@capgo/cli 7.29.1 → 7.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,80 +1,80 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var AF=Object.create;var zs=Object.defineProperty;var FF=Object.getOwnPropertyDescriptor;var OF=Object.getOwnPropertyNames;var kF=Object.getPrototypeOf,PF=Object.prototype.hasOwnProperty;var tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Hr=(t,e)=>{for(var r in e)zs(t,r,{get:e[r],enumerable:!0})},DD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of OF(e))!PF.call(t,o)&&o!==r&&zs(t,o,{get:()=>e[o],enumerable:!(n=FF(e,o))||n.enumerable});return t};var le=(t,e,r)=>(r=t!=null?AF(kF(t)):{},DD(e||!t||!t.__esModule?zs(r,"default",{value:t,enumerable:!0}):r,t)),ne=t=>DD(zs({},"__esModule",{value:!0}),t);var Da=x(Df=>{var Gs=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}},gf=class extends Gs{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Df.CommanderError=Gs;Df.InvalidArgumentError=gf});var Ks=x(bf=>{var{InvalidArgumentError:$F}=Da(),yf=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 $F(`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 TF(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}bf.Argument=yf;bf.humanReadableArgName=TF});var Cf=x(vf=>{var{humanReadableArgName:IF}=Ks(),wf=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=>IF(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(p,d){return r.formatItem(p,n,d,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(p=>i(r.styleArgumentTerm(r.argumentTerm(p)),r.styleArgumentDescription(r.argumentDescription(p))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),p=>p.helpGroupHeading??"Options:").forEach((p,d)=>{let h=p.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),r.showGlobalOptions){let p=r.visibleGlobalOptions(e).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",p,r))}return this.groupItems(e.commands,r.visibleCommands(e),p=>p.helpGroup()||"Commands:").forEach((p,d)=>{let h=p.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),a.join(`
3
- `)}displayWidth(e){return yD(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,p;return l<this.minWidthToWrap||o.preformatted(n)?p=n:p=o.boxWrap(n,l).replace(/\n/g,`
2
+ "use strict";var F2=Object.create;var Ks=Object.defineProperty;var O2=Object.getOwnPropertyDescriptor;var k2=Object.getOwnPropertyNames;var P2=Object.getPrototypeOf,$2=Object.prototype.hasOwnProperty;var rt=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Vr=(t,e)=>{for(var r in e)Ks(t,r,{get:e[r],enumerable:!0})},yD=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k2(e))!$2.call(t,o)&&o!==r&&Ks(t,o,{get:()=>e[o],enumerable:!(n=O2(e,o))||n.enumerable});return t};var fe=(t,e,r)=>(r=t!=null?F2(P2(t)):{},yD(e||!t||!t.__esModule?Ks(r,"default",{value:t,enumerable:!0}):r,t)),ne=t=>yD(Ks({},"__esModule",{value:!0}),t);var ya=x(yf=>{var Gs=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}},Df=class extends Gs{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};yf.CommanderError=Gs;yf.InvalidArgumentError=Df});var Ws=x(wf=>{var{InvalidArgumentError:I2}=ya(),bf=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 T2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}wf.Argument=bf;wf.humanReadableArgName=T2});var Ef=x(Cf=>{var{humanReadableArgName:R2}=Ws(),vf=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=>R2(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(p,d){return r.formatItem(p,n,d,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(p=>i(r.styleArgumentTerm(r.argumentTerm(p)),r.styleArgumentDescription(r.argumentDescription(p))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),p=>p.helpGroupHeading??"Options:").forEach((p,d)=>{let h=p.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),r.showGlobalOptions){let p=r.visibleGlobalOptions(e).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));a=a.concat(this.formatItemList("Global Options:",p,r))}return this.groupItems(e.commands,r.visibleCommands(e),p=>p.helpGroup()||"Commands:").forEach((p,d)=>{let h=p.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(d,h,r))}),a.join(`
3
+ `)}displayWidth(e){return bD(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,p;return l<this.minWidthToWrap||o.preformatted(n)?p=n:p=o.boxWrap(n,l).replace(/\n/g,`
4
4
  `+" ".repeat(r+u)),a+s+" ".repeat(u)+p.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 p=this.displayWidth(l);if(c+p<=r){u.push(l),c+=p;return}i.push(u.join(""));let d=l.trimStart();u=[d],c=this.displayWidth(d)}),i.push(u.join(""))}),i.join(`
6
- `)}};function yD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}vf.Help=wf;vf.stripColor=yD});var Sf=x(xf=>{var{InvalidArgumentError:RF}=Da(),Ef=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=BF(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 RF(`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?bD(this.name().replace(/^no-/,"")):bD(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 bD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function BF(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 bD(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Cf.Help=vf;Cf.stripColor=bD});var Af=x(xf=>{var{InvalidArgumentError:B2}=ya(),_f=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=L2(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 B2(`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?wD(this.name().replace(/^no-/,"")):wD(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}},Sf=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 wD(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function L2(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}}xf.Option=Ef;xf.DualOptions=_f});var vD=x(wD=>{function jF(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 NF(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=jF(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}}xf.Option=_f;xf.DualOptions=Sf});var CD=x(vD=>{function N2(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 j2(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=N2(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]}?)`:""}wD.suggestSimilar=NF});var xD=x(Pf=>{var LF=require("node:events").EventEmitter,Af=require("node:child_process"),Vr=require("node:path"),Ws=require("node:fs"),we=require("node:process"),{Argument:UF,humanReadableArgName:MF}=Ks(),{CommanderError:Ff}=Da(),{Help:qF,stripColor:HF}=Cf(),{Option:CD,DualOptions:VF}=Sf(),{suggestSimilar:ED}=vD(),Of=class t extends LF{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=>we.stdout.write(r),writeErr:r=>we.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>we.stdout.isTTY?we.stdout.columns:void 0,getErrHelpWidth:()=>we.stderr.isTTY?we.stderr.columns:void 0,getOutHasColors:()=>kf()??(we.stdout.isTTY&&we.stdout.hasColors?.()),getErrHasColors:()=>kf()??(we.stderr.isTTY&&we.stderr.hasColors?.()),stripColor:r=>HF(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 UF(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 Ff(e,r,n)),we.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 CD(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 CD)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){we.versions?.electron&&(r.from="electron");let o=we.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=we.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":we.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(Ws.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]}?)`:""}vD.suggestSimilar=j2});var xD=x($f=>{var U2=require("node:events").EventEmitter,Ff=require("node:child_process"),zr=require("node:path"),Ys=require("node:fs"),we=require("node:process"),{Argument:M2,humanReadableArgName:q2}=Ws(),{CommanderError:Of}=ya(),{Help:H2,stripColor:V2}=Ef(),{Option:ED,DualOptions:z2}=Af(),{suggestSimilar:_D}=CD(),kf=class t extends U2{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=>we.stdout.write(r),writeErr:r=>we.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>we.stdout.isTTY?we.stdout.columns:void 0,getErrHelpWidth:()=>we.stderr.isTTY?we.stderr.columns:void 0,getOutHasColors:()=>Pf()??(we.stdout.isTTY&&we.stdout.hasColors?.()),getErrHasColors:()=>Pf()??(we.stderr.isTTY&&we.stderr.hasColors?.()),stripColor:r=>V2(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 H2,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 M2(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 Of(e,r,n)),we.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 ED(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 ED)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){we.versions?.electron&&(r.from="electron");let o=we.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=we.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":we.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(Ys.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,p){let d=Vr.resolve(l,p);if(Ws.existsSync(d))return d;if(o.includes(Vr.extname(p)))return;let h=o.find(m=>Ws.existsSync(`${d}${m}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Ws.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=Vr.resolve(Vr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let p=Vr.basename(this._scriptPath,Vr.extname(this._scriptPath));p!==this._name&&(l=i(s,`${p}-${e._name}`))}a=l||a}n=o.includes(Vr.extname(a));let u;we.platform!=="win32"?n?(r.unshift(a),r=_D(we.execArgv).concat(r),u=Af.spawn(we.argv[0],r,{stdio:"inherit"})):u=Af.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=_D(we.execArgv).concat(r),u=Af.spawn(we.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{we.on(p,()=>{u.killed===!1&&u.exitCode===null&&u.kill(p)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Ff(l,"commander.executeSubCommandAsync","(close)")):we.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)we.exit(1);else{let p=new Ff(1,"commander.executeSubCommandAsync","(error)");p.nestedError=l,c(p)}}),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(p=>p.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!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 p=this._findOption(l);if(p){if(p.required){let d=e[c++];d===void 0&&this.optionMissingArgument(p),this.emit(`option:${p.name()}`,d)}else if(p.optional){let d=null;c<e.length&&(!i(e[c])||a(e[c]))&&(d=e[c++]),this.emit(`option:${p.name()}`,d)}else this.emit(`option:${p.name()}`);s=p.variadic?p:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let p=this._findOption(`-${l[1]}`);if(p){p.required||p.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${p.name()}`,l.slice(2)):(this.emit(`option:${p.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let p=l.indexOf("="),d=this._findOption(l.slice(0,p));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(p+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,p){let d=zr.resolve(l,p);if(Ys.existsSync(d))return d;if(o.includes(zr.extname(p)))return;let h=o.find(m=>Ys.existsSync(`${d}${m}`));if(h)return`${d}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let l;try{l=Ys.realpathSync(this._scriptPath)}catch{l=this._scriptPath}s=zr.resolve(zr.dirname(l),s)}if(s){let l=i(s,a);if(!l&&!e._executableFile&&this._scriptPath){let p=zr.basename(this._scriptPath,zr.extname(this._scriptPath));p!==this._name&&(l=i(s,`${p}-${e._name}`))}a=l||a}n=o.includes(zr.extname(a));let u;we.platform!=="win32"?n?(r.unshift(a),r=SD(we.execArgv).concat(r),u=Ff.spawn(we.argv[0],r,{stdio:"inherit"})):u=Ff.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=SD(we.execArgv).concat(r),u=Ff.spawn(we.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{we.on(p,()=>{u.killed===!1&&u.exitCode===null&&u.kill(p)})});let c=this._exitCallback;u.on("close",l=>{l=l??1,c?c(new Of(l,"commander.executeSubCommandAsync","(close)")):we.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)we.exit(1);else{let p=new Of(1,"commander.executeSubCommandAsync","(error)");p.nestedError=l,c(p)}}),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(p=>p.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!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 p=this._findOption(l);if(p){if(p.required){let d=e[c++];d===void 0&&this.optionMissingArgument(p),this.emit(`option:${p.name()}`,d)}else if(p.optional){let d=null;c<e.length&&(!i(e[c])||a(e[c]))&&(d=e[c++]),this.emit(`option:${p.name()}`,d)}else this.emit(`option:${p.name()}`);s=p.variadic?p:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let p=this._findOption(`-${l[1]}`);if(p){p.required||p.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${p.name()}`,l.slice(2)):(this.emit(`option:${p.name()}`),u=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let p=l.indexOf("="),d=this._findOption(l.slice(0,p));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(p+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 we.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()}`,we.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new VF(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(p=>p.negate&&s===p.attributeName()),l=this.options.find(p=>!p.negate&&s===p.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=ED(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=ED(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=>MF(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=Vr.basename(e,Vr.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(we.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 we.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()}`,we.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new z2(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(p=>p.negate&&s===p.attributeName()),l=this.options.find(p=>!p.negate&&s===p.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=_D(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=_D(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=>q2(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=zr.basename(e,zr.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(we.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 _D(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 kf(){if(we.env.NO_COLOR||we.env.FORCE_COLOR==="0"||we.env.FORCE_COLOR==="false")return!1;if(we.env.FORCE_COLOR||we.env.CLICOLOR_FORCE!==void 0)return!0}Pf.Command=Of;Pf.useColor=kf});var OD=x(Xt=>{var{Argument:SD}=Ks(),{Command:$f}=xD(),{CommanderError:zF,InvalidArgumentError:AD}=Da(),{Help:GF}=Cf(),{Option:FD}=Sf();Xt.program=new $f;Xt.createCommand=t=>new $f(t);Xt.createOption=(t,e)=>new FD(t,e);Xt.createArgument=(t,e)=>new SD(t,e);Xt.Command=$f;Xt.Option=FD;Xt.Argument=SD;Xt.Help=GF;Xt.CommanderError=zF;Xt.InvalidArgumentError=AD;Xt.InvalidOptionArgumentError=AD});var If=x((W7,PD)=>{"use strict";var Tf={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"},WF={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},YF={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?Tf.up():"");return t&&(e+=Tf.left),e}};PD.exports={cursor:Tf,scroll:WF,erase:YF,beep:"\x07"}});var Bf=x((Y7,Rf)=>{var Js=process||{},$D=Js.argv||[],Ys=Js.env||{},JF=!(Ys.NO_COLOR||$D.includes("--no-color"))&&(!!Ys.FORCE_COLOR||$D.includes("--color")||Js.platform==="win32"||(Js.stdout||{}).isTTY&&Ys.TERM!=="dumb"||!!Ys.CI),XF=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+ZF(o,e,r,i)+e:t+o+e},ZF=(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)},TD=(t=JF)=>{let e=t?XF:()=>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")}};Rf.exports=TD();Rf.exports.createColors=TD});var iu=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isNXMonorepo=Tt.isMonorepo=Tt.findPackageRelativePathInMonorepo=Tt.findPackagePath=Tt.findNXMonorepoRoot=Tt.findMonorepoRoot=void 0;var wa=require("node:fs"),dn=require("node:path");function ou(t){let e=(0,dn.join)(t,"package.json"),r=(0,dn.join)(t,"pnpm-workspace.yaml");if((0,wa.existsSync)(r)||(0,wa.existsSync)(e)&&JSON.parse((0,wa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,dn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return ou(n)}Tt.findMonorepoRoot=ou;function Yf(t){let e=(0,dn.join)(t,"nx.json");if((0,wa.existsSync)(e))return t;let r=(0,dn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Yf(r)}Tt.findNXMonorepoRoot=Yf;function Jf(t,e,r){let n=(0,dn.join)(e,"node_modules",t);if((0,wa.existsSync)(n))return n;if(e===r)return null;let o=(0,dn.dirname)(e);return Jf(t,o,r)}Tt.findPackagePath=Jf;function kO(t,e){let r=ou(e),n=Jf(t,e,r);return n?(0,dn.relative)(e,n):null}Tt.findPackageRelativePathInMonorepo=kO;function PO(t){try{return ou(t),!0}catch{return!1}}Tt.isMonorepo=PO;function $O(t){try{return Yf(t),!0}catch{return!1}}Tt.isNXMonorepo=$O});var fe={};Hr(fe,{__addDisposableResource:()=>Ry,__assign:()=>pu,__asyncDelegator:()=>Ay,__asyncGenerator:()=>Sy,__asyncValues:()=>Fy,__await:()=>Go,__awaiter:()=>wy,__classPrivateFieldGet:()=>$y,__classPrivateFieldIn:()=>Iy,__classPrivateFieldSet:()=>Ty,__createBinding:()=>hu,__decorate:()=>dy,__disposeResources:()=>By,__esDecorate:()=>my,__exportStar:()=>Cy,__extends:()=>fy,__generator:()=>vy,__importDefault:()=>Py,__importStar:()=>ky,__makeTemplateObject:()=>Oy,__metadata:()=>by,__param:()=>hy,__propKey:()=>Dy,__read:()=>ip,__rest:()=>py,__rewriteRelativeImportExtension:()=>jy,__runInitializers:()=>gy,__setFunctionName:()=>yy,__spread:()=>Ey,__spreadArray:()=>xy,__spreadArrays:()=>_y,__values:()=>du,default:()=>rk});function fy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");np(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function py(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 dy(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 hy(t,e){return function(r,n){e(r,n,t)}}function my(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):{}),p,d=!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(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||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");(p=a(D.get))&&(l.get=p),(p=a(D.set))&&(l.set=p),(p=a(D.init))&&o.unshift(p)}else(p=a(D))&&(s==="field"?o.unshift(p):l[u]=p)}c&&Object.defineProperty(c,n.name,l),d=!0}function gy(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 Dy(t){return typeof t=="symbol"?t:"".concat(t)}function yy(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 by(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function wy(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(p){a(p)}}function u(l){try{c(n.throw(l))}catch(p){a(p)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function vy(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 Cy(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&hu(e,t,r)}function du(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 ip(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 Ey(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ip(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 xy(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 Sy(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,p)}}function s(h,m){n[h]&&(o[h]=function(b){return new Promise(function(D,C){i.push([h,b,D,C])>1||u(h,b)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(b){d(i[0][3],b)}}function c(h){h.value instanceof Go?Promise.resolve(h.value.v).then(l,p):d(i[0][2],h)}function l(h){u("next",h)}function p(h){u("throw",h)}function d(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Ay(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 Fy(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 du=="function"?du(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 Oy(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ky(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=op(t),n=0;n<r.length;n++)r[n]!=="default"&&hu(e,t,r[n]);return ek(e,t),e}function Py(t){return t&&t.__esModule?t:{default:t}}function $y(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 Ty(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 Iy(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 Ry(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 By(t){function e(i){t.error=t.hasError?new tk(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 jy(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 np,pu,hu,ek,op,tk,rk,pe=tt(()=>{np=function(t,e){return np=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])},np(t,e)};pu=function(){return pu=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},pu.apply(this,arguments)};hu=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]});ek=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},op=function(t){return op=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},op(t)};tk=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};rk={__extends:fy,__assign:pu,__rest:py,__decorate:dy,__param:hy,__esDecorate:my,__runInitializers:gy,__propKey:Dy,__setFunctionName:yy,__metadata:by,__awaiter:wy,__generator:vy,__createBinding:hu,__exportStar:Cy,__values:du,__read:ip,__spread:Ey,__spreadArrays:_y,__spreadArray:xy,__await:Go,__asyncGenerator:Sy,__asyncDelegator:Ay,__asyncValues:Fy,__makeTemplateObject:Oy,__importStar:ky,__importDefault:Py,__classPrivateFieldGet:$y,__classPrivateFieldSet:Ty,__classPrivateFieldIn:Iy,__addDisposableResource:Ry,__disposeResources:By,__rewriteRelativeImportExtension:jy}});var Ny=x(mu=>{"use strict";Object.defineProperty(mu,"__esModule",{value:!0});mu.resolveFetch=void 0;var nk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);mu.resolveFetch=nk});var cp=x(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.FunctionRegion=Qt.FunctionsHttpError=Qt.FunctionsRelayError=Qt.FunctionsFetchError=Qt.FunctionsError=void 0;var Ko=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Qt.FunctionsError=Ko;var ap=class extends Ko{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Qt.FunctionsFetchError=ap;var sp=class extends Ko{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Qt.FunctionsRelayError=sp;var up=class extends Ko{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Qt.FunctionsHttpError=up;var Ly;(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"})(Ly||(Qt.FunctionRegion=Ly={}))});var Uy=x(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.FunctionsClient=void 0;var ok=(pe(),ne(fe)),ik=Ny(),zn=cp(),lp=class{constructor(e,{headers:r={},customFetch:n,region:o=zn.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,ik.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return ok.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:a,body:s,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let p=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,p.searchParams.set("forceFunctionRegion",l));let d;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=s):typeof s=="string"?(c["Content-Type"]="text/plain",d=s):typeof FormData<"u"&&s instanceof FormData?d=s:(c["Content-Type"]="application/json",d=JSON.stringify(s)):d=s;let h=yield this.fetch(p.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new zn.FunctionsFetchError(C)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new zn.FunctionsRelayError(h);if(!h.ok)throw new zn.FunctionsHttpError(h);let b=((o=h.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return b==="application/json"?D=yield h.json():b==="application/octet-stream"||b==="application/pdf"?D=yield h.blob():b==="text/event-stream"?D=h:b==="multipart/form-data"?D=yield h.formData():D=yield h.text(),{data:D,error:null,response:h}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new zn.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof zn.FunctionsHttpError||i instanceof zn.FunctionsRelayError?i.context:void 0}}})}};gu.FunctionsClient=lp});var fp=x(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.FunctionRegion=It.FunctionsRelayError=It.FunctionsHttpError=It.FunctionsFetchError=It.FunctionsError=It.FunctionsClient=void 0;var ak=Uy();Object.defineProperty(It,"FunctionsClient",{enumerable:!0,get:function(){return ak.FunctionsClient}});var xa=cp();Object.defineProperty(It,"FunctionsError",{enumerable:!0,get:function(){return xa.FunctionsError}});Object.defineProperty(It,"FunctionsFetchError",{enumerable:!0,get:function(){return xa.FunctionsFetchError}});Object.defineProperty(It,"FunctionsHttpError",{enumerable:!0,get:function(){return xa.FunctionsHttpError}});Object.defineProperty(It,"FunctionsRelayError",{enumerable:!0,get:function(){return xa.FunctionsRelayError}});Object.defineProperty(It,"FunctionRegion",{enumerable:!0,get:function(){return xa.FunctionRegion}})});var hp=x(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});var pp=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};dp.default=pp});var Dp=x(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var sk=(pe(),ne(fe)),uk=sk.__importDefault(hp()),mp=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,p=null,d=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"))?p=E:p=JSON.parse(E))}let D=(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("/");D&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(l={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,d=null,h=406,m="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(p=[],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 uk.default(l)}return{error:l,data:p,count:d,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(s=i?.stack)!==null&&s!==void 0?s:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};gp.default=mp});var wp=x(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var ck=(pe(),ne(fe)),lk=ck.__importDefault(Dp()),yp=class extends lk.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}};bp.default=yp});var Du=x(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var fk=(pe(),ne(fe)),pk=fk.__importDefault(wp()),dk=new RegExp("[,()]"),vp=class extends pk.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}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&dk.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}};Cp.default=vp});var xp=x(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var hk=(pe(),ne(fe)),Sa=hk.__importDefault(Du()),Ep=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 Sa.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 Sa.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 Sa.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 Sa.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 Sa.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};_p.default=Ep});var qy=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var My=(pe(),ne(fe)),mk=My.__importDefault(xp()),gk=My.__importDefault(Du()),Sp=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){let r=new URL(`${this.url}/${e}`);return new mk.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(([p,d])=>d!==void 0).map(([p,d])=>[p,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([p,d])=>{u.searchParams.append(p,d)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new gk.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Ap.default=Sp});var Fp=x(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.PostgrestError=xt.PostgrestBuilder=xt.PostgrestTransformBuilder=xt.PostgrestFilterBuilder=xt.PostgrestQueryBuilder=xt.PostgrestClient=void 0;var Wo=(pe(),ne(fe)),Hy=Wo.__importDefault(qy());xt.PostgrestClient=Hy.default;var Vy=Wo.__importDefault(xp());xt.PostgrestQueryBuilder=Vy.default;var zy=Wo.__importDefault(Du());xt.PostgrestFilterBuilder=zy.default;var Gy=Wo.__importDefault(wp());xt.PostgrestTransformBuilder=Gy.default;var Ky=Wo.__importDefault(Dp());xt.PostgrestBuilder=Ky.default;var Wy=Wo.__importDefault(hp());xt.PostgrestError=Wy.default;xt.default={PostgrestClient:Hy.default,PostgrestQueryBuilder:Vy.default,PostgrestFilterBuilder:zy.default,PostgrestTransformBuilder:Gy.default,PostgrestBuilder:Ky.default,PostgrestError:Wy.default}});var kp={};Hr(kp,{RealtimeClient:()=>Op});var Op,Pp=tt(()=>{Op=class{constructor(){}connect(){}disconnect(){}}});var gn=x(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.StorageUnknownError=Gr.StorageApiError=Gr.StorageError=void 0;Gr.isStorageError=Dk;var Aa=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Gr.StorageError=Aa;function Dk(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var $p=class extends Aa{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}}};Gr.StorageApiError=$p;var Tp=class extends Aa{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Gr.StorageUnknownError=Tp});var Fa=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.isPlainObject=er.recursiveToCamel=er.resolveResponse=er.resolveFetch=void 0;var yk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);er.resolveFetch=yk;var bk=()=>Response;er.resolveResponse=bk;var wk=t=>{if(Array.isArray(t))return t.map(r=>(0,er.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,er.recursiveToCamel)(n)}),e};er.recursiveToCamel=wk;var vk=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)};er.isPlainObject=vk});var yu=x(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.get=_k;Kn.post=xk;Kn.put=Sk;Kn.head=Ak;Kn.remove=Fk;var Gn=(pe(),ne(fe)),Ip=gn(),Yy=Fa(),Rp=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)},Ck=(t,e,r)=>Gn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,Yy.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new Ip.StorageApiError(Rp(o),i,a))}).catch(o=>{e(new Ip.StorageUnknownError(Rp(o),o))}):e(new Ip.StorageUnknownError(Rp(t),t))}),Ek=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Yy.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 Oa(t,e,r,n,o,i){return Gn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Ek(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>Ck(u,s,n))})})}function _k(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return Oa(t,"GET",e,r,n)})}function xk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Oa(t,"POST",e,n,o,r)})}function Sk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Oa(t,"PUT",e,n,o,r)})}function Ak(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return Oa(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function Fk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return Oa(t,"DELETE",e,n,o,r)})}});var Jy=x(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var Ok=(pe(),ne(fe)),kk=gn(),Bp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return Ok.__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,kk.isStorageError)(e))return{data:null,error:e};throw e}})}};jp.default=Bp});var Qy=x(Lp=>{"use strict";var Xy;Object.defineProperty(Lp,"__esModule",{value:!0});var Zy=(pe(),ne(fe)),Pk=gn(),$k=Zy.__importDefault(Jy()),Np=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[Xy]="BlobDownloadBuilder",this.promise=null}asStream(){return new $k.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 Zy.__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,Pk.isStorageError)(e))return{data:null,error:e};throw e}})}};Xy=Symbol.toStringTag;Lp.default=Np});var r0=x(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var St=(pe(),ne(fe)),Rt=gn(),Bt=yu(),e0=Fa(),Tk=St.__importDefault(Qy()),Ik={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},t0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Up=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,e0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return St.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},t0),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),p=yield(e=="PUT"?Bt.put:Bt.post)(this.fetch,`${this.url}/object/${l}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:p.Id,fullPath:p.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Rt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return St.__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:t0.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 p=yield(0,Bt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:p.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Rt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return St.__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,Bt.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 Rt.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,Rt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bt.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,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Bt.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,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Bt.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,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Bt.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,Rt.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,Bt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new Tk.default(u,this.shouldThrowOnError)}info(e){return St.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Bt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,e0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Rt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return St.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Bt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Rt.isStorageError)(n)&&n instanceof Rt.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 St.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Bt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Rt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return St.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},Ik),r),{prefix:e||""});return{data:yield(0,Bt.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,Rt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return St.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Bt.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,Rt.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("&")}};Mp.default=Up});var qp=x(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.version=void 0;bu.version="2.79.0"});var Hp=x(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.DEFAULT_HEADERS=void 0;var Rk=qp();wu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Rk.version}`}});var n0=x(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var Yo=(pe(),ne(fe)),Bk=Hp(),Jo=gn(),Xo=yu(),jk=Fa(),Vp=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({},Bk.DEFAULT_HEADERS),r),this.fetch=(0,jk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Yo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Xo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Jo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Yo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Xo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Jo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Yo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Xo.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,Jo.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return Yo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Xo.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,Jo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Yo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Xo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Jo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Yo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Xo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Jo.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():""}};zp.default=Vp});var Xp=x(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var Gp=(pe(),ne(fe)),Nk=Hp(),Kp=gn(),Wp=yu(),Lk=Fa(),Yp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Nk.DEFAULT_HEADERS),r),this.fetch=(0,Lk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Gp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Kp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Gp.__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,Wp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Kp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Gp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Wp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Kp.isStorageError)(r))return{data:null,error:r};throw r}})}};Jp.default=Yp});var Cu=x(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.DEFAULT_HEADERS=void 0;var Uk=qp();vu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Uk.version}`,"Content-Type":"application/json"}});var Zo=x(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.StorageVectorsErrorCode=wr.StorageVectorsUnknownError=wr.StorageVectorsApiError=wr.StorageVectorsError=void 0;wr.isStorageVectorsError=Mk;var ka=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};wr.StorageVectorsError=ka;function Mk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Zp=class extends ka{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}}};wr.StorageVectorsApiError=Zp;var Qp=class extends ka{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};wr.StorageVectorsUnknownError=Qp;var o0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(o0||(wr.StorageVectorsErrorCode=o0={}))});var Qo=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.validateVectorDimension=tr.normalizeToFloat32=tr.isPlainObject=tr.resolveResponse=tr.resolveFetch=void 0;var qk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);tr.resolveFetch=qk;var Hk=()=>Response;tr.resolveResponse=Hk;var Vk=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)};tr.isPlainObject=Vk;var zk=t=>Array.from(new Float32Array(t));tr.normalizeToFloat32=zk;var Gk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};tr.validateVectorDimension=Gk});var xu=x(ti=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});ti.get=Jk;ti.post=Xk;ti.put=Zk;ti.remove=Qk;var ei=(pe(),ne(fe)),Eu=Zo(),Kk=Qo(),i0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Wk=(t,e,r)=>ei.__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 Eu.StorageVectorsApiError(i0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Eu.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Eu.StorageVectorsApiError(s,o,a))}}else e(new Eu.StorageVectorsUnknownError(i0(t),t))}),Yk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Kk.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 _u(t,e,r,n,o,i){return ei.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Yk(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=>Wk(u,s,n))})})}function Jk(t,e,r,n){return ei.__awaiter(this,void 0,void 0,function*(){return _u(t,"GET",e,r,n)})}function Xk(t,e,r,n,o){return ei.__awaiter(this,void 0,void 0,function*(){return _u(t,"POST",e,n,o,r)})}function Zk(t,e,r,n,o){return ei.__awaiter(this,void 0,void 0,function*(){return _u(t,"PUT",e,n,o,r)})}function Qk(t,e,r,n,o){return ei.__awaiter(this,void 0,void 0,function*(){return _u(t,"DELETE",e,n,o,r)})}});var rd=x(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var Su=(pe(),ne(fe)),e3=Cu(),Au=Zo(),Fu=xu(),t3=Qo(),ed=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},e3.DEFAULT_HEADERS),r),this.fetch=(0,t3.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Fu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Au.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Fu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Au.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};td.default=ed});var id=x(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});var Pa=(pe(),ne(fe)),r3=Cu(),$a=Zo(),Ta=xu(),n3=Qo(),nd=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},r3.DEFAULT_HEADERS),r),this.fetch=(0,n3.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Pa.__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,Ta.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Pa.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ta.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Pa.__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,Ta.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Pa.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ta.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Pa.__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,Ta.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,$a.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};od.default=nd});var ud=x(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var Ou=(pe(),ne(fe)),o3=Cu(),ku=Zo(),Pu=xu(),i3=Qo(),ad=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},o3.DEFAULT_HEADERS),r),this.fetch=(0,i3.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Ou.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Pu.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ku.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Ou.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Pu.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ku.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Ou.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Pu.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ku.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Ou.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Pu.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ku.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};sd.default=ad});var a0=x(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.VectorIndexScope=Dn.VectorBucketScope=Dn.StorageVectorsClient=void 0;var rr=(pe(),ne(fe)),a3=rr.__importDefault(rd()),s3=rr.__importDefault(id()),u3=rr.__importDefault(ud()),cd=class extends u3.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new $u(this.url,this.headers,e,this.fetch)}};Dn.StorageVectorsClient=cd;var $u=class extends a3.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 rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Tu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Dn.VectorBucketScope=$u;var Tu=class extends s3.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 rr.__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 rr.__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 rr.__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 rr.__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 rr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Dn.VectorIndexScope=Tu});var pd=x(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.validateVectorDimension=de.normalizeToFloat32=de.isPlainObject=de.resolveResponse=de.resolveFetch=de.isStorageVectorsError=de.StorageVectorsErrorCode=de.StorageVectorsUnknownError=de.StorageVectorsApiError=de.StorageVectorsError=de.VectorDataApi=de.VectorIndexApi=de.VectorBucketApi=de.VectorIndexScope=de.VectorBucketScope=de.StorageVectorsClient=void 0;var ld=(pe(),ne(fe)),fd=a0();Object.defineProperty(de,"StorageVectorsClient",{enumerable:!0,get:function(){return fd.StorageVectorsClient}});Object.defineProperty(de,"VectorBucketScope",{enumerable:!0,get:function(){return fd.VectorBucketScope}});Object.defineProperty(de,"VectorIndexScope",{enumerable:!0,get:function(){return fd.VectorIndexScope}});var c3=ud();Object.defineProperty(de,"VectorBucketApi",{enumerable:!0,get:function(){return ld.__importDefault(c3).default}});var l3=rd();Object.defineProperty(de,"VectorIndexApi",{enumerable:!0,get:function(){return ld.__importDefault(l3).default}});var f3=id();Object.defineProperty(de,"VectorDataApi",{enumerable:!0,get:function(){return ld.__importDefault(f3).default}});var Ia=Zo();Object.defineProperty(de,"StorageVectorsError",{enumerable:!0,get:function(){return Ia.StorageVectorsError}});Object.defineProperty(de,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ia.StorageVectorsApiError}});Object.defineProperty(de,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ia.StorageVectorsUnknownError}});Object.defineProperty(de,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ia.StorageVectorsErrorCode}});Object.defineProperty(de,"isStorageVectorsError",{enumerable:!0,get:function(){return Ia.isStorageVectorsError}});var Ra=Qo();Object.defineProperty(de,"resolveFetch",{enumerable:!0,get:function(){return Ra.resolveFetch}});Object.defineProperty(de,"resolveResponse",{enumerable:!0,get:function(){return Ra.resolveResponse}});Object.defineProperty(de,"isPlainObject",{enumerable:!0,get:function(){return Ra.isPlainObject}});Object.defineProperty(de,"normalizeToFloat32",{enumerable:!0,get:function(){return Ra.normalizeToFloat32}});Object.defineProperty(de,"validateVectorDimension",{enumerable:!0,get:function(){return Ra.validateVectorDimension}})});var s0=x(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.StorageClient=void 0;var hd=(pe(),ne(fe)),p3=hd.__importDefault(r0()),d3=hd.__importDefault(n0()),h3=hd.__importDefault(Xp()),m3=pd(),dd=class extends d3.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new p3.default(this.url,this.headers,e,this.fetch)}get vectors(){return new m3.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new h3.default(this.url+"/iceberg",this.headers,this.fetch)}};Iu.StorageClient=dd});var c0=x(u0=>{"use strict";Object.defineProperty(u0,"__esModule",{value:!0})});var l0=x(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.StorageAnalyticsApi=Kr.StorageClient=void 0;var Ru=(pe(),ne(fe)),g3=s0();Object.defineProperty(Kr,"StorageClient",{enumerable:!0,get:function(){return g3.StorageClient}});var D3=Xp();Object.defineProperty(Kr,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Ru.__importDefault(D3).default}});Ru.__exportStar(c0(),Kr);Ru.__exportStar(gn(),Kr);Ru.__exportStar(pd(),Kr)});var f0=x(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.version=void 0;Bu.version="2.79.0"});var p0=x(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.DEFAULT_REALTIME_OPTIONS=Vt.DEFAULT_AUTH_OPTIONS=Vt.DEFAULT_DB_OPTIONS=Vt.DEFAULT_GLOBAL_OPTIONS=Vt.DEFAULT_HEADERS=void 0;var y3=f0(),Ba="";typeof Deno<"u"?Ba="deno":typeof document<"u"?Ba="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ba="react-native":Ba="node";Vt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Ba}/${y3.version}`};Vt.DEFAULT_GLOBAL_OPTIONS={headers:Vt.DEFAULT_HEADERS};Vt.DEFAULT_DB_OPTIONS={schema:"public"};Vt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Vt.DEFAULT_REALTIME_OPTIONS={}});var d0=x(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.fetchWithAuth=Sr.resolveHeadersConstructor=Sr.resolveFetch=void 0;var b3=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Sr.resolveFetch=b3;var w3=()=>Headers;Sr.resolveHeadersConstructor=w3;var v3=(t,e,r)=>{let n=(0,Sr.resolveFetch)(r),o=(0,Sr.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}))}};Sr.fetchWithAuth=v3});var m0=x(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.isBrowser=void 0;yn.uuid=C3;yn.ensureTrailingSlash=h0;yn.applySettingDefaults=_3;yn.validateSupabaseUrl=x3;function C3(){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 h0(t){return t.endsWith("/")?t:t+"/"}var E3=()=>typeof window<"u";yn.isBrowser=E3;function _3(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:p}=e,d={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({},p),s),{headers:Object.assign(Object.assign({},(r=p?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function x3(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(h0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Ad={};Hr(Ad,{AuthAdminApi:()=>gd,AuthApiError:()=>Dd,AuthClient:()=>md,AuthError:()=>vr,AuthImplicitGrantRedirectError:()=>Cd,AuthInvalidCredentialsError:()=>vd,AuthInvalidTokenResponseError:()=>wd,AuthPKCEGrantCodeExchangeError:()=>Ed,AuthRetryableError:()=>yd,AuthSessionMissingError:()=>bd,AuthWeakPasswordError:()=>_d,GoTrueAdminApi:()=>Nu,GoTrueClient:()=>ju,NavigatorLockAcquireTimeoutError:()=>xd,isAuthApiError:()=>k3,isAuthError:()=>O3,isAuthRetryableError:()=>P3,isAuthSessionMissingError:()=>$3,isAuthWeakPasswordError:()=>T3,lockInternals:()=>F3,navigatorLock:()=>S3,processLock:()=>A3});var Sd,g0,ju,Nu,md,gd,vr,Dd,yd,bd,wd,vd,Cd,Ed,_d,S3,A3,xd,F3,O3,k3,P3,$3,T3,Fd=tt(()=>{Sd=()=>Promise.resolve({data:{session:null,user:null},error:null}),g0={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}):Sd}},ju=class{constructor(e){return this.options=e,new Proxy(this,g0)}},Nu=class{constructor(e){return this.options=e,new Proxy(this,g0)}},md=class extends ju{},gd=class extends Nu{},vr=class extends Error{},Dd=class extends vr{},yd=class extends vr{},bd=class extends vr{},wd=class extends vr{},vd=class extends vr{},Cd=class extends vr{},Ed=class extends vr{},_d=class extends vr{},S3=Sd,A3=Sd,xd=class extends Error{},F3={},O3=()=>!1,k3=()=>!1,P3=()=>!1,$3=()=>!1,T3=()=>!1});var D0=x(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.SupabaseAuthClient=void 0;var I3=(Fd(),ne(Ad)),Od=class extends I3.AuthClient{constructor(e){super(e)}};Lu.SupabaseAuthClient=Od});var $d=x(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});var R3=fp(),B3=Fp(),j3=(Pp(),ne(kp)),N3=l0(),Uu=p0(),L3=d0(),y0=m0(),U3=D0(),kd=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,y0.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:Uu.DEFAULT_DB_OPTIONS,realtime:Uu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Uu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Uu.DEFAULT_GLOBAL_OPTIONS},l=(0,y0.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:(p,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,L3.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.rest=new B3.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new N3.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new R3.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},p,d){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new U3.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),p),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new j3.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)}};Pd.default=kd});var v0=x(Ie=>{"use strict";var M3=Ie&&Ie.__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]})),b0=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&M3(e,t,r)},w0=Ie&&Ie.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createClient=Ie.SupabaseClient=Ie.FunctionRegion=Ie.FunctionsError=Ie.FunctionsRelayError=Ie.FunctionsFetchError=Ie.FunctionsHttpError=Ie.PostgrestError=void 0;var q3=w0($d());b0((Fd(),ne(Ad)),Ie);var H3=Fp();Object.defineProperty(Ie,"PostgrestError",{enumerable:!0,get:function(){return H3.PostgrestError}});var ja=fp();Object.defineProperty(Ie,"FunctionsHttpError",{enumerable:!0,get:function(){return ja.FunctionsHttpError}});Object.defineProperty(Ie,"FunctionsFetchError",{enumerable:!0,get:function(){return ja.FunctionsFetchError}});Object.defineProperty(Ie,"FunctionsRelayError",{enumerable:!0,get:function(){return ja.FunctionsRelayError}});Object.defineProperty(Ie,"FunctionsError",{enumerable:!0,get:function(){return ja.FunctionsError}});Object.defineProperty(Ie,"FunctionRegion",{enumerable:!0,get:function(){return ja.FunctionRegion}});b0((Pp(),ne(kp)),Ie);var V3=$d();Object.defineProperty(Ie,"SupabaseClient",{enumerable:!0,get:function(){return w0(V3).default}});var z3=(t,e,r)=>new q3.default(t,e,r);Ie.createClient=z3;function G3(){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}G3()&&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 Td=x((HV,C0)=>{C0.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 Mu=x(_0=>{var E0={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 K3(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(E0))_0[t]=K3(E0[t])});var O0=x((zV,F0)=>{var W3=require("fs"),rt=require("path"),x0=Td(),Y3=Mu(),J3=typeof process=="object"&&process.platform==="win32",S0=t=>typeof t=="object"&&t!==null,A0=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 Ke(t){this.sep=rt.sep,this.fs=W3,S0(t)&&S0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}F0.exports=Ke;Ke.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 Y3.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};Ke.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=rt.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};Ke.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=rt.dirname(t);i.fs.exists(c,function(l){l||i.makeDir(c),i.fs.open(t,"w",438,function(p,d){p?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)})})})})}):d?i.fs.write(d,e,0,e.length,0,function(){i.fs.close(d,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};Ke.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=rt.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(rt.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};Ke.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=rt.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(rt.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(l,p){if(l)return e(l);n=n.concat(p),--a||e(null,n)}):--a||e(null,n))})})})};Ke.prototype.getAttributes=function(){};Ke.prototype.setAttributes=function(){};Ke.crc32update=function(t,e){return A0[(t^e)&255]^t>>>8};Ke.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=Ke.crc32update(r,t[n++]);return~r>>>0};Ke.methodToString=function(t){switch(t){case x0.STORED:return"STORED ("+t+")";case x0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Ke.canonical=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.join(".",e)};Ke.zipnamefix=function(t){if(!t)return"";let e=rt.posix.normalize("/"+t.split("\\").join("/"));return rt.posix.join(".",e)};Ke.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]};Ke.sanitize=function(t,e){t=rt.resolve(rt.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=rt.normalize(rt.join(t,r.slice(n,o).join(rt.sep)));if(i.indexOf(t)===0)return i}return rt.normalize(rt.join(t,rt.basename(e)))};Ke.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};Ke.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};Ke.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)};Ke.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};Ke.isWin=J3;Ke.crcTable=A0});var P0=x((GV,k0)=>{var X3=require("path");k0.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=X3.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 T0=x((KV,$0)=>{$0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var ni=x((WV,ri)=>{ri.exports=O0();ri.exports.Constants=Td();ri.exports.Errors=Mu();ri.exports.FileAttr=P0();ri.exports.decoder=T0()});var R0=x((YV,I0)=>{var bn=ni(),W=bn.Constants;I0.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,p=0,d=0,h=0,m=0;t|=bn.isWin?2560:768,r|=W.FLG_EFS;let b={extraLen:0},D=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=bn.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&W.FLG_EFS)>0},set flags_efs(g){g?r|=W.FLG_EFS:r&=~W.FLG_EFS},get flags_desc(){return(r&W.FLG_DESC)>0},set flags_desc(g){g?r|=W.FLG_DESC:r&=~W.FLG_DESC},get method(){return n},set method(g){switch(g){case W.STORED:this.version=10;case W.DEFLATED:default:this.version=20}n=g},get time(){return bn.fromDOS2Date(this.timeval)},set time(g){this.timeval=bn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return E(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 p},set diskNumStart(g){p=D(g)},get inAttr(){return d},set inAttr(g){d=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&W.FLG_ENC)===W.FLG_ENC},get centralHeaderSize(){return W.CENHDR+u+c+l},get realDataOffset(){return m+W.LOCHDR+b.fnameLen+b.extraLen},get localHeader(){return b},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+W.LOCHDR);if(_.readUInt32LE(0)!==W.LOCSIG)throw bn.Errors.INVALID_LOC();b.version=_.readUInt16LE(W.LOCVER),b.flags=_.readUInt16LE(W.LOCFLG),b.method=_.readUInt16LE(W.LOCHOW),b.time=_.readUInt32LE(W.LOCTIM),b.crc=_.readUInt32LE(W.LOCCRC),b.compressedSize=_.readUInt32LE(W.LOCSIZ),b.size=_.readUInt32LE(W.LOCLEN),b.fnameLen=_.readUInt16LE(W.LOCNAM),b.extraLen=_.readUInt16LE(W.LOCEXT);let S=m+W.LOCHDR+b.fnameLen,P=S+b.extraLen;return g.slice(S,P)},loadFromBinary:function(g){if(g.length!==W.CENHDR||g.readUInt32LE(0)!==W.CENSIG)throw bn.Errors.INVALID_CEN();t=g.readUInt16LE(W.CENVEM),e=g.readUInt16LE(W.CENVER),r=g.readUInt16LE(W.CENFLG),n=g.readUInt16LE(W.CENHOW),o=g.readUInt32LE(W.CENTIM),i=g.readUInt32LE(W.CENCRC),a=g.readUInt32LE(W.CENSIZ),s=g.readUInt32LE(W.CENLEN),u=g.readUInt16LE(W.CENNAM),c=g.readUInt16LE(W.CENEXT),l=g.readUInt16LE(W.CENCOM),p=g.readUInt16LE(W.CENDSK),d=g.readUInt16LE(W.CENATT),h=g.readUInt32LE(W.CENATX),m=g.readUInt32LE(W.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(W.LOCHDR);return g.writeUInt32LE(W.LOCSIG,0),g.writeUInt16LE(e,W.LOCVER),g.writeUInt16LE(r,W.LOCFLG),g.writeUInt16LE(n,W.LOCHOW),g.writeUInt32LE(o,W.LOCTIM),g.writeUInt32LE(i,W.LOCCRC),g.writeUInt32LE(a,W.LOCSIZ),g.writeUInt32LE(s,W.LOCLEN),g.writeUInt16LE(u,W.LOCNAM),g.writeUInt16LE(b.extraLen,W.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(W.CENHDR+u+c+l);return g.writeUInt32LE(W.CENSIG,0),g.writeUInt16LE(t,W.CENVEM),g.writeUInt16LE(e,W.CENVER),g.writeUInt16LE(r,W.CENFLG),g.writeUInt16LE(n,W.CENHOW),g.writeUInt32LE(o,W.CENTIM),g.writeUInt32LE(i,W.CENCRC),g.writeUInt32LE(a,W.CENSIZ),g.writeUInt32LE(s,W.CENLEN),g.writeUInt16LE(u,W.CENNAM),g.writeUInt16LE(c,W.CENEXT),g.writeUInt16LE(l,W.CENCOM),g.writeUInt16LE(p,W.CENDSK),g.writeUInt16LE(d,W.CENATT),g.writeUInt32LE(h,W.CENATX),g.writeUInt32LE(m,W.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:bn.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:p,inAttr:d,attr:h,offset:m,centralHeaderSize:g(W.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var j0=x((JV,B0)=>{var oi=ni(),He=oi.Constants;B0.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 He.ENDHDR+o},loadFromBinary:function(i){if((i.length!==He.ENDHDR||i.readUInt32LE(0)!==He.ENDSIG)&&(i.length<He.ZIP64HDR||i.readUInt32LE(0)!==He.ZIP64SIG))throw oi.Errors.INVALID_END();i.readUInt32LE(0)===He.ENDSIG?(t=i.readUInt16LE(He.ENDSUB),e=i.readUInt16LE(He.ENDTOT),r=i.readUInt32LE(He.ENDSIZ),n=i.readUInt32LE(He.ENDOFF),o=i.readUInt16LE(He.ENDCOM)):(t=oi.readBigUInt64LE(i,He.ZIP64SUB),e=oi.readBigUInt64LE(i,He.ZIP64TOT),r=oi.readBigUInt64LE(i,He.ZIP64SIZE),n=oi.readBigUInt64LE(i,He.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(He.ENDHDR+o);return i.writeUInt32LE(He.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,He.ENDSUB),i.writeUInt16LE(e,He.ENDTOT),i.writeUInt32LE(r,He.ENDSIZ),i.writeUInt32LE(n,He.ENDOFF),i.writeUInt16LE(o,He.ENDCOM),i.fill(" ",He.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 Rd=x(Id=>{Id.EntryHeader=R0();Id.MainHeader=j0()});var L0=x((ZV,N0)=>{N0.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 M0=x((QV,U0)=>{var Z3=+(process.versions?process.versions.node:"").split(".")[0]||0;U0.exports=function(t,e){var r=require("zlib");let n=Z3>=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 p=a[l];p.copy(u,c),c+=p.length}o&&o(u)}),i.end(t)}}}});var G0=x((ez,z0)=>{"use strict";var{randomFillSync:q0}=require("crypto"),Q3=Mu(),eP=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}),V0=(t,e)=>Math.imul(t,e)>>>0,H0=(t,e)=>eP[(t^e)&255]^t>>>8,Na=()=>typeof q0=="function"?q0(Buffer.alloc(12)):Na.node();Na.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 qu={genSalt:Na};function Hu(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])}Hu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=H0(e[0],t),e[1]+=e[0]&255,e[1]=V0(e[1],134775813)+1,e[2]=H0(e[2],e[1]>>>24),t};Hu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return V0(t,t^1)>>8&255};function tP(t){let e=new Hu(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 rP(t){let e=new Hu(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 nP(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=tP(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw Q3.WRONG_PASSWORD();return n(t.slice(12))}function oP(t){Buffer.isBuffer(t)&&t.length>=12?qu.genSalt=function(){return t.slice(0,12)}:t==="node"?qu.genSalt=Na.node:qu.genSalt=Na}function iP(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=rP(r),i=qu.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)}z0.exports={decrypt:nP,encrypt:iP,_salter:oP}});var K0=x(Vu=>{Vu.Deflater=L0();Vu.Inflater=M0();Vu.ZipCrypto=G0()});var jd=x((rz,W0)=>{var xe=ni(),aP=Rd(),We=xe.Constants,Bd=K0();W0.exports=function(t,e){var r=new aP.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,p=typeof l.decoder=="object"?l.decoder:xe.decoder;c=p.hasOwnProperty("efs")?p.efs:!1;function d(){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 _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==We.LOCSIG||e.readUInt32LE(S)==We.CENSIG)throw xe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==We.EXTSIG)_.crc=e.readUInt32LE(S+We.EXTCRC),_.compressedSize=e.readUInt32LE(S+We.EXTSIZ),_.size=e.readUInt32LE(S+We.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+We.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+We.EXTSIZ-4),_.size=e.readUInt32LE(S+We.EXTLEN-4);else throw xe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw xe.Errors.DESCRIPTOR_FAULTY();if(xe.crc32(g)!==_.crc)return!1}else if(xe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,S){if(typeof _>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),xe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var P=d();if(P.length===0)return g&&_&&_(P),P;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw xe.Errors.INVALID_PASS_PARAM();P=Bd.ZipCrypto.decrypt(P,r,S)}var k=Buffer.alloc(r.size);switch(r.method){case xe.Constants.STORED:if(P.copy(k),h(k))return g&&_&&_(k),k;throw g&&_&&_(k,xe.Errors.BAD_CRC()),xe.Errors.BAD_CRC();case xe.Constants.DEFLATED:var B=new Bd.Inflater(P,r.size);if(g)B.inflateAsync(function(R){R.copy(R,0),_&&(h(R)?_(R):_(R,xe.Errors.BAD_CRC()))});else{if(B.inflate(k).copy(k,0),!h(k))throw xe.Errors.BAD_CRC(`"${p.decode(n)}"`);return k}break;default:throw g&&_&&_(Buffer.alloc(0),xe.Errors.UNKNOWN_METHOD()),xe.Errors.UNKNOWN_METHOD()}}function b(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(d()),d();if(a.length&&!i){var S;switch(r.method){case xe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case xe.Constants.DEFLATED:var P=new Bd.Deflater(a);if(g)P.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var k=P.deflate();return r.compressedSize=k.length,k}P=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,S,P,k;_+4<g.length;)S=g.readUInt16LE(_),_+=2,P=g.readUInt16LE(_),_+=2,k=g.slice(_,_+P),_+=P,We.ID_ZIP64===S&&E(k)}catch{throw xe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,P,k;g.length>=We.EF_ZIP64_SCOMP&&(_=D(g,We.EF_ZIP64_SUNCOMP),r.size===We.EF_ZIP64_OR_32&&(r.size=_)),g.length>=We.EF_ZIP64_RHO&&(S=D(g,We.EF_ZIP64_SCOMP),r.compressedSize===We.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=We.EF_ZIP64_DSN&&(P=D(g,We.EF_ZIP64_RHO),r.offset===We.EF_ZIP64_OR_32&&(r.offset=P)),g.length>=We.EF_ZIP64_DSN+4&&(k=g.readUInt32LE(We.EF_ZIP64_DSN),r.diskNumStart===We.EF_ZIP64_OR_16&&(r.diskNumStart=k))}return{get entryName(){return p.decode(n)},get rawEntryName(){return n},set entryName(g){n=xe.toBuffer(g,p.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 p.decode(o)},set comment(g){if(o=xe.toBuffer(g,p.encode),r.commentLength=o.length,o.length>65535)throw xe.Errors.COMMENT_TOO_LONG()},get name(){var g=p.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=xe.toBuffer(g,xe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=xe.Constants.DEFLATED,r.crc=xe.crc32(g),r.changed=!0):r.method=xe.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(),_=xe.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(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,g),g+=_.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},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 X0=x((nz,J0)=>{var Y0=jd(),sP=Rd(),pt=ni();J0.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new sP.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:p}=c;t?m(c.readEntries):a=!0;function d(){let D=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("/")+"/";D.add(_)}}for(let C of D)if(!(C in n)){let E=new Y0(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)/pt.Constants.CENHDR)throw pt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,C=0;C<r.length;C++){var E=D,g=new Y0(c,t);g.header=t.slice(E,E+=pt.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)),D+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),d()}function m(D){var C=t.length-pt.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,S=-1,P=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===pt.Constants.ENDSIG){S=C,P=C,_=C+pt.Constants.ENDHDR,g=C-pt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===pt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===pt.Constants.ZIP64SIG){S=C,_=C+pt.readBigUInt64LE(t,C+pt.Constants.ZIP64SIZE)+pt.Constants.ZIP64LEAD;break}}if(S==-1)throw pt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(P+pt.Constants.ENDHDR)),D&&h()}function b(){r.length>1&&!l&&r.sort((D,C)=>D.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return p.decode(o)},set comment(D){o=pt.toBuffer(D,p.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,C=!0){a||h();let E=n[D];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let C=n[D],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,C=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&C){let E=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let C=this.getEntryChildren(D);return C.includes(D)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),b();let D=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let k of this.entries){let B=k.getCompressedData();k.header.offset=g;let R=k.packLocalHeader(),N=R.length+B.length;g+=N,D.push(R),D.push(B);let F=k.packCentralHeader();C.push(F),i.size+=F.length,E+=N+F.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let k of D)k.copy(S,g),g+=k.length;for(let k of C)k.copy(S,g),g+=k.length;let P=i.toBinary();return o&&o.copy(P,pt.Constants.ENDHDR),P.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,C,E,g){try{a||h(),b();let _=[],S=[],P=0,k=0,B=0;i.size=0,i.offset=0;let R=function(N){if(N.length>0){let F=N.shift(),U=F.entryName+F.extra.toString();E&&E(U),F.getCompressedDataAsync(function(M){g&&g(U),F.header.offset=k;let Q=F.packLocalHeader(),$=Q.length+M.length;k+=$,_.push(Q),_.push(M);let y=F.packCentralHeader();S.push(y),i.size+=y.length,P+=$+y.length,B++,R(N)})}else{P+=i.mainHeaderSize,i.offset=k,i.totalEntries=B,k=0;let F=Buffer.alloc(P);_.forEach(function(M){M.copy(F,k),k+=M.length}),S.forEach(function(M){M.copy(F,k),k+=M.length});let U=i.toBinary();o&&o.copy(U,pt.Constants.ENDHDR),U.copy(F,k),t=F,a=!1,D(F)}};R(Array.from(this.entries))}catch(_){C(_)}}}}});var eb=x((oz,Q0)=>{var Ve=ni(),Ye=require("path"),uP=jd(),cP=X0(),Wn=(...t)=>Ve.findLast(t,e=>typeof e=="boolean"),Z0=(...t)=>Ve.findLast(t,e=>typeof e=="string"),lP=(...t)=>Ve.findLast(t,e=>typeof e=="function"),fP={noSort:!1,readEntries:!1,method:Ve.Constants.NONE,fs:null};Q0.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),fP);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=Ve.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ve(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ve.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ve.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ve.Errors.INVALID_FILENAME();let i=new cP(r,n),{canonical:a,sanitize:s,zipnamefix:u}=Ve;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Ye.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}=Ye.posix;return m(".",b(D+h.split("\\").join(D)+D))}function p(h){return h instanceof RegExp?(function(m){return function(b){return m.test(b)}})(h):typeof h!="function"?()=>!0:h}let d=(h,m)=>{let b=m.slice(-1);return b=b===o.sep?o.sep:"",Ye.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(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,D){if(o.fs.existsSync(h)){m=m?l(m):"";let C=Ye.win32.basename(Ye.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,D,E)}else throw Ve.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let b=Ye.resolve(h.localPath),{comment:D}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(b,function(_,S){if(_)return m(_,!1);C=C?l(C):"";let P=Ye.win32.basename(Ye.win32.normalize(b));if(C+=E||P,S.isFile())o.fs.readFile(b,function(k,B){return k?m(k,!1):(g.addFile(C,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,b){if(b=p(b),m=m?l(m):"",h=Ye.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),C=this;if(D.length)for(let E of D){let g=Ye.join(m,d(h,E));b(g)&&C.addLocalFile(E,Ye.dirname(g))}}else throw Ve.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,b,D){D=p(D),b=b?l(b):"",h=Ye.normalize(h);var C=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,Ve.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var g=o.findFiles(h),_=-1,S=function(){if(_+=1,_<g.length){var P=g[_],k=d(h,P).split("\\").join("/");k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(k)?o.fs.stat(P,function(B,R){B&&m(void 0,B),R.isFile()?o.fs.readFile(P,function(N,F){N?m(void 0,N):(C.addFile(b+k,F,"",R),S())}):(C.addFile(b+k+"/",Buffer.alloc(0),"",R),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let b=this;h=typeof h=="object"?h:{localPath:h},localPath=Ye.resolve(l(h.localPath));let{zipPath:D,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(S){return function(P){return S.test(P)}})(C):typeof C!="function"&&(C=function(){return!0}),D=D?l(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let g=S=>Ye.join(D,E(d(localPath,S))),_=S=>Ye.win32.basename(Ye.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ve.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(P,k){if(P)return m(P);k=k.filter(B=>C(g(B))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(B,R){return function(N,F){if(N||F===!1)return setImmediate(B,N,!1);b.addLocalFileAsync({localPath:R,zipPath:Ye.dirname(g(R)),zipName:_(R)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((b,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&D(C),E&&b(this)})})},addFile:function(h,m,b,D){h=u(h);let C=c(h),E=C!=null;E||(C=new uP(n),C.entryName=h),C.comment=b||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(C.header.time=D.mtime);var _=C.isDirectory?16:0;let S=C.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=C.isDirectory?493:420,_=(_|S<<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,D,C,E){D=Wn(!1,D),C=Wn(!1,C),b=Wn(!0,b),E=Z0(C,E);var g=c(h);if(!g)throw Ve.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:b?_:Ye.basename(_));if(g.isDirectory){var P=i.getEntryChildren(g);return P.forEach(function(R){if(R.isDirectory)return;var N=R.getData();if(!N)throw Ve.Errors.CANT_EXTRACT_FILE();var F=a(R.entryName),U=s(m,b?F:Ye.basename(F));let M=C?R.header.fileAttr:void 0;o.writeFileTo(U,N,D,M)}),!0}var k=g.getData(i.password);if(!k)throw Ve.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ve.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(S,k,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=Wn(!1,b),D=Z0(b,D),m=Wn(!1,m),!i)throw Ve.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(D);if(!g)throw Ve.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 Ve.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,b,D){if(D=lP(m,b,D),b=Wn(!1,b),m=Wn(!1,m),!D)return new Promise((S,P)=>{this.extractAllToAsync(h,m,b,function(k){k?P(k):S(this)})});if(!i){D(Ve.Errors.NO_ZIP());return}h=Ye.resolve(h);let C=S=>s(h,Ye.normalize(a(S.entryName))),E=(S,P)=>new Error(S+': "'+P+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let P=C(S),k=b?S.header.fileAttr:void 0;try{o.makeDir(P),k&&o.fs.chmodSync(P,k),o.fs.utimesSync(P,S.header.time,S.header.time)}catch{D(E("Unable to create folder",P))}}_.reverse().reduce(function(S,P){return function(k){if(k)S(k);else{let B=Ye.normalize(a(P.entryName)),R=s(h,B);P.getDataAsync(function(N,F){if(F)S(F);else if(!N)S(Ve.Errors.CANT_EXTRACT_FILE());else{let U=b?P.header.fileAttr:void 0;o.writeFileToAsync(R,N,m,U,function(M){M||S(E("Unable to write file",R)),o.fs.utimes(R,P.header.time,P.header.time,function(Q){Q?S(E("Unable to set times",R)):S()})})}})}}},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((C,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(g=>{let _=S=>S?C(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,b,D,_)},E)})},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 ob=x((iz,nb)=>{var rb={};nb.exports=rb;var tb={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(tb).forEach(function(t){var e=tb[t],r=rb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var ab=x((az,ib)=>{"use strict";ib.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 ub=x((sz,sb)=>{"use strict";var pP=require("os"),Cr=ab(),At=process.env,ii=void 0;Cr("no-color")||Cr("no-colors")||Cr("color=false")?ii=!1:(Cr("color")||Cr("colors")||Cr("color=true")||Cr("color=always"))&&(ii=!0);"FORCE_COLOR"in At&&(ii=At.FORCE_COLOR.length===0||parseInt(At.FORCE_COLOR,10)!==0);function dP(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function hP(t){if(ii===!1)return 0;if(Cr("color=16m")||Cr("color=full")||Cr("color=truecolor"))return 3;if(Cr("color=256"))return 2;if(t&&!t.isTTY&&ii!==!0)return 0;var e=ii?1:0;if(process.platform==="win32"){var r=pP.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 At)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in At})||At.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in At)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(At.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in At){var n=parseInt((At.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(At.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(At.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(At.TERM)||"COLORTERM"in At?1:(At.TERM==="dumb",e)}function Nd(t){var e=hP(t);return dP(e)}sb.exports={supportsColor:Nd,stdout:Nd(process.stdout),stderr:Nd(process.stderr)}});var lb=x((uz,cb)=>{cb.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 pb=x((cz,fb)=>{fb.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="",p,d;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(d in u)if(!a(d)){switch(l=l+u[d],p={up:0,down:0,mid:0},c.size){case"mini":p.up=i(8),p.mid=i(2),p.down=i(8);break;case"maxi":p.up=i(16)+3,p.mid=i(4)+1,p.down=i(64)+3;break;default:p.up=i(8)+1,p.mid=i(6)/2,p.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var b=h[m],D=0;D<=p[b];D++)c[b]&&(l=l+n[b][i(n[b].length)])}return l}return s(e,r)}});var hb=x((lz,db)=>{db.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 gb=x((fz,mb)=>{mb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var yb=x((pz,Db)=>{Db.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 wb=x((dz,bb)=>{bb.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 Sb=x((mz,xb)=>{var ce={};xb.exports=ce;ce.themes={};var mP=require("util"),Yn=ce.styles=ob(),Cb=Object.defineProperties,gP=new RegExp(/[\r\n]+/g);ce.supportsColor=ub().supportsColor;typeof ce.enabled>"u"&&(ce.enabled=ce.supportsColor()!==!1);ce.enable=function(){ce.enabled=!0};ce.disable=function(){ce.enabled=!1};ce.stripColors=ce.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var hz=ce.stylize=function(e,r){if(!ce.enabled)return e+"";var n=Yn[r];return!n&&r in ce?ce[r](e):n.open+e+n.close},DP=/[|\\{}()[\]^$+*?.]/g,yP=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(DP,"\\$&")};function Eb(t){var e=function r(){return wP.apply(r,arguments)};return e._styles=t,e.__proto__=bP,e}var _b=(function(){var t={};return Yn.grey=Yn.gray,Object.keys(Yn).forEach(function(e){Yn[e].closeRe=new RegExp(yP(Yn[e].close),"g"),t[e]={get:function(){return Eb(this._styles.concat(e))}}}),t})(),bP=Cb(function(){},_b);function wP(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:mP.inspect(a)}).join(" ");if(!ce.enabled||!e)return e;for(var r=e.indexOf(`
28
- `)!=-1,n=this._styles,o=n.length;o--;){var i=Yn[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(gP,function(a){return i.close+a+i.open}))}return e}ce.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){ce[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=ce[t[r][i]](o);return o}return ce[t[r]](n)}})(e)};function vP(){var t={};return Object.keys(_b).forEach(function(e){t[e]={get:function(){return Eb([e])}}}),t}var CP=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ce.trap=lb();ce.zalgo=pb();ce.maps={};ce.maps.america=hb()(ce);ce.maps.zebra=gb()(ce);ce.maps.rainbow=yb()(ce);ce.maps.random=wb()(ce);for(vb in ce.maps)(function(t){ce[t]=function(e){return CP(ce.maps[t],e)}})(vb);var vb;Cb(ce,vP())});var Fb=x((gz,Ab)=>{var EP=Sb();Ab.exports=EP});var Ob=x(Ld=>{"use strict";Ld.indent=function(e){return new Array(e+1).join(" ")};Ld.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 kb=x((yz,_P)=>{_P.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 Pb=x(La=>{"use strict";var Ar=Fb(),wn=Ob(),xP=/[^\w\s\n\r\v\t\.,]/i;La.version=kb().version;var Ud=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(`
29
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&zu(t[0],!0,r))},SP=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Ar[e.stringColor](t):t;var r=t+"";return t===!0?Ar.green(r):t===!1?Ar.red(r):t==null?Ar.grey(r):typeof t=="number"?t>=0?Ar[e.positiveNumberColor](r):Ar[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Md=function(t,e){return t.multilineStringColor===null||t.noColor?e:Ar[t.multilineStringColor](e)},AP=function(t,e,r){var n=t.split(`
30
- `);return n=n.map(function(o){return wn.indent(e)+Md(r,o)}),n.join(`
31
- `)},ai=function(t,e,r){if(typeof t=="string"&&t.match(xP)&&e.escape&&(t=JSON.stringify(t)),!Ud(t,e))return[];if(zu(t,!1,e))return[wn.indent(r)+SP(t,e)];if(typeof t=="string")return[wn.indent(r)+Md(e,'"""'),AP(t,r+e.defaultIndentation,e),wn.indent(r)+Md(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[wn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Ud(s,e)){var u="- ";e.noColor||(u=Ar[e.dashColor](u)),u=wn.indent(r)+u,zu(s,!1,e)?(u+=ai(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,ai(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return ai({message:t.message,stack:t.stack.split(`
32
- `)},e,r);var o=e.noAlign?0:wn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Ud(t[s],e))if(i=s+": ",e.noColor||(i=Ar[e.keysColor](i)),i=wn.indent(r)+i,zu(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=ai(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,ai(t[s],e,r+e.defaultIndentation))}),a};La.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,ai(e,r,n).join(`
33
- `)};La.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)+`
34
- `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Ar.red("Error:")+" Not valid JSON!"}return o+=La.render(i,r,n),o}});var Vd=x(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.default=void 0;function si(t){"@babel/helpers - typeof";return si=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},si(t)}function $b(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,OP(n.key),n)}}function FP(t,e,r){return e&&$b(t.prototype,e),r&&$b(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function OP(t){var e=kP(t,"string");return si(e)=="symbol"?e:e+""}function kP(t,e){if(si(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(si(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $P(t,e,r){return e=Ma(e),TP(t,Hd()?Reflect.construct(e,r||[],Ma(t).constructor):e.apply(t,r))}function TP(t,e){if(e&&(si(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IP(t)}function IP(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RP(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&&Ua(t,e)}function qd(t){var e=typeof Map=="function"?new Map:void 0;return qd=function(n){if(n===null||!jP(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 BP(n,arguments,Ma(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ua(o,n)},qd(t)}function BP(t,e,r){if(Hd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ua(o,r.prototype),o}function Hd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Hd=function(){return!!t})()}function jP(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ua(t,e){return Ua=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ua(t,e)}function Ma(t){return Ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ma(t)}var NP=(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(PP(this,e),n=$P(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",p=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(p,", request id: ").concat(s,")")}return n.message=r,n}return RP(e,t),FP(e)})(qd(Error)),wz=Gu.default=NP});var zd=x(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.enableDebugLog=LP;Ku.log=UP;var Tb=!1;function LP(){Tb=!0}function UP(t){Tb&&console.log(t)}});var Rb=x(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.default=void 0;function qa(t){"@babel/helpers - typeof";return qa=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},qa(t)}function MP(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ib(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,HP(n.key),n)}}function qP(t,e,r){return e&&Ib(t.prototype,e),r&&Ib(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function HP(t){var e=VP(t,"string");return qa(e)=="symbol"?e:e+""}function VP(t,e){if(qa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ez=Wu.default=(function(){function t(){MP(this,t)}return qP(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 Bb=x((Gd,Kd)=>{(function(t,e){typeof Gd=="object"&&typeof Kd<"u"?Kd.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:Gd,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(T){var j={};return T.forEach(function(ee,V){return j[ee]=V}),j})(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(T){return new Uint8Array(Array.prototype.slice.call(T,0))},p=function(T){return T.replace(/=/g,"").replace(/[+\/]/g,function(j){return j=="+"?"-":"_"})},d=function(T){return T.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(T){for(var j,ee,V,se,hr="",G=T.length%3,Ee=0;Ee<T.length;){if((ee=T.charCodeAt(Ee++))>255||(V=T.charCodeAt(Ee++))>255||(se=T.charCodeAt(Ee++))>255)throw new TypeError("invalid character found");j=ee<<16|V<<8|se,hr+=a[j>>18&63]+a[j>>12&63]+a[j>>6&63]+a[j&63]}return G?hr.slice(0,G-3)+"===".substring(G):hr},m=typeof btoa=="function"?function(T){return btoa(T)}:r?function(T){return Buffer.from(T,"binary").toString("base64")}:h,b=r?function(T){return Buffer.from(T).toString("base64")}:function(T){for(var j=4096,ee=[],V=0,se=T.length;V<se;V+=j)ee.push(c.apply(null,T.subarray(V,V+j)));return m(ee.join(""))},D=function(T,j){return j===void 0&&(j=!1),j?p(b(T)):b(T)},C=function(T){if(T.length<2){var j=T.charCodeAt(0);return j<128?T:j<2048?c(192|j>>>6)+c(128|j&63):c(224|j>>>12&15)+c(128|j>>>6&63)+c(128|j&63)}else{var j=65536+(T.charCodeAt(0)-55296)*1024+(T.charCodeAt(1)-56320);return c(240|j>>>18&7)+c(128|j>>>12&63)+c(128|j>>>6&63)+c(128|j&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(T){return T.replace(E,C)},_=r?function(T){return Buffer.from(T,"utf8").toString("base64")}:o?function(T){return b(o.encode(T))}:function(T){return m(g(T))},S=function(T,j){return j===void 0&&(j=!1),j?p(_(T)):_(T)},P=function(T){return S(T,!0)},k=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(T){switch(T.length){case 4:var j=(7&T.charCodeAt(0))<<18|(63&T.charCodeAt(1))<<12|(63&T.charCodeAt(2))<<6|63&T.charCodeAt(3),ee=j-65536;return c((ee>>>10)+55296)+c((ee&1023)+56320);case 3:return c((15&T.charCodeAt(0))<<12|(63&T.charCodeAt(1))<<6|63&T.charCodeAt(2));default:return c((31&T.charCodeAt(0))<<6|63&T.charCodeAt(1))}},R=function(T){return T.replace(k,B)},N=function(T){if(T=T.replace(/\s+/g,""),!u.test(T))throw new TypeError("malformed base64.");T+="==".slice(2-(T.length&3));for(var j,ee,V,se=[],hr=0;hr<T.length;)j=s[T.charAt(hr++)]<<18|s[T.charAt(hr++)]<<12|(ee=s[T.charAt(hr++)])<<6|(V=s[T.charAt(hr++)]),ee===64?se.push(c(j>>16&255)):V===64?se.push(c(j>>16&255,j>>8&255)):se.push(c(j>>16&255,j>>8&255,j&255));return se.join("")},F=typeof atob=="function"?function(T){return atob(d(T))}:r?function(T){return Buffer.from(T,"base64").toString("binary")}:N,U=r?function(T){return l(Buffer.from(T,"base64"))}:function(T){return l(F(T).split("").map(function(j){return j.charCodeAt(0)}))},M=function(T){return U($(T))},Q=r?function(T){return Buffer.from(T,"base64").toString("utf8")}:n?function(T){return n.decode(U(T))}:function(T){return R(F(T))},$=function(T){return d(T.replace(/[-_]/g,function(j){return j=="-"?"+":"/"}))},y=function(T){return Q($(T))},w=function(T){if(typeof T!="string")return!1;var j=T.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(j)||!/[^\s0-9a-zA-Z\-_]/.test(j)},v=function(T){return{value:T,enumerable:!1,writable:!0,configurable:!0}},A=function(){var T=function(j,ee){return Object.defineProperty(String.prototype,j,v(ee))};T("fromBase64",function(){return y(this)}),T("toBase64",function(j){return S(this,j)}),T("toBase64URI",function(){return S(this,!0)}),T("toBase64URL",function(){return S(this,!0)}),T("toUint8Array",function(){return M(this)})},I=function(){var T=function(j,ee){return Object.defineProperty(Uint8Array.prototype,j,v(ee))};T("toBase64",function(j){return D(this,j)}),T("toBase64URI",function(){return D(this,!0)}),T("toBase64URL",function(){return D(this,!0)})},O=function(){A(),I()},q={version:t,VERSION:e,atob:F,atobPolyfill:N,btoa:m,btoaPolyfill:h,fromBase64:y,toBase64:S,encode:S,encodeURI:P,encodeURL:P,utob:g,btou:R,decode:y,isValid:w,fromUint8Array:D,toUint8Array:M,extendString:A,extendUint8Array:I,extendBuiltins:O};return q.Base64={},Object.keys(q).forEach(function(T){return q.Base64[T]=q[T]}),q})});var Nb=x((xz,jb)=>{"use strict";jb.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 Mb=x(Wd=>{"use strict";var zP=Object.prototype.hasOwnProperty,GP;function Lb(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Ub(t){try{return encodeURIComponent(t)}catch{return null}}function KP(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Lb(n[1]),i=Lb(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function WP(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(zP.call(t,o)){if(n=t[o],!n&&(n===null||n===GP||isNaN(n))&&(n=""),o=Ub(o),n=Ub(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Wd.stringify=WP;Wd.parse=KP});var Yb=x((Az,Wb)=>{"use strict";var Hb=Nb(),Yu=Mb(),YP=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Vb=/[\n\r\t]/g,JP=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,zb=/:\d+$/,XP=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,ZP=/^[a-zA-Z]:/;function Jd(t){return(t||"").toString().replace(YP,"")}var Yd=[["#","hash"],["?","query"],function(e,r){return Fr(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]],qb={hash:1,query:1};function Gb(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 Or(unescape(t.pathname),{});else if(o==="string"){n=new Or(t,{});for(i in qb)delete n[i]}else if(o==="object"){for(i in t)i in qb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=JP.test(t.href))}return n}function Fr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function Kb(t,e){t=Jd(t),t=t.replace(Vb,""),e=e||{};var r=XP.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)):Fr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Fr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Fr(n),slashesCount:a,rest:s}}function QP(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 Or(t,e,r){if(t=Jd(t),t=t.replace(Vb,""),!(this instanceof Or))return new Or(t,e,r);var n,o,i,a,s,u,c=Yd.slice(),l=typeof e,p=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Yu.parse),e=Gb(e),o=Kb(t||"",e),n=!o.protocol&&!o.slashes,p.slashes=o.slashes||n&&e.slashes,p.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||ZP.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Fr(p.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(a=c[d],typeof a=="function"){t=a(t,p);continue}i=a[0],u=a[1],i!==i?p[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(p[u]=t.slice(0,s),t=t.slice(s+a[2])):(p[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(p[u]=s[1],t=t.slice(0,s.index)),p[u]=p[u]||n&&a[3]&&e[u]||"",a[4]&&(p[u]=p[u].toLowerCase())}r&&(p.query=r(p.query)),n&&e.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||e.pathname!=="")&&(p.pathname=QP(p.pathname,e.pathname)),p.pathname.charAt(0)!=="/"&&Fr(p.protocol)&&(p.pathname="/"+p.pathname),Hb(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.indexOf(":"),~s?(p.username=p.auth.slice(0,s),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(s+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&Fr(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function e$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Yu.parse)(e)),n[t]=e;break;case"port":n[t]=e,Hb(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<Yd.length;a++){var s=Yd[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:"&&Fr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function t$(t){(!t||typeof t!="function")&&(t=Yu.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||Fr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Fr(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}Or.prototype={set:e$,toString:t$};Or.extractProtocol=Kb;Or.location=Gb;Or.trimLeft=Jd;Or.qs=Yu;Wb.exports=Or});var Jb=x(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});Xd.default=r$;function r$(){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 fw=x(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.default=void 0;var n$=Bb(),o$=eh(Yb()),Ju=eh(Vd()),Jn=zd(),i$=eh(Jb());function eh(t){return t&&t.__esModule?t:{default:t}}function Zd(){"use strict";Zd=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,A,I){return v[A]=I}}function l(y,w,v,A){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Xn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var A;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return A=A?A.then(T,T):T()}})}function N(y,w,v){var A=d;return function(I,O){if(A===m)throw Error("Generator is already running");if(A===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=F(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var j=p(y,w,v);if(j.type==="normal"){if(A=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(A=b,v.method="throw",v.arg=j.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(A,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(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 Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(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,A=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return A.next=A}}throw new TypeError(Xn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(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(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,A,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,A),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,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 A(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var I=A.completion;if(I.type==="throw"){var O=I.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function Xb(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 a$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Xb(i,n,o,a,s,"next",u)}function s(u){Xb(i,n,o,a,s,"throw",u)}a(void 0)})}}function aw(t,e){return c$(t)||u$(t,e)||sw(t,e)||s$()}function s$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u$(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 c$(t){if(Array.isArray(t))return t}function Xn(t){"@babel/helpers - typeof";return Xn=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},Xn(t)}function l$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=sw(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.
36
- 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 sw(t,e){if(t){if(typeof t=="string")return Zb(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 Zb(t,e)}}function Zb(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 Qb(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 ui(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Qb(Object(r),!0).forEach(function(n){f$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Qb(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function f$(t,e,r){return e=uw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ew(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,uw(n.key),n)}}function d$(t,e,r){return e&&ew(t.prototype,e),r&&ew(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function uw(t){var e=h$(t,"string");return Xn(e)=="symbol"?e:e+""}function h$(t,e){if(Xn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xu="tus-v1",Zu="ietf-draft-03",Ha="ietf-draft-05",m$={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:lw,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:Xu},cw=(function(){function t(e,r){p$(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 d$(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(![Xu,Zu,Ha].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,Jn.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Jn.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:D$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,p){l.uploadUrl=n._parallelUploadUrls[p]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,p){var d=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(b,D){var C=ui(ui({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ui(ui({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:b,onError:D,onProgress:function(_){i=i-d+_,d=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[p]=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=tw(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!ci(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=iw(n.options.endpoint,p),(0,Jn.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,Jn.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Jn.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Jn.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=l$(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 Ju.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),ow(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=tw(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===Zu||this.options.protocol===Ha)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!ci(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=iw(r.options.endpoint,s),(0,Jn.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(!ci(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(ci(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===Xu){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(!ci(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===Xu?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ha&&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===Zu||n.options.protocol===Ha)&&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=rw(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 nw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=rw("DELETE",r,n);return nw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new Ju.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof Ju.default||(i=new Ju.default("tus: failed to terminate upload",i,o,null)),!ow(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=ui(ui({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function tw(t){return Object.entries(t).map(function(e){var r=aw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(n$.Base64.encode(String(o)))}).join(",")}function ci(t,e){return t>=e&&t<e+100}function rw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Zu?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ha?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=aw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,i$.default)();n.setHeader("X-Request-ID",l)}return n}function nw(t,e,r){return Qd.apply(this,arguments)}function Qd(){return Qd=a$(Zd().mark(function t(e,r,n){var o;return Zd().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)})),Qd.apply(this,arguments)}function g$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function ow(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):lw(t)}function lw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!ci(e,400)||e===409||e===423)&&g$()}function iw(t,e){return new o$.default(e,t).toString()}function D$(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}cw.defaultOptions=m$;var Oz=Qu.default=cw});var dw=x((Pz,pw)=>{"use strict";var kr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";kr.writable=t=>kr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";kr.readable=t=>kr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";kr.duplex=t=>kr.writable(t)&&kr.readable(t);kr.transform=t=>kr.duplex(t)&&typeof t._transform=="function";pw.exports=kr});var mw=x(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.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 y$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hw(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,w$(n.key),n)}}function b$(t,e,r){return e&&hw(t.prototype,e),r&&hw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function w$(t){var e=v$(t,"string");return Va(e)=="symbol"?e:e+""}function v$(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 $z=ec.default=(function(){function t(e){y$(this,t),this._buffer=e,this.size=e.length}return b$(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 bw=x(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.default=A$;var yw=require("fs");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 th(){"use strict";th=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,A,I){return v[A]=I}}function l(y,w,v,A){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Zn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var A;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return A=A?A.then(T,T):T()}})}function N(y,w,v){var A=d;return function(I,O){if(A===m)throw Error("Generator is already running");if(A===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=F(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var j=p(y,w,v);if(j.type==="normal"){if(A=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(A=b,v.method="throw",v.arg=j.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(A,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(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 Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(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,A=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return A.next=A}}throw new TypeError(Zn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(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(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,A,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,A),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,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 A(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var I=A.completion;if(I.type==="throw"){var O=I.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function C$(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,_$(n.key),n)}}function E$(t,e,r){return e&&gw(t.prototype,e),r&&gw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _$(t){var e=x$(t,"string");return Zn(e)=="symbol"?e:e+""}function x$(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)}function Dw(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 S$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Dw(i,n,o,a,s,"next",u)}function s(u){Dw(i,n,o,a,s,"throw",u)}a(void 0)})}}function A$(t){return rh.apply(this,arguments)}function rh(){return rh=S$(th().mark(function t(e){var r,n,o,i,a,s,u;return th().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,yw.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 F$(e,n,u));case 9:case"end":return l.stop()}},t)})),rh.apply(this,arguments)}var F$=(function(){function t(e,r,n){C$(this,t),this._stream=e,this._path=r,this.size=n}return E$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,yw.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 ih=x(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.default=void 0;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 za(){"use strict";za=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,A,I){return v[A]=I}}function l(y,w,v,A){var I=w&&w.prototype instanceof C?w:C,O=Object.create(I.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(y,v,q)}),O}function p(y,w,v){try{return{type:"normal",arg:y.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",b="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(y){["next","throw","return"].forEach(function(w){c(y,w,function(v){return this._invoke(w,v)})})}function R(y,w){function v(I,O,q,T){var j=p(y[I],y,O);if(j.type!=="throw"){var ee=j.arg,V=ee.value;return V&&Qn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,T)},function(se){v("throw",se,q,T)}):w.resolve(V).then(function(se){ee.value=se,q(ee)},function(se){return v("throw",se,q,T)})}T(j.arg)}var A;o(this,"_invoke",{value:function(O,q){function T(){return new w(function(j,ee){v(O,q,j,ee)})}return A=A?A.then(T,T):T()}})}function N(y,w,v){var A=d;return function(I,O){if(A===m)throw Error("Generator is already running");if(A===b){if(I==="throw")throw O;return{value:t,done:!0}}for(v.method=I,v.arg=O;;){var q=v.delegate;if(q){var T=F(q,v);if(T){if(T===D)continue;return T}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=b,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var j=p(y,w,v);if(j.type==="normal"){if(A=v.done?b:h,j.arg===D)continue;return{value:j.arg,done:v.done}}j.type==="throw"&&(A=b,v.method="throw",v.arg=j.arg)}}}function F(y,w){var v=w.method,A=y.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&y.iterator.return&&(w.method="return",w.arg=t,F(y,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var I=p(A,y.iterator,w.arg);if(I.type==="throw")return w.method="throw",w.arg=I.arg,w.delegate=null,D;var O=I.arg;return O?O.done?(w[y.resultName]=O.value,w.next=y.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(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 Q(y){this.tryEntries=[{tryLoc:"root"}],y.forEach(U,this),this.reset(!0)}function $(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,A=function I(){for(;++v<y.length;)if(n.call(y,v))return I.value=y[v],I.done=!1,I;return I.value=t,I.done=!0,I};return A.next=A}}throw new TypeError(Qn(y)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(y){var w=typeof y=="function"&&y.constructor;return!!w&&(w===E||(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(k),y},e.awrap=function(y){return{__await:y}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(y,w,v,A,I){I===void 0&&(I=Promise);var O=new R(l(y,w,v,A),I);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(y){var w=Object(y),v=[];for(var A in w)v.push(A);return v.reverse(),function I(){for(;v.length;){var O=v.pop();if(O in w)return I.value=O,I.done=!1,I}return I.done=!0,I}},e.values=$,Q.prototype={constructor:Q,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 A(ee,V){return q.type="throw",q.arg=w,v.next=ee,V&&(v.method="next",v.arg=t),!!V}for(var I=this.tryEntries.length-1;I>=0;--I){var O=this.tryEntries[I],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var T=n.call(O,"catchLoc"),j=n.call(O,"finallyLoc");if(T&&j){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(T){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!j)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.tryLoc<=this.prev&&n.call(I,"finallyLoc")&&this.prev<I.finallyLoc){var O=I;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var I=A.completion;if(I.type==="throw"){var O=I.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function O$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ww(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&&ww(t.prototype,e),r&&ww(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function P$(t){var e=$$(t,"string");return Qn(e)=="symbol"?e:e+""}function $$(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 vw(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 Cw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){vw(i,n,o,a,s,"next",u)}function s(u){vw(i,n,o,a,s,"throw",u)}a(void 0)})}}function T$(t,e){return oh.apply(this,arguments)}function oh(){return oh=Cw(za().mark(function t(e,r){return za().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)})),oh.apply(this,arguments)}var Rz=tc.default=(function(){function t(e){var r=this;O$(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 k$(t,[{key:"slice",value:(function(){var e=Cw(za().mark(function n(o,i){var a,s,u,c,l;return za().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(o<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.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){d.next=10;break}return a.size=a.length,d.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){d.next=16;break}return d.next=14,T$(this._stream,c-a.length);case 14:l=d.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,d.abrupt("return",{value:a,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var _w=x(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.default=void 0;var I$=require("fs"),R$=rc(dw()),B$=rc(mw()),j$=rc(bw()),N$=rc(ih());function rc(t){return t&&t.__esModule?t:{default:t}}function Ga(t){"@babel/helpers - typeof";return Ga=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},Ga(t)}function L$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ew(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,M$(n.key),n)}}function U$(t,e,r){return e&&Ew(t.prototype,e),r&&Ew(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function M$(t){var e=q$(t,"string");return Ga(e)=="symbol"?e:e+""}function q$(t,e){if(Ga(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ga(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jz=nc.default=(function(){function t(){L$(this,t)}return U$(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new B$.default(r)):r instanceof I$.ReadStream&&r.path!=null?(0,j$.default)(r):R$.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new N$.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 Fw=x(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.default=z$;var H$=require("crypto"),xw=Aw(require("fs")),V$=Aw(require("path"));function Sw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Sw=function(n){return n?r:e})(t)}function Aw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Sw(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 z$(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,H$.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof xw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=V$.resolve(t.path);xw.stat(t.path,function(c,l){if(c){s(c);return}var p=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(p)})}):Promise.resolve(null)}});var Tw=x((Uz,$w)=>{var Pw="Expected a function",Ow=NaN,G$="[object Symbol]",K$=/^\s+|\s+$/g,W$=/^[-+]0x[0-9a-f]+$/i,Y$=/^0b[01]+$/i,J$=/^0o[0-7]+$/i,X$=parseInt,Z$=typeof global=="object"&&global&&global.Object===Object&&global,Q$=typeof self=="object"&&self&&self.Object===Object&&self,eT=Z$||Q$||Function("return this")(),tT=Object.prototype,rT=tT.toString,nT=Math.max,oT=Math.min,sh=function(){return eT.Date.now()};function iT(t,e,r){var n,o,i,a,s,u,c=0,l=!1,p=!1,d=!0;if(typeof t!="function")throw new TypeError(Pw);e=kw(e)||0,oc(r)&&(l=!!r.leading,p="maxWait"in r,i=p?nT(kw(r.maxWait)||0,e):i,d="trailing"in r?!!r.trailing:d);function h(P){var k=n,B=o;return n=o=void 0,c=P,a=t.apply(B,k),a}function m(P){return c=P,s=setTimeout(C,e),l?h(P):a}function b(P){var k=P-u,B=P-c,R=e-k;return p?oT(R,i-B):R}function D(P){var k=P-u,B=P-c;return u===void 0||k>=e||k<0||p&&B>=i}function C(){var P=sh();if(D(P))return E(P);s=setTimeout(C,b(P))}function E(P){return s=void 0,d&&n?h(P):(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(sh())}function S(){var P=sh(),k=D(P);if(n=arguments,o=this,u=P,k){if(s===void 0)return m(u);if(p)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return S.cancel=g,S.flush=_,S}function aT(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(Pw);return oc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),iT(t,e,{leading:n,maxWait:e,trailing:o})}function oc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sT(t){return!!t&&typeof t=="object"}function uT(t){return typeof t=="symbol"||sT(t)&&rT.call(t)==G$}function kw(t){if(typeof t=="number")return t;if(uT(t))return Ow;if(oc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=oc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(K$,"");var r=Y$.test(t);return r||J$.test(t)?X$(t.slice(2),r?2:8):W$.test(t)?Ow:+t}$w.exports=aT});var qw=x(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;var cT=Lw(require("http")),lT=Lw(require("https")),Bw=require("stream"),fT=require("url"),jw=pT(Tw());function pT(t){return t&&t.__esModule?t:{default:t}}function Nw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Nw=function(n){return n?r:e})(t)}function Lw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Nw(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 dT(t,e,r){return e=ic(e),hT(t,Uw()?Reflect.construct(e,r||[],ic(t).constructor):e.apply(t,r))}function hT(t,e){if(e&&(li(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mT(t)}function mT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Uw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Uw=function(){return!!t})()}function ic(t){return ic=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ic(t)}function gT(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&&uh(t,e)}function uh(t,e){return uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},uh(t,e)}function Iw(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 Ka(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Iw(Object(r),!0).forEach(function(n){DT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Iw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function DT(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 li(t){"@babel/helpers - typeof";return li=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},li(t)}function ac(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,Mw(n.key),n)}}function sc(t,e,r){return e&&Rw(t.prototype,e),r&&Rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Mw(t){var e=yT(t,"string");return li(e)=="symbol"?e:e+""}function yT(t,e){if(li(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(li(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Mz=uc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ac(this,t),this._requestOptions=e}return sc(t,[{key:"createRequest",value:function(r,n){return new bT(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),bT=(function(){function t(e,r,n){ac(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return sc(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=Ka(Ka(Ka({},(0,fT.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Ka(Ka({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?lT:cT;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(p){l.push(p)}),c.on("end",function(){var p=Buffer.concat(l).toString("utf8");o(new wT(c,p))})}),u.on("error",function(c){i(c)}),n instanceof Bw.Readable?n.pipe(new vT(r._progressHandler)).pipe(u):n instanceof Uint8Array?CT(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}}])})(),wT=(function(){function t(e,r){ac(this,t),this._response=e,this._body=r}return sc(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}}])})(),vT=(function(t){function e(r){var n;return ac(this,e),n=dT(this,e),n._onprogress=(0,jw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return gT(e,t),sc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(Bw.Transform),CT=function(e,r,n){n=(0,jw.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 Hw=x(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(`
27
+ `)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function SD(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 Pf(){if(we.env.NO_COLOR||we.env.FORCE_COLOR==="0"||we.env.FORCE_COLOR==="false")return!1;if(we.env.FORCE_COLOR||we.env.CLICOLOR_FORCE!==void 0)return!0}$f.Command=kf;$f.useColor=Pf});var kD=x(Zt=>{var{Argument:AD}=Ws(),{Command:If}=xD(),{CommanderError:K2,InvalidArgumentError:FD}=ya(),{Help:G2}=Ef(),{Option:OD}=Af();Zt.program=new If;Zt.createCommand=t=>new If(t);Zt.createOption=(t,e)=>new OD(t,e);Zt.createArgument=(t,e)=>new AD(t,e);Zt.Command=If;Zt.Option=OD;Zt.Argument=AD;Zt.Help=G2;Zt.CommanderError=K2;Zt.InvalidArgumentError=FD;Zt.InvalidOptionArgumentError=FD});var Rf=x((J7,$D)=>{"use strict";var Tf={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"},Y2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},J2={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?Tf.up():"");return t&&(e+=Tf.left),e}};$D.exports={cursor:Tf,scroll:Y2,erase:J2,beep:"\x07"}});var Lf=x((X7,Bf)=>{var Xs=process||{},ID=Xs.argv||[],Js=Xs.env||{},X2=!(Js.NO_COLOR||ID.includes("--no-color"))&&(!!Js.FORCE_COLOR||ID.includes("--color")||Xs.platform==="win32"||(Xs.stdout||{}).isTTY&&Js.TERM!=="dumb"||!!Js.CI),Z2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+Q2(o,e,r,i)+e:t+o+e},Q2=(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)},TD=(t=X2)=>{let e=t?Z2:()=>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")}};Bf.exports=TD();Bf.exports.createColors=TD});var au=x(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.isNXMonorepo=Tt.isMonorepo=Tt.findPackageRelativePathInMonorepo=Tt.findPackagePath=Tt.findNXMonorepoRoot=Tt.findMonorepoRoot=void 0;var va=require("node:fs"),hn=require("node:path");function iu(t){let e=(0,hn.join)(t,"package.json"),r=(0,hn.join)(t,"pnpm-workspace.yaml");if((0,va.existsSync)(r)||(0,va.existsSync)(e)&&JSON.parse((0,va.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,hn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return iu(n)}Tt.findMonorepoRoot=iu;function Jf(t){let e=(0,hn.join)(t,"nx.json");if((0,va.existsSync)(e))return t;let r=(0,hn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Jf(r)}Tt.findNXMonorepoRoot=Jf;function Xf(t,e,r){let n=(0,hn.join)(e,"node_modules",t);if((0,va.existsSync)(n))return n;if(e===r)return null;let o=(0,hn.dirname)(e);return Xf(t,o,r)}Tt.findPackagePath=Xf;function PO(t,e){let r=iu(e),n=Xf(t,e,r);return n?(0,hn.relative)(e,n):null}Tt.findPackageRelativePathInMonorepo=PO;function $O(t){try{return iu(t),!0}catch{return!1}}Tt.isMonorepo=$O;function IO(t){try{return Jf(t),!0}catch{return!1}}Tt.isNXMonorepo=IO});var pe={};Vr(pe,{__addDisposableResource:()=>By,__assign:()=>du,__asyncDelegator:()=>Fy,__asyncGenerator:()=>Ay,__asyncValues:()=>Oy,__await:()=>Go,__awaiter:()=>vy,__classPrivateFieldGet:()=>Iy,__classPrivateFieldIn:()=>Ry,__classPrivateFieldSet:()=>Ty,__createBinding:()=>mu,__decorate:()=>hy,__disposeResources:()=>Ly,__esDecorate:()=>gy,__exportStar:()=>Ey,__extends:()=>py,__generator:()=>Cy,__importDefault:()=>$y,__importStar:()=>Py,__makeTemplateObject:()=>ky,__metadata:()=>wy,__param:()=>my,__propKey:()=>yy,__read:()=>ap,__rest:()=>dy,__rewriteRelativeImportExtension:()=>Ny,__runInitializers:()=>Dy,__setFunctionName:()=>by,__spread:()=>_y,__spreadArray:()=>xy,__spreadArrays:()=>Sy,__values:()=>hu,default:()=>nk});function py(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");op(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function dy(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 hy(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 my(t,e){return function(r,n){e(r,n,t)}}function gy(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):{}),p,d=!1,h=r.length-1;h>=0;h--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(C){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(C||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");(p=a(D.get))&&(l.get=p),(p=a(D.set))&&(l.set=p),(p=a(D.init))&&o.unshift(p)}else(p=a(D))&&(s==="field"?o.unshift(p):l[u]=p)}c&&Object.defineProperty(c,n.name,l),d=!0}function Dy(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 yy(t){return typeof t=="symbol"?t:"".concat(t)}function by(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 wy(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function vy(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(p){a(p)}}function u(l){try{c(n.throw(l))}catch(p){a(p)}}function c(l){l.done?i(l.value):o(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function Cy(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 Ey(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&mu(e,t,r)}function hu(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 ap(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 _y(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(ap(arguments[e]));return t}function Sy(){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 xy(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 Ay(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,p)}}function s(h,m){n[h]&&(o[h]=function(y){return new Promise(function(D,C){i.push([h,y,D,C])>1||u(h,y)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(y){d(i[0][3],y)}}function c(h){h.value instanceof Go?Promise.resolve(h.value.v).then(l,p):d(i[0][2],h)}function l(h){u("next",h)}function p(h){u("throw",h)}function d(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function Fy(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 Oy(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 hu=="function"?hu(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 ky(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function Py(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=ip(t),n=0;n<r.length;n++)r[n]!=="default"&&mu(e,t,r[n]);return tk(e,t),e}function $y(t){return t&&t.__esModule?t:{default:t}}function Iy(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 Ty(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 Ry(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 By(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 Ly(t){function e(i){t.error=t.hasError?new rk(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 Ny(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 op,du,mu,tk,ip,rk,nk,de=rt(()=>{op=function(t,e){return op=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])},op(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)};mu=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]});tk=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},ip=function(t){return ip=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},ip(t)};rk=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};nk={__extends:py,__assign:du,__rest:dy,__decorate:hy,__param:my,__esDecorate:gy,__runInitializers:Dy,__propKey:yy,__setFunctionName:by,__metadata:wy,__awaiter:vy,__generator:Cy,__createBinding:mu,__exportStar:Ey,__values:hu,__read:ap,__spread:_y,__spreadArrays:Sy,__spreadArray:xy,__await:Go,__asyncGenerator:Ay,__asyncDelegator:Fy,__asyncValues:Oy,__makeTemplateObject:ky,__importStar:Py,__importDefault:$y,__classPrivateFieldGet:Iy,__classPrivateFieldSet:Ty,__classPrivateFieldIn:Ry,__addDisposableResource:By,__disposeResources:Ly,__rewriteRelativeImportExtension:Ny}});var jy=x(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});gu.resolveFetch=void 0;var ok=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);gu.resolveFetch=ok});var lp=x(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.FunctionRegion=er.FunctionsHttpError=er.FunctionsRelayError=er.FunctionsFetchError=er.FunctionsError=void 0;var Wo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};er.FunctionsError=Wo;var sp=class extends Wo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};er.FunctionsFetchError=sp;var up=class extends Wo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};er.FunctionsRelayError=up;var cp=class extends Wo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};er.FunctionsHttpError=cp;var Uy;(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"})(Uy||(er.FunctionRegion=Uy={}))});var My=x(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.FunctionsClient=void 0;var ik=(de(),ne(pe)),ak=jy(),Kn=lp(),fp=class{constructor(e,{headers:r={},customFetch:n,region:o=Kn.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,ak.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return ik.__awaiter(this,arguments,void 0,function*(r,n={}){var o;try{let{headers:i,method:a,body:s,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let p=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,p.searchParams.set("forceFunctionRegion",l));let d;s&&(i&&!Object.prototype.hasOwnProperty.call(i,"Content-Type")||!i)?typeof Blob<"u"&&s instanceof Blob||s instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=s):typeof s=="string"?(c["Content-Type"]="text/plain",d=s):typeof FormData<"u"&&s instanceof FormData?d=s:(c["Content-Type"]="application/json",d=JSON.stringify(s)):d=s;let h=yield this.fetch(p.toString(),{method:a||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),i),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new Kn.FunctionsFetchError(C)}),m=h.headers.get("x-relay-error");if(m&&m==="true")throw new Kn.FunctionsRelayError(h);if(!h.ok)throw new Kn.FunctionsHttpError(h);let y=((o=h.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),D;return y==="application/json"?D=yield h.json():y==="application/octet-stream"||y==="application/pdf"?D=yield h.blob():y==="text/event-stream"?D=h:y==="multipart/form-data"?D=yield h.formData():D=yield h.text(),{data:D,error:null,response:h}}catch(i){return i instanceof Error&&i.name==="AbortError"?{data:null,error:new Kn.FunctionsFetchError(i)}:{data:null,error:i,response:i instanceof Kn.FunctionsHttpError||i instanceof Kn.FunctionsRelayError?i.context:void 0}}})}};Du.FunctionsClient=fp});var pp=x(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.FunctionRegion=Rt.FunctionsRelayError=Rt.FunctionsHttpError=Rt.FunctionsFetchError=Rt.FunctionsError=Rt.FunctionsClient=void 0;var sk=My();Object.defineProperty(Rt,"FunctionsClient",{enumerable:!0,get:function(){return sk.FunctionsClient}});var xa=lp();Object.defineProperty(Rt,"FunctionsError",{enumerable:!0,get:function(){return xa.FunctionsError}});Object.defineProperty(Rt,"FunctionsFetchError",{enumerable:!0,get:function(){return xa.FunctionsFetchError}});Object.defineProperty(Rt,"FunctionsHttpError",{enumerable:!0,get:function(){return xa.FunctionsHttpError}});Object.defineProperty(Rt,"FunctionsRelayError",{enumerable:!0,get:function(){return xa.FunctionsRelayError}});Object.defineProperty(Rt,"FunctionRegion",{enumerable:!0,get:function(){return xa.FunctionRegion}})});var mp=x(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var dp=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};hp.default=dp});var yp=x(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var uk=(de(),ne(pe)),ck=uk.__importDefault(mp()),gp=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,p=null,d=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"))?p=E:p=JSON.parse(E))}let D=(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("/");D&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(l={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,d=null,h=406,m="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let D=await i.text();try{l=JSON.parse(D),Array.isArray(l)&&i.status===404&&(p=[],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 ck.default(l)}return{error:l,data:p,count:d,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u;return{error:{message:`${(a=i?.name)!==null&&a!==void 0?a:"FetchError"}: ${i?.message}`,details:`${(s=i?.stack)!==null&&s!==void 0?s:""}`,hint:"",code:`${(u=i?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Dp.default=gp});var vp=x(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var lk=(de(),ne(pe)),fk=lk.__importDefault(yp()),bp=class extends fk.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}};wp.default=bp});var yu=x(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var pk=(de(),ne(pe)),dk=pk.__importDefault(vp()),hk=new RegExp("[,()]"),Cp=class extends dk.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}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&hk.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}};Ep.default=Cp});var xp=x(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var mk=(de(),ne(pe)),Aa=mk.__importDefault(yu()),_p=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 Aa.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 Aa.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 Aa.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 Aa.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 Aa.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Sp.default=_p});var Hy=x(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var qy=(de(),ne(pe)),gk=qy.__importDefault(xp()),Dk=qy.__importDefault(yu()),Ap=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){let r=new URL(`${this.url}/${e}`);return new gk.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(([p,d])=>d!==void 0).map(([p,d])=>[p,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([p,d])=>{u.searchParams.append(p,d)})):(s="POST",c=r);let l=new Headers(this.headers);return i&&l.set("Prefer",`count=${i}`),new Dk.default({method:s,url:u,headers:l,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Fp.default=Ap});var Op=x(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.PostgrestError=xt.PostgrestBuilder=xt.PostgrestTransformBuilder=xt.PostgrestFilterBuilder=xt.PostgrestQueryBuilder=xt.PostgrestClient=void 0;var Yo=(de(),ne(pe)),Vy=Yo.__importDefault(Hy());xt.PostgrestClient=Vy.default;var zy=Yo.__importDefault(xp());xt.PostgrestQueryBuilder=zy.default;var Ky=Yo.__importDefault(yu());xt.PostgrestFilterBuilder=Ky.default;var Gy=Yo.__importDefault(vp());xt.PostgrestTransformBuilder=Gy.default;var Wy=Yo.__importDefault(yp());xt.PostgrestBuilder=Wy.default;var Yy=Yo.__importDefault(mp());xt.PostgrestError=Yy.default;xt.default={PostgrestClient:Vy.default,PostgrestQueryBuilder:zy.default,PostgrestFilterBuilder:Ky.default,PostgrestTransformBuilder:Gy.default,PostgrestBuilder:Wy.default,PostgrestError:Yy.default}});var Pp={};Vr(Pp,{RealtimeClient:()=>kp});var kp,$p=rt(()=>{kp=class{constructor(){}connect(){}disconnect(){}}});var Dn=x(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.StorageUnknownError=Gr.StorageApiError=Gr.StorageError=void 0;Gr.isStorageError=yk;var Fa=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Gr.StorageError=Fa;function yk(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ip=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}}};Gr.StorageApiError=Ip;var Tp=class extends Fa{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Gr.StorageUnknownError=Tp});var Oa=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.isPlainObject=tr.recursiveToCamel=tr.resolveResponse=tr.resolveFetch=void 0;var bk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);tr.resolveFetch=bk;var wk=()=>Response;tr.resolveResponse=wk;var vk=t=>{if(Array.isArray(t))return t.map(r=>(0,tr.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,tr.recursiveToCamel)(n)}),e};tr.recursiveToCamel=vk;var Ck=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)};tr.isPlainObject=Ck});var bu=x(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:!0});Wn.get=Sk;Wn.post=xk;Wn.put=Ak;Wn.head=Fk;Wn.remove=Ok;var Gn=(de(),ne(pe)),Rp=Dn(),Jy=Oa(),Bp=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)},Ek=(t,e,r)=>Gn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,Jy.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new Rp.StorageApiError(Bp(o),i,a))}).catch(o=>{e(new Rp.StorageUnknownError(Bp(o),o))}):e(new Rp.StorageUnknownError(Bp(t),t))}),_k=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Jy.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 ka(t,e,r,n,o,i){return Gn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,_k(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>Ek(u,s,n))})})}function Sk(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return ka(t,"GET",e,r,n)})}function xk(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return ka(t,"POST",e,n,o,r)})}function Ak(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return ka(t,"PUT",e,n,o,r)})}function Fk(t,e,r,n){return Gn.__awaiter(this,void 0,void 0,function*(){return ka(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function Ok(t,e,r,n,o){return Gn.__awaiter(this,void 0,void 0,function*(){return ka(t,"DELETE",e,n,o,r)})}});var Xy=x(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var kk=(de(),ne(pe)),Pk=Dn(),Lp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return kk.__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,Pk.isStorageError)(e))return{data:null,error:e};throw e}})}};Np.default=Lp});var e0=x(Up=>{"use strict";var Zy;Object.defineProperty(Up,"__esModule",{value:!0});var Qy=(de(),ne(pe)),$k=Dn(),Ik=Qy.__importDefault(Xy()),jp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[Zy]="BlobDownloadBuilder",this.promise=null}asStream(){return new Ik.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 Qy.__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,$k.isStorageError)(e))return{data:null,error:e};throw e}})}};Zy=Symbol.toStringTag;Up.default=jp});var n0=x(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var At=(de(),ne(pe)),Bt=Dn(),Lt=bu(),t0=Oa(),Tk=At.__importDefault(e0()),Rk={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},r0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Mp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,t0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return At.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},r0),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),p=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:p.Id,fullPath:p.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Bt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return At.__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:r0.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 p=yield(0,Lt.put)(this.fetch,s.toString(),u,{headers:l});return{data:{path:i,fullPath:p.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Bt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return At.__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 Bt.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,Bt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return At.__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,Bt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return At.__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,Bt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return At.__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,Bt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return At.__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,Bt.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 Tk.default(u,this.shouldThrowOnError)}info(e){return At.__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,t0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Bt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return At.__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,Bt.isStorageError)(n)&&n instanceof Bt.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 At.__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,Bt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return At.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},Rk),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,Bt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return At.__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,Bt.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("&")}};qp.default=Mp});var Hp=x(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.version=void 0;wu.version="2.79.0"});var Vp=x(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.DEFAULT_HEADERS=void 0;var Bk=Hp();vu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Bk.version}`}});var o0=x(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var Jo=(de(),ne(pe)),Lk=Vp(),Xo=Dn(),Zo=bu(),Nk=Oa(),zp=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({},Lk.DEFAULT_HEADERS),r),this.fetch=(0,Nk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Jo.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Zo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Xo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Jo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Zo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Xo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Jo.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Zo.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,Xo.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return Jo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Zo.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,Xo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Jo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Zo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Xo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Jo.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Zo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Xo.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():""}};Kp.default=zp});var Zp=x(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Gp=(de(),ne(pe)),jk=Vp(),Wp=Dn(),Yp=bu(),Uk=Oa(),Jp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},jk.DEFAULT_HEADERS),r),this.fetch=(0,Uk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Gp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Yp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Wp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Gp.__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,Yp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Wp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Gp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Yp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Wp.isStorageError)(r))return{data:null,error:r};throw r}})}};Xp.default=Jp});var Eu=x(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.DEFAULT_HEADERS=void 0;var Mk=Hp();Cu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Mk.version}`,"Content-Type":"application/json"}});var Qo=x(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.StorageVectorsErrorCode=vr.StorageVectorsUnknownError=vr.StorageVectorsApiError=vr.StorageVectorsError=void 0;vr.isStorageVectorsError=qk;var Pa=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};vr.StorageVectorsError=Pa;function qk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Qp=class extends Pa{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}}};vr.StorageVectorsApiError=Qp;var ed=class extends Pa{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};vr.StorageVectorsUnknownError=ed;var i0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(i0||(vr.StorageVectorsErrorCode=i0={}))});var ei=x(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.validateVectorDimension=rr.normalizeToFloat32=rr.isPlainObject=rr.resolveResponse=rr.resolveFetch=void 0;var Hk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);rr.resolveFetch=Hk;var Vk=()=>Response;rr.resolveResponse=Vk;var zk=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)};rr.isPlainObject=zk;var Kk=t=>Array.from(new Float32Array(t));rr.normalizeToFloat32=Kk;var Gk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};rr.validateVectorDimension=Gk});var xu=x(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.get=Xk;ri.post=Zk;ri.put=Qk;ri.remove=eP;var ti=(de(),ne(pe)),_u=Qo(),Wk=ei(),a0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Yk=(t,e,r)=>ti.__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 _u.StorageVectorsApiError(a0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new _u.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new _u.StorageVectorsApiError(s,o,a))}}else e(new _u.StorageVectorsUnknownError(a0(t),t))}),Jk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Wk.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 Su(t,e,r,n,o,i){return ti.__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;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=>Yk(u,s,n))})})}function Xk(t,e,r,n){return ti.__awaiter(this,void 0,void 0,function*(){return Su(t,"GET",e,r,n)})}function Zk(t,e,r,n,o){return ti.__awaiter(this,void 0,void 0,function*(){return Su(t,"POST",e,n,o,r)})}function Qk(t,e,r,n,o){return ti.__awaiter(this,void 0,void 0,function*(){return Su(t,"PUT",e,n,o,r)})}function eP(t,e,r,n,o){return ti.__awaiter(this,void 0,void 0,function*(){return Su(t,"DELETE",e,n,o,r)})}});var nd=x(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});var Au=(de(),ne(pe)),tP=Eu(),Fu=Qo(),Ou=xu(),rP=ei(),td=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},tP.DEFAULT_HEADERS),r),this.fetch=(0,rP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Au.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ou.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Au.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Fu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Au.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Au.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ou.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Fu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};rd.default=td});var ad=x(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});var $a=(de(),ne(pe)),nP=Eu(),Ia=Qo(),Ta=xu(),oP=ei(),od=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},nP.DEFAULT_HEADERS),r),this.fetch=(0,oP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return $a.__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,Ta.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 $a.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ta.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 $a.__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,Ta.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 $a.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ta.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 $a.__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,Ta.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}})}};id.default=od});var cd=x(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var ku=(de(),ne(pe)),iP=Eu(),Pu=Qo(),$u=xu(),aP=ei(),sd=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},iP.DEFAULT_HEADERS),r),this.fetch=(0,aP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return ku.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,$u.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Pu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ku.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,$u.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Pu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return ku.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,$u.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Pu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ku.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,$u.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Pu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};ud.default=sd});var s0=x(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.VectorIndexScope=yn.VectorBucketScope=yn.StorageVectorsClient=void 0;var nr=(de(),ne(pe)),sP=nr.__importDefault(nd()),uP=nr.__importDefault(ad()),cP=nr.__importDefault(cd()),ld=class extends cP.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Iu(this.url,this.headers,e,this.fetch)}};yn.StorageVectorsClient=ld;var Iu=class extends sP.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 nr.__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 nr.__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 nr.__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 nr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Tu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};yn.VectorBucketScope=Iu;var Tu=class extends uP.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 nr.__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 nr.__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 nr.__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 nr.__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 nr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};yn.VectorIndexScope=Tu});var dd=x(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.validateVectorDimension=he.normalizeToFloat32=he.isPlainObject=he.resolveResponse=he.resolveFetch=he.isStorageVectorsError=he.StorageVectorsErrorCode=he.StorageVectorsUnknownError=he.StorageVectorsApiError=he.StorageVectorsError=he.VectorDataApi=he.VectorIndexApi=he.VectorBucketApi=he.VectorIndexScope=he.VectorBucketScope=he.StorageVectorsClient=void 0;var fd=(de(),ne(pe)),pd=s0();Object.defineProperty(he,"StorageVectorsClient",{enumerable:!0,get:function(){return pd.StorageVectorsClient}});Object.defineProperty(he,"VectorBucketScope",{enumerable:!0,get:function(){return pd.VectorBucketScope}});Object.defineProperty(he,"VectorIndexScope",{enumerable:!0,get:function(){return pd.VectorIndexScope}});var lP=cd();Object.defineProperty(he,"VectorBucketApi",{enumerable:!0,get:function(){return fd.__importDefault(lP).default}});var fP=nd();Object.defineProperty(he,"VectorIndexApi",{enumerable:!0,get:function(){return fd.__importDefault(fP).default}});var pP=ad();Object.defineProperty(he,"VectorDataApi",{enumerable:!0,get:function(){return fd.__importDefault(pP).default}});var Ra=Qo();Object.defineProperty(he,"StorageVectorsError",{enumerable:!0,get:function(){return Ra.StorageVectorsError}});Object.defineProperty(he,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ra.StorageVectorsApiError}});Object.defineProperty(he,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ra.StorageVectorsUnknownError}});Object.defineProperty(he,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ra.StorageVectorsErrorCode}});Object.defineProperty(he,"isStorageVectorsError",{enumerable:!0,get:function(){return Ra.isStorageVectorsError}});var Ba=ei();Object.defineProperty(he,"resolveFetch",{enumerable:!0,get:function(){return Ba.resolveFetch}});Object.defineProperty(he,"resolveResponse",{enumerable:!0,get:function(){return Ba.resolveResponse}});Object.defineProperty(he,"isPlainObject",{enumerable:!0,get:function(){return Ba.isPlainObject}});Object.defineProperty(he,"normalizeToFloat32",{enumerable:!0,get:function(){return Ba.normalizeToFloat32}});Object.defineProperty(he,"validateVectorDimension",{enumerable:!0,get:function(){return Ba.validateVectorDimension}})});var u0=x(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.StorageClient=void 0;var md=(de(),ne(pe)),dP=md.__importDefault(n0()),hP=md.__importDefault(o0()),mP=md.__importDefault(Zp()),gP=dd(),hd=class extends hP.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new dP.default(this.url,this.headers,e,this.fetch)}get vectors(){return new gP.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new mP.default(this.url+"/iceberg",this.headers,this.fetch)}};Ru.StorageClient=hd});var l0=x(c0=>{"use strict";Object.defineProperty(c0,"__esModule",{value:!0})});var f0=x(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.StorageAnalyticsApi=Wr.StorageClient=void 0;var Bu=(de(),ne(pe)),DP=u0();Object.defineProperty(Wr,"StorageClient",{enumerable:!0,get:function(){return DP.StorageClient}});var yP=Zp();Object.defineProperty(Wr,"StorageAnalyticsApi",{enumerable:!0,get:function(){return Bu.__importDefault(yP).default}});Bu.__exportStar(l0(),Wr);Bu.__exportStar(Dn(),Wr);Bu.__exportStar(dd(),Wr)});var p0=x(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.version=void 0;Lu.version="2.79.0"});var d0=x(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.DEFAULT_REALTIME_OPTIONS=zt.DEFAULT_AUTH_OPTIONS=zt.DEFAULT_DB_OPTIONS=zt.DEFAULT_GLOBAL_OPTIONS=zt.DEFAULT_HEADERS=void 0;var bP=p0(),La="";typeof Deno<"u"?La="deno":typeof document<"u"?La="web":typeof navigator<"u"&&navigator.product==="ReactNative"?La="react-native":La="node";zt.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${La}/${bP.version}`};zt.DEFAULT_GLOBAL_OPTIONS={headers:zt.DEFAULT_HEADERS};zt.DEFAULT_DB_OPTIONS={schema:"public"};zt.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};zt.DEFAULT_REALTIME_OPTIONS={}});var h0=x(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.fetchWithAuth=Ar.resolveHeadersConstructor=Ar.resolveFetch=void 0;var wP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Ar.resolveFetch=wP;var vP=()=>Headers;Ar.resolveHeadersConstructor=vP;var CP=(t,e,r)=>{let n=(0,Ar.resolveFetch)(r),o=(0,Ar.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}))}};Ar.fetchWithAuth=CP});var g0=x(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.isBrowser=void 0;bn.uuid=EP;bn.ensureTrailingSlash=m0;bn.applySettingDefaults=SP;bn.validateSupabaseUrl=xP;function EP(){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 m0(t){return t.endsWith("/")?t:t+"/"}var _P=()=>typeof window<"u";bn.isBrowser=_P;function SP(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:l,global:p}=e,d={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({},p),s),{headers:Object.assign(Object.assign({},(r=p?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function xP(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(m0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Fd={};Vr(Fd,{AuthAdminApi:()=>Dd,AuthApiError:()=>yd,AuthClient:()=>gd,AuthError:()=>Cr,AuthImplicitGrantRedirectError:()=>Ed,AuthInvalidCredentialsError:()=>Cd,AuthInvalidTokenResponseError:()=>vd,AuthPKCEGrantCodeExchangeError:()=>_d,AuthRetryableError:()=>bd,AuthSessionMissingError:()=>wd,AuthWeakPasswordError:()=>Sd,GoTrueAdminApi:()=>ju,GoTrueClient:()=>Nu,NavigatorLockAcquireTimeoutError:()=>xd,isAuthApiError:()=>PP,isAuthError:()=>kP,isAuthRetryableError:()=>$P,isAuthSessionMissingError:()=>IP,isAuthWeakPasswordError:()=>TP,lockInternals:()=>OP,navigatorLock:()=>AP,processLock:()=>FP});var Ad,D0,Nu,ju,gd,Dd,Cr,yd,bd,wd,vd,Cd,Ed,_d,Sd,AP,FP,xd,OP,kP,PP,$P,IP,TP,Od=rt(()=>{Ad=()=>Promise.resolve({data:{session:null,user:null},error:null}),D0={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}):Ad}},Nu=class{constructor(e){return this.options=e,new Proxy(this,D0)}},ju=class{constructor(e){return this.options=e,new Proxy(this,D0)}},gd=class extends Nu{},Dd=class extends ju{},Cr=class extends Error{},yd=class extends Cr{},bd=class extends Cr{},wd=class extends Cr{},vd=class extends Cr{},Cd=class extends Cr{},Ed=class extends Cr{},_d=class extends Cr{},Sd=class extends Cr{},AP=Ad,FP=Ad,xd=class extends Error{},OP={},kP=()=>!1,PP=()=>!1,$P=()=>!1,IP=()=>!1,TP=()=>!1});var y0=x(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.SupabaseAuthClient=void 0;var RP=(Od(),ne(Fd)),kd=class extends RP.AuthClient{constructor(e){super(e)}};Uu.SupabaseAuthClient=kd});var Id=x($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var BP=pp(),LP=Op(),NP=($p(),ne(Pp)),jP=f0(),Mu=d0(),UP=h0(),b0=g0(),MP=y0(),Pd=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,b0.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:Mu.DEFAULT_DB_OPTIONS,realtime:Mu.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Mu.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Mu.DEFAULT_GLOBAL_OPTIONS},l=(0,b0.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:(p,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=l.auth)!==null&&a!==void 0?a:{},this.headers,l.global.fetch),this.fetch=(0,UP.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.rest=new LP.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new jP.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new BP.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},p,d){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new MP.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),p),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new NP.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)}};$d.default=Pd});var C0=x(Re=>{"use strict";var qP=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]})),w0=Re&&Re.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&qP(e,t,r)},v0=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 HP=v0(Id());w0((Od(),ne(Fd)),Re);var VP=Op();Object.defineProperty(Re,"PostgrestError",{enumerable:!0,get:function(){return VP.PostgrestError}});var Na=pp();Object.defineProperty(Re,"FunctionsHttpError",{enumerable:!0,get:function(){return Na.FunctionsHttpError}});Object.defineProperty(Re,"FunctionsFetchError",{enumerable:!0,get:function(){return Na.FunctionsFetchError}});Object.defineProperty(Re,"FunctionsRelayError",{enumerable:!0,get:function(){return Na.FunctionsRelayError}});Object.defineProperty(Re,"FunctionsError",{enumerable:!0,get:function(){return Na.FunctionsError}});Object.defineProperty(Re,"FunctionRegion",{enumerable:!0,get:function(){return Na.FunctionRegion}});w0(($p(),ne(Pp)),Re);var zP=Id();Object.defineProperty(Re,"SupabaseClient",{enumerable:!0,get:function(){return v0(zP).default}});var KP=(t,e,r)=>new HP.default(t,e,r);Re.createClient=KP;function GP(){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}GP()&&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 Td=x((zV,E0)=>{E0.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 qu=x(S0=>{var _0={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 WP(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(_0))S0[t]=WP(_0[t])});var k0=x((GV,O0)=>{var YP=require("fs"),nt=require("path"),x0=Td(),JP=qu(),XP=typeof process=="object"&&process.platform==="win32",A0=t=>typeof t=="object"&&t!==null,F0=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=YP,A0(t)&&A0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}O0.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 JP.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(p,d){p?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)})})})})}):d?i.fs.write(d,e,0,e.length,0,function(){i.fs.close(d,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,p){if(l)return e(l);n=n.concat(p),--a||e(null,n)}):--a||e(null,n))})})})};We.prototype.getAttributes=function(){};We.prototype.setAttributes=function(){};We.crc32update=function(t,e){return F0[(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 x0.STORED:return"STORED ("+t+")";case x0.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=XP;We.crcTable=F0});var $0=x((WV,P0)=>{var ZP=require("path");P0.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=ZP.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 T0=x((YV,I0)=>{I0.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var oi=x((JV,ni)=>{ni.exports=k0();ni.exports.Constants=Td();ni.exports.Errors=qu();ni.exports.FileAttr=$0();ni.exports.decoder=T0()});var B0=x((XV,R0)=>{var wn=oi(),W=wn.Constants;R0.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,p=0,d=0,h=0,m=0;t|=wn.isWin?2560:768,r|=W.FLG_EFS;let y={extraLen:0},D=g=>Math.max(0,g)>>>0,C=g=>Math.max(0,g)&65535,E=g=>Math.max(0,g)&255;return o=wn.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&W.FLG_EFS)>0},set flags_efs(g){g?r|=W.FLG_EFS:r&=~W.FLG_EFS},get flags_desc(){return(r&W.FLG_DESC)>0},set flags_desc(g){g?r|=W.FLG_DESC:r&=~W.FLG_DESC},get method(){return n},set method(g){switch(g){case W.STORED:this.version=10;case W.DEFLATED:default:this.version=20}n=g},get time(){return wn.fromDOS2Date(this.timeval)},set time(g){this.timeval=wn.fromDate2DOS(g)},get timeval(){return o},set timeval(g){o=D(g)},get timeHighByte(){return E(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 y.extraLen},set extraLocalLength(g){y.extraLen=g},get commentLength(){return l},set commentLength(g){l=g},get diskNumStart(){return p},set diskNumStart(g){p=D(g)},get inAttr(){return d},set inAttr(g){d=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&W.FLG_ENC)===W.FLG_ENC},get centralHeaderSize(){return W.CENHDR+u+c+l},get realDataOffset(){return m+W.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(g){var _=g.slice(m,m+W.LOCHDR);if(_.readUInt32LE(0)!==W.LOCSIG)throw wn.Errors.INVALID_LOC();y.version=_.readUInt16LE(W.LOCVER),y.flags=_.readUInt16LE(W.LOCFLG),y.method=_.readUInt16LE(W.LOCHOW),y.time=_.readUInt32LE(W.LOCTIM),y.crc=_.readUInt32LE(W.LOCCRC),y.compressedSize=_.readUInt32LE(W.LOCSIZ),y.size=_.readUInt32LE(W.LOCLEN),y.fnameLen=_.readUInt16LE(W.LOCNAM),y.extraLen=_.readUInt16LE(W.LOCEXT);let S=m+W.LOCHDR+y.fnameLen,P=S+y.extraLen;return g.slice(S,P)},loadFromBinary:function(g){if(g.length!==W.CENHDR||g.readUInt32LE(0)!==W.CENSIG)throw wn.Errors.INVALID_CEN();t=g.readUInt16LE(W.CENVEM),e=g.readUInt16LE(W.CENVER),r=g.readUInt16LE(W.CENFLG),n=g.readUInt16LE(W.CENHOW),o=g.readUInt32LE(W.CENTIM),i=g.readUInt32LE(W.CENCRC),a=g.readUInt32LE(W.CENSIZ),s=g.readUInt32LE(W.CENLEN),u=g.readUInt16LE(W.CENNAM),c=g.readUInt16LE(W.CENEXT),l=g.readUInt16LE(W.CENCOM),p=g.readUInt16LE(W.CENDSK),d=g.readUInt16LE(W.CENATT),h=g.readUInt32LE(W.CENATX),m=g.readUInt32LE(W.CENOFF)},localHeaderToBinary:function(){var g=Buffer.alloc(W.LOCHDR);return g.writeUInt32LE(W.LOCSIG,0),g.writeUInt16LE(e,W.LOCVER),g.writeUInt16LE(r,W.LOCFLG),g.writeUInt16LE(n,W.LOCHOW),g.writeUInt32LE(o,W.LOCTIM),g.writeUInt32LE(i,W.LOCCRC),g.writeUInt32LE(a,W.LOCSIZ),g.writeUInt32LE(s,W.LOCLEN),g.writeUInt16LE(u,W.LOCNAM),g.writeUInt16LE(y.extraLen,W.LOCEXT),g},centralHeaderToBinary:function(){var g=Buffer.alloc(W.CENHDR+u+c+l);return g.writeUInt32LE(W.CENSIG,0),g.writeUInt16LE(t,W.CENVEM),g.writeUInt16LE(e,W.CENVER),g.writeUInt16LE(r,W.CENFLG),g.writeUInt16LE(n,W.CENHOW),g.writeUInt32LE(o,W.CENTIM),g.writeUInt32LE(i,W.CENCRC),g.writeUInt32LE(a,W.CENSIZ),g.writeUInt32LE(s,W.CENLEN),g.writeUInt16LE(u,W.CENNAM),g.writeUInt16LE(c,W.CENEXT),g.writeUInt16LE(l,W.CENCOM),g.writeUInt16LE(p,W.CENDSK),g.writeUInt16LE(d,W.CENATT),g.writeUInt32LE(h,W.CENATX),g.writeUInt32LE(m,W.CENOFF),g},toJSON:function(){let g=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:wn.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:p,inAttr:d,attr:h,offset:m,centralHeaderSize:g(W.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var N0=x((ZV,L0)=>{var ii=oi(),Ve=ii.Constants;L0.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 ii.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=ii.readBigUInt64LE(i,Ve.ZIP64SUB),e=ii.readBigUInt64LE(i,Ve.ZIP64TOT),r=ii.readBigUInt64LE(i,Ve.ZIP64SIZE),n=ii.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 Bd=x(Rd=>{Rd.EntryHeader=B0();Rd.MainHeader=N0()});var U0=x((ez,j0)=>{j0.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 q0=x((tz,M0)=>{var QP=+(process.versions?process.versions.node:"").split(".")[0]||0;M0.exports=function(t,e){var r=require("zlib");let n=QP>=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 p=a[l];p.copy(u,c),c+=p.length}o&&o(u)}),i.end(t)}}}});var G0=x((rz,K0)=>{"use strict";var{randomFillSync:H0}=require("crypto"),e3=qu(),t3=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,V0=(t,e)=>t3[(t^e)&255]^t>>>8,ja=()=>typeof H0=="function"?H0(Buffer.alloc(12)):ja.node();ja.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 Hu={genSalt:ja};function Vu(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])}Vu.prototype.updateKeys=function(t){let e=this.keys;return e[0]=V0(e[0],t),e[1]+=e[0]&255,e[1]=z0(e[1],134775813)+1,e[2]=V0(e[2],e[1]>>>24),t};Vu.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return z0(t,t^1)>>8&255};function r3(t){let e=new Vu(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 n3(t){let e=new Vu(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 o3(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=r3(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw e3.WRONG_PASSWORD();return n(t.slice(12))}function i3(t){Buffer.isBuffer(t)&&t.length>=12?Hu.genSalt=function(){return t.slice(0,12)}:t==="node"?Hu.genSalt=ja.node:Hu.genSalt=ja}function a3(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=n3(r),i=Hu.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)}K0.exports={decrypt:o3,encrypt:a3,_salter:i3}});var W0=x(zu=>{zu.Deflater=U0();zu.Inflater=q0();zu.ZipCrypto=G0()});var Nd=x((oz,Y0)=>{var xe=oi(),s3=Bd(),Ye=xe.Constants,Ld=W0();Y0.exports=function(t,e){var r=new s3.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,p=typeof l.decoder=="object"?l.decoder:xe.decoder;c=p.hasOwnProperty("efs")?p.efs:!1;function d(){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 _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Ye.LOCSIG||e.readUInt32LE(S)==Ye.CENSIG)throw xe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Ye.EXTSIG)_.crc=e.readUInt32LE(S+Ye.EXTCRC),_.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ),_.size=e.readUInt32LE(S+Ye.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Ye.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Ye.EXTSIZ-4),_.size=e.readUInt32LE(S+Ye.EXTLEN-4);else throw xe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw xe.Errors.DESCRIPTOR_FAULTY();if(xe.crc32(g)!==_.crc)return!1}else if(xe.crc32(g)!==r.localHeader.crc)return!1;return!0}function m(g,_,S){if(typeof _>"u"&&typeof g=="string"&&(S=g,g=void 0),i)return g&&_&&_(Buffer.alloc(0),xe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var P=d();if(P.length===0)return g&&_&&_(P),P;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw xe.Errors.INVALID_PASS_PARAM();P=Ld.ZipCrypto.decrypt(P,r,S)}var k=Buffer.alloc(r.size);switch(r.method){case xe.Constants.STORED:if(P.copy(k),h(k))return g&&_&&_(k),k;throw g&&_&&_(k,xe.Errors.BAD_CRC()),xe.Errors.BAD_CRC();case xe.Constants.DEFLATED:var B=new Ld.Inflater(P,r.size);if(g)B.inflateAsync(function(R){R.copy(R,0),_&&(h(R)?_(R):_(R,xe.Errors.BAD_CRC()))});else{if(B.inflate(k).copy(k,0),!h(k))throw xe.Errors.BAD_CRC(`"${p.decode(n)}"`);return k}break;default:throw g&&_&&_(Buffer.alloc(0),xe.Errors.UNKNOWN_METHOD()),xe.Errors.UNKNOWN_METHOD()}}function y(g,_){if((!a||!a.length)&&Buffer.isBuffer(e))return g&&_&&_(d()),d();if(a.length&&!i){var S;switch(r.method){case xe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),g&&_&&_(S),S;default:case xe.Constants.DEFLATED:var P=new Ld.Deflater(a);if(g)P.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var k=P.deflate();return r.compressedSize=k.length,k}P=null;break}}else if(g&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(g,_){return(g.readUInt32LE(_+4)<<4)+g.readUInt32LE(_)}function C(g){try{for(var _=0,S,P,k;_+4<g.length;)S=g.readUInt16LE(_),_+=2,P=g.readUInt16LE(_),_+=2,k=g.slice(_,_+P),_+=P,Ye.ID_ZIP64===S&&E(k)}catch{throw xe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(g){var _,S,P,k;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&&(S=D(g,Ye.EF_ZIP64_SCOMP),r.compressedSize===Ye.EF_ZIP64_OR_32&&(r.compressedSize=S)),g.length>=Ye.EF_ZIP64_DSN&&(P=D(g,Ye.EF_ZIP64_RHO),r.offset===Ye.EF_ZIP64_OR_32&&(r.offset=P)),g.length>=Ye.EF_ZIP64_DSN+4&&(k=g.readUInt32LE(Ye.EF_ZIP64_DSN),r.diskNumStart===Ye.EF_ZIP64_OR_16&&(r.diskNumStart=k))}return{get entryName(){return p.decode(n)},get rawEntryName(){return n},set entryName(g){n=xe.toBuffer(g,p.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 p.decode(o)},set comment(g){if(o=xe.toBuffer(g,p.encode),r.commentLength=o.length,o.length>65535)throw xe.Errors.COMMENT_TOO_LONG()},get name(){var g=p.decode(n);return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(g){y(!0,g)},setData:function(g){a=xe.toBuffer(g,xe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=xe.Constants.DEFLATED,r.crc=xe.crc32(g),r.changed=!0):r.method=xe.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(),_=xe.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(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,g),g+=_.length,n.copy(S,g),g+=n.length,u.copy(S,g),g+=u.length,S},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 Z0=x((iz,X0)=>{var J0=Nd(),u3=Bd(),dt=oi();X0.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new u3.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:l,decoder:p}=c;t?m(c.readEntries):a=!0;function d(){let D=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("/")+"/";D.add(_)}}for(let C of D)if(!(C in n)){let E=new J0(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)/dt.Constants.CENHDR)throw dt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,C=0;C<r.length;C++){var E=D,g=new J0(c,t);g.header=t.slice(E,E+=dt.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)),D+=g.header.centralHeaderSize,r[C]=g,n[g.entryName]=g}u.clear(),d()}function m(D){var C=t.length-dt.Constants.ENDHDR,E=Math.max(0,C-65535),g=E,_=t.length,S=-1,P=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(E=0),C;C>=g;C--)if(t[C]===80){if(t.readUInt32LE(C)===dt.Constants.ENDSIG){S=C,P=C,_=C+dt.Constants.ENDHDR,g=C-dt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===dt.Constants.END64SIG){g=E;continue}if(t.readUInt32LE(C)===dt.Constants.ZIP64SIG){S=C,_=C+dt.readBigUInt64LE(t,C+dt.Constants.ZIP64SIZE)+dt.Constants.ZIP64LEAD;break}}if(S==-1)throw dt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(P+dt.Constants.ENDHDR)),D&&h()}function y(){r.length>1&&!l&&r.sort((D,C)=>D.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return p.decode(o)},set comment(D){o=dt.toBuffer(D,p.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,C=!0){a||h();let E=n[D];this.getEntryChildren(E,C).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let C=n[D],E=r.indexOf(C);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,C=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&C){let E=[],g=D.entryName;for(let _ of r)_.entryName.startsWith(g)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let C=this.getEntryChildren(D);return C.includes(D)?C.length-1:C.length}return 0},compressToBuffer:function(){a||h(),y();let D=[],C=[],E=0,g=0;i.size=0,i.offset=0;let _=0;for(let k of this.entries){let B=k.getCompressedData();k.header.offset=g;let R=k.packLocalHeader(),N=R.length+B.length;g+=N,D.push(R),D.push(B);let F=k.packCentralHeader();C.push(F),i.size+=F.length,E+=N+F.length,_++}E+=i.mainHeaderSize,i.offset=g,i.totalEntries=_,g=0;let S=Buffer.alloc(E);for(let k of D)k.copy(S,g),g+=k.length;for(let k of C)k.copy(S,g),g+=k.length;let P=i.toBinary();return o&&o.copy(P,dt.Constants.ENDHDR),P.copy(S,g),t=S,a=!1,S},toAsyncBuffer:function(D,C,E,g){try{a||h(),y();let _=[],S=[],P=0,k=0,B=0;i.size=0,i.offset=0;let R=function(N){if(N.length>0){let F=N.shift(),U=F.entryName+F.extra.toString();E&&E(U),F.getCompressedDataAsync(function(M){g&&g(U),F.header.offset=k;let Q=F.packLocalHeader(),$=Q.length+M.length;k+=$,_.push(Q),_.push(M);let b=F.packCentralHeader();S.push(b),i.size+=b.length,P+=$+b.length,B++,R(N)})}else{P+=i.mainHeaderSize,i.offset=k,i.totalEntries=B,k=0;let F=Buffer.alloc(P);_.forEach(function(M){M.copy(F,k),k+=M.length}),S.forEach(function(M){M.copy(F,k),k+=M.length});let U=i.toBinary();o&&o.copy(U,dt.Constants.ENDHDR),U.copy(F,k),t=F,a=!1,D(F)}};R(Array.from(this.entries))}catch(_){C(_)}}}}});var tb=x((az,eb)=>{var ze=oi(),Je=require("path"),c3=Nd(),l3=Z0(),Yn=(...t)=>ze.findLast(t,e=>typeof e=="boolean"),Q0=(...t)=>ze.findLast(t,e=>typeof e=="string"),f3=(...t)=>ze.findLast(t,e=>typeof e=="function"),p3={noSort:!1,readEntries:!1,method:ze.Constants.NONE,fs:null};eb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),p3);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 l3(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:y,sep:D}=Je.posix;return m(".",y(D+h.split("\\").join(D)+D))}function p(h){return h instanceof RegExp?(function(m){return function(y){return m.test(y)}})(h):typeof h!="function"?()=>!0:h}let d=(h,m)=>{let y=m.slice(-1);return y=y===o.sep?o.sep:"",Je.relative(h,m)+y};return{readFile:function(h,m){var y=c(h);return y&&y.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var y=c(h);y?y.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var y=c(h);if(y){var D=y.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,y){var D=c(h);D?D.getDataAsync(function(C,E){if(E){m(C,E);return}C&&C.length?m(C.toString(y||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var y=c(h);y&&i.deleteFile(y.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 y=c(h);y&&(y.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var y=c(h);y&&y.setData(m)},addLocalFile:function(h,m,y,D){if(o.fs.existsSync(h)){m=m?l(m):"";let C=Je.win32.basename(Je.win32.normalize(h));m+=y||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,D,E)}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let y=Je.resolve(h.localPath),{comment:D}=h,{zipPath:C,zipName:E}=h,g=this;o.fs.stat(y,function(_,S){if(_)return m(_,!1);C=C?l(C):"";let P=Je.win32.basename(Je.win32.normalize(y));if(C+=E||P,S.isFile())o.fs.readFile(y,function(k,B){return k?m(k,!1):(g.addFile(C,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return C+=o.sep,g.addFile(C,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,y){if(y=p(y),m=m?l(m):"",h=Je.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),C=this;if(D.length)for(let E of D){let g=Je.join(m,d(h,E));y(g)&&C.addLocalFile(E,Je.dirname(g))}}else throw ze.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,y,D){D=p(D),y=y?l(y):"",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,S=function(){if(_+=1,_<g.length){var P=g[_],k=d(h,P).split("\\").join("/");k=k.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(k)?o.fs.stat(P,function(B,R){B&&m(void 0,B),R.isFile()?o.fs.readFile(P,function(N,F){N?m(void 0,N):(C.addFile(y+k,F,"",R),S())}):(C.addFile(y+k+"/",Buffer.alloc(0),"",R),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let y=this;h=typeof h=="object"?h:{localPath:h},localPath=Je.resolve(l(h.localPath));let{zipPath:D,filter:C,namefix:E}=h;C instanceof RegExp?C=(function(S){return function(P){return S.test(P)}})(C):typeof C!="function"&&(C=function(){return!0}),D=D?l(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let g=S=>Je.join(D,E(d(localPath,S))),_=S=>Je.win32.basename(Je.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,ze.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(P,k){if(P)return m(P);k=k.filter(B=>C(g(B))),k.length||m(void 0,!1),setImmediate(k.reverse().reduce(function(B,R){return function(N,F){if(N||F===!1)return setImmediate(B,N,!1);y.addLocalFileAsync({localPath:R,zipPath:Je.dirname(g(R)),zipName:_(R)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((y,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(C,E)=>{C&&D(C),E&&y(this)})})},addFile:function(h,m,y,D){h=u(h);let C=c(h),E=C!=null;E||(C=new c3(n),C.entryName=h),C.comment=y||"";let g=typeof D=="object"&&D instanceof o.fs.Stats;g&&(C.header.time=D.mtime);var _=C.isDirectory?16:0;let S=C.isDirectory?16384:32768;return g?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=C.isDirectory?493:420,_=(_|S<<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,y,D,C,E){D=Yn(!1,D),C=Yn(!1,C),y=Yn(!0,y),E=Q0(C,E);var g=c(h);if(!g)throw ze.Errors.NO_ENTRY();var _=a(g.entryName),S=s(m,E&&!g.isDirectory?E:y?_:Je.basename(_));if(g.isDirectory){var P=i.getEntryChildren(g);return P.forEach(function(R){if(R.isDirectory)return;var N=R.getData();if(!N)throw ze.Errors.CANT_EXTRACT_FILE();var F=a(R.entryName),U=s(m,y?F:Je.basename(F));let M=C?R.header.fileAttr:void 0;o.writeFileTo(U,N,D,M)}),!0}var k=g.getData(i.password);if(!k)throw ze.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw ze.Errors.CANT_OVERRIDE();let B=C?h.header.fileAttr:void 0;return o.writeFileTo(S,k,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var y=i.entries[m].getData(h);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(h,m,y,D){if(y=Yn(!1,y),D=Q0(y,D),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(D);if(!g)throw ze.Errors.CANT_EXTRACT_FILE();let _=y?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,y,D){if(D=f3(m,y,D),y=Yn(!1,y),m=Yn(!1,m),!D)return new Promise((S,P)=>{this.extractAllToAsync(h,m,y,function(k){k?P(k):S(this)})});if(!i){D(ze.Errors.NO_ZIP());return}h=Je.resolve(h);let C=S=>s(h,Je.normalize(a(S.entryName))),E=(S,P)=>new Error(S+': "'+P+'"'),g=[],_=[];i.entries.forEach(S=>{S.isDirectory?g.push(S):_.push(S)});for(let S of g){let P=C(S),k=y?S.header.fileAttr:void 0;try{o.makeDir(P),k&&o.fs.chmodSync(P,k),o.fs.utimesSync(P,S.header.time,S.header.time)}catch{D(E("Unable to create folder",P))}}_.reverse().reduce(function(S,P){return function(k){if(k)S(k);else{let B=Je.normalize(a(P.entryName)),R=s(h,B);P.getDataAsync(function(N,F){if(F)S(F);else if(!N)S(ze.Errors.CANT_EXTRACT_FILE());else{let U=y?P.header.fileAttr:void 0;o.writeFileToAsync(R,N,m,U,function(M){M||S(E("Unable to write file",R)),o.fs.utimes(R,P.header.time,P.header.time,function(Q){Q?S(E("Unable to set times",R)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var y=i.compressToBuffer();if(y){var D=o.writeFileTo(h,y,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:y,perm:D}=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 _=S=>S?C(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,g,y,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,y,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,y,D),null):i.compressToBuffer()}}}});var ib=x((sz,ob)=>{var nb={};ob.exports=nb;var rb={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(rb).forEach(function(t){var e=rb[t],r=nb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var sb=x((uz,ab)=>{"use strict";ab.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 cb=x((cz,ub)=>{"use strict";var d3=require("os"),Er=sb(),Ft=process.env,ai=void 0;Er("no-color")||Er("no-colors")||Er("color=false")?ai=!1:(Er("color")||Er("colors")||Er("color=true")||Er("color=always"))&&(ai=!0);"FORCE_COLOR"in Ft&&(ai=Ft.FORCE_COLOR.length===0||parseInt(Ft.FORCE_COLOR,10)!==0);function h3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function m3(t){if(ai===!1)return 0;if(Er("color=16m")||Er("color=full")||Er("color=truecolor"))return 3;if(Er("color=256"))return 2;if(t&&!t.isTTY&&ai!==!0)return 0;var e=ai?1:0;if(process.platform==="win32"){var r=d3.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 jd(t){var e=m3(t);return h3(e)}ub.exports={supportsColor:jd,stdout:jd(process.stdout),stderr:jd(process.stderr)}});var fb=x((lz,lb)=>{lb.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 db=x((fz,pb)=>{pb.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="",p,d;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(d in u)if(!a(d)){switch(l=l+u[d],p={up:0,down:0,mid:0},c.size){case"mini":p.up=i(8),p.mid=i(2),p.down=i(8);break;case"maxi":p.up=i(16)+3,p.mid=i(4)+1,p.down=i(64)+3;break;default:p.up=i(8)+1,p.mid=i(6)/2,p.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var y=h[m],D=0;D<=p[y];D++)c[y]&&(l=l+n[y][i(n[y].length)])}return l}return s(e,r)}});var mb=x((pz,hb)=>{hb.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 Db=x((dz,gb)=>{gb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var bb=x((hz,yb)=>{yb.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 vb=x((mz,wb)=>{wb.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 Ab=x((Dz,xb)=>{var le={};xb.exports=le;le.themes={};var g3=require("util"),Jn=le.styles=ib(),Eb=Object.defineProperties,D3=new RegExp(/[\r\n]+/g);le.supportsColor=cb().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 gz=le.stylize=function(e,r){if(!le.enabled)return e+"";var n=Jn[r];return!n&&r in le?le[r](e):n.open+e+n.close},y3=/[|\\{}()[\]^$+*?.]/g,b3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(y3,"\\$&")};function _b(t){var e=function r(){return v3.apply(r,arguments)};return e._styles=t,e.__proto__=w3,e}var Sb=(function(){var t={};return Jn.grey=Jn.gray,Object.keys(Jn).forEach(function(e){Jn[e].closeRe=new RegExp(b3(Jn[e].close),"g"),t[e]={get:function(){return _b(this._styles.concat(e))}}}),t})(),w3=Eb(function(){},Sb);function v3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:g3.inspect(a)}).join(" ");if(!le.enabled||!e)return e;for(var r=e.indexOf(`
28
+ `)!=-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(D3,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 C3(){var t={};return Object.keys(Sb).forEach(function(e){t[e]={get:function(){return _b([e])}}}),t}var E3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};le.trap=fb();le.zalgo=db();le.maps={};le.maps.america=mb()(le);le.maps.zebra=Db()(le);le.maps.rainbow=bb()(le);le.maps.random=vb()(le);for(Cb in le.maps)(function(t){le[t]=function(e){return E3(le.maps[t],e)}})(Cb);var Cb;Eb(le,C3())});var Ob=x((yz,Fb)=>{var _3=Ab();Fb.exports=_3});var kb=x(Ud=>{"use strict";Ud.indent=function(e){return new Array(e+1).join(" ")};Ud.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 Pb=x((wz,S3)=>{S3.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 $b=x(Ua=>{"use strict";var Fr=Ob(),vn=kb(),x3=/[^\w\s\n\r\v\t\.,]/i;Ua.version=Pb().version;var Md=function(t,e){return t!==void 0||e.renderUndefined},Ku=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(`
29
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&Ku(t[0],!0,r))},A3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Fr[e.stringColor](t):t;var r=t+"";return t===!0?Fr.green(r):t===!1?Fr.red(r):t==null?Fr.grey(r):typeof t=="number"?t>=0?Fr[e.positiveNumberColor](r):Fr[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},qd=function(t,e){return t.multilineStringColor===null||t.noColor?e:Fr[t.multilineStringColor](e)},F3=function(t,e,r){var n=t.split(`
30
+ `);return n=n.map(function(o){return vn.indent(e)+qd(r,o)}),n.join(`
31
+ `)},si=function(t,e,r){if(typeof t=="string"&&t.match(x3)&&e.escape&&(t=JSON.stringify(t)),!Md(t,e))return[];if(Ku(t,!1,e))return[vn.indent(r)+A3(t,e)];if(typeof t=="string")return[vn.indent(r)+qd(e,'"""'),F3(t,r+e.defaultIndentation,e),vn.indent(r)+qd(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[vn.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(Md(s,e)){var u="- ";e.noColor||(u=Fr[e.dashColor](u)),u=vn.indent(r)+u,Ku(s,!1,e)?(u+=si(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,si(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return si({message:t.message,stack:t.stack.split(`
32
+ `)},e,r);var o=e.noAlign?0:vn.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(Md(t[s],e))if(i=s+": ",e.noColor||(i=Fr[e.keysColor](i)),i=vn.indent(r)+i,Ku(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=si(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,si(t[s],e,r+e.defaultIndentation))}),a};Ua.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,si(e,r,n).join(`
33
+ `)};Ua.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)+`
34
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Fr.red("Error:")+" Not valid JSON!"}return o+=Ua.render(i,r,n),o}});var zd=x(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});Gu.default=void 0;function ui(t){"@babel/helpers - typeof";return ui=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},ui(t)}function Ib(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,k3(n.key),n)}}function O3(t,e,r){return e&&Ib(t.prototype,e),r&&Ib(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function k3(t){var e=P3(t,"string");return ui(e)=="symbol"?e:e+""}function P3(t,e){if(ui(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ui(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I3(t,e,r){return e=qa(e),T3(t,Vd()?Reflect.construct(e,r||[],qa(t).constructor):e.apply(t,r))}function T3(t,e){if(e&&(ui(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R3(t)}function R3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function B3(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&&Ma(t,e)}function Hd(t){var e=typeof Map=="function"?new Map:void 0;return Hd=function(n){if(n===null||!N3(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 L3(n,arguments,qa(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ma(o,n)},Hd(t)}function L3(t,e,r){if(Vd())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ma(o,r.prototype),o}function Vd(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Vd=function(){return!!t})()}function N3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ma(t,e){return Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ma(t,e)}function qa(t){return qa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},qa(t)}var j3=(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($3(this,e),n=I3(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",p=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(p,", request id: ").concat(s,")")}return n.message=r,n}return B3(e,t),O3(e)})(Hd(Error)),Cz=Gu.default=j3});var Kd=x(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.enableDebugLog=U3;Wu.log=M3;var Tb=!1;function U3(){Tb=!0}function M3(t){Tb&&console.log(t)}});var Bb=x(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.default=void 0;function Ha(t){"@babel/helpers - typeof";return Ha=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},Ha(t)}function q3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Rb(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,V3(n.key),n)}}function H3(t,e,r){return e&&Rb(t.prototype,e),r&&Rb(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function V3(t){var e=z3(t,"string");return Ha(e)=="symbol"?e:e+""}function z3(t,e){if(Ha(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ha(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Sz=Yu.default=(function(){function t(){q3(this,t)}return H3(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 Lb=x((Gd,Wd)=>{(function(t,e){typeof Gd=="object"&&typeof Wd<"u"?Wd.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:Gd,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(I){var L={};return I.forEach(function(te,V){return L[te]=V}),L})(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(I){return new Uint8Array(Array.prototype.slice.call(I,0))},p=function(I){return I.replace(/=/g,"").replace(/[+\/]/g,function(L){return L=="+"?"-":"_"})},d=function(I){return I.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(I){for(var L,te,V,se,mr="",K=I.length%3,_e=0;_e<I.length;){if((te=I.charCodeAt(_e++))>255||(V=I.charCodeAt(_e++))>255||(se=I.charCodeAt(_e++))>255)throw new TypeError("invalid character found");L=te<<16|V<<8|se,mr+=a[L>>18&63]+a[L>>12&63]+a[L>>6&63]+a[L&63]}return K?mr.slice(0,K-3)+"===".substring(K):mr},m=typeof btoa=="function"?function(I){return btoa(I)}:r?function(I){return Buffer.from(I,"binary").toString("base64")}:h,y=r?function(I){return Buffer.from(I).toString("base64")}:function(I){for(var L=4096,te=[],V=0,se=I.length;V<se;V+=L)te.push(c.apply(null,I.subarray(V,V+L)));return m(te.join(""))},D=function(I,L){return L===void 0&&(L=!1),L?p(y(I)):y(I)},C=function(I){if(I.length<2){var L=I.charCodeAt(0);return L<128?I:L<2048?c(192|L>>>6)+c(128|L&63):c(224|L>>>12&15)+c(128|L>>>6&63)+c(128|L&63)}else{var L=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return c(240|L>>>18&7)+c(128|L>>>12&63)+c(128|L>>>6&63)+c(128|L&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,g=function(I){return I.replace(E,C)},_=r?function(I){return Buffer.from(I,"utf8").toString("base64")}:o?function(I){return y(o.encode(I))}:function(I){return m(g(I))},S=function(I,L){return L===void 0&&(L=!1),L?p(_(I)):_(I)},P=function(I){return S(I,!0)},k=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(I){switch(I.length){case 4:var L=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),te=L-65536;return c((te>>>10)+55296)+c((te&1023)+56320);case 3:return c((15&I.charCodeAt(0))<<12|(63&I.charCodeAt(1))<<6|63&I.charCodeAt(2));default:return c((31&I.charCodeAt(0))<<6|63&I.charCodeAt(1))}},R=function(I){return I.replace(k,B)},N=function(I){if(I=I.replace(/\s+/g,""),!u.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));for(var L,te,V,se=[],mr=0;mr<I.length;)L=s[I.charAt(mr++)]<<18|s[I.charAt(mr++)]<<12|(te=s[I.charAt(mr++)])<<6|(V=s[I.charAt(mr++)]),te===64?se.push(c(L>>16&255)):V===64?se.push(c(L>>16&255,L>>8&255)):se.push(c(L>>16&255,L>>8&255,L&255));return se.join("")},F=typeof atob=="function"?function(I){return atob(d(I))}:r?function(I){return Buffer.from(I,"base64").toString("binary")}:N,U=r?function(I){return l(Buffer.from(I,"base64"))}:function(I){return l(F(I).split("").map(function(L){return L.charCodeAt(0)}))},M=function(I){return U($(I))},Q=r?function(I){return Buffer.from(I,"base64").toString("utf8")}:n?function(I){return n.decode(U(I))}:function(I){return R(F(I))},$=function(I){return d(I.replace(/[-_]/g,function(L){return L=="-"?"+":"/"}))},b=function(I){return Q($(I))},w=function(I){if(typeof I!="string")return!1;var L=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(L)||!/[^\s0-9a-zA-Z\-_]/.test(L)},v=function(I){return{value:I,enumerable:!1,writable:!0,configurable:!0}},A=function(){var I=function(L,te){return Object.defineProperty(String.prototype,L,v(te))};I("fromBase64",function(){return b(this)}),I("toBase64",function(L){return S(this,L)}),I("toBase64URI",function(){return S(this,!0)}),I("toBase64URL",function(){return S(this,!0)}),I("toUint8Array",function(){return M(this)})},T=function(){var I=function(L,te){return Object.defineProperty(Uint8Array.prototype,L,v(te))};I("toBase64",function(L){return D(this,L)}),I("toBase64URI",function(){return D(this,!0)}),I("toBase64URL",function(){return D(this,!0)})},O=function(){A(),T()},q={version:t,VERSION:e,atob:F,atobPolyfill:N,btoa:m,btoaPolyfill:h,fromBase64:b,toBase64:S,encode:S,encodeURI:P,encodeURL:P,utob:g,btou:R,decode:b,isValid:w,fromUint8Array:D,toUint8Array:M,extendString:A,extendUint8Array:T,extendBuiltins:O};return q.Base64={},Object.keys(q).forEach(function(I){return q.Base64[I]=q[I]}),q})});var jb=x((Az,Nb)=>{"use strict";Nb.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=x(Yd=>{"use strict";var K3=Object.prototype.hasOwnProperty,G3;function Ub(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function Mb(t){try{return encodeURIComponent(t)}catch{return null}}function W3(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=Ub(n[1]),i=Ub(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function Y3(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(K3.call(t,o)){if(n=t[o],!n&&(n===null||n===G3||isNaN(n))&&(n=""),o=Mb(o),n=Mb(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Yd.stringify=Y3;Yd.parse=W3});var Jb=x((Oz,Yb)=>{"use strict";var Vb=jb(),Ju=qb(),J3=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,zb=/[\n\r\t]/g,X3=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Kb=/:\d+$/,Z3=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Q3=/^[a-zA-Z]:/;function Xd(t){return(t||"").toString().replace(J3,"")}var Jd=[["#","hash"],["?","query"],function(e,r){return Or(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]],Hb={hash:1,query:1};function Gb(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 kr(unescape(t.pathname),{});else if(o==="string"){n=new kr(t,{});for(i in Hb)delete n[i]}else if(o==="object"){for(i in t)i in Hb||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=X3.test(t.href))}return n}function Or(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function Wb(t,e){t=Xd(t),t=t.replace(zb,""),e=e||{};var r=Z3.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)):Or(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Or(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Or(n),slashesCount:a,rest:s}}function e$(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 kr(t,e,r){if(t=Xd(t),t=t.replace(zb,""),!(this instanceof kr))return new kr(t,e,r);var n,o,i,a,s,u,c=Jd.slice(),l=typeof e,p=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Ju.parse),e=Gb(e),o=Wb(t||"",e),n=!o.protocol&&!o.slashes,p.slashes=o.slashes||n&&e.slashes,p.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||Q3.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Or(p.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(a=c[d],typeof a=="function"){t=a(t,p);continue}i=a[0],u=a[1],i!==i?p[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(p[u]=t.slice(0,s),t=t.slice(s+a[2])):(p[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(p[u]=s[1],t=t.slice(0,s.index)),p[u]=p[u]||n&&a[3]&&e[u]||"",a[4]&&(p[u]=p[u].toLowerCase())}r&&(p.query=r(p.query)),n&&e.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||e.pathname!=="")&&(p.pathname=e$(p.pathname,e.pathname)),p.pathname.charAt(0)!=="/"&&Or(p.protocol)&&(p.pathname="/"+p.pathname),Vb(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(s=p.auth.indexOf(":"),~s?(p.username=p.auth.slice(0,s),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(s+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&Or(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function t$(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Ju.parse)(e)),n[t]=e;break;case"port":n[t]=e,Vb(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,Kb.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<Jd.length;a++){var s=Jd[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:"&&Or(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function r$(t){(!t||typeof t!="function")&&(t=Ju.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||Or(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Or(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||Kb.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}kr.prototype={set:t$,toString:r$};kr.extractProtocol=Wb;kr.location=Gb;kr.trimLeft=Xd;kr.qs=Ju;Yb.exports=kr});var Xb=x(Zd=>{"use strict";Object.defineProperty(Zd,"__esModule",{value:!0});Zd.default=n$;function n$(){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 pw=x(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.default=void 0;var o$=Lb(),i$=th(Jb()),Xu=th(zd()),Xn=Kd(),a$=th(Xb());function th(t){return t&&t.__esModule?t:{default:t}}function Qd(){"use strict";Qd=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,v){b[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,v){return Object.defineProperty(b,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(v,A,T){return v[A]=T}}function l(b,w,v,A){var T=w&&w.prototype instanceof C?w:C,O=Object.create(T.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(b,v,q)}),O}function p(b,w,v){try{return{type:"normal",arg:b.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(v){return this._invoke(w,v)})})}function R(b,w){function v(T,O,q,I){var L=p(b[T],b,O);if(L.type!=="throw"){var te=L.arg,V=te.value;return V&&Zn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,I)},function(se){v("throw",se,q,I)}):w.resolve(V).then(function(se){te.value=se,q(te)},function(se){return v("throw",se,q,I)})}I(L.arg)}var A;o(this,"_invoke",{value:function(O,q){function I(){return new w(function(L,te){v(O,q,L,te)})}return A=A?A.then(I,I):I()}})}function N(b,w,v){var A=d;return function(T,O){if(A===m)throw Error("Generator is already running");if(A===y){if(T==="throw")throw O;return{value:t,done:!0}}for(v.method=T,v.arg=O;;){var q=v.delegate;if(q){var I=F(q,v);if(I){if(I===D)continue;return I}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=y,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var L=p(b,w,v);if(L.type==="normal"){if(A=v.done?y:h,L.arg===D)continue;return{value:L.arg,done:v.done}}L.type==="throw"&&(A=y,v.method="throw",v.arg=L.arg)}}}function F(b,w){var v=w.method,A=b.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,F(b,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var T=p(A,b.iterator,w.arg);if(T.type==="throw")return w.method="throw",w.arg=T.arg,w.delegate=null,D;var O=T.arg;return O?O.done?(w[b.resultName]=O.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function M(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Q(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(U,this),this.reset(!0)}function $(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var v=-1,A=function T(){for(;++v<b.length;)if(n.call(b,v))return T.value=b[v],T.done=!1,T;return T.value=t,T.done=!0,T};return A.next=A}}throw new TypeError(Zn(b)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(k),b},e.awrap=function(b){return{__await:b}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(b,w,v,A,T){T===void 0&&(T=Promise);var O=new R(l(b,w,v,A),T);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),v=[];for(var A in w)v.push(A);return v.reverse(),function T(){for(;v.length;){var O=v.pop();if(O in w)return T.value=O,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,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 A(te,V){return q.type="throw",q.arg=w,v.next=te,V&&(v.method="next",v.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var I=n.call(O,"catchLoc"),L=n.call(O,"finallyLoc");if(I&&L){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(I){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!L)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var T=this.tryEntries[A];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var O=T;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var T=A.completion;if(T.type==="throw"){var O=T.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function Zb(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 s$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Zb(i,n,o,a,s,"next",u)}function s(u){Zb(i,n,o,a,s,"throw",u)}a(void 0)})}}function sw(t,e){return l$(t)||c$(t,e)||uw(t,e)||u$()}function u$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
35
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c$(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 l$(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 f$(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=uw(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.
36
+ 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 uw(t,e){if(t){if(typeof t=="string")return Qb(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 Qb(t,e)}}function Qb(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 ew(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 ci(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ew(Object(r),!0).forEach(function(n){p$(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ew(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function p$(t,e,r){return e=cw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tw(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,cw(n.key),n)}}function h$(t,e,r){return e&&tw(t.prototype,e),r&&tw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function cw(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 Zu="tus-v1",Qu="ietf-draft-03",Va="ietf-draft-05",g$={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:fw,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:Zu},lw=(function(){function t(e,r){d$(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 h$(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(![Zu,Qu,Va].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:y$(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(l,p){l.uploadUrl=n._parallelUploadUrls[p]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(l,p){var d=0;return n._source.slice(l.start,l.end).then(function(h){var m=h.value;return new Promise(function(y,D){var C=ci(ci({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:ci(ci({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:D,onProgress:function(_){i=i-d+_,d=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[p]=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=rw(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!li(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var p=l.getHeader("Location");if(p==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=aw(n.options.endpoint,p),(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=f$(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 Xu.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),iw(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=rw(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===Qu||this.options.protocol===Va)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!li(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=aw(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(!li(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(li(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===Zu){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(!li(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===Zu?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Va&&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===Qu||n.options.protocol===Va)&&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=nw(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 ow(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=nw("DELETE",r,n);return ow(o,null,n).then(function(i){if(i.getStatus()!==204)throw new Xu.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof Xu.default||(i=new Xu.default("tus: failed to terminate upload",i,o,null)),!iw(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=ci(ci({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function rw(t){return Object.entries(t).map(function(e){var r=sw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(o$.Base64.encode(String(o)))}).join(",")}function li(t,e){return t>=e&&t<e+100}function nw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Qu?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Va?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=sw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,a$.default)();n.setHeader("X-Request-ID",l)}return n}function ow(t,e,r){return eh.apply(this,arguments)}function eh(){return eh=s$(Qd().mark(function t(e,r,n){var o;return Qd().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)})),eh.apply(this,arguments)}function D$(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function iw(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):fw(t)}function fw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!li(e,400)||e===409||e===423)&&D$()}function aw(t,e){return new i$.default(e,t).toString()}function y$(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}lw.defaultOptions=g$;var Pz=ec.default=lw});var hw=x((Iz,dw)=>{"use strict";var Pr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Pr.writable=t=>Pr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Pr.readable=t=>Pr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Pr.duplex=t=>Pr.writable(t)&&Pr.readable(t);Pr.transform=t=>Pr.duplex(t)&&typeof t._transform=="function";dw.exports=Pr});var gw=x(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.default=void 0;function za(t){"@babel/helpers - typeof";return za=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},za(t)}function b$(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mw(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,v$(n.key),n)}}function w$(t,e,r){return e&&mw(t.prototype,e),r&&mw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v$(t){var e=C$(t,"string");return za(e)=="symbol"?e:e+""}function C$(t,e){if(za(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(za(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tz=tc.default=(function(){function t(e){b$(this,t),this._buffer=e,this.size=e.length}return w$(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 ww=x(oh=>{"use strict";Object.defineProperty(oh,"__esModule",{value:!0});oh.default=F$;var bw=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 rh(){"use strict";rh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,v){b[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,v){return Object.defineProperty(b,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(v,A,T){return v[A]=T}}function l(b,w,v,A){var T=w&&w.prototype instanceof C?w:C,O=Object.create(T.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(b,v,q)}),O}function p(b,w,v){try{return{type:"normal",arg:b.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(v){return this._invoke(w,v)})})}function R(b,w){function v(T,O,q,I){var L=p(b[T],b,O);if(L.type!=="throw"){var te=L.arg,V=te.value;return V&&Qn(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,I)},function(se){v("throw",se,q,I)}):w.resolve(V).then(function(se){te.value=se,q(te)},function(se){return v("throw",se,q,I)})}I(L.arg)}var A;o(this,"_invoke",{value:function(O,q){function I(){return new w(function(L,te){v(O,q,L,te)})}return A=A?A.then(I,I):I()}})}function N(b,w,v){var A=d;return function(T,O){if(A===m)throw Error("Generator is already running");if(A===y){if(T==="throw")throw O;return{value:t,done:!0}}for(v.method=T,v.arg=O;;){var q=v.delegate;if(q){var I=F(q,v);if(I){if(I===D)continue;return I}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=y,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var L=p(b,w,v);if(L.type==="normal"){if(A=v.done?y:h,L.arg===D)continue;return{value:L.arg,done:v.done}}L.type==="throw"&&(A=y,v.method="throw",v.arg=L.arg)}}}function F(b,w){var v=w.method,A=b.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,F(b,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var T=p(A,b.iterator,w.arg);if(T.type==="throw")return w.method="throw",w.arg=T.arg,w.delegate=null,D;var O=T.arg;return O?O.done?(w[b.resultName]=O.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function M(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Q(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(U,this),this.reset(!0)}function $(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var v=-1,A=function T(){for(;++v<b.length;)if(n.call(b,v))return T.value=b[v],T.done=!1,T;return T.value=t,T.done=!0,T};return A.next=A}}throw new TypeError(Qn(b)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(k),b},e.awrap=function(b){return{__await:b}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(b,w,v,A,T){T===void 0&&(T=Promise);var O=new R(l(b,w,v,A),T);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),v=[];for(var A in w)v.push(A);return v.reverse(),function T(){for(;v.length;){var O=v.pop();if(O in w)return T.value=O,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,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 A(te,V){return q.type="throw",q.arg=w,v.next=te,V&&(v.method="next",v.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var I=n.call(O,"catchLoc"),L=n.call(O,"finallyLoc");if(I&&L){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(I){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!L)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var T=this.tryEntries[A];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var O=T;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var T=A.completion;if(T.type==="throw"){var O=T.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function E$(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,S$(n.key),n)}}function _$(t,e,r){return e&&Dw(t.prototype,e),r&&Dw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function S$(t){var e=x$(t,"string");return Qn(e)=="symbol"?e:e+""}function x$(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 yw(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 A$(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){yw(i,n,o,a,s,"next",u)}function s(u){yw(i,n,o,a,s,"throw",u)}a(void 0)})}}function F$(t){return nh.apply(this,arguments)}function nh(){return nh=A$(rh().mark(function t(e){var r,n,o,i,a,s,u;return rh().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,bw.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 O$(e,n,u));case 9:case"end":return l.stop()}},t)})),nh.apply(this,arguments)}var O$=(function(){function t(e,r,n){E$(this,t),this._stream=e,this._path=r,this.size=n}return _$(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,bw.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 ah=x(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});rc.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 Ka(){"use strict";Ka=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,v){b[w]=v.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,v){return Object.defineProperty(b,w,{value:v,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(v,A,T){return v[A]=T}}function l(b,w,v,A){var T=w&&w.prototype instanceof C?w:C,O=Object.create(T.prototype),q=new Q(A||[]);return o(O,"_invoke",{value:N(b,v,q)}),O}function p(b,w,v){try{return{type:"normal",arg:b.call(w,v)}}catch(A){return{type:"throw",arg:A}}}e.wrap=l;var d="suspendedStart",h="suspendedYield",m="executing",y="completed",D={};function C(){}function E(){}function g(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S($([])));P&&P!==r&&n.call(P,a)&&(_=P);var k=g.prototype=C.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(v){return this._invoke(w,v)})})}function R(b,w){function v(T,O,q,I){var L=p(b[T],b,O);if(L.type!=="throw"){var te=L.arg,V=te.value;return V&&eo(V)=="object"&&n.call(V,"__await")?w.resolve(V.__await).then(function(se){v("next",se,q,I)},function(se){v("throw",se,q,I)}):w.resolve(V).then(function(se){te.value=se,q(te)},function(se){return v("throw",se,q,I)})}I(L.arg)}var A;o(this,"_invoke",{value:function(O,q){function I(){return new w(function(L,te){v(O,q,L,te)})}return A=A?A.then(I,I):I()}})}function N(b,w,v){var A=d;return function(T,O){if(A===m)throw Error("Generator is already running");if(A===y){if(T==="throw")throw O;return{value:t,done:!0}}for(v.method=T,v.arg=O;;){var q=v.delegate;if(q){var I=F(q,v);if(I){if(I===D)continue;return I}}if(v.method==="next")v.sent=v._sent=v.arg;else if(v.method==="throw"){if(A===d)throw A=y,v.arg;v.dispatchException(v.arg)}else v.method==="return"&&v.abrupt("return",v.arg);A=m;var L=p(b,w,v);if(L.type==="normal"){if(A=v.done?y:h,L.arg===D)continue;return{value:L.arg,done:v.done}}L.type==="throw"&&(A=y,v.method="throw",v.arg=L.arg)}}}function F(b,w){var v=w.method,A=b.iterator[v];if(A===t)return w.delegate=null,v==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,F(b,w),w.method==="throw")||v!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+v+"' method")),D;var T=p(A,b.iterator,w.arg);if(T.type==="throw")return w.method="throw",w.arg=T.arg,w.delegate=null,D;var O=T.arg;return O?O.done?(w[b.resultName]=O.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):O:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function U(b){var w={tryLoc:b[0]};1 in b&&(w.catchLoc=b[1]),2 in b&&(w.finallyLoc=b[2],w.afterLoc=b[3]),this.tryEntries.push(w)}function M(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Q(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(U,this),this.reset(!0)}function $(b){if(b||b===""){var w=b[a];if(w)return w.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var v=-1,A=function T(){for(;++v<b.length;)if(n.call(b,v))return T.value=b[v],T.done=!1,T;return T.value=t,T.done=!0,T};return A.next=A}}throw new TypeError(eo(b)+" is not iterable")}return E.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:E,configurable:!0}),E.displayName=c(g,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===E||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,g):(b.__proto__=g,c(b,u,"GeneratorFunction")),b.prototype=Object.create(k),b},e.awrap=function(b){return{__await:b}},B(R.prototype),c(R.prototype,s,function(){return this}),e.AsyncIterator=R,e.async=function(b,w,v,A,T){T===void 0&&(T=Promise);var O=new R(l(b,w,v,A),T);return e.isGeneratorFunction(w)?O:O.next().then(function(q){return q.done?q.value:O.next()})},B(k),c(k,u,"Generator"),c(k,a,function(){return this}),c(k,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),v=[];for(var A in w)v.push(A);return v.reverse(),function T(){for(;v.length;){var O=v.pop();if(O in w)return T.value=O,T.done=!1,T}return T.done=!0,T}},e.values=$,Q.prototype={constructor:Q,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 A(te,V){return q.type="throw",q.arg=w,v.next=te,V&&(v.method="next",v.arg=t),!!V}for(var T=this.tryEntries.length-1;T>=0;--T){var O=this.tryEntries[T],q=O.completion;if(O.tryLoc==="root")return A("end");if(O.tryLoc<=this.prev){var I=n.call(O,"catchLoc"),L=n.call(O,"finallyLoc");if(I&&L){if(this.prev<O.catchLoc)return A(O.catchLoc,!0);if(this.prev<O.finallyLoc)return A(O.finallyLoc)}else if(I){if(this.prev<O.catchLoc)return A(O.catchLoc,!0)}else{if(!L)throw Error("try statement without catch or finally");if(this.prev<O.finallyLoc)return A(O.finallyLoc)}}}},abrupt:function(w,v){for(var A=this.tryEntries.length-1;A>=0;--A){var T=this.tryEntries[A];if(T.tryLoc<=this.prev&&n.call(T,"finallyLoc")&&this.prev<T.finallyLoc){var O=T;break}}O&&(w==="break"||w==="continue")&&O.tryLoc<=v&&v<=O.finallyLoc&&(O=null);var q=O?O.completion:{};return q.type=w,q.arg=v,O?(this.method="next",this.next=O.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 A=this.tryEntries[v];if(A.finallyLoc===w)return this.complete(A.completion,A.afterLoc),M(A),D}},catch:function(w){for(var v=this.tryEntries.length-1;v>=0;--v){var A=this.tryEntries[v];if(A.tryLoc===w){var T=A.completion;if(T.type==="throw"){var O=T.arg;M(A)}return O}}throw Error("illegal catch attempt")},delegateYield:function(w,v,A){return this.delegate={iterator:$(w),resultName:v,nextLoc:A},this.method==="next"&&(this.arg=t),D}},e}function k$(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,$$(n.key),n)}}function P$(t,e,r){return e&&vw(t.prototype,e),r&&vw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $$(t){var e=I$(t,"string");return eo(e)=="symbol"?e:e+""}function I$(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 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 Ew(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 T$(t,e){return ih.apply(this,arguments)}function ih(){return ih=Ew(Ka().mark(function t(e,r){return Ka().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)})),ih.apply(this,arguments)}var Lz=rc.default=(function(){function t(e){var r=this;k$(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 P$(t,[{key:"slice",value:(function(){var e=Ew(Ka().mark(function n(o,i){var a,s,u,c,l;return Ka().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(o<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.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){d.next=10;break}return a.size=a.length,d.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){d.next=16;break}return d.next=14,T$(this._stream,c-a.length);case 14:l=d.sent,a=Buffer.concat([a,l]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,d.abrupt("return",{value:a,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Sw=x(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});oc.default=void 0;var R$=require("fs"),B$=nc(hw()),L$=nc(gw()),N$=nc(ww()),j$=nc(ah());function nc(t){return t&&t.__esModule?t:{default:t}}function Ga(t){"@babel/helpers - typeof";return Ga=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},Ga(t)}function U$(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,q$(n.key),n)}}function M$(t,e,r){return e&&_w(t.prototype,e),r&&_w(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function q$(t){var e=H$(t,"string");return Ga(e)=="symbol"?e:e+""}function H$(t,e){if(Ga(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ga(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jz=oc.default=(function(){function t(){U$(this,t)}return M$(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new L$.default(r)):r instanceof R$.ReadStream&&r.path!=null?(0,N$.default)(r):B$.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new j$.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 Ow=x(sh=>{"use strict";Object.defineProperty(sh,"__esModule",{value:!0});sh.default=K$;var V$=require("crypto"),xw=Fw(require("fs")),z$=Fw(require("path"));function Aw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Aw=function(n){return n?r:e})(t)}function Fw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Aw(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 K$(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,V$.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof xw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=z$.resolve(t.path);xw.stat(t.path,function(c,l){if(c){s(c);return}var p=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");a(p)})}):Promise.resolve(null)}});var Tw=x((qz,Iw)=>{var $w="Expected a function",kw=NaN,G$="[object Symbol]",W$=/^\s+|\s+$/g,Y$=/^[-+]0x[0-9a-f]+$/i,J$=/^0b[01]+$/i,X$=/^0o[0-7]+$/i,Z$=parseInt,Q$=typeof global=="object"&&global&&global.Object===Object&&global,eI=typeof self=="object"&&self&&self.Object===Object&&self,tI=Q$||eI||Function("return this")(),rI=Object.prototype,nI=rI.toString,oI=Math.max,iI=Math.min,uh=function(){return tI.Date.now()};function aI(t,e,r){var n,o,i,a,s,u,c=0,l=!1,p=!1,d=!0;if(typeof t!="function")throw new TypeError($w);e=Pw(e)||0,ic(r)&&(l=!!r.leading,p="maxWait"in r,i=p?oI(Pw(r.maxWait)||0,e):i,d="trailing"in r?!!r.trailing:d);function h(P){var k=n,B=o;return n=o=void 0,c=P,a=t.apply(B,k),a}function m(P){return c=P,s=setTimeout(C,e),l?h(P):a}function y(P){var k=P-u,B=P-c,R=e-k;return p?iI(R,i-B):R}function D(P){var k=P-u,B=P-c;return u===void 0||k>=e||k<0||p&&B>=i}function C(){var P=uh();if(D(P))return E(P);s=setTimeout(C,y(P))}function E(P){return s=void 0,d&&n?h(P):(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(uh())}function S(){var P=uh(),k=D(P);if(n=arguments,o=this,u=P,k){if(s===void 0)return m(u);if(p)return s=setTimeout(C,e),h(u)}return s===void 0&&(s=setTimeout(C,e)),a}return S.cancel=g,S.flush=_,S}function sI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError($w);return ic(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),aI(t,e,{leading:n,maxWait:e,trailing:o})}function ic(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function uI(t){return!!t&&typeof t=="object"}function cI(t){return typeof t=="symbol"||uI(t)&&nI.call(t)==G$}function Pw(t){if(typeof t=="number")return t;if(cI(t))return kw;if(ic(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ic(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(W$,"");var r=J$.test(t);return r||X$.test(t)?Z$(t.slice(2),r?2:8):Y$.test(t)?kw:+t}Iw.exports=sI});var Hw=x(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.default=void 0;var lI=Uw(require("http")),fI=Uw(require("https")),Lw=require("stream"),pI=require("url"),Nw=dI(Tw());function dI(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 Uw(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 hI(t,e,r){return e=ac(e),mI(t,Mw()?Reflect.construct(e,r||[],ac(t).constructor):e.apply(t,r))}function mI(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 gI(t)}function gI(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mw(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Mw=function(){return!!t})()}function ac(t){return ac=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ac(t)}function DI(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&&ch(t,e)}function ch(t,e){return ch=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ch(t,e)}function Rw(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 Wa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Rw(Object(r),!0).forEach(function(n){yI(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Rw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function yI(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 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 sc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bw(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 uc(t,e,r){return e&&Bw(t.prototype,e),r&&Bw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function qw(t){var e=bI(t,"string");return fi(e)=="symbol"?e:e+""}function bI(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)}var Hz=cc.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};sc(this,t),this._requestOptions=e}return uc(t,[{key:"createRequest",value:function(r,n){return new wI(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),wI=(function(){function t(e,r,n){sc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return uc(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=Wa(Wa(Wa({},(0,pI.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Wa(Wa({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?fI:lI;r._request=s.request(a);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(p){l.push(p)}),c.on("end",function(){var p=Buffer.concat(l).toString("utf8");o(new vI(c,p))})}),u.on("error",function(c){i(c)}),n instanceof Lw.Readable?n.pipe(new CI(r._progressHandler)).pipe(u):n instanceof Uint8Array?EI(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}}])})(),vI=(function(){function t(e,r){sc(this,t),this._response=e,this._body=r}return uc(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}}])})(),CI=(function(t){function e(r){var n;return sc(this,e),n=hI(this,e),n._onprogress=(0,Nw.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return DI(e,t),uc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(Lw.Transform),EI=function(e,r,n){n=(0,Nw.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 Vw=x(lh=>{"use strict";lh.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};lh.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(`
37
37
  `)}(!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(`
38
38
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
39
- `),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 Gw=x((Vz,zw)=>{"use strict";zw.exports=eo;eo.factory=Hw();var ph=eo("CustomError");ph.order=eo(ph,{message:"Arguments out of order.",code:"EOARG"});function eo(t,e,r,n){var o,i;return e=cc(arguments,1,Error,Vw,[lh,lc]),r=cc(arguments,2,{},lh,[lc]),n=cc(arguments,3,fh,lc,[]),t=cc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,ET,[Vw,lh,lc]),i=e===Error,i&&n===fh&&(n=eo.factory.root),o=function(a,s){var u,c,l,p,d,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(eo.factory).forEach(function(m){l[m]=function(b,D){eo.factory[m].call(u,b,D,l)}}),p=this.CustomError.chain.length-1;p>=0;p--)d=this.CustomError.chain[p],d.factory!==fh&&d.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 cc(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 ph.order;return a!==-1?t[a]:r}function lc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function ET(t){return typeof t=="string"}function Vw(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function lh(t){return t&&typeof t=="object"}function fh(){}});var Ww=x((zz,Kw)=>{Kw.exports=Gw()});var Qw=x((to,fi)=>{var _T=1/0,xT="[object Symbol]",Wa={function:!0,object:!0},ST=Wa[typeof to]&&to&&!to.nodeType?to:void 0,AT=Wa[typeof fi]&&fi&&!fi.nodeType?fi:void 0,FT=fc(ST&&AT&&typeof global=="object"&&global),OT=fc(Wa[typeof self]&&self),Yw=fc(Wa[typeof window]&&window),dh=fc(Wa[typeof to]&&to),kT=FT||Yw!==(dh&&dh.window)&&Yw||OT||dh||Function("return this")();function fc(t){return t&&t.Object===Object?t:null}var PT=Object.prototype,$T=PT.toString,Jw=kT.Symbol,Xw=Jw?Jw.prototype:void 0,Zw=Xw?Xw.toString:void 0;function TT(t){if(typeof t=="string")return t;if(RT(t))return Zw?Zw.call(t):"";var e=t+"";return e=="0"&&1/t==-_T?"-0":e}function IT(t){return!!t&&typeof t=="object"}function RT(t){return typeof t=="symbol"||IT(t)&&$T.call(t)==xT}fi.exports=TT});var av=x((ro,pi)=>{var BT=Qw(),jT="Expected a function",tv="__lodash_hash_undefined__",NT="[object Function]",LT="[object GeneratorFunction]",UT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,MT=/[\\^$.*+?()[\]{}|]/g,qT=/\\(\\)?/g,HT=/^\[object .+?Constructor\]$/,Ja={function:!0,object:!0},VT=Ja[typeof ro]&&ro&&!ro.nodeType?ro:void 0,zT=Ja[typeof pi]&&pi&&!pi.nodeType?pi:void 0,GT=pc(VT&&zT&&typeof global=="object"&&global),KT=pc(Ja[typeof self]&&self),ev=pc(Ja[typeof window]&&window),hh=pc(Ja[typeof ro]&&ro),WT=GT||ev!==(hh&&hh.window)&&ev||KT||hh||Function("return this")();function pc(t){return t&&t.Object===Object?t:null}function YT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var JT=Array.prototype,rv=Object.prototype,nv=Function.prototype.toString,mh=rv.hasOwnProperty,XT=rv.toString,ZT=RegExp("^"+nv.call(mh).replace(MT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),QT=JT.splice,eI=ov(WT,"Map"),Ya=ov(Object,"create");function no(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 tI(){this.__data__=Ya?Ya(null):{}}function rI(t){return this.has(t)&&delete this.__data__[t]}function nI(t){var e=this.__data__;if(Ya){var r=e[t];return r===tv?void 0:r}return mh.call(e,t)?e[t]:void 0}function oI(t){var e=this.__data__;return Ya?e[t]!==void 0:mh.call(e,t)}function iI(t,e){var r=this.__data__;return r[t]=Ya&&e===void 0?tv:e,this}no.prototype.clear=tI;no.prototype.delete=rI;no.prototype.get=nI;no.prototype.has=oI;no.prototype.set=iI;function di(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 aI(){this.__data__=[]}function sI(t){var e=this.__data__,r=dc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():QT.call(e,r,1),!0}function uI(t){var e=this.__data__,r=dc(e,t);return r<0?void 0:e[r][1]}function cI(t){return dc(this.__data__,t)>-1}function lI(t,e){var r=this.__data__,n=dc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}di.prototype.clear=aI;di.prototype.delete=sI;di.prototype.get=uI;di.prototype.has=cI;di.prototype.set=lI;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 fI(){this.__data__={hash:new no,map:new(eI||di),string:new no}}function pI(t){return hc(this,t).delete(t)}function dI(t){return hc(this,t).get(t)}function hI(t){return hc(this,t).has(t)}function mI(t,e){return hc(this,t).set(t,e),this}oo.prototype.clear=fI;oo.prototype.delete=pI;oo.prototype.get=dI;oo.prototype.has=hI;oo.prototype.set=mI;function dc(t,e){for(var r=t.length;r--;)if(bI(t[r][0],e))return r;return-1}function hc(t,e){var r=t.__data__;return gI(e)?r[typeof e=="string"?"string":"hash"]:r.map}function ov(t,e){var r=t[e];return vI(r)?r:void 0}function gI(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var DI=gh(function(t){var e=[];return CI(t).replace(UT,function(r,n,o,i){e.push(o?i.replace(qT,"$1"):n||r)}),e});function yI(t){if(t!=null){try{return nv.call(t)}catch{}try{return t+""}catch{}}return""}function gh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(jT);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(gh.Cache||oo),r}gh.Cache=oo;function bI(t,e){return t===e||t!==t&&e!==e}function wI(t){var e=iv(t)?XT.call(t):"";return e==NT||e==LT}function iv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function vI(t){if(!iv(t))return!1;var e=wI(t)||YT(t)?ZT:HT;return e.test(yI(t))}function CI(t){return t==null?"":BT(t)}pi.exports=DI});var Bv=x((io,mi)=>{var EI=av(),_I=200,Ah="__lodash_hash_undefined__",bc=1,gi=2,xI=1/0,pv=9007199254740991,mc="[object Arguments]",bh="[object Array]",dv="[object Boolean]",hv="[object Date]",mv="[object Error]",gv="[object Function]",SI="[object GeneratorFunction]",Xa="[object Map]",Dv="[object Number]",hi="[object Object]",sv="[object Promise]",yv="[object RegExp]",Za="[object Set]",Fh="[object String]",bv="[object Symbol]",wh="[object WeakMap]",wv="[object ArrayBuffer]",gc="[object DataView]",AI="[object Float32Array]",FI="[object Float64Array]",OI="[object Int8Array]",kI="[object Int16Array]",PI="[object Int32Array]",$I="[object Uint8Array]",TI="[object Uint8ClampedArray]",II="[object Uint16Array]",RI="[object Uint32Array]",BI=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jI=/^\w*$/,NI=/[\\^$.*+?()[\]{}|]/g,LI=/^\[object .+?Constructor\]$/,UI=/^(?:0|[1-9]\d*)$/,Be={};Be[AI]=Be[FI]=Be[OI]=Be[kI]=Be[PI]=Be[$I]=Be[TI]=Be[II]=Be[RI]=!0;Be[mc]=Be[bh]=Be[wv]=Be[dv]=Be[gc]=Be[hv]=Be[mv]=Be[gv]=Be[Xa]=Be[Dv]=Be[hi]=Be[yv]=Be[Za]=Be[Fh]=Be[wh]=!1;var es={function:!0,object:!0},MI=es[typeof io]&&io&&!io.nodeType?io:void 0,qI=es[typeof mi]&&mi&&!mi.nodeType?mi:void 0,HI=wc(MI&&qI&&typeof global=="object"&&global),VI=wc(es[typeof self]&&self),uv=wc(es[typeof window]&&window),Dh=wc(es[typeof io]&&io),uo=HI||uv!==(Dh&&Dh.window)&&uv||VI||Dh||Function("return this")();function zI(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function GI(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function KI(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function WI(t,e){return zI(e,function(r){return[r,t[r]]})}function wc(t){return t&&t.Object===Object?t:null}function vh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function vv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function YI(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function JI(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var XI=Array.prototype,vc=Object.prototype,Cv=Function.prototype.toString,ao=vc.hasOwnProperty,co=vc.toString,ZI=RegExp("^"+Cv.call(ao).replace(NI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),cv=uo.Symbol,lv=uo.Uint8Array,QI=vc.propertyIsEnumerable,eR=XI.splice,tR=Object.getPrototypeOf,rR=Object.keys,Ch=Di(uo,"DataView"),Dc=Di(uo,"Map"),Eh=Di(uo,"Promise"),_h=Di(uo,"Set"),xh=Di(uo,"WeakMap"),Qa=Di(Object,"create"),nR=fo(Ch),oR=fo(Dc),iR=fo(Eh),aR=fo(_h),sR=fo(xh),fv=cv?cv.prototype:void 0,yh=fv?fv.valueOf:void 0;function so(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__=Qa?Qa(null):{}}function cR(t){return this.has(t)&&delete this.__data__[t]}function lR(t){var e=this.__data__;if(Qa){var r=e[t];return r===Ah?void 0:r}return ao.call(e,t)?e[t]:void 0}function fR(t){var e=this.__data__;return Qa?e[t]!==void 0:ao.call(e,t)}function pR(t,e){var r=this.__data__;return r[t]=Qa&&e===void 0?Ah:e,this}so.prototype.clear=uR;so.prototype.delete=cR;so.prototype.get=lR;so.prototype.has=fR;so.prototype.set=pR;function Jr(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 dR(){this.__data__=[]}function hR(t){var e=this.__data__,r=Cc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():eR.call(e,r,1),!0}function mR(t){var e=this.__data__,r=Cc(e,t);return r<0?void 0:e[r][1]}function gR(t){return Cc(this.__data__,t)>-1}function DR(t,e){var r=this.__data__,n=Cc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Jr.prototype.clear=dR;Jr.prototype.delete=hR;Jr.prototype.get=mR;Jr.prototype.has=gR;Jr.prototype.set=DR;function lo(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 yR(){this.__data__={hash:new so,map:new(Dc||Jr),string:new so}}function bR(t){return Ec(this,t).delete(t)}function wR(t){return Ec(this,t).get(t)}function vR(t){return Ec(this,t).has(t)}function CR(t,e){return Ec(this,t).set(t,e),this}lo.prototype.clear=yR;lo.prototype.delete=bR;lo.prototype.get=wR;lo.prototype.has=vR;lo.prototype.set=CR;function yc(t){var e=-1,r=t?t.length:0;for(this.__data__=new lo;++e<r;)this.add(t[e])}function ER(t){return this.__data__.set(t,Ah),this}function _R(t){return this.__data__.has(t)}yc.prototype.add=yc.prototype.push=ER;yc.prototype.has=_R;function Yr(t){this.__data__=new Jr(t)}function xR(){this.__data__=new Jr}function SR(t){return this.__data__.delete(t)}function AR(t){return this.__data__.get(t)}function FR(t){return this.__data__.has(t)}function OR(t,e){var r=this.__data__;return r instanceof Jr&&r.__data__.length==_I&&(r=this.__data__=new lo(r.__data__)),r.set(t,e),this}Yr.prototype.clear=xR;Yr.prototype.delete=SR;Yr.prototype.get=AR;Yr.prototype.has=FR;Yr.prototype.set=OR;function Cc(t,e){for(var r=t.length;r--;)if(WR(t[r][0],e))return r;return-1}function Ev(t,e){e=_c(e,t)?[e]:Sv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[xc(e[r++])];return r&&r==n?t:void 0}function _v(t,e){return ao.call(t,e)||typeof t=="object"&&e in t&&HR(t)===null}function kR(t,e){return e in Object(t)}function Oh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Ac(t)&&!ts(e)?t!==t&&e!==e:PR(t,e,Oh,r,n,o)}function PR(t,e,r,n,o,i){var a=vn(t),s=vn(e),u=bh,c=bh;a||(u=Wr(t),u=u==mc?hi:u),s||(c=Wr(e),c=c==mc?hi:c);var l=u==hi&&!vh(t),p=c==hi&&!vh(e),d=u==c;if(d&&!l)return i||(i=new Yr),a||XR(t)?Av(t,e,r,n,o,i):LR(t,e,u,r,n,o,i);if(!(o&gi)){var h=l&&ao.call(t,"__wrapped__"),m=p&&ao.call(e,"__wrapped__");if(h||m){var b=h?t.value():t,D=m?e.value():e;return i||(i=new Yr),r(b,D,n,o,i)}}return d?(i||(i=new Yr),UR(t,e,r,n,o,i)):!1}function $R(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 p=new Yr;if(n)var d=n(c,l,u,t,e,p);if(!(d===void 0?Oh(l,c,n,bc|gi,p):d))return!1}}return!0}function TR(t){return typeof t=="function"?t:t==null?t6:typeof t=="object"?vn(t)?BR(t[0],t[1]):RR(t):r6(t)}function IR(t){return rR(Object(t))}function RR(t){var e=qR(t);return e.length==1&&e[0][2]?kv(e[0][0],e[0][1]):function(r){return r===t||$R(r,t,e)}}function BR(t,e){return _c(t)&&Ov(e)?kv(xc(t),e):function(r){var n=ZR(r,t);return n===void 0&&n===e?QR(r,t):Oh(e,n,void 0,bc|gi)}}function xv(t){return function(e){return e?.[t]}}function jR(t){return function(e){return Ev(e,t)}}function Sv(t){return vn(t)?t:EI(t)}function NR(t){return function(e){var r=Wr(e);return r==Xa?vv(e):r==Za?JI(e):WI(e,t(e))}}function Av(t,e,r,n,o,i){var a=o&gi,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,p=!0,d=o&bc?new yc: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;p=!1;break}if(d){if(!GI(e,function(D,C){if(!d.has(C)&&(h===D||r(h,D,n,o,i)))return d.add(C)})){p=!1;break}}else if(!(h===m||r(h,m,n,o,i))){p=!1;break}}return i.delete(t),p}function LR(t,e,r,n,o,i,a){switch(r){case gc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case wv:return!(t.byteLength!=e.byteLength||!n(new lv(t),new lv(e)));case dv:case hv:return+t==+e;case mv:return t.name==e.name&&t.message==e.message;case Dv:return t!=+t?e!=+e:t==+e;case yv:case Fh:return t==e+"";case Xa:var s=vv;case Za:var u=i&gi;if(s||(s=YI),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=bc,a.set(t,e),Av(s(t),s(e),n,o,i,a));case bv:if(yh)return yh.call(t)==yh.call(e)}return!1}function UR(t,e,r,n,o,i){var a=o&gi,s=Sh(t),u=s.length,c=Sh(e),l=c.length;if(u!=l&&!a)return!1;for(var p=u;p--;){var d=s[p];if(!(a?d in e:_v(e,d)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var b=a;++p<u;){d=s[p];var D=t[d],C=e[d];if(n)var E=a?n(C,D,d,e,t,i):n(D,C,d,t,e,i);if(!(E===void 0?D===C||r(D,C,n,o,i):E)){m=!1;break}b||(b=d=="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 MR=xv("length");function Ec(t,e){var r=t.__data__;return GR(e)?r[typeof e=="string"?"string":"hash"]:r.map}function qR(t){for(var e=e6(t),r=e.length;r--;)e[r][2]=Ov(e[r][1]);return e}function Di(t,e){var r=t[e];return JR(r)?r:void 0}function HR(t){return tR(Object(t))}function Wr(t){return co.call(t)}(Ch&&Wr(new Ch(new ArrayBuffer(1)))!=gc||Dc&&Wr(new Dc)!=Xa||Eh&&Wr(Eh.resolve())!=sv||_h&&Wr(new _h)!=Za||xh&&Wr(new xh)!=wh)&&(Wr=function(t){var e=co.call(t),r=e==hi?t.constructor:void 0,n=r?fo(r):void 0;if(n)switch(n){case nR:return gc;case oR:return Xa;case iR:return sv;case aR:return Za;case sR:return wh}return e});function VR(t,e,r){e=_c(e,t)?[e]:Sv(e);for(var n,o=-1,a=e.length;++o<a;){var i=xc(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&&Sc(a)&&Fv(i,a)&&(vn(t)||Iv(t)||Pv(t))}function zR(t){var e=t?t.length:void 0;return Sc(e)&&(vn(t)||Iv(t)||Pv(t))?KI(e,String):null}function Fv(t,e){return e=e??pv,!!e&&(typeof t=="number"||UI.test(t))&&t>-1&&t%1==0&&t<e}function _c(t,e){if(vn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Rv(t)?!0:jI.test(t)||!BI.test(t)||e!=null&&t in Object(e)}function GR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function KR(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||vc;return t===r}function Ov(t){return t===t&&!Ac(t)}function kv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function xc(t){if(typeof t=="string"||Rv(t))return t;var e=t+"";return e=="0"&&1/t==-xI?"-0":e}function fo(t){if(t!=null){try{return Cv.call(t)}catch{}try{return t+""}catch{}}return""}function WR(t,e){return t===e||t!==t&&e!==e}function Pv(t){return YR(t)&&ao.call(t,"callee")&&(!QI.call(t,"callee")||co.call(t)==mc)}var vn=Array.isArray;function $v(t){return t!=null&&Sc(MR(t))&&!Tv(t)}function YR(t){return ts(t)&&$v(t)}function Tv(t){var e=Ac(t)?co.call(t):"";return e==gv||e==SI}function Sc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=pv}function Ac(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ts(t){return!!t&&typeof t=="object"}function JR(t){if(!Ac(t))return!1;var e=Tv(t)||vh(t)?ZI:LI;return e.test(fo(t))}function Iv(t){return typeof t=="string"||!vn(t)&&ts(t)&&co.call(t)==Fh}function Rv(t){return typeof t=="symbol"||ts(t)&&co.call(t)==bv}function XR(t){return ts(t)&&Sc(t.length)&&!!Be[co.call(t)]}function ZR(t,e,r){var n=t==null?void 0:Ev(t,e);return n===void 0?r:n}function QR(t,e){return t!=null&&VR(t,e,kR)}function Sh(t){var e=KR(t);if(!(e||$v(t)))return IR(t);var r=zR(t),n=!!r,o=r||[],i=o.length;for(var a in t)_v(t,a)&&!(n&&(a=="length"||Fv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var e6=NR(Sh);function t6(t){return t}function r6(t){return _c(t)?xv(xc(t)):jR(t)}mi.exports=TR});var Mv=x((po,yi)=>{var n6=1/0,o6="[object Function]",i6="[object GeneratorFunction]",a6=/[\\^$.*+?()[\]{}|]/g,s6=/^\[object .+?Constructor\]$/,rs={function:!0,object:!0},u6=rs[typeof po]&&po&&!po.nodeType?po:void 0,c6=rs[typeof yi]&&yi&&!yi.nodeType?yi:void 0,l6=Fc(u6&&c6&&typeof global=="object"&&global),f6=Fc(rs[typeof self]&&self),jv=Fc(rs[typeof window]&&window),kh=Fc(rs[typeof po]&&po),p6=l6||jv!==(kh&&kh.window)&&jv||f6||kh||Function("return this")();function Fc(t){return t&&t.Object===Object?t:null}function d6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function h6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Nv=Object.prototype,Lv=Function.prototype.toString,m6=Nv.hasOwnProperty,g6=Nv.toString,D6=RegExp("^"+Lv.call(m6).replace(a6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ph=b6(p6,"Set"),y6=Ph&&1/h6(new Ph([,-0]))[1]==n6?function(t){return new Ph(t)}:E6;function b6(t,e){var r=t[e];return C6(r)?r:void 0}function w6(t){if(t!=null){try{return Lv.call(t)}catch{}try{return t+""}catch{}}return""}function v6(t){var e=Uv(t)?g6.call(t):"";return e==o6||e==i6}function Uv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function C6(t){if(!Uv(t))return!1;var e=v6(t)||d6(t)?D6:s6;return e.test(w6(t))}function E6(){}yi.exports=y6});var Hv=x((ho,bi)=>{var ns={function:!0,object:!0},_6=ns[typeof ho]&&ho&&!ho.nodeType?ho:void 0,x6=ns[typeof bi]&&bi&&!bi.nodeType?bi:void 0,S6=Oc(_6&&x6&&typeof global=="object"&&global),A6=Oc(ns[typeof self]&&self),qv=Oc(ns[typeof window]&&window),$h=Oc(ns[typeof ho]&&ho),F6=S6||qv!==($h&&$h.window)&&qv||A6||$h||Function("return this")();function Oc(t){return t&&t.Object===Object?t:null}bi.exports=F6});var Yv=x((Gz,Wv)=>{var O6=Mv(),k6=Hv(),P6=200,Th="__lodash_hash_undefined__",$6="[object Function]",T6="[object GeneratorFunction]",I6=/[\\^$.*+?()[\]{}|]/g,R6=/^\[object .+?Constructor\]$/;function B6(t,e){return!!t.length&&N6(t,e,0)>-1}function j6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function N6(t,e,r){if(e!==e)return U6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function L6(t,e){return t.has(e)}function U6(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 M6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function q6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var H6=Array.prototype,Vv=Object.prototype,zv=Function.prototype.toString,Ih=Vv.hasOwnProperty,V6=Vv.toString,z6=RegExp("^"+zv.call(Ih).replace(I6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),G6=H6.splice,K6=Gv(k6,"Map"),os=Gv(Object,"create");function mo(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 W6(){this.__data__=os?os(null):{}}function Y6(t){return this.has(t)&&delete this.__data__[t]}function J6(t){var e=this.__data__;if(os){var r=e[t];return r===Th?void 0:r}return Ih.call(e,t)?e[t]:void 0}function X6(t){var e=this.__data__;return os?e[t]!==void 0:Ih.call(e,t)}function Z6(t,e){var r=this.__data__;return r[t]=os&&e===void 0?Th:e,this}mo.prototype.clear=W6;mo.prototype.delete=Y6;mo.prototype.get=J6;mo.prototype.has=X6;mo.prototype.set=Z6;function wi(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 Q6(){this.__data__=[]}function eB(t){var e=this.__data__,r=Pc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():G6.call(e,r,1),!0}function tB(t){var e=this.__data__,r=Pc(e,t);return r<0?void 0:e[r][1]}function rB(t){return Pc(this.__data__,t)>-1}function nB(t,e){var r=this.__data__,n=Pc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}wi.prototype.clear=Q6;wi.prototype.delete=eB;wi.prototype.get=tB;wi.prototype.has=rB;wi.prototype.set=nB;function vi(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 oB(){this.__data__={hash:new mo,map:new(K6||wi),string:new mo}}function iB(t){return $c(this,t).delete(t)}function aB(t){return $c(this,t).get(t)}function sB(t){return $c(this,t).has(t)}function uB(t,e){return $c(this,t).set(t,e),this}vi.prototype.clear=oB;vi.prototype.delete=iB;vi.prototype.get=aB;vi.prototype.has=sB;vi.prototype.set=uB;function kc(t){var e=-1,r=t?t.length:0;for(this.__data__=new vi;++e<r;)this.add(t[e])}function cB(t){return this.__data__.set(t,Th),this}function lB(t){return this.__data__.has(t)}kc.prototype.add=kc.prototype.push=cB;kc.prototype.has=lB;function Pc(t,e){for(var r=t.length;r--;)if(hB(t[r][0],e))return r;return-1}function fB(t,e,r){var n=-1,o=B6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=j6;else if(i>=P6){var c=e?null:O6(t);if(c)return q6(c);a=!1,o=L6,u=new kc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],p=e?e(l):l;if(l=r||l!==0?l:0,a&&p===p){for(var d=u.length;d--;)if(u[d]===p)continue e;e&&u.push(p),s.push(l)}else o(u,p,r)||(u!==s&&u.push(p),s.push(l))}return s}function $c(t,e){var r=t.__data__;return pB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Gv(t,e){var r=t[e];return gB(r)?r:void 0}function pB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function dB(t){if(t!=null){try{return zv.call(t)}catch{}try{return t+""}catch{}}return""}function hB(t,e){return t===e||t!==t&&e!==e}function mB(t){var e=Kv(t)?V6.call(t):"";return e==$6||e==T6}function Kv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function gB(t){if(!Kv(t))return!1;var e=mB(t)||M6(t)?z6:R6;return e.test(dB(t))}Wv.exports=fB});var Xv=x((Kz,Jv)=>{var DB=Bv(),yB=Yv();function bB(t,e){return t&&t.length?yB(t,DB(e)):[]}Jv.exports=bB});var Qv=x((Wz,Zv)=>{"use strict";var wB=Ww(),vB=Xv(),CB=wB("MultiError");Zv.exports=Rh;function Rh(t){if(!(this instanceof Rh))return new Rh(t);if(t=Array.isArray(t)?t:[t],t=vB(t,function(r){return r.stack}),t.length===1)return t[0];var e=new CB({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(`
39
+ `),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 Gw=x((Kz,Kw)=>{"use strict";Kw.exports=to;to.factory=Vw();var dh=to("CustomError");dh.order=to(dh,{message:"Arguments out of order.",code:"EOARG"});function to(t,e,r,n){var o,i;return e=lc(arguments,1,Error,zw,[fh,fc]),r=lc(arguments,2,{},fh,[fc]),n=lc(arguments,3,ph,fc,[]),t=lc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,_I,[zw,fh,fc]),i=e===Error,i&&n===ph&&(n=to.factory.root),o=function(a,s){var u,c,l,p,d,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(y,D){to.factory[m].call(u,y,D,l)}}),p=this.CustomError.chain.length-1;p>=0;p--)d=this.CustomError.chain[p],d.factory!==ph&&d.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 lc(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 dh.order;return a!==-1?t[a]:r}function fc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function _I(t){return typeof t=="string"}function zw(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function fh(t){return t&&typeof t=="object"}function ph(){}});var Yw=x((Gz,Ww)=>{Ww.exports=Gw()});var ev=x((ro,pi)=>{var SI=1/0,xI="[object Symbol]",Ya={function:!0,object:!0},AI=Ya[typeof ro]&&ro&&!ro.nodeType?ro:void 0,FI=Ya[typeof pi]&&pi&&!pi.nodeType?pi:void 0,OI=pc(AI&&FI&&typeof global=="object"&&global),kI=pc(Ya[typeof self]&&self),Jw=pc(Ya[typeof window]&&window),hh=pc(Ya[typeof ro]&&ro),PI=OI||Jw!==(hh&&hh.window)&&Jw||kI||hh||Function("return this")();function pc(t){return t&&t.Object===Object?t:null}var $I=Object.prototype,II=$I.toString,Xw=PI.Symbol,Zw=Xw?Xw.prototype:void 0,Qw=Zw?Zw.toString:void 0;function TI(t){if(typeof t=="string")return t;if(BI(t))return Qw?Qw.call(t):"";var e=t+"";return e=="0"&&1/t==-SI?"-0":e}function RI(t){return!!t&&typeof t=="object"}function BI(t){return typeof t=="symbol"||RI(t)&&II.call(t)==xI}pi.exports=TI});var sv=x((no,di)=>{var LI=ev(),NI="Expected a function",rv="__lodash_hash_undefined__",jI="[object Function]",UI="[object GeneratorFunction]",MI=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,qI=/[\\^$.*+?()[\]{}|]/g,HI=/\\(\\)?/g,VI=/^\[object .+?Constructor\]$/,Xa={function:!0,object:!0},zI=Xa[typeof no]&&no&&!no.nodeType?no:void 0,KI=Xa[typeof di]&&di&&!di.nodeType?di:void 0,GI=dc(zI&&KI&&typeof global=="object"&&global),WI=dc(Xa[typeof self]&&self),tv=dc(Xa[typeof window]&&window),mh=dc(Xa[typeof no]&&no),YI=GI||tv!==(mh&&mh.window)&&tv||WI||mh||Function("return this")();function dc(t){return t&&t.Object===Object?t:null}function JI(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var XI=Array.prototype,nv=Object.prototype,ov=Function.prototype.toString,gh=nv.hasOwnProperty,ZI=nv.toString,QI=RegExp("^"+ov.call(gh).replace(qI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),eT=XI.splice,tT=iv(YI,"Map"),Ja=iv(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 rT(){this.__data__=Ja?Ja(null):{}}function nT(t){return this.has(t)&&delete this.__data__[t]}function oT(t){var e=this.__data__;if(Ja){var r=e[t];return r===rv?void 0:r}return gh.call(e,t)?e[t]:void 0}function iT(t){var e=this.__data__;return Ja?e[t]!==void 0:gh.call(e,t)}function aT(t,e){var r=this.__data__;return r[t]=Ja&&e===void 0?rv:e,this}oo.prototype.clear=rT;oo.prototype.delete=nT;oo.prototype.get=oT;oo.prototype.has=iT;oo.prototype.set=aT;function hi(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 sT(){this.__data__=[]}function uT(t){var e=this.__data__,r=hc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():eT.call(e,r,1),!0}function cT(t){var e=this.__data__,r=hc(e,t);return r<0?void 0:e[r][1]}function lT(t){return hc(this.__data__,t)>-1}function fT(t,e){var r=this.__data__,n=hc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}hi.prototype.clear=sT;hi.prototype.delete=uT;hi.prototype.get=cT;hi.prototype.has=lT;hi.prototype.set=fT;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 pT(){this.__data__={hash:new oo,map:new(tT||hi),string:new oo}}function dT(t){return mc(this,t).delete(t)}function hT(t){return mc(this,t).get(t)}function mT(t){return mc(this,t).has(t)}function gT(t,e){return mc(this,t).set(t,e),this}io.prototype.clear=pT;io.prototype.delete=dT;io.prototype.get=hT;io.prototype.has=mT;io.prototype.set=gT;function hc(t,e){for(var r=t.length;r--;)if(wT(t[r][0],e))return r;return-1}function mc(t,e){var r=t.__data__;return DT(e)?r[typeof e=="string"?"string":"hash"]:r.map}function iv(t,e){var r=t[e];return CT(r)?r:void 0}function DT(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var yT=Dh(function(t){var e=[];return ET(t).replace(MI,function(r,n,o,i){e.push(o?i.replace(HI,"$1"):n||r)}),e});function bT(t){if(t!=null){try{return ov.call(t)}catch{}try{return t+""}catch{}}return""}function Dh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(NI);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(Dh.Cache||io),r}Dh.Cache=io;function wT(t,e){return t===e||t!==t&&e!==e}function vT(t){var e=av(t)?ZI.call(t):"";return e==jI||e==UI}function av(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function CT(t){if(!av(t))return!1;var e=vT(t)||JI(t)?QI:VI;return e.test(bT(t))}function ET(t){return t==null?"":LI(t)}di.exports=yT});var Lv=x((ao,gi)=>{var _T=sv(),ST=200,Fh="__lodash_hash_undefined__",wc=1,Di=2,xT=1/0,dv=9007199254740991,gc="[object Arguments]",wh="[object Array]",hv="[object Boolean]",mv="[object Date]",gv="[object Error]",Dv="[object Function]",AT="[object GeneratorFunction]",Za="[object Map]",yv="[object Number]",mi="[object Object]",uv="[object Promise]",bv="[object RegExp]",Qa="[object Set]",Oh="[object String]",wv="[object Symbol]",vh="[object WeakMap]",vv="[object ArrayBuffer]",Dc="[object DataView]",FT="[object Float32Array]",OT="[object Float64Array]",kT="[object Int8Array]",PT="[object Int16Array]",$T="[object Int32Array]",IT="[object Uint8Array]",TT="[object Uint8ClampedArray]",RT="[object Uint16Array]",BT="[object Uint32Array]",LT=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,NT=/^\w*$/,jT=/[\\^$.*+?()[\]{}|]/g,UT=/^\[object .+?Constructor\]$/,MT=/^(?:0|[1-9]\d*)$/,Le={};Le[FT]=Le[OT]=Le[kT]=Le[PT]=Le[$T]=Le[IT]=Le[TT]=Le[RT]=Le[BT]=!0;Le[gc]=Le[wh]=Le[vv]=Le[hv]=Le[Dc]=Le[mv]=Le[gv]=Le[Dv]=Le[Za]=Le[yv]=Le[mi]=Le[bv]=Le[Qa]=Le[Oh]=Le[vh]=!1;var ts={function:!0,object:!0},qT=ts[typeof ao]&&ao&&!ao.nodeType?ao:void 0,HT=ts[typeof gi]&&gi&&!gi.nodeType?gi:void 0,VT=vc(qT&&HT&&typeof global=="object"&&global),zT=vc(ts[typeof self]&&self),cv=vc(ts[typeof window]&&window),yh=vc(ts[typeof ao]&&ao),co=VT||cv!==(yh&&yh.window)&&cv||zT||yh||Function("return this")();function KT(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function GT(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function WT(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function YT(t,e){return KT(e,function(r){return[r,t[r]]})}function vc(t){return t&&t.Object===Object?t:null}function Ch(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Cv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function JT(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function XT(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var ZT=Array.prototype,Cc=Object.prototype,Ev=Function.prototype.toString,so=Cc.hasOwnProperty,lo=Cc.toString,QT=RegExp("^"+Ev.call(so).replace(jT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lv=co.Symbol,fv=co.Uint8Array,eR=Cc.propertyIsEnumerable,tR=ZT.splice,rR=Object.getPrototypeOf,nR=Object.keys,Eh=yi(co,"DataView"),yc=yi(co,"Map"),_h=yi(co,"Promise"),Sh=yi(co,"Set"),xh=yi(co,"WeakMap"),es=yi(Object,"create"),oR=po(Eh),iR=po(yc),aR=po(_h),sR=po(Sh),uR=po(xh),pv=lv?lv.prototype:void 0,bh=pv?pv.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 cR(){this.__data__=es?es(null):{}}function lR(t){return this.has(t)&&delete this.__data__[t]}function fR(t){var e=this.__data__;if(es){var r=e[t];return r===Fh?void 0:r}return so.call(e,t)?e[t]:void 0}function pR(t){var e=this.__data__;return es?e[t]!==void 0:so.call(e,t)}function dR(t,e){var r=this.__data__;return r[t]=es&&e===void 0?Fh:e,this}uo.prototype.clear=cR;uo.prototype.delete=lR;uo.prototype.get=fR;uo.prototype.has=pR;uo.prototype.set=dR;function Xr(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 hR(){this.__data__=[]}function mR(t){var e=this.__data__,r=Ec(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():tR.call(e,r,1),!0}function gR(t){var e=this.__data__,r=Ec(e,t);return r<0?void 0:e[r][1]}function DR(t){return Ec(this.__data__,t)>-1}function yR(t,e){var r=this.__data__,n=Ec(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Xr.prototype.clear=hR;Xr.prototype.delete=mR;Xr.prototype.get=gR;Xr.prototype.has=DR;Xr.prototype.set=yR;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 bR(){this.__data__={hash:new uo,map:new(yc||Xr),string:new uo}}function wR(t){return _c(this,t).delete(t)}function vR(t){return _c(this,t).get(t)}function CR(t){return _c(this,t).has(t)}function ER(t,e){return _c(this,t).set(t,e),this}fo.prototype.clear=bR;fo.prototype.delete=wR;fo.prototype.get=vR;fo.prototype.has=CR;fo.prototype.set=ER;function bc(t){var e=-1,r=t?t.length:0;for(this.__data__=new fo;++e<r;)this.add(t[e])}function _R(t){return this.__data__.set(t,Fh),this}function SR(t){return this.__data__.has(t)}bc.prototype.add=bc.prototype.push=_R;bc.prototype.has=SR;function Jr(t){this.__data__=new Xr(t)}function xR(){this.__data__=new Xr}function AR(t){return this.__data__.delete(t)}function FR(t){return this.__data__.get(t)}function OR(t){return this.__data__.has(t)}function kR(t,e){var r=this.__data__;return r instanceof Xr&&r.__data__.length==ST&&(r=this.__data__=new fo(r.__data__)),r.set(t,e),this}Jr.prototype.clear=xR;Jr.prototype.delete=AR;Jr.prototype.get=FR;Jr.prototype.has=OR;Jr.prototype.set=kR;function Ec(t,e){for(var r=t.length;r--;)if(YR(t[r][0],e))return r;return-1}function _v(t,e){e=Sc(e,t)?[e]:Av(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[xc(e[r++])];return r&&r==n?t:void 0}function Sv(t,e){return so.call(t,e)||typeof t=="object"&&e in t&&VR(t)===null}function PR(t,e){return e in Object(t)}function kh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Fc(t)&&!rs(e)?t!==t&&e!==e:$R(t,e,kh,r,n,o)}function $R(t,e,r,n,o,i){var a=Cn(t),s=Cn(e),u=wh,c=wh;a||(u=Yr(t),u=u==gc?mi:u),s||(c=Yr(e),c=c==gc?mi:c);var l=u==mi&&!Ch(t),p=c==mi&&!Ch(e),d=u==c;if(d&&!l)return i||(i=new Jr),a||ZR(t)?Fv(t,e,r,n,o,i):UR(t,e,u,r,n,o,i);if(!(o&Di)){var h=l&&so.call(t,"__wrapped__"),m=p&&so.call(e,"__wrapped__");if(h||m){var y=h?t.value():t,D=m?e.value():e;return i||(i=new Jr),r(y,D,n,o,i)}}return d?(i||(i=new Jr),MR(t,e,r,n,o,i)):!1}function IR(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 p=new Jr;if(n)var d=n(c,l,u,t,e,p);if(!(d===void 0?kh(l,c,n,wc|Di,p):d))return!1}}return!0}function TR(t){return typeof t=="function"?t:t==null?rB:typeof t=="object"?Cn(t)?LR(t[0],t[1]):BR(t):nB(t)}function RR(t){return nR(Object(t))}function BR(t){var e=HR(t);return e.length==1&&e[0][2]?Pv(e[0][0],e[0][1]):function(r){return r===t||IR(r,t,e)}}function LR(t,e){return Sc(t)&&kv(e)?Pv(xc(t),e):function(r){var n=QR(r,t);return n===void 0&&n===e?eB(r,t):kh(e,n,void 0,wc|Di)}}function xv(t){return function(e){return e?.[t]}}function NR(t){return function(e){return _v(e,t)}}function Av(t){return Cn(t)?t:_T(t)}function jR(t){return function(e){var r=Yr(e);return r==Za?Cv(e):r==Qa?XT(e):YT(e,t(e))}}function Fv(t,e,r,n,o,i){var a=o&Di,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,p=!0,d=o&wc?new bc:void 0;for(i.set(t,e);++l<s;){var h=t[l],m=e[l];if(n)var y=a?n(m,h,l,e,t,i):n(h,m,l,t,e,i);if(y!==void 0){if(y)continue;p=!1;break}if(d){if(!GT(e,function(D,C){if(!d.has(C)&&(h===D||r(h,D,n,o,i)))return d.add(C)})){p=!1;break}}else if(!(h===m||r(h,m,n,o,i))){p=!1;break}}return i.delete(t),p}function UR(t,e,r,n,o,i,a){switch(r){case Dc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case vv:return!(t.byteLength!=e.byteLength||!n(new fv(t),new fv(e)));case hv:case mv:return+t==+e;case gv:return t.name==e.name&&t.message==e.message;case yv:return t!=+t?e!=+e:t==+e;case bv:case Oh:return t==e+"";case Za:var s=Cv;case Qa:var u=i&Di;if(s||(s=JT),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=wc,a.set(t,e),Fv(s(t),s(e),n,o,i,a));case wv:if(bh)return bh.call(t)==bh.call(e)}return!1}function MR(t,e,r,n,o,i){var a=o&Di,s=Ah(t),u=s.length,c=Ah(e),l=c.length;if(u!=l&&!a)return!1;for(var p=u;p--;){var d=s[p];if(!(a?d in e:Sv(e,d)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var y=a;++p<u;){d=s[p];var D=t[d],C=e[d];if(n)var E=a?n(C,D,d,e,t,i):n(D,C,d,t,e,i);if(!(E===void 0?D===C||r(D,C,n,o,i):E)){m=!1;break}y||(y=d=="constructor")}if(m&&!y){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 qR=xv("length");function _c(t,e){var r=t.__data__;return GR(e)?r[typeof e=="string"?"string":"hash"]:r.map}function HR(t){for(var e=tB(t),r=e.length;r--;)e[r][2]=kv(e[r][1]);return e}function yi(t,e){var r=t[e];return XR(r)?r:void 0}function VR(t){return rR(Object(t))}function Yr(t){return lo.call(t)}(Eh&&Yr(new Eh(new ArrayBuffer(1)))!=Dc||yc&&Yr(new yc)!=Za||_h&&Yr(_h.resolve())!=uv||Sh&&Yr(new Sh)!=Qa||xh&&Yr(new xh)!=vh)&&(Yr=function(t){var e=lo.call(t),r=e==mi?t.constructor:void 0,n=r?po(r):void 0;if(n)switch(n){case oR:return Dc;case iR:return Za;case aR:return uv;case sR:return Qa;case uR:return vh}return e});function zR(t,e,r){e=Sc(e,t)?[e]:Av(e);for(var n,o=-1,a=e.length;++o<a;){var i=xc(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&&Ac(a)&&Ov(i,a)&&(Cn(t)||Rv(t)||$v(t))}function KR(t){var e=t?t.length:void 0;return Ac(e)&&(Cn(t)||Rv(t)||$v(t))?WT(e,String):null}function Ov(t,e){return e=e??dv,!!e&&(typeof t=="number"||MT.test(t))&&t>-1&&t%1==0&&t<e}function Sc(t,e){if(Cn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Bv(t)?!0:NT.test(t)||!LT.test(t)||e!=null&&t in Object(e)}function GR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function WR(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Cc;return t===r}function kv(t){return t===t&&!Fc(t)}function Pv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function xc(t){if(typeof t=="string"||Bv(t))return t;var e=t+"";return e=="0"&&1/t==-xT?"-0":e}function po(t){if(t!=null){try{return Ev.call(t)}catch{}try{return t+""}catch{}}return""}function YR(t,e){return t===e||t!==t&&e!==e}function $v(t){return JR(t)&&so.call(t,"callee")&&(!eR.call(t,"callee")||lo.call(t)==gc)}var Cn=Array.isArray;function Iv(t){return t!=null&&Ac(qR(t))&&!Tv(t)}function JR(t){return rs(t)&&Iv(t)}function Tv(t){var e=Fc(t)?lo.call(t):"";return e==Dv||e==AT}function Ac(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=dv}function Fc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function rs(t){return!!t&&typeof t=="object"}function XR(t){if(!Fc(t))return!1;var e=Tv(t)||Ch(t)?QT:UT;return e.test(po(t))}function Rv(t){return typeof t=="string"||!Cn(t)&&rs(t)&&lo.call(t)==Oh}function Bv(t){return typeof t=="symbol"||rs(t)&&lo.call(t)==wv}function ZR(t){return rs(t)&&Ac(t.length)&&!!Le[lo.call(t)]}function QR(t,e,r){var n=t==null?void 0:_v(t,e);return n===void 0?r:n}function eB(t,e){return t!=null&&zR(t,e,PR)}function Ah(t){var e=WR(t);if(!(e||Iv(t)))return RR(t);var r=KR(t),n=!!r,o=r||[],i=o.length;for(var a in t)Sv(t,a)&&!(n&&(a=="length"||Ov(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var tB=jR(Ah);function rB(t){return t}function nB(t){return Sc(t)?xv(xc(t)):NR(t)}gi.exports=TR});var qv=x((ho,bi)=>{var oB=1/0,iB="[object Function]",aB="[object GeneratorFunction]",sB=/[\\^$.*+?()[\]{}|]/g,uB=/^\[object .+?Constructor\]$/,ns={function:!0,object:!0},cB=ns[typeof ho]&&ho&&!ho.nodeType?ho:void 0,lB=ns[typeof bi]&&bi&&!bi.nodeType?bi:void 0,fB=Oc(cB&&lB&&typeof global=="object"&&global),pB=Oc(ns[typeof self]&&self),Nv=Oc(ns[typeof window]&&window),Ph=Oc(ns[typeof ho]&&ho),dB=fB||Nv!==(Ph&&Ph.window)&&Nv||pB||Ph||Function("return this")();function Oc(t){return t&&t.Object===Object?t:null}function hB(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,Uv=Function.prototype.toString,gB=jv.hasOwnProperty,DB=jv.toString,yB=RegExp("^"+Uv.call(gB).replace(sB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$h=wB(dB,"Set"),bB=$h&&1/mB(new $h([,-0]))[1]==oB?function(t){return new $h(t)}:_B;function wB(t,e){var r=t[e];return EB(r)?r:void 0}function vB(t){if(t!=null){try{return Uv.call(t)}catch{}try{return t+""}catch{}}return""}function CB(t){var e=Mv(t)?DB.call(t):"";return e==iB||e==aB}function Mv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function EB(t){if(!Mv(t))return!1;var e=CB(t)||hB(t)?yB:uB;return e.test(vB(t))}function _B(){}bi.exports=bB});var Vv=x((mo,wi)=>{var os={function:!0,object:!0},SB=os[typeof mo]&&mo&&!mo.nodeType?mo:void 0,xB=os[typeof wi]&&wi&&!wi.nodeType?wi:void 0,AB=kc(SB&&xB&&typeof global=="object"&&global),FB=kc(os[typeof self]&&self),Hv=kc(os[typeof window]&&window),Ih=kc(os[typeof mo]&&mo),OB=AB||Hv!==(Ih&&Ih.window)&&Hv||FB||Ih||Function("return this")();function kc(t){return t&&t.Object===Object?t:null}wi.exports=OB});var Jv=x((Wz,Yv)=>{var kB=qv(),PB=Vv(),$B=200,Th="__lodash_hash_undefined__",IB="[object Function]",TB="[object GeneratorFunction]",RB=/[\\^$.*+?()[\]{}|]/g,BB=/^\[object .+?Constructor\]$/;function LB(t,e){return!!t.length&&jB(t,e,0)>-1}function NB(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function jB(t,e,r){if(e!==e)return MB(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function UB(t,e){return t.has(e)}function MB(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 qB(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function HB(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var VB=Array.prototype,zv=Object.prototype,Kv=Function.prototype.toString,Rh=zv.hasOwnProperty,zB=zv.toString,KB=RegExp("^"+Kv.call(Rh).replace(RB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),GB=VB.splice,WB=Gv(PB,"Map"),is=Gv(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 YB(){this.__data__=is?is(null):{}}function JB(t){return this.has(t)&&delete this.__data__[t]}function XB(t){var e=this.__data__;if(is){var r=e[t];return r===Th?void 0:r}return Rh.call(e,t)?e[t]:void 0}function ZB(t){var e=this.__data__;return is?e[t]!==void 0:Rh.call(e,t)}function QB(t,e){var r=this.__data__;return r[t]=is&&e===void 0?Th:e,this}go.prototype.clear=YB;go.prototype.delete=JB;go.prototype.get=XB;go.prototype.has=ZB;go.prototype.set=QB;function vi(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 e6(){this.__data__=[]}function t6(t){var e=this.__data__,r=$c(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():GB.call(e,r,1),!0}function r6(t){var e=this.__data__,r=$c(e,t);return r<0?void 0:e[r][1]}function n6(t){return $c(this.__data__,t)>-1}function o6(t,e){var r=this.__data__,n=$c(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}vi.prototype.clear=e6;vi.prototype.delete=t6;vi.prototype.get=r6;vi.prototype.has=n6;vi.prototype.set=o6;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 i6(){this.__data__={hash:new go,map:new(WB||vi),string:new go}}function a6(t){return Ic(this,t).delete(t)}function s6(t){return Ic(this,t).get(t)}function u6(t){return Ic(this,t).has(t)}function c6(t,e){return Ic(this,t).set(t,e),this}Ci.prototype.clear=i6;Ci.prototype.delete=a6;Ci.prototype.get=s6;Ci.prototype.has=u6;Ci.prototype.set=c6;function Pc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ci;++e<r;)this.add(t[e])}function l6(t){return this.__data__.set(t,Th),this}function f6(t){return this.__data__.has(t)}Pc.prototype.add=Pc.prototype.push=l6;Pc.prototype.has=f6;function $c(t,e){for(var r=t.length;r--;)if(m6(t[r][0],e))return r;return-1}function p6(t,e,r){var n=-1,o=LB,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=NB;else if(i>=$B){var c=e?null:kB(t);if(c)return HB(c);a=!1,o=UB,u=new Pc}else u=e?[]:s;e:for(;++n<i;){var l=t[n],p=e?e(l):l;if(l=r||l!==0?l:0,a&&p===p){for(var d=u.length;d--;)if(u[d]===p)continue e;e&&u.push(p),s.push(l)}else o(u,p,r)||(u!==s&&u.push(p),s.push(l))}return s}function Ic(t,e){var r=t.__data__;return d6(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Gv(t,e){var r=t[e];return D6(r)?r:void 0}function d6(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function h6(t){if(t!=null){try{return Kv.call(t)}catch{}try{return t+""}catch{}}return""}function m6(t,e){return t===e||t!==t&&e!==e}function g6(t){var e=Wv(t)?zB.call(t):"";return e==IB||e==TB}function Wv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function D6(t){if(!Wv(t))return!1;var e=g6(t)||qB(t)?KB:BB;return e.test(h6(t))}Yv.exports=p6});var Zv=x((Yz,Xv)=>{var y6=Lv(),b6=Jv();function w6(t,e){return t&&t.length?b6(t,y6(e)):[]}Xv.exports=w6});var eC=x((Jz,Qv)=>{"use strict";var v6=Yw(),C6=Zv(),E6=v6("MultiError");Qv.exports=Bh;function Bh(t){if(!(this instanceof Bh))return new Bh(t);if(t=Array.isArray(t)?t:[t],t=C6(t,function(r){return r.stack}),t.length===1)return t[0];var e=new E6({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(`
40
40
 
41
41
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
42
42
 
43
- `)}),e}});var tC=x((Yz,eC)=>{var Cn=require("constants"),EB=process.cwd,Tc=null,_B=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Tc||(Tc=EB.call(process)),Tc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Bh=process.chdir,process.chdir=function(t){Tc=null,Bh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Bh));var Bh;eC.exports=xB;function xB(t){Cn.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,p,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,p,d,h){h&&process.nextTick(h)},t.lchownSync=function(){}),_B==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function p(d,h,m){var b=Date.now(),D=0;l(d,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(d,h,C):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function p(d,h,m,b,D,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,S,P){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,d,h,m,b,D,E);C.apply(this,arguments)}}return l.call(t,d,h,m,b,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(p,d,h,m,b){for(var D=0;;)try{return l.call(t,p,d,h,m,b)}catch(C){if(C.code==="EAGAIN"&&D<10){D++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(p,d,h){l.open(p,Cn.O_WRONLY|Cn.O_SYMLINK,d,function(m,b){if(m){h&&h(m);return}l.fchmod(b,d,function(D){l.close(b,function(C){h&&h(D||C)})})})},l.lchmodSync=function(p,d){var h=l.openSync(p,Cn.O_WRONLY|Cn.O_SYMLINK,d),m=!0,b;try{b=l.fchmodSync(h,d),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return b}}function r(l){Cn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(p,d,h,m){l.open(p,Cn.O_SYMLINK,function(b,D){if(b){m&&m(b);return}l.futimes(D,d,h,function(C){l.close(D,function(E){m&&m(C||E)})})})},l.lutimesSync=function(p,d,h){var m=l.openSync(p,Cn.O_SYMLINK),b,D=!0;try{b=l.futimesSync(m,d,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return b}):l.futimes&&(l.lutimes=function(p,d,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(p,d,h){return l.call(t,p,d,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(p,d){try{return l.call(t,p,d)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(p,d,h,m){return l.call(t,p,d,h,function(b){c(b)&&(b=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(p,d,h){try{return l.call(t,p,d,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(p,d,h){typeof d=="function"&&(h=d,d=null);function m(b,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return d?l.call(t,p,d,m):l.call(t,p,m)}}function u(l){return l&&function(p,d){var h=d?l.call(t,p,d):l.call(t,p);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 p=!process.getuid||process.getuid()!==0;return!!(p&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var oC=x((Jz,nC)=>{var rC=require("stream").Stream;nC.exports=SB;function SB(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);rC.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,p){if(l){i.emit("error",l),i.readable=!1;return}i.fd=p,i.emit("open",p),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);rC.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 aC=x((Xz,iC)=>{"use strict";iC.exports=FB;var AB=Object.getPrototypeOf||function(t){return t.__proto__};function FB(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:AB(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var En=x((Zz,Lh)=>{var ze=require("fs"),OB=tC(),kB=oC(),PB=aC(),Ic=require("util"),dt,Bc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(dt=Symbol.for("graceful-fs.queue"),Bc=Symbol.for("graceful-fs.previous")):(dt="___graceful-fs.queue",Bc="___graceful-fs.previous");function $B(){}function cC(t,e){Object.defineProperty(t,dt,{get:function(){return e}})}var go=$B;Ic.debuglog?go=Ic.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(go=function(){var t=Ic.format.apply(Ic,arguments);t="GFS4: "+t.split(/\n/).join(`
44
- GFS4: `),console.error(t)});ze[dt]||(sC=global[dt]||[],cC(ze,sC),ze.close=(function(t){function e(r,n){return t.call(ze,r,function(o){o||uC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Bc,{value:t}),e})(ze.close),ze.closeSync=(function(t){function e(r){t.apply(ze,arguments),uC()}return Object.defineProperty(e,Bc,{value:t}),e})(ze.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){go(ze[dt]),require("assert").equal(ze[dt].length,0)}));var sC;global[dt]||cC(global,ze[dt]);Lh.exports=jh(PB(ze));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ze.__patched&&(Lh.exports=jh(ze),ze.__patched=!0);function jh(t){OB(t),t.gracefulify=jh,t.createReadStream=S,t.createWriteStream=P;var e=t.readFile;t.readFile=r;function r(R,N,F){return typeof N=="function"&&(F=N,N=null),U(R,N,F);function U(M,Q,$,y){return e(M,Q,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Ci([U,[M,Q,$],w,y||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,y,w,v){return n(Q,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ci([M,[Q,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,y,w,v){return i(Q,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ci([M,[Q,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(R,N,F,U){return typeof F=="function"&&(U=F,F=0),M(R,N,F,U);function M(Q,$,y,w,v){return s(Q,$,y,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ci([M,[Q,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=p;var l=/^v[0-5]\./;function p(R,N,F){typeof N=="function"&&(F=N,N=null);var U=l.test(process.version)?function($,y,w,v){return c($,M($,y,w,v))}:function($,y,w,v){return c($,y,M($,y,w,v))};return U(R,N,F);function M(Q,$,y,w){return function(v,A){v&&(v.code==="EMFILE"||v.code==="ENFILE")?Ci([U,[Q,$,y],v,w||Date.now(),Date.now()]):(A&&A.sort&&A.sort(),typeof y=="function"&&y.call(this,v,A))}}}if(process.version.substr(0,4)==="v0.8"){var d=kB(t);C=d.ReadStream,g=d.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(R){C=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var b=C;Object.defineProperty(t,"FileReadStream",{get:function(){return b},set:function(R){b=R},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(R){D=R},enumerable:!0,configurable:!0});function C(R,N){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var R=this;B(R.path,R.flags,R.mode,function(N,F){N?(R.autoClose&&R.destroy(),R.emit("error",N)):(R.fd=F,R.emit("open",F),R.read())})}function g(R,N){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var R=this;B(R.path,R.flags,R.mode,function(N,F){N?(R.destroy(),R.emit("error",N)):(R.fd=F,R.emit("open",F))})}function S(R,N){return new t.ReadStream(R,N)}function P(R,N){return new t.WriteStream(R,N)}var k=t.open;t.open=B;function B(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,y,w,v){return k(Q,$,y,function(A,I){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ci([M,[Q,$,y,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Ci(t){go("ENQUEUE",t[0].name,t[1]),ze[dt].push(t),Nh()}var Rc;function uC(){for(var t=Date.now(),e=0;e<ze[dt].length;++e)ze[dt][e].length>2&&(ze[dt][e][3]=t,ze[dt][e][4]=t);Nh()}function Nh(){if(clearTimeout(Rc),Rc=void 0,ze[dt].length!==0){var t=ze[dt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)go("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){go("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?(go("RETRY",e.name,r),e.apply(null,r.concat([o]))):ze[dt].push(t)}Rc===void 0&&(Rc=setTimeout(Nh,0))}}});var fC=x((Qz,lC)=>{function nr(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))}lC.exports=nr;nr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};nr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};nr.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};nr.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)};nr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};nr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};nr.prototype.start=nr.prototype.try;nr.prototype.errors=function(){return this._errors};nr.prototype.attempts=function(){return this._attempts};nr.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 pC=x(Do=>{var TB=fC();Do.operation=function(t){var e=Do.timeouts(t);return new TB(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),p=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),p.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var hC=x((tG,dC)=>{dC.exports=pC()});var mC=x((rG,jc)=>{jc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&jc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&jc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var qh=x((nG,xi)=>{var Le=global.process,yo=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"};yo(Le)?(gC=require("assert"),Ei=mC(),DC=/^win/i.test(Le.platform),is=require("events"),typeof is!="function"&&(is=is.EventEmitter),Le.__signal_exit_emitter__?ot=Le.__signal_exit_emitter__:(ot=Le.__signal_exit_emitter__=new is,ot.count=0,ot.emitted={}),ot.infinite||(ot.setMaxListeners(1/0),ot.infinite=!0),xi.exports=function(t,e){if(!yo(global.process))return function(){};gC.equal(typeof t,"function","a callback must be provided for exit handler"),_i===!1&&Uh();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){ot.removeListener(r,t),ot.listeners("exit").length===0&&ot.listeners("afterexit").length===0&&Nc()};return ot.on(r,t),n},Nc=function(){!_i||!yo(global.process)||(_i=!1,Ei.forEach(function(e){try{Le.removeListener(e,Lc[e])}catch{}}),Le.emit=Uc,Le.reallyExit=Mh,ot.count-=1)},xi.exports.unload=Nc,bo=function(e,r,n){ot.emitted[e]||(ot.emitted[e]=!0,ot.emit(e,r,n))},Lc={},Ei.forEach(function(t){Lc[t]=function(){if(yo(global.process)){var r=Le.listeners(t);r.length===ot.count&&(Nc(),bo("exit",null,t),bo("afterexit",null,t),DC&&t==="SIGHUP"&&(t="SIGINT"),Le.kill(Le.pid,t))}}}),xi.exports.signals=function(){return Ei},_i=!1,Uh=function(){_i||!yo(global.process)||(_i=!0,ot.count+=1,Ei=Ei.filter(function(e){try{return Le.on(e,Lc[e]),!0}catch{return!1}}),Le.emit=bC,Le.reallyExit=yC)},xi.exports.load=Uh,Mh=Le.reallyExit,yC=function(e){yo(global.process)&&(Le.exitCode=e||0,bo("exit",Le.exitCode,null),bo("afterexit",Le.exitCode,null),Mh.call(Le,Le.exitCode))},Uc=Le.emit,bC=function(e,r){if(e==="exit"&&yo(global.process)){r!==void 0&&(Le.exitCode=r);var n=Uc.apply(this,arguments);return bo("exit",Le.exitCode,null),bo("afterexit",Le.exitCode,null),n}else return Uc.apply(this,arguments)}):xi.exports=function(){return function(){}};var gC,Ei,DC,is,ot,Nc,bo,Lc,_i,Uh,Mh,yC,Uc,bC});var vC=x((oG,Hh)=>{"use strict";var wC=Symbol();function IB(t,e,r){let n=e[wC];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,wC,{value:u}),r(null,s.mtime,u)})})}function RB(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Hh.exports.probe=IB;Hh.exports.getMtime=RB});var SC=x((iG,ss)=>{"use strict";var BB=require("path"),Gh=En(),jB=hC(),NB=qh(),CC=vC(),Xr={};function as(t,e){return e.lockfilePath||`${t}.lock`}function Kh(t,e,r){if(!e.realpath)return r(null,BB.resolve(t));e.fs.realpath(t,r)}function zh(t,e,r){let n=as(t,e);e.fs.mkdir(n,o=>{if(!o)return CC.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"?zh(t,{...e,stale:0},r):r(i);if(!EC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));_C(t,e,s=>{if(s)return r(s);zh(t,{...e,stale:0},r)})})})}function EC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function _C(t,e,r){e.fs.rmdir(as(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Mc(t,e){let r=Xr[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?Vh(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Mc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return Vh(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=CC.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?Vh(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Mc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,Mc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function Vh(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Xr[t]===e&&delete Xr[t],e.options.onCompromised(r)}function LB(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Gh,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),Kh(t,e,(n,o)=>{if(n)return r(n);let i=jB.operation(e.retries);i.attempt(()=>{zh(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=Xr[o]={lockfilePath:as(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};Mc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));xC(o,{...e,realpath:!1},l)})})})})}function xC(t,e,r){e={fs:Gh,realpath:!0,...e},Kh(t,e,(n,o)=>{if(n)return r(n);let i=Xr[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 Xr[o],_C(o,e,r)})}function UB(t,e,r){e={stale:1e4,realpath:!0,fs:Gh,...e},e.stale=Math.max(e.stale||0,2e3),Kh(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(as(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!EC(a,e)))})}function MB(){return Xr}NB(()=>{for(let t in Xr){let e=Xr[t].options;try{e.fs.rmdirSync(as(t,e))}catch{}}});ss.exports.lock=LB;ss.exports.unlock=xC;ss.exports.check=UB;ss.exports.getLocks=MB});var FC=x((aG,AC)=>{"use strict";var qB=En();function HB(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 VB(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function zB(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function GB(t){if(t={...t},t.fs=HB(t.fs||qB),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}AC.exports={toPromise:VB,toSync:zB,toSyncOptions:GB}});var kC=x((sG,_n)=>{"use strict";var Si=SC(),{toPromise:qc,toSync:Hc,toSyncOptions:Wh}=FC();async function OC(t,e){let r=await qc(Si.lock)(t,e);return qc(r)}function KB(t,e){let r=Hc(Si.lock)(t,Wh(e));return Hc(r)}function WB(t,e){return qc(Si.unlock)(t,e)}function YB(t,e){return Hc(Si.unlock)(t,Wh(e))}function JB(t,e){return qc(Si.check)(t,e)}function XB(t,e){return Hc(Si.check)(t,Wh(e))}_n.exports=OC;_n.exports.lock=OC;_n.exports.unlock=WB;_n.exports.lockSync=KB;_n.exports.unlockSync=YB;_n.exports.check=JB;_n.exports.checkSync=XB});var RC=x(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.canStoreURLs=Ai.FileUrlStorage=void 0;var PC=require("fs"),ZB=e8(Qv()),$C=QB(kC());function IC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(IC=function(n){return n?r:e})(t)}function QB(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=IC(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 e8(t){return t&&t.__esModule?t:{default:t}}function us(t){"@babel/helpers - typeof";return us=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},us(t)}function t8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TC(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,n8(n.key),n)}}function r8(t,e,r){return e&&TC(t.prototype,e),r&&TC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function n8(t){var e=o8(t,"string");return us(e)=="symbol"?e:e+""}function o8(t,e){if(us(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(us(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uG=Ai.canStoreURLs=!0,cG=Ai.FileUrlStorage=(function(){function t(e){t8(this,t),this.path=e}return r8(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;$C.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;$C.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,ZB.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,PC.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,PC.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 Xh=x(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});Object.defineProperty(jt,"DefaultHttpStack",{enumerable:!0,get:function(){return LC.default}});Object.defineProperty(jt,"DetailedError",{enumerable:!0,get:function(){return i8.default}});Object.defineProperty(jt,"FileUrlStorage",{enumerable:!0,get:function(){return UC.FileUrlStorage}});Object.defineProperty(jt,"StreamSource",{enumerable:!0,get:function(){return l8.default}});jt.Upload=void 0;Object.defineProperty(jt,"canStoreURLs",{enumerable:!0,get:function(){return UC.canStoreURLs}});jt.defaultOptions=void 0;Object.defineProperty(jt,"enableDebugLog",{enumerable:!0,get:function(){return a8.enableDebugLog}});jt.isSupported=void 0;var i8=wo(Vd()),a8=zd(),s8=wo(Rb()),Yh=wo(fw()),u8=wo(_w()),c8=wo(Fw()),LC=wo(qw()),l8=wo(ih()),UC=RC();function wo(t){return t&&t.__esModule?t:{default:t}}function Oi(t){"@babel/helpers - typeof";return Oi=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},Oi(t)}function f8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BC(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,qC(n.key),n)}}function p8(t,e,r){return e&&BC(t.prototype,e),r&&BC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function d8(t,e,r){return e=Vc(e),h8(t,MC()?Reflect.construct(e,r||[],Vc(t).constructor):e.apply(t,r))}function h8(t,e){if(e&&(Oi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m8(t)}function m8(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function MC(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(MC=function(){return!!t})()}function Vc(t){return Vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vc(t)}function g8(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&&Jh(t,e)}function Jh(t,e){return Jh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Jh(t,e)}function jC(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 Fi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jC(Object(r),!0).forEach(function(n){D8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function D8(t,e,r){return e=qC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qC(t){var e=y8(t,"string");return Oi(e)=="symbol"?e:e+""}function y8(t,e){if(Oi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Oi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var NC=jt.defaultOptions=Fi(Fi({},Yh.default.defaultOptions),{},{httpStack:new LC.default,fileReader:new u8.default,urlStorage:new s8.default,fingerprint:c8.default}),fG=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 f8(this,e),n=Fi(Fi({},NC),n),d8(this,e,[r,n])}return g8(e,t),p8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Fi(Fi({},NC),o),Yh.default.terminate(n,o)}}])})(Yh.default),pG=jt.isSupported=!0});var KC=x((FG,GC)=>{var ki=1e3,Pi=ki*60,$i=Pi*60,vo=$i*24,A8=vo*7,F8=vo*365.25;GC.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return O8(t);if(r==="number"&&isFinite(t))return e.long?P8(t):k8(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function O8(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*F8;case"weeks":case"week":case"w":return r*A8;case"days":case"day":case"d":return r*vo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*$i;case"minutes":case"minute":case"mins":case"min":case"m":return r*Pi;case"seconds":case"second":case"secs":case"sec":case"s":return r*ki;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function k8(t){var e=Math.abs(t);return e>=vo?Math.round(t/vo)+"d":e>=$i?Math.round(t/$i)+"h":e>=Pi?Math.round(t/Pi)+"m":e>=ki?Math.round(t/ki)+"s":t+"ms"}function P8(t){var e=Math.abs(t);return e>=vo?Gc(t,e,vo,"day"):e>=$i?Gc(t,e,$i,"hour"):e>=Pi?Gc(t,e,Pi,"minute"):e>=ki?Gc(t,e,ki,"second"):t+" ms"}function Gc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var em=x((OG,WC)=>{function $8(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=KC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let p=0;for(let d=0;d<l.length;d++)p=(p<<5)-p+l.charCodeAt(d),p|=0;return r.colors[Math.abs(p)%r.colors.length]}r.selectColor=e;function r(l){let p,d=null,h,m;function b(...D){if(!b.enabled)return;let C=b,E=Number(new Date),g=E-(p||E);C.diff=g,C.prev=p,C.curr=E,p=E,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(P,k)=>{if(P==="%%")return"%";_++;let B=r.formatters[k];if(typeof B=="function"){let R=D[_];P=B.call(C,R),D.splice(_,1),_--}return P}),r.formatArgs.call(C,D),(C.log||r.log).apply(C,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:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{d=D}}),typeof r.init=="function"&&r.init(b),b}function n(l,p){let d=r(this.namespace+(typeof p>"u"?":":p)+l);return d.log=this.log,d}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let p=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of p)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function i(l,p){let d=0,h=0,m=-1,b=0;for(;d<l.length;)if(h<p.length&&(p[h]===l[d]||p[h]==="*"))p[h]==="*"?(m=h,b=d,h++):(d++,h++);else if(m!==-1)h=m+1,b++,d=b;else return!1;for(;h<p.length&&p[h]==="*";)h++;return h===p.length}function a(){let l=[...r.names,...r.skips.map(p=>"-"+p)].join(",");return r.enable(""),l}function s(l){for(let p of r.skips)if(i(l,p))return!1;for(let p of r.names)if(i(l,p))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}WC.exports=$8});var YC=x((Nt,Kc)=>{Nt.formatArgs=I8;Nt.save=R8;Nt.load=B8;Nt.useColors=T8;Nt.storage=j8();Nt.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`."))}})();Nt.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 T8(){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 I8(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Kc.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)}Nt.log=console.debug||console.log||(()=>{});function R8(t){try{t?Nt.storage.setItem("debug",t):Nt.storage.removeItem("debug")}catch{}}function B8(){let t;try{t=Nt.storage.getItem("debug")||Nt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function j8(){try{return localStorage}catch{}}Kc.exports=em()(Nt);var{formatters:N8}=Kc.exports;N8.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var XC=x((kG,JC)=>{"use strict";JC.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 eE=x((PG,QC)=>{"use strict";var L8=require("os"),ZC=require("tty"),sr=XC(),{env:at}=process,xn;sr("no-color")||sr("no-colors")||sr("color=false")||sr("color=never")?xn=0:(sr("color")||sr("colors")||sr("color=true")||sr("color=always"))&&(xn=1);"FORCE_COLOR"in at&&(at.FORCE_COLOR==="true"?xn=1:at.FORCE_COLOR==="false"?xn=0:xn=at.FORCE_COLOR.length===0?1:Math.min(parseInt(at.FORCE_COLOR,10),3));function tm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function rm(t,e){if(xn===0)return 0;if(sr("color=16m")||sr("color=full")||sr("color=truecolor"))return 3;if(sr("color=256"))return 2;if(t&&!e&&xn===void 0)return 0;let r=xn||0;if(at.TERM==="dumb")return r;if(process.platform==="win32"){let n=L8.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in at)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in at)||at.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in at)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(at.TEAMCITY_VERSION)?1:0;if(at.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in at){let n=parseInt((at.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(at.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(at.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(at.TERM)||"COLORTERM"in at?1:r}function U8(t){let e=rm(t,t&&t.isTTY);return tm(e)}QC.exports={supportsColor:U8,stdout:tm(rm(!0,ZC.isatty(1))),stderr:tm(rm(!0,ZC.isatty(2)))}});var rE=x((st,Yc)=>{var M8=require("tty"),Wc=require("util");st.init=W8;st.log=z8;st.formatArgs=H8;st.save=G8;st.load=K8;st.useColors=q8;st.destroy=Wc.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");st.colors=[6,2,3,4,5,1];try{let t=eE();t&&(t.stderr||t).level>=2&&(st.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{}st.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 st.inspectOpts?!!st.inspectOpts.colors:M8.isatty(process.stderr.fd)}function H8(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(`
43
+ `)}),e}});var rC=x((Xz,tC)=>{var En=require("constants"),_6=process.cwd,Tc=null,S6=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Tc||(Tc=_6.call(process)),Tc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Lh=process.chdir,process.chdir=function(t){Tc=null,Lh.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Lh));var Lh;tC.exports=x6;function x6(t){En.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,p,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,p,d,h){h&&process.nextTick(h)},t.lchownSync=function(){}),S6==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function p(d,h,m){var y=Date.now(),D=0;l(d,h,function C(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(h,function(g,_){g&&g.code==="ENOENT"?l(d,h,C):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function p(d,h,m,y,D,C){var E;if(C&&typeof C=="function"){var g=0;E=function(_,S,P){if(_&&_.code==="EAGAIN"&&g<10)return g++,l.call(t,d,h,m,y,D,E);C.apply(this,arguments)}}return l.call(t,d,h,m,y,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,l),p})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(p,d,h,m,y){for(var D=0;;)try{return l.call(t,p,d,h,m,y)}catch(C){if(C.code==="EAGAIN"&&D<10){D++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(p,d,h){l.open(p,En.O_WRONLY|En.O_SYMLINK,d,function(m,y){if(m){h&&h(m);return}l.fchmod(y,d,function(D){l.close(y,function(C){h&&h(D||C)})})})},l.lchmodSync=function(p,d){var h=l.openSync(p,En.O_WRONLY|En.O_SYMLINK,d),m=!0,y;try{y=l.fchmodSync(h,d),m=!1}finally{if(m)try{l.closeSync(h)}catch{}else l.closeSync(h)}return y}}function r(l){En.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(p,d,h,m){l.open(p,En.O_SYMLINK,function(y,D){if(y){m&&m(y);return}l.futimes(D,d,h,function(C){l.close(D,function(E){m&&m(C||E)})})})},l.lutimesSync=function(p,d,h){var m=l.openSync(p,En.O_SYMLINK),y,D=!0;try{y=l.futimesSync(m,d,h),D=!1}finally{if(D)try{l.closeSync(m)}catch{}else l.closeSync(m)}return y}):l.futimes&&(l.lutimes=function(p,d,h,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(p,d,h){return l.call(t,p,d,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(l){return l&&function(p,d){try{return l.call(t,p,d)}catch(h){if(!c(h))throw h}}}function i(l){return l&&function(p,d,h,m){return l.call(t,p,d,h,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function a(l){return l&&function(p,d,h){try{return l.call(t,p,d,h)}catch(m){if(!c(m))throw m}}}function s(l){return l&&function(p,d,h){typeof d=="function"&&(h=d,d=null);function m(y,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return d?l.call(t,p,d,m):l.call(t,p,m)}}function u(l){return l&&function(p,d){var h=d?l.call(t,p,d):l.call(t,p);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 p=!process.getuid||process.getuid()!==0;return!!(p&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var iC=x((Zz,oC)=>{var nC=require("stream").Stream;oC.exports=A6;function A6(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);nC.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,p){if(l){i.emit("error",l),i.readable=!1;return}i.fd=p,i.emit("open",p),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);nC.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 sC=x((Qz,aC)=>{"use strict";aC.exports=O6;var F6=Object.getPrototypeOf||function(t){return t.__proto__};function O6(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:F6(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var _n=x((eK,Uh)=>{var Ke=require("fs"),k6=rC(),P6=iC(),$6=sC(),Rc=require("util"),ht,Lc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(ht=Symbol.for("graceful-fs.queue"),Lc=Symbol.for("graceful-fs.previous")):(ht="___graceful-fs.queue",Lc="___graceful-fs.previous");function I6(){}function lC(t,e){Object.defineProperty(t,ht,{get:function(){return e}})}var Do=I6;Rc.debuglog?Do=Rc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Do=function(){var t=Rc.format.apply(Rc,arguments);t="GFS4: "+t.split(/\n/).join(`
44
+ GFS4: `),console.error(t)});Ke[ht]||(uC=global[ht]||[],lC(Ke,uC),Ke.close=(function(t){function e(r,n){return t.call(Ke,r,function(o){o||cC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Lc,{value:t}),e})(Ke.close),Ke.closeSync=(function(t){function e(r){t.apply(Ke,arguments),cC()}return Object.defineProperty(e,Lc,{value:t}),e})(Ke.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Do(Ke[ht]),require("assert").equal(Ke[ht].length,0)}));var uC;global[ht]||lC(global,Ke[ht]);Uh.exports=Nh($6(Ke));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ke.__patched&&(Uh.exports=Nh(Ke),Ke.__patched=!0);function Nh(t){k6(t),t.gracefulify=Nh,t.createReadStream=S,t.createWriteStream=P;var e=t.readFile;t.readFile=r;function r(R,N,F){return typeof N=="function"&&(F=N,N=null),U(R,N,F);function U(M,Q,$,b){return e(M,Q,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Ei([U,[M,Q,$],w,b||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,b,w,v){return n(Q,$,b,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ei([M,[Q,$,b,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,b,w,v){return i(Q,$,b,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ei([M,[Q,$,b,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(R,N,F,U){return typeof F=="function"&&(U=F,F=0),M(R,N,F,U);function M(Q,$,b,w,v){return s(Q,$,b,function(A){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ei([M,[Q,$,b,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=p;var l=/^v[0-5]\./;function p(R,N,F){typeof N=="function"&&(F=N,N=null);var U=l.test(process.version)?function($,b,w,v){return c($,M($,b,w,v))}:function($,b,w,v){return c($,b,M($,b,w,v))};return U(R,N,F);function M(Q,$,b,w){return function(v,A){v&&(v.code==="EMFILE"||v.code==="ENFILE")?Ei([U,[Q,$,b],v,w||Date.now(),Date.now()]):(A&&A.sort&&A.sort(),typeof b=="function"&&b.call(this,v,A))}}}if(process.version.substr(0,4)==="v0.8"){var d=P6(t);C=d.ReadStream,g=d.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(R){C=R},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return g},set:function(R){g=R},enumerable:!0,configurable:!0});var y=C;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(R){y=R},enumerable:!0,configurable:!0});var D=g;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(R){D=R},enumerable:!0,configurable:!0});function C(R,N){return this instanceof C?(h.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function E(){var R=this;B(R.path,R.flags,R.mode,function(N,F){N?(R.autoClose&&R.destroy(),R.emit("error",N)):(R.fd=F,R.emit("open",F),R.read())})}function g(R,N){return this instanceof g?(m.apply(this,arguments),this):g.apply(Object.create(g.prototype),arguments)}function _(){var R=this;B(R.path,R.flags,R.mode,function(N,F){N?(R.destroy(),R.emit("error",N)):(R.fd=F,R.emit("open",F))})}function S(R,N){return new t.ReadStream(R,N)}function P(R,N){return new t.WriteStream(R,N)}var k=t.open;t.open=B;function B(R,N,F,U){return typeof F=="function"&&(U=F,F=null),M(R,N,F,U);function M(Q,$,b,w,v){return k(Q,$,b,function(A,T){A&&(A.code==="EMFILE"||A.code==="ENFILE")?Ei([M,[Q,$,b,w],A,v||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Ei(t){Do("ENQUEUE",t[0].name,t[1]),Ke[ht].push(t),jh()}var Bc;function cC(){for(var t=Date.now(),e=0;e<Ke[ht].length;++e)Ke[ht][e].length>2&&(Ke[ht][e][3]=t,Ke[ht][e][4]=t);jh()}function jh(){if(clearTimeout(Bc),Bc=void 0,Ke[ht].length!==0){var t=Ke[ht].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)Do("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){Do("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?(Do("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ke[ht].push(t)}Bc===void 0&&(Bc=setTimeout(jh,0))}}});var pC=x((tK,fC)=>{function or(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))}fC.exports=or;or.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};or.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};or.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};or.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)};or.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};or.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};or.prototype.start=or.prototype.try;or.prototype.errors=function(){return this._errors};or.prototype.attempts=function(){return this._attempts};or.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 dC=x(yo=>{var T6=pC();yo.operation=function(t){var e=yo.timeouts(t);return new T6(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};yo.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};yo.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};yo.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=yo.operation(e),l=Array.prototype.slice.call(arguments,1),p=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),p.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,a),t[i].options=e}}});var mC=x((nK,hC)=>{hC.exports=dC()});var gC=x((oK,Nc)=>{Nc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Nc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Nc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Hh=x((iK,xi)=>{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)?(DC=require("assert"),_i=gC(),yC=/^win/i.test(Ue.platform),as=require("events"),typeof as!="function"&&(as=as.EventEmitter),Ue.__signal_exit_emitter__?it=Ue.__signal_exit_emitter__:(it=Ue.__signal_exit_emitter__=new as,it.count=0,it.emitted={}),it.infinite||(it.setMaxListeners(1/0),it.infinite=!0),xi.exports=function(t,e){if(!bo(global.process))return function(){};DC.equal(typeof t,"function","a callback must be provided for exit handler"),Si===!1&&Mh();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&&jc()};return it.on(r,t),n},jc=function(){!Si||!bo(global.process)||(Si=!1,_i.forEach(function(e){try{Ue.removeListener(e,Uc[e])}catch{}}),Ue.emit=Mc,Ue.reallyExit=qh,it.count-=1)},xi.exports.unload=jc,wo=function(e,r,n){it.emitted[e]||(it.emitted[e]=!0,it.emit(e,r,n))},Uc={},_i.forEach(function(t){Uc[t]=function(){if(bo(global.process)){var r=Ue.listeners(t);r.length===it.count&&(jc(),wo("exit",null,t),wo("afterexit",null,t),yC&&t==="SIGHUP"&&(t="SIGINT"),Ue.kill(Ue.pid,t))}}}),xi.exports.signals=function(){return _i},Si=!1,Mh=function(){Si||!bo(global.process)||(Si=!0,it.count+=1,_i=_i.filter(function(e){try{return Ue.on(e,Uc[e]),!0}catch{return!1}}),Ue.emit=wC,Ue.reallyExit=bC)},xi.exports.load=Mh,qh=Ue.reallyExit,bC=function(e){bo(global.process)&&(Ue.exitCode=e||0,wo("exit",Ue.exitCode,null),wo("afterexit",Ue.exitCode,null),qh.call(Ue,Ue.exitCode))},Mc=Ue.emit,wC=function(e,r){if(e==="exit"&&bo(global.process)){r!==void 0&&(Ue.exitCode=r);var n=Mc.apply(this,arguments);return wo("exit",Ue.exitCode,null),wo("afterexit",Ue.exitCode,null),n}else return Mc.apply(this,arguments)}):xi.exports=function(){return function(){}};var DC,_i,yC,as,it,jc,wo,Uc,Si,Mh,qh,bC,Mc,wC});var CC=x((aK,Vh)=>{"use strict";var vC=Symbol();function R6(t,e,r){let n=e[vC];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,vC,{value:u}),r(null,s.mtime,u)})})}function B6(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Vh.exports.probe=R6;Vh.exports.getMtime=B6});var AC=x((sK,us)=>{"use strict";var L6=require("path"),Gh=_n(),N6=mC(),j6=Hh(),EC=CC(),Zr={};function ss(t,e){return e.lockfilePath||`${t}.lock`}function Wh(t,e,r){if(!e.realpath)return r(null,L6.resolve(t));e.fs.realpath(t,r)}function Kh(t,e,r){let n=ss(t,e);e.fs.mkdir(n,o=>{if(!o)return EC.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"?Kh(t,{...e,stale:0},r):r(i);if(!_C(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));SC(t,e,s=>{if(s)return r(s);Kh(t,{...e,stale:0},r)})})})}function _C(t,e){return t.mtime.getTime()<Date.now()-e.stale}function SC(t,e,r){e.fs.rmdir(ss(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function qc(t,e){let r=Zr[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?zh(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qc(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return zh(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=EC.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?zh(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qc(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,qc(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function zh(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Zr[t]===e&&delete Zr[t],e.options.onCompromised(r)}function U6(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Gh,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),Wh(t,e,(n,o)=>{if(n)return r(n);let i=N6.operation(e.retries);i.attempt(()=>{Kh(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=Zr[o]={lockfilePath:ss(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};qc(o,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));xC(o,{...e,realpath:!1},l)})})})})}function xC(t,e,r){e={fs:Gh,realpath:!0,...e},Wh(t,e,(n,o)=>{if(n)return r(n);let i=Zr[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 Zr[o],SC(o,e,r)})}function M6(t,e,r){e={stale:1e4,realpath:!0,fs:Gh,...e},e.stale=Math.max(e.stale||0,2e3),Wh(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ss(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!_C(a,e)))})}function q6(){return Zr}j6(()=>{for(let t in Zr){let e=Zr[t].options;try{e.fs.rmdirSync(ss(t,e))}catch{}}});us.exports.lock=U6;us.exports.unlock=xC;us.exports.check=M6;us.exports.getLocks=q6});var OC=x((uK,FC)=>{"use strict";var H6=_n();function V6(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 z6(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function K6(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function G6(t){if(t={...t},t.fs=V6(t.fs||H6),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}FC.exports={toPromise:z6,toSync:K6,toSyncOptions:G6}});var PC=x((cK,Sn)=>{"use strict";var Ai=AC(),{toPromise:Hc,toSync:Vc,toSyncOptions:Yh}=OC();async function kC(t,e){let r=await Hc(Ai.lock)(t,e);return Hc(r)}function W6(t,e){let r=Vc(Ai.lock)(t,Yh(e));return Vc(r)}function Y6(t,e){return Hc(Ai.unlock)(t,e)}function J6(t,e){return Vc(Ai.unlock)(t,Yh(e))}function X6(t,e){return Hc(Ai.check)(t,e)}function Z6(t,e){return Vc(Ai.check)(t,Yh(e))}Sn.exports=kC;Sn.exports.lock=kC;Sn.exports.unlock=Y6;Sn.exports.lockSync=W6;Sn.exports.unlockSync=J6;Sn.exports.check=X6;Sn.exports.checkSync=Z6});var BC=x(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.canStoreURLs=Fi.FileUrlStorage=void 0;var $C=require("fs"),Q6=t8(eC()),IC=e8(PC());function RC(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(RC=function(n){return n?r:e})(t)}function e8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=RC(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 t8(t){return t&&t.__esModule?t:{default:t}}function cs(t){"@babel/helpers - typeof";return cs=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},cs(t)}function r8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TC(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,o8(n.key),n)}}function n8(t,e,r){return e&&TC(t.prototype,e),r&&TC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function o8(t){var e=i8(t,"string");return cs(e)=="symbol"?e:e+""}function i8(t,e){if(cs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(cs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lK=Fi.canStoreURLs=!0,fK=Fi.FileUrlStorage=(function(){function t(e){r8(this,t),this.path=e}return n8(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;IC.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;IC.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,Q6.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,$C.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,$C.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 Zh=x(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Object.defineProperty(Nt,"DefaultHttpStack",{enumerable:!0,get:function(){return UC.default}});Object.defineProperty(Nt,"DetailedError",{enumerable:!0,get:function(){return a8.default}});Object.defineProperty(Nt,"FileUrlStorage",{enumerable:!0,get:function(){return MC.FileUrlStorage}});Object.defineProperty(Nt,"StreamSource",{enumerable:!0,get:function(){return f8.default}});Nt.Upload=void 0;Object.defineProperty(Nt,"canStoreURLs",{enumerable:!0,get:function(){return MC.canStoreURLs}});Nt.defaultOptions=void 0;Object.defineProperty(Nt,"enableDebugLog",{enumerable:!0,get:function(){return s8.enableDebugLog}});Nt.isSupported=void 0;var a8=vo(zd()),s8=Kd(),u8=vo(Bb()),Jh=vo(pw()),c8=vo(Sw()),l8=vo(Ow()),UC=vo(Hw()),f8=vo(ah()),MC=BC();function vo(t){return t&&t.__esModule?t:{default:t}}function ki(t){"@babel/helpers - typeof";return ki=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},ki(t)}function p8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function LC(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,HC(n.key),n)}}function d8(t,e,r){return e&&LC(t.prototype,e),r&&LC(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function h8(t,e,r){return e=zc(e),m8(t,qC()?Reflect.construct(e,r||[],zc(t).constructor):e.apply(t,r))}function m8(t,e){if(e&&(ki(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g8(t)}function g8(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 zc(t){return zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zc(t)}function D8(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&&Xh(t,e)}function Xh(t,e){return Xh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Xh(t,e)}function NC(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 Oi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?NC(Object(r),!0).forEach(function(n){y8(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):NC(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function y8(t,e,r){return e=HC(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function HC(t){var e=b8(t,"string");return ki(e)=="symbol"?e:e+""}function b8(t,e){if(ki(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ki(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var jC=Nt.defaultOptions=Oi(Oi({},Jh.default.defaultOptions),{},{httpStack:new UC.default,fileReader:new c8.default,urlStorage:new u8.default,fingerprint:l8.default}),dK=Nt.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 p8(this,e),n=Oi(Oi({},jC),n),h8(this,e,[r,n])}return D8(e,t),d8(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Oi(Oi({},jC),o),Jh.default.terminate(n,o)}}])})(Jh.default),hK=Nt.isSupported=!0});var WC=x((kK,GC)=>{var Pi=1e3,$i=Pi*60,Ii=$i*60,Co=Ii*24,F8=Co*7,O8=Co*365.25;GC.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return k8(t);if(r==="number"&&isFinite(t))return e.long?$8(t):P8(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function k8(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*O8;case"weeks":case"week":case"w":return r*F8;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*$i;case"seconds":case"second":case"secs":case"sec":case"s":return r*Pi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function P8(t){var e=Math.abs(t);return e>=Co?Math.round(t/Co)+"d":e>=Ii?Math.round(t/Ii)+"h":e>=$i?Math.round(t/$i)+"m":e>=Pi?Math.round(t/Pi)+"s":t+"ms"}function $8(t){var e=Math.abs(t);return e>=Co?Gc(t,e,Co,"day"):e>=Ii?Gc(t,e,Ii,"hour"):e>=$i?Gc(t,e,$i,"minute"):e>=Pi?Gc(t,e,Pi,"second"):t+" ms"}function Gc(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var tm=x((PK,YC)=>{function I8(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=WC(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let p=0;for(let d=0;d<l.length;d++)p=(p<<5)-p+l.charCodeAt(d),p|=0;return r.colors[Math.abs(p)%r.colors.length]}r.selectColor=e;function r(l){let p,d=null,h,m;function y(...D){if(!y.enabled)return;let C=y,E=Number(new Date),g=E-(p||E);C.diff=g,C.prev=p,C.curr=E,p=E,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let _=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(P,k)=>{if(P==="%%")return"%";_++;let B=r.formatters[k];if(typeof B=="function"){let R=D[_];P=B.call(C,R),D.splice(_,1),_--}return P}),r.formatArgs.call(C,D),(C.log||r.log).apply(C,D)}return y.namespace=l,y.useColors=r.useColors(),y.color=r.selectColor(l),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(l)),m),set:D=>{d=D}}),typeof r.init=="function"&&r.init(y),y}function n(l,p){let d=r(this.namespace+(typeof p>"u"?":":p)+l);return d.log=this.log,d}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let p=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of p)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function i(l,p){let d=0,h=0,m=-1,y=0;for(;d<l.length;)if(h<p.length&&(p[h]===l[d]||p[h]==="*"))p[h]==="*"?(m=h,y=d,h++):(d++,h++);else if(m!==-1)h=m+1,y++,d=y;else return!1;for(;h<p.length&&p[h]==="*";)h++;return h===p.length}function a(){let l=[...r.names,...r.skips.map(p=>"-"+p)].join(",");return r.enable(""),l}function s(l){for(let p of r.skips)if(i(l,p))return!1;for(let p of r.names)if(i(l,p))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}YC.exports=I8});var JC=x((jt,Wc)=>{jt.formatArgs=R8;jt.save=B8;jt.load=L8;jt.useColors=T8;jt.storage=N8();jt.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`."))}})();jt.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 T8(){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 R8(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Wc.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)}jt.log=console.debug||console.log||(()=>{});function B8(t){try{t?jt.storage.setItem("debug",t):jt.storage.removeItem("debug")}catch{}}function L8(){let t;try{t=jt.storage.getItem("debug")||jt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function N8(){try{return localStorage}catch{}}Wc.exports=tm()(jt);var{formatters:j8}=Wc.exports;j8.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ZC=x(($K,XC)=>{"use strict";XC.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 tE=x((IK,eE)=>{"use strict";var U8=require("os"),QC=require("tty"),ur=ZC(),{env:st}=process,xn;ur("no-color")||ur("no-colors")||ur("color=false")||ur("color=never")?xn=0:(ur("color")||ur("colors")||ur("color=true")||ur("color=always"))&&(xn=1);"FORCE_COLOR"in st&&(st.FORCE_COLOR==="true"?xn=1:st.FORCE_COLOR==="false"?xn=0:xn=st.FORCE_COLOR.length===0?1:Math.min(parseInt(st.FORCE_COLOR,10),3));function rm(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function nm(t,e){if(xn===0)return 0;if(ur("color=16m")||ur("color=full")||ur("color=truecolor"))return 3;if(ur("color=256"))return 2;if(t&&!e&&xn===void 0)return 0;let r=xn||0;if(st.TERM==="dumb")return r;if(process.platform==="win32"){let n=U8.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 M8(t){let e=nm(t,t&&t.isTTY);return rm(e)}eE.exports={supportsColor:M8,stdout:rm(nm(!0,QC.isatty(1))),stderr:rm(nm(!0,QC.isatty(2)))}});var nE=x((ut,Jc)=>{var q8=require("tty"),Yc=require("util");ut.init=Y8;ut.log=K8;ut.formatArgs=V8;ut.save=G8;ut.load=W8;ut.useColors=H8;ut.destroy=Yc.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=tE();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 H8(){return"colors"in ut.inspectOpts?!!ut.inspectOpts.colors:q8.isatty(process.stderr.fd)}function V8(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(`
45
45
  `).join(`
46
- `+i),t.push(o+"m+"+Yc.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=V8()+e+" "+t[0]}function V8(){return st.inspectOpts.hideDate?"":new Date().toISOString()+" "}function z8(...t){return process.stderr.write(Wc.formatWithOptions(st.inspectOpts,...t)+`
47
- `)}function G8(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function K8(){return process.env.DEBUG}function W8(t){t.inspectOpts={};let e=Object.keys(st.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=st.inspectOpts[e[r]]}Yc.exports=em()(st);var{formatters:tE}=Yc.exports;tE.o=function(t){return this.inspectOpts.colors=this.useColors,Wc.inspect(t,this.inspectOpts).split(`
48
- `).map(e=>e.trim()).join(" ")};tE.O=function(t){return this.inspectOpts.colors=this.useColors,Wc.inspect(t,this.inspectOpts)}});var om=x(($G,nm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?nm.exports=YC():nm.exports=rE()});var ut=x(im=>{"use strict";im.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})};im.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 Ot=x(Qr=>{"use strict";var nE=ut().fromCallback,Ft=En(),Y8=["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 Ft[t]=="function");Object.assign(Qr,Ft);Y8.forEach(t=>{Qr[t]=nE(Ft[t])});Qr.exists=function(t,e){return typeof e=="function"?Ft.exists(t,e):new Promise(r=>Ft.exists(t,r))};Qr.read=function(t,e,r,n,o,i){return typeof i=="function"?Ft.read(t,e,r,n,o,i):new Promise((a,s)=>{Ft.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};Qr.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Ft.write(t,e,...r):new Promise((n,o)=>{Ft.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};Qr.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Ft.readv(t,e,...r):new Promise((n,o)=>{Ft.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};Qr.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Ft.writev(t,e,...r):new Promise((n,o)=>{Ft.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Ft.realpath.native=="function"?Qr.realpath.native=nE(Ft.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var iE=x((RG,oE)=>{"use strict";var J8=require("path");oE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(J8.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var cE=x((BG,am)=>{"use strict";var aE=Ot(),{checkPath:sE}=iE(),uE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};am.exports.makeDir=async(t,e)=>(sE(t),aE.mkdir(t,{mode:uE(e),recursive:!0}));am.exports.makeDirSync=(t,e)=>(sE(t),aE.mkdirSync(t,{mode:uE(e),recursive:!0}))});var Er=x((jG,lE)=>{"use strict";var X8=ut().fromPromise,{makeDir:Z8,makeDirSync:sm}=cE(),um=X8(Z8);lE.exports={mkdirs:um,mkdirsSync:sm,mkdirp:um,mkdirpSync:sm,ensureDir:um,ensureDirSync:sm}});var Sn=x((NG,pE)=>{"use strict";var Q8=ut().fromPromise,fE=Ot();function ej(t){return fE.access(t).then(()=>!0).catch(()=>!1)}pE.exports={pathExists:Q8(ej),pathExistsSync:fE.existsSync}});var cm=x((LG,dE)=>{"use strict";var Ti=Ot(),tj=ut().fromPromise;async function rj(t,e,r){let n=await Ti.open(t,"r+"),o=null;try{await Ti.futimes(n,e,r)}finally{try{await Ti.close(n)}catch(i){o=i}}if(o)throw o}function nj(t,e,r){let n=Ti.openSync(t,"r+");return Ti.futimesSync(n,e,r),Ti.closeSync(n)}dE.exports={utimesMillis:tj(rj),utimesMillisSync:nj}});var Co=x((UG,DE)=>{"use strict";var Ii=Ot(),ct=require("path"),hE=ut().fromPromise;function oj(t,e,r){let n=r.dereference?o=>Ii.stat(o,{bigint:!0}):o=>Ii.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 ij(t,e,r){let n,o=r.dereference?a=>Ii.statSync(a,{bigint:!0}):a=>Ii.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 aj(t,e,r,n){let{srcStat:o,destStat:i}=await oj(t,e,n);if(i){if(cs(o,i)){let a=ct.basename(t),s=ct.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()&&lm(t,e))throw new Error(Jc(t,e,r));return{srcStat:o,destStat:i}}function sj(t,e,r,n){let{srcStat:o,destStat:i}=ij(t,e,n);if(i){if(cs(o,i)){let a=ct.basename(t),s=ct.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()&&lm(t,e))throw new Error(Jc(t,e,r));return{srcStat:o,destStat:i}}async function mE(t,e,r,n){let o=ct.resolve(ct.dirname(t)),i=ct.resolve(ct.dirname(r));if(i===o||i===ct.parse(i).root)return;let a;try{a=await Ii.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(cs(e,a))throw new Error(Jc(t,r,n));return mE(t,e,i,n)}function gE(t,e,r,n){let o=ct.resolve(ct.dirname(t)),i=ct.resolve(ct.dirname(r));if(i===o||i===ct.parse(i).root)return;let a;try{a=Ii.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(cs(e,a))throw new Error(Jc(t,r,n));return gE(t,e,i,n)}function cs(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function lm(t,e){let r=ct.resolve(t).split(ct.sep).filter(o=>o),n=ct.resolve(e).split(ct.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function Jc(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}DE.exports={checkPaths:hE(aj),checkPathsSync:sj,checkParentPaths:hE(mE),checkParentPathsSync:gE,isSrcSubdir:lm,areIdentical:cs}});var bE=x((MG,yE)=>{"use strict";async function uj(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})))}yE.exports={asyncIteratorConcurrentProcess:uj}});var _E=x((qG,EE)=>{"use strict";var Dt=Ot(),ls=require("path"),{mkdirs:cj}=Er(),{pathExists:lj}=Sn(),{utimesMillis:fj}=cm(),fs=Co(),{asyncIteratorConcurrentProcess:pj}=bE();async function dj(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;
46
+ `+i),t.push(o+"m+"+Jc.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=z8()+e+" "+t[0]}function z8(){return ut.inspectOpts.hideDate?"":new Date().toISOString()+" "}function K8(...t){return process.stderr.write(Yc.formatWithOptions(ut.inspectOpts,...t)+`
47
+ `)}function G8(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function W8(){return process.env.DEBUG}function Y8(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]]}Jc.exports=tm()(ut);var{formatters:rE}=Jc.exports;rE.o=function(t){return this.inspectOpts.colors=this.useColors,Yc.inspect(t,this.inspectOpts).split(`
48
+ `).map(e=>e.trim()).join(" ")};rE.O=function(t){return this.inspectOpts.colors=this.useColors,Yc.inspect(t,this.inspectOpts)}});var im=x((TK,om)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?om.exports=JC():om.exports=nE()});var ct=x(am=>{"use strict";am.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})};am.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 kt=x(en=>{"use strict";var oE=ct().fromCallback,Ot=_n(),J8=["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 Ot[t]=="function");Object.assign(en,Ot);J8.forEach(t=>{en[t]=oE(Ot[t])});en.exists=function(t,e){return typeof e=="function"?Ot.exists(t,e):new Promise(r=>Ot.exists(t,r))};en.read=function(t,e,r,n,o,i){return typeof i=="function"?Ot.read(t,e,r,n,o,i):new Promise((a,s)=>{Ot.read(t,e,r,n,o,(u,c,l)=>{if(u)return s(u);a({bytesRead:c,buffer:l})})})};en.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Ot.write(t,e,...r):new Promise((n,o)=>{Ot.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};en.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Ot.readv(t,e,...r):new Promise((n,o)=>{Ot.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};en.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Ot.writev(t,e,...r):new Promise((n,o)=>{Ot.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Ot.realpath.native=="function"?en.realpath.native=oE(Ot.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var aE=x((LK,iE)=>{"use strict";var X8=require("path");iE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(X8.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var lE=x((NK,sm)=>{"use strict";var sE=kt(),{checkPath:uE}=aE(),cE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};sm.exports.makeDir=async(t,e)=>(uE(t),sE.mkdir(t,{mode:cE(e),recursive:!0}));sm.exports.makeDirSync=(t,e)=>(uE(t),sE.mkdirSync(t,{mode:cE(e),recursive:!0}))});var _r=x((jK,fE)=>{"use strict";var Z8=ct().fromPromise,{makeDir:Q8,makeDirSync:um}=lE(),cm=Z8(Q8);fE.exports={mkdirs:cm,mkdirsSync:um,mkdirp:cm,mkdirpSync:um,ensureDir:cm,ensureDirSync:um}});var An=x((UK,dE)=>{"use strict";var eL=ct().fromPromise,pE=kt();function tL(t){return pE.access(t).then(()=>!0).catch(()=>!1)}dE.exports={pathExists:eL(tL),pathExistsSync:pE.existsSync}});var lm=x((MK,hE)=>{"use strict";var Ti=kt(),rL=ct().fromPromise;async function nL(t,e,r){let n=await Ti.open(t,"r+"),o=null;try{await Ti.futimes(n,e,r)}finally{try{await Ti.close(n)}catch(i){o=i}}if(o)throw o}function oL(t,e,r){let n=Ti.openSync(t,"r+");return Ti.futimesSync(n,e,r),Ti.closeSync(n)}hE.exports={utimesMillis:rL(nL),utimesMillisSync:oL}});var Eo=x((qK,yE)=>{"use strict";var Ri=kt(),lt=require("path"),mE=ct().fromPromise;function iL(t,e,r){let n=r.dereference?o=>Ri.stat(o,{bigint:!0}):o=>Ri.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 aL(t,e,r){let n,o=r.dereference?a=>Ri.statSync(a,{bigint:!0}):a=>Ri.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 sL(t,e,r,n){let{srcStat:o,destStat:i}=await iL(t,e,n);if(i){if(ls(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()&&fm(t,e))throw new Error(Xc(t,e,r));return{srcStat:o,destStat:i}}function uL(t,e,r,n){let{srcStat:o,destStat:i}=aL(t,e,n);if(i){if(ls(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()&&fm(t,e))throw new Error(Xc(t,e,r));return{srcStat:o,destStat:i}}async function gE(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 Ri.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ls(e,a))throw new Error(Xc(t,r,n));return gE(t,e,i,n)}function DE(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=Ri.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ls(e,a))throw new Error(Xc(t,r,n));return DE(t,e,i,n)}function ls(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function fm(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 Xc(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}yE.exports={checkPaths:mE(sL),checkPathsSync:uL,checkParentPaths:mE(gE),checkParentPathsSync:DE,isSrcSubdir:fm,areIdentical:ls}});var wE=x((HK,bE)=>{"use strict";async function cL(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})))}bE.exports={asyncIteratorConcurrentProcess:cL}});var SE=x((VK,_E)=>{"use strict";var yt=kt(),fs=require("path"),{mkdirs:lL}=_r(),{pathExists:fL}=An(),{utimesMillis:pL}=lm(),ps=Eo(),{asyncIteratorConcurrentProcess:dL}=wE();async function hL(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
49
 
50
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await fs.checkPaths(t,e,"copy",r);if(await fs.checkParentPaths(t,n,e,"copy"),!await vE(t,e,r))return;let a=ls.dirname(e);await lj(a)||await cj(a),await CE(o,t,e,r)}async function vE(t,e,r){return r.filter?r.filter(t,e):!0}async function CE(t,e,r,n){let i=await(n.dereference?Dt.stat:Dt.lstat)(e);if(i.isDirectory())return Dj(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return hj(i,t,e,r,n);if(i.isSymbolicLink())return yj(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 hj(t,e,r,n,o){if(!e)return wE(t,r,n,o);if(o.overwrite)return await Dt.unlink(n),wE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function wE(t,e,r,n){if(await Dt.copyFile(e,r),n.preserveTimestamps){mj(t.mode)&&await gj(r,t.mode);let o=await Dt.stat(e);await fj(r,o.atime,o.mtime)}return Dt.chmod(r,t.mode)}function mj(t){return(t&128)===0}function gj(t,e){return Dt.chmod(t,e|128)}async function Dj(t,e,r,n,o){e||await Dt.mkdir(n),await pj(await Dt.opendir(r),async i=>{let a=ls.join(r,i.name),s=ls.join(n,i.name);if(await vE(a,s,o)){let{destStat:c}=await fs.checkPaths(a,s,"copy",o);await CE(c,a,s,o)}}),e||await Dt.chmod(n,t.mode)}async function yj(t,e,r,n){let o=await Dt.readlink(e);if(n.dereference&&(o=ls.resolve(process.cwd(),o)),!t)return Dt.symlink(o,r);let i=null;try{i=await Dt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Dt.symlink(o,r);throw a}if(n.dereference&&(i=ls.resolve(process.cwd(),i)),fs.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(fs.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await Dt.unlink(r),Dt.symlink(o,r)}EE.exports=dj});var OE=x((HG,FE)=>{"use strict";var kt=En(),ps=require("path"),bj=Er().mkdirsSync,wj=cm().utimesMillisSync,ds=Co();function vj(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;
50
+ 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 CE(t,e,r))return;let a=fs.dirname(e);await fL(a)||await lL(a),await EE(o,t,e,r)}async function CE(t,e,r){return r.filter?r.filter(t,e):!0}async function EE(t,e,r,n){let i=await(n.dereference?yt.stat:yt.lstat)(e);if(i.isDirectory())return yL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return mL(i,t,e,r,n);if(i.isSymbolicLink())return bL(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 mL(t,e,r,n,o){if(!e)return vE(t,r,n,o);if(o.overwrite)return await yt.unlink(n),vE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function vE(t,e,r,n){if(await yt.copyFile(e,r),n.preserveTimestamps){gL(t.mode)&&await DL(r,t.mode);let o=await yt.stat(e);await pL(r,o.atime,o.mtime)}return yt.chmod(r,t.mode)}function gL(t){return(t&128)===0}function DL(t,e){return yt.chmod(t,e|128)}async function yL(t,e,r,n,o){e||await yt.mkdir(n),await dL(await yt.opendir(r),async i=>{let a=fs.join(r,i.name),s=fs.join(n,i.name);if(await CE(a,s,o)){let{destStat:c}=await ps.checkPaths(a,s,"copy",o);await EE(c,a,s,o)}}),e||await yt.chmod(n,t.mode)}async function bL(t,e,r,n){let o=await yt.readlink(e);if(n.dereference&&(o=fs.resolve(process.cwd(),o)),!t)return yt.symlink(o,r);let i=null;try{i=await yt.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return yt.symlink(o,r);throw a}if(n.dereference&&(i=fs.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 yt.unlink(r),yt.symlink(o,r)}_E.exports=hL});var kE=x((zK,OE)=>{"use strict";var Pt=_n(),ds=require("path"),wL=_r().mkdirsSync,vL=lm().utimesMillisSync,hs=Eo();function CL(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;
51
51
 
52
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=ds.checkPathsSync(t,e,"copy",r);if(ds.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=ps.dirname(e);return kt.existsSync(i)||bj(i),xE(o,t,e,r)}function xE(t,e,r,n){let i=(n.dereference?kt.statSync:kt.lstatSync)(e);if(i.isDirectory())return Fj(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return Cj(i,t,e,r,n);if(i.isSymbolicLink())return Pj(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 Cj(t,e,r,n,o){return e?Ej(t,r,n,o):SE(t,r,n,o)}function Ej(t,e,r,n){if(n.overwrite)return kt.unlinkSync(r),SE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function SE(t,e,r,n){return kt.copyFileSync(e,r),n.preserveTimestamps&&_j(t.mode,e,r),fm(r,t.mode)}function _j(t,e,r){return xj(t)&&Sj(r,t),Aj(e,r)}function xj(t){return(t&128)===0}function Sj(t,e){return fm(t,e|128)}function fm(t,e){return kt.chmodSync(t,e)}function Aj(t,e){let r=kt.statSync(t);return wj(e,r.atime,r.mtime)}function Fj(t,e,r,n,o){return e?AE(r,n,o):Oj(t.mode,r,n,o)}function Oj(t,e,r,n){return kt.mkdirSync(r),AE(e,r,n),fm(r,t)}function AE(t,e,r){let n=kt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)kj(o.name,t,e,r)}finally{n.closeSync()}}function kj(t,e,r,n){let o=ps.join(e,t),i=ps.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=ds.checkPathsSync(o,i,"copy",n);return xE(a,o,i,n)}function Pj(t,e,r,n){let o=kt.readlinkSync(e);if(n.dereference&&(o=ps.resolve(process.cwd(),o)),t){let i;try{i=kt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return kt.symlinkSync(o,r);throw a}if(n.dereference&&(i=ps.resolve(process.cwd(),i)),ds.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ds.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return $j(o,r)}else return kt.symlinkSync(o,r)}function $j(t,e){return kt.unlinkSync(e),kt.symlinkSync(t,e)}FE.exports=vj});var Xc=x((VG,kE)=>{"use strict";var Tj=ut().fromPromise;kE.exports={copy:Tj(_E()),copySync:OE()}});var hs=x((zG,$E)=>{"use strict";var PE=En(),Ij=ut().fromCallback;function Rj(t,e){PE.rm(t,{recursive:!0,force:!0},e)}function Bj(t){PE.rmSync(t,{recursive:!0,force:!0})}$E.exports={remove:Ij(Rj),removeSync:Bj}});var UE=x((GG,LE)=>{"use strict";var jj=ut().fromPromise,RE=Ot(),BE=require("path"),jE=Er(),NE=hs(),TE=jj(async function(e){let r;try{r=await RE.readdir(e)}catch{return jE.mkdirs(e)}return Promise.all(r.map(n=>NE.remove(BE.join(e,n))))});function IE(t){let e;try{e=RE.readdirSync(t)}catch{return jE.mkdirsSync(t)}e.forEach(r=>{r=BE.join(t,r),NE.removeSync(r)})}LE.exports={emptyDirSync:IE,emptydirSync:IE,emptyDir:TE,emptydir:TE}});var VE=x((KG,HE)=>{"use strict";var Nj=ut().fromPromise,ME=require("path"),en=Ot(),qE=Er();async function Lj(t){let e;try{e=await en.stat(t)}catch{}if(e&&e.isFile())return;let r=ME.dirname(t),n=null;try{n=await en.stat(r)}catch(o){if(o.code==="ENOENT"){await qE.mkdirs(r),await en.writeFile(t,"");return}else throw o}n.isDirectory()?await en.writeFile(t,""):await en.readdir(r)}function Uj(t){let e;try{e=en.statSync(t)}catch{}if(e&&e.isFile())return;let r=ME.dirname(t);try{en.statSync(r).isDirectory()||en.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")qE.mkdirsSync(r);else throw n}en.writeFileSync(t,"")}HE.exports={createFile:Nj(Lj),createFileSync:Uj}});var YE=x((WG,WE)=>{"use strict";var Mj=ut().fromPromise,zE=require("path"),An=Ot(),GE=Er(),{pathExists:qj}=Sn(),{areIdentical:KE}=Co();async function Hj(t,e){let r;try{r=await An.lstat(e)}catch{}let n;try{n=await An.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&KE(n,r))return;let o=zE.dirname(e);await qj(o)||await GE.mkdirs(o),await An.link(t,e)}function Vj(t,e){let r;try{r=An.lstatSync(e)}catch{}try{let i=An.lstatSync(t);if(r&&KE(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=zE.dirname(e);return An.existsSync(n)||GE.mkdirsSync(n),An.linkSync(t,e)}WE.exports={createLink:Mj(Hj),createLinkSync:Vj}});var XE=x((YG,JE)=>{"use strict";var Fn=require("path"),ms=Ot(),{pathExists:zj}=Sn(),Gj=ut().fromPromise;async function Kj(t,e){if(Fn.isAbsolute(t)){try{await ms.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Fn.dirname(e),n=Fn.join(r,t);if(await zj(n))return{toCwd:n,toDst:t};try{await ms.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Fn.relative(r,t)}}function Wj(t,e){if(Fn.isAbsolute(t)){if(!ms.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Fn.dirname(e),n=Fn.join(r,t);if(ms.existsSync(n))return{toCwd:n,toDst:t};if(!ms.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Fn.relative(r,t)}}JE.exports={symlinkPaths:Gj(Kj),symlinkPathsSync:Wj}});var e_=x((JG,QE)=>{"use strict";var ZE=Ot(),Yj=ut().fromPromise;async function Jj(t,e){if(e)return e;let r;try{r=await ZE.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function Xj(t,e){if(e)return e;let r;try{r=ZE.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}QE.exports={symlinkType:Yj(Jj),symlinkTypeSync:Xj}});var o_=x((XG,n_)=>{"use strict";var Zj=ut().fromPromise,t_=require("path"),Pr=Ot(),{mkdirs:Qj,mkdirsSync:eN}=Er(),{symlinkPaths:tN,symlinkPathsSync:rN}=XE(),{symlinkType:nN,symlinkTypeSync:oN}=e_(),{pathExists:iN}=Sn(),{areIdentical:r_}=Co();async function aN(t,e,r){let n;try{n=await Pr.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Pr.stat(t),Pr.stat(e)]);if(r_(s,u))return}let o=await tN(t,e);t=o.toDst;let i=await nN(o.toCwd,r),a=t_.dirname(e);return await iN(a)||await Qj(a),Pr.symlink(t,e,i)}function sN(t,e,r){let n;try{n=Pr.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Pr.statSync(t),u=Pr.statSync(e);if(r_(s,u))return}let o=rN(t,e);t=o.toDst,r=oN(o.toCwd,r);let i=t_.dirname(e);return Pr.existsSync(i)||eN(i),Pr.symlinkSync(t,e,r)}n_.exports={createSymlink:Zj(aN),createSymlinkSync:sN}});var p_=x((ZG,f_)=>{"use strict";var{createFile:i_,createFileSync:a_}=VE(),{createLink:s_,createLinkSync:u_}=YE(),{createSymlink:c_,createSymlinkSync:l_}=o_();f_.exports={createFile:i_,createFileSync:a_,ensureFile:i_,ensureFileSync:a_,createLink:s_,createLinkSync:u_,ensureLink:s_,ensureLinkSync:u_,createSymlink:c_,createSymlinkSync:l_,ensureSymlink:c_,ensureSymlinkSync:l_}});var Zc=x((QG,d_)=>{function uN(t,{EOL:e=`
53
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function cN(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}d_.exports={stringify:uN,stripBom:cN}});var D_=x((eK,g_)=>{var Ri;try{Ri=En()}catch{Ri=require("fs")}var Qc=ut(),{stringify:h_,stripBom:m_}=Zc();async function lN(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ri,n="throws"in e?e.throws:!0,o=await Qc.fromCallback(r.readFile)(t,e);o=m_(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 fN=Qc.fromPromise(lN);function pN(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Ri,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=m_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function dN(t,e,r={}){let n=r.fs||Ri,o=h_(e,r);await Qc.fromCallback(n.writeFile)(t,o,r)}var hN=Qc.fromPromise(dN);function mN(t,e,r={}){let n=r.fs||Ri,o=h_(e,r);return n.writeFileSync(t,o,r)}g_.exports={readFile:fN,readFileSync:pN,writeFile:hN,writeFileSync:mN}});var b_=x((tK,y_)=>{"use strict";var el=D_();y_.exports={readJson:el.readFile,readJsonSync:el.readFileSync,writeJson:el.writeFile,writeJsonSync:el.writeFileSync}});var tl=x((rK,C_)=>{"use strict";var gN=ut().fromPromise,pm=Ot(),w_=require("path"),v_=Er(),DN=Sn().pathExists;async function yN(t,e,r="utf-8"){let n=w_.dirname(t);return await DN(n)||await v_.mkdirs(n),pm.writeFile(t,e,r)}function bN(t,...e){let r=w_.dirname(t);pm.existsSync(r)||v_.mkdirsSync(r),pm.writeFileSync(t,...e)}C_.exports={outputFile:gN(yN),outputFileSync:bN}});var __=x((nK,E_)=>{"use strict";var{stringify:wN}=Zc(),{outputFile:vN}=tl();async function CN(t,e,r={}){let n=wN(e,r);await vN(t,n,r)}E_.exports=CN});var S_=x((oK,x_)=>{"use strict";var{stringify:EN}=Zc(),{outputFileSync:_N}=tl();function xN(t,e,r){let n=EN(e,r);_N(t,n,r)}x_.exports=xN});var F_=x((iK,A_)=>{"use strict";var SN=ut().fromPromise,Pt=b_();Pt.outputJson=SN(__());Pt.outputJsonSync=S_();Pt.outputJSON=Pt.outputJson;Pt.outputJSONSync=Pt.outputJsonSync;Pt.writeJSON=Pt.writeJson;Pt.writeJSONSync=Pt.writeJsonSync;Pt.readJSON=Pt.readJson;Pt.readJSONSync=Pt.readJsonSync;A_.exports=Pt});var T_=x((aK,$_)=>{"use strict";var AN=Ot(),O_=require("path"),{copy:FN}=Xc(),{remove:P_}=hs(),{mkdirp:ON}=Er(),{pathExists:kN}=Sn(),k_=Co();async function PN(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await k_.checkPaths(t,e,"move",r);await k_.checkParentPaths(t,o,e,"move");let a=O_.dirname(e);return O_.parse(a).root!==a&&await ON(a),$N(t,e,n,i)}async function $N(t,e,r,n){if(!n){if(r)await P_(e);else if(await kN(e))throw new Error("dest already exists.")}try{await AN.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await TN(t,e,r)}}async function TN(t,e,r){return await FN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),P_(t)}$_.exports=PN});var N_=x((sK,j_)=>{"use strict";var R_=En(),hm=require("path"),IN=Xc().copySync,B_=hs().removeSync,RN=Er().mkdirpSync,I_=Co();function BN(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=I_.checkPathsSync(t,e,"move",r);return I_.checkParentPathsSync(t,o,e,"move"),jN(e)||RN(hm.dirname(e)),NN(t,e,n,i)}function jN(t){let e=hm.dirname(t);return hm.parse(e).root===e}function NN(t,e,r,n){if(n)return dm(t,e,r);if(r)return B_(e),dm(t,e,r);if(R_.existsSync(e))throw new Error("dest already exists.");return dm(t,e,r)}function dm(t,e,r){try{R_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return LN(t,e,r)}}function LN(t,e,r){return IN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),B_(t)}j_.exports=BN});var U_=x((uK,L_)=>{"use strict";var UN=ut().fromPromise;L_.exports={move:UN(T_()),moveSync:N_()}});var Bi=x((cK,M_)=>{"use strict";M_.exports={...Ot(),...Xc(),...UE(),...p_(),...F_(),...Er(),...U_(),...tl(),...Sn(),...hs()}});var W_=x((lK,K_)=>{"use strict";var mm,H_,V_,z_,G_=!0;typeof process<"u"&&({FORCE_COLOR:mm,NODE_DISABLE_COLORS:H_,NO_COLOR:V_,TERM:z_}=process.env||{},G_=process.stdout&&process.stdout.isTTY);var Se={enabled:!H_&&V_==null&&z_!=="dumb"&&(mm!=null&&mm!=="0"||G_),reset:Re(0,0),bold:Re(1,22),dim:Re(2,22),italic:Re(3,23),underline:Re(4,24),inverse:Re(7,27),hidden:Re(8,28),strikethrough:Re(9,29),black:Re(30,39),red:Re(31,39),green:Re(32,39),yellow:Re(33,39),blue:Re(34,39),magenta:Re(35,39),cyan:Re(36,39),white:Re(37,39),gray:Re(90,39),grey:Re(90,39),bgBlack:Re(40,49),bgRed:Re(41,49),bgGreen:Re(42,49),bgYellow:Re(43,49),bgBlue:Re(44,49),bgMagenta:Re(45,49),bgCyan:Re(46,49),bgWhite:Re(47,49)};function q_(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 MN(t,e){let r={has:t,keys:e};return r.reset=Se.reset.bind(r),r.bold=Se.bold.bind(r),r.dim=Se.dim.bind(r),r.italic=Se.italic.bind(r),r.underline=Se.underline.bind(r),r.inverse=Se.inverse.bind(r),r.hidden=Se.hidden.bind(r),r.strikethrough=Se.strikethrough.bind(r),r.black=Se.black.bind(r),r.red=Se.red.bind(r),r.green=Se.green.bind(r),r.yellow=Se.yellow.bind(r),r.blue=Se.blue.bind(r),r.magenta=Se.magenta.bind(r),r.cyan=Se.cyan.bind(r),r.white=Se.white.bind(r),r.gray=Se.gray.bind(r),r.grey=Se.grey.bind(r),r.bgBlack=Se.bgBlack.bind(r),r.bgRed=Se.bgRed.bind(r),r.bgGreen=Se.bgGreen.bind(r),r.bgYellow=Se.bgYellow.bind(r),r.bgBlue=Se.bgBlue.bind(r),r.bgMagenta=Se.bgMagenta.bind(r),r.bgCyan=Se.bgCyan.bind(r),r.bgWhite=Se.bgWhite.bind(r),r}function Re(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:Se.enabled?q_(this.keys,n+""):n+""):n===void 0?MN([t],[r]):Se.enabled?q_([r],n+""):n+""}}K_.exports=Se});var ji=x(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.ancillary=Xe.failure=Xe.success=Xe.input=Xe.weak=Xe.strong=void 0;var qN=(pe(),ne(fe)),$r=qN.__importDefault(W_());Xe.strong=$r.default.bold;Xe.weak=$r.default.dim;Xe.input=$r.default.cyan;Xe.success=$r.default.green;Xe.failure=$r.default.red;Xe.ancillary=$r.default.cyan;var HN={strong:Xe.strong,weak:Xe.weak,input:Xe.input,success:Xe.success,failure:Xe.failure,ancillary:Xe.ancillary,log:{DEBUG:$r.default.magenta,INFO:$r.default.cyan,WARN:$r.default.yellow,ERROR:$r.default.red}};Xe.default=HN});var gm=x(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.EscapeCode=void 0;var _r="\x1B[",lt=class{};rl.EscapeCode=lt;lt.cursorLeft=()=>`${_r}G`;lt.cursorUp=(t=1)=>`${_r}${t}A`;lt.cursorDown=(t=1)=>`${_r}${t}B`;lt.cursorForward=(t=1)=>`${_r}${t}C`;lt.cursorBackward=(t=1)=>`${_r}${t}D`;lt.cursorHide=()=>`${_r}?25l`;lt.cursorShow=()=>`${_r}?25h`;lt.eraseLine=()=>`${_r}2K`;lt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=lt.eraseLine(),r<t-1&&(e+=lt.cursorUp());return`${e}${lt.cursorLeft()}`};lt.eraseUp=()=>`${_r}1J`;lt.eraseDown=()=>`${_r}J`;lt.eraseScreen=()=>`${_r}2J`});var J_=x(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.Cursor=void 0;var VN=(pe(),ne(fe)),zN=VN.__importDefault(qh()),Y_=gm(),Ni=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(Y_.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,zN.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(Y_.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};nl.Cursor=Ni;Ni.stream=process.stderr;Ni._isVisible=!0;Ni._listenerAttached=!1});var ym=x((hK,Dm)=>{"use strict";var X_=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);Dm.exports=X_;Dm.exports.default=X_});var ex=x((mK,Q_)=>{"use strict";var Z_="[\uD800-\uDBFF][\uDC00-\uDFFF]",GN=t=>t&&t.exact?new RegExp(`^${Z_}$`):new RegExp(Z_,"g");Q_.exports=GN});var rx=x((gK,tx)=>{"use strict";tx.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 bm=x((DK,ox)=>{var gs=rx(),nx={};for(let t of Object.keys(gs))nx[gs[t]]=t;var X={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"]}};ox.exports=X;for(let t of Object.keys(X)){if(!("channels"in X[t]))throw new Error("missing channels property: "+t);if(!("labels"in X[t]))throw new Error("missing channel labels property: "+t);if(X[t].labels.length!==X[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=X[t];delete X[t].channels,delete X[t].labels,Object.defineProperty(X[t],"channels",{value:e}),Object.defineProperty(X[t],"labels",{value:r})}X.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]};X.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),p=function(d){return(c-d)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=p(a),r=p(s),n=p(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]};X.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=X.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]};X.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 KN(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}X.rgb.keyword=function(t){let e=nx[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(gs)){let i=gs[o],a=KN(t,i);a<r&&(r=a,n=o)}return n};X.keyword.rgb=function(t){return gs[t]};X.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]};X.rgb.lab=function(t){let e=X.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]};X.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};X.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]};X.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]}};X.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]};X.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,p;switch(a){default:case 6:case 0:c=s,l=u,p=r;break;case 1:c=u,l=s,p=r;break;case 2:c=r,l=s,p=u;break;case 3:c=r,l=u,p=s;break;case 4:c=u,l=r,p=s;break;case 5:c=s,l=r,p=u;break}return[c*255,l*255,p*255]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?X.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};X.hsv.ansi16=function(t){return X.rgb.ansi16(X.hsv.rgb(t),t[2])};X.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)};X.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]};X.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]};X.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};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};X.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};X.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};X.gray.hsl=function(t){return[0,0,t[0]]};X.gray.hsv=X.gray.hsl;X.gray.hwb=function(t){return[0,100,t[0]]};X.gray.cmyk=function(t){return[0,0,0,t[0]]};X.gray.lab=function(t){return[t[0],0,0]};X.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};X.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var ax=x((yK,ix)=>{var ol=bm();function WN(){let t={},e=Object.keys(ol);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function YN(t){let e=WN(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(ol[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 JN(t,e){return function(r){return e(t(r))}}function XN(t,e){let r=[e[t].parent,t],n=ol[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=JN(ol[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}ix.exports=function(t){let e=YN(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]=XN(a,e))}return r}});var ux=x((bK,sx)=>{var wm=bm(),ZN=ax(),Li={},QN=Object.keys(wm);function eL(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 tL(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}QN.forEach(t=>{Li[t]={},Object.defineProperty(Li[t],"channels",{value:wm[t].channels}),Object.defineProperty(Li[t],"labels",{value:wm[t].labels});let e=ZN(t);Object.keys(e).forEach(n=>{let o=e[n];Li[t][n]=tL(o),Li[t][n].raw=eL(o)})});sx.exports=Li});var Cm=x((wK,dx)=>{"use strict";var cx=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,lx=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},fx=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},il=t=>t,px=(t,e,r)=>[t,e,r],Ui=(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})},vm,Mi=(t,e,r,n)=>{vm===void 0&&(vm=ux());let o=n?10:0,i={};for(let[a,s]of Object.entries(vm)){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 rL(){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",Ui(e.color,"ansi",()=>Mi(cx,"ansi16",il,!1)),Ui(e.color,"ansi256",()=>Mi(lx,"ansi256",il,!1)),Ui(e.color,"ansi16m",()=>Mi(fx,"rgb",px,!1)),Ui(e.bgColor,"ansi",()=>Mi(cx,"ansi16",il,!0)),Ui(e.bgColor,"ansi256",()=>Mi(lx,"ansi256",il,!0)),Ui(e.bgColor,"ansi16m",()=>Mi(fx,"rgb",px,!0)),e}Object.defineProperty(dx,"exports",{enumerable:!0,get:rL})});var yx=x((vK,Dx)=>{"use strict";var nL=ym(),oL=ex(),hx=Cm(),gx=["\x1B","\x9B"],al=t=>`${gx[0]}[${t}m`,mx=(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=hx.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(al(e?a:i)):t.splice(s,1)}else if(e){n.push(al(0));break}else n.push(al(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=al(hx.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};Dx.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,p]of n.entries()){let d=!1;if(gx.includes(p)){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&&p==="m"&&(a=!1,d=!0);if(!a&&!d&&u++,!oL({exact:!0}).test(p)&&nL(p.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=p;else if(u===e&&!a&&s!==void 0)c=mx(o);else if(u>=i){c+=mx(o,!0,s);break}}return c}});var wx=x((CK,bx)=>{"use strict";bx.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 sl=x((EK,vx)=>{"use strict";var iL=wx();vx.exports=t=>typeof t=="string"?t.replace(iL(),""):t});var Ex=x((_K,Cx)=>{"use strict";Cx.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=x((xK,Em)=>{"use strict";var aL=sl(),sL=ym(),uL=Ex(),_x=t=>{if(typeof t!="string"||t.length===0||(t=aL(t),t.length===0))return 0;t=t.replace(uL()," ");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+=sL(n)?2:1)}return e};Em.exports=_x;Em.exports.default=_x});var kx=x((SK,Ox)=>{"use strict";var Ds=_m(),cL=sl(),lL=Cm(),ul=new Set(["\x1B","\x9B"]),fL=39,Sm="\x07",Ax="[",pL="]",Fx="m",Am=`${pL}8;;`,xx=t=>`${ul.values().next().value}${Ax}${t}${Fx}`,Sx=t=>`${ul.values().next().value}${Am}${t}${Sm}`,dL=t=>t.split(" ").map(e=>Ds(e)),xm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Ds(cL(t[t.length-1]));for(let[s,u]of n.entries()){let c=Ds(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),ul.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Am)),o){i?u===Sm&&(o=!1,i=!1):u===Fx&&(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())},hL=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ds(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},mL=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=dL(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=Ds(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),xm(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){xm(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){xm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(hL));let u=[...s.join(`
54
- `)];for(let[c,l]of u.entries()){if(n+=l,ul.has(l)){let{groups:d}=new RegExp(`(?:\\${Ax}(?<code>\\d+)m|\\${Am}(?<uri>.*)${Sm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===fL?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=lL.codes.get(Number(o));u[c+1]===`
55
- `?(i&&(n+=Sx("")),o&&p&&(n+=xx(p))):l===`
56
- `&&(o&&p&&(n+=xx(o)),i&&(n+=Sx(i)))}return n};Ox.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
52
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=hs.checkPathsSync(t,e,"copy",r);if(hs.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=ds.dirname(e);return Pt.existsSync(i)||wL(i),xE(o,t,e,r)}function xE(t,e,r,n){let i=(n.dereference?Pt.statSync:Pt.lstatSync)(e);if(i.isDirectory())return OL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return EL(i,t,e,r,n);if(i.isSymbolicLink())return $L(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 EL(t,e,r,n,o){return e?_L(t,r,n,o):AE(t,r,n,o)}function _L(t,e,r,n){if(n.overwrite)return Pt.unlinkSync(r),AE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function AE(t,e,r,n){return Pt.copyFileSync(e,r),n.preserveTimestamps&&SL(t.mode,e,r),pm(r,t.mode)}function SL(t,e,r){return xL(t)&&AL(r,t),FL(e,r)}function xL(t){return(t&128)===0}function AL(t,e){return pm(t,e|128)}function pm(t,e){return Pt.chmodSync(t,e)}function FL(t,e){let r=Pt.statSync(t);return vL(e,r.atime,r.mtime)}function OL(t,e,r,n,o){return e?FE(r,n,o):kL(t.mode,r,n,o)}function kL(t,e,r,n){return Pt.mkdirSync(r),FE(e,r,n),pm(r,t)}function FE(t,e,r){let n=Pt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)PL(o.name,t,e,r)}finally{n.closeSync()}}function PL(t,e,r,n){let o=ds.join(e,t),i=ds.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=hs.checkPathsSync(o,i,"copy",n);return xE(a,o,i,n)}function $L(t,e,r,n){let o=Pt.readlinkSync(e);if(n.dereference&&(o=ds.resolve(process.cwd(),o)),t){let i;try{i=Pt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Pt.symlinkSync(o,r);throw a}if(n.dereference&&(i=ds.resolve(process.cwd(),i)),hs.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(hs.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return IL(o,r)}else return Pt.symlinkSync(o,r)}function IL(t,e){return Pt.unlinkSync(e),Pt.symlinkSync(t,e)}OE.exports=CL});var Zc=x((KK,PE)=>{"use strict";var TL=ct().fromPromise;PE.exports={copy:TL(SE()),copySync:kE()}});var ms=x((GK,IE)=>{"use strict";var $E=_n(),RL=ct().fromCallback;function BL(t,e){$E.rm(t,{recursive:!0,force:!0},e)}function LL(t){$E.rmSync(t,{recursive:!0,force:!0})}IE.exports={remove:RL(BL),removeSync:LL}});var ME=x((WK,UE)=>{"use strict";var NL=ct().fromPromise,BE=kt(),LE=require("path"),NE=_r(),jE=ms(),TE=NL(async function(e){let r;try{r=await BE.readdir(e)}catch{return NE.mkdirs(e)}return Promise.all(r.map(n=>jE.remove(LE.join(e,n))))});function RE(t){let e;try{e=BE.readdirSync(t)}catch{return NE.mkdirsSync(t)}e.forEach(r=>{r=LE.join(t,r),jE.removeSync(r)})}UE.exports={emptyDirSync:RE,emptydirSync:RE,emptyDir:TE,emptydir:TE}});var zE=x((YK,VE)=>{"use strict";var jL=ct().fromPromise,qE=require("path"),tn=kt(),HE=_r();async function UL(t){let e;try{e=await tn.stat(t)}catch{}if(e&&e.isFile())return;let r=qE.dirname(t),n=null;try{n=await tn.stat(r)}catch(o){if(o.code==="ENOENT"){await HE.mkdirs(r),await tn.writeFile(t,"");return}else throw o}n.isDirectory()?await tn.writeFile(t,""):await tn.readdir(r)}function ML(t){let e;try{e=tn.statSync(t)}catch{}if(e&&e.isFile())return;let r=qE.dirname(t);try{tn.statSync(r).isDirectory()||tn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")HE.mkdirsSync(r);else throw n}tn.writeFileSync(t,"")}VE.exports={createFile:jL(UL),createFileSync:ML}});var JE=x((JK,YE)=>{"use strict";var qL=ct().fromPromise,KE=require("path"),Fn=kt(),GE=_r(),{pathExists:HL}=An(),{areIdentical:WE}=Eo();async function VL(t,e){let r;try{r=await Fn.lstat(e)}catch{}let n;try{n=await Fn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&WE(n,r))return;let o=KE.dirname(e);await HL(o)||await GE.mkdirs(o),await Fn.link(t,e)}function zL(t,e){let r;try{r=Fn.lstatSync(e)}catch{}try{let i=Fn.lstatSync(t);if(r&&WE(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=KE.dirname(e);return Fn.existsSync(n)||GE.mkdirsSync(n),Fn.linkSync(t,e)}YE.exports={createLink:qL(VL),createLinkSync:zL}});var ZE=x((XK,XE)=>{"use strict";var On=require("path"),gs=kt(),{pathExists:KL}=An(),GL=ct().fromPromise;async function WL(t,e){if(On.isAbsolute(t)){try{await gs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=On.dirname(e),n=On.join(r,t);if(await KL(n))return{toCwd:n,toDst:t};try{await gs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:On.relative(r,t)}}function YL(t,e){if(On.isAbsolute(t)){if(!gs.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=On.dirname(e),n=On.join(r,t);if(gs.existsSync(n))return{toCwd:n,toDst:t};if(!gs.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:On.relative(r,t)}}XE.exports={symlinkPaths:GL(WL),symlinkPathsSync:YL}});var t_=x((ZK,e_)=>{"use strict";var QE=kt(),JL=ct().fromPromise;async function XL(t,e){if(e)return e;let r;try{r=await QE.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function ZL(t,e){if(e)return e;let r;try{r=QE.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}e_.exports={symlinkType:JL(XL),symlinkTypeSync:ZL}});var i_=x((QK,o_)=>{"use strict";var QL=ct().fromPromise,r_=require("path"),$r=kt(),{mkdirs:eN,mkdirsSync:tN}=_r(),{symlinkPaths:rN,symlinkPathsSync:nN}=ZE(),{symlinkType:oN,symlinkTypeSync:iN}=t_(),{pathExists:aN}=An(),{areIdentical:n_}=Eo();async function sN(t,e,r){let n;try{n=await $r.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([$r.stat(t),$r.stat(e)]);if(n_(s,u))return}let o=await rN(t,e);t=o.toDst;let i=await oN(o.toCwd,r),a=r_.dirname(e);return await aN(a)||await eN(a),$r.symlink(t,e,i)}function uN(t,e,r){let n;try{n=$r.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=$r.statSync(t),u=$r.statSync(e);if(n_(s,u))return}let o=nN(t,e);t=o.toDst,r=iN(o.toCwd,r);let i=r_.dirname(e);return $r.existsSync(i)||tN(i),$r.symlinkSync(t,e,r)}o_.exports={createSymlink:QL(sN),createSymlinkSync:uN}});var d_=x((eG,p_)=>{"use strict";var{createFile:a_,createFileSync:s_}=zE(),{createLink:u_,createLinkSync:c_}=JE(),{createSymlink:l_,createSymlinkSync:f_}=i_();p_.exports={createFile:a_,createFileSync:s_,ensureFile:a_,ensureFileSync:s_,createLink:u_,createLinkSync:c_,ensureLink:u_,ensureLinkSync:c_,createSymlink:l_,createSymlinkSync:f_,ensureSymlink:l_,ensureSymlinkSync:f_}});var Qc=x((tG,h_)=>{function cN(t,{EOL:e=`
53
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function lN(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}h_.exports={stringify:cN,stripBom:lN}});var y_=x((rG,D_)=>{var Bi;try{Bi=_n()}catch{Bi=require("fs")}var el=ct(),{stringify:m_,stripBom:g_}=Qc();async function fN(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Bi,n="throws"in e?e.throws:!0,o=await el.fromCallback(r.readFile)(t,e);o=g_(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 pN=el.fromPromise(fN);function dN(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Bi,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=g_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function hN(t,e,r={}){let n=r.fs||Bi,o=m_(e,r);await el.fromCallback(n.writeFile)(t,o,r)}var mN=el.fromPromise(hN);function gN(t,e,r={}){let n=r.fs||Bi,o=m_(e,r);return n.writeFileSync(t,o,r)}D_.exports={readFile:pN,readFileSync:dN,writeFile:mN,writeFileSync:gN}});var w_=x((nG,b_)=>{"use strict";var tl=y_();b_.exports={readJson:tl.readFile,readJsonSync:tl.readFileSync,writeJson:tl.writeFile,writeJsonSync:tl.writeFileSync}});var rl=x((oG,E_)=>{"use strict";var DN=ct().fromPromise,dm=kt(),v_=require("path"),C_=_r(),yN=An().pathExists;async function bN(t,e,r="utf-8"){let n=v_.dirname(t);return await yN(n)||await C_.mkdirs(n),dm.writeFile(t,e,r)}function wN(t,...e){let r=v_.dirname(t);dm.existsSync(r)||C_.mkdirsSync(r),dm.writeFileSync(t,...e)}E_.exports={outputFile:DN(bN),outputFileSync:wN}});var S_=x((iG,__)=>{"use strict";var{stringify:vN}=Qc(),{outputFile:CN}=rl();async function EN(t,e,r={}){let n=vN(e,r);await CN(t,n,r)}__.exports=EN});var A_=x((aG,x_)=>{"use strict";var{stringify:_N}=Qc(),{outputFileSync:SN}=rl();function xN(t,e,r){let n=_N(e,r);SN(t,n,r)}x_.exports=xN});var O_=x((sG,F_)=>{"use strict";var AN=ct().fromPromise,$t=w_();$t.outputJson=AN(S_());$t.outputJsonSync=A_();$t.outputJSON=$t.outputJson;$t.outputJSONSync=$t.outputJsonSync;$t.writeJSON=$t.writeJson;$t.writeJSONSync=$t.writeJsonSync;$t.readJSON=$t.readJson;$t.readJSONSync=$t.readJsonSync;F_.exports=$t});var T_=x((uG,I_)=>{"use strict";var FN=kt(),k_=require("path"),{copy:ON}=Zc(),{remove:$_}=ms(),{mkdirp:kN}=_r(),{pathExists:PN}=An(),P_=Eo();async function $N(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await P_.checkPaths(t,e,"move",r);await P_.checkParentPaths(t,o,e,"move");let a=k_.dirname(e);return k_.parse(a).root!==a&&await kN(a),IN(t,e,n,i)}async function IN(t,e,r,n){if(!n){if(r)await $_(e);else if(await PN(e))throw new Error("dest already exists.")}try{await FN.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await TN(t,e,r)}}async function TN(t,e,r){return await ON(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),$_(t)}I_.exports=$N});var j_=x((cG,N_)=>{"use strict";var B_=_n(),mm=require("path"),RN=Zc().copySync,L_=ms().removeSync,BN=_r().mkdirpSync,R_=Eo();function LN(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=R_.checkPathsSync(t,e,"move",r);return R_.checkParentPathsSync(t,o,e,"move"),NN(e)||BN(mm.dirname(e)),jN(t,e,n,i)}function NN(t){let e=mm.dirname(t);return mm.parse(e).root===e}function jN(t,e,r,n){if(n)return hm(t,e,r);if(r)return L_(e),hm(t,e,r);if(B_.existsSync(e))throw new Error("dest already exists.");return hm(t,e,r)}function hm(t,e,r){try{B_.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return UN(t,e,r)}}function UN(t,e,r){return RN(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),L_(t)}N_.exports=LN});var M_=x((lG,U_)=>{"use strict";var MN=ct().fromPromise;U_.exports={move:MN(T_()),moveSync:j_()}});var Li=x((fG,q_)=>{"use strict";q_.exports={...kt(),...Zc(),...ME(),...d_(),...O_(),..._r(),...M_(),...rl(),...An(),...ms()}});var Y_=x((pG,W_)=>{"use strict";var gm,V_,z_,K_,G_=!0;typeof process<"u"&&({FORCE_COLOR:gm,NODE_DISABLE_COLORS:V_,NO_COLOR:z_,TERM:K_}=process.env||{},G_=process.stdout&&process.stdout.isTTY);var Ae={enabled:!V_&&z_==null&&K_!=="dumb"&&(gm!=null&&gm!=="0"||G_),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 H_(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 qN(t,e){let r={has:t,keys:e};return r.reset=Ae.reset.bind(r),r.bold=Ae.bold.bind(r),r.dim=Ae.dim.bind(r),r.italic=Ae.italic.bind(r),r.underline=Ae.underline.bind(r),r.inverse=Ae.inverse.bind(r),r.hidden=Ae.hidden.bind(r),r.strikethrough=Ae.strikethrough.bind(r),r.black=Ae.black.bind(r),r.red=Ae.red.bind(r),r.green=Ae.green.bind(r),r.yellow=Ae.yellow.bind(r),r.blue=Ae.blue.bind(r),r.magenta=Ae.magenta.bind(r),r.cyan=Ae.cyan.bind(r),r.white=Ae.white.bind(r),r.gray=Ae.gray.bind(r),r.grey=Ae.grey.bind(r),r.bgBlack=Ae.bgBlack.bind(r),r.bgRed=Ae.bgRed.bind(r),r.bgGreen=Ae.bgGreen.bind(r),r.bgYellow=Ae.bgYellow.bind(r),r.bgBlue=Ae.bgBlue.bind(r),r.bgMagenta=Ae.bgMagenta.bind(r),r.bgCyan=Ae.bgCyan.bind(r),r.bgWhite=Ae.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:Ae.enabled?H_(this.keys,n+""):n+""):n===void 0?qN([t],[r]):Ae.enabled?H_([r],n+""):n+""}}W_.exports=Ae});var Ni=x(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ancillary=Ze.failure=Ze.success=Ze.input=Ze.weak=Ze.strong=void 0;var HN=(de(),ne(pe)),Ir=HN.__importDefault(Y_());Ze.strong=Ir.default.bold;Ze.weak=Ir.default.dim;Ze.input=Ir.default.cyan;Ze.success=Ir.default.green;Ze.failure=Ir.default.red;Ze.ancillary=Ir.default.cyan;var VN={strong:Ze.strong,weak:Ze.weak,input:Ze.input,success:Ze.success,failure:Ze.failure,ancillary:Ze.ancillary,log:{DEBUG:Ir.default.magenta,INFO:Ir.default.cyan,WARN:Ir.default.yellow,ERROR:Ir.default.red}};Ze.default=VN});var Dm=x(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.EscapeCode=void 0;var Sr="\x1B[",ft=class{};nl.EscapeCode=ft;ft.cursorLeft=()=>`${Sr}G`;ft.cursorUp=(t=1)=>`${Sr}${t}A`;ft.cursorDown=(t=1)=>`${Sr}${t}B`;ft.cursorForward=(t=1)=>`${Sr}${t}C`;ft.cursorBackward=(t=1)=>`${Sr}${t}D`;ft.cursorHide=()=>`${Sr}?25l`;ft.cursorShow=()=>`${Sr}?25h`;ft.eraseLine=()=>`${Sr}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=()=>`${Sr}1J`;ft.eraseDown=()=>`${Sr}J`;ft.eraseScreen=()=>`${Sr}2J`});var X_=x(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.Cursor=void 0;var zN=(de(),ne(pe)),KN=zN.__importDefault(Hh()),J_=Dm(),ji=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(J_.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,KN.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(J_.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};ol.Cursor=ji;ji.stream=process.stderr;ji._isVisible=!0;ji._listenerAttached=!1});var bm=x((gG,ym)=>{"use strict";var Z_=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);ym.exports=Z_;ym.exports.default=Z_});var tS=x((DG,eS)=>{"use strict";var Q_="[\uD800-\uDBFF][\uDC00-\uDFFF]",GN=t=>t&&t.exact?new RegExp(`^${Q_}$`):new RegExp(Q_,"g");eS.exports=GN});var nS=x((yG,rS)=>{"use strict";rS.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 wm=x((bG,iS)=>{var Ds=nS(),oS={};for(let t of Object.keys(Ds))oS[Ds[t]]=t;var X={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"]}};iS.exports=X;for(let t of Object.keys(X)){if(!("channels"in X[t]))throw new Error("missing channels property: "+t);if(!("labels"in X[t]))throw new Error("missing channel labels property: "+t);if(X[t].labels.length!==X[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=X[t];delete X[t].channels,delete X[t].labels,Object.defineProperty(X[t],"channels",{value:e}),Object.defineProperty(X[t],"labels",{value:r})}X.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]};X.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),p=function(d){return(c-d)/6/l+1/2};return l===0?(o=0,i=0):(i=l/c,e=p(a),r=p(s),n=p(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]};X.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=X.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]};X.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 WN(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}X.rgb.keyword=function(t){let e=oS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(Ds)){let i=Ds[o],a=WN(t,i);a<r&&(r=a,n=o)}return n};X.keyword.rgb=function(t){return Ds[t]};X.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]};X.rgb.lab=function(t){let e=X.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]};X.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};X.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]};X.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]}};X.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]};X.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,p;switch(a){default:case 6:case 0:c=s,l=u,p=r;break;case 1:c=u,l=s,p=r;break;case 2:c=r,l=s,p=u;break;case 3:c=r,l=u,p=s;break;case 4:c=u,l=r,p=s;break;case 5:c=s,l=r,p=u;break}return[c*255,l*255,p*255]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?X.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};X.hsv.ansi16=function(t){return X.rgb.ansi16(X.hsv.rgb(t),t[2])};X.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)};X.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]};X.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]};X.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};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.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]};X.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};X.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};X.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};X.gray.hsl=function(t){return[0,0,t[0]]};X.gray.hsv=X.gray.hsl;X.gray.hwb=function(t){return[0,100,t[0]]};X.gray.cmyk=function(t){return[0,0,0,t[0]]};X.gray.lab=function(t){return[t[0],0,0]};X.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};X.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var sS=x((wG,aS)=>{var il=wm();function YN(){let t={},e=Object.keys(il);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function JN(t){let e=YN(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(il[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 XN(t,e){return function(r){return e(t(r))}}function ZN(t,e){let r=[e[t].parent,t],n=il[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=XN(il[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}aS.exports=function(t){let e=JN(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]=ZN(a,e))}return r}});var cS=x((vG,uS)=>{var vm=wm(),QN=sS(),Ui={},ej=Object.keys(vm);function tj(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 rj(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}ej.forEach(t=>{Ui[t]={},Object.defineProperty(Ui[t],"channels",{value:vm[t].channels}),Object.defineProperty(Ui[t],"labels",{value:vm[t].labels});let e=QN(t);Object.keys(e).forEach(n=>{let o=e[n];Ui[t][n]=rj(o),Ui[t][n].raw=tj(o)})});uS.exports=Ui});var Em=x((CG,hS)=>{"use strict";var lS=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,fS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},pS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},al=t=>t,dS=(t,e,r)=>[t,e,r],Mi=(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})},Cm,qi=(t,e,r,n)=>{Cm===void 0&&(Cm=cS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Cm)){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 nj(){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",Mi(e.color,"ansi",()=>qi(lS,"ansi16",al,!1)),Mi(e.color,"ansi256",()=>qi(fS,"ansi256",al,!1)),Mi(e.color,"ansi16m",()=>qi(pS,"rgb",dS,!1)),Mi(e.bgColor,"ansi",()=>qi(lS,"ansi16",al,!0)),Mi(e.bgColor,"ansi256",()=>qi(fS,"ansi256",al,!0)),Mi(e.bgColor,"ansi16m",()=>qi(pS,"rgb",dS,!0)),e}Object.defineProperty(hS,"exports",{enumerable:!0,get:nj})});var bS=x((EG,yS)=>{"use strict";var oj=bm(),ij=tS(),mS=Em(),DS=["\x1B","\x9B"],sl=t=>`${DS[0]}[${t}m`,gS=(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=mS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(sl(e?a:i)):t.splice(s,1)}else if(e){n.push(sl(0));break}else n.push(sl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=sl(mS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};yS.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[l,p]of n.entries()){let d=!1;if(DS.includes(p)){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&&p==="m"&&(a=!1,d=!0);if(!a&&!d&&u++,!ij({exact:!0}).test(p)&&oj(p.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=p;else if(u===e&&!a&&s!==void 0)c=gS(o);else if(u>=i){c+=gS(o,!0,s);break}}return c}});var vS=x((_G,wS)=>{"use strict";wS.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 ul=x((SG,CS)=>{"use strict";var aj=vS();CS.exports=t=>typeof t=="string"?t.replace(aj(),""):t});var _S=x((xG,ES)=>{"use strict";ES.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 Sm=x((AG,_m)=>{"use strict";var sj=ul(),uj=bm(),cj=_S(),SS=t=>{if(typeof t!="string"||t.length===0||(t=sj(t),t.length===0))return 0;t=t.replace(cj()," ");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+=uj(n)?2:1)}return e};_m.exports=SS;_m.exports.default=SS});var PS=x((FG,kS)=>{"use strict";var ys=Sm(),lj=ul(),fj=Em(),cl=new Set(["\x1B","\x9B"]),pj=39,Am="\x07",FS="[",dj="]",OS="m",Fm=`${dj}8;;`,xS=t=>`${cl.values().next().value}${FS}${t}${OS}`,AS=t=>`${cl.values().next().value}${Fm}${t}${Am}`,hj=t=>t.split(" ").map(e=>ys(e)),xm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=ys(lj(t[t.length-1]));for(let[s,u]of n.entries()){let c=ys(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),cl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Fm)),o){i?u===Am&&(o=!1,i=!1):u===OS&&(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&&!(ys(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},gj=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=hj(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=ys(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),xm(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){xm(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){xm(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(mj));let u=[...s.join(`
54
+ `)];for(let[c,l]of u.entries()){if(n+=l,cl.has(l)){let{groups:d}=new RegExp(`(?:\\${FS}(?<code>\\d+)m|\\${Fm}(?<uri>.*)${Am})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===pj?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=fj.codes.get(Number(o));u[c+1]===`
55
+ `?(i&&(n+=AS("")),o&&p&&(n+=xS(p))):l===`
56
+ `&&(o&&p&&(n+=xS(o)),i&&(n+=AS(i)))}return n};kS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
57
57
  `).split(`
58
- `).map(n=>mL(n,e,r)).join(`
59
- `)});var Tx=x((AK,$x)=>{"use strict";var gL=require("os"),Px=gL.homedir();$x.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return Px?t.replace(/^~(?=$|\/|\\)/,Px):t}});var Lx=x(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 Ix=(pe(),ne(fe)),DL=Ix.__importStar(require("os")),tn=Ix.__importStar(require("path")),Rx=yx();Ge.sliceAnsi=Rx;var cl=_m();Ge.stringWidth=cl;var yL=sl();Ge.stripAnsi=yL;var bL=kx(),wL=Tx(),vL=80,CL=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max(vL,Math.min(process.stdout.columns,CL)):1/0;function Bx(t=4){return" ".repeat(t)}Ge.indent=Bx;function EL(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return bL(t,e-r-n.length,{trim:!0}).split(`
58
+ `).map(n=>gj(n,e,r)).join(`
59
+ `)});var TS=x((OG,IS)=>{"use strict";var Dj=require("os"),$S=Dj.homedir();IS.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return $S?t.replace(/^~(?=$|\/|\\)/,$S):t}});var US=x(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 RS=(de(),ne(pe)),yj=RS.__importStar(require("os")),rn=RS.__importStar(require("path")),BS=bS();Ge.sliceAnsi=BS;var ll=Sm();Ge.stringWidth=ll;var bj=ul();Ge.stripAnsi=bj;var wj=PS(),vj=TS(),Cj=80,Ej=120;Ge.TTY_WIDTH=process.stdout.columns?Math.max(Cj,Math.min(process.stdout.columns,Ej)):1/0;function LS(t=4){return" ".repeat(t)}Ge.indent=LS;function _j(t,{width:e=Ge.TTY_WIDTH,indentation:r=0,append:n=""}){return wj(t,e-r-n.length,{trim:!0}).split(`
60
60
  `).join(`${n}
61
- ${Bx(r)}`)}Ge.wordWrap=EL;function _L(t){t=jx(t);let e=process.cwd(),r=tn.dirname(t),n=DL.homedir(),o=Math.abs(r.split(tn.sep).length-e.split(tn.sep).length);if(e===r)return"."+tn.sep+tn.basename(t);if(r.startsWith(e))return"."+tn.sep+t.substring(e.length+1);if(o<=2){let i=tn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+tn.sep+t.substring(n.length+1)}return t}Ge.prettyPath=_L;function jx(t){return tn.resolve(wL(t))}Ge.expandPath=jx;function Nx(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>cl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>Rx(i,0,o-cl(a)))}Ge.generateFillSpaceStringList=Nx;function xL(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 p=0,d=l.map(h=>{let m=h.split(`
62
- `);return p=Math.max(p,m.length),m});for(let h in l)a[h]&&a[h].push(...d[h],...Array(p-d[h].length).fill(""))}let s=a.map((l,p)=>{if(p<i-1){let d=Nx(l);return l.map((h,m)=>`${h}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,p)=>l.map((d,h)=>{let m=l[h]+p[h];return u=Math.max(u,cl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
- `)}Ge.columnar=xL});var Ux=x(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.TERMINAL_INFO=ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES=void 0;var SL=(pe(),ne(fe)),AL=om(),FL=SL.__importStar(require("os")),OL=(0,AL.debug)("ionic:utils-terminal:info");ur.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];ur.CI_ENVIRONMENT_VARIABLES_DETECTED=ur.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function kL(){let{shell:t}=FL.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")}ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&OL(`Environment variables for CI detected: ${ur.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);ur.TERMINAL_INFO=Object.freeze({ci:ur.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:kL(),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 Fm=x(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var ll=(pe(),ne(fe));ll.__exportStar(gm(),qi);ll.__exportStar(J_(),qi);ll.__exportStar(Lx(),qi);ll.__exportStar(Ux(),qi)});var pl=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.isFatal=Tr.fatal=Tr.FatalException=Tr.BaseException=void 0;var fl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Tr.BaseException=fl;var ys=class extends fl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Tr.FatalException=ys;function PL(t){throw new ys(t)}Tr.fatal=PL;function $L(t){return t&&t instanceof ys}Tr.isFatal=$L});var Pm={};Hr(Pm,{LOGGER_LEVELS:()=>UL,Logger:()=>km,NO_COLORS:()=>Mx,StreamOutputStrategy:()=>dl,TTYOutputStrategy:()=>Om,TTY_WIDTH:()=>TL,createDefaultLogger:()=>LL,indent:()=>IL,sliceAnsi:()=>RL,stringWidth:()=>BL,stripAnsi:()=>jL,wordWrap:()=>NL});var TL,IL,RL,BL,jL,NL,LL,Mx,dl,Om,km,UL,$m=tt(()=>{TL=80,IL=t=>t,RL=t=>t,BL=t=>t.length,jL=t=>t,NL=t=>t,LL=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),Mx={},dl=class{constructor(){this.colors=Mx,this.stream=process.stdout}},Om=class extends dl{constructor(e){super(),this.options=e}},km=class{constructor(){}info(){}warn(){}error(){}debug(){}},UL={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var Hx=x(Eo=>{"use strict";Object.defineProperty(Eo,"__esModule",{value:!0});Eo.isInteractive=Eo.checkInteractive=void 0;var ML=(pe(),ne(fe)),qx=Fm(),qL=ML.__importDefault(ji()),HL=bs(),VL=(...t)=>(0,Eo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(HL.logger.error(`Non-interactive shell detected.
64
- Run the command with ${qL.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Eo.checkInteractive=VL;var zL=()=>qx.TERMINAL_INFO.tty&&!qx.TERMINAL_INFO.ci;Eo.isInteractive=zL});var hl={};Hr(hl,{default:()=>Vx});function Vx(){throw new Error("Prompts are not supported in this CLI build")}var ml=tt(()=>{});var bs=x(Lt=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:!0});Lt.logSuccess=Lt.logPrompt=Lt.logger=Lt.output=void 0;var Tm=(pe(),ne(fe)),_o=($m(),ne(Pm)),xo=Tm.__importDefault(ji()),GL=Hx(),zx={colors:xo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Lt.output=(0,GL.isInteractive)()?new _o.TTYOutputStrategy(zx):new _o.StreamOutputStrategy(zx);Lt.logger=(0,_o.createDefaultLogger)({output:Lt.output,formatterOptions:{titleize:!1,tags:new Map([[_o.LOGGER_LEVELS.DEBUG,xo.default.log.DEBUG("[debug]")],[_o.LOGGER_LEVELS.INFO,xo.default.log.INFO("[info]")],[_o.LOGGER_LEVELS.WARN,xo.default.log.WARN("[warn]")],[_o.LOGGER_LEVELS.ERROR,xo.default.log.ERROR("[error]")]])}});async function KL(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Tm.__importStar(($m(),ne(Pm)))),{prompt:n}=await Promise.resolve().then(()=>Tm.__importStar((ml(),ne(hl))));return Lt.logger.log({msg:`${xo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Lt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Lt.logPrompt=KL;function WL(t){Lt.logger.msg(`${xo.default.success("[success]")} ${t}`)}Lt.logSuccess=WL});var gl=x(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.resolveNode=Hi.requireTS=void 0;var YL=require("fs"),JL=Bi(),XL=require("path"),ZL=(t,e)=>{let r=(0,XL.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,JL.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};Hi.requireTS=ZL;function QL(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,YL.existsSync)(n)?n:null}}Hi.resolveNode=QL});var Gx={};Hr(Gx,{default:()=>e4});var e4,Kx=tt(()=>{e4={}});var Wx=x(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.buildXmlElement=Ir.writeXML=Ir.parseXML=Ir.readXML=void 0;var t4=(pe(),ne(fe)),r4=Bi(),ws=t4.__importDefault((Kx(),ne(Gx)));async function n4(t){var e;try{let r=await(0,r4.readFile)(t,{encoding:"utf-8"});try{return await ws.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Ir.readXML=n4;function o4(t,e){let r=e!==void 0?new ws.default.Parser({...e}):new ws.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Ir.parseXML=o4;async function i4(t){return new Promise(e=>{let n=new ws.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Ir.writeXML=i4;function a4(t,e){return new ws.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Ir.buildXmlElement=a4});var Qx=x(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 s4=(pe(),ne(fe)),u4=Bi(),Im=require("path"),Vi=s4.__importDefault(ji()),c4=pl(),l4=bs(),Yx=gl(),f4=Wx();function Jx(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=Jx;async function p4(t,e){var r;let n=(r=Jx(t,e))!==null&&r!==void 0?r:Zx(t);return(await Promise.all(n.map(async i=>Xx(t,i)))).filter(i=>!!i)}Fe.getPlugins=p4;async function Xx(t,e){try{let r=(0,Yx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,c4.fatal)(`Unable to find ${Vi.default.strong(`node_modules/${e}`)}.
65
- Are you sure ${Vi.default.strong(e)} is installed?`);let n=(0,Im.dirname)(r),o=await(0,u4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Rm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Im.join)(n,"plugin.xml"),a=await(0,f4.readXML)(i);return{id:e,name:Rm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Fe.resolvePlugin=Xx;function Zx(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=Zx;function Rm(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=Rm;function d4(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 ${Vi.default.strong(e)}:
66
- `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Vi.default.strong(e)}, skipped install:
67
- `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Vi.default.strong(e)}:
68
- `;break}n+=t.map(i=>`${i.id}${Vi.default.weak(`@${i.version}`)}`).join(`
69
- `),l4.logger.info(n)}Fe.printPlugins=d4;function Bm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Fe.getPluginPlatform=Bm;function h4(t,e,r){let n=Bm(t,e);if(n){let o=n[r];if(o)return o}return[]}Fe.getPlatformElement=h4;function m4(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=m4;function g4(t,e){return jm(t,e,"js-module")}Fe.getJSModules=g4;function D4(t,e){return jm(t,e,"asset")}Fe.getAssets=D4;function y4(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,Yx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Im.join)(e.rootPath,r)}Fe.getFilePath=y4;function jm(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Bm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Fe.getAllElements=jm});var eS={};Hr(eS,{default:()=>b4});var b4,tS=tt(()=>{b4={}});var Dl=x(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.isInstalled=On.getCommandOutput=On.runCommand=void 0;var Nm=(tS(),ne(eS));async function rS(t,e,r={}){let n=new Nm.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof Nm.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}On.runCommand=rS;async function w4(t,e,r={}){try{return(await rS(t,e,r)).trim()}catch{return null}}On.getCommandOutput=w4;async function v4(t){try{await(0,Nm.which)(t)}catch{return!1}return!0}On.isInstalled=v4});var nS={};Hr(nS,{Comparator:()=>Y4,Range:()=>K4,SemVer:()=>W4,clean:()=>x4,coerce:()=>G4,compare:()=>k4,diff:()=>C4,eq:()=>I4,gt:()=>$4,gte:()=>B4,gtr:()=>H4,inc:()=>S4,intersects:()=>z4,lt:()=>T4,lte:()=>j4,ltr:()=>V4,major:()=>A4,maxSatisfying:()=>L4,minSatisfying:()=>U4,minor:()=>F4,neq:()=>R4,outside:()=>q4,parse:()=>E4,patch:()=>O4,rcompare:()=>P4,satisfies:()=>N4,valid:()=>_4,validRange:()=>M4});var C4,E4,_4,x4,S4,A4,F4,O4,k4,P4,$4,T4,I4,R4,B4,j4,N4,L4,U4,M4,q4,H4,V4,z4,G4,K4,W4,Y4,oS=tt(()=>{C4=()=>null,E4=()=>null,_4=()=>null,x4=()=>null,S4=()=>null,A4=()=>null,F4=()=>null,O4=()=>null,k4=()=>0,P4=()=>0,$4=()=>!1,T4=()=>!1,I4=()=>!1,R4=()=>!0,B4=()=>!1,j4=()=>!1,N4=()=>!1,L4=()=>null,U4=()=>null,M4=()=>null,q4=()=>!1,H4=()=>!1,V4=()=>!1,z4=()=>!1,G4=()=>null,K4=class{},W4=class{},Y4=class{}});var gS=x(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.parseApkNameFromFlavor=Y.checkJDKMajorVersion=Y.resolvePlatform=Y.checkPlatformVersions=Y.getAddedPlatforms=Y.getPlatformTargetName=Y.promptForPlatformTarget=Y.promptForPlatform=Y.isValidEnterprisePlatform=Y.getKnownEnterprisePlatforms=Y.isValidCommunityPlatform=Y.getKnownCommunityPlatforms=Y.isValidPlatform=Y.getKnownPlatforms=Y.selectPlatforms=Y.getProjectPlatformDirectory=Y.getCLIVersion=Y.getCoreVersion=Y.getCapacitorPackageVersion=Y.requireCapacitorPackage=Y.getCapacitorPackage=Y.runTask=Y.runPlatformHook=Y.runHooks=Y.wait=Y.checkAppName=Y.checkAppId=Y.checkAppDir=Y.checkAppConfig=Y.checkCapacitorPlatform=Y.checkPackage=Y.checkWebDir=Y.check=void 0;var Cs=(pe(),ne(fe)),iS=Fm(),kn=Bi(),So=require("path"),Oe=Cs.__importDefault(ji()),zi=pl(),sS=bs(),J4=Qx(),aS=iu(),vs=gl(),X4=Dl();async function Z4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
- `)}Y.check=Z4;async function Q4(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,kn.pathExists)(t.app.webDirAbs)?await(0,kn.pathExists)((0,So.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Oe.default.strong((0,iS.prettyPath)(t.app.webDirAbs))}) must contain an ${Oe.default.strong("index.html")} file.
71
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Oe.default.strong((0,iS.prettyPath)(t.app.webDirAbs))}.
72
- Please create it and make sure it has an ${Oe.default.strong("index.html")} file. You can change the path of this directory in ${Oe.default.strong(t.app.extConfigName)} (${Oe.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Oe.default.input("npm run build")}). More info: ${Oe.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Y.checkWebDir=Q4;async function eU(){return await(0,kn.pathExists)("package.json")||await(0,kn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
61
+ ${LS(r)}`)}Ge.wordWrap=_j;function Sj(t){t=NS(t);let e=process.cwd(),r=rn.dirname(t),n=yj.homedir(),o=Math.abs(r.split(rn.sep).length-e.split(rn.sep).length);if(e===r)return"."+rn.sep+rn.basename(t);if(r.startsWith(e))return"."+rn.sep+t.substring(e.length+1);if(o<=2){let i=rn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+rn.sep+t.substring(n.length+1)}return t}Ge.prettyPath=Sj;function NS(t){return rn.resolve(vj(t))}Ge.expandPath=NS;function jS(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>ll(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>BS(i,0,o-ll(a)))}Ge.generateFillSpaceStringList=jS;function xj(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 p=0,d=l.map(h=>{let m=h.split(`
62
+ `);return p=Math.max(p,m.length),m});for(let h in l)a[h]&&a[h].push(...d[h],...Array(p-d[h].length).fill(""))}let s=a.map((l,p)=>{if(p<i-1){let d=jS(l);return l.map((h,m)=>`${h}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=s.reduce((l,p)=>l.map((d,h)=>{let m=l[h]+p[h];return u=Math.max(u,ll(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
63
+ `)}Ge.columnar=xj});var MS=x(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.TERMINAL_INFO=cr.CI_ENVIRONMENT_VARIABLES_DETECTED=cr.CI_ENVIRONMENT_VARIABLES=void 0;var Aj=(de(),ne(pe)),Fj=im(),Oj=Aj.__importStar(require("os")),kj=(0,Fj.debug)("ionic:utils-terminal:info");cr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];cr.CI_ENVIRONMENT_VARIABLES_DETECTED=cr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function Pj(){let{shell:t}=Oj.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")}cr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&kj(`Environment variables for CI detected: ${cr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);cr.TERMINAL_INFO=Object.freeze({ci:cr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:Pj(),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 Om=x(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var fl=(de(),ne(pe));fl.__exportStar(Dm(),Hi);fl.__exportStar(X_(),Hi);fl.__exportStar(US(),Hi);fl.__exportStar(MS(),Hi)});var dl=x(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.isFatal=Tr.fatal=Tr.FatalException=Tr.BaseException=void 0;var pl=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};Tr.BaseException=pl;var bs=class extends pl{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};Tr.FatalException=bs;function $j(t){throw new bs(t)}Tr.fatal=$j;function Ij(t){return t&&t instanceof bs}Tr.isFatal=Ij});var $m={};Vr($m,{LOGGER_LEVELS:()=>Mj,Logger:()=>Pm,NO_COLORS:()=>qS,StreamOutputStrategy:()=>hl,TTYOutputStrategy:()=>km,TTY_WIDTH:()=>Tj,createDefaultLogger:()=>Uj,indent:()=>Rj,sliceAnsi:()=>Bj,stringWidth:()=>Lj,stripAnsi:()=>Nj,wordWrap:()=>jj});var Tj,Rj,Bj,Lj,Nj,jj,Uj,qS,hl,km,Pm,Mj,Im=rt(()=>{Tj=80,Rj=t=>t,Bj=t=>t,Lj=t=>t.length,Nj=t=>t,jj=t=>t,Uj=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),qS={},hl=class{constructor(){this.colors=qS,this.stream=process.stdout}},km=class extends hl{constructor(e){super(),this.options=e}},Pm=class{constructor(){}info(){}warn(){}error(){}debug(){}},Mj={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var VS=x(_o=>{"use strict";Object.defineProperty(_o,"__esModule",{value:!0});_o.isInteractive=_o.checkInteractive=void 0;var qj=(de(),ne(pe)),HS=Om(),Hj=qj.__importDefault(Ni()),Vj=ws(),zj=(...t)=>(0,_o.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(Vj.logger.error(`Non-interactive shell detected.
64
+ Run the command with ${Hj.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;_o.checkInteractive=zj;var Kj=()=>HS.TERMINAL_INFO.tty&&!HS.TERMINAL_INFO.ci;_o.isInteractive=Kj});var ml={};Vr(ml,{default:()=>zS});function zS(){throw new Error("Prompts are not supported in this CLI build")}var gl=rt(()=>{});var ws=x(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.logSuccess=Ut.logPrompt=Ut.logger=Ut.output=void 0;var Tm=(de(),ne(pe)),So=(Im(),ne($m)),xo=Tm.__importDefault(Ni()),Gj=VS(),KS={colors:xo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Ut.output=(0,Gj.isInteractive)()?new So.TTYOutputStrategy(KS):new So.StreamOutputStrategy(KS);Ut.logger=(0,So.createDefaultLogger)({output:Ut.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 Wj(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Tm.__importStar((Im(),ne($m)))),{prompt:n}=await Promise.resolve().then(()=>Tm.__importStar((gl(),ne(ml))));return Ut.logger.log({msg:`${xo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Ut.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Ut.logPrompt=Wj;function Yj(t){Ut.logger.msg(`${xo.default.success("[success]")} ${t}`)}Ut.logSuccess=Yj});var Dl=x(Vi=>{"use strict";Object.defineProperty(Vi,"__esModule",{value:!0});Vi.resolveNode=Vi.requireTS=void 0;var Jj=require("fs"),Xj=Li(),Zj=require("path"),Qj=(t,e)=>{let r=(0,Zj.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,Xj.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};Vi.requireTS=Qj;function e4(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,Jj.existsSync)(n)?n:null}}Vi.resolveNode=e4});var GS={};Vr(GS,{default:()=>t4});var t4,WS=rt(()=>{t4={}});var YS=x(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.buildXmlElement=Rr.writeXML=Rr.parseXML=Rr.readXML=void 0;var r4=(de(),ne(pe)),n4=Li(),vs=r4.__importDefault((WS(),ne(GS)));async function o4(t){var e;try{let r=await(0,n4.readFile)(t,{encoding:"utf-8"});try{return await vs.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Rr.readXML=o4;function i4(t,e){let r=e!==void 0?new vs.default.Parser({...e}):new vs.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Rr.parseXML=i4;async function a4(t){return new Promise(e=>{let n=new vs.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Rr.writeXML=a4;function s4(t,e){return new vs.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Rr.buildXmlElement=s4});var ex=x(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.getAllElements=Oe.getFilePath=Oe.getAssets=Oe.getJSModules=Oe.getPluginType=Oe.getPlatformElement=Oe.getPluginPlatform=Oe.printPlugins=Oe.fixName=Oe.getDependencies=Oe.resolvePlugin=Oe.getPlugins=Oe.getIncludedPluginPackages=void 0;var u4=(de(),ne(pe)),c4=Li(),Rm=require("path"),zi=u4.__importDefault(Ni()),l4=dl(),f4=ws(),JS=Dl(),p4=YS();function XS(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}}Oe.getIncludedPluginPackages=XS;async function d4(t,e){var r;let n=(r=XS(t,e))!==null&&r!==void 0?r:QS(t);return(await Promise.all(n.map(async i=>ZS(t,i)))).filter(i=>!!i)}Oe.getPlugins=d4;async function ZS(t,e){try{let r=(0,JS.resolveNode)(t.app.rootDir,e,"package.json");r||(0,l4.fatal)(`Unable to find ${zi.default.strong(`node_modules/${e}`)}.
65
+ Are you sure ${zi.default.strong(e)} is installed?`);let n=(0,Rm.dirname)(r),o=await(0,c4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:Bm(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,Rm.join)(n,"plugin.xml"),a=await(0,p4.readXML)(i);return{id:e,name:Bm(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Oe.resolvePlugin=ZS;function QS(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:{})]}Oe.getDependencies=QS;function Bm(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Oe.fixName=Bm;function h4(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 ${zi.default.strong(e)}:
66
+ `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${zi.default.strong(e)}, skipped install:
67
+ `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${zi.default.strong(e)}:
68
+ `;break}n+=t.map(i=>`${i.id}${zi.default.weak(`@${i.version}`)}`).join(`
69
+ `),f4.logger.info(n)}Oe.printPlugins=h4;function Lm(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Oe.getPluginPlatform=Lm;function m4(t,e,r){let n=Lm(t,e);if(n){let o=n[r];if(o)return o}return[]}Oe.getPlatformElement=m4;function g4(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}Oe.getPluginType=g4;function D4(t,e){return Nm(t,e,"js-module")}Oe.getJSModules=D4;function y4(t,e){return Nm(t,e,"asset")}Oe.getAssets=y4;function b4(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,JS.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,Rm.join)(e.rootPath,r)}Oe.getFilePath=b4;function Nm(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=Lm(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Oe.getAllElements=Nm});var tx={};Vr(tx,{default:()=>w4});var w4,rx=rt(()=>{w4={}});var yl=x(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.isInstalled=kn.getCommandOutput=kn.runCommand=void 0;var jm=(rx(),ne(tx));async function nx(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}}kn.runCommand=nx;async function v4(t,e,r={}){try{return(await nx(t,e,r)).trim()}catch{return null}}kn.getCommandOutput=v4;async function C4(t){try{await(0,jm.which)(t)}catch{return!1}return!0}kn.isInstalled=C4});var ox={};Vr(ox,{Comparator:()=>J4,Range:()=>W4,SemVer:()=>Y4,clean:()=>x4,coerce:()=>G4,compare:()=>P4,diff:()=>E4,eq:()=>R4,gt:()=>I4,gte:()=>L4,gtr:()=>V4,inc:()=>A4,intersects:()=>K4,lt:()=>T4,lte:()=>N4,ltr:()=>z4,major:()=>F4,maxSatisfying:()=>U4,minSatisfying:()=>M4,minor:()=>O4,neq:()=>B4,outside:()=>H4,parse:()=>_4,patch:()=>k4,rcompare:()=>$4,satisfies:()=>j4,valid:()=>S4,validRange:()=>q4});var E4,_4,S4,x4,A4,F4,O4,k4,P4,$4,I4,T4,R4,B4,L4,N4,j4,U4,M4,q4,H4,V4,z4,K4,G4,W4,Y4,J4,ix=rt(()=>{E4=()=>null,_4=()=>null,S4=()=>null,x4=()=>null,A4=()=>null,F4=()=>null,O4=()=>null,k4=()=>null,P4=()=>0,$4=()=>0,I4=()=>!1,T4=()=>!1,R4=()=>!1,B4=()=>!0,L4=()=>!1,N4=()=>!1,j4=()=>!1,U4=()=>null,M4=()=>null,q4=()=>null,H4=()=>!1,V4=()=>!1,z4=()=>!1,K4=()=>!1,G4=()=>null,W4=class{},Y4=class{},J4=class{}});var Dx=x(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.parseApkNameFromFlavor=Y.checkJDKMajorVersion=Y.resolvePlatform=Y.checkPlatformVersions=Y.getAddedPlatforms=Y.getPlatformTargetName=Y.promptForPlatformTarget=Y.promptForPlatform=Y.isValidEnterprisePlatform=Y.getKnownEnterprisePlatforms=Y.isValidCommunityPlatform=Y.getKnownCommunityPlatforms=Y.isValidPlatform=Y.getKnownPlatforms=Y.selectPlatforms=Y.getProjectPlatformDirectory=Y.getCLIVersion=Y.getCoreVersion=Y.getCapacitorPackageVersion=Y.requireCapacitorPackage=Y.getCapacitorPackage=Y.runTask=Y.runPlatformHook=Y.runHooks=Y.wait=Y.checkAppName=Y.checkAppId=Y.checkAppDir=Y.checkAppConfig=Y.checkCapacitorPlatform=Y.checkPackage=Y.checkWebDir=Y.check=void 0;var Es=(de(),ne(pe)),ax=Om(),Pn=Li(),Ao=require("path"),ke=Es.__importDefault(Ni()),Ki=dl(),ux=ws(),X4=ex(),sx=au(),Cs=Dl(),Z4=yl();async function Q4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
70
+ `)}Y.check=Q4;async function eU(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,Pn.pathExists)(t.app.webDirAbs)?await(0,Pn.pathExists)((0,Ao.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${ke.default.strong((0,ax.prettyPath)(t.app.webDirAbs))}) must contain an ${ke.default.strong("index.html")} file.
71
+ 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,ax.prettyPath)(t.app.webDirAbs))}.
72
+ 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")}`}Y.checkWebDir=eU;async function tU(){return await(0,Pn.pathExists)("package.json")||await(0,Pn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
73
73
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
74
- More info: ${Oe.default.strong("https://docs.npmjs.com/cli/init")}`}Y.checkPackage=eU;async function tU(t,e){return await Um(t,e)?null:`Could not find the ${Oe.default.input(e)} platform.
75
- You must install it in your project first, e.g. w/ ${Oe.default.input(`npm install @capacitor/${e}`)}`}Y.checkCapacitorPlatform=tU;async function rU(t){if(!t.app.appId)return`Missing ${Oe.default.input("appId")} for new platform.
76
- Please add it in ${t.app.extConfigName} or run ${Oe.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Oe.default.input("appName")} for new platform.
77
- Please add it in ${t.app.extConfigName} or run ${Oe.default.input("npx cap init")}.`;let e=await uS(t,t.app.appId);if(e)return e;let r=await cS(t,t.app.appName);return r||null}Y.checkAppConfig=rU;async function nU(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Y.checkAppDir=nU;async function uS(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
74
+ More info: ${ke.default.strong("https://docs.npmjs.com/cli/init")}`}Y.checkPackage=tU;async function rU(t,e){return await Mm(t,e)?null:`Could not find the ${ke.default.input(e)} platform.
75
+ You must install it in your project first, e.g. w/ ${ke.default.input(`npm install @capacitor/${e}`)}`}Y.checkCapacitorPlatform=rU;async function nU(t){if(!t.app.appId)return`Missing ${ke.default.input("appId")} for new platform.
76
+ 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.
77
+ Please add it in ${t.app.extConfigName} or run ${ke.default.input("npx cap init")}.`;let e=await cx(t,t.app.appId);if(e)return e;let r=await lx(t,t.app.appName);return r||null}Y.checkAppConfig=nU;async function oU(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Y.checkAppDir=oU;async function cx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
78
78
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
79
79
  - Must be in Java package form with no dashes (ex: com.example.app)
80
80
  - It must have at least two segments (one or more dots).
@@ -82,109 +82,109 @@ Please add it in ${t.app.extConfigName} or run ${Oe.default.input("npx cap init"
82
82
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
83
83
 
84
84
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
85
- `:"Invalid App ID. App ID is required and cannot be blank."}Y.checkAppId=uS;async function cS(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Y.checkAppName=cS;async function oU(t){return new Promise(e=>setTimeout(e,t))}Y.wait=oU;async function iU(t,e,r,n){await Lm(t,e,r,n);let o=await(0,J4.getPlugins)(t,e);for(let i of o)await Lm(t,e,i.rootPath,n)}Y.runHooks=iU;async function Lm(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Cs.__importStar(require("child_process"))),a;(0,aS.isNXMonorepo)(r)?a=await(0,kn.readJSON)((0,So.join)((0,aS.findNXMonorepoRoot)(r),"package.json")):a=await(0,kn.readJSON)((0,So.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",p=>{p===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${p} while running command: ${s}`))}),l.on("error",p=>{c(p)})})}Y.runPlatformHook=Lm;async function aU(t,e){let r=sS.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Y.runTask=aU;async function Um(t,e){let r=(0,vs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,kn.readJSON)(r):null}Y.getCapacitorPackage=Um;async function lS(t,e){let r=await Um(t,e);return r||(0,zi.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
- Are you sure ${Oe.default.strong(`@capacitor/${e}`)} is installed?`),r}Y.requireCapacitorPackage=lS;async function bl(t,e){return(await lS(t,e)).version}Y.getCapacitorPackageVersion=bl;async function fS(t){return bl(t,"core")}Y.getCoreVersion=fS;async function sU(t){return bl(t,"cli")}Y.getCLIVersion=sU;function uU(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 yl(t,e){let r=uU(t,e);return r&&await(0,kn.pathExists)(r)?r:null}Y.getProjectPlatformDirectory=yl;async function cU(t,e){if(e){let r=e.toLowerCase().trim();return await qm(r)?await yl(t,r)||(r==="web"&&(0,zi.fatal)(`Could not find the web platform directory.
87
- Make sure ${Oe.default.strong(t.app.webDir)} exists.`),(0,zi.fatal)(`${Oe.default.strong(r)} platform has not been added yet.
88
- See the docs for adding the ${Oe.default.strong(r)} platform: ${Oe.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,zi.fatal)(`Invalid platform: ${Oe.default.input(r)}`),[r]}return mS(t)}Y.selectPlatforms=cU;async function Mm(){return["web","android","ios"]}Y.getKnownPlatforms=Mm;async function qm(t){return(await Mm()).includes(t)}Y.isValidPlatform=qm;async function pS(){return["electron"]}Y.getKnownCommunityPlatforms=pS;async function lU(t){return(await pS()).includes(t)}Y.isValidCommunityPlatform=lU;async function dS(){return["windows"]}Y.getKnownEnterprisePlatforms=dS;async function fU(t){return(await dS()).includes(t)}Y.isValidEnterprisePlatform=fU;async function pU(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Cs.__importStar((ml(),ne(hl))));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 qm(o)){let i=await Mm();(0,zi.fatal)(`Invalid platform: ${Oe.default.input(o)}.
89
- Valid platforms include: ${i.join(", ")}`)}return o}Y.promptForPlatform=pU;async function dU(t,e){let{prompt:r}=await Promise.resolve().then(()=>Cs.__importStar((ml(),ne(hl)))),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:`${hS(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,zi.fatal)(`Invalid target ID: ${Oe.default.input(o)}.
90
- Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}Y.promptForPlatformTarget=dU;function hS(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"})`:""}`}Y.getPlatformTargetName=hS;async function mS(t){let e=[];return await yl(t,t.android.name)&&e.push(t.android.name),await yl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Y.getAddedPlatforms=mS;async function hU(t,e){let r=await Promise.resolve().then(()=>Cs.__importStar((oS(),ne(nS)))),n=await fS(t),o=await bl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&sS.logger.warn(`${Oe.default.strong("@capacitor/core")}${Oe.default.weak(`@${n}`)} version doesn't match ${Oe.default.strong(`@capacitor/${e}`)}${Oe.default.weak(`@${o}`)} version.
91
- Consider updating to a matching version, e.g. w/ ${Oe.default.input(`npm install @capacitor/core@${o}`)}`)}Y.checkPlatformVersions=hU;function mU(t,e){if(e[0]!=="@"){let n=(0,vs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,So.dirname)(n);let o=(0,vs.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,So.dirname)(o);let i=(0,vs.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,So.dirname)(i)}let r=(0,vs.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,So.dirname)(r):null}Y.resolvePlatform=mU;async function gU(){try{let t=await(0,X4.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}}Y.checkJDKMajorVersion=gU;function DU(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Y.parseApkNameFromFlavor=DU});var DS=x(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.tryFn=void 0;var yU=async(t,...e)=>{try{return await t(...e)}catch{}return null};wl.tryFn=yU});var yS=x(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.formatJSObject=void 0;var bU=(pe(),ne(fe)),wU=bU.__importDefault(require("util"));function vU(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return wU.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}vl.formatJSObject=vU});var bS=x(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.lazy=Pn.LazyPromise=Pn.allSerial=void 0;function CU(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Pn.allSerial=CU;var Cl=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)}};Pn.LazyPromise=Cl;function EU(t){return new Cl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Pn.lazy=EU});var ES=x(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.writeConfig=ft.loadConfig=ft.CONFIG_FILE_NAME_JSON=ft.CONFIG_FILE_NAME_JS=ft.CONFIG_FILE_NAME_TS=void 0;var Vm=(pe(),ne(fe)),_U=Vm.__importDefault(om()),Ut=Bi(),ae=require("path"),Ao=Vm.__importDefault(ji()),xU=gS(),El=pl(),SU=bs(),Hm=DS(),AU=yS(),wS=iu(),vS=gl(),Gi=bS(),FU=Dl(),CS=(0,_U.default)("capacitor:config");ft.CONFIG_FILE_NAME_TS="capacitor.config.ts";ft.CONFIG_FILE_NAME_JS="capacitor.config.js";ft.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function OU(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await TU(o),s=await(async()=>{var h,m;if((0,wS.isNXMonorepo)(o)){let b=(0,wS.findNXMonorepoRoot)(o),D=await(0,Hm.tryFn)(Ut.readJSON,(0,ae.resolve)(b,"package.json")),C=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.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",p=await IU(i),d={android:await RU(o,a.extConfig,p),ios:await BU(o,a.extConfig),web:await jU(o,l),cli:p,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,Hm.tryFn)(Ut.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return CS("config: %O",d),d}ft.loadConfig=OU;async function kU(t,e){switch((0,ae.extname)(e)){case".json":{await(0,Ut.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Ut.writeFile)(e,HU(t));break}}}ft.writeConfig=kU;async function PU(t,e,r){var n;try{let o=(0,vS.resolveNode)(t,"typescript");o||(0,El.fatal)(`Could not find installation of TypeScript.
92
- To use ${Ao.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Ao.default.input("npm install -D typescript")}`);let i=require(o),a=(0,vS.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,El.isFatal)(o)||(0,El.fatal)(`Parsing ${Ao.default.strong(e)} failed.
85
+ `:"Invalid App ID. App ID is required and cannot be blank."}Y.checkAppId=cx;async function lx(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Y.checkAppName=lx;async function iU(t){return new Promise(e=>setTimeout(e,t))}Y.wait=iU;async function aU(t,e,r,n){await Um(t,e,r,n);let o=await(0,X4.getPlugins)(t,e);for(let i of o)await Um(t,e,i.rootPath,n)}Y.runHooks=aU;async function Um(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Es.__importStar(require("child_process"))),a;(0,sx.isNXMonorepo)(r)?a=await(0,Pn.readJSON)((0,Ao.join)((0,sx.findNXMonorepoRoot)(r),"package.json")):a=await(0,Pn.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",p=>{p===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${p} while running command: ${s}`))}),l.on("error",p=>{c(p)})})}Y.runPlatformHook=Um;async function sU(t,e){let r=ux.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Y.runTask=sU;async function Mm(t,e){let r=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,Pn.readJSON)(r):null}Y.getCapacitorPackage=Mm;async function fx(t,e){let r=await Mm(t,e);return r||(0,Ki.fatal)(`Unable to find node_modules/@capacitor/${e}.
86
+ Are you sure ${ke.default.strong(`@capacitor/${e}`)} is installed?`),r}Y.requireCapacitorPackage=fx;async function wl(t,e){return(await fx(t,e)).version}Y.getCapacitorPackageVersion=wl;async function px(t){return wl(t,"core")}Y.getCoreVersion=px;async function uU(t){return wl(t,"cli")}Y.getCLIVersion=uU;function cU(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 bl(t,e){let r=cU(t,e);return r&&await(0,Pn.pathExists)(r)?r:null}Y.getProjectPlatformDirectory=bl;async function lU(t,e){if(e){let r=e.toLowerCase().trim();return await Hm(r)?await bl(t,r)||(r==="web"&&(0,Ki.fatal)(`Could not find the web platform directory.
87
+ Make sure ${ke.default.strong(t.app.webDir)} exists.`),(0,Ki.fatal)(`${ke.default.strong(r)} platform has not been added yet.
88
+ See the docs for adding the ${ke.default.strong(r)} platform: ${ke.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ki.fatal)(`Invalid platform: ${ke.default.input(r)}`),[r]}return gx(t)}Y.selectPlatforms=lU;async function qm(){return["web","android","ios"]}Y.getKnownPlatforms=qm;async function Hm(t){return(await qm()).includes(t)}Y.isValidPlatform=Hm;async function dx(){return["electron"]}Y.getKnownCommunityPlatforms=dx;async function fU(t){return(await dx()).includes(t)}Y.isValidCommunityPlatform=fU;async function hx(){return["windows"]}Y.getKnownEnterprisePlatforms=hx;async function pU(t){return(await hx()).includes(t)}Y.isValidEnterprisePlatform=pU;async function dU(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Es.__importStar((gl(),ne(ml))));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 Hm(o)){let i=await qm();(0,Ki.fatal)(`Invalid platform: ${ke.default.input(o)}.
89
+ Valid platforms include: ${i.join(", ")}`)}return o}Y.promptForPlatform=dU;async function hU(t,e){let{prompt:r}=await Promise.resolve().then(()=>Es.__importStar((gl(),ne(ml)))),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:`${mx(s)} (${s.id})`,value:s}))}],{onCancel:()=>process.exit(1)})).target;let o=e.trim(),i=t.find(a=>a.id===o);return i||(0,Ki.fatal)(`Invalid target ID: ${ke.default.input(o)}.
90
+ Valid targets are: ${t.map(a=>a.id).join(", ")}`),i}Y.promptForPlatformTarget=hU;function mx(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"})`:""}`}Y.getPlatformTargetName=mx;async function gx(t){let e=[];return await bl(t,t.android.name)&&e.push(t.android.name),await bl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Y.getAddedPlatforms=gx;async function mU(t,e){let r=await Promise.resolve().then(()=>Es.__importStar((ix(),ne(ox)))),n=await px(t),o=await wl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&ux.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.
91
+ Consider updating to a matching version, e.g. w/ ${ke.default.input(`npm install @capacitor/core@${o}`)}`)}Y.checkPlatformVersions=mU;function gU(t,e){if(e[0]!=="@"){let n=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,Ao.dirname)(n);let o=(0,Cs.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,Ao.dirname)(o);let i=(0,Cs.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,Ao.dirname)(i)}let r=(0,Cs.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,Ao.dirname)(r):null}Y.resolvePlatform=gU;async function DU(){try{let t=await(0,Z4.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}}Y.checkJDKMajorVersion=DU;function yU(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Y.parseApkNameFromFlavor=yU});var yx=x(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});vl.tryFn=void 0;var bU=async(t,...e)=>{try{return await t(...e)}catch{}return null};vl.tryFn=bU});var bx=x(Cl=>{"use strict";Object.defineProperty(Cl,"__esModule",{value:!0});Cl.formatJSObject=void 0;var wU=(de(),ne(pe)),vU=wU.__importDefault(require("util"));function CU(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return vU.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Cl.formatJSObject=CU});var wx=x($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.lazy=$n.LazyPromise=$n.allSerial=void 0;function EU(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}$n.allSerial=EU;var El=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)}};$n.LazyPromise=El;function _U(t){return new El(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}$n.lazy=_U});var _x=x(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.writeConfig=pt.loadConfig=pt.CONFIG_FILE_NAME_JSON=pt.CONFIG_FILE_NAME_JS=pt.CONFIG_FILE_NAME_TS=void 0;var zm=(de(),ne(pe)),SU=zm.__importDefault(im()),Mt=Li(),ae=require("path"),Fo=zm.__importDefault(Ni()),xU=Dx(),_l=dl(),AU=ws(),Vm=yx(),FU=bx(),vx=au(),Cx=Dl(),Gi=wx(),OU=yl(),Ex=(0,SU.default)("capacitor:config");pt.CONFIG_FILE_NAME_TS="capacitor.config.ts";pt.CONFIG_FILE_NAME_JS="capacitor.config.js";pt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function kU(){var t,e,r,n;let o=process.cwd(),i=(0,ae.dirname)(__dirname),a=await TU(o),s=await(async()=>{var h,m;if((0,vx.isNXMonorepo)(o)){let y=(0,vx.findNXMonorepoRoot)(o),D=await(0,Vm.tryFn)(Mt.readJSON,(0,ae.resolve)(y,"package.json")),C=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.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",p=await RU(i),d={android:await BU(o,a.extConfig,p),ios:await LU(o,a.extConfig),web:await NU(o,l),cli:p,app:{rootDir:o,appId:u,appName:c,webDir:l,webDirAbs:(0,ae.resolve)(o,l),package:(n=await(0,Vm.tryFn)(Mt.readJSON,(0,ae.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return Ex("config: %O",d),d}pt.loadConfig=kU;async function PU(t,e){switch((0,ae.extname)(e)){case".json":{await(0,Mt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Mt.writeFile)(e,VU(t));break}}}pt.writeConfig=PU;async function $U(t,e,r){var n;try{let o=(0,Cx.resolveNode)(t,"typescript");o||(0,_l.fatal)(`Could not find installation of TypeScript.
92
+ 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,Cx.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,_l.isFatal)(o)||(0,_l.fatal)(`Parsing ${Fo.default.strong(e)} failed.
93
93
 
94
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function $U(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,El.fatal)(`Parsing ${Ao.default.strong(e)} failed.
94
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function IU(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,_l.fatal)(`Parsing ${Fo.default.strong(e)} failed.
95
95
 
96
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function TU(t){var e;let r=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_TS);if(await(0,Ut.pathExists)(r))return PU(t,ft.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_JS);if(await(0,Ut.pathExists)(n))return $U(t,ft.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,ft.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:ft.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Hm.tryFn)(Ut.readJSON,o))!==null&&e!==void 0?e:{}}}async function IU(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,Ut.readJSON)((0,ae.resolve)(t,"package.json")),os:NU(process.platform)}}async function RU(t,e,r){var n,o,i,a,s,u,c,l,p,d,h,m,b,D,C,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",P=(0,ae.resolve)(t,S),k="app",B=`${k}/src`,R=`${B}/main`,N=`${R}/assets`,F=`${N}/public`,U=`${R}/res`,M=`${k}/build/outputs/apk/`,Q=((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 $=(0,xU.parseApkNameFromFlavor)(Q),y=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,Gi.lazy)(()=>MU(r.os)),A={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(p=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.keystorePassword,keystoreAlias:(h=(d=e.android)===null||d===void 0?void 0:d.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=(D=e.android)===null||D===void 0?void 0:D.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:S,platformDirAbs:P,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ae.resolve)(P,w),appDir:k,appDirAbs:(0,ae.resolve)(P,k),srcDir:B,srcDirAbs:(0,ae.resolve)(P,B),srcMainDir:R,srcMainDirAbs:(0,ae.resolve)(P,R),assetsDir:N,assetsDirAbs:(0,ae.resolve)(P,N),webDir:F,webDirAbs:(0,ae.resolve)(P,F),resDir:U,resDirAbs:(0,ae.resolve)(P,U),apkName:$,buildOutputDir:y,buildOutputDirAbs:(0,ae.resolve)(P,y),flavor:Q,buildOptions:A}}async function BU(t,e){var r,n,o,i,a,s,u,c,l,p,d,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),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)(D,E),_=`${E}/App`,S=(0,ae.resolve)(D,_),P=`${E}/App.xcodeproj`,k=(0,ae.resolve)(D,P),B=(0,Gi.lazy)(()=>LU(g)),R=(0,Gi.lazy)(()=>qU(t,D,g)),N=(0,Gi.lazy)(()=>UU(g,S,k)),F="capacitor-cordova-ios-plugins",U={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:(p=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.signingCertificate,provisioningProfile:(h=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:b,platformDirAbs:D,scheme:C,cordovaPluginsDir:F,cordovaPluginsDirAbs:(0,ae.resolve)(D,F),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:P,nativeXcodeProjDirAbs:k,nativeXcodeWorkspaceDir:(0,Gi.lazy)(async()=>(0,ae.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Gi.lazy)(async()=>(0,ae.relative)(D,await N)),webDirAbs:N,podPath:R,buildOptions:U}}async function jU(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function NU(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function LU(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function UU(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,Ut.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return SU.logger.warn(`Using the iOS project root for the ${Ao.default.strong("public")} directory is deprecated.
97
- Please follow the Upgrade Guide to move ${Ao.default.strong("public")} inside the iOS target directory: ${Ao.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 MU(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(()=>Vm.__importStar(Dl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Ut.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){CS("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,Ut.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,Ut.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,Ut.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,FU.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,Ut.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function HU(t){return`import type { CapacitorConfig } from '@capacitor/cli';
96
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function TU(t){var e;let r=(0,ae.resolve)(t,pt.CONFIG_FILE_NAME_TS);if(await(0,Mt.pathExists)(r))return $U(t,pt.CONFIG_FILE_NAME_TS,r);let n=(0,ae.resolve)(t,pt.CONFIG_FILE_NAME_JS);if(await(0,Mt.pathExists)(n))return IU(t,pt.CONFIG_FILE_NAME_JS,n);let o=(0,ae.resolve)(t,pt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:pt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,Vm.tryFn)(Mt.readJSON,o))!==null&&e!==void 0?e:{}}}async function RU(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,Mt.readJSON)((0,ae.resolve)(t,"package.json")),os:jU(process.platform)}}async function BU(t,e,r){var n,o,i,a,s,u,c,l,p,d,h,m,y,D,C,E,g;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",P=(0,ae.resolve)(t,S),k="app",B=`${k}/src`,R=`${B}/main`,N=`${R}/assets`,F=`${N}/public`,U=`${R}/res`,M=`${k}/build/outputs/apk/`,Q=((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 $=(0,xU.parseApkNameFromFlavor)(Q),b=`${M}/debug`,w="capacitor-cordova-android-plugins",v=(0,Gi.lazy)(()=>qU(r.os)),A={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(p=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.keystorePassword,keystoreAlias:(h=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(y=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(C=(D=e.android)===null||D===void 0?void 0:D.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:S,platformDirAbs:P,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,ae.resolve)(P,w),appDir:k,appDirAbs:(0,ae.resolve)(P,k),srcDir:B,srcDirAbs:(0,ae.resolve)(P,B),srcMainDir:R,srcMainDirAbs:(0,ae.resolve)(P,R),assetsDir:N,assetsDirAbs:(0,ae.resolve)(P,N),webDir:F,webDirAbs:(0,ae.resolve)(P,F),resDir:U,resDirAbs:(0,ae.resolve)(P,U),apkName:$,buildOutputDir:b,buildOutputDirAbs:(0,ae.resolve)(P,b),flavor:Q,buildOptions:A}}async function LU(t,e){var r,n,o,i,a,s,u,c,l,p,d,h;let y=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,ae.resolve)(t,y),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)(D,E),_=`${E}/App`,S=(0,ae.resolve)(D,_),P=`${E}/App.xcodeproj`,k=(0,ae.resolve)(D,P),B=(0,Gi.lazy)(()=>UU(g)),R=(0,Gi.lazy)(()=>HU(t,D,g)),N=(0,Gi.lazy)(()=>MU(g,S,k)),F="capacitor-cordova-ios-plugins",U={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:(p=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||p===void 0?void 0:p.signingCertificate,provisioningProfile:(h=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:y,platformDirAbs:D,scheme:C,cordovaPluginsDir:F,cordovaPluginsDirAbs:(0,ae.resolve)(D,F),nativeProjectDir:E,nativeProjectDirAbs:g,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:P,nativeXcodeProjDirAbs:k,nativeXcodeWorkspaceDir:(0,Gi.lazy)(async()=>(0,ae.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Gi.lazy)(async()=>(0,ae.relative)(D,await N)),webDirAbs:N,podPath:R,buildOptions:U}}async function NU(t,e){let r=e,n=(0,ae.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function jU(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function UU(t){return(0,ae.resolve)(t,"App.xcworkspace")}async function MU(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,Mt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return AU.logger.warn(`Using the iOS project root for the ${Fo.default.strong("public")} directory is deprecated.
97
+ 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 qU(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(yl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Mt.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){Ex("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 HU(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Mt.pathExists)((0,ae.resolve)(t,"Gemfile"))?n=(0,ae.resolve)(t,"Gemfile"):await(0,Mt.pathExists)((0,ae.resolve)(e,"Gemfile"))?n=(0,ae.resolve)(e,"Gemfile"):await(0,Mt.pathExists)((0,ae.resolve)(r,"Gemfile"))&&(n=(0,ae.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,OU.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,ae.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,Mt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function VU(t){return`import type { CapacitorConfig } from '@capacitor/cli';
98
98
 
99
- const config: CapacitorConfig = ${(0,AU.formatJSObject)(t)};
99
+ const config: CapacitorConfig = ${(0,FU.formatJSObject)(t)};
100
100
 
101
101
  export default config;
102
- `}});function VU(){try{return Km.default.statSync("/.dockerenv"),!0}catch{return!1}}function zU(){try{return Km.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Wm(){return Gm===void 0&&(Gm=VU()||zU()),Gm}var Km,Gm,xS=tt(()=>{Km=le(require("node:fs"),1)});function Wi(){return Ym===void 0&&(Ym=GU()||Wm()),Ym}var SS,Ym,GU,Jm=tt(()=>{SS=le(require("node:fs"),1);xS();GU=()=>{try{return SS.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Xm,FS,OS,AS,$n,Zm=tt(()=>{Xm=le(require("node:process"),1),FS=le(require("node:os"),1),OS=le(require("node:fs"),1);Jm();AS=()=>{if(Xm.default.platform!=="linux")return!1;if(FS.default.release().toLowerCase().includes("microsoft"))return!Wi();try{return OS.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Wi():!1}catch{return!1}},$n=Xm.default.env.__IS_WSL_TEST__?AS:AS()});var Qm,_s,KU,WU,eg,kS=tt(()=>{Qm=le(require("node:process"),1),_s=le(require("node:fs/promises"),1);Zm();Zm();KU=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await _s.default.access(r,_s.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await _s.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}})(),WU=async()=>`${await KU()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,eg=async()=>$n?WU():`${Qm.default.env.SYSTEMROOT||Qm.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function Tn(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 PS=tt(()=>{});async function tg(){if(TS.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await YU("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var $S,TS,IS,YU,RS=tt(()=>{$S=require("node:util"),TS=le(require("node:process"),1),IS=require("node:child_process"),YU=(0,$S.promisify)(IS.execFile)});async function NS(t,{humanReadableOutput:e=!0,signal:r}={}){if(BS.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await JU("osascript",["-e",t,n],o);return i.trim()}var BS,jS,rg,JU,LS=tt(()=>{BS=le(require("node:process"),1),jS=require("node:util"),rg=require("node:child_process"),JU=(0,jS.promisify)(rg.execFile)});async function ng(t){return NS(`tell application "Finder" to set app_path to application file id "${t}" as string
103
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var US=tt(()=>{LS()});async function og(t=XU){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 _l(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=ZU[n];if(!o)throw new _l(`Unknown browser ID: ${n}`);return o}var MS,qS,XU,ZU,_l,HS=tt(()=>{MS=require("node:util"),qS=require("node:child_process"),XU=(0,MS.promisify)(qS.execFile),ZU={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},_l=class extends Error{}});async function ig(){if(xl.default.platform==="darwin"){let t=await tg();return{name:await ng(t),id:t}}if(xl.default.platform==="linux"){let{stdout:t}=await QU("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:e5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(xl.default.platform==="win32")return og();throw new Error("Only macOS, Linux, and Windows are supported")}var VS,xl,zS,QU,e5,GS=tt(()=>{VS=require("node:util"),xl=le(require("node:process"),1),zS=require("node:child_process");RS();US();HS();QU=(0,VS.promisify)(zS.execFile),e5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var fg={};Hr(fg,{apps:()=>In,default:()=>i5,openApp:()=>o5});async function r5(){let t=await eg(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=ug.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await t5(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 JS(t){if(typeof t=="string"||Array.isArray(t))return t;let{[WS]:e}=t;if(!e)throw new Error(`${WS} is not supported`);return e}function Al({[Yi]:t},{wsl:e}){if(e&&$n)return JS(e);if(!t)throw new Error(`${Yi} is not supported`);return JS(t)}var sg,ug,cg,XS,ZS,lg,Sl,a5,t5,ag,KS,Yi,WS,YS,xs,n5,o5,In,i5,pg=tt(()=>{sg=le(require("node:process"),1),ug=require("node:buffer"),cg=le(require("node:path"),1),XS=require("node:url"),ZS=require("node:util"),lg=le(require("node:child_process"),1),Sl=le(require("node:fs/promises"),1);kS();PS();GS();Jm();a5={},t5=(0,ZS.promisify)(lg.default.execFile),ag=cg.default.dirname((0,XS.fileURLToPath)(a5.url)),KS=cg.default.join(ag,"xdg-open"),{platform:Yi,arch:WS}=sg.default;YS=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},xs=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return YS(t.app,s=>xs({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return YS(e,s=>xs({...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=$n?await r5():await ig();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),xs({...t,app:{name:In[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(Yi==="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(Yi==="win32"||$n&&!Wi()&&!e){n=await eg(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),$n||(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=ug.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!ag||ag==="/",u=!1;try{await Sl.default.access(KS,Sl.constants.X_OK),u=!0}catch{}n=sg.default.versions.electron??(Yi==="android"||s||!u)?"xdg-open":KS}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}Yi==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=lg.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)},n5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return xs({...e,target:t})},o5=(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 xs({...e,app:{name:t,arguments:r}})};In={};Tn(In,"chrome",()=>Al({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"]}}));Tn(In,"brave",()=>Al({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"]}}));Tn(In,"firefox",()=>Al({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Tn(In,"edge",()=>Al({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Tn(In,"browser",()=>"browser");Tn(In,"browserPrivate",()=>"browserPrivate");i5=n5});var Ql=x(fr=>{"use strict";fr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;fr.find=(t,e)=>t.nodes.find(r=>r.type===e);fr.exceedsLimit=(t,e,r=1,n)=>n===!1||!fr.isInteger(t)||!fr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;fr.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)};fr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;fr.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;fr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;fr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);fr.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 ef=x((mJ,_A)=>{"use strict";var EA=Ql();_A.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&EA.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&EA.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 SA=x((gJ,xA)=>{"use strict";xA.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var RA=x((DJ,IA)=>{"use strict";var AA=SA(),No=(t,e,r)=>{if(AA(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(AA(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(No.cache.hasOwnProperty(u))return No.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 p=TA(t)||TA(e),d={min:t,max:e,a:c,b:l},h=[],m=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),c<0){let b=l<0?Math.abs(l):1;m=FA(b,Math.abs(c),d,n),c=d.a=0}return l>=0&&(h=FA(c,l,d,n)),d.negatives=m,d.positives=h,d.result=X5(m,h,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&h.length+m.length>1&&(d.result=`(?:${d.result})`),No.cache[u]=d,d.result};function X5(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 Z5(t,e){let r=1,n=1,o=kA(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=kA(t,r);for(o=PA(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=PA(e+1,n)-1;return i=[...i],i.sort(tM),i}function Q5(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=eM(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+=rM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function FA(t,e,r,n){let o=Z5(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=Q5(String(a),String(c),n),p="";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+$A(s.count),a=c+1;continue}r.isPadded&&(p=nM(c,r,n)),l.string=p+l.pattern+$A(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&&!OA(e,"string",s)&&i.push(r+s),n&&OA(e,"string",s)&&i.push(r+s)}return i}function eM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function tM(t,e){return t>e?1:e>t?-1:0}function OA(t,e,r){return t.some(n=>n[e]===r)}function kA(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function PA(t,e){return t-t%Math.pow(10,e)}function $A(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function rM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function TA(t){return/^-?(0+)\d/.test(t)}function nM(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}}`}}No.cache={};No.clearCache=()=>No.cache={};IA.exports=No});var Ug=x((yJ,qA)=>{"use strict";var oM=require("util"),jA=RA(),BA=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),iM=t=>e=>t===!0?Number(e):String(e),Ng=t=>typeof t=="number"||typeof t=="string"&&t!=="",Bs=t=>Number.isInteger(+t),Lg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},aM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,sM=(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},rf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},uM=(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=>rf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>rf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},NA=(t,e,r,n)=>{if(r)return jA(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},LA=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return jA(t,e,r)},UA=(...t)=>new RangeError("Invalid range arguments: "+oM.inspect(...t)),MA=(t,e,r)=>{if(r.strictRanges===!0)throw UA([t,e]);return[]},cM=(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 UA([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=Lg(s)||Lg(u)||Lg(c),p=l?Math.max(s.length,u.length,c.length):0,d=l===!1&&aM(t,e,n)===!1,h=n.transform||iM(d);if(n.toRegex&&r===1)return NA(rf(t,p),rf(e,p),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):D.push(sM(h(o,C),p,d)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?uM(m,n,p):LA(D,null,{wrap:!1,...n}):D},fM=(t,e,r=1,n={})=>{if(!Bs(t)&&t.length>1||!Bs(e)&&e.length>1)return MA(t,e,n);let o=n.transform||(d=>String.fromCharCode(d)),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 NA(u,c,!1,n);let l=[],p=0;for(;s?i>=a:i<=a;)l.push(o(i,p)),i=s?i-r:i+r,p++;return n.toRegex===!0?LA(l,null,{wrap:!1,options:n}):l},tf=(t,e,r,n={})=>{if(e==null&&Ng(t))return[t];if(!Ng(t)||!Ng(e))return MA(t,e,n);if(typeof r=="function")return tf(t,e,1,{transform:r});if(BA(r))return tf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Bs(r)?Bs(t)&&Bs(e)?lM(t,e,r,o):fM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!BA(r)?cM(r,o):tf(t,e,1,r)};qA.exports=tf});var zA=x((bJ,VA)=>{"use strict";var pM=Ug(),HA=Ql(),dM=(t,e={})=>{let r=(n,o={})=>{let i=HA.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=HA.reduce(n.nodes),p=pM(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};VA.exports=dM});var WA=x((wJ,KA)=>{"use strict";var hM=Ug(),GA=ef(),la=Ql(),Lo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?la.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Lo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Lo(o,i,r):o+i);return la.flatten(n)},mM=(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(Lo(s.pop(),GA(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Lo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let p=la.reduce(o.nodes);if(la.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=hM(...p,e);d.length===0&&(d=GA(o,e)),s.push(Lo(s.pop(),d)),o.nodes=[];return}let u=la.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let p=0;p<o.nodes.length;p++){let d=o.nodes[p];if(d.type==="comma"&&o.type==="brace"){p===1&&c.push(""),c.push("");continue}if(d.type==="close"){s.push(Lo(s.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(Lo(c.pop(),d.value));continue}d.nodes&&n(d,o)}return c};return la.flatten(n(t))};KA.exports=mM});var JA=x((vJ,YA)=>{"use strict";YA.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:`
104
- `,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 t2=x((CJ,e2)=>{"use strict";var gM=ef(),{MAX_LENGTH:XA,CHAR_BACKSLASH:Mg,CHAR_BACKTICK:DM,CHAR_COMMA:yM,CHAR_DOT:bM,CHAR_LEFT_PARENTHESES:wM,CHAR_RIGHT_PARENTHESES:vM,CHAR_LEFT_CURLY_BRACE:CM,CHAR_RIGHT_CURLY_BRACE:EM,CHAR_LEFT_SQUARE_BRACKET:ZA,CHAR_RIGHT_SQUARE_BRACKET:QA,CHAR_DOUBLE_QUOTE:_M,CHAR_SINGLE_QUOTE:xM,CHAR_NO_BREAK_SPACE:SM,CHAR_ZERO_WIDTH_NOBREAK_SPACE:AM}=JA(),FM=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(XA,r.maxLength):XA;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,p=0,d,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],d=h(),!(d===AM||d===SM)){if(d===Mg){m({type:"text",value:(e.keepEscaping?d:"")+h()});continue}if(d===QA){m({type:"text",value:"\\"+d});continue}if(d===ZA){u++;let b;for(;l<c&&(b=h());){if(d+=b,b===ZA){u++;continue}if(b===Mg){d+=h();continue}if(b===QA&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===wM){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:d});continue}if(d===vM){if(a.type!=="paren"){m({type:"text",value:d});continue}a=i.pop(),m({type:"text",value:d}),a=i[i.length-1];continue}if(d===_M||d===xM||d===DM){let b=d,D;for(e.keepQuotes!==!0&&(d="");l<c&&(D=h());){if(D===Mg){d+=D+h();continue}if(D===b){e.keepQuotes===!0&&(d+=D);break}d+=D}m({type:"text",value:d});continue}if(d===CM){p++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:d});continue}if(d===EM){if(a.type!=="brace"){m({type:"text",value:d});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:d}),p--,a=i[i.length-1];continue}if(d===yM&&p>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:gM(a)}]}m({type:"comma",value:d}),a.commas++;continue}if(d===bM&&p>0&&a.commas===0){let b=a.nodes;if(p===0||b.length===0){m({type:"text",value:d});continue}if(s.type==="dot"){if(a.range=[],s.value+=d,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+d,s=D,a.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}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],D=b.nodes.indexOf(a);b.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};e2.exports=FM});var o2=x((EJ,n2)=>{"use strict";var r2=ef(),OM=zA(),kM=WA(),PM=t2(),Wt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Wt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Wt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Wt.parse=(t,e={})=>PM(t,e);Wt.stringify=(t,e={})=>r2(typeof t=="string"?Wt.parse(t,e):t,e);Wt.compile=(t,e={})=>(typeof t=="string"&&(t=Wt.parse(t,e)),OM(t,e));Wt.expand=(t,e={})=>{typeof t=="string"&&(t=Wt.parse(t,e));let r=kM(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Wt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Wt.compile(t,e):Wt.expand(t,e);n2.exports=Wt});var js=x((_J,c2)=>{"use strict";var $M=require("path"),Lr="\\\\/",i2=`[^${Lr}]`,cn="\\.",TM="\\+",IM="\\?",nf="\\/",RM="(?=.)",a2="[^/]",qg=`(?:${nf}|$)`,s2=`(?:^|${nf})`,Hg=`${cn}{1,2}${qg}`,BM=`(?!${cn})`,jM=`(?!${s2}${Hg})`,NM=`(?!${cn}{0,1}${qg})`,LM=`(?!${Hg})`,UM=`[^.${nf}]`,MM=`${a2}*?`,u2={DOT_LITERAL:cn,PLUS_LITERAL:TM,QMARK_LITERAL:IM,SLASH_LITERAL:nf,ONE_CHAR:RM,QMARK:a2,END_ANCHOR:qg,DOTS_SLASH:Hg,NO_DOT:BM,NO_DOTS:jM,NO_DOT_SLASH:NM,NO_DOTS_SLASH:LM,QMARK_NO_DOT:UM,STAR:MM,START_ANCHOR:s2},qM={...u2,SLASH_LITERAL:`[${Lr}]`,QMARK:i2,STAR:`${i2}*?`,DOTS_SLASH:`${cn}{1,2}(?:[${Lr}]|$)`,NO_DOT:`(?!${cn})`,NO_DOTS:`(?!(?:^|[${Lr}])${cn}{1,2}(?:[${Lr}]|$))`,NO_DOT_SLASH:`(?!${cn}{0,1}(?:[${Lr}]|$))`,NO_DOTS_SLASH:`(?!${cn}{1,2}(?:[${Lr}]|$))`,QMARK_NO_DOT:`[^.${Lr}]`,START_ANCHOR:`(?:^|[${Lr}])`,END_ANCHOR:`(?:[${Lr}]|$)`},HM={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"};c2.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:HM,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:$M.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?qM:u2}}});var Ns=x(Mt=>{"use strict";var VM=require("path"),zM=process.platform==="win32",{REGEX_BACKSLASH:GM,REGEX_REMOVE_BACKSLASH:KM,REGEX_SPECIAL_CHARS:WM,REGEX_SPECIAL_CHARS_GLOBAL:YM}=js();Mt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Mt.hasRegexChars=t=>WM.test(t);Mt.isRegexChar=t=>t.length===1&&Mt.hasRegexChars(t);Mt.escapeRegex=t=>t.replace(YM,"\\$1");Mt.toPosixSlashes=t=>t.replace(GM,"/");Mt.removeBackslashes=t=>t.replace(KM,e=>e==="\\"?"":e);Mt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Mt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:zM===!0||VM.sep==="\\";Mt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Mt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Mt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Mt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var D2=x((SJ,g2)=>{"use strict";var l2=Ns(),{CHAR_ASTERISK:Vg,CHAR_AT:JM,CHAR_BACKWARD_SLASH:Ls,CHAR_COMMA:XM,CHAR_DOT:zg,CHAR_EXCLAMATION_MARK:Gg,CHAR_FORWARD_SLASH:m2,CHAR_LEFT_CURLY_BRACE:Kg,CHAR_LEFT_PARENTHESES:Wg,CHAR_LEFT_SQUARE_BRACKET:ZM,CHAR_PLUS:QM,CHAR_QUESTION_MARK:f2,CHAR_RIGHT_CURLY_BRACE:e9,CHAR_RIGHT_PARENTHESES:p2,CHAR_RIGHT_SQUARE_BRACKET:t9}=js(),d2=t=>t===m2||t===Ls,h2=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},r9=(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,p=0,d=!1,h=!1,m=!1,b=!1,D=!1,C=!1,E=!1,g=!1,_=!1,S=!1,P=0,k,B,R={value:"",depth:0,isGlob:!1},N=()=>c>=n,F=()=>u.charCodeAt(c+1),U=()=>(k=B,u.charCodeAt(++c));for(;c<n;){B=U();let w;if(B===Ls){E=R.backslashes=!0,B=U(),B===Kg&&(C=!0);continue}if(C===!0||B===Kg){for(P++;N()!==!0&&(B=U());){if(B===Ls){E=R.backslashes=!0,U();continue}if(B===Kg){P++;continue}if(C!==!0&&B===zg&&(B=U())===zg){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(C!==!0&&B===XM){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===e9&&(P--,P===0)){C=!1,d=R.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===m2){if(i.push(c),a.push(R),R={value:"",depth:0,isGlob:!1},S===!0)continue;if(k===zg&&c===l+1){l+=2;continue}p=c+1;continue}if(r.noext!==!0&&(B===QM||B===JM||B===Vg||B===f2||B===Gg)===!0&&F()===Wg){if(m=R.isGlob=!0,b=R.isExtglob=!0,S=!0,B===Gg&&c===l&&(_=!0),o===!0){for(;N()!==!0&&(B=U());){if(B===Ls){E=R.backslashes=!0,B=U();continue}if(B===p2){m=R.isGlob=!0,S=!0;break}}continue}break}if(B===Vg){if(k===Vg&&(D=R.isGlobstar=!0),m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===f2){if(m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===ZM){for(;N()!==!0&&(w=U());){if(w===Ls){E=R.backslashes=!0,U();continue}if(w===t9){h=R.isBracket=!0,m=R.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===Gg&&c===l){g=R.negated=!0,l++;continue}if(r.noparen!==!0&&B===Wg){if(m=R.isGlob=!0,o===!0){for(;N()!==!0&&(B=U());){if(B===Wg){E=R.backslashes=!0,B=U();continue}if(B===p2){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,Q="",$="";l>0&&(Q=u.slice(0,l),u=u.slice(l),p-=l),M&&m===!0&&p>0?(M=u.slice(0,p),$=u.slice(p)):m===!0?(M="",$=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&d2(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&($&&($=l2.removeBackslashes($)),M&&E===!0&&(M=l2.removeBackslashes(M)));let y={prefix:Q,input:t,start:l,base:M,glob:$,isBrace:d,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(y.maxDepth=0,d2(B)||a.push(R),y.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let A=w?w+1:l,I=i[v],O=t.slice(A,I);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=Q):a[v].value=O,h2(a[v]),y.maxDepth+=a[v].depth),(v!==0||O!=="")&&s.push(O),w=I}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,h2(a[a.length-1]),y.maxDepth+=a[a.length-1].depth)}y.slashes=i,y.parts=s}return y};g2.exports=r9});var w2=x((AJ,b2)=>{"use strict";var of=js(),Yt=Ns(),{MAX_LENGTH:af,POSIX_REGEX_SOURCE:n9,REGEX_NON_SPECIAL_CHARS:o9,REGEX_SPECIAL_CHARS_BACKREF:i9,REPLACEMENTS:y2}=of,a9=(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=>Yt.escapeRegex(o)).join("..")}return r},fa=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Yg=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=y2[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(af,r.maxLength):af,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=Yt.isWindows(e),c=of.globChars(u),l=of.extglobChars(c),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:P}=c,k=G=>`(${s}(?:(?!${P}${G.dot?b:p}).)*?)`,B=r.dot?"":D,R=r.dot?g:_,N=r.bash===!0?k(r):S;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let F={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=Yt.removePrefix(t,F),o=t.length;let U=[],M=[],Q=[],$=i,y,w=()=>F.index===o-1,v=F.peek=(G=1)=>t[F.index+G],A=F.advance=()=>t[++F.index]||"",I=()=>t.slice(F.index+1),O=(G="",Ee=0)=>{F.consumed+=G,F.index+=Ee},q=G=>{F.output+=G.output!=null?G.output:G.value,O(G.value)},T=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)A(),F.start++,G++;return G%2===0?!1:(F.negated=!0,F.start++,!0)},j=G=>{F[G]++,Q.push(G)},ee=G=>{F[G]--,Q.pop()},V=G=>{if($.type==="globstar"){let Ee=F.braces>0&&(G.type==="comma"||G.type==="brace"),H=G.extglob===!0||U.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Ee&&!H&&(F.output=F.output.slice(0,-$.output.length),$.type="star",$.value="*",$.output=N,F.output+=$.output)}if(U.length&&G.type!=="paren"&&(U[U.length-1].inner+=G.value),(G.value||G.output)&&q(G),$&&$.type==="text"&&G.type==="text"){$.value+=G.value,$.output=($.output||"")+G.value;return}G.prev=$,a.push(G),$=G},se=(G,Ee)=>{let H={...l[Ee],conditions:1,inner:""};H.prev=$,H.parens=F.parens,H.output=F.output;let ue=(r.capture?"(":"")+H.open;j("parens"),V({type:G,value:Ee,output:F.output?"":m}),V({type:"paren",extglob:!0,value:A(),output:ue}),U.push(H)},hr=G=>{let Ee=G.close+(r.capture?")":""),H;if(G.type==="negate"){let ue=N;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ue=k(r)),(ue!==N||w()||/^\)+$/.test(I()))&&(Ee=G.close=`)$))${ue}`),G.inner.includes("*")&&(H=I())&&/^\.[^\\/.]+$/.test(H)){let Me=Yg(H,{...e,fastpaths:!1}).output;Ee=G.close=`)${Me})${ue})`}G.prev.type==="bos"&&(F.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:y,output:Ee}),ee("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Ee=t.replace(i9,(H,ue,Me,vt,et,mf)=>vt==="\\"?(G=!0,H):vt==="?"?ue?ue+vt+(et?g.repeat(et.length):""):mf===0?R+(et?g.repeat(et.length):""):g.repeat(Me.length):vt==="."?p.repeat(Me.length):vt==="*"?ue?ue+vt+(et?N:""):N:ue?H:`\\${H}`);return G===!0&&(r.unescape===!0?Ee=Ee.replace(/\\/g,""):Ee=Ee.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),Ee===t&&r.contains===!0?(F.output=t,F):(F.output=Yt.wrapOutput(Ee,F,e),F)}for(;!w();){if(y=A(),y==="\0")continue;if(y==="\\"){let H=v();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){y+="\\",V({type:"text",value:y});continue}let ue=/^\\+/.exec(I()),Me=0;if(ue&&ue[0].length>2&&(Me=ue[0].length,F.index+=Me,Me%2!==0&&(y+="\\")),r.unescape===!0?y=A():y+=A(),F.brackets===0){V({type:"text",value:y});continue}}if(F.brackets>0&&(y!=="]"||$.value==="["||$.value==="[^")){if(r.posix!==!1&&y===":"){let H=$.value.slice(1);if(H.includes("[")&&($.posix=!0,H.includes(":"))){let ue=$.value.lastIndexOf("["),Me=$.value.slice(0,ue),vt=$.value.slice(ue+2),et=n9[vt];if(et){$.value=Me+et,F.backtrack=!0,A(),!i.output&&a.indexOf($)===1&&(i.output=m);continue}}}(y==="["&&v()!==":"||y==="-"&&v()==="]")&&(y=`\\${y}`),y==="]"&&($.value==="["||$.value==="[^")&&(y=`\\${y}`),r.posix===!0&&y==="!"&&$.value==="["&&(y="^"),$.value+=y,q({value:y});continue}if(F.quotes===1&&y!=='"'){y=Yt.escapeRegex(y),$.value+=y,q({value:y});continue}if(y==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:y});continue}if(y==="("){j("parens"),V({type:"paren",value:y});continue}if(y===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(fa("opening","("));let H=U[U.length-1];if(H&&F.parens===H.parens+1){hr(U.pop());continue}V({type:"paren",value:y,output:F.parens?")":"\\)"}),ee("parens");continue}if(y==="["){if(r.nobracket===!0||!I().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(fa("closing","]"));y=`\\${y}`}else j("brackets");V({type:"bracket",value:y});continue}if(y==="]"){if(r.nobracket===!0||$&&$.type==="bracket"&&$.value.length===1){V({type:"text",value:y,output:`\\${y}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(fa("opening","["));V({type:"text",value:y,output:`\\${y}`});continue}ee("brackets");let H=$.value.slice(1);if($.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(y=`/${y}`),$.value+=y,q({value:y}),r.literalBrackets===!1||Yt.hasRegexChars(H))continue;let ue=Yt.escapeRegex($.value);if(F.output=F.output.slice(0,-$.value.length),r.literalBrackets===!0){F.output+=ue,$.value=ue;continue}$.value=`(${s}${ue}|${$.value})`,F.output+=$.value;continue}if(y==="{"&&r.nobrace!==!0){j("braces");let H={type:"brace",value:y,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};M.push(H),V(H);continue}if(y==="}"){let H=M[M.length-1];if(r.nobrace===!0||!H){V({type:"text",value:y,output:y});continue}let ue=")";if(H.dots===!0){let Me=a.slice(),vt=[];for(let et=Me.length-1;et>=0&&(a.pop(),Me[et].type!=="brace");et--)Me[et].type!=="dots"&&vt.unshift(Me[et].value);ue=a9(vt,r),F.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let Me=F.output.slice(0,H.outputIndex),vt=F.tokens.slice(H.tokensIndex);H.value=H.output="\\{",y=ue="\\}",F.output=Me;for(let et of vt)F.output+=et.output||et.value}V({type:"brace",value:y,output:ue}),ee("braces"),M.pop();continue}if(y==="|"){U.length>0&&U[U.length-1].conditions++,V({type:"text",value:y});continue}if(y===","){let H=y,ue=M[M.length-1];ue&&Q[Q.length-1]==="braces"&&(ue.comma=!0,H="|"),V({type:"comma",value:y,output:H});continue}if(y==="/"){if($.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",a.pop(),$=i;continue}V({type:"slash",value:y,output:h});continue}if(y==="."){if(F.braces>0&&$.type==="dot"){$.value==="."&&($.output=p);let H=M[M.length-1];$.type="dots",$.output+=y,$.value+=y,H.dots=!0;continue}if(F.braces+F.parens===0&&$.type!=="bos"&&$.type!=="slash"){V({type:"text",value:y,output:p});continue}V({type:"dot",value:y,output:p});continue}if(y==="?"){if(!($&&$.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",y);continue}if($&&$.type==="paren"){let ue=v(),Me=y;if(ue==="<"&&!Yt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");($.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(I()))&&(Me=`\\${y}`),V({type:"text",value:y,output:Me});continue}if(r.dot!==!0&&($.type==="slash"||$.type==="bos")){V({type:"qmark",value:y,output:_});continue}V({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&&F.index===0){T();continue}}if(y==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",y);continue}if($&&$.value==="("||r.regex===!1){V({type:"plus",value:y,output:d});continue}if($&&($.type==="bracket"||$.type==="paren"||$.type==="brace")||F.parens>0){V({type:"plus",value:y});continue}V({type:"plus",value:d});continue}if(y==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){V({type:"at",extglob:!0,value:y,output:""});continue}V({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);let H=o9.exec(I());H&&(y+=H[0],F.index+=H[0].length),V({type:"text",value:y});continue}if($&&($.type==="globstar"||$.star===!0)){$.type="star",$.star=!0,$.value+=y,$.output=N,F.backtrack=!0,F.globstar=!0,O(y);continue}let G=I();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",y);continue}if($.type==="star"){if(r.noglobstar===!0){O(y);continue}let H=$.prev,ue=H.prev,Me=H.type==="slash"||H.type==="bos",vt=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!Me||G[0]&&G[0]!=="/")){V({type:"star",value:y,output:""});continue}let et=F.braces>0&&(H.type==="comma"||H.type==="brace"),mf=U.length&&(H.type==="pipe"||H.type==="paren");if(!Me&&H.type!=="paren"&&!et&&!mf){V({type:"star",value:y,output:""});continue}for(;G.slice(0,3)==="/**";){let Vs=t[F.index+4];if(Vs&&Vs!=="/")break;G=G.slice(3),O("/**",3)}if(H.type==="bos"&&w()){$.type="globstar",$.value+=y,$.output=k(r),F.output=$.output,F.globstar=!0,O(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!vt&&w()){F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=k(r)+(r.strictSlashes?")":"|$)"),$.value+=y,F.globstar=!0,F.output+=H.output+$.output,O(y);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&G[0]==="/"){let Vs=G[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=`${k(r)}${h}|${h}${Vs})`,$.value+=y,F.output+=H.output+$.output,F.globstar=!0,O(y+A()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&G[0]==="/"){$.type="globstar",$.value+=y,$.output=`(?:^|${h}|${k(r)}${h})`,F.output=$.output,F.globstar=!0,O(y+A()),V({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-$.output.length),$.type="globstar",$.output=k(r),$.value+=y,F.output+=$.output,F.globstar=!0,O(y);continue}let Ee={type:"star",value:y,output:N};if(r.bash===!0){Ee.output=".*?",($.type==="bos"||$.type==="slash")&&(Ee.output=B+Ee.output),V(Ee);continue}if($&&($.type==="bracket"||$.type==="paren")&&r.regex===!0){Ee.output=y,V(Ee);continue}(F.index===F.start||$.type==="slash"||$.type==="dot")&&($.type==="dot"?(F.output+=C,$.output+=C):r.dot===!0?(F.output+=E,$.output+=E):(F.output+=B,$.output+=B),v()!=="*"&&(F.output+=m,$.output+=m)),V(Ee)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(fa("closing","]"));F.output=Yt.escapeLast(F.output,"["),ee("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(fa("closing",")"));F.output=Yt.escapeLast(F.output,"("),ee("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(fa("closing","}"));F.output=Yt.escapeLast(F.output,"{"),ee("braces")}if(r.strictSlashes!==!0&&($.type==="star"||$.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${h}?`}),F.backtrack===!0){F.output="";for(let G of F.tokens)F.output+=G.output!=null?G.output:G.value,G.suffix&&(F.output+=G.suffix)}return F};Yg.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(af,r.maxLength):af,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=y2[t]||t;let i=Yt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:m}=of.globChars(i),b=r.dot?p:l,D=r.dot?d: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}).)*?)`,S=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 R=/^(.*?)\.(\w+)$/.exec(B);if(!R)return;let N=S(R[1]);return N?N+a+R[2]:void 0}}},P=Yt.removePrefix(t,E),k=S(P);return k&&r.strictSlashes!==!0&&(k+=`${s}?`),k};b2.exports=Yg});var C2=x((FJ,v2)=>{"use strict";var s9=require("path"),u9=D2(),Jg=w2(),Xg=Ns(),c9=js(),l9=t=>t&&typeof t=="object"&&!Array.isArray(t),Ze=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ze(d,e,r));return d=>{for(let h of l){let m=h(d);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=Xg.isWindows(e),a=n?Ze.compileRe(t,e):Ze.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=Ze(o.ignore,l,r)}let c=(l,p=!1)=>{let{isMatch:d,match:h,output:m}=Ze.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:d};return typeof o.onResult=="function"&&o.onResult(b),d===!1?(b.isMatch=!1,p?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,p?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),p?b:!0)};return r&&(c.state=s),c};Ze.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?Xg.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=Ze.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};Ze.matchBase=(t,e,r,n=Xg.isWindows(r))=>(e instanceof RegExp?e:Ze.makeRe(e,r)).test(s9.basename(t));Ze.isMatch=(t,e,r)=>Ze(e,r)(t);Ze.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ze.parse(r,e)):Jg(t,{...e,fastpaths:!1});Ze.scan=(t,e)=>u9(t,e);Ze.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=Ze.toRegex(s,e);return n===!0&&(u.state=t),u};Ze.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=Jg.fastpaths(t,e)),o.output||(o=Jg(t,e)),Ze.compileRe(o,e,r,n)};Ze.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/$^/}};Ze.constants=c9;v2.exports=Ze});var _2=x((OJ,E2)=>{"use strict";E2.exports=C2()});var k2=x((kJ,O2)=>{"use strict";var S2=require("util"),A2=o2(),Ur=_2(),Zg=Ns(),x2=t=>t===""||t==="./",F2=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},je=(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 p=Ur(String(e[l]),{...r,onResult:s},!0),d=p.state.negated||p.state.negatedExtglob;d&&a++;for(let h of t){let m=p(h,!0);(d?!m.isMatch:m.isMatch)&&(d?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};je.match=je;je.matcher=(t,e)=>Ur(t,e);je.isMatch=(t,e,r)=>Ur(e,r)(t);je.any=je.isMatch;je.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(je(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};je.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${S2.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>je.contains(t,n,r));if(typeof e=="string"){if(x2(t)||x2(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return je.isMatch(t,e,{...r,contains:!0})};je.matchKeys=(t,e,r)=>{if(!Zg.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=je(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};je.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Ur(String(o),r);if(n.some(a=>i(a)))return!0}return!1};je.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Ur(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};je.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${S2.inspect(t)}"`);return[].concat(e).every(n=>Ur(n,r)(t))};je.capture=(t,e,r)=>{let n=Zg.isWindows(r),i=Ur.makeRe(String(t),{...r,capture:!0}).exec(n?Zg.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};je.makeRe=(...t)=>Ur.makeRe(...t);je.scan=(...t)=>Ur.scan(...t);je.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of A2(String(n),e))r.push(Ur.parse(o,e));return r};je.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!F2(t)?[t]:A2(t,e)};je.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return je.braces(t,{...e,expand:!0})};je.hasBraces=F2;O2.exports=je});var mF=x((FX,ln)=>{var Pe=require("fs"),lf=require("os"),mt=require("path"),Z2=require("crypto"),qr={fs:Pe.constants,os:lf.constants},Q2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",nF=/XXXXXX/,j9=3,oF=(qr.O_CREAT||qr.fs.O_CREAT)|(qr.O_EXCL||qr.fs.O_EXCL)|(qr.O_RDWR||qr.fs.O_RDWR),N9=lf.platform()==="win32",L9=qr.EBADF||qr.os.errno.EBADF,U9=qr.ENOENT||qr.os.errno.ENOENT,iF=448,aF=384,M9="exit",da=[],sF=Pe.rmdirSync.bind(Pe),uF=!1;function q9(t,e){return Pe.rm(t,{recursive:!0},e)}function cF(t){return Pe.rmSync(t,{recursive:!0})}function iD(t,e){let r=ha(t,e),n=r[0],o=r[1];Z9(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=fF(a);Pe.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 aD(t){let e=ha(t),r=e[0],n=Q9(r),o=n.tries;do{let i=fF(n);try{Pe.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function H9(t,e){let r=ha(t,e),n=r[0],o=r[1];iD(n,function(a,s){if(a)return o(a);Pe.open(s,oF,n.mode||aF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return Pe.close(l,function(d){return o(d,s,void 0,nD(s,-1,n,!1))});{let p=n.discardDescriptor||n.detachDescriptor;o(null,s,l,nD(s,p?-1:l,n,!1))}})})}function V9(t){let e=ha(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=aD(r),i=Pe.openSync(o,oF,r.mode||aF);return r.discardDescriptor&&(Pe.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:nD(o,n?-1:i,r,!0)}}function z9(t,e){let r=ha(t,e),n=r[0],o=r[1];iD(n,function(a,s){if(a)return o(a);Pe.mkdir(s,n.mode||iF,function(c){if(c)return o(c);o(null,s,lF(s,n,!1))})})}function G9(t){let e=ha(t),r=e[0],n=aD(r);return Pe.mkdirSync(n,r.mode||iF),{name:n,removeCallback:lF(n,r,!0)}}function K9(t,e){let r=function(n){if(n&&!oD(n))return e(n);e()};0<=t[0]?Pe.close(t[0],function(){Pe.unlink(t[1],r)}):Pe.unlink(t[1],r)}function W9(t){let e=null;try{0<=t[0]&&Pe.closeSync(t[0])}catch(r){if(!e7(r)&&!oD(r))throw r}finally{try{Pe.unlinkSync(t[1])}catch(r){oD(r)||(e=r)}}if(e!==null)throw e}function nD(t,e,r,n){let o=cf(W9,[e,t],n),i=cf(K9,[e,t],n,o);return r.keep||da.unshift(o),n?o:i}function lF(t,e,r){let n=e.unsafeCleanup?q9:Pe.rmdir.bind(Pe),o=e.unsafeCleanup?cF:sF,i=cf(o,t,r),a=cf(n,t,r,i);return e.keep||da.unshift(i),r?i:a}function cf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=da.indexOf(s);return u>=0&&da.splice(u,1),o=!0,r||t===sF||t===cF?t(e):t(e,a||function(){})}}}function Y9(){if(uF)for(;da.length;)try{da[0]()}catch{}}function eF(t){let e=[],r=null;try{r=Z2.randomBytes(t)}catch{r=Z2.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(Q2[r[n]%Q2.length]);return e.join("")}function Jt(t){return typeof t>"u"}function ha(t,e){if(typeof t=="function")return[{},t];if(Jt(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function J9(t,e,r){let n=mt.isAbsolute(t)?t:mt.join(e,t);Pe.stat(n,function(o){o?Pe.realpath(mt.dirname(n),function(i,a){if(i)return r(i);r(null,mt.join(a,mt.basename(n)))}):Pe.realpath(n,r)})}function X9(t,e){let r=mt.isAbsolute(t)?t:mt.join(e,t);try{return Pe.statSync(r),Pe.realpathSync(r)}catch{let o=Pe.realpathSync(mt.dirname(r));return mt.join(o,mt.basename(r))}}function fF(t){let e=t.tmpdir;if(!Jt(t.name))return mt.join(e,t.dir,t.name);if(!Jt(t.template))return mt.join(e,t.dir,t.template).replace(nF,eF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",eF(12),t.postfix?"-"+t.postfix:""].join("");return mt.join(e,t.dir,r)}function pF(t){if(!Jt(t.name)){let e=t.name;if(mt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=mt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!Jt(t.template)&&!t.template.match(nF))throw new Error(`Invalid template, found "${t.template}".`);if(!Jt(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=Jt(t.name)?t.tries||j9:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=Jt(t.prefix)?"":t.prefix,t.postfix=Jt(t.postfix)?"":t.postfix}function tF(t,e,r,n){if(Jt(e))return n(null);J9(e,r,function(o,i){if(o)return n(o);let a=mt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function rF(t,e,r){if(Jt(e))return;let n=X9(e,r),o=mt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function Z9(t,e){r7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{pF(t,n)}catch(o){return e(o)}tF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=Jt(i)?"":i,tF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function Q9(t){let e=t.tmpdir=hF(t);pF(t,e);let r=rF("dir",t.dir,e);return t.dir=Jt(r)?"":r,t.template=rF("template",t.template,e),t}function e7(t){return dF(t,-L9,"EBADF")}function oD(t){return dF(t,-U9,"ENOENT")}function dF(t,e,r){return N9?t.code===r:t.code===r&&t.errno===e}function t7(){uF=!0}function r7(t,e){return Pe.realpath(t&&t.tmpdir||lf.tmpdir(),e)}function hF(t){return Pe.realpathSync(t&&t.tmpdir||lf.tmpdir())}process.addListener(M9,Y9);Object.defineProperty(ln.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return hF()}});ln.exports.dir=z9;ln.exports.dirSync=G9;ln.exports.file=H9;ln.exports.fileSync=V9;ln.exports.tmpName=iD;ln.exports.tmpNameSync=aD;ln.exports.setGracefulCleanup=t7});var df=require("node:process");var kD=le(OD(),1),{program:nt,createCommand:B7,createArgument:j7,createOption:N7,CommanderError:L7,InvalidArgumentError:U7,InvalidOptionArgumentError:M7,Command:q7,Argument:H7,Option:V7,Help:z7}=kD.default;var mr={name:"@capgo/cli",version:"7.29.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:"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"},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 oa=require("node:fs");var gt=le(If(),1),qo=require("node:process"),pn=le(require("node:readline"),1),Lf=le(require("node:readline"),1),MD=require("node:stream"),qD=le(Bf(),1);function QF({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 eO=QF();function HD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(eO,"")}function VD(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],p=e.length(l);if(s>=o-(p==2?1:0))if(s+p<=i)a+=l;else break;s+=p}return a}})(zD);var tO=zD.exports,rO=VD(tO),nO=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},oO=VD(nO);function ya(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=HD(t),t.length===0))return 0;t=t.replace(oO()," ");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(rO.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var jf=10,ID=(t=0)=>e=>`\x1B[${e+t}m`,RD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,BD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Ne={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(Ne.modifier);var iO=Object.keys(Ne.color),aO=Object.keys(Ne.bgColor);[...iO,...aO];function sO(){let t=new Map;for(let[e,r]of Object.entries(Ne)){for(let[n,o]of Object.entries(r))Ne[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ne[n],t.set(o[0],o[1]);Object.defineProperty(Ne,e,{value:r,enumerable:!1})}return Object.defineProperty(Ne,"codes",{value:t,enumerable:!1}),Ne.color.close="\x1B[39m",Ne.bgColor.close="\x1B[49m",Ne.color.ansi=ID(),Ne.color.ansi256=RD(),Ne.color.ansi16m=BD(),Ne.bgColor.ansi=ID(jf),Ne.bgColor.ansi256=RD(jf),Ne.bgColor.ansi16m=BD(jf),Object.defineProperties(Ne,{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=>Ne.rgbToAnsi256(...Ne.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)=>Ne.ansi256ToAnsi(Ne.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Ne.ansi256ToAnsi(Ne.hexToAnsi256(e)),enumerable:!1}}),Ne}var uO=sO(),ru=new Set(["\x1B","\x9B"]),cO=39,Mf="\x07",GD="[",lO="]",KD="m",qf=`${lO}8;;`,jD=t=>`${ru.values().next().value}${GD}${t}${KD}`,ND=t=>`${ru.values().next().value}${qf}${t}${Mf}`,fO=t=>t.split(" ").map(e=>ya(e)),Nf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=ya(HD(t[t.length-1]));for(let[s,u]of n.entries()){let c=ya(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),ru.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(qf)),o){i?u===Mf&&(o=!1,i=!1):u===KD&&(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())},pO=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(ya(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},dO=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=fO(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=ya(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Nf(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){Nf(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){Nf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>pO(c)));let u=[...s.join(`
105
- `)];for(let[c,l]of u.entries()){if(n+=l,ru.has(l)){let{groups:d}=new RegExp(`(?:\\${GD}(?<code>\\d+)m|\\${qf}(?<uri>.*)${Mf})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===cO?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=uO.codes.get(Number(o));u[c+1]===`
106
- `?(i&&(n+=ND("")),o&&p&&(n+=jD(p))):l===`
107
- `&&(o&&p&&(n+=jD(o)),i&&(n+=ND(i)))}return n};function LD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
102
+ `}});function zU(){try{return Wm.default.statSync("/.dockerenv"),!0}catch{return!1}}function KU(){try{return Wm.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Ym(){return Gm===void 0&&(Gm=zU()||KU()),Gm}var Wm,Gm,xx=rt(()=>{Wm=fe(require("node:fs"),1)});function Yi(){return Jm===void 0&&(Jm=GU()||Ym()),Jm}var Ax,Jm,GU,Xm=rt(()=>{Ax=fe(require("node:fs"),1);xx();GU=()=>{try{return Ax.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Zm,Ox,kx,Fx,In,Qm=rt(()=>{Zm=fe(require("node:process"),1),Ox=fe(require("node:os"),1),kx=fe(require("node:fs"),1);Xm();Fx=()=>{if(Zm.default.platform!=="linux")return!1;if(Ox.default.release().toLowerCase().includes("microsoft"))return!Yi();try{return kx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Yi():!1}catch{return!1}},In=Zm.default.env.__IS_WSL_TEST__?Fx:Fx()});var eg,Ss,WU,YU,tg,Px=rt(()=>{eg=fe(require("node:process"),1),Ss=fe(require("node:fs/promises"),1);Qm();Qm();WU=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ss.default.access(r,Ss.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Ss.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}})(),YU=async()=>`${await WU()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,tg=async()=>In?YU():`${eg.default.env.SYSTEMROOT||eg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function Tn(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 $x=rt(()=>{});async function rg(){if(Tx.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await JU("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var Ix,Tx,Rx,JU,Bx=rt(()=>{Ix=require("node:util"),Tx=fe(require("node:process"),1),Rx=require("node:child_process"),JU=(0,Ix.promisify)(Rx.execFile)});async function jx(t,{humanReadableOutput:e=!0,signal:r}={}){if(Lx.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await XU("osascript",["-e",t,n],o);return i.trim()}var Lx,Nx,ng,XU,Ux=rt(()=>{Lx=fe(require("node:process"),1),Nx=require("node:util"),ng=require("node:child_process"),XU=(0,Nx.promisify)(ng.execFile)});async function og(t){return jx(`tell application "Finder" to set app_path to application file id "${t}" as string
103
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var Mx=rt(()=>{Ux()});async function ig(t=ZU){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 Sl(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=QU[n];if(!o)throw new Sl(`Unknown browser ID: ${n}`);return o}var qx,Hx,ZU,QU,Sl,Vx=rt(()=>{qx=require("node:util"),Hx=require("node:child_process"),ZU=(0,qx.promisify)(Hx.execFile),QU={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},Sl=class extends Error{}});async function ag(){if(xl.default.platform==="darwin"){let t=await rg();return{name:await og(t),id:t}}if(xl.default.platform==="linux"){let{stdout:t}=await e5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:t5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(xl.default.platform==="win32")return ig();throw new Error("Only macOS, Linux, and Windows are supported")}var zx,xl,Kx,e5,t5,Gx=rt(()=>{zx=require("node:util"),xl=fe(require("node:process"),1),Kx=require("node:child_process");Bx();Mx();Vx();e5=(0,zx.promisify)(Kx.execFile),t5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var pg={};Vr(pg,{apps:()=>Rn,default:()=>a5,openApp:()=>i5});async function n5(){let t=await tg(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=cg.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await r5(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 Xx(t){if(typeof t=="string"||Array.isArray(t))return t;let{[Yx]:e}=t;if(!e)throw new Error(`${Yx} is not supported`);return e}function Fl({[Ji]:t},{wsl:e}){if(e&&In)return Xx(e);if(!t)throw new Error(`${Ji} is not supported`);return Xx(t)}var ug,cg,lg,Zx,Qx,fg,Al,s5,r5,sg,Wx,Ji,Yx,Jx,xs,o5,i5,Rn,a5,dg=rt(()=>{ug=fe(require("node:process"),1),cg=require("node:buffer"),lg=fe(require("node:path"),1),Zx=require("node:url"),Qx=require("node:util"),fg=fe(require("node:child_process"),1),Al=fe(require("node:fs/promises"),1);Px();$x();Gx();Xm();s5={},r5=(0,Qx.promisify)(fg.default.execFile),sg=lg.default.dirname((0,Zx.fileURLToPath)(s5.url)),Wx=lg.default.join(sg,"xdg-open"),{platform:Ji,arch:Yx}=ug.default;Jx=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(o){r=o}throw r},xs=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return Jx(t.app,s=>xs({...t,app:s}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return Jx(e,s=>xs({...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=In?await n5():await ag();if(c.id in s){let l=s[c.id];return e==="browserPrivate"&&r.push(u[l]),xs({...t,app:{name:Rn[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,o=[],i={};if(Ji==="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(Ji==="win32"||In&&!Yi()&&!e){n=await tg(),o.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),In||(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=cg.Buffer.from(s.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let s=!sg||sg==="/",u=!1;try{await Al.default.access(Wx,Al.constants.X_OK),u=!0}catch{}n=ug.default.versions.electron??(Ji==="android"||s||!u)?"xdg-open":Wx}r.length>0&&o.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}Ji==="darwin"&&r.length>0&&o.push("--args",...r),t.target&&o.push(t.target);let a=fg.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)},o5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return xs({...e,target:t})},i5=(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 xs({...e,app:{name:t,arguments:r}})};Rn={};Tn(Rn,"chrome",()=>Fl({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"]}}));Tn(Rn,"brave",()=>Fl({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"]}}));Tn(Rn,"firefox",()=>Fl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Tn(Rn,"edge",()=>Fl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Tn(Rn,"browser",()=>"browser");Tn(Rn,"browserPrivate",()=>"browserPrivate");a5=o5});var ef=x(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 tf=x((yJ,S1)=>{"use strict";var _1=ef();S1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&_1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&_1.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 A1=x((bJ,x1)=>{"use strict";x1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var B1=x((wJ,R1)=>{"use strict";var F1=A1(),jo=(t,e,r)=>{if(F1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(F1(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 y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let p=T1(t)||T1(e),d={min:t,max:e,a:c,b:l},h=[],m=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;m=O1(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(h=O1(c,l,d,n)),d.negatives=m,d.positives=h,d.result=Q5(m,h,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&h.length+m.length>1&&(d.result=`(?:${d.result})`),jo.cache[u]=d,d.result};function Q5(t,e,r){let n=Ng(t,e,"-",!1,r)||[],o=Ng(e,t,"",!1,r)||[],i=Ng(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function eM(t,e){let r=1,n=1,o=P1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=P1(t,r);for(o=$1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=$1(e+1,n)-1;return i=[...i],i.sort(nM),i}function tM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=rM(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+=oM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function O1(t,e,r,n){let o=eM(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=tM(String(a),String(c),n),p="";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+I1(s.count),a=c+1;continue}r.isPadded&&(p=iM(c,r,n)),l.string=p+l.pattern+I1(l.count),i.push(l),a=c+1,s=l}return i}function Ng(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!k1(e,"string",s)&&i.push(r+s),n&&k1(e,"string",s)&&i.push(r+s)}return i}function rM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function nM(t,e){return t>e?1:e>t?-1:0}function k1(t,e,r){return t.some(n=>n[e]===r)}function P1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function $1(t,e){return t-t%Math.pow(10,e)}function I1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function oM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function T1(t){return/^-?(0+)\d/.test(t)}function iM(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={};R1.exports=jo});var Mg=x((vJ,H1)=>{"use strict";var aM=require("util"),N1=B1(),L1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),sM=t=>e=>t===!0?Number(e):String(e),jg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ls=t=>Number.isInteger(+t),Ug=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},uM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,cM=(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},nf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},lM=(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=>nf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>nf(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 N1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},U1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return N1(t,e,r)},M1=(...t)=>new RangeError("Invalid range arguments: "+aM.inspect(...t)),q1=(t,e,r)=>{if(r.strictRanges===!0)throw M1([t,e]);return[]},fM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},pM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw M1([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=Ug(s)||Ug(u)||Ug(c),p=l?Math.max(s.length,u.length,c.length):0,d=l===!1&&uM(t,e,n)===!1,h=n.transform||sM(d);if(n.toRegex&&r===1)return j1(nf(t,p),nf(e,p),!0,n);let m={negatives:[],positives:[]},y=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?y(o):D.push(cM(h(o,C),p,d)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?lM(m,n,p):U1(D,null,{wrap:!1,...n}):D},dM=(t,e,r=1,n={})=>{if(!Ls(t)&&t.length>1||!Ls(e)&&e.length>1)return q1(t,e,n);let o=n.transform||(d=>String.fromCharCode(d)),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=[],p=0;for(;s?i>=a:i<=a;)l.push(o(i,p)),i=s?i-r:i+r,p++;return n.toRegex===!0?U1(l,null,{wrap:!1,options:n}):l},rf=(t,e,r,n={})=>{if(e==null&&jg(t))return[t];if(!jg(t)||!jg(e))return q1(t,e,n);if(typeof r=="function")return rf(t,e,1,{transform:r});if(L1(r))return rf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Ls(r)?Ls(t)&&Ls(e)?pM(t,e,r,o):dM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!L1(r)?fM(r,o):rf(t,e,1,r)};H1.exports=rf});var K1=x((CJ,z1)=>{"use strict";var hM=Mg(),V1=ef(),mM=(t,e={})=>{let r=(n,o={})=>{let i=V1.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=V1.reduce(n.nodes),p=hM(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};z1.exports=mM});var Y1=x((EJ,W1)=>{"use strict";var gM=Mg(),G1=tf(),fa=ef(),Uo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?fa.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 fa.flatten(n)},DM=(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(),G1(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 p=fa.reduce(o.nodes);if(fa.exceedsLimit(...p,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=gM(...p,e);d.length===0&&(d=G1(o,e)),s.push(Uo(s.pop(),d)),o.nodes=[];return}let u=fa.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let p=0;p<o.nodes.length;p++){let d=o.nodes[p];if(d.type==="comma"&&o.type==="brace"){p===1&&c.push(""),c.push("");continue}if(d.type==="close"){s.push(Uo(s.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(Uo(c.pop(),d.value));continue}d.nodes&&n(d,o)}return c};return fa.flatten(n(t))};W1.exports=DM});var X1=x((_J,J1)=>{"use strict";J1.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:`
104
+ `,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 rF=x((SJ,tF)=>{"use strict";var yM=tf(),{MAX_LENGTH:Z1,CHAR_BACKSLASH:qg,CHAR_BACKTICK:bM,CHAR_COMMA:wM,CHAR_DOT:vM,CHAR_LEFT_PARENTHESES:CM,CHAR_RIGHT_PARENTHESES:EM,CHAR_LEFT_CURLY_BRACE:_M,CHAR_RIGHT_CURLY_BRACE:SM,CHAR_LEFT_SQUARE_BRACKET:Q1,CHAR_RIGHT_SQUARE_BRACKET:eF,CHAR_DOUBLE_QUOTE:xM,CHAR_SINGLE_QUOTE:AM,CHAR_NO_BREAK_SPACE:FM,CHAR_ZERO_WIDTH_NOBREAK_SPACE:OM}=X1(),kM=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(Z1,r.maxLength):Z1;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,p=0,d,h=()=>t[l++],m=y=>{if(y.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&y.type==="text"){s.value+=y.value;return}return a.nodes.push(y),y.parent=a,y.prev=s,s=y,y};for(m({type:"bos"});l<c;)if(a=i[i.length-1],d=h(),!(d===OM||d===FM)){if(d===qg){m({type:"text",value:(e.keepEscaping?d:"")+h()});continue}if(d===eF){m({type:"text",value:"\\"+d});continue}if(d===Q1){u++;let y;for(;l<c&&(y=h());){if(d+=y,y===Q1){u++;continue}if(y===qg){d+=h();continue}if(y===eF&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===CM){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:d});continue}if(d===EM){if(a.type!=="paren"){m({type:"text",value:d});continue}a=i.pop(),m({type:"text",value:d}),a=i[i.length-1];continue}if(d===xM||d===AM||d===bM){let y=d,D;for(e.keepQuotes!==!0&&(d="");l<c&&(D=h());){if(D===qg){d+=D+h();continue}if(D===y){e.keepQuotes===!0&&(d+=D);break}d+=D}m({type:"text",value:d});continue}if(d===_M){p++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:d});continue}if(d===SM){if(a.type!=="brace"){m({type:"text",value:d});continue}let y="close";a=i.pop(),a.close=!0,m({type:y,value:d}),p--,a=i[i.length-1];continue}if(d===wM&&p>0){if(a.ranges>0){a.ranges=0;let y=a.nodes.shift();a.nodes=[y,{type:"text",value:yM(a)}]}m({type:"comma",value:d}),a.commas++;continue}if(d===vM&&p>0&&a.commas===0){let y=a.nodes;if(p===0||y.length===0){m({type:"text",value:d});continue}if(s.type==="dot"){if(a.range=[],s.value+=d,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"){y.pop();let D=y[y.length-1];D.value+=s.value+d,s=D,a.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}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 y=i[i.length-1],D=y.nodes.indexOf(a);y.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};tF.exports=kM});var iF=x((xJ,oF)=>{"use strict";var nF=tf(),PM=K1(),$M=Y1(),IM=rF(),Yt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Yt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Yt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Yt.parse=(t,e={})=>IM(t,e);Yt.stringify=(t,e={})=>nF(typeof t=="string"?Yt.parse(t,e):t,e);Yt.compile=(t,e={})=>(typeof t=="string"&&(t=Yt.parse(t,e)),PM(t,e));Yt.expand=(t,e={})=>{typeof t=="string"&&(t=Yt.parse(t,e));let r=$M(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Yt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Yt.compile(t,e):Yt.expand(t,e);oF.exports=Yt});var Ns=x((AJ,lF)=>{"use strict";var TM=require("path"),Ur="\\\\/",aF=`[^${Ur}]`,ln="\\.",RM="\\+",BM="\\?",of="\\/",LM="(?=.)",sF="[^/]",Hg=`(?:${of}|$)`,uF=`(?:^|${of})`,Vg=`${ln}{1,2}${Hg}`,NM=`(?!${ln})`,jM=`(?!${uF}${Vg})`,UM=`(?!${ln}{0,1}${Hg})`,MM=`(?!${Vg})`,qM=`[^.${of}]`,HM=`${sF}*?`,cF={DOT_LITERAL:ln,PLUS_LITERAL:RM,QMARK_LITERAL:BM,SLASH_LITERAL:of,ONE_CHAR:LM,QMARK:sF,END_ANCHOR:Hg,DOTS_SLASH:Vg,NO_DOT:NM,NO_DOTS:jM,NO_DOT_SLASH:UM,NO_DOTS_SLASH:MM,QMARK_NO_DOT:qM,STAR:HM,START_ANCHOR:uF},VM={...cF,SLASH_LITERAL:`[${Ur}]`,QMARK:aF,STAR:`${aF}*?`,DOTS_SLASH:`${ln}{1,2}(?:[${Ur}]|$)`,NO_DOT:`(?!${ln})`,NO_DOTS:`(?!(?:^|[${Ur}])${ln}{1,2}(?:[${Ur}]|$))`,NO_DOT_SLASH:`(?!${ln}{0,1}(?:[${Ur}]|$))`,NO_DOTS_SLASH:`(?!${ln}{1,2}(?:[${Ur}]|$))`,QMARK_NO_DOT:`[^.${Ur}]`,START_ANCHOR:`(?:^|[${Ur}])`,END_ANCHOR:`(?:[${Ur}]|$)`},zM={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"};lF.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:zM,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:TM.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?VM:cF}}});var js=x(qt=>{"use strict";var KM=require("path"),GM=process.platform==="win32",{REGEX_BACKSLASH:WM,REGEX_REMOVE_BACKSLASH:YM,REGEX_SPECIAL_CHARS:JM,REGEX_SPECIAL_CHARS_GLOBAL:XM}=Ns();qt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);qt.hasRegexChars=t=>JM.test(t);qt.isRegexChar=t=>t.length===1&&qt.hasRegexChars(t);qt.escapeRegex=t=>t.replace(XM,"\\$1");qt.toPosixSlashes=t=>t.replace(WM,"/");qt.removeBackslashes=t=>t.replace(YM,e=>e==="\\"?"":e);qt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};qt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:GM===!0||KM.sep==="\\";qt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?qt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};qt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};qt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var yF=x((OJ,DF)=>{"use strict";var fF=js(),{CHAR_ASTERISK:zg,CHAR_AT:ZM,CHAR_BACKWARD_SLASH:Us,CHAR_COMMA:QM,CHAR_DOT:Kg,CHAR_EXCLAMATION_MARK:Gg,CHAR_FORWARD_SLASH:gF,CHAR_LEFT_CURLY_BRACE:Wg,CHAR_LEFT_PARENTHESES:Yg,CHAR_LEFT_SQUARE_BRACKET:e9,CHAR_PLUS:t9,CHAR_QUESTION_MARK:pF,CHAR_RIGHT_CURLY_BRACE:r9,CHAR_RIGHT_PARENTHESES:dF,CHAR_RIGHT_SQUARE_BRACKET:n9}=Ns(),hF=t=>t===gF||t===Us,mF=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},o9=(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,p=0,d=!1,h=!1,m=!1,y=!1,D=!1,C=!1,E=!1,g=!1,_=!1,S=!1,P=0,k,B,R={value:"",depth:0,isGlob:!1},N=()=>c>=n,F=()=>u.charCodeAt(c+1),U=()=>(k=B,u.charCodeAt(++c));for(;c<n;){B=U();let w;if(B===Us){E=R.backslashes=!0,B=U(),B===Wg&&(C=!0);continue}if(C===!0||B===Wg){for(P++;N()!==!0&&(B=U());){if(B===Us){E=R.backslashes=!0,U();continue}if(B===Wg){P++;continue}if(C!==!0&&B===Kg&&(B=U())===Kg){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(C!==!0&&B===QM){if(d=R.isBrace=!0,m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===r9&&(P--,P===0)){C=!1,d=R.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===gF){if(i.push(c),a.push(R),R={value:"",depth:0,isGlob:!1},S===!0)continue;if(k===Kg&&c===l+1){l+=2;continue}p=c+1;continue}if(r.noext!==!0&&(B===t9||B===ZM||B===zg||B===pF||B===Gg)===!0&&F()===Yg){if(m=R.isGlob=!0,y=R.isExtglob=!0,S=!0,B===Gg&&c===l&&(_=!0),o===!0){for(;N()!==!0&&(B=U());){if(B===Us){E=R.backslashes=!0,B=U();continue}if(B===dF){m=R.isGlob=!0,S=!0;break}}continue}break}if(B===zg){if(k===zg&&(D=R.isGlobstar=!0),m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===pF){if(m=R.isGlob=!0,S=!0,o===!0)continue;break}if(B===e9){for(;N()!==!0&&(w=U());){if(w===Us){E=R.backslashes=!0,U();continue}if(w===n9){h=R.isBracket=!0,m=R.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===Gg&&c===l){g=R.negated=!0,l++;continue}if(r.noparen!==!0&&B===Yg){if(m=R.isGlob=!0,o===!0){for(;N()!==!0&&(B=U());){if(B===Yg){E=R.backslashes=!0,B=U();continue}if(B===dF){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let M=u,Q="",$="";l>0&&(Q=u.slice(0,l),u=u.slice(l),p-=l),M&&m===!0&&p>0?(M=u.slice(0,p),$=u.slice(p)):m===!0?(M="",$=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&hF(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&($&&($=fF.removeBackslashes($)),M&&E===!0&&(M=fF.removeBackslashes(M)));let b={prefix:Q,input:t,start:l,base:M,glob:$,isBrace:d,isBracket:h,isGlob:m,isExtglob:y,isGlobstar:D,negated:g,negatedExtglob:_};if(r.tokens===!0&&(b.maxDepth=0,hF(B)||a.push(R),b.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let A=w?w+1:l,T=i[v],O=t.slice(A,T);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=Q):a[v].value=O,mF(a[v]),b.maxDepth+=a[v].depth),(v!==0||O!=="")&&s.push(O),w=T}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,mF(a[a.length-1]),b.maxDepth+=a[a.length-1].depth)}b.slashes=i,b.parts=s}return b};DF.exports=o9});var vF=x((kJ,wF)=>{"use strict";var af=Ns(),Jt=js(),{MAX_LENGTH:sf,POSIX_REGEX_SOURCE:i9,REGEX_NON_SPECIAL_CHARS:a9,REGEX_SPECIAL_CHARS_BACKREF:s9,REPLACEMENTS:bF}=af,u9=(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=>Jt.escapeRegex(o)).join("..")}return r},pa=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Jg=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=bF[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(sf,r.maxLength):sf,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=Jt.isWindows(e),c=af.globChars(u),l=af.extglobChars(c),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:D,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:P}=c,k=K=>`(${s}(?:(?!${P}${K.dot?y:p}).)*?)`,B=r.dot?"":D,R=r.dot?g:_,N=r.bash===!0?k(r):S;r.capture&&(N=`(${N})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let F={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=Jt.removePrefix(t,F),o=t.length;let U=[],M=[],Q=[],$=i,b,w=()=>F.index===o-1,v=F.peek=(K=1)=>t[F.index+K],A=F.advance=()=>t[++F.index]||"",T=()=>t.slice(F.index+1),O=(K="",_e=0)=>{F.consumed+=K,F.index+=_e},q=K=>{F.output+=K.output!=null?K.output:K.value,O(K.value)},I=()=>{let K=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)A(),F.start++,K++;return K%2===0?!1:(F.negated=!0,F.start++,!0)},L=K=>{F[K]++,Q.push(K)},te=K=>{F[K]--,Q.pop()},V=K=>{if($.type==="globstar"){let _e=F.braces>0&&(K.type==="comma"||K.type==="brace"),H=K.extglob===!0||U.length&&(K.type==="pipe"||K.type==="paren");K.type!=="slash"&&K.type!=="paren"&&!_e&&!H&&(F.output=F.output.slice(0,-$.output.length),$.type="star",$.value="*",$.output=N,F.output+=$.output)}if(U.length&&K.type!=="paren"&&(U[U.length-1].inner+=K.value),(K.value||K.output)&&q(K),$&&$.type==="text"&&K.type==="text"){$.value+=K.value,$.output=($.output||"")+K.value;return}K.prev=$,a.push(K),$=K},se=(K,_e)=>{let H={...l[_e],conditions:1,inner:""};H.prev=$,H.parens=F.parens,H.output=F.output;let ue=(r.capture?"(":"")+H.open;L("parens"),V({type:K,value:_e,output:F.output?"":m}),V({type:"paren",extglob:!0,value:A(),output:ue}),U.push(H)},mr=K=>{let _e=K.close+(r.capture?")":""),H;if(K.type==="negate"){let ue=N;if(K.inner&&K.inner.length>1&&K.inner.includes("/")&&(ue=k(r)),(ue!==N||w()||/^\)+$/.test(T()))&&(_e=K.close=`)$))${ue}`),K.inner.includes("*")&&(H=T())&&/^\.[^\\/.]+$/.test(H)){let qe=Jg(H,{...e,fastpaths:!1}).output;_e=K.close=`)${qe})${ue})`}K.prev.type==="bos"&&(F.negatedExtglob=!0)}V({type:"paren",extglob:!0,value:b,output:_e}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let K=!1,_e=t.replace(s9,(H,ue,qe,Ct,tt,gf)=>Ct==="\\"?(K=!0,H):Ct==="?"?ue?ue+Ct+(tt?g.repeat(tt.length):""):gf===0?R+(tt?g.repeat(tt.length):""):g.repeat(qe.length):Ct==="."?p.repeat(qe.length):Ct==="*"?ue?ue+Ct+(tt?N:""):N:ue?H:`\\${H}`);return K===!0&&(r.unescape===!0?_e=_e.replace(/\\/g,""):_e=_e.replace(/\\+/g,H=>H.length%2===0?"\\\\":H?"\\":"")),_e===t&&r.contains===!0?(F.output=t,F):(F.output=Jt.wrapOutput(_e,F,e),F)}for(;!w();){if(b=A(),b==="\0")continue;if(b==="\\"){let H=v();if(H==="/"&&r.bash!==!0||H==="."||H===";")continue;if(!H){b+="\\",V({type:"text",value:b});continue}let ue=/^\\+/.exec(T()),qe=0;if(ue&&ue[0].length>2&&(qe=ue[0].length,F.index+=qe,qe%2!==0&&(b+="\\")),r.unescape===!0?b=A():b+=A(),F.brackets===0){V({type:"text",value:b});continue}}if(F.brackets>0&&(b!=="]"||$.value==="["||$.value==="[^")){if(r.posix!==!1&&b===":"){let H=$.value.slice(1);if(H.includes("[")&&($.posix=!0,H.includes(":"))){let ue=$.value.lastIndexOf("["),qe=$.value.slice(0,ue),Ct=$.value.slice(ue+2),tt=i9[Ct];if(tt){$.value=qe+tt,F.backtrack=!0,A(),!i.output&&a.indexOf($)===1&&(i.output=m);continue}}}(b==="["&&v()!==":"||b==="-"&&v()==="]")&&(b=`\\${b}`),b==="]"&&($.value==="["||$.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&$.value==="["&&(b="^"),$.value+=b,q({value:b});continue}if(F.quotes===1&&b!=='"'){b=Jt.escapeRegex(b),$.value+=b,q({value:b});continue}if(b==='"'){F.quotes=F.quotes===1?0:1,r.keepQuotes===!0&&V({type:"text",value:b});continue}if(b==="("){L("parens"),V({type:"paren",value:b});continue}if(b===")"){if(F.parens===0&&r.strictBrackets===!0)throw new SyntaxError(pa("opening","("));let H=U[U.length-1];if(H&&F.parens===H.parens+1){mr(U.pop());continue}V({type:"paren",value:b,output:F.parens?")":"\\)"}),te("parens");continue}if(b==="["){if(r.nobracket===!0||!T().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(pa("closing","]"));b=`\\${b}`}else L("brackets");V({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||$&&$.type==="bracket"&&$.value.length===1){V({type:"text",value:b,output:`\\${b}`});continue}if(F.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(pa("opening","["));V({type:"text",value:b,output:`\\${b}`});continue}te("brackets");let H=$.value.slice(1);if($.posix!==!0&&H[0]==="^"&&!H.includes("/")&&(b=`/${b}`),$.value+=b,q({value:b}),r.literalBrackets===!1||Jt.hasRegexChars(H))continue;let ue=Jt.escapeRegex($.value);if(F.output=F.output.slice(0,-$.value.length),r.literalBrackets===!0){F.output+=ue,$.value=ue;continue}$.value=`(${s}${ue}|${$.value})`,F.output+=$.value;continue}if(b==="{"&&r.nobrace!==!0){L("braces");let H={type:"brace",value:b,output:"(",outputIndex:F.output.length,tokensIndex:F.tokens.length};M.push(H),V(H);continue}if(b==="}"){let H=M[M.length-1];if(r.nobrace===!0||!H){V({type:"text",value:b,output:b});continue}let ue=")";if(H.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=u9(Ct,r),F.backtrack=!0}if(H.comma!==!0&&H.dots!==!0){let qe=F.output.slice(0,H.outputIndex),Ct=F.tokens.slice(H.tokensIndex);H.value=H.output="\\{",b=ue="\\}",F.output=qe;for(let tt of Ct)F.output+=tt.output||tt.value}V({type:"brace",value:b,output:ue}),te("braces"),M.pop();continue}if(b==="|"){U.length>0&&U[U.length-1].conditions++,V({type:"text",value:b});continue}if(b===","){let H=b,ue=M[M.length-1];ue&&Q[Q.length-1]==="braces"&&(ue.comma=!0,H="|"),V({type:"comma",value:b,output:H});continue}if(b==="/"){if($.type==="dot"&&F.index===F.start+1){F.start=F.index+1,F.consumed="",F.output="",a.pop(),$=i;continue}V({type:"slash",value:b,output:h});continue}if(b==="."){if(F.braces>0&&$.type==="dot"){$.value==="."&&($.output=p);let H=M[M.length-1];$.type="dots",$.output+=b,$.value+=b,H.dots=!0;continue}if(F.braces+F.parens===0&&$.type!=="bos"&&$.type!=="slash"){V({type:"text",value:b,output:p});continue}V({type:"dot",value:b,output:p});continue}if(b==="?"){if(!($&&$.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",b);continue}if($&&$.type==="paren"){let ue=v(),qe=b;if(ue==="<"&&!Jt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");($.value==="("&&!/[!=<:]/.test(ue)||ue==="<"&&!/<([!=]|\w+>)/.test(T()))&&(qe=`\\${b}`),V({type:"text",value:b,output:qe});continue}if(r.dot!==!0&&($.type==="slash"||$.type==="bos")){V({type:"qmark",value:b,output:_});continue}V({type:"qmark",value:b,output:g});continue}if(b==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",b);continue}if(r.nonegate!==!0&&F.index===0){I();continue}}if(b==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",b);continue}if($&&$.value==="("||r.regex===!1){V({type:"plus",value:b,output:d});continue}if($&&($.type==="bracket"||$.type==="paren"||$.type==="brace")||F.parens>0){V({type:"plus",value:b});continue}V({type:"plus",value:d});continue}if(b==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){V({type:"at",extglob:!0,value:b,output:""});continue}V({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let H=a9.exec(T());H&&(b+=H[0],F.index+=H[0].length),V({type:"text",value:b});continue}if($&&($.type==="globstar"||$.star===!0)){$.type="star",$.star=!0,$.value+=b,$.output=N,F.backtrack=!0,F.globstar=!0,O(b);continue}let K=T();if(r.noextglob!==!0&&/^\([^?]/.test(K)){se("star",b);continue}if($.type==="star"){if(r.noglobstar===!0){O(b);continue}let H=$.prev,ue=H.prev,qe=H.type==="slash"||H.type==="bos",Ct=ue&&(ue.type==="star"||ue.type==="globstar");if(r.bash===!0&&(!qe||K[0]&&K[0]!=="/")){V({type:"star",value:b,output:""});continue}let tt=F.braces>0&&(H.type==="comma"||H.type==="brace"),gf=U.length&&(H.type==="pipe"||H.type==="paren");if(!qe&&H.type!=="paren"&&!tt&&!gf){V({type:"star",value:b,output:""});continue}for(;K.slice(0,3)==="/**";){let zs=t[F.index+4];if(zs&&zs!=="/")break;K=K.slice(3),O("/**",3)}if(H.type==="bos"&&w()){$.type="globstar",$.value+=b,$.output=k(r),F.output=$.output,F.globstar=!0,O(b);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&!Ct&&w()){F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=k(r)+(r.strictSlashes?")":"|$)"),$.value+=b,F.globstar=!0,F.output+=H.output+$.output,O(b);continue}if(H.type==="slash"&&H.prev.type!=="bos"&&K[0]==="/"){let zs=K[1]!==void 0?"|$":"";F.output=F.output.slice(0,-(H.output+$.output).length),H.output=`(?:${H.output}`,$.type="globstar",$.output=`${k(r)}${h}|${h}${zs})`,$.value+=b,F.output+=H.output+$.output,F.globstar=!0,O(b+A()),V({type:"slash",value:"/",output:""});continue}if(H.type==="bos"&&K[0]==="/"){$.type="globstar",$.value+=b,$.output=`(?:^|${h}|${k(r)}${h})`,F.output=$.output,F.globstar=!0,O(b+A()),V({type:"slash",value:"/",output:""});continue}F.output=F.output.slice(0,-$.output.length),$.type="globstar",$.output=k(r),$.value+=b,F.output+=$.output,F.globstar=!0,O(b);continue}let _e={type:"star",value:b,output:N};if(r.bash===!0){_e.output=".*?",($.type==="bos"||$.type==="slash")&&(_e.output=B+_e.output),V(_e);continue}if($&&($.type==="bracket"||$.type==="paren")&&r.regex===!0){_e.output=b,V(_e);continue}(F.index===F.start||$.type==="slash"||$.type==="dot")&&($.type==="dot"?(F.output+=C,$.output+=C):r.dot===!0?(F.output+=E,$.output+=E):(F.output+=B,$.output+=B),v()!=="*"&&(F.output+=m,$.output+=m)),V(_e)}for(;F.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing","]"));F.output=Jt.escapeLast(F.output,"["),te("brackets")}for(;F.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing",")"));F.output=Jt.escapeLast(F.output,"("),te("parens")}for(;F.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(pa("closing","}"));F.output=Jt.escapeLast(F.output,"{"),te("braces")}if(r.strictSlashes!==!0&&($.type==="star"||$.type==="bracket")&&V({type:"maybe_slash",value:"",output:`${h}?`}),F.backtrack===!0){F.output="";for(let K of F.tokens)F.output+=K.output!=null?K.output:K.value,K.suffix&&(F.output+=K.suffix)}return F};Jg.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(sf,r.maxLength):sf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=bF[t]||t;let i=Jt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:h,START_ANCHOR:m}=af.globChars(i),y=r.dot?p:l,D=r.dot?d: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}).)*?)`,S=B=>{switch(B){case"*":return`${y}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${y}${g}${a}${u}${g}`;case"*/*":return`${y}${g}${s}${u}${D}${g}`;case"**":return y+_(r);case"**/*":return`(?:${y}${_(r)}${s})?${D}${u}${g}`;case"**/*.*":return`(?:${y}${_(r)}${s})?${D}${g}${a}${u}${g}`;case"**/.*":return`(?:${y}${_(r)}${s})?${a}${u}${g}`;default:{let R=/^(.*?)\.(\w+)$/.exec(B);if(!R)return;let N=S(R[1]);return N?N+a+R[2]:void 0}}},P=Jt.removePrefix(t,E),k=S(P);return k&&r.strictSlashes!==!0&&(k+=`${s}?`),k};wF.exports=Jg});var EF=x((PJ,CF)=>{"use strict";var c9=require("path"),l9=yF(),Xg=vF(),Zg=js(),f9=Ns(),p9=t=>t&&typeof t=="object"&&!Array.isArray(t),Qe=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Qe(d,e,r));return d=>{for(let h of l){let m=h(d);if(m)return m}return!1}}let n=p9(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=Zg.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,p=!1)=>{let{isMatch:d,match:h,output:m}=Qe.test(l,a,e,{glob:t,posix:i}),y={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:d};return typeof o.onResult=="function"&&o.onResult(y),d===!1?(y.isMatch=!1,p?y:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(y),y.isMatch=!1,p?y:!1):(typeof o.onMatch=="function"&&o.onMatch(y),p?y:!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?Zg.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=Zg.isWindows(r))=>(e instanceof RegExp?e:Qe.makeRe(e,r)).test(c9.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)):Xg(t,{...e,fastpaths:!1});Qe.scan=(t,e)=>l9(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=Xg.fastpaths(t,e)),o.output||(o=Xg(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=f9;CF.exports=Qe});var SF=x(($J,_F)=>{"use strict";_F.exports=EF()});var PF=x((IJ,kF)=>{"use strict";var AF=require("util"),FF=iF(),Mr=SF(),Qg=js(),xF=t=>t===""||t==="./",OF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Ne=(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 p=Mr(String(e[l]),{...r,onResult:s},!0),d=p.state.negated||p.state.negatedExtglob;d&&a++;for(let h of t){let m=p(h,!0);(d?!m.isMatch:m.isMatch)&&(d?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};Ne.match=Ne;Ne.matcher=(t,e)=>Mr(t,e);Ne.isMatch=(t,e,r)=>Mr(e,r)(t);Ne.any=Ne.isMatch;Ne.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(Ne(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Ne.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${AF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Ne.contains(t,n,r));if(typeof e=="string"){if(xF(t)||xF(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Ne.isMatch(t,e,{...r,contains:!0})};Ne.matchKeys=(t,e,r)=>{if(!Qg.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Ne(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Ne.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Mr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Ne.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Mr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Ne.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${AF.inspect(t)}"`);return[].concat(e).every(n=>Mr(n,r)(t))};Ne.capture=(t,e,r)=>{let n=Qg.isWindows(r),i=Mr.makeRe(String(t),{...r,capture:!0}).exec(n?Qg.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Ne.makeRe=(...t)=>Mr.makeRe(...t);Ne.scan=(...t)=>Mr.scan(...t);Ne.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of FF(String(n),e))r.push(Mr.parse(o,e));return r};Ne.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!OF(t)?[t]:FF(t,e)};Ne.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Ne.braces(t,{...e,expand:!0})};Ne.hasBraces=OF;kF.exports=Ne});var g2=x((PX,fn)=>{var $e=require("fs"),ff=require("os"),gt=require("path"),QF=require("crypto"),Hr={fs:$e.constants,os:ff.constants},e2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",o2=/XXXXXX/,j9=3,i2=(Hr.O_CREAT||Hr.fs.O_CREAT)|(Hr.O_EXCL||Hr.fs.O_EXCL)|(Hr.O_RDWR||Hr.fs.O_RDWR),U9=ff.platform()==="win32",M9=Hr.EBADF||Hr.os.errno.EBADF,q9=Hr.ENOENT||Hr.os.errno.ENOENT,a2=448,s2=384,H9="exit",ha=[],u2=$e.rmdirSync.bind($e),c2=!1;function V9(t,e){return $e.rm(t,{recursive:!0},e)}function l2(t){return $e.rmSync(t,{recursive:!0})}function aD(t,e){let r=ma(t,e),n=r[0],o=r[1];e7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=p2(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 sD(t){let e=ma(t),r=e[0],n=t7(r),o=n.tries;do{let i=p2(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 z9(t,e){let r=ma(t,e),n=r[0],o=r[1];aD(n,function(a,s){if(a)return o(a);$e.open(s,i2,n.mode||s2,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(d){return o(d,s,void 0,oD(s,-1,n,!1))});{let p=n.discardDescriptor||n.detachDescriptor;o(null,s,l,oD(s,p?-1:l,n,!1))}})})}function K9(t){let e=ma(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=sD(r),i=$e.openSync(o,i2,r.mode||s2);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:oD(o,n?-1:i,r,!0)}}function G9(t,e){let r=ma(t,e),n=r[0],o=r[1];aD(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||a2,function(c){if(c)return o(c);o(null,s,f2(s,n,!1))})})}function W9(t){let e=ma(t),r=e[0],n=sD(r);return $e.mkdirSync(n,r.mode||a2),{name:n,removeCallback:f2(n,r,!0)}}function Y9(t,e){let r=function(n){if(n&&!iD(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function J9(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!r7(r)&&!iD(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){iD(r)||(e=r)}}if(e!==null)throw e}function oD(t,e,r,n){let o=lf(J9,[e,t],n),i=lf(Y9,[e,t],n,o);return r.keep||ha.unshift(o),n?o:i}function f2(t,e,r){let n=e.unsafeCleanup?V9:$e.rmdir.bind($e),o=e.unsafeCleanup?l2:u2,i=lf(o,t,r),a=lf(n,t,r,i);return e.keep||ha.unshift(i),r?i:a}function lf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ha.indexOf(s);return u>=0&&ha.splice(u,1),o=!0,r||t===u2||t===l2?t(e):t(e,a||function(){})}}}function X9(){if(c2)for(;ha.length;)try{ha[0]()}catch{}}function t2(t){let e=[],r=null;try{r=QF.randomBytes(t)}catch{r=QF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(e2[r[n]%e2.length]);return e.join("")}function Xt(t){return typeof t>"u"}function ma(t,e){if(typeof t=="function")return[{},t];if(Xt(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function Z9(t,e,r){let n=gt.isAbsolute(t)?t:gt.join(e,t);$e.stat(n,function(o){o?$e.realpath(gt.dirname(n),function(i,a){if(i)return r(i);r(null,gt.join(a,gt.basename(n)))}):$e.realpath(n,r)})}function Q9(t,e){let r=gt.isAbsolute(t)?t:gt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(gt.dirname(r));return gt.join(o,gt.basename(r))}}function p2(t){let e=t.tmpdir;if(!Xt(t.name))return gt.join(e,t.dir,t.name);if(!Xt(t.template))return gt.join(e,t.dir,t.template).replace(o2,t2(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",t2(12),t.postfix?"-"+t.postfix:""].join("");return gt.join(e,t.dir,r)}function d2(t){if(!Xt(t.name)){let e=t.name;if(gt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=gt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!Xt(t.template)&&!t.template.match(o2))throw new Error(`Invalid template, found "${t.template}".`);if(!Xt(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=Xt(t.name)?t.tries||j9:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=Xt(t.prefix)?"":t.prefix,t.postfix=Xt(t.postfix)?"":t.postfix}function r2(t,e,r,n){if(Xt(e))return n(null);Z9(e,r,function(o,i){if(o)return n(o);let a=gt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function n2(t,e,r){if(Xt(e))return;let n=Q9(e,r),o=gt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function e7(t,e){o7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{d2(t,n)}catch(o){return e(o)}r2("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=Xt(i)?"":i,r2("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function t7(t){let e=t.tmpdir=m2(t);d2(t,e);let r=n2("dir",t.dir,e);return t.dir=Xt(r)?"":r,t.template=n2("template",t.template,e),t}function r7(t){return h2(t,-M9,"EBADF")}function iD(t){return h2(t,-q9,"ENOENT")}function h2(t,e,r){return U9?t.code===r:t.code===r&&t.errno===e}function n7(){c2=!0}function o7(t,e){return $e.realpath(t&&t.tmpdir||ff.tmpdir(),e)}function m2(t){return $e.realpathSync(t&&t.tmpdir||ff.tmpdir())}process.addListener(H9,X9);Object.defineProperty(fn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return m2()}});fn.exports.dir=G9;fn.exports.dirSync=W9;fn.exports.file=z9;fn.exports.fileSync=K9;fn.exports.tmpName=aD;fn.exports.tmpNameSync=sD;fn.exports.setGracefulCleanup=n7});var hf=require("node:process");var PD=fe(kD(),1),{program:ot,createCommand:N7,createArgument:j7,createOption:U7,CommanderError:M7,InvalidArgumentError:q7,InvalidOptionArgumentError:H7,Command:V7,Argument:z7,Option:K7,Help:G7}=PD.default;var gr={name:"@capgo/cli",version:"7.30.0",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 ia=require("node:fs");var Dt=fe(Rf(),1),Ho=require("node:process"),dn=fe(require("node:readline"),1),Uf=fe(require("node:readline"),1),qD=require("node:stream"),HD=fe(Lf(),1);function eO({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 tO=eO();function VD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(tO,"")}function zD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var KD={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],p=e.length(l);if(s>=o-(p==2?1:0))if(s+p<=i)a+=l;else break;s+=p}return a}})(KD);var rO=KD.exports,nO=zD(rO),oO=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},iO=zD(oO);function ba(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=VD(t),t.length===0))return 0;t=t.replace(iO()," ");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(nO.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Nf=10,RD=(t=0)=>e=>`\x1B[${e+t}m`,BD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,LD=(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 aO=Object.keys(je.color),sO=Object.keys(je.bgColor);[...aO,...sO];function uO(){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=RD(),je.color.ansi256=BD(),je.color.ansi16m=LD(),je.bgColor.ansi=RD(Nf),je.bgColor.ansi256=BD(Nf),je.bgColor.ansi16m=LD(Nf),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 cO=uO(),nu=new Set(["\x1B","\x9B"]),lO=39,qf="\x07",GD="[",fO="]",WD="m",Hf=`${fO}8;;`,ND=t=>`${nu.values().next().value}${GD}${t}${WD}`,jD=t=>`${nu.values().next().value}${Hf}${t}${qf}`,pO=t=>t.split(" ").map(e=>ba(e)),jf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=ba(VD(t[t.length-1]));for(let[s,u]of n.entries()){let c=ba(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),nu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Hf)),o){i?u===qf&&(o=!1,i=!1):u===WD&&(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())},dO=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(ba(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},hO=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=pO(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let p=ba(s[s.length-1]);if(c!==0&&(p>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),p=0),(p>0||r.trim===!1)&&(s[s.length-1]+=" ",p++)),r.hard&&a[c]>e){let d=e-p,h=1+Math.floor((a[c]-d-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),jf(s,l,e);continue}if(p+a[c]>e&&p>0&&a[c]>0){if(r.wordWrap===!1&&p<e){jf(s,l,e);continue}s.push("")}if(p+a[c]>e&&r.wordWrap===!1){jf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>dO(c)));let u=[...s.join(`
105
+ `)];for(let[c,l]of u.entries()){if(n+=l,nu.has(l)){let{groups:d}=new RegExp(`(?:\\${GD}(?<code>\\d+)m|\\${Hf}(?<uri>.*)${qf})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let h=Number.parseFloat(d.code);o=h===lO?void 0:h}else d.uri!==void 0&&(i=d.uri.length===0?void 0:d.uri)}let p=cO.codes.get(Number(o));u[c+1]===`
106
+ `?(i&&(n+=jD("")),o&&p&&(n+=ND(p))):l===`
107
+ `&&(o&&p&&(n+=ND(o)),i&&(n+=jD(i)))}return n};function UD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
108
108
  `).split(`
109
- `).map(n=>dO(n,e,r)).join(`
110
- `)}var hO=["up","down","left","right","space","enter","cancel"],Zs={actions:new Set(hO),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Hf(t,e){if(typeof t=="string")return Zs.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Hf(r,e))return!0;return!1}function mO(t,e){if(t===e)return;let r=t.split(`
109
+ `).map(n=>hO(n,e,r)).join(`
110
+ `)}var mO=["up","down","left","right","space","enter","cancel"],Qs={actions:new Set(mO),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Vf(t,e){if(typeof t=="string")return Qs.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Vf(r,e))return!0;return!1}function gO(t,e){if(t===e)return;let r=t.split(`
111
111
  `),n=e.split(`
112
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var gO=globalThis.process.platform.startsWith("win"),Uf=Symbol("clack:cancel");function De(t){return t===Uf}function Xs(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function WD({input:t=qo.stdin,output:e=qo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=pn.createInterface({input:t,output:e,prompt:"",tabSize:1});pn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(Hf([c,s,u],"cancel")){n&&e.write(gt.cursor.show),process.exit(0);return}if(!r)return;pn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{pn.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(gt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(gt.cursor.show),t.isTTY&&!gO&&t.setRawMode(!1),o.terminal=!1,o.close()}}var DO=Object.defineProperty,yO=(t,e,r)=>e in t?DO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ht=(t,e,r)=>(yO(t,typeof e!="symbol"?e+"":e,r),r),ba=class{constructor(e,r=!0){Ht(this,"input"),Ht(this,"output"),Ht(this,"_abortSignal"),Ht(this,"rl"),Ht(this,"opts"),Ht(this,"_render"),Ht(this,"_track",!1),Ht(this,"_prevFrame",""),Ht(this,"_subscribers",new Map),Ht(this,"_cursor",0),Ht(this,"state","initial"),Ht(this,"error",""),Ht(this,"value");let{input:n=qo.stdin,output:o=qo.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(Uf);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new MD.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=Lf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Lf.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),Xs(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(gt.cursor.show),this.output.off("resize",this.render),Xs(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(gt.cursor.show),this.output.off("resize",this.render),Xs(this.input,!1),e(Uf)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Zs.aliases.has(r.name)&&this.emit("cursor",Zs.aliases.get(r.name)),Zs.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")}Hf([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(`
113
- `),Xs(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=LD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
- `).length-1;this.output.write(gt.cursor.move(-999,e*-1))}render(){let e=LD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(gt.cursor.hide);else{let r=mO(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(gt.cursor.move(0,n)),this.output.write(gt.erase.lines(1));let o=e.split(`
115
- `);this.output.write(o[n]),this._prevFrame=e,this.output.write(gt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(gt.cursor.move(0,n)),this.output.write(gt.erase.down());let o=e.split(`
112
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var DO=globalThis.process.platform.startsWith("win"),Mf=Symbol("clack:cancel");function De(t){return t===Mf}function Zs(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function YD({input:t=Ho.stdin,output:e=Ho.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=dn.createInterface({input:t,output:e,prompt:"",tabSize:1});dn.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(Vf([c,s,u],"cancel")){n&&e.write(Dt.cursor.show),process.exit(0);return}if(!r)return;dn.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{dn.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&&!DO&&t.setRawMode(!1),o.terminal=!1,o.close()}}var yO=Object.defineProperty,bO=(t,e,r)=>e in t?yO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vt=(t,e,r)=>(bO(t,typeof e!="symbol"?e+"":e,r),r),wa=class{constructor(e,r=!0){Vt(this,"input"),Vt(this,"output"),Vt(this,"_abortSignal"),Vt(this,"rl"),Vt(this,"opts"),Vt(this,"_render"),Vt(this,"_track",!1),Vt(this,"_prevFrame",""),Vt(this,"_subscribers",new Map),Vt(this,"_cursor",0),Vt(this,"state","initial"),Vt(this,"error",""),Vt(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(Mf);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new qD.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=Uf.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Uf.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),Zs(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),Zs(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Dt.cursor.show),this.output.off("resize",this.render),Zs(this.input,!1),e(Mf)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Qs.aliases.has(r.name)&&this.emit("cursor",Qs.aliases.get(r.name)),Qs.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")}Vf([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(`
113
+ `),Zs(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=UD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
114
+ `).length-1;this.output.write(Dt.cursor.move(-999,e*-1))}render(){let e=UD(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=gO(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(`
115
+ `);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(`
116
116
  `).slice(n);this.output.write(o.join(`
117
- `)),this._prevFrame=e;return}this.output.write(gt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Qs=class extends ba{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(gt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var bO;bO=new WeakMap;var wO=Object.defineProperty,vO=(t,e,r)=>e in t?wO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,UD=(t,e,r)=>(vO(t,typeof e!="symbol"?e+"":e,r),r),eu=class extends ba{constructor(e){super(e,!1),UD(this,"options"),UD(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 tu=class extends ba{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}${qD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Zt=le(require("node:process"),1),K=le(Bf(),1),nu=le(If(),1);function CO(){return Zt.default.platform!=="win32"?Zt.default.env.TERM!=="linux":!!Zt.default.env.CI||!!Zt.default.env.WT_SESSION||!!Zt.default.env.TERMINUS_SUBLIME||Zt.default.env.ConEmuTask==="{cmd::Cmder}"||Zt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Zt.default.env.TERM_PROGRAM==="vscode"||Zt.default.env.TERM==="xterm-256color"||Zt.default.env.TERM==="alacritty"||Zt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Vf=CO(),Je=(t,e)=>Vf?t:e,EO=Je("\u25C6","*"),YD=Je("\u25A0","x"),JD=Je("\u25B2","x"),Kf=Je("\u25C7","o"),_O=Je("\u250C","T"),qe=Je("\u2502","|"),Ho=Je("\u2514","\u2014"),zf=Je("\u25CF",">"),Gf=Je("\u25CB"," "),nq=Je("\u25FB","[\u2022]"),oq=Je("\u25FC","[+]"),iq=Je("\u25FB","[ ]"),aq=Je("\u25AA","\u2022"),sq=Je("\u2500","-"),uq=Je("\u256E","+"),cq=Je("\u251C","+"),lq=Je("\u256F","+"),xO=Je("\u25CF","\u2022"),SO=Je("\u25C6","*"),AO=Je("\u25B2","!"),FO=Je("\u25A0","x"),Wf=t=>{switch(t){case"initial":case"active":return K.default.cyan(EO);case"cancel":return K.default.red(YD);case"error":return K.default.yellow(JD);case"submit":return K.default.green(Kf)}},OO=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,p,d)=>{let h=p===0&&u,m=p===d.length-1&&c;return h||m?K.default.dim("..."):n(l,p+s===e)})},gr=t=>new tu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${K.default.gray(qe)}
118
- ${Wf(this.state)} ${t.message}
119
- `,r=t.placeholder?K.default.inverse(t.placeholder[0])+K.default.dim(t.placeholder.slice(1)):K.default.inverse(K.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
120
- ${K.default.yellow(qe)} ${n}
121
- ${K.default.yellow(Ho)} ${K.default.yellow(this.error)}
122
- `;case"submit":return`${e}${K.default.gray(qe)} ${K.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${K.default.gray(qe)} ${K.default.strikethrough(K.default.dim(this.value??""))}${this.value?.trim()?`
123
- ${K.default.gray(qe)}`:""}`;default:return`${e}${K.default.cyan(qe)} ${n}
124
- ${K.default.cyan(Ho)}
125
- `}}}).prompt();var ye=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new Qs({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${K.default.gray(qe)}
126
- ${Wf(this.state)} ${t.message}
127
- `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${K.default.gray(qe)} ${K.default.dim(o)}`;case"cancel":return`${n}${K.default.gray(qe)} ${K.default.strikethrough(K.default.dim(o))}
128
- ${K.default.gray(qe)}`;default:return`${n}${K.default.cyan(qe)} ${this.value?`${K.default.green(zf)} ${e}`:`${K.default.dim(Gf)} ${K.default.dim(e)}`} ${K.default.dim("/")} ${this.value?`${K.default.dim(Gf)} ${K.default.dim(r)}`:`${K.default.green(zf)} ${r}`}
129
- ${K.default.cyan(Ho)}
130
- `}}}).prompt()},Dr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${K.default.dim(o)}`;case"active":return`${K.default.green(zf)} ${o} ${r.hint?K.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${K.default.strikethrough(K.default.dim(o))}`;default:return`${K.default.dim(Gf)} ${K.default.dim(o)}`}};return new eu({options:t.options,initialValue:t.initialValue,render(){let r=`${K.default.gray(qe)}
131
- ${Wf(this.state)} ${t.message}
132
- `;switch(this.state){case"submit":return`${r}${K.default.gray(qe)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${K.default.gray(qe)} ${e(this.options[this.cursor],"cancelled")}
133
- ${K.default.gray(qe)}`;default:return`${r}${K.default.cyan(qe)} ${OO({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
- ${K.default.cyan(qe)} `)}
135
- ${K.default.cyan(Ho)}
136
- `}}}).prompt()};var Hn=(t="")=>{process.stdout.write(`${K.default.gray(Ho)} ${K.default.red(t)}
137
-
138
- `)},Z=(t="")=>{process.stdout.write(`${K.default.gray(_O)} ${t}
139
- `)},J=(t="")=>{process.stdout.write(`${K.default.gray(qe)}
140
- ${K.default.gray(Ho)} ${t}
141
-
142
- `)},f={message:(t="",{symbol:e=K.default.gray(qe)}={})=>{let r=[`${K.default.gray(qe)}`];if(t){let[n,...o]=t.split(`
143
- `);r.push(`${e} ${n}`,...o.map(i=>`${K.default.gray(qe)} ${i}`))}process.stdout.write(`${r.join(`
117
+ `)),this._prevFrame=e;return}this.output.write(Dt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},eu=class extends wa{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 wO;wO=new WeakMap;var vO=Object.defineProperty,CO=(t,e,r)=>e in t?vO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,MD=(t,e,r)=>(CO(t,typeof e!="symbol"?e+"":e,r),r),tu=class extends wa{constructor(e){super(e,!1),MD(this,"options"),MD(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 ru=class extends wa{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}${HD.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Qt=fe(require("node:process"),1),G=fe(Lf(),1),ou=fe(Rf(),1);function EO(){return Qt.default.platform!=="win32"?Qt.default.env.TERM!=="linux":!!Qt.default.env.CI||!!Qt.default.env.WT_SESSION||!!Qt.default.env.TERMINUS_SUBLIME||Qt.default.env.ConEmuTask==="{cmd::Cmder}"||Qt.default.env.TERM_PROGRAM==="Terminus-Sublime"||Qt.default.env.TERM_PROGRAM==="vscode"||Qt.default.env.TERM==="xterm-256color"||Qt.default.env.TERM==="alacritty"||Qt.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var zf=EO(),Xe=(t,e)=>zf?t:e,_O=Xe("\u25C6","*"),JD=Xe("\u25A0","x"),XD=Xe("\u25B2","x"),Wf=Xe("\u25C7","o"),SO=Xe("\u250C","T"),He=Xe("\u2502","|"),Vo=Xe("\u2514","\u2014"),Kf=Xe("\u25CF",">"),Gf=Xe("\u25CB"," "),iq=Xe("\u25FB","[\u2022]"),aq=Xe("\u25FC","[+]"),sq=Xe("\u25FB","[ ]"),uq=Xe("\u25AA","\u2022"),cq=Xe("\u2500","-"),lq=Xe("\u256E","+"),fq=Xe("\u251C","+"),pq=Xe("\u256F","+"),xO=Xe("\u25CF","\u2022"),AO=Xe("\u25C6","*"),FO=Xe("\u25B2","!"),OO=Xe("\u25A0","x"),Yf=t=>{switch(t){case"initial":case"active":return G.default.cyan(_O);case"cancel":return G.default.red(JD);case"error":return G.default.yellow(XD);case"submit":return G.default.green(Wf)}},kO=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,p,d)=>{let h=p===0&&u,m=p===d.length-1&&c;return h||m?G.default.dim("..."):n(l,p+s===e)})},Dr=t=>new ru({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${G.default.gray(He)}
118
+ ${Yf(this.state)} ${t.message}
119
+ `,r=t.placeholder?G.default.inverse(t.placeholder[0])+G.default.dim(t.placeholder.slice(1)):G.default.inverse(G.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
120
+ ${G.default.yellow(He)} ${n}
121
+ ${G.default.yellow(Vo)} ${G.default.yellow(this.error)}
122
+ `;case"submit":return`${e}${G.default.gray(He)} ${G.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${G.default.gray(He)} ${G.default.strikethrough(G.default.dim(this.value??""))}${this.value?.trim()?`
123
+ ${G.default.gray(He)}`:""}`;default:return`${e}${G.default.cyan(He)} ${n}
124
+ ${G.default.cyan(Vo)}
125
+ `}}}).prompt();var ye=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new eu({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${G.default.gray(He)}
126
+ ${Yf(this.state)} ${t.message}
127
+ `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${G.default.gray(He)} ${G.default.dim(o)}`;case"cancel":return`${n}${G.default.gray(He)} ${G.default.strikethrough(G.default.dim(o))}
128
+ ${G.default.gray(He)}`;default:return`${n}${G.default.cyan(He)} ${this.value?`${G.default.green(Kf)} ${e}`:`${G.default.dim(Gf)} ${G.default.dim(e)}`} ${G.default.dim("/")} ${this.value?`${G.default.dim(Gf)} ${G.default.dim(r)}`:`${G.default.green(Kf)} ${r}`}
129
+ ${G.default.cyan(Vo)}
130
+ `}}}).prompt()},yr=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${G.default.dim(o)}`;case"active":return`${G.default.green(Kf)} ${o} ${r.hint?G.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${G.default.strikethrough(G.default.dim(o))}`;default:return`${G.default.dim(Gf)} ${G.default.dim(o)}`}};return new tu({options:t.options,initialValue:t.initialValue,render(){let r=`${G.default.gray(He)}
131
+ ${Yf(this.state)} ${t.message}
132
+ `;switch(this.state){case"submit":return`${r}${G.default.gray(He)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${G.default.gray(He)} ${e(this.options[this.cursor],"cancelled")}
133
+ ${G.default.gray(He)}`;default:return`${r}${G.default.cyan(He)} ${kO({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
134
+ ${G.default.cyan(He)} `)}
135
+ ${G.default.cyan(Vo)}
136
+ `}}}).prompt()};var Vn=(t="")=>{process.stdout.write(`${G.default.gray(Vo)} ${G.default.red(t)}
137
+
138
+ `)},Z=(t="")=>{process.stdout.write(`${G.default.gray(SO)} ${t}
139
+ `)},J=(t="")=>{process.stdout.write(`${G.default.gray(He)}
140
+ ${G.default.gray(Vo)} ${t}
141
+
142
+ `)},f={message:(t="",{symbol:e=G.default.gray(He)}={})=>{let r=[`${G.default.gray(He)}`];if(t){let[n,...o]=t.split(`
143
+ `);r.push(`${e} ${n}`,...o.map(i=>`${G.default.gray(He)} ${i}`))}process.stdout.write(`${r.join(`
144
144
  `)}
145
- `)},info:t=>{f.message(t,{symbol:K.default.blue(xO)})},success:t=>{f.message(t,{symbol:K.default.green(SO)})},step:t=>{f.message(t,{symbol:K.default.green(Kf)})},warn:t=>{f.message(t,{symbol:K.default.yellow(AO)})},warning:t=>{f.warn(t)},error:t=>{f.message(t,{symbol:K.default.red(FO)})}},fq=`${K.default.gray(qe)} `;var ve=({indicator:t="dots"}={})=>{let e=Vf?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Vf?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),l=_=>{let S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},p=()=>l(2),d=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},b=()=>{if(u===void 0)return;n&&process.stdout.write(`
145
+ `)},info:t=>{f.message(t,{symbol:G.default.blue(xO)})},success:t=>{f.message(t,{symbol:G.default.green(AO)})},step:t=>{f.message(t,{symbol:G.default.green(Wf)})},warn:t=>{f.message(t,{symbol:G.default.yellow(FO)})},warning:t=>{f.warn(t)},error:t=>{f.message(t,{symbol:G.default.red(OO)})}},dq=`${G.default.gray(He)} `;var ve=({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 S=_>1?"Something went wrong":"Canceled";a&&g(S,_)},p=()=>l(2),d=()=>l(1),h=()=>{process.on("uncaughtExceptionMonitor",p),process.on("unhandledRejection",p),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",p),process.removeListener("unhandledRejection",p),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},y=()=>{if(u===void 0)return;n&&process.stdout.write(`
146
146
  `);let _=u.split(`
147
- `);process.stdout.write(nu.cursor.move(-999,_.length-1)),process.stdout.write(nu.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),C=_=>{let S=(performance.now()-_)/1e3,P=Math.floor(S/60),k=Math.floor(S%60);return P>0?`[${P}m ${k}s]`:`[${k}s]`},E=(_="")=>{a=!0,o=WD(),s=D(_),c=performance.now(),process.stdout.write(`${K.default.gray(qe)}
148
- `);let S=0,P=0;h(),i=setInterval(()=>{if(n&&s===u)return;b(),u=s;let k=K.default.magenta(e[S]);if(n)process.stdout.write(`${k} ${s}...`);else if(t==="timer")process.stdout.write(`${k} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${k} ${s}${B}`)}S=S+1<e.length?S+1:0,P=P<e.length?P+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),b();let P=S===0?K.default.green(Kf):S===1?K.default.red(YD):K.default.red(JD);s=D(_??s),t==="timer"?process.stdout.write(`${P} ${s} ${C(c)}
147
+ `);process.stdout.write(ou.cursor.move(-999,_.length-1)),process.stdout.write(ou.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),C=_=>{let S=(performance.now()-_)/1e3,P=Math.floor(S/60),k=Math.floor(S%60);return P>0?`[${P}m ${k}s]`:`[${k}s]`},E=(_="")=>{a=!0,o=YD(),s=D(_),c=performance.now(),process.stdout.write(`${G.default.gray(He)}
148
+ `);let S=0,P=0;h(),i=setInterval(()=>{if(n&&s===u)return;y(),u=s;let k=G.default.magenta(e[S]);if(n)process.stdout.write(`${k} ${s}...`);else if(t==="timer")process.stdout.write(`${k} ${s} ${C(c)}`);else{let B=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${k} ${s}${B}`)}S=S+1<e.length?S+1:0,P=P<e.length?P+.125:0},r)},g=(_="",S=0)=>{a=!1,clearInterval(i),y();let P=S===0?G.default.green(Wf):S===1?G.default.red(JD):G.default.red(XD);s=D(_??s),t==="timer"?process.stdout.write(`${P} ${s} ${C(c)}
149
149
  `):process.stdout.write(`${P} ${s}
150
- `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var i1=require("node:child_process"),ke=require("node:fs"),Ol=require("node:os"),Ae=le(require("node:path")),zt=require("node:process"),Rr=le(iu());var Ct=require("fs"),va=(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,Ct.existsSync)(r)||(0,Ct.existsSync)(n)?"bun":(0,Ct.existsSync)(o)||(0,Ct.existsSync)(i)?"pnpm":(0,Ct.existsSync)(a)?"yarn":(0,Ct.existsSync)(s)||(0,Ct.existsSync)(u)?"npm":e},au=(t=va(),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"}},XD=(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,Ct.existsSync)(r)||(0,Ct.existsSync)(n)?"bunx":(0,Ct.existsSync)(o)||(0,Ct.existsSync)(i)?"pnpm exec":(0,Ct.existsSync)(a)?"yarn dlx":(0,Ct.existsSync)(s)||(0,Ct.existsSync)(u)?"npx":e};function su(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function ey(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Zf(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 Vo="0|[1-9]\\d*",TO="\\d*[a-zA-Z-][a-zA-Z0-9-]*",IO=`(?<major>${Vo})\\.(?<minor>${Vo})\\.(?<patch>${Vo})`,ZD=`(?:${Vo}|${TO})`,ty=`(?:-(?<prerelease>${ZD}(?:\\.${ZD})*))`,QD="[0-9A-Za-z-]+",ry=`(?:\\+(?<buildmetadata>${QD}(?:\\.${QD})*))`,ny=`v?${IO}${ty}?${ry}?`,oy=new RegExp(`^${ny}$`),iy="(?:<|>)?=?",RO="x|X|\\*",Xf=`${Vo}|${RO}`,uu=`[v=\\s]*(?<major>${Xf})(?:\\.(?<minor>${Xf})(?:\\.(?<patch>${Xf})${ty}?${ry}?)?)?`,ay=new RegExp(`^(?<operator>~>?|\\^|${iy})\\s*${uu}$`),sy=new RegExp(`^(?<operator>${iy})\\s*(${ny})$|^$`);function Qf(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var ep=256;var BO=new RegExp(`^${Vo}$`);function Et(t){return t.split(".").filter(Boolean).map(e=>{if(BO.test(e)){let r=Number(e);if(Qf(r))return r}return e})}function yr(t){return t.split(".").filter(Boolean)}function hn(t,e){let r=Number(t);if(!Qf(r))throw new TypeError(e);return r}function zr(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 _t(t,e){return t===e?0:su(t.major,e.major)||su(t.minor,e.minor)||su(t.patch,e.patch)||ey(t.prerelease,e.prerelease)||Zf(t.prerelease,e.prerelease)}function tp(t){return t.toFixed(0)}function br(t){let e=tp(t.major),r=tp(t.minor),n=tp(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 jO(t,e){if(zr(e))return!0;let r=_t(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 cu(t,e){for(let r of e)if(!jO(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(zr(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 Ca(t,e){return e.some(r=>cu(t,r))}function NO(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 Ea(t=[],e){let r=NO(t);if(!e)return r;let n=Et(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 _a(t,e,r={}){let n=r.build!==void 0?yr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Ea(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Ea(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Ea(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:Ea(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:Ea(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var lu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},zo={operator:void 0,...lu};function rp(t,e){return _t(t,e)>0}function Vn(t,e){return _t(t,e)<0}function LO(t){let r=t.match(sy)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:hn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:hn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:hn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?Et(o):[],build:i?yr(i):[]}:lu;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function UO(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?Et(t.prerelease):[],build:[]}}function MO(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:Et(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function qO(t){let e=t.match(new RegExp(`^${uu}`)),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(`^${uu}\\s*$`))?.groups;if(!s)return null;let u=UO(r),c=MO(s);return[u,c].filter(Boolean)}function HO(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[zo];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=Et(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 VO(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[zo];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=Et(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function zO(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=Et(t.prerelease??""),u=yr(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function GO(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=Et(t.prerelease??""),s=yr(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function KO(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=Et(t.prerelease??""),u=yr(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function WO(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[zo];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=Et(t.prerelease??""),u=yr(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function YO(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[zo];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=Et(t.prerelease??""),u=yr(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function JO(t){let e=t.match(ay)?.groups;if(!e)return LO(t);switch(e.operator){case"^":return HO(e);case"~":case"~>":return VO(e);case"<":return zO(e);case"<=":return GO(e);case">":return KO(e);case">=":return WO(e);case"=":case"":return YO(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function XO(t){return t.split(/\s+/).flatMap(JO)}function fu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>qO(r)||XO(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>ep)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${ep}`);t=t.trim();let e=t.match(oy)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=hn(e.major,`Cannot parse version ${t}: invalid major version`),n=hn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=hn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?Et(e.prerelease):[],a=e.buildmetadata?yr(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function uy(t,e){let r=t.operator,n=e.operator;if(r===void 0)return zr(t)?!0:Ca(t,[[e]]);if(n===void 0)return zr(e)?!0:Ca(e,[[t]]);let o=_t(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 ZO(t){return t.every(e=>e.some(r=>QO(r)))}function QO(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!uy(r,n))return!1}return!0}function cy(t,e){return ZO([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>uy(o,i)))))}function ly(t){try{return _e(t),!0}catch{return!1}}function mn(t,e){return _t(t,e)>=0}var Xi=le(v0()),hg=le(eb()),a1=le(Pb()),kl=le(Xh());function HC(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var it=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?HC("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))+HC("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(`
151
- `)}};async function zc(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 he(){let t=await zc("@capgo/cli")??"",e=t?.split(".")[0];t!==mr.version&&f.warning(`\u{1F6A8} You are using @capgo/cli@${mr.version} it's not the latest version.
152
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function b8(t){return new Promise(e=>{setTimeout(e,t)})}function w8(t){return new Date(t||"").toLocaleTimeString()}async function or(t,e,r,n,o,i="\u2705"){await be(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function v8(t,e,r,n){if(De(e))throw await or(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function C8(t,e,r){try{let n=await ir(),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 ${L(n)}`)}return[]}function E8(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 _8(t,e,r,n,o,i){let a=E8(t);if(!a)return{};a.snag&&await or(e,r,n,a.snag);let s=w8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,p=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,p],stop:a.stop}}async function Zh(t,e,r,n,o){let i=!0,a=await ir(),s=`${a.hostWeb}/app/p/${r}`;await or(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,p=ve(),d=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`);i;){await b8(5e3);let h=await C8(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()),D=new it;D.headers=["Time","Device","Key","Message"],D.theme=it.roundTheme,D.rows=[];let C=!1;for(let E of b){let{row:g,stop:_}=await _8(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(C=!0)}if(D.rows.length&&(p.stop(""),f.info(D.toString()),p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`)),C){i=!1;break}}}return p.stop("Stop watching logs"),Promise.resolve()}async function VC(t,e){Z("Debug Live update in Capgo"),await he(),e.apikey=e.apikey||ie();let r=await te();t=me(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 ar(o,t),a=await ye({message:"Automatic check if update working in device ?"});await v8("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 Zh("debug",e.apikey,t,i,n),J("Done \u2705")):J("Canceled \u274C")}var Qh=require("node:buffer"),zC=require("node:crypto"),x8=(()=>{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 S8(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=x8[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Zr(t,e="sha256"){let r=Qh.Buffer.isBuffer(t)?t:Qh.Buffer.from(t);if(e==="crc32")return S8(r);let n=(0,zC.createHash)(e);return n.update(r),n.digest("hex")}var Es=le(ES());async function _S(){let t=await(0,Es.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function zm(t,e,r=!1){let n=await(0,Es.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,Es.writeConfig)(o,n.app.extConfigFilePath))}async function Ki(t,e=!1){await zm("CapacitorUpdater",t,e)}var Zi=".capgo_key",Kt=".capgo_key_v2",Pl=`${Zi}.pub`,rn=`${Kt}.pub`,QS="https://capgo.app",e1="https://files.capgo.app",t1="https://api.capgo.app",r1="https://console.capgo.app",mg=12e4,s5=1024*1024*20,u5=1024*1024*1024,c5=1024*1024*99,Br="package.json",Qi=/^(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,L=t=>t?`
153
- ${a1.default.render(t)}`:"";function Fl(t){return new Promise(e=>{setTimeout(e,t)})}function s1(t){return(0,Rr.isMonorepo)(t)||(0,Rr.isNXMonorepo)(t)}function yt(t){return(0,Rr.isMonorepo)(t)?(0,Rr.findMonorepoRoot)(t):(0,Rr.isNXMonorepo)(t)?(0,Rr.findNXMonorepoRoot)(t):t}function u1(t=yt((0,zt.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,ke.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw f.error(o),new Error(o)}let n=(0,ke.readFileSync)(r??(0,Ae.join)(t,Br));return JSON.parse(n)}function gg(t=yt((0,zt.cwd)()),e=void 0){return u1(t,e).scripts}function xr(t=yt((0,zt.cwd)()),e=void 0){return u1(t,e).version??""}function n1(t){let e=t.replace("^","").replace("~","");if(ly(e))try{let r=_e(e);return br(r)}catch{return e}return e}async function nn(t,e=(0,zt.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let a=(await Gt(e,r)).get(t);if(a)return a}catch{}let n=null,o=(0,Ae.join)(e,"ios","App","Podfile");if((0,ke.existsSync)(o))try{let a=(0,ke.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,ke.existsSync)(i))try{let s=(0,ke.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,Br);if((0,ke.existsSync)(i))try{let a=JSON.parse((0,ke.readFileSync)(i,"utf-8"));if(a.version)return a.version}catch{}}try{let a=(await Gt(e)).get(t);if(a)return a}catch{}return null}async function Gt(t=yt((0,zt.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Ae.join)(t,Br)],r){for(let o of r)if(!(0,ke.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,ke.readFileSync)(o),a=JSON.parse(i);for(let s in a.dependencies)n.set(s,n1(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,n1(a.devDependencies[s]))}return n}async function te(){try{let t=await _S();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 ${L(t)}`;throw f.error(e),new Error(e)}}async function Dg(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 zm(t,r)),r}async function As(t){return Dg("CapacitorUpdater",t)}async function ir(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||QS,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||r1,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||e1,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||t1};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:QS,hostWeb:r1,hostFilesApi:e1,hostApi:t1}}}var l5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function $l(){let t=await ir();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 ${L(t)}`),t}}async function c1(){let t=await ir();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:u5,maxChunkSize:c5,alertUploadSize:s5}}}async function re(t,e,r){let n=await $l();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,Xi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function f5(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 l1(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function f1(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function p5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function d5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var bt=(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))(bt||{}),ea=(t,e)=>t>=e;async function p1(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 d1(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: ${L(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",`
150
+ `),m(),o()};return{start:E,stop:g,message:(_="")=>{s=D(_??s)}}};var aA=require("node:child_process"),Pe=require("node:fs"),kl=require("node:os"),Fe=fe(require("node:path")),Kt=require("node:process"),Br=fe(au());var Et=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,Et.existsSync)(r)||(0,Et.existsSync)(n)?"bun":(0,Et.existsSync)(o)||(0,Et.existsSync)(i)?"pnpm":(0,Et.existsSync)(a)?"yarn":(0,Et.existsSync)(s)||(0,Et.existsSync)(u)?"npm":e},su=(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"}},ZD=(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,Et.existsSync)(r)||(0,Et.existsSync)(n)?"bunx":(0,Et.existsSync)(o)||(0,Et.existsSync)(i)?"pnpm exec":(0,Et.existsSync)(a)?"yarn dlx":(0,Et.existsSync)(s)||(0,Et.existsSync)(u)?"npx":e};function uu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function ty(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Qf(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*",TO="\\d*[a-zA-Z-][a-zA-Z0-9-]*",RO=`(?<major>${zo})\\.(?<minor>${zo})\\.(?<patch>${zo})`,QD=`(?:${zo}|${TO})`,ry=`(?:-(?<prerelease>${QD}(?:\\.${QD})*))`,ey="[0-9A-Za-z-]+",ny=`(?:\\+(?<buildmetadata>${ey}(?:\\.${ey})*))`,oy=`v?${RO}${ry}?${ny}?`,iy=new RegExp(`^${oy}$`),ay="(?:<|>)?=?",BO="x|X|\\*",Zf=`${zo}|${BO}`,cu=`[v=\\s]*(?<major>${Zf})(?:\\.(?<minor>${Zf})(?:\\.(?<patch>${Zf})${ry}?${ny}?)?)?`,sy=new RegExp(`^(?<operator>~>?|\\^|${ay})\\s*${cu}$`),uy=new RegExp(`^(?<operator>${ay})\\s*(${oy})$|^$`);function ep(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var tp=256;var LO=new RegExp(`^${zo}$`);function _t(t){return t.split(".").filter(Boolean).map(e=>{if(LO.test(e)){let r=Number(e);if(ep(r))return r}return e})}function br(t){return t.split(".").filter(Boolean)}function mn(t,e){let r=Number(t);if(!ep(r))throw new TypeError(e);return r}function Kr(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 St(t,e){return t===e?0:uu(t.major,e.major)||uu(t.minor,e.minor)||uu(t.patch,e.patch)||ty(t.prerelease,e.prerelease)||Qf(t.prerelease,e.prerelease)}function rp(t){return t.toFixed(0)}function wr(t){let e=rp(t.major),r=rp(t.minor),n=rp(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 NO(t,e){if(Kr(e))return!0;let r=St(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 lu(t,e){for(let r of e)if(!NO(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Kr(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 Ea(t,e){return e.some(r=>lu(t,r))}function jO(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 _a(t=[],e){let r=jO(t);if(!e)return r;let n=_t(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 Sa(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:_a(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:_a(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:_a(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:_a(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:_a(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var fu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ko={operator:void 0,...fu};function np(t,e){return St(t,e)>0}function zn(t,e){return St(t,e)<0}function UO(t){let r=t.match(uy)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:mn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:mn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:mn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?_t(o):[],build:i?br(i):[]}:fu;return{operator:n||void 0,...a}}function Te(t){return!t||t.toLowerCase()==="x"||t==="*"}function MO(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?_t(t.prerelease):[],build:[]}}function qO(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:_t(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function HO(t){let e=t.match(new RegExp(`^${cu}`)),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(`^${cu}\\s*$`))?.groups;if(!s)return null;let u=MO(r),c=qO(s);return[u,c].filter(Boolean)}function VO(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[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=_t(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 zO(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[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=_t(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function KO(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=_t(t.prerelease??""),u=br(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function GO(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=_t(t.prerelease??""),s=br(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function WO(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=_t(t.prerelease??""),u=br(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function YO(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[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=_t(t.prerelease??""),u=br(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function JO(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[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=_t(t.prerelease??""),u=br(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function XO(t){let e=t.match(sy)?.groups;if(!e)return UO(t);switch(e.operator){case"^":return VO(e);case"~":case"~>":return zO(e);case"<":return KO(e);case"<=":return GO(e);case">":return WO(e);case">=":return YO(e);case"=":case"":return JO(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function ZO(t){return t.split(/\s+/).flatMap(XO)}function pu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>HO(r)||ZO(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function Se(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>tp)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${tp}`);t=t.trim();let e=t.match(iy)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=mn(e.major,`Cannot parse version ${t}: invalid major version`),n=mn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=mn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?_t(e.prerelease):[],a=e.buildmetadata?br(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function cy(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Kr(t)?!0:Ea(t,[[e]]);if(n===void 0)return Kr(e)?!0:Ea(e,[[t]]);let o=St(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 QO(t){return t.every(e=>e.some(r=>ek(r)))}function ek(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!cy(r,n))return!1}return!0}function ly(t,e){return QO([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>cy(o,i)))))}function fy(t){try{return Se(t),!0}catch{return!1}}function gn(t,e){return St(t,e)>=0}var Zi=fe(C0()),mg=fe(tb()),sA=fe($b()),Pl=fe(Zh());function VC(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?VC("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))+VC("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(`
151
+ `)}};async function Kc(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 me(){let t=await Kc("@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.
152
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function w8(t){return new Promise(e=>{setTimeout(e,t)})}function v8(t){return new Date(t||"").toLocaleTimeString()}async function ir(t,e,r,n,o,i="\u2705"){await be(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function C8(t,e,r,n){if(De(e))throw await ir(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function E8(t,e,r){try{let n=await ar(),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 ${j(n)}`)}return[]}function _8(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 S8(t,e,r,n,o,i){let a=_8(t);if(!a)return{};a.snag&&await ir(e,r,n,a.snag);let s=v8(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",l=t.version?` (version ${t.version})`:c,p=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${l}`;return{row:[s,t.device_id,u,p],stop:a.stop}}async function Qh(t,e,r,n,o){let i=!0,a=await ar(),s=`${a.hostWeb}/app/p/${r}`;await ir(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,p=ve(),d=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`);i;){await w8(5e3);let h=await E8(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 y=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()),D=new at;D.headers=["Time","Device","Key","Message"],D.theme=at.roundTheme,D.rows=[];let C=!1;for(let E of y){let{row:g,stop:_}=await S8(E,t,n,e,s,a.hostWeb);g&&D.rows.push(g),_&&(C=!0)}if(D.rows.length&&(p.stop(""),f.info(D.toString()),p.start(`Waiting for logs (Expect delay of 30 sec) more info: ${d}`)),C){i=!1;break}}}return p.stop("Stop watching logs"),Promise.resolve()}async function zC(t,e){Z("Debug Live update in Capgo"),await me(),e.apikey=e.apikey||ie();let r=await ee();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 sr(o,t),a=await ye({message:"Automatic check if update working in device ?"});await C8("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 Qh("debug",e.apikey,t,i,n),J("Done \u2705")):J("Canceled \u274C")}var em=require("node:buffer"),KC=require("node:crypto"),x8=(()=>{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 A8(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=x8[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Qr(t,e="sha256"){let r=em.Buffer.isBuffer(t)?t:em.Buffer.from(t);if(e==="crc32")return A8(r);let n=(0,KC.createHash)(e);return n.update(r),n.digest("hex")}var _s=fe(_x());async function Sx(){let t=await(0,_s.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Km(t,e,r=!1){let n=await(0,_s.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,_s.writeConfig)(o,n.app.extConfigFilePath))}async function Wi(t,e=!1){await Km("CapacitorUpdater",t,e)}var Qi=".capgo_key",Wt=".capgo_key_v2",$l=`${Qi}.pub`,nn=`${Wt}.pub`,eA="https://capgo.app",tA="https://files.capgo.app",rA="https://api.capgo.app",nA="https://console.capgo.app",gg=12e4,u5=1024*1024*20,c5=1024*1024*1024,l5=1024*1024*99,Lr="package.json",ea=/^(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,j=t=>t?`
153
+ ${sA.default.render(t)}`:"";function Ol(t){return new Promise(e=>{setTimeout(e,t)})}function uA(t){return(0,Br.isMonorepo)(t)||(0,Br.isNXMonorepo)(t)}function bt(t){return(0,Br.isMonorepo)(t)?(0,Br.findMonorepoRoot)(t):(0,Br.isNXMonorepo)(t)?(0,Br.findNXMonorepoRoot)(t):t}function cA(t=bt((0,Kt.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,Fe.join)(t,Lr));return JSON.parse(n)}function Dg(t=bt((0,Kt.cwd)()),e=void 0){return cA(t,e).scripts}function xr(t=bt((0,Kt.cwd)()),e=void 0){return cA(t,e).version??""}function oA(t){let e=t.replace("^","").replace("~","");if(fy(e))try{let r=Se(e);return wr(r)}catch{return e}return e}async function on(t,e=(0,Kt.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let a=(await Gt(e,r)).get(t);if(a)return a}catch{}let n=null,o=(0,Fe.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,Fe.resolve)((0,Fe.join)(e,"ios","App",a[1])))}catch{}if(!n){let i=(0,Fe.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,Fe.resolve)((0,Fe.join)(e,"android",s[1])).replace(/\/android$/,""))}catch{}}if(n){let i=(0,Fe.join)(n,Lr);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 Gt(e)).get(t);if(a)return a}catch{}return null}async function Gt(t=bt((0,Kt.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Fe.join)(t,Lr)],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,oA(a.dependencies[s]));for(let s in a.devDependencies)n.set(s,oA(a.devDependencies[s]))}return n}async function ee(){try{let t=await Sx();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 ${j(t)}`;throw f.error(e),new Error(e)}}async function yg(t,e){let r=await ee();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Km(t,r)),r}async function Fs(t){return yg("CapacitorUpdater",t)}async function ar(){try{let t=await ee(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||eA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||nA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||tA,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||rA};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:nA,hostFilesApi:tA,hostApi:rA}}}var f5=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Il(){let t=await ar();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 ${j(t)}`),t}}async function lA(){let t=await ar();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:c5,maxChunkSize:l5,alertUploadSize:u5}}}async function re(t,e,r){let n=await Il();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,Zi.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function p5(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 fA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function pA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function d5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function h5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var wt=(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))(wt||{}),ta=(t,e)=>t>=e;async function dA(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 hA(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: ${j(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",`
154
154
  `)}`),i=new Error(s.message)):f.warn(`${s.message.replaceAll("\\n",`
155
- `)}`)}if(i)throw f.error("Please fix the warnings and try again."),i;f.info("End of cli warnings.")}}async function h1(t,e,r,n,o=!0){let i=await $l();if(!await(n?d5(t,n,r):p5(t,e)))throw f.error(`You need to upgrade your plan to continue to use capgo.
155
+ `)}`)}if(i)throw f.error("Please fix the warnings and try again."),i;f.info("End of cli warnings.")}}async function mA(t,e,r,n,o=!0){let i=await Il();if(!await(n?h5(t,n,r):d5(t,e)))throw f.error(`You need to upgrade your plan to continue to use capgo.
156
156
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
157
- `),Fl(100),Promise.resolve().then(()=>(pg(),fg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Fl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([f1(t,e),l1(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
157
+ `),Ol(100),Promise.resolve().then(()=>(dg(),pg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Ol(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([pA(t,e),fA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
158
158
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
159
- `)}async function m1(t,e,r,n,o=!0){let i=await $l(),{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.
159
+ `)}async function gA(t,e,r,n,o=!0){let i=await Il(),{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.
160
160
  Upgrade here: ${i.hostWeb}/dashboard/settings/plans
161
- `),Fl(100),Promise.resolve().then(()=>(pg(),fg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Fl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([f1(t,e),l1(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
161
+ `),Ol(100),Promise.resolve().then(()=>(dg(),pg)).then(c=>{c.default(`${i.hostWeb}/dashboard/settings/plans`)}),Ol(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([pA(t,e),fA(t,e)]);s>0&&o&&!u&&f.warn(`WARNING !!
162
162
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
163
- `)}function ie(t=!1){let e=zt.env.CAPGO_TOKEN?.trim();if(e)return t||f.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Ol.homedir)(),n,o=`${r}/.capgo`;if((0,ke.existsSync)(o)&&(t||f.info(`Use global API key ${o}`),n=(0,ke.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,ke.existsSync)(o)&&(t||f.info(`Use local API key ${o}`),n=(0,ke.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${Qe().runner} @capacitor/cli login`;throw f.error(i),new Error(i)}return n}async function*yg(t){let e=await(0,ke.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*yg(n):yield n}}function ta(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 Tl(){let t=(0,zt.cwd)(),e=!1,r=(0,Ae.resolve)(t,"tsconfig.json");(0,ke.existsSync)(r)&&(e=!0);for await(let n of yg(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(Br)){let o=(0,Ae.dirname)(n),i=await Gt(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 g1(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 bg(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 ye({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 ye({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 D1(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,zt.cwd)(),n=r.split("/").length;for await(let o of yg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,f.info(`Found main file here ${o}`);break}return e}async function wg(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 y1(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 Xi.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 ${L(o)}`)}return""}async function*b1(t){let e=(0,ke.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Ae.join)(t,r.name);r.isDirectory()?yield*b1(n):yield n}}async function w1(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 b1(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,ke.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 Zr(o,"sha256"),a=(0,Ae.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Il(t){return(0,Ol.platform)()==="win32"?m5(t):h5(t)}function h5(t){let e=new hg.default;return e.addLocalFolder(t),e.toBuffer()}async function m5(t){f.info("Zipping file windows mode");let e=new hg.default,r=(n,o)=>{let i=(0,ke.readdirSync)(n);for(let a of i){let s=(0,Ae.join)(n,a),u=(0,ke.statSync)(s);if(u.isFile()){let c=(0,ke.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 v1(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{be(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new kl.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(p){if(f.error(`Error uploading bundle: ${p.message}`),p instanceof kl.DetailedError){let d=p.originalResponse?.getBody(),h=JSON.parse(d||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(p.message||p.toString()||"unknown error")},onProgress(p,d){let h=(p/d*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await be(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function C1(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 Xi.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 Xi.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: ${L(o)}`)}}async function Rl(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 be(t,e,r){try{r&&f.info(`Get remove config: for ${e.event}`);let n=await $l();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(L(n)))}}async function ra(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 Dr({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(De(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 oe(t,e,r=["all"]){await f5(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 ar(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}`),L(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function na(t){return new Date(t||"").toLocaleString()}var o1=!1,Ji="npm",Ss="install",dg="npx";function Qe(){if(o1)return{pm:Ji,command:Ss,installCommand:`${Ji} ${Ss}`,runner:dg};let t=yt((0,zt.cwd)());return Ji=va(t,"npm"),Ss=au(Ji),o1=!0,dg=XD(t),{pm:Ji,command:Ss,installCommand:`${Ji} ${Ss}`,runner:dg}}function E1(t){return(0,ke.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Ae.join)(t,n.name);return n.isDirectory()?E1(o):o.split(`node_modules${Ae.sep}`)[1]||o})}async function vg(t,e){let r=e?e.split(","):[],n;try{n=await Gt("",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(Br,""):yt((0,zt.cwd)());if(!n)throw f.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,p]of Object.entries(n))if(typeof p!="string")throw f.error(`Invalid dependency ${l}: ${p}, expected string, got ${typeof p}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Ae.join)((0,zt.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,ke.existsSync)(l))){let l=va(i,"npm"),p=au(l);throw f.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${p}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,p])=>{let d=!1,h=!1;for(let m of a){let b=(0,Ae.join)(m,l);if((0,ke.existsSync)(b)){d=!0;try{if(E1(b).some(C=>l5.test(C))){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(!d){u=!0;let m=va(i,"npm"),b=au(m);return f.error(`Missing dependency ${l}, please run ${m} ${b}`),{name:l,version:p}}return{name:l,version:p,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 g5(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 D5(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 _1(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
163
+ `)}function ie(t=!1){let e=Kt.env.CAPGO_TOKEN?.trim();if(e)return t||f.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,kl.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*bg(t){let e=await(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Fe.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*bg(n):yield n}}function ra(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 Tl(){let t=(0,Kt.cwd)(),e=!1,r=(0,Fe.resolve)(t,"tsconfig.json");(0,Pe.existsSync)(r)&&(e=!0);for await(let n of bg(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(Lr)){let o=(0,Fe.dirname)(n),i=await Gt(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 DA(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 wg(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 ye({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 ye({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 yA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,Kt.cwd)(),n=r.split("/").length;for await(let o of bg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,f.info(`Found main file here ${o}`);break}return e}async function vg(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 bA(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 Zi.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 ${j(o)}`)}return""}async function*wA(t){let e=(0,Pe.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Fe.join)(t,r.name);r.isDirectory()?yield*wA(n):yield n}}async function vA(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 wA(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 Qr(o,"sha256"),a=(0,Fe.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Rl(t){return(0,kl.platform)()==="win32"?g5(t):m5(t)}function m5(t){let e=new mg.default;return e.addLocalFolder(t),e.toBuffer()}async function g5(t){f.info("Zipping file windows mode");let e=new mg.default,r=(n,o)=>{let i=(0,Pe.readdirSync)(n);for(let a of i){let s=(0,Fe.join)(n,a),u=(0,Pe.statSync)(s);if(u.isFile()){let c=(0,Pe.readFileSync)(s);e.addFile((0,Fe.join)(o,a).split(Fe.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,Fe.join)(o,a))}};return r(t,""),e.toBuffer()}async function CA(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{be(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Pl.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(p){if(f.error(`Error uploading bundle: ${p.message}`),p instanceof Pl.DetailedError){let d=p.originalResponse?.getBody(),h=JSON.parse(d||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(p.message||p.toString()||"unknown error")},onProgress(p,d){let h=(p/d*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await be(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function EA(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 Zi.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 Zi.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: ${j(o)}`)}}async function Bl(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 be(t,e,r){try{r&&f.info(`Get remove config: for ${e.event}`);let n=await Il();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(j(n)))}}async function na(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(De(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 oe(t,e,r=["all"]){await p5(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 sr(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}`),j(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function oa(t){return new Date(t||"").toLocaleString()}var iA=!1,Xi="npm",As="install",hg="npx";function et(){if(iA)return{pm:Xi,command:As,installCommand:`${Xi} ${As}`,runner:hg};let t=bt((0,Kt.cwd)());return Xi=Ca(t,"npm"),As=su(Xi),iA=!0,hg=ZD(t),{pm:Xi,command:As,installCommand:`${Xi} ${As}`,runner:hg}}function _A(t){return(0,Pe.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,Fe.join)(t,n.name);return n.isDirectory()?_A(o):o.split(`node_modules${Fe.sep}`)[1]||o})}async function Cg(t,e){let r=e?e.split(","):[],n;try{n=await Gt("",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?Fe.default.resolve(o).replace(Lr,""):bt((0,Kt.cwd)());if(!n)throw f.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,p]of Object.entries(n))if(typeof p!="string")throw f.error(`Invalid dependency ${l}: ${p}, expected string, got ${typeof p}`),new Error(`Invalid dependency ${l}: expected string version`);let a=r.length===0?[(0,Fe.join)((0,Kt.cwd)(),"node_modules")]:r;if(!a.some(l=>(0,Pe.existsSync)(l))){let l=Ca(i,"npm"),p=su(l);throw f.error(`Missing node_modules folder at ${a.join(", ")}, please run ${l} ${p}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,p])=>{let d=!1,h=!1;for(let m of a){let y=(0,Fe.join)(m,l);if((0,Pe.existsSync)(y)){d=!0;try{if(_A(y).some(C=>f5.test(C))){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(!d){u=!0;let m=Ca(i,"npm"),y=su(m);return f.error(`Missing dependency ${l}, please run ${m} ${y}`),{name:l,version:p}}return{name:l,version:p,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 D5(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 y5(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 SA(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
164
164
  native_packages
165
- )`).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 D5(n.version.native_packages??[])}async function x1(t,e,r,n){let o=ve();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await g5(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.
165
+ )`).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 y5(n.version.native_packages??[])}async function xA(t,e,r,n){let o=ve();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await D5(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.
166
166
  Current bundle checksum matches remote bundle for channel ${r}
167
167
  Did you build your app before uploading?
168
- 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 me(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function Fo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=fu(t.localVersion),r=fu(t.remoteVersion);return cy(e,r)}catch{return!1}}async function Bl(t,e,r,n,o){let i=await vg(n,o),a=await _1(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 Cg(t,e,r,n){let o=await _1(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 jl(t,e,r){let n=await ye({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(De(n))throw t&&e&&r&&await or("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=Qe(),i=ve();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,i1.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=Qe();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 S1(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Ue(t,e,r,n,o=!1){let i=Qe(),a=await p1(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: ${bt[a.data]}, required for this action: ${bt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var cr="assets/icon.png";var y5=/^[a-z0-9]+(\.[\w-]+)+$/i;function b5(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(!y5.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 w5(t,e,r){if(await S1(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 Eg(t,e,r,n=!1){n||Z("Adding"),await he(),e.apikey=e.apikey||ie();let o=await te(),i=me(t,o?.config);b5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await w5(a,i,n),r||(r=await ra(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 p=null,d=null;l&&(0,oa.existsSync)(l)?(p=(0,oa.readFileSync)(l),d=ta(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,oa.existsSync)(cr)?(p=(0,oa.readFileSync)(cr),d=ta(cr)||"image/png",n||f.warn(`Found app icon ${cr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${cr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(p&&d){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,p,{contentType:d});if(D)throw n||console.error(D),n||f.error(`Could not add app ${L(D)}`),new Error(`Could not add app ${L(D)}`);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 ${L(b)}`),new Error(`Could not add app ${L(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),J("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function A1(t,e){await Eg(t,e,void 0)}async function v5(t,e,r=!1,n=!1){r||Z("Deleting"),e.apikey=e.apikey||ie();let o=await te(),i=me(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 oe(a,e.apikey,["write","all"]);await Ue(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 Dr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(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 ${L(c)}`);let{error:p}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);p&&!r&&f.error("Could not delete app logo");let{error:d}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);d&&!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: ${L(h)}`);let m=await ar(a,i);return await be(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"),J("Done \u2705")),!0}async function F1(t,e){return v5(t,e,!1,!1)}var Nl=require("node:os"),k1=require("node:process");async function O1(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>zc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function C5(){let t=await Gt(),e={"@capgo/cli":mr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function E5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=xr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=me("",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,Nl.platform)()} ${(0,Nl.version)()}`),f.info(` Node: ${k1.version}`),f.info(" Installed Dependencies:"));let u=await C5();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 O1(u);else{let l=ve();l.start("Running: Loading latest dependencies"),c=await O1(u),l.stop("Latest Dependencies:");for(let p of Object.keys(c))f.info(` ${p}: ${c[p]}`)}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 P1(t){return E5(t)}function _5(t){let e=new it;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,na(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 S5(t,e=!1){e||Z("List apps in Capgo"),await he(),t.apikey=t.apikey||ie();let r=await re(t.apikey,t.supaHost,t.supaAnon);await oe(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}`),_5(n),J("Done \u2705")),n}async function $1(t){return S5(t,!1)}var T1=require("node:crypto"),ia=require("node:fs");async function A5(t,e,r=!1){r||Z("Set app"),e.apikey=e.apikey||ie();let n=await te();if(t=me(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 ra(o,["admin","super_admin"])).gid,s=await oe(o,e.apikey,["write","all"]);await Ue(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 p,d,h=`icon_${(0,T1.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ia.existsSync)(c)?(p=(0,ia.readFileSync)(c),d=ta(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,ia.existsSync)(cr)?(p=(0,ia.readFileSync)(cr),d=ta(cr)||"image/png",r||f.warn(`Found app icon ${cr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${cr}`),p&&d){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,p,{contentType:d});if(D)throw r||f.error(`Could not set app ${L(D)}`),new Error(`Could not set app: ${L(D)}`);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 ${L(b)}`),new Error(`Could not set app: ${L(b)}`);return r||J("Done \u2705"),!0}async function I1(t,e){return A5(t,e)}async function F5(t,e,r=!1){if(r||Z("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 Ki(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${L(n)}`),new Error(`Cannot set capacitor config: ${L(n)}`)}r||J("Done \u2705")}async function R1(t,e){return F5(t,e)}var ko=require("node:fs"),Po=require("node:path"),lr=le(require("node:process"));var Oo=require("node:fs/promises"),B1=require("node:os"),_g=require("node:path"),j1=(0,_g.join)((0,B1.homedir)(),".capgo-credentials"),N1=(0,_g.join)(j1,"credentials.json");async function aa(t){return(await(0,Oo.readFile)(t)).toString("base64")}async function Ul(){try{let t=await(0,Oo.readFile)(N1,"utf-8");return JSON.parse(t)}catch{return{}}}async function Fs(t){let e=await Ul();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Ll(t){await(0,Oo.mkdir)(j1,{recursive:!0}),await(0,Oo.writeFile)(N1,JSON.stringify(t,null,2),"utf-8")}async function L1(t,e,r){let n=await Fs(t);return!n||!n[e]?r:{...n[e],...r}}async function U1(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await aa(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await aa(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await aa(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await aa(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await aa(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await aa(e.PLAY_CONFIG_JSON_PATH))),n}async function M1(t,e,r){let n=await Ul(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Ll(n)}async function Ml(t,e){let r=await Ul();if(!t){await Ll({});return}if(!e){delete r[t],await Ll(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Ll(r)}async function q1(t,e){return(await Fs(t))?.[e]||null}async function xg(){let t=await Ul();return Object.keys(t)}async function H1(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),lr.default.exit(1)),t.appId||(f.error("App ID is required. Use --appId com.example.app"),lr.default.exit(1));let e=t.platform,r=t.appId;f.info(`
168
+ 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 Oo(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=pu(t.localVersion),r=pu(t.remoteVersion);return ly(e,r)}catch{return!1}}async function Ll(t,e,r,n,o){let i=await Cg(n,o),a=await SA(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 Eg(t,e,r,n){let o=await SA(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 Nl(t,e,r){let n=await ye({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(De(n))throw t&&e&&r&&await ir("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=et(),i=ve();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,aA.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 AA(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 dA(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: ${wt[a.data]}, required for this action: ${wt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var lr="assets/icon.png";var b5=/^[a-z0-9]+(\.[\w-]+)+$/i;function w5(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(!b5.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 v5(t,e,r){if(await AA(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 _g(t,e,r,n=!1){n||Z("Adding"),await me(),e.apikey=e.apikey||ie();let o=await ee(),i=ce(t,o?.config);w5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await oe(a,e.apikey,["write","all"]);await v5(a,i,n),r||(r=await na(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 p=null,d=null;l&&(0,ia.existsSync)(l)?(p=(0,ia.readFileSync)(l),d=ra(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,ia.existsSync)(lr)?(p=(0,ia.readFileSync)(lr),d=ra(lr)||"image/png",n||f.warn(`Found app icon ${lr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${lr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(p&&d){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,p,{contentType:d});if(D)throw n||console.error(D),n||f.error(`Could not add app ${j(D)}`),new Error(`Could not add app ${j(D)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:y}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(y)throw n||f.error(`Could not add app ${j(y)}`),new Error(`Could not add app ${j(y)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),J("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function FA(t,e){await _g(t,e,void 0)}async function C5(t,e,r=!1,n=!1){r||Z("Deleting"),e.apikey=e.apikey||ie();let o=await ee(),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 oe(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 y=await yr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(y)||y==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${j(c)}`);let{error:p}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);p&&!r&&f.error("Could not delete app logo");let{error:d}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);d&&!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: ${j(h)}`);let m=await sr(a,i);return await be(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"),J("Done \u2705")),!0}async function OA(t,e){return C5(t,e,!1,!1)}var jl=require("node:os"),PA=require("node:process");async function kA(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Kc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function E5(){let t=await Gt(),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 _5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await ee(),n=xr("",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,jl.platform)()} ${(0,jl.version)()}`),f.info(` Node: ${PA.version}`),f.info(" Installed Dependencies:"));let u=await E5();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 kA(u);else{let l=ve();l.start("Running: Loading latest dependencies"),c=await kA(u),l.stop("Latest Dependencies:");for(let p of Object.keys(c))f.info(` ${p}: ${c[p]}`)}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 $A(t){return _5(t)}function S5(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,oa(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 A5(t,e=!1){e||Z("List apps in Capgo"),await me(),t.apikey=t.apikey||ie();let r=await re(t.apikey,t.supaHost,t.supaAnon);await oe(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}`),S5(n),J("Done \u2705")),n}async function IA(t){return A5(t,!1)}var TA=require("node:crypto"),aa=require("node:fs");async function F5(t,e,r=!1){r||Z("Set app"),e.apikey=e.apikey||ie();let n=await ee();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 na(o,["admin","super_admin"])).gid,s=await oe(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 p,d,h=`icon_${(0,TA.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,aa.existsSync)(c)?(p=(0,aa.readFileSync)(c),d=ra(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,aa.existsSync)(lr)?(p=(0,aa.readFileSync)(lr),d=ra(lr)||"image/png",r||f.warn(`Found app icon ${lr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${lr}`),p&&d){let{error:D}=await o.storage.from(`images/org/${a}/${t}`).upload(h,p,{contentType:d});if(D)throw r||f.error(`Could not set app ${j(D)}`),new Error(`Could not set app: ${j(D)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:y}=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(y)throw r||f.error(`Could not set app ${j(y)}`),new Error(`Could not set app: ${j(y)}`);return r||J("Done \u2705"),!0}async function RA(t,e){return F5(t,e)}async function O5(t,e,r=!1){if(r||Z("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 ee(),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 Wi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${j(n)}`),new Error(`Cannot set capacitor config: ${j(n)}`)}r||J("Done \u2705")}async function BA(t,e){return O5(t,e)}var Po=require("node:fs"),$o=require("node:path"),fr=fe(require("node:process"));var ko=require("node:fs/promises"),LA=require("node:os"),Sg=require("node:path"),Ce=require("node:process"),NA=(0,Sg.join)((0,LA.homedir)(),".capgo-credentials"),jA=(0,Sg.join)(NA,"credentials.json");async function sa(t){return(await(0,ko.readFile)(t)).toString("base64")}async function Ml(){try{let t=await(0,ko.readFile)(jA,"utf-8");return JSON.parse(t)}catch{return{}}}async function Os(t){let e=await Ml();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Ul(t){await(0,ko.mkdir)(NA,{recursive:!0}),await(0,ko.writeFile)(jA,JSON.stringify(t,null,2),"utf-8")}function k5(){let t={};return Ce.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Ce.env.BUILD_CERTIFICATE_BASE64),Ce.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Ce.env.BUILD_PROVISION_PROFILE_BASE64),Ce.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Ce.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Ce.env.P12_PASSWORD&&(t.P12_PASSWORD=Ce.env.P12_PASSWORD),Ce.env.APPLE_ID&&(t.APPLE_ID=Ce.env.APPLE_ID),Ce.env.APPLE_APP_SPECIFIC_PASSWORD&&(t.APPLE_APP_SPECIFIC_PASSWORD=Ce.env.APPLE_APP_SPECIFIC_PASSWORD),Ce.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Ce.env.APPLE_KEY_ID),Ce.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Ce.env.APPLE_ISSUER_ID),Ce.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Ce.env.APPLE_KEY_CONTENT),Ce.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Ce.env.APP_STORE_CONNECT_TEAM_ID),Ce.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Ce.env.ANDROID_KEYSTORE_FILE),Ce.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Ce.env.KEYSTORE_KEY_ALIAS),Ce.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Ce.env.KEYSTORE_KEY_PASSWORD),Ce.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Ce.env.KEYSTORE_STORE_PASSWORD),Ce.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Ce.env.PLAY_CONFIG_JSON),t}async function UA(t,e,r){let n=await Os(t),o=k5(),i={...n?.[e]||{}};return Object.assign(i,o),r&&Object.assign(i,r),Object.keys(i).length>0?i:void 0}async function MA(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await sa(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await sa(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await sa(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await sa(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await sa(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await sa(e.PLAY_CONFIG_JSON_PATH))),n}async function qA(t,e,r){let n=await Ml(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Ul(n)}async function ql(t,e){let r=await Ml();if(!t){await Ul({});return}if(!e){delete r[t],await Ul(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Ul(r)}async function HA(t,e){return(await Os(t))?.[e]||null}async function xg(){let t=await Ml();return Object.keys(t)}async function VA(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),fr.default.exit(1));let e=await ee(),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(""),fr.default.exit(1));let n=t.platform;f.info(`
169
169
  \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
170
- `);let n={},o={};if(e==="ios"){if(t.certificate){let a=(0,Po.resolve)(t.certificate);(0,ko.existsSync)(a)||(f.error(`Certificate file not found: ${a}`),lr.default.exit(1)),o.BUILD_CERTIFICATE_FILE=a,f.info(`\u2713 Certificate file: ${a}`)}if(t.provisioningProfile){let a=(0,Po.resolve)(t.provisioningProfile);(0,ko.existsSync)(a)||(f.error(`Provisioning profile not found: ${a}`),lr.default.exit(1)),o.BUILD_PROVISION_PROFILE_FILE=a,f.info(`\u2713 Provisioning profile: ${a}`)}if(t.provisioningProfileProd){let a=(0,Po.resolve)(t.provisioningProfileProd);(0,ko.existsSync)(a)||(f.error(`Production provisioning profile not found: ${a}`),lr.default.exit(1)),o.BUILD_PROVISION_PROFILE_FILE_PROD=a,f.info(`\u2713 Production provisioning profile: ${a}`)}if(t.appleKey){let a=(0,Po.resolve)(t.appleKey);(0,ko.existsSync)(a)||(f.error(`Apple key file not found: ${a}`),lr.default.exit(1)),o.APPLE_KEY_FILE=a,f.info(`\u2713 Apple key file: ${a}`)}t.p12Password&&(n.P12_PASSWORD=t.p12Password),t.appleKeyId&&(n.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(n.APPLE_ISSUER_ID=t.appleIssuerId),t.appleTeamId&&(n.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId),t.appleId&&(n.APPLE_ID=t.appleId),t.appleAppPassword&&(n.APPLE_APP_SPECIFIC_PASSWORD=t.appleAppPassword)}else if(e==="android"){if(t.keystore){let a=(0,Po.resolve)(t.keystore);(0,ko.existsSync)(a)||(f.error(`Keystore file not found: ${a}`),lr.default.exit(1)),o.ANDROID_KEYSTORE_PATH=a,f.info(`\u2713 Keystore file: ${a}`)}if(t.playConfig){let a=(0,Po.resolve)(t.playConfig);(0,ko.existsSync)(a)||(f.error(`Play config file not found: ${a}`),lr.default.exit(1)),o.PLAY_CONFIG_JSON_PATH=a,f.info(`\u2713 Play Store config: ${a}`)}t.keystoreAlias&&(n.KEYSTORE_KEY_ALIAS=t.keystoreAlias),t.keystoreKeyPassword&&(n.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword),t.keystoreStorePassword&&(n.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let i=await U1(e,o,n);await M1(r,e,i),f.success(`
171
- \u2705 ${e.toUpperCase()} credentials saved successfully for ${r}!`),f.info(" Location: ~/.capgo-credentials/credentials.json"),f.info(` Use: npx @capgo/cli build ${r} --platform ${e}
172
- `)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),lr.default.exit(1)}}async function V1(t){try{let e=await xg();if(e.length===0){f.info("No saved credentials found."),f.info("Use: npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>");return}f.info(`
170
+ `);let o={},i={};if(n==="ios"){if(t.certificate){let s=(0,$o.resolve)(t.certificate);(0,Po.existsSync)(s)||(f.error(`Certificate file not found: ${s}`),fr.default.exit(1)),i.BUILD_CERTIFICATE_FILE=s,f.info(`\u2713 Certificate file: ${s}`)}if(t.provisioningProfile){let s=(0,$o.resolve)(t.provisioningProfile);(0,Po.existsSync)(s)||(f.error(`Provisioning profile not found: ${s}`),fr.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=s,f.info(`\u2713 Provisioning profile: ${s}`)}if(t.provisioningProfileProd){let s=(0,$o.resolve)(t.provisioningProfileProd);(0,Po.existsSync)(s)||(f.error(`Production provisioning profile not found: ${s}`),fr.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=s,f.info(`\u2713 Production provisioning profile: ${s}`)}if(t.appleKey){let s=(0,$o.resolve)(t.appleKey);(0,Po.existsSync)(s)||(f.error(`Apple key file not found: ${s}`),fr.default.exit(1)),i.APPLE_KEY_FILE=s,f.info(`\u2713 Apple key file: ${s}`)}t.p12Password&&(o.P12_PASSWORD=t.p12Password),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId),t.appleId&&(o.APPLE_ID=t.appleId),t.appleAppPassword&&(o.APPLE_APP_SPECIFIC_PASSWORD=t.appleAppPassword)}else if(n==="android"){if(t.keystore){let s=(0,$o.resolve)(t.keystore);(0,Po.existsSync)(s)||(f.error(`Keystore file not found: ${s}`),fr.default.exit(1)),i.ANDROID_KEYSTORE_PATH=s,f.info(`\u2713 Keystore file: ${s}`)}if(t.playConfig){let s=(0,$o.resolve)(t.playConfig);(0,Po.existsSync)(s)||(f.error(`Play config file not found: ${s}`),fr.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=s,f.info(`\u2713 Play Store config: ${s}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias),t.keystoreKeyPassword&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword),t.keystoreStorePassword&&(o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await MA(n,i,o);await qA(r,n,a),f.success(`
171
+ \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}
172
+ `)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),fr.default.exit(1)}}async function zA(t){try{let e=await xg();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(`
173
173
  \u{1F4CB} Saved Build Credentials:
174
- `);let r=t?.appId?[t.appId]:e;for(let n of r){let o=await Fs(n);if(o){if(f.info(`
175
- \u{1F539} App: ${n}`),o.ios){f.info(" iOS Credentials:");let i=o.ios;i.BUILD_CERTIFICATE_BASE64&&f.info(" \u2713 Certificate (base64)"),i.BUILD_PROVISION_PROFILE_BASE64&&f.info(" \u2713 Provisioning Profile (base64)"),i.BUILD_PROVISION_PROFILE_BASE64_PROD&&f.info(" \u2713 Production Provisioning Profile (base64)"),i.APPLE_KEY_CONTENT&&f.info(" \u2713 Apple Key Content (base64)"),i.P12_PASSWORD&&f.info(" \u2713 P12 Password: ********"),i.APPLE_KEY_ID&&f.info(` \u2713 Apple Key ID: ${i.APPLE_KEY_ID}`),i.APPLE_ISSUER_ID&&f.info(` \u2713 Apple Issuer ID: ${i.APPLE_ISSUER_ID}`),i.APP_STORE_CONNECT_TEAM_ID&&f.info(` \u2713 Team ID: ${i.APP_STORE_CONNECT_TEAM_ID}`),i.APPLE_ID&&f.info(` \u2713 Apple ID: ${i.APPLE_ID}`),i.APPLE_APP_SPECIFIC_PASSWORD&&f.info(" \u2713 Apple App Password: ********")}if(o.android){f.info(" Android Credentials:");let i=o.android;i.ANDROID_KEYSTORE_FILE&&f.info(" \u2713 Keystore (base64)"),i.PLAY_CONFIG_JSON&&f.info(" \u2713 Play Store Config (base64)"),i.KEYSTORE_KEY_ALIAS&&f.info(` \u2713 Keystore Alias: ${i.KEYSTORE_KEY_ALIAS}`),i.KEYSTORE_KEY_PASSWORD&&f.info(" \u2713 Key Password: ********"),i.KEYSTORE_STORE_PASSWORD&&f.info(" \u2713 Store Password: ********")}}}f.info(`
174
+ `);let r=await ee(),n=t?.appId||ce(void 0,r?.config),o=n?[n]:e;for(let i of o){let a=await Os(i);if(a){if(f.info(`
175
+ \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}`),s.APPLE_ID&&f.info(` \u2713 Apple ID: ${s.APPLE_ID}`),s.APPLE_APP_SPECIFIC_PASSWORD&&f.info(" \u2713 Apple App Password: ********")}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(`
176
176
  Location: ~/.capgo-credentials/credentials.json`),f.info(`
177
177
  \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.
178
- `)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),lr.default.exit(1)}}async function z1(t){try{if(t.appId&&t.platform){if(!await q1(t.appId,t.platform)){f.info(`No ${t.platform.toUpperCase()} credentials found for ${t.appId}.`);return}await Ml(t.appId,t.platform),f.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${t.appId}!`)}else if(t.appId){let e=await Fs(t.appId);if(!e||!e.ios&&!e.android){f.info(`No credentials found for ${t.appId}.`);return}await Ml(t.appId),f.success(`\u2705 All credentials cleared for ${t.appId}!`)}else{if((await xg()).length===0){f.info("No saved credentials found.");return}await Ml(),f.success("\u2705 All credentials cleared for all apps!")}f.info(` Location: ~/.capgo-credentials/credentials.json
179
- `)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),lr.default.exit(1)}}var G1=require("node:child_process"),Rn=require("node:fs/promises"),K1=require("node:os"),$o=require("node:path"),Sg=le(require("node:process"));async function O5(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 p=s.decode(c,{stream:!0}).split(`
180
- `);for(let d of p)if(d.startsWith("data: ")){let h=d.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function k5(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 P5(t,e){return new Promise((r,n)=>{let i=(0,G1.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});i.on("error",a=>{a.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(a)}),i.on("close",a=>{a===0?r():n(new Error(`zip process exited with code ${a}`))})})}async function $5(t,e,r=!1){try{e.apikey=e.apikey||ie(r);let n=await te();if(t=t||n?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let o=(0,$o.resolve)(e.path||Sg.default.cwd()),i=await re(e.apikey,e.supaHost,e.supaAnon);await oe(i,e.apikey,["write","all"]),r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.lane}`),f.info(`Project: ${o}`),f.info(`
178
+ `)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),fr.default.exit(1)}}async function KA(t){try{let e=await ee(),r=t.appId||ce(void 0,e?.config);if(r&&t.platform){if(!await HA(r,t.platform)){f.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await ql(r,t.platform),f.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let n=await Os(r);if(!n||!n.ios&&!n.android){f.info(`No credentials found for ${r}.`);return}await ql(r),f.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await xg()).length===0){f.info("No saved credentials found.");return}await ql(),f.success("\u2705 All credentials cleared for all apps!")}f.info(` Location: ~/.capgo-credentials/credentials.json
179
+ `)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),fr.default.exit(1)}}var GA=require("node:child_process"),Bn=require("node:fs/promises"),WA=require("node:os"),Io=require("node:path"),Ag=fe(require("node:process"));async function P5(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 p=s.decode(c,{stream:!0}).split(`
180
+ `);for(let d of p)if(d.startsWith("data: ")){let h=d.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function $5(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 I5(t,e){return new Promise((r,n)=>{let i=(0,GA.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});i.on("error",a=>{a.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(a)}),i.on("close",a=>{a===0?r():n(new Error(`zip process exited with code ${a}`))})})}async function T5(t,e,r=!1){try{e.apikey=e.apikey||ie(r);let n=await ee();if(t=t||n?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let o=(0,Io.resolve)(e.path||Ag.default.cwd()),i=await re(e.apikey,e.supaHost,e.supaAnon);await oe(i,e.apikey,["write","all"]),r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.platform}`),f.info(`Project: ${o}`),f.info(`
181
181
  \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
182
- `));let a=await L1(t,e.lane,e.credentials),s={app_id:t,platform:e.lane};if(a)s.credentials=a,r||f.info("\u2713 Using credentials (saved + provided)");else throw r||(f.error("\u274C No credentials found for this app and platform"),f.error(""),f.error("You must save credentials before building:"),f.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.lane}`),f.error(""),f.error("Documentation:"),f.error(" https://capgo.app/docs/cli/cloud-build/credentials/#saving-ios-credentials"),f.error(" https://capgo.app/docs/cli/cloud-build/credentials/#saving-android-credentials")),new Error("No credentials found. Please save credentials before building.");r||f.info("Requesting build from Capgo...");let u=e.supaHost||"https://api.capgo.app",c=await fetch(`${u}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(s)});if(!c.ok){let h=await c.text();throw new Error(`Failed to request build: ${c.status} - ${h}`)}let l=await c.json();r||(f.success(`Build job created: ${l.job_id}`),f.info(`Status: ${l.status}`));let p=(0,$o.join)((0,K1.tmpdir)(),`capgo-build-${Date.now()}`);await(0,Rn.mkdir)(p,{recursive:!0});let d=(0,$o.join)(p,`${(0,$o.basename)(o)}.zip`);try{r||f.info(`Zipping project from ${o}...`),await P5(o,d);let h=await(0,Rn.stat)(d),m=(h.size/1024/1024).toFixed(2);r||f.success(`Created zip: ${d} (${m} MB)`),r||f.info("Uploading to builder...");let b=await(0,Rn.readFile)(d),D=await fetch(l.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(h.size)},body:b});if(!D.ok){let _=await D.text();throw new Error(`Upload failed: ${D.status} - ${_}`)}r||f.success("Upload complete!"),r||f.info("Starting build job...");let C=await fetch(`${u}/build/start/${l.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!C.ok){let _=await C.text();throw new Error(`Failed to start build: ${C.status} - ${_}`)}let E=await C.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${l.job_id}`),f.info(`Streaming build logs...
183
- `)),await O5(u,l.job_id,t,e.apikey,r);let g=await k5(u,l.job_id,t,e.lane,e.apikey,r);return r||(g==="succeeded"?f.success("Build completed successfully!"):g==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${g}`)),{success:g==="succeeded",jobId:l.job_id,uploadUrl:l.upload_url,status:g||E.status||l.status}}finally{await(0,Rn.rm)(p,{recursive:!0,force:!0})}}catch(n){let o=n instanceof Error?n.message:String(n);return r||f.error(o),{success:!1,error:o}}}async function W1(t,e){(await $5(t,e,!1)).success||Sg.default.exit(1)}async function Y1(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}: ${L(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${L(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);Z(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ye({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=ve();l.start(`Unlinking channel ${c.name}`);let p=await Ag(t,e,{silent:o});if(!p)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:p.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${L(d)}`),new Error(`Cannot update channel ${c.name}: ${L(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}J(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Ag(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.
184
- ${L(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${L(i)}`)}function J1(t,e){return t.from("channels").insert(e).select().single()}function X1(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function Z1(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function Q1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function eA(t,e,r){return t.from("channels").select(`
182
+ `));let a={};e.buildCertificateBase64&&(a.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(a.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(a.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(a.P12_PASSWORD=e.p12Password),e.appleId&&(a.APPLE_ID=e.appleId),e.appleAppSpecificPassword&&(a.APPLE_APP_SPECIFIC_PASSWORD=e.appleAppSpecificPassword),e.appleKeyId&&(a.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(a.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(a.APPLE_KEY_CONTENT=e.appleKeyContent),e.appStoreConnectTeamId&&(a.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(a.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(a.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias),e.keystoreKeyPassword&&(a.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword),e.keystoreStorePassword&&(a.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(a.PLAY_CONFIG_JSON=e.playConfigJson);let s=await UA(t,e.platform,Object.keys(a).length>0?a:void 0),u={app_id:t,platform:e.platform};if(!s)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-id, --p12-password, etc.)"),f.error(" 2. Environment variables (APPLE_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 c=[];if(e.platform==="ios"){s.BUILD_CERTIFICATE_BASE64||c.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),s.P12_PASSWORD||c.push("P12_PASSWORD (or --p12-password)"),s.BUILD_PROVISION_PROFILE_BASE64||c.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)");let y=s.APPLE_KEY_ID&&s.APPLE_ISSUER_ID&&s.APPLE_KEY_CONTENT&&s.APP_STORE_CONNECT_TEAM_ID,D=s.APPLE_ID&&s.APPLE_APP_SPECIFIC_PASSWORD;!y&&!D&&c.push("Either (APPLE_KEY_ID + APPLE_ISSUER_ID + APPLE_KEY_CONTENT + APP_STORE_CONNECT_TEAM_ID) OR (APPLE_ID + APPLE_APP_SPECIFIC_PASSWORD)")}else e.platform==="android"&&(s.ANDROID_KEYSTORE_FILE||c.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),s.KEYSTORE_KEY_ALIAS||c.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),s.KEYSTORE_KEY_PASSWORD||c.push("KEYSTORE_KEY_PASSWORD (or --keystore-key-password)"),s.KEYSTORE_STORE_PASSWORD||c.push("KEYSTORE_STORE_PASSWORD (or --keystore-store-password)"),!s.PLAY_CONFIG_JSON&&!r&&f.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store"));if(c.length>0){if(!r){f.error(`\u274C Missing required credentials for ${e.platform}:`),f.error("");for(let y of c)f.error(` \u2022 ${y}`);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}: ${c.join(", ")}`)}u.credentials=s,r||f.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||f.info("Requesting build from Capgo...");let l=e.supaHost||"https://api.capgo.app",p=await fetch(`${l}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(u)});if(!p.ok){let y=await p.text();throw new Error(`Failed to request build: ${p.status} - ${y}`)}let d=await p.json();r||(f.success(`Build job created: ${d.job_id}`),f.info(`Status: ${d.status}`));let h=(0,Io.join)((0,WA.tmpdir)(),`capgo-build-${Date.now()}`);await(0,Bn.mkdir)(h,{recursive:!0});let m=(0,Io.join)(h,`${(0,Io.basename)(o)}.zip`);try{r||f.info(`Zipping project from ${o}...`),await I5(o,m);let y=await(0,Bn.stat)(m),D=(y.size/1024/1024).toFixed(2);r||f.success(`Created zip: ${m} (${D} MB)`),r||f.info("Uploading to builder...");let C=await(0,Bn.readFile)(m),E=await fetch(d.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(y.size)},body:C});if(!E.ok){let P=await E.text();throw new Error(`Upload failed: ${E.status} - ${P}`)}r||f.success("Upload complete!"),r||f.info("Starting build job...");let g=await fetch(`${l}/build/start/${d.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!g.ok){let P=await g.text();throw new Error(`Failed to start build: ${g.status} - ${P}`)}let _=await g.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${d.job_id}`),f.info(`Streaming build logs...
183
+ `)),await P5(l,d.job_id,t,e.apikey,r);let S=await $5(l,d.job_id,t,e.platform,e.apikey,r);return r||(S==="succeeded"?f.success("Build completed successfully!"):S==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${S}`)),{success:S==="succeeded",jobId:d.job_id,uploadUrl:d.upload_url,status:S||_.status||d.status}}finally{await(0,Bn.rm)(h,{recursive:!0,force:!0})}}catch(n){let o=n instanceof Error?n.message:String(n);return r||f.error(o),{success:!1,error:o}}}async function YA(t,e){(await T5(t,e,!1)).success||Ag.default.exit(1)}async function JA(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}: ${j(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${j(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);Z(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ye({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=ve();l.start(`Unlinking channel ${c.name}`);let p=await Fg(t,e,{silent:o});if(!p)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:p.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${j(d)}`),new Error(`Cannot update channel ${c.name}: ${j(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}J(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Fg(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.
184
+ ${j(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${j(i)}`)}function XA(t,e){return t.from("channels").insert(e).select().single()}function ZA(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function QA(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function e1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function t1(t,e,r){return t.from("channels").select(`
185
185
  id,
186
186
  version (id, name)
187
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function tA(t,e=!1){if(e)return;let r=new it;r.theme=it.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 rA(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
187
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function r1(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 n1(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
188
188
  id,
189
189
  name,
190
190
  public,
@@ -199,35 +199,35 @@ ${L(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${L(i)}`)}fun
199
199
  created_by,
200
200
  app_id,
201
201
  version (id, name)
202
- `).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: ${L(o)}`);return n}async function Fg(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}: ${L(i)}`)}}async function ql(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await T5(t,e,r,{silent:o});await Y1(t,e,a,{silent:o,autoUnlink:i}),await Fg(t,e,r,{silent:o})}function Hl(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new it;r.theme=it.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,na(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function Vl(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}: ${L(i)}`)}return o??[]}async function nA(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}: ${L(i)}`)}return(o??[]).map(a=>a.version)}async function T5(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?`: ${L(a)}`:""}`)}return i}async function I5(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${na(o.created_at)}`),await ql(e,r,o.name)}function R5(t,e,r){let n=[];for(let o of t??[]){let i=_e(o.name);rp(i,e)&&Vn(i,r)&&n.push(o)}return n}async function B5(t,e,r=!1){r||Z("Cleanup versions in Capgo"),await he(),e.apikey=e.apikey||ie();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=me(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 oe(u,e.apikey,["write","all"]),await Ue(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await Vl(u,t),l=await nA(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=_a(h,"major");r||f.info(`Querying available versions in Capgo between ${br(h)} and ${br(m)}`),c=R5(c,h,m),r||f.info(`Active versions in Capgo between ${br(h)} and ${br(m)}: ${c?.length??0}`)}let p=[],d=0;for(let h of c){let m=l.find(b=>b===h.id);d<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(h.keep="\u274C",p.push(h))}if(!p.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||Hl(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ye({message:"Do you want to continue removing the versions specified?"});if(De(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 I5(p,u,t,r),r||J("Done \u2705"),{removed:p.length,kept:d}}async function oA(t,e){return B5(t,e)}async function j5(t,e,r=!1){r||Z("Check compatibility");let n={...e,apikey:e.apikey||ie()},o=await te(),i=me(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 oe(s,n.apikey,["write","all","read","upload"]),await Ue(s,n.apikey,i,1,r);let u=await Bl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new it;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=it.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",p=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=d,D=Fo(d)?l:p;c.rows.push([h,m,b,D])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function iA(t,e){try{await j5(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${L(r)}`),r}}var an=require("node:fs");var Bn=require("node:buffer"),ht=require("node:crypto"),aA="aes-128-cbc",on="base64",zl=ht.constants.RSA_PKCS1_PADDING;function Gl(t){let e=(0,ht.randomBytes)(16),r=(0,ht.randomBytes)(16),n=e.toString(on),o=(0,ht.privateEncrypt)({key:t,padding:zl},r).toString(on);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function sa(t,e,r){let[n]=r.split(":"),o=Bn.Buffer.from(n,on),i=(0,ht.createCipheriv)(aA,e,o);return i.setAutoPadding(!0),Bn.Buffer.concat([i.update(t),i.final()])}function sA(t,e,r){let[n,o]=e.split(":"),i=(0,ht.publicDecrypt)({key:r,padding:zl},Bn.Buffer.from(o,on)),a=Bn.Buffer.from(n,on),s=(0,ht.createDecipheriv)(aA,i,a);return s.setAutoPadding(!0),Bn.Buffer.concat([s.update(t),s.final()])}function ua(t,e){return(0,ht.privateEncrypt)({key:e,padding:zl},Bn.Buffer.from(t,on)).toString(on)}function uA(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,ht.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 cA(t,e){return(0,ht.publicDecrypt)({key:e,padding:zl},Bn.Buffer.from(t,on)).toString(on)}function N5(t,e){let r=t.key||rn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,an.existsSync)(r)?n=(0,an.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function L5(t,e,r,n=!1){n||Z("Decrypt zip file");try{if(await he(),!(0,an.existsSync)(t)){let p=`Zip not found at the path ${t}`;throw n||f.error(p),new Error(p)}let o=await te();if(!r.key&&!(0,an.existsSync)(rn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let p=`Private Key not found at the path ${rn} or in ${o.path}`;throw n||f.error(p),new Error(p)}let{publicKey:i,fallbackKeyPath:a}=N5(r,o);if(!i){let p=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(p),new Error(p)}let s=(0,an.readFileSync)(t),u=sA(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,an.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let p=await Zr(u,"sha256"),d=cA(r.checksum,r.keyData??i);if(l=p===d,!l){let h=`Checksum does not match ${p} !== ${d}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||J("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${L(o)}`),o instanceof Error?o:new Error(String(o))}}async function lA(t,e,r){await L5(t,e,r,!1)}async function U5(t,e,r,n=!1){n||Z("Delete bundle"),r.apikey=r.apikey||ie();let o=await te();if(e=me(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 oe(i,r.apikey,["write","all"]),await Ue(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`),J("Done")),!0}async function fA(t,e,r){return U5(t,e,r)}var sn=require("node:fs");function Os(t){console.error(L(t))}async function M5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(Z("Encryption"),await he());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,sn.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?Os({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?Os({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Kt,l=r.keyData||"";if(!(0,sn.existsSync)(c)&&!l)throw n||(o?Os({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,sn.existsSync)(c)&&(l=(0,sn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Os({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let p=(0,sn.readFileSync)(t),{sessionKey:d,ivSessionKey:h}=Gl(l),m=sa(p,d,h),b=ua(e,l),D=`${t}_encrypted.zip`;return(0,sn.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}`),J("Done \u2705"))),{checksum:b,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Os(a):f.error(`Error encrypting zip file ${L(a)}`)),a instanceof Error?a:new Error(String(a))}}async function pA(t,e,r){await M5(t,e,r,!1)}async function dA(t,e,r=!1){r||Z("List bundles"),await he(),e.apikey=e.apikey||ie();let n=await te();if(t=me(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 oe(o,e.apikey,["write","all","read","upload"]),await Ue(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await Vl(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),Hl(i),J("Done \u2705")),i}var U2=require("node:crypto"),Mo=require("node:fs"),Qg=require("node:process");var Kl=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 jn(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 d={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return d;d.attributes[h.name]=h.value}return u(/\?>\s*/),d}function n(){let p=u(/^<([\w-:.]+)\s*/);if(!p)return;let d={name:p[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=o();let h;for(;h=n();)d.children.push(h);return u(/^<\/[\w-:.]+>\s*/),d}function o(){let p=u(/^([^<]*)/);return p?s(p[1]):""}function i(){let p=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(p)return{name:p[1],value:s(a(p[2]))}}function a(p){return p.replace(/^['"]|['"]$/g,"")}function s(p){return p.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(p){let d=t.match(p);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(p){return t.startsWith(p)}}var jr=class extends Error{};var wt=class extends jr{},ks=class extends jr{},Wl=class extends jr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Nr=class extends jr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Nn=class extends jr{constructor(){super("accessKey is required")}},ca=class extends jr{constructor(){super("secretKey is required")}},Ps=class extends jr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},un=class extends jr{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 hA(t){try{let r=jn(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 un(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new un(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function mA(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function gA(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 Ln(t){return!(!q5(t)||t.length===0)}function q5(t){return!(typeof t!="string"||t.length>1024)}function $s(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function To(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function kg(t){return t.get("x-amz-version-id")??null}function Io(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 Pg(t){return Io(t).slice(0,8)}function $g(t,e){return`${Pg(e)}/${t}/s3/aws4_request`}async function Yl(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),$s(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var H5=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Jl=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,p=[];super({start(){},async write(d,h){let b=s++;try{if(b==1&&d.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});a={etag:To(E.headers.get("etag")??void 0),versionId:kg(E.headers)};return}b===1&&(u=(await V5({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(d.length)};for(let E of H5){let g=i[E];g&&(D[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:d}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});p.push(C.catch(E=>{l||(l=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(p),l)throw l;c.sort((d,h)=>d.part>h.part?1:-1),a=await z5({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 V5(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=jn(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 z5({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
202
+ `).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: ${j(o)}`);return n}async function Og(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}: ${j(i)}`)}}async function Hl(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await R5(t,e,r,{silent:o});await JA(t,e,a,{silent:o,autoUnlink:i}),await Og(t,e,r,{silent:o})}function Vl(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,oa(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function zl(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}: ${j(i)}`)}return o??[]}async function o1(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}: ${j(i)}`)}return(o??[]).map(a=>a.version)}async function R5(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?`: ${j(a)}`:""}`)}return i}async function B5(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${oa(o.created_at)}`),await Hl(e,r,o.name)}function L5(t,e,r){let n=[];for(let o of t??[]){let i=Se(o.name);np(i,e)&&zn(i,r)&&n.push(o)}return n}async function N5(t,e,r=!1){r||Z("Cleanup versions in Capgo"),await me(),e.apikey=e.apikey||ie();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await ee();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 oe(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 zl(u,t),l=await o1(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=Se(n),m=Sa(h,"major");r||f.info(`Querying available versions in Capgo between ${wr(h)} and ${wr(m)}`),c=L5(c,h,m),r||f.info(`Active versions in Capgo between ${wr(h)} and ${wr(m)}: ${c?.length??0}`)}let p=[],d=0;for(let h of c){let m=l.find(y=>y===h.id);d<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(h.keep="\u274C",p.push(h))}if(!p.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||Vl(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ye({message:"Do you want to continue removing the versions specified?"});if(De(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 B5(p,u,t,r),r||J("Done \u2705"),{removed:p.length,kept:d}}async function i1(t,e){return N5(t,e)}async function j5(t,e,r=!1){r||Z("Check compatibility");let n={...e,apikey:e.apikey||ie()},o=await ee(),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 oe(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Ll(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",p=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:y}=d,D=Oo(d)?l:p;c.rows.push([h,m,y,D])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function a1(t,e){try{await j5(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${j(r)}`),r}}var sn=require("node:fs");var Ln=require("node:buffer"),mt=require("node:crypto"),s1="aes-128-cbc",an="base64",Kl=mt.constants.RSA_PKCS1_PADDING;function Gl(t){let e=(0,mt.randomBytes)(16),r=(0,mt.randomBytes)(16),n=e.toString(an),o=(0,mt.privateEncrypt)({key:t,padding:Kl},r).toString(an);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ua(t,e,r){let[n]=r.split(":"),o=Ln.Buffer.from(n,an),i=(0,mt.createCipheriv)(s1,e,o);return i.setAutoPadding(!0),Ln.Buffer.concat([i.update(t),i.final()])}function u1(t,e,r){let[n,o]=e.split(":"),i=(0,mt.publicDecrypt)({key:r,padding:Kl},Ln.Buffer.from(o,an)),a=Ln.Buffer.from(n,an),s=(0,mt.createDecipheriv)(s1,i,a);return s.setAutoPadding(!0),Ln.Buffer.concat([s.update(t),s.final()])}function ca(t,e){return(0,mt.privateEncrypt)({key:e,padding:Kl},Ln.Buffer.from(t,an)).toString(an)}function c1(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,mt.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 l1(t,e){return(0,mt.publicDecrypt)({key:e,padding:Kl},Ln.Buffer.from(t,an)).toString(an)}function U5(t,e){let r=t.key||nn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,sn.existsSync)(r)?n=(0,sn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function M5(t,e,r,n=!1){n||Z("Decrypt zip file");try{if(await me(),!(0,sn.existsSync)(t)){let p=`Zip not found at the path ${t}`;throw n||f.error(p),new Error(p)}let o=await ee();if(!r.key&&!(0,sn.existsSync)(nn)&&!o.config.plugins?.CapacitorUpdater?.privateKey){let p=`Private Key not found at the path ${nn} or in ${o.path}`;throw n||f.error(p),new Error(p)}let{publicKey:i,fallbackKeyPath:a}=U5(r,o);if(!i){let p=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(p),new Error(p)}let s=(0,sn.readFileSync)(t),u=u1(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,sn.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let p=await Qr(u,"sha256"),d=l1(r.checksum,r.keyData??i);if(l=p===d,!l){let h=`Checksum does not match ${p} !== ${d}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||J("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${j(o)}`),o instanceof Error?o:new Error(String(o))}}async function f1(t,e,r){await M5(t,e,r,!1)}async function q5(t,e,r,n=!1){n||Z("Delete bundle"),r.apikey=r.apikey||ie();let o=await ee();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 oe(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 Hl(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),J("Done")),!0}async function p1(t,e,r){return q5(t,e,r)}var un=require("node:fs");function ks(t){console.error(j(t))}async function H5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(Z("Encryption"),await me());try{let a=await ee(),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,un.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?ks({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?ks({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Wt,l=r.keyData||"";if(!(0,un.existsSync)(c)&&!l)throw n||(o?ks({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,un.existsSync)(c)&&(l=(0,un.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?ks({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let p=(0,un.readFileSync)(t),{sessionKey:d,ivSessionKey:h}=Gl(l),m=ua(p,d,h),y=ca(e,l),D=`${t}_encrypted.zip`;return(0,un.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:y,filename:D,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${y}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${D}`),J("Done \u2705"))),{checksum:y,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?ks(a):f.error(`Error encrypting zip file ${j(a)}`)),a instanceof Error?a:new Error(String(a))}}async function d1(t,e,r){await H5(t,e,r,!1)}async function h1(t,e,r=!1){r||Z("List bundles"),await me(),e.apikey=e.apikey||ie();let n=await ee();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 oe(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 zl(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),Vl(i),J("Done \u2705")),i}var MF=require("node:crypto"),qo=require("node:fs"),eD=require("node:process");var Wl=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 Nn(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 d={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return d;d.attributes[h.name]=h.value}return u(/\?>\s*/),d}function n(){let p=u(/^<([\w-:.]+)\s*/);if(!p)return;let d={name:p[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=o();let h;for(;h=n();)d.children.push(h);return u(/^<\/[\w-:.]+>\s*/),d}function o(){let p=u(/^([^<]*)/);return p?s(p[1]):""}function i(){let p=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(p)return{name:p[1],value:s(a(p[2]))}}function a(p){return p.replace(/^['"]|['"]$/g,"")}function s(p){return p.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(p){let d=t.match(p);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(p){return t.startsWith(p)}}var Nr=class extends Error{};var vt=class extends Nr{},Ps=class extends Nr{},Yl=class extends Nr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},jr=class extends Nr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},jn=class extends Nr{constructor(){super("accessKey is required")}},la=class extends Nr{constructor(){super("secretKey is required")}},$s=class extends Nr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},cn=class extends Nr{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 m1(t){try{let r=Nn(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 cn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new cn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function g1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function D1(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 Un(t){return!(!V5(t)||t.length===0)}function V5(t){return!(typeof t!="string"||t.length>1024)}function Is(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function To(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function Pg(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 $g(t){return Ro(t).slice(0,8)}function Ig(t,e){return`${$g(e)}/${t}/s3/aws4_request`}async function Jl(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Is(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var z5=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Xl=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,p=[];super({start(){},async write(d,h){let y=s++;try{if(y==1&&d.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});a={etag:To(E.headers.get("etag")??void 0),versionId:Pg(E.headers)};return}y===1&&(u=(await K5({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(d.length)};for(let E of z5){let g=i[E];g&&(D[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:d}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:g}),E});p.push(C.catch(E=>{l||(l=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(p),l)throw l;c.sort((d,h)=>d.part>h.part?1:-1),a=await G5({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 K5(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=Nn(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 G5({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
203
203
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
204
204
  ${o.map(p=>` <Part><PartNumber>${p.part}</PartNumber><ETag>${p.etag}</ETag></Part>`).join(`
205
205
  `)}
206
206
  </CompleteMultipartUpload>
207
- `,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=jn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(p=>p.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=kg(a.headers);return{etag:To(c),versionId:l}}var Ts="AWS4-HMAC-SHA256";async function DA(t){if(!t.accessKey)throw new Nn;if(!t.secretKey)throw new ca;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=bA(t.headers),n=wA(t.method,t.path,t.headers,r,e),o=await vA(n,t.date,t.region),i=await Ig(t.date,t.region,t.secretKey),a=Rg(t.accessKey,t.region,t.date),s=$s(await Bo(i,o)).toLowerCase();return`${Ts} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function yA(t){if(!t.accessKey)throw new Nn;if(!t.secretKey)throw new ca;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ps;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=Io(t.date),o=bA(t.headers),i=Rg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Ts),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("/"),p=wA(t.method,c,t.headers,o,a),d=await vA(p,t.date,t.region),h=await Ig(t.date,t.region,t.secretKey),m=$s(await Bo(h,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function bA(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 Ro={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},G5="-._~".split("").map(t=>t.charCodeAt(0));function Tg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Ro.A&&o<=Ro.Z||o>=Ro.a&&o<=Ro.z||o>=Ro[0]&&o<=Ro[9]||G5.includes(o)||o==Ro["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function wA(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 Tg(decodeURIComponent(c))+"="+Tg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Tg(a,!0),s,i.join(`
207
+ `,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=Nn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(p=>p.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=Pg(a.headers);return{etag:To(c),versionId:l}}var Ts="AWS4-HMAC-SHA256";async function y1(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new la;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=w1(t.headers),n=v1(t.method,t.path,t.headers,r,e),o=await C1(n,t.date,t.region),i=await Rg(t.date,t.region,t.secretKey),a=Bg(t.accessKey,t.region,t.date),s=Is(await Lo(i,o)).toLowerCase();return`${Ts} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function b1(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new la;if(t.expirySeconds<1||t.expirySeconds>604800)throw new $s;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=w1(t.headers),i=Bg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Ts),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("/"),p=v1(t.method,c,t.headers,o,a),d=await C1(p,t.date,t.region),h=await Rg(t.date,t.region,t.secretKey),m=Is(await Lo(h,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function w1(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},W5="-._~".split("").map(t=>t.charCodeAt(0));function Tg(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]||W5.includes(o)||o==Bo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function v1(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 Tg(decodeURIComponent(c))+"="+Tg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Tg(a,!0),s,i.join(`
208
208
  `)+`
209
209
  `,n.join(";").toLowerCase(),o].join(`
210
- `)}async function vA(t,e,r){let n=await Yl(t),o=$g(r,e);return[Ts,Io(e),o,n].join(`
211
- `)}async function Ig(t,e,r){let n=Pg(t),o=await Bo("AWS4"+r,n),i=await Bo(o,e),a=await Bo(i,"s3");return await Bo(a,"aws4_request")}function Rg(t,e,r){return`${t}/${$g(e,r)}`}async function Bo(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 CA(t){if(!t.accessKey)throw new Nn;if(!t.secretKey)throw new ca;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ps;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Rg(t.accessKey,t.region,t.date),n=Io(t.date),o={"X-Amz-Algorithm":Ts,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Ts},{"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 Ig(t.date,t.region,t.secretKey),p=$s(await Bo(l,c)).toLowerCase();return o["X-Amz-Signature"]=p,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var K5=["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"],W5=5*1024*1024,Y5=5*1024*1024*1024,Bg=5*1024*1024*1024*1024,Is=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 wt("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 ks(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ks(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!mA(n))throw new wt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new wt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new wt("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 wt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new wt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new wt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!gA(r))throw new Wl(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 Yl(r??new Uint8Array);i.set("x-amz-date",Io(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await DA({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let p=`${this.protocol}//${a}${u}`,d=await fetch(p,{method:e,headers:i,body:r});if(d.status!==c)throw d.status>=400?await hA(d):d.status===301?new un(d.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 un(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Ln(e))throw new Nr(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 un&&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(!Ln(e))throw new Nr(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 Nn;if(!Ln(r))throw new Nr(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 yA({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 wt("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=jn(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),p=[];for(let h of l)p.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))p.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:To(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++;p.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 p)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(!Ln(e))throw new Nr(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(p){p.enqueue(l),p.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 wt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new wt(`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 wt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<W5)throw new wt("Part size should be greater than 5MB");if(s>Y5)throw new wt("Part size should be less than 6MB");let u=new Kl(s),c=new Jl({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=Bg),e>Bg)throw new TypeError(`size should not be more than ${Bg}`);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(!Ln(e))throw new Nr(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 K5)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:To(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Ln(r))throw new Nr(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=jn(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let p=l.children.find(h=>h.name==="ETag")?.content??"",d=l.children.find(h=>h.name==="LastModified")?.content;if(d===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:To(p),lastModified:new Date(d),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 un&&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(!Ln(e))throw new Nr(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 CA({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 jo=require("node:fs"),Xl=require("node:path");function J5(t,e){return(0,jo.readFileSync)(t,"utf8").includes(e)}function Rs(t,e){let r=(0,jo.readdirSync)(t);for(let n of r){let o=(0,Xl.join)(t,n),i=(0,jo.statSync)(o);if(i.isDirectory()){if(Rs(o,e))return!0}else if(i.isFile()&&(0,Xl.extname)(o)===".js"&&J5(o,e))return!0}return!1}function Zl(t){return(0,jo.readdirSync)(t).indexOf("index.html")>-1}var pa=require("node:fs"),P2=require("node:os"),Uo=require("node:path"),$2=require("node:process"),sf=require("node:stream/consumers"),T2=require("node:zlib");var I2=le(k2()),R2=le(Xh());async function f9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var p9=8192,B2="6.25.0",j2="7.0.35";async function d9(t){let e=yt((0,$2.cwd)()),r=await nn("@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=n.major===6&&mn(n,_e(B2)),i=n.major>=7&&mn(n,_e(j2)),a=o||i;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:a}}function h9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:I2.isMatch(t,r)}async function m9(t,e,r){let o=(0,pa.statSync)(t).size,i=await(0,sf.buffer)((0,pa.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(h9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<p9)return{buffer:i,useBrotli:!1};try{let a=await(0,sf.buffer)((0,pa.createReadStream)(t).pipe((0,T2.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 N2(t,e,r,n,o,i){let a=ve();a.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let s=await w1(t);if(o==="v2")for(let u of s)u.hash=ua(u.hash,i);return a.stop("Manifest generated successfully"),await be(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),s}function g9(t){return(0,P2.platform)()!=="win32"?t:Uo.win32.normalize(t).split(Uo.win32.sep).join(Uo.posix.sep)}function D9(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 L2(t,e,r,n,o,i,a){let s=ve();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await ir(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:p,supportsBrotliV2:d}=await d9(a);if(d)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 (${p||"unknown"}). To use Delta updates, please upgrade to version ${B2} (v6) or ${j2} (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,D=0;try{s.message(`Uploading ${b} files using TUS protocol`);let C=async P=>{let k=(0,Uo.join)(r,P.file),B=g9(P.file),R,N=!1;if(a.disableBrotli)R=await(0,sf.buffer)((0,pa.createReadStream)(k)),N=!1;else{let $=await m9(k,B,a);R=$.buffer,N=$.useBrotli}let F=R;i&&(F=sa(R,i.sessionKey,i.ivSessionKey));let U=B;N&&(U=`${B}.br`,D++);let M=D9(U),Q=`orgs/${o}/apps/${n}/delta/${P.hash}_${M}`;return await f9(c,Q)?(m++,Promise.resolve({file_name:M,s3_path:Q,file_hash:P.hash})):new Promise(($,y)=>{s.message(`Prepare upload partial file: ${B}`),new R2.Upload(F,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:Q},headers:{Authorization:t},onError:v=>{let A=v.toString(),I;try{let q=A.match(/response text: (\{.*?\})/);q&&q[1]&&(I=JSON.parse(q[1]).moreInfo?.requestId)}catch{}let O=I?` [requestId: ${I}]`:"";f.error(`Failed to upload ${B}: ${A}${O}`),y(v)},onProgress(){let v=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${v}%`)},onSuccess(){m++,$({file_name:M,s3_path:Q,file_hash:P.hash})}}).start()})},E=500,g=[];for(let P=0;P<e.length;P+=E){let k=e.slice(P,P+E),B=Math.floor(P/E)+1,R=Math.ceil(e.length/E);R>1&&s.message(`Processing batch ${B}/${R} (${k.length} files)`);let N=await Promise.all(k.map(F=>C(F)));g.push(...N)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&f.info(`${D} of ${b} files were compressed with brotli and use .br extension`),await be(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 be(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},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 ge(t){throw f.error(t),new Error(t)}async function y9(t,e){let r=xr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,U2.randomUUID)().split("-")[0]}`;return Qi.test(n)||ge(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function b9(t){let e=t.apikey||ie();return e||ge("Missing API key, you need to provide an API key to upload your bundle"),e}function w9(t,e,r){let n=me(t,r),o=e.path||r?.webDir;return n||ge("Missing argument, you need to provide a appid or be in a capacitor project"),o||ge("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Mo.existsSync)(o)||ge(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function v9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Rs(e,"notifyAppReady")||ge(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
212
- If you are sure your app has this code, you can use the --no-code-check option`),Zl(e)||ge(`index.html is missing in the root folder of ${e}`))}async function C9(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(),p=!!c&&c.disable_auto_update==="version_number",d,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=ve();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Bl(t,o,n,r.packageJson,r.nodeModules);if(h=C,d=E,h.find(g=>!Fo(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||!Qi.test(g))&&ge("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{ge(`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`),d=await vg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));p&&!u&&!a&&ge("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Qi.test(u)||ge(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.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,C])=>({name:D,version:C.version})):void 0,minUpdateVersion:u}}async function E9(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`),J("Bundle version already exists - exiting gracefully \u{1F389}"),!0;ge(`Version ${r} already exists ${L(i)}`)}return!1}async function _9(t,e,r,n,o,i,a){let s,u,c="",l=null,p="none",d="",h=e.keyV2,m=e.key===!1,b=ve();b.start(`Zipping bundle from ${t}`),l=await Il(t),b.message("Calculating checksum");let D=yt((0,Qg.cwd)()),C=await nn("@capgo/capacitor-updater",D,e.packageJson),E=!1,g;try{g=C?_e(C):void 0}catch{g=void 0}if(C?g?E=mn(g,_e("6.25.0")):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):ge("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,Mo.existsSync)(Kt))&&!m||E?c=await Zr(l,"sha256"):c=await Zr(l,"crc32"),b.stop(`Checksum ${E?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,Mo.existsSync)(Kt)||e.keyDataV2)&&!e.oldEncryption){let P=typeof h=="string"?h:Kt,k=e.keyDataV2||"";!k&&!(0,Mo.existsSync)(P)&&ge(`Cannot find private key ${P}`),await be(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),k||(k=(0,Mo.readFileSync)(P).toString()),f.info("Encrypting your bundle with V2");let{sessionKey:B,ivSessionKey:R}=Gl(k),N=sa(l,B,R);c=ua(c,k),s=R,u=B,p="v2",d=k,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
210
+ `)}async function C1(t,e,r){let n=await Jl(t),o=Ig(r,e);return[Ts,Ro(e),o,n].join(`
211
+ `)}async function Rg(t,e,r){let n=$g(t),o=await Lo("AWS4"+r,n),i=await Lo(o,e),a=await Lo(i,"s3");return await Lo(a,"aws4_request")}function Bg(t,e,r){return`${t}/${Ig(e,r)}`}async function Lo(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 E1(t){if(!t.accessKey)throw new jn;if(!t.secretKey)throw new la;if(t.expirySeconds<1||t.expirySeconds>604800)throw new $s;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Bg(t.accessKey,t.region,t.date),n=Ro(t.date),o={"X-Amz-Algorithm":Ts,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Ts},{"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 Rg(t.date,t.region,t.secretKey),p=Is(await Lo(l,c)).toLowerCase();return o["X-Amz-Signature"]=p,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var Y5=["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"],J5=5*1024*1024,X5=5*1024*1024*1024,Lg=5*1024*1024*1024*1024,Rs=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 vt("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 Ps(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ps(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!g1(n))throw new vt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new vt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new vt("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 vt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new vt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new vt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!D1(r))throw new Yl(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 Jl(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 y1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let p=`${this.protocol}//${a}${u}`,d=await fetch(p,{method:e,headers:i,body:r});if(d.status!==c)throw d.status>=400?await m1(d):d.status===301?new cn(d.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 cn(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Un(e))throw new jr(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 cn&&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(!Un(e))throw new jr(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 jn;if(!Un(r))throw new jr(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 b1({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 vt("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=Nn(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),p=[];for(let h of l)p.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))p.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:To(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++;p.sort((h,m)=>{let y=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return y>D?1:y<D?-1:0});for(let h of p)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(!Un(e))throw new jr(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(p){p.enqueue(l),p.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 vt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new vt(`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 vt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<J5)throw new vt("Part size should be greater than 5MB");if(s>X5)throw new vt("Part size should be less than 6MB");let u=new Wl(s),c=new Xl({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=Lg),e>Lg)throw new TypeError(`size should not be more than ${Lg}`);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(!Un(e))throw new jr(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 Y5)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:To(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Un(r))throw new jr(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=Nn(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let p=l.children.find(h=>h.name==="ETag")?.content??"",d=l.children.find(h=>h.name==="LastModified")?.content;if(d===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:To(p),lastModified:new Date(d),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 cn&&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(!Un(e))throw new jr(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 E1({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 No=require("node:fs"),Zl=require("node:path");function Z5(t,e){return(0,No.readFileSync)(t,"utf8").includes(e)}function Bs(t,e){let r=(0,No.readdirSync)(t);for(let n of r){let o=(0,Zl.join)(t,n),i=(0,No.statSync)(o);if(i.isDirectory()){if(Bs(o,e))return!0}else if(i.isFile()&&(0,Zl.extname)(o)===".js"&&Z5(o,e))return!0}return!1}function Ql(t){return(0,No.readdirSync)(t).indexOf("index.html")>-1}var da=require("node:fs"),$F=require("node:os"),Mo=require("node:path"),IF=require("node:process"),uf=require("node:stream/consumers"),TF=require("node:zlib");var RF=fe(PF()),BF=fe(Zh());async function d9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var h9=8192,LF="6.25.0",NF="7.0.35";async function m9(t){let e=bt((0,IF.cwd)()),r=await on("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?Se(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=n.major===6&&gn(n,Se(LF)),i=n.major>=7&&gn(n,Se(NF)),a=o||i;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:a}}function g9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:RF.isMatch(t,r)}async function D9(t,e,r){let o=(0,da.statSync)(t).size,i=await(0,uf.buffer)((0,da.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(g9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<h9)return{buffer:i,useBrotli:!1};try{let a=await(0,uf.buffer)((0,da.createReadStream)(t).pipe((0,TF.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 jF(t,e,r,n,o,i){let a=ve();a.start(o!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let s=await vA(t);if(o==="v2")for(let u of s)u.hash=ca(u.hash,i);return a.stop("Manifest generated successfully"),await be(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),s}function y9(t){return(0,$F.platform)()!=="win32"?t:Mo.win32.normalize(t).split(Mo.win32.sep).join(Mo.posix.sep)}function b9(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 UF(t,e,r,n,o,i,a){let s=ve();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await ar(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:p,supportsBrotliV2:d}=await m9(a);if(d)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 (${p||"unknown"}). To use Delta updates, please upgrade to version ${LF} (v6) or ${NF} (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,y=e.length,D=0;try{s.message(`Uploading ${y} files using TUS protocol`);let C=async P=>{let k=(0,Mo.join)(r,P.file),B=y9(P.file),R,N=!1;if(a.disableBrotli)R=await(0,uf.buffer)((0,da.createReadStream)(k)),N=!1;else{let $=await D9(k,B,a);R=$.buffer,N=$.useBrotli}let F=R;i&&(F=ua(R,i.sessionKey,i.ivSessionKey));let U=B;N&&(U=`${B}.br`,D++);let M=b9(U),Q=`orgs/${o}/apps/${n}/delta/${P.hash}_${M}`;return await d9(c,Q)?(m++,Promise.resolve({file_name:M,s3_path:Q,file_hash:P.hash})):new Promise(($,b)=>{s.message(`Prepare upload partial file: ${B}`),new BF.Upload(F,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:Q},headers:{Authorization:t},onError:v=>{let A=v.toString(),T;try{let q=A.match(/response text: (\{.*?\})/);q&&q[1]&&(T=JSON.parse(q[1]).moreInfo?.requestId)}catch{}let O=T?` [requestId: ${T}]`:"";f.error(`Failed to upload ${B}: ${A}${O}`),b(v)},onProgress(){let v=(m/y*100).toFixed(2);s.message(`Uploading partial update: ${v}%`)},onSuccess(){m++,$({file_name:M,s3_path:Q,file_hash:P.hash})}}).start()})},E=500,g=[];for(let P=0;P<e.length;P+=E){let k=e.slice(P,P+E),B=Math.floor(P/E)+1,R=Math.ceil(e.length/E);R>1&&s.message(`Processing batch ${B}/${R} (${k.length} files)`);let N=await Promise.all(k.map(F=>C(F)));g.push(...N)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&f.info(`${D} of ${y} files were compressed with brotli and use .br extension`),await be(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 be(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},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 ge(t){throw f.error(t),new Error(t)}async function w9(t,e){let r=xr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,MF.randomUUID)().split("-")[0]}`;return ea.test(n)||ge(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function v9(t){let e=t.apikey||ie();return e||ge("Missing API key, you need to provide an API key to upload your bundle"),e}function C9(t,e,r){let n=ce(t,r),o=e.path||r?.webDir;return n||ge("Missing argument, you need to provide a appid or be in a capacitor project"),o||ge("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,qo.existsSync)(o)||ge(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function E9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Bs(e,"notifyAppReady")||ge(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
212
+ If you are sure your app has this code, you can use the --no-code-check option`),Ql(e)||ge(`index.html is missing in the root folder of ${e}`))}async function _9(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(),p=!!c&&c.disable_auto_update==="version_number",d,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let D=ve();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Ll(t,o,n,r.packageJson,r.nodeModules);if(h=C,d=E,h.find(g=>!Oo(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||!ea.test(g))&&ge("Invalid remote min update version, skipping auto setting compatibility"),u=g,D.stop(`Auto set min-update-version to ${u}`)}catch{ge(`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`),d=await Cg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));p&&!u&&!a&&ge("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ea.test(u)||ge(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.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,C])=>({name:D,version:C.version})):void 0,minUpdateVersion:u}}async function S9(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`),J("Bundle version already exists - exiting gracefully \u{1F389}"),!0;ge(`Version ${r} already exists ${j(i)}`)}return!1}async function x9(t,e,r,n,o,i,a){let s,u,c="",l=null,p="none",d="",h=e.keyV2,m=e.key===!1,y=ve();y.start(`Zipping bundle from ${t}`),l=await Rl(t),y.message("Calculating checksum");let D=bt((0,eD.cwd)()),C=await on("@capgo/capacitor-updater",D,e.packageJson),E=!1,g;try{g=C?Se(C):void 0}catch{g=void 0}if(C?g?E=gn(g,Se("6.25.0")):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):ge("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,qo.existsSync)(Wt))&&!m||E?c=await Qr(l,"sha256"):c=await Qr(l,"crc32"),y.stop(`Checksum ${E?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,qo.existsSync)(Wt)||e.keyDataV2)&&!e.oldEncryption){let P=typeof h=="string"?h:Wt,k=e.keyDataV2||"";!k&&!(0,qo.existsSync)(P)&&ge(`Cannot find private key ${P}`),await be(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),k||(k=(0,qo.readFileSync)(P).toString()),f.info("Encrypting your bundle with V2");let{sessionKey:B,ivSessionKey:R}=Gl(k),N=ua(l,B,R);c=ca(c,k),s=R,u=B,p="v2",d=k,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
213
213
  keep it safe, you will need it to decrypt your bundle.
214
214
  It will be also visible in your dashboard
215
215
  `),l=N}let _=Math.floor((l?.byteLength??0)/1024/1024),S=Math.floor(i/1024/1024);return l?.byteLength>i?ge(`The bundle size is ${_} Mb, this is greater than the maximum upload length ${S} Mb, please reduce the size of your bundle`):l?.byteLength>a?(f.warn(`WARNING !!
216
216
  The bundle size is ${_} Mb, this may take a while to download for users
217
217
  `),f.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
218
- `),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: ${S} MB`),f.info("[Verbose] Sending 'App Too Large' event to analytics...")),await be(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:p,finalKeyData:d}}async function x9(t,e,r,n,o,i,a,s){let u=ve();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
219
- Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await ir();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 v1(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 ${L(b)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${L(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 y1(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||mg}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let b=new AbortController,D=setTimeout(()=>b.abort(),a.timeout||mg);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(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+)/),C=D?D[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: ${L(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${L(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${L(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await C1(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${d} 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 be(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:d},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function S9(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 ${L(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 ${L(a)}`);return}f.info("Linked bundle deleted")}async function A9(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||ge("Cannot get version id, cannot set channel");let{data:p}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(p){let{error:d,data:h}=await Rl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});d&&ge(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${L(d)}`);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 F9(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 eD(t,e,r=!1){r||Z(`Uploading with CLI version ${mr.version}`);let n,o=Qe();await he();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:p}=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 d=b9(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 c1();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}=w9(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${b}, Build path: ${D}`);let C=await y9(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await As({version:C}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),v9(e,D),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${b}@${C} started from path "${D}" to Capgo cloud`);let _=await ir();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 S=await re(d,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let P=await oe(S,d,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${P}`);let k=e.channel||await F9(b,S,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${k}`);let B=await ar(S,b);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await d1(S,B,mr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await m1(S,B,d,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 ${k}...`);let{nativePackages:R,minUpdateVersion:N}=await C9(S,o,e,k,b,C);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${R?R.length:0}`),f.info(` - Min update version: ${N||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${C} already exists...`);let F=await E9(S,b,C,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${F?"yes (skipping)":"no (continuing)"}`),F)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&ge(`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 U={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:N,native_packages:R,owner_org:B,user_id:P,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,Q="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await be(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),U.session_key=e.ivSessionKey,U.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:A,ivSessionKey:I,checksum:O,sessionKey:q,encryptionMethod:T,finalKeyData:j}=await _9(D,e,d,B,b,m.maxUploadLength,m.alertUploadSize);U.session_key=I,U.checksum=O,n=q,M=A,g=T,Q=j,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((A?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${O}`),f.info(` - Encryption: ${T}`),f.info(` - IV Session Key: ${I?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await x1(S,b,k,O),e.verbose&&f.info("[Verbose] Checksum is unique"))}if(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"&&ge("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let A=yt((0,Qg.cwd)()),I=await nn("@capgo/capacitor-updater",A,e.packageJson),O;try{O=I?_e(I):void 0}catch{O=void 0}I&&O&&mn(O,_e("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${O} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let $=e.delta?await N2(D,d,B,b,e.encryptPartial?g:"none",Q):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${$.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:y}=await wg(S,U);if(y&&ge(`Cannot add bundle ${L(y)}`),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||p)){(!u||!c||!i||!a||!s||!l)&&ge("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: ${p?"enabled":"disabled"}`));let A=p?`https://${c}`:`http://${c}`,I=new Is({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),O=`${b}-${C}`,q=encodeURIComponent(O);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${O}`),await I.putObject(O,Uint8Array.from(M)),U.external_url=`${A}/${q}`,U.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${U.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await x9(d,S,b,C,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let A=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let O=U.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:U.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${$.length}`),f.info(` - Encryption: ${O?"enabled":"disabled"}`)),A=e.delta?await L2(d,$,D,b,B,O,e):null,e.verbose&&A&&f.info(`[Verbose] Delta upload complete with ${A.length} files`)}catch(O){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw O;f.info(`Failed to upload partial files to capgo cloud. Error: ${L(O)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${L(O)}`)}U.storage_provider="r2",U.manifest=A,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:I}=await wg(S,U);I&&ge(`Cannot update bundle ${L(I)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let w=await Ue(S,d,b,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${ea(w,2)?"yes":"no"}`),f.info(` - Write: ${ea(w,3)?"yes":"no"}`),f.info(` - Admin: ${ea(w,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ea(w,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${k}...`),await S9(S,b,k)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),ea(w,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${C} to channel ${k}...`),await A9(S,d,!!e.bundleUrl,C,k,P,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 be(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let v={success:!0,bundle:C,checksum:U.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof U.session_key=="string"?U.session_key:void 0,storageProvider:U.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${v.bundle}`),f.info(` - Checksum: ${v.checksum}`),f.info(` - Encryption: ${v.encryptionMethod}`),f.info(` - Storage: ${v.storageProvider}`)),r&&!v.skipped&&J("Time to share your update to the world \u{1F30D}"),v}function O9(t){t.ivSessionKey&&!t.external&&ge("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&ge("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&&ge("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&ge("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&ge("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&ge("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&ge("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&ge("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)&&ge("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&ge("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&ge("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function M2(t,e){try{O9(e),await eD(t,e)}catch(r){throw f.error(`uploadBundle failed: ${L(r)}`),r instanceof Error?r:new Error(String(r))}}var q2=require("node:crypto"),uf=require("node:fs"),H2=require("node:process");var k9=20;function P9(t){console.log(JSON.stringify(t,null,2))}function Us(t){console.error(L(t))}async function $9(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await he();let s=await te(),u=me(t,s?.config),c=(0,q2.randomUUID)().split("-")[0],l=xr("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&Z(`Zipping ${u}@${o}`),o&&!Qi.test(o)){let P=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Us({error:"invalid_semver"}):f.error(P)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let P="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Us({error:"missing_argument"}):f.error(P)),new Error(P)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Rs(i,"notifyAppReady"))throw r||(n?Us({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(!Zl(i))throw r||(n?Us({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 d=await Il(i);a&&f.info(`Zipped ${d.byteLength} bytes`);let h=a?ve():null;h&&h.start("Calculating checksum");let m=yt((0,H2.cwd)()),b=await nn("@capgo/capacitor-updater",m,e.packageJson);if(!b){let P="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn(P),new Error(P)}let D=!1,C;try{C=b?_e(b):void 0}catch{C=void 0}if(C){let P=C.major===6&&mn(C,_e("6.25.0")),k=C.major>=7;D=P||k}else b==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await Zr(d,e.keyV2||(0,uf.existsSync)(Kt)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(d.byteLength/1024/1024);g>k9&&a&&(f.warn(`WARNING !!
218
+ `),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: ${S} MB`),f.info("[Verbose] Sending 'App Too Large' event to analytics...")),await be(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:p,finalKeyData:d}}async function A9(t,e,r,n,o,i,a,s){let u=ve();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
219
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await ar();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 CA(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:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return f.error(`Cannot finish TUS upload ${j(y)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${j(y)}`),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 bA(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||gg}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let y=new AbortController,D=setTimeout(()=>y.abort(),a.timeout||gg);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(D)}a.verbose&&f.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),a.verbose&&(f.info(`[Verbose] Upload failed after ${y} 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+)/),C=D?D[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: ${j(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${j(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${j(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await EA(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${d} 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 be(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:d},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function F9(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 ${j(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 ${j(a)}`);return}f.info("Linked bundle deleted")}async function O9(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||ge("Cannot get version id, cannot set channel");let{data:p}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(p){let{error:d,data:h}=await Bl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});d&&ge(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${j(d)}`);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 k9(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 tD(t,e,r=!1){r||Z(`Uploading with CLI version ${gr.version}`);let n,o=et();await me();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:p}=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 d=v9(e);e.verbose&&f.info("[Verbose] API key retrieved successfully");let h=await ee();e.verbose&&f.info("[Verbose] Capacitor config loaded successfully");let m=await lA();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:y,path:D}=C9(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${y}, Build path: ${D}`);let C=await w9(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Fs({version:C}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),E9(e,D),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${y}@${C} started from path "${D}" to Capgo cloud`);let _=await ar();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 S=await re(d,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let P=await oe(S,d,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${P}`);let k=e.channel||await k9(y,S,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${k}`);let B=await sr(S,y);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await hA(S,B,gr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await gA(S,B,d,y,!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 ${k}...`);let{nativePackages:R,minUpdateVersion:N}=await _9(S,o,e,k,y,C);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${R?R.length:0}`),f.info(` - Min update version: ${N||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${C} already exists...`);let F=await S9(S,y,C,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${F?"yes (skipping)":"no (continuing)"}`),F)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&ge(`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 U={name:C,app_id:y,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:N,native_packages:R,owner_org:B,user_id:P,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,Q="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await be(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":y},notify:!1},e.verbose),U.session_key=e.ivSessionKey,U.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:A,ivSessionKey:T,checksum:O,sessionKey:q,encryptionMethod:I,finalKeyData:L}=await x9(D,e,d,B,y,m.maxUploadLength,m.alertUploadSize);U.session_key=T,U.checksum=O,n=q,M=A,g=I,Q=L,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((A?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${O}`),f.info(` - Encryption: ${I}`),f.info(` - IV Session Key: ${T?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await xA(S,y,k,O),e.verbose&&f.info("[Verbose] Checksum is unique"))}if(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"&&ge("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&g==="v2"&&!e.encryptPartial){let A=bt((0,eD.cwd)()),T=await on("@capgo/capacitor-updater",A,e.packageJson),O;try{O=T?Se(T):void 0}catch{O=void 0}T&&O&&gn(O,Se("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${O} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let $=e.delta?await jF(D,d,B,y,e.encryptPartial?g:"none",Q):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${$.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:b}=await vg(S,U);if(b&&ge(`Cannot add bundle ${j(b)}`),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||p)){(!u||!c||!i||!a||!s||!l)&&ge("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: ${p?"enabled":"disabled"}`));let A=p?`https://${c}`:`http://${c}`,T=new Rs({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),O=`${y}-${C}`,q=encodeURIComponent(O);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${O}`),await T.putObject(O,Uint8Array.from(M)),U.external_url=`${A}/${q}`,U.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${U.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await A9(d,S,y,C,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let A=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let O=U.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:U.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${$.length}`),f.info(` - Encryption: ${O?"enabled":"disabled"}`)),A=e.delta?await UF(d,$,D,y,B,O,e):null,e.verbose&&A&&f.info(`[Verbose] Delta upload complete with ${A.length} files`)}catch(O){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw O;f.info(`Failed to upload partial files to capgo cloud. Error: ${j(O)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${j(O)}`)}U.storage_provider="r2",U.manifest=A,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:T}=await vg(S,U);T&&ge(`Cannot update bundle ${j(T)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let w=await Me(S,d,y,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${ta(w,2)?"yes":"no"}`),f.info(` - Write: ${ta(w,3)?"yes":"no"}`),f.info(` - Admin: ${ta(w,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ta(w,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${k}...`),await F9(S,y,k)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),ta(w,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${C} to channel ${k}...`),await O9(S,d,!!e.bundleUrl,C,k,P,B,y,_,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 be(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":y},notify:!1},e.verbose);let v={success:!0,bundle:C,checksum:U.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof U.session_key=="string"?U.session_key:void 0,storageProvider:U.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${v.bundle}`),f.info(` - Checksum: ${v.checksum}`),f.info(` - Encryption: ${v.encryptionMethod}`),f.info(` - Storage: ${v.storageProvider}`)),r&&!v.skipped&&J("Time to share your update to the world \u{1F30D}"),v}function P9(t){t.ivSessionKey&&!t.external&&ge("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&ge("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&&ge("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&ge("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&ge("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&ge("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&ge("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&ge("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)&&ge("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&ge("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&ge("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function qF(t,e){try{P9(e),await tD(t,e)}catch(r){throw f.error(`uploadBundle failed: ${j(r)}`),r instanceof Error?r:new Error(String(r))}}var HF=require("node:crypto"),cf=require("node:fs"),VF=require("node:process");var $9=20;function I9(t){console.log(JSON.stringify(t,null,2))}function Ms(t){console.error(j(t))}async function T9(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await me();let s=await ee(),u=ce(t,s?.config),c=(0,HF.randomUUID)().split("-")[0],l=xr("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&Z(`Zipping ${u}@${o}`),o&&!ea.test(o)){let P=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Ms({error:"invalid_semver"}):f.error(P)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let P="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Ms({error:"missing_argument"}):f.error(P)),new Error(P)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Bs(i,"notifyAppReady"))throw r||(n?Ms({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(!Ql(i))throw r||(n?Ms({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 d=await Rl(i);a&&f.info(`Zipped ${d.byteLength} bytes`);let h=a?ve():null;h&&h.start("Calculating checksum");let m=bt((0,VF.cwd)()),y=await on("@capgo/capacitor-updater",m,e.packageJson);if(!y){let P="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn(P),new Error(P)}let D=!1,C;try{C=y?Se(y):void 0}catch{C=void 0}if(C){let P=C.major===6&&gn(C,Se("6.25.0")),k=C.major>=7;D=P||k}else y==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await Qr(d,e.keyV2||(0,cf.existsSync)(Wt)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(d.byteLength/1024/1024);g>$9&&a&&(f.warn(`WARNING !!
220
220
  The bundle size is ${g} Mb, this may take a while to download for users
221
221
  `),f.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
222
- `));let _=a?ve():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,uf.writeFileSync)(S,d),_&&_.stop(`Saved to ${S}`),a&&J("Done \u2705"),!r&&n&&P9({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Us(s):f.error(L(s))),s instanceof Error?s:new Error(String(s))}}async function V2(t,e){await $9(t,e,!1)}async function tD(t,e,r,n=!1){n||Z("Create channel"),r.apikey=r.apikey||ie();let o=await te().catch(()=>{});if(e=me(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 oe(i,r.apikey,["write","all"]),await Ue(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await Ag(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 ar(i,e),u=await oe(i,r.apikey,["write","all"]),c=await J1(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}
223
- ${L(c.error)}`),new Error(`Cannot create channel: ${L(c.error)}`);return await be(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"),J("Done \u2705")),c.data??!0}async function z2(t,e,r){await tD(t,e,r,!1)}async function T9(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&Z("List current bundle"),r.apikey=r.apikey||ie(o);let i=await te();if(e=me(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 oe(a,r.apikey,["write","all","read"]),await Ue(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 G2(t,e,r){return T9(t,e,r)}async function I9(t,e,r,n=!1){n||Z("Delete channel"),r.apikey=r.apikey||ie();let o=await te();if(e=me(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 oe(i,r.apikey,["all"]);if(await Ue(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await eA(i,e,t);d?.name&&!n&&f.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await Fg(i,e,d.name)}let{data:s,error:u}=await Z1(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 Q1(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${L(c)}`),new Error(`Cannot delete channel devices: ${L(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await X1(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${L(l.error)}`),new Error(`Cannot delete channel: ${L(l.error)}`);let p=await ar(i,e);return await be(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:p,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),J("Done \u2705")),!0}async function K2(t,e,r){return I9(t,e,r,!1)}async function R9(t,e,r=!1){r||Z("List channels"),e.apikey=e.apikey||ie();let n=await te();if(t=me(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 oe(o,e.apikey,["write","all","read","upload"]);await Ue(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await rA(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),tA(a)),await be(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||J("Done \u2705"),a}async function W2(t,e){return R9(t,e,!1)}var Y2=["major","minor","metadata","patch","none"];async function B9(t,e,r,n=!1){n||Z("Set channel"),r.apikey=r.apikey||ie();let o=await te();if(e=me(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 oe(i,r.apikey,["write","all"]);await Ue(i,r.apikey,e,4,n);let s=await ar(i,e),{bundle:u,state:c,downgrade:l,latest:p,latestRemote:d,ios:h,android:m,selfAssign:b,disableAutoUpdate:D,dev:C,emulator:E}=r;if(p&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&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(d&&p)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&&p==null&&d==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&D==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await h1(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 S=p?o?.config?.plugins?.CapacitorUpdater?.version||xr("",r.packageJson):u;if(S!=null){let{data:k,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",a).eq("deleted",!1).single();if(B||!k)throw n||f.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:N}=await Cg(i,e,t,k.native_packages??[]),F=Qe();if(N.length>0&&R.some(U=>!Fo(U)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(N.length===0&&R.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 @${S}`),g.version=k.id}if(d){let{data:k,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||!k)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await Cg(i,e,t,k.native_packages??[]),N=Qe();if(R.some(F=>!Fo(F)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${N.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${k.name}`),g.version=k.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),D!=null){let k=D.toLowerCase();if(!Y2.includes(k))throw n||f.error(`Channel strategy ${k} is not known. The possible values are: ${Y2.join(", ")}.`),new Error(`Unknown channel strategy ${k}`);k==="metadata"&&(k="version_number"),g.disable_auto_update=k,n||f.info(`Set ${e} channel: ${t} to ${k} disable update strategy to this channel`)}let{error:P}=await Rl(i,g);if(P)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 be(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||J("Done \u2705"),!0}async function J2(t,e,r){return B9(t,e,r,!1)}var Mr=require("node:fs");function rD(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 X2(t="./README.md",e){let r=nt.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,p=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(d=>({flags:d.flags,description:d.description||""})),subcommands:[],hasAction:p,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 p=i?"###":"##",d="",h=rD(u);s&&!i||(d+=`${p} <a id="${l}"></a> ${h} **${c}**
222
+ `));let _=a?ve():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,cf.writeFileSync)(S,d),_&&_.stop(`Saved to ${S}`),a&&J("Done \u2705"),!r&&n&&I9({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Ms(s):f.error(j(s))),s instanceof Error?s:new Error(String(s))}}async function zF(t,e){await T9(t,e,!1)}async function rD(t,e,r,n=!1){n||Z("Create channel"),r.apikey=r.apikey||ie();let o=await ee().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 oe(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 Fg(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 sr(i,e),u=await oe(i,r.apikey,["write","all"]),c=await XA(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}
223
+ ${j(c.error)}`),new Error(`Cannot create channel: ${j(c.error)}`);return await be(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"),J("Done \u2705")),c.data??!0}async function KF(t,e,r){await rD(t,e,r,!1)}async function R9(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&Z("List current bundle"),r.apikey=r.apikey||ie(o);let i=await ee();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 oe(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 GF(t,e,r){return R9(t,e,r)}async function B9(t,e,r,n=!1){n||Z("Delete channel"),r.apikey=r.apikey||ie();let o=await ee();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 oe(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 d=await t1(i,e,t);d?.name&&!n&&f.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await Og(i,e,d.name)}let{data:s,error:u}=await QA(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 e1(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${j(c)}`),new Error(`Cannot delete channel devices: ${j(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await ZA(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${j(l.error)}`),new Error(`Cannot delete channel: ${j(l.error)}`);let p=await sr(i,e);return await be(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:p,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),J("Done \u2705")),!0}async function WF(t,e,r){return B9(t,e,r,!1)}async function L9(t,e,r=!1){r||Z("List channels"),e.apikey=e.apikey||ie();let n=await ee();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 oe(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 n1(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),r1(a)),await be(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||J("Done \u2705"),a}async function YF(t,e){return L9(t,e,!1)}var JF=["major","minor","metadata","patch","none"];async function N9(t,e,r,n=!1){n||Z("Set channel"),r.apikey=r.apikey||ie();let o=await ee();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 oe(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await sr(i,e),{bundle:u,state:c,downgrade:l,latest:p,latestRemote:d,ios:h,android:m,selfAssign:y,disableAutoUpdate:D,dev:C,emulator:E}=r;if(p&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&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(d&&p)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&&p==null&&d==null&&l==null&&h==null&&m==null&&y==null&&C==null&&E==null&&D==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await mA(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 S=p?o?.config?.plugins?.CapacitorUpdater?.version||xr("",r.packageJson):u;if(S!=null){let{data:k,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",S).eq("user_id",a).eq("deleted",!1).single();if(B||!k)throw n||f.error(`Cannot find version ${S}`),new Error(`Cannot find version ${S}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:R,localDependencies:N}=await Eg(i,e,t,k.native_packages??[]),F=et();if(N.length>0&&R.some(U=>!Oo(U)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${F.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(N.length===0&&R.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 @${S}`),g.version=k.id}if(d){let{data:k,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||!k)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:R}=await Eg(i,e,t,k.native_packages??[]),N=et();if(R.some(F=>!Oo(F)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${N.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${k.name}`),g.version=k.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),y!=null&&(n||f.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!y),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),D!=null){let k=D.toLowerCase();if(!JF.includes(k))throw n||f.error(`Channel strategy ${k} is not known. The possible values are: ${JF.join(", ")}.`),new Error(`Unknown channel strategy ${k}`);k==="metadata"&&(k="version_number"),g.disable_auto_update=k,n||f.info(`Set ${e} channel: ${t} to ${k} disable update strategy to this channel`)}let{error:P}=await Bl(i,g);if(P)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 be(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||J("Done \u2705"),!0}async function XF(t,e,r){return N9(t,e,r,!1)}var qr=require("node:fs");function nD(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 ZF(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,p=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(d=>({flags:d.flags,description:d.description||""})),subcommands:[],hasAction:p,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 p=i?"###":"##",d="",h=nD(u);s&&!i||(d+=`${p} <a id="${l}"></a> ${h} **${c}**
224
224
 
225
225
  `),o.alias&&(d+=`**Alias:** \`${o.alias}\`
226
226
 
227
227
  `),o.isCommandGroup||(d+="```bash\n",i?d+=`npx @capgo/cli@latest ${a} ${u}
228
228
  `:d+=`npx @capgo/cli@latest ${u}
229
229
  `,d+="```\n\n");let m=o.description.split(`
230
- `),b=!i&&s?1:0;for(let C=b;C<m.length;C++){let E=m[C];E.trim().startsWith("Note:")?d+=`> \u2139\uFE0F ${E.trim().substring(5).trim()}
230
+ `),y=!i&&s?1:0;for(let C=y;C<m.length;C++){let E=m[C];E.trim().startsWith("Note:")?d+=`> \u2139\uFE0F ${E.trim().substring(5).trim()}
231
231
 
232
232
  `:E.includes("Example:")||E.trim()&&(d+=`${E}
233
233
  `)}d+=`
@@ -243,8 +243,8 @@ ${L(c.error)}`),new Error(`Cannot create channel: ${L(c.error)}`);return await b
243
243
  `,d+=`| -------------- | ------------- | -------------------- |
244
244
  `;for(let C of o.options){let E=C.flags.split(" ")[0],g=C.flags.split(" ").length>1?"string":"boolean";d+=`| **${E}** | <code>${g}</code> | ${C.description} |
245
245
  `}d+=`
246
- `}return d};if(e){(0,Mr.existsSync)(e)||(0,Mr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
247
- title: ${rD(o.name)} ${o.name}
246
+ `}return d};if(e){(0,qr.existsSync)(e)||(0,qr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
247
+ title: ${nD(o.name)} ${o.name}
248
248
  description: ${o.description.split(`
249
249
  `)[0]}
250
250
  sidebar_label: ${o.name}
@@ -255,154 +255,154 @@ sidebar:
255
255
  `,s=o.description.split(`
256
256
  `)[0];a+=`${s}
257
257
 
258
- `;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,Mr.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
258
+ `;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,qr.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
259
259
 
260
260
  `;o+=`## \u{1F4CB} Table of Contents
261
261
 
262
- `;for(let l of r){if(l.name==="generate-docs")continue;let p=rD(l.name);if(o+=`- ${p} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
262
+ `;for(let l of r){if(l.name==="generate-docs")continue;let p=nD(l.name);if(o+=`- ${p} [${l.name.charAt(0).toUpperCase()+l.name.slice(1)}](#${l.name})
263
263
  `,l.subcommands.length>0)for(let d of l.subcommands)o+=` - [${d.name.charAt(0).toUpperCase()+d.name.slice(1)}](#${l.name}-${d.name})
264
264
  `}o+=`
265
265
  `;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:
266
266
 
267
267
  `);for(let p of l.subcommands)o+=n(p,!0,l.name)}o+=`
268
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Mr.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),p=s.substring(c),d=`${l}
268
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,qr.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),p=s.substring(c),d=`${l}
269
269
  ${o}
270
- ${p}`;(0,Mr.writeFileSync)(t,d,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Mr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var ma=require("node:child_process"),$e=require("node:fs"),Un=require("node:path"),Ce=require("node:process");var pf=le(mF());var $t=require("node:fs");function gF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function n7(t,e=!1){e||Z("Save keys \u{1F511}");let r=await te(),n=t.key||rn,o=t.keyData||"";if(!(0,$t.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,$t.existsSync)(n)&&(o=(0,$t.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=gF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({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 Ki(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 o7(t,e=!1){e||Z("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Ki(r),(0,$t.existsSync)(Zi))try{(0,$t.unlinkSync)(Zi),e||f.success(`Old private key file deleted: ${Zi}`)}catch(o){e||f.error(`Failed to delete old private key file: ${Zi} (${String(o)})`)}if((0,$t.existsSync)(Pl))try{(0,$t.unlinkSync)(Pl),e||f.success(`Old public key file deleted: ${Pl}`)}catch(o){e||f.error(`Failed to delete old public key file: ${rn} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),J("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function DF(t){await he(),await n7(t,!1)}async function sD(t,e=!1){e||Z("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=uA();if((0,$t.existsSync)(rn)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,$t.writeFileSync)(rn,r),(0,$t.existsSync)(Kt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,$t.writeFileSync)(Kt,n);let o=await te();if(o){let i=gF(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({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 Ki(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Kt}`),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 jl(),J("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function yF(t){await he(),await sD(t,!1)}async function bF(t){await he(),await o7(t,!1)}var fn=require("node:fs"),uD=require("node:os");function wF(){let t=(0,uD.homedir)();return(0,fn.existsSync)(`${t}/.capgo`)||(0,fn.existsSync)(".capgo")}async function cD(t,e,r=!1){if(r||Z("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 he();let{local:n}=e;if(n){if(!(0,fn.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,fn.writeFileSync)(".capgo",`${t}
271
- `),(0,fn.appendFileSync)(".gitignore",`.capgo
272
- `)}else{let a=(0,uD.homedir)();(0,fn.writeFileSync)(`${a}/.capgo`,`${t}
273
- `)}let o=await re(t,e.supaHost,e.supaAnon),i=await oe(o,t,["write","all","upload"]);await be(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`),J("Done \u2705"))}async function vF(t,e){await cD(t,e,!1)}var CF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",ff="CapacitorUpdater.notifyAppReady()",i7=/import.*from.*/g,Ms="production",lD={stdio:"pipe"},qs,Mn;function EF(){qs??=(0,$e.readdirSync)(pf.default.tmpdir).map(t=>({name:t,full:`${pf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??pf.default.fileSync({prefix:"capgocli"}).name}function pr(t,e){try{EF(),(0,$e.writeFileSync)(qs,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Mn})),e&&(Mn=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
274
- ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!")}}async function a7(t,e){try{EF();let r=(0,$e.readFileSync)(qs,"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 ye({message:"Would you like to continue from where you left off?"});return await qt(i,t,e),i?(o&&(Mn=o),n):void 0}catch(r){f.error(`Cannot read which steps have been completed, error:
275
- ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!");return}}function s7(){if(qs)try{(0,$e.rmSync)(qs)}catch(t){f.error(`Cannot delete the tmp steps file.
276
- Error: ${t}`)}}async function qt(t,e,r){De(t)&&(await or("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ce.exit)())}async function dr(t,e,r,n){return or("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function u7(t,e,r,n){let o=Qe(),i=await ye({message:`Add ${r} in Capgo?`});if(await qt(i,t.gid,e),i){let a=ve();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await Eg(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 dr(t.gid,e,"add-app",r)}async function c7(t,e,r){let n=Qe(),o=await ye({message:`Create default channel ${Ms} for ${r} in Capgo?`});if(await qt(o,t,e),o){let i=ve();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${Ms} ${r} --default`),await tD(Ms,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 ${Ms} ${r} --default"`);await dr(t,e,"add-channel",r)}async function l7(t){let e=(0,Un.join)(yt((0,Ce.cwd)()),Br),r=Mn?await Gt(void 0,Mn):await Gt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){f.warn("No adequate dependencies found");let n=await ye({message:"Would you like to select the package.json file manually?"});if(De(n)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)),n){let o=await ye({message:"Would you like to use a tree selector to choose the package.json file?"});if(De(o)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)),o){let a=(0,Ce.cwd)(),s=Br;for(;;){let u=(0,$e.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await Dr({message:"Select package.json file:",options:u}),De(s)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)),!(0,$e.statSync)((0,Un.join)(a,s)).isDirectory()&&s!==Br){f.error("Selected a file that is not a package.json file");continue}if(a=(0,Un.join)(a,s),s===Br)break}return await pr(t,a),{dependencies:await Gt(void 0,a),path:a}}let i=await gr({message:"Enter path to node_modules folder:"});return De(i)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)),(0,$e.existsSync)(i)||(f.error(`Path ${i} does not exist`),(0,Ce.exit)(1)),{dependencies:await Gt(void 0,i),path:i}}}return await pr(t,e),{dependencies:await Gt(void 0,e),path:e}}var f7="https://capacitorjs.com/docs/updating/6-0",p7="https://capacitorjs.com/docs/updating/7-0";async function d7(t,e,r){let n=Qe(),o="1.0.0",i=!1,a=await ye({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await qt(a,t,e),a){let s=ve(),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"),J("Bye \u{1F44B}"),(0,Ce.exit)());let p=c.get("@capacitor/core");if(p||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),J("Bye \u{1F44B}"),(0,Ce.exit)()),p==="latest"?(s.stop(`@capacitor/core version is ${p}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),J("Bye \u{1F44B}"),(0,Ce.exit)()):Vn(_e(p),_e("6.0.0"))?(s.stop("Error"),f.warn(`@capacitor/core version is ${p}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${f7}`),J("Bye \u{1F44B}"),(0,Ce.exit)()):Vn(_e(p),_e("7.0.0"))&&(s.stop(`@capacitor/core version is ${p}, update to Capacitor v7 minimum: ${p7} 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"),J("Bye \u{1F44B}"),(0,Ce.exit)()),await nn("@capgo/capacitor-updater",l.replace("/package.json",""),l))s.stop("Capgo already installed \u2705");else{await(0,ma.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...lD,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=xr(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await ye({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 qt(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await Dg("SplashScreen",{launchAutoHide:!1}),await As({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 dr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function h7(t,e,r){let n=await ye({message:`Automatic Add "${ff}" code and import in ${r}?`});if(await qt(n,t,e),n){let o=ve();o.start("Adding @capacitor-updater to your main file");let i=await Tl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Un.join)("plugins");(0,$e.existsSync)(a)||(0,$e.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Un.join)(a,"capacitorUpdater.client.ts"):s=(0,Un.join)(a,"capacitorUpdater.client.js");let u=`
270
+ ${p}`;(0,qr.writeFileSync)(t,d,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,qr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var ga=require("node:child_process"),Ie=require("node:fs"),Mn=require("node:path"),Ee=require("node:process");var df=fe(g2());var It=require("node:fs");function D2(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function i7(t,e=!1){e||Z("Save keys \u{1F511}");let r=await ee(),n=t.key||nn,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=D2(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({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 Wi(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 a7(t,e=!1){e||Z("Deleting old private key \u{1F5D1}\uFE0F");let r=await ee(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Wi(r),(0,It.existsSync)(Qi))try{(0,It.unlinkSync)(Qi),e||f.success(`Old private key file deleted: ${Qi}`)}catch(o){e||f.error(`Failed to delete old private key file: ${Qi} (${String(o)})`)}if((0,It.existsSync)($l))try{(0,It.unlinkSync)($l),e||f.success(`Old public key file deleted: ${$l}`)}catch(o){e||f.error(`Failed to delete old public key file: ${nn} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),J("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function y2(t){await me(),await i7(t,!1)}async function uD(t,e=!1){e||Z("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=c1();if((0,It.existsSync)(nn)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,It.writeFileSync)(nn,r),(0,It.existsSync)(Wt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,It.writeFileSync)(Wt,n);let o=await ee();if(o){let i=D2(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ye({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 Wi(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Wt}`),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 Nl(),J("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function b2(t){await me(),await uD(t,!1)}async function w2(t){await me(),await a7(t,!1)}var pn=require("node:fs"),cD=require("node:os");function v2(){let t=(0,cD.homedir)();return(0,pn.existsSync)(`${t}/.capgo`)||(0,pn.existsSync)(".capgo")}async function lD(t,e,r=!1){if(r||Z("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 me();let{local:n}=e;if(n){if(!(0,pn.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,pn.writeFileSync)(".capgo",`${t}
271
+ `),(0,pn.appendFileSync)(".gitignore",`.capgo
272
+ `)}else{let a=(0,cD.homedir)();(0,pn.writeFileSync)(`${a}/.capgo`,`${t}
273
+ `)}let o=await re(t,e.supaHost,e.supaAnon),i=await oe(o,t,["write","all","upload"]);await be(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`),J("Done \u2705"))}async function C2(t,e){await lD(t,e,!1)}var E2="import { CapacitorUpdater } from '@capgo/capacitor-updater'",pf="CapacitorUpdater.notifyAppReady()",s7=/import.*from.*/g,qs="production",fD={stdio:"pipe"},Hs,qn;function _2(){Hs??=(0,Ie.readdirSync)(df.default.tmpdir).map(t=>({name:t,full:`${df.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??df.default.fileSync({prefix:"capgocli"}).name}function dr(t,e){try{_2(),(0,Ie.writeFileSync)(Hs,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:qn})),e&&(qn=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
274
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!")}}async function u7(t,e){try{_2();let r=(0,Ie.readFileSync)(Hs,"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 ye({message:"Would you like to continue from where you left off?"});return await Ht(i,t,e),i?(o&&(qn=o),n):void 0}catch(r){f.error(`Cannot read which steps have been completed, error:
275
+ ${r}`),f.warn("Onboarding will continue but please report it to the capgo team!");return}}function c7(){if(Hs)try{(0,Ie.rmSync)(Hs)}catch(t){f.error(`Cannot delete the tmp steps file.
276
+ Error: ${t}`)}}async function Ht(t,e,r){De(t)&&(await ir("onboarding-v2",e,r,"canceled","\u{1F937}"),(0,Ee.exit)())}async function hr(t,e,r,n){return ir("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function l7(t,e,r,n){let o=et(),i=await ye({message:`Add ${r} in Capgo?`});if(await Ht(i,t.gid,e),i){let a=ve();a.start(`Running: ${o.runner} @capgo/cli@latest app add ${r}`),await _g(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 hr(t.gid,e,"add-app",r)}async function f7(t,e,r){let n=et(),o=await ye({message:`Create default channel ${qs} for ${r} in Capgo?`});if(await Ht(o,t,e),o){let i=ve();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${qs} ${r} --default`),await rD(qs,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 ${qs} ${r} --default"`);await hr(t,e,"add-channel",r)}async function p7(t){let e=(0,Mn.join)(bt((0,Ee.cwd)()),Lr),r=qn?await Gt(void 0,qn):await Gt(void 0,e);if(r.size===0||!r.has("@capacitor/core")){f.warn("No adequate dependencies found");let n=await ye({message:"Would you like to select the package.json file manually?"});if(De(n)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)),n){let o=await ye({message:"Would you like to use a tree selector to choose the package.json file?"});if(De(o)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)),o){let a=(0,Ee.cwd)(),s=Lr;for(;;){let u=(0,Ie.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await yr({message:"Select package.json file:",options:u}),De(s)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)),!(0,Ie.statSync)((0,Mn.join)(a,s)).isDirectory()&&s!==Lr){f.error("Selected a file that is not a package.json file");continue}if(a=(0,Mn.join)(a,s),s===Lr)break}return await dr(t,a),{dependencies:await Gt(void 0,a),path:a}}let i=await Dr({message:"Enter path to node_modules folder:"});return De(i)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)),(0,Ie.existsSync)(i)||(f.error(`Path ${i} does not exist`),(0,Ee.exit)(1)),{dependencies:await Gt(void 0,i),path:i}}}return await dr(t,e),{dependencies:await Gt(void 0,e),path:e}}var d7="https://capacitorjs.com/docs/updating/6-0",h7="https://capacitorjs.com/docs/updating/7-0";async function m7(t,e,r){let n=et(),o="1.0.0",i=!1,a=await ye({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Ht(a,t,e),a){let s=ve(),u="latest",{dependencies:c,path:l}=await p7(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"),J("Bye \u{1F44B}"),(0,Ee.exit)());let p=c.get("@capacitor/core");if(p||(s.stop("Error"),f.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),J("Bye \u{1F44B}"),(0,Ee.exit)()),p==="latest"?(s.stop(`@capacitor/core version is ${p}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),J("Bye \u{1F44B}"),(0,Ee.exit)()):zn(Se(p),Se("6.0.0"))?(s.stop("Error"),f.warn(`@capacitor/core version is ${p}, Capgo only support 2 last Capacitor versions, please update to Capacitor v6 minimum: ${d7}`),J("Bye \u{1F44B}"),(0,Ee.exit)()):zn(Se(p),Se("7.0.0"))&&(s.stop(`@capacitor/core version is ${p}, update to Capacitor v7 minimum: ${h7} 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"),J("Bye \u{1F44B}"),(0,Ee.exit)()),await on("@capgo/capacitor-updater",l.replace("/package.json",""),l))s.stop("Capgo already installed \u2705");else{await(0,ga.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...fD,cwd:l.replace("/package.json","")}),s.stop("Install Done \u2705"),o=xr(void 0,l)||"1.0.0";let h=!1;u==="latest"&&(h=await ye({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 Ht(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await yg("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 hr(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function g7(t,e,r){let n=await ye({message:`Automatic Add "${pf}" code and import in ${r}?`});if(await Ht(n,t,e),n){let o=ve();o.start("Adding @capacitor-updater to your main file");let i=await Tl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Mn.join)("plugins");(0,Ie.existsSync)(a)||(0,Ie.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Mn.join)(a,"capacitorUpdater.client.ts"):s=(0,Mn.join)(a,"capacitorUpdater.client.js");let u=`
277
277
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
278
278
 
279
279
  export default defineNuxtPlugin(() => {
280
280
  CapacitorUpdater.notifyAppReady()
281
281
  })
282
- `;(0,$e.existsSync)(s)?(0,$e.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,$e.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,$e.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 D1();else{let p=i.endsWith("-ts");a=await g1(i,p)}if(!a||!(0,$e.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let p=await gr({message:"Provide the correct relative path to your main file (JS or TS):",validate:d=>{if(!(0,$e.existsSync)(d))return"File does not exist. Please provide a valid path."}});De(p)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)),a=p}let u=(0,$e.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/"),J("Bye \u{1F44B}"),(0,Ce.exit)()),u.includes(ff))o.stop(`Code already added to ${a} \u2705`);else{let p=u.replace(l,`${l}
283
- ${CF};
282
+ `;(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 yA();else{let p=i.endsWith("-ts");a=await DA(i,p)}if(!a||!(0,Ie.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let p=await Dr({message:"Provide the correct relative path to your main file (JS or TS):",validate:d=>{if(!(0,Ie.existsSync)(d))return"File does not exist. Please provide a valid path."}});De(p)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)),a=p}let u=(0,Ie.readFileSync)(a,"utf8").toString(),l=u.match(s7)?.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/"),J("Bye \u{1F44B}"),(0,Ee.exit)()),u.includes(pf))o.stop(`Code already added to ${a} \u2705`);else{let p=u.replace(l,`${l}
283
+ ${E2};
284
284
 
285
- ${ff};
286
- `);(0,$e.writeFileSync)(a,p,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await dr(t,e,"add-code",r)}else f.info(`Add to your main file the following code:
285
+ ${pf};
286
+ `);(0,Ie.writeFileSync)(a,p,"utf8"),o.stop(`Code added to ${a} \u2705`)}}await hr(t,e,"add-code",r)}else f.info(`Add to your main file the following code:
287
287
 
288
- ${CF};
288
+ ${E2};
289
289
 
290
- ${ff};
291
- `)}async function m7(t,e,r){let o=(await Gt()).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=Qe(),a=await ye({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await qt(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&&Vn(_e(o),_e("6.0.0"))){f.warn("Encryption is not supported in Capacitor V5.");return}let s=ve();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await sD({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),f.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,Ce.exit)(1));try{await jl(!0,t,e),or("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await dr(t,e,"add-encryption",r)}async function g7(t,e,r){let n=Qe(),o=await ye({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await qt(o,t,e),o){let i=ve();i.start("Checking project type");let a=await Tl(),s=await bg(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),gg()[s]||(i.stop("Error"),f.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,ma.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,lD),i.stop("Build & Sync Done \u2705")}else f.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await dr(t,e,"build-project",r)}async function D7(t,e,r){let n=Qe(),o=await ye({message:`Run ${r} in device now to test the initial version?`});if(await qt(o,t,e),o){let i=await Dr({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});De(i)&&(J("Bye \u{1F44B}"),(0,Ce.exit)());let a=i,s=ve();s.start(`Running: ${n.runner} cap run ${a}`),await(0,ma.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 dr(t,e,"run-device",r)}async function y7(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 Dr({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(De(o)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),o==="auto"){let l=ve();l.start("Making automatic changes to test Capgo updates");let p=!1,d=["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 d)if((0,$e.existsSync)(h)&&!p)try{let m=(0,$e.readFileSync)(h,"utf8"),b=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(b=m.replace("<body>",`<body>
290
+ ${pf};
291
+ `)}async function D7(t,e,r){let o=(await Gt()).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 ye({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await Ht(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&&zn(Se(o),Se("6.0.0"))){f.warn("Encryption is not supported in Capacitor V5.");return}let s=ve();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await uD({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),f.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,Ee.exit)(1));try{await Nl(!0,t,e),ir("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await hr(t,e,"add-encryption",r)}async function y7(t,e,r){let n=et(),o=await ye({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await Ht(o,t,e),o){let i=ve();i.start("Checking project type");let a=await Tl(),s=await wg(a);i.message(`Running: ${n.pm} run ${s} && ${n.runner} cap sync`),Dg()[s]||(i.stop("Error"),f.warn(`Cannot find ${s} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ee.exit)()),(0,ga.execSync)(`${n.pm} run ${s} && ${n.runner} cap sync`,fD),i.stop("Build & Sync Done \u2705")}else f.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await hr(t,e,"build-project",r)}async function b7(t,e,r){let n=et(),o=await ye({message:`Run ${r} in device now to test the initial version?`});if(await Ht(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"}]});De(i)&&(J("Bye \u{1F44B}"),(0,Ee.exit)());let a=i,s=ve();s.start(`Running: ${n.runner} cap run ${a}`),await(0,ga.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 hr(t,e,"run-device",r)}async function w7(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(De(o)&&(await ir("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)()),o==="auto"){let l=ve();l.start("Making automatic changes to test Capgo updates");let p=!1,d=["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 d)if((0,Ie.existsSync)(h)&&!p)try{let m=(0,Ie.readFileSync)(h,"utf8"),y=m;if(h.endsWith(".html")?m.includes("<body>")&&!m.includes("capgo-test-banner")&&(y=m.replace("<body>",`<body>
292
292
  <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));">
293
293
  \u{1F680} Capgo Update Test - This banner shows the update worked!
294
294
  </div>
295
295
  <style>
296
296
  body { padding-top: calc(60px + env(safe-area-inset-top, 0)) !important; }
297
- </style>`)):h.endsWith(".vue")?m.includes("<template>")&&!m.includes("capgo-test-vue")&&(b=m.replace("<template>",`<template>
297
+ </style>`)):h.endsWith(".vue")?m.includes("<template>")&&!m.includes("capgo-test-vue")&&(y=m.replace("<template>",`<template>
298
298
  <div class="capgo-test-vue" style="background: linear-gradient(90deg, #4CAF50, #2196F3); color: white; padding: 15px; text-align: center; font-weight: bold; margin-bottom: 20px; padding-top: calc(15px + env(safe-area-inset-top, 0)); padding-left: calc(15px + env(safe-area-inset-left, 0)); padding-right: calc(15px + env(safe-area-inset-right, 0));">
299
299
  \u{1F680} Capgo Update Test - Vue component updated!
300
- </div>`)):h.endsWith(".css")&&(m.includes("capgo-test-background")||(b=`/* Capgo test modification - background change */
300
+ </div>`)):h.endsWith(".css")&&(m.includes("capgo-test-background")||(y=`/* Capgo test modification - background change */
301
301
  body {
302
302
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
303
303
  /* capgo-test-background */
304
304
  }
305
305
 
306
- ${m}`)),b!==m){(0,$e.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"),p=!0;break}}catch{}if(!p){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 ye({message:"Continue after making your changes?"});await qt(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 ye({message:"Have you made your changes and ready to continue?"});await qt(l,t,e)}let i="1.0.1";try{let l=_e(n);i=br(_a(l,"patch"))}catch{i="1.0.1"}let a=await Dr({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"}]});De(a)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)());let s=n;if(a==="auto")try{let l=_e(n);s=br(_a(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 gr({message:`Current version is ${n}. Enter new version:`,validate:p=>{if(!p.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});De(l)&&(await or("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ce.exit)()),s=l}let u=Qe(),c=await ye({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 qt(c,t,e),c){let l=ve();l.start("Checking project type");let p=await Tl(),d=await bg(p);l.message(`Running: ${u.pm} run ${d} && ${u.runner} cap sync`),gg()[d]||(l.stop("Error"),f.warn(`Cannot find ${d} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ce.exit)()),(0,ma.execSync)(`${u.pm} run ${d} && ${u.runner} cap sync`,lD),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 dr(t,e,"add-code-change",r),s}async function b7(t,e,r,n,o){let i=Qe(),a=await ye({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await qt(a,t,e),a){let s=ve(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=s1((0,Ce.cwd)());Mn&&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,Un.join)(yt((0,Ce.cwd)()),"node_modules"),f.warn(`Guessed node modules path at: ${u}`),(0,$e.existsSync)(u)||(f.error("Node modules path does not exist, upload skipped"),J("Bye \u{1F44B}"),(0,Ce.exit)(1))),(await eD(r,{channel:Ms,apikey:e,packageJson:c?Mn: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"),J("Bye \u{1F44B}"),(0,Ce.exit)())}else f.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await dr(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 ye({message:"Monitor Capgo logs to verify the update worked?"});await qt(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 Zh("onboarding-v2",e,r,e,t)):f.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await dr(t,e,"test-update",r)}async function _F(t,e,r){let n=Qe();Z("Capgo onboarding \u{1F6EB}"),await he();let o=!r.supaAnon||!r.supaHost?await te():await As({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 ir();e=me(e,o?.config),r.apikey=t||ie(),e===void 0&&(e=await gr({message:"Enter your appId:"}),De(e)&&(Hn("Operation cancelled."),(0,Ce.exit)(1)));let a=ve();(!wF()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await cD(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await oe(s,r.apikey,["upload","all","read","write"]);let u=await ra(s,["admin","super_admin"]),c=u.gid,l=await a7(c,r.apikey)??0,p=xr(void 0,Mn)||"1.0.0",d=!1,h=p;try{if(l<1&&await dr(c,r.apikey,"add-app",e),l<2&&(await u7(u,r.apikey,e,r),pr(2)),l<3&&(await c7(c,r.apikey,e),pr(3)),l<4){let m=await d7(c,r.apikey,e);p=m.pkgVersion,h=p,d=m.delta,pr(4)}l<5&&(await h7(c,r.apikey,e),pr(5)),l<6&&(await m7(c,r.apikey,e),pr(6)),l<7&&(await g7(c,r.apikey,e),pr(7)),l<8&&(await D7(c,r.apikey,e),pr(8)),l<9&&(h=await y7(c,r.apikey,e,p),pr(9)),l<10&&(await b7(c,r.apikey,e,h,d),pr(10)),l<11&&(await w7(c,r.apikey,e,i.hostWeb,d),pr(11)),await dr(c,r.apikey,"done",e),s7()}catch(m){console.error(m),f.error(`Error during onboarding.
306
+ ${m}`)),y!==m){(0,Ie.writeFileSync)(h,y,"utf8"),l.stop(`\u2705 Made test changes to ${h}`),f.info("\u{1F4DD} Added visible test modification to verify the update works"),p=!0;break}}catch{}if(!p){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 ye({message:"Continue after making your changes?"});await Ht(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 ye({message:"Have you made your changes and ready to continue?"});await Ht(l,t,e)}let i="1.0.1";try{let l=Se(n);i=wr(Sa(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"}]});De(a)&&(await ir("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)());let s=n;if(a==="auto")try{let l=Se(n);s=wr(Sa(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:p=>{if(!p.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});De(l)&&(await ir("onboarding-v2",t,e,"canceled","\u{1F937}"),(0,Ee.exit)()),s=l}let u=et(),c=await ye({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 Ht(c,t,e),c){let l=ve();l.start("Checking project type");let p=await Tl(),d=await wg(p);l.message(`Running: ${u.pm} run ${d} && ${u.runner} cap sync`),Dg()[d]||(l.stop("Error"),f.warn(`Cannot find ${d} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,Ee.exit)()),(0,ga.execSync)(`${u.pm} run ${d} && ${u.runner} cap sync`,fD),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 hr(t,e,"add-code-change",r),s}async function v7(t,e,r,n,o){let i=et(),a=await ye({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Ht(a,t,e),a){let s=ve(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=uA((0,Ee.cwd)());qn&&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,Mn.join)(bt((0,Ee.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"),J("Bye \u{1F44B}"),(0,Ee.exit)(1))),(await tD(r,{channel:qs,apikey:e,packageJson:c?qn: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"),J("Bye \u{1F44B}"),(0,Ee.exit)())}else f.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await hr(t,e,"upload",r)}async function C7(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 ye({message:"Monitor Capgo logs to verify the update worked?"});await Ht(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 Qh("onboarding-v2",e,r,e,t)):f.info(`\u{1F4CA} Check logs manually at ${n}/app/p/${r}/logs to verify the update`),await hr(t,e,"test-update",r)}async function S2(t,e,r){let n=et();Z("Capgo onboarding \u{1F6EB}"),await me();let o=!r.supaAnon||!r.supaHost?await ee():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 ar();e=ce(e,o?.config),r.apikey=t||ie(),e===void 0&&(e=await Dr({message:"Enter your appId:"}),De(e)&&(Vn("Operation cancelled."),(0,Ee.exit)(1)));let a=ve();(!v2()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await lD(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await oe(s,r.apikey,["upload","all","read","write"]);let u=await na(s,["admin","super_admin"]),c=u.gid,l=await u7(c,r.apikey)??0,p=xr(void 0,qn)||"1.0.0",d=!1,h=p;try{if(l<1&&await hr(c,r.apikey,"add-app",e),l<2&&(await l7(u,r.apikey,e,r),dr(2)),l<3&&(await f7(c,r.apikey,e),dr(3)),l<4){let m=await m7(c,r.apikey,e);p=m.pkgVersion,h=p,d=m.delta,dr(4)}l<5&&(await g7(c,r.apikey,e),dr(5)),l<6&&(await D7(c,r.apikey,e),dr(6)),l<7&&(await y7(c,r.apikey,e),dr(7)),l<8&&(await b7(c,r.apikey,e),dr(8)),l<9&&(h=await w7(c,r.apikey,e,p),dr(9)),l<10&&(await v7(c,r.apikey,e,h,d),dr(10)),l<11&&(await C7(c,r.apikey,e,i.hostWeb,d),dr(11)),await hr(c,r.apikey,"done",e),c7()}catch(m){console.error(m),f.error(`Error during onboarding.
307
307
  if the error persists please contact support@capgo.app
308
- 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\``),J("Bye \u{1F44B}"),(0,Ce.exit)()}async function v7(t,e=!1){e||Z("Adding organization"),await he();let r={...t,apikey:t.apikey||ie()};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 oe(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await gr({message:"Organization name:",placeholder:"My Organization"});if(De(c))throw f.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await gr({message:"Management email:",placeholder:"admin@example.com"});if(De(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 ${L(u)}`),new Error(`Could not add organization: ${L(u)}`);return await be(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`),J("Done \u2705")),s}async function fD(t){await v7(t,!1)}async function C7(t,e,r=!1){r||Z("Deleting organization"),await he();let n={...e,apikey:e.apikey||ie()};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 oe(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 ${L(s)}`),new Error(`Cannot get organization details: ${L(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 Dr({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(De(c)||c==="no")throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ye({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(De(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 ${L(u)}`),new Error(`Could not delete organization: ${L(u)}`);return await be(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`),J("Done \u2705")),!0}async function pD(t,e){await C7(t,e,!1)}function E7(t,e){if(e)return;if(!t.length){f.error("No organizations found");return}let r=new it;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 _7(t,e=!1){e||Z("List organizations"),await he();let r={...t,apikey:t.apikey||ie()};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 oe(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 ${L(o)}`),new Error(`Cannot get organizations: ${L(o)}`);let a=i||[];return e||(f.info(`Organizations found: ${a.length}`),E7(a,e),J("Done \u2705")),a}async function dD(t){await _7(t,!1)}async function x7(t,e,r=!1){r||Z("Updating organization"),await he();let n={...e,apikey:e.apikey||ie()};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 oe(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 ${L(a)}`),new Error(`Cannot get organization details: ${L(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await gr({message:"New organization name:",placeholder:i.name||"My Organization"});if(De(l))throw f.error("Canceled updating organization"),new Error("Organization update cancelled");s=l}if(!r&&!u){let l=await gr({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(De(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 ${L(c)}`),new Error(`Could not update organization: ${L(c)}`);return await be(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"),J("Done \u2705")),{orgId:t,name:s,email:u}}async function hD(t,e){await x7(t,e,!1)}async function S7(t,e=!1){e||Z("Getting user id");let r={...t,apikey:t.apikey||ie()};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 oe(n,r.apikey,["read","all","write"]);return e||J(`Done \u2705: ${o}`),o}catch(n){throw e||f.error(`Error getting user id ${L(n)}`),n instanceof Error?n:new Error(String(n))}}async function xF(t){await S7(t,!1)}var z={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"};nt.name(mr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(mr.version,"-v, --version","output the current version");nt.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
308
+ 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\``),J("Bye \u{1F44B}"),(0,Ee.exit)()}async function E7(t,e=!1){e||Z("Adding organization"),await me();let r={...t,apikey:t.apikey||ie()};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 oe(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await Dr({message:"Organization name:",placeholder:"My Organization"});if(De(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(De(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 ${j(u)}`),new Error(`Could not add organization: ${j(u)}`);return await be(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`),J("Done \u2705")),s}async function pD(t){await E7(t,!1)}async function _7(t,e,r=!1){r||Z("Deleting organization"),await me();let n={...e,apikey:e.apikey||ie()};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 oe(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 ${j(s)}`),new Error(`Cannot get organization details: ${j(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(De(c)||c==="no")throw f.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ye({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(De(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 ${j(u)}`),new Error(`Could not delete organization: ${j(u)}`);return await be(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`),J("Done \u2705")),!0}async function dD(t,e){await _7(t,e,!1)}function S7(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 x7(t,e=!1){e||Z("List organizations"),await me();let r={...t,apikey:t.apikey||ie()};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 oe(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 ${j(o)}`),new Error(`Cannot get organizations: ${j(o)}`);let a=i||[];return e||(f.info(`Organizations found: ${a.length}`),S7(a,e),J("Done \u2705")),a}async function hD(t){await x7(t,!1)}async function A7(t,e,r=!1){r||Z("Updating organization"),await me();let n={...e,apikey:e.apikey||ie()};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 oe(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 ${j(a)}`),new Error(`Cannot get organization details: ${j(a)}`);let{name:s,email:u}=n;if(!r&&!s){let l=await Dr({message:"New organization name:",placeholder:i.name||"My Organization"});if(De(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(De(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 ${j(c)}`),new Error(`Could not update organization: ${j(c)}`);return await be(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"),J("Done \u2705")),{orgId:t,name:s,email:u}}async function mD(t,e){await A7(t,e,!1)}async function F7(t,e=!1){e||Z("Getting user id");let r={...t,apikey:t.apikey||ie()};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 oe(n,r.apikey,["read","all","write"]);return e||J(`Done \u2705: ${o}`),o}catch(n){throw e||f.error(`Error getting user id ${j(n)}`),n instanceof Error?n:new Error(String(n))}}async function x2(t){await F7(t,!1)}var z={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.
309
309
 
310
310
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
311
311
 
312
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(_F).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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);nt.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.
312
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(S2).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>",z.supaHost).option("--supa-anon <supaAnon>",z.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.
313
313
 
314
314
  This command helps diagnose issues with your setup.
315
315
 
316
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",z.packageJson).action(async(...t)=>{let e=t.at(-1);await P1(e)});nt.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.
316
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",z.packageJson).action(async(...t)=>{let e=t.at(-1);await $A(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.
317
317
 
318
318
  Use --apikey=******** in any command to override it.
319
319
 
320
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(vF).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var qn=nt.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");qn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
320
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(C2).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var Hn=ot.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Hn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
321
321
 
322
322
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
323
323
 
324
324
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
325
325
  Capgo never inspects external content. Add encryption for trustless security.
326
326
 
327
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(M2).option("-a, --apikey <apikey>",z.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>",z.packageJson).option("--node-modules <nodeModules>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon).option("--verbose",z.verbose);qn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
327
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(qF).option("-a, --apikey <apikey>",z.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>",z.packageJson).option("--node-modules <nodeModules>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon).option("--verbose",z.verbose);Hn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
328
328
 
329
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(iA).option("-a, --apikey <apikey>",z.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",z.packageJson).option("--node-modules <nodeModules>",z.nodeModules).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);qn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
329
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(a1).option("-a, --apikey <apikey>",z.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",z.packageJson).option("--node-modules <nodeModules>",z.nodeModules).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
330
330
 
331
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await fA(t,e,r)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);qn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
331
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await p1(t,e,r)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
332
332
 
333
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await dA(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);qn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
333
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await h1(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
334
334
 
335
335
  Bundles linked to channels are preserved unless --ignore-channel is used.
336
336
 
337
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await oA(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);qn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
337
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await i1(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
338
338
 
339
339
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
340
340
 
341
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(pA).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");qn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
341
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(d1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Hn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
342
342
 
343
343
  Prints base64 session key for verification.
344
344
 
345
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(lA).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");qn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
345
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(f1).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");Hn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
346
346
 
347
347
  Returns checksum for use with encryption. Use --json for machine-readable output.
348
348
 
349
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(V2).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>",z.packageJson);var ga=nt.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");ga.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.
349
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(zF).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>",z.packageJson);var Da=ot.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");Da.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.
350
350
 
351
351
  All options can be guessed from config if not provided.
352
352
 
353
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(A1).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>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);ga.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
353
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(FA).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>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Da.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
354
354
 
355
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await F1(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);ga.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
355
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await OA(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Da.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
356
356
 
357
- Example: npx @capgo/cli@latest app list`).action(async t=>{await $1(t)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);ga.command("debug [appId]").action(VC).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
357
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await IA(t)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Da.command("debug [appId]").action(zC).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
358
358
 
359
359
  Optionally target a specific device for detailed diagnostics.
360
360
 
361
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",z.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);ga.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
361
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",z.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Da.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
362
362
 
363
363
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
364
364
 
365
- 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(R1);ga.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.
365
+ 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(BA);Da.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.
366
366
 
367
367
  Retention of 0 means infinite storage.
368
368
 
369
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await I1(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>",z.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var Hs=nt.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Hs.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
369
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await RA(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>",z.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var Vs=ot.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Vs.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
370
370
 
371
- Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(z2).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hs.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
371
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(KF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Vs.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
372
372
 
373
- Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await K2(t,e,r)}).option("-a, --apikey <apikey>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hs.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
373
+ 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>",z.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>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Vs.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
374
374
 
375
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await W2(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hs.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
375
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await YF(t,e)}).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Vs.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
376
376
 
377
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await G2(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",z.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Hs.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).
377
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await GF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",z.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);Vs.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).
378
378
 
379
379
  One channel must be default.
380
380
 
381
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await J2(t,e,r)}).option("-a, --apikey <apikey>",z.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>",z.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var mD=nt.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.");mD.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
381
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await XF(t,e,r)}).option("-a, --apikey <apikey>",z.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>",z.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var gD=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.");gD.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
382
382
 
383
383
  Recommended not to commit the key for security.
384
384
 
385
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(DF).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");mD.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
385
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(y2).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");gD.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
386
386
 
387
387
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
388
388
  Public key is saved to capacitor.config for mobile app decryption.
389
389
  NEVER commit the private key - store it securely!
390
390
 
391
- Example: npx @capgo/cli@latest key create`).action(yF).option("-f, --force","Force generate a new one");mD.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
391
+ Example: npx @capgo/cli@latest key create`).action(b2).option("-f, --force","Force generate a new one");gD.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
392
392
 
393
- Example: npx @capgo/cli@latest key delete_old`).action(bF);var A7=nt.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");A7.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
393
+ Example: npx @capgo/cli@latest key delete_old`).action(w2);var O7=ot.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");O7.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
394
394
 
395
- Example: npx @capgo/cli@latest account id`).action(xF).option("-a, --apikey <apikey>",z.apikey);var hf=nt.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");hf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
395
+ Example: npx @capgo/cli@latest account id`).action(x2).option("-a, --apikey <apikey>",z.apikey);var mf=ot.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");mf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
396
396
 
397
- Example: npx @capgo/cli@latest organisation list`).action(dD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);hf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
397
+ Example: npx @capgo/cli@latest organisation list`).action(hD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);mf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
398
398
 
399
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(fD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);hf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
399
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(pD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);mf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
400
400
 
401
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(hD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);hf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
401
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(mD).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);mf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
402
402
 
403
403
  Only organization owners can delete organizations.
404
404
 
405
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(pD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var SF=nt.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
405
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(dD).option("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var A2=ot.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
406
406
 
407
407
  \u26A0\uFE0F This feature is currently in PUBLIC BETA and cannot be used by anyone at this time.
408
408
 
@@ -414,7 +414,7 @@ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(pD).option("-
414
414
  \u{1F4CB} BEFORE BUILDING:
415
415
  Save your credentials first:
416
416
  npx @capgo/cli build credentials save --appId <your-app-id> --platform ios
417
- npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);SF.command("request [appId]").description(`Request a native build from Capgo Cloud.
417
+ npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);A2.command("request [appId]").description(`Request a native build from Capgo Cloud.
418
418
 
419
419
  This command will zip your project directory and upload it to Capgo for building.
420
420
  The build will be processed and sent directly to app stores.
@@ -425,13 +425,13 @@ The build will be processed and sent directly to app stores.
425
425
  \u{1F4CB} PREREQUISITE: Save credentials first with:
426
426
  npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>
427
427
 
428
- Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(W1).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("-a, --apikey <apikey>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var gD=SF.command("credentials").description(`Manage build credentials stored locally on your machine.
428
+ Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(YA).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").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("--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>",z.apikey).option("--supa-host <supaHost>",z.supaHost).option("--supa-anon <supaAnon>",z.supaAnon);var DD=A2.command("credentials").description(`Manage build credentials stored locally on your machine.
429
429
 
430
430
  \u{1F512} SECURITY:
431
431
  - Credentials saved to ~/.capgo-credentials/credentials.json (local machine only)
432
432
  - When building, sent to Capgo but NEVER stored permanently
433
433
  - Auto-deleted from Capgo after build (max 24 hours)
434
- - Builds sent directly to app stores - Capgo keeps nothing`);gD.command("save").description(`Save build credentials locally for iOS or Android.
434
+ - Builds sent directly to app stores - Capgo keeps nothing`);DD.command("save").description(`Save build credentials locally for iOS or Android.
435
435
 
436
436
  Credentials are stored in ~/.capgo-credentials/credentials.json per app ID and automatically used when building.
437
437
 
@@ -461,13 +461,13 @@ Android Example:
461
461
  --keystore-alias "my-key" \\
462
462
  --keystore-key-password "key-pass" \\
463
463
  --keystore-store-password "store-pass" \\
464
- --play-config ./service-account.json`).action(H1).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").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-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").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");gD.command("list").description(`List saved build credentials (passwords masked).
464
+ --play-config ./service-account.json`).action(VA).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").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-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").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");DD.command("list").description(`List saved build credentials (passwords masked).
465
465
 
466
466
  Shows what credentials are currently saved in ~/.capgo-credentials/credentials.json
467
467
 
468
468
  Examples:
469
469
  npx @capgo/cli build credentials list # List all apps
470
- npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(V1).option("--appId <appId>","App ID to list (optional, lists all if omitted)");gD.command("clear").description(`Clear saved build credentials.
470
+ npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(zA).option("--appId <appId>","App ID to list (optional, lists all if omitted)");DD.command("clear").description(`Clear saved build credentials.
471
471
 
472
472
  Remove credentials from ~/.capgo-credentials/credentials.json
473
473
  Use --appId and --platform to target specific credentials.
@@ -475,7 +475,7 @@ Use --appId and --platform to target specific credentials.
475
475
  Examples:
476
476
  npx @capgo/cli build credentials clear # Clear all apps
477
477
  npx @capgo/cli build credentials clear --appId com.example.app # Clear specific app
478
- npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(z1).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)");nt.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)=>{X2(t,e.folder)});nt.exitOverride();nt.configureOutput({writeErr:t=>{}});nt.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,df.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,df.exit)(r)}console.error(`Error: ${L(t)}`),(0,df.exit)(1)});
478
+ npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(KA).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)=>{ZF(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,hf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,hf.exit)(r)}console.error(`Error: ${j(t)}`),(0,hf.exit)(1)});
479
479
  /*! Bundled license information:
480
480
 
481
481
  tus-js-client/lib.es5/upload.js: