@capgo/cli 7.41.1 → 7.41.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,83 +1,83 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var LF=Object.create;var Js=Object.defineProperty;var jF=Object.getOwnPropertyDescriptor;var UF=Object.getOwnPropertyNames;var MF=Object.getPrototypeOf,qF=Object.prototype.hasOwnProperty;var rt=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Wr=(t,e)=>{for(var r in e)Js(t,r,{get:e[r],enumerable:!0})},_D=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of UF(e))!qF.call(t,o)&&o!==r&&Js(t,o,{get:()=>e[o],enumerable:!(n=jF(e,o))||n.enumerable});return t};var de=(t,e,r)=>(r=t!=null?LF(MF(t)):{},_D(e||!t||!t.__esModule?Js(r,"default",{value:t,enumerable:!0}):r,t)),oe=t=>_D(Js({},"__esModule",{value:!0}),t);var ba=S(Sf=>{var Xs=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},_f=class extends Xs{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Sf.CommanderError=Xs;Sf.InvalidArgumentError=_f});var Zs=S(Af=>{var{InvalidArgumentError:HF}=ba(),xf=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new HF(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function VF(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Af.Argument=xf;Af.humanReadableArgName=VF});var kf=S(Ff=>{var{humanReadableArgName:zF}=Zs(),Of=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(e,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(e.createOption(n.long,n.description)):n.short&&!o&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>zF(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(d,p){return r.formatItem(d,n,p,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let h=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),a.join(`
3
- `)}displayWidth(e){return SD(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,o){let a=" ".repeat(2);if(!n)return a+e;let s=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,d;return l<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,l).replace(/\n/g,`
2
+ "use strict";var e2=Object.create;var Zs=Object.defineProperty;var t2=Object.getOwnPropertyDescriptor;var r2=Object.getOwnPropertyNames;var n2=Object.getPrototypeOf,o2=Object.prototype.hasOwnProperty;var Xe=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Yr=(t,e)=>{for(var r in e)Zs(t,r,{get:e[r],enumerable:!0})},Fy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of r2(e))!o2.call(t,o)&&o!==r&&Zs(t,o,{get:()=>e[o],enumerable:!(n=t2(e,o))||n.enumerable});return t};var ue=(t,e,r)=>(r=t!=null?e2(n2(t)):{},Fy(e||!t||!t.__esModule?Zs(r,"default",{value:t,enumerable:!0}):r,t)),oe=t=>Fy(Zs({},"__esModule",{value:!0}),t);var va=S(Ff=>{var Qs=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},Of=class extends Qs{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ff.CommanderError=Qs;Ff.InvalidArgumentError=Of});var eu=S(Pf=>{var{InvalidArgumentError:i2}=va(),kf=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new i2(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function a2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Pf.Argument=kf;Pf.humanReadableArgName=a2});var Tf=S(If=>{var{humanReadableArgName:s2}=eu(),$f=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(o=>!o._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(e,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(o=>!o.hidden),n=e._getHelpOption();if(n&&!n.hidden){let o=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(e.createOption(n.long,n.description)):n.short&&!o&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>s2(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(d,p){return r.formatItem(d,n,p,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let h=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),a.join(`
3
+ `)}displayWidth(e){return ky(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,o){let a=" ".repeat(2);if(!n)return a+e;let s=e.padEnd(r+e.length-o.displayWidth(e)),u=2,l=(this.helpWidth??80)-r-u-2,d;return l<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,l).replace(/\n/g,`
4
4
  `+" ".repeat(r+u)),a+s+" ".repeat(u)+d.replace(/\n/g,`
5
5
  ${a}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(a=>{let s=a.match(o);if(s===null){i.push("");return}let u=[s.shift()],c=this.displayWidth(u[0]);s.forEach(l=>{let d=this.displayWidth(l);if(c+d<=r){u.push(l),c+=d;return}i.push(u.join(""));let p=l.trimStart();u=[p],c=this.displayWidth(p)}),i.push(u.join(""))}),i.join(`
6
- `)}};function SD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Ff.Help=Of;Ff.stripColor=SD});var If=S(Tf=>{var{InvalidArgumentError:KF}=ba(),Pf=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=GF(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new KF(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?xD(this.name().replace(/^no-/,"")):xD(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},$f=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===e)}};function xD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function GF(t){let e,r,n=/^-[^-]$/,o=/^--[^-]/,i=t.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(e=i.shift()),o.test(i[0])&&(r=i.shift()),!e&&n.test(i[0])&&(e=i.shift()),!e&&o.test(i[0])&&(e=r,r=i.shift()),i[0].startsWith("-")){let a=i[0],s=`option creation failed due to '${a}' in option flags '${t}'`;throw/^-[^-][^-]/.test(a)?new Error(`${s}
6
+ `)}};function ky(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}If.Help=$f;If.stripColor=ky});var Lf=S(Nf=>{var{InvalidArgumentError:u2}=va(),Rf=class{constructor(e,r){this.flags=e,this.description=r||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=c2(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let r=e;return typeof e=="string"&&(r={[e]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new u2(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Py(this.name().replace(/^no-/,"")):Py(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Bf=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===e)}};function Py(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function c2(t){let e,r,n=/^-[^-]$/,o=/^--[^-]/,i=t.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(e=i.shift()),o.test(i[0])&&(r=i.shift()),!e&&n.test(i[0])&&(e=i.shift()),!e&&o.test(i[0])&&(e=r,r=i.shift()),i[0].startsWith("-")){let a=i[0],s=`option creation failed due to '${a}' in option flags '${t}'`;throw/^-[^-][^-]/.test(a)?new Error(`${s}
7
7
  - a short flag is a single dash and a single character
8
8
  - either use a single dash and a single character (for a short flag)
9
9
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(a)?new Error(`${s}
10
10
  - too many short flags`):o.test(a)?new Error(`${s}
11
11
  - too many long flags`):new Error(`${s}
12
- - unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Tf.Option=Pf;Tf.DualOptions=$f});var OD=S(AD=>{function WF(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=t.length;o++){let i=1;t[o-1]===e[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[t.length][e.length]}function YF(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(a=>a.slice(2)));let n=[],o=3,i=.4;return e.forEach(a=>{if(a.length<=1)return;let s=WF(t,a),u=Math.max(t.length,a.length);(u-s)/u>i&&(s<o?(o=s,n=[a]):s===o&&n.push(a))}),n.sort((a,s)=>a.localeCompare(s)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
12
+ - unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}Nf.Option=Rf;Nf.DualOptions=Bf});var Iy=S($y=>{function l2(t,e){if(Math.abs(t.length-e.length)>3)return Math.max(t.length,e.length);let r=[];for(let n=0;n<=t.length;n++)r[n]=[n];for(let n=0;n<=e.length;n++)r[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=t.length;o++){let i=1;t[o-1]===e[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[t.length][e.length]}function f2(t,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let r=t.startsWith("--");r&&(t=t.slice(2),e=e.map(a=>a.slice(2)));let n=[],o=3,i=.4;return e.forEach(a=>{if(a.length<=1)return;let s=l2(t,a),u=Math.max(t.length,a.length);(u-s)/u>i&&(s<o?(o=s,n=[a]):s===o&&n.push(a))}),n.sort((a,s)=>a.localeCompare(s)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
13
13
  (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
14
- (Did you mean ${n[0]}?)`:""}AD.suggestSimilar=YF});var $D=S(jf=>{var JF=require("node:events").EventEmitter,Rf=require("node:child_process"),Yr=require("node:path"),Qs=require("node:fs"),ve=require("node:process"),{Argument:XF,humanReadableArgName:ZF}=Zs(),{CommanderError:Bf}=ba(),{Help:QF,stripColor:e2}=kf(),{Option:FD,DualOptions:t2}=If(),{suggestSimilar:kD}=OD(),Nf=class t extends JF{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>ve.stdout.write(r),writeErr:r=>ve.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ve.stdout.isTTY?ve.stdout.columns:void 0,getErrHelpWidth:()=>ve.stderr.isTTY?ve.stderr.columns:void 0,getOutHasColors:()=>Lf()??(ve.stdout.isTTY&&ve.stdout.hasColors?.()),getErrHasColors:()=>Lf()??(ve.stderr.isTTY&&ve.stderr.hasColors?.()),stripColor:r=>e2(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,a,s]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),i.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(i.noHelp||i.hidden),u._executableFile=i.executableFile||null,s&&u.arguments(s),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new t(e)}createHelp(){return Object.assign(new QF,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
- - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new XF(e,r)}argument(e,r,n,o){let i=this.createArgument(e,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),a=r??"display help for command",s=this.createCommand(o);return s.helpOption(!1),i&&s.arguments(i),a&&s.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=s,(e||r)&&this._initCommandGroup(s),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
- Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new Bf(e,r,n)),ve.exit(e)}action(e){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=r,this}createOption(e,r){return new FD(e,r)}_callParseArg(e,r,n,o){try{return e.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let a=`${o} ${i.message}`;this.error(a,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
- - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=o=>[o.name()].concat(o.aliases()),n=r(e).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(i,a,s)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,a):i!==null&&e.variadic&&(i=e._collectValue(i,u)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,s)};return this.on("option:"+r,i=>{let a=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,a,"cli")}),e.envVar&&this.on("optionEnv:"+r,i=>{let a=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,a,"env")}),this}_optionEx(e,r,n,o,i){if(typeof r=="object"&&r instanceof FD)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(i).argParser(o);else if(o instanceof RegExp){let s=o;o=(u,c)=>{let l=s.exec(u);return l?l[0]:c},a.default(i).argParser(o)}else a.default(o);return this.addOption(a)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ve.versions?.electron&&(r.from="electron");let o=ve.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ve.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ve.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(Qs.existsSync(e))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
14
+ (Did you mean ${n[0]}?)`:""}$y.suggestSimilar=f2});var Ny=S(Hf=>{var d2=require("node:events").EventEmitter,jf=require("node:child_process"),Jr=require("node:path"),tu=require("node:fs"),ve=require("node:process"),{Argument:p2,humanReadableArgName:h2}=eu(),{CommanderError:Uf}=va(),{Help:m2,stripColor:g2}=Tf(),{Option:Ty,DualOptions:y2}=Lf(),{suggestSimilar:Ry}=Iy(),Mf=class t extends d2{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>ve.stdout.write(r),writeErr:r=>ve.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>ve.stdout.isTTY?ve.stdout.columns:void 0,getErrHelpWidth:()=>ve.stderr.isTTY?ve.stderr.columns:void 0,getOutHasColors:()=>qf()??(ve.stdout.isTTY&&ve.stdout.hasColors?.()),getErrHasColors:()=>qf()??(ve.stderr.isTTY&&ve.stderr.hasColors?.()),stripColor:r=>g2(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let r=this;r;r=r.parent)e.push(r);return e}command(e,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,a,s]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),i.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(i.noHelp||i.hidden),u._executableFile=i.executableFile||null,s&&u.arguments(s),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new t(e)}createHelp(){return Object.assign(new m2,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,r){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
15
+ - specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=e._name),(r.noHelp||r.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,r){return new p2(e,r)}argument(e,r,n,o){let i=this.createArgument(e,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(e){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,r){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=e??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),a=r??"display help for command",s=this.createCommand(o);return s.helpOption(!1),i&&s.arguments(i),a&&s.description(a),this._addImplicitHelpCommand=!0,this._helpCommand=s,(e||r)&&this._initCommandGroup(s),this}addHelpCommand(e,r){return typeof e!="object"?(this.helpCommand(e,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
16
+ Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(r):this._lifeCycleHooks[e]=[r],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(e,r,n){this._exitCallback&&this._exitCallback(new Uf(e,r,n)),ve.exit(e)}action(e){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),e.apply(this,i)};return this._actionHandler=r,this}createOption(e,r){return new Ty(e,r)}_callParseArg(e,r,n,o){try{return e.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let a=`${o} ${i.message}`;this.error(a,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
17
+ - already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=o=>[o.name()].concat(o.aliases()),n=r(e).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(e).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let i=e.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let o=(i,a,s)=>{i==null&&e.presetArg!==void 0&&(i=e.presetArg);let u=this.getOptionValue(n);i!==null&&e.parseArg?i=this._callParseArg(e,i,u,a):i!==null&&e.variadic&&(i=e._collectValue(i,u)),i==null&&(e.negate?i=!1:e.isBoolean()||e.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,s)};return this.on("option:"+r,i=>{let a=`error: option '${e.flags}' argument '${i}' is invalid.`;o(i,a,"cli")}),e.envVar&&this.on("optionEnv:"+r,i=>{let a=`error: option '${e.flags}' value '${i}' from env '${e.envVar}' is invalid.`;o(i,a,"env")}),this}_optionEx(e,r,n,o,i){if(typeof r=="object"&&r instanceof Ty)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(i).argParser(o);else if(o instanceof RegExp){let s=o;o=(u,c)=>{let l=s.exec(u);return l?l[0]:c},a.default(i).argParser(o)}else a.default(o);return this.addOption(a)}option(e,r,n,o){return this._optionEx({},e,r,n,o)}requiredOption(e,r,n,o){return this._optionEx({mandatory:!0},e,r,n,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){ve.versions?.electron&&(r.from="electron");let o=ve.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=ve.argv),this.rawArgs=e.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":ve.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return this._parseCommand([],n),this}async parseAsync(e,r){this._prepareForParse();let n=this._prepareUserArgs(e,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
18
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,r,n){if(tu.existsSync(e))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${e}' does not exist
19
19
  - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
20
20
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
21
- - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,d){let p=Yr.resolve(l,d);if(Qs.existsSync(p))return p;if(o.includes(Yr.extname(d)))return;let h=o.find(m=>Qs.existsSync(`${p}${m}`));if(h)return`${p}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Qs.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Yr.resolve(Yr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let d=Yr.basename(this._scriptPath,Yr.extname(this._scriptPath));d!==this._name&&(l=i(s,`${d}-${e._name}`))}a=l||a}n=o.includes(Yr.extname(a));let u;ve.platform!=="win32"?n?(r.unshift(a),r=PD(ve.execArgv).concat(r),u=Rf.spawn(ve.argv[0],r,{stdio:"inherit"})):u=Rf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=PD(ve.execArgv).concat(r),u=Rf.spawn(ve.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ve.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Bf(l,"commander.executeSubCommandAsync","(close)")):ve.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(l.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)ve.exit(1);else{let d=new Bf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=l,c(d)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let a=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(s&&(!i(l)||a(l))){this.emit(`option:${s.name()}`,l);continue}if(s=null,i(l)){let d=this._findOption(l);if(d){if(d.required){let p=e[c++];p===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,p)}else if(d.optional){let p=null;c<e.length&&(!i(e[c])||a(e[c]))&&(p=e[c++]),this.emit(`option:${d.name()}`,p)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let d=this._findOption(`-${l[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,l.slice(2)):(this.emit(`option:${d.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let d=l.indexOf("="),p=this._findOption(l.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,l.slice(d+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&a(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
21
+ - ${o}`;throw new Error(i)}_executeSubCommand(e,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,d){let p=Jr.resolve(l,d);if(tu.existsSync(p))return p;if(o.includes(Jr.extname(d)))return;let h=o.find(m=>tu.existsSync(`${p}${m}`));if(h)return`${p}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=tu.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Jr.resolve(Jr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let d=Jr.basename(this._scriptPath,Jr.extname(this._scriptPath));d!==this._name&&(l=i(s,`${d}-${e._name}`))}a=l||a}n=o.includes(Jr.extname(a));let u;ve.platform!=="win32"?n?(r.unshift(a),r=By(ve.execArgv).concat(r),u=jf.spawn(ve.argv[0],r,{stdio:"inherit"})):u=jf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=By(ve.execArgv).concat(r),u=jf.spawn(ve.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{ve.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Uf(l,"commander.executeSubCommandAsync","(close)")):ve.exit(l)}),u.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(l.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)ve.exit(1);else{let d=new Uf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=l,c(d)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let a=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let l=u??e[c++];if(u=null,l==="--"){o===n&&o.push(l),o.push(...e.slice(c));break}if(s&&(!i(l)||a(l))){this.emit(`option:${s.name()}`,l);continue}if(s=null,i(l)){let d=this._findOption(l);if(d){if(d.required){let p=e[c++];p===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,p)}else if(d.optional){let p=null;c<e.length&&(!i(e[c])||a(e[c]))&&(p=e[c++]),this.emit(`option:${d.name()}`,p)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let d=this._findOption(`-${l[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,l.slice(2)):(this.emit(`option:${d.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let d=l.indexOf("="),p=this._findOption(l.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,l.slice(d+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&a(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){o.push(l,...e.slice(c));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,r)=>Object.assign(e,r.opts()),{})}error(e,r){this._outputConfiguration.outputError(`${e}
22
22
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
23
23
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
24
- `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ve.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ve.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new t2(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(d=>d.negate&&s===d.attributeName()),l=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||a},o=a=>{let s=n(a),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},i=`error: ${o(e)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let a=i.createHelp().visibleOptions(i).filter(s=>s.long).map(s=>s.long);o=o.concat(a),i=i.parent}while(i&&!i._enablePositionalOptions);r=kD(e,o)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=kD(e,o)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
- `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>ZF(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Yr.basename(e,Yr.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let r=!!e.error,n,o,i;return r?(n=s=>this._outputConfiguration.writeErr(s),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=s=>this._outputConfiguration.writeOut(s),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:s=>(o||(s=this._outputConfiguration.stripColor(s)),n(s)),hasColors:o,helpWidth:i}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ve.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
24
+ `),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in ve.env){let r=e.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,ve.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new y2(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(d=>d.negate&&s===d.attributeName()),l=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:l||a},o=a=>{let s=n(a),u=s.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},i=`error: ${o(e)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let a=i.createHelp().visibleOptions(i).filter(s=>s.long).map(s=>s.long);o=o.concat(a),i=i.parent}while(i&&!i._enablePositionalOptions);r=Ry(e,o)}let n=`error: unknown option '${e}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=Ry(e,o)}let n=`error: unknown command '${e}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(e,r,n){if(e===void 0)return this._version;this._version=e,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
25
+ `),this._exit(0,"commander.version",e)}),this}description(e,r){return e===void 0&&r===void 0?this._description:(this._description=e,r&&(this._argsDescription=r),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),e===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(e);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(r=>this.alias(r)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>h2(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=Jr.basename(e,Jr.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let r=this.createHelp(),n=this._getOutputContext(e);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(e){e=e||{};let r=!!e.error,n,o,i;return r?(n=s=>this._outputConfiguration.writeErr(s),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=s=>this._outputConfiguration.writeOut(s),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:s=>(o||(s=this._outputConfiguration.stripColor(s)),n(s)),hasColors:o,helpWidth:i}}outputHelp(e){let r;typeof e=="function"&&(r=e,e=void 0);let n=this._getOutputContext(e),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(a=>a.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(a=>a.emit("afterAllHelp",o))}helpOption(e,r){return typeof e=="boolean"?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",r??"display help for command"),(e||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let r=Number(ve.exitCode??0);r===0&&e&&typeof e!="function"&&e.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(e,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
26
26
  Expecting one of '${n.join("', '")}'`);let o=`${e}Help`;return this.on(o,i=>{let a;typeof r=="function"?a=r({error:i.error,command:i.command}):a=r,a&&i.write(`${a}
27
- `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function PD(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:e})}function Lf(){if(ve.env.NO_COLOR||ve.env.FORCE_COLOR==="0"||ve.env.FORCE_COLOR==="false")return!1;if(ve.env.FORCE_COLOR||ve.env.CLICOLOR_FORCE!==void 0)return!0}jf.Command=Nf;jf.useColor=Lf});var BD=S(tr=>{var{Argument:TD}=Zs(),{Command:Uf}=$D(),{CommanderError:r2,InvalidArgumentError:ID}=ba(),{Help:n2}=kf(),{Option:RD}=If();tr.program=new Uf;tr.createCommand=t=>new Uf(t);tr.createOption=(t,e)=>new RD(t,e);tr.createArgument=(t,e)=>new TD(t,e);tr.Command=Uf;tr.Option=RD;tr.Argument=TD;tr.Help=n2;tr.CommanderError=r2;tr.InvalidArgumentError=ID;tr.InvalidOptionArgumentError=ID});var qf=S((aq,LD)=>{"use strict";var Mf={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},i2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},a2={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?Mf.up():"");return t&&(e+=Mf.left),e}};LD.exports={cursor:Mf,scroll:i2,erase:a2,beep:"\x07"}});var Vf=S((sq,Hf)=>{var tu=process||{},jD=tu.argv||[],eu=tu.env||{},s2=!(eu.NO_COLOR||jD.includes("--no-color"))&&(!!eu.FORCE_COLOR||jD.includes("--color")||tu.platform==="win32"||(tu.stdout||{}).isTTY&&eu.TERM!=="dumb"||!!eu.CI),u2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+c2(o,e,r,i)+e:t+o+e},c2=(t,e,r,n)=>{let o="",i=0;do o+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return o+t.substring(i)},UD=(t=s2)=>{let e=t?u2:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Hf.exports=UD();Hf.exports.createColors=UD});var lu=S(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.isNXMonorepo=Rt.isMonorepo=Rt.findPackageRelativePathInMonorepo=Rt.findPackagePath=Rt.findNXMonorepoRoot=Rt.findMonorepoRoot=void 0;var Ea=require("node:fs"),bn=require("node:path");function cu(t){let e=(0,bn.join)(t,"package.json"),r=(0,bn.join)(t,"pnpm-workspace.yaml");if((0,Ea.existsSync)(r)||(0,Ea.existsSync)(e)&&JSON.parse((0,Ea.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,bn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return cu(n)}Rt.findMonorepoRoot=cu;function nd(t){let e=(0,bn.join)(t,"nx.json");if((0,Ea.existsSync)(e))return t;let r=(0,bn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return nd(r)}Rt.findNXMonorepoRoot=nd;function od(t,e,r){let n=(0,bn.join)(e,"node_modules",t);if((0,Ea.existsSync)(n))return n;if(e===r)return null;let o=(0,bn.dirname)(e);return od(t,o,r)}Rt.findPackagePath=od;function M2(t,e){let r=cu(e),n=od(t,e,r);return n?(0,bn.relative)(e,n):null}Rt.findPackageRelativePathInMonorepo=M2;function q2(t){try{return cu(t),!0}catch{return!1}}Rt.isMonorepo=q2;function H2(t){try{return nd(t),!0}catch{return!1}}Rt.isNXMonorepo=H2});var pe={};Wr(pe,{__addDisposableResource:()=>Hy,__assign:()=>Du,__asyncDelegator:()=>Ry,__asyncGenerator:()=>Iy,__asyncValues:()=>By,__await:()=>Go,__awaiter:()=>Oy,__classPrivateFieldGet:()=>Uy,__classPrivateFieldIn:()=>qy,__classPrivateFieldSet:()=>My,__createBinding:()=>bu,__decorate:()=>vy,__disposeResources:()=>Vy,__esDecorate:()=>Cy,__exportStar:()=>ky,__extends:()=>by,__generator:()=>Fy,__importDefault:()=>jy,__importStar:()=>Ly,__makeTemplateObject:()=>Ny,__metadata:()=>Ay,__param:()=>Ey,__propKey:()=>Sy,__read:()=>pd,__rest:()=>wy,__rewriteRelativeImportExtension:()=>zy,__runInitializers:()=>_y,__setFunctionName:()=>xy,__spread:()=>Py,__spreadArray:()=>Ty,__spreadArrays:()=>$y,__values:()=>yu,default:()=>pk});function by(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function wy(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function vy(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function Ey(t,e){return function(r,n){e(r,n,t)}}function Cy(t,e,r,n,o,i){function a(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(E){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(E||null))};var D=(0,r[h])(s==="accessor"?{get:l.get,set:l.set}:l[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(d=a(D.get))&&(l.get=d),(d=a(D.set))&&(l.set=d),(d=a(D.init))&&o.unshift(d)}else(d=a(D))&&(s==="field"?o.unshift(d):l[u]=d)}c&&Object.defineProperty(c,n.name,l),p=!0}function _y(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function Sy(t){return typeof t=="symbol"?t:"".concat(t)}function xy(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function Ay(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function Oy(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{c(n.next(l))}catch(d){a(d)}}function u(l){try{c(n.throw(l))}catch(d){a(d)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function Fy(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function ky(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&bu(e,t,r)}function yu(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function pd(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function Py(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(pd(arguments[e]));return t}function $y(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function Ty(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Go(t){return this instanceof Go?(this.v=t,this):new Go(t)}function Iy(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,d)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(D,E){i.push([h,b,D,E])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){p(i[0][3],b)}}function c(h){h.value instanceof Go?Promise.resolve(h.value.v).then(l,d):p(i[0][2],h)}function l(h){u("next",h)}function d(h){u("throw",h)}function p(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Ry(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:Go(t[o](a)),done:!1}:i?i(a):a}:i}}function By(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof yu=="function"?yu(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function Ny(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Ly(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=dd(t),n=0;n<r.length;n++)r[n]!=="default"&&bu(e,t,r[n]);return fk(e,t),e}function jy(t){return t&&t.__esModule?t:{default:t}}function Uy(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function My(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function qy(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function Hy(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function Vy(t){function e(i){t.error=t.hasError?new dk(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function zy(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,i,a){return n?e?".jsx":".js":o&&(!i||!a)?r:o+i+"."+a.toLowerCase()+"js"}):t}var fd,Du,bu,fk,dd,dk,pk,he=rt(()=>{fd=function(t,e){return fd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},fd(t,e)};Du=function(){return Du=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Du.apply(this,arguments)};bu=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});fk=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},dd=function(t){return dd=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},dd(t)};dk=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};pk={__extends:by,__assign:Du,__rest:wy,__decorate:vy,__param:Ey,__esDecorate:Cy,__runInitializers:_y,__propKey:Sy,__setFunctionName:xy,__metadata:Ay,__awaiter:Oy,__generator:Fy,__createBinding:bu,__exportStar:ky,__values:yu,__read:pd,__spread:Py,__spreadArrays:$y,__spreadArray:Ty,__await:Go,__asyncGenerator:Iy,__asyncDelegator:Ry,__asyncValues:By,__makeTemplateObject:Ny,__importStar:Ly,__importDefault:jy,__classPrivateFieldGet:Uy,__classPrivateFieldSet:My,__classPrivateFieldIn:qy,__addDisposableResource:Hy,__disposeResources:Vy,__rewriteRelativeImportExtension:zy}});var Ky=S(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.resolveFetch=void 0;var hk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);wu.resolveFetch=hk});var Dd=S(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.FunctionRegion=nr.FunctionsHttpError=nr.FunctionsRelayError=nr.FunctionsFetchError=nr.FunctionsError=void 0;var Wo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};nr.FunctionsError=Wo;var hd=class extends Wo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};nr.FunctionsFetchError=hd;var md=class extends Wo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};nr.FunctionsRelayError=md;var gd=class extends Wo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};nr.FunctionsHttpError=gd;var Gy;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Gy||(nr.FunctionRegion=Gy={}))});var Wy=S(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.FunctionsClient=void 0;var mk=(he(),oe(pe)),gk=Ky(),Yo=Dd(),yd=class{constructor(e,{headers:r={},customFetch:n,region:o=Yo.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,gk.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return mk.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:l,timeout:d}=n,p={},{region:h}=n;h||(h=this.region);let m=new URL(`${this.url}/${r}`);h&&h!=="any"&&(p["x-region"]=h,m.searchParams.set("forceFunctionRegion",h));let b;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",b=c):typeof c=="string"?(p["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(p["Content-Type"]="application/json",b=JSON.stringify(c)):b=c;let D=l;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),l?(D=a.signal,l.addEventListener("abort",()=>a.abort())):D=a.signal);let E=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),s),body:b,signal:D}).catch(x=>{throw new Yo.FunctionsFetchError(x)}),C=E.headers.get("x-relay-error");if(C&&C==="true")throw new Yo.FunctionsRelayError(E);if(!E.ok)throw new Yo.FunctionsHttpError(E);let g=((o=E.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),_;return g==="application/json"?_=yield E.json():g==="application/octet-stream"||g==="application/pdf"?_=yield E.blob():g==="text/event-stream"?_=E:g==="multipart/form-data"?_=yield E.formData():_=yield E.text(),{data:_,error:null,response:E}}catch(s){return{data:null,error:s,response:s instanceof Yo.FunctionsHttpError||s instanceof Yo.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};vu.FunctionsClient=yd});var bd=S(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.FunctionRegion=Bt.FunctionsRelayError=Bt.FunctionsHttpError=Bt.FunctionsFetchError=Bt.FunctionsError=Bt.FunctionsClient=void 0;var Dk=Wy();Object.defineProperty(Bt,"FunctionsClient",{enumerable:!0,get:function(){return Dk.FunctionsClient}});var Aa=Dd();Object.defineProperty(Bt,"FunctionsError",{enumerable:!0,get:function(){return Aa.FunctionsError}});Object.defineProperty(Bt,"FunctionsFetchError",{enumerable:!0,get:function(){return Aa.FunctionsFetchError}});Object.defineProperty(Bt,"FunctionsHttpError",{enumerable:!0,get:function(){return Aa.FunctionsHttpError}});Object.defineProperty(Bt,"FunctionsRelayError",{enumerable:!0,get:function(){return Aa.FunctionsRelayError}});Object.defineProperty(Bt,"FunctionRegion",{enumerable:!0,get:function(){return Aa.FunctionRegion}})});var Ed=S(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});var wd=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};vd.default=wd});var Sd=S(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});var yk=(he(),oe(pe)),bk=yk.__importDefault(Ed()),Cd=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,o=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,s,u,c;let l=null,d=null,p=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let C=await i.text();C===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?d=C:d=JSON.parse(C))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),E=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&E&&E.length>1&&(p=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(l={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,p=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(d=[],l=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):l={message:D}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,h=200,m="OK"),l&&this.shouldThrowOnError)throw new bk.default(l)}return{error:l,data:d,count:p,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,l,d;let p="",h=i?.cause;if(h){let m=(a=h?.message)!==null&&a!==void 0?a:"",b=(s=h?.code)!==null&&s!==void 0?s:"";p=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,p+=`
27
+ `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function By(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:e})}function qf(){if(ve.env.NO_COLOR||ve.env.FORCE_COLOR==="0"||ve.env.FORCE_COLOR==="false")return!1;if(ve.env.FORCE_COLOR||ve.env.CLICOLOR_FORCE!==void 0)return!0}Hf.Command=Mf;Hf.useColor=qf});var My=S(rr=>{var{Argument:Ly}=eu(),{Command:Vf}=Ny(),{CommanderError:D2,InvalidArgumentError:jy}=va(),{Help:b2}=Tf(),{Option:Uy}=Lf();rr.program=new Vf;rr.createCommand=t=>new Vf(t);rr.createOption=(t,e)=>new Uy(t,e);rr.createArgument=(t,e)=>new Ly(t,e);rr.Command=Vf;rr.Option=Uy;rr.Argument=Ly;rr.Help=b2;rr.CommanderError=D2;rr.InvalidArgumentError=jy;rr.InvalidOptionArgumentError=jy});var Kf=S((Cq,Hy)=>{"use strict";var zf={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},v2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},C2={screen:"\x1B[2J",up:(t=1)=>"\x1B[1J".repeat(t),down:(t=1)=>"\x1B[J".repeat(t),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(t){let e="";for(let r=0;r<t;r++)e+=this.line+(r<t-1?zf.up():"");return t&&(e+=zf.left),e}};Hy.exports={cursor:zf,scroll:v2,erase:C2,beep:"\x07"}});var Wf=S((Eq,Gf)=>{var nu=process||{},Vy=nu.argv||[],ru=nu.env||{},E2=!(ru.NO_COLOR||Vy.includes("--no-color"))&&(!!ru.FORCE_COLOR||Vy.includes("--color")||nu.platform==="win32"||(nu.stdout||{}).isTTY&&ru.TERM!=="dumb"||!!ru.CI),_2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+S2(o,e,r,i)+e:t+o+e},S2=(t,e,r,n)=>{let o="",i=0;do o+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return o+t.substring(i)},zy=(t=E2)=>{let e=t?_2:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Gf.exports=zy();Gf.exports.createColors=zy});var du=S(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.isNXMonorepo=Rt.isMonorepo=Rt.findPackageRelativePathInMonorepo=Rt.findPackagePath=Rt.findNXMonorepoRoot=Rt.findMonorepoRoot=void 0;var _a=require("node:fs"),vn=require("node:path");function fu(t){let e=(0,vn.join)(t,"package.json"),r=(0,vn.join)(t,"pnpm-workspace.yaml");if((0,_a.existsSync)(r)||(0,_a.existsSync)(e)&&JSON.parse((0,_a.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,vn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return fu(n)}Rt.findMonorepoRoot=fu;function sd(t){let e=(0,vn.join)(t,"nx.json");if((0,_a.existsSync)(e))return t;let r=(0,vn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return sd(r)}Rt.findNXMonorepoRoot=sd;function ud(t,e,r){let n=(0,vn.join)(e,"node_modules",t);if((0,_a.existsSync)(n))return n;if(e===r)return null;let o=(0,vn.dirname)(e);return ud(t,o,r)}Rt.findPackagePath=ud;function nk(t,e){let r=fu(e),n=ud(t,e,r);return n?(0,vn.relative)(e,n):null}Rt.findPackageRelativePathInMonorepo=nk;function ok(t){try{return fu(t),!0}catch{return!1}}Rt.isMonorepo=ok;function ik(t){try{return sd(t),!0}catch{return!1}}Rt.isNXMonorepo=ik});var pe={};Yr(pe,{__addDisposableResource:()=>WD,__assign:()=>bu,__asyncDelegator:()=>UD,__asyncGenerator:()=>jD,__asyncValues:()=>MD,__await:()=>Yo,__awaiter:()=>ID,__classPrivateFieldGet:()=>zD,__classPrivateFieldIn:()=>GD,__classPrivateFieldSet:()=>KD,__createBinding:()=>vu,__decorate:()=>xD,__disposeResources:()=>YD,__esDecorate:()=>OD,__exportStar:()=>RD,__extends:()=>_D,__generator:()=>TD,__importDefault:()=>VD,__importStar:()=>HD,__makeTemplateObject:()=>qD,__metadata:()=>$D,__param:()=>AD,__propKey:()=>kD,__read:()=>yd,__rest:()=>SD,__rewriteRelativeImportExtension:()=>JD,__runInitializers:()=>FD,__setFunctionName:()=>PD,__spread:()=>BD,__spreadArray:()=>LD,__spreadArrays:()=>ND,__values:()=>wu,default:()=>Fk});function _D(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");md(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function SD(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function xD(t,e,r,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function AD(t,e){return function(r,n){e(r,n,t)}}function OD(t,e,r,n,o,i){function a(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var m={};for(var b in n)m[b]=b==="access"?{}:n[b];for(var b in n.access)m.access[b]=n.access[b];m.addInitializer=function(C){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||null))};var y=(0,r[h])(s==="accessor"?{get:l.get,set:l.set}:l[u],m);if(s==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=a(y.get))&&(l.get=d),(d=a(y.set))&&(l.set=d),(d=a(y.init))&&o.unshift(d)}else(d=a(y))&&(s==="field"?o.unshift(d):l[u]=d)}c&&Object.defineProperty(c,n.name,l),p=!0}function FD(t,e,r){for(var n=arguments.length>2,o=0;o<e.length;o++)r=n?e[o].call(t,r):e[o].call(t);return n?r:void 0}function kD(t){return typeof t=="symbol"?t:"".concat(t)}function PD(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function $D(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ID(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function s(l){try{c(n.next(l))}catch(d){a(d)}}function u(l){try{c(n.throw(l))}catch(d){a(d)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function TD(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function RD(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&vu(e,t,r)}function wu(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function yd(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return i}function BD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(yd(arguments[e]));return t}function ND(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),o=0,e=0;e<r;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)n[o]=i[a];return n}function LD(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Yo(t){return this instanceof Yo?(this.v=t,this):new Yo(t)}function jD(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,d)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(y,C){i.push([h,b,y,C])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){p(i[0][3],b)}}function c(h){h.value instanceof Yo?Promise.resolve(h.value.v).then(l,d):p(i[0][2],h)}function l(h){u("next",h)}function d(h){u("throw",h)}function p(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function UD(t){var e,r;return e={},n("next"),n("throw",function(o){throw o}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(o,i){e[o]=t[o]?function(a){return(r=!r)?{value:Yo(t[o](a)),done:!1}:i?i(a):a}:i}}function MD(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof wu=="function"?wu(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function qD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function HD(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=gd(t),n=0;n<r.length;n++)r[n]!=="default"&&vu(e,t,r[n]);return Ak(e,t),e}function VD(t){return t&&t.__esModule?t:{default:t}}function zD(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function KD(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function GD(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function WD(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],r&&(o=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");o&&(n=function(){try{o.call(this)}catch(i){return Promise.reject(i)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function YD(t){function e(i){t.error=t.hasError?new Ok(i,t.error,"An error was suppressed during disposal."):i,t.hasError=!0}var r,n=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var i=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(i).then(o,function(a){return e(a),o()})}else n|=1}catch(a){e(a)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function JD(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,o,i,a){return n?e?".jsx":".js":o&&(!i||!a)?r:o+i+"."+a.toLowerCase()+"js"}):t}var md,bu,vu,Ak,gd,Ok,Fk,he=Xe(()=>{md=function(t,e){return md=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},md(t,e)};bu=function(){return bu=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},bu.apply(this,arguments)};vu=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});Ak=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},gd=function(t){return gd=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},gd(t)};Ok=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Fk={__extends:_D,__assign:bu,__rest:SD,__decorate:xD,__param:AD,__esDecorate:OD,__runInitializers:FD,__propKey:kD,__setFunctionName:PD,__metadata:$D,__awaiter:ID,__generator:TD,__createBinding:vu,__exportStar:RD,__values:wu,__read:yd,__spread:BD,__spreadArrays:ND,__spreadArray:LD,__await:Yo,__asyncGenerator:jD,__asyncDelegator:UD,__asyncValues:MD,__makeTemplateObject:qD,__importStar:HD,__importDefault:VD,__classPrivateFieldGet:zD,__classPrivateFieldSet:KD,__classPrivateFieldIn:GD,__addDisposableResource:WD,__disposeResources:YD,__rewriteRelativeImportExtension:JD}});var XD=S(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.resolveFetch=void 0;var kk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Cu.resolveFetch=kk});var vd=S(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.FunctionRegion=or.FunctionsHttpError=or.FunctionsRelayError=or.FunctionsFetchError=or.FunctionsError=void 0;var Jo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};or.FunctionsError=Jo;var Dd=class extends Jo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};or.FunctionsFetchError=Dd;var bd=class extends Jo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};or.FunctionsRelayError=bd;var wd=class extends Jo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};or.FunctionsHttpError=wd;var ZD;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(ZD||(or.FunctionRegion=ZD={}))});var QD=S(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});Eu.FunctionsClient=void 0;var Pk=(he(),oe(pe)),$k=XD(),Xo=vd(),Cd=class{constructor(e,{headers:r={},customFetch:n,region:o=Xo.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,$k.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Pk.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:l,timeout:d}=n,p={},{region:h}=n;h||(h=this.region);let m=new URL(`${this.url}/${r}`);h&&h!=="any"&&(p["x-region"]=h,m.searchParams.set("forceFunctionRegion",h));let b;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",b=c):typeof c=="string"?(p["Content-Type"]="text/plain",b=c):typeof FormData<"u"&&c instanceof FormData?b=c:(p["Content-Type"]="application/json",b=JSON.stringify(c)):b=c;let y=l;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),l?(y=a.signal,l.addEventListener("abort",()=>a.abort())):y=a.signal);let C=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),s),body:b,signal:y}).catch(x=>{throw new Xo.FunctionsFetchError(x)}),E=C.headers.get("x-relay-error");if(E&&E==="true")throw new Xo.FunctionsRelayError(C);if(!C.ok)throw new Xo.FunctionsHttpError(C);let g=((o=C.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),_;return g==="application/json"?_=yield C.json():g==="application/octet-stream"||g==="application/pdf"?_=yield C.blob():g==="text/event-stream"?_=C:g==="multipart/form-data"?_=yield C.formData():_=yield C.text(),{data:_,error:null,response:C}}catch(s){return{data:null,error:s,response:s instanceof Xo.FunctionsHttpError||s instanceof Xo.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};Eu.FunctionsClient=Cd});var Ed=S(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.FunctionRegion=Bt.FunctionsRelayError=Bt.FunctionsHttpError=Bt.FunctionsFetchError=Bt.FunctionsError=Bt.FunctionsClient=void 0;var Ik=QD();Object.defineProperty(Bt,"FunctionsClient",{enumerable:!0,get:function(){return Ik.FunctionsClient}});var Fa=vd();Object.defineProperty(Bt,"FunctionsError",{enumerable:!0,get:function(){return Fa.FunctionsError}});Object.defineProperty(Bt,"FunctionsFetchError",{enumerable:!0,get:function(){return Fa.FunctionsFetchError}});Object.defineProperty(Bt,"FunctionsHttpError",{enumerable:!0,get:function(){return Fa.FunctionsHttpError}});Object.defineProperty(Bt,"FunctionsRelayError",{enumerable:!0,get:function(){return Fa.FunctionsRelayError}});Object.defineProperty(Bt,"FunctionRegion",{enumerable:!0,get:function(){return Fa.FunctionRegion}})});var xd=S(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var _d=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Sd.default=_d});var Fd=S(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Tk=(he(),oe(pe)),Rk=Tk.__importDefault(xd()),Ad=class{constructor(e){var r,n;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(r=e.shouldThrowOnError)!==null&&r!==void 0?r:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,r){return this.headers=new Headers(this.headers),this.headers.set(e,r),this}then(e,r){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let n=this.fetch,o=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var a,s,u,c;let l=null,d=null,p=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let E=await i.text();E===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}let y=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),C=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");y&&C&&C.length>1&&(p=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(l={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,p=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let y=await i.text();try{l=JSON.parse(y),Array.isArray(l)&&i.status===404&&(d=[],l=null,h=200,m="OK")}catch{i.status===404&&y===""?(h=204,m="No Content"):l={message:y}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,h=200,m="OK"),l&&this.shouldThrowOnError)throw new Rk.default(l)}return{error:l,data:d,count:p,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,l,d;let p="",h=i?.cause;if(h){let m=(a=h?.message)!==null&&a!==void 0?a:"",b=(s=h?.code)!==null&&s!==void 0?s:"";p=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,p+=`
28
28
 
29
29
  Caused by: ${(c=h?.name)!==null&&c!==void 0?c:"Error"}: ${m}`,b&&(p+=` (${b})`),h?.stack&&(p+=`
30
- ${h.stack}`)}else p=(l=i?.stack)!==null&&l!==void 0?l:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:p,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};_d.default=Cd});var Od=S(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});var wk=(he(),oe(pe)),vk=wk.__importDefault(Sd()),xd=class extends vk.default{select(e){let r=!1,n=(e??"*").split("").map(o=>/\s/.test(o)&&!r?"":(o==='"'&&(r=!r),o)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:o,referencedTable:i=o}={}){let a=i?`${i}.order`:"order",s=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${s?`${s},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:o=n}={}){let i=typeof o>"u"?"offset":`${o}.offset`,a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:o=!1,wal:i=!1,format:a="text"}={}){var s;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,o?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(s=this.headers.get("Accept"))!==null&&s!==void 0?s:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${u};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Ad.default=xd});var Eu=S(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var Ek=(he(),oe(pe)),Ck=Ek.__importDefault(Od()),_k=new RegExp("[,()]"),Fd=class extends Ck.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&_k.test(o)?`"${o}"`:`${o}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:o}={}){let i="";o==="plain"?i="pl":o==="phrase"?i="ph":o==="websearch"&&(i="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let o=n?`${n}.or`:"or";return this.url.searchParams.append(o,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};kd.default=Fd});var Td=S($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var Sk=(he(),oe(pe)),Oa=Sk.__importDefault(Eu()),Pd=class{constructor(e,{headers:r={},schema:n,fetch:o}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=o}select(e,r){let{head:n=!1,count:o}=r??{},i=n?"HEAD":"GET",a=!1,s=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join("");return this.url.searchParams.set("select",s),o&&this.headers.append("Prefer",`count=${o}`),new Oa.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var o;let i="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let a=e.reduce((s,u)=>s.concat(Object.keys(u)),[]);if(a.length>0){let s=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",s.join(","))}}return new Oa.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:o,defaultToNull:i=!0}={}){var a;let s="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new Oa.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new Oa.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new Oa.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};$d.default=Pd});var Jy=S(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});var Yy=(he(),oe(pe)),xk=Yy.__importDefault(Td()),Ak=Yy.__importDefault(Eu()),Id=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new xk.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([d,p])=>p!==void 0).map(([d,p])=>[d,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([d,p])=>{u.searchParams.append(d,p)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new Ak.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Rd.default=Id});var Bd=S(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.PostgrestError=At.PostgrestBuilder=At.PostgrestTransformBuilder=At.PostgrestFilterBuilder=At.PostgrestQueryBuilder=At.PostgrestClient=void 0;var Jo=(he(),oe(pe)),Xy=Jo.__importDefault(Jy());At.PostgrestClient=Xy.default;var Zy=Jo.__importDefault(Td());At.PostgrestQueryBuilder=Zy.default;var Qy=Jo.__importDefault(Eu());At.PostgrestFilterBuilder=Qy.default;var e0=Jo.__importDefault(Od());At.PostgrestTransformBuilder=e0.default;var t0=Jo.__importDefault(Sd());At.PostgrestBuilder=t0.default;var r0=Jo.__importDefault(Ed());At.PostgrestError=r0.default;At.default={PostgrestClient:Xy.default,PostgrestQueryBuilder:Zy.default,PostgrestFilterBuilder:Qy.default,PostgrestTransformBuilder:e0.default,PostgrestBuilder:t0.default,PostgrestError:r0.default}});var Ld={};Wr(Ld,{RealtimeClient:()=>Nd});var Nd,jd=rt(()=>{Nd=class{constructor(){}connect(){}disconnect(){}}});var vn=S(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.StorageUnknownError=Xr.StorageApiError=Xr.StorageError=void 0;Xr.isStorageError=Ok;var Fa=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Xr.StorageError=Fa;function Ok(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ud=class extends Fa{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Xr.StorageApiError=Ud;var Md=class extends Fa{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Xr.StorageUnknownError=Md});var ka=S(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.isPlainObject=or.recursiveToCamel=or.resolveResponse=or.resolveFetch=void 0;var Fk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);or.resolveFetch=Fk;var kk=()=>Response;or.resolveResponse=kk;var Pk=t=>{if(Array.isArray(t))return t.map(r=>(0,or.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let o=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[o]=(0,or.recursiveToCamel)(n)}),e};or.recursiveToCamel=Pk;var $k=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};or.isPlainObject=$k});var Cu=S(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.get=Rk;Yn.post=Bk;Yn.put=Nk;Yn.head=Lk;Yn.remove=jk;var Wn=(he(),oe(pe)),qd=vn(),n0=ka(),Hd=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Tk=(t,e,r)=>Wn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,n0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new qd.StorageApiError(Hd(o),i,a))}).catch(o=>{e(new qd.StorageUnknownError(Hd(o),o))}):e(new qd.StorageUnknownError(Hd(t),t))}),Ik=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,n0.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,e?.duplex&&(o.duplex=e.duplex),Object.assign(Object.assign({},o),r))};function Pa(t,e,r,n,o,i){return Wn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Ik(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>Tk(u,s,n))})})}function Rk(t,e,r,n){return Wn.__awaiter(this,void 0,void 0,function*(){return Pa(t,"GET",e,r,n)})}function Bk(t,e,r,n,o){return Wn.__awaiter(this,void 0,void 0,function*(){return Pa(t,"POST",e,n,o,r)})}function Nk(t,e,r,n,o){return Wn.__awaiter(this,void 0,void 0,function*(){return Pa(t,"PUT",e,n,o,r)})}function Lk(t,e,r,n){return Wn.__awaiter(this,void 0,void 0,function*(){return Pa(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function jk(t,e,r,n,o){return Wn.__awaiter(this,void 0,void 0,function*(){return Pa(t,"DELETE",e,n,o,r)})}});var o0=S(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var Uk=(he(),oe(pe)),Mk=vn(),Vd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return Uk.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,Mk.isStorageError)(e))return{data:null,error:e};throw e}})}};zd.default=Vd});var s0=S(Gd=>{"use strict";var i0;Object.defineProperty(Gd,"__esModule",{value:!0});var a0=(he(),oe(pe)),qk=vn(),Hk=a0.__importDefault(o0()),Kd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[i0]="BlobDownloadBuilder",this.promise=null}asStream(){return new Hk.default(this.downloadFn,this.shouldThrowOnError)}then(e,r){return this.getPromise().then(e,r)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return a0.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,qk.isStorageError)(e))return{data:null,error:e};throw e}})}};i0=Symbol.toStringTag;Gd.default=Kd});var l0=S(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var Ot=(he(),oe(pe)),Nt=vn(),Lt=Cu(),u0=ka(),Vk=Ot.__importDefault(s0()),zk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},c0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Wd=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,u0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return Ot.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},c0),o),s=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,u&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),o?.headers&&(s=Object.assign(Object.assign({},s),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),d=yield(e=="PUT"?Lt.put:Lt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Nt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return Ot.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",r);try{let u,c=Object.assign({upsert:c0.upsert},o),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let d=yield(0,Lt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Nt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return Ot.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=Object.assign({},this.headers);r?.upsert&&(o["x-upsert"]="true");let i=yield(0,Lt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),a=new URL(this.url+i.url),s=a.searchParams.get("token");if(!s)throw new Nt.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Lt.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Lt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Lt.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}download(e,r){let o=typeof r?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(r?.transform||{}),a=i?`?${i}`:"",s=this._getFinalPath(e),u=()=>(0,Lt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new Vk.default(u,this.shouldThrowOnError)}info(e){return Ot.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Lt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,u0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return Ot.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Lt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n)&&n instanceof Nt.StorageUnknownError){let o=n.originalError;if([400,404].includes(o?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),o=[],i=r?.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&o.push(i);let s=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&o.push(u);let c=o.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${c}`)}}}remove(e){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},zk),r),{prefix:e||""});return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},n),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return Ot.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}};Yd.default=Wd});var Jd=S(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.version=void 0;_u.version="2.84.0"});var Xd=S(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.DEFAULT_HEADERS=void 0;var Kk=Jd();Su.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Kk.version}`}});var f0=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var Xo=(he(),oe(pe)),Gk=Xd(),Zo=vn(),Qo=Cu(),Wk=ka(),Zd=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1;let i=new URL(e);o?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Gk.DEFAULT_HEADERS),r),this.fetch=(0,Wk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Xo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Qo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Zo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Xo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Qo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Zo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Xo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Qo.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Zo.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return Xo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Qo.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Zo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Xo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Qo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Zo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Xo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Qo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Zo.isStorageError)(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){let r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}};Qd.default=Zd});var ip=S(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var ep=(he(),oe(pe)),Yk=Xd(),tp=vn(),rp=Cu(),Jk=ka(),np=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Yk.DEFAULT_HEADERS),r),this.fetch=(0,Jk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return ep.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,rp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,tp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return ep.__awaiter(this,void 0,void 0,function*(){try{let r=new URLSearchParams;e?.limit!==void 0&&r.set("limit",e.limit.toString()),e?.offset!==void 0&&r.set("offset",e.offset.toString()),e?.sortColumn&&r.set("sortColumn",e.sortColumn),e?.sortOrder&&r.set("sortOrder",e.sortOrder),e?.search&&r.set("search",e.search);let n=r.toString(),o=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,rp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,tp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ep.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,rp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,tp.isStorageError)(r))return{data:null,error:r};throw r}})}};op.default=np});var Au=S(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DEFAULT_HEADERS=void 0;var Xk=Jd();xu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Xk.version}`,"Content-Type":"application/json"}});var ei=S(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.StorageVectorsErrorCode=Er.StorageVectorsUnknownError=Er.StorageVectorsApiError=Er.StorageVectorsError=void 0;Er.isStorageVectorsError=Zk;var $a=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Er.StorageVectorsError=$a;function Zk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var ap=class extends $a{constructor(e,r,n){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Er.StorageVectorsApiError=ap;var sp=class extends $a{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Er.StorageVectorsUnknownError=sp;var d0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(d0||(Er.StorageVectorsErrorCode=d0={}))});var ti=S(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.validateVectorDimension=ir.normalizeToFloat32=ir.isPlainObject=ir.resolveResponse=ir.resolveFetch=void 0;var Qk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);ir.resolveFetch=Qk;var eP=()=>Response;ir.resolveResponse=eP;var tP=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};ir.isPlainObject=tP;var rP=t=>Array.from(new Float32Array(t));ir.normalizeToFloat32=rP;var nP=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};ir.validateVectorDimension=nP});var ku=S(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.get=sP;ni.post=uP;ni.put=cP;ni.remove=lP;var ri=(he(),oe(pe)),Ou=ei(),oP=ti(),p0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),iP=(t,e,r)=>ri.__awaiter(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let o=t.status||500,i=t;if(typeof i.json=="function")i.json().then(a=>{let s=a?.statusCode||a?.code||o+"";e(new Ou.StorageVectorsApiError(p0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Ou.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Ou.StorageVectorsApiError(s,o,a))}}else e(new Ou.StorageVectorsUnknownError(p0(t),t))}),aP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,oP.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,Object.assign(Object.assign({},o),r))};function Fu(t,e,r,n,o,i){return ri.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,aP(e,n,o,i)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>a(u)).catch(u=>iP(u,s,n))})})}function sP(t,e,r,n){return ri.__awaiter(this,void 0,void 0,function*(){return Fu(t,"GET",e,r,n)})}function uP(t,e,r,n,o){return ri.__awaiter(this,void 0,void 0,function*(){return Fu(t,"POST",e,n,o,r)})}function cP(t,e,r,n,o){return ri.__awaiter(this,void 0,void 0,function*(){return Fu(t,"PUT",e,n,o,r)})}function lP(t,e,r,n,o){return ri.__awaiter(this,void 0,void 0,function*(){return Fu(t,"DELETE",e,n,o,r)})}});var lp=S(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var Pu=(he(),oe(pe)),fP=Au(),$u=ei(),Tu=ku(),dP=ti(),up=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},fP.DEFAULT_HEADERS),r),this.fetch=(0,dP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Tu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Tu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,$u.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Tu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$u.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Tu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,$u.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};cp.default=up});var pp=S(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});var Ta=(he(),oe(pe)),pP=Au(),Ia=ei(),Ra=ku(),hP=ti(),fp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},pP.DEFAULT_HEADERS),r),this.fetch=(0,hP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ta.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,Ra.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ia.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Ta.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ra.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ia.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Ta.__awaiter(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield(0,Ra.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ia.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Ta.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ra.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ia.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Ta.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,Ra.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ia.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};dp.default=fp});var gp=S(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Iu=(he(),oe(pe)),mP=Au(),Ru=ei(),Bu=ku(),gP=ti(),hp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mP.DEFAULT_HEADERS),r),this.fetch=(0,gP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Bu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Iu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Bu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Bu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};mp.default=hp});var h0=S(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.VectorIndexScope=En.VectorBucketScope=En.StorageVectorsClient=void 0;var ar=(he(),oe(pe)),DP=ar.__importDefault(lp()),yP=ar.__importDefault(pp()),bP=ar.__importDefault(gp()),Dp=class extends bP.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Nu(this.url,this.headers,e,this.fetch)}};En.StorageVectorsClient=Dp;var Nu=class extends DP.default{constructor(e,r,n,o){super(e,r,o),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return ar.__awaiter(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return ar.__awaiter(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return ar.__awaiter(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return ar.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Lu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};En.VectorBucketScope=Nu;var Lu=class extends yP.default{constructor(e,r,n,o,i){super(e,r,i),this.vectorBucketName=n,this.indexName=o}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return ar.__awaiter(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return ar.__awaiter(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return ar.__awaiter(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return ar.__awaiter(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return ar.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};En.VectorIndexScope=Lu});var wp=S(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.validateVectorDimension=me.normalizeToFloat32=me.isPlainObject=me.resolveResponse=me.resolveFetch=me.isStorageVectorsError=me.StorageVectorsErrorCode=me.StorageVectorsUnknownError=me.StorageVectorsApiError=me.StorageVectorsError=me.VectorDataApi=me.VectorIndexApi=me.VectorBucketApi=me.VectorIndexScope=me.VectorBucketScope=me.StorageVectorsClient=void 0;var yp=(he(),oe(pe)),bp=h0();Object.defineProperty(me,"StorageVectorsClient",{enumerable:!0,get:function(){return bp.StorageVectorsClient}});Object.defineProperty(me,"VectorBucketScope",{enumerable:!0,get:function(){return bp.VectorBucketScope}});Object.defineProperty(me,"VectorIndexScope",{enumerable:!0,get:function(){return bp.VectorIndexScope}});var wP=gp();Object.defineProperty(me,"VectorBucketApi",{enumerable:!0,get:function(){return yp.__importDefault(wP).default}});var vP=lp();Object.defineProperty(me,"VectorIndexApi",{enumerable:!0,get:function(){return yp.__importDefault(vP).default}});var EP=pp();Object.defineProperty(me,"VectorDataApi",{enumerable:!0,get:function(){return yp.__importDefault(EP).default}});var Ba=ei();Object.defineProperty(me,"StorageVectorsError",{enumerable:!0,get:function(){return Ba.StorageVectorsError}});Object.defineProperty(me,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ba.StorageVectorsApiError}});Object.defineProperty(me,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ba.StorageVectorsUnknownError}});Object.defineProperty(me,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ba.StorageVectorsErrorCode}});Object.defineProperty(me,"isStorageVectorsError",{enumerable:!0,get:function(){return Ba.isStorageVectorsError}});var Na=ti();Object.defineProperty(me,"resolveFetch",{enumerable:!0,get:function(){return Na.resolveFetch}});Object.defineProperty(me,"resolveResponse",{enumerable:!0,get:function(){return Na.resolveResponse}});Object.defineProperty(me,"isPlainObject",{enumerable:!0,get:function(){return Na.isPlainObject}});Object.defineProperty(me,"normalizeToFloat32",{enumerable:!0,get:function(){return Na.normalizeToFloat32}});Object.defineProperty(me,"validateVectorDimension",{enumerable:!0,get:function(){return Na.validateVectorDimension}})});var m0=S(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.StorageClient=void 0;var Ep=(he(),oe(pe)),CP=Ep.__importDefault(l0()),_P=Ep.__importDefault(f0()),SP=Ep.__importDefault(ip()),xP=wp(),vp=class extends _P.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new CP.default(this.url,this.headers,e,this.fetch)}get vectors(){return new xP.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new SP.default(this.url+"/iceberg",this.headers,this.fetch)}};ju.StorageClient=vp});var D0=S(g0=>{"use strict";Object.defineProperty(g0,"__esModule",{value:!0})});var y0=S(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.StorageAnalyticsClient=Zr.StorageClient=void 0;var Uu=(he(),oe(pe)),AP=m0();Object.defineProperty(Zr,"StorageClient",{enumerable:!0,get:function(){return AP.StorageClient}});var OP=ip();Object.defineProperty(Zr,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Uu.__importDefault(OP).default}});Uu.__exportStar(D0(),Zr);Uu.__exportStar(vn(),Zr);Uu.__exportStar(wp(),Zr)});var b0=S(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.version=void 0;Mu.version="2.84.0"});var w0=S(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.DEFAULT_REALTIME_OPTIONS=Gt.DEFAULT_AUTH_OPTIONS=Gt.DEFAULT_DB_OPTIONS=Gt.DEFAULT_GLOBAL_OPTIONS=Gt.DEFAULT_HEADERS=void 0;var FP=b0(),La="";typeof Deno<"u"?La="deno":typeof document<"u"?La="web":typeof navigator<"u"&&navigator.product==="ReactNative"?La="react-native":La="node";Gt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${La}/${FP.version}`};Gt.DEFAULT_GLOBAL_OPTIONS={headers:Gt.DEFAULT_HEADERS};Gt.DEFAULT_DB_OPTIONS={schema:"public"};Gt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Gt.DEFAULT_REALTIME_OPTIONS={}});var v0=S(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.fetchWithAuth=kr.resolveHeadersConstructor=kr.resolveFetch=void 0;var kP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);kr.resolveFetch=kP;var PP=()=>Headers;kr.resolveHeadersConstructor=PP;var $P=(t,e,r)=>{let n=(0,kr.resolveFetch)(r),o=(0,kr.resolveHeadersConstructor)();return async(i,a)=>{var s;let u=(s=await e())!==null&&s!==void 0?s:t,c=new o(a?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},a),{headers:c}))}};kr.fetchWithAuth=$P});var C0=S(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.isBrowser=void 0;Cn.uuid=TP;Cn.ensureTrailingSlash=E0;Cn.applySettingDefaults=RP;Cn.validateSupabaseUrl=BP;function TP(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t=="x"?e:e&3|8;return r.toString(16)})}function E0(t){return t.endsWith("/")?t:t+"/"}var IP=()=>typeof window<"u";Cn.isBrowser=IP;function RP(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:d}=e,p={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function BP(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(E0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Rp={};Wr(Rp,{AuthAdminApi:()=>_p,AuthApiError:()=>Sp,AuthClient:()=>Cp,AuthError:()=>Cr,AuthImplicitGrantRedirectError:()=>kp,AuthInvalidCredentialsError:()=>Fp,AuthInvalidTokenResponseError:()=>Op,AuthPKCEGrantCodeExchangeError:()=>Pp,AuthRetryableError:()=>xp,AuthSessionMissingError:()=>Ap,AuthWeakPasswordError:()=>$p,GoTrueAdminApi:()=>Hu,GoTrueClient:()=>qu,NavigatorLockAcquireTimeoutError:()=>Tp,isAuthApiError:()=>MP,isAuthError:()=>UP,isAuthRetryableError:()=>qP,isAuthSessionMissingError:()=>HP,isAuthWeakPasswordError:()=>VP,lockInternals:()=>jP,navigatorLock:()=>NP,processLock:()=>LP});var Ip,_0,qu,Hu,Cp,_p,Cr,Sp,xp,Ap,Op,Fp,kp,Pp,$p,NP,LP,Tp,jP,UP,MP,qP,HP,VP,Bp=rt(()=>{Ip=()=>Promise.resolve({data:{session:null,user:null},error:null}),_0={get:(t,e)=>{if(e==="constructor")return t.constructor;if(!(e==="then"||e==="catch"||e==="finally")&&typeof e!="symbol")return e==="getSession"?()=>Promise.resolve({data:{session:null,user:null},error:null}):e==="onAuthStateChange"?()=>({data:{subscription:{unsubscribe:()=>{}}},error:null}):Ip}},qu=class{constructor(e){return this.options=e,new Proxy(this,_0)}},Hu=class{constructor(e){return this.options=e,new Proxy(this,_0)}},Cp=class extends qu{},_p=class extends Hu{},Cr=class extends Error{},Sp=class extends Cr{},xp=class extends Cr{},Ap=class extends Cr{},Op=class extends Cr{},Fp=class extends Cr{},kp=class extends Cr{},Pp=class extends Cr{},$p=class extends Cr{},NP=Ip,LP=Ip,Tp=class extends Error{},jP={},UP=()=>!1,MP=()=>!1,qP=()=>!1,HP=()=>!1,VP=()=>!1});var S0=S(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});Vu.SupabaseAuthClient=void 0;var zP=(Bp(),oe(Rp)),Np=class extends zP.AuthClient{constructor(e){super(e)}};Vu.SupabaseAuthClient=Np});var Up=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var KP=bd(),GP=Bd(),WP=(jd(),oe(Ld)),YP=y0(),zu=w0(),JP=v0(),x0=C0(),XP=S0(),Lp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,x0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let u=`sb-${s.hostname.split(".")[0]}-auth-token`,c={db:zu.DEFAULT_DB_OPTIONS,realtime:zu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},zu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:zu.DEFAULT_GLOBAL_OPTIONS},l=(0,x0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,JP.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new GP.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new YP.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new KP.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,storageKey:a,flowType:s,lock:u,debug:c,throwOnError:l},d,p){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new XP.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new WP.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};jp.default=Lp});var F0=S(Re=>{"use strict";var ZP=Re&&Re.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),A0=Re&&Re.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ZP(e,t,r)},O0=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.createClient=Re.SupabaseClient=Re.FunctionRegion=Re.FunctionsError=Re.FunctionsRelayError=Re.FunctionsFetchError=Re.FunctionsHttpError=Re.PostgrestError=void 0;var QP=O0(Up());A0((Bp(),oe(Rp)),Re);var e3=Bd();Object.defineProperty(Re,"PostgrestError",{enumerable:!0,get:function(){return e3.PostgrestError}});var ja=bd();Object.defineProperty(Re,"FunctionsHttpError",{enumerable:!0,get:function(){return ja.FunctionsHttpError}});Object.defineProperty(Re,"FunctionsFetchError",{enumerable:!0,get:function(){return ja.FunctionsFetchError}});Object.defineProperty(Re,"FunctionsRelayError",{enumerable:!0,get:function(){return ja.FunctionsRelayError}});Object.defineProperty(Re,"FunctionsError",{enumerable:!0,get:function(){return ja.FunctionsError}});Object.defineProperty(Re,"FunctionRegion",{enumerable:!0,get:function(){return ja.FunctionRegion}});A0((jd(),oe(Ld)),Re);var t3=Up();Object.defineProperty(Re,"SupabaseClient",{enumerable:!0,get:function(){return O0(t3).default}});var r3=(t,e,r)=>new QP.default(t,e,r);Re.createClient=r3;function n3(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}n3()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var Mp=S((tz,k0)=>{k0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Ku=S($0=>{var P0={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function o3(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(P0))$0[t]=o3(P0[t])});var N0=S((nz,B0)=>{var i3=require("fs"),nt=require("path"),T0=Mp(),a3=Ku(),s3=typeof process=="object"&&process.platform==="win32",I0=t=>typeof t=="object"&&t!==null,R0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function We(t){this.sep=nt.sep,this.fs=i3,I0(t)&&I0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}B0.exports=We;We.prototype.makeDir=function(t){let e=this;function r(n){let o=n.split(e.sep)[0];n.split(e.sep).forEach(function(i){if(!(!i||i.substr(-1,1)===":")){o+=e.sep+i;var a;try{a=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(a&&a.isFile())throw a3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};We.prototype.writeFileTo=function(t,e,r,n){let o=this;if(o.fs.existsSync(t)){if(!r)return!1;var i=o.fs.statSync(t);if(i.isDirectory())return!1}var a=nt.dirname(t);o.fs.existsSync(a)||o.makeDir(a);var s;try{s=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),s=o.fs.openSync(t,"w",438)}if(s)try{o.fs.writeSync(s,e,0,e.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(t,n||438),!0};We.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(a){if(a&&!r)return o(!1);i.fs.stat(t,function(s,u){if(a&&u.isDirectory())return o(!1);var c=nt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(d,p){d?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):p?i.fs.write(p,e,0,e.length,0,function(){i.fs.close(p,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};We.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let a=[];return e.fs.readdirSync(n).forEach(function(s){let u=nt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(nt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};We.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let a=i.length;if(!a)return e(null,n);i.forEach(function(s){s=nt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(nt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,d){if(l)return e(l);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};We.prototype.getAttributes=function(){};We.prototype.setAttributes=function(){};We.crc32update=function(t,e){return R0[(t^e)&255]^t>>>8};We.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=We.crc32update(r,t[n++]);return~r>>>0};We.methodToString=function(t){switch(t){case T0.STORED:return"STORED ("+t+")";case T0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};We.canonical=function(t){if(!t)return"";let e=nt.posix.normalize("/"+t.split("\\").join("/"));return nt.join(".",e)};We.zipnamefix=function(t){if(!t)return"";let e=nt.posix.normalize("/"+t.split("\\").join("/"));return nt.posix.join(".",e)};We.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};We.sanitize=function(t,e){t=nt.resolve(nt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=nt.normalize(nt.join(t,r.slice(n,o).join(nt.sep)));if(i.indexOf(t)===0)return i}return nt.normalize(nt.join(t,nt.basename(e)))};We.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};We.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};We.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};We.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};We.isWin=s3;We.crcTable=R0});var j0=S((oz,L0)=>{var u3=require("path");L0.exports=function(t,{fs:e}){var r=t||"",n=i(),o=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(o=e.statSync(r),n.directory=o.isDirectory(),n.mtime=o.mtime,n.atime=o.atime,n.executable=(73&o.mode)!==0,n.readonly=(128&o.mode)===0,n.hidden=u3.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var M0=S((iz,U0)=>{U0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var ii=S((az,oi)=>{oi.exports=N0();oi.exports.Constants=Mp();oi.exports.Errors=Ku();oi.exports.FileAttr=j0();oi.exports.decoder=M0()});var H0=S((sz,q0)=>{var _n=ii(),Y=_n.Constants;q0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,d=0,p=0,h=0,m=0;t|=_n.isWin?2560:768,r|=Y.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,E=g=>Math.max(0,g)&65535,C=g=>Math.max(0,g)&255;return o=_n.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(g){g?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(g){g?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(g){switch(g){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=g},get time(){return _n.fromDOS2Date(this.timeval)},set time(g){this.timeval=_n.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return C(o>>>8)},get crc(){return i},set crc(g){i=D(g)},get compressedSize(){return a},set compressedSize(g){a=D(g)},get size(){return s},set size(g){s=D(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return d},set diskNumStart(g){d=D(g)},get inAttr(){return p},set inAttr(g){p=D(g)},get attr(){return h},set attr(g){h=D(g)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(g){m=D(g)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return m+Y.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+Y.LOCHDR);if(_.readUInt32LE(0)!==Y.LOCSIG)throw _n.Errors.INVALID_LOC();b.version=_.readUInt16LE(Y.LOCVER),b.flags=_.readUInt16LE(Y.LOCFLG),b.method=_.readUInt16LE(Y.LOCHOW),b.time=_.readUInt32LE(Y.LOCTIM),b.crc=_.readUInt32LE(Y.LOCCRC),b.compressedSize=_.readUInt32LE(Y.LOCSIZ),b.size=_.readUInt32LE(Y.LOCLEN),b.fnameLen=_.readUInt16LE(Y.LOCNAM),b.extraLen=_.readUInt16LE(Y.LOCEXT);let x=m+Y.LOCHDR+b.fnameLen,$=x+b.extraLen;return g.slice(x,$)},loadFromBinary:function(g){if(g.length!==Y.CENHDR||g.readUInt32LE(0)!==Y.CENSIG)throw _n.Errors.INVALID_CEN();t=g.readUInt16LE(Y.CENVEM),e=g.readUInt16LE(Y.CENVER),r=g.readUInt16LE(Y.CENFLG),n=g.readUInt16LE(Y.CENHOW),o=g.readUInt32LE(Y.CENTIM),i=g.readUInt32LE(Y.CENCRC),a=g.readUInt32LE(Y.CENSIZ),s=g.readUInt32LE(Y.CENLEN),u=g.readUInt16LE(Y.CENNAM),c=g.readUInt16LE(Y.CENEXT),l=g.readUInt16LE(Y.CENCOM),d=g.readUInt16LE(Y.CENDSK),p=g.readUInt16LE(Y.CENATT),h=g.readUInt32LE(Y.CENATX),m=g.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(Y.LOCHDR);return g.writeUInt32LE(Y.LOCSIG,0),g.writeUInt16LE(e,Y.LOCVER),g.writeUInt16LE(r,Y.LOCFLG),g.writeUInt16LE(n,Y.LOCHOW),g.writeUInt32LE(o,Y.LOCTIM),g.writeUInt32LE(i,Y.LOCCRC),g.writeUInt32LE(a,Y.LOCSIZ),g.writeUInt32LE(s,Y.LOCLEN),g.writeUInt16LE(u,Y.LOCNAM),g.writeUInt16LE(b.extraLen,Y.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(Y.CENHDR+u+c+l);return g.writeUInt32LE(Y.CENSIG,0),g.writeUInt16LE(t,Y.CENVEM),g.writeUInt16LE(e,Y.CENVER),g.writeUInt16LE(r,Y.CENFLG),g.writeUInt16LE(n,Y.CENHOW),g.writeUInt32LE(o,Y.CENTIM),g.writeUInt32LE(i,Y.CENCRC),g.writeUInt32LE(a,Y.CENSIZ),g.writeUInt32LE(s,Y.CENLEN),g.writeUInt16LE(u,Y.CENNAM),g.writeUInt16LE(c,Y.CENEXT),g.writeUInt16LE(l,Y.CENCOM),g.writeUInt16LE(d,Y.CENDSK),g.writeUInt16LE(p,Y.CENATT),g.writeUInt32LE(h,Y.CENATX),g.writeUInt32LE(m,Y.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:_n.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(a),size:g(s),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:d,inAttr:p,attr:h,offset:m,centralHeaderSize:g(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var z0=S((uz,V0)=>{var ai=ii(),Ve=ai.Constants;V0.exports=function(){var t=0,e=0,r=0,n=0,o=0;return{get diskEntries(){return t},set diskEntries(i){t=e=i},get totalEntries(){return e},set totalEntries(i){e=t=i},get size(){return r},set size(i){r=i},get offset(){return n},set offset(i){n=i},get commentLength(){return o},set commentLength(i){o=i},get mainHeaderSize(){return Ve.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Ve.ENDHDR||i.readUInt32LE(0)!==Ve.ENDSIG)&&(i.length<Ve.ZIP64HDR||i.readUInt32LE(0)!==Ve.ZIP64SIG))throw ai.Errors.INVALID_END();i.readUInt32LE(0)===Ve.ENDSIG?(t=i.readUInt16LE(Ve.ENDSUB),e=i.readUInt16LE(Ve.ENDTOT),r=i.readUInt32LE(Ve.ENDSIZ),n=i.readUInt32LE(Ve.ENDOFF),o=i.readUInt16LE(Ve.ENDCOM)):(t=ai.readBigUInt64LE(i,Ve.ZIP64SUB),e=ai.readBigUInt64LE(i,Ve.ZIP64TOT),r=ai.readBigUInt64LE(i,Ve.ZIP64SIZE),n=ai.readBigUInt64LE(i,Ve.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Ve.ENDHDR+o);return i.writeUInt32LE(Ve.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Ve.ENDSUB),i.writeUInt16LE(e,Ve.ENDTOT),i.writeUInt32LE(r,Ve.ENDSIZ),i.writeUInt32LE(n,Ve.ENDOFF),i.writeUInt16LE(o,Ve.ENDCOM),i.fill(" ",Ve.ENDHDR),i},toJSON:function(){let i=function(a,s){let u=a.toString(16).toUpperCase();for(;u.length<s;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:i(n,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Hp=S(qp=>{qp.EntryHeader=H0();qp.MainHeader=z0()});var G0=S((lz,K0)=>{K0.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var o=e.createDeflateRaw(r),i=[],a=0;o.on("data",function(s){i.push(s),a+=s.length}),o.on("end",function(){var s=Buffer.alloc(a),u=0;s.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(s,u),u+=l.length}n&&n(s)}),o.end(t)}}}});var Y0=S((fz,W0)=>{var c3=+(process.versions?process.versions.node:"").split(".")[0]||0;W0.exports=function(t,e){var r=require("zlib");let n=c3>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),a=[],s=0;i.on("data",function(u){a.push(u),s+=u.length}),i.on("end",function(){var u=Buffer.alloc(s),c=0;u.fill(0);for(var l=0;l<a.length;l++){var d=a[l];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var eb=S((dz,Q0)=>{"use strict";var{randomFillSync:J0}=require("crypto"),l3=Ku(),f3=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),Z0=(t,e)=>Math.imul(t,e)>>>0,X0=(t,e)=>f3[(t^e)&255]^t>>>8,Ua=()=>typeof J0=="function"?J0(Buffer.alloc(12)):Ua.node();Ua.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Gu={genSalt:Ua};function Wu(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Wu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=X0(e[0],t),e[1]+=e[0]&255,e[1]=Z0(e[1],134775813)+1,e[2]=X0(e[2],e[1]>>>24),t};Wu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return Z0(t,t^1)>>8&255};function d3(t){let e=new Wu(t);return function(r){let n=Buffer.alloc(r.length),o=0;for(let i of r)n[o++]=e.updateKeys(i^e.next());return n}}function p3(t){let e=new Wu(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let a=e.next();n[o++]=i^a,e.updateKeys(i)}return n}}function h3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=d3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw l3.WRONG_PASSWORD();return n(t.slice(12))}function m3(t){Buffer.isBuffer(t)&&t.length>=12?Gu.genSalt=function(){return t.slice(0,12)}:t==="node"?Gu.genSalt=Ua.node:Gu.genSalt=Ua}function g3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=p3(r),i=Gu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let a=Buffer.alloc(t.length+12);return o(i,a),o(t,a,12)}Q0.exports={decrypt:h3,encrypt:g3,_salter:m3}});var tb=S(Yu=>{Yu.Deflater=G0();Yu.Inflater=Y0();Yu.ZipCrypto=eb()});var zp=S((hz,rb)=>{var Se=ii(),D3=Hp(),Ye=Se.Constants,Vp=tb();rb.exports=function(t,e){var r=new D3.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,d=typeof l.decoder=="object"?l.decoder:Se.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function p(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(g){if(r.flags_desc){let _={},x=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(x)==Ye.LOCSIG||e.readUInt32LE(x)==Ye.CENSIG)throw Se.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(x)==Ye.EXTSIG)_.crc=e.readUInt32LE(x+Ye.EXTCRC),_.compressedSize=e.readUInt32LE(x+Ye.EXTSIZ),_.size=e.readUInt32LE(x+Ye.EXTLEN);else if(e.readUInt16LE(x+12)===19280)_.crc=e.readUInt32LE(x+Ye.EXTCRC-4),_.compressedSize=e.readUInt32LE(x+Ye.EXTSIZ-4),_.size=e.readUInt32LE(x+Ye.EXTLEN-4);else throw Se.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw Se.Errors.DESCRIPTOR_FAULTY();if(Se.crc32(g)!==_.crc)return!1}else if(Se.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,x){if(typeof _>"u"&&typeof g=="string"&&(x=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),Se.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var $=p();if($.length===0)return g&&_&&_($),$;if(r.encrypted){if(typeof x!="string"&&!Buffer.isBuffer(x))throw Se.Errors.INVALID_PASS_PARAM();$=Vp.ZipCrypto.decrypt($,r,x)}var F=Buffer.alloc(r.size);switch(r.method){case Se.Constants.STORED:if($.copy(F),h(F))return g&&_&&_(F),F;throw g&&_&&_(F,Se.Errors.BAD_CRC()),Se.Errors.BAD_CRC();case Se.Constants.DEFLATED:var B=new Vp.Inflater($,r.size);if(g)B.inflateAsync(function(I){I.copy(I,0),_&&(h(I)?_(I):_(I,Se.Errors.BAD_CRC()))});else{if(B.inflate(F).copy(F,0),!h(F))throw Se.Errors.BAD_CRC(`"${d.decode(n)}"`);return F}break;default:throw g&&_&&_(Buffer.alloc(0),Se.Errors.UNKNOWN_METHOD()),Se.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(p()),p();if(a.length&&!i){var x;switch(r.method){case Se.Constants.STORED:return r.compressedSize=r.size,x=Buffer.alloc(a.length),a.copy(x),g&&_&&_(x),x;default:case Se.Constants.DEFLATED:var $=new Vp.Deflater(a);if(g)$.deflateAsync(function(B){x=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(x),_&&_(x)});else{var F=$.deflate();return r.compressedSize=F.length,F}$=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function E(g){try{for(var _=0,x,$,F;_+4<g.length;)x=g.readUInt16LE(_),_+=2,$=g.readUInt16LE(_),_+=2,F=g.slice(_,_+$),_+=$,Ye.ID_ZIP64===x&&C(F)}catch{throw Se.Errors.EXTRA_FIELD_PARSE_ERROR()}}function C(g){var _,x,$,F;g.length>=Ye.EF_ZIP64_SCOMP&&(_=D(g,Ye.EF_ZIP64_SUNCOMP),r.size===Ye.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ye.EF_ZIP64_RHO&&(x=D(g,Ye.EF_ZIP64_SCOMP),r.compressedSize===Ye.EF_ZIP64_OR_32&&(r.compressedSize=x)),g.length>=Ye.EF_ZIP64_DSN&&($=D(g,Ye.EF_ZIP64_RHO),r.offset===Ye.EF_ZIP64_OR_32&&(r.offset=$)),g.length>=Ye.EF_ZIP64_DSN+4&&(F=g.readUInt32LE(Ye.EF_ZIP64_DSN),r.diskNumStart===Ye.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(g){n=Se.toBuffer(g,d.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(g){s=g,r.extraLength=g.length,E(g)},get comment(){return d.decode(o)},set comment(g){if(o=Se.toBuffer(g,d.encode),r.commentLength=o.length,o.length>65535)throw Se.Errors.COMMENT_TOO_LONG()},get name(){var g=d.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){a=Se.toBuffer(g,Se.decoder.encode),!i&&a.length?(r.size=a.length,r.method=Se.Constants.DEFLATED,r.crc=Se.crc32(g),r.changed=!0):r.method=Se.Constants.STORED},getData:function(g){return r.changed?a:m(!1,null,g)},getDataAsync:function(g,_){r.changed?g(a):m(!0,g,_)},set attr(g){r.attr=g},get attr(){return r.attr},set header(g){r.loadFromBinary(g)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var g=r.centralHeaderToBinary(),_=Se.Constants.CENHDR;return n.copy(g,_),_+=n.length,s.copy(g,_),_+=r.extraLength,o.copy(g,_),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),x=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(x,g),g+=_.length,n.copy(x,g),g+=n.length,u.copy(x,g),g+=u.length,x},toJSON:function(){let g=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:g(e),data:g(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var ib=S((mz,ob)=>{var nb=zp(),y3=Hp(),ht=ii();ob.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new y3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:d}=c;t?m(c.readEntries):a=!0;function p(){let D=new Set;for(let E of Object.keys(n)){let C=E.split("/");if(C.pop(),!!C.length)for(let g=0;g<C.length;g++){let _=C.slice(0,g+1).join("/")+"/";D.add(_)}}for(let E of D)if(!(E in n)){let C=new nb(c);C.entryName=E,C.attr=16,C.temporary=!0,r.push(C),n[C.entryName]=C,u.add(C)}}function h(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/ht.Constants.CENHDR)throw ht.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,E=0;E<r.length;E++){var C=D,g=new nb(c,t);g.header=t.slice(C,C+=ht.Constants.CENHDR),g.entryName=t.slice(C,C+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(C,C+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(C,C+g.header.commentLength)),D+=g.header.centralHeaderSize,r[E]=g,n[g.entryName]=g}u.clear(),p()}function m(D){var E=t.length-ht.Constants.ENDHDR,C=Math.max(0,E-65535),g=C,_=t.length,x=-1,$=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(C=0),E;E>=g;E--)if(t[E]===80){if(t.readUInt32LE(E)===ht.Constants.ENDSIG){x=E,$=E,_=E+ht.Constants.ENDHDR,g=E-ht.Constants.END64HDR;continue}if(t.readUInt32LE(E)===ht.Constants.END64SIG){g=C;continue}if(t.readUInt32LE(E)===ht.Constants.ZIP64SIG){x=E,_=E+ht.readBigUInt64LE(t,E+ht.Constants.ZIP64SIZE)+ht.Constants.ZIP64LEAD;break}}if(x==-1)throw ht.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(x,_)),i.commentLength&&(o=t.slice($+ht.Constants.ENDHDR)),D&&h()}function b(){r.length>1&&!l&&r.sort((D,E)=>D.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return d.decode(o)},set comment(D){o=ht.toBuffer(D,d.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||h(),n[D]||null},setEntry:function(D){a||h(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,E=!0){a||h();let C=n[D];this.getEntryChildren(C,E).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let E=n[D],C=r.indexOf(E);C>=0&&(r.splice(C,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,E=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&E){let C=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&C.push(_);return C}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let E=this.getEntryChildren(D);return E.includes(D)?E.length-1:E.length}return 0},compressToBuffer:function(){a||h(),b();let D=[],E=[],C=0,g=0;i.size=0,i.offset=0;let _=0;for(let F of this.entries){let B=F.getCompressedData();F.header.offset=g;let I=F.packLocalHeader(),L=I.length+B.length;g+=L,D.push(I),D.push(B);let A=F.packCentralHeader();E.push(A),i.size+=A.length,C+=L+A.length,_++}C+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let x=Buffer.alloc(C);for(let F of D)F.copy(x,g),g+=F.length;for(let F of E)F.copy(x,g),g+=F.length;let $=i.toBinary();return o&&o.copy($,ht.Constants.ENDHDR),$.copy(x,g),t=x,a=!1,x},toAsyncBuffer:function(D,E,C,g){try{a||h(),b();let _=[],x=[],$=0,F=0,B=0;i.size=0,i.offset=0;let I=function(L){if(L.length>0){let A=L.shift(),j=A.entryName+A.extra.toString();C&&C(j),A.getCompressedDataAsync(function(M){g&&g(j),A.header.offset=F;let J=A.packLocalHeader(),k=J.length+M.length;F+=k,_.push(J),_.push(M);let y=A.packCentralHeader();x.push(y),i.size+=y.length,$+=k+y.length,B++,I(L)})}else{$+=i.mainHeaderSize,i.offset=F,i.totalEntries=B,F=0;let A=Buffer.alloc($);_.forEach(function(M){M.copy(A,F),F+=M.length}),x.forEach(function(M){M.copy(A,F),F+=M.length});let j=i.toBinary();o&&o.copy(j,ht.Constants.ENDHDR),j.copy(A,F),t=A,a=!1,D(A)}};I(Array.from(this.entries))}catch(_){E(_)}}}}});var Kp=S((gz,sb)=>{var ze=ii(),Je=require("path"),b3=zp(),w3=ib(),Jn=(...t)=>ze.findLast(t,e=>typeof e=="boolean"),ab=(...t)=>ze.findLast(t,e=>typeof e=="string"),v3=(...t)=>ze.findLast(t,e=>typeof e=="function"),E3={noSort:!1,readEntries:!1,method:ze.Constants.NONE,fs:null};sb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),E3);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=ze.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new ze(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=ze.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=ze.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw ze.Errors.INVALID_FILENAME();let i=new w3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=ze;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Je.posix.normalize(h))),typeof h=="object"&&typeof h.entryName<"u"&&typeof h.header<"u"&&(m=i.getEntry(h.entryName)),m)return m}return null}function l(h){let{join:m,normalize:b,sep:D}=Je.posix;return m(".",b(D+h.split("\\").join(D)+D))}function d(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let p=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",Je.relative(h,m)+b};return{readFile:function(h,m){var b=c(h);return b&&b.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var b=c(h);b?b.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var b=c(h);if(b){var D=b.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,b){var D=c(h);D?D.getDataAsync(function(E,C){if(C){m(E,C);return}E&&E.length?m(E.toString(b||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var b=c(h);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(h){var m=c(h);m&&i.deleteEntry(m.entryName)},addZipComment:function(h){i.comment=h},getZipComment:function(){return i.comment||""},addZipEntryComment:function(h,m){var b=c(h);b&&(b.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var b=c(h);b&&b.setData(m)},addLocalFile:function(h,m,b,D){if(o.fs.existsSync(h)){m=m?l(m):"";let E=Je.win32.basename(Je.win32.normalize(h));m+=b||E;let C=o.fs.statSync(h),g=C.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);C.isDirectory()&&(m+=o.sep),this.addFile(m,g,D,C)}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=Je.resolve(h.localPath),{comment:D}=h,{zipPath:E,zipName:C}=h,g=this;o.fs.stat(b,function(_,x){if(_)return m(_,!1);E=E?l(E):"";let $=Je.win32.basename(Je.win32.normalize(b));if(E+=C||$,x.isFile())o.fs.readFile(b,function(F,B){return F?m(F,!1):(g.addFile(E,B,D,x),setImmediate(m,void 0,!0))});else if(x.isDirectory())return E+=o.sep,g.addFile(E,Buffer.alloc(0),D,x),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=d(b),m=m?l(m):"",h=Je.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),E=this;if(D.length)for(let C of D){let g=Je.join(m,p(h,C));b(g)&&E.addLocalFile(C,Je.dirname(g))}}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,D){D=d(D),b=b?l(b):"",h=Je.normalize(h);var E=this;o.fs.open(h,"r",function(C){if(C&&C.code==="ENOENT")m(void 0,ze.Errors.FILE_NOT_FOUND(h));else if(C)m(void 0,C);else{var g=o.findFiles(h),_=-1,x=function(){if(_+=1,_<g.length){var $=g[_],F=p(h,$).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(F)?o.fs.stat($,function(B,I){B&&m(void 0,B),I.isFile()?o.fs.readFile($,function(L,A){L?m(void 0,L):(E.addFile(b+F,A,"",I),x())}):(E.addFile(b+F+"/",Buffer.alloc(0),"",I),x())}):process.nextTick(()=>{x()})}else m(!0,void 0)};x()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=Je.resolve(l(h.localPath));let{zipPath:D,filter:E,namefix:C}=h;E instanceof RegExp?E=(function(x){return function($){return x.test($)}})(E):typeof E!="function"&&(E=function(){return!0}),D=D?l(D):"",C=="latin1"&&(C=x=>x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof C!="function"&&(C=x=>x);let g=x=>Je.join(D,C(p(localPath,x))),_=x=>Je.win32.basename(Je.win32.normalize(C(x)));o.fs.open(localPath,"r",function(x){x&&x.code==="ENOENT"?m(void 0,ze.Errors.FILE_NOT_FOUND(localPath)):x?m(void 0,x):o.findFilesAsync(localPath,function($,F){if($)return m($);F=F.filter(B=>E(g(B))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(B,I){return function(L,A){if(L||A===!1)return setImmediate(B,L,!1);b.addLocalFileAsync({localPath:I,zipPath:Je.dirname(g(I)),zipName:_(I)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(E,C)=>{E&&D(E),C&&b(this)})})},addFile:function(h,m,b,D){h=u(h);let E=c(h),C=E!=null;C||(E=new b3(n),E.entryName=h),E.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(E.header.time=D.mtime);var _=E.isDirectory?16:0;let x=E.isDirectory?16384:32768;return g?x|=4095&D.mode:typeof D=="number"?x|=4095&D:x|=E.isDirectory?493:420,_=(_|x<<16)>>>0,E.attr=_,E.setData(m),C||i.setEntry(E),E},getEntries:function(h){return i.password=h,i?i.entries:[]},getEntry:function(h){return c(h)},getEntryCount:function(){return i.getEntryCount()},forEach:function(h){return i.forEach(h)},extractEntryTo:function(h,m,b,D,E,C){D=Jn(!1,D),E=Jn(!1,E),b=Jn(!0,b),C=ab(E,C);var g=c(h);if(!g)throw ze.Errors.NO_ENTRY();var _=a(g.entryName),x=s(m,C&&!g.isDirectory?C:b?_:Je.basename(_));if(g.isDirectory){var $=i.getEntryChildren(g);return $.forEach(function(I){if(I.isDirectory)return;var L=I.getData();if(!L)throw ze.Errors.CANT_EXTRACT_FILE();var A=a(I.entryName),j=s(m,b?A:Je.basename(A));let M=E?I.header.fileAttr:void 0;o.writeFileTo(j,L,D,M)}),!0}var F=g.getData(i.password);if(!F)throw ze.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(x)&&!D)throw ze.Errors.CANT_OVERRIDE();let B=E?h.header.fileAttr:void 0;return o.writeFileTo(x,F,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(h);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(h,m,b,D){if(b=Jn(!1,b),D=ab(b,D),m=Jn(!1,m),!i)throw ze.Errors.NO_ZIP();i.entries.forEach(function(E){var C=s(h,a(E.entryName));if(E.isDirectory){o.makeDir(C);return}var g=E.getData(D);if(!g)throw ze.Errors.CANT_EXTRACT_FILE();let _=b?E.header.fileAttr:void 0;o.writeFileTo(C,g,m,_);try{o.fs.utimesSync(C,E.header.time,E.header.time)}catch{throw ze.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,D){if(D=v3(m,b,D),b=Jn(!1,b),m=Jn(!1,m),!D)return new Promise((x,$)=>{this.extractAllToAsync(h,m,b,function(F){F?$(F):x(this)})});if(!i){D(ze.Errors.NO_ZIP());return}h=Je.resolve(h);let E=x=>s(h,Je.normalize(a(x.entryName))),C=(x,$)=>new Error(x+': "'+$+'"'),g=[],_=[];i.entries.forEach(x=>{x.isDirectory?g.push(x):_.push(x)});for(let x of g){let $=E(x),F=b?x.header.fileAttr:void 0;try{o.makeDir($),F&&o.fs.chmodSync($,F),o.fs.utimesSync($,x.header.time,x.header.time)}catch{D(C("Unable to create folder",$))}}_.reverse().reduce(function(x,$){return function(F){if(F)x(F);else{let B=Je.normalize(a($.entryName)),I=s(h,B);$.getDataAsync(function(L,A){if(A)x(A);else if(!L)x(ze.Errors.CANT_EXTRACT_FILE());else{let j=b?$.header.fileAttr:void 0;o.writeFileToAsync(I,L,m,j,function(M){M||x(C("Unable to write file",I)),o.fs.utimes(I,$.header.time,$.header.time,function(J){J?x(C("Unable to set times",I)):x()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var b=i.compressToBuffer();if(b){var D=o.writeFileTo(h,b,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:b,perm:D}=Object.assign({overwrite:!0},m);return new Promise((E,C)=>{!h&&n.filename&&(h=n.filename),h||C("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=x=>x?E(x):C("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,D,_)},C)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,b,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,b,D),null):i.compressToBuffer()}}}});var fb=S((Dz,lb)=>{var cb={};lb.exports=cb;var ub={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(ub).forEach(function(t){var e=ub[t],r=cb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var pb=S((yz,db)=>{"use strict";db.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",o=e.indexOf(n+t);return o!==-1&&(r===-1?!0:o<r)}});var mb=S((bz,hb)=>{"use strict";var C3=require("os"),_r=pb(),Ft=process.env,si=void 0;_r("no-color")||_r("no-colors")||_r("color=false")?si=!1:(_r("color")||_r("colors")||_r("color=true")||_r("color=always"))&&(si=!0);"FORCE_COLOR"in Ft&&(si=Ft.FORCE_COLOR.length===0||parseInt(Ft.FORCE_COLOR,10)!==0);function _3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function S3(t){if(si===!1)return 0;if(_r("color=16m")||_r("color=full")||_r("color=truecolor"))return 3;if(_r("color=256"))return 2;if(t&&!t.isTTY&&si!==!0)return 0;var e=si?1:0;if(process.platform==="win32"){var r=C3.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ft)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Ft})||Ft.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ft)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ft.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Ft){var n=parseInt((Ft.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ft.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ft.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Ft.TERM)||"COLORTERM"in Ft?1:(Ft.TERM==="dumb",e)}function Gp(t){var e=S3(t);return _3(e)}hb.exports={supportsColor:Gp,stdout:Gp(process.stdout),stderr:Gp(process.stderr)}});var Db=S((wz,gb)=>{gb.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var o={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var a=o[i]||[" "],s=Math.floor(Math.random()*a.length);typeof o[i]<"u"?n+=o[i][s]:n+=i}),n}});var bb=S((vz,yb)=>{yb.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},o=[].concat(n.up,n.down,n.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return o.filter(function(l){c=l===u}),c}function s(u,c){var l="",d,p;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(p in u)if(!a(p)){switch(l=l+u[p],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],D=0;D<=d[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var vb=S((Ez,wb)=>{wb.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var Cb=S((Cz,Eb)=>{Eb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var Sb=S((_z,_b)=>{_b.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,o){return r===" "?r:t[e[n++%e.length]](r)}}});var Ab=S((Sz,xb)=>{xb.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,o){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var Tb=S((Az,$b)=>{var le={};$b.exports=le;le.themes={};var x3=require("util"),Xn=le.styles=fb(),Fb=Object.defineProperties,A3=new RegExp(/[\r\n]+/g);le.supportsColor=mb().supportsColor;typeof le.enabled>"u"&&(le.enabled=le.supportsColor()!==!1);le.enable=function(){le.enabled=!0};le.disable=function(){le.enabled=!1};le.stripColors=le.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var xz=le.stylize=function(e,r){if(!le.enabled)return e+"";var n=Xn[r];return!n&&r in le?le[r](e):n.open+e+n.close},O3=/[|\\{}()[\]^$+*?.]/g,F3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(O3,"\\$&")};function kb(t){var e=function r(){return P3.apply(r,arguments)};return e._styles=t,e.__proto__=k3,e}var Pb=(function(){var t={};return Xn.grey=Xn.gray,Object.keys(Xn).forEach(function(e){Xn[e].closeRe=new RegExp(F3(Xn[e].close),"g"),t[e]={get:function(){return kb(this._styles.concat(e))}}}),t})(),k3=Fb(function(){},Pb);function P3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:x3.inspect(a)}).join(" ");if(!le.enabled||!e)return e;for(var r=e.indexOf(`
31
- `)!=-1,n=this._styles,o=n.length;o--;){var i=Xn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(A3,function(a){return i.close+a+i.open}))}return e}le.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){le[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=le[t[r][i]](o);return o}return le[t[r]](n)}})(e)};function $3(){var t={};return Object.keys(Pb).forEach(function(e){t[e]={get:function(){return kb([e])}}}),t}var T3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};le.trap=Db();le.zalgo=bb();le.maps={};le.maps.america=vb()(le);le.maps.zebra=Cb()(le);le.maps.rainbow=Sb()(le);le.maps.random=Ab()(le);for(Ob in le.maps)(function(t){le[t]=function(e){return T3(le.maps[t],e)}})(Ob);var Ob;Fb(le,$3())});var Rb=S((Oz,Ib)=>{var I3=Tb();Ib.exports=I3});var Bb=S(Wp=>{"use strict";Wp.indent=function(e){return new Array(e+1).join(" ")};Wp.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var Nb=S((kz,R3)=>{R3.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var Lb=S(Ma=>{"use strict";var Pr=Rb(),Sn=Bb(),B3=/[^\w\s\n\r\v\t\.,]/i;Ma.version=Nb().version;var Yp=function(t,e){return t!==void 0||e.renderUndefined},Ju=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
32
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Ju(t[0],!0,r))},N3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Pr[e.stringColor](t):t;var r=t+"";return t===!0?Pr.green(r):t===!1?Pr.red(r):t==null?Pr.grey(r):typeof t=="number"?t>=0?Pr[e.positiveNumberColor](r):Pr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Jp=function(t,e){return t.multilineStringColor===null||t.noColor?e:Pr[t.multilineStringColor](e)},L3=function(t,e,r){var n=t.split(`
33
- `);return n=n.map(function(o){return Sn.indent(e)+Jp(r,o)}),n.join(`
34
- `)},ui=function(t,e,r){if(typeof t=="string"&&t.match(B3)&&e.escape&&(t=JSON.stringify(t)),!Yp(t,e))return[];if(Ju(t,!1,e))return[Sn.indent(r)+N3(t,e)];if(typeof t=="string")return[Sn.indent(r)+Jp(e,'"""'),L3(t,r+e.defaultIndentation,e),Sn.indent(r)+Jp(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[Sn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Yp(s,e)){var u="- ";e.noColor||(u=Pr[e.dashColor](u)),u=Sn.indent(r)+u,Ju(s,!1,e)?(u+=ui(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,ui(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return ui({message:t.message,stack:t.stack.split(`
35
- `)},e,r);var o=e.noAlign?0:Sn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Yp(t[s],e))if(i=s+": ",e.noColor||(i=Pr[e.keysColor](i)),i=Sn.indent(r)+i,Ju(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=ui(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,ui(t[s],e,r+e.defaultIndentation))}),a};Ma.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,ui(e,r,n).join(`
36
- `)};Ma.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
37
- `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Pr.red("Error:")+" Not valid JSON!"}return o+=Ma.render(i,r,n),o}});var Qp=S(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.default=void 0;function ci(t){"@babel/helpers - typeof";return ci=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ci(t)}function jb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,U3(n.key),n)}}function j3(t,e,r){return e&&jb(t.prototype,e),r&&jb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function U3(t){var e=M3(t,"string");return ci(e)=="symbol"?e:e+""}function M3(t,e){if(ci(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ci(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function q3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function H3(t,e,r){return e=Ha(e),V3(t,Zp()?Reflect.construct(e,r||[],Ha(t).constructor):e.apply(t,r))}function V3(t,e){if(e&&(ci(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return z3(t)}function z3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function K3(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qa(t,e)}function Xp(t){var e=typeof Map=="function"?new Map:void 0;return Xp=function(n){if(n===null||!W3(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return G3(n,arguments,Ha(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),qa(o,n)},Xp(t)}function G3(t,e,r){if(Zp())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&qa(o,r.prototype),o}function Zp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zp=function(){return!!t})()}function W3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function qa(t,e){return qa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},qa(t,e)}function Ha(t){return Ha=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ha(t)}var Y3=(function(t){function e(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(q3(this,e),n=H3(this,e,[r]),n.originalRequest=i,n.originalResponse=a,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var s=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return K3(e,t),j3(e)})(Xp(Error)),$z=Xu.default=Y3});var eh=S(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.enableDebugLog=J3;Zu.log=X3;var Ub=!1;function J3(){Ub=!0}function X3(t){Ub&&console.log(t)}});var qb=S(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;function Va(t){"@babel/helpers - typeof";return Va=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Va(t)}function Z3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,e$(n.key),n)}}function Q3(t,e,r){return e&&Mb(t.prototype,e),r&&Mb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function e$(t){var e=t$(t,"string");return Va(e)=="symbol"?e:e+""}function t$(t,e){if(Va(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Va(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rz=Qu.default=(function(){function t(){Z3(this,t)}return Q3(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var Hb=S((th,rh)=>{(function(t,e){typeof th=="object"&&typeof rh<"u"?rh.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:th,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=(function(P){var N={};return P.forEach(function(z,H){return N[z]=H}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(P){return new Uint8Array(Array.prototype.slice.call(P,0))},d=function(P){return P.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},p=function(P){return P.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(P){for(var N,z,H,se,zt="",G=P.length%3,Ce=0;Ce<P.length;){if((z=P.charCodeAt(Ce++))>255||(H=P.charCodeAt(Ce++))>255||(se=P.charCodeAt(Ce++))>255)throw new TypeError("invalid character found");N=z<<16|H<<8|se,zt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return G?zt.slice(0,G-3)+"===".substring(G):zt},m=typeof btoa=="function"?function(P){return btoa(P)}:r?function(P){return Buffer.from(P,"binary").toString("base64")}:h,b=r?function(P){return Buffer.from(P).toString("base64")}:function(P){for(var N=4096,z=[],H=0,se=P.length;H<se;H+=N)z.push(c.apply(null,P.subarray(H,H+N)));return m(z.join(""))},D=function(P,N){return N===void 0&&(N=!1),N?d(b(P)):b(P)},E=function(P){if(P.length<2){var N=P.charCodeAt(0);return N<128?P:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},C=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(P){return P.replace(C,E)},_=r?function(P){return Buffer.from(P,"utf8").toString("base64")}:o?function(P){return b(o.encode(P))}:function(P){return m(g(P))},x=function(P,N){return N===void 0&&(N=!1),N?d(_(P)):_(P)},$=function(P){return x(P,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(P){switch(P.length){case 4:var N=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),z=N-65536;return c((z>>>10)+55296)+c((z&1023)+56320);case 3:return c((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return c((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},I=function(P){return P.replace(F,B)},L=function(P){if(P=P.replace(/\s+/g,""),!u.test(P))throw new TypeError("malformed base64.");P+="==".slice(2-(P.length&3));for(var N,z,H,se=[],zt=0;zt<P.length;)N=s[P.charAt(zt++)]<<18|s[P.charAt(zt++)]<<12|(z=s[P.charAt(zt++)])<<6|(H=s[P.charAt(zt++)]),z===64?se.push(c(N>>16&255)):H===64?se.push(c(N>>16&255,N>>8&255)):se.push(c(N>>16&255,N>>8&255,N&255));return se.join("")},A=typeof atob=="function"?function(P){return atob(p(P))}:r?function(P){return Buffer.from(P,"base64").toString("binary")}:L,j=r?function(P){return l(Buffer.from(P,"base64"))}:function(P){return l(A(P).split("").map(function(N){return N.charCodeAt(0)}))},M=function(P){return j(k(P))},J=r?function(P){return Buffer.from(P,"base64").toString("utf8")}:n?function(P){return n.decode(j(P))}:function(P){return I(A(P))},k=function(P){return p(P.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},y=function(P){return J(k(P))},w=function(P){if(typeof P!="string")return!1;var N=P.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},v=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}},O=function(){var P=function(N,z){return Object.defineProperty(String.prototype,N,v(z))};P("fromBase64",function(){return y(this)}),P("toBase64",function(N){return x(this,N)}),P("toBase64URI",function(){return x(this,!0)}),P("toBase64URL",function(){return x(this,!0)}),P("toUint8Array",function(){return M(this)})},R=function(){var P=function(N,z){return Object.defineProperty(Uint8Array.prototype,N,v(z))};P("toBase64",function(N){return D(this,N)}),P("toBase64URI",function(){return D(this,!0)}),P("toBase64URL",function(){return D(this,!0)})},T=function(){O(),R()},q={version:t,VERSION:e,atob:A,atobPolyfill:L,btoa:m,btoaPolyfill:h,fromBase64:y,toBase64:x,encode:x,encodeURI:$,encodeURL:$,utob:g,btou:I,decode:y,isValid:w,fromUint8Array:D,toUint8Array:M,extendString:O,extendUint8Array:R,extendBuiltins:T};return q.Base64={},Object.keys(q).forEach(function(P){return q.Base64[P]=q[P]}),q})});var zb=S((Nz,Vb)=>{"use strict";Vb.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Wb=S(nh=>{"use strict";var r$=Object.prototype.hasOwnProperty,n$;function Kb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Gb(t){try{return encodeURIComponent(t)}catch{return null}}function o$(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Kb(n[1]),i=Kb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function i$(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(r$.call(t,o)){if(n=t[o],!n&&(n===null||n===n$||isNaN(n))&&(n=""),o=Gb(o),n=Gb(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}nh.stringify=i$;nh.parse=o$});var rw=S((jz,tw)=>{"use strict";var Jb=zb(),ec=Wb(),a$=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Xb=/[\n\r\t]/g,s$=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Zb=/:\d+$/,u$=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,c$=/^[a-zA-Z]:/;function ih(t){return(t||"").toString().replace(a$,"")}var oh=[["#","hash"],["?","query"],function(e,r){return $r(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Yb={hash:1,query:1};function Qb(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},o=typeof t,i;if(t.protocol==="blob:")n=new Tr(unescape(t.pathname),{});else if(o==="string"){n=new Tr(t,{});for(i in Yb)delete n[i]}else if(o==="object"){for(i in t)i in Yb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=s$.test(t.href))}return n}function $r(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function ew(t,e){t=ih(t),t=t.replace(Xb,""),e=e||{};var r=u$.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],a=0,s;return o?i?(s=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(s=r[2]+r[4],a=r[2].length):i?(s=r[3]+r[4],a=r[3].length):s=r[4],n==="file:"?a>=2&&(s=s.slice(2)):$r(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&$r(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||$r(n),slashesCount:a,rest:s}}function l$(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),a++):a&&(n===0&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Tr(t,e,r){if(t=ih(t),t=t.replace(Xb,""),!(this instanceof Tr))return new Tr(t,e,r);var n,o,i,a,s,u,c=oh.slice(),l=typeof e,d=this,p=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=ec.parse),e=Qb(e),o=ew(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||c$.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!$r(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=l$(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&$r(d.protocol)&&(d.pathname="/"+d.pathname),Jb(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&$r(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function f$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||ec.parse)(e)),n[t]=e;break;case"port":n[t]=e,Jb(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,Zb.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<oh.length;a++){var s=oh[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&$r(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function d$(t){(!t||typeof t!="function")&&(t=ec.stringify);var e,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var i=o+(r.protocol&&r.slashes||$r(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&$r(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||Zb.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(i+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(i+=r.hash),i}Tr.prototype={set:f$,toString:d$};Tr.extractProtocol=ew;Tr.location=Qb;Tr.trimLeft=ih;Tr.qs=ec;tw.exports=Tr});var nw=S(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.default=p$;function p$(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t==="x"?e:e&3|8;return r.toString(16)})}});var yw=S(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.default=void 0;var h$=Hb(),m$=ch(rw()),tc=ch(Qp()),Zn=eh(),g$=ch(nw());function ch(t){return t&&t.__esModule?t:{default:t}}function sh(){"use strict";sh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(y,w,v,O){var R=w&&w.prototype instanceof E?w:E,T=Object.create(R.prototype),q=new J(O||[]);return o(T,"_invoke",{value:L(y,v,q)}),T}function d(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function E(){}function C(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=E.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,T,q,P){var N=d(y[R],y,T);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&Qn(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(T,q){function P(){return new w(function(N,z){v(T,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(y,w,v){var O=p;return function(R,T){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw T;return{value:t,done:!0}}for(v.method=R,v.arg=T;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(y,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(y,w){var v=w.method,O=y.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=d(O,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var T=R.arg;return T?T.done?(w[y.resultName]=T.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):T:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function j(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function J(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(j,this),this.reset(!0)}function k(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,O=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(Qn(y)+" is not iterable")}return C.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:C,configurable:!0}),C.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===C||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(F),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,s,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,O,R){R===void 0&&(R=Promise);var T=new I(l(y,w,v,O),R);return e.isGeneratorFunction(w)?T:T.next().then(function(q){return q.done?q.value:T.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var T=v.pop();if(T in w)return R.value=T,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var T=this.tryEntries[R],q=T.completion;if(T.tryLoc==="root")return O("end");if(T.tryLoc<=this.prev){var P=n.call(T,"catchLoc"),N=n.call(T,"finallyLoc");if(P&&N){if(this.prev<T.catchLoc)return O(T.catchLoc,!0);if(this.prev<T.finallyLoc)return O(T.finallyLoc)}else if(P){if(this.prev<T.catchLoc)return O(T.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<T.finallyLoc)return O(T.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var T=R;break}}T&&(w==="break"||w==="continue")&&T.tryLoc<=v&&v<=T.finallyLoc&&(T=null);var q=T?T.completion:{};return q.type=w,q.arg=v,T?(this.method="next",this.next=T.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var T=R.arg;M(O)}return T}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function ow(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function D$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){ow(i,n,o,a,s,"next",u)}function s(u){ow(i,n,o,a,s,"throw",u)}a(void 0)})}}function pw(t,e){return w$(t)||b$(t,e)||hw(t,e)||y$()}function y$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b$(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function w$(t){if(Array.isArray(t))return t}function Qn(t){"@babel/helpers - typeof";return Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qn(t)}function v$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=hw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
39
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function hw(t,e){if(t){if(typeof t=="string")return iw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return iw(t,e)}}function iw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function aw(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function li(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aw(Object(r),!0).forEach(function(n){E$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function E$(t,e,r){return e=mw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mw(n.key),n)}}function _$(t,e,r){return e&&sw(t.prototype,e),r&&sw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function mw(t){var e=S$(t,"string");return Qn(e)=="symbol"?e:e+""}function S$(t,e){if(Qn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rc="tus-v1",nc="ietf-draft-03",za="ietf-draft-05",x$={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Dw,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:rc},gw=(function(){function t(e,r){C$(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return _$(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![rc,nc,za].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,Zn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Zn.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,i=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:O$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,d){l.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,d){var p=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,D){var E=li(li({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:li(li({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(_){i=i-p+_,p=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=C.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),C=new t(m,E);C.start(),n._parallelUploads.push(C)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=uw(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!fi(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var d=l.getHeader("Location");if(d==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=dw(n.options.endpoint,d),(0,Zn.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Zn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Zn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Zn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=v$(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.abort(r)}}catch(s){o.e(s)}finally{o.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,i){this._emitError(new tc.default(o,i,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),fw(r,this._retryAttempt,this.options)){var i=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},i);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=uw(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var i;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,i=this._addChunkToRequest(n)):((this.options.protocol===nc||this.options.protocol===za)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!fi(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while creating upload");return}var s=a.getHeader("Location");if(s==null){r._emitHttpError(n,a,"tus: invalid or missing Location header");return}if(r.url=dw(r.options.endpoint,s),(0,Zn.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(a),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,a):(r._offset=0,r._performUpload())})}).catch(function(a){r._emitHttpError(n,null,"tus: failed to create upload",a)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var a=i.getStatus();if(!fi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(fi(a,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,i,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var s=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){r._emitHttpError(n,i,"tus: invalid or missing offset value");return}var u=Number.parseInt(i.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===rc){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(s===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=s,r._performUpload()})}).catch(function(i){r._emitHttpError(n,null,"tus: failed to resume upload",i)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(i){if(!fi(i.getStatus(),200)){r._emitHttpError(n,i,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,i)}).catch(function(i){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),i)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,i=this._offset+this.options.chunkSize;return r.setProgressHandler(function(a){n._emitProgress(o+a,n._size)}),this.options.protocol===rc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===za&&r.setHeader("Content-Type","application/partial-upload"),(i===Number.POSITIVE_INFINITY||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(o,i).then(function(a){var s=a.value,u=a.done,c=s!=null&&s.size?s.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===nc||n.options.protocol===za)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,s))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var o=cw(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return lw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=cw("DELETE",r,n);return lw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new tc.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof tc.default||(i=new tc.default("tus: failed to terminate upload",i,o,null)),!fw(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=li(li({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function uw(t){return Object.entries(t).map(function(e){var r=pw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(h$.Base64.encode(String(o)))}).join(",")}function fi(t,e){return t>=e&&t<e+100}function cw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===nc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===za?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var s=pw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,g$.default)();n.setHeader("X-Request-ID",l)}return n}function lw(t,e,r){return uh.apply(this,arguments)}function uh(){return uh=D$(sh().mark(function t(e,r,n){var o;return sh().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof n.onBeforeRequest!="function"){a.next=3;break}return a.next=3,n.onBeforeRequest(e);case 3:return a.next=5,e.send(r);case 5:if(o=a.sent,typeof n.onAfterResponse!="function"){a.next=9;break}return a.next=9,n.onAfterResponse(e,o);case 9:return a.abrupt("return",o);case 10:case"end":return a.stop()}},t)})),uh.apply(this,arguments)}function A$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function fw(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):Dw(t)}function Dw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!fi(e,400)||e===409||e===423)&&A$()}function dw(t,e){return new m$.default(e,t).toString()}function O$(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}gw.defaultOptions=x$;var Mz=oc.default=gw});var ww=S((Hz,bw)=>{"use strict";var Ir=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Ir.writable=t=>Ir(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Ir.readable=t=>Ir(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Ir.duplex=t=>Ir.writable(t)&&Ir.readable(t);Ir.transform=t=>Ir.duplex(t)&&typeof t._transform=="function";bw.exports=Ir});var Ew=S(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});ic.default=void 0;function Ka(t){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ka(t)}function F$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,P$(n.key),n)}}function k$(t,e,r){return e&&vw(t.prototype,e),r&&vw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function P$(t){var e=$$(t,"string");return Ka(e)=="symbol"?e:e+""}function $$(t,e){if(Ka(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ka(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vz=ic.default=(function(){function t(e){F$(this,t),this._buffer=e,this.size=e.length}return k$(t,[{key:"slice",value:function(r,n){var o=this._buffer.slice(r,n);o.size=o.length;var i=n>=this.size;return Promise.resolve({value:o,done:i})}},{key:"close",value:function(){}}])})()});var xw=S(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});dh.default=L$;var Sw=require("fs");function eo(t){"@babel/helpers - typeof";return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(t)}function lh(){"use strict";lh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(y,w,v,O){var R=w&&w.prototype instanceof E?w:E,T=Object.create(R.prototype),q=new J(O||[]);return o(T,"_invoke",{value:L(y,v,q)}),T}function d(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function E(){}function C(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=E.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,T,q,P){var N=d(y[R],y,T);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&eo(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(T,q){function P(){return new w(function(N,z){v(T,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(y,w,v){var O=p;return function(R,T){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw T;return{value:t,done:!0}}for(v.method=R,v.arg=T;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(y,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(y,w){var v=w.method,O=y.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=d(O,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var T=R.arg;return T?T.done?(w[y.resultName]=T.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):T:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function j(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function J(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(j,this),this.reset(!0)}function k(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,O=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(eo(y)+" is not iterable")}return C.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:C,configurable:!0}),C.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===C||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(F),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,s,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,O,R){R===void 0&&(R=Promise);var T=new I(l(y,w,v,O),R);return e.isGeneratorFunction(w)?T:T.next().then(function(q){return q.done?q.value:T.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var T=v.pop();if(T in w)return R.value=T,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var T=this.tryEntries[R],q=T.completion;if(T.tryLoc==="root")return O("end");if(T.tryLoc<=this.prev){var P=n.call(T,"catchLoc"),N=n.call(T,"finallyLoc");if(P&&N){if(this.prev<T.catchLoc)return O(T.catchLoc,!0);if(this.prev<T.finallyLoc)return O(T.finallyLoc)}else if(P){if(this.prev<T.catchLoc)return O(T.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<T.finallyLoc)return O(T.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var T=R;break}}T&&(w==="break"||w==="continue")&&T.tryLoc<=v&&v<=T.finallyLoc&&(T=null);var q=T?T.completion:{};return q.type=w,q.arg=v,T?(this.method="next",this.next=T.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var T=R.arg;M(O)}return T}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function T$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,R$(n.key),n)}}function I$(t,e,r){return e&&Cw(t.prototype,e),r&&Cw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function R$(t){var e=B$(t,"string");return eo(e)=="symbol"?e:e+""}function B$(t,e){if(eo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(eo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _w(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function N$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){_w(i,n,o,a,s,"next",u)}function s(u){_w(i,n,o,a,s,"throw",u)}a(void 0)})}}function L$(t){return fh.apply(this,arguments)}function fh(){return fh=N$(lh().mark(function t(e){var r,n,o,i,a,s,u;return lh().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,Sw.promises.stat(n);case 3:return o=l.sent,i=o.size,a=(r=e.start)!==null&&r!==void 0?r:0,s=Number.isFinite(e.end)?e.end+1:i,u=s-a,l.abrupt("return",new j$(e,n,u));case 9:case"end":return l.stop()}},t)})),fh.apply(this,arguments)}var j$=(function(){function t(e,r,n){T$(this,t),this._stream=e,this._path=r,this.size=n}return I$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,Sw.createReadStream)(this._path,{start:i+r,end:i+n-1,autoClose:!0});a.size=Math.min(n-r,this.size);var s=a.size>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var hh=S(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.default=void 0;function to(t){"@babel/helpers - typeof";return to=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},to(t)}function Ga(){"use strict";Ga=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(y,w,v){y[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(y,w,v){return Object.defineProperty(y,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),y[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(y,w,v,O){var R=w&&w.prototype instanceof E?w:E,T=Object.create(R.prototype),q=new J(O||[]);return o(T,"_invoke",{value:L(y,v,q)}),T}function d(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function E(){}function C(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=E.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function I(y,w){function v(R,T,q,P){var N=d(y[R],y,T);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&to(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(T,q){function P(){return new w(function(N,z){v(T,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(y,w,v){var O=p;return function(R,T){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw T;return{value:t,done:!0}}for(v.method=R,v.arg=T;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===D)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(y,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===D)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(y,w){var v=w.method,O=y.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,A(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var R=d(O,y.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var T=R.arg;return T?T.done?(w[y.resultName]=T.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):T:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function j(y){var w={tryLoc:y[0]};1 in y&&(w.catchLoc=y[1]),2 in y&&(w.finallyLoc=y[2],w.afterLoc=y[3]),this.tryEntries.push(w)}function M(y){var w=y.completion||{};w.type="normal",delete w.arg,y.completion=w}function J(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(j,this),this.reset(!0)}function k(y){if(y||y===""){var w=y[a];if(w)return w.call(y);if(typeof y.next=="function")return y;if(!isNaN(y.length)){var v=-1,O=function R(){for(;++v<y.length;)if(n.call(y,v))return R.value=y[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(to(y)+" is not iterable")}return C.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:C,configurable:!0}),C.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===C||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(y){return Object.setPrototypeOf?Object.setPrototypeOf(y,g):(y.__proto__=g,c(y,u,"GeneratorFunction")),y.prototype=Object.create(F),y},e.awrap=function(y){return{__await:y}},B(I.prototype),c(I.prototype,s,function(){return this}),e.AsyncIterator=I,e.async=function(y,w,v,O,R){R===void 0&&(R=Promise);var T=new I(l(y,w,v,O),R);return e.isGeneratorFunction(w)?T:T.next().then(function(q){return q.done?q.value:T.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var T=v.pop();if(T in w)return R.value=T,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var T=this.tryEntries[R],q=T.completion;if(T.tryLoc==="root")return O("end");if(T.tryLoc<=this.prev){var P=n.call(T,"catchLoc"),N=n.call(T,"finallyLoc");if(P&&N){if(this.prev<T.catchLoc)return O(T.catchLoc,!0);if(this.prev<T.finallyLoc)return O(T.finallyLoc)}else if(P){if(this.prev<T.catchLoc)return O(T.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<T.finallyLoc)return O(T.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var T=R;break}}T&&(w==="break"||w==="continue")&&T.tryLoc<=v&&v<=T.finallyLoc&&(T=null);var q=T?T.completion:{};return q.type=w,q.arg=v,T?(this.method="next",this.next=T.finallyLoc,D):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),D},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var T=R.arg;M(O)}return T}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function U$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Aw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,q$(n.key),n)}}function M$(t,e,r){return e&&Aw(t.prototype,e),r&&Aw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function q$(t){var e=H$(t,"string");return to(e)=="symbol"?e:e+""}function H$(t,e){if(to(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(to(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ow(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function Fw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Ow(i,n,o,a,s,"next",u)}function s(u){Ow(i,n,o,a,s,"throw",u)}a(void 0)})}}function V$(t,e){return ph.apply(this,arguments)}function ph(){return ph=Fw(Ga().mark(function t(e,r){return Ga().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(l){e.off("readable",u),a(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",s),e.off("readable",c),i(l))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),ph.apply(this,arguments)}var Gz=ac.default=(function(){function t(e){var r=this;U$(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return M$(t,[{key:"slice",value:(function(){var e=Fw(Ga().mark(function n(o,i){var a,s,u,c,l;return Ga().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o<this._bufPos)){p.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){p.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){p.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){p.next=10;break}return a.size=a.length,p.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){p.next=16;break}return p.next=14,V$(this._stream,c-a.length);case 14:l=p.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,p.abrupt("return",{value:a,done:this._ended});case 20:case"end":return p.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Pw=S(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;var z$=require("fs"),K$=sc(ww()),G$=sc(Ew()),W$=sc(xw()),Y$=sc(hh());function sc(t){return t&&t.__esModule?t:{default:t}}function Wa(t){"@babel/helpers - typeof";return Wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wa(t)}function J$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Z$(n.key),n)}}function X$(t,e,r){return e&&kw(t.prototype,e),r&&kw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Z$(t){var e=Q$(t,"string");return Wa(e)=="symbol"?e:e+""}function Q$(t,e){if(Wa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yz=uc.default=(function(){function t(){J$(this,t)}return X$(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new G$.default(r)):r instanceof z$.ReadStream&&r.path!=null?(0,W$.default)(r):K$.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new Y$.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var Rw=S(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});mh.default=rT;var eT=require("crypto"),$w=Iw(require("fs")),tT=Iw(require("path"));function Tw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Tw=function(n){return n?r:e})(t)}function Iw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Tw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function rT(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,eT.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof $w.ReadStream&&t.path!=null?new Promise(function(a,s){var u=tT.resolve(t.path);$w.stat(t.path,function(c,l){if(c){s(c);return}var d=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var Uw=S((Zz,jw)=>{var Lw="Expected a function",Bw=NaN,nT="[object Symbol]",oT=/^\s+|\s+$/g,iT=/^[-+]0x[0-9a-f]+$/i,aT=/^0b[01]+$/i,sT=/^0o[0-7]+$/i,uT=parseInt,cT=typeof global=="object"&&global&&global.Object===Object&&global,lT=typeof self=="object"&&self&&self.Object===Object&&self,fT=cT||lT||Function("return this")(),dT=Object.prototype,pT=dT.toString,hT=Math.max,mT=Math.min,gh=function(){return fT.Date.now()};function gT(t,e,r){var n,o,i,a,s,u,c=0,l=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(Lw);e=Nw(e)||0,cc(r)&&(l=!!r.leading,d="maxWait"in r,i=d?hT(Nw(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p);function h($){var F=n,B=o;return n=o=void 0,c=$,a=t.apply(B,F),a}function m($){return c=$,s=setTimeout(E,e),l?h($):a}function b($){var F=$-u,B=$-c,I=e-F;return d?mT(I,i-B):I}function D($){var F=$-u,B=$-c;return u===void 0||F>=e||F<0||d&&B>=i}function E(){var $=gh();if(D($))return C($);s=setTimeout(E,b($))}function C($){return s=void 0,p&&n?h($):(n=o=void 0,a)}function g(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function _(){return s===void 0?a:C(gh())}function x(){var $=gh(),F=D($);if(n=arguments,o=this,u=$,F){if(s===void 0)return m(u);if(d)return s=setTimeout(E,e),h(u)}return s===void 0&&(s=setTimeout(E,e)),a}return x.cancel=g,x.flush=_,x}function DT(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(Lw);return cc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),gT(t,e,{leading:n,maxWait:e,trailing:o})}function cc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function yT(t){return!!t&&typeof t=="object"}function bT(t){return typeof t=="symbol"||yT(t)&&pT.call(t)==nT}function Nw(t){if(typeof t=="number")return t;if(bT(t))return Bw;if(cc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=cc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(oT,"");var r=aT.test(t);return r||sT.test(t)?uT(t.slice(2),r?2:8):iT.test(t)?Bw:+t}jw.exports=DT});var Yw=S(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});pc.default=void 0;var wT=Kw(require("http")),vT=Kw(require("https")),Hw=require("stream"),ET=require("url"),Vw=CT(Uw());function CT(t){return t&&t.__esModule?t:{default:t}}function zw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(zw=function(n){return n?r:e})(t)}function Kw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=zw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function _T(t,e,r){return e=lc(e),ST(t,Gw()?Reflect.construct(e,r||[],lc(t).constructor):e.apply(t,r))}function ST(t,e){if(e&&(di(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xT(t)}function xT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Gw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Gw=function(){return!!t})()}function lc(t){return lc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},lc(t)}function AT(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Dh(t,e)}function Dh(t,e){return Dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Dh(t,e)}function Mw(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Ya(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mw(Object(r),!0).forEach(function(n){OT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function OT(t,e,r){return e=Ww(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function di(t){"@babel/helpers - typeof";return di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},di(t)}function fc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ww(n.key),n)}}function dc(t,e,r){return e&&qw(t.prototype,e),r&&qw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ww(t){var e=FT(t,"string");return di(e)=="symbol"?e:e+""}function FT(t,e){if(di(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(di(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qz=pc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fc(this,t),this._requestOptions=e}return dc(t,[{key:"createRequest",value:function(r,n){return new kT(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),kT=(function(){function t(e,r,n){fc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return dc(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,i){var a=Ya(Ya(Ya({},(0,ET.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Ya(Ya({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?vT:wT;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(d){l.push(d)}),c.on("end",function(){var d=Buffer.concat(l).toString("utf8");o(new PT(c,d))})}),u.on("error",function(c){i(c)}),n instanceof Hw.Readable?n.pipe(new $T(r._progressHandler)).pipe(u):n instanceof Uint8Array?TT(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),PT=(function(){function t(e,r){fc(this,t),this._response=e,this._body=r}return dc(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),$T=(function(t){function e(r){var n;return fc(this,e),n=_T(this,e),n._onprogress=(0,Vw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return AT(e,t),dc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(Hw.Transform),TT=function(e,r,n){n=(0,Vw.default)(n,100,{leading:!0,trailing:!1});var o=0;function i(){var a=Math.min(e.writableHighWaterMark,r.length-o),s=r.subarray(o,o+a);o+=s.length;var u=e.write(s);u?o<r.length?i():e.end():(e.once("drain",i),n(o))}i()}});var Jw=S(yh=>{"use strict";yh.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};yh.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
30
+ ${h.stack}`)}else p=(l=i?.stack)!==null&&l!==void 0?l:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:p,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Od.default=Ad});var $d=S(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var Bk=(he(),oe(pe)),Nk=Bk.__importDefault(Fd()),kd=class extends Nk.default{select(e){let r=!1,n=(e??"*").split("").map(o=>/\s/.test(o)&&!r?"":(o==='"'&&(r=!r),o)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:o,referencedTable:i=o}={}){let a=i?`${i}.order`:"order",s=this.url.searchParams.get(a);return this.url.searchParams.set(a,`${s?`${s},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:o=n}={}){let i=typeof o>"u"?"offset":`${o}.offset`,a=typeof o>"u"?"limit":`${o}.limit`;return this.url.searchParams.set(i,`${e}`),this.url.searchParams.set(a,`${r-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:r=!1,settings:n=!1,buffers:o=!1,wal:i=!1,format:a="text"}={}){var s;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,o?"buffers":null,i?"wal":null].filter(Boolean).join("|"),c=(s=this.headers.get("Accept"))!==null&&s!==void 0?s:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${a}; for="${c}"; options=${u};`),a==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};Pd.default=kd});var _u=S(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});var Lk=(he(),oe(pe)),jk=Lk.__importDefault($d()),Uk=new RegExp("[,()]"),Id=class extends jk.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&Uk.test(o)?`"${o}"`:`${o}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}contains(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cs.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cs.{${r.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(r)}`),this}containedBy(e,r){return typeof r=="string"?this.url.searchParams.append(e,`cd.${r}`):Array.isArray(r)?this.url.searchParams.append(e,`cd.{${r.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(r)}`),this}rangeGt(e,r){return this.url.searchParams.append(e,`sr.${r}`),this}rangeGte(e,r){return this.url.searchParams.append(e,`nxl.${r}`),this}rangeLt(e,r){return this.url.searchParams.append(e,`sl.${r}`),this}rangeLte(e,r){return this.url.searchParams.append(e,`nxr.${r}`),this}rangeAdjacent(e,r){return this.url.searchParams.append(e,`adj.${r}`),this}overlaps(e,r){return typeof r=="string"?this.url.searchParams.append(e,`ov.${r}`):this.url.searchParams.append(e,`ov.{${r.join(",")}}`),this}textSearch(e,r,{config:n,type:o}={}){let i="";o==="plain"?i="pl":o==="phrase"?i="ph":o==="websearch"&&(i="w");let a=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${i}fts${a}.${r}`),this}match(e){return Object.entries(e).forEach(([r,n])=>{this.url.searchParams.append(r,`eq.${n}`)}),this}not(e,r,n){return this.url.searchParams.append(e,`not.${r}.${n}`),this}or(e,{foreignTable:r,referencedTable:n=r}={}){let o=n?`${n}.or`:"or";return this.url.searchParams.append(o,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};Td.default=Id});var Nd=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});var Mk=(he(),oe(pe)),ka=Mk.__importDefault(_u()),Rd=class{constructor(e,{headers:r={},schema:n,fetch:o}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=o}select(e,r){let{head:n=!1,count:o}=r??{},i=n?"HEAD":"GET",a=!1,s=(e??"*").split("").map(u=>/\s/.test(u)&&!a?"":(u==='"'&&(a=!a),u)).join("");return this.url.searchParams.set("select",s),o&&this.headers.append("Prefer",`count=${o}`),new ka.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var o;let i="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let a=e.reduce((s,u)=>s.concat(Object.keys(u)),[]);if(a.length>0){let s=[...new Set(a)].map(u=>`"${u}"`);this.url.searchParams.set("columns",s.join(","))}}return new ka.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:o,defaultToNull:i=!0}={}){var a;let s="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),o&&this.headers.append("Prefer",`count=${o}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new ka.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}update(e,{count:r}={}){var n;let o="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new ka.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:e}={}){var r;let n="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new ka.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Bd.default=Rd});var t0=S(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var e0=(he(),oe(pe)),qk=e0.__importDefault(Nd()),Hk=e0.__importDefault(_u()),Ld=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new qk.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([d,p])=>p!==void 0).map(([d,p])=>[d,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([d,p])=>{u.searchParams.append(d,p)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new Hk.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};jd.default=Ld});var Ud=S(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.PostgrestError=At.PostgrestBuilder=At.PostgrestTransformBuilder=At.PostgrestFilterBuilder=At.PostgrestQueryBuilder=At.PostgrestClient=void 0;var Zo=(he(),oe(pe)),r0=Zo.__importDefault(t0());At.PostgrestClient=r0.default;var n0=Zo.__importDefault(Nd());At.PostgrestQueryBuilder=n0.default;var o0=Zo.__importDefault(_u());At.PostgrestFilterBuilder=o0.default;var i0=Zo.__importDefault($d());At.PostgrestTransformBuilder=i0.default;var a0=Zo.__importDefault(Fd());At.PostgrestBuilder=a0.default;var s0=Zo.__importDefault(xd());At.PostgrestError=s0.default;At.default={PostgrestClient:r0.default,PostgrestQueryBuilder:n0.default,PostgrestFilterBuilder:o0.default,PostgrestTransformBuilder:i0.default,PostgrestBuilder:a0.default,PostgrestError:s0.default}});var qd={};Yr(qd,{RealtimeClient:()=>Md});var Md,Hd=Xe(()=>{Md=class{constructor(){}connect(){}disconnect(){}}});var En=S(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.StorageUnknownError=Zr.StorageApiError=Zr.StorageError=void 0;Zr.isStorageError=Vk;var Pa=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Zr.StorageError=Pa;function Vk(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Vd=class extends Pa{constructor(e,r,n){super(e),this.name="StorageApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Zr.StorageApiError=Vd;var zd=class extends Pa{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Zr.StorageUnknownError=zd});var $a=S(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.isPlainObject=ir.recursiveToCamel=ir.resolveResponse=ir.resolveFetch=void 0;var zk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);ir.resolveFetch=zk;var Kk=()=>Response;ir.resolveResponse=Kk;var Gk=t=>{if(Array.isArray(t))return t.map(r=>(0,ir.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let o=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[o]=(0,ir.recursiveToCamel)(n)}),e};ir.recursiveToCamel=Gk;var Wk=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};ir.isPlainObject=Wk});var Su=S(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.get=Xk;Wn.post=Zk;Wn.put=Qk;Wn.head=eP;Wn.remove=tP;var Gn=(he(),oe(pe)),Kd=En(),u0=$a(),Gd=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Yk=(t,e,r)=>Gn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,u0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new Kd.StorageApiError(Gd(o),i,a))}).catch(o=>{e(new Kd.StorageUnknownError(Gd(o),o))}):e(new Kd.StorageUnknownError(Gd(t),t))}),Jk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,u0.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,e?.duplex&&(o.duplex=e.duplex),Object.assign(Object.assign({},o),r))};function Ia(t,e,r,n,o,i){return Gn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Jk(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>Yk(u,s,n))})})}function Xk(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return Ia(t,"GET",e,r,n)})}function Zk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Ia(t,"POST",e,n,o,r)})}function Qk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Ia(t,"PUT",e,n,o,r)})}function eP(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return Ia(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function tP(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Ia(t,"DELETE",e,n,o,r)})}});var c0=S(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var rP=(he(),oe(pe)),nP=En(),Wd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return rP.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,nP.isStorageError)(e))return{data:null,error:e};throw e}})}};Yd.default=Wd});var d0=S(Xd=>{"use strict";var l0;Object.defineProperty(Xd,"__esModule",{value:!0});var f0=(he(),oe(pe)),oP=En(),iP=f0.__importDefault(c0()),Jd=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[l0]="BlobDownloadBuilder",this.promise=null}asStream(){return new iP.default(this.downloadFn,this.shouldThrowOnError)}then(e,r){return this.getPromise().then(e,r)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return f0.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if((0,oP.isStorageError)(e))return{data:null,error:e};throw e}})}};l0=Symbol.toStringTag;Xd.default=Jd});var m0=S(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var Ot=(he(),oe(pe)),Nt=En(),Lt=Su(),p0=$a(),aP=Ot.__importDefault(d0()),sP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},h0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Zd=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,p0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return Ot.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},h0),o),s=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(a.upsert)}),u=a.metadata;typeof Blob<"u"&&n instanceof Blob?(i=new FormData,i.append("cacheControl",a.cacheControl),u&&i.append("metadata",this.encodeMetadata(u)),i.append("",n)):typeof FormData<"u"&&n instanceof FormData?(i=n,i.has("cacheControl")||i.append("cacheControl",a.cacheControl),u&&!i.has("metadata")&&i.append("metadata",this.encodeMetadata(u))):(i=n,s["cache-control"]=`max-age=${a.cacheControl}`,s["content-type"]=a.contentType,u&&(s["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!a.duplex&&(a.duplex="half")),o?.headers&&(s=Object.assign(Object.assign({},s),o.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),d=yield(e=="PUT"?Lt.put:Lt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Nt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return Ot.__awaiter(this,void 0,void 0,function*(){let i=this._removeEmptyFolders(e),a=this._getFinalPath(i),s=new URL(this.url+`/object/upload/sign/${a}`);s.searchParams.set("token",r);try{let u,c=Object.assign({upsert:h0.upsert},o),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let d=yield(0,Lt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Nt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return Ot.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),o=Object.assign({},this.headers);r?.upsert&&(o["x-upsert"]="true");let i=yield(0,Lt.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:o}),a=new URL(this.url+i.url),s=a.searchParams.get("token");if(!s)throw new Nt.StorageError("No token returned by API");return{data:{signedUrl:a.toString(),path:e,token:s},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Lt.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Lt.post)(this.fetch,`${this.url}/object/sign/${o}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),a=n?.download?`&download=${n.download===!0?"":n.download}`:"";return i={signedUrl:encodeURI(`${this.url}${i.signedURL}${a}`)},{data:i,error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Lt.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),i=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:o.map(a=>Object.assign(Object.assign({},a),{signedUrl:a.signedURL?encodeURI(`${this.url}${a.signedURL}${i}`):null})),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}download(e,r){let o=typeof r?.transform<"u"?"render/image/authenticated":"object",i=this.transformOptsToQueryString(r?.transform||{}),a=i?`?${i}`:"",s=this._getFinalPath(e),u=()=>(0,Lt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new aP.default(u,this.shouldThrowOnError)}info(e){return Ot.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Lt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,p0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return Ot.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Lt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n)&&n instanceof Nt.StorageUnknownError){let o=n.originalError;if([400,404].includes(o?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),o=[],i=r?.download?`download=${r.download===!0?"":r.download}`:"";i!==""&&o.push(i);let s=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&o.push(u);let c=o.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${c}`)}}}remove(e){return Ot.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return Ot.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},sP),r),{prefix:e||""});return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,o,{headers:this.headers},n),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,Nt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return Ot.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Lt.post)(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,n,{headers:this.headers},r),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Nt.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let r=[];return e.width&&r.push(`width=${e.width}`),e.height&&r.push(`height=${e.height}`),e.resize&&r.push(`resize=${e.resize}`),e.format&&r.push(`format=${e.format}`),e.quality&&r.push(`quality=${e.quality}`),r.join("&")}};Qd.default=Zd});var ep=S(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.version=void 0;xu.version="2.84.0"});var tp=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});Au.DEFAULT_HEADERS=void 0;var uP=ep();Au.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${uP.version}`}});var g0=S(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var Qo=(he(),oe(pe)),cP=tp(),ei=En(),ti=Su(),lP=$a(),rp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1;let i=new URL(e);o?.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},cP.DEFAULT_HEADERS),r),this.fetch=(0,lP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Qo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,ti.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ei.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ti.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ei.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Qo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,ti.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(o){if(this.shouldThrowOnError)throw o;if((0,ei.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return Qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ti.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,ei.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ti.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ei.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Qo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ti.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ei.isStorageError)(r))return{data:null,error:r};throw r}})}listBucketOptionsToQueryString(e){let r={};return e&&("limit"in e&&(r.limit=String(e.limit)),"offset"in e&&(r.offset=String(e.offset)),e.search&&(r.search=e.search),e.sortColumn&&(r.sortColumn=e.sortColumn),e.sortOrder&&(r.sortOrder=e.sortOrder)),Object.keys(r).length>0?"?"+new URLSearchParams(r).toString():""}};np.default=rp});var cp=S(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var op=(he(),oe(pe)),fP=tp(),ip=En(),ap=Su(),dP=$a(),sp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},fP.DEFAULT_HEADERS),r),this.fetch=(0,dP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return op.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ap.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ip.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return op.__awaiter(this,void 0,void 0,function*(){try{let r=new URLSearchParams;e?.limit!==void 0&&r.set("limit",e.limit.toString()),e?.offset!==void 0&&r.set("offset",e.offset.toString()),e?.sortColumn&&r.set("sortColumn",e.sortColumn),e?.sortOrder&&r.set("sortOrder",e.sortOrder),e?.search&&r.set("search",e.search);let n=r.toString(),o=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,ap.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ip.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return op.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ap.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ip.isStorageError)(r))return{data:null,error:r};throw r}})}};up.default=sp});var Fu=S(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.DEFAULT_HEADERS=void 0;var pP=ep();Ou.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${pP.version}`,"Content-Type":"application/json"}});var ri=S(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.StorageVectorsErrorCode=Er.StorageVectorsUnknownError=Er.StorageVectorsApiError=Er.StorageVectorsError=void 0;Er.isStorageVectorsError=hP;var Ta=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Er.StorageVectorsError=Ta;function hP(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var lp=class extends Ta{constructor(e,r,n){super(e),this.name="StorageVectorsApiError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};Er.StorageVectorsApiError=lp;var fp=class extends Ta{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Er.StorageVectorsUnknownError=fp;var y0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(y0||(Er.StorageVectorsErrorCode=y0={}))});var ni=S(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.validateVectorDimension=ar.normalizeToFloat32=ar.isPlainObject=ar.resolveResponse=ar.resolveFetch=void 0;var mP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);ar.resolveFetch=mP;var gP=()=>Response;ar.resolveResponse=gP;var yP=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};ar.isPlainObject=yP;var DP=t=>Array.from(new Float32Array(t));ar.normalizeToFloat32=DP;var bP=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};ar.validateVectorDimension=bP});var $u=S(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.get=EP;ii.post=_P;ii.put=SP;ii.remove=xP;var oi=(he(),oe(pe)),ku=ri(),wP=ni(),D0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),vP=(t,e,r)=>oi.__awaiter(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!r?.noResolveJson){let o=t.status||500,i=t;if(typeof i.json=="function")i.json().then(a=>{let s=a?.statusCode||a?.code||o+"";e(new ku.StorageVectorsApiError(D0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new ku.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new ku.StorageVectorsApiError(s,o,a))}}else e(new ku.StorageVectorsUnknownError(D0(t),t))}),CP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,wP.isPlainObject)(n)?(o.headers=Object.assign({"Content-Type":"application/json"},e?.headers),o.body=JSON.stringify(n)):o.body=n,Object.assign(Object.assign({},o),r))};function Pu(t,e,r,n,o,i){return oi.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,CP(e,n,o,i)).then(u=>{if(!u.ok)throw u;if(n?.noResolveJson)return u;let c=u.headers.get("content-type");return!c||!c.includes("application/json")?{}:u.json()}).then(u=>a(u)).catch(u=>vP(u,s,n))})})}function EP(t,e,r,n){return oi.__awaiter(this,void 0,void 0,function*(){return Pu(t,"GET",e,r,n)})}function _P(t,e,r,n,o){return oi.__awaiter(this,void 0,void 0,function*(){return Pu(t,"POST",e,n,o,r)})}function SP(t,e,r,n,o){return oi.__awaiter(this,void 0,void 0,function*(){return Pu(t,"PUT",e,n,o,r)})}function xP(t,e,r,n,o){return oi.__awaiter(this,void 0,void 0,function*(){return Pu(t,"DELETE",e,n,o,r)})}});var hp=S(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var Iu=(he(),oe(pe)),AP=Fu(),Tu=ri(),Ru=$u(),OP=ni(),dp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},AP.DEFAULT_HEADERS),r),this.fetch=(0,OP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ru.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Tu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Tu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Tu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Iu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ru.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Tu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};pp.default=dp});var yp=S(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var Ra=(he(),oe(pe)),FP=Fu(),Ba=ri(),Na=$u(),kP=ni(),mp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},FP.DEFAULT_HEADERS),r),this.fetch=(0,kP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Ra.__awaiter(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield(0,Na.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ba.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Ra.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Na.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ba.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Ra.__awaiter(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield(0,Na.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ba.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Ra.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Na.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ba.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Ra.__awaiter(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield(0,Na.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ba.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};gp.default=mp});var wp=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var Bu=(he(),oe(pe)),PP=Fu(),Nu=ri(),Lu=$u(),$P=ni(),Dp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},PP.DEFAULT_HEADERS),r),this.fetch=(0,$P.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Bu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Lu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Bu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Lu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Bu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Lu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Bu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Lu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Nu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};bp.default=Dp});var b0=S(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.VectorIndexScope=_n.VectorBucketScope=_n.StorageVectorsClient=void 0;var sr=(he(),oe(pe)),IP=sr.__importDefault(hp()),TP=sr.__importDefault(yp()),RP=sr.__importDefault(wp()),vp=class extends RP.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new ju(this.url,this.headers,e,this.fetch)}};_n.StorageVectorsClient=vp;var ju=class extends IP.default{constructor(e,r,n,o){super(e,r,o),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return sr.__awaiter(this,void 0,void 0,function*(){return r.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return sr.__awaiter(this,arguments,void 0,function*(r={}){return e.listIndexes.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let r=Object.create(null,{getIndex:{get:()=>super.getIndex}});return sr.__awaiter(this,void 0,void 0,function*(){return r.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let r=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return sr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Uu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};_n.VectorBucketScope=ju;var Uu=class extends TP.default{constructor(e,r,n,o,i){super(e,r,i),this.vectorBucketName=n,this.indexName=o}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return sr.__awaiter(this,void 0,void 0,function*(){return r.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let r=Object.create(null,{getVectors:{get:()=>super.getVectors}});return sr.__awaiter(this,void 0,void 0,function*(){return r.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return sr.__awaiter(this,arguments,void 0,function*(r={}){return e.listVectors.call(this,Object.assign(Object.assign({},r),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let r=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return sr.__awaiter(this,void 0,void 0,function*(){return r.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let r=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return sr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};_n.VectorIndexScope=Uu});var _p=S(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.validateVectorDimension=me.normalizeToFloat32=me.isPlainObject=me.resolveResponse=me.resolveFetch=me.isStorageVectorsError=me.StorageVectorsErrorCode=me.StorageVectorsUnknownError=me.StorageVectorsApiError=me.StorageVectorsError=me.VectorDataApi=me.VectorIndexApi=me.VectorBucketApi=me.VectorIndexScope=me.VectorBucketScope=me.StorageVectorsClient=void 0;var Cp=(he(),oe(pe)),Ep=b0();Object.defineProperty(me,"StorageVectorsClient",{enumerable:!0,get:function(){return Ep.StorageVectorsClient}});Object.defineProperty(me,"VectorBucketScope",{enumerable:!0,get:function(){return Ep.VectorBucketScope}});Object.defineProperty(me,"VectorIndexScope",{enumerable:!0,get:function(){return Ep.VectorIndexScope}});var BP=wp();Object.defineProperty(me,"VectorBucketApi",{enumerable:!0,get:function(){return Cp.__importDefault(BP).default}});var NP=hp();Object.defineProperty(me,"VectorIndexApi",{enumerable:!0,get:function(){return Cp.__importDefault(NP).default}});var LP=yp();Object.defineProperty(me,"VectorDataApi",{enumerable:!0,get:function(){return Cp.__importDefault(LP).default}});var La=ri();Object.defineProperty(me,"StorageVectorsError",{enumerable:!0,get:function(){return La.StorageVectorsError}});Object.defineProperty(me,"StorageVectorsApiError",{enumerable:!0,get:function(){return La.StorageVectorsApiError}});Object.defineProperty(me,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return La.StorageVectorsUnknownError}});Object.defineProperty(me,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return La.StorageVectorsErrorCode}});Object.defineProperty(me,"isStorageVectorsError",{enumerable:!0,get:function(){return La.isStorageVectorsError}});var ja=ni();Object.defineProperty(me,"resolveFetch",{enumerable:!0,get:function(){return ja.resolveFetch}});Object.defineProperty(me,"resolveResponse",{enumerable:!0,get:function(){return ja.resolveResponse}});Object.defineProperty(me,"isPlainObject",{enumerable:!0,get:function(){return ja.isPlainObject}});Object.defineProperty(me,"normalizeToFloat32",{enumerable:!0,get:function(){return ja.normalizeToFloat32}});Object.defineProperty(me,"validateVectorDimension",{enumerable:!0,get:function(){return ja.validateVectorDimension}})});var w0=S(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.StorageClient=void 0;var xp=(he(),oe(pe)),jP=xp.__importDefault(m0()),UP=xp.__importDefault(g0()),MP=xp.__importDefault(cp()),qP=_p(),Sp=class extends UP.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new jP.default(this.url,this.headers,e,this.fetch)}get vectors(){return new qP.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new MP.default(this.url+"/iceberg",this.headers,this.fetch)}};Mu.StorageClient=Sp});var C0=S(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0})});var E0=S(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.StorageAnalyticsClient=Qr.StorageClient=void 0;var qu=(he(),oe(pe)),HP=w0();Object.defineProperty(Qr,"StorageClient",{enumerable:!0,get:function(){return HP.StorageClient}});var VP=cp();Object.defineProperty(Qr,"StorageAnalyticsClient",{enumerable:!0,get:function(){return qu.__importDefault(VP).default}});qu.__exportStar(C0(),Qr);qu.__exportStar(En(),Qr);qu.__exportStar(_p(),Qr)});var _0=S(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.version=void 0;Hu.version="2.84.0"});var S0=S(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.DEFAULT_REALTIME_OPTIONS=Gt.DEFAULT_AUTH_OPTIONS=Gt.DEFAULT_DB_OPTIONS=Gt.DEFAULT_GLOBAL_OPTIONS=Gt.DEFAULT_HEADERS=void 0;var zP=_0(),Ua="";typeof Deno<"u"?Ua="deno":typeof document<"u"?Ua="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ua="react-native":Ua="node";Gt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Ua}/${zP.version}`};Gt.DEFAULT_GLOBAL_OPTIONS={headers:Gt.DEFAULT_HEADERS};Gt.DEFAULT_DB_OPTIONS={schema:"public"};Gt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Gt.DEFAULT_REALTIME_OPTIONS={}});var x0=S(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.fetchWithAuth=Pr.resolveHeadersConstructor=Pr.resolveFetch=void 0;var KP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Pr.resolveFetch=KP;var GP=()=>Headers;Pr.resolveHeadersConstructor=GP;var WP=(t,e,r)=>{let n=(0,Pr.resolveFetch)(r),o=(0,Pr.resolveHeadersConstructor)();return async(i,a)=>{var s;let u=(s=await e())!==null&&s!==void 0?s:t,c=new o(a?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(i,Object.assign(Object.assign({},a),{headers:c}))}};Pr.fetchWithAuth=WP});var O0=S(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.isBrowser=void 0;Sn.uuid=YP;Sn.ensureTrailingSlash=A0;Sn.applySettingDefaults=XP;Sn.validateSupabaseUrl=ZP;function YP(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t=="x"?e:e&3|8;return r.toString(16)})}function A0(t){return t.endsWith("/")?t:t+"/"}var JP=()=>typeof window<"u";Sn.isBrowser=JP;function XP(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:d}=e,p={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},l),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function ZP(t){let e=t?.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(A0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var jp={};Yr(jp,{AuthAdminApi:()=>Op,AuthApiError:()=>Fp,AuthClient:()=>Ap,AuthError:()=>_r,AuthImplicitGrantRedirectError:()=>Tp,AuthInvalidCredentialsError:()=>Ip,AuthInvalidTokenResponseError:()=>$p,AuthPKCEGrantCodeExchangeError:()=>Rp,AuthRetryableError:()=>kp,AuthSessionMissingError:()=>Pp,AuthWeakPasswordError:()=>Bp,GoTrueAdminApi:()=>zu,GoTrueClient:()=>Vu,NavigatorLockAcquireTimeoutError:()=>Np,isAuthApiError:()=>n3,isAuthError:()=>r3,isAuthRetryableError:()=>o3,isAuthSessionMissingError:()=>i3,isAuthWeakPasswordError:()=>a3,lockInternals:()=>t3,navigatorLock:()=>QP,processLock:()=>e3});var Lp,F0,Vu,zu,Ap,Op,_r,Fp,kp,Pp,$p,Ip,Tp,Rp,Bp,QP,e3,Np,t3,r3,n3,o3,i3,a3,Up=Xe(()=>{Lp=()=>Promise.resolve({data:{session:null,user:null},error:null}),F0={get:(t,e)=>{if(e==="constructor")return t.constructor;if(!(e==="then"||e==="catch"||e==="finally")&&typeof e!="symbol")return e==="getSession"?()=>Promise.resolve({data:{session:null,user:null},error:null}):e==="onAuthStateChange"?()=>({data:{subscription:{unsubscribe:()=>{}}},error:null}):Lp}},Vu=class{constructor(e){return this.options=e,new Proxy(this,F0)}},zu=class{constructor(e){return this.options=e,new Proxy(this,F0)}},Ap=class extends Vu{},Op=class extends zu{},_r=class extends Error{},Fp=class extends _r{},kp=class extends _r{},Pp=class extends _r{},$p=class extends _r{},Ip=class extends _r{},Tp=class extends _r{},Rp=class extends _r{},Bp=class extends _r{},QP=Lp,e3=Lp,Np=class extends Error{},t3={},r3=()=>!1,n3=()=>!1,o3=()=>!1,i3=()=>!1,a3=()=>!1});var k0=S(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.SupabaseAuthClient=void 0;var s3=(Up(),oe(jp)),Mp=class extends s3.AuthClient{constructor(e){super(e)}};Ku.SupabaseAuthClient=Mp});var Vp=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var u3=Ed(),c3=Ud(),l3=(Hd(),oe(qd)),f3=E0(),Gu=S0(),d3=x0(),P0=O0(),p3=k0(),qp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,P0.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);let u=`sb-${s.hostname.split(".")[0]}-auth-token`,c={db:Gu.DEFAULT_DB_OPTIONS,realtime:Gu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Gu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Gu.DEFAULT_GLOBAL_OPTIONS},l=(0,P0.applySettingDefaults)(n??{},c);this.storageKey=(o=l.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(d,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,d3.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new c3.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new f3.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new u3.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,r={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,r,n)}channel(e,r={config:{}}){return this.realtime.channel(e,r)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,r;if(this.accessToken)return await this.accessToken();let{data:n}=await this.auth.getSession();return(r=(e=n.session)===null||e===void 0?void 0:e.access_token)!==null&&r!==void 0?r:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,storageKey:a,flowType:s,lock:u,debug:c,throwOnError:l},d,p){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new p3.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new l3.RealtimeClient(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,n)=>{this._handleTokenChanged(r,"CLIENT",n?.access_token)})}_handleTokenChanged(e,r,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Hp.default=qp});var T0=S(Re=>{"use strict";var h3=Re&&Re.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),$0=Re&&Re.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&h3(e,t,r)},I0=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.createClient=Re.SupabaseClient=Re.FunctionRegion=Re.FunctionsError=Re.FunctionsRelayError=Re.FunctionsFetchError=Re.FunctionsHttpError=Re.PostgrestError=void 0;var m3=I0(Vp());$0((Up(),oe(jp)),Re);var g3=Ud();Object.defineProperty(Re,"PostgrestError",{enumerable:!0,get:function(){return g3.PostgrestError}});var Ma=Ed();Object.defineProperty(Re,"FunctionsHttpError",{enumerable:!0,get:function(){return Ma.FunctionsHttpError}});Object.defineProperty(Re,"FunctionsFetchError",{enumerable:!0,get:function(){return Ma.FunctionsFetchError}});Object.defineProperty(Re,"FunctionsRelayError",{enumerable:!0,get:function(){return Ma.FunctionsRelayError}});Object.defineProperty(Re,"FunctionsError",{enumerable:!0,get:function(){return Ma.FunctionsError}});Object.defineProperty(Re,"FunctionRegion",{enumerable:!0,get:function(){return Ma.FunctionRegion}});$0((Hd(),oe(qd)),Re);var y3=Vp();Object.defineProperty(Re,"SupabaseClient",{enumerable:!0,get:function(){return I0(y3).default}});var D3=(t,e,r)=>new m3.default(t,e,r);Re.createClient=D3;function b3(){if(typeof window<"u"||typeof process>"u")return!1;let t=process.version;if(t==null)return!1;let e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}b3()&&console.warn("\u26A0\uFE0F Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")});var zp=S((yz,R0)=>{R0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var Wu=S(N0=>{var B0={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",DESCRIPTOR_NOT_EXIST:"No descriptor present",DESCRIPTOR_UNKNOWN:"Unknown descriptor format",DESCRIPTOR_FAULTY:"Descriptor data is malformed",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed {0}",FILE_IN_THE_WAY:"There is a file in the way: {0}",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:'File not found: "{0}"',NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found",INVALID_PASS_PARAM:"Incompatible password parameter",WRONG_PASSWORD:"Wrong Password",COMMENT_TOO_LONG:"Comment is too long",EXTRA_FIELD_PARSE_ERROR:"Extra field parsing error"};function w3(t){return function(...e){return e.length&&(t=t.replace(/\{(\d)\}/g,(r,n)=>e[n]||"")),new Error("ADM-ZIP: "+t)}}for(let t of Object.keys(B0))N0[t]=w3(B0[t])});var q0=S((bz,M0)=>{var v3=require("fs"),nt=require("path"),L0=zp(),C3=Wu(),E3=typeof process=="object"&&process.platform==="win32",j0=t=>typeof t=="object"&&t!==null,U0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=3988292384^e>>>1:e>>>=1;return e>>>0});function We(t){this.sep=nt.sep,this.fs=v3,j0(t)&&j0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}M0.exports=We;We.prototype.makeDir=function(t){let e=this;function r(n){let o=n.split(e.sep)[0];n.split(e.sep).forEach(function(i){if(!(!i||i.substr(-1,1)===":")){o+=e.sep+i;var a;try{a=e.fs.statSync(o)}catch{e.fs.mkdirSync(o)}if(a&&a.isFile())throw C3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};We.prototype.writeFileTo=function(t,e,r,n){let o=this;if(o.fs.existsSync(t)){if(!r)return!1;var i=o.fs.statSync(t);if(i.isDirectory())return!1}var a=nt.dirname(t);o.fs.existsSync(a)||o.makeDir(a);var s;try{s=o.fs.openSync(t,"w",438)}catch{o.fs.chmodSync(t,438),s=o.fs.openSync(t,"w",438)}if(s)try{o.fs.writeSync(s,e,0,e.length,0)}finally{o.fs.closeSync(s)}return o.fs.chmodSync(t,n||438),!0};We.prototype.writeFileToAsync=function(t,e,r,n,o){typeof n=="function"&&(o=n,n=void 0);let i=this;i.fs.exists(t,function(a){if(a&&!r)return o(!1);i.fs.stat(t,function(s,u){if(a&&u.isDirectory())return o(!1);var c=nt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(d,p){d?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):p?i.fs.write(p,e,0,e.length,0,function(){i.fs.close(p,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};We.prototype.findFiles=function(t){let e=this;function r(n,o,i){typeof o=="boolean"&&(i=o,o=void 0);let a=[];return e.fs.readdirSync(n).forEach(function(s){let u=nt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(nt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};We.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(o,i){if(o)return e(o);let a=i.length;if(!a)return e(null,n);i.forEach(function(s){s=nt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(nt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,d){if(l)return e(l);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};We.prototype.getAttributes=function(){};We.prototype.setAttributes=function(){};We.crc32update=function(t,e){return U0[(t^e)&255]^t>>>8};We.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=We.crc32update(r,t[n++]);return~r>>>0};We.methodToString=function(t){switch(t){case L0.STORED:return"STORED ("+t+")";case L0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};We.canonical=function(t){if(!t)return"";let e=nt.posix.normalize("/"+t.split("\\").join("/"));return nt.join(".",e)};We.zipnamefix=function(t){if(!t)return"";let e=nt.posix.normalize("/"+t.split("\\").join("/"));return nt.posix.join(".",e)};We.findLast=function(t,e){if(!Array.isArray(t))throw new TypeError("arr is not array");let r=t.length>>>0;for(let n=r-1;n>=0;n--)if(e(t[n],n,t))return t[n]};We.sanitize=function(t,e){t=nt.resolve(nt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=nt.normalize(nt.join(t,r.slice(n,o).join(nt.sep)));if(i.indexOf(t)===0)return i}return nt.normalize(nt.join(t,nt.basename(e)))};We.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};We.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};We.fromDOS2Date=function(t){return new Date((t>>25&127)+1980,Math.max((t>>21&15)-1,0),Math.max(t>>16&31,1),t>>11&31,t>>5&63,(t&31)<<1)};We.fromDate2DOS=function(t){let e=0,r=0;return t.getFullYear()>1979&&(e=(t.getFullYear()-1980&127)<<9|t.getMonth()+1<<5|t.getDate(),r=t.getHours()<<11|t.getMinutes()<<5|t.getSeconds()>>1),e<<16|r};We.isWin=E3;We.crcTable=U0});var V0=S((wz,H0)=>{var _3=require("path");H0.exports=function(t,{fs:e}){var r=t||"",n=i(),o=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(o=e.statSync(r),n.directory=o.isDirectory(),n.mtime=o.mtime,n.atime=o.atime,n.executable=(73&o.mode)!==0,n.readonly=(128&o.mode)===0,n.hidden=_3.basename(r)[0]==="."):console.warn("Invalid path: "+r),{get directory(){return n.directory},get readOnly(){return n.readonly},get hidden(){return n.hidden},get mtime(){return n.mtime},get atime(){return n.atime},get executable(){return n.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:r,isDirectory:n.directory,isReadOnly:n.readonly,isHidden:n.hidden,isExecutable:n.executable,mTime:n.mtime,aTime:n.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var K0=S((vz,z0)=>{z0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var si=S((Cz,ai)=>{ai.exports=q0();ai.exports.Constants=zp();ai.exports.Errors=Wu();ai.exports.FileAttr=V0();ai.exports.decoder=K0()});var W0=S((Ez,G0)=>{var xn=si(),Y=xn.Constants;G0.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,l=0,d=0,p=0,h=0,m=0;t|=xn.isWin?2560:768,r|=Y.FLG_EFS;let b={extraLen:0},y=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=xn.fromDate2DOS(new Date),{get made(){return t},set made(g){t=g},get version(){return e},set version(g){e=g},get flags(){return r},set flags(g){r=g},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(g){g?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(g){g?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(g){switch(g){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=g},get time(){return xn.fromDOS2Date(this.timeval)},set time(g){this.timeval=xn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=y(g)},get timeHighByte(){return E(o>>>8)},get crc(){return i},set crc(g){i=y(g)},get compressedSize(){return a},set compressedSize(g){a=y(g)},get size(){return s},set size(g){s=y(g)},get fileNameLength(){return u},set fileNameLength(g){u=g},get extraLength(){return c},set extraLength(g){c=g},get extraLocalLength(){return b.extraLen},set extraLocalLength(g){b.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return d},set diskNumStart(g){d=y(g)},get inAttr(){return p},set inAttr(g){p=y(g)},get attr(){return h},set attr(g){h=y(g)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(g){m=y(g)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return m+Y.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+Y.LOCHDR);if(_.readUInt32LE(0)!==Y.LOCSIG)throw xn.Errors.INVALID_LOC();b.version=_.readUInt16LE(Y.LOCVER),b.flags=_.readUInt16LE(Y.LOCFLG),b.method=_.readUInt16LE(Y.LOCHOW),b.time=_.readUInt32LE(Y.LOCTIM),b.crc=_.readUInt32LE(Y.LOCCRC),b.compressedSize=_.readUInt32LE(Y.LOCSIZ),b.size=_.readUInt32LE(Y.LOCLEN),b.fnameLen=_.readUInt16LE(Y.LOCNAM),b.extraLen=_.readUInt16LE(Y.LOCEXT);let x=m+Y.LOCHDR+b.fnameLen,$=x+b.extraLen;return g.slice(x,$)},loadFromBinary:function(g){if(g.length!==Y.CENHDR||g.readUInt32LE(0)!==Y.CENSIG)throw xn.Errors.INVALID_CEN();t=g.readUInt16LE(Y.CENVEM),e=g.readUInt16LE(Y.CENVER),r=g.readUInt16LE(Y.CENFLG),n=g.readUInt16LE(Y.CENHOW),o=g.readUInt32LE(Y.CENTIM),i=g.readUInt32LE(Y.CENCRC),a=g.readUInt32LE(Y.CENSIZ),s=g.readUInt32LE(Y.CENLEN),u=g.readUInt16LE(Y.CENNAM),c=g.readUInt16LE(Y.CENEXT),l=g.readUInt16LE(Y.CENCOM),d=g.readUInt16LE(Y.CENDSK),p=g.readUInt16LE(Y.CENATT),h=g.readUInt32LE(Y.CENATX),m=g.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(Y.LOCHDR);return g.writeUInt32LE(Y.LOCSIG,0),g.writeUInt16LE(e,Y.LOCVER),g.writeUInt16LE(r,Y.LOCFLG),g.writeUInt16LE(n,Y.LOCHOW),g.writeUInt32LE(o,Y.LOCTIM),g.writeUInt32LE(i,Y.LOCCRC),g.writeUInt32LE(a,Y.LOCSIZ),g.writeUInt32LE(s,Y.LOCLEN),g.writeUInt16LE(u,Y.LOCNAM),g.writeUInt16LE(b.extraLen,Y.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(Y.CENHDR+u+c+l);return g.writeUInt32LE(Y.CENSIG,0),g.writeUInt16LE(t,Y.CENVEM),g.writeUInt16LE(e,Y.CENVER),g.writeUInt16LE(r,Y.CENFLG),g.writeUInt16LE(n,Y.CENHOW),g.writeUInt32LE(o,Y.CENTIM),g.writeUInt32LE(i,Y.CENCRC),g.writeUInt32LE(a,Y.CENSIZ),g.writeUInt32LE(s,Y.CENLEN),g.writeUInt16LE(u,Y.CENNAM),g.writeUInt16LE(c,Y.CENEXT),g.writeUInt16LE(l,Y.CENCOM),g.writeUInt16LE(d,Y.CENDSK),g.writeUInt16LE(p,Y.CENATT),g.writeUInt32LE(h,Y.CENATX),g.writeUInt32LE(m,Y.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:xn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:g(a),size:g(s),fileNameLength:g(u),extraLength:g(c),commentLength:g(l),diskNumStart:d,inAttr:p,attr:h,offset:m,centralHeaderSize:g(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var J0=S((_z,Y0)=>{var ui=si(),Ve=ui.Constants;Y0.exports=function(){var t=0,e=0,r=0,n=0,o=0;return{get diskEntries(){return t},set diskEntries(i){t=e=i},get totalEntries(){return e},set totalEntries(i){e=t=i},get size(){return r},set size(i){r=i},get offset(){return n},set offset(i){n=i},get commentLength(){return o},set commentLength(i){o=i},get mainHeaderSize(){return Ve.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Ve.ENDHDR||i.readUInt32LE(0)!==Ve.ENDSIG)&&(i.length<Ve.ZIP64HDR||i.readUInt32LE(0)!==Ve.ZIP64SIG))throw ui.Errors.INVALID_END();i.readUInt32LE(0)===Ve.ENDSIG?(t=i.readUInt16LE(Ve.ENDSUB),e=i.readUInt16LE(Ve.ENDTOT),r=i.readUInt32LE(Ve.ENDSIZ),n=i.readUInt32LE(Ve.ENDOFF),o=i.readUInt16LE(Ve.ENDCOM)):(t=ui.readBigUInt64LE(i,Ve.ZIP64SUB),e=ui.readBigUInt64LE(i,Ve.ZIP64TOT),r=ui.readBigUInt64LE(i,Ve.ZIP64SIZE),n=ui.readBigUInt64LE(i,Ve.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Ve.ENDHDR+o);return i.writeUInt32LE(Ve.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Ve.ENDSUB),i.writeUInt16LE(e,Ve.ENDTOT),i.writeUInt32LE(r,Ve.ENDSIZ),i.writeUInt32LE(n,Ve.ENDOFF),i.writeUInt16LE(o,Ve.ENDCOM),i.fill(" ",Ve.ENDHDR),i},toJSON:function(){let i=function(a,s){let u=a.toString(16).toUpperCase();for(;u.length<s;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:i(n,4),commentLength:o}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Gp=S(Kp=>{Kp.EntryHeader=W0();Kp.MainHeader=J0()});var Z0=S((xz,X0)=>{X0.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var o=e.createDeflateRaw(r),i=[],a=0;o.on("data",function(s){i.push(s),a+=s.length}),o.on("end",function(){var s=Buffer.alloc(a),u=0;s.fill(0);for(var c=0;c<i.length;c++){var l=i[c];l.copy(s,u),u+=l.length}n&&n(s)}),o.end(t)}}}});var eb=S((Az,Q0)=>{var S3=+(process.versions?process.versions.node:"").split(".")[0]||0;Q0.exports=function(t,e){var r=require("zlib");let n=S3>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(o){var i=r.createInflateRaw(n),a=[],s=0;i.on("data",function(u){a.push(u),s+=u.length}),i.on("end",function(){var u=Buffer.alloc(s),c=0;u.fill(0);for(var l=0;l<a.length;l++){var d=a[l];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var ib=S((Oz,ob)=>{"use strict";var{randomFillSync:tb}=require("crypto"),x3=Wu(),A3=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)(e&1)!==0?e=e>>>1^3988292384:e>>>=1;return e>>>0}),nb=(t,e)=>Math.imul(t,e)>>>0,rb=(t,e)=>A3[(t^e)&255]^t>>>8,qa=()=>typeof tb=="function"?tb(Buffer.alloc(12)):qa.node();qa.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r<e;r++)t[r]=Math.random()*256&255;return t};var Yu={genSalt:qa};function Ju(t){let e=Buffer.isBuffer(t)?t:Buffer.from(t);this.keys=new Uint32Array([305419896,591751049,878082192]);for(let r=0;r<e.length;r++)this.updateKeys(e[r])}Ju.prototype.updateKeys=function(t){let e=this.keys;return e[0]=rb(e[0],t),e[1]+=e[0]&255,e[1]=nb(e[1],134775813)+1,e[2]=rb(e[2],e[1]>>>24),t};Ju.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return nb(t,t^1)>>8&255};function O3(t){let e=new Ju(t);return function(r){let n=Buffer.alloc(r.length),o=0;for(let i of r)n[o++]=e.updateKeys(i^e.next());return n}}function F3(t){let e=new Ju(t);return function(r,n,o=0){n||(n=Buffer.alloc(r.length));for(let i of r){let a=e.next();n[o++]=i^a,e.updateKeys(i)}return n}}function k3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=O3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw x3.WRONG_PASSWORD();return n(t.slice(12))}function P3(t){Buffer.isBuffer(t)&&t.length>=12?Yu.genSalt=function(){return t.slice(0,12)}:t==="node"?Yu.genSalt=qa.node:Yu.genSalt=qa}function $3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=F3(r),i=Yu.genSalt();i[11]=e.crc>>>24&255,n&&(i[10]=e.crc>>>16&255);let a=Buffer.alloc(t.length+12);return o(i,a),o(t,a,12)}ob.exports={decrypt:k3,encrypt:$3,_salter:P3}});var ab=S(Xu=>{Xu.Deflater=Z0();Xu.Inflater=eb();Xu.ZipCrypto=ib()});var Yp=S((kz,sb)=>{var Se=si(),I3=Gp(),Ye=Se.Constants,Wp=ab();sb.exports=function(t,e){var r=new I3.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,d=typeof l.decoder=="object"?l.decoder:Se.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function p(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(g){if(r.flags_desc){let _={},x=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(x)==Ye.LOCSIG||e.readUInt32LE(x)==Ye.CENSIG)throw Se.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(x)==Ye.EXTSIG)_.crc=e.readUInt32LE(x+Ye.EXTCRC),_.compressedSize=e.readUInt32LE(x+Ye.EXTSIZ),_.size=e.readUInt32LE(x+Ye.EXTLEN);else if(e.readUInt16LE(x+12)===19280)_.crc=e.readUInt32LE(x+Ye.EXTCRC-4),_.compressedSize=e.readUInt32LE(x+Ye.EXTSIZ-4),_.size=e.readUInt32LE(x+Ye.EXTLEN-4);else throw Se.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw Se.Errors.DESCRIPTOR_FAULTY();if(Se.crc32(g)!==_.crc)return!1}else if(Se.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,x){if(typeof _>"u"&&typeof g=="string"&&(x=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),Se.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var $=p();if($.length===0)return g&&_&&_($),$;if(r.encrypted){if(typeof x!="string"&&!Buffer.isBuffer(x))throw Se.Errors.INVALID_PASS_PARAM();$=Wp.ZipCrypto.decrypt($,r,x)}var F=Buffer.alloc(r.size);switch(r.method){case Se.Constants.STORED:if($.copy(F),h(F))return g&&_&&_(F),F;throw g&&_&&_(F,Se.Errors.BAD_CRC()),Se.Errors.BAD_CRC();case Se.Constants.DEFLATED:var B=new Wp.Inflater($,r.size);if(g)B.inflateAsync(function(T){T.copy(T,0),_&&(h(T)?_(T):_(T,Se.Errors.BAD_CRC()))});else{if(B.inflate(F).copy(F,0),!h(F))throw Se.Errors.BAD_CRC(`"${d.decode(n)}"`);return F}break;default:throw g&&_&&_(Buffer.alloc(0),Se.Errors.UNKNOWN_METHOD()),Se.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(p()),p();if(a.length&&!i){var x;switch(r.method){case Se.Constants.STORED:return r.compressedSize=r.size,x=Buffer.alloc(a.length),a.copy(x),g&&_&&_(x),x;default:case Se.Constants.DEFLATED:var $=new Wp.Deflater(a);if(g)$.deflateAsync(function(B){x=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(x),_&&_(x)});else{var F=$.deflate();return r.compressedSize=F.length,F}$=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function y(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,x,$,F;_+4<g.length;)x=g.readUInt16LE(_),_+=2,$=g.readUInt16LE(_),_+=2,F=g.slice(_,_+$),_+=$,Ye.ID_ZIP64===x&&E(F)}catch{throw Se.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,x,$,F;g.length>=Ye.EF_ZIP64_SCOMP&&(_=y(g,Ye.EF_ZIP64_SUNCOMP),r.size===Ye.EF_ZIP64_OR_32&&(r.size=_)),g.length>=Ye.EF_ZIP64_RHO&&(x=y(g,Ye.EF_ZIP64_SCOMP),r.compressedSize===Ye.EF_ZIP64_OR_32&&(r.compressedSize=x)),g.length>=Ye.EF_ZIP64_DSN&&($=y(g,Ye.EF_ZIP64_RHO),r.offset===Ye.EF_ZIP64_OR_32&&(r.offset=$)),g.length>=Ye.EF_ZIP64_DSN+4&&(F=g.readUInt32LE(Ye.EF_ZIP64_DSN),r.diskNumStart===Ye.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(g){n=Se.toBuffer(g,d.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(g){s=g,r.extraLength=g.length,C(g)},get comment(){return d.decode(o)},set comment(g){if(o=Se.toBuffer(g,d.encode),r.commentLength=o.length,o.length>65535)throw Se.Errors.COMMENT_TOO_LONG()},get name(){var g=d.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return b(!1,null)},getCompressedDataAsync:function(g){b(!0,g)},setData:function(g){a=Se.toBuffer(g,Se.decoder.encode),!i&&a.length?(r.size=a.length,r.method=Se.Constants.DEFLATED,r.crc=Se.crc32(g),r.changed=!0):r.method=Se.Constants.STORED},getData:function(g){return r.changed?a:m(!1,null,g)},getDataAsync:function(g,_){r.changed?g(a):m(!0,g,_)},set attr(g){r.attr=g},get attr(){return r.attr},set header(g){r.loadFromBinary(g)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var g=r.centralHeaderToBinary(),_=Se.Constants.CENHDR;return n.copy(g,_),_+=n.length,s.copy(g,_),_+=r.extraLength,o.copy(g,_),g},packLocalHeader:function(){let g=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),x=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(x,g),g+=_.length,n.copy(x,g),g+=n.length,u.copy(x,g),g+=u.length,x},toJSON:function(){let g=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:g(e),data:g(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var lb=S((Pz,cb)=>{var ub=Yp(),T3=Gp(),ht=si();cb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new T3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:d}=c;t?m(c.readEntries):a=!0;function p(){let y=new Set;for(let C of Object.keys(n)){let E=C.split("/");if(E.pop(),!!E.length)for(let g=0;g<E.length;g++){let _=E.slice(0,g+1).join("/")+"/";y.add(_)}}for(let C of y)if(!(C in n)){let E=new ub(c);E.entryName=C,E.attr=16,E.temporary=!0,r.push(E),n[E.entryName]=E,u.add(E)}}function h(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/ht.Constants.CENHDR)throw ht.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var y=i.offset,C=0;C<r.length;C++){var E=y,g=new ub(c,t);g.header=t.slice(E,E+=ht.Constants.CENHDR),g.entryName=t.slice(E,E+=g.header.fileNameLength),g.header.extraLength&&(g.extra=t.slice(E,E+=g.header.extraLength)),g.header.commentLength&&(g.comment=t.slice(E,E+g.header.commentLength)),y+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),p()}function m(y){var C=t.length-ht.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,x=-1,$=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===ht.Constants.ENDSIG){x=C,$=C,_=C+ht.Constants.ENDHDR,g=C-ht.Constants.END64HDR;continue}if(t.readUInt32LE(C)===ht.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===ht.Constants.ZIP64SIG){x=C,_=C+ht.readBigUInt64LE(t,C+ht.Constants.ZIP64SIZE)+ht.Constants.ZIP64LEAD;break}}if(x==-1)throw ht.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(x,_)),i.commentLength&&(o=t.slice($+ht.Constants.ENDHDR)),y&&h()}function b(){r.length>1&&!l&&r.sort((y,C)=>y.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(y=>!u.has(y))},get comment(){return d.decode(o)},set comment(y){o=ht.toBuffer(y,d.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(y){this.entries.forEach(y)},getEntry:function(y){return a||h(),n[y]||null},setEntry:function(y){a||h(),r.push(y),n[y.entryName]=y,i.totalEntries=r.length},deleteFile:function(y,C=!0){a||h();let E=n[y];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(y){a||h();let C=n[y],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[y],i.totalEntries=r.length)},getEntryChildren:function(y,C=!0){if(a||h(),typeof y=="object")if(y.isDirectory&&C){let E=[],g=y.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[y];return[]},getChildCount:function(y){if(y&&y.isDirectory){let C=this.getEntryChildren(y);return C.includes(y)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),b();let y=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let F of this.entries){let B=F.getCompressedData();F.header.offset=g;let T=F.packLocalHeader(),L=T.length+B.length;g+=L,y.push(T),y.push(B);let A=F.packCentralHeader();C.push(A),i.size+=A.length,E+=L+A.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let x=Buffer.alloc(E);for(let F of y)F.copy(x,g),g+=F.length;for(let F of C)F.copy(x,g),g+=F.length;let $=i.toBinary();return o&&o.copy($,ht.Constants.ENDHDR),$.copy(x,g),t=x,a=!1,x},toAsyncBuffer:function(y,C,E,g){try{a||h(),b();let _=[],x=[],$=0,F=0,B=0;i.size=0,i.offset=0;let T=function(L){if(L.length>0){let A=L.shift(),j=A.entryName+A.extra.toString();E&&E(j),A.getCompressedDataAsync(function(M){g&&g(j),A.header.offset=F;let J=A.packLocalHeader(),k=J.length+M.length;F+=k,_.push(J),_.push(M);let D=A.packCentralHeader();x.push(D),i.size+=D.length,$+=k+D.length,B++,T(L)})}else{$+=i.mainHeaderSize,i.offset=F,i.totalEntries=B,F=0;let A=Buffer.alloc($);_.forEach(function(M){M.copy(A,F),F+=M.length}),x.forEach(function(M){M.copy(A,F),F+=M.length});let j=i.toBinary();o&&o.copy(j,ht.Constants.ENDHDR),j.copy(A,F),t=A,a=!1,y(A)}};T(Array.from(this.entries))}catch(_){C(_)}}}}});var Jp=S(($z,db)=>{var ze=si(),Je=require("path"),R3=Yp(),B3=lb(),Yn=(...t)=>ze.findLast(t,e=>typeof e=="boolean"),fb=(...t)=>ze.findLast(t,e=>typeof e=="string"),N3=(...t)=>ze.findLast(t,e=>typeof e=="function"),L3={noSort:!1,readEntries:!1,method:ze.Constants.NONE,fs:null};db.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),L3);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=ze.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new ze(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=ze.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=ze.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw ze.Errors.INVALID_FILENAME();let i=new B3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=ze;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Je.posix.normalize(h))),typeof h=="object"&&typeof h.entryName<"u"&&typeof h.header<"u"&&(m=i.getEntry(h.entryName)),m)return m}return null}function l(h){let{join:m,normalize:b,sep:y}=Je.posix;return m(".",b(y+h.split("\\").join(y)+y))}function d(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let p=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",Je.relative(h,m)+b};return{readFile:function(h,m){var b=c(h);return b&&b.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var b=c(h);b?b.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var b=c(h);if(b){var y=b.getData();if(y&&y.length)return y.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,b){var y=c(h);y?y.getDataAsync(function(C,E){if(E){m(C,E);return}C&&C.length?m(C.toString(b||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var b=c(h);b&&i.deleteFile(b.entryName,m)},deleteEntry:function(h){var m=c(h);m&&i.deleteEntry(m.entryName)},addZipComment:function(h){i.comment=h},getZipComment:function(){return i.comment||""},addZipEntryComment:function(h,m){var b=c(h);b&&(b.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var b=c(h);b&&b.setData(m)},addLocalFile:function(h,m,b,y){if(o.fs.existsSync(h)){m=m?l(m):"";let C=Je.win32.basename(Je.win32.normalize(h));m+=b||C;let E=o.fs.statSync(h),g=E.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);E.isDirectory()&&(m+=o.sep),this.addFile(m,g,y,E)}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=Je.resolve(h.localPath),{comment:y}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(b,function(_,x){if(_)return m(_,!1);C=C?l(C):"";let $=Je.win32.basename(Je.win32.normalize(b));if(C+=E||$,x.isFile())o.fs.readFile(b,function(F,B){return F?m(F,!1):(g.addFile(C,B,y,x),setImmediate(m,void 0,!0))});else if(x.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),y,x),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=d(b),m=m?l(m):"",h=Je.normalize(h),o.fs.existsSync(h)){let y=o.findFiles(h),C=this;if(y.length)for(let E of y){let g=Je.join(m,p(h,E));b(g)&&C.addLocalFile(E,Je.dirname(g))}}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,y){y=d(y),b=b?l(b):"",h=Je.normalize(h);var C=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,ze.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var g=o.findFiles(h),_=-1,x=function(){if(_+=1,_<g.length){var $=g[_],F=p(h,$).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),y(F)?o.fs.stat($,function(B,T){B&&m(void 0,B),T.isFile()?o.fs.readFile($,function(L,A){L?m(void 0,L):(C.addFile(b+F,A,"",T),x())}):(C.addFile(b+F+"/",Buffer.alloc(0),"",T),x())}):process.nextTick(()=>{x()})}else m(!0,void 0)};x()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=Je.resolve(l(h.localPath));let{zipPath:y,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(x){return function($){return x.test($)}})(C):typeof C!="function"&&(C=function(){return!0}),y=y?l(y):"",E=="latin1"&&(E=x=>x.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=x=>x);let g=x=>Je.join(y,E(p(localPath,x))),_=x=>Je.win32.basename(Je.win32.normalize(E(x)));o.fs.open(localPath,"r",function(x){x&&x.code==="ENOENT"?m(void 0,ze.Errors.FILE_NOT_FOUND(localPath)):x?m(void 0,x):o.findFilesAsync(localPath,function($,F){if($)return m($);F=F.filter(B=>C(g(B))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(B,T){return function(L,A){if(L||A===!1)return setImmediate(B,L,!1);b.addLocalFileAsync({localPath:T,zipPath:Je.dirname(g(T)),zipName:_(T)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,y)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&y(C),E&&b(this)})})},addFile:function(h,m,b,y){h=u(h);let C=c(h),E=C!=null;E||(C=new R3(n),C.entryName=h),C.comment=b||"";let g=typeof y=="object"&&y instanceof o.fs.Stats;g&&(C.header.time=y.mtime);var _=C.isDirectory?16:0;let x=C.isDirectory?16384:32768;return g?x|=4095&y.mode:typeof y=="number"?x|=4095&y:x|=C.isDirectory?493:420,_=(_|x<<16)>>>0,C.attr=_,C.setData(m),E||i.setEntry(C),C},getEntries:function(h){return i.password=h,i?i.entries:[]},getEntry:function(h){return c(h)},getEntryCount:function(){return i.getEntryCount()},forEach:function(h){return i.forEach(h)},extractEntryTo:function(h,m,b,y,C,E){y=Yn(!1,y),C=Yn(!1,C),b=Yn(!0,b),E=fb(C,E);var g=c(h);if(!g)throw ze.Errors.NO_ENTRY();var _=a(g.entryName),x=s(m,E&&!g.isDirectory?E:b?_:Je.basename(_));if(g.isDirectory){var $=i.getEntryChildren(g);return $.forEach(function(T){if(T.isDirectory)return;var L=T.getData();if(!L)throw ze.Errors.CANT_EXTRACT_FILE();var A=a(T.entryName),j=s(m,b?A:Je.basename(A));let M=C?T.header.fileAttr:void 0;o.writeFileTo(j,L,y,M)}),!0}var F=g.getData(i.password);if(!F)throw ze.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(x)&&!y)throw ze.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(x,F,y,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var b=i.entries[m].getData(h);if(!b)return!1}catch{return!1}return!0},extractAllTo:function(h,m,b,y){if(b=Yn(!1,b),y=fb(b,y),m=Yn(!1,m),!i)throw ze.Errors.NO_ZIP();i.entries.forEach(function(C){var E=s(h,a(C.entryName));if(C.isDirectory){o.makeDir(E);return}var g=C.getData(y);if(!g)throw ze.Errors.CANT_EXTRACT_FILE();let _=b?C.header.fileAttr:void 0;o.writeFileTo(E,g,m,_);try{o.fs.utimesSync(E,C.header.time,C.header.time)}catch{throw ze.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,y){if(y=N3(m,b,y),b=Yn(!1,b),m=Yn(!1,m),!y)return new Promise((x,$)=>{this.extractAllToAsync(h,m,b,function(F){F?$(F):x(this)})});if(!i){y(ze.Errors.NO_ZIP());return}h=Je.resolve(h);let C=x=>s(h,Je.normalize(a(x.entryName))),E=(x,$)=>new Error(x+': "'+$+'"'),g=[],_=[];i.entries.forEach(x=>{x.isDirectory?g.push(x):_.push(x)});for(let x of g){let $=C(x),F=b?x.header.fileAttr:void 0;try{o.makeDir($),F&&o.fs.chmodSync($,F),o.fs.utimesSync($,x.header.time,x.header.time)}catch{y(E("Unable to create folder",$))}}_.reverse().reduce(function(x,$){return function(F){if(F)x(F);else{let B=Je.normalize(a($.entryName)),T=s(h,B);$.getDataAsync(function(L,A){if(A)x(A);else if(!L)x(ze.Errors.CANT_EXTRACT_FILE());else{let j=b?$.header.fileAttr:void 0;o.writeFileToAsync(T,L,m,j,function(M){M||x(E("Unable to write file",T)),o.fs.utimes(T,$.header.time,$.header.time,function(J){J?x(E("Unable to set times",T)):x()})})}})}}},y)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var b=i.compressToBuffer();if(b){var y=o.writeFileTo(h,b,!0);typeof m=="function"&&m(y?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:b,perm:y}=Object.assign({overwrite:!0},m);return new Promise((C,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=x=>x?C(x):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,y,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,b,y){return typeof h=="function"?(i.toAsyncBuffer(h,m,b,y),null):i.compressToBuffer()}}}});var gb=S((Iz,mb)=>{var hb={};mb.exports=hb;var pb={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(pb).forEach(function(t){var e=pb[t],r=hb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Db=S((Tz,yb)=>{"use strict";yb.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",o=e.indexOf(n+t);return o!==-1&&(r===-1?!0:o<r)}});var wb=S((Rz,bb)=>{"use strict";var j3=require("os"),Sr=Db(),Ft=process.env,ci=void 0;Sr("no-color")||Sr("no-colors")||Sr("color=false")?ci=!1:(Sr("color")||Sr("colors")||Sr("color=true")||Sr("color=always"))&&(ci=!0);"FORCE_COLOR"in Ft&&(ci=Ft.FORCE_COLOR.length===0||parseInt(Ft.FORCE_COLOR,10)!==0);function U3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function M3(t){if(ci===!1)return 0;if(Sr("color=16m")||Sr("color=full")||Sr("color=truecolor"))return 3;if(Sr("color=256"))return 2;if(t&&!t.isTTY&&ci!==!0)return 0;var e=ci?1:0;if(process.platform==="win32"){var r=j3.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in Ft)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Ft})||Ft.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ft)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ft.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Ft){var n=parseInt((Ft.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ft.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ft.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Ft.TERM)||"COLORTERM"in Ft?1:(Ft.TERM==="dumb",e)}function Xp(t){var e=M3(t);return U3(e)}bb.exports={supportsColor:Xp,stdout:Xp(process.stdout),stderr:Xp(process.stderr)}});var Cb=S((Bz,vb)=>{vb.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var o={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var a=o[i]||[" "],s=Math.floor(Math.random()*a.length);typeof o[i]<"u"?n+=o[i][s]:n+=i}),n}});var _b=S((Nz,Eb)=>{Eb.exports=function(e,r){e=e||" he is here ";var n={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},o=[].concat(n.up,n.down,n.mid);function i(u){var c=Math.floor(Math.random()*u);return c}function a(u){var c=!1;return o.filter(function(l){c=l===u}),c}function s(u,c){var l="",d,p;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(p in u)if(!a(p)){switch(l=l+u[p],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],y=0;y<=d[b];y++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var xb=S((Lz,Sb)=>{Sb.exports=function(t){return function(e,r,n){if(e===" ")return e;switch(r%3){case 0:return t.red(e);case 1:return t.white(e);case 2:return t.blue(e)}}}});var Ob=S((jz,Ab)=>{Ab.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var kb=S((Uz,Fb)=>{Fb.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,o){return r===" "?r:t[e[n++%e.length]](r)}}});var $b=S((Mz,Pb)=>{Pb.exports=function(t){var e=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,n,o){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var Lb=S((Hz,Nb)=>{var fe={};Nb.exports=fe;fe.themes={};var q3=require("util"),Jn=fe.styles=gb(),Tb=Object.defineProperties,H3=new RegExp(/[\r\n]+/g);fe.supportsColor=wb().supportsColor;typeof fe.enabled>"u"&&(fe.enabled=fe.supportsColor()!==!1);fe.enable=function(){fe.enabled=!0};fe.disable=function(){fe.enabled=!1};fe.stripColors=fe.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var qz=fe.stylize=function(e,r){if(!fe.enabled)return e+"";var n=Jn[r];return!n&&r in fe?fe[r](e):n.open+e+n.close},V3=/[|\\{}()[\]^$+*?.]/g,z3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(V3,"\\$&")};function Rb(t){var e=function r(){return G3.apply(r,arguments)};return e._styles=t,e.__proto__=K3,e}var Bb=(function(){var t={};return Jn.grey=Jn.gray,Object.keys(Jn).forEach(function(e){Jn[e].closeRe=new RegExp(z3(Jn[e].close),"g"),t[e]={get:function(){return Rb(this._styles.concat(e))}}}),t})(),K3=Tb(function(){},Bb);function G3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:q3.inspect(a)}).join(" ");if(!fe.enabled||!e)return e;for(var r=e.indexOf(`
31
+ `)!=-1,n=this._styles,o=n.length;o--;){var i=Jn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(H3,function(a){return i.close+a+i.open}))}return e}fe.setTheme=function(t){if(typeof t=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var e in t)(function(r){fe[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=fe[t[r][i]](o);return o}return fe[t[r]](n)}})(e)};function W3(){var t={};return Object.keys(Bb).forEach(function(e){t[e]={get:function(){return Rb([e])}}}),t}var Y3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};fe.trap=Cb();fe.zalgo=_b();fe.maps={};fe.maps.america=xb()(fe);fe.maps.zebra=Ob()(fe);fe.maps.rainbow=kb()(fe);fe.maps.random=$b()(fe);for(Ib in fe.maps)(function(t){fe[t]=function(e){return Y3(fe.maps[t],e)}})(Ib);var Ib;Tb(fe,W3())});var Ub=S((Vz,jb)=>{var J3=Lb();jb.exports=J3});var Mb=S(Zp=>{"use strict";Zp.indent=function(e){return new Array(e+1).join(" ")};Zp.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var qb=S((Kz,X3)=>{X3.exports={author:"Rafael de Oleza <rafeca@gmail.com> (https://github.com/rafeca)",name:"prettyjson",description:"Package for formatting JSON data in a coloured YAML-style, perfect for CLI output",version:"1.2.5",homepage:"http://rafeca.com/prettyjson",keywords:["json","cli","formatting","colors"],repository:{type:"git",url:"https://github.com/rafeca/prettyjson.git"},bugs:{url:"https://github.com/rafeca/prettyjson/issues"},main:"./lib/prettyjson",files:["bin/prettyjson","lib/*.js"],license:"MIT",scripts:{test:"npm run jshint && mocha --reporter spec",testwin:"node ./node_modules/mocha/bin/mocha --reporter spec",jshint:"jshint lib/*.js test/*.js",coverage:"istanbul cover _mocha --report lcovonly -- -R spec",coveralls:"npm run coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",changelog:"git log $(git describe --tags --abbrev=0)..HEAD --pretty='* %s' --first-parent"},bin:{prettyjson:"./bin/prettyjson"},dependencies:{colors:"1.4.0",minimist:"^1.2.0"},devDependencies:{coveralls:"^2.11.15",istanbul:"^0.4.5",jshint:"^2.9.4",mocha:"^3.1.2","mocha-lcov-reporter":"^1.2.0",should:"^11.1.1"}}});var Hb=S(Ha=>{"use strict";var $r=Ub(),An=Mb(),Z3=/[^\w\s\n\r\v\t\.,]/i;Ha.version=qb().version;var Qp=function(t,e){return t!==void 0||e.renderUndefined},Zu=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
32
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Zu(t[0],!0,r))},Q3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?$r[e.stringColor](t):t;var r=t+"";return t===!0?$r.green(r):t===!1?$r.red(r):t==null?$r.grey(r):typeof t=="number"?t>=0?$r[e.positiveNumberColor](r):$r[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},eh=function(t,e){return t.multilineStringColor===null||t.noColor?e:$r[t.multilineStringColor](e)},e$=function(t,e,r){var n=t.split(`
33
+ `);return n=n.map(function(o){return An.indent(e)+eh(r,o)}),n.join(`
34
+ `)},li=function(t,e,r){if(typeof t=="string"&&t.match(Z3)&&e.escape&&(t=JSON.stringify(t)),!Qp(t,e))return[];if(Zu(t,!1,e))return[An.indent(r)+Q3(t,e)];if(typeof t=="string")return[An.indent(r)+eh(e,'"""'),e$(t,r+e.defaultIndentation,e),An.indent(r)+eh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[An.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Qp(s,e)){var u="- ";e.noColor||(u=$r[e.dashColor](u)),u=An.indent(r)+u,Zu(s,!1,e)?(u+=li(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,li(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return li({message:t.message,stack:t.stack.split(`
35
+ `)},e,r);var o=e.noAlign?0:An.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Qp(t[s],e))if(i=s+": ",e.noColor||(i=$r[e.keysColor](i)),i=An.indent(r)+i,Zu(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=li(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,li(t[s],e,r+e.defaultIndentation))}),a};Ha.render=function(e,r,n){return n=n||0,r=r||{},r.emptyArrayMsg=r.emptyArrayMsg||"(empty array)",r.keysColor=r.keysColor||"green",r.dashColor=r.dashColor||"green",r.numberColor=r.numberColor||"blue",r.positiveNumberColor=r.positiveNumberColor||r.numberColor,r.negativeNumberColor=r.negativeNumberColor||r.numberColor,r.defaultIndentation=r.defaultIndentation||2,r.noColor=!!r.noColor,r.noAlign=!!r.noAlign,r.escape=!!r.escape,r.renderUndefined=!!r.renderUndefined,r.stringColor=r.stringColor||null,r.multilineStringColor=r.multilineStringColor||null,li(e,r,n).join(`
36
+ `)};Ha.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
37
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return $r.red("Error:")+" Not valid JSON!"}return o+=Ha.render(i,r,n),o}});var nh=S(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;function fi(t){"@babel/helpers - typeof";return fi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fi(t)}function Vb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,r$(n.key),n)}}function t$(t,e,r){return e&&Vb(t.prototype,e),r&&Vb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function r$(t){var e=n$(t,"string");return fi(e)=="symbol"?e:e+""}function n$(t,e){if(fi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(fi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function o$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i$(t,e,r){return e=za(e),a$(t,rh()?Reflect.construct(e,r||[],za(t).constructor):e.apply(t,r))}function a$(t,e){if(e&&(fi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s$(t)}function s$(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u$(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Va(t,e)}function th(t){var e=typeof Map=="function"?new Map:void 0;return th=function(n){if(n===null||!l$(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return c$(n,arguments,za(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Va(o,n)},th(t)}function c$(t,e,r){if(rh())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Va(o,r.prototype),o}function rh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rh=function(){return!!t})()}function l$(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Va(t,e){return Va=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Va(t,e)}function za(t){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},za(t)}var f$=(function(t){function e(r){var n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(o$(this,e),n=i$(this,e,[r]),n.originalRequest=i,n.originalResponse=a,n.causingError=o,o!=null&&(r+=", caused by ".concat(o.toString())),i!=null){var s=i.getHeader("X-Request-ID")||"n/a",u=i.getMethod(),c=i.getURL(),l=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return u$(e,t),t$(e)})(th(Error)),Wz=Qu.default=f$});var oh=S(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.enableDebugLog=d$;ec.log=p$;var zb=!1;function d$(){zb=!0}function p$(t){zb&&console.log(t)}});var Gb=S(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.default=void 0;function Ka(t){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ka(t)}function h$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kb(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g$(n.key),n)}}function m$(t,e,r){return e&&Kb(t.prototype,e),r&&Kb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function g$(t){var e=y$(t,"string");return Ka(e)=="symbol"?e:e+""}function y$(t,e){if(Ka(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ka(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xz=tc.default=(function(){function t(){h$(this,t)}return m$(t,[{key:"listAllUploads",value:function(){return Promise.resolve([])}},{key:"findUploadsByFingerprint",value:function(r){return Promise.resolve([])}},{key:"removeUpload",value:function(r){return Promise.resolve()}},{key:"addUpload",value:function(r,n){return Promise.resolve(null)}}])})()});var Wb=S((ih,ah)=>{(function(t,e){typeof ih=="object"&&typeof ah<"u"?ah.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:ih,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,o=typeof TextEncoder=="function"?new TextEncoder:void 0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=Array.prototype.slice.call(i),s=(function(P){var N={};return P.forEach(function(z,H){return N[z]=H}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(P){return new Uint8Array(Array.prototype.slice.call(P,0))},d=function(P){return P.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},p=function(P){return P.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(P){for(var N,z,H,se,zt="",G=P.length%3,Ee=0;Ee<P.length;){if((z=P.charCodeAt(Ee++))>255||(H=P.charCodeAt(Ee++))>255||(se=P.charCodeAt(Ee++))>255)throw new TypeError("invalid character found");N=z<<16|H<<8|se,zt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return G?zt.slice(0,G-3)+"===".substring(G):zt},m=typeof btoa=="function"?function(P){return btoa(P)}:r?function(P){return Buffer.from(P,"binary").toString("base64")}:h,b=r?function(P){return Buffer.from(P).toString("base64")}:function(P){for(var N=4096,z=[],H=0,se=P.length;H<se;H+=N)z.push(c.apply(null,P.subarray(H,H+N)));return m(z.join(""))},y=function(P,N){return N===void 0&&(N=!1),N?d(b(P)):b(P)},C=function(P){if(P.length<2){var N=P.charCodeAt(0);return N<128?P:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(P.charCodeAt(0)-55296)*1024+(P.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(P){return P.replace(E,C)},_=r?function(P){return Buffer.from(P,"utf8").toString("base64")}:o?function(P){return b(o.encode(P))}:function(P){return m(g(P))},x=function(P,N){return N===void 0&&(N=!1),N?d(_(P)):_(P)},$=function(P){return x(P,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(P){switch(P.length){case 4:var N=(7&P.charCodeAt(0))<<18|(63&P.charCodeAt(1))<<12|(63&P.charCodeAt(2))<<6|63&P.charCodeAt(3),z=N-65536;return c((z>>>10)+55296)+c((z&1023)+56320);case 3:return c((15&P.charCodeAt(0))<<12|(63&P.charCodeAt(1))<<6|63&P.charCodeAt(2));default:return c((31&P.charCodeAt(0))<<6|63&P.charCodeAt(1))}},T=function(P){return P.replace(F,B)},L=function(P){if(P=P.replace(/\s+/g,""),!u.test(P))throw new TypeError("malformed base64.");P+="==".slice(2-(P.length&3));for(var N,z,H,se=[],zt=0;zt<P.length;)N=s[P.charAt(zt++)]<<18|s[P.charAt(zt++)]<<12|(z=s[P.charAt(zt++)])<<6|(H=s[P.charAt(zt++)]),z===64?se.push(c(N>>16&255)):H===64?se.push(c(N>>16&255,N>>8&255)):se.push(c(N>>16&255,N>>8&255,N&255));return se.join("")},A=typeof atob=="function"?function(P){return atob(p(P))}:r?function(P){return Buffer.from(P,"base64").toString("binary")}:L,j=r?function(P){return l(Buffer.from(P,"base64"))}:function(P){return l(A(P).split("").map(function(N){return N.charCodeAt(0)}))},M=function(P){return j(k(P))},J=r?function(P){return Buffer.from(P,"base64").toString("utf8")}:n?function(P){return n.decode(j(P))}:function(P){return T(A(P))},k=function(P){return p(P.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},D=function(P){return J(k(P))},w=function(P){if(typeof P!="string")return!1;var N=P.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},v=function(P){return{value:P,enumerable:!1,writable:!0,configurable:!0}},O=function(){var P=function(N,z){return Object.defineProperty(String.prototype,N,v(z))};P("fromBase64",function(){return D(this)}),P("toBase64",function(N){return x(this,N)}),P("toBase64URI",function(){return x(this,!0)}),P("toBase64URL",function(){return x(this,!0)}),P("toUint8Array",function(){return M(this)})},R=function(){var P=function(N,z){return Object.defineProperty(Uint8Array.prototype,N,v(z))};P("toBase64",function(N){return y(this,N)}),P("toBase64URI",function(){return y(this,!0)}),P("toBase64URL",function(){return y(this,!0)})},I=function(){O(),R()},q={version:t,VERSION:e,atob:A,atobPolyfill:L,btoa:m,btoaPolyfill:h,fromBase64:D,toBase64:x,encode:x,encodeURI:$,encodeURL:$,utob:g,btou:T,decode:D,isValid:w,fromUint8Array:y,toUint8Array:M,extendString:O,extendUint8Array:R,extendBuiltins:I};return q.Base64={},Object.keys(q).forEach(function(P){return q.Base64[P]=q[P]}),q})});var Jb=S((Qz,Yb)=>{"use strict";Yb.exports=function(e,r){if(r=r.split(":")[0],e=+e,!e)return!1;switch(r){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Qb=S(sh=>{"use strict";var D$=Object.prototype.hasOwnProperty,b$;function Xb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Zb(t){try{return encodeURIComponent(t)}catch{return null}}function w$(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Xb(n[1]),i=Xb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function v$(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(D$.call(t,o)){if(n=t[o],!n&&(n===null||n===b$||isNaN(n))&&(n=""),o=Zb(o),n=Zb(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}sh.stringify=v$;sh.parse=w$});var sw=S((tK,aw)=>{"use strict";var tw=Jb(),rc=Qb(),C$=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,rw=/[\n\r\t]/g,E$=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,nw=/:\d+$/,_$=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,S$=/^[a-zA-Z]:/;function ch(t){return(t||"").toString().replace(C$,"")}var uh=[["#","hash"],["?","query"],function(e,r){return Ir(r.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],ew={hash:1,query:1};function ow(t){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var r=e.location||{};t=t||r;var n={},o=typeof t,i;if(t.protocol==="blob:")n=new Tr(unescape(t.pathname),{});else if(o==="string"){n=new Tr(t,{});for(i in ew)delete n[i]}else if(o==="object"){for(i in t)i in ew||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=E$.test(t.href))}return n}function Ir(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function iw(t,e){t=ch(t),t=t.replace(rw,""),e=e||{};var r=_$.exec(t),n=r[1]?r[1].toLowerCase():"",o=!!r[2],i=!!r[3],a=0,s;return o?i?(s=r[2]+r[3]+r[4],a=r[2].length+r[3].length):(s=r[2]+r[4],a=r[2].length):i?(s=r[3]+r[4],a=r[3].length):s=r[4],n==="file:"?a>=2&&(s=s.slice(2)):Ir(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Ir(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Ir(n),slashesCount:a,rest:s}}function x$(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,o=r[n-1],i=!1,a=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),a++):a&&(n===0&&(i=!0),r.splice(n,1),a--);return i&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function Tr(t,e,r){if(t=ch(t),t=t.replace(rw,""),!(this instanceof Tr))return new Tr(t,e,r);var n,o,i,a,s,u,c=uh.slice(),l=typeof e,d=this,p=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=rc.parse),e=ow(e),o=iw(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||S$.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Ir(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=x$(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Ir(d.protocol)&&(d.pathname="/"+d.pathname),tw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Ir(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function A$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||rc.parse)(e)),n[t]=e;break;case"port":n[t]=e,tw(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[t]="");break;case"hostname":n[t]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[t]=e,nw.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(e){var o=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==o?o+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var i=e.indexOf(":");~i?(n.username=e.slice(0,i),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(i+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<uh.length;a++){var s=uh[a];s[4]&&(n[s[1]]=n[s[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Ir(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function O$(t){(!t||typeof t!="function")&&(t=rc.stringify);var e,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var i=o+(r.protocol&&r.slashes||Ir(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Ir(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||nw.test(r.hostname)&&!r.port)&&(n+=":"),i+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(i+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(i+=r.hash),i}Tr.prototype={set:A$,toString:O$};Tr.extractProtocol=iw;Tr.location=ow;Tr.trimLeft=ch;Tr.qs=rc;aw.exports=Tr});var uw=S(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});lh.default=F$;function F$(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,r=t==="x"?e:e&3|8;return r.toString(16)})}});var Ew=S(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.default=void 0;var k$=Wb(),P$=ph(sw()),nc=ph(nh()),Xn=oh(),$$=ph(uw());function ph(t){return t&&t.__esModule?t:{default:t}}function fh(){"use strict";fh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(D,w,v){D[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(D,w,v){return Object.defineProperty(D,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),D[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(D,w,v,O){var R=w&&w.prototype instanceof C?w:C,I=Object.create(R.prototype),q=new J(O||[]);return o(I,"_invoke",{value:L(D,v,q)}),I}function d(D,w,v){try{return{type:"normal",arg:D.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",y={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=C.prototype=Object.create(_);function B(D){["next","throw","return"].forEach(function(w){c(D,w,function(v){return this._invoke(w,v)})})}function T(D,w){function v(R,I,q,P){var N=d(D[R],D,I);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&Zn(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(I,q){function P(){return new w(function(N,z){v(I,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(D,w,v){var O=p;return function(R,I){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw I;return{value:t,done:!0}}for(v.method=R,v.arg=I;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===y)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(D,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===y)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(D,w){var v=w.method,O=D.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&D.iterator.return&&(w.method="return",w.arg=t,A(D,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),y;var R=d(O,D.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,y;var I=R.arg;return I?I.done?(w[D.resultName]=I.value,w.next=D.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,y):I:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,y)}function j(D){var w={tryLoc:D[0]};1 in D&&(w.catchLoc=D[1]),2 in D&&(w.finallyLoc=D[2],w.afterLoc=D[3]),this.tryEntries.push(w)}function M(D){var w=D.completion||{};w.type="normal",delete w.arg,D.completion=w}function J(D){this.tryEntries=[{tryLoc:"root"}],D.forEach(j,this),this.reset(!0)}function k(D){if(D||D===""){var w=D[a];if(w)return w.call(D);if(typeof D.next=="function")return D;if(!isNaN(D.length)){var v=-1,O=function R(){for(;++v<D.length;)if(n.call(D,v))return R.value=D[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(Zn(D)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(D){var w=typeof D=="function"&&D.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(D){return Object.setPrototypeOf?Object.setPrototypeOf(D,g):(D.__proto__=g,c(D,u,"GeneratorFunction")),D.prototype=Object.create(F),D},e.awrap=function(D){return{__await:D}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(D,w,v,O,R){R===void 0&&(R=Promise);var I=new T(l(D,w,v,O),R);return e.isGeneratorFunction(w)?I:I.next().then(function(q){return q.done?q.value:I.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(D){var w=Object(D),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var I=v.pop();if(I in w)return R.value=I,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R],q=I.completion;if(I.tryLoc==="root")return O("end");if(I.tryLoc<=this.prev){var P=n.call(I,"catchLoc"),N=n.call(I,"finallyLoc");if(P&&N){if(this.prev<I.catchLoc)return O(I.catchLoc,!0);if(this.prev<I.finallyLoc)return O(I.finallyLoc)}else if(P){if(this.prev<I.catchLoc)return O(I.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return O(I.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var I=R;break}}I&&(w==="break"||w==="continue")&&I.tryLoc<=v&&v<=I.finallyLoc&&(I=null);var q=I?I.completion:{};return q.type=w,q.arg=v,I?(this.method="next",this.next=I.finallyLoc,y):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),y},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),y}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var I=R.arg;M(O)}return I}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),y}},e}function cw(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function I$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){cw(i,n,o,a,s,"next",u)}function s(u){cw(i,n,o,a,s,"throw",u)}a(void 0)})}}function Dw(t,e){return B$(t)||R$(t,e)||bw(t,e)||T$()}function T$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function R$(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(l){c=!0,o=l}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function B$(t){if(Array.isArray(t))return t}function Zn(t){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zn(t)}function N$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=bw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
39
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function bw(t,e){if(t){if(typeof t=="string")return lw(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return lw(t,e)}}function lw(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function fw(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function di(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fw(Object(r),!0).forEach(function(n){L$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function L$(t,e,r){return e=ww(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function j$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,ww(n.key),n)}}function U$(t,e,r){return e&&dw(t.prototype,e),r&&dw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ww(t){var e=M$(t,"string");return Zn(e)=="symbol"?e:e+""}function M$(t,e){if(Zn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var oc="tus-v1",ic="ietf-draft-03",Ga="ietf-draft-05",q$={endpoint:null,uploadUrl:null,metadata:{},metadataForPartialUploads:{},fingerprint:null,uploadSize:null,onProgress:null,onChunkComplete:null,onSuccess:null,onError:null,onUploadUrlAvailable:null,overridePatchMethod:!1,headers:{},addRequestId:!1,onBeforeRequest:null,onAfterResponse:null,onShouldRetry:Cw,chunkSize:Number.POSITIVE_INFINITY,retryDelays:[0,1e3,3e3,5e3],parallelUploads:1,parallelUploadBoundaries:null,storeFingerprintForResuming:!0,removeFingerprintOnSuccess:!1,uploadLengthDeferred:!1,uploadDataDuringCreation:!1,urlStorage:null,fileReader:null,httpStack:null,protocol:oc},vw=(function(){function t(e,r){j$(this,t),"resume"in r&&console.log("tus: The `resume` option has been removed in tus-js-client v2. Please use the URL storage API instead."),this.options=r,this.options.chunkSize=Number(this.options.chunkSize),this._urlStorage=this.options.urlStorage,this.file=e,this.url=null,this._req=null,this._fingerprint=null,this._urlStorageKey=null,this._offset=null,this._aborted=!1,this._size=null,this._source=null,this._retryAttempt=0,this._retryTimeout=null,this._offsetBeforeRetry=0,this._parallelUploads=null,this._parallelUploadUrls=null}return U$(t,[{key:"findPreviousUploads",value:function(){var r=this;return this.options.fingerprint(this.file,this.options).then(function(n){return r._urlStorage.findUploadsByFingerprint(n)})}},{key:"resumeFromPreviousUpload",value:function(r){this.url=r.uploadUrl||null,this._parallelUploadUrls=r.parallelUploadUrls||null,this._urlStorageKey=r.urlStorageKey}},{key:"start",value:function(){var r=this,n=this.file;if(!n){this._emitError(new Error("tus: no file or stream to upload provided"));return}if(![oc,ic,Ga].includes(this.options.protocol)){this._emitError(new Error("tus: unsupported protocol ".concat(this.options.protocol)));return}if(!this.options.endpoint&&!this.options.uploadUrl&&!this.url){this._emitError(new Error("tus: neither an endpoint or an upload URL is provided"));return}var o=this.options.retryDelays;if(o!=null&&Object.prototype.toString.call(o)!=="[object Array]"){this._emitError(new Error("tus: the `retryDelays` option must either be an array or null"));return}if(this.options.parallelUploads>1)for(var i=0,a=["uploadUrl","uploadSize","uploadLengthDeferred"];i<a.length;i++){var s=a[i];if(this.options[s]){this._emitError(new Error("tus: cannot use the ".concat(s," option when parallelUploads is enabled")));return}}if(this.options.parallelUploadBoundaries){if(this.options.parallelUploads<=1){this._emitError(new Error("tus: cannot use the `parallelUploadBoundaries` option when `parallelUploads` is disabled"));return}if(this.options.parallelUploads!==this.options.parallelUploadBoundaries.length){this._emitError(new Error("tus: the `parallelUploadBoundaries` must have the same length as the value of `parallelUploads`"));return}}this.options.fingerprint(n,this.options).then(function(u){return u==null?(0,Xn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Xn.log)("Calculated fingerprint: ".concat(u)),r._fingerprint=u,r._source?r._source:r.options.fileReader.openFile(n,r.options.chunkSize)}).then(function(u){if(r._source=u,r.options.uploadLengthDeferred)r._size=null;else if(r.options.uploadSize!=null){if(r._size=Number(r.options.uploadSize),Number.isNaN(r._size)){r._emitError(new Error("tus: cannot convert `uploadSize` option into a number"));return}}else if(r._size=r._source.size,r._size==null){r._emitError(new Error("tus: cannot automatically derive upload's size from input. Specify it manually using the `uploadSize` option or use the `uploadLengthDeferred` option"));return}r.options.parallelUploads>1||r._parallelUploadUrls!=null?r._startParallelUpload():r._startSingleUpload()}).catch(function(u){r._emitError(u)})}},{key:"_startParallelUpload",value:function(){var r,n=this,o=this._size,i=0;this._parallelUploads=[];var a=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,s=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:V$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,d){l.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,d){var p=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,y){var C=di(di({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:di(di({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:y,onProgress:function(_){i=i-p+_,p=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,C);E.start(),n._parallelUploads.push(E)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=pw(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!pi(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var d=l.getHeader("Location");if(d==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=yw(n.options.endpoint,d),(0,Xn.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Xn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Xn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Xn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=N$(this._parallelUploads),i;try{for(o.s();!(i=o.n()).done;){var a=i.value;a.abort(r)}}catch(s){o.e(s)}finally{o.f()}}return this._req!==null&&this._req.abort(),this._aborted=!0,this._retryTimeout!=null&&(clearTimeout(this._retryTimeout),this._retryTimeout=null),!r||this.url==null?Promise.resolve():t.terminate(this.url,this.options).then(function(){return n._removeFromUrlStorage()})}},{key:"_emitHttpError",value:function(r,n,o,i){this._emitError(new nc.default(o,i,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var o=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(o&&(this._retryAttempt=0),gw(r,this._retryAttempt,this.options)){var i=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},i);return}}if(typeof this.options.onError=="function")this.options.onError(r);else throw r}}},{key:"_emitSuccess",value:function(r){this.options.removeFingerprintOnSuccess&&this._removeFromUrlStorage(),typeof this.options.onSuccess=="function"&&this.options.onSuccess({lastResponse:r})}},{key:"_emitProgress",value:function(r,n){typeof this.options.onProgress=="function"&&this.options.onProgress(r,n)}},{key:"_emitChunkComplete",value:function(r,n,o){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,o)}},{key:"_createUpload",value:function(){var r=this;if(!this.options.endpoint){this._emitError(new Error("tus: unable to create upload because no endpoint is provided"));return}var n=this._openRequest("POST",this.options.endpoint);this.options.uploadLengthDeferred?n.setHeader("Upload-Defer-Length","1"):n.setHeader("Upload-Length","".concat(this._size));var o=pw(this.options.metadata);o!==""&&n.setHeader("Upload-Metadata",o);var i;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,i=this._addChunkToRequest(n)):((this.options.protocol===ic||this.options.protocol===Ga)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!pi(a.getStatus(),200)){r._emitHttpError(n,a,"tus: unexpected response while creating upload");return}var s=a.getHeader("Location");if(s==null){r._emitHttpError(n,a,"tus: invalid or missing Location header");return}if(r.url=yw(r.options.endpoint,s),(0,Xn.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(a),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,a):(r._offset=0,r._performUpload())})}).catch(function(a){r._emitHttpError(n,null,"tus: failed to create upload",a)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),o=this._sendRequest(n,null);o.then(function(i){var a=i.getStatus();if(!pi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(pi(a,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,i,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var s=Number.parseInt(i.getHeader("Upload-Offset"),10);if(Number.isNaN(s)){r._emitHttpError(n,i,"tus: invalid or missing offset value");return}var u=Number.parseInt(i.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===oc){r._emitHttpError(n,i,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(s===u){r._emitProgress(u,u),r._emitSuccess(i);return}r._offset=s,r._performUpload()})}).catch(function(i){r._emitHttpError(n,null,"tus: failed to resume upload",i)})}},{key:"_performUpload",value:function(){var r=this;if(!this._aborted){var n;this.options.overridePatchMethod?(n=this._openRequest("POST",this.url),n.setHeader("X-HTTP-Method-Override","PATCH")):n=this._openRequest("PATCH",this.url),n.setHeader("Upload-Offset","".concat(this._offset));var o=this._addChunkToRequest(n);o.then(function(i){if(!pi(i.getStatus(),200)){r._emitHttpError(n,i,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,i)}).catch(function(i){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),i)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,o=this._offset,i=this._offset+this.options.chunkSize;return r.setProgressHandler(function(a){n._emitProgress(o+a,n._size)}),this.options.protocol===oc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ga&&r.setHeader("Content-Type","application/partial-upload"),(i===Number.POSITIVE_INFINITY||i>this._size)&&!this.options.uploadLengthDeferred&&(i=this._size),this._source.slice(o,i).then(function(a){var s=a.value,u=a.done,c=s!=null&&s.size?s.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===ic||n.options.protocol===Ga)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,s))})}},{key:"_handleUploadResponse",value:function(r,n){var o=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(o)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(o,this._size),this._emitChunkComplete(o-this._offset,o,this._size),this._offset=o,o===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var o=hw(r,n,this.options);return this._req=o,o}},{key:"_removeFromUrlStorage",value:function(){var r=this;this._urlStorageKey&&(this._urlStorage.removeUpload(this._urlStorageKey).catch(function(n){r._emitError(n)}),this._urlStorageKey=null)}},{key:"_saveUploadInUrlStorage",value:function(){var r=this;if(!this.options.storeFingerprintForResuming||!this._fingerprint||this._urlStorageKey!==null)return Promise.resolve();var n={size:this._size,metadata:this.options.metadata,creationTime:new Date().toString()};return this._parallelUploads?n.parallelUploadUrls=this._parallelUploadUrls:n.uploadUrl=this.url,this._urlStorage.addUpload(this._fingerprint,n).then(function(o){r._urlStorageKey=o})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return mw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=hw("DELETE",r,n);return mw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new nc.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof nc.default||(i=new nc.default("tus: failed to terminate upload",i,o,null)),!gw(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=di(di({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function pw(t){return Object.entries(t).map(function(e){var r=Dw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(k$.Base64.encode(String(o)))}).join(",")}function pi(t,e){return t>=e&&t<e+100}function hw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===ic?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ga?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var o=r.headers||{},i=0,a=Object.entries(o);i<a.length;i++){var s=Dw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,$$.default)();n.setHeader("X-Request-ID",l)}return n}function mw(t,e,r){return dh.apply(this,arguments)}function dh(){return dh=I$(fh().mark(function t(e,r,n){var o;return fh().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(typeof n.onBeforeRequest!="function"){a.next=3;break}return a.next=3,n.onBeforeRequest(e);case 3:return a.next=5,e.send(r);case 5:if(o=a.sent,typeof n.onAfterResponse!="function"){a.next=9;break}return a.next=9,n.onAfterResponse(e,o);case 9:return a.abrupt("return",o);case 10:case"end":return a.stop()}},t)})),dh.apply(this,arguments)}function H$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function gw(t,e,r){return r.retryDelays==null||e>=r.retryDelays.length||t.originalRequest==null?!1:r&&typeof r.onShouldRetry=="function"?r.onShouldRetry(t,e,r):Cw(t)}function Cw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!pi(e,400)||e===409||e===423)&&H$()}function yw(t,e){return new P$.default(e,t).toString()}function V$(t,e){for(var r=Math.floor(t/e),n=[],o=0;o<e;o++)n.push({start:r*o,end:r*(o+1)});return n[e-1].end=t,n}vw.defaultOptions=q$;var nK=ac.default=vw});var Sw=S((iK,_w)=>{"use strict";var Rr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Rr.writable=t=>Rr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Rr.readable=t=>Rr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Rr.duplex=t=>Rr.writable(t)&&Rr.readable(t);Rr.transform=t=>Rr.duplex(t)&&typeof t._transform=="function";_w.exports=Rr});var Aw=S(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.default=void 0;function Wa(t){"@babel/helpers - typeof";return Wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wa(t)}function z$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,G$(n.key),n)}}function K$(t,e,r){return e&&xw(t.prototype,e),r&&xw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function G$(t){var e=W$(t,"string");return Wa(e)=="symbol"?e:e+""}function W$(t,e){if(Wa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var aK=sc.default=(function(){function t(e){z$(this,t),this._buffer=e,this.size=e.length}return K$(t,[{key:"slice",value:function(r,n){var o=this._buffer.slice(r,n);o.size=o.length;var i=n>=this.size;return Promise.resolve({value:o,done:i})}},{key:"close",value:function(){}}])})()});var Pw=S(gh=>{"use strict";Object.defineProperty(gh,"__esModule",{value:!0});gh.default=eI;var kw=require("fs");function Qn(t){"@babel/helpers - typeof";return Qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qn(t)}function hh(){"use strict";hh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(D,w,v){D[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(D,w,v){return Object.defineProperty(D,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),D[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(D,w,v,O){var R=w&&w.prototype instanceof C?w:C,I=Object.create(R.prototype),q=new J(O||[]);return o(I,"_invoke",{value:L(D,v,q)}),I}function d(D,w,v){try{return{type:"normal",arg:D.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",y={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=C.prototype=Object.create(_);function B(D){["next","throw","return"].forEach(function(w){c(D,w,function(v){return this._invoke(w,v)})})}function T(D,w){function v(R,I,q,P){var N=d(D[R],D,I);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&Qn(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(I,q){function P(){return new w(function(N,z){v(I,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(D,w,v){var O=p;return function(R,I){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw I;return{value:t,done:!0}}for(v.method=R,v.arg=I;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===y)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(D,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===y)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(D,w){var v=w.method,O=D.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&D.iterator.return&&(w.method="return",w.arg=t,A(D,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),y;var R=d(O,D.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,y;var I=R.arg;return I?I.done?(w[D.resultName]=I.value,w.next=D.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,y):I:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,y)}function j(D){var w={tryLoc:D[0]};1 in D&&(w.catchLoc=D[1]),2 in D&&(w.finallyLoc=D[2],w.afterLoc=D[3]),this.tryEntries.push(w)}function M(D){var w=D.completion||{};w.type="normal",delete w.arg,D.completion=w}function J(D){this.tryEntries=[{tryLoc:"root"}],D.forEach(j,this),this.reset(!0)}function k(D){if(D||D===""){var w=D[a];if(w)return w.call(D);if(typeof D.next=="function")return D;if(!isNaN(D.length)){var v=-1,O=function R(){for(;++v<D.length;)if(n.call(D,v))return R.value=D[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(Qn(D)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(D){var w=typeof D=="function"&&D.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(D){return Object.setPrototypeOf?Object.setPrototypeOf(D,g):(D.__proto__=g,c(D,u,"GeneratorFunction")),D.prototype=Object.create(F),D},e.awrap=function(D){return{__await:D}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(D,w,v,O,R){R===void 0&&(R=Promise);var I=new T(l(D,w,v,O),R);return e.isGeneratorFunction(w)?I:I.next().then(function(q){return q.done?q.value:I.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(D){var w=Object(D),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var I=v.pop();if(I in w)return R.value=I,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R],q=I.completion;if(I.tryLoc==="root")return O("end");if(I.tryLoc<=this.prev){var P=n.call(I,"catchLoc"),N=n.call(I,"finallyLoc");if(P&&N){if(this.prev<I.catchLoc)return O(I.catchLoc,!0);if(this.prev<I.finallyLoc)return O(I.finallyLoc)}else if(P){if(this.prev<I.catchLoc)return O(I.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return O(I.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var I=R;break}}I&&(w==="break"||w==="continue")&&I.tryLoc<=v&&v<=I.finallyLoc&&(I=null);var q=I?I.completion:{};return q.type=w,q.arg=v,I?(this.method="next",this.next=I.finallyLoc,y):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),y},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),y}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var I=R.arg;M(O)}return I}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),y}},e}function Y$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ow(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,X$(n.key),n)}}function J$(t,e,r){return e&&Ow(t.prototype,e),r&&Ow(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function X$(t){var e=Z$(t,"string");return Qn(e)=="symbol"?e:e+""}function Z$(t,e){if(Qn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Qn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fw(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function Q$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Fw(i,n,o,a,s,"next",u)}function s(u){Fw(i,n,o,a,s,"throw",u)}a(void 0)})}}function eI(t){return mh.apply(this,arguments)}function mh(){return mh=Q$(hh().mark(function t(e){var r,n,o,i,a,s,u;return hh().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,kw.promises.stat(n);case 3:return o=l.sent,i=o.size,a=(r=e.start)!==null&&r!==void 0?r:0,s=Number.isFinite(e.end)?e.end+1:i,u=s-a,l.abrupt("return",new tI(e,n,u));case 9:case"end":return l.stop()}},t)})),mh.apply(this,arguments)}var tI=(function(){function t(e,r,n){Y$(this,t),this._stream=e,this._path=r,this.size=n}return J$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,kw.createReadStream)(this._path,{start:i+r,end:i+n-1,autoClose:!0});a.size=Math.min(n-r,this.size);var s=a.size>=this.size;return Promise.resolve({value:a,done:s})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var Dh=S(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;function eo(t){"@babel/helpers - typeof";return eo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eo(t)}function Ya(){"use strict";Ya=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(D,w,v){D[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(D,w,v){return Object.defineProperty(D,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),D[w]}try{c({},"")}catch{c=function(v,O,R){return v[O]=R}}function l(D,w,v,O){var R=w&&w.prototype instanceof C?w:C,I=Object.create(R.prototype),q=new J(O||[]);return o(I,"_invoke",{value:L(D,v,q)}),I}function d(D,w,v){try{return{type:"normal",arg:D.call(w,v)}}catch(O){return{type:"throw",arg:O}}}e.wrap=l;var p="suspendedStart",h="suspendedYield",m="executing",b="completed",y={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var x=Object.getPrototypeOf,$=x&&x(x(k([])));$&&$!==r&&n.call($,a)&&(_=$);var F=g.prototype=C.prototype=Object.create(_);function B(D){["next","throw","return"].forEach(function(w){c(D,w,function(v){return this._invoke(w,v)})})}function T(D,w){function v(R,I,q,P){var N=d(D[R],D,I);if(N.type!=="throw"){var z=N.arg,H=z.value;return H&&eo(H)=="object"&&n.call(H,"__await")?w.resolve(H.__await).then(function(se){v("next",se,q,P)},function(se){v("throw",se,q,P)}):w.resolve(H).then(function(se){z.value=se,q(z)},function(se){return v("throw",se,q,P)})}P(N.arg)}var O;o(this,"_invoke",{value:function(I,q){function P(){return new w(function(N,z){v(I,q,N,z)})}return O=O?O.then(P,P):P()}})}function L(D,w,v){var O=p;return function(R,I){if(O===m)throw Error("Generator is already running");if(O===b){if(R==="throw")throw I;return{value:t,done:!0}}for(v.method=R,v.arg=I;;){var q=v.delegate;if(q){var P=A(q,v);if(P){if(P===y)continue;return P}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(O===p)throw O=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);O=m;var N=d(D,w,v);if(N.type==="normal"){if(O=v.done?b:h,N.arg===y)continue;return{value:N.arg,done:v.done}}N.type==="throw"&&(O=b,v.method="throw",v.arg=N.arg)}}}function A(D,w){var v=w.method,O=D.iterator[v];if(O===t)return w.delegate=null,v==="throw"&&D.iterator.return&&(w.method="return",w.arg=t,A(D,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),y;var R=d(O,D.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,y;var I=R.arg;return I?I.done?(w[D.resultName]=I.value,w.next=D.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,y):I:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,y)}function j(D){var w={tryLoc:D[0]};1 in D&&(w.catchLoc=D[1]),2 in D&&(w.finallyLoc=D[2],w.afterLoc=D[3]),this.tryEntries.push(w)}function M(D){var w=D.completion||{};w.type="normal",delete w.arg,D.completion=w}function J(D){this.tryEntries=[{tryLoc:"root"}],D.forEach(j,this),this.reset(!0)}function k(D){if(D||D===""){var w=D[a];if(w)return w.call(D);if(typeof D.next=="function")return D;if(!isNaN(D.length)){var v=-1,O=function R(){for(;++v<D.length;)if(n.call(D,v))return R.value=D[v],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(eo(D)+" is not iterable")}return E.prototype=g,o(F,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(D){var w=typeof D=="function"&&D.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(D){return Object.setPrototypeOf?Object.setPrototypeOf(D,g):(D.__proto__=g,c(D,u,"GeneratorFunction")),D.prototype=Object.create(F),D},e.awrap=function(D){return{__await:D}},B(T.prototype),c(T.prototype,s,function(){return this}),e.AsyncIterator=T,e.async=function(D,w,v,O,R){R===void 0&&(R=Promise);var I=new T(l(D,w,v,O),R);return e.isGeneratorFunction(w)?I:I.next().then(function(q){return q.done?q.value:I.next()})},B(F),c(F,u,"Generator"),c(F,a,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(D){var w=Object(D),v=[];for(var O in w)v.push(O);return v.reverse(),function R(){for(;v.length;){var I=v.pop();if(I in w)return R.value=I,R.done=!1,R}return R.done=!0,R}},e.values=k,J.prototype={constructor:J,reset:function(w){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(M),!w)for(var v in this)v.charAt(0)==="t"&&n.call(this,v)&&!isNaN(+v.slice(1))&&(this[v]=t)},stop:function(){this.done=!0;var w=this.tryEntries[0].completion;if(w.type==="throw")throw w.arg;return this.rval},dispatchException:function(w){if(this.done)throw w;var v=this;function O(z,H){return q.type="throw",q.arg=w,v.next=z,H&&(v.method="next",v.arg=t),!!H}for(var R=this.tryEntries.length-1;R>=0;--R){var I=this.tryEntries[R],q=I.completion;if(I.tryLoc==="root")return O("end");if(I.tryLoc<=this.prev){var P=n.call(I,"catchLoc"),N=n.call(I,"finallyLoc");if(P&&N){if(this.prev<I.catchLoc)return O(I.catchLoc,!0);if(this.prev<I.finallyLoc)return O(I.finallyLoc)}else if(P){if(this.prev<I.catchLoc)return O(I.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<I.finallyLoc)return O(I.finallyLoc)}}}},abrupt:function(w,v){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var I=R;break}}I&&(w==="break"||w==="continue")&&I.tryLoc<=v&&v<=I.finallyLoc&&(I=null);var q=I?I.completion:{};return q.type=w,q.arg=v,I?(this.method="next",this.next=I.finallyLoc,y):this.complete(q)},complete:function(w,v){if(w.type==="throw")throw w.arg;return w.type==="break"||w.type==="continue"?this.next=w.arg:w.type==="return"?(this.rval=this.arg=w.arg,this.method="return",this.next="end"):w.type==="normal"&&v&&(this.next=v),y},finish:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),M(O),y}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var O=this.tryEntries[v];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var I=R.arg;M(O)}return I}}throw Error("illegal catch attempt")},delegateYield:function(w,v,O){return this.delegate={iterator:k(w),resultName:v,nextLoc:O},this.method==="next"&&(this.arg=t),y}},e}function rI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $w(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,oI(n.key),n)}}function nI(t,e,r){return e&&$w(t.prototype,e),r&&$w(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function oI(t){var e=iI(t,"string");return eo(e)=="symbol"?e:e+""}function iI(t,e){if(eo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(eo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Iw(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(c){r(c);return}s.done?e(u):Promise.resolve(u).then(n,o)}function Tw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Iw(i,n,o,a,s,"next",u)}function s(u){Iw(i,n,o,a,s,"throw",u)}a(void 0)})}}function aI(t,e){return yh.apply(this,arguments)}function yh(){return yh=Tw(Ya().mark(function t(e,r){return Ya().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(l){e.off("readable",u),a(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",s),e.off("readable",c),i(l))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),yh.apply(this,arguments)}var cK=uc.default=(function(){function t(e){var r=this;rI(this,t),this._stream=e,this.size=null,this._buf=Buffer.alloc(0),this._bufPos=0,this._ended=!1,this._error=null,e.pause(),e.on("end",function(){r._ended=!0}),e.on("error",function(n){r._error=n})}return nI(t,[{key:"slice",value:(function(){var e=Tw(Ya().mark(function n(o,i){var a,s,u,c,l;return Ya().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o<this._bufPos)){p.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){p.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){p.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){p.next=10;break}return a.size=a.length,p.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){p.next=16;break}return p.next=14,aI(this._stream,c-a.length);case 14:l=p.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,p.abrupt("return",{value:a,done:this._ended});case 20:case"end":return p.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Bw=S(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default=void 0;var sI=require("fs"),uI=cc(Sw()),cI=cc(Aw()),lI=cc(Pw()),fI=cc(Dh());function cc(t){return t&&t.__esModule?t:{default:t}}function Ja(t){"@babel/helpers - typeof";return Ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ja(t)}function dI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hI(n.key),n)}}function pI(t,e,r){return e&&Rw(t.prototype,e),r&&Rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hI(t){var e=mI(t,"string");return Ja(e)=="symbol"?e:e+""}function mI(t,e){if(Ja(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ja(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var fK=lc.default=(function(){function t(){dI(this,t)}return pI(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new cI.default(r)):r instanceof sI.ReadStream&&r.path!=null?(0,lI.default)(r):uI.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new fI.default(r)):Promise.reject(new Error("cannot create source for stream without a finite value for the `chunkSize` option; specify a chunkSize to control the memory consumption"))):Promise.reject(new Error("source object may only be an instance of Buffer or Readable in this environment"))}}])})()});var Uw=S(bh=>{"use strict";Object.defineProperty(bh,"__esModule",{value:!0});bh.default=DI;var gI=require("crypto"),Nw=jw(require("fs")),yI=jw(require("path"));function Lw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Lw=function(n){return n?r:e})(t)}function jw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Lw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function DI(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,gI.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof Nw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=yI.resolve(t.path);Nw.stat(t.path,function(c,l){if(c){s(c);return}var d=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var zw=S((hK,Vw)=>{var Hw="Expected a function",Mw=NaN,bI="[object Symbol]",wI=/^\s+|\s+$/g,vI=/^[-+]0x[0-9a-f]+$/i,CI=/^0b[01]+$/i,EI=/^0o[0-7]+$/i,_I=parseInt,SI=typeof global=="object"&&global&&global.Object===Object&&global,xI=typeof self=="object"&&self&&self.Object===Object&&self,AI=SI||xI||Function("return this")(),OI=Object.prototype,FI=OI.toString,kI=Math.max,PI=Math.min,wh=function(){return AI.Date.now()};function $I(t,e,r){var n,o,i,a,s,u,c=0,l=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(Hw);e=qw(e)||0,fc(r)&&(l=!!r.leading,d="maxWait"in r,i=d?kI(qw(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p);function h($){var F=n,B=o;return n=o=void 0,c=$,a=t.apply(B,F),a}function m($){return c=$,s=setTimeout(C,e),l?h($):a}function b($){var F=$-u,B=$-c,T=e-F;return d?PI(T,i-B):T}function y($){var F=$-u,B=$-c;return u===void 0||F>=e||F<0||d&&B>=i}function C(){var $=wh();if(y($))return E($);s=setTimeout(C,b($))}function E($){return s=void 0,p&&n?h($):(n=o=void 0,a)}function g(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function _(){return s===void 0?a:E(wh())}function x(){var $=wh(),F=y($);if(n=arguments,o=this,u=$,F){if(s===void 0)return m(u);if(d)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return x.cancel=g,x.flush=_,x}function II(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(Hw);return fc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),$I(t,e,{leading:n,maxWait:e,trailing:o})}function fc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function TI(t){return!!t&&typeof t=="object"}function RI(t){return typeof t=="symbol"||TI(t)&&FI.call(t)==bI}function qw(t){if(typeof t=="number")return t;if(RI(t))return Mw;if(fc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=fc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(wI,"");var r=CI.test(t);return r||EI.test(t)?_I(t.slice(2),r?2:8):vI.test(t)?Mw:+t}Vw.exports=II});var ev=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.default=void 0;var BI=Xw(require("http")),NI=Xw(require("https")),Ww=require("stream"),LI=require("url"),Yw=jI(zw());function jI(t){return t&&t.__esModule?t:{default:t}}function Jw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Jw=function(n){return n?r:e})(t)}function Xw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Jw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function UI(t,e,r){return e=dc(e),MI(t,Zw()?Reflect.construct(e,r||[],dc(t).constructor):e.apply(t,r))}function MI(t,e){if(e&&(hi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qI(t)}function qI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zw=function(){return!!t})()}function dc(t){return dc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},dc(t)}function HI(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vh(t,e)}function vh(t,e){return vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},vh(t,e)}function Kw(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function Xa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kw(Object(r),!0).forEach(function(n){VI(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function VI(t,e,r){return e=Qw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hi(t){"@babel/helpers - typeof";return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hi(t)}function pc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Gw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qw(n.key),n)}}function hc(t,e,r){return e&&Gw(t.prototype,e),r&&Gw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Qw(t){var e=zI(t,"string");return hi(e)=="symbol"?e:e+""}function zI(t,e){if(hi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mK=mc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};pc(this,t),this._requestOptions=e}return hc(t,[{key:"createRequest",value:function(r,n){return new KI(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),KI=(function(){function t(e,r,n){pc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return hc(t,[{key:"getMethod",value:function(){return this._method}},{key:"getURL",value:function(){return this._url}},{key:"setHeader",value:function(r,n){this._headers[r]=n}},{key:"getHeader",value:function(r){return this._headers[r]}},{key:"setProgressHandler",value:function(r){this._progressHandler=r}},{key:"send",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return new Promise(function(o,i){var a=Xa(Xa(Xa({},(0,LI.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Xa(Xa({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?NI:BI;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(d){l.push(d)}),c.on("end",function(){var d=Buffer.concat(l).toString("utf8");o(new GI(c,d))})}),u.on("error",function(c){i(c)}),n instanceof Ww.Readable?n.pipe(new WI(r._progressHandler)).pipe(u):n instanceof Uint8Array?YI(u,n,r._progressHandler):u.end(n)})}},{key:"abort",value:function(){return this._request!==null&&this._request.abort(),Promise.resolve()}},{key:"getUnderlyingObject",value:function(){return this._request}}])})(),GI=(function(){function t(e,r){pc(this,t),this._response=e,this._body=r}return hc(t,[{key:"getStatus",value:function(){return this._response.statusCode}},{key:"getHeader",value:function(r){return this._response.headers[r.toLowerCase()]}},{key:"getBody",value:function(){return this._body}},{key:"getUnderlyingObject",value:function(){return this._response}}])})(),WI=(function(t){function e(r){var n;return pc(this,e),n=UI(this,e),n._onprogress=(0,Yw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return HI(e,t),hc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(Ww.Transform),YI=function(e,r,n){n=(0,Yw.default)(n,100,{leading:!0,trailing:!1});var o=0;function i(){var a=Math.min(e.writableHighWaterMark,r.length-o),s=r.subarray(o,o+a);o+=s.length;var u=e.write(s);u?o<r.length?i():e.end():(e.once("drain",i),n(o))}i()}});var tv=S(Ch=>{"use strict";Ch.expectReceive=function(t,e,r){var n;r.root(t,e,r),n=this.message,t.hasOwnProperty("expected")&&(n+=" Expected "+t.expected+"."),t.hasOwnProperty("received")&&(n+=" Received: "+t.received+"."),this.message=n};Ch.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
40
40
  `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(i.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(i.rootOnly=e.rootOnly),(!i.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":o=t.code||void 0;break;case"message":a=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
41
41
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
42
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(l){a=l,c()}}),c())}});var Qw=S((rK,Zw)=>{"use strict";Zw.exports=ro;ro.factory=Jw();var vh=ro("CustomError");vh.order=ro(vh,{message:"Arguments out of order.",code:"EOARG"});function ro(t,e,r,n){var o,i;return e=hc(arguments,1,Error,Xw,[bh,mc]),r=hc(arguments,2,{},bh,[mc]),n=hc(arguments,3,wh,mc,[]),t=hc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,IT,[Xw,bh,mc]),i=e===Error,i&&n===wh&&(n=ro.factory.root),o=function(a,s){var u,c,l,d,p,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,l={},Object.keys(ro.factory).forEach(function(m){l[m]=function(b,D){ro.factory[m].call(u,b,D,l)}}),d=this.CustomError.chain.length-1;d>=0;d--)p=this.CustomError.chain[d],p.factory!==wh&&p.factory.call(this,h,s,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var a=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(a+=" "+this.code),this.message&&(a+=": "+this.message),a},o}function hc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,l;for(s=0;s<=c;s++){if(l=t[s],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=s);a===-1&&n(l)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new vh.order;return a!==-1?t[a]:r}function mc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function IT(t){return typeof t=="string"}function Xw(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function bh(t){return t&&typeof t=="object"}function wh(){}});var tv=S((nK,ev)=>{ev.exports=Qw()});var av=S((no,pi)=>{var RT=1/0,BT="[object Symbol]",Ja={function:!0,object:!0},NT=Ja[typeof no]&&no&&!no.nodeType?no:void 0,LT=Ja[typeof pi]&&pi&&!pi.nodeType?pi:void 0,jT=gc(NT&&LT&&typeof global=="object"&&global),UT=gc(Ja[typeof self]&&self),rv=gc(Ja[typeof window]&&window),Eh=gc(Ja[typeof no]&&no),MT=jT||rv!==(Eh&&Eh.window)&&rv||UT||Eh||Function("return this")();function gc(t){return t&&t.Object===Object?t:null}var qT=Object.prototype,HT=qT.toString,nv=MT.Symbol,ov=nv?nv.prototype:void 0,iv=ov?ov.toString:void 0;function VT(t){if(typeof t=="string")return t;if(KT(t))return iv?iv.call(t):"";var e=t+"";return e=="0"&&1/t==-RT?"-0":e}function zT(t){return!!t&&typeof t=="object"}function KT(t){return typeof t=="symbol"||zT(t)&&HT.call(t)==BT}pi.exports=VT});var pv=S((oo,hi)=>{var GT=av(),WT="Expected a function",uv="__lodash_hash_undefined__",YT="[object Function]",JT="[object GeneratorFunction]",XT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,ZT=/[\\^$.*+?()[\]{}|]/g,QT=/\\(\\)?/g,eI=/^\[object .+?Constructor\]$/,Za={function:!0,object:!0},tI=Za[typeof oo]&&oo&&!oo.nodeType?oo:void 0,rI=Za[typeof hi]&&hi&&!hi.nodeType?hi:void 0,nI=Dc(tI&&rI&&typeof global=="object"&&global),oI=Dc(Za[typeof self]&&self),sv=Dc(Za[typeof window]&&window),Ch=Dc(Za[typeof oo]&&oo),iI=nI||sv!==(Ch&&Ch.window)&&sv||oI||Ch||Function("return this")();function Dc(t){return t&&t.Object===Object?t:null}function aI(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var sI=Array.prototype,cv=Object.prototype,lv=Function.prototype.toString,_h=cv.hasOwnProperty,uI=cv.toString,cI=RegExp("^"+lv.call(_h).replace(ZT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lI=sI.splice,fI=fv(iI,"Map"),Xa=fv(Object,"create");function io(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function dI(){this.__data__=Xa?Xa(null):{}}function pI(t){return this.has(t)&&delete this.__data__[t]}function hI(t){var e=this.__data__;if(Xa){var r=e[t];return r===uv?void 0:r}return _h.call(e,t)?e[t]:void 0}function mI(t){var e=this.__data__;return Xa?e[t]!==void 0:_h.call(e,t)}function gI(t,e){var r=this.__data__;return r[t]=Xa&&e===void 0?uv:e,this}io.prototype.clear=dI;io.prototype.delete=pI;io.prototype.get=hI;io.prototype.has=mI;io.prototype.set=gI;function mi(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function DI(){this.__data__=[]}function yI(t){var e=this.__data__,r=yc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():lI.call(e,r,1),!0}function bI(t){var e=this.__data__,r=yc(e,t);return r<0?void 0:e[r][1]}function wI(t){return yc(this.__data__,t)>-1}function vI(t,e){var r=this.__data__,n=yc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}mi.prototype.clear=DI;mi.prototype.delete=yI;mi.prototype.get=bI;mi.prototype.has=wI;mi.prototype.set=vI;function ao(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function EI(){this.__data__={hash:new io,map:new(fI||mi),string:new io}}function CI(t){return bc(this,t).delete(t)}function _I(t){return bc(this,t).get(t)}function SI(t){return bc(this,t).has(t)}function xI(t,e){return bc(this,t).set(t,e),this}ao.prototype.clear=EI;ao.prototype.delete=CI;ao.prototype.get=_I;ao.prototype.has=SI;ao.prototype.set=xI;function yc(t,e){for(var r=t.length;r--;)if(kI(t[r][0],e))return r;return-1}function bc(t,e){var r=t.__data__;return AI(e)?r[typeof e=="string"?"string":"hash"]:r.map}function fv(t,e){var r=t[e];return $I(r)?r:void 0}function AI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var OI=Sh(function(t){var e=[];return TI(t).replace(XT,function(r,n,o,i){e.push(o?i.replace(QT,"$1"):n||r)}),e});function FI(t){if(t!=null){try{return lv.call(t)}catch{}try{return t+""}catch{}}return""}function Sh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(WT);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(Sh.Cache||ao),r}Sh.Cache=ao;function kI(t,e){return t===e||t!==t&&e!==e}function PI(t){var e=dv(t)?uI.call(t):"";return e==YT||e==JT}function dv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function $I(t){if(!dv(t))return!1;var e=PI(t)||aI(t)?cI:eI;return e.test(FI(t))}function TI(t){return t==null?"":GT(t)}hi.exports=OI});var Hv=S((so,Di)=>{var II=pv(),RI=200,Bh="__lodash_hash_undefined__",_c=1,yi=2,BI=1/0,bv=9007199254740991,wc="[object Arguments]",Oh="[object Array]",wv="[object Boolean]",vv="[object Date]",Ev="[object Error]",Cv="[object Function]",NI="[object GeneratorFunction]",Qa="[object Map]",_v="[object Number]",gi="[object Object]",hv="[object Promise]",Sv="[object RegExp]",es="[object Set]",Nh="[object String]",xv="[object Symbol]",Fh="[object WeakMap]",Av="[object ArrayBuffer]",vc="[object DataView]",LI="[object Float32Array]",jI="[object Float64Array]",UI="[object Int8Array]",MI="[object Int16Array]",qI="[object Int32Array]",HI="[object Uint8Array]",VI="[object Uint8ClampedArray]",zI="[object Uint16Array]",KI="[object Uint32Array]",GI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,WI=/^\w*$/,YI=/[\\^$.*+?()[\]{}|]/g,JI=/^\[object .+?Constructor\]$/,XI=/^(?:0|[1-9]\d*)$/,Ne={};Ne[LI]=Ne[jI]=Ne[UI]=Ne[MI]=Ne[qI]=Ne[HI]=Ne[VI]=Ne[zI]=Ne[KI]=!0;Ne[wc]=Ne[Oh]=Ne[Av]=Ne[wv]=Ne[vc]=Ne[vv]=Ne[Ev]=Ne[Cv]=Ne[Qa]=Ne[_v]=Ne[gi]=Ne[Sv]=Ne[es]=Ne[Nh]=Ne[Fh]=!1;var rs={function:!0,object:!0},ZI=rs[typeof so]&&so&&!so.nodeType?so:void 0,QI=rs[typeof Di]&&Di&&!Di.nodeType?Di:void 0,eR=Sc(ZI&&QI&&typeof global=="object"&&global),tR=Sc(rs[typeof self]&&self),mv=Sc(rs[typeof window]&&window),xh=Sc(rs[typeof so]&&so),lo=eR||mv!==(xh&&xh.window)&&mv||tR||xh||Function("return this")();function rR(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function nR(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function oR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function iR(t,e){return rR(e,function(r){return[r,t[r]]})}function Sc(t){return t&&t.Object===Object?t:null}function kh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Ov(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function aR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function sR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var uR=Array.prototype,xc=Object.prototype,Fv=Function.prototype.toString,uo=xc.hasOwnProperty,fo=xc.toString,cR=RegExp("^"+Fv.call(uo).replace(YI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),gv=lo.Symbol,Dv=lo.Uint8Array,lR=xc.propertyIsEnumerable,fR=uR.splice,dR=Object.getPrototypeOf,pR=Object.keys,Ph=bi(lo,"DataView"),Ec=bi(lo,"Map"),$h=bi(lo,"Promise"),Th=bi(lo,"Set"),Ih=bi(lo,"WeakMap"),ts=bi(Object,"create"),hR=ho(Ph),mR=ho(Ec),gR=ho($h),DR=ho(Th),yR=ho(Ih),yv=gv?gv.prototype:void 0,Ah=yv?yv.valueOf:void 0;function co(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function bR(){this.__data__=ts?ts(null):{}}function wR(t){return this.has(t)&&delete this.__data__[t]}function vR(t){var e=this.__data__;if(ts){var r=e[t];return r===Bh?void 0:r}return uo.call(e,t)?e[t]:void 0}function ER(t){var e=this.__data__;return ts?e[t]!==void 0:uo.call(e,t)}function CR(t,e){var r=this.__data__;return r[t]=ts&&e===void 0?Bh:e,this}co.prototype.clear=bR;co.prototype.delete=wR;co.prototype.get=vR;co.prototype.has=ER;co.prototype.set=CR;function tn(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function _R(){this.__data__=[]}function SR(t){var e=this.__data__,r=Ac(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():fR.call(e,r,1),!0}function xR(t){var e=this.__data__,r=Ac(e,t);return r<0?void 0:e[r][1]}function AR(t){return Ac(this.__data__,t)>-1}function OR(t,e){var r=this.__data__,n=Ac(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}tn.prototype.clear=_R;tn.prototype.delete=SR;tn.prototype.get=xR;tn.prototype.has=AR;tn.prototype.set=OR;function po(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function FR(){this.__data__={hash:new co,map:new(Ec||tn),string:new co}}function kR(t){return Oc(this,t).delete(t)}function PR(t){return Oc(this,t).get(t)}function $R(t){return Oc(this,t).has(t)}function TR(t,e){return Oc(this,t).set(t,e),this}po.prototype.clear=FR;po.prototype.delete=kR;po.prototype.get=PR;po.prototype.has=$R;po.prototype.set=TR;function Cc(t){var e=-1,r=t?t.length:0;for(this.__data__=new po;++e<r;)this.add(t[e])}function IR(t){return this.__data__.set(t,Bh),this}function RR(t){return this.__data__.has(t)}Cc.prototype.add=Cc.prototype.push=IR;Cc.prototype.has=RR;function en(t){this.__data__=new tn(t)}function BR(){this.__data__=new tn}function NR(t){return this.__data__.delete(t)}function LR(t){return this.__data__.get(t)}function jR(t){return this.__data__.has(t)}function UR(t,e){var r=this.__data__;return r instanceof tn&&r.__data__.length==RI&&(r=this.__data__=new po(r.__data__)),r.set(t,e),this}en.prototype.clear=BR;en.prototype.delete=NR;en.prototype.get=LR;en.prototype.has=jR;en.prototype.set=UR;function Ac(t,e){for(var r=t.length;r--;)if(iB(t[r][0],e))return r;return-1}function kv(t,e){e=Fc(e,t)?[e]:Tv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[kc(e[r++])];return r&&r==n?t:void 0}function Pv(t,e){return uo.call(t,e)||typeof t=="object"&&e in t&&eB(t)===null}function MR(t,e){return e in Object(t)}function Lh(t,e,r,n,o){return t===e?!0:t==null||e==null||!$c(t)&&!ns(e)?t!==t&&e!==e:qR(t,e,Lh,r,n,o)}function qR(t,e,r,n,o,i){var a=xn(t),s=xn(e),u=Oh,c=Oh;a||(u=Qr(t),u=u==wc?gi:u),s||(c=Qr(e),c=c==wc?gi:c);var l=u==gi&&!kh(t),d=c==gi&&!kh(e),p=u==c;if(p&&!l)return i||(i=new en),a||uB(t)?Iv(t,e,r,n,o,i):JR(t,e,u,r,n,o,i);if(!(o&yi)){var h=l&&uo.call(t,"__wrapped__"),m=d&&uo.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,D=m?e.value():e;return i||(i=new en),r(b,D,n,o,i)}}return p?(i||(i=new en),XR(t,e,r,n,o,i)):!1}function HR(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new en;if(n)var p=n(c,l,u,t,e,d);if(!(p===void 0?Lh(l,c,n,_c|yi,d):p))return!1}}return!0}function VR(t){return typeof t=="function"?t:t==null?dB:typeof t=="object"?xn(t)?GR(t[0],t[1]):KR(t):pB(t)}function zR(t){return pR(Object(t))}function KR(t){var e=QR(t);return e.length==1&&e[0][2]?Nv(e[0][0],e[0][1]):function(r){return r===t||HR(r,t,e)}}function GR(t,e){return Fc(t)&&Bv(e)?Nv(kc(t),e):function(r){var n=cB(r,t);return n===void 0&&n===e?lB(r,t):Lh(e,n,void 0,_c|yi)}}function $v(t){return function(e){return e?.[t]}}function WR(t){return function(e){return kv(e,t)}}function Tv(t){return xn(t)?t:II(t)}function YR(t){return function(e){var r=Qr(e);return r==Qa?Ov(e):r==es?sR(e):iR(e,t(e))}}function Iv(t,e,r,n,o,i){var a=o&yi,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c)return c==e;var l=-1,d=!0,p=o&_c?new Cc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var b=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(b!==void 0){if(b)continue;d=!1;break}if(p){if(!nR(e,function(D,E){if(!p.has(E)&&(h===D||r(h,D,n,o,i)))return p.add(E)})){d=!1;break}}else if(!(h===m||r(h,m,n,o,i))){d=!1;break}}return i.delete(t),d}function JR(t,e,r,n,o,i,a){switch(r){case vc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Av:return!(t.byteLength!=e.byteLength||!n(new Dv(t),new Dv(e)));case wv:case vv:return+t==+e;case Ev:return t.name==e.name&&t.message==e.message;case _v:return t!=+t?e!=+e:t==+e;case Sv:case Nh:return t==e+"";case Qa:var s=Ov;case es:var u=i&yi;if(s||(s=aR),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=_c,a.set(t,e),Iv(s(t),s(e),n,o,i,a));case xv:if(Ah)return Ah.call(t)==Ah.call(e)}return!1}function XR(t,e,r,n,o,i){var a=o&yi,s=Rh(t),u=s.length,c=Rh(e),l=c.length;if(u!=l&&!a)return!1;for(var d=u;d--;){var p=s[d];if(!(a?p in e:Pv(e,p)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++d<u;){p=s[d];var D=t[p],E=e[p];if(n)var C=a?n(E,D,p,e,t,i):n(D,E,p,t,e,i);if(!(C===void 0?D===E||r(D,E,n,o,i):C)){m=!1;break}b||(b=p=="constructor")}if(m&&!b){var g=t.constructor,_=e.constructor;g!=_&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var ZR=$v("length");function Oc(t,e){var r=t.__data__;return nB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function QR(t){for(var e=fB(t),r=e.length;r--;)e[r][2]=Bv(e[r][1]);return e}function bi(t,e){var r=t[e];return sB(r)?r:void 0}function eB(t){return dR(Object(t))}function Qr(t){return fo.call(t)}(Ph&&Qr(new Ph(new ArrayBuffer(1)))!=vc||Ec&&Qr(new Ec)!=Qa||$h&&Qr($h.resolve())!=hv||Th&&Qr(new Th)!=es||Ih&&Qr(new Ih)!=Fh)&&(Qr=function(t){var e=fo.call(t),r=e==gi?t.constructor:void 0,n=r?ho(r):void 0;if(n)switch(n){case hR:return vc;case mR:return Qa;case gR:return hv;case DR:return es;case yR:return Fh}return e});function tB(t,e,r){e=Fc(e,t)?[e]:Tv(e);for(var n,o=-1,a=e.length;++o<a;){var i=kc(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var a=t?t.length:0;return!!a&&Pc(a)&&Rv(i,a)&&(xn(t)||Mv(t)||Lv(t))}function rB(t){var e=t?t.length:void 0;return Pc(e)&&(xn(t)||Mv(t)||Lv(t))?oR(e,String):null}function Rv(t,e){return e=e??bv,!!e&&(typeof t=="number"||XI.test(t))&&t>-1&&t%1==0&&t<e}function Fc(t,e){if(xn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||qv(t)?!0:WI.test(t)||!GI.test(t)||e!=null&&t in Object(e)}function nB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function oB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||xc;return t===r}function Bv(t){return t===t&&!$c(t)}function Nv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function kc(t){if(typeof t=="string"||qv(t))return t;var e=t+"";return e=="0"&&1/t==-BI?"-0":e}function ho(t){if(t!=null){try{return Fv.call(t)}catch{}try{return t+""}catch{}}return""}function iB(t,e){return t===e||t!==t&&e!==e}function Lv(t){return aB(t)&&uo.call(t,"callee")&&(!lR.call(t,"callee")||fo.call(t)==wc)}var xn=Array.isArray;function jv(t){return t!=null&&Pc(ZR(t))&&!Uv(t)}function aB(t){return ns(t)&&jv(t)}function Uv(t){var e=$c(t)?fo.call(t):"";return e==Cv||e==NI}function Pc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=bv}function $c(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ns(t){return!!t&&typeof t=="object"}function sB(t){if(!$c(t))return!1;var e=Uv(t)||kh(t)?cR:JI;return e.test(ho(t))}function Mv(t){return typeof t=="string"||!xn(t)&&ns(t)&&fo.call(t)==Nh}function qv(t){return typeof t=="symbol"||ns(t)&&fo.call(t)==xv}function uB(t){return ns(t)&&Pc(t.length)&&!!Ne[fo.call(t)]}function cB(t,e,r){var n=t==null?void 0:kv(t,e);return n===void 0?r:n}function lB(t,e){return t!=null&&tB(t,e,MR)}function Rh(t){var e=oB(t);if(!(e||jv(t)))return zR(t);var r=rB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Pv(t,a)&&!(n&&(a=="length"||Rv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var fB=YR(Rh);function dB(t){return t}function pB(t){return Fc(t)?$v(kc(t)):WR(t)}Di.exports=VR});var Wv=S((mo,wi)=>{var hB=1/0,mB="[object Function]",gB="[object GeneratorFunction]",DB=/[\\^$.*+?()[\]{}|]/g,yB=/^\[object .+?Constructor\]$/,os={function:!0,object:!0},bB=os[typeof mo]&&mo&&!mo.nodeType?mo:void 0,wB=os[typeof wi]&&wi&&!wi.nodeType?wi:void 0,vB=Tc(bB&&wB&&typeof global=="object"&&global),EB=Tc(os[typeof self]&&self),Vv=Tc(os[typeof window]&&window),jh=Tc(os[typeof mo]&&mo),CB=vB||Vv!==(jh&&jh.window)&&Vv||EB||jh||Function("return this")();function Tc(t){return t&&t.Object===Object?t:null}function _B(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function SB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var zv=Object.prototype,Kv=Function.prototype.toString,xB=zv.hasOwnProperty,AB=zv.toString,OB=RegExp("^"+Kv.call(xB).replace(DB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Uh=kB(CB,"Set"),FB=Uh&&1/SB(new Uh([,-0]))[1]==hB?function(t){return new Uh(t)}:IB;function kB(t,e){var r=t[e];return TB(r)?r:void 0}function PB(t){if(t!=null){try{return Kv.call(t)}catch{}try{return t+""}catch{}}return""}function $B(t){var e=Gv(t)?AB.call(t):"";return e==mB||e==gB}function Gv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function TB(t){if(!Gv(t))return!1;var e=$B(t)||_B(t)?OB:yB;return e.test(PB(t))}function IB(){}wi.exports=FB});var Jv=S((go,vi)=>{var is={function:!0,object:!0},RB=is[typeof go]&&go&&!go.nodeType?go:void 0,BB=is[typeof vi]&&vi&&!vi.nodeType?vi:void 0,NB=Ic(RB&&BB&&typeof global=="object"&&global),LB=Ic(is[typeof self]&&self),Yv=Ic(is[typeof window]&&window),Mh=Ic(is[typeof go]&&go),jB=NB||Yv!==(Mh&&Mh.window)&&Yv||LB||Mh||Function("return this")();function Ic(t){return t&&t.Object===Object?t:null}vi.exports=jB});var rE=S((oK,tE)=>{var UB=Wv(),MB=Jv(),qB=200,qh="__lodash_hash_undefined__",HB="[object Function]",VB="[object GeneratorFunction]",zB=/[\\^$.*+?()[\]{}|]/g,KB=/^\[object .+?Constructor\]$/;function GB(t,e){return!!t.length&&YB(t,e,0)>-1}function WB(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function YB(t,e,r){if(e!==e)return XB(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function JB(t,e){return t.has(e)}function XB(t,e,r){for(var n=t.length,o=e+(r?0:-1);r?o--:++o<n;){var i=t[o];if(i!==i)return o}return-1}function ZB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function QB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var e6=Array.prototype,Xv=Object.prototype,Zv=Function.prototype.toString,Hh=Xv.hasOwnProperty,t6=Xv.toString,r6=RegExp("^"+Zv.call(Hh).replace(zB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),n6=e6.splice,o6=Qv(MB,"Map"),as=Qv(Object,"create");function Do(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function i6(){this.__data__=as?as(null):{}}function a6(t){return this.has(t)&&delete this.__data__[t]}function s6(t){var e=this.__data__;if(as){var r=e[t];return r===qh?void 0:r}return Hh.call(e,t)?e[t]:void 0}function u6(t){var e=this.__data__;return as?e[t]!==void 0:Hh.call(e,t)}function c6(t,e){var r=this.__data__;return r[t]=as&&e===void 0?qh:e,this}Do.prototype.clear=i6;Do.prototype.delete=a6;Do.prototype.get=s6;Do.prototype.has=u6;Do.prototype.set=c6;function Ei(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function l6(){this.__data__=[]}function f6(t){var e=this.__data__,r=Bc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():n6.call(e,r,1),!0}function d6(t){var e=this.__data__,r=Bc(e,t);return r<0?void 0:e[r][1]}function p6(t){return Bc(this.__data__,t)>-1}function h6(t,e){var r=this.__data__,n=Bc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Ei.prototype.clear=l6;Ei.prototype.delete=f6;Ei.prototype.get=d6;Ei.prototype.has=p6;Ei.prototype.set=h6;function Ci(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function m6(){this.__data__={hash:new Do,map:new(o6||Ei),string:new Do}}function g6(t){return Nc(this,t).delete(t)}function D6(t){return Nc(this,t).get(t)}function y6(t){return Nc(this,t).has(t)}function b6(t,e){return Nc(this,t).set(t,e),this}Ci.prototype.clear=m6;Ci.prototype.delete=g6;Ci.prototype.get=D6;Ci.prototype.has=y6;Ci.prototype.set=b6;function Rc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ci;++e<r;)this.add(t[e])}function w6(t){return this.__data__.set(t,qh),this}function v6(t){return this.__data__.has(t)}Rc.prototype.add=Rc.prototype.push=w6;Rc.prototype.has=v6;function Bc(t,e){for(var r=t.length;r--;)if(S6(t[r][0],e))return r;return-1}function E6(t,e,r){var n=-1,o=GB,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=WB;else if(i>=qB){var c=e?null:UB(t);if(c)return QB(c);a=!1,o=JB,u=new Rc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;e&&u.push(d),s.push(l)}else o(u,d,r)||(u!==s&&u.push(d),s.push(l))}return s}function Nc(t,e){var r=t.__data__;return C6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Qv(t,e){var r=t[e];return A6(r)?r:void 0}function C6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function _6(t){if(t!=null){try{return Zv.call(t)}catch{}try{return t+""}catch{}}return""}function S6(t,e){return t===e||t!==t&&e!==e}function x6(t){var e=eE(t)?t6.call(t):"";return e==HB||e==VB}function eE(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function A6(t){if(!eE(t))return!1;var e=x6(t)||ZB(t)?r6:KB;return e.test(_6(t))}tE.exports=E6});var oE=S((iK,nE)=>{var O6=Hv(),F6=rE();function k6(t,e){return t&&t.length?F6(t,O6(e)):[]}nE.exports=k6});var aE=S((aK,iE)=>{"use strict";var P6=tv(),$6=oE(),T6=P6("MultiError");iE.exports=Vh;function Vh(t){if(!(this instanceof Vh))return new Vh(t);if(t=Array.isArray(t)?t:[t],t=$6(t,function(r){return r.stack}),t.length===1)return t[0];var e=new T6({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
42
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(l){a=l,c()}}),c())}});var ov=S((DK,nv)=>{"use strict";nv.exports=to;to.factory=tv();var Sh=to("CustomError");Sh.order=to(Sh,{message:"Arguments out of order.",code:"EOARG"});function to(t,e,r,n){var o,i;return e=gc(arguments,1,Error,rv,[Eh,yc]),r=gc(arguments,2,{},Eh,[yc]),n=gc(arguments,3,_h,yc,[]),t=gc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,JI,[rv,Eh,yc]),i=e===Error,i&&n===_h&&(n=to.factory.root),o=function(a,s){var u,c,l,d,p,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,l={},Object.keys(to.factory).forEach(function(m){l[m]=function(b,y){to.factory[m].call(u,b,y,l)}}),d=this.CustomError.chain.length-1;d>=0;d--)p=this.CustomError.chain[d],p.factory!==_h&&p.factory.call(this,h,s,l)},o.prototype=Object.create(e.prototype),o.prototype.constructor=o,o.prototype.name=t,o.prototype.CustomError={chain:i?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},o.prototype.CustomError.chain.unshift(o.prototype.CustomError),o.prototype.toString=function(){var a=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(a+=" "+this.code),this.message&&(a+=": "+this.message),a},o}function gc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,l;for(s=0;s<=c;s++){if(l=t[s],i===-1)for(u=0;u<o.length;u++)o[u](l)&&(i=s);a===-1&&n(l)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Sh.order;return a!==-1?t[a]:r}function yc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function JI(t){return typeof t=="string"}function rv(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Eh(t){return t&&typeof t=="object"}function _h(){}});var av=S((bK,iv)=>{iv.exports=ov()});var fv=S((ro,mi)=>{var XI=1/0,ZI="[object Symbol]",Za={function:!0,object:!0},QI=Za[typeof ro]&&ro&&!ro.nodeType?ro:void 0,eT=Za[typeof mi]&&mi&&!mi.nodeType?mi:void 0,tT=Dc(QI&&eT&&typeof global=="object"&&global),rT=Dc(Za[typeof self]&&self),sv=Dc(Za[typeof window]&&window),xh=Dc(Za[typeof ro]&&ro),nT=tT||sv!==(xh&&xh.window)&&sv||rT||xh||Function("return this")();function Dc(t){return t&&t.Object===Object?t:null}var oT=Object.prototype,iT=oT.toString,uv=nT.Symbol,cv=uv?uv.prototype:void 0,lv=cv?cv.toString:void 0;function aT(t){if(typeof t=="string")return t;if(uT(t))return lv?lv.call(t):"";var e=t+"";return e=="0"&&1/t==-XI?"-0":e}function sT(t){return!!t&&typeof t=="object"}function uT(t){return typeof t=="symbol"||sT(t)&&iT.call(t)==ZI}mi.exports=aT});var Dv=S((no,gi)=>{var cT=fv(),lT="Expected a function",pv="__lodash_hash_undefined__",fT="[object Function]",dT="[object GeneratorFunction]",pT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,hT=/[\\^$.*+?()[\]{}|]/g,mT=/\\(\\)?/g,gT=/^\[object .+?Constructor\]$/,es={function:!0,object:!0},yT=es[typeof no]&&no&&!no.nodeType?no:void 0,DT=es[typeof gi]&&gi&&!gi.nodeType?gi:void 0,bT=bc(yT&&DT&&typeof global=="object"&&global),wT=bc(es[typeof self]&&self),dv=bc(es[typeof window]&&window),Ah=bc(es[typeof no]&&no),vT=bT||dv!==(Ah&&Ah.window)&&dv||wT||Ah||Function("return this")();function bc(t){return t&&t.Object===Object?t:null}function CT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var ET=Array.prototype,hv=Object.prototype,mv=Function.prototype.toString,Oh=hv.hasOwnProperty,_T=hv.toString,ST=RegExp("^"+mv.call(Oh).replace(hT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),xT=ET.splice,AT=gv(vT,"Map"),Qa=gv(Object,"create");function oo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function OT(){this.__data__=Qa?Qa(null):{}}function FT(t){return this.has(t)&&delete this.__data__[t]}function kT(t){var e=this.__data__;if(Qa){var r=e[t];return r===pv?void 0:r}return Oh.call(e,t)?e[t]:void 0}function PT(t){var e=this.__data__;return Qa?e[t]!==void 0:Oh.call(e,t)}function $T(t,e){var r=this.__data__;return r[t]=Qa&&e===void 0?pv:e,this}oo.prototype.clear=OT;oo.prototype.delete=FT;oo.prototype.get=kT;oo.prototype.has=PT;oo.prototype.set=$T;function yi(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function IT(){this.__data__=[]}function TT(t){var e=this.__data__,r=wc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():xT.call(e,r,1),!0}function RT(t){var e=this.__data__,r=wc(e,t);return r<0?void 0:e[r][1]}function BT(t){return wc(this.__data__,t)>-1}function NT(t,e){var r=this.__data__,n=wc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}yi.prototype.clear=IT;yi.prototype.delete=TT;yi.prototype.get=RT;yi.prototype.has=BT;yi.prototype.set=NT;function io(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function LT(){this.__data__={hash:new oo,map:new(AT||yi),string:new oo}}function jT(t){return vc(this,t).delete(t)}function UT(t){return vc(this,t).get(t)}function MT(t){return vc(this,t).has(t)}function qT(t,e){return vc(this,t).set(t,e),this}io.prototype.clear=LT;io.prototype.delete=jT;io.prototype.get=UT;io.prototype.has=MT;io.prototype.set=qT;function wc(t,e){for(var r=t.length;r--;)if(KT(t[r][0],e))return r;return-1}function vc(t,e){var r=t.__data__;return HT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function gv(t,e){var r=t[e];return WT(r)?r:void 0}function HT(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var VT=Fh(function(t){var e=[];return YT(t).replace(pT,function(r,n,o,i){e.push(o?i.replace(mT,"$1"):n||r)}),e});function zT(t){if(t!=null){try{return mv.call(t)}catch{}try{return t+""}catch{}}return""}function Fh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(lT);var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a),a};return r.cache=new(Fh.Cache||io),r}Fh.Cache=io;function KT(t,e){return t===e||t!==t&&e!==e}function GT(t){var e=yv(t)?_T.call(t):"";return e==fT||e==dT}function yv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function WT(t){if(!yv(t))return!1;var e=GT(t)||CT(t)?ST:gT;return e.test(zT(t))}function YT(t){return t==null?"":cT(t)}gi.exports=VT});var Wv=S((ao,bi)=>{var JT=Dv(),XT=200,Uh="__lodash_hash_undefined__",xc=1,wi=2,ZT=1/0,_v=9007199254740991,Cc="[object Arguments]",$h="[object Array]",Sv="[object Boolean]",xv="[object Date]",Av="[object Error]",Ov="[object Function]",QT="[object GeneratorFunction]",ts="[object Map]",Fv="[object Number]",Di="[object Object]",bv="[object Promise]",kv="[object RegExp]",rs="[object Set]",Mh="[object String]",Pv="[object Symbol]",Ih="[object WeakMap]",$v="[object ArrayBuffer]",Ec="[object DataView]",eR="[object Float32Array]",tR="[object Float64Array]",rR="[object Int8Array]",nR="[object Int16Array]",oR="[object Int32Array]",iR="[object Uint8Array]",aR="[object Uint8ClampedArray]",sR="[object Uint16Array]",uR="[object Uint32Array]",cR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lR=/^\w*$/,fR=/[\\^$.*+?()[\]{}|]/g,dR=/^\[object .+?Constructor\]$/,pR=/^(?:0|[1-9]\d*)$/,Ne={};Ne[eR]=Ne[tR]=Ne[rR]=Ne[nR]=Ne[oR]=Ne[iR]=Ne[aR]=Ne[sR]=Ne[uR]=!0;Ne[Cc]=Ne[$h]=Ne[$v]=Ne[Sv]=Ne[Ec]=Ne[xv]=Ne[Av]=Ne[Ov]=Ne[ts]=Ne[Fv]=Ne[Di]=Ne[kv]=Ne[rs]=Ne[Mh]=Ne[Ih]=!1;var os={function:!0,object:!0},hR=os[typeof ao]&&ao&&!ao.nodeType?ao:void 0,mR=os[typeof bi]&&bi&&!bi.nodeType?bi:void 0,gR=Ac(hR&&mR&&typeof global=="object"&&global),yR=Ac(os[typeof self]&&self),wv=Ac(os[typeof window]&&window),kh=Ac(os[typeof ao]&&ao),co=gR||wv!==(kh&&kh.window)&&wv||yR||kh||Function("return this")();function DR(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function bR(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function wR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function vR(t,e){return DR(e,function(r){return[r,t[r]]})}function Ac(t){return t&&t.Object===Object?t:null}function Th(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Iv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function CR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function ER(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var _R=Array.prototype,Oc=Object.prototype,Tv=Function.prototype.toString,so=Oc.hasOwnProperty,lo=Oc.toString,SR=RegExp("^"+Tv.call(so).replace(fR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vv=co.Symbol,Cv=co.Uint8Array,xR=Oc.propertyIsEnumerable,AR=_R.splice,OR=Object.getPrototypeOf,FR=Object.keys,Rh=vi(co,"DataView"),_c=vi(co,"Map"),Bh=vi(co,"Promise"),Nh=vi(co,"Set"),Lh=vi(co,"WeakMap"),ns=vi(Object,"create"),kR=po(Rh),PR=po(_c),$R=po(Bh),IR=po(Nh),TR=po(Lh),Ev=vv?vv.prototype:void 0,Ph=Ev?Ev.valueOf:void 0;function uo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function RR(){this.__data__=ns?ns(null):{}}function BR(t){return this.has(t)&&delete this.__data__[t]}function NR(t){var e=this.__data__;if(ns){var r=e[t];return r===Uh?void 0:r}return so.call(e,t)?e[t]:void 0}function LR(t){var e=this.__data__;return ns?e[t]!==void 0:so.call(e,t)}function jR(t,e){var r=this.__data__;return r[t]=ns&&e===void 0?Uh:e,this}uo.prototype.clear=RR;uo.prototype.delete=BR;uo.prototype.get=NR;uo.prototype.has=LR;uo.prototype.set=jR;function rn(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function UR(){this.__data__=[]}function MR(t){var e=this.__data__,r=Fc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():AR.call(e,r,1),!0}function qR(t){var e=this.__data__,r=Fc(e,t);return r<0?void 0:e[r][1]}function HR(t){return Fc(this.__data__,t)>-1}function VR(t,e){var r=this.__data__,n=Fc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}rn.prototype.clear=UR;rn.prototype.delete=MR;rn.prototype.get=qR;rn.prototype.has=HR;rn.prototype.set=VR;function fo(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function zR(){this.__data__={hash:new uo,map:new(_c||rn),string:new uo}}function KR(t){return kc(this,t).delete(t)}function GR(t){return kc(this,t).get(t)}function WR(t){return kc(this,t).has(t)}function YR(t,e){return kc(this,t).set(t,e),this}fo.prototype.clear=zR;fo.prototype.delete=KR;fo.prototype.get=GR;fo.prototype.has=WR;fo.prototype.set=YR;function Sc(t){var e=-1,r=t?t.length:0;for(this.__data__=new fo;++e<r;)this.add(t[e])}function JR(t){return this.__data__.set(t,Uh),this}function XR(t){return this.__data__.has(t)}Sc.prototype.add=Sc.prototype.push=JR;Sc.prototype.has=XR;function tn(t){this.__data__=new rn(t)}function ZR(){this.__data__=new rn}function QR(t){return this.__data__.delete(t)}function eB(t){return this.__data__.get(t)}function tB(t){return this.__data__.has(t)}function rB(t,e){var r=this.__data__;return r instanceof rn&&r.__data__.length==XT&&(r=this.__data__=new fo(r.__data__)),r.set(t,e),this}tn.prototype.clear=ZR;tn.prototype.delete=QR;tn.prototype.get=eB;tn.prototype.has=tB;tn.prototype.set=rB;function Fc(t,e){for(var r=t.length;r--;)if(vB(t[r][0],e))return r;return-1}function Rv(t,e){e=Pc(e,t)?[e]:Lv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[$c(e[r++])];return r&&r==n?t:void 0}function Bv(t,e){return so.call(t,e)||typeof t=="object"&&e in t&&gB(t)===null}function nB(t,e){return e in Object(t)}function qh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Tc(t)&&!is(e)?t!==t&&e!==e:oB(t,e,qh,r,n,o)}function oB(t,e,r,n,o,i){var a=On(t),s=On(e),u=$h,c=$h;a||(u=en(t),u=u==Cc?Di:u),s||(c=en(e),c=c==Cc?Di:c);var l=u==Di&&!Th(t),d=c==Di&&!Th(e),p=u==c;if(p&&!l)return i||(i=new tn),a||_B(t)?jv(t,e,r,n,o,i):dB(t,e,u,r,n,o,i);if(!(o&wi)){var h=l&&so.call(t,"__wrapped__"),m=d&&so.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,y=m?e.value():e;return i||(i=new tn),r(b,y,n,o,i)}}return p?(i||(i=new tn),pB(t,e,r,n,o,i)):!1}function iB(t,e,r,n){var o=r.length,i=o,a=!n;if(t==null)return!i;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<i;){s=r[o];var u=s[0],c=t[u],l=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new tn;if(n)var p=n(c,l,u,t,e,d);if(!(p===void 0?qh(l,c,n,xc|wi,d):p))return!1}}return!0}function aB(t){return typeof t=="function"?t:t==null?OB:typeof t=="object"?On(t)?cB(t[0],t[1]):uB(t):FB(t)}function sB(t){return FR(Object(t))}function uB(t){var e=mB(t);return e.length==1&&e[0][2]?qv(e[0][0],e[0][1]):function(r){return r===t||iB(r,t,e)}}function cB(t,e){return Pc(t)&&Mv(e)?qv($c(t),e):function(r){var n=SB(r,t);return n===void 0&&n===e?xB(r,t):qh(e,n,void 0,xc|wi)}}function Nv(t){return function(e){return e?.[t]}}function lB(t){return function(e){return Rv(e,t)}}function Lv(t){return On(t)?t:JT(t)}function fB(t){return function(e){var r=en(e);return r==ts?Iv(e):r==rs?ER(e):vR(e,t(e))}}function jv(t,e,r,n,o,i){var a=o&wi,s=t.length,u=e.length;if(s!=u&&!(a&&u>s))return!1;var c=i.get(t);if(c)return c==e;var l=-1,d=!0,p=o&xc?new Sc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var b=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(b!==void 0){if(b)continue;d=!1;break}if(p){if(!bR(e,function(y,C){if(!p.has(C)&&(h===y||r(h,y,n,o,i)))return p.add(C)})){d=!1;break}}else if(!(h===m||r(h,m,n,o,i))){d=!1;break}}return i.delete(t),d}function dB(t,e,r,n,o,i,a){switch(r){case Ec:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case $v:return!(t.byteLength!=e.byteLength||!n(new Cv(t),new Cv(e)));case Sv:case xv:return+t==+e;case Av:return t.name==e.name&&t.message==e.message;case Fv:return t!=+t?e!=+e:t==+e;case kv:case Mh:return t==e+"";case ts:var s=Iv;case rs:var u=i&wi;if(s||(s=CR),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=xc,a.set(t,e),jv(s(t),s(e),n,o,i,a));case Pv:if(Ph)return Ph.call(t)==Ph.call(e)}return!1}function pB(t,e,r,n,o,i){var a=o&wi,s=jh(t),u=s.length,c=jh(e),l=c.length;if(u!=l&&!a)return!1;for(var d=u;d--;){var p=s[d];if(!(a?p in e:Bv(e,p)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++d<u;){p=s[d];var y=t[p],C=e[p];if(n)var E=a?n(C,y,p,e,t,i):n(y,C,p,t,e,i);if(!(E===void 0?y===C||r(y,C,n,o,i):E)){m=!1;break}b||(b=p=="constructor")}if(m&&!b){var g=t.constructor,_=e.constructor;g!=_&&"constructor"in t&&"constructor"in e&&!(typeof g=="function"&&g instanceof g&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var hB=Nv("length");function kc(t,e){var r=t.__data__;return bB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function mB(t){for(var e=AB(t),r=e.length;r--;)e[r][2]=Mv(e[r][1]);return e}function vi(t,e){var r=t[e];return EB(r)?r:void 0}function gB(t){return OR(Object(t))}function en(t){return lo.call(t)}(Rh&&en(new Rh(new ArrayBuffer(1)))!=Ec||_c&&en(new _c)!=ts||Bh&&en(Bh.resolve())!=bv||Nh&&en(new Nh)!=rs||Lh&&en(new Lh)!=Ih)&&(en=function(t){var e=lo.call(t),r=e==Di?t.constructor:void 0,n=r?po(r):void 0;if(n)switch(n){case kR:return Ec;case PR:return ts;case $R:return bv;case IR:return rs;case TR:return Ih}return e});function yB(t,e,r){e=Pc(e,t)?[e]:Lv(e);for(var n,o=-1,a=e.length;++o<a;){var i=$c(e[o]);if(!(n=t!=null&&r(t,i)))break;t=t[i]}if(n)return n;var a=t?t.length:0;return!!a&&Ic(a)&&Uv(i,a)&&(On(t)||Kv(t)||Hv(t))}function DB(t){var e=t?t.length:void 0;return Ic(e)&&(On(t)||Kv(t)||Hv(t))?wR(e,String):null}function Uv(t,e){return e=e??_v,!!e&&(typeof t=="number"||pR.test(t))&&t>-1&&t%1==0&&t<e}function Pc(t,e){if(On(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Gv(t)?!0:lR.test(t)||!cR.test(t)||e!=null&&t in Object(e)}function bB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function wB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Oc;return t===r}function Mv(t){return t===t&&!Tc(t)}function qv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function $c(t){if(typeof t=="string"||Gv(t))return t;var e=t+"";return e=="0"&&1/t==-ZT?"-0":e}function po(t){if(t!=null){try{return Tv.call(t)}catch{}try{return t+""}catch{}}return""}function vB(t,e){return t===e||t!==t&&e!==e}function Hv(t){return CB(t)&&so.call(t,"callee")&&(!xR.call(t,"callee")||lo.call(t)==Cc)}var On=Array.isArray;function Vv(t){return t!=null&&Ic(hB(t))&&!zv(t)}function CB(t){return is(t)&&Vv(t)}function zv(t){var e=Tc(t)?lo.call(t):"";return e==Ov||e==QT}function Ic(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=_v}function Tc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function is(t){return!!t&&typeof t=="object"}function EB(t){if(!Tc(t))return!1;var e=zv(t)||Th(t)?SR:dR;return e.test(po(t))}function Kv(t){return typeof t=="string"||!On(t)&&is(t)&&lo.call(t)==Mh}function Gv(t){return typeof t=="symbol"||is(t)&&lo.call(t)==Pv}function _B(t){return is(t)&&Ic(t.length)&&!!Ne[lo.call(t)]}function SB(t,e,r){var n=t==null?void 0:Rv(t,e);return n===void 0?r:n}function xB(t,e){return t!=null&&yB(t,e,nB)}function jh(t){var e=wB(t);if(!(e||Vv(t)))return sB(t);var r=DB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Bv(t,a)&&!(n&&(a=="length"||Uv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var AB=fB(jh);function OB(t){return t}function FB(t){return Pc(t)?Nv($c(t)):lB(t)}bi.exports=aB});var Qv=S((ho,Ci)=>{var kB=1/0,PB="[object Function]",$B="[object GeneratorFunction]",IB=/[\\^$.*+?()[\]{}|]/g,TB=/^\[object .+?Constructor\]$/,as={function:!0,object:!0},RB=as[typeof ho]&&ho&&!ho.nodeType?ho:void 0,BB=as[typeof Ci]&&Ci&&!Ci.nodeType?Ci:void 0,NB=Rc(RB&&BB&&typeof global=="object"&&global),LB=Rc(as[typeof self]&&self),Yv=Rc(as[typeof window]&&window),Hh=Rc(as[typeof ho]&&ho),jB=NB||Yv!==(Hh&&Hh.window)&&Yv||LB||Hh||Function("return this")();function Rc(t){return t&&t.Object===Object?t:null}function UB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function MB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Jv=Object.prototype,Xv=Function.prototype.toString,qB=Jv.hasOwnProperty,HB=Jv.toString,VB=RegExp("^"+Xv.call(qB).replace(IB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vh=KB(jB,"Set"),zB=Vh&&1/MB(new Vh([,-0]))[1]==kB?function(t){return new Vh(t)}:JB;function KB(t,e){var r=t[e];return YB(r)?r:void 0}function GB(t){if(t!=null){try{return Xv.call(t)}catch{}try{return t+""}catch{}}return""}function WB(t){var e=Zv(t)?HB.call(t):"";return e==PB||e==$B}function Zv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function YB(t){if(!Zv(t))return!1;var e=WB(t)||UB(t)?VB:TB;return e.test(GB(t))}function JB(){}Ci.exports=zB});var tC=S((mo,Ei)=>{var ss={function:!0,object:!0},XB=ss[typeof mo]&&mo&&!mo.nodeType?mo:void 0,ZB=ss[typeof Ei]&&Ei&&!Ei.nodeType?Ei:void 0,QB=Bc(XB&&ZB&&typeof global=="object"&&global),e6=Bc(ss[typeof self]&&self),eC=Bc(ss[typeof window]&&window),zh=Bc(ss[typeof mo]&&mo),t6=QB||eC!==(zh&&zh.window)&&eC||e6||zh||Function("return this")();function Bc(t){return t&&t.Object===Object?t:null}Ei.exports=t6});var sC=S((wK,aC)=>{var r6=Qv(),n6=tC(),o6=200,Kh="__lodash_hash_undefined__",i6="[object Function]",a6="[object GeneratorFunction]",s6=/[\\^$.*+?()[\]{}|]/g,u6=/^\[object .+?Constructor\]$/;function c6(t,e){return!!t.length&&f6(t,e,0)>-1}function l6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function f6(t,e,r){if(e!==e)return p6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function d6(t,e){return t.has(e)}function p6(t,e,r){for(var n=t.length,o=e+(r?0:-1);r?o--:++o<n;){var i=t[o];if(i!==i)return o}return-1}function h6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function m6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var g6=Array.prototype,rC=Object.prototype,nC=Function.prototype.toString,Gh=rC.hasOwnProperty,y6=rC.toString,D6=RegExp("^"+nC.call(Gh).replace(s6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),b6=g6.splice,w6=oC(n6,"Map"),us=oC(Object,"create");function go(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function v6(){this.__data__=us?us(null):{}}function C6(t){return this.has(t)&&delete this.__data__[t]}function E6(t){var e=this.__data__;if(us){var r=e[t];return r===Kh?void 0:r}return Gh.call(e,t)?e[t]:void 0}function _6(t){var e=this.__data__;return us?e[t]!==void 0:Gh.call(e,t)}function S6(t,e){var r=this.__data__;return r[t]=us&&e===void 0?Kh:e,this}go.prototype.clear=v6;go.prototype.delete=C6;go.prototype.get=E6;go.prototype.has=_6;go.prototype.set=S6;function _i(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function x6(){this.__data__=[]}function A6(t){var e=this.__data__,r=Lc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():b6.call(e,r,1),!0}function O6(t){var e=this.__data__,r=Lc(e,t);return r<0?void 0:e[r][1]}function F6(t){return Lc(this.__data__,t)>-1}function k6(t,e){var r=this.__data__,n=Lc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}_i.prototype.clear=x6;_i.prototype.delete=A6;_i.prototype.get=O6;_i.prototype.has=F6;_i.prototype.set=k6;function Si(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function P6(){this.__data__={hash:new go,map:new(w6||_i),string:new go}}function $6(t){return jc(this,t).delete(t)}function I6(t){return jc(this,t).get(t)}function T6(t){return jc(this,t).has(t)}function R6(t,e){return jc(this,t).set(t,e),this}Si.prototype.clear=P6;Si.prototype.delete=$6;Si.prototype.get=I6;Si.prototype.has=T6;Si.prototype.set=R6;function Nc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Si;++e<r;)this.add(t[e])}function B6(t){return this.__data__.set(t,Kh),this}function N6(t){return this.__data__.has(t)}Nc.prototype.add=Nc.prototype.push=B6;Nc.prototype.has=N6;function Lc(t,e){for(var r=t.length;r--;)if(M6(t[r][0],e))return r;return-1}function L6(t,e,r){var n=-1,o=c6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=l6;else if(i>=o6){var c=e?null:r6(t);if(c)return m6(c);a=!1,o=d6,u=new Nc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],d=e?e(l):l;if(l=r||l!==0?l:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;e&&u.push(d),s.push(l)}else o(u,d,r)||(u!==s&&u.push(d),s.push(l))}return s}function jc(t,e){var r=t.__data__;return j6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function oC(t,e){var r=t[e];return H6(r)?r:void 0}function j6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function U6(t){if(t!=null){try{return nC.call(t)}catch{}try{return t+""}catch{}}return""}function M6(t,e){return t===e||t!==t&&e!==e}function q6(t){var e=iC(t)?y6.call(t):"";return e==i6||e==a6}function iC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function H6(t){if(!iC(t))return!1;var e=q6(t)||h6(t)?D6:u6;return e.test(U6(t))}aC.exports=L6});var cC=S((vK,uC)=>{var V6=Wv(),z6=sC();function K6(t,e){return t&&t.length?z6(t,V6(e)):[]}uC.exports=K6});var fC=S((CK,lC)=>{"use strict";var G6=av(),W6=cC(),Y6=G6("MultiError");lC.exports=Wh;function Wh(t){if(!(this instanceof Wh))return new Wh(t);if(t=Array.isArray(t)?t:[t],t=W6(t,function(r){return r.stack}),t.length===1)return t[0];var e=new Y6({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
43
43
 
44
44
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
45
45
 
46
- `)}),e}});var uE=S((sK,sE)=>{var An=require("constants"),I6=process.cwd,Lc=null,R6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Lc||(Lc=I6.call(process)),Lc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(zh=process.chdir,process.chdir=function(t){Lc=null,zh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,zh));var zh;sE.exports=B6;function B6(t){An.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=a(t.chownSync),t.fchownSync=a(t.fchownSync),t.lchownSync=a(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=s(t.stat),t.fstat=s(t.fstat),t.lstat=s(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,d,p,h){h&&process.nextTick(h)},t.lchownSync=function(){}),R6==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,h,m){var b=Date.now(),D=0;l(p,h,function E(C){if(C&&(C.code==="EACCES"||C.code==="EPERM"||C.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(p,h,E):m(C)})},D),D<100&&(D+=10);return}m&&m(C)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function d(p,h,m,b,D,E){var C;if(E&&typeof E=="function"){var g=0;C=function(_,x,$){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,p,h,m,b,D,C);E.apply(this,arguments)}}return l.call(t,p,h,m,b,D,C)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(d,p,h,m,b){for(var D=0;;)try{return l.call(t,d,p,h,m,b)}catch(E){if(E.code==="EAGAIN"&&D<10){D++;continue}throw E}}})(t.readSync);function e(l){l.lchmod=function(d,p,h){l.open(d,An.O_WRONLY|An.O_SYMLINK,p,function(m,b){if(m){h&&h(m);return}l.fchmod(b,p,function(D){l.close(b,function(E){h&&h(D||E)})})})},l.lchmodSync=function(d,p){var h=l.openSync(d,An.O_WRONLY|An.O_SYMLINK,p),m=!0,b;try{b=l.fchmodSync(h,p),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){An.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,p,h,m){l.open(d,An.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,p,h,function(E){l.close(D,function(C){m&&m(E||C)})})})},l.lutimesSync=function(d,p,h){var m=l.openSync(d,An.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,p,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(d,p,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(d,p,h){return l.call(t,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(d,p){try{return l.call(t,d,p)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(d,p,h,m){return l.call(t,d,p,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(d,p,h){try{return l.call(t,d,p,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return p?l.call(t,d,p,m):l.call(t,d,m)}}function u(l){return l&&function(d,p){var h=p?l.call(t,d,p):l.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var fE=S((uK,lE)=>{var cE=require("stream").Stream;lE.exports=N6;function N6(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);cE.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),s=0,u=a.length;s<u;s++){var c=a[s];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,d){if(l){i.emit("error",l),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);cE.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),a=0,s=i.length;a<s;a++){var u=i[a];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var pE=S((cK,dE)=>{"use strict";dE.exports=j6;var L6=Object.getPrototypeOf||function(t){return t.__proto__};function j6(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:L6(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var On=S((lK,Wh)=>{var Ke=require("fs"),U6=uE(),M6=fE(),q6=pE(),jc=require("util"),mt,Mc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(mt=Symbol.for("graceful-fs.queue"),Mc=Symbol.for("graceful-fs.previous")):(mt="___graceful-fs.queue",Mc="___graceful-fs.previous");function H6(){}function gE(t,e){Object.defineProperty(t,mt,{get:function(){return e}})}var yo=H6;jc.debuglog?yo=jc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(yo=function(){var t=jc.format.apply(jc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
- GFS4: `),console.error(t)});Ke[mt]||(hE=global[mt]||[],gE(Ke,hE),Ke.close=(function(t){function e(r,n){return t.call(Ke,r,function(o){o||mE(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Mc,{value:t}),e})(Ke.close),Ke.closeSync=(function(t){function e(r){t.apply(Ke,arguments),mE()}return Object.defineProperty(e,Mc,{value:t}),e})(Ke.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){yo(Ke[mt]),require("assert").equal(Ke[mt].length,0)}));var hE;global[mt]||gE(global,Ke[mt]);Wh.exports=Kh(q6(Ke));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ke.__patched&&(Wh.exports=Kh(Ke),Ke.__patched=!0);function Kh(t){U6(t),t.gracefulify=Kh,t.createReadStream=x,t.createWriteStream=$;var e=t.readFile;t.readFile=r;function r(I,L,A){return typeof L=="function"&&(A=L,L=null),j(I,L,A);function j(M,J,k,y){return e(M,J,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?_i([j,[M,J,k],w,y||Date.now(),Date.now()]):typeof k=="function"&&k.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(I,L,A,j){return typeof A=="function"&&(j=A,A=null),M(I,L,A,j);function M(J,k,y,w,v){return n(J,k,y,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?_i([M,[J,k,y,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(I,L,A,j){return typeof A=="function"&&(j=A,A=null),M(I,L,A,j);function M(J,k,y,w,v){return i(J,k,y,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?_i([M,[J,k,y,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(I,L,A,j){return typeof A=="function"&&(j=A,A=0),M(I,L,A,j);function M(J,k,y,w,v){return s(J,k,y,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?_i([M,[J,k,y,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var l=/^v[0-5]\./;function d(I,L,A){typeof L=="function"&&(A=L,L=null);var j=l.test(process.version)?function(k,y,w,v){return c(k,M(k,y,w,v))}:function(k,y,w,v){return c(k,y,M(k,y,w,v))};return j(I,L,A);function M(J,k,y,w){return function(v,O){v&&(v.code==="EMFILE"||v.code==="ENFILE")?_i([j,[J,k,y],v,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof y=="function"&&y.call(this,v,O))}}}if(process.version.substr(0,4)==="v0.8"){var p=M6(t);E=p.ReadStream,g=p.WriteStream}var h=t.ReadStream;h&&(E.prototype=Object.create(h.prototype),E.prototype.open=C);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(I){E=I},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(I){g=I},enumerable:!0,configurable:!0});var b=E;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(I){b=I},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(I){D=I},enumerable:!0,configurable:!0});function E(I,L){return this instanceof E?(h.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function C(){var I=this;B(I.path,I.flags,I.mode,function(L,A){L?(I.autoClose&&I.destroy(),I.emit("error",L)):(I.fd=A,I.emit("open",A),I.read())})}function g(I,L){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var I=this;B(I.path,I.flags,I.mode,function(L,A){L?(I.destroy(),I.emit("error",L)):(I.fd=A,I.emit("open",A))})}function x(I,L){return new t.ReadStream(I,L)}function $(I,L){return new t.WriteStream(I,L)}var F=t.open;t.open=B;function B(I,L,A,j){return typeof A=="function"&&(j=A,A=null),M(I,L,A,j);function M(J,k,y,w,v){return F(J,k,y,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?_i([M,[J,k,y,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function _i(t){yo("ENQUEUE",t[0].name,t[1]),Ke[mt].push(t),Gh()}var Uc;function mE(){for(var t=Date.now(),e=0;e<Ke[mt].length;++e)Ke[mt][e].length>2&&(Ke[mt][e][3]=t,Ke[mt][e][4]=t);Gh()}function Gh(){if(clearTimeout(Uc),Uc=void 0,Ke[mt].length!==0){var t=Ke[mt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)yo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){yo("TIMEOUT",e.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var s=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);s>=c?(yo("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ke[mt].push(t)}Uc===void 0&&(Uc=setTimeout(Gh,0))}}});var yE=S((fK,DE)=>{function sr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}DE.exports=sr;sr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};sr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};sr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0};sr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};sr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};sr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};sr.prototype.start=sr.prototype.try;sr.prototype.errors=function(){return this._errors};sr.prototype.attempts=function(){return this._attempts};sr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var bE=S(bo=>{var V6=yE();bo.operation=function(t){var e=bo.timeouts(t);return new V6(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};bo.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};bo.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};bo.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var c=bo.operation(e),l=Array.prototype.slice.call(arguments,1),d=l.pop();l.push(function(p){c.retry(p)||(p&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var vE=S((pK,wE)=>{wE.exports=bE()});var EE=S((hK,qc)=>{qc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&qc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&qc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Xh=S((mK,Ai)=>{var Ue=global.process,wo=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};wo(Ue)?(CE=require("assert"),Si=EE(),_E=/^win/i.test(Ue.platform),ss=require("events"),typeof ss!="function"&&(ss=ss.EventEmitter),Ue.__signal_exit_emitter__?it=Ue.__signal_exit_emitter__:(it=Ue.__signal_exit_emitter__=new ss,it.count=0,it.emitted={}),it.infinite||(it.setMaxListeners(1/0),it.infinite=!0),Ai.exports=function(t,e){if(!wo(global.process))return function(){};CE.equal(typeof t,"function","a callback must be provided for exit handler"),xi===!1&&Yh();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){it.removeListener(r,t),it.listeners("exit").length===0&&it.listeners("afterexit").length===0&&Hc()};return it.on(r,t),n},Hc=function(){!xi||!wo(global.process)||(xi=!1,Si.forEach(function(e){try{Ue.removeListener(e,Vc[e])}catch{}}),Ue.emit=zc,Ue.reallyExit=Jh,it.count-=1)},Ai.exports.unload=Hc,vo=function(e,r,n){it.emitted[e]||(it.emitted[e]=!0,it.emit(e,r,n))},Vc={},Si.forEach(function(t){Vc[t]=function(){if(wo(global.process)){var r=Ue.listeners(t);r.length===it.count&&(Hc(),vo("exit",null,t),vo("afterexit",null,t),_E&&t==="SIGHUP"&&(t="SIGINT"),Ue.kill(Ue.pid,t))}}}),Ai.exports.signals=function(){return Si},xi=!1,Yh=function(){xi||!wo(global.process)||(xi=!0,it.count+=1,Si=Si.filter(function(e){try{return Ue.on(e,Vc[e]),!0}catch{return!1}}),Ue.emit=xE,Ue.reallyExit=SE)},Ai.exports.load=Yh,Jh=Ue.reallyExit,SE=function(e){wo(global.process)&&(Ue.exitCode=e||0,vo("exit",Ue.exitCode,null),vo("afterexit",Ue.exitCode,null),Jh.call(Ue,Ue.exitCode))},zc=Ue.emit,xE=function(e,r){if(e==="exit"&&wo(global.process)){r!==void 0&&(Ue.exitCode=r);var n=zc.apply(this,arguments);return vo("exit",Ue.exitCode,null),vo("afterexit",Ue.exitCode,null),n}else return zc.apply(this,arguments)}):Ai.exports=function(){return function(){}};var CE,Si,_E,ss,it,Hc,vo,Vc,xi,Yh,Jh,SE,zc,xE});var OE=S((gK,Zh)=>{"use strict";var AE=Symbol();function z6(t,e,r){let n=e[AE];if(n)return e.stat(t,(i,a)=>{if(i)return r(i);r(null,a.mtime,n)});let o=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,o,o,i=>{if(i)return r(i);e.stat(t,(a,s)=>{if(a)return r(a);let u=s.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,AE,{value:u}),r(null,s.mtime,u)})})}function K6(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Zh.exports.probe=z6;Zh.exports.getMtime=K6});var TE=S((DK,cs)=>{"use strict";var G6=require("path"),tm=On(),W6=vE(),Y6=Xh(),FE=OE(),rn={};function us(t,e){return e.lockfilePath||`${t}.lock`}function rm(t,e,r){if(!e.realpath)return r(null,G6.resolve(t));e.fs.realpath(t,r)}function em(t,e,r){let n=us(t,e);e.fs.mkdir(n,o=>{if(!o)return FE.probe(n,e.fs,(i,a,s)=>{if(i)return e.fs.rmdir(n,()=>{}),r(i);r(null,a,s)});if(o.code!=="EEXIST")return r(o);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(i,a)=>{if(i)return i.code==="ENOENT"?em(t,{...e,stale:0},r):r(i);if(!kE(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));PE(t,e,s=>{if(s)return r(s);em(t,{...e,stale:0},r)})})})}function kE(t,e){return t.mtime.getTime()<Date.now()-e.stale}function PE(t,e,r){e.fs.rmdir(us(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Kc(t,e){let r=rn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,o)=>{let i=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||i?Qh(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return Qh(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=FE.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,s,s,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?Qh(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Kc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Kc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Qh(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),rn[t]===e&&delete rn[t],e.options.onCompromised(r)}function J6(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:tm,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),rm(t,e,(n,o)=>{if(n)return r(n);let i=W6.operation(e.retries);i.attempt(()=>{em(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=rn[o]={lockfilePath:us(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Kc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));$E(o,{...e,realpath:!1},l)})})})})}function $E(t,e,r){e={fs:tm,realpath:!0,...e},rm(t,e,(n,o)=>{if(n)return r(n);let i=rn[o];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete rn[o],PE(o,e,r)})}function X6(t,e,r){e={stale:1e4,realpath:!0,fs:tm,...e},e.stale=Math.max(e.stale||0,2e3),rm(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(us(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!kE(a,e)))})}function Z6(){return rn}Y6(()=>{for(let t in rn){let e=rn[t].options;try{e.fs.rmdirSync(us(t,e))}catch{}}});cs.exports.lock=J6;cs.exports.unlock=$E;cs.exports.check=X6;cs.exports.getLocks=Z6});var RE=S((yK,IE)=>{"use strict";var Q6=On();function e8(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...o)=>{let i=o.pop(),a;try{a=t[`${n}Sync`](...o)}catch(s){return i(s)}i(null,a)}}),r}function t8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function r8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function n8(t){if(t={...t},t.fs=e8(t.fs||Q6),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}IE.exports={toPromise:t8,toSync:r8,toSyncOptions:n8}});var NE=S((bK,Fn)=>{"use strict";var Oi=TE(),{toPromise:Gc,toSync:Wc,toSyncOptions:nm}=RE();async function BE(t,e){let r=await Gc(Oi.lock)(t,e);return Gc(r)}function o8(t,e){let r=Wc(Oi.lock)(t,nm(e));return Wc(r)}function i8(t,e){return Gc(Oi.unlock)(t,e)}function a8(t,e){return Wc(Oi.unlock)(t,nm(e))}function s8(t,e){return Gc(Oi.check)(t,e)}function u8(t,e){return Wc(Oi.check)(t,nm(e))}Fn.exports=BE;Fn.exports.lock=BE;Fn.exports.unlock=i8;Fn.exports.lockSync=o8;Fn.exports.unlockSync=a8;Fn.exports.check=s8;Fn.exports.checkSync=u8});var qE=S(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.canStoreURLs=Fi.FileUrlStorage=void 0;var LE=require("fs"),c8=f8(aE()),jE=l8(NE());function ME(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(ME=function(n){return n?r:e})(t)}function l8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=ME(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function f8(t){return t&&t.__esModule?t:{default:t}}function ls(t){"@babel/helpers - typeof";return ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ls(t)}function d8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function UE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h8(n.key),n)}}function p8(t,e,r){return e&&UE(t.prototype,e),r&&UE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function h8(t){var e=m8(t,"string");return ls(e)=="symbol"?e:e+""}function m8(t,e){if(ls(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ls(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wK=Fi.canStoreURLs=!0,vK=Fi.FileUrlStorage=(function(){function t(e){d8(this,t),this.path=e}return p8(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,o){r._getItems("tus::",function(i,a){i?o(i):n(a)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(o,i){n._getItems("tus::".concat(r),function(a,s){a?i(a):o(s)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(o,i){n._removeItem(r,function(a){a?i(a):o()})})}},{key:"addUpload",value:function(r,n){var o=this,i=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(i);return new Promise(function(s,u){o._setItem(a,n,function(c){c?u(c):s(a)})})}},{key:"_setItem",value:function(r,n,o){var i=this;jE.lock(this.path,this._lockfileOptions()).then(function(a){o=i._releaseAndCb(a,o),i._getData(function(s,u){if(s){o(s);return}u[r]=n,i._writeData(u,function(c){return o(c)})})}).catch(o)}},{key:"_getItems",value:function(r,n){this._getData(function(o,i){if(o){n(o);return}var a=Object.keys(i).filter(function(s){return s.startsWith(r)}).map(function(s){var u=i[s];return u.urlStorageKey=s,u});n(null,a)})}},{key:"_removeItem",value:function(r,n){var o=this;jE.lock(this.path,this._lockfileOptions()).then(function(i){n=o._releaseAndCb(i,n),o._getData(function(a,s){if(a){n(a);return}delete s[r],o._writeData(s,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(o){if(o){r().then(function(){return n(o)}).catch(function(i){return n((0,c8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,LE.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,LE.readFile)(this.path,"utf8",function(n,o){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{o=o.trim().length?JSON.parse(o):{}}catch(i){r(i);return}r(null,o)})}}])})()});var Jc=S(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});Object.defineProperty(jt,"DefaultHttpStack",{enumerable:!0,get:function(){return KE.default}});Object.defineProperty(jt,"DetailedError",{enumerable:!0,get:function(){return g8.default}});Object.defineProperty(jt,"FileUrlStorage",{enumerable:!0,get:function(){return GE.FileUrlStorage}});Object.defineProperty(jt,"StreamSource",{enumerable:!0,get:function(){return v8.default}});jt.Upload=void 0;Object.defineProperty(jt,"canStoreURLs",{enumerable:!0,get:function(){return GE.canStoreURLs}});jt.defaultOptions=void 0;Object.defineProperty(jt,"enableDebugLog",{enumerable:!0,get:function(){return D8.enableDebugLog}});jt.isSupported=void 0;var g8=Eo(Qp()),D8=eh(),y8=Eo(qb()),om=Eo(yw()),b8=Eo(Pw()),w8=Eo(Rw()),KE=Eo(Yw()),v8=Eo(hh()),GE=qE();function Eo(t){return t&&t.__esModule?t:{default:t}}function Pi(t){"@babel/helpers - typeof";return Pi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pi(t)}function E8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function HE(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,YE(n.key),n)}}function C8(t,e,r){return e&&HE(t.prototype,e),r&&HE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _8(t,e,r){return e=Yc(e),S8(t,WE()?Reflect.construct(e,r||[],Yc(t).constructor):e.apply(t,r))}function S8(t,e){if(e&&(Pi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x8(t)}function x8(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function WE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WE=function(){return!!t})()}function Yc(t){return Yc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Yc(t)}function A8(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&im(t,e)}function im(t,e){return im=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},im(t,e)}function VE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function ki(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VE(Object(r),!0).forEach(function(n){O8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function O8(t,e,r){return e=YE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function YE(t){var e=F8(t,"string");return Pi(e)=="symbol"?e:e+""}function F8(t,e){if(Pi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Pi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var zE=jt.defaultOptions=ki(ki({},om.default.defaultOptions),{},{httpStack:new KE.default,fileReader:new b8.default,urlStorage:new y8.default,fingerprint:w8.default}),CK=jt.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return E8(this,e),n=ki(ki({},zE),n),_8(this,e,[r,n])}return A8(e,t),C8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=ki(ki({},zE),o),om.default.terminate(n,o)}}])})(om.default),_K=jt.isSupported=!0});var eC=S((UK,QE)=>{var $i=1e3,Ti=$i*60,Ii=Ti*60,Co=Ii*24,L8=Co*7,j8=Co*365.25;QE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return U8(t);if(r==="number"&&isFinite(t))return e.long?q8(t):M8(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function U8(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*j8;case"weeks":case"week":case"w":return r*L8;case"days":case"day":case"d":return r*Co;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ii;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ti;case"seconds":case"second":case"secs":case"sec":case"s":return r*$i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function M8(t){var e=Math.abs(t);return e>=Co?Math.round(t/Co)+"d":e>=Ii?Math.round(t/Ii)+"h":e>=Ti?Math.round(t/Ti)+"m":e>=$i?Math.round(t/$i)+"s":t+"ms"}function q8(t){var e=Math.abs(t);return e>=Co?Zc(t,e,Co,"day"):e>=Ii?Zc(t,e,Ii,"hour"):e>=Ti?Zc(t,e,Ti,"minute"):e>=$i?Zc(t,e,$i,"second"):t+" ms"}function Zc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var um=S((MK,tC)=>{function H8(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=eC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let d=0;for(let p=0;p<l.length;p++)d=(d<<5)-d+l.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(l){let d,p=null,h,m;function b(...D){if(!b.enabled)return;let E=b,C=Number(new Date),g=C-(d||C);E.diff=g,E.prev=d,E.curr=C,d=C,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,($,F)=>{if($==="%%")return"%";_++;let B=r.formatters[F];if(typeof B=="function"){let I=D[_];$=B.call(E,I),D.splice(_,1),_--}return $}),r.formatArgs.call(E,D),(E.log||r.log).apply(E,D)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{p=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,d){let p=r(this.namespace+(typeof d>"u"?":":d)+l);return p.log=this.log,p}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function i(l,d){let p=0,h=0,m=-1,b=0;for(;p<l.length;)if(h<d.length&&(d[h]===l[p]||d[h]==="*"))d[h]==="*"?(m=h,b=p,h++):(p++,h++);else if(m!==-1)h=m+1,b++,p=b;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function a(){let l=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),l}function s(l){for(let d of r.skips)if(i(l,d))return!1;for(let d of r.names)if(i(l,d))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}tC.exports=H8});var rC=S((Ut,Qc)=>{Ut.formatArgs=z8;Ut.save=K8;Ut.load=G8;Ut.useColors=V8;Ut.storage=W8();Ut.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ut.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function V8(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function z8(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Qc.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Ut.log=console.debug||console.log||(()=>{});function K8(t){try{t?Ut.storage.setItem("debug",t):Ut.storage.removeItem("debug")}catch{}}function G8(){let t;try{t=Ut.storage.getItem("debug")||Ut.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function W8(){try{return localStorage}catch{}}Qc.exports=um()(Ut);var{formatters:Y8}=Qc.exports;Y8.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var oC=S((qK,nC)=>{"use strict";nC.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var sC=S((HK,aC)=>{"use strict";var J8=require("os"),iC=require("tty"),lr=oC(),{env:st}=process,kn;lr("no-color")||lr("no-colors")||lr("color=false")||lr("color=never")?kn=0:(lr("color")||lr("colors")||lr("color=true")||lr("color=always"))&&(kn=1);"FORCE_COLOR"in st&&(st.FORCE_COLOR==="true"?kn=1:st.FORCE_COLOR==="false"?kn=0:kn=st.FORCE_COLOR.length===0?1:Math.min(parseInt(st.FORCE_COLOR,10),3));function cm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function lm(t,e){if(kn===0)return 0;if(lr("color=16m")||lr("color=full")||lr("color=truecolor"))return 3;if(lr("color=256"))return 2;if(t&&!e&&kn===void 0)return 0;let r=kn||0;if(st.TERM==="dumb")return r;if(process.platform==="win32"){let n=J8.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in st)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in st)||st.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in st)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(st.TEAMCITY_VERSION)?1:0;if(st.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in st){let n=parseInt((st.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(st.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(st.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(st.TERM)||"COLORTERM"in st?1:r}function X8(t){let e=lm(t,t&&t.isTTY);return cm(e)}aC.exports={supportsColor:X8,stdout:cm(lm(!0,iC.isatty(1))),stderr:cm(lm(!0,iC.isatty(2)))}});var cC=S((ut,tl)=>{var Z8=require("tty"),el=require("util");ut.init=iN;ut.log=rN;ut.formatArgs=eN;ut.save=nN;ut.load=oN;ut.useColors=Q8;ut.destroy=el.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ut.colors=[6,2,3,4,5,1];try{let t=sC();t&&(t.stderr||t).level>=2&&(ut.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ut.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function Q8(){return"colors"in ut.inspectOpts?!!ut.inspectOpts.colors:Z8.isatty(process.stderr.fd)}function eN(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
46
+ `)}),e}});var pC=S((EK,dC)=>{var Fn=require("constants"),J6=process.cwd,Uc=null,X6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Uc||(Uc=J6.call(process)),Uc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Yh=process.chdir,process.chdir=function(t){Uc=null,Yh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Yh));var Yh;dC.exports=Z6;function Z6(t){Fn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=i(t.chown),t.fchown=i(t.fchown),t.lchown=i(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=a(t.chownSync),t.fchownSync=a(t.fchownSync),t.lchownSync=a(t.lchownSync),t.chmodSync=o(t.chmodSync),t.fchmodSync=o(t.fchmodSync),t.lchmodSync=o(t.lchmodSync),t.stat=s(t.stat),t.fstat=s(t.fstat),t.lstat=s(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,d,p,h){h&&process.nextTick(h)},t.lchownSync=function(){}),X6==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,h,m){var b=Date.now(),y=0;l(p,h,function C(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-b<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(p,h,C):m(E)})},y),y<100&&(y+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function d(p,h,m,b,y,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,x,$){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,p,h,m,b,y,E);C.apply(this,arguments)}}return l.call(t,p,h,m,b,y,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(d,p,h,m,b){for(var y=0;;)try{return l.call(t,d,p,h,m,b)}catch(C){if(C.code==="EAGAIN"&&y<10){y++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(d,p,h){l.open(d,Fn.O_WRONLY|Fn.O_SYMLINK,p,function(m,b){if(m){h&&h(m);return}l.fchmod(b,p,function(y){l.close(b,function(C){h&&h(y||C)})})})},l.lchmodSync=function(d,p){var h=l.openSync(d,Fn.O_WRONLY|Fn.O_SYMLINK,p),m=!0,b;try{b=l.fchmodSync(h,p),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){Fn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,p,h,m){l.open(d,Fn.O_SYMLINK,function(b,y){if(b){m&&m(b);return}l.futimes(y,p,h,function(C){l.close(y,function(E){m&&m(C||E)})})})},l.lutimesSync=function(d,p,h){var m=l.openSync(d,Fn.O_SYMLINK),b,y=!0;try{b=l.futimesSync(m,p,h),y=!1}finally{if(y)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(d,p,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(d,p,h){return l.call(t,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(d,p){try{return l.call(t,d,p)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(d,p,h,m){return l.call(t,d,p,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(d,p,h){try{return l.call(t,d,p,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function m(b,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.gid+=4294967296)),h&&h.apply(this,arguments)}return p?l.call(t,d,p,m):l.call(t,d,m)}}function u(l){return l&&function(d,p){var h=p?l.call(t,d,p):l.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var gC=S((_K,mC)=>{var hC=require("stream").Stream;mC.exports=Q6;function Q6(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);hC.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),s=0,u=a.length;s<u;s++){var c=a[s];this[c]=o[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}t.open(this.path,this.flags,this.mode,function(l,d){if(l){i.emit("error",l),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);hC.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var i=Object.keys(o),a=0,s=i.length;a<s;a++){var u=i[a];this[u]=o[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var DC=S((SK,yC)=>{"use strict";yC.exports=t8;var e8=Object.getPrototypeOf||function(t){return t.__proto__};function t8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:e8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var kn=S((xK,Zh)=>{var Ke=require("fs"),r8=pC(),n8=gC(),o8=DC(),Mc=require("util"),mt,Hc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(mt=Symbol.for("graceful-fs.queue"),Hc=Symbol.for("graceful-fs.previous")):(mt="___graceful-fs.queue",Hc="___graceful-fs.previous");function i8(){}function vC(t,e){Object.defineProperty(t,mt,{get:function(){return e}})}var yo=i8;Mc.debuglog?yo=Mc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(yo=function(){var t=Mc.format.apply(Mc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
+ GFS4: `),console.error(t)});Ke[mt]||(bC=global[mt]||[],vC(Ke,bC),Ke.close=(function(t){function e(r,n){return t.call(Ke,r,function(o){o||wC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Hc,{value:t}),e})(Ke.close),Ke.closeSync=(function(t){function e(r){t.apply(Ke,arguments),wC()}return Object.defineProperty(e,Hc,{value:t}),e})(Ke.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){yo(Ke[mt]),require("assert").equal(Ke[mt].length,0)}));var bC;global[mt]||vC(global,Ke[mt]);Zh.exports=Jh(o8(Ke));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ke.__patched&&(Zh.exports=Jh(Ke),Ke.__patched=!0);function Jh(t){r8(t),t.gracefulify=Jh,t.createReadStream=x,t.createWriteStream=$;var e=t.readFile;t.readFile=r;function r(T,L,A){return typeof L=="function"&&(A=L,L=null),j(T,L,A);function j(M,J,k,D){return e(M,J,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?xi([j,[M,J,k],w,D||Date.now(),Date.now()]):typeof k=="function"&&k.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(T,L,A,j){return typeof A=="function"&&(j=A,A=null),M(T,L,A,j);function M(J,k,D,w,v){return n(J,k,D,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?xi([M,[J,k,D,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(T,L,A,j){return typeof A=="function"&&(j=A,A=null),M(T,L,A,j);function M(J,k,D,w,v){return i(J,k,D,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?xi([M,[J,k,D,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(T,L,A,j){return typeof A=="function"&&(j=A,A=0),M(T,L,A,j);function M(J,k,D,w,v){return s(J,k,D,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?xi([M,[J,k,D,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var l=/^v[0-5]\./;function d(T,L,A){typeof L=="function"&&(A=L,L=null);var j=l.test(process.version)?function(k,D,w,v){return c(k,M(k,D,w,v))}:function(k,D,w,v){return c(k,D,M(k,D,w,v))};return j(T,L,A);function M(J,k,D,w){return function(v,O){v&&(v.code==="EMFILE"||v.code==="ENFILE")?xi([j,[J,k,D],v,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof D=="function"&&D.call(this,v,O))}}}if(process.version.substr(0,4)==="v0.8"){var p=n8(t);C=p.ReadStream,g=p.WriteStream}var h=t.ReadStream;h&&(C.prototype=Object.create(h.prototype),C.prototype.open=E);var m=t.WriteStream;m&&(g.prototype=Object.create(m.prototype),g.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return C},set:function(T){C=T},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(T){g=T},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(T){b=T},enumerable:!0,configurable:!0});var y=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(T){y=T},enumerable:!0,configurable:!0});function C(T,L){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var T=this;B(T.path,T.flags,T.mode,function(L,A){L?(T.autoClose&&T.destroy(),T.emit("error",L)):(T.fd=A,T.emit("open",A),T.read())})}function g(T,L){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var T=this;B(T.path,T.flags,T.mode,function(L,A){L?(T.destroy(),T.emit("error",L)):(T.fd=A,T.emit("open",A))})}function x(T,L){return new t.ReadStream(T,L)}function $(T,L){return new t.WriteStream(T,L)}var F=t.open;t.open=B;function B(T,L,A,j){return typeof A=="function"&&(j=A,A=null),M(T,L,A,j);function M(J,k,D,w,v){return F(J,k,D,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?xi([M,[J,k,D,w],O,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function xi(t){yo("ENQUEUE",t[0].name,t[1]),Ke[mt].push(t),Xh()}var qc;function wC(){for(var t=Date.now(),e=0;e<Ke[mt].length;++e)Ke[mt][e].length>2&&(Ke[mt][e][3]=t,Ke[mt][e][4]=t);Xh()}function Xh(){if(clearTimeout(qc),qc=void 0,Ke[mt].length!==0){var t=Ke[mt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)yo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){yo("TIMEOUT",e.name,r);var a=r.pop();typeof a=="function"&&a.call(null,n)}else{var s=Date.now()-i,u=Math.max(i-o,1),c=Math.min(u*1.2,100);s>=c?(yo("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ke[mt].push(t)}qc===void 0&&(qc=setTimeout(Xh,0))}}});var EC=S((AK,CC)=>{function ur(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}CC.exports=ur;ur.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};ur.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};ur.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0};ur.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};ur.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};ur.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};ur.prototype.start=ur.prototype.try;ur.prototype.errors=function(){return this._errors};ur.prototype.attempts=function(){return this._attempts};ur.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e}});var _C=S(Do=>{var a8=EC();Do.operation=function(t){var e=Do.timeouts(t);return new a8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Do.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(i,a){return i-a}),n};Do.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};Do.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var o=0;o<r.length;o++){var i=r[o],a=t[i];t[i]=function(u){var c=Do.operation(e),l=Array.prototype.slice.call(arguments,1),d=l.pop();l.push(function(p){c.retry(p)||(p&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var xC=S((FK,SC)=>{SC.exports=_C()});var AC=S((kK,Vc)=>{Vc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Vc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Vc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var tm=S((PK,Fi)=>{var Ue=global.process,bo=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};bo(Ue)?(OC=require("assert"),Ai=AC(),FC=/^win/i.test(Ue.platform),cs=require("events"),typeof cs!="function"&&(cs=cs.EventEmitter),Ue.__signal_exit_emitter__?it=Ue.__signal_exit_emitter__:(it=Ue.__signal_exit_emitter__=new cs,it.count=0,it.emitted={}),it.infinite||(it.setMaxListeners(1/0),it.infinite=!0),Fi.exports=function(t,e){if(!bo(global.process))return function(){};OC.equal(typeof t,"function","a callback must be provided for exit handler"),Oi===!1&&Qh();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){it.removeListener(r,t),it.listeners("exit").length===0&&it.listeners("afterexit").length===0&&zc()};return it.on(r,t),n},zc=function(){!Oi||!bo(global.process)||(Oi=!1,Ai.forEach(function(e){try{Ue.removeListener(e,Kc[e])}catch{}}),Ue.emit=Gc,Ue.reallyExit=em,it.count-=1)},Fi.exports.unload=zc,wo=function(e,r,n){it.emitted[e]||(it.emitted[e]=!0,it.emit(e,r,n))},Kc={},Ai.forEach(function(t){Kc[t]=function(){if(bo(global.process)){var r=Ue.listeners(t);r.length===it.count&&(zc(),wo("exit",null,t),wo("afterexit",null,t),FC&&t==="SIGHUP"&&(t="SIGINT"),Ue.kill(Ue.pid,t))}}}),Fi.exports.signals=function(){return Ai},Oi=!1,Qh=function(){Oi||!bo(global.process)||(Oi=!0,it.count+=1,Ai=Ai.filter(function(e){try{return Ue.on(e,Kc[e]),!0}catch{return!1}}),Ue.emit=PC,Ue.reallyExit=kC)},Fi.exports.load=Qh,em=Ue.reallyExit,kC=function(e){bo(global.process)&&(Ue.exitCode=e||0,wo("exit",Ue.exitCode,null),wo("afterexit",Ue.exitCode,null),em.call(Ue,Ue.exitCode))},Gc=Ue.emit,PC=function(e,r){if(e==="exit"&&bo(global.process)){r!==void 0&&(Ue.exitCode=r);var n=Gc.apply(this,arguments);return wo("exit",Ue.exitCode,null),wo("afterexit",Ue.exitCode,null),n}else return Gc.apply(this,arguments)}):Fi.exports=function(){return function(){}};var OC,Ai,FC,cs,it,zc,wo,Kc,Oi,Qh,em,kC,Gc,PC});var IC=S(($K,rm)=>{"use strict";var $C=Symbol();function s8(t,e,r){let n=e[$C];if(n)return e.stat(t,(i,a)=>{if(i)return r(i);r(null,a.mtime,n)});let o=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,o,o,i=>{if(i)return r(i);e.stat(t,(a,s)=>{if(a)return r(a);let u=s.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,$C,{value:u}),r(null,s.mtime,u)})})}function u8(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}rm.exports.probe=s8;rm.exports.getMtime=u8});var LC=S((IK,fs)=>{"use strict";var c8=require("path"),im=kn(),l8=xC(),f8=tm(),TC=IC(),nn={};function ls(t,e){return e.lockfilePath||`${t}.lock`}function am(t,e,r){if(!e.realpath)return r(null,c8.resolve(t));e.fs.realpath(t,r)}function om(t,e,r){let n=ls(t,e);e.fs.mkdir(n,o=>{if(!o)return TC.probe(n,e.fs,(i,a,s)=>{if(i)return e.fs.rmdir(n,()=>{}),r(i);r(null,a,s)});if(o.code!=="EEXIST")return r(o);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(i,a)=>{if(i)return i.code==="ENOENT"?om(t,{...e,stale:0},r):r(i);if(!RC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));BC(t,e,s=>{if(s)return r(s);om(t,{...e,stale:0},r)})})})}function RC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function BC(t,e,r){e.fs.rmdir(ls(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Wc(t,e){let r=nn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,o)=>{let i=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||i?nm(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Wc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return nm(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=TC.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,s,s,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?nm(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Wc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Wc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function nm(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),nn[t]===e&&delete nn[t],e.options.onCompromised(r)}function d8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:im,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),am(t,e,(n,o)=>{if(n)return r(n);let i=l8.operation(e.retries);i.attempt(()=>{om(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=nn[o]={lockfilePath:ls(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Wc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));NC(o,{...e,realpath:!1},l)})})})})}function NC(t,e,r){e={fs:im,realpath:!0,...e},am(t,e,(n,o)=>{if(n)return r(n);let i=nn[o];if(!i)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete nn[o],BC(o,e,r)})}function p8(t,e,r){e={stale:1e4,realpath:!0,fs:im,...e},e.stale=Math.max(e.stale||0,2e3),am(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ls(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!RC(a,e)))})}function h8(){return nn}f8(()=>{for(let t in nn){let e=nn[t].options;try{e.fs.rmdirSync(ls(t,e))}catch{}}});fs.exports.lock=d8;fs.exports.unlock=NC;fs.exports.check=p8;fs.exports.getLocks=h8});var UC=S((TK,jC)=>{"use strict";var m8=kn();function g8(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...o)=>{let i=o.pop(),a;try{a=t[`${n}Sync`](...o)}catch(s){return i(s)}i(null,a)}}),r}function y8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function D8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function b8(t){if(t={...t},t.fs=g8(t.fs||m8),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}jC.exports={toPromise:y8,toSync:D8,toSyncOptions:b8}});var qC=S((RK,Pn)=>{"use strict";var ki=LC(),{toPromise:Yc,toSync:Jc,toSyncOptions:sm}=UC();async function MC(t,e){let r=await Yc(ki.lock)(t,e);return Yc(r)}function w8(t,e){let r=Jc(ki.lock)(t,sm(e));return Jc(r)}function v8(t,e){return Yc(ki.unlock)(t,e)}function C8(t,e){return Jc(ki.unlock)(t,sm(e))}function E8(t,e){return Yc(ki.check)(t,e)}function _8(t,e){return Jc(ki.check)(t,sm(e))}Pn.exports=MC;Pn.exports.lock=MC;Pn.exports.unlock=v8;Pn.exports.lockSync=w8;Pn.exports.unlockSync=C8;Pn.exports.check=E8;Pn.exports.checkSync=_8});var GC=S(Pi=>{"use strict";Object.defineProperty(Pi,"__esModule",{value:!0});Pi.canStoreURLs=Pi.FileUrlStorage=void 0;var HC=require("fs"),S8=A8(fC()),VC=x8(qC());function KC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(KC=function(n){return n?r:e})(t)}function x8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=KC(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function A8(t){return t&&t.__esModule?t:{default:t}}function ds(t){"@babel/helpers - typeof";return ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ds(t)}function O8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,k8(n.key),n)}}function F8(t,e,r){return e&&zC(t.prototype,e),r&&zC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function k8(t){var e=P8(t,"string");return ds(e)=="symbol"?e:e+""}function P8(t,e){if(ds(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ds(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var BK=Pi.canStoreURLs=!0,NK=Pi.FileUrlStorage=(function(){function t(e){O8(this,t),this.path=e}return F8(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,o){r._getItems("tus::",function(i,a){i?o(i):n(a)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(o,i){n._getItems("tus::".concat(r),function(a,s){a?i(a):o(s)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(o,i){n._removeItem(r,function(a){a?i(a):o()})})}},{key:"addUpload",value:function(r,n){var o=this,i=Math.round(Math.random()*1e12),a="tus::".concat(r,"::").concat(i);return new Promise(function(s,u){o._setItem(a,n,function(c){c?u(c):s(a)})})}},{key:"_setItem",value:function(r,n,o){var i=this;VC.lock(this.path,this._lockfileOptions()).then(function(a){o=i._releaseAndCb(a,o),i._getData(function(s,u){if(s){o(s);return}u[r]=n,i._writeData(u,function(c){return o(c)})})}).catch(o)}},{key:"_getItems",value:function(r,n){this._getData(function(o,i){if(o){n(o);return}var a=Object.keys(i).filter(function(s){return s.startsWith(r)}).map(function(s){var u=i[s];return u.urlStorageKey=s,u});n(null,a)})}},{key:"_removeItem",value:function(r,n){var o=this;VC.lock(this.path,this._lockfileOptions()).then(function(i){n=o._releaseAndCb(i,n),o._getData(function(a,s){if(a){n(a);return}delete s[r],o._writeData(s,function(u){return n(u)})})}).catch(n)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(r,n){return function(o){if(o){r().then(function(){return n(o)}).catch(function(i){return n((0,S8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,HC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,HC.readFile)(this.path,"utf8",function(n,o){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{o=o.trim().length?JSON.parse(o):{}}catch(i){r(i);return}r(null,o)})}}])})()});var Zc=S(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});Object.defineProperty(jt,"DefaultHttpStack",{enumerable:!0,get:function(){return XC.default}});Object.defineProperty(jt,"DetailedError",{enumerable:!0,get:function(){return $8.default}});Object.defineProperty(jt,"FileUrlStorage",{enumerable:!0,get:function(){return ZC.FileUrlStorage}});Object.defineProperty(jt,"StreamSource",{enumerable:!0,get:function(){return N8.default}});jt.Upload=void 0;Object.defineProperty(jt,"canStoreURLs",{enumerable:!0,get:function(){return ZC.canStoreURLs}});jt.defaultOptions=void 0;Object.defineProperty(jt,"enableDebugLog",{enumerable:!0,get:function(){return I8.enableDebugLog}});jt.isSupported=void 0;var $8=vo(nh()),I8=oh(),T8=vo(Gb()),um=vo(Ew()),R8=vo(Bw()),B8=vo(Uw()),XC=vo(ev()),N8=vo(Dh()),ZC=GC();function vo(t){return t&&t.__esModule?t:{default:t}}function Ii(t){"@babel/helpers - typeof";return Ii=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ii(t)}function L8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WC(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,eE(n.key),n)}}function j8(t,e,r){return e&&WC(t.prototype,e),r&&WC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function U8(t,e,r){return e=Xc(e),M8(t,QC()?Reflect.construct(e,r||[],Xc(t).constructor):e.apply(t,r))}function M8(t,e){if(e&&(Ii(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return q8(t)}function q8(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function QC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(QC=function(){return!!t})()}function Xc(t){return Xc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Xc(t)}function H8(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cm(t,e)}function cm(t,e){return cm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},cm(t,e)}function YC(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,n)}return r}function $i(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?YC(Object(r),!0).forEach(function(n){V8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):YC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function V8(t,e,r){return e=eE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eE(t){var e=z8(t,"string");return Ii(e)=="symbol"?e:e+""}function z8(t,e){if(Ii(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ii(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var JC=jt.defaultOptions=$i($i({},um.default.defaultOptions),{},{httpStack:new XC.default,fileReader:new R8.default,urlStorage:new T8.default,fingerprint:B8.default}),jK=jt.Upload=(function(t){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return L8(this,e),n=$i($i({},JC),n),U8(this,e,[r,n])}return H8(e,t),j8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=$i($i({},JC),o),um.default.terminate(n,o)}}])})(um.default),UK=jt.isSupported=!0});var iE=S((rG,oE)=>{var Ti=1e3,Ri=Ti*60,Bi=Ri*60,Co=Bi*24,eN=Co*7,tN=Co*365.25;oE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return rN(t);if(r==="number"&&isFinite(t))return e.long?oN(t):nN(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function rN(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*tN;case"weeks":case"week":case"w":return r*eN;case"days":case"day":case"d":return r*Co;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Bi;case"minutes":case"minute":case"mins":case"min":case"m":return r*Ri;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ti;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function nN(t){var e=Math.abs(t);return e>=Co?Math.round(t/Co)+"d":e>=Bi?Math.round(t/Bi)+"h":e>=Ri?Math.round(t/Ri)+"m":e>=Ti?Math.round(t/Ti)+"s":t+"ms"}function oN(t){var e=Math.abs(t);return e>=Co?el(t,e,Co,"day"):e>=Bi?el(t,e,Bi,"hour"):e>=Ri?el(t,e,Ri,"minute"):e>=Ti?el(t,e,Ti,"second"):t+" ms"}function el(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var dm=S((nG,aE)=>{function iN(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=iE(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let d=0;for(let p=0;p<l.length;p++)d=(d<<5)-d+l.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(l){let d,p=null,h,m;function b(...y){if(!b.enabled)return;let C=b,E=Number(new Date),g=E-(d||E);C.diff=g,C.prev=d,C.curr=E,d=E,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let _=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,($,F)=>{if($==="%%")return"%";_++;let B=r.formatters[F];if(typeof B=="function"){let T=y[_];$=B.call(C,T),y.splice(_,1),_--}return $}),r.formatArgs.call(C,y),(C.log||r.log).apply(C,y)}return b.namespace=l,b.useColors=r.useColors(),b.color=r.selectColor(l),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:y=>{p=y}}),typeof r.init=="function"&&r.init(b),b}function n(l,d){let p=r(this.namespace+(typeof d>"u"?":":d)+l);return p.log=this.log,p}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let d=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function i(l,d){let p=0,h=0,m=-1,b=0;for(;p<l.length;)if(h<d.length&&(d[h]===l[p]||d[h]==="*"))d[h]==="*"?(m=h,b=p,h++):(p++,h++);else if(m!==-1)h=m+1,b++,p=b;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function a(){let l=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),l}function s(l){for(let d of r.skips)if(i(l,d))return!1;for(let d of r.names)if(i(l,d))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}aE.exports=iN});var sE=S((Ut,tl)=>{Ut.formatArgs=sN;Ut.save=uN;Ut.load=cN;Ut.useColors=aN;Ut.storage=lN();Ut.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Ut.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function aN(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function sN(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+tl.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),t.splice(n,0,e)}Ut.log=console.debug||console.log||(()=>{});function uN(t){try{t?Ut.storage.setItem("debug",t):Ut.storage.removeItem("debug")}catch{}}function cN(){let t;try{t=Ut.storage.getItem("debug")||Ut.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function lN(){try{return localStorage}catch{}}tl.exports=dm()(Ut);var{formatters:fN}=tl.exports;fN.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var cE=S((oG,uE)=>{"use strict";uE.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),o=e.indexOf("--");return n!==-1&&(o===-1||n<o)}});var dE=S((iG,fE)=>{"use strict";var dN=require("os"),lE=require("tty"),fr=cE(),{env:st}=process,$n;fr("no-color")||fr("no-colors")||fr("color=false")||fr("color=never")?$n=0:(fr("color")||fr("colors")||fr("color=true")||fr("color=always"))&&($n=1);"FORCE_COLOR"in st&&(st.FORCE_COLOR==="true"?$n=1:st.FORCE_COLOR==="false"?$n=0:$n=st.FORCE_COLOR.length===0?1:Math.min(parseInt(st.FORCE_COLOR,10),3));function pm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function hm(t,e){if($n===0)return 0;if(fr("color=16m")||fr("color=full")||fr("color=truecolor"))return 3;if(fr("color=256"))return 2;if(t&&!e&&$n===void 0)return 0;let r=$n||0;if(st.TERM==="dumb")return r;if(process.platform==="win32"){let n=dN.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in st)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in st)||st.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in st)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(st.TEAMCITY_VERSION)?1:0;if(st.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in st){let n=parseInt((st.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(st.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(st.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(st.TERM)||"COLORTERM"in st?1:r}function pN(t){let e=hm(t,t&&t.isTTY);return pm(e)}fE.exports={supportsColor:pN,stdout:pm(hm(!0,lE.isatty(1))),stderr:pm(hm(!0,lE.isatty(2)))}});var hE=S((ut,nl)=>{var hN=require("tty"),rl=require("util");ut.init=vN;ut.log=DN;ut.formatArgs=gN;ut.save=bN;ut.load=wN;ut.useColors=mN;ut.destroy=rl.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ut.colors=[6,2,3,4,5,1];try{let t=dE();t&&(t.stderr||t).level>=2&&(ut.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ut.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),t[r]=n,t},{});function mN(){return"colors"in ut.inspectOpts?!!ut.inspectOpts.colors:hN.isatty(process.stderr.fd)}function gN(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
48
48
  `).join(`
49
- `+i),t.push(o+"m+"+tl.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=tN()+e+" "+t[0]}function tN(){return ut.inspectOpts.hideDate?"":new Date().toISOString()+" "}function rN(...t){return process.stderr.write(el.formatWithOptions(ut.inspectOpts,...t)+`
50
- `)}function nN(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function oN(){return process.env.DEBUG}function iN(t){t.inspectOpts={};let e=Object.keys(ut.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ut.inspectOpts[e[r]]}tl.exports=um()(ut);var{formatters:uC}=tl.exports;uC.o=function(t){return this.inspectOpts.colors=this.useColors,el.inspect(t,this.inspectOpts).split(`
51
- `).map(e=>e.trim()).join(" ")};uC.O=function(t){return this.inspectOpts.colors=this.useColors,el.inspect(t,this.inspectOpts)}});var dm=S((VK,fm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?fm.exports=rC():fm.exports=cC()});var ct=S(pm=>{"use strict";pm.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((o,i)=>o!=null?n(o):r(i)),t.apply(this,e)})},"name",{value:t.name})};pm.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var Pt=S(on=>{"use strict";var lC=ct().fromCallback,kt=On(),aN=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof kt[t]=="function");Object.assign(on,kt);aN.forEach(t=>{on[t]=lC(kt[t])});on.exists=function(t,e){return typeof e=="function"?kt.exists(t,e):new Promise(r=>kt.exists(t,r))};on.read=function(t,e,r,n,o,i){return typeof i=="function"?kt.read(t,e,r,n,o,i):new Promise((a,s)=>{kt.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};on.write=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.write(t,e,...r):new Promise((n,o)=>{kt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};on.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.readv(t,e,...r):new Promise((n,o)=>{kt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};on.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.writev(t,e,...r):new Promise((n,o)=>{kt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof kt.realpath.native=="function"?on.realpath.native=lC(kt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var dC=S((GK,fC)=>{"use strict";var sN=require("path");fC.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(sN.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var gC=S((WK,hm)=>{"use strict";var pC=Pt(),{checkPath:hC}=dC(),mC=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};hm.exports.makeDir=async(t,e)=>(hC(t),pC.mkdir(t,{mode:mC(e),recursive:!0}));hm.exports.makeDirSync=(t,e)=>(hC(t),pC.mkdirSync(t,{mode:mC(e),recursive:!0}))});var Sr=S((YK,DC)=>{"use strict";var uN=ct().fromPromise,{makeDir:cN,makeDirSync:mm}=gC(),gm=uN(cN);DC.exports={mkdirs:gm,mkdirsSync:mm,mkdirp:gm,mkdirpSync:mm,ensureDir:gm,ensureDirSync:mm}});var Pn=S((JK,bC)=>{"use strict";var lN=ct().fromPromise,yC=Pt();function fN(t){return yC.access(t).then(()=>!0).catch(()=>!1)}bC.exports={pathExists:lN(fN),pathExistsSync:yC.existsSync}});var Dm=S((XK,wC)=>{"use strict";var Ri=Pt(),dN=ct().fromPromise;async function pN(t,e,r){let n=await Ri.open(t,"r+"),o=null;try{await Ri.futimes(n,e,r)}finally{try{await Ri.close(n)}catch(i){o=i}}if(o)throw o}function hN(t,e,r){let n=Ri.openSync(t,"r+");return Ri.futimesSync(n,e,r),Ri.closeSync(n)}wC.exports={utimesMillis:dN(pN),utimesMillisSync:hN}});var _o=S((ZK,_C)=>{"use strict";var Bi=Pt(),lt=require("path"),vC=ct().fromPromise;function mN(t,e,r){let n=r.dereference?o=>Bi.stat(o,{bigint:!0}):o=>Bi.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function gN(t,e,r){let n,o=r.dereference?a=>Bi.statSync(a,{bigint:!0}):a=>Bi.lstatSync(a,{bigint:!0}),i=o(t);try{n=o(e)}catch(a){if(a.code==="ENOENT")return{srcStat:i,destStat:null};throw a}return{srcStat:i,destStat:n}}async function DN(t,e,r,n){let{srcStat:o,destStat:i}=await mN(t,e,n);if(i){if(fs(o,i)){let a=lt.basename(t),s=lt.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&ym(t,e))throw new Error(rl(t,e,r));return{srcStat:o,destStat:i}}function yN(t,e,r,n){let{srcStat:o,destStat:i}=gN(t,e,n);if(i){if(fs(o,i)){let a=lt.basename(t),s=lt.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&ym(t,e))throw new Error(rl(t,e,r));return{srcStat:o,destStat:i}}async function EC(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let a;try{a=await Bi.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(fs(e,a))throw new Error(rl(t,r,n));return EC(t,e,i,n)}function CC(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let a;try{a=Bi.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(fs(e,a))throw new Error(rl(t,r,n));return CC(t,e,i,n)}function fs(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function ym(t,e){let r=lt.resolve(t).split(lt.sep).filter(o=>o),n=lt.resolve(e).split(lt.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function rl(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}_C.exports={checkPaths:vC(DN),checkPathsSync:yN,checkParentPaths:vC(EC),checkParentPathsSync:CC,isSrcSubdir:ym,areIdentical:fs}});var xC=S((QK,SC)=>{"use strict";async function bN(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,o=>o??new Error("unknown error")));await Promise.all(r.map(n=>n.then(o=>{if(o!==null)throw o})))}SC.exports={asyncIteratorConcurrentProcess:bN}});var PC=S((eG,kC)=>{"use strict";var wt=Pt(),ds=require("path"),{mkdirs:wN}=Sr(),{pathExists:vN}=Pn(),{utimesMillis:EN}=Dm(),ps=_o(),{asyncIteratorConcurrentProcess:CN}=xC();async function _N(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
49
+ `+i),t.push(o+"m+"+nl.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=yN()+e+" "+t[0]}function yN(){return ut.inspectOpts.hideDate?"":new Date().toISOString()+" "}function DN(...t){return process.stderr.write(rl.formatWithOptions(ut.inspectOpts,...t)+`
50
+ `)}function bN(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function wN(){return process.env.DEBUG}function vN(t){t.inspectOpts={};let e=Object.keys(ut.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ut.inspectOpts[e[r]]}nl.exports=dm()(ut);var{formatters:pE}=nl.exports;pE.o=function(t){return this.inspectOpts.colors=this.useColors,rl.inspect(t,this.inspectOpts).split(`
51
+ `).map(e=>e.trim()).join(" ")};pE.O=function(t){return this.inspectOpts.colors=this.useColors,rl.inspect(t,this.inspectOpts)}});var gm=S((aG,mm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?mm.exports=sE():mm.exports=hE()});var ct=S(ym=>{"use strict";ym.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((o,i)=>o!=null?n(o):r(i)),t.apply(this,e)})},"name",{value:t.name})};ym.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var Pt=S(an=>{"use strict";var mE=ct().fromCallback,kt=kn(),CN=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof kt[t]=="function");Object.assign(an,kt);CN.forEach(t=>{an[t]=mE(kt[t])});an.exists=function(t,e){return typeof e=="function"?kt.exists(t,e):new Promise(r=>kt.exists(t,r))};an.read=function(t,e,r,n,o,i){return typeof i=="function"?kt.read(t,e,r,n,o,i):new Promise((a,s)=>{kt.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};an.write=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.write(t,e,...r):new Promise((n,o)=>{kt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};an.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.readv(t,e,...r):new Promise((n,o)=>{kt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};an.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?kt.writev(t,e,...r):new Promise((n,o)=>{kt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof kt.realpath.native=="function"?an.realpath.native=mE(kt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var yE=S((cG,gE)=>{"use strict";var EN=require("path");gE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(EN.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var vE=S((lG,Dm)=>{"use strict";var DE=Pt(),{checkPath:bE}=yE(),wE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Dm.exports.makeDir=async(t,e)=>(bE(t),DE.mkdir(t,{mode:wE(e),recursive:!0}));Dm.exports.makeDirSync=(t,e)=>(bE(t),DE.mkdirSync(t,{mode:wE(e),recursive:!0}))});var xr=S((fG,CE)=>{"use strict";var _N=ct().fromPromise,{makeDir:SN,makeDirSync:bm}=vE(),wm=_N(SN);CE.exports={mkdirs:wm,mkdirsSync:bm,mkdirp:wm,mkdirpSync:bm,ensureDir:wm,ensureDirSync:bm}});var In=S((dG,_E)=>{"use strict";var xN=ct().fromPromise,EE=Pt();function AN(t){return EE.access(t).then(()=>!0).catch(()=>!1)}_E.exports={pathExists:xN(AN),pathExistsSync:EE.existsSync}});var vm=S((pG,SE)=>{"use strict";var Ni=Pt(),ON=ct().fromPromise;async function FN(t,e,r){let n=await Ni.open(t,"r+"),o=null;try{await Ni.futimes(n,e,r)}finally{try{await Ni.close(n)}catch(i){o=i}}if(o)throw o}function kN(t,e,r){let n=Ni.openSync(t,"r+");return Ni.futimesSync(n,e,r),Ni.closeSync(n)}SE.exports={utimesMillis:ON(FN),utimesMillisSync:kN}});var Eo=S((hG,FE)=>{"use strict";var Li=Pt(),lt=require("path"),xE=ct().fromPromise;function PN(t,e,r){let n=r.dereference?o=>Li.stat(o,{bigint:!0}):o=>Li.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function $N(t,e,r){let n,o=r.dereference?a=>Li.statSync(a,{bigint:!0}):a=>Li.lstatSync(a,{bigint:!0}),i=o(t);try{n=o(e)}catch(a){if(a.code==="ENOENT")return{srcStat:i,destStat:null};throw a}return{srcStat:i,destStat:n}}async function IN(t,e,r,n){let{srcStat:o,destStat:i}=await PN(t,e,n);if(i){if(ps(o,i)){let a=lt.basename(t),s=lt.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&Cm(t,e))throw new Error(ol(t,e,r));return{srcStat:o,destStat:i}}function TN(t,e,r,n){let{srcStat:o,destStat:i}=$N(t,e,n);if(i){if(ps(o,i)){let a=lt.basename(t),s=lt.basename(e);if(r==="move"&&a!==s&&a.toLowerCase()===s.toLowerCase())return{srcStat:o,destStat:i,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(o.isDirectory()&&!i.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!o.isDirectory()&&i.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(o.isDirectory()&&Cm(t,e))throw new Error(ol(t,e,r));return{srcStat:o,destStat:i}}async function AE(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let a;try{a=await Li.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ps(e,a))throw new Error(ol(t,r,n));return AE(t,e,i,n)}function OE(t,e,r,n){let o=lt.resolve(lt.dirname(t)),i=lt.resolve(lt.dirname(r));if(i===o||i===lt.parse(i).root)return;let a;try{a=Li.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ps(e,a))throw new Error(ol(t,r,n));return OE(t,e,i,n)}function ps(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Cm(t,e){let r=lt.resolve(t).split(lt.sep).filter(o=>o),n=lt.resolve(e).split(lt.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function ol(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}FE.exports={checkPaths:xE(IN),checkPathsSync:TN,checkParentPaths:xE(AE),checkParentPathsSync:OE,isSrcSubdir:Cm,areIdentical:ps}});var PE=S((mG,kE)=>{"use strict";async function RN(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,o=>o??new Error("unknown error")));await Promise.all(r.map(n=>n.then(o=>{if(o!==null)throw o})))}kE.exports={asyncIteratorConcurrentProcess:RN}});var BE=S((gG,RE)=>{"use strict";var wt=Pt(),hs=require("path"),{mkdirs:BN}=xr(),{pathExists:NN}=In(),{utimesMillis:LN}=vm(),ms=Eo(),{asyncIteratorConcurrentProcess:jN}=PE();async function UN(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
52
52
 
53
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ps.checkPaths(t,e,"copy",r);if(await ps.checkParentPaths(t,n,e,"copy"),!await OC(t,e,r))return;let a=ds.dirname(e);await vN(a)||await wN(a),await FC(o,t,e,r)}async function OC(t,e,r){return r.filter?r.filter(t,e):!0}async function FC(t,e,r,n){let i=await(n.dereference?wt.stat:wt.lstat)(e);if(i.isDirectory())return ON(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return SN(i,t,e,r,n);if(i.isSymbolicLink())return FN(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function SN(t,e,r,n,o){if(!e)return AC(t,r,n,o);if(o.overwrite)return await wt.unlink(n),AC(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function AC(t,e,r,n){if(await wt.copyFile(e,r),n.preserveTimestamps){xN(t.mode)&&await AN(r,t.mode);let o=await wt.stat(e);await EN(r,o.atime,o.mtime)}return wt.chmod(r,t.mode)}function xN(t){return(t&128)===0}function AN(t,e){return wt.chmod(t,e|128)}async function ON(t,e,r,n,o){e||await wt.mkdir(n),await CN(await wt.opendir(r),async i=>{let a=ds.join(r,i.name),s=ds.join(n,i.name);if(await OC(a,s,o)){let{destStat:c}=await ps.checkPaths(a,s,"copy",o);await FC(c,a,s,o)}}),e||await wt.chmod(n,t.mode)}async function FN(t,e,r,n){let o=await wt.readlink(e);if(n.dereference&&(o=ds.resolve(process.cwd(),o)),!t)return wt.symlink(o,r);let i=null;try{i=await wt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return wt.symlink(o,r);throw a}if(n.dereference&&(i=ds.resolve(process.cwd(),i)),ps.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ps.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await wt.unlink(r),wt.symlink(o,r)}kC.exports=_N});var BC=S((tG,RC)=>{"use strict";var $t=On(),hs=require("path"),kN=Sr().mkdirsSync,PN=Dm().utimesMillisSync,ms=_o();function $N(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
53
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ms.checkPaths(t,e,"copy",r);if(await ms.checkParentPaths(t,n,e,"copy"),!await IE(t,e,r))return;let a=hs.dirname(e);await NN(a)||await BN(a),await TE(o,t,e,r)}async function IE(t,e,r){return r.filter?r.filter(t,e):!0}async function TE(t,e,r,n){let i=await(n.dereference?wt.stat:wt.lstat)(e);if(i.isDirectory())return VN(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return MN(i,t,e,r,n);if(i.isSymbolicLink())return zN(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function MN(t,e,r,n,o){if(!e)return $E(t,r,n,o);if(o.overwrite)return await wt.unlink(n),$E(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function $E(t,e,r,n){if(await wt.copyFile(e,r),n.preserveTimestamps){qN(t.mode)&&await HN(r,t.mode);let o=await wt.stat(e);await LN(r,o.atime,o.mtime)}return wt.chmod(r,t.mode)}function qN(t){return(t&128)===0}function HN(t,e){return wt.chmod(t,e|128)}async function VN(t,e,r,n,o){e||await wt.mkdir(n),await jN(await wt.opendir(r),async i=>{let a=hs.join(r,i.name),s=hs.join(n,i.name);if(await IE(a,s,o)){let{destStat:c}=await ms.checkPaths(a,s,"copy",o);await TE(c,a,s,o)}}),e||await wt.chmod(n,t.mode)}async function zN(t,e,r,n){let o=await wt.readlink(e);if(n.dereference&&(o=hs.resolve(process.cwd(),o)),!t)return wt.symlink(o,r);let i=null;try{i=await wt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return wt.symlink(o,r);throw a}if(n.dereference&&(i=hs.resolve(process.cwd(),i)),ms.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ms.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await wt.unlink(r),wt.symlink(o,r)}RE.exports=UN});var ME=S((yG,UE)=>{"use strict";var $t=kn(),gs=require("path"),KN=xr().mkdirsSync,GN=vm().utimesMillisSync,ys=Eo();function WN(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
54
54
 
55
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=ms.checkPathsSync(t,e,"copy",r);if(ms.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=hs.dirname(e);return $t.existsSync(i)||kN(i),$C(o,t,e,r)}function $C(t,e,r,n){let i=(n.dereference?$t.statSync:$t.lstatSync)(e);if(i.isDirectory())return jN(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return TN(i,t,e,r,n);if(i.isSymbolicLink())return qN(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function TN(t,e,r,n,o){return e?IN(t,r,n,o):TC(t,r,n,o)}function IN(t,e,r,n){if(n.overwrite)return $t.unlinkSync(r),TC(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function TC(t,e,r,n){return $t.copyFileSync(e,r),n.preserveTimestamps&&RN(t.mode,e,r),bm(r,t.mode)}function RN(t,e,r){return BN(t)&&NN(r,t),LN(e,r)}function BN(t){return(t&128)===0}function NN(t,e){return bm(t,e|128)}function bm(t,e){return $t.chmodSync(t,e)}function LN(t,e){let r=$t.statSync(t);return PN(e,r.atime,r.mtime)}function jN(t,e,r,n,o){return e?IC(r,n,o):UN(t.mode,r,n,o)}function UN(t,e,r,n){return $t.mkdirSync(r),IC(e,r,n),bm(r,t)}function IC(t,e,r){let n=$t.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)MN(o.name,t,e,r)}finally{n.closeSync()}}function MN(t,e,r,n){let o=hs.join(e,t),i=hs.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=ms.checkPathsSync(o,i,"copy",n);return $C(a,o,i,n)}function qN(t,e,r,n){let o=$t.readlinkSync(e);if(n.dereference&&(o=hs.resolve(process.cwd(),o)),t){let i;try{i=$t.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return $t.symlinkSync(o,r);throw a}if(n.dereference&&(i=hs.resolve(process.cwd(),i)),ms.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ms.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return HN(o,r)}else return $t.symlinkSync(o,r)}function HN(t,e){return $t.unlinkSync(e),$t.symlinkSync(t,e)}RC.exports=$N});var nl=S((rG,NC)=>{"use strict";var VN=ct().fromPromise;NC.exports={copy:VN(PC()),copySync:BC()}});var gs=S((nG,jC)=>{"use strict";var LC=On(),zN=ct().fromCallback;function KN(t,e){LC.rm(t,{recursive:!0,force:!0},e)}function GN(t){LC.rmSync(t,{recursive:!0,force:!0})}jC.exports={remove:zN(KN),removeSync:GN}});var GC=S((oG,KC)=>{"use strict";var WN=ct().fromPromise,qC=Pt(),HC=require("path"),VC=Sr(),zC=gs(),UC=WN(async function(e){let r;try{r=await qC.readdir(e)}catch{return VC.mkdirs(e)}return Promise.all(r.map(n=>zC.remove(HC.join(e,n))))});function MC(t){let e;try{e=qC.readdirSync(t)}catch{return VC.mkdirsSync(t)}e.forEach(r=>{r=HC.join(t,r),zC.removeSync(r)})}KC.exports={emptyDirSync:MC,emptydirSync:MC,emptyDir:UC,emptydir:UC}});var XC=S((iG,JC)=>{"use strict";var YN=ct().fromPromise,WC=require("path"),an=Pt(),YC=Sr();async function JN(t){let e;try{e=await an.stat(t)}catch{}if(e&&e.isFile())return;let r=WC.dirname(t),n=null;try{n=await an.stat(r)}catch(o){if(o.code==="ENOENT"){await YC.mkdirs(r),await an.writeFile(t,"");return}else throw o}n.isDirectory()?await an.writeFile(t,""):await an.readdir(r)}function XN(t){let e;try{e=an.statSync(t)}catch{}if(e&&e.isFile())return;let r=WC.dirname(t);try{an.statSync(r).isDirectory()||an.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")YC.mkdirsSync(r);else throw n}an.writeFileSync(t,"")}JC.exports={createFile:YN(JN),createFileSync:XN}});var r_=S((aG,t_)=>{"use strict";var ZN=ct().fromPromise,ZC=require("path"),$n=Pt(),QC=Sr(),{pathExists:QN}=Pn(),{areIdentical:e_}=_o();async function eL(t,e){let r;try{r=await $n.lstat(e)}catch{}let n;try{n=await $n.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&e_(n,r))return;let o=ZC.dirname(e);await QN(o)||await QC.mkdirs(o),await $n.link(t,e)}function tL(t,e){let r;try{r=$n.lstatSync(e)}catch{}try{let i=$n.lstatSync(t);if(r&&e_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=ZC.dirname(e);return $n.existsSync(n)||QC.mkdirsSync(n),$n.linkSync(t,e)}t_.exports={createLink:ZN(eL),createLinkSync:tL}});var o_=S((sG,n_)=>{"use strict";var Tn=require("path"),Ds=Pt(),{pathExists:rL}=Pn(),nL=ct().fromPromise;async function oL(t,e){if(Tn.isAbsolute(t)){try{await Ds.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Tn.dirname(e),n=Tn.join(r,t);if(await rL(n))return{toCwd:n,toDst:t};try{await Ds.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Tn.relative(r,t)}}function iL(t,e){if(Tn.isAbsolute(t)){if(!Ds.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Tn.dirname(e),n=Tn.join(r,t);if(Ds.existsSync(n))return{toCwd:n,toDst:t};if(!Ds.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Tn.relative(r,t)}}n_.exports={symlinkPaths:nL(oL),symlinkPathsSync:iL}});var s_=S((uG,a_)=>{"use strict";var i_=Pt(),aL=ct().fromPromise;async function sL(t,e){if(e)return e;let r;try{r=await i_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function uL(t,e){if(e)return e;let r;try{r=i_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}a_.exports={symlinkType:aL(sL),symlinkTypeSync:uL}});var f_=S((cG,l_)=>{"use strict";var cL=ct().fromPromise,u_=require("path"),Rr=Pt(),{mkdirs:lL,mkdirsSync:fL}=Sr(),{symlinkPaths:dL,symlinkPathsSync:pL}=o_(),{symlinkType:hL,symlinkTypeSync:mL}=s_(),{pathExists:gL}=Pn(),{areIdentical:c_}=_o();async function DL(t,e,r){let n;try{n=await Rr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Rr.stat(t),Rr.stat(e)]);if(c_(s,u))return}let o=await dL(t,e);t=o.toDst;let i=await hL(o.toCwd,r),a=u_.dirname(e);return await gL(a)||await lL(a),Rr.symlink(t,e,i)}function yL(t,e,r){let n;try{n=Rr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Rr.statSync(t),u=Rr.statSync(e);if(c_(s,u))return}let o=pL(t,e);t=o.toDst,r=mL(o.toCwd,r);let i=u_.dirname(e);return Rr.existsSync(i)||fL(i),Rr.symlinkSync(t,e,r)}l_.exports={createSymlink:cL(DL),createSymlinkSync:yL}});var b_=S((lG,y_)=>{"use strict";var{createFile:d_,createFileSync:p_}=XC(),{createLink:h_,createLinkSync:m_}=r_(),{createSymlink:g_,createSymlinkSync:D_}=f_();y_.exports={createFile:d_,createFileSync:p_,ensureFile:d_,ensureFileSync:p_,createLink:h_,createLinkSync:m_,ensureLink:h_,ensureLinkSync:m_,createSymlink:g_,createSymlinkSync:D_,ensureSymlink:g_,ensureSymlinkSync:D_}});var ol=S((fG,w_)=>{function bL(t,{EOL:e=`
56
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function wL(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}w_.exports={stringify:bL,stripBom:wL}});var __=S((dG,C_)=>{var Ni;try{Ni=On()}catch{Ni=require("fs")}var il=ct(),{stringify:v_,stripBom:E_}=ol();async function vL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ni,n="throws"in e?e.throws:!0,o=await il.fromCallback(r.readFile)(t,e);o=E_(o);let i;try{i=JSON.parse(o,e?e.reviver:null)}catch(a){if(n)throw a.message=`${t}: ${a.message}`,a;return null}return i}var EL=il.fromPromise(vL);function CL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ni,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=E_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function _L(t,e,r={}){let n=r.fs||Ni,o=v_(e,r);await il.fromCallback(n.writeFile)(t,o,r)}var SL=il.fromPromise(_L);function xL(t,e,r={}){let n=r.fs||Ni,o=v_(e,r);return n.writeFileSync(t,o,r)}C_.exports={readFile:EL,readFileSync:CL,writeFile:SL,writeFileSync:xL}});var x_=S((pG,S_)=>{"use strict";var al=__();S_.exports={readJson:al.readFile,readJsonSync:al.readFileSync,writeJson:al.writeFile,writeJsonSync:al.writeFileSync}});var sl=S((hG,F_)=>{"use strict";var AL=ct().fromPromise,wm=Pt(),A_=require("path"),O_=Sr(),OL=Pn().pathExists;async function FL(t,e,r="utf-8"){let n=A_.dirname(t);return await OL(n)||await O_.mkdirs(n),wm.writeFile(t,e,r)}function kL(t,...e){let r=A_.dirname(t);wm.existsSync(r)||O_.mkdirsSync(r),wm.writeFileSync(t,...e)}F_.exports={outputFile:AL(FL),outputFileSync:kL}});var P_=S((mG,k_)=>{"use strict";var{stringify:PL}=ol(),{outputFile:$L}=sl();async function TL(t,e,r={}){let n=PL(e,r);await $L(t,n,r)}k_.exports=TL});var T_=S((gG,$_)=>{"use strict";var{stringify:IL}=ol(),{outputFileSync:RL}=sl();function BL(t,e,r){let n=IL(e,r);RL(t,n,r)}$_.exports=BL});var R_=S((DG,I_)=>{"use strict";var NL=ct().fromPromise,Tt=x_();Tt.outputJson=NL(P_());Tt.outputJsonSync=T_();Tt.outputJSON=Tt.outputJson;Tt.outputJSONSync=Tt.outputJsonSync;Tt.writeJSON=Tt.writeJson;Tt.writeJSONSync=Tt.writeJsonSync;Tt.readJSON=Tt.readJson;Tt.readJSONSync=Tt.readJsonSync;I_.exports=Tt});var U_=S((yG,j_)=>{"use strict";var LL=Pt(),B_=require("path"),{copy:jL}=nl(),{remove:L_}=gs(),{mkdirp:UL}=Sr(),{pathExists:ML}=Pn(),N_=_o();async function qL(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await N_.checkPaths(t,e,"move",r);await N_.checkParentPaths(t,o,e,"move");let a=B_.dirname(e);return B_.parse(a).root!==a&&await UL(a),HL(t,e,n,i)}async function HL(t,e,r,n){if(!n){if(r)await L_(e);else if(await ML(e))throw new Error("dest already exists.")}try{await LL.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await VL(t,e,r)}}async function VL(t,e,r){return await jL(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),L_(t)}j_.exports=qL});var z_=S((bG,V_)=>{"use strict";var q_=On(),Em=require("path"),zL=nl().copySync,H_=gs().removeSync,KL=Sr().mkdirpSync,M_=_o();function GL(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=M_.checkPathsSync(t,e,"move",r);return M_.checkParentPathsSync(t,o,e,"move"),WL(e)||KL(Em.dirname(e)),YL(t,e,n,i)}function WL(t){let e=Em.dirname(t);return Em.parse(e).root===e}function YL(t,e,r,n){if(n)return vm(t,e,r);if(r)return H_(e),vm(t,e,r);if(q_.existsSync(e))throw new Error("dest already exists.");return vm(t,e,r)}function vm(t,e,r){try{q_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return JL(t,e,r)}}function JL(t,e,r){return zL(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),H_(t)}V_.exports=GL});var G_=S((wG,K_)=>{"use strict";var XL=ct().fromPromise;K_.exports={move:XL(U_()),moveSync:z_()}});var Li=S((vG,W_)=>{"use strict";W_.exports={...Pt(),...nl(),...GC(),...b_(),...R_(),...Sr(),...G_(),...sl(),...Pn(),...gs()}});var tS=S((EG,eS)=>{"use strict";var Cm,J_,X_,Z_,Q_=!0;typeof process<"u"&&({FORCE_COLOR:Cm,NODE_DISABLE_COLORS:J_,NO_COLOR:X_,TERM:Z_}=process.env||{},Q_=process.stdout&&process.stdout.isTTY);var xe={enabled:!J_&&X_==null&&Z_!=="dumb"&&(Cm!=null&&Cm!=="0"||Q_),reset:Be(0,0),bold:Be(1,22),dim:Be(2,22),italic:Be(3,23),underline:Be(4,24),inverse:Be(7,27),hidden:Be(8,28),strikethrough:Be(9,29),black:Be(30,39),red:Be(31,39),green:Be(32,39),yellow:Be(33,39),blue:Be(34,39),magenta:Be(35,39),cyan:Be(36,39),white:Be(37,39),gray:Be(90,39),grey:Be(90,39),bgBlack:Be(40,49),bgRed:Be(41,49),bgGreen:Be(42,49),bgYellow:Be(43,49),bgBlue:Be(44,49),bgMagenta:Be(45,49),bgCyan:Be(46,49),bgWhite:Be(47,49)};function Y_(t,e){let r=0,n,o="",i="";for(;r<t.length;r++)n=t[r],o+=n.open,i+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+i}function ZL(t,e){let r={has:t,keys:e};return r.reset=xe.reset.bind(r),r.bold=xe.bold.bind(r),r.dim=xe.dim.bind(r),r.italic=xe.italic.bind(r),r.underline=xe.underline.bind(r),r.inverse=xe.inverse.bind(r),r.hidden=xe.hidden.bind(r),r.strikethrough=xe.strikethrough.bind(r),r.black=xe.black.bind(r),r.red=xe.red.bind(r),r.green=xe.green.bind(r),r.yellow=xe.yellow.bind(r),r.blue=xe.blue.bind(r),r.magenta=xe.magenta.bind(r),r.cyan=xe.cyan.bind(r),r.white=xe.white.bind(r),r.gray=xe.gray.bind(r),r.grey=xe.grey.bind(r),r.bgBlack=xe.bgBlack.bind(r),r.bgRed=xe.bgRed.bind(r),r.bgGreen=xe.bgGreen.bind(r),r.bgYellow=xe.bgYellow.bind(r),r.bgBlue=xe.bgBlue.bind(r),r.bgMagenta=xe.bgMagenta.bind(r),r.bgCyan=xe.bgCyan.bind(r),r.bgWhite=xe.bgWhite.bind(r),r}function Be(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:xe.enabled?Y_(this.keys,n+""):n+""):n===void 0?ZL([t],[r]):xe.enabled?Y_([r],n+""):n+""}}eS.exports=xe});var ji=S(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ancillary=Ze.failure=Ze.success=Ze.input=Ze.weak=Ze.strong=void 0;var QL=(he(),oe(pe)),Br=QL.__importDefault(tS());Ze.strong=Br.default.bold;Ze.weak=Br.default.dim;Ze.input=Br.default.cyan;Ze.success=Br.default.green;Ze.failure=Br.default.red;Ze.ancillary=Br.default.cyan;var ej={strong:Ze.strong,weak:Ze.weak,input:Ze.input,success:Ze.success,failure:Ze.failure,ancillary:Ze.ancillary,log:{DEBUG:Br.default.magenta,INFO:Br.default.cyan,WARN:Br.default.yellow,ERROR:Br.default.red}};Ze.default=ej});var _m=S(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.EscapeCode=void 0;var xr="\x1B[",ft=class{};ul.EscapeCode=ft;ft.cursorLeft=()=>`${xr}G`;ft.cursorUp=(t=1)=>`${xr}${t}A`;ft.cursorDown=(t=1)=>`${xr}${t}B`;ft.cursorForward=(t=1)=>`${xr}${t}C`;ft.cursorBackward=(t=1)=>`${xr}${t}D`;ft.cursorHide=()=>`${xr}?25l`;ft.cursorShow=()=>`${xr}?25h`;ft.eraseLine=()=>`${xr}2K`;ft.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=ft.eraseLine(),r<t-1&&(e+=ft.cursorUp());return`${e}${ft.cursorLeft()}`};ft.eraseUp=()=>`${xr}1J`;ft.eraseDown=()=>`${xr}J`;ft.eraseScreen=()=>`${xr}2J`});var nS=S(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.Cursor=void 0;var tj=(he(),oe(pe)),rj=tj.__importDefault(Xh()),rS=_m(),Ui=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(rS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,rj.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(rS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};cl.Cursor=Ui;Ui.stream=process.stderr;Ui._isVisible=!0;Ui._listenerAttached=!1});var xm=S((xG,Sm)=>{"use strict";var oS=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);Sm.exports=oS;Sm.exports.default=oS});var sS=S((AG,aS)=>{"use strict";var iS="[\uD800-\uDBFF][\uDC00-\uDFFF]",nj=t=>t&&t.exact?new RegExp(`^${iS}$`):new RegExp(iS,"g");aS.exports=nj});var cS=S((OG,uS)=>{"use strict";uS.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Am=S((FG,fS)=>{var ys=cS(),lS={};for(let t of Object.keys(ys))lS[ys[t]]=t;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};fS.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};Q.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),d=function(p){return(c-p)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=d(a),r=d(s),n=d(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};Q.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function oj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=lS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(ys)){let i=ys[o],a=oj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return ys[t]};Q.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};Q.rgb.lab=function(t){let e=Q.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};Q.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};Q.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};Q.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};Q.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};Q.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,l,d;switch(a){default:case 6:case 0:c=s,l=u,d=r;break;case 1:c=u,l=s,d=r;break;case 2:c=r,l=s,d=u;break;case 3:c=r,l=u,d=s;break;case 4:c=u,l=r,d=s;break;case 5:c=s,l=r,d=u;break}return[c*255,l*255,d*255]};Q.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};Q.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};Q.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};Q.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};Q.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};Q.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};Q.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};Q.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};Q.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};Q.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};Q.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};Q.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};Q.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};Q.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};Q.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};Q.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};Q.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var pS=S((kG,dS)=>{var ll=Am();function ij(){let t={},e=Object.keys(ll);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function aj(t){let e=ij(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(ll[n]);for(let i=o.length,a=0;a<i;a++){let s=o[a],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(s))}}return e}function sj(t,e){return function(r){return e(t(r))}}function uj(t,e){let r=[e[t].parent,t],n=ll[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=sj(ll[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}dS.exports=function(t){let e=aj(t),r={},n=Object.keys(e);for(let o=n.length,i=0;i<o;i++){let a=n[i];e[a].parent!==null&&(r[a]=uj(a,e))}return r}});var mS=S((PG,hS)=>{var Om=Am(),cj=pS(),Mi={},lj=Object.keys(Om);function fj(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function dj(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let o=t(r);if(typeof o=="object")for(let i=o.length,a=0;a<i;a++)o[a]=Math.round(o[a]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}lj.forEach(t=>{Mi[t]={},Object.defineProperty(Mi[t],"channels",{value:Om[t].channels}),Object.defineProperty(Mi[t],"labels",{value:Om[t].labels});let e=cj(t);Object.keys(e).forEach(n=>{let o=e[n];Mi[t][n]=dj(o),Mi[t][n].raw=fj(o)})});hS.exports=Mi});var km=S(($G,wS)=>{"use strict";var gS=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,DS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},yS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},fl=t=>t,bS=(t,e,r)=>[t,e,r],qi=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},Fm,Hi=(t,e,r,n)=>{Fm===void 0&&(Fm=mS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Fm)){let u=a==="ansi16"?"ansi":a;a===e?i[u]=t(r,o):typeof s=="object"&&(i[u]=t(s[e],o))}return i};function pj(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",qi(e.color,"ansi",()=>Hi(gS,"ansi16",fl,!1)),qi(e.color,"ansi256",()=>Hi(DS,"ansi256",fl,!1)),qi(e.color,"ansi16m",()=>Hi(yS,"rgb",bS,!1)),qi(e.bgColor,"ansi",()=>Hi(gS,"ansi16",fl,!0)),qi(e.bgColor,"ansi256",()=>Hi(DS,"ansi256",fl,!0)),qi(e.bgColor,"ansi16m",()=>Hi(yS,"rgb",bS,!0)),e}Object.defineProperty(wS,"exports",{enumerable:!0,get:pj})});var SS=S((TG,_S)=>{"use strict";var hj=xm(),mj=sS(),vS=km(),CS=["\x1B","\x9B"],dl=t=>`${CS[0]}[${t}m`,ES=(t,e,r)=>{let n=[];t=[...t];for(let o of t){let i=o;o.includes(";")&&(o=o.split(";")[0][0]+"0");let a=vS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(dl(e?a:i)):t.splice(s,1)}else if(e){n.push(dl(0));break}else n.push(dl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=dl(vS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};_S.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,d]of n.entries()){let p=!1;if(CS.includes(d)){let h=/\d[^m]*/.exec(t.slice(l,l+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,p=!0);if(!a&&!p&&u++,!mj({exact:!0}).test(d)&&hj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=ES(o);else if(u>=i){c+=ES(o,!0,s);break}}return c}});var AS=S((IG,xS)=>{"use strict";xS.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var pl=S((RG,OS)=>{"use strict";var gj=AS();OS.exports=t=>typeof t=="string"?t.replace(gj(),""):t});var kS=S((BG,FS)=>{"use strict";FS.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var $m=S((NG,Pm)=>{"use strict";var Dj=pl(),yj=xm(),bj=kS(),PS=t=>{if(typeof t!="string"||t.length===0||(t=Dj(t),t.length===0))return 0;t=t.replace(bj()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=yj(n)?2:1)}return e};Pm.exports=PS;Pm.exports.default=PS});var NS=S((LG,BS)=>{"use strict";var bs=$m(),wj=pl(),vj=km(),hl=new Set(["\x1B","\x9B"]),Ej=39,Im="\x07",IS="[",Cj="]",RS="m",Rm=`${Cj}8;;`,$S=t=>`${hl.values().next().value}${IS}${t}${RS}`,TS=t=>`${hl.values().next().value}${Rm}${t}${Im}`,_j=t=>t.split(" ").map(e=>bs(e)),Tm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=bs(wj(t[t.length-1]));for(let[s,u]of n.entries()){let c=bs(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),hl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Rm)),o){i?u===Im&&(o=!1,i=!1):u===RS&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Sj=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(bs(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},xj=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=_j(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=bs(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Tm(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Tm(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Tm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(Sj));let u=[...s.join(`
57
- `)];for(let[c,l]of u.entries()){if(n+=l,hl.has(l)){let{groups:p}=new RegExp(`(?:\\${IS}(?<code>\\d+)m|\\${Rm}(?<uri>.*)${Im})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===Ej?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=vj.codes.get(Number(o));u[c+1]===`
58
- `?(i&&(n+=TS("")),o&&d&&(n+=$S(d))):l===`
59
- `&&(o&&d&&(n+=$S(o)),i&&(n+=TS(i)))}return n};BS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
55
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=ys.checkPathsSync(t,e,"copy",r);if(ys.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=gs.dirname(e);return $t.existsSync(i)||KN(i),NE(o,t,e,r)}function NE(t,e,r,n){let i=(n.dereference?$t.statSync:$t.lstatSync)(e);if(i.isDirectory())return tL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return YN(i,t,e,r,n);if(i.isSymbolicLink())return oL(t,e,r,n);throw i.isSocket()?new Error(`Cannot copy a socket file: ${e}`):i.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function YN(t,e,r,n,o){return e?JN(t,r,n,o):LE(t,r,n,o)}function JN(t,e,r,n){if(n.overwrite)return $t.unlinkSync(r),LE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function LE(t,e,r,n){return $t.copyFileSync(e,r),n.preserveTimestamps&&XN(t.mode,e,r),Em(r,t.mode)}function XN(t,e,r){return ZN(t)&&QN(r,t),eL(e,r)}function ZN(t){return(t&128)===0}function QN(t,e){return Em(t,e|128)}function Em(t,e){return $t.chmodSync(t,e)}function eL(t,e){let r=$t.statSync(t);return GN(e,r.atime,r.mtime)}function tL(t,e,r,n,o){return e?jE(r,n,o):rL(t.mode,r,n,o)}function rL(t,e,r,n){return $t.mkdirSync(r),jE(e,r,n),Em(r,t)}function jE(t,e,r){let n=$t.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)nL(o.name,t,e,r)}finally{n.closeSync()}}function nL(t,e,r,n){let o=gs.join(e,t),i=gs.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=ys.checkPathsSync(o,i,"copy",n);return NE(a,o,i,n)}function oL(t,e,r,n){let o=$t.readlinkSync(e);if(n.dereference&&(o=gs.resolve(process.cwd(),o)),t){let i;try{i=$t.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return $t.symlinkSync(o,r);throw a}if(n.dereference&&(i=gs.resolve(process.cwd(),i)),ys.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ys.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return iL(o,r)}else return $t.symlinkSync(o,r)}function iL(t,e){return $t.unlinkSync(e),$t.symlinkSync(t,e)}UE.exports=WN});var il=S((DG,qE)=>{"use strict";var aL=ct().fromPromise;qE.exports={copy:aL(BE()),copySync:ME()}});var Ds=S((bG,VE)=>{"use strict";var HE=kn(),sL=ct().fromCallback;function uL(t,e){HE.rm(t,{recursive:!0,force:!0},e)}function cL(t){HE.rmSync(t,{recursive:!0,force:!0})}VE.exports={remove:sL(uL),removeSync:cL}});var ZE=S((wG,XE)=>{"use strict";var lL=ct().fromPromise,GE=Pt(),WE=require("path"),YE=xr(),JE=Ds(),zE=lL(async function(e){let r;try{r=await GE.readdir(e)}catch{return YE.mkdirs(e)}return Promise.all(r.map(n=>JE.remove(WE.join(e,n))))});function KE(t){let e;try{e=GE.readdirSync(t)}catch{return YE.mkdirsSync(t)}e.forEach(r=>{r=WE.join(t,r),JE.removeSync(r)})}XE.exports={emptyDirSync:KE,emptydirSync:KE,emptyDir:zE,emptydir:zE}});var r_=S((vG,t_)=>{"use strict";var fL=ct().fromPromise,QE=require("path"),sn=Pt(),e_=xr();async function dL(t){let e;try{e=await sn.stat(t)}catch{}if(e&&e.isFile())return;let r=QE.dirname(t),n=null;try{n=await sn.stat(r)}catch(o){if(o.code==="ENOENT"){await e_.mkdirs(r),await sn.writeFile(t,"");return}else throw o}n.isDirectory()?await sn.writeFile(t,""):await sn.readdir(r)}function pL(t){let e;try{e=sn.statSync(t)}catch{}if(e&&e.isFile())return;let r=QE.dirname(t);try{sn.statSync(r).isDirectory()||sn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")e_.mkdirsSync(r);else throw n}sn.writeFileSync(t,"")}t_.exports={createFile:fL(dL),createFileSync:pL}});var s_=S((CG,a_)=>{"use strict";var hL=ct().fromPromise,n_=require("path"),Tn=Pt(),o_=xr(),{pathExists:mL}=In(),{areIdentical:i_}=Eo();async function gL(t,e){let r;try{r=await Tn.lstat(e)}catch{}let n;try{n=await Tn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&i_(n,r))return;let o=n_.dirname(e);await mL(o)||await o_.mkdirs(o),await Tn.link(t,e)}function yL(t,e){let r;try{r=Tn.lstatSync(e)}catch{}try{let i=Tn.lstatSync(t);if(r&&i_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=n_.dirname(e);return Tn.existsSync(n)||o_.mkdirsSync(n),Tn.linkSync(t,e)}a_.exports={createLink:hL(gL),createLinkSync:yL}});var c_=S((EG,u_)=>{"use strict";var Rn=require("path"),bs=Pt(),{pathExists:DL}=In(),bL=ct().fromPromise;async function wL(t,e){if(Rn.isAbsolute(t)){try{await bs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Rn.dirname(e),n=Rn.join(r,t);if(await DL(n))return{toCwd:n,toDst:t};try{await bs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Rn.relative(r,t)}}function vL(t,e){if(Rn.isAbsolute(t)){if(!bs.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Rn.dirname(e),n=Rn.join(r,t);if(bs.existsSync(n))return{toCwd:n,toDst:t};if(!bs.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Rn.relative(r,t)}}u_.exports={symlinkPaths:bL(wL),symlinkPathsSync:vL}});var d_=S((_G,f_)=>{"use strict";var l_=Pt(),CL=ct().fromPromise;async function EL(t,e){if(e)return e;let r;try{r=await l_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function _L(t,e){if(e)return e;let r;try{r=l_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}f_.exports={symlinkType:CL(EL),symlinkTypeSync:_L}});var g_=S((SG,m_)=>{"use strict";var SL=ct().fromPromise,p_=require("path"),Br=Pt(),{mkdirs:xL,mkdirsSync:AL}=xr(),{symlinkPaths:OL,symlinkPathsSync:FL}=c_(),{symlinkType:kL,symlinkTypeSync:PL}=d_(),{pathExists:$L}=In(),{areIdentical:h_}=Eo();async function IL(t,e,r){let n;try{n=await Br.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Br.stat(t),Br.stat(e)]);if(h_(s,u))return}let o=await OL(t,e);t=o.toDst;let i=await kL(o.toCwd,r),a=p_.dirname(e);return await $L(a)||await xL(a),Br.symlink(t,e,i)}function TL(t,e,r){let n;try{n=Br.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Br.statSync(t),u=Br.statSync(e);if(h_(s,u))return}let o=FL(t,e);t=o.toDst,r=PL(o.toCwd,r);let i=p_.dirname(e);return Br.existsSync(i)||AL(i),Br.symlinkSync(t,e,r)}m_.exports={createSymlink:SL(IL),createSymlinkSync:TL}});var __=S((xG,E_)=>{"use strict";var{createFile:y_,createFileSync:D_}=r_(),{createLink:b_,createLinkSync:w_}=s_(),{createSymlink:v_,createSymlinkSync:C_}=g_();E_.exports={createFile:y_,createFileSync:D_,ensureFile:y_,ensureFileSync:D_,createLink:b_,createLinkSync:w_,ensureLink:b_,ensureLinkSync:w_,createSymlink:v_,createSymlinkSync:C_,ensureSymlink:v_,ensureSymlinkSync:C_}});var al=S((AG,S_)=>{function RL(t,{EOL:e=`
56
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function BL(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}S_.exports={stringify:RL,stripBom:BL}});var F_=S((OG,O_)=>{var ji;try{ji=kn()}catch{ji=require("fs")}var sl=ct(),{stringify:x_,stripBom:A_}=al();async function NL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||ji,n="throws"in e?e.throws:!0,o=await sl.fromCallback(r.readFile)(t,e);o=A_(o);let i;try{i=JSON.parse(o,e?e.reviver:null)}catch(a){if(n)throw a.message=`${t}: ${a.message}`,a;return null}return i}var LL=sl.fromPromise(NL);function jL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||ji,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=A_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function UL(t,e,r={}){let n=r.fs||ji,o=x_(e,r);await sl.fromCallback(n.writeFile)(t,o,r)}var ML=sl.fromPromise(UL);function qL(t,e,r={}){let n=r.fs||ji,o=x_(e,r);return n.writeFileSync(t,o,r)}O_.exports={readFile:LL,readFileSync:jL,writeFile:ML,writeFileSync:qL}});var P_=S((FG,k_)=>{"use strict";var ul=F_();k_.exports={readJson:ul.readFile,readJsonSync:ul.readFileSync,writeJson:ul.writeFile,writeJsonSync:ul.writeFileSync}});var cl=S((kG,T_)=>{"use strict";var HL=ct().fromPromise,_m=Pt(),$_=require("path"),I_=xr(),VL=In().pathExists;async function zL(t,e,r="utf-8"){let n=$_.dirname(t);return await VL(n)||await I_.mkdirs(n),_m.writeFile(t,e,r)}function KL(t,...e){let r=$_.dirname(t);_m.existsSync(r)||I_.mkdirsSync(r),_m.writeFileSync(t,...e)}T_.exports={outputFile:HL(zL),outputFileSync:KL}});var B_=S((PG,R_)=>{"use strict";var{stringify:GL}=al(),{outputFile:WL}=cl();async function YL(t,e,r={}){let n=GL(e,r);await WL(t,n,r)}R_.exports=YL});var L_=S(($G,N_)=>{"use strict";var{stringify:JL}=al(),{outputFileSync:XL}=cl();function ZL(t,e,r){let n=JL(e,r);XL(t,n,r)}N_.exports=ZL});var U_=S((IG,j_)=>{"use strict";var QL=ct().fromPromise,It=P_();It.outputJson=QL(B_());It.outputJsonSync=L_();It.outputJSON=It.outputJson;It.outputJSONSync=It.outputJsonSync;It.writeJSON=It.writeJson;It.writeJSONSync=It.writeJsonSync;It.readJSON=It.readJson;It.readJSONSync=It.readJsonSync;j_.exports=It});var z_=S((TG,V_)=>{"use strict";var ej=Pt(),M_=require("path"),{copy:tj}=il(),{remove:H_}=Ds(),{mkdirp:rj}=xr(),{pathExists:nj}=In(),q_=Eo();async function oj(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await q_.checkPaths(t,e,"move",r);await q_.checkParentPaths(t,o,e,"move");let a=M_.dirname(e);return M_.parse(a).root!==a&&await rj(a),ij(t,e,n,i)}async function ij(t,e,r,n){if(!n){if(r)await H_(e);else if(await nj(e))throw new Error("dest already exists.")}try{await ej.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await aj(t,e,r)}}async function aj(t,e,r){return await tj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),H_(t)}V_.exports=oj});var J_=S((RG,Y_)=>{"use strict";var G_=kn(),xm=require("path"),sj=il().copySync,W_=Ds().removeSync,uj=xr().mkdirpSync,K_=Eo();function cj(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=K_.checkPathsSync(t,e,"move",r);return K_.checkParentPathsSync(t,o,e,"move"),lj(e)||uj(xm.dirname(e)),fj(t,e,n,i)}function lj(t){let e=xm.dirname(t);return xm.parse(e).root===e}function fj(t,e,r,n){if(n)return Sm(t,e,r);if(r)return W_(e),Sm(t,e,r);if(G_.existsSync(e))throw new Error("dest already exists.");return Sm(t,e,r)}function Sm(t,e,r){try{G_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return dj(t,e,r)}}function dj(t,e,r){return sj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),W_(t)}Y_.exports=cj});var Z_=S((BG,X_)=>{"use strict";var pj=ct().fromPromise;X_.exports={move:pj(z_()),moveSync:J_()}});var Ui=S((NG,Q_)=>{"use strict";Q_.exports={...Pt(),...il(),...ZE(),...__(),...U_(),...xr(),...Z_(),...cl(),...In(),...Ds()}});var aS=S((LG,iS)=>{"use strict";var Am,tS,rS,nS,oS=!0;typeof process<"u"&&({FORCE_COLOR:Am,NODE_DISABLE_COLORS:tS,NO_COLOR:rS,TERM:nS}=process.env||{},oS=process.stdout&&process.stdout.isTTY);var xe={enabled:!tS&&rS==null&&nS!=="dumb"&&(Am!=null&&Am!=="0"||oS),reset:Be(0,0),bold:Be(1,22),dim:Be(2,22),italic:Be(3,23),underline:Be(4,24),inverse:Be(7,27),hidden:Be(8,28),strikethrough:Be(9,29),black:Be(30,39),red:Be(31,39),green:Be(32,39),yellow:Be(33,39),blue:Be(34,39),magenta:Be(35,39),cyan:Be(36,39),white:Be(37,39),gray:Be(90,39),grey:Be(90,39),bgBlack:Be(40,49),bgRed:Be(41,49),bgGreen:Be(42,49),bgYellow:Be(43,49),bgBlue:Be(44,49),bgMagenta:Be(45,49),bgCyan:Be(46,49),bgWhite:Be(47,49)};function eS(t,e){let r=0,n,o="",i="";for(;r<t.length;r++)n=t[r],o+=n.open,i+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return o+e+i}function hj(t,e){let r={has:t,keys:e};return r.reset=xe.reset.bind(r),r.bold=xe.bold.bind(r),r.dim=xe.dim.bind(r),r.italic=xe.italic.bind(r),r.underline=xe.underline.bind(r),r.inverse=xe.inverse.bind(r),r.hidden=xe.hidden.bind(r),r.strikethrough=xe.strikethrough.bind(r),r.black=xe.black.bind(r),r.red=xe.red.bind(r),r.green=xe.green.bind(r),r.yellow=xe.yellow.bind(r),r.blue=xe.blue.bind(r),r.magenta=xe.magenta.bind(r),r.cyan=xe.cyan.bind(r),r.white=xe.white.bind(r),r.gray=xe.gray.bind(r),r.grey=xe.grey.bind(r),r.bgBlack=xe.bgBlack.bind(r),r.bgRed=xe.bgRed.bind(r),r.bgGreen=xe.bgGreen.bind(r),r.bgYellow=xe.bgYellow.bind(r),r.bgBlue=xe.bgBlue.bind(r),r.bgMagenta=xe.bgMagenta.bind(r),r.bgCyan=xe.bgCyan.bind(r),r.bgWhite=xe.bgWhite.bind(r),r}function Be(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:xe.enabled?eS(this.keys,n+""):n+""):n===void 0?hj([t],[r]):xe.enabled?eS([r],n+""):n+""}}iS.exports=xe});var Mi=S(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.ancillary=Qe.failure=Qe.success=Qe.input=Qe.weak=Qe.strong=void 0;var mj=(he(),oe(pe)),Nr=mj.__importDefault(aS());Qe.strong=Nr.default.bold;Qe.weak=Nr.default.dim;Qe.input=Nr.default.cyan;Qe.success=Nr.default.green;Qe.failure=Nr.default.red;Qe.ancillary=Nr.default.cyan;var gj={strong:Qe.strong,weak:Qe.weak,input:Qe.input,success:Qe.success,failure:Qe.failure,ancillary:Qe.ancillary,log:{DEBUG:Nr.default.magenta,INFO:Nr.default.cyan,WARN:Nr.default.yellow,ERROR:Nr.default.red}};Qe.default=gj});var Om=S(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:!0});ll.EscapeCode=void 0;var Ar="\x1B[",ft=class{};ll.EscapeCode=ft;ft.cursorLeft=()=>`${Ar}G`;ft.cursorUp=(t=1)=>`${Ar}${t}A`;ft.cursorDown=(t=1)=>`${Ar}${t}B`;ft.cursorForward=(t=1)=>`${Ar}${t}C`;ft.cursorBackward=(t=1)=>`${Ar}${t}D`;ft.cursorHide=()=>`${Ar}?25l`;ft.cursorShow=()=>`${Ar}?25h`;ft.eraseLine=()=>`${Ar}2K`;ft.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=ft.eraseLine(),r<t-1&&(e+=ft.cursorUp());return`${e}${ft.cursorLeft()}`};ft.eraseUp=()=>`${Ar}1J`;ft.eraseDown=()=>`${Ar}J`;ft.eraseScreen=()=>`${Ar}2J`});var uS=S(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.Cursor=void 0;var yj=(he(),oe(pe)),Dj=yj.__importDefault(tm()),sS=Om(),qi=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(sS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,Dj.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(sS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};fl.Cursor=qi;qi.stream=process.stderr;qi._isVisible=!0;qi._listenerAttached=!1});var km=S((qG,Fm)=>{"use strict";var cS=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);Fm.exports=cS;Fm.exports.default=cS});var dS=S((HG,fS)=>{"use strict";var lS="[\uD800-\uDBFF][\uDC00-\uDFFF]",bj=t=>t&&t.exact?new RegExp(`^${lS}$`):new RegExp(lS,"g");fS.exports=bj});var hS=S((VG,pS)=>{"use strict";pS.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Pm=S((zG,gS)=>{var ws=hS(),mS={};for(let t of Object.keys(ws))mS[ws[t]]=t;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};gS.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};Q.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),l=c-Math.min(a,s,u),d=function(p){return(c-p)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=d(a),r=d(s),n=d(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};Q.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function wj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=mS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(ws)){let i=ws[o],a=wj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return ws[t]};Q.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};Q.rgb.lab=function(t){let e=Q.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};Q.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};Q.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};Q.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};Q.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};Q.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,l,d;switch(a){default:case 6:case 0:c=s,l=u,d=r;break;case 1:c=u,l=s,d=r;break;case 2:c=r,l=s,d=u;break;case 3:c=r,l=u,d=s;break;case 4:c=u,l=r,d=s;break;case 5:c=s,l=r,d=u;break}return[c*255,l*255,d*255]};Q.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};Q.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};Q.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};Q.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};Q.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};Q.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};Q.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};Q.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};Q.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};Q.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};Q.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};Q.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};Q.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};Q.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};Q.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};Q.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};Q.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var DS=S((KG,yS)=>{var dl=Pm();function vj(){let t={},e=Object.keys(dl);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function Cj(t){let e=vj(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(dl[n]);for(let i=o.length,a=0;a<i;a++){let s=o[a],u=e[s];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(s))}}return e}function Ej(t,e){return function(r){return e(t(r))}}function _j(t,e){let r=[e[t].parent,t],n=dl[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=Ej(dl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}yS.exports=function(t){let e=Cj(t),r={},n=Object.keys(e);for(let o=n.length,i=0;i<o;i++){let a=n[i];e[a].parent!==null&&(r[a]=_j(a,e))}return r}});var wS=S((GG,bS)=>{var $m=Pm(),Sj=DS(),Hi={},xj=Object.keys($m);function Aj(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function Oj(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let o=t(r);if(typeof o=="object")for(let i=o.length,a=0;a<i;a++)o[a]=Math.round(o[a]);return o};return"conversion"in t&&(e.conversion=t.conversion),e}xj.forEach(t=>{Hi[t]={},Object.defineProperty(Hi[t],"channels",{value:$m[t].channels}),Object.defineProperty(Hi[t],"labels",{value:$m[t].labels});let e=Sj(t);Object.keys(e).forEach(n=>{let o=e[n];Hi[t][n]=Oj(o),Hi[t][n].raw=Aj(o)})});bS.exports=Hi});var Tm=S((WG,SS)=>{"use strict";var vS=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,CS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},ES=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},pl=t=>t,_S=(t,e,r)=>[t,e,r],Vi=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},Im,zi=(t,e,r,n)=>{Im===void 0&&(Im=wS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Im)){let u=a==="ansi16"?"ansi":a;a===e?i[u]=t(r,o):typeof s=="object"&&(i[u]=t(s[e],o))}return i};function Fj(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[o,i]of Object.entries(n))e[o]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},n[o]=e[o],t.set(i[0],i[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",Vi(e.color,"ansi",()=>zi(vS,"ansi16",pl,!1)),Vi(e.color,"ansi256",()=>zi(CS,"ansi256",pl,!1)),Vi(e.color,"ansi16m",()=>zi(ES,"rgb",_S,!1)),Vi(e.bgColor,"ansi",()=>zi(vS,"ansi16",pl,!0)),Vi(e.bgColor,"ansi256",()=>zi(CS,"ansi256",pl,!0)),Vi(e.bgColor,"ansi16m",()=>zi(ES,"rgb",_S,!0)),e}Object.defineProperty(SS,"exports",{enumerable:!0,get:Fj})});var kS=S((YG,FS)=>{"use strict";var kj=km(),Pj=dS(),xS=Tm(),OS=["\x1B","\x9B"],hl=t=>`${OS[0]}[${t}m`,AS=(t,e,r)=>{let n=[];t=[...t];for(let o of t){let i=o;o.includes(";")&&(o=o.split(";")[0][0]+"0");let a=xS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(hl(e?a:i)):t.splice(s,1)}else if(e){n.push(hl(0));break}else n.push(hl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=hl(xS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};FS.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,d]of n.entries()){let p=!1;if(OS.includes(d)){let h=/\d[^m]*/.exec(t.slice(l,l+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,p=!0);if(!a&&!p&&u++,!Pj({exact:!0}).test(d)&&kj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=AS(o);else if(u>=i){c+=AS(o,!0,s);break}}return c}});var $S=S((JG,PS)=>{"use strict";PS.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var ml=S((XG,IS)=>{"use strict";var $j=$S();IS.exports=t=>typeof t=="string"?t.replace($j(),""):t});var RS=S((ZG,TS)=>{"use strict";TS.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var Bm=S((QG,Rm)=>{"use strict";var Ij=ml(),Tj=km(),Rj=RS(),BS=t=>{if(typeof t!="string"||t.length===0||(t=Ij(t),t.length===0))return 0;t=t.replace(Rj()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=Tj(n)?2:1)}return e};Rm.exports=BS;Rm.exports.default=BS});var qS=S((eW,MS)=>{"use strict";var vs=Bm(),Bj=ml(),Nj=Tm(),gl=new Set(["\x1B","\x9B"]),Lj=39,Lm="\x07",jS="[",jj="]",US="m",jm=`${jj}8;;`,NS=t=>`${gl.values().next().value}${jS}${t}${US}`,LS=t=>`${gl.values().next().value}${jm}${t}${Lm}`,Uj=t=>t.split(" ").map(e=>vs(e)),Nm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=vs(Bj(t[t.length-1]));for(let[s,u]of n.entries()){let c=vs(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),gl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(jm)),o){i?u===Lm&&(o=!1,i=!1):u===US&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},Mj=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(vs(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},qj=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=Uj(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=vs(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Nm(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Nm(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Nm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(Mj));let u=[...s.join(`
57
+ `)];for(let[c,l]of u.entries()){if(n+=l,gl.has(l)){let{groups:p}=new RegExp(`(?:\\${jS}(?<code>\\d+)m|\\${jm}(?<uri>.*)${Lm})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===Lj?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=Nj.codes.get(Number(o));u[c+1]===`
58
+ `?(i&&(n+=LS("")),o&&d&&(n+=NS(d))):l===`
59
+ `&&(o&&d&&(n+=NS(o)),i&&(n+=LS(i)))}return n};MS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
60
60
  `).split(`
61
- `).map(n=>xj(n,e,r)).join(`
62
- `)});var US=S((jG,jS)=>{"use strict";var Aj=require("os"),LS=Aj.homedir();jS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return LS?t.replace(/^~(?=$|\/|\\)/,LS):t}});var KS=S(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.columnar=Ge.generateFillSpaceStringList=Ge.expandPath=Ge.prettyPath=Ge.wordWrap=Ge.indent=Ge.TTY_WIDTH=Ge.stripAnsi=Ge.stringWidth=Ge.sliceAnsi=void 0;var MS=(he(),oe(pe)),Oj=MS.__importStar(require("os")),sn=MS.__importStar(require("path")),qS=SS();Ge.sliceAnsi=qS;var ml=$m();Ge.stringWidth=ml;var Fj=pl();Ge.stripAnsi=Fj;var kj=NS(),Pj=US(),$j=80,Tj=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max($j,Math.min(process.stdout.columns,Tj)):1/0;function HS(t=4){return" ".repeat(t)}Ge.indent=HS;function Ij(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return kj(t,e-r-n.length,{trim:!0}).split(`
61
+ `).map(n=>qj(n,e,r)).join(`
62
+ `)});var zS=S((tW,VS)=>{"use strict";var Hj=require("os"),HS=Hj.homedir();VS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return HS?t.replace(/^~(?=$|\/|\\)/,HS):t}});var XS=S(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.columnar=Ge.generateFillSpaceStringList=Ge.expandPath=Ge.prettyPath=Ge.wordWrap=Ge.indent=Ge.TTY_WIDTH=Ge.stripAnsi=Ge.stringWidth=Ge.sliceAnsi=void 0;var KS=(he(),oe(pe)),Vj=KS.__importStar(require("os")),un=KS.__importStar(require("path")),GS=kS();Ge.sliceAnsi=GS;var yl=Bm();Ge.stringWidth=yl;var zj=ml();Ge.stripAnsi=zj;var Kj=qS(),Gj=zS(),Wj=80,Yj=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max(Wj,Math.min(process.stdout.columns,Yj)):1/0;function WS(t=4){return" ".repeat(t)}Ge.indent=WS;function Jj(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return Kj(t,e-r-n.length,{trim:!0}).split(`
63
63
  `).join(`${n}
64
- ${HS(r)}`)}Ge.wordWrap=Ij;function Rj(t){t=VS(t);let e=process.cwd(),r=sn.dirname(t),n=Oj.homedir(),o=Math.abs(r.split(sn.sep).length-e.split(sn.sep).length);if(e===r)return"."+sn.sep+sn.basename(t);if(r.startsWith(e))return"."+sn.sep+t.substring(e.length+1);if(o<=2){let i=sn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+sn.sep+t.substring(n.length+1)}return t}Ge.prettyPath=Rj;function VS(t){return sn.resolve(Pj(t))}Ge.expandPath=VS;function zS(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>ml(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>qS(i,0,o-ml(a)))}Ge.generateFillSpaceStringList=zS;function Bj(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,a=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let d=0,p=l.map(h=>{let m=h.split(`
65
- `);return d=Math.max(d,m.length),m});for(let h in l)a[h]&&a[h].push(...p[h],...Array(d-p[h].length).fill(""))}let s=a.map((l,d)=>{if(d<i-1){let p=zS(l);return l.map((h,m)=>`${h}${p[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,d)=>l.map((p,h)=>{let m=l[h]+d[h];return u=Math.max(u,ml(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
- `)}Ge.columnar=Bj});var GS=S(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.TERMINAL_INFO=fr.CI_ENVIRONMENT_VARIABLES_DETECTED=fr.CI_ENVIRONMENT_VARIABLES=void 0;var Nj=(he(),oe(pe)),Lj=dm(),jj=Nj.__importStar(require("os")),Uj=(0,Lj.debug)("ionic:utils-terminal:info");fr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];fr.CI_ENVIRONMENT_VARIABLES_DETECTED=fr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function Mj(){let{shell:t}=jj.userInfo();return t||(process.env.SHELL?process.env.SHELL:process.platform==="darwin"?"/bin/bash":process.platform==="win32"?process.env.COMSPEC?process.env.COMSPEC:"cmd.exe":"/bin/sh")}fr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&Uj(`Environment variables for CI detected: ${fr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);fr.TERMINAL_INFO=Object.freeze({ci:fr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:Mj(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var Bm=S(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});var gl=(he(),oe(pe));gl.__exportStar(_m(),Vi);gl.__exportStar(nS(),Vi);gl.__exportStar(KS(),Vi);gl.__exportStar(GS(),Vi)});var yl=S(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.isFatal=Nr.fatal=Nr.FatalException=Nr.BaseException=void 0;var Dl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Nr.BaseException=Dl;var ws=class extends Dl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Nr.FatalException=ws;function qj(t){throw new ws(t)}Nr.fatal=qj;function Hj(t){return t&&t instanceof ws}Nr.isFatal=Hj});var jm={};Wr(jm,{LOGGER_LEVELS:()=>Xj,Logger:()=>Lm,NO_COLORS:()=>WS,StreamOutputStrategy:()=>bl,TTYOutputStrategy:()=>Nm,TTY_WIDTH:()=>Vj,createDefaultLogger:()=>Jj,indent:()=>zj,sliceAnsi:()=>Kj,stringWidth:()=>Gj,stripAnsi:()=>Wj,wordWrap:()=>Yj});var Vj,zj,Kj,Gj,Wj,Yj,Jj,WS,bl,Nm,Lm,Xj,Um=rt(()=>{Vj=80,zj=t=>t,Kj=t=>t,Gj=t=>t.length,Wj=t=>t,Yj=t=>t,Jj=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),WS={},bl=class{constructor(){this.colors=WS,this.stream=process.stdout}},Nm=class extends bl{constructor(e){super(),this.options=e}},Lm=class{constructor(){}info(){}warn(){}error(){}debug(){}},Xj={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var JS=S(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.isInteractive=So.checkInteractive=void 0;var Zj=(he(),oe(pe)),YS=Bm(),Qj=Zj.__importDefault(ji()),e4=vs(),t4=(...t)=>(0,So.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(e4.logger.error(`Non-interactive shell detected.
67
- Run the command with ${Qj.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;So.checkInteractive=t4;var r4=()=>YS.TERMINAL_INFO.tty&&!YS.TERMINAL_INFO.ci;So.isInteractive=r4});var wl={};Wr(wl,{default:()=>XS});function XS(){throw new Error("Prompts are not supported in this CLI build")}var vl=rt(()=>{});var vs=S(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.logSuccess=Mt.logPrompt=Mt.logger=Mt.output=void 0;var Mm=(he(),oe(pe)),xo=(Um(),oe(jm)),Ao=Mm.__importDefault(ji()),n4=JS(),ZS={colors:Ao.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Mt.output=(0,n4.isInteractive)()?new xo.TTYOutputStrategy(ZS):new xo.StreamOutputStrategy(ZS);Mt.logger=(0,xo.createDefaultLogger)({output:Mt.output,formatterOptions:{titleize:!1,tags:new Map([[xo.LOGGER_LEVELS.DEBUG,Ao.default.log.DEBUG("[debug]")],[xo.LOGGER_LEVELS.INFO,Ao.default.log.INFO("[info]")],[xo.LOGGER_LEVELS.WARN,Ao.default.log.WARN("[warn]")],[xo.LOGGER_LEVELS.ERROR,Ao.default.log.ERROR("[error]")]])}});async function o4(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Mm.__importStar((Um(),oe(jm)))),{prompt:n}=await Promise.resolve().then(()=>Mm.__importStar((vl(),oe(wl))));return Mt.logger.log({msg:`${Ao.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Mt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Mt.logPrompt=o4;function i4(t){Mt.logger.msg(`${Ao.default.success("[success]")} ${t}`)}Mt.logSuccess=i4});var El=S(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.resolveNode=zi.requireTS=void 0;var a4=require("fs"),s4=Li(),u4=require("path"),c4=(t,e)=>{let r=(0,u4.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,s4.readFileSync)(i,"utf8");i.endsWith(".ts")?s=t.transpileModule(s,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:s=s.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(a=o._compile)===null||a===void 0||a.call(o,s,i)};let n=require(r);return delete require.extensions[".ts"],n};zi.requireTS=c4;function l4(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,a4.existsSync)(n)?n:null}}zi.resolveNode=l4});var QS={};Wr(QS,{default:()=>f4});var f4,ex=rt(()=>{f4={}});var tx=S(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.buildXmlElement=Lr.writeXML=Lr.parseXML=Lr.readXML=void 0;var d4=(he(),oe(pe)),p4=Li(),Es=d4.__importDefault((ex(),oe(QS)));async function h4(t){var e;try{let r=await(0,p4.readFile)(t,{encoding:"utf-8"});try{return await Es.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Lr.readXML=h4;function m4(t,e){let r=e!==void 0?new Es.default.Parser({...e}):new Es.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Lr.parseXML=m4;async function g4(t){return new Promise(e=>{let n=new Es.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Lr.writeXML=g4;function D4(t,e){return new Es.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Lr.buildXmlElement=D4});var ax=S(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getAllElements=Fe.getFilePath=Fe.getAssets=Fe.getJSModules=Fe.getPluginType=Fe.getPlatformElement=Fe.getPluginPlatform=Fe.printPlugins=Fe.fixName=Fe.getDependencies=Fe.resolvePlugin=Fe.getPlugins=Fe.getIncludedPluginPackages=void 0;var y4=(he(),oe(pe)),b4=Li(),qm=require("path"),Ki=y4.__importDefault(ji()),w4=yl(),v4=vs(),rx=El(),E4=tx();function nx(t,e){var r,n,o,i;let{extConfig:a}=t.app;switch(e){case"android":return(n=(r=a.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:a.includePlugins;case"ios":return(i=(o=a.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:a.includePlugins}}Fe.getIncludedPluginPackages=nx;async function C4(t,e){var r;let n=(r=nx(t,e))!==null&&r!==void 0?r:ix(t);return(await Promise.all(n.map(async i=>ox(t,i)))).filter(i=>!!i)}Fe.getPlugins=C4;async function ox(t,e){try{let r=(0,rx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,w4.fatal)(`Unable to find ${Ki.default.strong(`node_modules/${e}`)}.
68
- Are you sure ${Ki.default.strong(e)} is installed?`);let n=(0,qm.dirname)(r),o=await(0,b4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Hm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,qm.join)(n,"plugin.xml"),a=await(0,E4.readXML)(i);return{id:e,name:Hm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Fe.resolvePlugin=ox;function ix(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Fe.getDependencies=ix;function Hm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Fe.fixName=Hm;function _4(t,e,r="capacitor"){if(t.length===0)return;let n,o=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${o} for ${Ki.default.strong(e)}:
69
- `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Ki.default.strong(e)}, skipped install:
70
- `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Ki.default.strong(e)}:
71
- `;break}n+=t.map(i=>`${i.id}${Ki.default.weak(`@${i.version}`)}`).join(`
72
- `),v4.logger.info(n)}Fe.printPlugins=_4;function Vm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Fe.getPluginPlatform=Vm;function S4(t,e,r){let n=Vm(t,e);if(n){let o=n[r];if(o)return o}return[]}Fe.getPlatformElement=S4;function x4(t,e){var r,n,o,i;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(i=(o=t.android)===null||o===void 0?void 0:o.type)!==null&&i!==void 0?i:0}return 0}Fe.getPluginType=x4;function A4(t,e){return zm(t,e,"js-module")}Fe.getJSModules=A4;function O4(t,e){return zm(t,e,"asset")}Fe.getAssets=O4;function F4(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let o=(0,rx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,qm.join)(e.rootPath,r)}Fe.getFilePath=F4;function zm(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Vm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Fe.getAllElements=zm});var sx={};Wr(sx,{default:()=>k4});var k4,ux=rt(()=>{k4={}});var Cl=S(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.isInstalled=In.getCommandOutput=In.runCommand=void 0;var Km=(ux(),oe(sx));async function cx(t,e,r={}){let n=new Km.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Km.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}In.runCommand=cx;async function P4(t,e,r={}){try{return(await cx(t,e,r)).trim()}catch{return null}}In.getCommandOutput=P4;async function $4(t){try{await(0,Km.which)(t)}catch{return!1}return!0}In.isInstalled=$4});var lx={};Wr(lx,{Comparator:()=>aU,Range:()=>oU,SemVer:()=>iU,clean:()=>B4,coerce:()=>nU,compare:()=>M4,diff:()=>T4,eq:()=>z4,gt:()=>H4,gte:()=>G4,gtr:()=>eU,inc:()=>N4,intersects:()=>rU,lt:()=>V4,lte:()=>W4,ltr:()=>tU,major:()=>L4,maxSatisfying:()=>J4,minSatisfying:()=>X4,minor:()=>j4,neq:()=>K4,outside:()=>Q4,parse:()=>I4,patch:()=>U4,rcompare:()=>q4,satisfies:()=>Y4,valid:()=>R4,validRange:()=>Z4});var T4,I4,R4,B4,N4,L4,j4,U4,M4,q4,H4,V4,z4,K4,G4,W4,Y4,J4,X4,Z4,Q4,eU,tU,rU,nU,oU,iU,aU,fx=rt(()=>{T4=()=>null,I4=()=>null,R4=()=>null,B4=()=>null,N4=()=>null,L4=()=>null,j4=()=>null,U4=()=>null,M4=()=>0,q4=()=>0,H4=()=>!1,V4=()=>!1,z4=()=>!1,K4=()=>!0,G4=()=>!1,W4=()=>!1,Y4=()=>!1,J4=()=>null,X4=()=>null,Z4=()=>null,Q4=()=>!1,eU=()=>!1,tU=()=>!1,rU=()=>!1,nU=()=>null,oU=class{},iU=class{},aU=class{}});var Cx=S(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.parseApkNameFromFlavor=X.checkJDKMajorVersion=X.resolvePlatform=X.checkPlatformVersions=X.getAddedPlatforms=X.getPlatformTargetName=X.promptForPlatformTarget=X.promptForPlatform=X.isValidEnterprisePlatform=X.getKnownEnterprisePlatforms=X.isValidCommunityPlatform=X.getKnownCommunityPlatforms=X.isValidPlatform=X.getKnownPlatforms=X.selectPlatforms=X.getProjectPlatformDirectory=X.getCLIVersion=X.getCoreVersion=X.getCapacitorPackageVersion=X.requireCapacitorPackage=X.getCapacitorPackage=X.runTask=X.runPlatformHook=X.runHooks=X.wait=X.checkAppName=X.checkAppId=X.checkAppDir=X.checkAppConfig=X.checkCapacitorPlatform=X.checkPackage=X.checkWebDir=X.check=void 0;var _s=(he(),oe(pe)),dx=Bm(),Rn=Li(),Oo=require("path"),ke=_s.__importDefault(ji()),Gi=yl(),hx=vs(),sU=ax(),px=lu(),Cs=El(),uU=Cl();async function cU(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
- `)}X.check=cU;async function lU(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,Rn.pathExists)(t.app.webDirAbs)?await(0,Rn.pathExists)((0,Oo.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${ke.default.strong((0,dx.prettyPath)(t.app.webDirAbs))}) must contain an ${ke.default.strong("index.html")} file.
74
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${ke.default.strong((0,dx.prettyPath)(t.app.webDirAbs))}.
75
- Please create it and make sure it has an ${ke.default.strong("index.html")} file. You can change the path of this directory in ${ke.default.strong(t.app.extConfigName)} (${ke.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${ke.default.input("npm run build")}). More info: ${ke.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}X.checkWebDir=lU;async function fU(){return await(0,Rn.pathExists)("package.json")||await(0,Rn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
64
+ ${WS(r)}`)}Ge.wordWrap=Jj;function Xj(t){t=YS(t);let e=process.cwd(),r=un.dirname(t),n=Vj.homedir(),o=Math.abs(r.split(un.sep).length-e.split(un.sep).length);if(e===r)return"."+un.sep+un.basename(t);if(r.startsWith(e))return"."+un.sep+t.substring(e.length+1);if(o<=2){let i=un.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+un.sep+t.substring(n.length+1)}return t}Ge.prettyPath=Xj;function YS(t){return un.resolve(Gj(t))}Ge.expandPath=YS;function JS(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>yl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>GS(i,0,o-yl(a)))}Ge.generateFillSpaceStringList=JS;function Zj(t,{hsep:e="-",vsep:r="|",headers:n}){let o=!!n;if(!t[0])return"";let i=n?n.length:t[0].length,a=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let d=0,p=l.map(h=>{let m=h.split(`
65
+ `);return d=Math.max(d,m.length),m});for(let h in l)a[h]&&a[h].push(...p[h],...Array(d-p[h].length).fill(""))}let s=a.map((l,d)=>{if(d<i-1){let p=JS(l);return l.map((h,m)=>`${h}${p[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,d)=>l.map((p,h)=>{let m=l[h]+d[h];return u=Math.max(u,yl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
+ `)}Ge.columnar=Zj});var ZS=S(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.TERMINAL_INFO=dr.CI_ENVIRONMENT_VARIABLES_DETECTED=dr.CI_ENVIRONMENT_VARIABLES=void 0;var Qj=(he(),oe(pe)),e4=gm(),t4=Qj.__importStar(require("os")),r4=(0,e4.debug)("ionic:utils-terminal:info");dr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];dr.CI_ENVIRONMENT_VARIABLES_DETECTED=dr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function n4(){let{shell:t}=t4.userInfo();return t||(process.env.SHELL?process.env.SHELL:process.platform==="darwin"?"/bin/bash":process.platform==="win32"?process.env.COMSPEC?process.env.COMSPEC:"cmd.exe":"/bin/sh")}dr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&r4(`Environment variables for CI detected: ${dr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);dr.TERMINAL_INFO=Object.freeze({ci:dr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:n4(),tty:!!(process.stdin.isTTY&&process.stdout.isTTY&&process.stderr.isTTY),windows:process.platform==="win32"||!!(process.env.OSTYPE&&/^(msys|cygwin)$/.test(process.env.OSTYPE)||process.env.MSYSTEM&&/^MINGW(32|64)$/.test(process.env.MSYSTEM))})});var Um=S(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var Dl=(he(),oe(pe));Dl.__exportStar(Om(),Ki);Dl.__exportStar(uS(),Ki);Dl.__exportStar(XS(),Ki);Dl.__exportStar(ZS(),Ki)});var wl=S(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.isFatal=Lr.fatal=Lr.FatalException=Lr.BaseException=void 0;var bl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Lr.BaseException=bl;var Cs=class extends bl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Lr.FatalException=Cs;function o4(t){throw new Cs(t)}Lr.fatal=o4;function i4(t){return t&&t instanceof Cs}Lr.isFatal=i4});var Hm={};Yr(Hm,{LOGGER_LEVELS:()=>p4,Logger:()=>qm,NO_COLORS:()=>QS,StreamOutputStrategy:()=>vl,TTYOutputStrategy:()=>Mm,TTY_WIDTH:()=>a4,createDefaultLogger:()=>d4,indent:()=>s4,sliceAnsi:()=>u4,stringWidth:()=>c4,stripAnsi:()=>l4,wordWrap:()=>f4});var a4,s4,u4,c4,l4,f4,d4,QS,vl,Mm,qm,p4,Vm=Xe(()=>{a4=80,s4=t=>t,u4=t=>t,c4=t=>t.length,l4=t=>t,f4=t=>t,d4=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),QS={},vl=class{constructor(){this.colors=QS,this.stream=process.stdout}},Mm=class extends vl{constructor(e){super(),this.options=e}},qm=class{constructor(){}info(){}warn(){}error(){}debug(){}},p4={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var tx=S(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.isInteractive=_o.checkInteractive=void 0;var h4=(he(),oe(pe)),ex=Um(),m4=h4.__importDefault(Mi()),g4=Es(),y4=(...t)=>(0,_o.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(g4.logger.error(`Non-interactive shell detected.
67
+ Run the command with ${m4.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;_o.checkInteractive=y4;var D4=()=>ex.TERMINAL_INFO.tty&&!ex.TERMINAL_INFO.ci;_o.isInteractive=D4});var Cl={};Yr(Cl,{default:()=>rx});function rx(){throw new Error("Prompts are not supported in this CLI build")}var El=Xe(()=>{});var Es=S(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.logSuccess=Mt.logPrompt=Mt.logger=Mt.output=void 0;var zm=(he(),oe(pe)),So=(Vm(),oe(Hm)),xo=zm.__importDefault(Mi()),b4=tx(),nx={colors:xo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Mt.output=(0,b4.isInteractive)()?new So.TTYOutputStrategy(nx):new So.StreamOutputStrategy(nx);Mt.logger=(0,So.createDefaultLogger)({output:Mt.output,formatterOptions:{titleize:!1,tags:new Map([[So.LOGGER_LEVELS.DEBUG,xo.default.log.DEBUG("[debug]")],[So.LOGGER_LEVELS.INFO,xo.default.log.INFO("[info]")],[So.LOGGER_LEVELS.WARN,xo.default.log.WARN("[warn]")],[So.LOGGER_LEVELS.ERROR,xo.default.log.ERROR("[error]")]])}});async function w4(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>zm.__importStar((Vm(),oe(Hm)))),{prompt:n}=await Promise.resolve().then(()=>zm.__importStar((El(),oe(Cl))));return Mt.logger.log({msg:`${xo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Mt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Mt.logPrompt=w4;function v4(t){Mt.logger.msg(`${xo.default.success("[success]")} ${t}`)}Mt.logSuccess=v4});var _l=S(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.resolveNode=Gi.requireTS=void 0;var C4=require("fs"),E4=Ui(),_4=require("path"),S4=(t,e)=>{let r=(0,_4.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,E4.readFileSync)(i,"utf8");i.endsWith(".ts")?s=t.transpileModule(s,{fileName:i,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:s=s.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(a=o._compile)===null||a===void 0||a.call(o,s,i)};let n=require(r);return delete require.extensions[".ts"],n};Gi.requireTS=S4;function x4(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,C4.existsSync)(n)?n:null}}Gi.resolveNode=x4});var ox={};Yr(ox,{default:()=>A4});var A4,ix=Xe(()=>{A4={}});var ax=S(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.buildXmlElement=jr.writeXML=jr.parseXML=jr.readXML=void 0;var O4=(he(),oe(pe)),F4=Ui(),_s=O4.__importDefault((ix(),oe(ox)));async function k4(t){var e;try{let r=await(0,F4.readFile)(t,{encoding:"utf-8"});try{return await _s.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}jr.readXML=k4;function P4(t,e){let r=e!==void 0?new _s.default.Parser({...e}):new _s.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}jr.parseXML=P4;async function $4(t){return new Promise(e=>{let n=new _s.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}jr.writeXML=$4;function I4(t,e){return new _s.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}jr.buildXmlElement=I4});var fx=S(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getAllElements=Fe.getFilePath=Fe.getAssets=Fe.getJSModules=Fe.getPluginType=Fe.getPlatformElement=Fe.getPluginPlatform=Fe.printPlugins=Fe.fixName=Fe.getDependencies=Fe.resolvePlugin=Fe.getPlugins=Fe.getIncludedPluginPackages=void 0;var T4=(he(),oe(pe)),R4=Ui(),Km=require("path"),Wi=T4.__importDefault(Mi()),B4=wl(),N4=Es(),sx=_l(),L4=ax();function ux(t,e){var r,n,o,i;let{extConfig:a}=t.app;switch(e){case"android":return(n=(r=a.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:a.includePlugins;case"ios":return(i=(o=a.ios)===null||o===void 0?void 0:o.includePlugins)!==null&&i!==void 0?i:a.includePlugins}}Fe.getIncludedPluginPackages=ux;async function j4(t,e){var r;let n=(r=ux(t,e))!==null&&r!==void 0?r:lx(t);return(await Promise.all(n.map(async i=>cx(t,i)))).filter(i=>!!i)}Fe.getPlugins=j4;async function cx(t,e){try{let r=(0,sx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,B4.fatal)(`Unable to find ${Wi.default.strong(`node_modules/${e}`)}.
68
+ Are you sure ${Wi.default.strong(e)} is installed?`);let n=(0,Km.dirname)(r),o=await(0,R4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Gm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Km.join)(n,"plugin.xml"),a=await(0,L4.readXML)(i);return{id:e,name:Gm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Fe.resolvePlugin=cx;function lx(t){var e,r;return[...Object.keys((e=t.app.package.dependencies)!==null&&e!==void 0?e:{}),...Object.keys((r=t.app.package.devDependencies)!==null&&r!==void 0?r:{})]}Fe.getDependencies=lx;function Gm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Fe.fixName=Gm;function U4(t,e,r="capacitor"){if(t.length===0)return;let n,o=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${o} for ${Wi.default.strong(e)}:
69
+ `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Wi.default.strong(e)}, skipped install:
70
+ `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Wi.default.strong(e)}:
71
+ `;break}n+=t.map(i=>`${i.id}${Wi.default.weak(`@${i.version}`)}`).join(`
72
+ `),N4.logger.info(n)}Fe.printPlugins=U4;function Wm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Fe.getPluginPlatform=Wm;function M4(t,e,r){let n=Wm(t,e);if(n){let o=n[r];if(o)return o}return[]}Fe.getPlatformElement=M4;function q4(t,e){var r,n,o,i;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(i=(o=t.android)===null||o===void 0?void 0:o.type)!==null&&i!==void 0?i:0}return 0}Fe.getPluginType=q4;function H4(t,e){return Ym(t,e,"js-module")}Fe.getJSModules=H4;function V4(t,e){return Ym(t,e,"asset")}Fe.getAssets=V4;function z4(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let o=(0,sx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Km.join)(e.rootPath,r)}Fe.getFilePath=z4;function Ym(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Wm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Fe.getAllElements=Ym});var dx={};Yr(dx,{default:()=>K4});var K4,px=Xe(()=>{K4={}});var Sl=S(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.isInstalled=Bn.getCommandOutput=Bn.runCommand=void 0;var Jm=(px(),oe(dx));async function hx(t,e,r={}){let n=new Jm.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Jm.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Bn.runCommand=hx;async function G4(t,e,r={}){try{return(await hx(t,e,r)).trim()}catch{return null}}Bn.getCommandOutput=G4;async function W4(t){try{await(0,Jm.which)(t)}catch{return!1}return!0}Bn.isInstalled=W4});var mx={};Yr(mx,{Comparator:()=>CU,Range:()=>wU,SemVer:()=>vU,clean:()=>Z4,coerce:()=>bU,compare:()=>nU,diff:()=>Y4,eq:()=>sU,gt:()=>iU,gte:()=>cU,gtr:()=>gU,inc:()=>Q4,intersects:()=>DU,lt:()=>aU,lte:()=>lU,ltr:()=>yU,major:()=>eU,maxSatisfying:()=>dU,minSatisfying:()=>pU,minor:()=>tU,neq:()=>uU,outside:()=>mU,parse:()=>J4,patch:()=>rU,rcompare:()=>oU,satisfies:()=>fU,valid:()=>X4,validRange:()=>hU});var Y4,J4,X4,Z4,Q4,eU,tU,rU,nU,oU,iU,aU,sU,uU,cU,lU,fU,dU,pU,hU,mU,gU,yU,DU,bU,wU,vU,CU,gx=Xe(()=>{Y4=()=>null,J4=()=>null,X4=()=>null,Z4=()=>null,Q4=()=>null,eU=()=>null,tU=()=>null,rU=()=>null,nU=()=>0,oU=()=>0,iU=()=>!1,aU=()=>!1,sU=()=>!1,uU=()=>!0,cU=()=>!1,lU=()=>!1,fU=()=>!1,dU=()=>null,pU=()=>null,hU=()=>null,mU=()=>!1,gU=()=>!1,yU=()=>!1,DU=()=>!1,bU=()=>null,wU=class{},vU=class{},CU=class{}});var Ox=S(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.parseApkNameFromFlavor=X.checkJDKMajorVersion=X.resolvePlatform=X.checkPlatformVersions=X.getAddedPlatforms=X.getPlatformTargetName=X.promptForPlatformTarget=X.promptForPlatform=X.isValidEnterprisePlatform=X.getKnownEnterprisePlatforms=X.isValidCommunityPlatform=X.getKnownCommunityPlatforms=X.isValidPlatform=X.getKnownPlatforms=X.selectPlatforms=X.getProjectPlatformDirectory=X.getCLIVersion=X.getCoreVersion=X.getCapacitorPackageVersion=X.requireCapacitorPackage=X.getCapacitorPackage=X.runTask=X.runPlatformHook=X.runHooks=X.wait=X.checkAppName=X.checkAppId=X.checkAppDir=X.checkAppConfig=X.checkCapacitorPlatform=X.checkPackage=X.checkWebDir=X.check=void 0;var xs=(he(),oe(pe)),yx=Um(),Nn=Ui(),Ao=require("path"),ke=xs.__importDefault(Mi()),Yi=wl(),bx=Es(),EU=fx(),Dx=du(),Ss=_l(),_U=Sl();async function SU(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
+ `)}X.check=SU;async function xU(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,Nn.pathExists)(t.app.webDirAbs)?await(0,Nn.pathExists)((0,Ao.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${ke.default.strong((0,yx.prettyPath)(t.app.webDirAbs))}) must contain an ${ke.default.strong("index.html")} file.
74
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${ke.default.strong((0,yx.prettyPath)(t.app.webDirAbs))}.
75
+ Please create it and make sure it has an ${ke.default.strong("index.html")} file. You can change the path of this directory in ${ke.default.strong(t.app.extConfigName)} (${ke.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${ke.default.input("npm run build")}). More info: ${ke.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}X.checkWebDir=xU;async function AU(){return await(0,Nn.pathExists)("package.json")||await(0,Nn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
76
76
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
77
- More info: ${ke.default.strong("https://docs.npmjs.com/cli/init")}`}X.checkPackage=fU;async function dU(t,e){return await Wm(t,e)?null:`Could not find the ${ke.default.input(e)} platform.
78
- You must install it in your project first, e.g. w/ ${ke.default.input(`npm install @capacitor/${e}`)}`}X.checkCapacitorPlatform=dU;async function pU(t){if(!t.app.appId)return`Missing ${ke.default.input("appId")} for new platform.
77
+ More info: ${ke.default.strong("https://docs.npmjs.com/cli/init")}`}X.checkPackage=AU;async function OU(t,e){return await Zm(t,e)?null:`Could not find the ${ke.default.input(e)} platform.
78
+ You must install it in your project first, e.g. w/ ${ke.default.input(`npm install @capacitor/${e}`)}`}X.checkCapacitorPlatform=OU;async function FU(t){if(!t.app.appId)return`Missing ${ke.default.input("appId")} for new platform.
79
79
  Please add it in ${t.app.extConfigName} or run ${ke.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${ke.default.input("appName")} for new platform.
80
- Please add it in ${t.app.extConfigName} or run ${ke.default.input("npx cap init")}.`;let e=await mx(t,t.app.appId);if(e)return e;let r=await gx(t,t.app.appName);return r||null}X.checkAppConfig=pU;async function hU(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}X.checkAppDir=hU;async function mx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
80
+ Please add it in ${t.app.extConfigName} or run ${ke.default.input("npx cap init")}.`;let e=await wx(t,t.app.appId);if(e)return e;let r=await vx(t,t.app.appName);return r||null}X.checkAppConfig=FU;async function kU(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}X.checkAppDir=kU;async function wx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
81
81
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
82
82
  - Must be in Java package form with no dashes (ex: com.example.app)
83
83
  - It must have at least two segments (one or more dots).
@@ -85,109 +85,109 @@ Please add it in ${t.app.extConfigName} or run ${ke.default.input("npx cap init"
85
85
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
86
86
 
87
87
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
88
- `:"Invalid App ID. App ID is required and cannot be blank."}X.checkAppId=mx;async function gx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}X.checkAppName=gx;async function mU(t){return new Promise(e=>setTimeout(e,t))}X.wait=mU;async function gU(t,e,r,n){await Gm(t,e,r,n);let o=await(0,sU.getPlugins)(t,e);for(let i of o)await Gm(t,e,i.rootPath,n)}X.runHooks=gU;async function Gm(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>_s.__importStar(require("child_process"))),a;(0,px.isNXMonorepo)(r)?a=await(0,Rn.readJSON)((0,Oo.join)((0,px.findNXMonorepoRoot)(r),"package.json")):a=await(0,Rn.readJSON)((0,Oo.join)(r,"package.json"));let s=(o=a.scripts)===null||o===void 0?void 0:o[n];if(s)return new Promise((u,c)=>{let l=i(s,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),l.on("error",d=>{c(d)})})}X.runPlatformHook=Gm;async function DU(t,e){let r=hx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}X.runTask=DU;async function Wm(t,e){let r=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,Rn.readJSON)(r):null}X.getCapacitorPackage=Wm;async function Dx(t,e){let r=await Wm(t,e);return r||(0,Gi.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
- Are you sure ${ke.default.strong(`@capacitor/${e}`)} is installed?`),r}X.requireCapacitorPackage=Dx;async function Sl(t,e){return(await Dx(t,e)).version}X.getCapacitorPackageVersion=Sl;async function yx(t){return Sl(t,"core")}X.getCoreVersion=yx;async function yU(t){return Sl(t,"cli")}X.getCLIVersion=yU;function bU(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function _l(t,e){let r=bU(t,e);return r&&await(0,Rn.pathExists)(r)?r:null}X.getProjectPlatformDirectory=_l;async function wU(t,e){if(e){let r=e.toLowerCase().trim();return await Jm(r)?await _l(t,r)||(r==="web"&&(0,Gi.fatal)(`Could not find the web platform directory.
90
- Make sure ${ke.default.strong(t.app.webDir)} exists.`),(0,Gi.fatal)(`${ke.default.strong(r)} platform has not been added yet.
91
- See the docs for adding the ${ke.default.strong(r)} platform: ${ke.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Gi.fatal)(`Invalid platform: ${ke.default.input(r)}`),[r]}return Ex(t)}X.selectPlatforms=wU;async function Ym(){return["web","android","ios"]}X.getKnownPlatforms=Ym;async function Jm(t){return(await Ym()).includes(t)}X.isValidPlatform=Jm;async function bx(){return["electron"]}X.getKnownCommunityPlatforms=bx;async function vU(t){return(await bx()).includes(t)}X.isValidCommunityPlatform=vU;async function wx(){return["windows"]}X.getKnownEnterprisePlatforms=wx;async function EU(t){return(await wx()).includes(t)}X.isValidEnterprisePlatform=EU;async function CU(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>_s.__importStar((vl(),oe(wl))));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(a=>({title:a,value:a}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let o=r.toLowerCase().trim();if(!await Jm(o)){let i=await Ym();(0,Gi.fatal)(`Invalid platform: ${ke.default.input(o)}.
92
- Valid platforms include: ${i.join(", ")}`)}return o}X.promptForPlatform=CU;async function _U(t,e){let{prompt:r}=await Promise.resolve().then(()=>_s.__importStar((vl(),oe(wl)))),n=t.filter(a=>a.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(s=>({title:`${vx(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Gi.fatal)(`Invalid target ID: ${ke.default.input(o)}.
93
- Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}X.promptForPlatformTarget=_U;function vx(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}X.getPlatformTargetName=vx;async function Ex(t){let e=[];return await _l(t,t.android.name)&&e.push(t.android.name),await _l(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}X.getAddedPlatforms=Ex;async function SU(t,e){let r=await Promise.resolve().then(()=>_s.__importStar((fx(),oe(lx)))),n=await yx(t),o=await Sl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&hx.logger.warn(`${ke.default.strong("@capacitor/core")}${ke.default.weak(`@${n}`)} version doesn't match ${ke.default.strong(`@capacitor/${e}`)}${ke.default.weak(`@${o}`)} version.
94
- Consider updating to a matching version, e.g. w/ ${ke.default.input(`npm install @capacitor/core@${o}`)}`)}X.checkPlatformVersions=SU;function xU(t,e){if(e[0]!=="@"){let n=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,Oo.dirname)(n);let o=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,Oo.dirname)(o);let i=(0,Cs.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,Oo.dirname)(i)}let r=(0,Cs.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,Oo.dirname)(r):null}X.resolvePlatform=xU;async function AU(){try{let t=await(0,uU.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),o=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof o=="number"&&n==1&&o<9?o:-1}catch{return-1}}X.checkJDKMajorVersion=AU;function OU(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}X.parseApkNameFromFlavor=OU});var _x=S(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl.tryFn=void 0;var FU=async(t,...e)=>{try{return await t(...e)}catch{}return null};xl.tryFn=FU});var Sx=S(Al=>{"use strict";Object.defineProperty(Al,"__esModule",{value:!0});Al.formatJSObject=void 0;var kU=(he(),oe(pe)),PU=kU.__importDefault(require("util"));function $U(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return PU.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Al.formatJSObject=$U});var xx=S(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.lazy=Bn.LazyPromise=Bn.allSerial=void 0;function TU(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Bn.allSerial=TU;var Ol=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};Bn.LazyPromise=Ol;function IU(t){return new Ol(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Bn.lazy=IU});var kx=S(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.writeConfig=dt.loadConfig=dt.CONFIG_FILE_NAME_JSON=dt.CONFIG_FILE_NAME_JS=dt.CONFIG_FILE_NAME_TS=void 0;var Zm=(he(),oe(pe)),RU=Zm.__importDefault(dm()),qt=Li(),ae=require("path"),Fo=Zm.__importDefault(ji()),BU=Cx(),Fl=yl(),NU=vs(),Xm=_x(),LU=Sx(),Ax=lu(),Ox=El(),Wi=xx(),jU=Cl(),Fx=(0,RU.default)("capacitor:config");dt.CONFIG_FILE_NAME_TS="capacitor.config.ts";dt.CONFIG_FILE_NAME_JS="capacitor.config.js";dt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function UU(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await VU(o),s=await(async()=>{var h,m;if((0,Ax.isNXMonorepo)(o)){let b=(0,Ax.findNXMonorepoRoot)(o),D=await(0,Xm.tryFn)(qt.readJSON,(0,ae.resolve)(b,"package.json")),E=(h=D?.devDependencies)!==null&&h!==void 0?h:{},C=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:E,dependencies:C}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await zU(i),p={android:await KU(o,a.extConfig,d),ios:await GU(o,a.extConfig),web:await WU(o,l),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,Xm.tryFn)(qt.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return Fx("config: %O",p),p}dt.loadConfig=UU;async function MU(t,e){switch((0,ae.extname)(e)){case".json":{await(0,qt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,qt.writeFile)(e,e5(t));break}}}dt.writeConfig=MU;async function qU(t,e,r){var n;try{let o=(0,Ox.resolveNode)(t,"typescript");o||(0,Fl.fatal)(`Could not find installation of TypeScript.
95
- To use ${Fo.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Fo.default.input("npm install -D typescript")}`);let i=require(o),a=(0,Ox.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Fl.isFatal)(o)||(0,Fl.fatal)(`Parsing ${Fo.default.strong(e)} failed.
88
+ `:"Invalid App ID. App ID is required and cannot be blank."}X.checkAppId=wx;async function vx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}X.checkAppName=vx;async function PU(t){return new Promise(e=>setTimeout(e,t))}X.wait=PU;async function $U(t,e,r,n){await Xm(t,e,r,n);let o=await(0,EU.getPlugins)(t,e);for(let i of o)await Xm(t,e,i.rootPath,n)}X.runHooks=$U;async function Xm(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>xs.__importStar(require("child_process"))),a;(0,Dx.isNXMonorepo)(r)?a=await(0,Nn.readJSON)((0,Ao.join)((0,Dx.findNXMonorepoRoot)(r),"package.json")):a=await(0,Nn.readJSON)((0,Ao.join)(r,"package.json"));let s=(o=a.scripts)===null||o===void 0?void 0:o[n];if(s)return new Promise((u,c)=>{let l=i(s,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),l.on("error",d=>{c(d)})})}X.runPlatformHook=Xm;async function IU(t,e){let r=bx.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}X.runTask=IU;async function Zm(t,e){let r=(0,Ss.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,Nn.readJSON)(r):null}X.getCapacitorPackage=Zm;async function Cx(t,e){let r=await Zm(t,e);return r||(0,Yi.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
+ Are you sure ${ke.default.strong(`@capacitor/${e}`)} is installed?`),r}X.requireCapacitorPackage=Cx;async function Al(t,e){return(await Cx(t,e)).version}X.getCapacitorPackageVersion=Al;async function Ex(t){return Al(t,"core")}X.getCoreVersion=Ex;async function TU(t){return Al(t,"cli")}X.getCLIVersion=TU;function RU(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function xl(t,e){let r=RU(t,e);return r&&await(0,Nn.pathExists)(r)?r:null}X.getProjectPlatformDirectory=xl;async function BU(t,e){if(e){let r=e.toLowerCase().trim();return await eg(r)?await xl(t,r)||(r==="web"&&(0,Yi.fatal)(`Could not find the web platform directory.
90
+ Make sure ${ke.default.strong(t.app.webDir)} exists.`),(0,Yi.fatal)(`${ke.default.strong(r)} platform has not been added yet.
91
+ See the docs for adding the ${ke.default.strong(r)} platform: ${ke.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Yi.fatal)(`Invalid platform: ${ke.default.input(r)}`),[r]}return Ax(t)}X.selectPlatforms=BU;async function Qm(){return["web","android","ios"]}X.getKnownPlatforms=Qm;async function eg(t){return(await Qm()).includes(t)}X.isValidPlatform=eg;async function _x(){return["electron"]}X.getKnownCommunityPlatforms=_x;async function NU(t){return(await _x()).includes(t)}X.isValidCommunityPlatform=NU;async function Sx(){return["windows"]}X.getKnownEnterprisePlatforms=Sx;async function LU(t){return(await Sx()).includes(t)}X.isValidEnterprisePlatform=LU;async function jU(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>xs.__importStar((El(),oe(Cl))));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(a=>({title:a,value:a}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let o=r.toLowerCase().trim();if(!await eg(o)){let i=await Qm();(0,Yi.fatal)(`Invalid platform: ${ke.default.input(o)}.
92
+ Valid platforms include: ${i.join(", ")}`)}return o}X.promptForPlatform=jU;async function UU(t,e){let{prompt:r}=await Promise.resolve().then(()=>xs.__importStar((El(),oe(Cl)))),n=t.filter(a=>a.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(s=>({title:`${xx(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Yi.fatal)(`Invalid target ID: ${ke.default.input(o)}.
93
+ Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}X.promptForPlatformTarget=UU;function xx(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}X.getPlatformTargetName=xx;async function Ax(t){let e=[];return await xl(t,t.android.name)&&e.push(t.android.name),await xl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}X.getAddedPlatforms=Ax;async function MU(t,e){let r=await Promise.resolve().then(()=>xs.__importStar((gx(),oe(mx)))),n=await Ex(t),o=await Al(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&bx.logger.warn(`${ke.default.strong("@capacitor/core")}${ke.default.weak(`@${n}`)} version doesn't match ${ke.default.strong(`@capacitor/${e}`)}${ke.default.weak(`@${o}`)} version.
94
+ Consider updating to a matching version, e.g. w/ ${ke.default.input(`npm install @capacitor/core@${o}`)}`)}X.checkPlatformVersions=MU;function qU(t,e){if(e[0]!=="@"){let n=(0,Ss.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,Ao.dirname)(n);let o=(0,Ss.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,Ao.dirname)(o);let i=(0,Ss.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,Ao.dirname)(i)}let r=(0,Ss.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,Ao.dirname)(r):null}X.resolvePlatform=qU;async function HU(){try{let t=await(0,_U.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),o=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof o=="number"&&n==1&&o<9?o:-1}catch{return-1}}X.checkJDKMajorVersion=HU;function VU(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}X.parseApkNameFromFlavor=VU});var Fx=S(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.tryFn=void 0;var zU=async(t,...e)=>{try{return await t(...e)}catch{}return null};Ol.tryFn=zU});var kx=S(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});Fl.formatJSObject=void 0;var KU=(he(),oe(pe)),GU=KU.__importDefault(require("util"));function WU(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return GU.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Fl.formatJSObject=WU});var Px=S(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.lazy=Ln.LazyPromise=Ln.allSerial=void 0;function YU(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Ln.allSerial=YU;var kl=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};Ln.LazyPromise=kl;function JU(t){return new kl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Ln.lazy=JU});var Rx=S(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.writeConfig=dt.loadConfig=dt.CONFIG_FILE_NAME_JSON=dt.CONFIG_FILE_NAME_JS=dt.CONFIG_FILE_NAME_TS=void 0;var rg=(he(),oe(pe)),XU=rg.__importDefault(gm()),qt=Ui(),ae=require("path"),Oo=rg.__importDefault(Mi()),ZU=Ox(),Pl=wl(),QU=Es(),tg=Fx(),e5=kx(),$x=du(),Ix=_l(),Ji=Px(),t5=Sl(),Tx=(0,XU.default)("capacitor:config");dt.CONFIG_FILE_NAME_TS="capacitor.config.ts";dt.CONFIG_FILE_NAME_JS="capacitor.config.js";dt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function r5(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await a5(o),s=await(async()=>{var h,m;if((0,$x.isNXMonorepo)(o)){let b=(0,$x.findNXMonorepoRoot)(o),y=await(0,tg.tryFn)(qt.readJSON,(0,ae.resolve)(b,"package.json")),C=(h=y?.devDependencies)!==null&&h!==void 0?h:{},E=(m=y?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:C,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await s5(i),p={android:await u5(o,a.extConfig,d),ios:await c5(o,a.extConfig),web:await l5(o,l),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,tg.tryFn)(qt.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return Tx("config: %O",p),p}dt.loadConfig=r5;async function n5(t,e){switch((0,ae.extname)(e)){case".json":{await(0,qt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,qt.writeFile)(e,g5(t));break}}}dt.writeConfig=n5;async function o5(t,e,r){var n;try{let o=(0,Ix.resolveNode)(t,"typescript");o||(0,Pl.fatal)(`Could not find installation of TypeScript.
95
+ To use ${Oo.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Oo.default.input("npm install -D typescript")}`);let i=require(o),a=(0,Ix.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Pl.isFatal)(o)||(0,Pl.fatal)(`Parsing ${Oo.default.strong(e)} failed.
96
96
 
97
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function HU(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Fl.fatal)(`Parsing ${Fo.default.strong(e)} failed.
97
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function i5(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Pl.fatal)(`Parsing ${Oo.default.strong(e)} failed.
98
98
 
99
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function VU(t){var e;let r=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_TS);if(await(0,qt.pathExists)(r))return qU(t,dt.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_JS);if(await(0,qt.pathExists)(n))return HU(t,dt.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:dt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Xm.tryFn)(qt.readJSON,o))!==null&&e!==void 0?e:{}}}async function zU(t){let e="assets",r=(0,ae.join)(t,e),n="ios-pods-template.tar.gz",o="capacitor-cordova-ios-plugins.tar.gz",i="android-template.tar.gz",a="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ae.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ae.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,a)}},package:await(0,qt.readJSON)((0,ae.resolve)(t,"package.json")),os:YU(process.platform)}}async function KU(t,e,r){var n,o,i,a,s,u,c,l,d,p,h,m,b,D,E,C,g;let _="android",x=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",$=(0,ae.resolve)(t,x),F="app",B=`${F}/src`,I=`${B}/main`,L=`${I}/assets`,A=`${L}/public`,j=`${I}/res`,M=`${F}/build/outputs/apk/`,J=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(M=`${M}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let k=(0,BU.parseApkNameFromFlavor)(J),y=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,Wi.lazy)(()=>ZU(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(h=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(E=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||E===void 0?void 0:E.signingType,releaseType:(g=(C=e.android)===null||C===void 0?void 0:C.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:_,minVersion:"23",studioPath:v,platformDir:x,platformDirAbs:$,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ae.resolve)($,w),appDir:F,appDirAbs:(0,ae.resolve)($,F),srcDir:B,srcDirAbs:(0,ae.resolve)($,B),srcMainDir:I,srcMainDirAbs:(0,ae.resolve)($,I),assetsDir:L,assetsDirAbs:(0,ae.resolve)($,L),webDir:A,webDirAbs:(0,ae.resolve)($,A),resDir:j,resDirAbs:(0,ae.resolve)($,j),apkName:k,buildOutputDir:y,buildOutputDirAbs:(0,ae.resolve)($,y),flavor:J,buildOptions:O}}async function GU(t,e){var r,n,o,i,a,s,u,c,l,d,p,h;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ae.resolve)(t,b),E=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",C="App",g=(0,ae.resolve)(D,C),_=`${C}/App`,x=(0,ae.resolve)(D,_),$=`${C}/App.xcodeproj`,F=(0,ae.resolve)(D,$),B=(0,Wi.lazy)(()=>JU(g)),I=(0,Wi.lazy)(()=>QU(t,D,g)),L=(0,Wi.lazy)(()=>XU(g,x,F)),A="capacitor-cordova-ios-plugins",j={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(d=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(h=(p=e.ios)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:E,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ae.resolve)(D,A),nativeProjectDir:C,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:x,nativeXcodeProjDir:$,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Wi.lazy)(async()=>(0,ae.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Wi.lazy)(async()=>(0,ae.relative)(D,await L)),webDirAbs:L,podPath:I,buildOptions:j}}async function WU(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function YU(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function JU(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function XU(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ae.resolve)(r,"project.pbxproj");try{let a=(await(0,qt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return NU.logger.warn(`Using the iOS project root for the ${Fo.default.strong("public")} directory is deprecated.
100
- Please follow the Upgrade Guide to move ${Fo.default.strong("public")} inside the iOS target directory: ${Fo.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ae.resolve)(t,"public")}catch{}return(0,ae.resolve)(e,"public")}async function ZU(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>Zm.__importStar(Cl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,qt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let o=n.indexOf("REG_SZ");o>0&&(r=n.substring(o+6).trim()+"\\bin\\studio64.exe")}}catch(n){Fx("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function QU(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,qt.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,jU.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,qt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function e5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
99
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function a5(t){var e;let r=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_TS);if(await(0,qt.pathExists)(r))return o5(t,dt.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_JS);if(await(0,qt.pathExists)(n))return i5(t,dt.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,dt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:dt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,tg.tryFn)(qt.readJSON,o))!==null&&e!==void 0?e:{}}}async function s5(t){let e="assets",r=(0,ae.join)(t,e),n="ios-pods-template.tar.gz",o="capacitor-cordova-ios-plugins.tar.gz",i="android-template.tar.gz",a="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ae.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,ae.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,ae.resolve)(r,a)}},package:await(0,qt.readJSON)((0,ae.resolve)(t,"package.json")),os:f5(process.platform)}}async function u5(t,e,r){var n,o,i,a,s,u,c,l,d,p,h,m,b,y,C,E,g;let _="android",x=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",$=(0,ae.resolve)(t,x),F="app",B=`${F}/src`,T=`${B}/main`,L=`${T}/assets`,A=`${L}/public`,j=`${T}/res`,M=`${F}/build/outputs/apk/`,J=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(M=`${M}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let k=(0,ZU.parseApkNameFromFlavor)(J),D=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,Ji.lazy)(()=>h5(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(h=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(b=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||b===void 0?void 0:b.keystoreAliasPassword,signingType:(C=(y=e.android)===null||y===void 0?void 0:y.buildOptions)===null||C===void 0?void 0:C.signingType,releaseType:(g=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||g===void 0?void 0:g.releaseType};return{name:_,minVersion:"23",studioPath:v,platformDir:x,platformDirAbs:$,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ae.resolve)($,w),appDir:F,appDirAbs:(0,ae.resolve)($,F),srcDir:B,srcDirAbs:(0,ae.resolve)($,B),srcMainDir:T,srcMainDirAbs:(0,ae.resolve)($,T),assetsDir:L,assetsDirAbs:(0,ae.resolve)($,L),webDir:A,webDirAbs:(0,ae.resolve)($,A),resDir:j,resDirAbs:(0,ae.resolve)($,j),apkName:k,buildOutputDir:D,buildOutputDirAbs:(0,ae.resolve)($,D),flavor:J,buildOptions:O}}async function c5(t,e){var r,n,o,i,a,s,u,c,l,d,p,h;let b=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",y=(0,ae.resolve)(t,b),C=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",g=(0,ae.resolve)(y,E),_=`${E}/App`,x=(0,ae.resolve)(y,_),$=`${E}/App.xcodeproj`,F=(0,ae.resolve)(y,$),B=(0,Ji.lazy)(()=>d5(g)),T=(0,Ji.lazy)(()=>m5(t,y,g)),L=(0,Ji.lazy)(()=>p5(g,x,F)),A="capacitor-cordova-ios-plugins",j={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(d=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(h=(p=e.ios)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:y,scheme:C,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,ae.resolve)(y,A),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:x,nativeXcodeProjDir:$,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Ji.lazy)(async()=>(0,ae.relative)(y,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Ji.lazy)(async()=>(0,ae.relative)(y,await L)),webDirAbs:L,podPath:T,buildOptions:j}}async function l5(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function f5(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function d5(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function p5(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,ae.resolve)(r,"project.pbxproj");try{let a=(await(0,qt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return QU.logger.warn(`Using the iOS project root for the ${Oo.default.strong("public")} directory is deprecated.
100
+ Please follow the Upgrade Guide to move ${Oo.default.strong("public")} inside the iOS target directory: ${Oo.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ae.resolve)(t,"public")}catch{}return(0,ae.resolve)(e,"public")}async function h5(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>rg.__importStar(Sl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,qt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let o=n.indexOf("REG_SZ");o>0&&(r=n.substring(o+6).trim()+"\\bin\\studio64.exe")}}catch(n){Tx("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function m5(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,qt.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,qt.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,t5.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,qt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function g5(t){return`import type { CapacitorConfig } from '@capacitor/cli';
101
101
 
102
- const config: CapacitorConfig = ${(0,LU.formatJSObject)(t)};
102
+ const config: CapacitorConfig = ${(0,e5.formatJSObject)(t)};
103
103
 
104
104
  export default config;
105
- `}});function t5(){try{return tg.default.statSync("/.dockerenv"),!0}catch{return!1}}function r5(){try{return tg.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function rg(){return eg===void 0&&(eg=t5()||r5()),eg}var tg,eg,$x=rt(()=>{tg=de(require("node:fs"),1)});function Ji(){return ng===void 0&&(ng=n5()||rg()),ng}var Tx,ng,n5,og=rt(()=>{Tx=de(require("node:fs"),1);$x();n5=()=>{try{return Tx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var ig,Rx,Bx,Ix,Nn,ag=rt(()=>{ig=de(require("node:process"),1),Rx=de(require("node:os"),1),Bx=de(require("node:fs"),1);og();Ix=()=>{if(ig.default.platform!=="linux")return!1;if(Rx.default.release().toLowerCase().includes("microsoft"))return!Ji();try{return Bx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ji():!1}catch{return!1}},Nn=ig.default.env.__IS_WSL_TEST__?Ix:Ix()});var sg,xs,o5,i5,ug,Nx=rt(()=>{sg=de(require("node:process"),1),xs=de(require("node:fs/promises"),1);ag();ag();o5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await xs.default.access(r,xs.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await xs.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),i5=async()=>`${await o5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,ug=async()=>Nn?i5():`${sg.default.env.SYSTEMROOT||sg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function Ln(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var Lx=rt(()=>{});async function cg(){if(Ux.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await a5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var jx,Ux,Mx,a5,qx=rt(()=>{jx=require("node:util"),Ux=de(require("node:process"),1),Mx=require("node:child_process"),a5=(0,jx.promisify)(Mx.execFile)});async function zx(t,{humanReadableOutput:e=!0,signal:r}={}){if(Hx.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await s5("osascript",["-e",t,n],o);return i.trim()}var Hx,Vx,lg,s5,Kx=rt(()=>{Hx=de(require("node:process"),1),Vx=require("node:util"),lg=require("node:child_process"),s5=(0,Vx.promisify)(lg.execFile)});async function fg(t){return zx(`tell application "Finder" to set app_path to application file id "${t}" as string
106
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var Gx=rt(()=>{Kx()});async function dg(t=u5){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new kl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=Jx[n];if(!o)throw new kl(`Unknown browser ID: ${n}`);return o}var Wx,Yx,u5,Jx,yW,kl,Xx=rt(()=>{Wx=require("node:util"),Yx=require("node:child_process"),u5=(0,Wx.promisify)(Yx.execFile),Jx={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},yW=new Map(Object.entries(Jx)),kl=class extends Error{}});async function pg(){if(Pl.default.platform==="darwin"){let t=await cg();return{name:await fg(t),id:t}}if(Pl.default.platform==="linux"){let{stdout:t}=await c5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:l5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Pl.default.platform==="win32")return dg();throw new Error("Only macOS, Linux, and Windows are supported")}var Zx,Pl,Qx,c5,l5,eA=rt(()=>{Zx=require("node:util"),Pl=de(require("node:process"),1),Qx=require("node:child_process");qx();Gx();Xx();c5=(0,Zx.promisify)(Qx.execFile),l5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var bg={};Wr(bg,{apps:()=>jn,default:()=>m5,openApp:()=>h5});async function d5(){let t=await ug(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=gg.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await f5(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),o=n.trim(),i={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return i[o]?{id:i[o]}:{}}function oA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[rA]:e}=t;if(!e)throw new Error(`${rA} is not supported`);return e}function Tl({[Xi]:t},{wsl:e}){if(e&&Nn)return oA(e);if(!t)throw new Error(`${Xi} is not supported`);return oA(t)}var mg,gg,Dg,iA,aA,yg,$l,g5,f5,hg,tA,Xi,rA,nA,As,p5,h5,jn,m5,wg=rt(()=>{mg=de(require("node:process"),1),gg=require("node:buffer"),Dg=de(require("node:path"),1),iA=require("node:url"),aA=require("node:util"),yg=de(require("node:child_process"),1),$l=de(require("node:fs/promises"),1);Nx();Lx();eA();og();g5={},f5=(0,aA.promisify)(yg.default.execFile),hg=Dg.default.dirname((0,iA.fileURLToPath)(g5.url)),tA=Dg.default.join(hg,"xdg-open"),{platform:Xi,arch:rA}=mg.default;nA=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},As=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return nA(t.app,s=>As({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return nA(e,s=>As({...t,app:{name:s,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let s={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Nn?await d5():await pg();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),As({...t,app:{name:jn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(Xi==="darwin")n="open",t.wait&&o.push("--wait-apps"),t.background&&o.push("--background"),t.newInstance&&o.push("--new"),e&&o.push("-a",e);else if(Xi==="win32"||Nn&&!Ji()&&!e){n=await ug(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Nn||(i.windowsVerbatimArguments=!0);let s=["Start"];t.wait&&s.push("-Wait"),e?(s.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&s.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),s.push("-ArgumentList",r.join(","))),t.target=gg.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!hg||hg==="/",u=!1;try{await $l.default.access(tA,$l.constants.X_OK),u=!0}catch{}n=mg.default.versions.electron??(Xi==="android"||s||!u)?"xdg-open":tA}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}Xi==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=yg.default.spawn(n,o,i);return t.wait?new Promise((s,u)=>{a.once("error",u),a.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}s(a)})}):(a.unref(),a)},p5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return As({...e,target:t})},h5=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return As({...e,app:{name:t,arguments:r}})};jn={};Ln(jn,"chrome",()=>Tl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Ln(jn,"brave",()=>Tl({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));Ln(jn,"firefox",()=>Tl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Ln(jn,"edge",()=>Tl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Ln(jn,"browser",()=>"browser");Ln(jn,"browserPrivate",()=>"browserPrivate");m5=p5});var sf=S(pr=>{"use strict";pr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;pr.find=(t,e)=>t.nodes.find(r=>r.type===e);pr.exceedsLimit=(t,e,r=1,n)=>n===!1||!pr.isInteger(t)||!pr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;pr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};pr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;pr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;pr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;pr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);pr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var uf=S((FJ,B1)=>{"use strict";var R1=sf();B1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&R1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&R1.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var L1=S((kJ,N1)=>{"use strict";N1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var G1=S((PJ,K1)=>{"use strict";var j1=L1(),jo=(t,e,r)=>{if(j1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(j1(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(jo.cache.hasOwnProperty(u))return jo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let d=z1(t)||z1(e),p={min:t,max:e,a:c,b:l},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let b=l<0?Math.abs(l):1;m=U1(b,Math.abs(c),p,n),c=p.a=0}return l>=0&&(h=U1(c,l,p,n)),p.negatives=m,p.positives=h,p.result=cM(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),jo.cache[u]=p,p.result};function cM(t,e,r){let n=zg(t,e,"-",!1,r)||[],o=zg(e,t,"",!1,r)||[],i=zg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function lM(t,e){let r=1,n=1,o=q1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=q1(t,r);for(o=H1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=H1(e+1,n)-1;return i=[...i],i.sort(pM),i}function fM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=dM(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=hM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function U1(t,e,r,n){let o=lM(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=fM(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+V1(s.count),a=c+1;continue}r.isPadded&&(d=mM(c,r,n)),l.string=d+l.pattern+V1(l.count),i.push(l),a=c+1,s=l}return i}function zg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!M1(e,"string",s)&&i.push(r+s),n&&M1(e,"string",s)&&i.push(r+s)}return i}function dM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function pM(t,e){return t>e?1:e>t?-1:0}function M1(t,e,r){return t.some(n=>n[e]===r)}function q1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function H1(t,e){return t-t%Math.pow(10,e)}function V1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function hM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function z1(t){return/^-?(0+)\d/.test(t)}function mM(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}jo.cache={};jo.clearCache=()=>jo.cache={};K1.exports=jo});var Wg=S(($J,eO)=>{"use strict";var gM=require("util"),Y1=G1(),W1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),DM=t=>e=>t===!0?Number(e):String(e),Kg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ms=t=>Number.isInteger(+t),Gg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},yM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,bM=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},lf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},wM=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>lf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>lf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},J1=(t,e,r,n)=>{if(r)return Y1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},X1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return Y1(t,e,r)},Z1=(...t)=>new RangeError("Invalid range arguments: "+gM.inspect(...t)),Q1=(t,e,r)=>{if(r.strictRanges===!0)throw Z1([t,e]);return[]},vM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},EM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw Z1([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Gg(s)||Gg(u)||Gg(c),d=l?Math.max(s.length,u.length,c.length):0,p=l===!1&&yM(t,e,n)===!1,h=n.transform||DM(p);if(n.toRegex&&r===1)return J1(lf(t,d),lf(e,d),!0,n);let m={negatives:[],positives:[]},b=C=>m[C<0?"negatives":"positives"].push(Math.abs(C)),D=[],E=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(bM(h(o,E),d,p)),o=a?o-r:o+r,E++;return n.toRegex===!0?r>1?wM(m,n,d):X1(D,null,{wrap:!1,...n}):D},CM=(t,e,r=1,n={})=>{if(!Ms(t)&&t.length>1||!Ms(e)&&e.length>1)return Q1(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return J1(u,c,!1,n);let l=[],d=0;for(;s?i>=a:i<=a;)l.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?X1(l,null,{wrap:!1,options:n}):l},cf=(t,e,r,n={})=>{if(e==null&&Kg(t))return[t];if(!Kg(t)||!Kg(e))return Q1(t,e,n);if(typeof r=="function")return cf(t,e,1,{transform:r});if(W1(r))return cf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Ms(r)?Ms(t)&&Ms(e)?EM(t,e,r,o):CM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!W1(r)?vM(r,o):cf(t,e,1,r)};eO.exports=cf});var nO=S((TJ,rO)=>{"use strict";var _M=Wg(),tO=sf(),SM=(t,e={})=>{let r=(n,o={})=>{let i=tO.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=tO.reduce(n.nodes),d=_M(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};rO.exports=SM});var aO=S((IJ,iO)=>{"use strict";var xM=Wg(),oO=uf(),da=sf(),Uo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?da.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Uo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Uo(o,i,r):o+i);return da.flatten(n)},AM=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(Uo(s.pop(),oO(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Uo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=da.reduce(o.nodes);if(da.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=xM(...d,e);p.length===0&&(p=oO(o,e)),s.push(Uo(s.pop(),p)),o.nodes=[];return}let u=da.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(Uo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(Uo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return da.flatten(n(t))};iO.exports=AM});var uO=S((RJ,sO)=>{"use strict";sO.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
107
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var pO=S((BJ,dO)=>{"use strict";var OM=uf(),{MAX_LENGTH:cO,CHAR_BACKSLASH:Yg,CHAR_BACKTICK:FM,CHAR_COMMA:kM,CHAR_DOT:PM,CHAR_LEFT_PARENTHESES:$M,CHAR_RIGHT_PARENTHESES:TM,CHAR_LEFT_CURLY_BRACE:IM,CHAR_RIGHT_CURLY_BRACE:RM,CHAR_LEFT_SQUARE_BRACKET:lO,CHAR_RIGHT_SQUARE_BRACKET:fO,CHAR_DOUBLE_QUOTE:BM,CHAR_SINGLE_QUOTE:NM,CHAR_NO_BREAK_SPACE:LM,CHAR_ZERO_WIDTH_NOBREAK_SPACE:jM}=uO(),UM=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(cO,r.maxLength):cO;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,d=0,p,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],p=h(),!(p===jM||p===LM)){if(p===Yg){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===fO){m({type:"text",value:"\\"+p});continue}if(p===lO){u++;let b;for(;l<c&&(b=h());){if(p+=b,b===lO){u++;continue}if(b===Yg){p+=h();continue}if(b===fO&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===$M){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===TM){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===BM||p===NM||p===FM){let b=p,D;for(e.keepQuotes!==!0&&(p="");l<c&&(D=h());){if(D===Yg){p+=D+h();continue}if(D===b){e.keepQuotes===!0&&(p+=D);break}p+=D}m({type:"text",value:p});continue}if(p===IM){d++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:p});continue}if(p===RM){if(a.type!=="brace"){m({type:"text",value:p});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:p}),d--,a=i[i.length-1];continue}if(p===kM&&d>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:OM(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===PM&&d>0&&a.commas===0){let b=a.nodes;if(d===0||b.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let D=b[b.length-1];D.value+=s.value+p,s=D,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let b=i[i.length-1],D=b.nodes.indexOf(a);b.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};dO.exports=UM});var gO=S((NJ,mO)=>{"use strict";var hO=uf(),MM=nO(),qM=aO(),HM=pO(),Zt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Zt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Zt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.parse=(t,e={})=>HM(t,e);Zt.stringify=(t,e={})=>hO(typeof t=="string"?Zt.parse(t,e):t,e);Zt.compile=(t,e={})=>(typeof t=="string"&&(t=Zt.parse(t,e)),MM(t,e));Zt.expand=(t,e={})=>{typeof t=="string"&&(t=Zt.parse(t,e));let r=qM(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Zt.compile(t,e):Zt.expand(t,e);mO.exports=Zt});var qs=S((LJ,vO)=>{"use strict";var VM=require("path"),Vr="\\\\/",DO=`[^${Vr}]`,mn="\\.",zM="\\+",KM="\\?",ff="\\/",GM="(?=.)",yO="[^/]",Jg=`(?:${ff}|$)`,bO=`(?:^|${ff})`,Xg=`${mn}{1,2}${Jg}`,WM=`(?!${mn})`,YM=`(?!${bO}${Xg})`,JM=`(?!${mn}{0,1}${Jg})`,XM=`(?!${Xg})`,ZM=`[^.${ff}]`,QM=`${yO}*?`,wO={DOT_LITERAL:mn,PLUS_LITERAL:zM,QMARK_LITERAL:KM,SLASH_LITERAL:ff,ONE_CHAR:GM,QMARK:yO,END_ANCHOR:Jg,DOTS_SLASH:Xg,NO_DOT:WM,NO_DOTS:YM,NO_DOT_SLASH:JM,NO_DOTS_SLASH:XM,QMARK_NO_DOT:ZM,STAR:QM,START_ANCHOR:bO},e9={...wO,SLASH_LITERAL:`[${Vr}]`,QMARK:DO,STAR:`${DO}*?`,DOTS_SLASH:`${mn}{1,2}(?:[${Vr}]|$)`,NO_DOT:`(?!${mn})`,NO_DOTS:`(?!(?:^|[${Vr}])${mn}{1,2}(?:[${Vr}]|$))`,NO_DOT_SLASH:`(?!${mn}{0,1}(?:[${Vr}]|$))`,NO_DOTS_SLASH:`(?!${mn}{1,2}(?:[${Vr}]|$))`,QMARK_NO_DOT:`[^.${Vr}]`,START_ANCHOR:`(?:^|[${Vr}])`,END_ANCHOR:`(?:[${Vr}]|$)`},t9={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};vO.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:t9,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:VM.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?e9:wO}}});var Hs=S(Ht=>{"use strict";var r9=require("path"),n9=process.platform==="win32",{REGEX_BACKSLASH:o9,REGEX_REMOVE_BACKSLASH:i9,REGEX_SPECIAL_CHARS:a9,REGEX_SPECIAL_CHARS_GLOBAL:s9}=qs();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>a9.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(s9,"\\$1");Ht.toPosixSlashes=t=>t.replace(o9,"/");Ht.removeBackslashes=t=>t.replace(i9,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:n9===!0||r9.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var FO=S((UJ,OO)=>{"use strict";var EO=Hs(),{CHAR_ASTERISK:Zg,CHAR_AT:u9,CHAR_BACKWARD_SLASH:Vs,CHAR_COMMA:c9,CHAR_DOT:Qg,CHAR_EXCLAMATION_MARK:eD,CHAR_FORWARD_SLASH:AO,CHAR_LEFT_CURLY_BRACE:tD,CHAR_LEFT_PARENTHESES:rD,CHAR_LEFT_SQUARE_BRACKET:l9,CHAR_PLUS:f9,CHAR_QUESTION_MARK:CO,CHAR_RIGHT_CURLY_BRACE:d9,CHAR_RIGHT_PARENTHESES:_O,CHAR_RIGHT_SQUARE_BRACKET:p9}=qs(),SO=t=>t===AO||t===Vs,xO=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},h9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,d=0,p=!1,h=!1,m=!1,b=!1,D=!1,E=!1,C=!1,g=!1,_=!1,x=!1,$=0,F,B,I={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),j=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=j();let w;if(B===Vs){C=I.backslashes=!0,B=j(),B===tD&&(E=!0);continue}if(E===!0||B===tD){for($++;L()!==!0&&(B=j());){if(B===Vs){C=I.backslashes=!0,j();continue}if(B===tD){$++;continue}if(E!==!0&&B===Qg&&(B=j())===Qg){if(p=I.isBrace=!0,m=I.isGlob=!0,x=!0,o===!0)continue;break}if(E!==!0&&B===c9){if(p=I.isBrace=!0,m=I.isGlob=!0,x=!0,o===!0)continue;break}if(B===d9&&($--,$===0)){E=!1,p=I.isBrace=!0,x=!0;break}}if(o===!0)continue;break}if(B===AO){if(i.push(c),a.push(I),I={value:"",depth:0,isGlob:!1},x===!0)continue;if(F===Qg&&c===l+1){l+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===f9||B===u9||B===Zg||B===CO||B===eD)===!0&&A()===rD){if(m=I.isGlob=!0,b=I.isExtglob=!0,x=!0,B===eD&&c===l&&(_=!0),o===!0){for(;L()!==!0&&(B=j());){if(B===Vs){C=I.backslashes=!0,B=j();continue}if(B===_O){m=I.isGlob=!0,x=!0;break}}continue}break}if(B===Zg){if(F===Zg&&(D=I.isGlobstar=!0),m=I.isGlob=!0,x=!0,o===!0)continue;break}if(B===CO){if(m=I.isGlob=!0,x=!0,o===!0)continue;break}if(B===l9){for(;L()!==!0&&(w=j());){if(w===Vs){C=I.backslashes=!0,j();continue}if(w===p9){h=I.isBracket=!0,m=I.isGlob=!0,x=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===eD&&c===l){g=I.negated=!0,l++;continue}if(r.noparen!==!0&&B===rD){if(m=I.isGlob=!0,o===!0){for(;L()!==!0&&(B=j());){if(B===rD){C=I.backslashes=!0,B=j();continue}if(B===_O){x=!0;break}}continue}break}if(m===!0){if(x=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,J="",k="";l>0&&(J=u.slice(0,l),u=u.slice(l),d-=l),M&&m===!0&&d>0?(M=u.slice(0,d),k=u.slice(d)):m===!0?(M="",k=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&SO(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&(k&&(k=EO.removeBackslashes(k)),M&&C===!0&&(M=EO.removeBackslashes(M)));let y={prefix:J,input:t,start:l,base:M,glob:k,isBrace:p,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(y.maxDepth=0,SO(B)||a.push(I),y.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let O=w?w+1:l,R=i[v],T=t.slice(O,R);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=J):a[v].value=T,xO(a[v]),y.maxDepth+=a[v].depth),(v!==0||T!=="")&&s.push(T),w=R}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,xO(a[a.length-1]),y.maxDepth+=a[a.length-1].depth)}y.slashes=i,y.parts=s}return y};OO.exports=h9});var $O=S((MJ,PO)=>{"use strict";var df=qs(),Qt=Hs(),{MAX_LENGTH:pf,POSIX_REGEX_SOURCE:m9,REGEX_NON_SPECIAL_CHARS:g9,REGEX_SPECIAL_CHARS_BACKREF:D9,REPLACEMENTS:kO}=df,y9=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>Qt.escapeRegex(o)).join("..")}return r},pa=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,nD=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=kO[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(pf,r.maxLength):pf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Qt.isWindows(e),c=df.globChars(u),l=df.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:E,NO_DOTS_SLASH:C,QMARK:g,QMARK_NO_DOT:_,STAR:x,START_ANCHOR:$}=c,F=G=>`(${s}(?:(?!${$}${G.dot?b:d}).)*?)`,B=r.dot?"":D,I=r.dot?g:_,L=r.bash===!0?F(r):x;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=Qt.removePrefix(t,A),o=t.length;let j=[],M=[],J=[],k=i,y,w=()=>A.index===o-1,v=A.peek=(G=1)=>t[A.index+G],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),T=(G="",Ce=0)=>{A.consumed+=G,A.index+=Ce},q=G=>{A.output+=G.output!=null?G.output:G.value,T(G.value)},P=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)O(),A.start++,G++;return G%2===0?!1:(A.negated=!0,A.start++,!0)},N=G=>{A[G]++,J.push(G)},z=G=>{A[G]--,J.pop()},H=G=>{if(k.type==="globstar"){let Ce=A.braces>0&&(G.type==="comma"||G.type==="brace"),V=G.extglob===!0||j.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Ce&&!V&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=L,A.output+=k.output)}if(j.length&&G.type!=="paren"&&(j[j.length-1].inner+=G.value),(G.value||G.output)&&q(G),k&&k.type==="text"&&G.type==="text"){k.value+=G.value,k.output=(k.output||"")+G.value;return}G.prev=k,a.push(G),k=G},se=(G,Ce)=>{let V={...l[Ce],conditions:1,inner:""};V.prev=k,V.parens=A.parens,V.output=A.output;let ue=(r.capture?"(":"")+V.open;N("parens"),H({type:G,value:Ce,output:A.output?"":m}),H({type:"paren",extglob:!0,value:O(),output:ue}),j.push(V)},zt=G=>{let Ce=G.close+(r.capture?")":""),V;if(G.type==="negate"){let ue=L;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ue=F(r)),(ue!==L||w()||/^\)+$/.test(R()))&&(Ce=G.close=`)$))${ue}`),G.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let qe=nD(V,{...e,fastpaths:!1}).output;Ce=G.close=`)${qe})${ue})`}G.prev.type==="bos"&&(A.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:y,output:Ce}),z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Ce=t.replace(D9,(V,ue,qe,Ct,tt,Cf)=>Ct==="\\"?(G=!0,V):Ct==="?"?ue?ue+Ct+(tt?g.repeat(tt.length):""):Cf===0?I+(tt?g.repeat(tt.length):""):g.repeat(qe.length):Ct==="."?d.repeat(qe.length):Ct==="*"?ue?ue+Ct+(tt?L:""):L:ue?V:`\\${V}`);return G===!0&&(r.unescape===!0?Ce=Ce.replace(/\\/g,""):Ce=Ce.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Ce===t&&r.contains===!0?(A.output=t,A):(A.output=Qt.wrapOutput(Ce,A,e),A)}for(;!w();){if(y=O(),y==="\0")continue;if(y==="\\"){let V=v();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){y+="\\",H({type:"text",value:y});continue}let ue=/^\\+/.exec(R()),qe=0;if(ue&&ue[0].length>2&&(qe=ue[0].length,A.index+=qe,qe%2!==0&&(y+="\\")),r.unescape===!0?y=O():y+=O(),A.brackets===0){H({type:"text",value:y});continue}}if(A.brackets>0&&(y!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&y===":"){let V=k.value.slice(1);if(V.includes("[")&&(k.posix=!0,V.includes(":"))){let ue=k.value.lastIndexOf("["),qe=k.value.slice(0,ue),Ct=k.value.slice(ue+2),tt=m9[Ct];if(tt){k.value=qe+tt,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(y==="["&&v()!==":"||y==="-"&&v()==="]")&&(y=`\\${y}`),y==="]"&&(k.value==="["||k.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&k.value==="["&&(y="^"),k.value+=y,q({value:y});continue}if(A.quotes===1&&y!=='"'){y=Qt.escapeRegex(y),k.value+=y,q({value:y});continue}if(y==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:y});continue}if(y==="("){N("parens"),H({type:"paren",value:y});continue}if(y===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(pa("opening","("));let V=j[j.length-1];if(V&&A.parens===V.parens+1){zt(j.pop());continue}H({type:"paren",value:y,output:A.parens?")":"\\)"}),z("parens");continue}if(y==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(pa("closing","]"));y=`\\${y}`}else N("brackets");H({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){H({type:"text",value:y,output:`\\${y}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(pa("opening","["));H({type:"text",value:y,output:`\\${y}`});continue}z("brackets");let V=k.value.slice(1);if(k.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(y=`/${y}`),k.value+=y,q({value:y}),r.literalBrackets===!1||Qt.hasRegexChars(V))continue;let ue=Qt.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=ue,k.value=ue;continue}k.value=`(${s}${ue}|${k.value})`,A.output+=k.value;continue}if(y==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:y,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(V),H(V);continue}if(y==="}"){let V=M[M.length-1];if(r.nobrace===!0||!V){H({type:"text",value:y,output:y});continue}let ue=")";if(V.dots===!0){let qe=a.slice(),Ct=[];for(let tt=qe.length-1;tt>=0&&(a.pop(),qe[tt].type!=="brace");tt--)qe[tt].type!=="dots"&&Ct.unshift(qe[tt].value);ue=y9(Ct,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let qe=A.output.slice(0,V.outputIndex),Ct=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",y=ue="\\}",A.output=qe;for(let tt of Ct)A.output+=tt.output||tt.value}H({type:"brace",value:y,output:ue}),z("braces"),M.pop();continue}if(y==="|"){j.length>0&&j[j.length-1].conditions++,H({type:"text",value:y});continue}if(y===","){let V=y,ue=M[M.length-1];ue&&J[J.length-1]==="braces"&&(ue.comma=!0,V="|"),H({type:"comma",value:y,output:V});continue}if(y==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}H({type:"slash",value:y,output:h});continue}if(y==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let V=M[M.length-1];k.type="dots",k.output+=y,k.value+=y,V.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){H({type:"text",value:y,output:d});continue}H({type:"dot",value:y,output:d});continue}if(y==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",y);continue}if(k&&k.type==="paren"){let ue=v(),qe=y;if(ue==="<"&&!Qt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(R()))&&(qe=`\\${y}`),H({type:"text",value:y,output:qe});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){H({type:"qmark",value:y,output:_});continue}H({type:"qmark",value:y,output:g});continue}if(y==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",y);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(y==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",y);continue}if(k&&k.value==="("||r.regex===!1){H({type:"plus",value:y,output:p});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){H({type:"plus",value:y});continue}H({type:"plus",value:p});continue}if(y==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){H({type:"at",extglob:!0,value:y,output:""});continue}H({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let V=g9.exec(R());V&&(y+=V[0],A.index+=V[0].length),H({type:"text",value:y});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=y,k.output=L,A.backtrack=!0,A.globstar=!0,T(y);continue}let G=R();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",y);continue}if(k.type==="star"){if(r.noglobstar===!0){T(y);continue}let V=k.prev,ue=V.prev,qe=V.type==="slash"||V.type==="bos",Ct=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!qe||G[0]&&G[0]!=="/")){H({type:"star",value:y,output:""});continue}let tt=A.braces>0&&(V.type==="comma"||V.type==="brace"),Cf=j.length&&(V.type==="pipe"||V.type==="paren");if(!qe&&V.type!=="paren"&&!tt&&!Cf){H({type:"star",value:y,output:""});continue}for(;G.slice(0,3)==="/**";){let Ys=t[A.index+4];if(Ys&&Ys!=="/")break;G=G.slice(3),T("/**",3)}if(V.type==="bos"&&w()){k.type="globstar",k.value+=y,k.output=F(r),A.output=k.output,A.globstar=!0,T(y);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!Ct&&w()){A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=F(r)+(r.strictSlashes?")":"|$)"),k.value+=y,A.globstar=!0,A.output+=V.output+k.output,T(y);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&G[0]==="/"){let Ys=G[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=`${F(r)}${h}|${h}${Ys})`,k.value+=y,A.output+=V.output+k.output,A.globstar=!0,T(y+O()),H({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&G[0]==="/"){k.type="globstar",k.value+=y,k.output=`(?:^|${h}|${F(r)}${h})`,A.output=k.output,A.globstar=!0,T(y+O()),H({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=F(r),k.value+=y,A.output+=k.output,A.globstar=!0,T(y);continue}let Ce={type:"star",value:y,output:L};if(r.bash===!0){Ce.output=".*?",(k.type==="bos"||k.type==="slash")&&(Ce.output=B+Ce.output),H(Ce);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Ce.output=y,H(Ce);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=E,k.output+=E):r.dot===!0?(A.output+=C,k.output+=C):(A.output+=B,k.output+=B),v()!=="*"&&(A.output+=m,k.output+=m)),H(Ce)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing","]"));A.output=Qt.escapeLast(A.output,"["),z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing",")"));A.output=Qt.escapeLast(A.output,"("),z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing","}"));A.output=Qt.escapeLast(A.output,"{"),z("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let G of A.tokens)A.output+=G.output!=null?G.output:G.value,G.suffix&&(A.output+=G.suffix)}return A};nD.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(pf,r.maxLength):pf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=kO[t]||t;let i=Qt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=df.globChars(i),b=r.dot?d:l,D=r.dot?p:l,E=r.capture?"":"?:",C={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${E}(?:(?!${m}${B.dot?c:a}).)*?)`,x=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${D}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let I=/^(.*?)\.(\w+)$/.exec(B);if(!I)return;let L=x(I[1]);return L?L+a+I[2]:void 0}}},$=Qt.removePrefix(t,C),F=x($);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};PO.exports=nD});var IO=S((qJ,TO)=>{"use strict";var b9=require("path"),w9=FO(),oD=$O(),iD=Hs(),v9=qs(),E9=t=>t&&typeof t=="object"&&!Array.isArray(t),Qe=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(p=>Qe(p,e,r));return p=>{for(let h of l){let m=h(p);if(m)return m}return!1}}let n=E9(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=iD.isWindows(e),a=n?Qe.compileRe(t,e):Qe.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Qe(o.ignore,l,r)}let c=(l,d=!1)=>{let{isMatch:p,match:h,output:m}=Qe.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(b),p===!1?(b.isMatch=!1,d?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,d?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),d?b:!0)};return r&&(c.state=s),c};Qe.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?iD.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=Qe.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};Qe.matchBase=(t,e,r,n=iD.isWindows(r))=>(e instanceof RegExp?e:Qe.makeRe(e,r)).test(b9.basename(t));Qe.isMatch=(t,e,r)=>Qe(e,r)(t);Qe.parse=(t,e)=>Array.isArray(t)?t.map(r=>Qe.parse(r,e)):oD(t,{...e,fastpaths:!1});Qe.scan=(t,e)=>w9(t,e);Qe.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=Qe.toRegex(s,e);return n===!0&&(u.state=t),u};Qe.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=oD.fastpaths(t,e)),o.output||(o=oD(t,e)),Qe.compileRe(o,e,r,n)};Qe.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};Qe.constants=v9;TO.exports=Qe});var BO=S((HJ,RO)=>{"use strict";RO.exports=IO()});var qO=S((VJ,MO)=>{"use strict";var LO=require("util"),jO=gO(),zr=BO(),aD=Hs(),NO=t=>t===""||t==="./",UO=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=zr(String(e[l]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>zr(t,e);Le.isMatch=(t,e,r)=>zr(e,r)(t);Le.any=Le.isMatch;Le.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${LO.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(NO(t)||NO(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!aD.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=zr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=zr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${LO.inspect(t)}"`);return[].concat(e).every(n=>zr(n,r)(t))};Le.capture=(t,e,r)=>{let n=aD.isWindows(r),i=zr.makeRe(String(t),{...r,capture:!0}).exec(n?aD.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>zr.makeRe(...t);Le.scan=(...t)=>zr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of jO(String(n),e))r.push(zr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!UO(t)?[t]:jO(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=UO;MO.exports=Le});var xF=S((qX,gn)=>{var $e=require("fs"),yf=require("os"),Dt=require("path"),cF=require("crypto"),Gr={fs:$e.constants,os:yf.constants},lF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",hF=/XXXXXX/,Y9=3,mF=(Gr.O_CREAT||Gr.fs.O_CREAT)|(Gr.O_EXCL||Gr.fs.O_EXCL)|(Gr.O_RDWR||Gr.fs.O_RDWR),J9=yf.platform()==="win32",X9=Gr.EBADF||Gr.os.errno.EBADF,Z9=Gr.ENOENT||Gr.os.errno.ENOENT,gF=448,DF=384,Q9="exit",ma=[],yF=$e.rmdirSync.bind($e),bF=!1;function e7(t,e){return $e.rm(t,{recursive:!0},e)}function wF(t){return $e.rmSync(t,{recursive:!0})}function dD(t,e){let r=ga(t,e),n=r[0],o=r[1];l7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=EF(a);$e.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function pD(t){let e=ga(t),r=e[0],n=f7(r),o=n.tries;do{let i=EF(n);try{$e.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function t7(t,e){let r=ga(t,e),n=r[0],o=r[1];dD(n,function(a,s){if(a)return o(a);$e.open(s,mF,n.mode||DF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(p){return o(p,s,void 0,lD(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,l,lD(s,d?-1:l,n,!1))}})})}function r7(t){let e=ga(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=pD(r),i=$e.openSync(o,mF,r.mode||DF);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:lD(o,n?-1:i,r,!0)}}function n7(t,e){let r=ga(t,e),n=r[0],o=r[1];dD(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||gF,function(c){if(c)return o(c);o(null,s,vF(s,n,!1))})})}function o7(t){let e=ga(t),r=e[0],n=pD(r);return $e.mkdirSync(n,r.mode||gF),{name:n,removeCallback:vF(n,r,!0)}}function i7(t,e){let r=function(n){if(n&&!fD(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function a7(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!d7(r)&&!fD(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){fD(r)||(e=r)}}if(e!==null)throw e}function lD(t,e,r,n){let o=Df(a7,[e,t],n),i=Df(i7,[e,t],n,o);return r.keep||ma.unshift(o),n?o:i}function vF(t,e,r){let n=e.unsafeCleanup?e7:$e.rmdir.bind($e),o=e.unsafeCleanup?wF:yF,i=Df(o,t,r),a=Df(n,t,r,i);return e.keep||ma.unshift(i),r?i:a}function Df(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ma.indexOf(s);return u>=0&&ma.splice(u,1),o=!0,r||t===yF||t===wF?t(e):t(e,a||function(){})}}}function s7(){if(bF)for(;ma.length;)try{ma[0]()}catch{}}function fF(t){let e=[],r=null;try{r=cF.randomBytes(t)}catch{r=cF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(lF[r[n]%lF.length]);return e.join("")}function er(t){return typeof t>"u"}function ga(t,e){if(typeof t=="function")return[{},t];if(er(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function u7(t,e,r){let n=Dt.isAbsolute(t)?t:Dt.join(e,t);$e.stat(n,function(o){o?$e.realpath(Dt.dirname(n),function(i,a){if(i)return r(i);r(null,Dt.join(a,Dt.basename(n)))}):$e.realpath(n,r)})}function c7(t,e){let r=Dt.isAbsolute(t)?t:Dt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(Dt.dirname(r));return Dt.join(o,Dt.basename(r))}}function EF(t){let e=t.tmpdir;if(!er(t.name))return Dt.join(e,t.dir,t.name);if(!er(t.template))return Dt.join(e,t.dir,t.template).replace(hF,fF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",fF(12),t.postfix?"-"+t.postfix:""].join("");return Dt.join(e,t.dir,r)}function CF(t){if(!er(t.name)){let e=t.name;if(Dt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=Dt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!er(t.template)&&!t.template.match(hF))throw new Error(`Invalid template, found "${t.template}".`);if(!er(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=er(t.name)?t.tries||Y9:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=er(t.prefix)?"":t.prefix,t.postfix=er(t.postfix)?"":t.postfix}function dF(t,e,r,n){if(er(e))return n(null);u7(e,r,function(o,i){if(o)return n(o);let a=Dt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function pF(t,e,r){if(er(e))return;let n=c7(e,r),o=Dt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function l7(t,e){h7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{CF(t,n)}catch(o){return e(o)}dF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=er(i)?"":i,dF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function f7(t){let e=t.tmpdir=SF(t);CF(t,e);let r=pF("dir",t.dir,e);return t.dir=er(r)?"":r,t.template=pF("template",t.template,e),t}function d7(t){return _F(t,-X9,"EBADF")}function fD(t){return _F(t,-Z9,"ENOENT")}function _F(t,e,r){return J9?t.code===r:t.code===r&&t.errno===e}function p7(){bF=!0}function h7(t,e){return $e.realpath(t&&t.tmpdir||yf.tmpdir(),e)}function SF(t){return $e.realpathSync(t&&t.tmpdir||yf.tmpdir())}process.addListener(Q9,s7);Object.defineProperty(gn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return SF()}});gn.exports.dir=n7;gn.exports.dirSync=o7;gn.exports.file=t7;gn.exports.fileSync=r7;gn.exports.tmpName=dD;gn.exports.tmpNameSync=pD;gn.exports.setGracefulCleanup=p7});var vf=require("node:process");var ND=de(BD(),1),{program:ot,createCommand:W7,createArgument:Y7,createOption:J7,CommanderError:X7,InvalidArgumentError:Z7,InvalidOptionArgumentError:Q7,Command:eq,Argument:tq,Option:rq,Help:nq}=ND.default;var gr={name:"@capgo/cli",version:"7.41.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var aa=require("node:fs");var yt=de(qf(),1),Ho=require("node:process"),yn=de(require("node:readline"),1),Gf=de(require("node:readline"),1),WD=require("node:stream"),YD=de(Vf(),1);function l2({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var f2=l2();function JD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(f2,"")}function XD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ZD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],d=e.length(l);if(s>=o-(d==2?1:0))if(s+d<=i)a+=l;else break;s+=d}return a}})(ZD);var d2=ZD.exports,p2=XD(d2),h2=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},m2=XD(h2);function wa(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=JD(t),t.length===0))return 0;t=t.replace(m2()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(p2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var zf=10,MD=(t=0)=>e=>`\x1B[${e+t}m`,qD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,HD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(je.modifier);var g2=Object.keys(je.color),D2=Object.keys(je.bgColor);[...g2,...D2];function y2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=MD(),je.color.ansi256=qD(),je.color.ansi16m=HD(),je.bgColor.ansi=MD(zf),je.bgColor.ansi256=qD(zf),je.bgColor.ansi16m=HD(zf),Object.defineProperties(je,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>je.rgbToAnsi256(...je.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var b2=y2(),su=new Set(["\x1B","\x9B"]),w2=39,Yf="\x07",QD="[",v2="]",ey="m",Jf=`${v2}8;;`,VD=t=>`${su.values().next().value}${QD}${t}${ey}`,zD=t=>`${su.values().next().value}${Jf}${t}${Yf}`,E2=t=>t.split(" ").map(e=>wa(e)),Kf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=wa(JD(t[t.length-1]));for(let[s,u]of n.entries()){let c=wa(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),su.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Jf)),o){i?u===Yf&&(o=!1,i=!1):u===ey&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},C2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(wa(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},_2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=E2(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=wa(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Kf(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Kf(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Kf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>C2(c)));let u=[...s.join(`
108
- `)];for(let[c,l]of u.entries()){if(n+=l,su.has(l)){let{groups:p}=new RegExp(`(?:\\${QD}(?<code>\\d+)m|\\${Jf}(?<uri>.*)${Yf})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===w2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=b2.codes.get(Number(o));u[c+1]===`
109
- `?(i&&(n+=zD("")),o&&d&&(n+=VD(d))):l===`
110
- `&&(o&&d&&(n+=VD(o)),i&&(n+=zD(i)))}return n};function KD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
105
+ `}});function y5(){try{return ig.default.statSync("/.dockerenv"),!0}catch{return!1}}function D5(){try{return ig.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function ag(){return og===void 0&&(og=y5()||D5()),og}var ig,og,Nx=Xe(()=>{ig=ue(require("node:fs"),1)});function Zi(){return sg===void 0&&(sg=b5()||ag()),sg}var Lx,sg,b5,ug=Xe(()=>{Lx=ue(require("node:fs"),1);Nx();b5=()=>{try{return Lx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var cg,Ux,Mx,jx,cn,lg=Xe(()=>{cg=ue(require("node:process"),1),Ux=ue(require("node:os"),1),Mx=ue(require("node:fs"),1);ug();jx=()=>{if(cg.default.platform!=="linux")return!1;if(Ux.default.release().toLowerCase().includes("microsoft"))return!Zi();try{return Mx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Zi():!1}catch{return!1}},cn=cg.default.env.__IS_WSL_TEST__?jx:jx()});var fg,qx,Hx,Vx,w5,dg,Wt,pg=Xe(()=>{fg=ue(require("node:process"),1),qx=require("node:buffer"),Hx=require("node:util"),Vx=ue(require("node:child_process"),1),w5=(0,Hx.promisify)(Vx.default.execFile),dg=()=>`${fg.default.env.SYSTEMROOT||fg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Wt=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=Wt.encodeCommand(t);return w5(r??dg(),[...Wt.argumentsPrefix,o],{encoding:"utf8",...n})};Wt.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Wt.encodeCommand=t=>qx.Buffer.from(t,"utf16le").toString("base64");Wt.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var Kx,Gx,Fo,v5,C5,E5,$l,zx,Wx,Yx,Jx,Xx=Xe(()=>{Kx=require("node:util"),Gx=ue(require("node:child_process"),1),Fo=ue(require("node:fs/promises"),1);lg();pg();lg();v5=(0,Kx.promisify)(Gx.default.execFile),C5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Fo.default.access(r,Fo.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Fo.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),E5=async()=>`${await C5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,$l=cn?E5:dg,Wx=async()=>(zx??=(async()=>{try{let t=await $l();return await Fo.default.access(t,Fo.constants.X_OK),!0}catch{return!1}})(),zx),Yx=async()=>{let t=await $l(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await Wt(e,{powerShellPath:t});return r.trim()},Jx=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await v5("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function ko(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var Zx=Xe(()=>{});async function hg(){if(eA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await _5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var Qx,eA,tA,_5,rA=Xe(()=>{Qx=require("node:util"),eA=ue(require("node:process"),1),tA=require("node:child_process"),_5=(0,Qx.promisify)(tA.execFile)});async function iA(t,{humanReadableOutput:e=!0,signal:r}={}){if(nA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await S5("osascript",["-e",t,n],o);return i.trim()}var nA,oA,mg,S5,aA=Xe(()=>{nA=ue(require("node:process"),1),oA=require("node:util"),mg=require("node:child_process"),S5=(0,oA.promisify)(mg.execFile)});async function gg(t){return iA(`tell application "Finder" to set app_path to application file id "${t}" as string
106
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var sA=Xe(()=>{aA()});async function Dg(t=x5){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new Il(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=lA[n];if(!o)throw new Il(`Unknown browser ID: ${n}`);return o}var uA,cA,x5,lA,yg,Il,bg=Xe(()=>{uA=require("node:util"),cA=require("node:child_process"),x5=(0,uA.promisify)(cA.execFile),lA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},yg=new Map(Object.entries(lA)),Il=class extends Error{}});async function wg(){if(Tl.default.platform==="darwin"){let t=await hg();return{name:await gg(t),id:t}}if(Tl.default.platform==="linux"){let{stdout:t}=await A5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:O5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Tl.default.platform==="win32")return Dg();throw new Error("Only macOS, Linux, and Windows are supported")}var fA,Tl,dA,A5,O5,pA=Xe(()=>{fA=require("node:util"),Tl=ue(require("node:process"),1),dA=require("node:child_process");rA();sA();bg();bg();A5=(0,fA.promisify)(dA.execFile),O5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Rl,F5,hA,mA=Xe(()=>{Rl=ue(require("node:process"),1),F5=!!(Rl.default.env.SSH_CONNECTION||Rl.default.env.SSH_CLIENT||Rl.default.env.SSH_TTY),hA=F5});var _g={};Yr(_g,{apps:()=>Po,default:()=>$5,openApp:()=>P5});function bA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[yA]:e}=t;if(!e)throw new Error(`${yA} is not supported`);return e}function Fs({[Qi]:t},{wsl:e}={}){if(e&&cn)return bA(e);if(!t)throw new Error(`${Qi} is not supported`);return bA(t)}var Cg,Eg,vA,CA,Nl,wA,Bl,vg,gA,Qi,yA,DA,Os,k5,P5,Po,$5,Sg=Xe(()=>{Cg=ue(require("node:process"),1),Eg=ue(require("node:path"),1),vA=require("node:url"),CA=ue(require("node:child_process"),1),Nl=ue(require("node:fs/promises"),1);Xx();pg();Zx();pA();ug();mA();wA={},Bl=Symbol("fallbackAttempt"),vg=wA.url?Eg.default.dirname((0,vA.fileURLToPath)(wA.url)):"",gA=Eg.default.join(vg,"xdg-open"),{platform:Qi,arch:yA}=Cg.default,DA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Os=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Bl]===!0;if(delete t[Bl],Array.isArray(t.app))return DA(t.app,c=>Os({...t,app:c,[Bl]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return DA(r,c=>Os({...t,app:{name:c,arguments:n},[Bl]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(cn){let p=await Yx();d=yg.get(p)??{}}else d=await wg();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[p])}return Os({...t,app:{name:Po[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(cn&&!Zi()&&!hA&&!r&&(s=await Wx()),Qi==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(Qi==="win32"||s){o=await $l(),i.push(...Wt.argumentsPrefix),cn||(a.windowsVerbatimArguments=!0),cn&&t.target&&(t.target=await Jx(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Wt.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Wt.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Wt.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Wt.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!vg||vg==="/",l=!1;try{await Nl.default.access(gA,Nl.constants.X_OK),l=!0}catch{}o=Cg.default.versions.electron??(Qi==="android"||c||!l)?"xdg-open":gA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}Qi==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=CA.default.spawn(o,i,a);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){l(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",l),d!==0){l(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},k5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Os({...e,target:t})},P5=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return Os({...e,app:{name:t,arguments:r}})};Po={browser:"browser",browserPrivate:"browserPrivate"};ko(Po,"chrome",()=>Fs({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ko(Po,"brave",()=>Fs({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ko(Po,"firefox",()=>Fs({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ko(Po,"edge",()=>Fs({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ko(Po,"safari",()=>Fs({darwin:"Safari"}));$5=k5});var ff=S(hr=>{"use strict";hr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;hr.find=(t,e)=>t.nodes.find(r=>r.type===e);hr.exceedsLimit=(t,e,r=1,n)=>n===!1||!hr.isInteger(t)||!hr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;hr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};hr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;hr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;hr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;hr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);hr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var df=S((JJ,Z1)=>{"use strict";var X1=ff();Z1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&X1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&X1.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var eO=S((XJ,Q1)=>{"use strict";Q1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var cO=S((ZJ,uO)=>{"use strict";var tO=eO(),Mo=(t,e,r)=>{if(tO(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(tO(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Mo.cache.hasOwnProperty(u))return Mo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let d=sO(t)||sO(e),p={min:t,max:e,a:c,b:l},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let b=l<0?Math.abs(l):1;m=rO(b,Math.abs(c),p,n),c=p.a=0}return l>=0&&(h=rO(c,l,p,n)),p.negatives=m,p.positives=h,p.result=SM(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Mo.cache[u]=p,p.result};function SM(t,e,r){let n=Jg(t,e,"-",!1,r)||[],o=Jg(e,t,"",!1,r)||[],i=Jg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function xM(t,e){let r=1,n=1,o=oO(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=oO(t,r);for(o=iO(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=iO(e+1,n)-1;return i=[...i],i.sort(FM),i}function AM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=OM(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=kM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function rO(t,e,r,n){let o=xM(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=AM(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+aO(s.count),a=c+1;continue}r.isPadded&&(d=PM(c,r,n)),l.string=d+l.pattern+aO(l.count),i.push(l),a=c+1,s=l}return i}function Jg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!nO(e,"string",s)&&i.push(r+s),n&&nO(e,"string",s)&&i.push(r+s)}return i}function OM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function FM(t,e){return t>e?1:e>t?-1:0}function nO(t,e,r){return t.some(n=>n[e]===r)}function oO(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function iO(t,e){return t-t%Math.pow(10,e)}function aO(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function kM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function sO(t){return/^-?(0+)\d/.test(t)}function PM(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Mo.cache={};Mo.clearCache=()=>Mo.cache={};uO.exports=Mo});var Qg=S((QJ,gO)=>{"use strict";var $M=require("util"),fO=cO(),lO=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),IM=t=>e=>t===!0?Number(e):String(e),Xg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Hs=t=>Number.isInteger(+t),Zg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},TM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,RM=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},hf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},BM=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>hf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>hf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},dO=(t,e,r,n)=>{if(r)return fO(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},pO=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return fO(t,e,r)},hO=(...t)=>new RangeError("Invalid range arguments: "+$M.inspect(...t)),mO=(t,e,r)=>{if(r.strictRanges===!0)throw hO([t,e]);return[]},NM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},LM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw hO([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Zg(s)||Zg(u)||Zg(c),d=l?Math.max(s.length,u.length,c.length):0,p=l===!1&&TM(t,e,n)===!1,h=n.transform||IM(p);if(n.toRegex&&r===1)return dO(hf(t,d),hf(e,d),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),y=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):y.push(RM(h(o,C),d,p)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?BM(m,n,d):pO(y,null,{wrap:!1,...n}):y},jM=(t,e,r=1,n={})=>{if(!Hs(t)&&t.length>1||!Hs(e)&&e.length>1)return mO(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return dO(u,c,!1,n);let l=[],d=0;for(;s?i>=a:i<=a;)l.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?pO(l,null,{wrap:!1,options:n}):l},pf=(t,e,r,n={})=>{if(e==null&&Xg(t))return[t];if(!Xg(t)||!Xg(e))return mO(t,e,n);if(typeof r=="function")return pf(t,e,1,{transform:r});if(lO(r))return pf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Hs(r)?Hs(t)&&Hs(e)?LM(t,e,r,o):jM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!lO(r)?NM(r,o):pf(t,e,1,r)};gO.exports=pf});var bO=S((eX,DO)=>{"use strict";var UM=Qg(),yO=ff(),MM=(t,e={})=>{let r=(n,o={})=>{let i=yO.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=yO.reduce(n.nodes),d=UM(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};DO.exports=MM});var CO=S((tX,vO)=>{"use strict";var qM=Qg(),wO=df(),ha=ff(),qo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ha.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(qo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?qo(o,i,r):o+i);return ha.flatten(n)},HM=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(qo(s.pop(),wO(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(qo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ha.reduce(o.nodes);if(ha.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=qM(...d,e);p.length===0&&(p=wO(o,e)),s.push(qo(s.pop(),p)),o.nodes=[];return}let u=ha.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(qo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(qo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ha.flatten(n(t))};vO.exports=HM});var _O=S((rX,EO)=>{"use strict";EO.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
107
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var FO=S((nX,OO)=>{"use strict";var VM=df(),{MAX_LENGTH:SO,CHAR_BACKSLASH:ey,CHAR_BACKTICK:zM,CHAR_COMMA:KM,CHAR_DOT:GM,CHAR_LEFT_PARENTHESES:WM,CHAR_RIGHT_PARENTHESES:YM,CHAR_LEFT_CURLY_BRACE:JM,CHAR_RIGHT_CURLY_BRACE:XM,CHAR_LEFT_SQUARE_BRACKET:xO,CHAR_RIGHT_SQUARE_BRACKET:AO,CHAR_DOUBLE_QUOTE:ZM,CHAR_SINGLE_QUOTE:QM,CHAR_NO_BREAK_SPACE:e9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:t9}=_O(),r9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(SO,r.maxLength):SO;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,d=0,p,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],p=h(),!(p===t9||p===e9)){if(p===ey){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===AO){m({type:"text",value:"\\"+p});continue}if(p===xO){u++;let b;for(;l<c&&(b=h());){if(p+=b,b===xO){u++;continue}if(b===ey){p+=h();continue}if(b===AO&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===WM){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===YM){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===ZM||p===QM||p===zM){let b=p,y;for(e.keepQuotes!==!0&&(p="");l<c&&(y=h());){if(y===ey){p+=y+h();continue}if(y===b){e.keepQuotes===!0&&(p+=y);break}p+=y}m({type:"text",value:p});continue}if(p===JM){d++;let y={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(y),i.push(a),m({type:"open",value:p});continue}if(p===XM){if(a.type!=="brace"){m({type:"text",value:p});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:p}),d--,a=i[i.length-1];continue}if(p===KM&&d>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:VM(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===GM&&d>0&&a.commas===0){let b=a.nodes;if(d===0||b.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let y=b[b.length-1];y.value+=s.value+p,s=y,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],y=b.nodes.indexOf(a);b.nodes.splice(y,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};OO.exports=r9});var $O=S((oX,PO)=>{"use strict";var kO=df(),n9=bO(),o9=CO(),i9=FO(),Qt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Qt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Qt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Qt.parse=(t,e={})=>i9(t,e);Qt.stringify=(t,e={})=>kO(typeof t=="string"?Qt.parse(t,e):t,e);Qt.compile=(t,e={})=>(typeof t=="string"&&(t=Qt.parse(t,e)),n9(t,e));Qt.expand=(t,e={})=>{typeof t=="string"&&(t=Qt.parse(t,e));let r=o9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Qt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Qt.compile(t,e):Qt.expand(t,e);PO.exports=Qt});var Vs=S((iX,NO)=>{"use strict";var a9=require("path"),zr="\\\\/",IO=`[^${zr}]`,yn="\\.",s9="\\+",u9="\\?",mf="\\/",c9="(?=.)",TO="[^/]",ty=`(?:${mf}|$)`,RO=`(?:^|${mf})`,ry=`${yn}{1,2}${ty}`,l9=`(?!${yn})`,f9=`(?!${RO}${ry})`,d9=`(?!${yn}{0,1}${ty})`,p9=`(?!${ry})`,h9=`[^.${mf}]`,m9=`${TO}*?`,BO={DOT_LITERAL:yn,PLUS_LITERAL:s9,QMARK_LITERAL:u9,SLASH_LITERAL:mf,ONE_CHAR:c9,QMARK:TO,END_ANCHOR:ty,DOTS_SLASH:ry,NO_DOT:l9,NO_DOTS:f9,NO_DOT_SLASH:d9,NO_DOTS_SLASH:p9,QMARK_NO_DOT:h9,STAR:m9,START_ANCHOR:RO},g9={...BO,SLASH_LITERAL:`[${zr}]`,QMARK:IO,STAR:`${IO}*?`,DOTS_SLASH:`${yn}{1,2}(?:[${zr}]|$)`,NO_DOT:`(?!${yn})`,NO_DOTS:`(?!(?:^|[${zr}])${yn}{1,2}(?:[${zr}]|$))`,NO_DOT_SLASH:`(?!${yn}{0,1}(?:[${zr}]|$))`,NO_DOTS_SLASH:`(?!${yn}{1,2}(?:[${zr}]|$))`,QMARK_NO_DOT:`[^.${zr}]`,START_ANCHOR:`(?:^|[${zr}])`,END_ANCHOR:`(?:[${zr}]|$)`},y9={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};NO.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y9,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:a9.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?g9:BO}}});var zs=S(Ht=>{"use strict";var D9=require("path"),b9=process.platform==="win32",{REGEX_BACKSLASH:w9,REGEX_REMOVE_BACKSLASH:v9,REGEX_SPECIAL_CHARS:C9,REGEX_SPECIAL_CHARS_GLOBAL:E9}=Vs();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>C9.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(E9,"\\$1");Ht.toPosixSlashes=t=>t.replace(w9,"/");Ht.removeBackslashes=t=>t.replace(v9,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:b9===!0||D9.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var zO=S((sX,VO)=>{"use strict";var LO=zs(),{CHAR_ASTERISK:ny,CHAR_AT:_9,CHAR_BACKWARD_SLASH:Ks,CHAR_COMMA:S9,CHAR_DOT:oy,CHAR_EXCLAMATION_MARK:iy,CHAR_FORWARD_SLASH:HO,CHAR_LEFT_CURLY_BRACE:ay,CHAR_LEFT_PARENTHESES:sy,CHAR_LEFT_SQUARE_BRACKET:x9,CHAR_PLUS:A9,CHAR_QUESTION_MARK:jO,CHAR_RIGHT_CURLY_BRACE:O9,CHAR_RIGHT_PARENTHESES:UO,CHAR_RIGHT_SQUARE_BRACKET:F9}=Vs(),MO=t=>t===HO||t===Ks,qO=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},k9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,d=0,p=!1,h=!1,m=!1,b=!1,y=!1,C=!1,E=!1,g=!1,_=!1,x=!1,$=0,F,B,T={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),j=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=j();let w;if(B===Ks){E=T.backslashes=!0,B=j(),B===ay&&(C=!0);continue}if(C===!0||B===ay){for($++;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,j();continue}if(B===ay){$++;continue}if(C!==!0&&B===oy&&(B=j())===oy){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(C!==!0&&B===S9){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===O9&&($--,$===0)){C=!1,p=T.isBrace=!0,x=!0;break}}if(o===!0)continue;break}if(B===HO){if(i.push(c),a.push(T),T={value:"",depth:0,isGlob:!1},x===!0)continue;if(F===oy&&c===l+1){l+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===A9||B===_9||B===ny||B===jO||B===iy)===!0&&A()===sy){if(m=T.isGlob=!0,b=T.isExtglob=!0,x=!0,B===iy&&c===l&&(_=!0),o===!0){for(;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,B=j();continue}if(B===UO){m=T.isGlob=!0,x=!0;break}}continue}break}if(B===ny){if(F===ny&&(y=T.isGlobstar=!0),m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===jO){if(m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===x9){for(;L()!==!0&&(w=j());){if(w===Ks){E=T.backslashes=!0,j();continue}if(w===F9){h=T.isBracket=!0,m=T.isGlob=!0,x=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===iy&&c===l){g=T.negated=!0,l++;continue}if(r.noparen!==!0&&B===sy){if(m=T.isGlob=!0,o===!0){for(;L()!==!0&&(B=j());){if(B===sy){E=T.backslashes=!0,B=j();continue}if(B===UO){x=!0;break}}continue}break}if(m===!0){if(x=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,J="",k="";l>0&&(J=u.slice(0,l),u=u.slice(l),d-=l),M&&m===!0&&d>0?(M=u.slice(0,d),k=u.slice(d)):m===!0?(M="",k=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&MO(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&(k&&(k=LO.removeBackslashes(k)),M&&E===!0&&(M=LO.removeBackslashes(M)));let D={prefix:J,input:t,start:l,base:M,glob:k,isBrace:p,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:y,negated:g,negatedExtglob:_};if(r.tokens===!0&&(D.maxDepth=0,MO(B)||a.push(T),D.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let O=w?w+1:l,R=i[v],I=t.slice(O,R);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=J):a[v].value=I,qO(a[v]),D.maxDepth+=a[v].depth),(v!==0||I!=="")&&s.push(I),w=R}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,qO(a[a.length-1]),D.maxDepth+=a[a.length-1].depth)}D.slashes=i,D.parts=s}return D};VO.exports=k9});var WO=S((uX,GO)=>{"use strict";var gf=Vs(),er=zs(),{MAX_LENGTH:yf,POSIX_REGEX_SOURCE:P9,REGEX_NON_SPECIAL_CHARS:$9,REGEX_SPECIAL_CHARS_BACKREF:I9,REPLACEMENTS:KO}=gf,T9=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>er.escapeRegex(o)).join("..")}return r},ma=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,uy=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KO[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=er.isWindows(e),c=gf.globChars(u),l=gf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:y,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:x,START_ANCHOR:$}=c,F=G=>`(${s}(?:(?!${$}${G.dot?b:d}).)*?)`,B=r.dot?"":y,T=r.dot?g:_,L=r.bash===!0?F(r):x;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=er.removePrefix(t,A),o=t.length;let j=[],M=[],J=[],k=i,D,w=()=>A.index===o-1,v=A.peek=(G=1)=>t[A.index+G],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),I=(G="",Ee=0)=>{A.consumed+=G,A.index+=Ee},q=G=>{A.output+=G.output!=null?G.output:G.value,I(G.value)},P=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)O(),A.start++,G++;return G%2===0?!1:(A.negated=!0,A.start++,!0)},N=G=>{A[G]++,J.push(G)},z=G=>{A[G]--,J.pop()},H=G=>{if(k.type==="globstar"){let Ee=A.braces>0&&(G.type==="comma"||G.type==="brace"),V=G.extglob===!0||j.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Ee&&!V&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=L,A.output+=k.output)}if(j.length&&G.type!=="paren"&&(j[j.length-1].inner+=G.value),(G.value||G.output)&&q(G),k&&k.type==="text"&&G.type==="text"){k.value+=G.value,k.output=(k.output||"")+G.value;return}G.prev=k,a.push(G),k=G},se=(G,Ee)=>{let V={...l[Ee],conditions:1,inner:""};V.prev=k,V.parens=A.parens,V.output=A.output;let ce=(r.capture?"(":"")+V.open;N("parens"),H({type:G,value:Ee,output:A.output?"":m}),H({type:"paren",extglob:!0,value:O(),output:ce}),j.push(V)},zt=G=>{let Ee=G.close+(r.capture?")":""),V;if(G.type==="negate"){let ce=L;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ce=F(r)),(ce!==L||w()||/^\)+$/.test(R()))&&(Ee=G.close=`)$))${ce}`),G.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let qe=uy(V,{...e,fastpaths:!1}).output;Ee=G.close=`)${qe})${ce})`}G.prev.type==="bos"&&(A.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:D,output:Ee}),z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Ee=t.replace(I9,(V,ce,qe,Et,rt,Af)=>Et==="\\"?(G=!0,V):Et==="?"?ce?ce+Et+(rt?g.repeat(rt.length):""):Af===0?T+(rt?g.repeat(rt.length):""):g.repeat(qe.length):Et==="."?d.repeat(qe.length):Et==="*"?ce?ce+Et+(rt?L:""):L:ce?V:`\\${V}`);return G===!0&&(r.unescape===!0?Ee=Ee.replace(/\\/g,""):Ee=Ee.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Ee===t&&r.contains===!0?(A.output=t,A):(A.output=er.wrapOutput(Ee,A,e),A)}for(;!w();){if(D=O(),D==="\0")continue;if(D==="\\"){let V=v();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){D+="\\",H({type:"text",value:D});continue}let ce=/^\\+/.exec(R()),qe=0;if(ce&&ce[0].length>2&&(qe=ce[0].length,A.index+=qe,qe%2!==0&&(D+="\\")),r.unescape===!0?D=O():D+=O(),A.brackets===0){H({type:"text",value:D});continue}}if(A.brackets>0&&(D!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&D===":"){let V=k.value.slice(1);if(V.includes("[")&&(k.posix=!0,V.includes(":"))){let ce=k.value.lastIndexOf("["),qe=k.value.slice(0,ce),Et=k.value.slice(ce+2),rt=P9[Et];if(rt){k.value=qe+rt,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(D==="["&&v()!==":"||D==="-"&&v()==="]")&&(D=`\\${D}`),D==="]"&&(k.value==="["||k.value==="[^")&&(D=`\\${D}`),r.posix===!0&&D==="!"&&k.value==="["&&(D="^"),k.value+=D,q({value:D});continue}if(A.quotes===1&&D!=='"'){D=er.escapeRegex(D),k.value+=D,q({value:D});continue}if(D==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:D});continue}if(D==="("){N("parens"),H({type:"paren",value:D});continue}if(D===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ma("opening","("));let V=j[j.length-1];if(V&&A.parens===V.parens+1){zt(j.pop());continue}H({type:"paren",value:D,output:A.parens?")":"\\)"}),z("parens");continue}if(D==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));D=`\\${D}`}else N("brackets");H({type:"bracket",value:D});continue}if(D==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){H({type:"text",value:D,output:`\\${D}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ma("opening","["));H({type:"text",value:D,output:`\\${D}`});continue}z("brackets");let V=k.value.slice(1);if(k.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(D=`/${D}`),k.value+=D,q({value:D}),r.literalBrackets===!1||er.hasRegexChars(V))continue;let ce=er.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=ce,k.value=ce;continue}k.value=`(${s}${ce}|${k.value})`,A.output+=k.value;continue}if(D==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:D,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(V),H(V);continue}if(D==="}"){let V=M[M.length-1];if(r.nobrace===!0||!V){H({type:"text",value:D,output:D});continue}let ce=")";if(V.dots===!0){let qe=a.slice(),Et=[];for(let rt=qe.length-1;rt>=0&&(a.pop(),qe[rt].type!=="brace");rt--)qe[rt].type!=="dots"&&Et.unshift(qe[rt].value);ce=T9(Et,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let qe=A.output.slice(0,V.outputIndex),Et=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",D=ce="\\}",A.output=qe;for(let rt of Et)A.output+=rt.output||rt.value}H({type:"brace",value:D,output:ce}),z("braces"),M.pop();continue}if(D==="|"){j.length>0&&j[j.length-1].conditions++,H({type:"text",value:D});continue}if(D===","){let V=D,ce=M[M.length-1];ce&&J[J.length-1]==="braces"&&(ce.comma=!0,V="|"),H({type:"comma",value:D,output:V});continue}if(D==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}H({type:"slash",value:D,output:h});continue}if(D==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let V=M[M.length-1];k.type="dots",k.output+=D,k.value+=D,V.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){H({type:"text",value:D,output:d});continue}H({type:"dot",value:D,output:d});continue}if(D==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",D);continue}if(k&&k.type==="paren"){let ce=v(),qe=D;if(ce==="<"&&!er.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(ce)||ce==="<"&&!/<([!=]|\w+>)/.test(R()))&&(qe=`\\${D}`),H({type:"text",value:D,output:qe});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){H({type:"qmark",value:D,output:_});continue}H({type:"qmark",value:D,output:g});continue}if(D==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",D);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(D==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",D);continue}if(k&&k.value==="("||r.regex===!1){H({type:"plus",value:D,output:p});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){H({type:"plus",value:D});continue}H({type:"plus",value:p});continue}if(D==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){H({type:"at",extglob:!0,value:D,output:""});continue}H({type:"text",value:D});continue}if(D!=="*"){(D==="$"||D==="^")&&(D=`\\${D}`);let V=$9.exec(R());V&&(D+=V[0],A.index+=V[0].length),H({type:"text",value:D});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=D,k.output=L,A.backtrack=!0,A.globstar=!0,I(D);continue}let G=R();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",D);continue}if(k.type==="star"){if(r.noglobstar===!0){I(D);continue}let V=k.prev,ce=V.prev,qe=V.type==="slash"||V.type==="bos",Et=ce&&(ce.type==="star"||ce.type==="globstar");if(r.bash===!0&&(!qe||G[0]&&G[0]!=="/")){H({type:"star",value:D,output:""});continue}let rt=A.braces>0&&(V.type==="comma"||V.type==="brace"),Af=j.length&&(V.type==="pipe"||V.type==="paren");if(!qe&&V.type!=="paren"&&!rt&&!Af){H({type:"star",value:D,output:""});continue}for(;G.slice(0,3)==="/**";){let Xs=t[A.index+4];if(Xs&&Xs!=="/")break;G=G.slice(3),I("/**",3)}if(V.type==="bos"&&w()){k.type="globstar",k.value+=D,k.output=F(r),A.output=k.output,A.globstar=!0,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!Et&&w()){A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=F(r)+(r.strictSlashes?")":"|$)"),k.value+=D,A.globstar=!0,A.output+=V.output+k.output,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&G[0]==="/"){let Xs=G[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=`${F(r)}${h}|${h}${Xs})`,k.value+=D,A.output+=V.output+k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&G[0]==="/"){k.type="globstar",k.value+=D,k.output=`(?:^|${h}|${F(r)}${h})`,A.output=k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=F(r),k.value+=D,A.output+=k.output,A.globstar=!0,I(D);continue}let Ee={type:"star",value:D,output:L};if(r.bash===!0){Ee.output=".*?",(k.type==="bos"||k.type==="slash")&&(Ee.output=B+Ee.output),H(Ee);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Ee.output=D,H(Ee);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=C,k.output+=C):r.dot===!0?(A.output+=E,k.output+=E):(A.output+=B,k.output+=B),v()!=="*"&&(A.output+=m,k.output+=m)),H(Ee)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));A.output=er.escapeLast(A.output,"["),z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing",")"));A.output=er.escapeLast(A.output,"("),z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","}"));A.output=er.escapeLast(A.output,"{"),z("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let G of A.tokens)A.output+=G.output!=null?G.output:G.value,G.suffix&&(A.output+=G.suffix)}return A};uy.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=KO[t]||t;let i=er.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=gf.globChars(i),b=r.dot?d:l,y=r.dot?p:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,x=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${y}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${y}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${y}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;let L=x(T[1]);return L?L+a+T[2]:void 0}}},$=er.removePrefix(t,E),F=x($);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};GO.exports=uy});var JO=S((cX,YO)=>{"use strict";var R9=require("path"),B9=zO(),cy=WO(),ly=zs(),N9=Vs(),L9=t=>t&&typeof t=="object"&&!Array.isArray(t),et=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(p=>et(p,e,r));return p=>{for(let h of l){let m=h(p);if(m)return m}return!1}}let n=L9(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=ly.isWindows(e),a=n?et.compileRe(t,e):et.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=et(o.ignore,l,r)}let c=(l,d=!1)=>{let{isMatch:p,match:h,output:m}=et.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(b),p===!1?(b.isMatch=!1,d?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,d?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),d?b:!0)};return r&&(c.state=s),c};et.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?ly.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=et.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};et.matchBase=(t,e,r,n=ly.isWindows(r))=>(e instanceof RegExp?e:et.makeRe(e,r)).test(R9.basename(t));et.isMatch=(t,e,r)=>et(e,r)(t);et.parse=(t,e)=>Array.isArray(t)?t.map(r=>et.parse(r,e)):cy(t,{...e,fastpaths:!1});et.scan=(t,e)=>B9(t,e);et.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=et.toRegex(s,e);return n===!0&&(u.state=t),u};et.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=cy.fastpaths(t,e)),o.output||(o=cy(t,e)),et.compileRe(o,e,r,n)};et.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};et.constants=N9;YO.exports=et});var ZO=S((lX,XO)=>{"use strict";XO.exports=JO()});var oF=S((fX,nF)=>{"use strict";var eF=require("util"),tF=$O(),Kr=ZO(),fy=zs(),QO=t=>t===""||t==="./",rF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=Kr(String(e[l]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>Kr(t,e);Le.isMatch=(t,e,r)=>Kr(e,r)(t);Le.any=Le.isMatch;Le.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(QO(t)||QO(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!fy.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);return[].concat(e).every(n=>Kr(n,r)(t))};Le.capture=(t,e,r)=>{let n=fy.isWindows(r),i=Kr.makeRe(String(t),{...r,capture:!0}).exec(n?fy.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>Kr.makeRe(...t);Le.scan=(...t)=>Kr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of tF(String(n),e))r.push(Kr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!rF(t)?[t]:tF(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=rF;nF.exports=Le});var qF=S((cZ,Dn)=>{var $e=require("fs"),Cf=require("os"),yt=require("path"),SF=require("crypto"),Wr={fs:$e.constants,os:Cf.constants},xF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",kF=/XXXXXX/,f7=3,PF=(Wr.O_CREAT||Wr.fs.O_CREAT)|(Wr.O_EXCL||Wr.fs.O_EXCL)|(Wr.O_RDWR||Wr.fs.O_RDWR),d7=Cf.platform()==="win32",p7=Wr.EBADF||Wr.os.errno.EBADF,h7=Wr.ENOENT||Wr.os.errno.ENOENT,$F=448,IF=384,m7="exit",ya=[],TF=$e.rmdirSync.bind($e),RF=!1;function g7(t,e){return $e.rm(t,{recursive:!0},e)}function BF(t){return $e.rmSync(t,{recursive:!0})}function yy(t,e){let r=Da(t,e),n=r[0],o=r[1];x7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=LF(a);$e.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function Dy(t){let e=Da(t),r=e[0],n=A7(r),o=n.tries;do{let i=LF(n);try{$e.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function y7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.open(s,PF,n.mode||IF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(p){return o(p,s,void 0,my(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,l,my(s,d?-1:l,n,!1))}})})}function D7(t){let e=Da(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Dy(r),i=$e.openSync(o,PF,r.mode||IF);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:my(o,n?-1:i,r,!0)}}function b7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||$F,function(c){if(c)return o(c);o(null,s,NF(s,n,!1))})})}function w7(t){let e=Da(t),r=e[0],n=Dy(r);return $e.mkdirSync(n,r.mode||$F),{name:n,removeCallback:NF(n,r,!0)}}function v7(t,e){let r=function(n){if(n&&!gy(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function C7(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!O7(r)&&!gy(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){gy(r)||(e=r)}}if(e!==null)throw e}function my(t,e,r,n){let o=vf(C7,[e,t],n),i=vf(v7,[e,t],n,o);return r.keep||ya.unshift(o),n?o:i}function NF(t,e,r){let n=e.unsafeCleanup?g7:$e.rmdir.bind($e),o=e.unsafeCleanup?BF:TF,i=vf(o,t,r),a=vf(n,t,r,i);return e.keep||ya.unshift(i),r?i:a}function vf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ya.indexOf(s);return u>=0&&ya.splice(u,1),o=!0,r||t===TF||t===BF?t(e):t(e,a||function(){})}}}function E7(){if(RF)for(;ya.length;)try{ya[0]()}catch{}}function AF(t){let e=[],r=null;try{r=SF.randomBytes(t)}catch{r=SF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(xF[r[n]%xF.length]);return e.join("")}function tr(t){return typeof t>"u"}function Da(t,e){if(typeof t=="function")return[{},t];if(tr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function _7(t,e,r){let n=yt.isAbsolute(t)?t:yt.join(e,t);$e.stat(n,function(o){o?$e.realpath(yt.dirname(n),function(i,a){if(i)return r(i);r(null,yt.join(a,yt.basename(n)))}):$e.realpath(n,r)})}function S7(t,e){let r=yt.isAbsolute(t)?t:yt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(yt.dirname(r));return yt.join(o,yt.basename(r))}}function LF(t){let e=t.tmpdir;if(!tr(t.name))return yt.join(e,t.dir,t.name);if(!tr(t.template))return yt.join(e,t.dir,t.template).replace(kF,AF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",AF(12),t.postfix?"-"+t.postfix:""].join("");return yt.join(e,t.dir,r)}function jF(t){if(!tr(t.name)){let e=t.name;if(yt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=yt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!tr(t.template)&&!t.template.match(kF))throw new Error(`Invalid template, found "${t.template}".`);if(!tr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=tr(t.name)?t.tries||f7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=tr(t.prefix)?"":t.prefix,t.postfix=tr(t.postfix)?"":t.postfix}function OF(t,e,r,n){if(tr(e))return n(null);_7(e,r,function(o,i){if(o)return n(o);let a=yt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function FF(t,e,r){if(tr(e))return;let n=S7(e,r),o=yt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function x7(t,e){k7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{jF(t,n)}catch(o){return e(o)}OF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=tr(i)?"":i,OF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function A7(t){let e=t.tmpdir=MF(t);jF(t,e);let r=FF("dir",t.dir,e);return t.dir=tr(r)?"":r,t.template=FF("template",t.template,e),t}function O7(t){return UF(t,-p7,"EBADF")}function gy(t){return UF(t,-h7,"ENOENT")}function UF(t,e,r){return d7?t.code===r:t.code===r&&t.errno===e}function F7(){RF=!0}function k7(t,e){return $e.realpath(t&&t.tmpdir||Cf.tmpdir(),e)}function MF(t){return $e.realpathSync(t&&t.tmpdir||Cf.tmpdir())}process.addListener(m7,E7);Object.defineProperty(Dn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return MF()}});Dn.exports.dir=b7;Dn.exports.dirSync=w7;Dn.exports.file=y7;Dn.exports.fileSync=D7;Dn.exports.tmpName=yy;Dn.exports.tmpNameSync=Dy;Dn.exports.setGracefulCleanup=F7});var Sf=require("node:process");var qy=ue(My(),1),{program:ot,createCommand:lq,createArgument:fq,createOption:dq,CommanderError:pq,InvalidArgumentError:hq,InvalidOptionArgumentError:mq,Command:gq,Argument:yq,Option:Dq,Help:bq}=qy.default;var yr={name:"@capgo/cli",version:"7.41.3",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var ua=require("node:fs");var Dt=ue(Kf(),1),zo=require("node:process"),wn=ue(require("node:readline"),1),Xf=ue(require("node:readline"),1),Qy=require("node:stream"),eD=ue(Wf(),1);function x2({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var A2=x2();function tD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(A2,"")}function rD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],d=e.length(l);if(s>=o-(d==2?1:0))if(s+d<=i)a+=l;else break;s+=d}return a}})(nD);var O2=nD.exports,F2=rD(O2),k2=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},P2=rD(k2);function Ca(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=tD(t),t.length===0))return 0;t=t.replace(P2()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(F2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Yf=10,Ky=(t=0)=>e=>`\x1B[${e+t}m`,Gy=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Wy=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(je.modifier);var $2=Object.keys(je.color),I2=Object.keys(je.bgColor);[...$2,...I2];function T2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=Ky(),je.color.ansi256=Gy(),je.color.ansi16m=Wy(),je.bgColor.ansi=Ky(Yf),je.bgColor.ansi256=Gy(Yf),je.bgColor.ansi16m=Wy(Yf),Object.defineProperties(je,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>je.rgbToAnsi256(...je.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var R2=T2(),cu=new Set(["\x1B","\x9B"]),B2=39,Qf="\x07",oD="[",N2="]",iD="m",ed=`${N2}8;;`,Yy=t=>`${cu.values().next().value}${oD}${t}${iD}`,Jy=t=>`${cu.values().next().value}${ed}${t}${Qf}`,L2=t=>t.split(" ").map(e=>Ca(e)),Jf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Ca(tD(t[t.length-1]));for(let[s,u]of n.entries()){let c=Ca(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),cu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(ed)),o){i?u===Qf&&(o=!1,i=!1):u===iD&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},j2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ca(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},U2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=L2(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Ca(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Jf(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Jf(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Jf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>j2(c)));let u=[...s.join(`
108
+ `)];for(let[c,l]of u.entries()){if(n+=l,cu.has(l)){let{groups:p}=new RegExp(`(?:\\${oD}(?<code>\\d+)m|\\${ed}(?<uri>.*)${Qf})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===B2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=R2.codes.get(Number(o));u[c+1]===`
109
+ `?(i&&(n+=Jy("")),o&&d&&(n+=Yy(d))):l===`
110
+ `&&(o&&d&&(n+=Yy(o)),i&&(n+=Jy(i)))}return n};function Xy(t,e,r){return String(t).normalize().replace(/\r\n/g,`
111
111
  `).split(`
112
- `).map(n=>_2(n,e,r)).join(`
113
- `)}var S2=["up","down","left","right","space","enter","cancel"],nu={actions:new Set(S2),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Xf(t,e){if(typeof t=="string")return nu.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Xf(r,e))return!0;return!1}function x2(t,e){if(t===e)return;let r=t.split(`
112
+ `).map(n=>U2(n,e,r)).join(`
113
+ `)}var M2=["up","down","left","right","space","enter","cancel"],iu={actions:new Set(M2),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function td(t,e){if(typeof t=="string")return iu.aliases.get(t)===e;for(let r of t)if(r!==void 0&&td(r,e))return!0;return!1}function q2(t,e){if(t===e)return;let r=t.split(`
114
114
  `),n=e.split(`
115
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var A2=globalThis.process.platform.startsWith("win"),Wf=Symbol("clack:cancel");function be(t){return t===Wf}function ru(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function ty({input:t=Ho.stdin,output:e=Ho.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=yn.createInterface({input:t,output:e,prompt:"",tabSize:1});yn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(Xf([c,s,u],"cancel")){n&&e.write(yt.cursor.show),process.exit(0);return}if(!r)return;yn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{yn.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(yt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(yt.cursor.show),t.isTTY&&!A2&&t.setRawMode(!1),o.terminal=!1,o.close()}}var O2=Object.defineProperty,F2=(t,e,r)=>e in t?O2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kt=(t,e,r)=>(F2(t,typeof e!="symbol"?e+"":e,r),r),va=class{constructor(e,r=!0){Kt(this,"input"),Kt(this,"output"),Kt(this,"_abortSignal"),Kt(this,"rl"),Kt(this,"opts"),Kt(this,"_render"),Kt(this,"_track",!1),Kt(this,"_prevFrame",""),Kt(this,"_subscribers",new Map),Kt(this,"_cursor",0),Kt(this,"state","initial"),Kt(this,"error",""),Kt(this,"value");let{input:n=Ho.stdin,output:o=Ho.stdout,render:i,signal:a,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=a,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...r),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Wf);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new WD.Writable;n._write=(o,i,a)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),a()},this.input.pipe(n),this.rl=Gf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Gf.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),ru(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(yt.cursor.show),this.output.off("resize",this.render),ru(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(yt.cursor.show),this.output.off("resize",this.render),ru(this.input,!1),e(Wf)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&nu.aliases.has(r.name)&&this.emit("cursor",nu.aliases.get(r.name)),nu.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Xf([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
116
- `),ru(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=KD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
117
- `).length-1;this.output.write(yt.cursor.move(-999,e*-1))}render(){let e=KD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(yt.cursor.hide);else{let r=x2(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(yt.cursor.move(0,n)),this.output.write(yt.erase.lines(1));let o=e.split(`
118
- `);this.output.write(o[n]),this._prevFrame=e,this.output.write(yt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(yt.cursor.move(0,n)),this.output.write(yt.erase.down());let o=e.split(`
115
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var H2=globalThis.process.platform.startsWith("win"),Zf=Symbol("clack:cancel");function be(t){return t===Zf}function ou(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function aD({input:t=zo.stdin,output:e=zo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=wn.createInterface({input:t,output:e,prompt:"",tabSize:1});wn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(td([c,s,u],"cancel")){n&&e.write(Dt.cursor.show),process.exit(0);return}if(!r)return;wn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{wn.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(Dt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(Dt.cursor.show),t.isTTY&&!H2&&t.setRawMode(!1),o.terminal=!1,o.close()}}var V2=Object.defineProperty,z2=(t,e,r)=>e in t?V2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Kt=(t,e,r)=>(z2(t,typeof e!="symbol"?e+"":e,r),r),Ea=class{constructor(e,r=!0){Kt(this,"input"),Kt(this,"output"),Kt(this,"_abortSignal"),Kt(this,"rl"),Kt(this,"opts"),Kt(this,"_render"),Kt(this,"_track",!1),Kt(this,"_prevFrame",""),Kt(this,"_subscribers",new Map),Kt(this,"_cursor",0),Kt(this,"state","initial"),Kt(this,"error",""),Kt(this,"value");let{input:n=zo.stdin,output:o=zo.stdout,render:i,signal:a,...s}=e;this.opts=s,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=i.bind(this),this._track=r,this._abortSignal=a,this.input=n,this.output=o}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],o=[];for(let i of n)i.cb(...r),i.once&&o.push(()=>n.splice(n.indexOf(i),1));for(let i of o)i()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Zf);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new Qy.Writable;n._write=(o,i,a)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),a()},this.input.pipe(n),this.rl=Xf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Xf.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),ou(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),ou(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),ou(this.input,!1),e(Zf)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&iu.aliases.has(r.name)&&this.emit("cursor",iu.aliases.get(r.name)),iu.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}td([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
116
+ `),ou(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=Xy(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
117
+ `).length-1;this.output.write(Dt.cursor.move(-999,e*-1))}render(){let e=Xy(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Dt.cursor.hide);else{let r=q2(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.lines(1));let o=e.split(`
118
+ `);this.output.write(o[n]),this._prevFrame=e,this.output.write(Dt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Dt.cursor.move(0,n)),this.output.write(Dt.erase.down());let o=e.split(`
119
119
  `).slice(n);this.output.write(o.join(`
120
- `)),this._prevFrame=e;return}this.output.write(yt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},ou=class extends va{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(yt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var k2;k2=new WeakMap;var P2=Object.defineProperty,$2=(t,e,r)=>e in t?P2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,GD=(t,e,r)=>($2(t,typeof e!="symbol"?e+"":e,r),r),iu=class extends va{constructor(e){super(e,!1),GD(this,"options"),GD(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var au=class extends va{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${YD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var rr=de(require("node:process"),1),W=de(Vf(),1),uu=de(qf(),1);function T2(){return rr.default.platform!=="win32"?rr.default.env.TERM!=="linux":!!rr.default.env.CI||!!rr.default.env.WT_SESSION||!!rr.default.env.TERMINUS_SUBLIME||rr.default.env.ConEmuTask==="{cmd::Cmder}"||rr.default.env.TERM_PROGRAM==="Terminus-Sublime"||rr.default.env.TERM_PROGRAM==="vscode"||rr.default.env.TERM==="xterm-256color"||rr.default.env.TERM==="alacritty"||rr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Zf=T2(),Xe=(t,e)=>Zf?t:e,I2=Xe("\u25C6","*"),ry=Xe("\u25A0","x"),ny=Xe("\u25B2","x"),td=Xe("\u25C7","o"),R2=Xe("\u250C","T"),He=Xe("\u2502","|"),Vo=Xe("\u2514","\u2014"),Qf=Xe("\u25CF",">"),ed=Xe("\u25CB"," "),mq=Xe("\u25FB","[\u2022]"),gq=Xe("\u25FC","[+]"),Dq=Xe("\u25FB","[ ]"),yq=Xe("\u25AA","\u2022"),bq=Xe("\u2500","-"),wq=Xe("\u256E","+"),vq=Xe("\u251C","+"),Eq=Xe("\u256F","+"),B2=Xe("\u25CF","\u2022"),N2=Xe("\u25C6","*"),L2=Xe("\u25B2","!"),j2=Xe("\u25A0","x"),rd=t=>{switch(t){case"initial":case"active":return W.default.cyan(I2);case"cancel":return W.default.red(ry);case"error":return W.default.yellow(ny);case"submit":return W.default.green(td)}},U2=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),a=Math.min(i,Math.max(o,5)),s=0;e>=s+a-3?s=Math.max(Math.min(e-a+3,r.length-a),0):e<s+2&&(s=Math.max(e-2,0));let u=a<r.length&&s>0,c=a<r.length&&s+a<r.length;return r.slice(s,s+a).map((l,d,p)=>{let h=d===0&&u,m=d===p.length-1&&c;return h||m?W.default.dim("..."):n(l,d+s===e)})},Dr=t=>new au({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${W.default.gray(He)}
121
- ${rd(this.state)} ${t.message}
120
+ `)),this._prevFrame=e;return}this.output.write(Dt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},au=class extends Ea{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Dt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var K2;K2=new WeakMap;var G2=Object.defineProperty,W2=(t,e,r)=>e in t?G2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Zy=(t,e,r)=>(W2(t,typeof e!="symbol"?e+"":e,r),r),su=class extends Ea{constructor(e){super(e,!1),Zy(this,"options"),Zy(this,"cursor",0),this.options=e.options,this.cursor=this.options.findIndex(({value:r})=>r===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",r=>{switch(r){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};var uu=class extends Ea{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[r,...n]=this.value.slice(this.cursor);return`${e}${eD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var nr=ue(require("node:process"),1),W=ue(Wf(),1),lu=ue(Kf(),1);function Y2(){return nr.default.platform!=="win32"?nr.default.env.TERM!=="linux":!!nr.default.env.CI||!!nr.default.env.WT_SESSION||!!nr.default.env.TERMINUS_SUBLIME||nr.default.env.ConEmuTask==="{cmd::Cmder}"||nr.default.env.TERM_PROGRAM==="Terminus-Sublime"||nr.default.env.TERM_PROGRAM==="vscode"||nr.default.env.TERM==="xterm-256color"||nr.default.env.TERM==="alacritty"||nr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var rd=Y2(),Ze=(t,e)=>rd?t:e,J2=Ze("\u25C6","*"),sD=Ze("\u25A0","x"),uD=Ze("\u25B2","x"),id=Ze("\u25C7","o"),X2=Ze("\u250C","T"),He=Ze("\u2502","|"),Ko=Ze("\u2514","\u2014"),nd=Ze("\u25CF",">"),od=Ze("\u25CB"," "),Pq=Ze("\u25FB","[\u2022]"),$q=Ze("\u25FC","[+]"),Iq=Ze("\u25FB","[ ]"),Tq=Ze("\u25AA","\u2022"),Rq=Ze("\u2500","-"),Bq=Ze("\u256E","+"),Nq=Ze("\u251C","+"),Lq=Ze("\u256F","+"),Z2=Ze("\u25CF","\u2022"),Q2=Ze("\u25C6","*"),ek=Ze("\u25B2","!"),tk=Ze("\u25A0","x"),ad=t=>{switch(t){case"initial":case"active":return W.default.cyan(J2);case"cancel":return W.default.red(sD);case"error":return W.default.yellow(uD);case"submit":return W.default.green(id)}},rk=t=>{let{cursor:e,options:r,style:n}=t,o=t.maxItems??Number.POSITIVE_INFINITY,i=Math.max(process.stdout.rows-4,0),a=Math.min(i,Math.max(o,5)),s=0;e>=s+a-3?s=Math.max(Math.min(e-a+3,r.length-a),0):e<s+2&&(s=Math.max(e-2,0));let u=a<r.length&&s>0,c=a<r.length&&s+a<r.length;return r.slice(s,s+a).map((l,d,p)=>{let h=d===0&&u,m=d===p.length-1&&c;return h||m?W.default.dim("..."):n(l,d+s===e)})},Dr=t=>new uu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${W.default.gray(He)}
121
+ ${ad(this.state)} ${t.message}
122
122
  `,r=t.placeholder?W.default.inverse(t.placeholder[0])+W.default.dim(t.placeholder.slice(1)):W.default.inverse(W.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
123
123
  ${W.default.yellow(He)} ${n}
124
- ${W.default.yellow(Vo)} ${W.default.yellow(this.error)}
124
+ ${W.default.yellow(Ko)} ${W.default.yellow(this.error)}
125
125
  `;case"submit":return`${e}${W.default.gray(He)} ${W.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${W.default.gray(He)} ${W.default.strikethrough(W.default.dim(this.value??""))}${this.value?.trim()?`
126
126
  ${W.default.gray(He)}`:""}`;default:return`${e}${W.default.cyan(He)} ${n}
127
- ${W.default.cyan(Vo)}
128
- `}}}).prompt();var we=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new ou({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${W.default.gray(He)}
129
- ${rd(this.state)} ${t.message}
127
+ ${W.default.cyan(Ko)}
128
+ `}}}).prompt();var we=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new au({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${W.default.gray(He)}
129
+ ${ad(this.state)} ${t.message}
130
130
  `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${W.default.gray(He)} ${W.default.dim(o)}`;case"cancel":return`${n}${W.default.gray(He)} ${W.default.strikethrough(W.default.dim(o))}
131
- ${W.default.gray(He)}`;default:return`${n}${W.default.cyan(He)} ${this.value?`${W.default.green(Qf)} ${e}`:`${W.default.dim(ed)} ${W.default.dim(e)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(ed)} ${W.default.dim(r)}`:`${W.default.green(Qf)} ${r}`}
132
- ${W.default.cyan(Vo)}
133
- `}}}).prompt()},yr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${W.default.dim(o)}`;case"active":return`${W.default.green(Qf)} ${o} ${r.hint?W.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(o))}`;default:return`${W.default.dim(ed)} ${W.default.dim(o)}`}};return new iu({options:t.options,initialValue:t.initialValue,render(){let r=`${W.default.gray(He)}
134
- ${rd(this.state)} ${t.message}
131
+ ${W.default.gray(He)}`;default:return`${n}${W.default.cyan(He)} ${this.value?`${W.default.green(nd)} ${e}`:`${W.default.dim(od)} ${W.default.dim(e)}`} ${W.default.dim("/")} ${this.value?`${W.default.dim(od)} ${W.default.dim(r)}`:`${W.default.green(nd)} ${r}`}
132
+ ${W.default.cyan(Ko)}
133
+ `}}}).prompt()},br=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${W.default.dim(o)}`;case"active":return`${W.default.green(nd)} ${o} ${r.hint?W.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${W.default.strikethrough(W.default.dim(o))}`;default:return`${W.default.dim(od)} ${W.default.dim(o)}`}};return new su({options:t.options,initialValue:t.initialValue,render(){let r=`${W.default.gray(He)}
134
+ ${ad(this.state)} ${t.message}
135
135
  `;switch(this.state){case"submit":return`${r}${W.default.gray(He)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${W.default.gray(He)} ${e(this.options[this.cursor],"cancelled")}
136
- ${W.default.gray(He)}`;default:return`${r}${W.default.cyan(He)} ${U2({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
136
+ ${W.default.gray(He)}`;default:return`${r}${W.default.cyan(He)} ${rk({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
137
137
  ${W.default.cyan(He)} `)}
138
- ${W.default.cyan(Vo)}
139
- `}}}).prompt()};var Gn=(t="")=>{process.stdout.write(`${W.default.gray(Vo)} ${W.default.red(t)}
138
+ ${W.default.cyan(Ko)}
139
+ `}}}).prompt()};var Kn=(t="")=>{process.stdout.write(`${W.default.gray(Ko)} ${W.default.red(t)}
140
140
 
141
- `)},ee=(t="")=>{process.stdout.write(`${W.default.gray(R2)} ${t}
141
+ `)},ee=(t="")=>{process.stdout.write(`${W.default.gray(X2)} ${t}
142
142
  `)},Z=(t="")=>{process.stdout.write(`${W.default.gray(He)}
143
- ${W.default.gray(Vo)} ${t}
143
+ ${W.default.gray(Ko)} ${t}
144
144
 
145
145
  `)},f={message:(t="",{symbol:e=W.default.gray(He)}={})=>{let r=[`${W.default.gray(He)}`];if(t){let[n,...o]=t.split(`
146
146
  `);r.push(`${e} ${n}`,...o.map(i=>`${W.default.gray(He)} ${i}`))}process.stdout.write(`${r.join(`
147
147
  `)}
148
- `)},info:t=>{f.message(t,{symbol:W.default.blue(B2)})},success:t=>{f.message(t,{symbol:W.default.green(N2)})},step:t=>{f.message(t,{symbol:W.default.green(td)})},warn:t=>{f.message(t,{symbol:W.default.yellow(L2)})},warning:t=>{f.warn(t)},error:t=>{f.message(t,{symbol:W.default.red(j2)})}},Cq=`${W.default.gray(He)} `;var De=({indicator:t="dots"}={})=>{let e=Zf?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Zf?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let x=_>1?"Something went wrong":"Canceled";a&&g(x,_)},d=()=>l(2),p=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
148
+ `)},info:t=>{f.message(t,{symbol:W.default.blue(Z2)})},success:t=>{f.message(t,{symbol:W.default.green(Q2)})},step:t=>{f.message(t,{symbol:W.default.green(id)})},warn:t=>{f.message(t,{symbol:W.default.yellow(ek)})},warning:t=>{f.warn(t)},error:t=>{f.message(t,{symbol:W.default.red(tk)})}},jq=`${W.default.gray(He)} `;var ye=({indicator:t="dots"}={})=>{let e=rd?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=rd?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let x=_>1?"Something went wrong":"Canceled";a&&g(x,_)},d=()=>l(2),p=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
149
149
  `);let _=u.split(`
150
- `);process.stdout.write(uu.cursor.move(-999,_.length-1)),process.stdout.write(uu.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),E=_=>{let x=(performance.now()-_)/1e3,$=Math.floor(x/60),F=Math.floor(x%60);return $>0?`[${$}m ${F}s]`:`[${F}s]`},C=(_="")=>{a=!0,o=ty(),s=D(_),c=performance.now(),process.stdout.write(`${W.default.gray(He)}
151
- `);let x=0,$=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let F=W.default.magenta(e[x]);if(n)process.stdout.write(`${F} ${s}...`);else if(t==="timer")process.stdout.write(`${F} ${s} ${E(c)}`);else{let B=".".repeat(Math.floor($)).slice(0,3);process.stdout.write(`${F} ${s}${B}`)}x=x+1<e.length?x+1:0,$=$<e.length?$+.125:0},r)},g=(_="",x=0)=>{a=!1,clearInterval(i),b();let $=x===0?W.default.green(td):x===1?W.default.red(ry):W.default.red(ny);s=D(_??s),t==="timer"?process.stdout.write(`${$} ${s} ${E(c)}
150
+ `);process.stdout.write(lu.cursor.move(-999,_.length-1)),process.stdout.write(lu.erase.down(_.length))},y=_=>_.replace(/\.+$/,""),C=_=>{let x=(performance.now()-_)/1e3,$=Math.floor(x/60),F=Math.floor(x%60);return $>0?`[${$}m ${F}s]`:`[${F}s]`},E=(_="")=>{a=!0,o=aD(),s=y(_),c=performance.now(),process.stdout.write(`${W.default.gray(He)}
151
+ `);let x=0,$=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let F=W.default.magenta(e[x]);if(n)process.stdout.write(`${F} ${s}...`);else if(t==="timer")process.stdout.write(`${F} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor($)).slice(0,3);process.stdout.write(`${F} ${s}${B}`)}x=x+1<e.length?x+1:0,$=$<e.length?$+.125:0},r)},g=(_="",x=0)=>{a=!1,clearInterval(i),b();let $=x===0?W.default.green(id):x===1?W.default.red(sD):W.default.red(uD);s=y(_??s),t==="timer"?process.stdout.write(`${$} ${s} ${C(c)}
152
152
  `):process.stdout.write(`${$} ${s}
153
- `),m(),o()};return{start:C,stop:g,message:(_="")=>{s=D(_??s)}}};var pA=require("node:child_process"),Pe=require("node:fs"),Rl=require("node:os"),Ae=de(require("node:path")),Wt=require("node:process"),jr=de(lu());var _t=require("fs"),Ca=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bun":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm":(0,_t.existsSync)(a)?"yarn":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npm":e},fu=(t=Ca(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},oy=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bunx":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm exec":(0,_t.existsSync)(a)?"yarn dlx":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npx":e};function du(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function sy(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function ad(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let o=t[n],i=e[n];if(o===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(o===void 0)return-1;if(typeof o=="string"&&typeof i=="number")return 1;if(typeof o=="number"&&typeof i=="string"||o<i)return-1;if(o>i)return 1}return 0}var zo="0|[1-9]\\d*",V2="\\d*[a-zA-Z-][a-zA-Z0-9-]*",z2=`(?<major>${zo})\\.(?<minor>${zo})\\.(?<patch>${zo})`,iy=`(?:${zo}|${V2})`,uy=`(?:-(?<prerelease>${iy}(?:\\.${iy})*))`,ay="[0-9A-Za-z-]+",cy=`(?:\\+(?<buildmetadata>${ay}(?:\\.${ay})*))`,ly=`v?${z2}${uy}?${cy}?`,fy=new RegExp(`^${ly}$`),dy="(?:<|>)?=?",K2="x|X|\\*",id=`${zo}|${K2}`,pu=`[v=\\s]*(?<major>${id})(?:\\.(?<minor>${id})(?:\\.(?<patch>${id})${uy}?${cy}?)?)?`,py=new RegExp(`^(?<operator>~>?|\\^|${dy})\\s*${pu}$`),hy=new RegExp(`^(?<operator>${dy})\\s*(${ly})$|^$`);function sd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var ud=256;var G2=new RegExp(`^${zo}$`);function St(t){return t.split(".").filter(Boolean).map(e=>{if(G2.test(e)){let r=Number(e);if(sd(r))return r}return e})}function br(t){return t.split(".").filter(Boolean)}function wn(t,e){let r=Number(t);if(!sd(r))throw new TypeError(e);return r}function Jr(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function xt(t,e){return t===e?0:du(t.major,e.major)||du(t.minor,e.minor)||du(t.patch,e.patch)||sy(t.prerelease,e.prerelease)||ad(t.prerelease,e.prerelease)}function cd(t){return t.toFixed(0)}function wr(t){let e=cd(t.major),r=cd(t.minor),n=cd(t.patch),o=t.prerelease?.join(".")??"",i=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,o].filter(u=>u).join("-"),i].filter(u=>u).join("+")}function W2(t,e){if(Jr(e))return!0;let r=xt(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function hu(t,e){for(let r of e)if(!W2(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Jr(r))continue;let{major:n,minor:o,patch:i,prerelease:a}=r;if(a&&a.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function _a(t,e){return e.some(r=>hu(t,r))}function Y2(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function Sa(t=[],e){let r=Y2(t);if(!e)return r;let n=St(e);if(n.every(o=>typeof o=="string")){if(n.every((o,i)=>o===r[i])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function xa(t,e,r={}){let n=r.build!==void 0?br(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Sa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Sa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Sa(t.prerelease,r.prerelease),build:n};case"prerelease":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:Sa(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let i=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:i,patch:0,prerelease:[],build:n}}case"patch":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:Sa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var mu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ko={operator:void 0,...mu};function ld(t,e){return xt(t,e)>0}function vr(t,e){return xt(t,e)<0}function J2(t){let r=t.match(hy)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:wn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:wn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:wn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?St(o):[],build:i?br(i):[]}:mu;return{operator:n||void 0,...a}}function Ie(t){return!t||t.toLowerCase()==="x"||t==="*"}function X2(t){if(!Ie(t.major))return Ie(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Ie(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?St(t.prerelease):[],build:[]}}function Z2(t){if(!Ie(t.major))return Ie(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Ie(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:St(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function Q2(t){let e=t.match(new RegExp(`^${pu}`)),r=e?.groups;if(!r)return null;let n=e[0].length,o=t.slice(n).match(/^\s+-\s+/);if(!o)return null;let i=o[0].length,s=t.slice(n+i).match(new RegExp(`^${pu}\\s*$`))?.groups;if(!s)return null;let u=X2(r),c=Z2(s);return[u,c].filter(Boolean)}function ek(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Ko];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return o===0?[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];let s=St(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i,patch:a+1}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o+1,minor:0,patch:0}]}function tk(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Ko];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function rk(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:o,minor:0,patch:0}]:[{operator:"<",major:o,minor:0,patch:0}];if(n)return[{operator:"<",major:o,minor:i,patch:0}];let s=St(t.prerelease??""),u=br(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function nk(t){let e=Ie(t.minor),r=Ie(t.patch),n=+t.major,o=+t.minor,i=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:o+1,patch:0}];if(r)return[{operator:"<",major:n,minor:o+1,patch:0}];let a=St(t.prerelease??""),s=br(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function ok(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??""),u=br(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function ik(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Ko];if(r)return n?[{operator:">=",major:o,minor:0,patch:0}]:[{operator:">=",major:o,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0}];let s=St(t.prerelease??""),u=br(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function ak(t){let e=Ie(t.major),r=Ie(t.minor),n=Ie(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Ko];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??""),u=br(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function sk(t){let e=t.match(py)?.groups;if(!e)return J2(t);switch(e.operator){case"^":return ek(e);case"~":case"~>":return tk(e);case"<":return rk(e);case"<=":return nk(e);case">":return ok(e);case">=":return ik(e);case"=":case"":return ak(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function uk(t){return t.split(/\s+/).flatMap(sk)}function gu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>Q2(r)||uk(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function _e(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>ud)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${ud}`);t=t.trim();let e=t.match(fy)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=wn(e.major,`Cannot parse version ${t}: invalid major version`),n=wn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=wn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?St(e.prerelease):[],a=e.buildmetadata?br(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function my(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Jr(t)?!0:_a(t,[[e]]);if(n===void 0)return Jr(e)?!0:_a(e,[[t]]);let o=xt(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||o===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||o===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||o===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function ck(t){return t.every(e=>e.some(r=>lk(r)))}function lk(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!my(r,n))return!1}return!0}function gy(t,e){return ck([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>my(o,i)))))}function Dy(t){try{return _e(t),!0}catch{return!1}}function yy(t,e){return xt(t,e)>=0}var Qi=de(F0()),Eg=de(Kp()),hA=de(Lb()),Bl=de(Jc());function JE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var at=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let o=0;o<r.length;o++){let i=this.cast(n[o]).length;i>r[o]&&(r[o]=i)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let o=this.cast(e),i=n?JE("bold",o):o,a=r-o.length,s=this.theme.row[1];switch(typeof e){case"number":return s.repeat(a)+i;case"string":return i+s.repeat(a);case"boolean":case"object":return s.repeat(Math.ceil(a/2))+JE("italic",o)+s.repeat(Math.floor(a/2));default:return s.repeat(a)}}renderRow(e,r=!1){let n=this.theme.row,o=this.columnWidth();return n[0]+e.map((i,a)=>this.renderCell(i,o[a],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(o=>this.renderRow(o)),r||n?this.renderLine(e.bot):""].filter(o=>o.length>0).join(`
154
- `)}};async function Xc(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function ge(){let t=await Xc("@capgo/cli")??"",e=t?.split(".")[0];t!==gr.version&&f.warning(`\u{1F6A8} You are using @capgo/cli@${gr.version} it's not the latest version.
155
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function k8(t){return new Promise(e=>{setTimeout(e,t)})}function P8(t){return new Date(t||"").toLocaleTimeString()}async function ur(t,e,r,n,o,i="\u2705"){await fe(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function $8(t,e,r,n){if(be(e))throw await ur(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function T8(t,e,r){try{let n=await cr(),o=r?{...e,rangeStart:r}:{...e},i=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:t},body:JSON.stringify(o)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let a=await i.json();if(a?.length>0)return a}catch(n){console.error("Cannot get devices",n),f.error(`Cannot get stats ${U(n)}`)}return[]}function I8(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function R8(t,e,r,n,o,i){let a=I8(t);if(!a)return{};a.snag&&await ur(e,r,n,a.snag);let s=P8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function am(t,e,r,n,o){let i=!0,a=await cr(),s=`${a.hostWeb}/app/p/${r}`;await ur(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,d=De(),p=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`);i;){await k8(5e3);let h=await T8(e,u,c);if(h.length>0){let m=h.reduce((C,g)=>{let _=new Date(g.created_at).getTime();return Math.max(C,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=h.filter(C=>{let g=`${C.app_id}|${C.device_id}|${C.action}|${C.version_id}|${C.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((C,g)=>new Date(C.created_at).getTime()-new Date(g.created_at).getTime()),D=new at;D.headers=["Time","Device","Key","Message"],D.theme=at.roundTheme,D.rows=[];let E=!1;for(let C of b){let{row:g,stop:_}=await R8(C,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(E=!0)}if(D.rows.length&&(d.stop(""),f.info(D.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`)),E){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function XE(t,e){ee("Debug Live update in Capgo"),await ge(),e.apikey=e.apikey||ne();let r=await te();t=ce(t,r?.config);let n=e.device;if(!e.apikey)throw f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await bt(o,t),a=await we({message:"Automatic check if update working in device ?"});await $8("debug",a,i,e.apikey),a?(f.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await am("debug",e.apikey,t,i,n),Z("Done \u2705")):Z("Canceled \u274C")}var sm=require("node:buffer"),ZE=require("node:crypto"),B8=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function N8(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=B8[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function nn(t,e="sha256"){let r=sm.Buffer.isBuffer(t)?t:sm.Buffer.from(t);if(e==="crc32")return N8(r);let n=(0,ZE.createHash)(e);return n.update(r),n.digest("hex")}var Ss=de(kx());async function Px(){let t=await(0,Ss.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Qm(t,e,r=!1){let n=await(0,Ss.loadConfig)(),{extConfig:o}=n.app;o&&(o.plugins||(o.plugins={extConfig:{},[t]:{}}),o.plugins[t]||(o.plugins[t]={}),r?o=e.config:o.plugins[t]=e.config.plugins?.[t],(0,Ss.writeConfig)(o,n.app.extConfigFilePath))}async function Yi(t,e=!1){await Qm("CapacitorUpdater",t,e)}var ea=".capgo_key",Jt=".capgo_key_v2",Nl=`${ea}.pub`,un=`${Jt}.pub`,sA="https://capgo.app",uA="https://files.capgo.app",cA="https://api.capgo.app",lA="https://console.capgo.app",Cg=12e4,D5=1024*1024*20,y5=1024*1024*1024,b5=1024*1024*99,Ur="package.json",ta=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,U=t=>t?`
156
- ${hA.default.render(t)}`:"";function Il(t){return new Promise(e=>{setTimeout(e,t)})}function mA(t){return(0,jr.isMonorepo)(t)||(0,jr.isNXMonorepo)(t)}function gt(t){return(0,jr.isMonorepo)(t)?(0,jr.findMonorepoRoot)(t):(0,jr.isNXMonorepo)(t)?(0,jr.findNXMonorepoRoot)(t):t}function gA(t=gt((0,Wt.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Pe.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw f.error(o),new Error(o)}let n=(0,Pe.readFileSync)(r??(0,Ae.join)(t,Ur));return JSON.parse(n)}function _g(t=gt((0,Wt.cwd)()),e=void 0){return gA(t,e).scripts}function Ar(t=gt((0,Wt.cwd)()),e=void 0){return gA(t,e).version??""}function fA(t){let e=t.replace("^","").replace("~","");if(Dy(e))try{let r=_e(e);return wr(r)}catch{return e}return e}async function Mr(t,e=(0,Wt.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let a=(await Yt(e,r)).get(t);if(a)return a}catch{}let n=null,o=(0,Ae.join)(e,"ios","App","Podfile");if((0,Pe.existsSync)(o))try{let a=(0,Pe.readFileSync)(o,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);a?.[1]&&(n=(0,Ae.resolve)((0,Ae.join)(e,"ios","App",a[1])))}catch{}if(!n){let i=(0,Ae.join)(e,"android","capacitor.settings.gradle");if((0,Pe.existsSync)(i))try{let s=(0,Pe.readFileSync)(i,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);s?.[1]&&(n=(0,Ae.resolve)((0,Ae.join)(e,"android",s[1])).replace(/\/android$/,""))}catch{}}if(n){let i=(0,Ae.join)(n,Ur);if((0,Pe.existsSync)(i))try{let a=JSON.parse((0,Pe.readFileSync)(i,"utf-8"));if(a.version)return a.version}catch{}}try{let a=(await Yt(e)).get(t);if(a)return a}catch{}return null}async function Yt(t=gt((0,Wt.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ae.join)(t,Ur)],r){for(let o of r)if(!(0,Pe.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw f.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,Pe.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,fA(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,fA(a.devDependencies[s]))}return n}async function te(){try{let t=await Px();if(!t){let e="No capacitor config file found, run `cap init` first";throw f.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${U(t)}`;throw f.error(e),new Error(e)}}async function Sg(t,e){let r=await te();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Qm(t,r)),r}async function Fs(t){return Sg("CapacitorUpdater",t)}async function cr(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||sA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||lA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||uA,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||cA};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(f.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:sA,hostWeb:lA,hostFilesApi:uA,hostApi:cA}}}var w5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Ll(){let t=await cr();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return f.info(`Local config ${U(t)}`),t}}async function DA(){let t=await cr();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:y5,maxChunkSize:b5,alertUploadSize:D5}}}async function re(t,e,r){let n=await Ll();if(e&&r&&(f.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw f.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Qi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function v5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){f.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((a,s)=>r.length===1?`"${a}"`:s===r.length-1?`or "${a}"`:`"${a}", `).join("")} mode.`;throw f.error(i),new Error("Invalid API key or insufficient permissions.")}}async function yA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function bA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function E5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function C5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var vt=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(vt||{}),ra=(t,e)=>t>=e;async function wA(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw f.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let s=null;switch(n){case"perm_none":{s=0;break}case"perm_read":{s=1;break}case"perm_upload":{s=2;break}case"perm_write":{s=3;break}case"perm_admin":{s=4;break}case"perm_owner":{s=5;break}default:throw n.includes("invite")?(f.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(f.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:s}}let a=null;switch(n){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:throw f.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:a}}async function vA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){f.error(`Cannot get cli warnings: ${U(o)}`);return}if(n.length>0){f.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let a of n){if(typeof a!="object"||typeof a.message!="string"||typeof a.fatal!="boolean"){f.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(f.error(`${s.message.replaceAll("\\n",`
153
+ `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=y(_??s)}}};var FA=require("node:child_process"),Pe=require("node:fs"),jl=require("node:os"),Ae=ue(require("node:path")),Yt=require("node:process"),Ur=ue(du());var _t=require("fs"),Sa=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bun":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm":(0,_t.existsSync)(a)?"yarn":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npm":e},pu=(t=Sa(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},cD=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,o=`${t}/pnpm-lock.yaml`,i=`${t}/shrinkwrap.yaml`,a=`${t}/yarn.lock`,s=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,_t.existsSync)(r)||(0,_t.existsSync)(n)?"bunx":(0,_t.existsSync)(o)||(0,_t.existsSync)(i)?"pnpm exec":(0,_t.existsSync)(a)?"yarn dlx":(0,_t.existsSync)(s)||(0,_t.existsSync)(u)?"npx":e};function hu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function dD(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function ld(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let o=t[n],i=e[n];if(o===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(o===void 0)return-1;if(typeof o=="string"&&typeof i=="number")return 1;if(typeof o=="number"&&typeof i=="string"||o<i)return-1;if(o>i)return 1}return 0}var Go="0|[1-9]\\d*",ak="\\d*[a-zA-Z-][a-zA-Z0-9-]*",sk=`(?<major>${Go})\\.(?<minor>${Go})\\.(?<patch>${Go})`,lD=`(?:${Go}|${ak})`,pD=`(?:-(?<prerelease>${lD}(?:\\.${lD})*))`,fD="[0-9A-Za-z-]+",hD=`(?:\\+(?<buildmetadata>${fD}(?:\\.${fD})*))`,mD=`v?${sk}${pD}?${hD}?`,gD=new RegExp(`^${mD}$`),yD="(?:<|>)?=?",uk="x|X|\\*",cd=`${Go}|${uk}`,mu=`[v=\\s]*(?<major>${cd})(?:\\.(?<minor>${cd})(?:\\.(?<patch>${cd})${pD}?${hD}?)?)?`,DD=new RegExp(`^(?<operator>~>?|\\^|${yD})\\s*${mu}$`),bD=new RegExp(`^(?<operator>${yD})\\s*(${mD})$|^$`);function fd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var dd=256;var ck=new RegExp(`^${Go}$`);function St(t){return t.split(".").filter(Boolean).map(e=>{if(ck.test(e)){let r=Number(e);if(fd(r))return r}return e})}function wr(t){return t.split(".").filter(Boolean)}function Cn(t,e){let r=Number(t);if(!fd(r))throw new TypeError(e);return r}function Xr(t){return Number.isNaN(t.major)&&Number.isNaN(t.minor)&&Number.isNaN(t.patch)&&(t.prerelease===void 0||t.prerelease.length===0)&&(t.build===void 0||t.build.length===0)}function xt(t,e){return t===e?0:hu(t.major,e.major)||hu(t.minor,e.minor)||hu(t.patch,e.patch)||dD(t.prerelease,e.prerelease)||ld(t.prerelease,e.prerelease)}function pd(t){return t.toFixed(0)}function vr(t){let e=pd(t.major),r=pd(t.minor),n=pd(t.patch),o=t.prerelease?.join(".")??"",i=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,o].filter(u=>u).join("-"),i].filter(u=>u).join("+")}function lk(t,e){if(Xr(e))return!0;let r=xt(t,e);switch(e.operator){case"=":case void 0:return r===0;case"!=":return r!==0;case">":return r>0;case"<":return r<0;case">=":return r>=0;case"<=":return r<=0}}function gu(t,e){for(let r of e)if(!lk(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Xr(r))continue;let{major:n,minor:o,patch:i,prerelease:a}=r;if(a&&a.length>0&&t.major===n&&t.minor===o&&t.patch===i)return!0}return!1}return!0}function xa(t,e){return e.some(r=>gu(t,r))}function fk(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function Aa(t=[],e){let r=fk(t);if(!e)return r;let n=St(e);if(n.every(o=>typeof o=="string")){if(n.every((o,i)=>o===r[i])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function Oa(t,e,r={}){let n=r.build!==void 0?wr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Aa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Aa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Aa(t.prerelease,r.prerelease),build:n};case"prerelease":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:Aa(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let i=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:i,patch:0,prerelease:[],build:n}}case"patch":{let i=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:i,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:Aa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var yu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Wo={operator:void 0,...yu};function hd(t,e){return xt(t,e)>0}function Cr(t,e){return xt(t,e)<0}function dk(t){let r=t.match(bD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:Cn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Cn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Cn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?St(o):[],build:i?wr(i):[]}:yu;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function pk(t){if(!Te(t.major))return Te(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Te(t.patch)?{operator:">=",major:+t.major,minor:+t.minor,patch:0,prerelease:[],build:[]}:{operator:">=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:t.prerelease?St(t.prerelease):[],build:[]}}function hk(t){if(!Te(t.major))return Te(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Te(t.patch)?{operator:"<",major:+t.major,minor:+t.minor+1,patch:0,prerelease:[],build:[]}:t.prerelease?{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:St(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function mk(t){let e=t.match(new RegExp(`^${mu}`)),r=e?.groups;if(!r)return null;let n=e[0].length,o=t.slice(n).match(/^\s+-\s+/);if(!o)return null;let i=o[0].length,s=t.slice(n+i).match(new RegExp(`^${mu}\\s*$`))?.groups;if(!s)return null;let u=pk(r),c=hk(s);return[u,c].filter(Boolean)}function gk(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Wo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return o===0?[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];let s=St(t.prerelease??"");return o===0?i===0?[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i,patch:a+1}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]:[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o+1,minor:0,patch:0}]}function yk(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Wo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function Dk(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:o,minor:0,patch:0}]:[{operator:"<",major:o,minor:0,patch:0}];if(n)return[{operator:"<",major:o,minor:i,patch:0}];let s=St(t.prerelease??""),u=wr(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function bk(t){let e=Te(t.minor),r=Te(t.patch),n=+t.major,o=+t.minor,i=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:o+1,patch:0}];if(r)return[{operator:"<",major:n,minor:o+1,patch:0}];let a=St(t.prerelease??""),s=wr(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function wk(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??""),u=wr(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function vk(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Wo];if(r)return n?[{operator:">=",major:o,minor:0,patch:0}]:[{operator:">=",major:o,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0}];let s=St(t.prerelease??""),u=wr(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function Ck(t){let e=Te(t.major),r=Te(t.minor),n=Te(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Wo];if(r)return[{operator:">=",major:o,minor:0,patch:0},{operator:"<",major:o+1,minor:0,patch:0}];if(n)return[{operator:">=",major:o,minor:i,patch:0},{operator:"<",major:o,minor:i+1,patch:0}];let s=St(t.prerelease??""),u=wr(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function Ek(t){let e=t.match(DD)?.groups;if(!e)return dk(t);switch(e.operator){case"^":return gk(e);case"~":case"~>":return yk(e);case"<":return Dk(e);case"<=":return bk(e);case">":return wk(e);case">=":return vk(e);case"=":case"":return Ck(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function _k(t){return t.split(/\s+/).flatMap(Ek)}function Du(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>mk(r)||_k(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function _e(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>dd)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${dd}`);t=t.trim();let e=t.match(gD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Cn(e.major,`Cannot parse version ${t}: invalid major version`),n=Cn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=Cn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?St(e.prerelease):[],a=e.buildmetadata?wr(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function wD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Xr(t)?!0:xa(t,[[e]]);if(n===void 0)return Xr(e)?!0:xa(e,[[t]]);let o=xt(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||o===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||o===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||o===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function Sk(t){return t.every(e=>e.some(r=>xk(r)))}function xk(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!wD(r,n))return!1}return!0}function vD(t,e){return Sk([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>wD(o,i)))))}function CD(t){try{return _e(t),!0}catch{return!1}}function ED(t,e){return xt(t,e)>=0}var ta=ue(T0()),Ag=ue(Jp()),kA=ue(Hb()),Ul=ue(Zc());function tE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var at=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let o=0;o<r.length;o++){let i=this.cast(n[o]).length;i>r[o]&&(r[o]=i)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let o=this.cast(e),i=n?tE("bold",o):o,a=r-o.length,s=this.theme.row[1];switch(typeof e){case"number":return s.repeat(a)+i;case"string":return i+s.repeat(a);case"boolean":case"object":return s.repeat(Math.ceil(a/2))+tE("italic",o)+s.repeat(Math.floor(a/2));default:return s.repeat(a)}}renderRow(e,r=!1){let n=this.theme.row,o=this.columnWidth();return n[0]+e.map((i,a)=>this.renderCell(i,o[a],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(o=>this.renderRow(o)),r||n?this.renderLine(e.bot):""].filter(o=>o.length>0).join(`
154
+ `)}};async function Qc(t){try{let r=`https://registry.npmjs.org/${encodeURIComponent(t.toLowerCase())}`,n=await fetch(r,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});return n.ok&&(await n.json())["dist-tags"]?.latest||null}catch{return null}}async function ge(){let t=await Qc("@capgo/cli")??"",e=t?.split(".")[0];t!==yr.version&&f.warning(`\u{1F6A8} You are using @capgo/cli@${yr.version} it's not the latest version.
155
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function K8(t){return new Promise(e=>{setTimeout(e,t)})}function G8(t){return new Date(t||"").toLocaleTimeString()}async function cr(t,e,r,n,o,i="\u2705"){await de(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function W8(t,e,r,n){if(be(e))throw await cr(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function Y8(t,e,r){try{let n=await lr(),o=r?{...e,rangeStart:r}:{...e},i=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:t},body:JSON.stringify(o)});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let a=await i.json();if(a?.length>0)return a}catch(n){console.error("Cannot get devices",n),f.error(`Cannot get stats ${U(n)}`)}return[]}function J8(t){let e={get:{summary:()=>"Update request by device. Waiting for download\u2026",level:"info",snag:"done"},delete:{summary:()=>"Bundle deleted on device",level:"info"},set:{summary:()=>"Bundle set on device \u2764\uFE0F",level:"info",snag:"set",stop:!0},NoChannelOrOverride:{summary:()=>"No default channel/override; create it in channel settings",level:"error"},needPlanUpgrade:{summary:({baseUrl:r})=>`Out of quota. Upgrade plan: ${r}/dashboard/settings/plans`,level:"error"},missingBundle:{summary:()=>"Requested bundle not found on server",level:"error"},noNew:{summary:()=>"Device already has latest available version",level:"info"},disablePlatformIos:{summary:()=>"iOS platform disabled in channel",level:"error"},disablePlatformAndroid:{summary:()=>"Android platform disabled in channel",level:"error"},disableAutoUpdate:{summary:()=>"Automatic updates disabled in channel",level:"error"},disableAutoUpdateToMajor:{summary:()=>"Auto-update to major versions disabled",level:"error"},disableAutoUpdateToMinor:{summary:()=>"Auto-update to minor versions disabled",level:"error"},disableAutoUpdateToPatch:{summary:()=>"Auto-update to patch versions disabled",level:"error"},disableAutoUpdateUnderNative:{summary:()=>"Channel update version is lower than device native",level:"error"},disableDevBuild:{summary:()=>"Dev build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},cannotGetBundle:{summary:()=>"Cannot retrieve bundle from channel",level:"error"},cannotUpdateViaPrivateChannel:{summary:()=>"No access to private channel",level:"error"},channelMisconfigured:{summary:()=>"Channel configuration invalid or incomplete",level:"error"},disableAutoUpdateMetadata:{summary:()=>"Auto-update on metadata disabled",level:"error"},set_fail:{summary:()=>"Bundle set failed. Possibly corrupted",level:"error"},reset:{summary:()=>"Device reset to builtin bundle",level:"warn"},update_fail:{summary:()=>"Installed bundle failed to call notifyAppReady",level:"error"},checksum_fail:{summary:()=>"Downloaded bundle checksum validation failed",level:"error"},windows_path_fail:{summary:()=>"Bundle contains illegal Windows-style paths",level:"error"},canonical_path_fail:{summary:()=>"Bundle contains non-canonical paths",level:"error"},directory_path_fail:{summary:()=>"Bundle ZIP contains invalid directory paths",level:"error"},unzip_fail:{summary:()=>"Failed to unzip bundle on device",level:"error"},low_mem_fail:{summary:()=>"Download failed due to low device memory",level:"error"},app_moved_to_background:{summary:()=>"App moved to background",level:"info"},app_moved_to_foreground:{summary:()=>"App moved to foreground",level:"info"},decrypt_fail:{summary:()=>"Failed to decrypt downloaded bundle",level:"error"},getChannel:{summary:()=>"Queried current channel on device",level:"info"},setChannel:{summary:()=>"Channel set on device",level:"info"},InvalidIp:{summary:()=>"Device appears in Google datacenter; blocking recent updates (<4h)",level:"warn"},uninstall:{summary:()=>"App uninstalled or Capgo data cleared on device",level:"warn"}};if(t.action.startsWith("download_")){let r=t.action.split("_")[1];return r==="complete"?{summary:()=>"Download complete; relaunch app to apply",level:"info",snag:"downloaded"}:r==="fail"?{summary:()=>"Download failed on device",level:"error"}:{summary:()=>`Downloading ${r}%`,level:"info"}}return e[t.action]||null}async function X8(t,e,r,n,o,i){let a=J8(t);if(!a)return{};a.snag&&await cr(e,r,n,a.snag);let s=G8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function lm(t,e,r,n,o){let i=!0,a=await lr(),s=`${a.hostWeb}/app/p/${r}`;await cr(t,n,e,"Use waitlog",r);let u={appId:r,devicesId:o?[o]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},c=null,l=new Set,d=ye(),p=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`);i;){await K8(5e3);let h=await Y8(e,u,c);if(h.length>0){let m=h.reduce((E,g)=>{let _=new Date(g.created_at).getTime();return Math.max(E,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let b=h.filter(E=>{let g=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return l.has(g)?!1:(l.add(g),!0)}).sort((E,g)=>new Date(E.created_at).getTime()-new Date(g.created_at).getTime()),y=new at;y.headers=["Time","Device","Key","Message"],y.theme=at.roundTheme,y.rows=[];let C=!1;for(let E of b){let{row:g,stop:_}=await X8(E,t,n,e,s,a.hostWeb);g&&y.rows.push(g),_&&(C=!0)}if(y.rows.length&&(d.stop(""),f.info(y.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`)),C){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function rE(t,e){ee("Debug Live update in Capgo"),await ge(),e.apikey=e.apikey||ne();let r=await te();t=le(t,r?.config);let n=e.device;if(!e.apikey)throw f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await bt(o,t),a=await we({message:"Automatic check if update working in device ?"});await W8("debug",a,i,e.apikey),a?(f.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await lm("debug",e.apikey,t,i,n),Z("Done \u2705")):Z("Canceled \u274C")}var fm=require("node:buffer"),nE=require("node:crypto"),Z8=(()=>{let t=[];for(let e=0;e<256;e++){let r=e;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t})();function Q8(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=Z8[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function on(t,e="sha256"){let r=fm.Buffer.isBuffer(t)?t:fm.Buffer.from(t);if(e==="crc32")return Q8(r);let n=(0,nE.createHash)(e);return n.update(r),n.digest("hex")}var As=ue(Rx());async function Bx(){let t=await(0,As.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function ng(t,e,r=!1){let n=await(0,As.loadConfig)(),{extConfig:o}=n.app;o&&(o.plugins||(o.plugins={extConfig:{},[t]:{}}),o.plugins[t]||(o.plugins[t]={}),r?o=e.config:o.plugins[t]=e.config.plugins?.[t],(0,As.writeConfig)(o,n.app.extConfigFilePath))}async function Xi(t,e=!1){await ng("CapacitorUpdater",t,e)}var ra=".capgo_key",Xt=".capgo_key_v2",Ml=`${ra}.pub`,ln=`${Xt}.pub`,EA="https://capgo.app",_A="https://files.capgo.app",SA="https://api.capgo.app",xA="https://console.capgo.app",Og=12e4,I5=1024*1024*20,T5=1024*1024*1024,R5=1024*1024*99,Mr="package.json",na=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,U=t=>t?`
156
+ ${kA.default.render(t)}`:"";function Ll(t){return new Promise(e=>{setTimeout(e,t)})}function PA(t){return(0,Ur.isMonorepo)(t)||(0,Ur.isNXMonorepo)(t)}function gt(t){return(0,Ur.isMonorepo)(t)?(0,Ur.findMonorepoRoot)(t):(0,Ur.isNXMonorepo)(t)?(0,Ur.findNXMonorepoRoot)(t):t}function $A(t=gt((0,Yt.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Pe.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw f.error(o),new Error(o)}let n=(0,Pe.readFileSync)(r??(0,Ae.join)(t,Mr));return JSON.parse(n)}function Fg(t=gt((0,Yt.cwd)()),e=void 0){return $A(t,e).scripts}function Or(t=gt((0,Yt.cwd)()),e=void 0){return $A(t,e).version??""}function AA(t){let e=t.replace("^","").replace("~","");if(CD(e))try{let r=_e(e);return vr(r)}catch{return e}return e}async function qr(t,e=(0,Yt.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let a=(await Jt(e,r)).get(t);if(a)return a}catch{}let n=null,o=(0,Ae.join)(e,"ios","App","Podfile");if((0,Pe.existsSync)(o))try{let a=(0,Pe.readFileSync)(o,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);a?.[1]&&(n=(0,Ae.resolve)((0,Ae.join)(e,"ios","App",a[1])))}catch{}if(!n){let i=(0,Ae.join)(e,"android","capacitor.settings.gradle");if((0,Pe.existsSync)(i))try{let s=(0,Pe.readFileSync)(i,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);s?.[1]&&(n=(0,Ae.resolve)((0,Ae.join)(e,"android",s[1])).replace(/\/android$/,""))}catch{}}if(n){let i=(0,Ae.join)(n,Mr);if((0,Pe.existsSync)(i))try{let a=JSON.parse((0,Pe.readFileSync)(i,"utf-8"));if(a.version)return a.version}catch{}}try{let a=(await Jt(e)).get(t);if(a)return a}catch{}return null}async function Jt(t=gt((0,Yt.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ae.join)(t,Mr)],r){for(let o of r)if(!(0,Pe.existsSync)(o)){let i=`Package.json at ${o} does not exist`;throw f.error(i),new Error(i)}}let n=new Map;for(let o of r){let i=(0,Pe.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,AA(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,AA(a.devDependencies[s]))}return n}async function te(){try{let t=await Bx();if(!t){let e="No capacitor config file found, run `cap init` first";throw f.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${U(t)}`;throw f.error(e),new Error(e)}}async function kg(t,e){let r=await te();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await ng(t,r)),r}async function Ps(t){return kg("CapacitorUpdater",t)}async function lr(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||EA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||xA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||_A,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||SA};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(f.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:EA,hostWeb:xA,hostFilesApi:_A,hostApi:SA}}}var B5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ql(){let t=await lr();try{let e=await fetch(`${t.hostApi}/private/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return{...await e.json(),...t}}catch{return f.info(`Local config ${U(t)}`),t}}async function IA(){let t=await lr();try{let e=await fetch(`${t.hostFilesApi}/files/config`);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return await e.json()}catch{return{partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1,maxUploadLength:T5,maxChunkSize:R5,alertUploadSize:I5}}}async function re(t,e,r){let n=await ql();if(e&&r&&(f.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw f.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,ta.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function N5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){f.error("Invalid API key or insufficient permissions.");let i=`Your key should be: ${r.map((a,s)=>r.length===1?`"${a}"`:s===r.length-1?`or "${a}"`:`"${a}", `).join("")} mode.`;throw f.error(i),new Error("Invalid API key or insufficient permissions.")}}async function TA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function RA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function L5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function j5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var vt=(a=>(a[a.none=0]="none",a[a.read=1]="read",a[a.upload=2]="upload",a[a.write=3]="write",a[a.admin=4]="admin",a[a.super_admin=5]="super_admin",a))(vt||{}),oa=(t,e)=>t>=e;async function BA(t,e,r){let{data:n,error:o}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(o)throw f.error("Cannot get permissions for organization!"),console.error(o),new Error("Cannot get permissions for organization");if(n.includes("perm")){let s=null;switch(n){case"perm_none":{s=0;break}case"perm_read":{s=1;break}case"perm_upload":{s=2;break}case"perm_write":{s=3;break}case"perm_admin":{s=4;break}case"perm_owner":{s=5;break}default:throw n.includes("invite")?(f.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(f.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:s}}let a=null;switch(n){case"INVALID_APIKEY":{a="INVALID_APIKEY";break}case"NO_APP":{a="NO_APP";break}case"NO_ORG":{a="NO_ORG";break}default:throw f.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:a}}async function NA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){f.error(`Cannot get cli warnings: ${U(o)}`);return}if(n.length>0){f.warn(`Found ${n.length} cli warnings for your organization.`);let i=null;for(let a of n){if(typeof a!="object"||typeof a.message!="string"||typeof a.fatal!="boolean"){f.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(f.error(`${s.message.replaceAll("\\n",`
157
157
  `)}`),i=new Error(s.message)):f.warn(`${s.message.replaceAll("\\n",`
158
- `)}`)}if(i)throw f.error("Please fix the warnings and try again."),i;f.info("End of cli warnings.")}}async function EA(t,e,r,n,o=!0){let i=await Ll();if(!await(n?C5(t,n,r):E5(t,e)))throw f.error(`You need to upgrade your plan to continue to use capgo.
158
+ `)}`)}if(i)throw f.error("Please fix the warnings and try again."),i;f.info("End of cli warnings.")}}async function LA(t,e,r,n,o=!0){let i=await ql();if(!await(n?j5(t,n,r):L5(t,e)))throw f.error(`You need to upgrade your plan to continue to use capgo.
159
159
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
160
- `),Il(100),Promise.resolve().then(()=>(wg(),bg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Il(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([bA(t,e),yA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
160
+ `),Ll(100),Promise.resolve().then(()=>(Sg(),_g)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Ll(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([RA(t,e),TA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
161
161
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
162
- `)}async function CA(t,e,r,n,o=!0){let i=await Ll(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw f.error(`You need to upgrade your plan to continue to use capgo.
162
+ `)}async function jA(t,e,r,n,o=!0){let i=await ql(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw f.error(`You need to upgrade your plan to continue to use capgo.
163
163
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
164
- `),Il(100),Promise.resolve().then(()=>(wg(),bg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Il(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([bA(t,e),yA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
164
+ `),Ll(100),Promise.resolve().then(()=>(Sg(),_g)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Ll(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([RA(t,e),TA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
165
165
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
166
- `)}function ne(t=!1){let e=Wt.env.CAPGO_TOKEN?.trim();if(e)return t||f.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Rl.homedir)(),n,o=`${r}/.capgo`;if((0,Pe.existsSync)(o)&&(t||f.info(`Use global API key ${o}`),n=(0,Pe.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,Pe.existsSync)(o)&&(t||f.info(`Use local API key ${o}`),n=(0,Pe.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${et().runner} @capacitor/cli login`;throw f.error(i),new Error(i)}return n}async function*xg(t){let e=await(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ae.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*xg(n):yield n}}function na(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function jl(){let t=(0,Wt.cwd)(),e=!1,r=(0,Ae.resolve)(t,"tsconfig.json");(0,Pe.existsSync)(r)&&(e=!0);for await(let n of xg(t)){if(n.includes("angular.json"))return f.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return f.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return f.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return f.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return f.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return f.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(Ur)){let o=(0,Ae.dirname)(n),i=await Yt(o);if(i){if(i.get("react"))return f.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return f.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function _A(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function Ag(t){if(t==="angular")return f.info("Angular project detected"),"build";if(t==="nuxtjs")return f.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(f.info("Nextjs project detected"),f.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),f.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await we({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(f.info("Sveltekit project detected"),f.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),f.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await we({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}return"build"}async function SA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,Wt.cwd)(),n=r.split("/").length;for await(let o of xg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,f.info(`Found main file here ${o}`);break}return e}async function Og(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function xA(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof Qi.FunctionsHttpError){let a=await i.error.context.json();f.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){f.error(`Cannot get upload url ${U(o)}`)}return""}async function*AA(t){let e=(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ae.join)(t,r.name);r.isDirectory()?yield*AA(n):yield n}}var OA="5.10.0",FA="6.25.0",ks="7.0.35";function Un(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&vr(t,_e(e))||t.major===6&&vr(t,_e(r))||t.major===7&&vr(t,_e(n)))}async function kA(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of AA(t)){if(r.some(s=>n.includes(s))){f.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,Pe.readFileSync)(n);if(o.length===0){f.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await nn(o,"sha256"),a=(0,Ae.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Ul(t){return(0,Rl.platform)()==="win32"?S5(t):_5(t)}function _5(t){let e=new Eg.default;return e.addLocalFolder(t),e.toBuffer()}async function S5(t){f.info("Zipping file windows mode");let e=new Eg.default,r=(n,o)=>{let i=(0,Pe.readdirSync)(n);for(let a of i){let s=(0,Ae.join)(n,a),u=(0,Pe.statSync)(s);if(u.isFile()){let c=(0,Pe.readFileSync)(s);e.addFile((0,Ae.join)(o,a).split(Ae.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Ae.join)(o,a))}};return r(t,""),e.toBuffer()}async function PA(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{fe(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Bl.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(d){if(f.error(`Error uploading bundle: ${d.message}`),d instanceof Bl.DetailedError){let p=d.originalResponse?.getBody(),h=JSON.parse(p||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,p){let h=(d/p*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await fe(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function $A(t,e,r){let n={app_id:e,name:r};try{let i=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(i.error){if(i.error instanceof Qi.FunctionsHttpError){let a=await i.error.context.json();f.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof Qi.FunctionsHttpError){let i=await o.context.json();f.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else f.error(`Cannot delete failed version: ${U(o)}`)}}async function Ml(t,e){if(!e.app_id||!e.name||!e.created_by)return f.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function fe(t,e,r){try{r&&f.info(`Get remove config: for ${e.event}`);let n=await Ll();r&&f.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let a=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:o.signal});if(clearTimeout(i),!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();s.error&&f.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(f.error("Failed to send Stats event details:"),f.error(U(n)))}}async function oa(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw f.error("Cannot get the list of organizations - exiting"),f.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw f.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw f.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let i=o.length>1?await yr({message:"Please pick the organization that you want to insert to",options:o.map(u=>({value:u.gid,label:u.name}))}):o[0].gid;if(be(i))throw f.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return f.info(`Using the organization "${s.name}" as the app owner`),s}async function ie(t,e,r=["all"]){await v5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw f.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function bt(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw f.error(`Cannot get organization id for app id ${e}`),U(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function ia(t){return new Date(t||"").toLocaleString()}var dA=!1,Zi="npm",Os="install",vg="npx";function et(){if(dA)return{pm:Zi,command:Os,installCommand:`${Zi} ${Os}`,runner:vg};let t=gt((0,Wt.cwd)());return Zi=Ca(t,"npm"),Os=fu(Zi),dA=!0,vg=oy(t),{pm:Zi,command:Os,installCommand:`${Zi} ${Os}`,runner:vg}}function TA(t){return(0,Pe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ae.join)(t,n.name);return n.isDirectory()?TA(o):o.split(`node_modules${Ae.sep}`)[1]||o})}async function Fg(t,e){let r=e?e.split(","):[],n;try{n=await Yt("",t)}catch(l){throw f.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Ae.default.resolve(o).replace(Ur,""):gt((0,Wt.cwd)());if(!n)throw f.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,d]of Object.entries(n))if(typeof d!="string")throw f.error(`Invalid dependency ${l}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Ae.join)((0,Wt.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,Pe.existsSync)(l))){let l=Ca(i,"npm"),d=fu(l);throw f.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,d])=>{let p=!1,h=!1;for(let m of a){let b=(0,Ae.join)(m,l);if((0,Pe.existsSync)(b)){p=!0;try{if(TA(b).some(E=>w5.test(E))){h=!0;break}}catch(D){throw f.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(D),D instanceof Error?D:new Error(`Error reading node_modules files for ${l}`)}}}if(!p){u=!0;let m=Ca(i,"npm"),b=fu(m);return f.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:d}}return{name:l,version:d,native:h}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw f.error("Missing dependencies or invalid dependencies"),f.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function x5(t,e,r){let{data:n,error:o}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),i=n;return o||i===null||!i.version||!i.version.checksum?null:i.version.checksum}function A5(t){if(!t)throw f.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw f.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw f.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw f.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function IA(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
166
+ `)}function ne(t=!1){let e=Yt.env.CAPGO_TOKEN?.trim();if(e)return t||f.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,jl.homedir)(),n,o=`${r}/.capgo`;if((0,Pe.existsSync)(o)&&(t||f.info(`Use global API key ${o}`),n=(0,Pe.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,Pe.existsSync)(o)&&(t||f.info(`Use local API key ${o}`),n=(0,Pe.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${tt().runner} @capacitor/cli login`;throw f.error(i),new Error(i)}return n}async function*Pg(t){let e=await(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ae.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*Pg(n):yield n}}function ia(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function Hl(){let t=(0,Yt.cwd)(),e=!1,r=(0,Ae.resolve)(t,"tsconfig.json");(0,Pe.existsSync)(r)&&(e=!0);for await(let n of Pg(t)){if(n.includes("angular.json"))return f.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return f.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return f.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return f.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return f.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return f.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(Mr)){let o=(0,Ae.dirname)(n),i=await Jt(o);if(i){if(i.get("react"))return f.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return f.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function UA(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function $g(t){if(t==="angular")return f.info("Angular project detected"),"build";if(t==="nuxtjs")return f.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(f.info("Nextjs project detected"),f.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),f.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await we({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(f.info("Sveltekit project detected"),f.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),f.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await we({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw f.error(r),new Error(r)}return"build"}return"build"}async function MA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,Yt.cwd)(),n=r.split("/").length;for await(let o of Pg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,f.info(`Found main file here ${o}`);break}return e}async function Ig(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function qA(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof ta.FunctionsHttpError){let a=await i.error.context.json();f.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){f.error(`Cannot get upload url ${U(o)}`)}return""}async function*HA(t){let e=(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ae.join)(t,r.name);r.isDirectory()?yield*HA(n):yield n}}var VA="5.10.0",zA="6.25.0",$s="7.0.30";function jn(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&Cr(t,_e(e))||t.major===6&&Cr(t,_e(r))||t.major===7&&Cr(t,_e(n)))}async function KA(t){let e=[],r=[".DS_Store",".git",".gitignore","node_modules","package-lock.json","tsconfig.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json","tsconfig.app.json","tsconfig.spec.json"];for await(let n of HA(t)){if(r.some(s=>n.includes(s))){f.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,Pe.readFileSync)(n);if(o.length===0){f.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await on(o,"sha256"),a=(0,Ae.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Vl(t){return(0,jl.platform)()==="win32"?M5(t):U5(t)}function U5(t){let e=new Ag.default;return e.addLocalFolder(t),e.toBuffer()}async function M5(t){f.info("Zipping file windows mode");let e=new Ag.default,r=(n,o)=>{let i=(0,Pe.readdirSync)(n);for(let a of i){let s=(0,Ae.join)(n,a),u=(0,Pe.statSync)(s);if(u.isFile()){let c=(0,Pe.readFileSync)(s);e.addFile((0,Ae.join)(o,a).split(Ae.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Ae.join)(o,a))}};return r(t,""),e.toBuffer()}async function GA(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{de(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Ul.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(d){if(f.error(`Error uploading bundle: ${d.message}`),d instanceof Ul.DetailedError){let p=d.originalResponse?.getBody(),h=JSON.parse(p||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,p){let h=(d/p*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await de(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function WA(t,e,r){let n={app_id:e,name:r};try{let i=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(i.error){if(i.error instanceof ta.FunctionsHttpError){let a=await i.error.context.json();f.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else f.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof ta.FunctionsHttpError){let i=await o.context.json();f.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else f.error(`Cannot delete failed version: ${U(o)}`)}}async function zl(t,e){if(!e.app_id||!e.name||!e.created_by)return f.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function de(t,e,r){try{r&&f.info(`Get remove config: for ${e.event}`);let n=await ql();r&&f.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let o=new AbortController,i=setTimeout(()=>o.abort(),1e4);try{let a=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:o.signal});if(clearTimeout(i),!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let s=await a.json();s.error&&f.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(f.error("Failed to send Stats event details:"),f.error(U(n)))}}async function aa(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw f.error("Cannot get the list of organizations - exiting"),f.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let o=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw f.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw f.error(`Could not find organization with roles: ${e.join(" or ")} please create an organization or ask the admin to add you to the organization with this roles`),new Error("Could not find organization with required roles");let i=o.length>1?await br({message:"Please pick the organization that you want to insert to",options:o.map(u=>({value:u.gid,label:u.name}))}):o[0].gid;if(be(i))throw f.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return f.info(`Using the organization "${s.name}" as the app owner`),s}async function ie(t,e,r=["all"]){await N5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw f.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function bt(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw f.error(`Cannot get organization id for app id ${e}`),U(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function sa(t){return new Date(t||"").toLocaleString()}var OA=!1,ea="npm",ks="install",xg="npx";function tt(){if(OA)return{pm:ea,command:ks,installCommand:`${ea} ${ks}`,runner:xg};let t=gt((0,Yt.cwd)());return ea=Sa(t,"npm"),ks=pu(ea),OA=!0,xg=cD(t),{pm:ea,command:ks,installCommand:`${ea} ${ks}`,runner:xg}}function YA(t){return(0,Pe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ae.join)(t,n.name);return n.isDirectory()?YA(o):o.split(`node_modules${Ae.sep}`)[1]||o})}async function Tg(t,e){let r=e?e.split(","):[],n;try{n=await Jt("",t)}catch(l){throw f.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?Ae.default.resolve(o).replace(Mr,""):gt((0,Yt.cwd)());if(!n)throw f.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,d]of Object.entries(n))if(typeof d!="string")throw f.error(`Invalid dependency ${l}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Ae.join)((0,Yt.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,Pe.existsSync)(l))){let l=Sa(i,"npm"),d=pu(l);throw f.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,d])=>{let p=!1,h=!1;for(let m of a){let b=(0,Ae.join)(m,l);if((0,Pe.existsSync)(b)){p=!0;try{if(YA(b).some(C=>B5.test(C))){h=!0;break}}catch(y){throw f.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(y),y instanceof Error?y:new Error(`Error reading node_modules files for ${l}`)}}}if(!p){u=!0;let m=Sa(i,"npm"),b=pu(m);return f.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:d}}return{name:l,version:d,native:h}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw f.error("Missing dependencies or invalid dependencies"),f.error("If you use monorepo, workspace or any special package manager you can use the --package-json [path,] and --node-modules [path,] options to make the command work properly"),new Error("Missing dependencies or invalid dependencies");return c}async function q5(t,e,r){let{data:n,error:o}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),i=n;return o||i===null||!i.version||!i.version.checksum?null:i.version.checksum}function H5(t){if(!t)throw f.error("Error parsing native packages, perhaps the metadata does not exist in Capgo?"),new Error("Error parsing native packages");for(let r of t){if(typeof r!="object")throw f.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:o}=r;if(!n||typeof n!="string")throw f.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!o||typeof o!="string")throw f.error(`Invalid remote native package version: ${o}, expected string, got ${typeof o}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function JA(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
167
167
  native_packages
168
- )`).eq("name",r).eq("app_id",e).single();if(o)throw f.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return A5(n.version.native_packages??[])}async function RA(t,e,r,n){let o=De();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await x5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw f.error(`Cannot upload the same bundle content.
168
+ )`).eq("name",r).eq("app_id",e).single();if(o)throw f.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return H5(n.version.native_packages??[])}async function XA(t,e,r,n){let o=ye();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await q5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw f.error(`Cannot upload the same bundle content.
169
169
  Current bundle checksum matches remote bundle for channel ${r}
170
170
  Did you build your app before uploading?
171
- PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function ce(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function ko(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=gu(t.localVersion),r=gu(t.remoteVersion);return gy(e,r)}catch{return!1}}async function ql(t,e,r,n,o){let i=await Fg(n,o),a=await IA(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function kg(t,e,r,n){let o=await IA(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function Hl(t,e,r){let n=await we({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(be(n))throw t&&e&&r&&await ur("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=et(),i=De();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,pA.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),f.error(`Failed to run Capacitor sync: ${a}`),f.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=et();f.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),f.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function BA(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=et(),a=await wA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||f.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||f.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||f.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${vt[a.data]}, required for this action: ${vt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var dr="assets/icon.png";var O5=/^[a-z0-9]+(\.[\w-]+)+$/i;function F5(t,e,r){if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||f.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!O5.test(t))throw r||(f.error(`Invalid app ID format: "${t}"`),f.info("App ID must be in reverse domain notation (e.g., com.example.app)"),f.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),f.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function k5(t,e,r){if(await BA(t,e))throw e==="io.ionic.starter"?(r||f.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||f.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Pg(t,e,r,n=!1){n||ee("Adding"),await ge(),e.apikey=e.apikey||ne();let o=await te(),i=ce(t,o?.config);F5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await k5(a,i,n),r||(r=await oa(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||f.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||f.info(`Adding ${i} to Capgo`);let d=null,p=null;l&&(0,aa.existsSync)(l)?(d=(0,aa.readFileSync)(l),p=na(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,aa.existsSync)(dr)?(d=(0,aa.readFileSync)(dr),p=na(dr)||"image/png",n||f.warn(`Found app icon ${dr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${dr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(D)throw n||console.error(D),n||f.error(`Could not add app ${U(D)}`),new Error(`Could not add app ${U(D)}`);let{data:E}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=E?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||f.error(`Could not add app ${U(b)}`),new Error(`Could not add app ${U(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),Z("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function NA(t,e){await Pg(t,e,void 0)}async function P5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=ce(t,o?.config);if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await Me(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{f.warn("Deleting the app is not recommended for users that are not the organization owner"),f.warn("You are invited as a super_admin but your are not the owner"),f.warn("It's strongly recommended that you do not continue!");let b=await yr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(b)||b==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${U(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);d&&!r&&f.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&f.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||f.error("Could not delete app"),new Error(`Could not delete app: ${U(h)}`);let m=await bt(a,i);return await fe(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(f.success("App deleted in Capgo"),Z("Done \u2705")),!0}async function LA(t,e){return P5(t,e,!1,!1)}var Vl=require("node:os"),UA=require("node:process");async function jA(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Xc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function $5(){let t=await Yt(),e={"@capgo/cli":gr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function T5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Ar("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=ce("",r?.config),s=r?.config?.webDir||"";e||(f.info(` App Name: ${i}`),f.info(` App ID: ${a}`),f.info(` App Version: ${o}`),f.info(` Web Dir: ${s}`),f.info(` OS: ${(0,Vl.platform)()} ${(0,Vl.version)()}`),f.info(` Node: ${UA.version}`),f.info(" Installed Dependencies:"));let u=await $5();if(Object.keys(u).length===0)throw e||f.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))f.info(` ${l}: ${u[l]}`);let c={};if(e)c=await jA(u);else{let l=De();l.start("Running: Loading latest dependencies"),c=await jA(u),l.stop("Latest Dependencies:");for(let d of Object.keys(c))f.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||f.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||f.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function MA(t){return T5(t)}function I5(t){let e=new at;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,ia(r.created_at)]);f.success("Apps"),f.success(e.toString())}async function R5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||f.error("Apps not found"),new Error("Apps not found");return r??[]}async function B5(t,e=!1){e||ee("List apps in Capgo"),await ge(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ie(r,t.apikey,["write","all","read","upload"]),e||f.info("Getting active bundle in Capgo");let n=await R5(r,e);if(!n.length)throw e||f.error("No apps found"),new Error("No apps found");return e||(f.info(`Active app in Capgo: ${n.length}`),I5(n),Z("Done \u2705")),n}async function qA(t){return B5(t,!1)}var HA=require("node:crypto"),sa=require("node:fs");async function N5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=ce(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),a=(await oa(o,["admin","super_admin"])).gid,s=await ie(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||f.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||f.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||f.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,p,h=`icon_${(0,HA.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,sa.existsSync)(c)?(d=(0,sa.readFileSync)(c),p=na(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,sa.existsSync)(dr)?(d=(0,sa.readFileSync)(dr),p=na(dr)||"image/png",r||f.warn(`Found app icon ${dr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${dr}`),d&&p){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,d,{contentType:p});if(D)throw r||f.error(`Could not set app ${U(D)}`),new Error(`Could not set app: ${U(D)}`);let{data:E}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=E?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||f.error(`Could not set app ${U(b)}`),new Error(`Could not set app: ${U(b)}`);return r||Z("Done \u2705"),!0}async function VA(t,e){return N5(t,e)}async function L5(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||f.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||f.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||f.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||f.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Yi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${U(n)}`),new Error(`Cannot set capacitor config: ${U(n)}`)}r||Z("Done \u2705")}async function zA(t,e){return L5(t,e)}var $o=require("node:fs"),To=require("node:path"),Xt=de(require("node:process"));var Po=require("node:fs/promises"),KA=require("node:os"),$g=require("node:path"),Oe=require("node:process"),GA=(0,$g.join)((0,KA.homedir)(),".capgo-credentials"),WA=(0,$g.join)(GA,"credentials.json");async function ua(t){return(await(0,Po.readFile)(t)).toString("base64")}async function Kl(){try{let t=await(0,Po.readFile)(WA,"utf-8");return JSON.parse(t)}catch{return{}}}async function Ps(t){let e=await Kl();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function zl(t){await(0,Po.mkdir)(GA,{recursive:!0}),await(0,Po.writeFile)(WA,JSON.stringify(t,null,2),"utf-8")}function j5(){let t={};return Oe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Oe.env.BUILD_CERTIFICATE_BASE64),Oe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Oe.env.BUILD_PROVISION_PROFILE_BASE64),Oe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Oe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Oe.env.P12_PASSWORD&&(t.P12_PASSWORD=Oe.env.P12_PASSWORD),Oe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Oe.env.APPLE_KEY_ID),Oe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Oe.env.APPLE_ISSUER_ID),Oe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Oe.env.APPLE_KEY_CONTENT),Oe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Oe.env.APPLE_PROFILE_NAME),Oe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Oe.env.APP_STORE_CONNECT_TEAM_ID),Oe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Oe.env.ANDROID_KEYSTORE_FILE),Oe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Oe.env.KEYSTORE_KEY_ALIAS),Oe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Oe.env.KEYSTORE_KEY_PASSWORD),Oe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Oe.env.KEYSTORE_STORE_PASSWORD),Oe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Oe.env.PLAY_CONFIG_JSON),t}async function YA(t,e,r){let n=await Ps(t),o=j5(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function JA(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await ua(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await ua(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await ua(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await ua(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await ua(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await ua(e.PLAY_CONFIG_JSON_PATH))),n}async function XA(t,e,r){let n=await Kl(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await zl(n)}async function Gl(t,e){let r=await Kl();if(!t){await zl({});return}if(!e){delete r[t],await zl(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await zl(r)}async function ZA(t,e){return(await Ps(t))?.[e]||null}async function Tg(){let t=await Kl();return Object.keys(t)}async function QA(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),Xt.default.exit(1));let e=await te(),r=ce(t.appId,e?.config);r||(f.error("\u274C App ID is required."),f.error(""),f.error("Either:"),f.error(" 1. Run this command from a Capacitor project directory, OR"),f.error(" 2. Provide --appId explicitly: --appId com.example.app"),f.error(""),Xt.default.exit(1));let n=t.platform;f.info(`
171
+ PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function le(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function $o(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Du(t.localVersion),r=Du(t.remoteVersion);return vD(e,r)}catch{return!1}}async function Kl(t,e,r,n,o){let i=await Tg(n,o),a=await JA(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Rg(t,e,r,n){let o=await JA(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function Gl(t,e,r){let n=await we({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(be(n))throw t&&e&&r&&await cr("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=tt(),i=ye();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,FA.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),f.error(`Failed to run Capacitor sync: ${a}`),f.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=tt();f.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),f.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function ZA(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=tt(),a=await BA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||f.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||f.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||f.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${vt[a.data]}, required for this action: ${vt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var pr="assets/icon.png";var V5=/^[a-z0-9]+(\.[\w-]+)+$/i;function z5(t,e,r){if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||f.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!V5.test(t))throw r||(f.error(`Invalid app ID format: "${t}"`),f.info("App ID must be in reverse domain notation (e.g., com.example.app)"),f.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),f.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function K5(t,e,r){if(await ZA(t,e))throw e==="io.ionic.starter"?(r||f.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||f.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Bg(t,e,r,n=!1){n||ee("Adding"),await ge(),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);z5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await K5(a,i,n),r||(r=await aa(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||f.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||f.info(`Adding ${i} to Capgo`);let d=null,p=null;l&&(0,ua.existsSync)(l)?(d=(0,ua.readFileSync)(l),p=ia(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,ua.existsSync)(pr)?(d=(0,ua.readFileSync)(pr),p=ia(pr)||"image/png",n||f.warn(`Found app icon ${pr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${pr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:y}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(y)throw n||console.error(y),n||f.error(`Could not add app ${U(y)}`),new Error(`Could not add app ${U(y)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||f.error(`Could not add app ${U(b)}`),new Error(`Could not add app ${U(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),Z("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function QA(t,e){await Bg(t,e,void 0)}async function G5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await Me(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{f.warn("Deleting the app is not recommended for users that are not the organization owner"),f.warn("You are invited as a super_admin but your are not the owner"),f.warn("It's strongly recommended that you do not continue!");let b=await br({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(b)||b==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${U(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);d&&!r&&f.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&f.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||f.error("Could not delete app"),new Error(`Could not delete app: ${U(h)}`);let m=await bt(a,i);return await de(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(f.success("App deleted in Capgo"),Z("Done \u2705")),!0}async function e1(t,e){return G5(t,e,!1,!1)}var Wl=require("node:os"),r1=require("node:process");async function t1(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Qc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function W5(){let t=await Jt(),e={"@capgo/cli":yr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function Y5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Or("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=le("",r?.config),s=r?.config?.webDir||"";e||(f.info(` App Name: ${i}`),f.info(` App ID: ${a}`),f.info(` App Version: ${o}`),f.info(` Web Dir: ${s}`),f.info(` OS: ${(0,Wl.platform)()} ${(0,Wl.version)()}`),f.info(` Node: ${r1.version}`),f.info(" Installed Dependencies:"));let u=await W5();if(Object.keys(u).length===0)throw e||f.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))f.info(` ${l}: ${u[l]}`);let c={};if(e)c=await t1(u);else{let l=ye();l.start("Running: Loading latest dependencies"),c=await t1(u),l.stop("Latest Dependencies:");for(let d of Object.keys(c))f.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||f.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||f.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function n1(t){return Y5(t)}function J5(t){let e=new at;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,sa(r.created_at)]);f.success("Apps"),f.success(e.toString())}async function X5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||f.error("Apps not found"),new Error("Apps not found");return r??[]}async function Z5(t,e=!1){e||ee("List apps in Capgo"),await ge(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ie(r,t.apikey,["write","all","read","upload"]),e||f.info("Getting active bundle in Capgo");let n=await X5(r,e);if(!n.length)throw e||f.error("No apps found"),new Error("No apps found");return e||(f.info(`Active app in Capgo: ${n.length}`),J5(n),Z("Done \u2705")),n}async function o1(t){return Z5(t,!1)}var i1=require("node:crypto"),ca=require("node:fs");async function Q5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),a=(await aa(o,["admin","super_admin"])).gid,s=await ie(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||f.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||f.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||f.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,p,h=`icon_${(0,i1.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ca.existsSync)(c)?(d=(0,ca.readFileSync)(c),p=ia(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,ca.existsSync)(pr)?(d=(0,ca.readFileSync)(pr),p=ia(pr)||"image/png",r||f.warn(`Found app icon ${pr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${pr}`),d&&p){let{error:y}=await o.storage.from(`images/org/${a}/${t}`).upload(h,d,{contentType:p});if(y)throw r||f.error(`Could not set app ${U(y)}`),new Error(`Could not set app: ${U(y)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||f.error(`Could not set app ${U(b)}`),new Error(`Could not set app: ${U(b)}`);return r||Z("Done \u2705"),!0}async function a1(t,e){return Q5(t,e)}async function eM(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||f.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||f.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||f.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||f.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Xi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${U(n)}`),new Error(`Cannot set capacitor config: ${U(n)}`)}r||Z("Done \u2705")}async function s1(t,e){return eM(t,e)}var To=require("node:fs"),Ro=require("node:path"),Zt=ue(require("node:process"));var Io=require("node:fs/promises"),u1=require("node:os"),Ng=require("node:path"),Oe=require("node:process"),c1=(0,Ng.join)((0,u1.homedir)(),".capgo-credentials"),l1=(0,Ng.join)(c1,"credentials.json");async function la(t){return(await(0,Io.readFile)(t)).toString("base64")}async function Jl(){try{let t=await(0,Io.readFile)(l1,"utf-8");return JSON.parse(t)}catch{return{}}}async function Is(t){let e=await Jl();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Yl(t){await(0,Io.mkdir)(c1,{recursive:!0}),await(0,Io.writeFile)(l1,JSON.stringify(t,null,2),"utf-8")}function tM(){let t={};return Oe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Oe.env.BUILD_CERTIFICATE_BASE64),Oe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Oe.env.BUILD_PROVISION_PROFILE_BASE64),Oe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Oe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Oe.env.P12_PASSWORD&&(t.P12_PASSWORD=Oe.env.P12_PASSWORD),Oe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Oe.env.APPLE_KEY_ID),Oe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Oe.env.APPLE_ISSUER_ID),Oe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Oe.env.APPLE_KEY_CONTENT),Oe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Oe.env.APPLE_PROFILE_NAME),Oe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Oe.env.APP_STORE_CONNECT_TEAM_ID),Oe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Oe.env.ANDROID_KEYSTORE_FILE),Oe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Oe.env.KEYSTORE_KEY_ALIAS),Oe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Oe.env.KEYSTORE_KEY_PASSWORD),Oe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Oe.env.KEYSTORE_STORE_PASSWORD),Oe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Oe.env.PLAY_CONFIG_JSON),t}async function f1(t,e,r){let n=await Is(t),o=tM(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function d1(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await la(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await la(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await la(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await la(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await la(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await la(e.PLAY_CONFIG_JSON_PATH))),n}async function p1(t,e,r){let n=await Jl(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Yl(n)}async function Xl(t,e){let r=await Jl();if(!t){await Yl({});return}if(!e){delete r[t],await Yl(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Yl(r)}async function h1(t,e){return(await Is(t))?.[e]||null}async function Lg(){let t=await Jl();return Object.keys(t)}async function m1(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),Zt.default.exit(1));let e=await te(),r=le(t.appId,e?.config);r||(f.error("\u274C App ID is required."),f.error(""),f.error("Either:"),f.error(" 1. Run this command from a Capacitor project directory, OR"),f.error(" 2. Provide --appId explicitly: --appId com.example.app"),f.error(""),Zt.default.exit(1));let n=t.platform;f.info(`
172
172
  \u{1F512} SECURITY NOTICE:`),f.info(" - Credentials saved to ~/.capgo-credentials/credentials.json (local only)"),f.info(" - When building, credentials are sent to Capgo servers"),f.info(" - Credentials are NEVER stored on Capgo servers"),f.info(" - Auto-deleted after build (max 24 hours)"),f.info(` - Builds sent directly to app stores - Capgo keeps nothing
173
- `);let o={},i={};if(n==="ios"){if(t.certificate){let u=(0,To.resolve)(t.certificate);(0,$o.existsSync)(u)||(f.error(`Certificate file not found: ${u}`),Xt.default.exit(1)),i.BUILD_CERTIFICATE_FILE=u,f.info(`\u2713 Certificate file: ${u}`)}if(t.provisioningProfile){let u=(0,To.resolve)(t.provisioningProfile);(0,$o.existsSync)(u)||(f.error(`Provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=u,f.info(`\u2713 Provisioning profile: ${u}`)}if(t.provisioningProfileProd){let u=(0,To.resolve)(t.provisioningProfileProd);(0,$o.existsSync)(u)||(f.error(`Production provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=u,f.info(`\u2713 Production provisioning profile: ${u}`)}if(t.appleKey){let u=(0,To.resolve)(t.appleKey);(0,$o.existsSync)(u)||(f.error(`Apple key file not found: ${u}`),Xt.default.exit(1)),i.APPLE_KEY_FILE=u,f.info(`\u2713 Apple key file: ${u}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(f.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),f.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let l=(0,To.resolve)(t.keystore);(0,$o.existsSync)(l)||(f.error(`Keystore file not found: ${l}`),Xt.default.exit(1)),i.ANDROID_KEYSTORE_PATH=l,f.info(`\u2713 Keystore file: ${l}`)}if(t.playConfig){let l=(0,To.resolve)(t.playConfig);(0,$o.existsSync)(l)||(f.error(`Play config file not found: ${l}`),Xt.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=l,f.info(`\u2713 Play Store config: ${l}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let u=!!t.keystoreKeyPassword,c=!!t.keystoreStorePassword;u&&!c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!u&&c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):u&&c&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await JA(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){f.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),f.error("");for(let u of s)f.error(` \u2022 ${u}`);f.error(""),f.error("Example:"),n==="ios"?(f.error(" npx @capgo/cli build credentials save --platform ios \\"),f.error(" --certificate ./cert.p12 \\"),f.error(' --p12-password "your-password" \\ # Optional if cert has no password'),f.error(" --provisioning-profile ./profile.mobileprovision \\"),f.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),f.error(' --apple-key-id "XXXXXXXXXX" \\'),f.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),f.error(' --apple-team-id "XXXXXXXXXX" \\'),f.error(' --apple-profile-name "match AppStore com.example.app"')):(f.error(" npx @capgo/cli build credentials save --platform android \\"),f.error(" --keystore ./release.keystore \\"),f.error(' --keystore-alias "my-key-alias" \\'),f.error(' --keystore-key-password "password" \\'),f.error(" --play-config ./play-store-service-account.json"),f.error(""),f.error(" Note: If both key and store passwords are the same, you only need to provide one."),f.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),f.error(" The --play-config is required for uploading to Google Play Store.")),f.error(""),Xt.default.exit(1)}await XA(r,n,a);try{let u=ne(!0);if(u){let c=await re(u),l=await bt(c,r);await fe(u,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:l,tags:{"app-id":r,platform:n},notify:!1}).catch()}}catch{}f.success(`
173
+ `);let o={},i={};if(n==="ios"){if(t.certificate){let u=(0,Ro.resolve)(t.certificate);(0,To.existsSync)(u)||(f.error(`Certificate file not found: ${u}`),Zt.default.exit(1)),i.BUILD_CERTIFICATE_FILE=u,f.info(`\u2713 Certificate file: ${u}`)}if(t.provisioningProfile){let u=(0,Ro.resolve)(t.provisioningProfile);(0,To.existsSync)(u)||(f.error(`Provisioning profile not found: ${u}`),Zt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=u,f.info(`\u2713 Provisioning profile: ${u}`)}if(t.provisioningProfileProd){let u=(0,Ro.resolve)(t.provisioningProfileProd);(0,To.existsSync)(u)||(f.error(`Production provisioning profile not found: ${u}`),Zt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=u,f.info(`\u2713 Production provisioning profile: ${u}`)}if(t.appleKey){let u=(0,Ro.resolve)(t.appleKey);(0,To.existsSync)(u)||(f.error(`Apple key file not found: ${u}`),Zt.default.exit(1)),i.APPLE_KEY_FILE=u,f.info(`\u2713 Apple key file: ${u}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(f.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),f.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let l=(0,Ro.resolve)(t.keystore);(0,To.existsSync)(l)||(f.error(`Keystore file not found: ${l}`),Zt.default.exit(1)),i.ANDROID_KEYSTORE_PATH=l,f.info(`\u2713 Keystore file: ${l}`)}if(t.playConfig){let l=(0,Ro.resolve)(t.playConfig);(0,To.existsSync)(l)||(f.error(`Play config file not found: ${l}`),Zt.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=l,f.info(`\u2713 Play Store config: ${l}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let u=!!t.keystoreKeyPassword,c=!!t.keystoreStorePassword;u&&!c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!u&&c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):u&&c&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await d1(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){f.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),f.error("");for(let u of s)f.error(` \u2022 ${u}`);f.error(""),f.error("Example:"),n==="ios"?(f.error(" npx @capgo/cli build credentials save --platform ios \\"),f.error(" --certificate ./cert.p12 \\"),f.error(' --p12-password "your-password" \\ # Optional if cert has no password'),f.error(" --provisioning-profile ./profile.mobileprovision \\"),f.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),f.error(' --apple-key-id "XXXXXXXXXX" \\'),f.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),f.error(' --apple-team-id "XXXXXXXXXX" \\'),f.error(' --apple-profile-name "match AppStore com.example.app"')):(f.error(" npx @capgo/cli build credentials save --platform android \\"),f.error(" --keystore ./release.keystore \\"),f.error(' --keystore-alias "my-key-alias" \\'),f.error(' --keystore-key-password "password" \\'),f.error(" --play-config ./play-store-service-account.json"),f.error(""),f.error(" Note: If both key and store passwords are the same, you only need to provide one."),f.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),f.error(" The --play-config is required for uploading to Google Play Store.")),f.error(""),Zt.default.exit(1)}await p1(r,n,a);try{let u=ne(!0);if(u){let c=await re(u),l=await bt(c,r);await de(u,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:l,tags:{"app-id":r,platform:n},notify:!1}).catch()}}catch{}f.success(`
174
174
  \u2705 ${n.toUpperCase()} credentials saved successfully for ${r}!`),f.info(" Location: ~/.capgo-credentials/credentials.json"),f.info(` Use: npx @capgo/cli build ${r} --platform ${n}
175
- `)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function e1(t){try{let e=await Tg();if(e.length===0){f.info("No saved credentials found."),f.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}f.info(`
175
+ `)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),Zt.default.exit(1)}}async function g1(t){try{let e=await Lg();if(e.length===0){f.info("No saved credentials found."),f.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}f.info(`
176
176
  \u{1F4CB} Saved Build Credentials:
177
- `);let r=await te(),n=t?.appId||ce(void 0,r?.config),o=n?[n]:e;for(let i of o){let a=await Ps(i);if(a){if(f.info(`
177
+ `);let r=await te(),n=t?.appId||le(void 0,r?.config),o=n?[n]:e;for(let i of o){let a=await Is(i);if(a){if(f.info(`
178
178
  \u{1F539} App: ${i}`),a.ios){f.info(" iOS Credentials:");let s=a.ios;s.BUILD_CERTIFICATE_BASE64&&f.info(" \u2713 Certificate (base64)"),s.BUILD_PROVISION_PROFILE_BASE64&&f.info(" \u2713 Provisioning Profile (base64)"),s.BUILD_PROVISION_PROFILE_BASE64_PROD&&f.info(" \u2713 Production Provisioning Profile (base64)"),s.APPLE_KEY_CONTENT&&f.info(" \u2713 Apple Key Content (base64)"),s.P12_PASSWORD&&f.info(" \u2713 P12 Password: ********"),s.APPLE_KEY_ID&&f.info(` \u2713 Apple Key ID: ${s.APPLE_KEY_ID}`),s.APPLE_ISSUER_ID&&f.info(` \u2713 Apple Issuer ID: ${s.APPLE_ISSUER_ID}`),s.APP_STORE_CONNECT_TEAM_ID&&f.info(` \u2713 Team ID: ${s.APP_STORE_CONNECT_TEAM_ID}`)}if(a.android){f.info(" Android Credentials:");let s=a.android;s.ANDROID_KEYSTORE_FILE&&f.info(" \u2713 Keystore (base64)"),s.PLAY_CONFIG_JSON&&f.info(" \u2713 Play Store Config (base64)"),s.KEYSTORE_KEY_ALIAS&&f.info(` \u2713 Keystore Alias: ${s.KEYSTORE_KEY_ALIAS}`),s.KEYSTORE_KEY_PASSWORD&&f.info(" \u2713 Key Password: ********"),s.KEYSTORE_STORE_PASSWORD&&f.info(" \u2713 Store Password: ********")}}}f.info(`
179
179
  Location: ~/.capgo-credentials/credentials.json`),f.info(`
180
180
  \u{1F512} These credentials are stored locally on your machine only.`),f.info(" When building, they are sent to Capgo but NEVER stored there."),f.info(" They are auto-deleted after build completion (max 24 hours)."),f.info(` Builds sent directly to app stores - Capgo keeps nothing.
181
- `)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function t1(t){try{let e=await te(),r=t.appId||ce(void 0,e?.config);if(r&&t.platform){if(!await ZA(r,t.platform)){f.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await Gl(r,t.platform),f.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let n=await Ps(r);if(!n||!n.ios&&!n.android){f.info(`No credentials found for ${r}.`);return}await Gl(r),f.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await Tg()).length===0){f.info("No saved credentials found.");return}await Gl(),f.success("\u2705 All credentials cleared for all apps!")}f.info(` Location: ~/.capgo-credentials/credentials.json
182
- `)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}var cn=require("node:fs"),Or=require("node:fs/promises"),n1=require("node:os"),Fr=require("node:path"),Ig=de(require("node:process"));var o1=de(Kp()),Wl=de(Jc());async function U5(t,e,r,n,o){if(!o)try{let i=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!i.ok){f.warn("Could not stream logs, continuing...");return}let a=i.body?.getReader();if(!a)return;let s=new TextDecoder;for(;;){let{done:u,value:c}=await a.read();if(u)break;let d=s.decode(c,{stream:!0}).split(`
183
- `);for(let p of d)if(p.startsWith("data: ")){let h=p.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function M5(t,e,r,n,o,i){let s=0;for(;s<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:o}});if(!u.ok){i||f.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),s++}catch(u){i||f.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||f.warn("Build status polling timed out"),"timeout"}async function q5(t,e){let r=new Set;if(e==="ios"){let n=(0,Fr.join)(t,"ios/App/Podfile");if((0,cn.existsSync)(n)){let i=(await(0,Or.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let a of i){let s=a[1];r.add(`node_modules/${s}/Package.swift`),r.add(`node_modules/${s}/*.podspec`),r.add(`node_modules/${s}/ios/`)}}}else if(e==="android"){let n=(0,Fr.join)(t,"android/capacitor.settings.gradle");if((0,cn.existsSync)(n)){let i=(await(0,Or.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of i){let u=a[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function r1(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r)if(n.startsWith(o))return!0;return!1}function $s(t,e,r,n,o){let i=(0,cn.readdirSync)(e);for(let a of i){let s=(0,Fr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,cn.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite")continue;if(a===n){$s(t,s,u,n,o);continue}if(a==="node_modules"){$s(t,s,u,n,o);continue}if(a==="resources"){$s(t,s,u,n,o);continue}let l=u.replace(/\\/g,"/");(r1(u,n,o)||Array.from(o).some(p=>p.startsWith(`${l}/`)))&&$s(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;r1(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function H5(t,e,r){let n=await q5(t,r),o=new o1.default;$s(o,t,"",r,n),await(0,Or.writeFile)(e,o.toBuffer())}async function V5(t,e,r=!1){let n=Date.now();try{e.apikey=e.apikey||ne(r);let o=await te();if(t=t||o?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let i=(0,Fr.resolve)(e.path||Ig.default.cwd()),a=e.supaHost||"https://api.capgo.app",s=await re(e.apikey,e.supaHost,e.supaAnon);await ie(s,e.apikey,["write","all"]);let u=await bt(s,t);r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.platform}`),f.info(`Project: ${i}`),f.info(`API host: ${a}`),f.info(`
181
+ `)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),Zt.default.exit(1)}}async function y1(t){try{let e=await te(),r=t.appId||le(void 0,e?.config);if(r&&t.platform){if(!await h1(r,t.platform)){f.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await Xl(r,t.platform),f.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let n=await Is(r);if(!n||!n.ios&&!n.android){f.info(`No credentials found for ${r}.`);return}await Xl(r),f.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await Lg()).length===0){f.info("No saved credentials found.");return}await Xl(),f.success("\u2705 All credentials cleared for all apps!")}f.info(` Location: ~/.capgo-credentials/credentials.json
182
+ `)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),Zt.default.exit(1)}}var fn=require("node:fs"),Fr=require("node:fs/promises"),b1=require("node:os"),kr=require("node:path"),jg=ue(require("node:process"));var w1=ue(Jp()),Zl=ue(Zc());async function rM(t,e,r,n,o){if(!o)try{let i=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!i.ok){f.warn("Could not stream logs, continuing...");return}let a=i.body?.getReader();if(!a)return;let s=new TextDecoder;for(;;){let{done:u,value:c}=await a.read();if(u)break;let d=s.decode(c,{stream:!0}).split(`
183
+ `);for(let p of d)if(p.startsWith("data: ")){let h=p.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function nM(t,e,r,n,o,i){let s=0;for(;s<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:o}});if(!u.ok){i||f.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),s++}catch(u){i||f.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||f.warn("Build status polling timed out"),"timeout"}async function oM(t,e){let r=new Set;if(e==="ios"){let n=(0,kr.join)(t,"ios/App/Podfile");if((0,fn.existsSync)(n)){let i=(await(0,Fr.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let a of i){let s=a[1];r.add(`node_modules/${s}/Package.swift`),r.add(`node_modules/${s}/*.podspec`),r.add(`node_modules/${s}/ios/`)}}}else if(e==="android"){let n=(0,kr.join)(t,"android/capacitor.settings.gradle");if((0,fn.existsSync)(n)){let i=(await(0,Fr.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of i){let u=a[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function D1(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r)if(n.startsWith(o))return!0;return!1}function Ts(t,e,r,n,o){let i=(0,fn.readdirSync)(e);for(let a of i){let s=(0,kr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,fn.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite")continue;if(a===n){Ts(t,s,u,n,o);continue}if(a==="node_modules"){Ts(t,s,u,n,o);continue}if(a==="resources"){Ts(t,s,u,n,o);continue}let l=u.replace(/\\/g,"/");(D1(u,n,o)||Array.from(o).some(p=>p.startsWith(`${l}/`)))&&Ts(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;D1(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function iM(t,e,r){let n=await oM(t,r),o=new w1.default;Ts(o,t,"",r,n),await(0,Fr.writeFile)(e,o.toBuffer())}async function aM(t,e,r=!1){let n=Date.now();try{e.apikey=e.apikey||ne(r);let o=await te();if(t=t||o?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let i=(0,kr.resolve)(e.path||jg.default.cwd()),a=e.supaHost||"https://api.capgo.app",s=await re(e.apikey,e.supaHost,e.supaAnon);await ie(s,e.apikey,["write","all"]);let u=await bt(s,t);r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.platform}`),f.info(`Project: ${i}`),f.info(`API host: ${a}`),f.info(`
184
184
  \u{1F512} Security: Credentials are never stored on Capgo servers`),f.info(" They are used only during build and deleted after (max 24h)"),f.info(` Builds sent directly to app stores - Capgo keeps nothing
185
- `));let c={};e.buildCertificateBase64&&(c.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(c.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(c.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(c.P12_PASSWORD=e.p12Password),e.appleKeyId&&(c.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(c.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(c.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(c.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(c.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(c.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(c.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let l=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;l&&!d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!l&&d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):l&&d&&(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(c.PLAY_CONFIG_JSON=e.playConfigJson);let p=await YA(t,e.platform,Object.keys(c).length>0?c:void 0),h={app_id:t,platform:e.platform};if(!p)throw r||(f.error("\u274C No credentials found for this app and platform"),f.error(""),f.error("You must provide credentials via:"),f.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),f.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),f.error(" 3. Saved credentials file:"),f.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),f.error(""),f.error("Documentation:"),f.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let m=[];if(e.platform==="ios"?(p.BUILD_CERTIFICATE_BASE64||m.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!p.P12_PASSWORD&&!r&&(f.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),f.warn(" If your certificate requires a password, provide it with --p12-password")),p.BUILD_PROVISION_PROFILE_BASE64||m.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),p.APPLE_KEY_ID||m.push("APPLE_KEY_ID (or --apple-key-id)"),p.APPLE_ISSUER_ID||m.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),p.APPLE_KEY_CONTENT||m.push("APPLE_KEY_CONTENT (or --apple-key-content)"),p.APP_STORE_CONNECT_TEAM_ID||m.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(p.ANDROID_KEYSTORE_FILE||m.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),p.KEYSTORE_KEY_ALIAS||m.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!p.KEYSTORE_KEY_PASSWORD&&!p.KEYSTORE_STORE_PASSWORD&&m.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!p.PLAY_CONFIG_JSON&&!r&&f.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),m.length>0){if(!r){f.error(`\u274C Missing required credentials for ${e.platform}:`),f.error("");for(let g of m)f.error(` \u2022 ${g}`);f.error(""),f.error("Provide credentials via:"),f.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),f.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),f.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),f.error(""),f.error("Documentation:"),f.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${m.join(", ")}`)}h.credentials=p,r||f.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||f.info("Requesting build from Capgo...");let b=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(h)});if(!b.ok){let g=await b.text();throw new Error(`Failed to request build: ${b.status} - ${g}`)}let D=await b.json();r||(f.success(`Build job created: ${D.job_id}`),f.info(`Status: ${D.status}`),f.info(`Upload URL: ${D.upload_url}`),f.info(`Upload expires: ${D.upload_expires_at}`)),await fe(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:u,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let E=(0,Fr.join)((0,n1.tmpdir)(),`capgo-build-${Date.now()}`);await(0,Or.mkdir)(E,{recursive:!0});let C=(0,Fr.join)(E,`${(0,Fr.basename)(i)}.zip`);try{r||f.info(`Zipping ${e.platform} project from ${i}...`),await H5(i,C,e.platform);let _=((await(0,Or.stat)(C)).size/1024/1024).toFixed(2);r||f.success(`Created zip: ${C} (${_} MB)`),r||(f.info("Uploading to builder with TUS protocol..."),f.info(`Upload endpoint: ${D.upload_url}`),f.info(`File size: ${_} MB`),f.info(`Job ID: ${D.job_id}`));let x=(0,cn.readFileSync)(C),$=De();r||$.start("Uploading bundle"),await new Promise((A,j)=>{let M=new Wl.Upload(x,{endpoint:D.upload_url,chunkSize:5242880,metadata:{filename:(0,Fr.basename)(C),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(J){if(!r){f.info(`[TUS] ${J.getMethod()} ${J.getURL()}`);let k=J.getHeader("authorization");f.info(`[TUS] Authorization header present: ${!!k}`)}},onAfterResponse(J,k){if(!r){f.info(`[TUS] Response status: ${k.getStatus()}`);let y=k.getHeader("upload-offset"),w=k.getHeader("tus-resumable");f.info(`[TUS] Upload-Offset: ${y}, Tus-Resumable: ${w}`)}},onError(J){if(r||($.stop("Upload failed"),f.error(`[TUS] Upload error: ${J.message}`)),J instanceof Wl.DetailedError){let k=J.originalResponse?.getBody(),y=J.originalResponse?.getStatus(),w=J.originalRequest?.getURL();r||(f.error(`[TUS] Request URL: ${w}`),f.error(`[TUS] Response status: ${y}`),f.error(`[TUS] Response body: ${k}`));let v="Unknown error";try{let O=JSON.parse(k||'{"error": "unknown error"}');v=O.status||O.error||O.message||"unknown error"}catch{v=k||J.message}j(new Error(`TUS upload failed: ${v}`))}else j(new Error(`TUS upload failed: ${J.message||J.toString()}`))},onProgress(J,k){let y=(J/k*100).toFixed(2);r||$.message(`Uploading ${y}%`)},onSuccess(){r||($.stop("Upload complete!"),f.success("TUS upload completed successfully")),A()}});r||f.info("[TUS] Starting upload..."),M.start()}),r||f.info("Starting build job...");let F=await fetch(`${a}/build/start/${D.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!F.ok){let A=await F.text();throw new Error(`Failed to start build: ${F.status} - ${A}`)}let B=await F.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${D.job_id}`),f.info(`Streaming build logs...
186
- `)),await U5(a,D.job_id,t,e.apikey,r);let I=await M5(a,D.job_id,t,e.platform,e.apikey,r);r||(I==="succeeded"?f.success("Build completed successfully!"):I==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${I}`));let L=((Date.now()-n)/1e3).toFixed(2);return await fe(e.apikey,{channel:"native-builder",event:I==="succeeded"?"Build succeeded":"Build failed",icon:I==="succeeded"?"\u2705":"\u274C",user_id:u,tags:{"app-id":t,platform:e.platform,status:I||"unknown",time:L},notify:!1}).catch(),{success:I==="succeeded",jobId:D.job_id,uploadUrl:D.upload_url,status:I||B.status||D.status}}finally{await(0,Or.rm)(E,{recursive:!0,force:!0})}}catch(o){let i=o instanceof Error?o.message:String(o);return r||f.error(i),{success:!1,error:i}}}async function i1(t,e){(await V5(t,e,!1)).success||Ig.default.exit(1)}async function a1(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||f.error(`Cannot check Version ${e}@${r.name}: ${U(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${U(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await we({message:"unlink it?"})===!0),!u)throw f.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=De();l.start(`Unlinking channel ${c.name}`);let d=await Rg(t,e,{silent:o});if(!d)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw l.stop(`Cannot update channel ${c.name} ${U(p)}`),new Error(`Cannot update channel ${c.name}: ${U(p)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}Z(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Rg(t,e,r={}){let{silent:n=!1}=r,o=[3e3,7e3],i;for(let a=0;a<=2;a++){let{data:s,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return s;i=u,a<2&&await new Promise(c=>setTimeout(c,o[a]))}throw n||f.error(`Cannot call findUnknownVersion as it returned an error.
187
- ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}function s1(t,e){return t.from("channels").insert(e).select().single()}function u1(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function c1(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function l1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function f1(t,e,r){return t.from("channels").select(`
185
+ `));let c={};e.buildCertificateBase64&&(c.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(c.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(c.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(c.P12_PASSWORD=e.p12Password),e.appleKeyId&&(c.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(c.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(c.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(c.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(c.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(c.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(c.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let l=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;l&&!d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!l&&d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):l&&d&&(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(c.PLAY_CONFIG_JSON=e.playConfigJson);let p=await f1(t,e.platform,Object.keys(c).length>0?c:void 0),h={app_id:t,platform:e.platform};if(!p)throw r||(f.error("\u274C No credentials found for this app and platform"),f.error(""),f.error("You must provide credentials via:"),f.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),f.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),f.error(" 3. Saved credentials file:"),f.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),f.error(""),f.error("Documentation:"),f.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let m=[];if(e.platform==="ios"?(p.BUILD_CERTIFICATE_BASE64||m.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!p.P12_PASSWORD&&!r&&(f.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),f.warn(" If your certificate requires a password, provide it with --p12-password")),p.BUILD_PROVISION_PROFILE_BASE64||m.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),p.APPLE_KEY_ID||m.push("APPLE_KEY_ID (or --apple-key-id)"),p.APPLE_ISSUER_ID||m.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),p.APPLE_KEY_CONTENT||m.push("APPLE_KEY_CONTENT (or --apple-key-content)"),p.APP_STORE_CONNECT_TEAM_ID||m.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(p.ANDROID_KEYSTORE_FILE||m.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),p.KEYSTORE_KEY_ALIAS||m.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!p.KEYSTORE_KEY_PASSWORD&&!p.KEYSTORE_STORE_PASSWORD&&m.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!p.PLAY_CONFIG_JSON&&!r&&f.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),m.length>0){if(!r){f.error(`\u274C Missing required credentials for ${e.platform}:`),f.error("");for(let g of m)f.error(` \u2022 ${g}`);f.error(""),f.error("Provide credentials via:"),f.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),f.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),f.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),f.error(""),f.error("Documentation:"),f.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${m.join(", ")}`)}h.credentials=p,r||f.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||f.info("Requesting build from Capgo...");let b=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(h)});if(!b.ok){let g=await b.text();throw new Error(`Failed to request build: ${b.status} - ${g}`)}let y=await b.json();r||(f.success(`Build job created: ${y.job_id}`),f.info(`Status: ${y.status}`),f.info(`Upload URL: ${y.upload_url}`),f.info(`Upload expires: ${y.upload_expires_at}`)),await de(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:u,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let C=(0,kr.join)((0,b1.tmpdir)(),`capgo-build-${Date.now()}`);await(0,Fr.mkdir)(C,{recursive:!0});let E=(0,kr.join)(C,`${(0,kr.basename)(i)}.zip`);try{r||f.info(`Zipping ${e.platform} project from ${i}...`),await iM(i,E,e.platform);let _=((await(0,Fr.stat)(E)).size/1024/1024).toFixed(2);r||f.success(`Created zip: ${E} (${_} MB)`),r||(f.info("Uploading to builder with TUS protocol..."),f.info(`Upload endpoint: ${y.upload_url}`),f.info(`File size: ${_} MB`),f.info(`Job ID: ${y.job_id}`));let x=(0,fn.readFileSync)(E),$=ye();r||$.start("Uploading bundle"),await new Promise((A,j)=>{let M=new Zl.Upload(x,{endpoint:y.upload_url,chunkSize:5242880,metadata:{filename:(0,kr.basename)(E),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(J){if(!r){f.info(`[TUS] ${J.getMethod()} ${J.getURL()}`);let k=J.getHeader("authorization");f.info(`[TUS] Authorization header present: ${!!k}`)}},onAfterResponse(J,k){if(!r){f.info(`[TUS] Response status: ${k.getStatus()}`);let D=k.getHeader("upload-offset"),w=k.getHeader("tus-resumable");f.info(`[TUS] Upload-Offset: ${D}, Tus-Resumable: ${w}`)}},onError(J){if(r||($.stop("Upload failed"),f.error(`[TUS] Upload error: ${J.message}`)),J instanceof Zl.DetailedError){let k=J.originalResponse?.getBody(),D=J.originalResponse?.getStatus(),w=J.originalRequest?.getURL();r||(f.error(`[TUS] Request URL: ${w}`),f.error(`[TUS] Response status: ${D}`),f.error(`[TUS] Response body: ${k}`));let v="Unknown error";try{let O=JSON.parse(k||'{"error": "unknown error"}');v=O.status||O.error||O.message||"unknown error"}catch{v=k||J.message}j(new Error(`TUS upload failed: ${v}`))}else j(new Error(`TUS upload failed: ${J.message||J.toString()}`))},onProgress(J,k){let D=(J/k*100).toFixed(2);r||$.message(`Uploading ${D}%`)},onSuccess(){r||($.stop("Upload complete!"),f.success("TUS upload completed successfully")),A()}});r||f.info("[TUS] Starting upload..."),M.start()}),r||f.info("Starting build job...");let F=await fetch(`${a}/build/start/${y.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!F.ok){let A=await F.text();throw new Error(`Failed to start build: ${F.status} - ${A}`)}let B=await F.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${y.job_id}`),f.info(`Streaming build logs...
186
+ `)),await rM(a,y.job_id,t,e.apikey,r);let T=await nM(a,y.job_id,t,e.platform,e.apikey,r);r||(T==="succeeded"?f.success("Build completed successfully!"):T==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${T}`));let L=((Date.now()-n)/1e3).toFixed(2);return await de(e.apikey,{channel:"native-builder",event:T==="succeeded"?"Build succeeded":"Build failed",icon:T==="succeeded"?"\u2705":"\u274C",user_id:u,tags:{"app-id":t,platform:e.platform,status:T||"unknown",time:L},notify:!1}).catch(),{success:T==="succeeded",jobId:y.job_id,uploadUrl:y.upload_url,status:T||B.status||y.status}}finally{await(0,Fr.rm)(C,{recursive:!0,force:!0})}}catch(o){let i=o instanceof Error?o.message:String(o);return r||f.error(i),{success:!1,error:i}}}async function v1(t,e){(await aM(t,e,!1)).success||jg.default.exit(1)}async function C1(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||f.error(`Cannot check Version ${e}@${r.name}: ${U(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${U(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await we({message:"unlink it?"})===!0),!u)throw f.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=ye();l.start(`Unlinking channel ${c.name}`);let d=await Ug(t,e,{silent:o});if(!d)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw l.stop(`Cannot update channel ${c.name} ${U(p)}`),new Error(`Cannot update channel ${c.name}: ${U(p)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}Z(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Ug(t,e,r={}){let{silent:n=!1}=r,o=[3e3,7e3],i;for(let a=0;a<=2;a++){let{data:s,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return s;i=u,a<2&&await new Promise(c=>setTimeout(c,o[a]))}throw n||f.error(`Cannot call findUnknownVersion as it returned an error.
187
+ ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}function E1(t,e){return t.from("channels").insert(e).select().single()}function _1(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function S1(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function x1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function A1(t,e,r){return t.from("channels").select(`
188
188
  id,
189
189
  version (id, name)
190
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function d1(t,e=!1){if(e)return;let r=new at;r.theme=at.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);f.success("Channels"),f.success(r.toString())}async function p1(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
190
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function O1(t,e=!1){if(e)return;let r=new at;r.theme=at.roundTheme,r.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);f.success("Channels"),f.success(r.toString())}async function F1(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
191
191
  id,
192
192
  name,
193
193
  public,
@@ -202,52 +202,52 @@ ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}fun
202
202
  created_by,
203
203
  app_id,
204
204
  version (id, name)
205
- `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||f.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${U(o)}`);return n}async function Bg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||f.error(a),new Error(`${a}: ${U(i)}`)}}async function Yl(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await z5(t,e,r,{silent:o});await a1(t,e,a,{silent:o,autoUnlink:i}),await Bg(t,e,r,{silent:o})}function Jl(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new at;r.theme=at.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,ia(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function Xl(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return o??[]}async function h1(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return(o??[]).map(a=>a.version)}async function z5(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||f.error(s),new Error(`${s}${a?`: ${U(a)}`:""}`)}return i}async function K5(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${ia(o.created_at)}`),await Yl(e,r,o.name)}function G5(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);ld(i,e)&&vr(i,r)&&n.push(o)}return n}async function W5(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await ge(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=ce(t,s?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await re(e.apikey,e.supaHost,e.supaAnon);await ie(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await Xl(u,t),l=await h1(u,t);if(r||f.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||f.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=_e(n),m=xa(h,"major");r||f.info(`Querying available versions in Capgo between ${wr(h)} and ${wr(m)}`),c=G5(c,h,m),r||f.info(`Active versions in Capgo between ${wr(h)} and ${wr(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=l.find(b=>b===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||Jl(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await we({message:"Do you want to continue removing the versions specified?"});if(be(h)||!h)throw f.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||f.success("You have confirmed removal, removing versions now"),await K5(d,u,t,r),r||Z("Done \u2705"),{removed:d.length,kept:p}}async function m1(t,e){return W5(t,e)}async function Y5(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=ce(t,o?.config),a=n.channel;if(!a)throw r||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await re(n.apikey,n.supaHost,n.supaAnon);await ie(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await ql(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new at;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=at.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=p,D=ko(p)?l:d;c.rows.push([h,m,b,D])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function g1(t,e){try{await Y5(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${U(r)}`),r}}var dn=require("node:fs");var ln=require("node:buffer"),pt=require("node:crypto"),y1="aes-128-cbc",fn="base64",D1="hex",Ts=pt.constants.RSA_PKCS1_PADDING;function Zl(t){let e=(0,pt.randomBytes)(16),r=(0,pt.randomBytes)(16),n=e.toString(fn),o=(0,pt.privateEncrypt)({key:t,padding:Ts},r).toString(fn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ca(t,e,r){let[n]=r.split(":"),o=ln.Buffer.from(n,fn),i=(0,pt.createCipheriv)(y1,e,o);return i.setAutoPadding(!0),ln.Buffer.concat([i.update(t),i.final()])}function b1(t,e,r){let[n,o]=e.split(":"),i=(0,pt.publicDecrypt)({key:r,padding:Ts},ln.Buffer.from(o,fn)),a=ln.Buffer.from(n,fn),s=(0,pt.createDecipheriv)(y1,i,a);return s.setAutoPadding(!0),ln.Buffer.concat([s.update(t),s.final()])}function la(t,e){return(0,pt.privateEncrypt)({key:e,padding:Ts},ln.Buffer.from(t,fn)).toString(fn)}function Ql(t,e){return(0,pt.privateEncrypt)({key:e,padding:Ts},ln.Buffer.from(t,D1)).toString(D1)}function w1(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,pt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function v1(t,e){return(0,pt.publicDecrypt)({key:e,padding:Ts},ln.Buffer.from(t,fn)).toString(fn)}function J5(t,e){let r=t.key||un,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,dn.existsSync)(r)?n=(0,dn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function X5(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await ge(),!(0,dn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||f.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,dn.existsSync)(un)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${un} or in ${o.path}`;throw n||f.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=J5(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(d),new Error(d)}let s=(0,dn.readFileSync)(t),u=b1(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,dn.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let d=await nn(u,"sha256"),p=v1(r.checksum,r.keyData??i);if(l=d===p,!l){let h=`Checksum does not match ${d} !== ${p}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||Z("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${U(o)}`),o instanceof Error?o:new Error(String(o))}}async function E1(t,e,r){await X5(t,e,r,!1)}async function Z5(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=ce(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await re(r.apikey,r.supaHost,r.supaAnon);return await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(f.info(`Deleting bundle ${e}@${t} from Capgo`),f.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Yl(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),Z("Done")),!0}async function C1(t,e,r){return Z5(t,e,r)}var pn=require("node:fs");function Is(t){console.error(U(t))}async function Q5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await ge());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&f.warning("There is still a privateKey in the config"),!(0,pn.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(o?Is({error:"zip_not_found"}):f.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(o?Is({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Jt,l=r.keyData||"";if(!(0,pn.existsSync)(c)&&!l)throw n||(o?Is({error:"missing_key"}):(f.warning(`Cannot find a private key at ${c} or as a keyData option`),f.error("Error: Missing key"))),new Error("Missing private key");if((0,pn.existsSync)(c)&&(l=(0,pn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Is({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,pn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=Zl(l),m=ca(d,p,h),b=la(e,l),D=`${t}_encrypted.zip`;return(0,pn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:b,filename:D,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${b}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${D}`),Z("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Is(a):f.error(`Error encrypting zip file ${U(a)}`)),a instanceof Error?a:new Error(String(a))}}async function _1(t,e,r){await Q5(t,e,r,!1)}async function S1(t,e,r=!1){r||ee("List bundles"),await ge(),e.apikey=e.apikey||ne();let n=await te();if(t=ce(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon);await ie(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await Xl(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),Jl(i),Z("Done \u2705")),i}var XO=require("node:crypto"),qo=require("node:fs"),mf=require("node:process");var ef=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function Mn(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function l(d){return t.startsWith(d)}}var qr=class extends Error{};var Et=class extends qr{},Rs=class extends qr{},tf=class extends qr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Hr=class extends qr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},qn=class extends qr{constructor(){super("accessKey is required")}},fa=class extends qr{constructor(){super("secretKey is required")}},Bs=class extends qr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},hn=class extends qr{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function x1(t){try{let r=Mn(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new hn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new hn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function A1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function O1(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function Hn(t){return!(!eM(t)||t.length===0)}function eM(t){return!(typeof t!="string"||t.length>1024)}function Ns(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Io(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function Lg(t){return t.get("x-amz-version-id")??null}function Ro(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function jg(t){return Ro(t).slice(0,8)}function Ug(t,e){return`${jg(e)}/${t}/s3/aws4_request`}async function rf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Ns(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var tM=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],nf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,d=[];super({start(){},async write(p,h){let b=s++;try{if(b==1&&p.length<o){let C=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Io(C.headers.get("etag")??void 0),versionId:Lg(C.headers)};return}b===1&&(u=(await rM({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(p.length)};for(let C of tM){let g=i[C];g&&(D[C]=g)}let E=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:p}).then(C=>{let g=C.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),C});d.push(E.catch(C=>{l||(l=C)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(d),l)throw l;c.sort((p,h)=>p.part>h.part?1:-1),a=await nM({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function rM(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=Mn(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function nM({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
205
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||f.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${U(o)}`);return n}async function Mg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||f.error(a),new Error(`${a}: ${U(i)}`)}}async function Ql(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await sM(t,e,r,{silent:o});await C1(t,e,a,{silent:o,autoUnlink:i}),await Mg(t,e,r,{silent:o})}function ef(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new at;r.theme=at.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,sa(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function tf(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return o??[]}async function k1(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return(o??[]).map(a=>a.version)}async function sM(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||f.error(s),new Error(`${s}${a?`: ${U(a)}`:""}`)}return i}async function uM(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${sa(o.created_at)}`),await Ql(e,r,o.name)}function cM(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);hd(i,e)&&Cr(i,r)&&n.push(o)}return n}async function lM(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await ge(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=le(t,s?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await re(e.apikey,e.supaHost,e.supaAnon);await ie(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await tf(u,t),l=await k1(u,t);if(r||f.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||f.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=_e(n),m=Oa(h,"major");r||f.info(`Querying available versions in Capgo between ${vr(h)} and ${vr(m)}`),c=cM(c,h,m),r||f.info(`Active versions in Capgo between ${vr(h)} and ${vr(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=l.find(b=>b===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||ef(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await we({message:"Do you want to continue removing the versions specified?"});if(be(h)||!h)throw f.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||f.success("You have confirmed removal, removing versions now"),await uM(d,u,t,r),r||Z("Done \u2705"),{removed:d.length,kept:p}}async function P1(t,e){return lM(t,e)}async function fM(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=le(t,o?.config),a=n.channel;if(!a)throw r||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await re(n.apikey,n.supaHost,n.supaAnon);await ie(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Kl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new at;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=at.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=p,y=$o(p)?l:d;c.rows.push([h,m,b,y])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function $1(t,e){try{await fM(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${U(r)}`),r}}var hn=require("node:fs");var dn=require("node:buffer"),pt=require("node:crypto"),T1="aes-128-cbc",pn="base64",I1="hex",Rs=pt.constants.RSA_PKCS1_PADDING;function rf(t){let e=(0,pt.randomBytes)(16),r=(0,pt.randomBytes)(16),n=e.toString(pn),o=(0,pt.privateEncrypt)({key:t,padding:Rs},r).toString(pn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function fa(t,e,r){let[n]=r.split(":"),o=dn.Buffer.from(n,pn),i=(0,pt.createCipheriv)(T1,e,o);return i.setAutoPadding(!0),dn.Buffer.concat([i.update(t),i.final()])}function R1(t,e,r){let[n,o]=e.split(":"),i=(0,pt.publicDecrypt)({key:r,padding:Rs},dn.Buffer.from(o,pn)),a=dn.Buffer.from(n,pn),s=(0,pt.createDecipheriv)(T1,i,a);return s.setAutoPadding(!0),dn.Buffer.concat([s.update(t),s.final()])}function da(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function nf(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,I1)).toString(I1)}function B1(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,pt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function N1(t,e){return(0,pt.publicDecrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function dM(t,e){let r=t.key||ln,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,hn.existsSync)(r)?n=(0,hn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function pM(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await ge(),!(0,hn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||f.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,hn.existsSync)(ln)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${ln} or in ${o.path}`;throw n||f.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=dM(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(d),new Error(d)}let s=(0,hn.readFileSync)(t),u=R1(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,hn.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let d=await on(u,"sha256"),p=N1(r.checksum,r.keyData??i);if(l=d===p,!l){let h=`Checksum does not match ${d} !== ${p}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||Z("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${U(o)}`),o instanceof Error?o:new Error(String(o))}}async function L1(t,e,r){await pM(t,e,r,!1)}async function hM(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await re(r.apikey,r.supaHost,r.supaAnon);return await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(f.info(`Deleting bundle ${e}@${t} from Capgo`),f.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Ql(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),Z("Done")),!0}async function j1(t,e,r){return hM(t,e,r)}var mn=require("node:fs");function Bs(t){console.error(U(t))}async function mM(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await ge());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&f.warning("There is still a privateKey in the config"),!(0,mn.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?Bs({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?Bs({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Xt,l=r.keyData||"";if(!(0,mn.existsSync)(c)&&!l)throw n||(o?Bs({error:"missing_key"}):(f.warning(`Cannot find a private key at ${c} or as a keyData option`),f.error("Error: Missing key"))),new Error("Missing private key");if((0,mn.existsSync)(c)&&(l=(0,mn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Bs({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,mn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=rf(l),m=fa(d,p,h),b=da(e,l),y=`${t}_encrypted.zip`;return(0,mn.writeFileSync)(y,m),n||(o?console.log(JSON.stringify({checksum:b,filename:y,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${b}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${y}`),Z("Done \u2705"))),{checksum:b,filename:y,ivSessionKey:h}}catch(a){throw n||(r.json?Bs(a):f.error(`Error encrypting zip file ${U(a)}`)),a instanceof Error?a:new Error(String(a))}}async function U1(t,e,r){await mM(t,e,r,!1)}async function M1(t,e,r=!1){r||ee("List bundles"),await ge(),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon);await ie(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await tf(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),ef(i),Z("Done \u2705")),i}var pF=require("node:crypto"),Vo=require("node:fs"),bf=require("node:process");var of=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function Un(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function l(d){return t.startsWith(d)}}var Hr=class extends Error{};var Ct=class extends Hr{},Ns=class extends Hr{},af=class extends Hr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Vr=class extends Hr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Mn=class extends Hr{constructor(){super("accessKey is required")}},pa=class extends Hr{constructor(){super("secretKey is required")}},Ls=class extends Hr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gn=class extends Hr{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function q1(t){try{let r=Un(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new gn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function H1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function V1(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function qn(t){return!(!gM(t)||t.length===0)}function gM(t){return!(typeof t!="string"||t.length>1024)}function js(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Bo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function Hg(t){return t.get("x-amz-version-id")??null}function No(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function Vg(t){return No(t).slice(0,8)}function zg(t,e){return`${Vg(e)}/${t}/s3/aws4_request`}async function sf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),js(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var yM=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],uf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,d=[];super({start(){},async write(p,h){let b=s++;try{if(b==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Bo(E.headers.get("etag")??void 0),versionId:Hg(E.headers)};return}b===1&&(u=(await DM({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let y={"Content-Length":String(p.length)};for(let E of yM){let g=i[E];g&&(y[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(y),bucketName:r,objectName:n,payload:p}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});d.push(C.catch(E=>{l||(l=E)}))}catch(y){throw y}},async close(){if(!a)if(u){if(await Promise.all(d),l)throw l;c.sort((p,h)=>p.part>h.part?1:-1),a=await bM({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function DM(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=Un(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function bM({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
206
206
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
207
207
  ${o.map(d=>` <Part><PartNumber>${d.part}</PartNumber><ETag>${d.etag}</ETag></Part>`).join(`
208
208
  `)}
209
209
  </CompleteMultipartUpload>
210
- `,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=Mn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=Lg(a.headers);return{etag:Io(c),versionId:l}}var Ls="AWS4-HMAC-SHA256";async function F1(t){if(!t.accessKey)throw new qn;if(!t.secretKey)throw new fa;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=P1(t.headers),n=$1(t.method,t.path,t.headers,r,e),o=await T1(n,t.date,t.region),i=await qg(t.date,t.region,t.secretKey),a=Hg(t.accessKey,t.region,t.date),s=Ns(await No(i,o)).toLowerCase();return`${Ls} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function k1(t){if(!t.accessKey)throw new qn;if(!t.secretKey)throw new fa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Bs;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=Ro(t.date),o=P1(t.headers),i=Hg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Ls),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(D=>encodeURIComponent(D)).join("/"),d=$1(t.method,c,t.headers,o,a),p=await T1(d,t.date,t.region),h=await qg(t.date,t.region,t.secretKey),m=Ns(await No(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function P1(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var Bo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},oM="-._~".split("").map(t=>t.charCodeAt(0));function Mg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Bo.A&&o<=Bo.Z||o>=Bo.a&&o<=Bo.z||o>=Bo[0]&&o<=Bo[9]||oM.includes(o)||o==Bo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function $1(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return Mg(decodeURIComponent(c))+"="+Mg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Mg(a,!0),s,i.join(`
210
+ `,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=Un(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=Hg(a.headers);return{etag:Bo(c),versionId:l}}var Us="AWS4-HMAC-SHA256";async function z1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=G1(t.headers),n=W1(t.method,t.path,t.headers,r,e),o=await Y1(n,t.date,t.region),i=await Gg(t.date,t.region,t.secretKey),a=Wg(t.accessKey,t.region,t.date),s=js(await jo(i,o)).toLowerCase();return`${Us} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function K1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ls;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=No(t.date),o=G1(t.headers),i=Wg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Us),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(y=>encodeURIComponent(y)).join("/"),d=W1(t.method,c,t.headers,o,a),p=await Y1(d,t.date,t.region),h=await Gg(t.date,t.region,t.secretKey),m=js(await jo(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function G1(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var Lo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},wM="-._~".split("").map(t=>t.charCodeAt(0));function Kg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Lo.A&&o<=Lo.Z||o>=Lo.a&&o<=Lo.z||o>=Lo[0]&&o<=Lo[9]||wM.includes(o)||o==Lo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function W1(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return Kg(decodeURIComponent(c))+"="+Kg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Kg(a,!0),s,i.join(`
211
211
  `)+`
212
212
  `,n.join(";").toLowerCase(),o].join(`
213
- `)}async function T1(t,e,r){let n=await rf(t),o=Ug(r,e);return[Ls,Ro(e),o,n].join(`
214
- `)}async function qg(t,e,r){let n=jg(t),o=await No("AWS4"+r,n),i=await No(o,e),a=await No(i,"s3");return await No(a,"aws4_request")}function Hg(t,e,r){return`${t}/${Ug(e,r)}`}async function No(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function I1(t){if(!t.accessKey)throw new qn;if(!t.secretKey)throw new fa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Bs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Hg(t.accessKey,t.region,t.date),n=Ro(t.date),o={"X-Amz-Algorithm":Ls,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Ls},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await qg(t.date,t.region,t.secretKey),d=Ns(await No(l,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var iM=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],aM=5*1024*1024,sM=5*1024*1024*1024,Vg=5*1024*1024*1024*1024,js=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Et("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new Rs(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Rs(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!A1(n))throw new Et(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Et("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Et("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Et("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Et("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Et("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!O1(r))throw new tf(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await rf(r??new Uint8Array);i.set("x-amz-date",Ro(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await F1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await x1(p):p.status===301?new hn(p.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new hn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Hn(e))throw new Hr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof hn&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...o}){let i=this.getBucketName(o);if(!Hn(e))throw new Hr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new qn;if(!Hn(r))throw new Hr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return k1({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Et("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Mn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of l)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Io(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return b>D?1:b<D?-1:0});for(let h of d)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Hn(e))throw new Hr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(d){d.enqueue(l),d.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Et("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Et(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Et(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<aM)throw new Et("Part size should be greater than 5MB");if(s>sM)throw new Et("Part size should be less than 6MB");let u=new ef(s),c=new nf({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Vg),e>Vg)throw new TypeError(`size should not be more than ${Vg}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!Hn(e))throw new Hr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of iM)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Io(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Hn(r))throw new Hr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=Mn(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=l.children.find(h=>h.name==="ETag")?.content??"",p=l.children.find(h=>h.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Io(d),lastModified:new Date(p),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof hn&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!Hn(e))throw new Hr(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let o=r.requestDate||new Date,i=r.expirySeconds??3600;return I1({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var Lo=require("node:fs"),of=require("node:path");function uM(t,e){return(0,Lo.readFileSync)(t,"utf8").includes(e)}function Us(t,e){let r=(0,Lo.readdirSync)(t);for(let n of r){let o=(0,of.join)(t,n),i=(0,Lo.statSync)(o);if(i.isDirectory()){if(Us(o,e))return!0}else if(i.isFile()&&(0,of.extname)(o)===".js"&&uM(o,e))return!0}return!1}function af(t){return(0,Lo.readdirSync)(t).indexOf("index.html")>-1}var HO=require("node:crypto"),ha=require("node:fs"),VO=require("node:os"),Mo=require("node:path"),zO=require("node:process"),hf=require("node:stream/consumers"),KO=require("node:zlib");var GO=de(qO()),WO=de(Jc());async function C9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var _9=8192;async function S9(t){let e=gt((0,zO.cwd)()),r=await Mr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?_e(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!Un(n,void 0,void 0,ks);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function x9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:GO.isMatch(t,r)}async function A9(t,e,r){let o=(0,ha.statSync)(t).size,i=await(0,hf.buffer)((0,ha.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(x9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<_9)return{buffer:i,useBrotli:!1};try{let a=await(0,hf.buffer)((0,ha.createReadStream)(t).pipe((0,KO.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return f.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function YO(t,e,r,n,o,i,a=!1){let s=De();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await kA(t);if(o==="v2")for(let c of u)c.hash=a?Ql(c.hash,i):la(c.hash,i);return s.stop("Manifest generated successfully"),await fe(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function O9(t){return(0,VO.platform)()!=="win32"?t:Mo.win32.normalize(t).split(Mo.win32.sep).join(Mo.posix.sep)}function F9(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&f.warn(`File "${t}" contains spaces in its name.`),e}async function JO(t,e,r,n,o,i,a){let s=De();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await cr(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await S9(a);if(p)a.disableBrotli?f.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&f.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${OA} (v5), ${FA} (v6) or ${ks} (v7) or higher.`);let h=e.filter(E=>E.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(E=>E.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,D=0;try{s.message(`Uploading ${b} files using TUS protocol`);let E=async $=>{let F=(0,Mo.join)(r,$.file),B=O9($.file),I,L=!1;if(a.disableBrotli)I=await(0,hf.buffer)((0,ha.createReadStream)(F)),L=!1;else{let y=await A9(F,B,a);I=y.buffer,L=y.useBrotli}let A=I;i&&(A=ca(I,i.sessionKey,i.ivSessionKey));let j=B;L&&(j=`${B}.br`,D++);let M=F9(j),J=(0,HO.createHash)("sha256").update($.hash).digest("hex"),k=`orgs/${o}/apps/${n}/delta/${J}_${M}`;return!i&&await C9(c,k)?(m++,Promise.resolve({file_name:M,s3_path:k,file_hash:$.hash})):new Promise((y,w)=>{s.message(`Prepare upload partial file: ${B}`),new WO.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),T;try{let P=R.match(/response text: (\{.*?\})/);P&&P[1]&&(T=JSON.parse(P[1]).moreInfo?.requestId)}catch{}let q=T?` [requestId: ${T}]`:"";f.error(`Failed to upload ${B}: ${R}${q}`),w(O)},onProgress(){let O=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,y({file_name:M,s3_path:k,file_hash:$.hash})}}).start()})},C=500,g=[];for(let $=0;$<e.length;$+=C){let F=e.slice($,$+C),B=Math.floor($/C)+1,I=Math.ceil(e.length/C);I>1&&s.message(`Processing batch ${B}/${I} (${F.length} files)`);let L=await Promise.all(F.map(A=>E(A)));g.push(...L)}let x=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${x} seconds)`),D>0&&f.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await fe(t,{channel:"app",event:`App Partial TUS done${D>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await fe(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:x},notify:!1}),g}catch(E){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw f.error(`Error uploading partial update: ${E}`),f.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return f.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ye(t){throw f.error(t),new Error(t)}async function k9(t,e){let r=Ar("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,XO.randomUUID)().split("-")[0]}`;return ta.test(n)||ye(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function P9(t){let e=t.apikey||ne();return e||ye("Missing API key, you need to provide an API key to upload your bundle"),e}function $9(t,e,r){let n=ce(t,r),o=e.path||r?.webDir;return n||ye("Missing argument, you need to provide a appid or be in a capacitor project"),o||ye("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,qo.existsSync)(o)||ye(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function T9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Us(e,"notifyAppReady")||ye(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
215
- If you are sure your app has this code, you can use the --no-code-check option`),af(e)||ye(`index.html is missing in the root folder of ${e}`))}async function I9(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=De();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:C}=await ql(t,o,n,r.packageJson,r.nodeModules);if(h=E,p=C,h.find(g=>!ko(g)))D.stop(`Bundle NOT compatible with ${n} channel`),f.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,f.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!ta.test(g))&&ye("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{ye(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(f.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await Fg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&ye("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ta.test(u)||ye(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.filter(D=>!!D.native&&D.native!==void 0).map(D=>[D.name,D])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([D,E])=>({name:D,version:E.version})):void 0,minUpdateVersion:u}}async function R9(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(o||i){if(n)return f.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),Z("Bundle version already exists - exiting gracefully \u{1F389}"),!0;ye(`Version ${r} already exists ${U(i)}`)}return!1}async function B9(t,e,r,n,o,i,a){let s,u,c="",l=null,d="none",p="",h=e.keyV2,m=e.key===!1,b=De();b.start(`Zipping bundle from ${t}`),l=await Ul(t),b.message("Calculating checksum");let D=gt((0,mf.cwd)()),E=await Mr("@capgo/capacitor-updater",D,e.packageJson),C=!1,g;try{g=E?_e(E):void 0}catch{g=void 0}if(E?g?C=!Un(g,ks):(E==="link:@capgo/capacitor-updater"||E==="file:.."||E==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),C=!0):ye("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,qo.existsSync)(Jt))&&!m||C?c=await nn(l,"sha256"):c=await nn(l,"crc32"),b.stop(`Checksum ${C?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,qo.existsSync)(Jt)||e.keyDataV2)&&!e.oldEncryption){let $=typeof h=="string"?h:Jt,F=e.keyDataV2||"";!F&&!(0,qo.existsSync)($)&&ye(`Cannot find private key ${$}`),await fe(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),F||(F=(0,qo.readFileSync)($).toString());let B=g&&!Un(g,"5.30.0","6.30.0","7.30.0");f.info(`Encrypting your bundle with ${B?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:L}=Zl(F),A=ca(l,I,L);c=B?Ql(c,F):la(c,F),s=L,u=I,d="v2",p=F,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
213
+ `)}async function Y1(t,e,r){let n=await sf(t),o=zg(r,e);return[Us,No(e),o,n].join(`
214
+ `)}async function Gg(t,e,r){let n=Vg(t),o=await jo("AWS4"+r,n),i=await jo(o,e),a=await jo(i,"s3");return await jo(a,"aws4_request")}function Wg(t,e,r){return`${t}/${zg(e,r)}`}async function jo(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function J1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ls;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Wg(t.accessKey,t.region,t.date),n=No(t.date),o={"X-Amz-Algorithm":Us,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Us},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await Gg(t.date,t.region,t.secretKey),d=js(await jo(l,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var vM=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],CM=5*1024*1024,EM=5*1024*1024*1024,Yg=5*1024*1024*1024*1024,Ms=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Ct("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new Ns(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ns(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!H1(n))throw new Ct(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ct("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ct("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Ct("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ct("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ct("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!V1(r))throw new af(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await sf(r??new Uint8Array);i.set("x-amz-date",No(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await z1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await q1(p):p.status===301?new gn(p.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new gn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!qn(e))throw new Vr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof gn&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...o}){let i=this.getBucketName(o);if(!qn(e))throw new Vr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Mn;if(!qn(r))throw new Vr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return K1({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Ct("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Un(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of l)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Bo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,y=m.type==="Object"?m.key:m.prefix;return b>y?1:b<y?-1:0});for(let h of d)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!qn(e))throw new Vr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(d){d.enqueue(l),d.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Ct("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ct(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Ct(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<CM)throw new Ct("Part size should be greater than 5MB");if(s>EM)throw new Ct("Part size should be less than 6MB");let u=new of(s),c=new uf({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Yg),e>Yg)throw new TypeError(`size should not be more than ${Yg}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!qn(e))throw new Vr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of vM)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Bo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!qn(r))throw new Vr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=Un(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=l.children.find(h=>h.name==="ETag")?.content??"",p=l.children.find(h=>h.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Bo(d),lastModified:new Date(p),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof gn&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}presignedPostObject(e,r={}){if(!qn(e))throw new Vr(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let o=r.requestDate||new Date,i=r.expirySeconds??3600;return J1({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var Uo=require("node:fs"),cf=require("node:path");function _M(t,e){return(0,Uo.readFileSync)(t,"utf8").includes(e)}function qs(t,e){let r=(0,Uo.readdirSync)(t);for(let n of r){let o=(0,cf.join)(t,n),i=(0,Uo.statSync)(o);if(i.isDirectory()){if(qs(o,e))return!0}else if(i.isFile()&&(0,cf.extname)(o)===".js"&&_M(o,e))return!0}return!1}function lf(t){return(0,Uo.readdirSync)(t).indexOf("index.html")>-1}var iF=require("node:crypto"),ga=require("node:fs"),aF=require("node:os"),Ho=require("node:path"),sF=require("node:process"),Df=require("node:stream/consumers"),uF=require("node:zlib");var cF=ue(oF()),lF=ue(Zc());async function j9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var U9=8192;async function M9(t){let e=gt((0,sF.cwd)()),r=await qr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?_e(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!jn(n,void 0,void 0,$s);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function q9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:cF.isMatch(t,r)}async function H9(t,e,r){let o=(0,ga.statSync)(t).size,i=await(0,Df.buffer)((0,ga.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(q9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<U9)return{buffer:i,useBrotli:!1};try{let a=await(0,Df.buffer)((0,ga.createReadStream)(t).pipe((0,uF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return f.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function fF(t,e,r,n,o,i,a=!1){let s=ye();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await KA(t);if(o==="v2")for(let c of u)c.hash=a?nf(c.hash,i):da(c.hash,i);return s.stop("Manifest generated successfully"),await de(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function V9(t){return(0,aF.platform)()!=="win32"?t:Ho.win32.normalize(t).split(Ho.win32.sep).join(Ho.posix.sep)}function z9(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&f.warn(`File "${t}" contains spaces in its name.`),e}async function dF(t,e,r,n,o,i,a){let s=ye();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await lr(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await M9(a);if(p)a.disableBrotli?f.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&f.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${VA} (v5), ${zA} (v6) or ${$s} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,y=0;try{s.message(`Uploading ${b} files using TUS protocol`);let C=async $=>{let F=(0,Ho.join)(r,$.file),B=V9($.file),T,L=!1;if(a.disableBrotli)T=await(0,Df.buffer)((0,ga.createReadStream)(F)),L=!1;else{let D=await H9(F,B,a);T=D.buffer,L=D.useBrotli}let A=T;i&&(A=fa(T,i.sessionKey,i.ivSessionKey));let j=B;L&&(j=`${B}.br`,y++);let M=z9(j),J=(0,iF.createHash)("sha256").update($.hash).digest("hex"),k=`orgs/${o}/apps/${n}/delta/${J}_${M}`;return!i&&await j9(c,k)?(m++,Promise.resolve({file_name:M,s3_path:k,file_hash:$.hash})):new Promise((D,w)=>{s.message(`Prepare upload partial file: ${B}`),new lF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),I;try{let P=R.match(/response text: (\{.*?\})/);P&&P[1]&&(I=JSON.parse(P[1]).moreInfo?.requestId)}catch{}let q=I?` [requestId: ${I}]`:"";f.error(`Failed to upload ${B}: ${R}${q}`),w(O)},onProgress(){let O=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,D({file_name:M,s3_path:k,file_hash:$.hash})}}).start()})},E=500,g=[];for(let $=0;$<e.length;$+=E){let F=e.slice($,$+E),B=Math.floor($/E)+1,T=Math.ceil(e.length/E);T>1&&s.message(`Processing batch ${B}/${T} (${F.length} files)`);let L=await Promise.all(F.map(A=>C(A)));g.push(...L)}let x=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${x} seconds)`),y>0&&f.info(`${y} of ${b} files were compressed with brotli and use .br extension`),await de(t,{channel:"app",event:`App Partial TUS done${y>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await de(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:x},notify:!1}),g}catch(C){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw f.error(`Error uploading partial update: ${C}`),f.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return f.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function De(t){throw f.error(t),new Error(t)}async function K9(t,e){let r=Or("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,pF.randomUUID)().split("-")[0]}`;return na.test(n)||De(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function G9(t){let e=t.apikey||ne();return e||De("Missing API key, you need to provide an API key to upload your bundle"),e}function W9(t,e,r){let n=le(t,r),o=e.path||r?.webDir;return n||De("Missing argument, you need to provide a appid or be in a capacitor project"),o||De("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Vo.existsSync)(o)||De(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function Y9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(qs(e,"notifyAppReady")||De(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
215
+ If you are sure your app has this code, you can use the --no-code-check option`),lf(e)||De(`index.html is missing in the root folder of ${e}`))}async function J9(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let y=ye();y.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Kl(t,o,n,r.packageJson,r.nodeModules);if(h=C,p=E,h.find(g=>!$o(g)))y.stop(`Bundle NOT compatible with ${n} channel`),f.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,f.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!na.test(g))&&De("Invalid remote min update version, skipping auto setting compatibility"),u=g,y.stop(`Auto set min-update-version to ${u}`)}catch{De(`Cannot auto set compatibility, invalid data ${c}`)}else y.stop(`Bundle compatible with ${n} channel`)}else a||(f.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await Tg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&De("You need to provide a min-update-version to upload a bundle to this channel"),u&&(na.test(u)||De(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.filter(y=>!!y.native&&y.native!==void 0).map(y=>[y.name,y])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([y,C])=>({name:y,version:C.version})):void 0,minUpdateVersion:u}}async function X9(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(o||i){if(n)return f.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),Z("Bundle version already exists - exiting gracefully \u{1F389}"),!0;De(`Version ${r} already exists ${U(i)}`)}return!1}async function Z9(t,e,r,n,o,i,a){let s,u,c="",l=null,d="none",p="",h=e.keyV2,m=e.key===!1,b=ye();b.start(`Zipping bundle from ${t}`),l=await Vl(t),b.message("Calculating checksum");let y=gt((0,bf.cwd)()),C=await qr("@capgo/capacitor-updater",y,e.packageJson),E=!1,g;try{g=C?_e(C):void 0}catch{g=void 0}if(C?g?E=!jn(g,$s):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):De("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,Vo.existsSync)(Xt))&&!m||E?c=await on(l,"sha256"):c=await on(l,"crc32"),b.stop(`Checksum ${E?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,Vo.existsSync)(Xt)||e.keyDataV2)&&!e.oldEncryption){let $=typeof h=="string"?h:Xt,F=e.keyDataV2||"";!F&&!(0,Vo.existsSync)($)&&De(`Cannot find private key ${$}`),await de(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),F||(F=(0,Vo.readFileSync)($).toString());let B=g&&!jn(g,"5.30.0","6.30.0","7.30.0");f.info(`Encrypting your bundle with ${B?"V3":"V2"}`);let{sessionKey:T,ivSessionKey:L}=rf(F),A=fa(l,T,L);c=B?nf(c,F):da(c,F),s=L,u=T,d="v2",p=F,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
216
216
  keep it safe, you will need it to decrypt your bundle.
217
217
  It will be also visible in your dashboard
218
- `),l=A}let _=Math.floor((l?.byteLength??0)/1024/1024),x=Math.floor(i/1024/1024);return l?.byteLength>i?ye(`The bundle size is ${_} Mb, this is greater than the maximum upload length ${x} Mb, please reduce the size of your bundle`):l?.byteLength>a?(f.warn(`WARNING !!
218
+ `),l=A}let _=Math.floor((l?.byteLength??0)/1024/1024),x=Math.floor(i/1024/1024);return l?.byteLength>i?De(`The bundle size is ${_} Mb, this is greater than the maximum upload length ${x} Mb, please reduce the size of your bundle`):l?.byteLength>a?(f.warn(`WARNING !!
219
219
  The bundle size is ${_} Mb, this may take a while to download for users
220
220
  `),f.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
221
- `),e.verbose&&(f.info("[Verbose] Bundle size details:"),f.info(` - Actual size: ${_} MB (${l?.byteLength} bytes)`),f.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),f.info(` - Maximum allowed: ${x} MB`),f.info("[Verbose] Sending 'App Too Large' event to analytics...")),await fe(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&f.info("[Verbose] Event sent successfully")):e.verbose&&f.info(`[Verbose] Bundle size OK: ${_} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&f.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:s,sessionKey:u,checksum:c,encryptionMethod:d,finalKeyData:p}}async function N9(t,e,r,n,o,i,a,s){let u=De();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(a.verbose&&(f.info("[Verbose] uploadBundleToCapgoCloud called:"),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info(` - App ID: ${r}`),f.info(` - Bundle version: ${n}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
222
- Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await cr();if(a.verbose&&f.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?f.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):f.info("Uploading bundle with TUS protocol"),a.verbose&&(f.info("[Verbose] Starting TUS resumable upload..."),f.info(` - Host: ${h.hostWeb}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await PA(t,i,o,r,n,u,h,s),l=!0,a.verbose&&f.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return f.error(`Cannot finish TUS upload ${U(b)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${U(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&f.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&f.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await xA(e,r,n);if(!m)return f.error("Cannot get upload url"),a.verbose&&f.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(f.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),f.info(` - Timeout: ${a.timeout||Cg}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),a.timeout||Cg);try{let E=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(D)}a.verbose&&f.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(f.info(`[Verbose] Upload failed after ${b} seconds`),f.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let D=h.message.match(/status: (\d+)/),E=D?D[1]:"unknown";f.error(`Upload failed with status ${E}: ${h.message}`)}catch{f.error(`Upload failed: ${h.message}`)}else a.verbose&&f.info(`[Verbose] Non-HTTP error: ${U(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${U(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${U(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await $A(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${p} seconds`),f.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info("[Verbose] Sending performance event...")),await fe(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function L9(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){f.error(`Cannot delete linked bundle on upload ${U(o)}`);return}if(n.length===0){f.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){f.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){f.error(`Cannot delete linked bundle on upload ${U(a)}`);return}f.info("Linked bundle deleted")}async function j9(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||ye("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await Ml(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&ye(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${U(p)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?f.info("Your update is now available in your public channel \u{1F389}"):h?.id&&f.info(`Link device to this bundle to try it: ${m}`),r&&f.info(`Bundle url: ${m}`)}else f.warn("The upload key is not allowed to set the version in the channel")}async function U9(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(f.warn("Cannot find default upload channel"),f.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function sD(t,e,r=!1){r||ee(`Uploading with CLI version ${gr.version}`);let n,o=et();await ge();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:d}=e;e.verbose&&(f.info("[Verbose] Starting upload process with options:"),f.info(` - API key: ${e.apikey?"provided":"from saved key"}`),f.info(` - Path: ${e.path||"from capacitor config"}`),f.info(` - Channel: ${e.channel||"from default upload channel"}`),f.info(` - Bundle: ${e.bundle||"auto-detected"}`),f.info(` - External: ${e.external||"false"}`),f.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),f.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),f.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=P9(e);e.verbose&&f.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&f.info("[Verbose] Capacitor config loaded successfully");let m=await DA();e.verbose&&(f.info("[Verbose] Remote file config retrieved:"),f.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),f.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),f.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),f.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),f.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),f.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:D}=$9(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let E=await k9(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${E}`);let C=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Fs({version:E}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),T9(e,D),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${b}@${E} started from path "${D}" to Capgo cloud`);let _=await cr();e.verbose&&f.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(f.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&f.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let x=await re(p,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let $=await ie(x,p,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${$}`);let F=e.channel||await U9(b,x,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${F}`);let B=await bt(x,b);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await vA(x,B,gr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await CA(x,B,p,b,!0),e.verbose&&f.info("[Verbose] Plan validation passed"),e.verbose&&f.info("[Verbose] Trial check completed"),e.verbose&&f.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:I,minUpdateVersion:L}=await I9(x,o,e,F,b,E);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${I?I.length:0}`),f.info(` - Min update version: ${L||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${E} already exists...`);let A=await R9(x,b,E,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:g,storageProvider:C};e.external&&!e.external.startsWith("https://")&&ye(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(f.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),f.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:E,app_id:b,session_key:void 0,external_url:e.external,storage_provider:C,min_update_version:L,native_packages:I,owner_org:B,user_id:$,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,J="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await fe(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(f.info("[Verbose] External bundle configured:"),f.info(` - URL: ${e.external}`),f.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),f.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&f.info(`[Verbose] Preparing bundle file from path: ${D}`);let{zipped:P,ivSessionKey:N,checksum:z,sessionKey:H,encryptionMethod:se,finalKeyData:zt}=await B9(D,e,p,B,b,m.maxUploadLength,m.alertUploadSize);j.session_key=N,j.checksum=z,n=H,M=P,g=se,J=zt,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((P?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${z}`),f.info(` - Encryption: ${se}`),f.info(` - IV Session Key: ${N?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await RA(x,b,F,z),e.verbose&&f.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&f.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&f.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&f.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&ye("You cannot encrypt the partial update if you are not using the v2 encryption method");let k="5.30.0",y="6.30.0",w="7.30.0",v=!1;if(e.delta&&g==="v2"&&!e.encryptPartial){let P=gt((0,mf.cwd)()),N=await Mr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?_e(N):void 0}catch{z=void 0}N&&z&&yy(z,_e("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${z} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||g==="v2")){let P=gt((0,mf.cwd)()),N=await Mr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?_e(N):void 0}catch{z=void 0}N&&z&&(v=!Un(z,k,y,w),e.verbose&&v&&f.info(`[Verbose] Using hex checksum format for updater version ${z}`))}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let O=e.delta?await YO(D,p,B,b,e.encryptPartial?g:"none",J,v):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${O.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:R}=await Og(x,j);if(R&&ye(`Cannot add bundle ${U(R)}`),e.verbose&&f.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(f.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&f.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||a||s||l||d)){(!u||!c||!i||!a||!s||!l)&&ye("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),f.info("Uploading to S3"),e.verbose&&(f.info("[Verbose] S3 configuration:"),f.info(` - Endpoint: ${c}`),f.info(` - Region: ${i}`),f.info(` - Bucket: ${u}`),f.info(` - Port: ${l}`),f.info(` - SSL: ${d?"enabled":"disabled"}`));let P=d?`https://${c}`:`http://${c}`,N=new js({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),z=`${b}-${E}`,H=encodeURIComponent(z);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${z}`),await N.putObject(z,Uint8Array.from(M)),j.external_url=`${P}/${H}`,j.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await N9(p,x,b,E,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let P=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let z=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${O.length}`),f.info(` - Encryption: ${z?"enabled":"disabled"}`)),P=e.delta?await JO(p,O,D,b,B,z,e):null,e.verbose&&P&&f.info(`[Verbose] Delta upload complete with ${P.length} files`)}catch(z){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw z;f.info(`Failed to upload partial files to capgo cloud. Error: ${U(z)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${U(z)}`)}j.storage_provider="r2",j.manifest=P,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:N}=await Og(x,j);N&&ye(`Cannot update bundle ${U(N)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let T=await Me(x,p,b,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${ra(T,2)?"yes":"no"}`),f.info(` - Write: ${ra(T,3)?"yes":"no"}`),f.info(` - Admin: ${ra(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ra(T,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await L9(x,b,F)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),ra(T,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await j9(x,p,!!e.bundleUrl,E,F,$,B,b,_,e.selfAssign),e.verbose&&f.info("[Verbose] Channel updated successfully")):f.warn("Cannot set channel as a upload organization member"),e.verbose&&f.info("[Verbose] Sending upload event..."),await fe(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let q={success:!0,bundle:E,checksum:j.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${q.bundle}`),f.info(` - Checksum: ${q.checksum}`),f.info(` - Encryption: ${q.encryptionMethod}`),f.info(` - Storage: ${q.storageProvider}`)),r&&!q.skipped&&Z("Time to share your update to the world \u{1F30D}"),q}function M9(t){t.ivSessionKey&&!t.external&&ye("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&ye("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&ye("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&ye("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&ye("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&ye("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&ye("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&ye("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&ye("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&ye("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&ye("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function ZO(t,e){try{M9(e),await sD(t,e)}catch(r){throw f.error(`uploadBundle failed: ${U(r)}`),r instanceof Error?r:new Error(String(r))}}var QO=require("node:crypto"),gf=require("node:fs"),eF=require("node:process");var q9=20;function H9(t){console.log(JSON.stringify(t,null,2))}function zs(t){console.error(U(t))}async function V9(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await ge();let s=await te(),u=ce(t,s?.config),c=(0,QO.randomUUID)().split("-")[0],l=Ar("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!ta.test(o)){let $=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?zs({error:"invalid_semver"}):f.error($)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let $="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?zs({error:"missing_argument"}):f.error($)),new Error($)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Us(i,"notifyAppReady"))throw r||(n?zs({error:"notifyAppReady_not_in_source_code"}):f.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!af(i))throw r||(n?zs({error:"index_html_not_found"}):f.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Ul(i);a&&f.info(`Zipped ${p.byteLength} bytes`);let h=a?De():null;h&&h.start("Calculating checksum");let m=gt((0,eF.cwd)()),b=await Mr("@capgo/capacitor-updater",m,e.packageJson);if(!b){let $="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn($),new Error($)}let D=!1,E;try{E=b?_e(b):void 0}catch{E=void 0}E?D=!Un(E,void 0,void 0,"7.0.0"):b==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let C=await nn(p,e.keyV2||(0,gf.existsSync)(Jt)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${C}`);let g=Math.floor(p.byteLength/1024/1024);g>q9&&a&&(f.warn(`WARNING !!
221
+ `),e.verbose&&(f.info("[Verbose] Bundle size details:"),f.info(` - Actual size: ${_} MB (${l?.byteLength} bytes)`),f.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),f.info(` - Maximum allowed: ${x} MB`),f.info("[Verbose] Sending 'App Too Large' event to analytics...")),await de(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&f.info("[Verbose] Event sent successfully")):e.verbose&&f.info(`[Verbose] Bundle size OK: ${_} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&f.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:s,sessionKey:u,checksum:c,encryptionMethod:d,finalKeyData:p}}async function Q9(t,e,r,n,o,i,a,s){let u=ye();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(a.verbose&&(f.info("[Verbose] uploadBundleToCapgoCloud called:"),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info(` - App ID: ${r}`),f.info(` - Bundle version: ${n}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
222
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await lr();if(a.verbose&&f.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?f.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):f.info("Uploading bundle with TUS protocol"),a.verbose&&(f.info("[Verbose] Starting TUS resumable upload..."),f.info(` - Host: ${h.hostWeb}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await GA(t,i,o,r,n,u,h,s),l=!0,a.verbose&&f.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return f.error(`Cannot finish TUS upload ${U(b)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${U(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&f.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&f.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await qA(e,r,n);if(!m)return f.error("Cannot get upload url"),a.verbose&&f.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(f.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),f.info(` - Timeout: ${a.timeout||Og}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let b=new AbortController,y=setTimeout(()=>b.abort(),a.timeout||Og);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(y)}a.verbose&&f.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(f.info(`[Verbose] Upload failed after ${b} seconds`),f.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let y=h.message.match(/status: (\d+)/),C=y?y[1]:"unknown";f.error(`Upload failed with status ${C}: ${h.message}`)}catch{f.error(`Upload failed: ${h.message}`)}else a.verbose&&f.info(`[Verbose] Non-HTTP error: ${U(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${U(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${U(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await WA(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${p} seconds`),f.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info("[Verbose] Sending performance event...")),await de(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function e7(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){f.error(`Cannot delete linked bundle on upload ${U(o)}`);return}if(n.length===0){f.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){f.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){f.error(`Cannot delete linked bundle on upload ${U(a)}`);return}f.info("Linked bundle deleted")}async function t7(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||De("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await zl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&De(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${U(p)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?f.info("Your update is now available in your public channel \u{1F389}"):h?.id&&f.info(`Link device to this bundle to try it: ${m}`),r&&f.info(`Bundle url: ${m}`)}else f.warn("The upload key is not allowed to set the version in the channel")}async function r7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(f.warn("Cannot find default upload channel"),f.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function dy(t,e,r=!1){r||ee(`Uploading with CLI version ${yr.version}`);let n,o=tt();await ge();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:d}=e;e.verbose&&(f.info("[Verbose] Starting upload process with options:"),f.info(` - API key: ${e.apikey?"provided":"from saved key"}`),f.info(` - Path: ${e.path||"from capacitor config"}`),f.info(` - Channel: ${e.channel||"from default upload channel"}`),f.info(` - Bundle: ${e.bundle||"auto-detected"}`),f.info(` - External: ${e.external||"false"}`),f.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),f.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),f.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=G9(e);e.verbose&&f.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&f.info("[Verbose] Capacitor config loaded successfully");let m=await IA();e.verbose&&(f.info("[Verbose] Remote file config retrieved:"),f.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),f.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),f.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),f.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),f.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),f.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:y}=W9(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${b}, Build path: ${y}`);let C=await K9(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Ps({version:C}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),Y9(e,y),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${b}@${C} started from path "${y}" to Capgo cloud`);let _=await lr();e.verbose&&f.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(f.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&f.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let x=await re(p,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let $=await ie(x,p,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${$}`);let F=e.channel||await r7(b,x,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${F}`);let B=await bt(x,b);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await NA(x,B,yr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await jA(x,B,p,b,!0),e.verbose&&f.info("[Verbose] Plan validation passed"),e.verbose&&f.info("[Verbose] Trial check completed"),e.verbose&&f.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:T,minUpdateVersion:L}=await J9(x,o,e,F,b,C);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${T?T.length:0}`),f.info(` - Min update version: ${L||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${C} already exists...`);let A=await X9(x,b,C,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&De(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(f.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),f.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:L,native_packages:T,owner_org:B,user_id:$,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,J="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await de(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(f.info("[Verbose] External bundle configured:"),f.info(` - URL: ${e.external}`),f.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),f.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&f.info(`[Verbose] Preparing bundle file from path: ${y}`);let{zipped:P,ivSessionKey:N,checksum:z,sessionKey:H,encryptionMethod:se,finalKeyData:zt}=await Z9(y,e,p,B,b,m.maxUploadLength,m.alertUploadSize);j.session_key=N,j.checksum=z,n=H,M=P,g=se,J=zt,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((P?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${z}`),f.info(` - Encryption: ${se}`),f.info(` - IV Session Key: ${N?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await XA(x,b,F,z),e.verbose&&f.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&f.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&f.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&f.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&De("You cannot encrypt the partial update if you are not using the v2 encryption method");let k="5.30.0",D="6.30.0",w="7.30.0",v=!1;if(e.delta&&g==="v2"&&!e.encryptPartial){let P=gt((0,bf.cwd)()),N=await qr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?_e(N):void 0}catch{z=void 0}N&&z&&ED(z,_e("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${z} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||g==="v2")){let P=gt((0,bf.cwd)()),N=await qr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?_e(N):void 0}catch{z=void 0}N&&z&&(v=!jn(z,k,D,w),e.verbose&&v&&f.info(`[Verbose] Using hex checksum format for updater version ${z}`))}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let O=e.delta?await fF(y,p,B,b,e.encryptPartial?g:"none",J,v):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${O.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:R}=await Ig(x,j);if(R&&De(`Cannot add bundle ${U(R)}`),e.verbose&&f.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(f.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&f.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||a||s||l||d)){(!u||!c||!i||!a||!s||!l)&&De("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),f.info("Uploading to S3"),e.verbose&&(f.info("[Verbose] S3 configuration:"),f.info(` - Endpoint: ${c}`),f.info(` - Region: ${i}`),f.info(` - Bucket: ${u}`),f.info(` - Port: ${l}`),f.info(` - SSL: ${d?"enabled":"disabled"}`));let P=d?`https://${c}`:`http://${c}`,N=new Ms({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),z=`${b}-${C}`,H=encodeURIComponent(z);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${z}`),await N.putObject(z,Uint8Array.from(M)),j.external_url=`${P}/${H}`,j.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await Q9(p,x,b,C,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let P=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let z=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${O.length}`),f.info(` - Encryption: ${z?"enabled":"disabled"}`)),P=e.delta?await dF(p,O,y,b,B,z,e):null,e.verbose&&P&&f.info(`[Verbose] Delta upload complete with ${P.length} files`)}catch(z){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw z;f.info(`Failed to upload partial files to capgo cloud. Error: ${U(z)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${U(z)}`)}j.storage_provider="r2",j.manifest=P,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:N}=await Ig(x,j);N&&De(`Cannot update bundle ${U(N)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let I=await Me(x,p,b,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${oa(I,2)?"yes":"no"}`),f.info(` - Write: ${oa(I,3)?"yes":"no"}`),f.info(` - Admin: ${oa(I,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&oa(I,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await e7(x,b,F)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),oa(I,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${C} to channel ${F}...`),await t7(x,p,!!e.bundleUrl,C,F,$,B,b,_,e.selfAssign),e.verbose&&f.info("[Verbose] Channel updated successfully")):f.warn("Cannot set channel as a upload organization member"),e.verbose&&f.info("[Verbose] Sending upload event..."),await de(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let q={success:!0,bundle:C,checksum:j.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${q.bundle}`),f.info(` - Checksum: ${q.checksum}`),f.info(` - Encryption: ${q.encryptionMethod}`),f.info(` - Storage: ${q.storageProvider}`)),r&&!q.skipped&&Z("Time to share your update to the world \u{1F30D}"),q}function n7(t){t.ivSessionKey&&!t.external&&De("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&De("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&De("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&De("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&De("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&De("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&De("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&De("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&De("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&De("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&De("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function hF(t,e){try{n7(e),await dy(t,e)}catch(r){throw f.error(`uploadBundle failed: ${U(r)}`),r instanceof Error?r:new Error(String(r))}}var mF=require("node:crypto"),wf=require("node:fs"),gF=require("node:process");var o7=20;function i7(t){console.log(JSON.stringify(t,null,2))}function Gs(t){console.error(U(t))}async function a7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await ge();let s=await te(),u=le(t,s?.config),c=(0,mF.randomUUID)().split("-")[0],l=Or("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!na.test(o)){let $=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Gs({error:"invalid_semver"}):f.error($)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let $="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Gs({error:"missing_argument"}):f.error($)),new Error($)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!qs(i,"notifyAppReady"))throw r||(n?Gs({error:"notifyAppReady_not_in_source_code"}):f.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!lf(i))throw r||(n?Gs({error:"index_html_not_found"}):f.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Vl(i);a&&f.info(`Zipped ${p.byteLength} bytes`);let h=a?ye():null;h&&h.start("Calculating checksum");let m=gt((0,gF.cwd)()),b=await qr("@capgo/capacitor-updater",m,e.packageJson);if(!b){let $="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn($),new Error($)}let y=!1,C;try{C=b?_e(b):void 0}catch{C=void 0}C?y=!jn(C,void 0,void 0,"7.0.0"):b==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),y=!0);let E=await on(p,e.keyV2||(0,wf.existsSync)(Xt)||y?"sha256":"crc32");h&&h.stop(`Checksum ${y?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(p.byteLength/1024/1024);g>o7&&a&&(f.warn(`WARNING !!
223
223
  The bundle size is ${g} Mb, this may take a while to download for users
224
224
  `),f.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
225
- `));let _=a?De():null,x=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${x}`),(0,gf.writeFileSync)(x,p),_&&_.stop(`Saved to ${x}`),a&&Z("Done \u2705"),!r&&n&&H9({bundle:o,filename:x,checksum:C}),{bundle:o,filename:x,checksum:C}}catch(s){throw r||(n?zs(s):f.error(U(s))),s instanceof Error?s:new Error(String(s))}}async function tF(t,e){await V9(t,e,!1)}async function uD(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=ce(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon);await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await Rg(i,e);if(!a)throw n||f.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await bt(i,e),u=await ie(i,r.apikey,["write","all"]),c=await s1(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||f.error(`Cannot create Channel \u{1F640}
226
- ${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await fe(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel created \u2705"),Z("Done \u2705")),c.data??!0}async function rF(t,e,r){await uD(t,e,r,!1)}async function z9(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=ce(e,i?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(r.apikey,r.supaHost,r.supaAnon);if(await ie(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||f.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=s[0];if(!c)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?f.info(c.name):f.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function nF(t,e,r){return z9(t,e,r)}async function K9(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=ce(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await f1(i,e,t);p?.name&&!n&&f.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Bg(i,e,p.name)}let{data:s,error:u}=await c1(i,e,t);if(u||!s){if(n||f.error(`Channel ${t} not found`),r.successIfNotFound)return n||f.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await l1(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${U(c)}`),new Error(`Cannot delete channel devices: ${U(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await u1(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${U(l.error)}`),new Error(`Cannot delete channel: ${U(l.error)}`);let d=await bt(i,e);return await fe(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),Z("Done \u2705")),!0}async function oF(t,e,r){return K9(t,e,r,!1)}async function G9(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=ce(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await ie(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await p1(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),d1(a)),await fe(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||Z("Done \u2705"),a}async function iF(t,e){return G9(t,e,!1)}var aF=["major","minor","metadata","patch","none"];async function W9(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=ce(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await bt(i,e),{bundle:u,state:c,downgrade:l,latest:d,latestRemote:p,ios:h,android:m,selfAssign:b,disableAutoUpdate:D,dev:E,emulator:C}=r;if(d&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||f.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||f.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&p==null&&l==null&&h==null&&m==null&&b==null&&E==null&&C==null&&D==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await EA(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||f.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let x=d?o?.config?.plugins?.CapacitorUpdater?.version||Ar("",r.packageJson):u;if(x!=null){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",x).eq("user_id",a).eq("deleted",!1).single();if(B||!F)throw n||f.error(`Cannot find version ${x}`),new Error(`Cannot find version ${x}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:I,localDependencies:L}=await kg(i,e,t,F.native_packages??[]),A=et();if(L.length>0&&I.some(j=>!ko(j)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(L.length===0&&I.length>0?f.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):f.info(`Bundle is compatible with ${t} channel`))}n||f.info(`Set ${e} channel: ${t} to @${x}`),g.version=F.id}if(p){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!F)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:I}=await kg(i,e,t,F.native_packages??[]),L=et();if(I.some(A=>!ko(A)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${L.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||f.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||f.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||f.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||f.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||f.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||f.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),E!=null&&(n||f.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),g.allow_dev=!!E),C!=null&&(n||f.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} emulator devices`),g.allow_emulator=!!C),D!=null){let F=D.toLowerCase();if(!aF.includes(F))throw n||f.error(`Channel strategy ${F} is not known. The possible values are: ${aF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||f.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:$}=await Ml(i,g);if($)throw n||f.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await fe(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||Z("Done \u2705"),!0}async function sF(t,e,r){return W9(t,e,r,!1)}var Kr=require("node:fs");function cD(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function uF(t="./README.md",e){let r=ot.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,d=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let d=i?"###":"##",p="",h=cD(u);s&&!i||(p+=`${d} <a id="${l}"></a> ${h} **${c}**
225
+ `));let _=a?ye():null,x=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${x}`),(0,wf.writeFileSync)(x,p),_&&_.stop(`Saved to ${x}`),a&&Z("Done \u2705"),!r&&n&&i7({bundle:o,filename:x,checksum:E}),{bundle:o,filename:x,checksum:E}}catch(s){throw r||(n?Gs(s):f.error(U(s))),s instanceof Error?s:new Error(String(s))}}async function yF(t,e){await a7(t,e,!1)}async function py(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon);await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await Ug(i,e);if(!a)throw n||f.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await bt(i,e),u=await ie(i,r.apikey,["write","all"]),c=await E1(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||f.error(`Cannot create Channel \u{1F640}
226
+ ${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await de(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel created \u2705"),Z("Done \u2705")),c.data??!0}async function DF(t,e,r){await py(t,e,r,!1)}async function s7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=le(e,i?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(r.apikey,r.supaHost,r.supaAnon);if(await ie(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||f.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=s[0];if(!c)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?f.info(c.name):f.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function bF(t,e,r){return s7(t,e,r)}async function u7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await A1(i,e,t);p?.name&&!n&&f.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Mg(i,e,p.name)}let{data:s,error:u}=await S1(i,e,t);if(u||!s){if(n||f.error(`Channel ${t} not found`),r.successIfNotFound)return n||f.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await x1(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${U(c)}`),new Error(`Cannot delete channel devices: ${U(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await _1(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${U(l.error)}`),new Error(`Cannot delete channel: ${U(l.error)}`);let d=await bt(i,e);return await de(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),Z("Done \u2705")),!0}async function wF(t,e,r){return u7(t,e,r,!1)}async function c7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await ie(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await F1(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),O1(a)),await de(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||Z("Done \u2705"),a}async function vF(t,e){return c7(t,e,!1)}var CF=["major","minor","metadata","patch","none"];async function l7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await bt(i,e),{bundle:u,state:c,downgrade:l,latest:d,latestRemote:p,ios:h,android:m,selfAssign:b,disableAutoUpdate:y,dev:C,emulator:E}=r;if(d&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||f.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||f.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&p==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&y==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await LA(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||f.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let x=d?o?.config?.plugins?.CapacitorUpdater?.version||Or("",r.packageJson):u;if(x!=null){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",x).eq("user_id",a).eq("deleted",!1).single();if(B||!F)throw n||f.error(`Cannot find version ${x}`),new Error(`Cannot find version ${x}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:T,localDependencies:L}=await Rg(i,e,t,F.native_packages??[]),A=tt();if(L.length>0&&T.some(j=>!$o(j)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(L.length===0&&T.length>0?f.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):f.info(`Bundle is compatible with ${t} channel`))}n||f.info(`Set ${e} channel: ${t} to @${x}`),g.version=F.id}if(p){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!F)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:T}=await Rg(i,e,t,F.native_packages??[]),L=tt();if(T.some(A=>!$o(A)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${L.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||f.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||f.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||f.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||f.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||f.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||f.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||f.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||f.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),y!=null){let F=y.toLowerCase();if(!CF.includes(F))throw n||f.error(`Channel strategy ${F} is not known. The possible values are: ${CF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||f.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:$}=await zl(i,g);if($)throw n||f.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await de(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||Z("Done \u2705"),!0}async function EF(t,e,r){return l7(t,e,r,!1)}var Gr=require("node:fs");function hy(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function _F(t="./README.md",e){let r=ot.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,d=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let d=i?"###":"##",p="",h=hy(u);s&&!i||(p+=`${d} <a id="${l}"></a> ${h} **${c}**
227
227
 
228
228
  `),o.alias&&(p+=`**Alias:** \`${o.alias}\`
229
229
 
230
230
  `),o.isCommandGroup||(p+="```bash\n",i?p+=`npx @capgo/cli@latest ${a} ${u}
231
231
  `:p+=`npx @capgo/cli@latest ${u}
232
232
  `,p+="```\n\n");let m=o.description.split(`
233
- `),b=!i&&s?1:0;for(let E=b;E<m.length;E++){let C=m[E];C.trim().startsWith("Note:")?p+=`> \u2139\uFE0F ${C.trim().substring(5).trim()}
233
+ `),b=!i&&s?1:0;for(let C=b;C<m.length;C++){let E=m[C];E.trim().startsWith("Note:")?p+=`> \u2139\uFE0F ${E.trim().substring(5).trim()}
234
234
 
235
- `:C.includes("Example:")||C.trim()&&(p+=`${C}
235
+ `:E.includes("Example:")||E.trim()&&(p+=`${E}
236
236
  `)}p+=`
237
- `;let D=o.description.split(`
238
- `).find(E=>E.includes("Example:"));if(D&&!o.isCommandGroup&&(p+=`**Example:**
237
+ `;let y=o.description.split(`
238
+ `).find(C=>C.includes("Example:"));if(y&&!o.isCommandGroup&&(p+=`**Example:**
239
239
 
240
- `,p+="```bash\n",p+=`${D.replace("Example: ","")}
240
+ `,p+="```bash\n",p+=`${y.replace("Example: ","")}
241
241
  `,p+="```\n\n"),o.options.length>0){i?p+=`**Options:**
242
242
 
243
243
  `:p+=`## <a id="options"></a> Options
244
244
 
245
245
  `,p+=`| Param | Type | Description |
246
246
  `,p+=`| -------------- | ------------- | -------------------- |
247
- `;for(let E of o.options){let C=E.flags.split(" ")[0],g=E.flags.split(" ").length>1?"string":"boolean";p+=`| **${C}** | <code>${g}</code> | ${E.description} |
247
+ `;for(let C of o.options){let E=C.flags.split(" ")[0],g=C.flags.split(" ").length>1?"string":"boolean";p+=`| **${E}** | <code>${g}</code> | ${C.description} |
248
248
  `}p+=`
249
- `}return p};if(e){(0,Kr.existsSync)(e)||(0,Kr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
250
- title: ${cD(o.name)} ${o.name}
249
+ `}return p};if(e){(0,Gr.existsSync)(e)||(0,Gr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
250
+ title: ${hy(o.name)} ${o.name}
251
251
  description: ${o.description.split(`
252
252
  `)[0]}
253
253
  sidebar_label: ${o.name}
@@ -258,40 +258,40 @@ sidebar:
258
258
  `,s=o.description.split(`
259
259
  `)[0];a+=`${s}
260
260
 
261
- `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);a+=u;try{(0,Kr.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),f.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}f.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
261
+ `;let u="";if(o.subcommands.length===0)u=n(o,!1,o.name,!0);else for(let c of o.subcommands)u+=n(c,!0,o.name);a+=u;try{(0,Gr.writeFileSync)(`${e}/${o.name}.mdx`,a,"utf8"),f.success(`Generated documentation file for ${o.name} command in ${e}/${o.name}.mdx`)}catch(c){console.error(`Error generating file for ${o.name}:`,c)}}f.success(`Documentation files generated in ${e}/`)}else{let o=`## \u{1F4D1} Capgo CLI Commands
262
262
 
263
263
  `;o+=`## \u{1F4CB} Table of Contents
264
264
 
265
- `;for(let l of r){if(l.name==="generate-docs")continue;let d=cD(l.name);if(o+=`- ${d} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
265
+ `;for(let l of r){if(l.name==="generate-docs")continue;let d=hy(l.name);if(o+=`- ${d} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
266
266
  `,l.subcommands.length>0)for(let p of l.subcommands)o+=` - [${p.name.charAt(0).toUpperCase()+p.name.slice(1)}](#${l.name}-${p.name})
267
267
  `}o+=`
268
268
  `;for(let l of r)if(l.name!=="generate-docs"){if(o+=n(l,!1,void 0,!1),l.subcommands.length>0){l.isCommandGroup||(o+=`#### ${l.name.toUpperCase()} Subcommands:
269
269
 
270
270
  `);for(let d of l.subcommands)o+=n(d,!0,l.name)}o+=`
271
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Kr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),d=s.substring(c),p=`${l}
271
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Gr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),d=s.substring(c),p=`${l}
272
272
  ${o}
273
- ${d}`;(0,Kr.writeFileSync)(t,p,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Kr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var Da=require("node:child_process"),Te=require("node:fs"),Vn=require("node:path"),Ee=require("node:process");var wf=de(xF());var It=require("node:fs");function AF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function m7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||un,o=t.keyData||"";if(!(0,It.existsSync)(n)&&!o)throw e||f.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,It.existsSync)(n)&&(o=(0,It.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||f.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=AF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await we({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Yi(r)}return e||(f.success(`Public key saved into ${r.path} file in local directory`),f.success("Your app will decode the zip archive with this key")),!0}async function g7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Yi(r),(0,It.existsSync)(ea))try{(0,It.unlinkSync)(ea),e||f.success(`Old private key file deleted: ${ea}`)}catch(o){e||f.error(`Failed to delete old private key file: ${ea} (${String(o)})`)}if((0,It.existsSync)(Nl))try{(0,It.unlinkSync)(Nl),e||f.success(`Old public key file deleted: ${Nl}`)}catch(o){e||f.error(`Failed to delete old public key file: ${un} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),Z("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function OF(t){await ge(),await m7(t,!1)}async function hD(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=w1();if((0,It.existsSync)(un)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,It.writeFileSync)(un,r),(0,It.existsSync)(Jt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,It.writeFileSync)(Jt,n);let o=await te();if(o){let i=AF(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await we({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Yi(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Jt}`),f.success("This key will be used to encrypt your bundle before sending it to Capgo"),f.success("Keep it safe"),f.success("Then make it unreadable by Capgo and unmodifiable by anyone"),f.success(`Public key saved in ${o.path}`),f.success("Your app will be the only one having it"),f.success("Only your users can decrypt your update"),f.success("Only you can send them an update");try{await Hl(),Z("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function FF(t){await ge(),await hD(t,!1)}async function kF(t){await ge(),await g7(t,!1)}var Dn=require("node:fs"),mD=require("node:os");function PF(){let t=(0,mD.homedir)();return(0,Dn.existsSync)(`${t}/.capgo`)||(0,Dn.existsSync)(".capgo")}async function gD(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await ge();let{local:n}=e;if(n){if(!(0,Dn.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,Dn.writeFileSync)(".capgo",`${t}
274
- `),(0,Dn.appendFileSync)(".gitignore",`.capgo
275
- `)}else{let a=(0,mD.homedir)();(0,Dn.writeFileSync)(`${a}/.capgo`,`${t}
276
- `)}let o=await re(t,e.supaHost,e.supaAnon),i=await ie(o,t,["write","all","upload"]);await fe(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(f.success(`login saved into .capgo file in ${n?"local":"home"} directory`),Z("Done \u2705"))}async function $F(t,e){await gD(t,e,!1)}var TF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",bf="CapacitorUpdater.notifyAppReady()",D7=/import.*from.*/g,Ks="production",DD={stdio:"pipe"},Gs,zn;function IF(){Gs??=(0,Te.readdirSync)(wf.default.tmpdir).map(t=>({name:t,full:`${wf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??wf.default.fileSync({prefix:"capgocli"}).name}function hr(t,e){try{IF(),(0,Te.writeFileSync)(Gs,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:zn})),e&&(zn=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
277
- ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!")}}async function y7(t,e){try{IF();let r=(0,Te.readFileSync)(Gs,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);f.info(`You have already got to the step ${n}/10 in the previous session`);let i=await we({message:"Would you like to continue from where you left off?"});return await Vt(i,t,e),i?(o&&(zn=o),n):void 0}catch(r){f.error(`Cannot read which steps have been completed, error:
278
- ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!");return}}function b7(){if(Gs)try{(0,Te.rmSync)(Gs)}catch(t){f.error(`Cannot delete the tmp steps file.
279
- Error: ${t}`)}}async function Vt(t,e,r){be(t)&&(await ur("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ee.exit)())}async function mr(t,e,r,n){return ur("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function w7(t,e,r,n){let o=et(),i=await we({message:`Add ${r} in Capgo?`});if(await Vt(i,t.gid,e),i){let a=De();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await Pg(r,n,t,!0)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else f.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await mr(t.gid,e,"add-app",r)}async function v7(t,e,r){let n=et(),o=await we({message:`Create default channel ${Ks} for ${r} in Capgo?`});if(await Vt(o,t,e),o){let i=De();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Ks} ${r} --default`),await uD(Ks,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else f.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Ks} ${r} --default"`);await mr(t,e,"add-channel",r)}async function E7(t){let e=(0,Vn.join)(gt((0,Ee.cwd)()),Ur),r=zn?await Yt(void 0,zn):await Yt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){f.warn("No adequate dependencies found");let n=await we({message:"Would you like to select the package.json file manually?"});if(be(n)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)),n){let o=await we({message:"Would you like to use a tree selector to choose the package.json file?"});if(be(o)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)),o){let a=(0,Ee.cwd)(),s=Ur;for(;;){let u=(0,Te.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await yr({message:"Select package.json file:",options:u}),be(s)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)),!(0,Te.statSync)((0,Vn.join)(a,s)).isDirectory()&&s!==Ur){f.error("Selected a file that is not a package.json file");continue}if(a=(0,Vn.join)(a,s),s===Ur)break}return await hr(t,a),{dependencies:await Yt(void 0,a),path:a}}let i=await Dr({message:"Enter path to node_modules folder:"});return be(i)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)),(0,Te.existsSync)(i)||(f.error(`Path ${i} does not exist`),(0,Ee.exit)(1)),{dependencies:await Yt(void 0,i),path:i}}}return await hr(t,e),{dependencies:await Yt(void 0,e),path:e}}var C7="https://capacitorjs.com/docs/updating/6-0",_7="https://capacitorjs.com/docs/updating/7-0";async function S7(t,e,r){let n=et(),o="1.0.0",i=!1,a=await we({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Vt(a,t,e),a){let s=De(),u="latest",{dependencies:c,path:l}=await E7(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json"),Z("Bye \u{1F44B}"),(0,Ee.exit)());let d=c.get("@capacitor/core");if(d||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),Z("Bye \u{1F44B}"),(0,Ee.exit)()),d==="latest"?(s.stop(`@capacitor/core version is ${d}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),Z("Bye \u{1F44B}"),(0,Ee.exit)()):vr(_e(d),_e("6.0.0"))?(s.stop("Error"),f.warn(`@capacitor/core version is ${d}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${C7}`),Z("Bye \u{1F44B}"),(0,Ee.exit)()):vr(_e(d),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${d}, update to Capacitor v7 minimum: ${_7} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(s.stop("Error"),f.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),Z("Bye \u{1F44B}"),(0,Ee.exit)()),await Mr("@capgo/capacitor-updater",l.replace("/package.json",""),l))s.stop("Capgo already installed \u2705");else{await(0,Da.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...DD,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Ar(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await we({message:`Do you want to set instant updates in ${r}? Read more about it here: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately`}),await Vt(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await Sg("SplashScreen",{launchAutoHide:!1}),await Fs({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else f.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await mr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function x7(t,e,r){let n=await we({message:`Automatic Add "${bf}" code and import in ${r}?`});if(await Vt(n,t,e),n){let o=De();o.start("Adding @capacitor-updater to your main file");let i=await jl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Vn.join)("plugins");(0,Te.existsSync)(a)||(0,Te.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Vn.join)(a,"capacitorUpdater.client.ts"):s=(0,Vn.join)(a,"capacitorUpdater.client.js");let u=`
273
+ ${d}`;(0,Gr.writeFileSync)(t,p,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Gr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var ba=require("node:child_process"),Ie=require("node:fs"),Hn=require("node:path"),Ce=require("node:process");var _f=ue(qF());var Tt=require("node:fs");function HF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function P7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||ln,o=t.keyData||"";if(!(0,Tt.existsSync)(n)&&!o)throw e||f.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Tt.existsSync)(n)&&(o=(0,Tt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||f.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=HF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await we({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Xi(r)}return e||(f.success(`Public key saved into ${r.path} file in local directory`),f.success("Your app will decode the zip archive with this key")),!0}async function $7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xi(r),(0,Tt.existsSync)(ra))try{(0,Tt.unlinkSync)(ra),e||f.success(`Old private key file deleted: ${ra}`)}catch(o){e||f.error(`Failed to delete old private key file: ${ra} (${String(o)})`)}if((0,Tt.existsSync)(Ml))try{(0,Tt.unlinkSync)(Ml),e||f.success(`Old public key file deleted: ${Ml}`)}catch(o){e||f.error(`Failed to delete old public key file: ${ln} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),Z("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function VF(t){await ge(),await P7(t,!1)}async function by(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=B1();if((0,Tt.existsSync)(ln)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Tt.writeFileSync)(ln,r),(0,Tt.existsSync)(Xt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Tt.writeFileSync)(Xt,n);let o=await te();if(o){let i=HF(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await we({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Xi(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Xt}`),f.success("This key will be used to encrypt your bundle before sending it to Capgo"),f.success("Keep it safe"),f.success("Then make it unreadable by Capgo and unmodifiable by anyone"),f.success(`Public key saved in ${o.path}`),f.success("Your app will be the only one having it"),f.success("Only your users can decrypt your update"),f.success("Only you can send them an update");try{await Gl(),Z("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function zF(t){await ge(),await by(t,!1)}async function KF(t){await ge(),await $7(t,!1)}var bn=require("node:fs"),wy=require("node:os");function GF(){let t=(0,wy.homedir)();return(0,bn.existsSync)(`${t}/.capgo`)||(0,bn.existsSync)(".capgo")}async function vy(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await ge();let{local:n}=e;if(n){if(!(0,bn.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,bn.writeFileSync)(".capgo",`${t}
274
+ `),(0,bn.appendFileSync)(".gitignore",`.capgo
275
+ `)}else{let a=(0,wy.homedir)();(0,bn.writeFileSync)(`${a}/.capgo`,`${t}
276
+ `)}let o=await re(t,e.supaHost,e.supaAnon),i=await ie(o,t,["write","all","upload"]);await de(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(f.success(`login saved into .capgo file in ${n?"local":"home"} directory`),Z("Done \u2705"))}async function WF(t,e){await vy(t,e,!1)}var YF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Ef="CapacitorUpdater.notifyAppReady()",I7=/import.*from.*/g,Ws="production",Cy={stdio:"pipe"},Ys,Vn;function JF(){Ys??=(0,Ie.readdirSync)(_f.default.tmpdir).map(t=>({name:t,full:`${_f.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??_f.default.fileSync({prefix:"capgocli"}).name}function mr(t,e){try{JF(),(0,Ie.writeFileSync)(Ys,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Vn})),e&&(Vn=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
277
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!")}}async function T7(t,e){try{JF();let r=(0,Ie.readFileSync)(Ys,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);f.info(`You have already got to the step ${n}/10 in the previous session`);let i=await we({message:"Would you like to continue from where you left off?"});return await Vt(i,t,e),i?(o&&(Vn=o),n):void 0}catch(r){f.error(`Cannot read which steps have been completed, error:
278
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!");return}}function R7(){if(Ys)try{(0,Ie.rmSync)(Ys)}catch(t){f.error(`Cannot delete the tmp steps file.
279
+ Error: ${t}`)}}async function Vt(t,e,r){be(t)&&(await cr("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ce.exit)())}async function gr(t,e,r,n){return cr("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function B7(t,e,r,n){let o=tt(),i=await we({message:`Add ${r} in Capgo?`});if(await Vt(i,t.gid,e),i){let a=ye();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await Bg(r,n,t,!0)?a.stop("App add Done \u2705"):a.stop("App already add \u2705")}else f.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${r}"`);await gr(t.gid,e,"add-app",r)}async function N7(t,e,r){let n=tt(),o=await we({message:`Create default channel ${Ws} for ${r} in Capgo?`});if(await Vt(o,t,e),o){let i=ye();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Ws} ${r} --default`),await py(Ws,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else f.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${Ws} ${r} --default"`);await gr(t,e,"add-channel",r)}async function L7(t){let e=(0,Hn.join)(gt((0,Ce.cwd)()),Mr),r=Vn?await Jt(void 0,Vn):await Jt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){f.warn("No adequate dependencies found");let n=await we({message:"Would you like to select the package.json file manually?"});if(be(n)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)),n){let o=await we({message:"Would you like to use a tree selector to choose the package.json file?"});if(be(o)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)),o){let a=(0,Ce.cwd)(),s=Mr;for(;;){let u=(0,Ie.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await br({message:"Select package.json file:",options:u}),be(s)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)),!(0,Ie.statSync)((0,Hn.join)(a,s)).isDirectory()&&s!==Mr){f.error("Selected a file that is not a package.json file");continue}if(a=(0,Hn.join)(a,s),s===Mr)break}return await mr(t,a),{dependencies:await Jt(void 0,a),path:a}}let i=await Dr({message:"Enter path to node_modules folder:"});return be(i)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)),(0,Ie.existsSync)(i)||(f.error(`Path ${i} does not exist`),(0,Ce.exit)(1)),{dependencies:await Jt(void 0,i),path:i}}}return await mr(t,e),{dependencies:await Jt(void 0,e),path:e}}var j7="https://capacitorjs.com/docs/updating/6-0",U7="https://capacitorjs.com/docs/updating/7-0";async function M7(t,e,r){let n=tt(),o="1.0.0",i=!1,a=await we({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Vt(a,t,e),a){let s=ye(),u="latest",{dependencies:c,path:l}=await L7(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json"),Z("Bye \u{1F44B}"),(0,Ce.exit)());let d=c.get("@capacitor/core");if(d||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),Z("Bye \u{1F44B}"),(0,Ce.exit)()),d==="latest"?(s.stop(`@capacitor/core version is ${d}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),Z("Bye \u{1F44B}"),(0,Ce.exit)()):Cr(_e(d),_e("6.0.0"))?(s.stop("Error"),f.warn(`@capacitor/core version is ${d}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${j7}`),Z("Bye \u{1F44B}"),(0,Ce.exit)()):Cr(_e(d),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${d}, update to Capacitor v7 minimum: ${U7} to support latest Mobile OS versions`),u="^6.0.0"),n.pm==="unknown"&&(s.stop("Error"),f.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),Z("Bye \u{1F44B}"),(0,Ce.exit)()),await qr("@capgo/capacitor-updater",l.replace("/package.json",""),l))s.stop("Capgo already installed \u2705");else{await(0,ba.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Cy,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Or(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await we({message:`Do you want to set instant updates in ${r}? Read more about it here: https://capgo.app/docs/live-updates/update-behavior/#applying-updates-immediately`}),await Vt(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await kg("SplashScreen",{launchAutoHide:!1}),await Ps({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else f.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await gr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function q7(t,e,r){let n=await we({message:`Automatic Add "${Ef}" code and import in ${r}?`});if(await Vt(n,t,e),n){let o=ye();o.start("Adding @capacitor-updater to your main file");let i=await Hl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Hn.join)("plugins");(0,Ie.existsSync)(a)||(0,Ie.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Hn.join)(a,"capacitorUpdater.client.ts"):s=(0,Hn.join)(a,"capacitorUpdater.client.js");let u=`
280
280
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
281
281
 
282
282
  export default defineNuxtPlugin(() => {
283
283
  CapacitorUpdater.notifyAppReady()
284
284
  })
285
- `;(0,Te.existsSync)(s)?(0,Te.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Te.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Updated capacitorUpdater.client.ts file with required code")):((0,Te.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await SA();else{let d=i.endsWith("-ts");a=await _A(i,d)}if(!a||!(0,Te.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await Dr({message:"Provide the correct relative path to your main file (JS or TS):",validate:p=>{if(!(0,Te.existsSync)(p))return"File does not exist. Please provide a valid path."}});be(d)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)),a=d}let u=(0,Te.readFileSync)(a,"utf8").toString(),l=u.match(D7)?.pop();if(l||(o.stop("Error"),f.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),Z("Bye \u{1F44B}"),(0,Ee.exit)()),u.includes(bf))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(l,`${l}
286
- ${TF};
285
+ `;(0,Ie.existsSync)(s)?(0,Ie.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Ie.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Updated capacitorUpdater.client.ts file with required code")):((0,Ie.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),f.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await MA();else{let d=i.endsWith("-ts");a=await UA(i,d)}if(!a||!(0,Ie.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await Dr({message:"Provide the correct relative path to your main file (JS or TS):",validate:p=>{if(!(0,Ie.existsSync)(p))return"File does not exist. Please provide a valid path."}});be(d)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)),a=d}let u=(0,Ie.readFileSync)(a,"utf8").toString(),l=u.match(I7)?.pop();if(l||(o.stop("Error"),f.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/getting-started/add-an-app/"),Z("Bye \u{1F44B}"),(0,Ce.exit)()),u.includes(Ef))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(l,`${l}
286
+ ${YF};
287
287
 
288
- ${bf};
289
- `);(0,Te.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await mr(t,e,"add-code",r)}else f.info(`Add to your main file the following code:
288
+ ${Ef};
289
+ `);(0,Ie.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await gr(t,e,"add-code",r)}else f.info(`Add to your main file the following code:
290
290
 
291
- ${TF};
291
+ ${YF};
292
292
 
293
- ${bf};
294
- `)}async function A7(t,e,r){let o=(await Yt()).get("@capacitor/core");o||f.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=et(),a=await we({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Vt(a,t,e),a){if(o==="latest"){f.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&vr(_e(o),_e("6.0.0"))){f.warn("Encryption is not supported in Capacitor V5.");return}let s=De();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await hD({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),f.warn("Cannot create key \u274C"),Z("Bye \u{1F44B}"),(0,Ee.exit)(1));try{await Hl(!0,t,e),ur("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await mr(t,e,"add-encryption",r)}async function O7(t,e,r){let n=et(),o=await we({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Vt(o,t,e),o){let i=De();i.start("Checking project type");let a=await jl(),s=await Ag(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),_g()[s]||(i.stop("Error"),f.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,Ee.exit)()),(0,Da.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,DD),i.stop("Build & Sync Done \u2705")}else f.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await mr(t,e,"build-project",r)}async function F7(t,e,r){let n=et(),o=await we({message:`Run ${r} in device now to test the initial version?`});if(await Vt(o,t,e),o){let i=await yr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});be(i)&&(Z("Bye \u{1F44B}"),(0,Ee.exit)());let a=i,s=De();s.start(`Running: ${n.runner} cap run ${a}`),await(0,Da.spawnSync)(n.runner,["cap","run",a],{stdio:"inherit"}),s.stop("App started \u2705"),f.info(`\u{1F4F1} Your app should now be running on your ${a} device with Capgo integrated`),f.info("\u{1F504} This is your baseline version - we'll create an update next")}else f.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await mr(t,e,"run-device",r)}async function k7(t,e,r,n){f.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await yr({message:"How would you like to test the update?",options:[{value:"auto",label:"Auto: Let Capgo CLI make a visible change for you"},{value:"manual",label:"Manual: I'll make changes myself"}]});if(be(o)&&(await ur("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)()),o==="auto"){let l=De();l.start("Making automatic changes to test Capgo updates");let d=!1,p=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let h of p)if((0,Te.existsSync)(h)&&!d)try{let m=(0,Te.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
293
+ ${Ef};
294
+ `)}async function H7(t,e,r){let o=(await Jt()).get("@capacitor/core");o||f.warn("Cannot find @capacitor/core in package.json. It is likely that you are using a monorepo. Please NOTE that encryption is not supported in Capacitor V5.");let i=tt(),a=await we({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Vt(a,t,e),a){if(o==="latest"){f.error(`@capacitor/core version is ${o}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`);return}if(o&&Cr(_e(o),_e("6.0.0"))){f.warn("Encryption is not supported in Capacitor V5.");return}let s=ye();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await by({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),f.warn("Cannot create key \u274C"),Z("Bye \u{1F44B}"),(0,Ce.exit)(1));try{await Gl(!0,t,e),cr("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await gr(t,e,"add-encryption",r)}async function V7(t,e,r){let n=tt(),o=await we({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Vt(o,t,e),o){let i=ye();i.start("Checking project type");let a=await Hl(),s=await $g(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),Fg()[s]||(i.stop("Error"),f.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,Ce.exit)()),(0,ba.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,Cy),i.stop("Build & Sync Done \u2705")}else f.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await gr(t,e,"build-project",r)}async function z7(t,e,r){let n=tt(),o=await we({message:`Run ${r} in device now to test the initial version?`});if(await Vt(o,t,e),o){let i=await br({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});be(i)&&(Z("Bye \u{1F44B}"),(0,Ce.exit)());let a=i,s=ye();s.start(`Running: ${n.runner} cap run ${a}`),await(0,ba.spawnSync)(n.runner,["cap","run",a],{stdio:"inherit"}),s.stop("App started \u2705"),f.info(`\u{1F4F1} Your app should now be running on your ${a} device with Capgo integrated`),f.info("\u{1F504} This is your baseline version - we'll create an update next")}else f.info(`If you change your mind, run it for yourself with: ${n.runner} cap run <ios|android>`);await gr(t,e,"run-device",r)}async function K7(t,e,r,n){f.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let o=await br({message:"How would you like to test the update?",options:[{value:"auto",label:"Auto: Let Capgo CLI make a visible change for you"},{value:"manual",label:"Manual: I'll make changes myself"}]});if(be(o)&&(await cr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),o==="auto"){let l=ye();l.start("Making automatic changes to test Capgo updates");let d=!1,p=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let h of p)if((0,Ie.existsSync)(h)&&!d)try{let m=(0,Ie.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
295
295
  <div id="capgo-test-banner" style="background: linear-gradient(90deg, #4CAF50, #2196F3); color: white; padding: 15px; text-align: center; font-weight: bold; position: fixed; top: env(safe-area-inset-top, 0); left: env(safe-area-inset-left, 0); right: env(safe-area-inset-right, 0); z-index: 9999; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding-top: calc(15px + env(safe-area-inset-top, 0));">
296
296
  \u{1F680} Capgo Update Test - This banner shows the update worked!
297
297
  </div>
@@ -306,106 +306,106 @@ body {
306
306
  /* capgo-test-background */
307
307
  }
308
308
 
309
- ${m}`)),b!==m){(0,Te.writeFileSync)(h,b,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),f.info("\u{1F4DD} Added visible test modification to verify the update works"),d=!0;break}}catch{}if(!d){l.stop("\u26A0\uFE0F Could not automatically modify files"),f.warn("Please make a visible change manually (like editing a text or color)");let h=await we({message:"Continue after making your changes?"});await Vt(h,t,e)}}else{f.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),f.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await we({message:"Have you made your changes and ready to continue?"});await Vt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=wr(xa(l,"patch"))}catch{i="1.0.1"}let a=await yr({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});be(a)&&(await ur("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=wr(xa(l,"patch")),f.info(`\u{1F522} Auto-bumped version from ${n} to ${s}`)}catch{s="1.0.1",f.warn(`Could not parse version ${n}, using fallback ${s}`)}else{let l=await Dr({message:`Current version is ${n}. Enter new version:`,validate:d=>{if(!d.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});be(l)&&(await ur("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)()),s=l}let u=et(),c=await we({message:`Build ${r} with changes before uploading? If you need to build yourself please do it now in other terminal, and then select no`});if(await Vt(c,t,e),c){let l=De();l.start("Checking project type");let d=await jl(),p=await Ag(d);l.message(`Running: ${u.pm} run ${p} && ${u.runner} cap sync`),_g()[p]||(l.stop("Error"),f.warn(`Cannot find ${p} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,Ee.exit)()),(0,Da.execSync)(`${u.pm} run ${p} && ${u.runner} cap sync`,DD),l.stop("\u2705 Build with changes completed"),f.info("\u{1F4E6} Your modifications have been built and synced")}else f.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await mr(t,e,"add-code-change",r),s}async function P7(t,e,r,n,o){let i=et(),a=await we({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Vt(a,t,e),a){let s=De(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=mA((0,Ee.cwd)());zn&&c&&(f.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),f.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Vn.join)(gt((0,Ee.cwd)()),"node_modules"),f.warn(`Guessed node modules path at: ${u}`),(0,Te.existsSync)(u)||(f.error("Node modules path does not exist, upload skipped"),Z("Bye \u{1F44B}"),(0,Ee.exit)(1))),(await sD(r,{channel:Ks,apikey:e,packageJson:c?zn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),f.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),f.warn("Upload failed \u274C"),Z("Bye \u{1F44B}"),(0,Ee.exit)())}else f.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await mr(t,e,"upload",r)}async function $7(t,e,r,n,o){f.info("\u{1F9EA} Time to test the Capgo update system!"),f.info("\u{1F4F1} Go to your device where the app is running"),o?(f.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),f.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(f.info("\u{1F4F1} With standard updates, you will need to:"),f.info(" 1. Background the app (swipe up/press home button) to start download"),f.info(" 2. Wait a few seconds for download to complete"),f.info(" 3. Background and foreground again to see the update")),f.info("\u{1F440} You should see your changes appear in the app!");let i=await we({message:"Monitor Capgo logs to verify the update worked?"});await Vt(i,t,e),i?(f.info(`\u{1F4CA} Watching logs from ${r}...`),f.info("\u{1F504} Please background and reopen your app now to trigger the update"),await am("onboarding-v2",e,r,e,t)):f.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await mr(t,e,"test-update",r)}async function RF(t,e,r){let n=et();ee("Capgo onboarding \u{1F6EB}"),await ge();let o=!r.supaAnon||!r.supaHost?await te():await Fs({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),i=await cr();e=ce(e,o?.config),r.apikey=t||ne(),e===void 0&&(e=await Dr({message:"Enter your appId:"}),be(e)&&(Gn("Operation cancelled."),(0,Ee.exit)(1)));let a=De();(!PF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await gD(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await ie(s,r.apikey,["upload","all","read","write"]);let u=await oa(s,["admin","super_admin"]),c=u.gid,l=await y7(c,r.apikey)??0,d=Ar(void 0,zn)||"1.0.0",p=!1,h=d;try{if(l<1&&await mr(c,r.apikey,"add-app",e),l<2&&(await w7(u,r.apikey,e,r),hr(2)),l<3&&(await v7(c,r.apikey,e),hr(3)),l<4){let m=await S7(c,r.apikey,e);d=m.pkgVersion,h=d,p=m.delta,hr(4)}l<5&&(await x7(c,r.apikey,e),hr(5)),l<6&&(await A7(c,r.apikey,e),hr(6)),l<7&&(await O7(c,r.apikey,e),hr(7)),l<8&&(await F7(c,r.apikey,e),hr(8)),l<9&&(h=await k7(c,r.apikey,e,d),hr(9)),l<10&&(await P7(c,r.apikey,e,h,p),hr(10)),l<11&&(await $7(c,r.apikey,e,i.hostWeb,p),hr(11)),await mr(c,r.apikey,"done",e),b7()}catch(m){console.error(m),f.error(`Error during onboarding.
309
+ ${m}`)),b!==m){(0,Ie.writeFileSync)(h,b,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),f.info("\u{1F4DD} Added visible test modification to verify the update works"),d=!0;break}}catch{}if(!d){l.stop("\u26A0\uFE0F Could not automatically modify files"),f.warn("Please make a visible change manually (like editing a text or color)");let h=await we({message:"Continue after making your changes?"});await Vt(h,t,e)}}else{f.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),f.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let l=await we({message:"Have you made your changes and ready to continue?"});await Vt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=vr(Oa(l,"patch"))}catch{i="1.0.1"}let a=await br({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${i})`},{value:"manual",label:"Manual: I'll provide the version number"}]});be(a)&&(await cr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=vr(Oa(l,"patch")),f.info(`\u{1F522} Auto-bumped version from ${n} to ${s}`)}catch{s="1.0.1",f.warn(`Could not parse version ${n}, using fallback ${s}`)}else{let l=await Dr({message:`Current version is ${n}. Enter new version:`,validate:d=>{if(!d.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});be(l)&&(await cr("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),s=l}let u=tt(),c=await we({message:`Build ${r} with changes before uploading? If you need to build yourself please do it now in other terminal, and then select no`});if(await Vt(c,t,e),c){let l=ye();l.start("Checking project type");let d=await Hl(),p=await $g(d);l.message(`Running: ${u.pm} run ${p} && ${u.runner} cap sync`),Fg()[p]||(l.stop("Error"),f.warn(`Cannot find ${p} script in package.json, please add it and run \`capgo init\` again`),Z("Bye \u{1F44B}"),(0,Ce.exit)()),(0,ba.execSync)(`${u.pm} run ${p} && ${u.runner} cap sync`,Cy),l.stop("\u2705 Build with changes completed"),f.info("\u{1F4E6} Your modifications have been built and synced")}else f.info(`Build yourself with command: ${u.pm} run build && ${u.runner} cap sync`);return await gr(t,e,"add-code-change",r),s}async function G7(t,e,r,n,o){let i=tt(),a=await we({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Vt(a,t,e),a){let s=ye(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=PA((0,Ce.cwd)());Vn&&c&&(f.warn("You are most likely using a monorepo, please provide the path to your package.json file AND node_modules path folder when uploading your bundle"),f.warn(`Example: ${i.runner} @capgo/cli@latest bundle upload --package-json ./packages/my-app/package.json --node-modules ./packages/my-app/node_modules ${o?"--delta-only":""}`),u=(0,Hn.join)(gt((0,Ce.cwd)()),"node_modules"),f.warn(`Guessed node modules path at: ${u}`),(0,Ie.existsSync)(u)||(f.error("Node modules path does not exist, upload skipped"),Z("Bye \u{1F44B}"),(0,Ce.exit)(1))),(await dy(r,{channel:Ws,apikey:e,packageJson:c?Vn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),f.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),f.warn("Upload failed \u274C"),Z("Bye \u{1F44B}"),(0,Ce.exit)())}else f.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await gr(t,e,"upload",r)}async function W7(t,e,r,n,o){f.info("\u{1F9EA} Time to test the Capgo update system!"),f.info("\u{1F4F1} Go to your device where the app is running"),o?(f.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),f.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(f.info("\u{1F4F1} With standard updates, you will need to:"),f.info(" 1. Background the app (swipe up/press home button) to start download"),f.info(" 2. Wait a few seconds for download to complete"),f.info(" 3. Background and foreground again to see the update")),f.info("\u{1F440} You should see your changes appear in the app!");let i=await we({message:"Monitor Capgo logs to verify the update worked?"});await Vt(i,t,e),i?(f.info(`\u{1F4CA} Watching logs from ${r}...`),f.info("\u{1F504} Please background and reopen your app now to trigger the update"),await lm("onboarding-v2",e,r,e,t)):f.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await gr(t,e,"test-update",r)}async function XF(t,e,r){let n=tt();ee("Capgo onboarding \u{1F6EB}"),await ge();let o=!r.supaAnon||!r.supaHost?await te():await Ps({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),i=await lr();e=le(e,o?.config),r.apikey=t||ne(),e===void 0&&(e=await Dr({message:"Enter your appId:"}),be(e)&&(Kn("Operation cancelled."),(0,Ce.exit)(1)));let a=ye();(!GF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await vy(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await ie(s,r.apikey,["upload","all","read","write"]);let u=await aa(s,["admin","super_admin"]),c=u.gid,l=await T7(c,r.apikey)??0,d=Or(void 0,Vn)||"1.0.0",p=!1,h=d;try{if(l<1&&await gr(c,r.apikey,"add-app",e),l<2&&(await B7(u,r.apikey,e,r),mr(2)),l<3&&(await N7(c,r.apikey,e),mr(3)),l<4){let m=await M7(c,r.apikey,e);d=m.pkgVersion,h=d,p=m.delta,mr(4)}l<5&&(await q7(c,r.apikey,e),mr(5)),l<6&&(await H7(c,r.apikey,e),mr(6)),l<7&&(await V7(c,r.apikey,e),mr(7)),l<8&&(await z7(c,r.apikey,e),mr(8)),l<9&&(h=await K7(c,r.apikey,e,d),mr(9)),l<10&&(await G7(c,r.apikey,e,h,p),mr(10)),l<11&&(await W7(c,r.apikey,e,i.hostWeb,p),mr(11)),await gr(c,r.apikey,"done",e),R7()}catch(m){console.error(m),f.error(`Error during onboarding.
310
310
  if the error persists please contact support@capgo.app
311
- Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,Ee.exit)(1)}f.info("Welcome onboard \u2708\uFE0F!"),f.info("Your Capgo update system is setup"),f.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),f.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),Z("Bye \u{1F44B}"),(0,Ee.exit)()}async function T7(t,e=!1){e||ee("Adding organization"),await ge();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await ie(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await Dr({message:"Organization name:",placeholder:"My Organization"});if(be(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await Dr({message:"Management email:",placeholder:"admin@example.com"});if(be(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||f.info(`Adding organization "${i}" to Capgo`);let{data:s,error:u}=await n.from("orgs").insert({name:i,management_email:a,created_by:o}).select().single();if(u)throw e||f.error(`Could not add organization ${U(u)}`),new Error(`Could not add organization: ${U(u)}`);return await fe(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(f.success(`Organization "${i}" added to Capgo`),Z("Done \u2705")),s}async function yD(t){await T7(t,!1)}async function I7(t,e,r=!1){r||ee("Deleting organization"),await ge();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon),i=await ie(o,n.apikey,["write","all"]),{data:a,error:s}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(s||!a)throw r||f.error(`Cannot get organization details ${U(s)}`),new Error(`Cannot get organization details: ${U(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");f.warn("Deleting an organization is restricted to the organization owner"),f.warn("You are not the owner of this organization"),f.warn("It's strongly recommended that you do not continue!");let c=await yr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(c)||c==="no")throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await we({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(be(c)||!c)throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||f.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||f.error(`Could not delete organization ${U(u)}`),new Error(`Could not delete organization: ${U(u)}`);return await fe(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(f.success(`Organization "${a.name}" deleted from Capgo`),Z("Done \u2705")),!0}async function bD(t,e){await I7(t,e,!1)}function R7(t,e){if(e)return;if(!t.length){f.error("No organizations found");return}let r=new at;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);f.success("Organizations"),f.success(r.toString())}async function B7(t,e=!1){e||ee("List organizations"),await ge();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon);await ie(n,r.apikey,["read","write","all"]),e||f.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||f.error(`Cannot get organizations ${U(o)}`),new Error(`Cannot get organizations: ${U(o)}`);let a=i||[];return e||(f.info(`Organizations found: ${a.length}`),R7(a,e),Z("Done \u2705")),a}async function wD(t){await B7(t,!1)}async function N7(t,e,r=!1){r||ee("Updating organization"),await ge();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon);await ie(o,n.apikey,["write","all"]);let{data:i,error:a}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(a||!i)throw r||f.error(`Cannot get organization details ${U(a)}`),new Error(`Cannot get organization details: ${U(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await Dr({message:"New organization name:",placeholder:i.name||"My Organization"});if(be(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await Dr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(be(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!s||!u)throw r||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||f.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||f.error(`Could not update organization ${U(c)}`),new Error(`Could not update organization: ${U(c)}`);return await fe(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(f.success("Organization updated"),Z("Done \u2705")),{orgId:t,name:s,email:u}}async function vD(t,e){await N7(t,e,!1)}async function L7(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await ie(n,r.apikey,["read","all","write"]);return e||Z(`Done \u2705: ${o}`),o}catch(n){throw e||f.error(`Error getting user id ${U(n)}`),n instanceof Error?n:new Error(String(n))}}async function BF(t){await L7(t,!1)}var K={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};ot.name(gr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(gr.version,"-v, --version","output the current version");ot.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
311
+ Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,Ce.exit)(1)}f.info("Welcome onboard \u2708\uFE0F!"),f.info("Your Capgo update system is setup"),f.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),f.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),Z("Bye \u{1F44B}"),(0,Ce.exit)()}async function Y7(t,e=!1){e||ee("Adding organization"),await ge();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await ie(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await Dr({message:"Organization name:",placeholder:"My Organization"});if(be(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await Dr({message:"Management email:",placeholder:"admin@example.com"});if(be(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||f.info(`Adding organization "${i}" to Capgo`);let{data:s,error:u}=await n.from("orgs").insert({name:i,management_email:a,created_by:o}).select().single();if(u)throw e||f.error(`Could not add organization ${U(u)}`),new Error(`Could not add organization: ${U(u)}`);return await de(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(f.success(`Organization "${i}" added to Capgo`),Z("Done \u2705")),s}async function Ey(t){await Y7(t,!1)}async function J7(t,e,r=!1){r||ee("Deleting organization"),await ge();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon),i=await ie(o,n.apikey,["write","all"]),{data:a,error:s}=await o.from("orgs").select("created_by, name").eq("id",t).single();if(s||!a)throw r||f.error(`Cannot get organization details ${U(s)}`),new Error(`Cannot get organization details: ${U(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");f.warn("Deleting an organization is restricted to the organization owner"),f.warn("You are not the owner of this organization"),f.warn("It's strongly recommended that you do not continue!");let c=await br({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(be(c)||c==="no")throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await we({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(be(c)||!c)throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||f.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||f.error(`Could not delete organization ${U(u)}`),new Error(`Could not delete organization: ${U(u)}`);return await de(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(f.success(`Organization "${a.name}" deleted from Capgo`),Z("Done \u2705")),!0}async function _y(t,e){await J7(t,e,!1)}function X7(t,e){if(e)return;if(!t.length){f.error("No organizations found");return}let r=new at;r.headers=["Name","ID","Role","Apps"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name??"Unknown",n.gid,n.role,n.app_count?.toString()||"0"]);f.success("Organizations"),f.success(r.toString())}async function Z7(t,e=!1){e||ee("List organizations"),await ge();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await re(r.apikey,r.supaHost,r.supaAnon);await ie(n,r.apikey,["read","write","all"]),e||f.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||f.error(`Cannot get organizations ${U(o)}`),new Error(`Cannot get organizations: ${U(o)}`);let a=i||[];return e||(f.info(`Organizations found: ${a.length}`),X7(a,e),Z("Done \u2705")),a}async function Sy(t){await Z7(t,!1)}async function Q7(t,e,r=!1){r||ee("Updating organization"),await ge();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await re(n.apikey,n.supaHost,n.supaAnon);await ie(o,n.apikey,["write","all"]);let{data:i,error:a}=await o.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(a||!i)throw r||f.error(`Cannot get organization details ${U(a)}`),new Error(`Cannot get organization details: ${U(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await Dr({message:"New organization name:",placeholder:i.name||"My Organization"});if(be(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await Dr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(be(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!s||!u)throw r||f.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||f.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||f.error(`Could not update organization ${U(c)}`),new Error(`Could not update organization: ${U(c)}`);return await de(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(f.success("Organization updated"),Z("Done \u2705")),{orgId:t,name:s,email:u}}async function xy(t,e){await Q7(t,e,!1)}async function eq(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||f.error("Missing API key, you need to provide an API key to fetch the user id"),new Error("Missing API key");try{let n=await re(r.apikey,r.supaHost,r.supaAnon),o=await ie(n,r.apikey,["read","all","write"]);return e||Z(`Done \u2705: ${o}`),o}catch(n){throw e||f.error(`Error getting user id ${U(n)}`),n instanceof Error?n:new Error(String(n))}}async function ZF(t){await eq(t,!1)}var K={apikey:"API key to link to your account",supaHost:"Custom Supabase host URL (for self-hosting or Capgo development)",supaAnon:"Custom Supabase anon key (for self-hosting)",packageJson:"Paths to package.json files for monorepos (comma-separated)",nodeModules:"Paths to node_modules directories for monorepos (comma-separated)",verbose:"Enable verbose output"};ot.name(yr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(yr.version,"-v, --version","output the current version");ot.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
312
312
 
313
313
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
314
314
 
315
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(RF).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ot.command("doctor").description(`\u{1F468}\u200D\u2695\uFE0F Check if your Capgo app installation is up-to-date and gather information useful for bug reports.
315
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(XF).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ot.command("doctor").description(`\u{1F468}\u200D\u2695\uFE0F Check if your Capgo app installation is up-to-date and gather information useful for bug reports.
316
316
 
317
317
  This command helps diagnose issues with your setup.
318
318
 
319
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await MA(e)});ot.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
319
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await n1(e)});ot.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
320
320
 
321
321
  Use --apikey=******** in any command to override it.
322
322
 
323
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action($F).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Kn=ot.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Kn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
323
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(WF).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var zn=ot.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");zn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
324
324
 
325
325
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
326
326
 
327
327
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
328
328
  Capgo never inspects external content. Add encryption for trustless security.
329
329
 
330
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(ZO).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);Kn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
330
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(hF).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the IV and session key for bundle URL external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <s3Endpoint>","URL of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key-v2 <key>","Custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","Private signing key (v2 system)").option("--bundle-url","Prints bundle URL into stdout").option("--no-key","Ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--display-iv-session","Show in the console the IV and session key used to encrypt the update").option("-b, --bundle <bundle>","Bundle version number of the bundle to upload").option("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);zn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
331
331
 
332
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(g1).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Kn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
332
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action($1).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
333
333
 
334
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await C1(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Kn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
334
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await j1(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
335
335
 
336
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await S1(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Kn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
336
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await M1(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
337
337
 
338
338
  Bundles linked to channels are preserved unless --ignore-channel is used.
339
339
 
340
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await m1(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Kn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
340
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await P1(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
341
341
 
342
342
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
343
343
 
344
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(_1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Kn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
344
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(U1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");zn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
345
345
 
346
346
  Prints base64 session key for verification.
347
347
 
348
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(E1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("--checksum <checksum>","Checksum of the bundle, to verify the integrity of the bundle");Kn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
348
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(L1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("--checksum <checksum>","Checksum of the bundle, to verify the integrity of the bundle");zn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
349
349
 
350
350
  Returns checksum for use with encryption. Use --json for machine-readable output.
351
351
 
352
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(tF).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",K.packageJson);var ya=ot.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");ya.command("add [appId]").alias("a").description(`\u2795 Add a new app to Capgo Cloud with a unique app ID in the format com.test.app.
352
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(yF).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-b, --bundle <bundle>","Bundle version number to name the zip file").option("-n, --name <name>","Name of the zip file").option("-j, --json","Output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in source code and index present in root folder").option("--key-v2","Use encryption v2").option("--package-json <packageJson>",K.packageJson);var wa=ot.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");wa.command("add [appId]").alias("a").description(`\u2795 Add a new app to Capgo Cloud with a unique app ID in the format com.test.app.
353
353
 
354
354
  All options can be guessed from config if not provided.
355
355
 
356
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(NA).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ya.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
356
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(QA).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
357
357
 
358
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await LA(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ya.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
358
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await e1(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
359
359
 
360
- Example: npx @capgo/cli@latest app list`).action(async t=>{await qA(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ya.command("debug [appId]").action(XE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
360
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await o1(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("debug [appId]").action(rE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
361
361
 
362
362
  Optionally target a specific device for detailed diagnostics.
363
363
 
364
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",K.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);ya.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
364
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",K.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
365
365
 
366
366
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
367
367
 
368
- Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(zA);ya.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
368
+ Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(s1);wa.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
369
369
 
370
370
  Retention of 0 means infinite storage.
371
371
 
372
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await VA(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Ws=ot.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Ws.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
372
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await a1(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Js=ot.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Js.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
373
373
 
374
- Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(rF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ws.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
374
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(DF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Js.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
375
375
 
376
- Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await oF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ws.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
376
+ Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await wF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--delete-bundle","Delete the bundle associated with the channel").option("--success-if-not-found","Success if the channel is not found").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Js.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
377
377
 
378
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await iF(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ws.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
378
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await vF(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Js.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
379
379
 
380
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await nF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",K.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ws.command("set [channelId] [appId]").alias("s").description(`\u2699\uFE0F Configure settings for a channel, such as linking a bundle, setting update strategies (major, minor, metadata, patch, none), or device targeting (iOS, Android, dev, emulator).
380
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await bF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",K.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Js.command("set [channelId] [appId]").alias("s").description(`\u2699\uFE0F Configure settings for a channel, such as linking a bundle, setting update strategies (major, minor, metadata, patch, none), or device targeting (iOS, Android, dev, emulator).
381
381
 
382
382
  One channel must be default.
383
383
 
384
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await sF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",K.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var ED=ot.command("key").description("\u{1F510} Manage encryption keys for secure bundle distribution in Capgo Cloud, supporting end-to-end encryption with RSA and AES combination.");ED.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
384
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await EF(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("-b, --bundle <bundle>","Bundle version number of the file to set").option("-s, --state <state>","Set the state of the channel, default or normal").option("--latest-remote","Get the latest bundle uploaded in capgo cloud and set it to the channel").option("--latest","Get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--ios","Allow sending update to iOS devices").option("--no-ios","Disable sending update to iOS devices").option("--android","Allow sending update to Android devices").option("--no-android","Disable sending update to Android devices").option("--self-assign","Allow device to self-assign to this channel").option("--no-self-assign","Disable devices to self-assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Block updates by type: major, minor, metadata, patch, or none (allows all)").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>",K.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Ay=ot.command("key").description("\u{1F510} Manage encryption keys for secure bundle distribution in Capgo Cloud, supporting end-to-end encryption with RSA and AES combination.");Ay.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
385
385
 
386
386
  Recommended not to commit the key for security.
387
387
 
388
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(OF).option("-f, --force","Force generate a new one").option("--key <key>","Key path to save in Capacitor config").option("--key-data <keyData>","Key data to save in Capacitor config");ED.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
388
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(VF).option("-f, --force","Force generate a new one").option("--key <key>","Key path to save in Capacitor config").option("--key-data <keyData>","Key data to save in Capacitor config");Ay.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
389
389
 
390
390
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
391
391
  Public key is saved to capacitor.config for mobile app decryption.
392
392
  NEVER commit the private key - store it securely!
393
393
 
394
- Example: npx @capgo/cli@latest key create`).action(FF).option("-f, --force","Force generate a new one");ED.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
394
+ Example: npx @capgo/cli@latest key create`).action(zF).option("-f, --force","Force generate a new one");Ay.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
395
395
 
396
- Example: npx @capgo/cli@latest key delete_old`).action(kF);var j7=ot.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");j7.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
396
+ Example: npx @capgo/cli@latest key delete_old`).action(KF);var tq=ot.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");tq.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
397
397
 
398
- Example: npx @capgo/cli@latest account id`).action(BF).option("-a, --apikey <apikey>",K.apikey);var Ef=ot.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");Ef.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
398
+ Example: npx @capgo/cli@latest account id`).action(ZF).option("-a, --apikey <apikey>",K.apikey);var xf=ot.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");xf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
399
399
 
400
- Example: npx @capgo/cli@latest organisation list`).action(wD).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ef.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
400
+ Example: npx @capgo/cli@latest organisation list`).action(Sy).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);xf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
401
401
 
402
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(yD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ef.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
402
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Ey).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);xf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
403
403
 
404
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(vD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Ef.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
404
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(xy).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);xf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
405
405
 
406
406
  Only organization owners can delete organizations.
407
407
 
408
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(bD).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var NF=ot.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
408
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(_y).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var QF=ot.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
409
409
 
410
410
  \u26A0\uFE0F This feature is currently in PUBLIC BETA and cannot be used by anyone at this time.
411
411
 
@@ -417,7 +417,7 @@ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(bD).option("-
417
417
  \u{1F4CB} BEFORE BUILDING:
418
418
  Save your credentials first:
419
419
  npx @capgo/cli build credentials save --appId <your-app-id> --platform ios
420
- npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);NF.command("request [appId]").description(`Request a native build from Capgo Cloud.
420
+ npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);QF.command("request [appId]").description(`Request a native build from Capgo Cloud.
421
421
 
422
422
  This command will zip your project directory and upload it to Capgo for building.
423
423
  The build will be processed and sent directly to app stores.
@@ -428,13 +428,13 @@ The build will be processed and sent directly to app stores.
428
428
  \u{1F4CB} PREREQUISITE: Save credentials first with:
429
429
  npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>
430
430
 
431
- Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(i1).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var CD=NF.command("credentials").description(`Manage build credentials stored locally on your machine.
431
+ Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(v1).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Oy=QF.command("credentials").description(`Manage build credentials stored locally on your machine.
432
432
 
433
433
  \u{1F512} SECURITY:
434
434
  - Credentials saved to ~/.capgo-credentials/credentials.json (local machine only)
435
435
  - When building, sent to Capgo but NEVER stored permanently
436
436
  - Auto-deleted from Capgo after build (max 24 hours)
437
- - Builds sent directly to app stores - Capgo keeps nothing`);CD.command("save").description(`Save build credentials locally for iOS or Android.
437
+ - Builds sent directly to app stores - Capgo keeps nothing`);Oy.command("save").description(`Save build credentials locally for iOS or Android.
438
438
 
439
439
  Credentials are stored in ~/.capgo-credentials/credentials.json per app ID and automatically used when building.
440
440
 
@@ -465,13 +465,13 @@ Android Example:
465
465
  --keystore-alias "my-key" \\
466
466
  --keystore-key-password "key-pass" \\
467
467
  --keystore-store-password "store-pass" \\
468
- --play-config ./service-account.json`).action(QA).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON");CD.command("list").description(`List saved build credentials (passwords masked).
468
+ --play-config ./service-account.json`).action(m1).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON");Oy.command("list").description(`List saved build credentials (passwords masked).
469
469
 
470
470
  Shows what credentials are currently saved in ~/.capgo-credentials/credentials.json
471
471
 
472
472
  Examples:
473
473
  npx @capgo/cli build credentials list # List all apps
474
- npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(e1).option("--appId <appId>","App ID to list (optional, lists all if omitted)");CD.command("clear").description(`Clear saved build credentials.
474
+ npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(g1).option("--appId <appId>","App ID to list (optional, lists all if omitted)");Oy.command("clear").description(`Clear saved build credentials.
475
475
 
476
476
  Remove credentials from ~/.capgo-credentials/credentials.json
477
477
  Use --appId and --platform to target specific credentials.
@@ -479,7 +479,7 @@ Use --appId and --platform to target specific credentials.
479
479
  Examples:
480
480
  npx @capgo/cli build credentials clear # Clear all apps
481
481
  npx @capgo/cli build credentials clear --appId com.example.app # Clear specific app
482
- npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(t1).option("--appId <appId>","App ID to clear (optional, clears all apps if omitted)").option("--platform <platform>","Platform to clear: ios or android (optional, clears all platforms if omitted)");ot.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{uF(t,e.folder)});ot.exitOverride();ot.configureOutput({writeErr:t=>{}});ot.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,vf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,vf.exit)(r)}console.error(`Error: ${U(t)}`),(0,vf.exit)(1)});
482
+ npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(y1).option("--appId <appId>","App ID to clear (optional, clears all apps if omitted)").option("--platform <platform>","Platform to clear: ios or android (optional, clears all platforms if omitted)");ot.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{_F(t,e.folder)});ot.exitOverride();ot.configureOutput({writeErr:t=>{}});ot.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Sf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Sf.exit)(r)}console.error(`Error: ${U(t)}`),(0,Sf.exit)(1)});
483
483
  /*! Bundled license information:
484
484
 
485
485
  tus-js-client/lib.es5/upload.js: