@capgo/cli 7.59.0 → 7.61.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,83 +1,83 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var d2=Object.create;var ou=Object.defineProperty;var p2=Object.getOwnPropertyDescriptor;var h2=Object.getOwnPropertyNames;var m2=Object.getPrototypeOf,g2=Object.prototype.hasOwnProperty;var Qe=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qr=(t,e)=>{for(var r in e)ou(t,r,{get:e[r],enumerable:!0})},jy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of h2(e))!g2.call(t,o)&&o!==r&&ou(t,o,{get:()=>e[o],enumerable:!(n=p2(e,o))||n.enumerable});return t};var de=(t,e,r)=>(r=t!=null?d2(m2(t)):{},jy(e||!t||!t.__esModule?ou(r,"default",{value:t,enumerable:!0}):r,t)),ie=t=>jy(ou({},"__esModule",{value:!0}),t);var _a=x(Uf=>{var iu=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}},jf=class extends iu{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Uf.CommanderError=iu;Uf.InvalidArgumentError=jf});var au=x(qf=>{var{InvalidArgumentError:y2}=_a(),Mf=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 y2(`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 D2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}qf.Argument=Mf;qf.humanReadableArgName=D2});var zf=x(Vf=>{var{humanReadableArgName:b2}=au(),Hf=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=>b2(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(d,p){return r.formatItem(d,n,p,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let h=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>i(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let h=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(p,h,r))}),a.join(`
3
- `)}displayWidth(e){return Uy(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,f=(this.helpWidth??80)-r-u-2,d;return f<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,f).replace(/\n/g,`
2
+ "use strict";var g2=Object.create;var iu=Object.defineProperty;var y2=Object.getOwnPropertyDescriptor;var D2=Object.getOwnPropertyNames;var b2=Object.getPrototypeOf,w2=Object.prototype.hasOwnProperty;var et=(t,e)=>()=>(t&&(e=t(t=0)),e);var x=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Qr=(t,e)=>{for(var r in e)iu(t,r,{get:e[r],enumerable:!0})},Uy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of D2(e))!w2.call(t,o)&&o!==r&&iu(t,o,{get:()=>e[o],enumerable:!(n=y2(e,o))||n.enumerable});return t};var pe=(t,e,r)=>(r=t!=null?g2(b2(t)):{},Uy(e||!t||!t.__esModule?iu(r,"default",{value:t,enumerable:!0}):r,t)),ae=t=>Uy(iu({},"__esModule",{value:!0}),t);var Sa=x(Mf=>{var au=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}},Uf=class extends au{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Mf.CommanderError=au;Mf.InvalidArgumentError=Uf});var su=x(Hf=>{var{InvalidArgumentError:v2}=Sa(),qf=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 v2(`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 C2(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Hf.Argument=qf;Hf.humanReadableArgName=C2});var Kf=x(zf=>{var{humanReadableArgName:E2}=su(),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=>E2(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let o=e.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let o=new Map;return e.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[])}),r.forEach(i=>{let a=n(i);o.has(a)||o.set(a,[]),o.get(a).push(i)}),o}formatHelp(e,r){let n=r.padWidth(e,r),o=r.helpWidth??80;function i(d,h){return r.formatItem(d,n,h,r)}let a=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(a=a.concat([r.boxWrap(r.styleCommandDescription(s),o),""]));let u=r.visibleArguments(e).map(d=>i(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(a=a.concat(this.formatItemList("Arguments:",u,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,h)=>{let p=d.map(m=>i(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));a=a.concat(this.formatItemList(h,p,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(h=>i(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));a=a.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,h)=>{let p=d.map(m=>i(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));a=a.concat(this.formatItemList(h,p,r))}),a.join(`
3
+ `)}displayWidth(e){return My(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,f=(this.helpWidth??80)-r-u-2,d;return f<this.minWidthToWrap||o.preformatted(n)?d=n:d=o.boxWrap(n,f).replace(/\n/g,`
4
4
  `+" ".repeat(r+u)),a+s+" ".repeat(u)+d.replace(/\n/g,`
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(f=>{let d=this.displayWidth(f);if(c+d<=r){u.push(f),c+=d;return}i.push(u.join(""));let p=f.trimStart();u=[p],c=this.displayWidth(p)}),i.push(u.join(""))}),i.join(`
6
- `)}};function Uy(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}Vf.Help=Hf;Vf.stripColor=Uy});var Yf=x(Wf=>{var{InvalidArgumentError:w2}=_a(),Kf=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=v2(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 w2(`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?My(this.name().replace(/^no-/,"")):My(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}},Gf=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 My(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function v2(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}
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(f=>{let d=this.displayWidth(f);if(c+d<=r){u.push(f),c+=d;return}i.push(u.join(""));let h=f.trimStart();u=[h],c=this.displayWidth(h)}),i.push(u.join(""))}),i.join(`
6
+ `)}};function My(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}zf.Help=Vf;zf.stripColor=My});var Jf=x(Yf=>{var{InvalidArgumentError:_2}=Sa(),Gf=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=S2(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 _2(`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?qy(this.name().replace(/^no-/,"")):qy(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}},Wf=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 qy(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function S2(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}}Wf.Option=Kf;Wf.DualOptions=Gf});var Hy=x(qy=>{function C2(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 E2(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=C2(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}}Yf.Option=Gf;Yf.DualOptions=Wf});var Vy=x(Hy=>{function x2(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 A2(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=x2(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]}?)`:""}qy.suggestSimilar=E2});var Gy=x(ed=>{var _2=require("node:events").EventEmitter,Jf=require("node:child_process"),en=require("node:path"),su=require("node:fs"),Ae=require("node:process"),{Argument:S2,humanReadableArgName:x2}=au(),{CommanderError:Xf}=_a(),{Help:A2,stripColor:O2}=zf(),{Option:Vy,DualOptions:F2}=Yf(),{suggestSimilar:zy}=Hy(),Zf=class t extends _2{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=>Ae.stdout.write(r),writeErr:r=>Ae.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ae.stdout.isTTY?Ae.stdout.columns:void 0,getErrHelpWidth:()=>Ae.stderr.isTTY?Ae.stderr.columns:void 0,getOutHasColors:()=>Qf()??(Ae.stdout.isTTY&&Ae.stdout.hasColors?.()),getErrHasColors:()=>Qf()??(Ae.stderr.isTTY&&Ae.stderr.hasColors?.()),stripColor:r=>O2(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 A2,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 S2(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 Xf(e,r,n)),Ae.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 Vy(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 Vy)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 f=s.exec(u);return f?f[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){Ae.versions?.electron&&(r.from="electron");let o=Ae.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ae.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":Ae.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(su.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]}?)`:""}Hy.suggestSimilar=A2});var Wy=x(td=>{var O2=require("node:events").EventEmitter,Xf=require("node:child_process"),en=require("node:path"),uu=require("node:fs"),Ae=require("node:process"),{Argument:F2,humanReadableArgName:k2}=su(),{CommanderError:Zf}=Sa(),{Help:P2,stripColor:$2}=Kf(),{Option:zy,DualOptions:I2}=Jf(),{suggestSimilar:Ky}=Vy(),Qf=class t extends O2{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=>Ae.stdout.write(r),writeErr:r=>Ae.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>Ae.stdout.isTTY?Ae.stdout.columns:void 0,getErrHelpWidth:()=>Ae.stderr.isTTY?Ae.stderr.columns:void 0,getOutHasColors:()=>ed()??(Ae.stdout.isTTY&&Ae.stdout.hasColors?.()),getErrHasColors:()=>ed()??(Ae.stderr.isTTY&&Ae.stderr.hasColors?.()),stripColor:r=>$2(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 P2,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 F2(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 Zf(e,r,n)),Ae.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 zy(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 zy)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 f=s.exec(u);return f?f[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){Ae.versions?.electron&&(r.from="electron");let o=Ae.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}e===void 0&&(e=Ae.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":Ae.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(uu.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(f,d){let p=en.resolve(f,d);if(su.existsSync(p))return p;if(o.includes(en.extname(d)))return;let h=o.find(m=>su.existsSync(`${p}${m}`));if(h)return`${p}${h}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let f;try{f=su.realpathSync(this._scriptPath)}catch{f=this._scriptPath}s=en.resolve(en.dirname(f),s)}if(s){let f=i(s,a);if(!f&&!e._executableFile&&this._scriptPath){let d=en.basename(this._scriptPath,en.extname(this._scriptPath));d!==this._name&&(f=i(s,`${d}-${e._name}`))}a=f||a}n=o.includes(en.extname(a));let u;Ae.platform!=="win32"?n?(r.unshift(a),r=Ky(Ae.execArgv).concat(r),u=Jf.spawn(Ae.argv[0],r,{stdio:"inherit"})):u=Jf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=Ky(Ae.execArgv).concat(r),u=Jf.spawn(Ae.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ae.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new Xf(f,"commander.executeSubCommandAsync","(close)")):Ae.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)Ae.exit(1);else{let d=new Xf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,c(d)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(f){return f.length>1&&f[0]==="-"}let a=f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let f=u??e[c++];if(u=null,f==="--"){o===n&&o.push(f),o.push(...e.slice(c));break}if(s&&(!i(f)||a(f))){this.emit(`option:${s.name()}`,f);continue}if(s=null,i(f)){let d=this._findOption(f);if(d){if(d.required){let p=e[c++];p===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,p)}else if(d.optional){let p=null;c<e.length&&(!i(e[c])||a(e[c]))&&(p=e[c++]),this.emit(`option:${d.name()}`,p)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),u=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),p=this._findOption(f.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,f.slice(d+1));continue}}if(o===r&&i(f)&&!(this.commands.length===0&&a(f))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){r.push(f,...e.slice(c));break}else if(this._defaultCommandName){n.push(f,...e.slice(c));break}}if(this._passThroughOptions){o.push(f,...e.slice(c));break}o.push(f)}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(f,d){let h=en.resolve(f,d);if(uu.existsSync(h))return h;if(o.includes(en.extname(d)))return;let p=o.find(m=>uu.existsSync(`${h}${m}`));if(p)return`${h}${p}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let f;try{f=uu.realpathSync(this._scriptPath)}catch{f=this._scriptPath}s=en.resolve(en.dirname(f),s)}if(s){let f=i(s,a);if(!f&&!e._executableFile&&this._scriptPath){let d=en.basename(this._scriptPath,en.extname(this._scriptPath));d!==this._name&&(f=i(s,`${d}-${e._name}`))}a=f||a}n=o.includes(en.extname(a));let u;Ae.platform!=="win32"?n?(r.unshift(a),r=Gy(Ae.execArgv).concat(r),u=Xf.spawn(Ae.argv[0],r,{stdio:"inherit"})):u=Xf.spawn(a,r,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),r.unshift(a),r=Gy(Ae.execArgv).concat(r),u=Xf.spawn(Ae.execPath,r,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{Ae.on(d,()=>{u.killed===!1&&u.exitCode===null&&u.kill(d)})});let c=this._exitCallback;u.on("close",f=>{f=f??1,c?c(new Zf(f,"commander.executeSubCommandAsync","(close)")):Ae.exit(f)}),u.on("error",f=>{if(f.code==="ENOENT")this._checkForMissingExecutable(a,s,e._name);else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)Ae.exit(1);else{let d=new Zf(1,"commander.executeSubCommandAsync","(error)");d.nestedError=f,c(d)}}),this.runningCommand=u}_dispatchSubcommand(e,r,n){let o=this._findCommand(e);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(e){e||this.help();let r=this._findCommand(e);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,r)=>{e.required&&this.args[r]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,o,i)=>{let a=o;if(o!==null&&n.parseArg){let s=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,o,i,s)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((a,s)=>e(n,s,a),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=e(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(e,r){return e?.then&&typeof e.then=="function"?e.then(()=>r()):r()}_chainOrCallHooks(e,r){let n=e,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:i,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let o=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(e,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),r=n.unknown,this.args=e.concat(r),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),r);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,e,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(i,e,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,e,r);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,r);this.listenerCount("command:*")?this.emit("command:*",e,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(r=>r._name===e||r._aliases.includes(e))}_findOption(e){return this.options.find(r=>r.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(r=>{r.mandatory&&e.getOptionValue(r.attributeName())===void 0&&e.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=e.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],o=r;function i(f){return f.length>1&&f[0]==="-"}let a=f=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(f)?!this._getCommandAndAncestors().some(d=>d.options.map(h=>h.short).some(h=>/^-\d$/.test(h))):!1,s=null,u=null,c=0;for(;c<e.length||u;){let f=u??e[c++];if(u=null,f==="--"){o===n&&o.push(f),o.push(...e.slice(c));break}if(s&&(!i(f)||a(f))){this.emit(`option:${s.name()}`,f);continue}if(s=null,i(f)){let d=this._findOption(f);if(d){if(d.required){let h=e[c++];h===void 0&&this.optionMissingArgument(d),this.emit(`option:${d.name()}`,h)}else if(d.optional){let h=null;c<e.length&&(!i(e[c])||a(e[c]))&&(h=e[c++]),this.emit(`option:${d.name()}`,h)}else this.emit(`option:${d.name()}`);s=d.variadic?d:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let d=this._findOption(`-${f[1]}`);if(d){d.required||d.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${d.name()}`,f.slice(2)):(this.emit(`option:${d.name()}`),u=`-${f.slice(2)}`);continue}}if(/^--[^=]+=/.test(f)){let d=f.indexOf("="),h=this._findOption(f.slice(0,d));if(h&&(h.required||h.optional)){this.emit(`option:${h.name()}`,f.slice(d+1));continue}}if(o===r&&i(f)&&!(this.commands.length===0&&a(f))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&f===this._getHelpCommand().name()){r.push(f,...e.slice(c));break}else if(this._defaultCommandName){n.push(f,...e.slice(c));break}}if(this._passThroughOptions){o.push(f,...e.slice(c));break}o.push(f)}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 Ae.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()}`,Ae.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new F2(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(d=>d.negate&&s===d.attributeName()),f=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||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=zy(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=zy(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=>x2(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=en.basename(e,en.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(Ae.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 Ae.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()}`,Ae.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new I2(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(e){let r=`error: missing required argument '${e}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(e){let r=`error: option '${e.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let r=`error: required option '${e.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,r){let n=a=>{let s=a.attributeName(),u=this.getOptionValue(s),c=this.options.find(d=>d.negate&&s===d.attributeName()),f=this.options.find(d=>!d.negate&&s===d.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:f||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=Ky(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=Ky(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=>k2(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=en.basename(e,en.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(Ae.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 Ky(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",o="9229",i;return(i=e.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:e})}function Qf(){if(Ae.env.NO_COLOR||Ae.env.FORCE_COLOR==="0"||Ae.env.FORCE_COLOR==="false")return!1;if(Ae.env.FORCE_COLOR||Ae.env.CLICOLOR_FORCE!==void 0)return!0}ed.Command=Zf;ed.useColor=Qf});var Xy=x(fr=>{var{Argument:Wy}=au(),{Command:td}=Gy(),{CommanderError:P2,InvalidArgumentError:Yy}=_a(),{Help:k2}=zf(),{Option:Jy}=Yf();fr.program=new td;fr.createCommand=t=>new td(t);fr.createOption=(t,e)=>new Jy(t,e);fr.createArgument=(t,e)=>new Wy(t,e);fr.Command=td;fr.Option=Jy;fr.Argument=Wy;fr.Help=k2;fr.CommanderError=P2;fr.InvalidArgumentError=Yy;fr.InvalidOptionArgumentError=Yy});var nd=x((Hq,Qy)=>{"use strict";var rd={to(t,e){return e?`\x1B[${e+1};${t+1}H`:`\x1B[${t+1}G`},move(t,e){let r="";return t<0?r+=`\x1B[${-t}D`:t>0&&(r+=`\x1B[${t}C`),e<0?r+=`\x1B[${-e}A`:e>0&&(r+=`\x1B[${e}B`),r},up:(t=1)=>`\x1B[${t}A`,down:(t=1)=>`\x1B[${t}B`,forward:(t=1)=>`\x1B[${t}C`,backward:(t=1)=>`\x1B[${t}D`,nextLine:(t=1)=>"\x1B[E".repeat(t),prevLine:(t=1)=>"\x1B[F".repeat(t),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},I2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},T2={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?rd.up():"");return t&&(e+=rd.left),e}};Qy.exports={cursor:rd,scroll:I2,erase:T2,beep:"\x07"}});var id=x((Vq,od)=>{var cu=process||{},eD=cu.argv||[],uu=cu.env||{},R2=!(uu.NO_COLOR||eD.includes("--no-color"))&&(!!uu.FORCE_COLOR||eD.includes("--color")||cu.platform==="win32"||(cu.stdout||{}).isTTY&&uu.TERM!=="dumb"||!!uu.CI),B2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+N2(o,e,r,i)+e:t+o+e},N2=(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=R2)=>{let e=t?B2:()=>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")}};od.exports=tD();od.exports.createColors=tD});var wu=x(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.isNXMonorepo=Ht.isMonorepo=Ht.findPackageRelativePathInMonorepo=Ht.findPackagePath=Ht.findNXMonorepoRoot=Ht.findMonorepoRoot=void 0;var Aa=require("node:fs"),Sn=require("node:path");function bu(t){let e=(0,Sn.join)(t,"package.json"),r=(0,Sn.join)(t,"pnpm-workspace.yaml");if((0,Aa.existsSync)(r)||(0,Aa.existsSync)(e)&&JSON.parse((0,Aa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Sn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return bu(n)}Ht.findMonorepoRoot=bu;function yd(t){let e=(0,Sn.join)(t,"nx.json");if((0,Aa.existsSync)(e))return t;let r=(0,Sn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return yd(r)}Ht.findNXMonorepoRoot=yd;function Dd(t,e,r){let n=(0,Sn.join)(e,"node_modules",t);if((0,Aa.existsSync)(n))return n;if(e===r)return null;let o=(0,Sn.dirname)(e);return Dd(t,o,r)}Ht.findPackagePath=Dd;function DP(t,e){let r=bu(e),n=Dd(t,e,r);return n?(0,Sn.relative)(e,n):null}Ht.findPackageRelativePathInMonorepo=DP;function bP(t){try{return bu(t),!0}catch{return!1}}Ht.isMonorepo=bP;function wP(t){try{return yd(t),!0}catch{return!1}}Ht.isNXMonorepo=wP});var we={};Qr(we,{__addDisposableResource:()=>i0,__assign:()=>Au,__asyncDelegator:()=>XD,__asyncGenerator:()=>JD,__asyncValues:()=>ZD,__await:()=>Zo,__awaiter:()=>VD,__classPrivateFieldGet:()=>r0,__classPrivateFieldIn:()=>o0,__classPrivateFieldSet:()=>n0,__createBinding:()=>Fu,__decorate:()=>ND,__disposeResources:()=>a0,__esDecorate:()=>jD,__exportStar:()=>KD,__extends:()=>RD,__generator:()=>zD,__importDefault:()=>t0,__importStar:()=>e0,__makeTemplateObject:()=>QD,__metadata:()=>HD,__param:()=>LD,__propKey:()=>MD,__read:()=>Ad,__rest:()=>BD,__rewriteRelativeImportExtension:()=>s0,__runInitializers:()=>UD,__setFunctionName:()=>qD,__spread:()=>GD,__spreadArray:()=>YD,__spreadArrays:()=>WD,__values:()=>Ou,default:()=>VP});function RD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Sd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function BD(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 ND(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 LD(t,e){return function(r,n){e(r,n,t)}}function jD(t,e,r,n,o,i){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,p=!1,h=r.length-1;h>=0;h--){var m={};for(var g in n)m[g]=g==="access"?{}:n[g];for(var g in n.access)m.access[g]=n.access[g];m.addInitializer=function(v){if(p)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(v||null))};var D=(0,r[h])(s==="accessor"?{get:f.get,set:f.set}:f[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(d=a(D.get))&&(f.get=d),(d=a(D.set))&&(f.set=d),(d=a(D.init))&&o.unshift(d)}else(d=a(D))&&(s==="field"?o.unshift(d):f[u]=d)}c&&Object.defineProperty(c,n.name,f),p=!0}function UD(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 MD(t){return typeof t=="symbol"?t:"".concat(t)}function qD(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 HD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function VD(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(f){try{c(n.next(f))}catch(d){a(d)}}function u(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function zD(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(f){return u([c,f])}}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(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function KD(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Fu(e,t,r)}function Ou(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 Ad(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 GD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Ad(arguments[e]));return t}function WD(){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 YD(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 Zo(t){return this instanceof Zo?(this.v=t,this):new Zo(t)}function JD(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(h){return function(m){return Promise.resolve(m).then(h,d)}}function s(h,m){n[h]&&(o[h]=function(g){return new Promise(function(D,v){i.push([h,g,D,v])>1||u(h,g)})},m&&(o[h]=m(o[h])))}function u(h,m){try{c(n[h](m))}catch(g){p(i[0][3],g)}}function c(h){h.value instanceof Zo?Promise.resolve(h.value.v).then(f,d):p(i[0][2],h)}function f(h){u("next",h)}function d(h){u("throw",h)}function p(h,m){h(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function XD(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:Zo(t[o](a)),done:!1}:i?i(a):a}:i}}function ZD(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 Ou=="function"?Ou(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(a){return new Promise(function(s,u){a=t[i](a),o(s,u,a.done,a.value)})}}function o(i,a,s,u){Promise.resolve(u).then(function(c){i({value:c,done:s})},a)}}function QD(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function e0(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=xd(t),n=0;n<r.length;n++)r[n]!=="default"&&Fu(e,t,r[n]);return qP(e,t),e}function t0(t){return t&&t.__esModule?t:{default:t}}function r0(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 n0(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 o0(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 i0(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 a0(t){function e(i){t.error=t.hasError?new HP(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 s0(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 Sd,Au,Fu,qP,xd,HP,VP,ve=Qe(()=>{Sd=function(t,e){return Sd=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])},Sd(t,e)};Au=function(){return Au=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},Au.apply(this,arguments)};Fu=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]});qP=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},xd=function(t){return xd=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},xd(t)};HP=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};VP={__extends:RD,__assign:Au,__rest:BD,__decorate:ND,__param:LD,__esDecorate:jD,__runInitializers:UD,__propKey:MD,__setFunctionName:qD,__metadata:HD,__awaiter:VD,__generator:zD,__createBinding:Fu,__exportStar:KD,__values:Ou,__read:Ad,__spread:GD,__spreadArrays:WD,__spreadArray:YD,__await:Zo,__asyncGenerator:JD,__asyncDelegator:XD,__asyncValues:ZD,__makeTemplateObject:QD,__importStar:e0,__importDefault:t0,__classPrivateFieldGet:r0,__classPrivateFieldSet:n0,__classPrivateFieldIn:o0,__addDisposableResource:i0,__disposeResources:a0,__rewriteRelativeImportExtension:s0}});var u0=x(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.resolveFetch=void 0;var zP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Pu.resolveFetch=zP});var kd=x(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.FunctionRegion=hr.FunctionsHttpError=hr.FunctionsRelayError=hr.FunctionsFetchError=hr.FunctionsError=void 0;var Qo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};hr.FunctionsError=Qo;var Od=class extends Qo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};hr.FunctionsFetchError=Od;var Fd=class extends Qo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};hr.FunctionsRelayError=Fd;var Pd=class extends Qo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};hr.FunctionsHttpError=Pd;var c0;(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"})(c0||(hr.FunctionRegion=c0={}))});var l0=x(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.FunctionsClient=void 0;var KP=(ve(),ie(we)),GP=u0(),ei=kd(),$d=class{constructor(e,{headers:r={},customFetch:n,region:o=ei.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,GP.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return KP.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:f,timeout:d}=n,p={},{region:h}=n;h||(h=this.region);let m=new URL(`${this.url}/${r}`);h&&h!=="any"&&(p["x-region"]=h,m.searchParams.set("forceFunctionRegion",h));let g;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",g=c):typeof c=="string"?(p["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(p["Content-Type"]="application/json",g=JSON.stringify(c)):g=c;let D=f;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),f?(D=a.signal,f.addEventListener("abort",()=>a.abort())):D=a.signal);let v=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),s),body:g,signal:D}).catch(S=>{throw new ei.FunctionsFetchError(S)}),E=v.headers.get("x-relay-error");if(E&&E==="true")throw new ei.FunctionsRelayError(v);if(!v.ok)throw new ei.FunctionsHttpError(v);let y=((o=v.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),_;return y==="application/json"?_=yield v.json():y==="application/octet-stream"||y==="application/pdf"?_=yield v.blob():y==="text/event-stream"?_=v:y==="multipart/form-data"?_=yield v.formData():_=yield v.text(),{data:_,error:null,response:v}}catch(s){return{data:null,error:s,response:s instanceof ei.FunctionsHttpError||s instanceof ei.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};ku.FunctionsClient=$d});var Id=x(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.FunctionRegion=zt.FunctionsRelayError=zt.FunctionsHttpError=zt.FunctionsFetchError=zt.FunctionsError=zt.FunctionsClient=void 0;var WP=l0();Object.defineProperty(zt,"FunctionsClient",{enumerable:!0,get:function(){return WP.FunctionsClient}});var ka=kd();Object.defineProperty(zt,"FunctionsError",{enumerable:!0,get:function(){return ka.FunctionsError}});Object.defineProperty(zt,"FunctionsFetchError",{enumerable:!0,get:function(){return ka.FunctionsFetchError}});Object.defineProperty(zt,"FunctionsHttpError",{enumerable:!0,get:function(){return ka.FunctionsHttpError}});Object.defineProperty(zt,"FunctionsRelayError",{enumerable:!0,get:function(){return ka.FunctionsRelayError}});Object.defineProperty(zt,"FunctionRegion",{enumerable:!0,get:function(){return ka.FunctionRegion}})});var Bd=x(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});var Td=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Rd.default=Td});var jd=x(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});var YP=(ve(),ie(we)),JP=YP.__importDefault(Bd()),Nd=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 f=null,d=null,p=null,h=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let E=await i.text();E===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?d=E:d=JSON.parse(E))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),v=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&v&&v.length>1&&(p=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(f={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,p=null,h=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let D=await i.text();try{f=JSON.parse(D),Array.isArray(f)&&i.status===404&&(d=[],f=null,h=200,m="OK")}catch{i.status===404&&D===""?(h=204,m="No Content"):f={message:D}}if(f&&this.isMaybeSingle&&(!((c=f?.details)===null||c===void 0)&&c.includes("0 rows"))&&(f=null,h=200,m="OK"),f&&this.shouldThrowOnError)throw new JP.default(f)}return{error:f,data:d,count:p,status:h,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,f,d;let p="",h=i?.cause;if(h){let m=(a=h?.message)!==null&&a!==void 0?a:"",g=(s=h?.code)!==null&&s!==void 0?s:"";p=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,p+=`
28
-
29
- Caused by: ${(c=h?.name)!==null&&c!==void 0?c:"Error"}: ${m}`,g&&(p+=` (${g})`),h?.stack&&(p+=`
30
- ${h.stack}`)}else p=(f=i?.stack)!==null&&f!==void 0?f:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:p,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};Ld.default=Nd});var qd=x(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});var XP=(ve(),ie(we)),ZP=XP.__importDefault(jd()),Ud=class extends ZP.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}};Md.default=Ud});var $u=x(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});var QP=(ve(),ie(we)),ek=QP.__importDefault(qd()),tk=new RegExp("[,()]"),Hd=class extends ek.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&tk.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}};Vd.default=Hd});var Gd=x(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});var rk=(ve(),ie(we)),$a=rk.__importDefault($u()),zd=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 $a.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 $a.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,f)=>c.concat(Object.keys(f)),[]);if(u.length>0){let c=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",c.join(","))}}return new $a.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 $a.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 $a.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Kd.default=zd});var d0=x(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var f0=(ve(),ie(we)),nk=f0.__importDefault(Gd()),ok=f0.__importDefault($u()),Wd=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new nk.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([d,p])=>p!==void 0).map(([d,p])=>[d,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([d,p])=>{u.searchParams.append(d,p)})):(s="POST",c=r);let f=new Headers(this.headers);return i&&f.set("Prefer",`count=${i}`),new ok.default({method:s,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Yd.default=Wd});var Jd=x($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.PostgrestError=$t.PostgrestBuilder=$t.PostgrestTransformBuilder=$t.PostgrestFilterBuilder=$t.PostgrestQueryBuilder=$t.PostgrestClient=void 0;var ti=(ve(),ie(we)),p0=ti.__importDefault(d0());$t.PostgrestClient=p0.default;var h0=ti.__importDefault(Gd());$t.PostgrestQueryBuilder=h0.default;var m0=ti.__importDefault($u());$t.PostgrestFilterBuilder=m0.default;var g0=ti.__importDefault(qd());$t.PostgrestTransformBuilder=g0.default;var y0=ti.__importDefault(jd());$t.PostgrestBuilder=y0.default;var D0=ti.__importDefault(Bd());$t.PostgrestError=D0.default;$t.default={PostgrestClient:p0.default,PostgrestQueryBuilder:h0.default,PostgrestFilterBuilder:m0.default,PostgrestTransformBuilder:g0.default,PostgrestBuilder:y0.default,PostgrestError:D0.default}});var Zd={};Qr(Zd,{RealtimeClient:()=>Xd});var Xd,Qd=Qe(()=>{Xd=class{constructor(){}connect(){}disconnect(){}}});var On=x(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.StorageUnknownError=rn.StorageApiError=rn.StorageError=void 0;rn.isStorageError=ik;var Ia=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};rn.StorageError=Ia;function ik(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var ep=class extends Ia{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}}};rn.StorageApiError=ep;var tp=class extends Ia{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};rn.StorageUnknownError=tp});var Ta=x(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.isPlainObject=mr.recursiveToCamel=mr.resolveResponse=mr.resolveFetch=void 0;var ak=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);mr.resolveFetch=ak;var sk=()=>Response;mr.resolveResponse=sk;var uk=t=>{if(Array.isArray(t))return t.map(r=>(0,mr.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,mr.recursiveToCamel)(n)}),e};mr.recursiveToCamel=uk;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)};mr.isPlainObject=ck});var Iu=x(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.get=dk;Zn.post=pk;Zn.put=hk;Zn.head=mk;Zn.remove=gk;var Xn=(ve(),ie(we)),rp=On(),b0=Ta(),np=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)},lk=(t,e,r)=>Xn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,b0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new rp.StorageApiError(np(o),i,a))}).catch(o=>{e(new rp.StorageUnknownError(np(o),o))}):e(new rp.StorageUnknownError(np(t),t))}),fk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,b0.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 Ra(t,e,r,n,o,i){return Xn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,fk(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>lk(u,s,n))})})}function dk(t,e,r,n){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"GET",e,r,n)})}function pk(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"POST",e,n,o,r)})}function hk(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"PUT",e,n,o,r)})}function mk(t,e,r,n){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function gk(t,e,r,n,o){return Xn.__awaiter(this,void 0,void 0,function*(){return Ra(t,"DELETE",e,n,o,r)})}});var w0=x(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});var yk=(ve(),ie(we)),Dk=On(),op=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return yk.__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,Dk.isStorageError)(e))return{data:null,error:e};throw e}})}};ip.default=op});var E0=x(sp=>{"use strict";var v0;Object.defineProperty(sp,"__esModule",{value:!0});var C0=(ve(),ie(we)),bk=On(),wk=C0.__importDefault(w0()),ap=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[v0]="BlobDownloadBuilder",this.promise=null}asStream(){return new wk.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 C0.__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,bk.isStorageError)(e))return{data:null,error:e};throw e}})}};v0=Symbol.toStringTag;sp.default=ap});var x0=x(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var It=(ve(),ie(we)),Kt=On(),Gt=Iu(),_0=Ta(),vk=It.__importDefault(E0()),Ck={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},S0={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,_0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return It.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},S0),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),f=this._getFinalPath(c),d=yield(e=="PUT"?Gt.put:Gt.post)(this.fetch,`${this.url}/object/${f}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Kt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return It.__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:S0.upsert},o),f=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,f["cache-control"]=`max-age=${c.cacheControl}`,f["content-type"]=c.contentType);let d=yield(0,Gt.put)(this.fetch,s.toString(),u,{headers:f});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Kt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return It.__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,Gt.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 Kt.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,Kt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Gt.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,Kt.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,Gt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new vk.default(u,this.shouldThrowOnError)}info(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Gt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,_0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Kt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Gt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Kt.isStorageError)(n)&&n instanceof Kt.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 It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Kt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},Ck),r),{prefix:e||""});return{data:yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return It.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Gt.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,Kt.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("&")}};cp.default=up});var lp=x(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.version=void 0;Tu.version="2.84.0"});var fp=x(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.DEFAULT_HEADERS=void 0;var Ek=lp();Ru.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Ek.version}`}});var A0=x(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var ri=(ve(),ie(we)),_k=fp(),ni=On(),oi=Iu(),Sk=Ta(),dp=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({},_k.DEFAULT_HEADERS),r),this.fetch=(0,Sk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return ri.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,oi.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ni.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ri.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,oi.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ni.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return ri.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,oi.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,ni.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return ri.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,oi.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,ni.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ri.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,oi.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ni.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ri.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,oi.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ni.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():""}};pp.default=dp});var bp=x(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var hp=(ve(),ie(we)),xk=fp(),mp=On(),gp=Iu(),Ak=Ta(),yp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},xk.DEFAULT_HEADERS),r),this.fetch=(0,Ak.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return hp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,gp.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,mp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return hp.__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,gp.get)(this.fetch,o,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,mp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return hp.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,gp.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,mp.isStorageError)(r))return{data:null,error:r};throw r}})}};Dp.default=yp});var Nu=x(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.DEFAULT_HEADERS=void 0;var Ok=lp();Bu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${Ok.version}`,"Content-Type":"application/json"}});var ii=x(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.StorageVectorsErrorCode=Or.StorageVectorsUnknownError=Or.StorageVectorsApiError=Or.StorageVectorsError=void 0;Or.isStorageVectorsError=Fk;var Ba=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Or.StorageVectorsError=Ba;function Fk(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var wp=class extends Ba{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}}};Or.StorageVectorsApiError=wp;var vp=class extends Ba{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Or.StorageVectorsUnknownError=vp;var O0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(O0||(Or.StorageVectorsErrorCode=O0={}))});var ai=x(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.validateVectorDimension=gr.normalizeToFloat32=gr.isPlainObject=gr.resolveResponse=gr.resolveFetch=void 0;var Pk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);gr.resolveFetch=Pk;var kk=()=>Response;gr.resolveResponse=kk;var $k=t=>{if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};gr.isPlainObject=$k;var Ik=t=>Array.from(new Float32Array(t));gr.normalizeToFloat32=Ik;var Tk=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};gr.validateVectorDimension=Tk});var Uu=x(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.get=Lk;ui.post=jk;ui.put=Uk;ui.remove=Mk;var si=(ve(),ie(we)),Lu=ii(),Rk=ai(),F0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),Bk=(t,e,r)=>si.__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 Lu.StorageVectorsApiError(F0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Lu.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new Lu.StorageVectorsApiError(s,o,a))}}else e(new Lu.StorageVectorsUnknownError(F0(t),t))}),Nk=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,Rk.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 ju(t,e,r,n,o,i){return si.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,Nk(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=>Bk(u,s,n))})})}function Lk(t,e,r,n){return si.__awaiter(this,void 0,void 0,function*(){return ju(t,"GET",e,r,n)})}function jk(t,e,r,n,o){return si.__awaiter(this,void 0,void 0,function*(){return ju(t,"POST",e,n,o,r)})}function Uk(t,e,r,n,o){return si.__awaiter(this,void 0,void 0,function*(){return ju(t,"PUT",e,n,o,r)})}function Mk(t,e,r,n,o){return si.__awaiter(this,void 0,void 0,function*(){return ju(t,"DELETE",e,n,o,r)})}});var _p=x(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var Mu=(ve(),ie(we)),qk=Nu(),qu=ii(),Hu=Uu(),Hk=ai(),Cp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},qk.DEFAULT_HEADERS),r),this.fetch=(0,Hk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Mu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Hu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return Mu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Hu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,qu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return Mu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Hu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return Mu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Hu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,qu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};Ep.default=Cp});var Ap=x(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var Na=(ve(),ie(we)),Vk=Nu(),La=ii(),ja=Uu(),zk=ai(),Sp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Vk.DEFAULT_HEADERS),r),this.fetch=(0,zk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Na.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ja.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Na.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ja.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Na.__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,ja.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,La.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};xp.default=Sp});var Pp=x(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var Vu=(ve(),ie(we)),Kk=Nu(),zu=ii(),Ku=Uu(),Gk=ai(),Op=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Kk.DEFAULT_HEADERS),r),this.fetch=(0,Gk.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ku.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,zu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Vu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ku.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,zu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return Vu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Ku.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,zu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Vu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Ku.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,zu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Fp.default=Op});var P0=x(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.VectorIndexScope=Fn.VectorBucketScope=Fn.StorageVectorsClient=void 0;var yr=(ve(),ie(we)),Wk=yr.__importDefault(_p()),Yk=yr.__importDefault(Ap()),Jk=yr.__importDefault(Pp()),kp=class extends Jk.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Gu(this.url,this.headers,e,this.fetch)}};Fn.StorageVectorsClient=kp;var Gu=class extends Wk.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 yr.__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 yr.__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 yr.__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 yr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Wu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fn.VectorBucketScope=Gu;var Wu=class extends Yk.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 yr.__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 yr.__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 yr.__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 yr.__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 yr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Fn.VectorIndexScope=Wu});var Tp=x(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var $p=(ve(),ie(we)),Ip=P0();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Ip.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Ip.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Ip.VectorIndexScope}});var Xk=Pp();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return $p.__importDefault(Xk).default}});var Zk=_p();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return $p.__importDefault(Zk).default}});var Qk=Ap();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return $p.__importDefault(Qk).default}});var Ua=ii();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Ua.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ua.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ua.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ua.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Ua.isStorageVectorsError}});var Ma=ai();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return Ma.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return Ma.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return Ma.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return Ma.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return Ma.validateVectorDimension}})});var k0=x(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});Yu.StorageClient=void 0;var Bp=(ve(),ie(we)),e$=Bp.__importDefault(x0()),t$=Bp.__importDefault(A0()),r$=Bp.__importDefault(bp()),n$=Tp(),Rp=class extends t$.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new e$.default(this.url,this.headers,e,this.fetch)}get vectors(){return new n$.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new r$.default(this.url+"/iceberg",this.headers,this.fetch)}};Yu.StorageClient=Rp});var I0=x($0=>{"use strict";Object.defineProperty($0,"__esModule",{value:!0})});var T0=x(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.StorageAnalyticsClient=nn.StorageClient=void 0;var Ju=(ve(),ie(we)),o$=k0();Object.defineProperty(nn,"StorageClient",{enumerable:!0,get:function(){return o$.StorageClient}});var i$=bp();Object.defineProperty(nn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Ju.__importDefault(i$).default}});Ju.__exportStar(I0(),nn);Ju.__exportStar(On(),nn);Ju.__exportStar(Tp(),nn)});var R0=x(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.version=void 0;Xu.version="2.84.0"});var B0=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_REALTIME_OPTIONS=tr.DEFAULT_AUTH_OPTIONS=tr.DEFAULT_DB_OPTIONS=tr.DEFAULT_GLOBAL_OPTIONS=tr.DEFAULT_HEADERS=void 0;var a$=R0(),qa="";typeof Deno<"u"?qa="deno":typeof document<"u"?qa="web":typeof navigator<"u"&&navigator.product==="ReactNative"?qa="react-native":qa="node";tr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${qa}/${a$.version}`};tr.DEFAULT_GLOBAL_OPTIONS={headers:tr.DEFAULT_HEADERS};tr.DEFAULT_DB_OPTIONS={schema:"public"};tr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};tr.DEFAULT_REALTIME_OPTIONS={}});var N0=x(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.fetchWithAuth=Rr.resolveHeadersConstructor=Rr.resolveFetch=void 0;var s$=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Rr.resolveFetch=s$;var u$=()=>Headers;Rr.resolveHeadersConstructor=u$;var c$=(t,e,r)=>{let n=(0,Rr.resolveFetch)(r),o=(0,Rr.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}))}};Rr.fetchWithAuth=c$});var j0=x(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.isBrowser=void 0;Pn.uuid=l$;Pn.ensureTrailingSlash=L0;Pn.applySettingDefaults=d$;Pn.validateSupabaseUrl=p$;function l$(){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 L0(t){return t.endsWith("/")?t:t+"/"}var f$=()=>typeof window<"u";Pn.isBrowser=f$;function d$(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:f,global:d}=e,p={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},f),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?p.accessToken=t.accessToken:delete p.accessToken,p}function p$(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(L0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Yp={};Qr(Yp,{AuthAdminApi:()=>Lp,AuthApiError:()=>jp,AuthClient:()=>Np,AuthError:()=>Fr,AuthImplicitGrantRedirectError:()=>Vp,AuthInvalidCredentialsError:()=>Hp,AuthInvalidTokenResponseError:()=>qp,AuthPKCEGrantCodeExchangeError:()=>zp,AuthRetryableError:()=>Up,AuthSessionMissingError:()=>Mp,AuthWeakPasswordError:()=>Kp,GoTrueAdminApi:()=>Qu,GoTrueClient:()=>Zu,NavigatorLockAcquireTimeoutError:()=>Gp,isAuthApiError:()=>D$,isAuthError:()=>y$,isAuthRetryableError:()=>b$,isAuthSessionMissingError:()=>w$,isAuthWeakPasswordError:()=>v$,lockInternals:()=>g$,navigatorLock:()=>h$,processLock:()=>m$});var Wp,U0,Zu,Qu,Np,Lp,Fr,jp,Up,Mp,qp,Hp,Vp,zp,Kp,h$,m$,Gp,g$,y$,D$,b$,w$,v$,Jp=Qe(()=>{Wp=()=>Promise.resolve({data:{session:null,user:null},error:null}),U0={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}):Wp}},Zu=class{constructor(e){return this.options=e,new Proxy(this,U0)}},Qu=class{constructor(e){return this.options=e,new Proxy(this,U0)}},Np=class extends Zu{},Lp=class extends Qu{},Fr=class extends Error{},jp=class extends Fr{},Up=class extends Fr{},Mp=class extends Fr{},qp=class extends Fr{},Hp=class extends Fr{},Vp=class extends Fr{},zp=class extends Fr{},Kp=class extends Fr{},h$=Wp,m$=Wp,Gp=class extends Error{},g$={},y$=()=>!1,D$=()=>!1,b$=()=>!1,w$=()=>!1,v$=()=>!1});var M0=x(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.SupabaseAuthClient=void 0;var C$=(Jp(),ie(Yp)),Xp=class extends C$.AuthClient{constructor(e){super(e)}};ec.SupabaseAuthClient=Xp});var eh=x(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var E$=Id(),_$=Jd(),S$=(Qd(),ie(Zd)),x$=T0(),tc=B0(),A$=N0(),q0=j0(),O$=M0(),Zp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,q0.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:tc.DEFAULT_DB_OPTIONS,realtime:tc.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},tc.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:tc.DEFAULT_GLOBAL_OPTIONS},f=(0,q0.applySettingDefaults)(n??{},c);this.storageKey=(o=f.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(d,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=(0,A$.fetchWithAuth)(r,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new _$.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),this.storage=new x$.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new E$.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:f},d,p){let h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new O$.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},h),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:f,fetch:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new S$.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)}};Qp.default=Zp});var z0=x(Be=>{"use strict";var F$=Be&&Be.__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]})),H0=Be&&Be.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&F$(e,t,r)},V0=Be&&Be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Be,"__esModule",{value:!0});Be.createClient=Be.SupabaseClient=Be.FunctionRegion=Be.FunctionsError=Be.FunctionsRelayError=Be.FunctionsFetchError=Be.FunctionsHttpError=Be.PostgrestError=void 0;var P$=V0(eh());H0((Jp(),ie(Yp)),Be);var k$=Jd();Object.defineProperty(Be,"PostgrestError",{enumerable:!0,get:function(){return k$.PostgrestError}});var Ha=Id();Object.defineProperty(Be,"FunctionsHttpError",{enumerable:!0,get:function(){return Ha.FunctionsHttpError}});Object.defineProperty(Be,"FunctionsFetchError",{enumerable:!0,get:function(){return Ha.FunctionsFetchError}});Object.defineProperty(Be,"FunctionsRelayError",{enumerable:!0,get:function(){return Ha.FunctionsRelayError}});Object.defineProperty(Be,"FunctionsError",{enumerable:!0,get:function(){return Ha.FunctionsError}});Object.defineProperty(Be,"FunctionRegion",{enumerable:!0,get:function(){return Ha.FunctionRegion}});H0((Qd(),ie(Zd)),Be);var $$=eh();Object.defineProperty(Be,"SupabaseClient",{enumerable:!0,get:function(){return V0($$).default}});var I$=(t,e,r)=>new P$.default(t,e,r);Be.createClient=I$;function T$(){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}T$()&&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 th=x((Bz,K0)=>{K0.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var rc=x(W0=>{var G0={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 R$(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(G0))W0[t]=R$(G0[t])});var Q0=x((Lz,Z0)=>{var B$=require("fs"),it=require("path"),Y0=th(),N$=rc(),L$=typeof process=="object"&&process.platform==="win32",J0=t=>typeof t=="object"&&t!==null,X0=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 Ye(t){this.sep=it.sep,this.fs=B$,J0(t)&&J0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}Z0.exports=Ye;Ye.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 N$.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};Ye.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=it.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};Ye.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=it.dirname(t);i.fs.exists(c,function(f){f||i.makeDir(c),i.fs.open(t,"w",438,function(d,p){d?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(h,m){i.fs.write(m,e,0,e.length,0,function(){i.fs.close(m,function(){i.fs.chmod(t,n||438,function(){o(!0)})})})})}):p?i.fs.write(p,e,0,e.length,0,function(){i.fs.close(p,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};Ye.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=it.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(it.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};Ye.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=it.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(it.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(f,d){if(f)return e(f);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};Ye.prototype.getAttributes=function(){};Ye.prototype.setAttributes=function(){};Ye.crc32update=function(t,e){return X0[(t^e)&255]^t>>>8};Ye.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=Ye.crc32update(r,t[n++]);return~r>>>0};Ye.methodToString=function(t){switch(t){case Y0.STORED:return"STORED ("+t+")";case Y0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Ye.canonical=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.join(".",e)};Ye.zipnamefix=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.posix.join(".",e)};Ye.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]};Ye.sanitize=function(t,e){t=it.resolve(it.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=it.normalize(it.join(t,r.slice(n,o).join(it.sep)));if(i.indexOf(t)===0)return i}return it.normalize(it.join(t,it.basename(e)))};Ye.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};Ye.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};Ye.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)};Ye.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};Ye.isWin=L$;Ye.crcTable=X0});var tb=x((jz,eb)=>{var j$=require("path");eb.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=j$.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 nb=x((Uz,rb)=>{rb.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var li=x((Mz,ci)=>{ci.exports=Q0();ci.exports.Constants=th();ci.exports.Errors=rc();ci.exports.FileAttr=tb();ci.exports.decoder=nb()});var ib=x((qz,ob)=>{var kn=li(),Y=kn.Constants;ob.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,f=0,d=0,p=0,h=0,m=0;t|=kn.isWin?2560:768,r|=Y.FLG_EFS;let g={extraLen:0},D=y=>Math.max(0,y)>>>0,v=y=>Math.max(0,y)&65535,E=y=>Math.max(0,y)&255;return o=kn.fromDate2DOS(new Date),{get made(){return t},set made(y){t=y},get version(){return e},set version(y){e=y},get flags(){return r},set flags(y){r=y},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(y){y?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(y){y?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(y){switch(y){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=y},get time(){return kn.fromDOS2Date(this.timeval)},set time(y){this.timeval=kn.fromDate2DOS(y)},get timeval(){return o},set timeval(y){o=D(y)},get timeHighByte(){return E(o>>>8)},get crc(){return i},set crc(y){i=D(y)},get compressedSize(){return a},set compressedSize(y){a=D(y)},get size(){return s},set size(y){s=D(y)},get fileNameLength(){return u},set fileNameLength(y){u=y},get extraLength(){return c},set extraLength(y){c=y},get extraLocalLength(){return g.extraLen},set extraLocalLength(y){g.extraLen=y},get commentLength(){return f},set commentLength(y){f=y},get diskNumStart(){return d},set diskNumStart(y){d=D(y)},get inAttr(){return p},set inAttr(y){p=D(y)},get attr(){return h},set attr(y){h=D(y)},get fileAttr(){return(h||0)>>16&4095},get offset(){return m},set offset(y){m=D(y)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+f},get realDataOffset(){return m+Y.LOCHDR+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(y){var _=y.slice(m,m+Y.LOCHDR);if(_.readUInt32LE(0)!==Y.LOCSIG)throw kn.Errors.INVALID_LOC();g.version=_.readUInt16LE(Y.LOCVER),g.flags=_.readUInt16LE(Y.LOCFLG),g.method=_.readUInt16LE(Y.LOCHOW),g.time=_.readUInt32LE(Y.LOCTIM),g.crc=_.readUInt32LE(Y.LOCCRC),g.compressedSize=_.readUInt32LE(Y.LOCSIZ),g.size=_.readUInt32LE(Y.LOCLEN),g.fnameLen=_.readUInt16LE(Y.LOCNAM),g.extraLen=_.readUInt16LE(Y.LOCEXT);let S=m+Y.LOCHDR+g.fnameLen,k=S+g.extraLen;return y.slice(S,k)},loadFromBinary:function(y){if(y.length!==Y.CENHDR||y.readUInt32LE(0)!==Y.CENSIG)throw kn.Errors.INVALID_CEN();t=y.readUInt16LE(Y.CENVEM),e=y.readUInt16LE(Y.CENVER),r=y.readUInt16LE(Y.CENFLG),n=y.readUInt16LE(Y.CENHOW),o=y.readUInt32LE(Y.CENTIM),i=y.readUInt32LE(Y.CENCRC),a=y.readUInt32LE(Y.CENSIZ),s=y.readUInt32LE(Y.CENLEN),u=y.readUInt16LE(Y.CENNAM),c=y.readUInt16LE(Y.CENEXT),f=y.readUInt16LE(Y.CENCOM),d=y.readUInt16LE(Y.CENDSK),p=y.readUInt16LE(Y.CENATT),h=y.readUInt32LE(Y.CENATX),m=y.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var y=Buffer.alloc(Y.LOCHDR);return y.writeUInt32LE(Y.LOCSIG,0),y.writeUInt16LE(e,Y.LOCVER),y.writeUInt16LE(r,Y.LOCFLG),y.writeUInt16LE(n,Y.LOCHOW),y.writeUInt32LE(o,Y.LOCTIM),y.writeUInt32LE(i,Y.LOCCRC),y.writeUInt32LE(a,Y.LOCSIZ),y.writeUInt32LE(s,Y.LOCLEN),y.writeUInt16LE(u,Y.LOCNAM),y.writeUInt16LE(g.extraLen,Y.LOCEXT),y},centralHeaderToBinary:function(){var y=Buffer.alloc(Y.CENHDR+u+c+f);return y.writeUInt32LE(Y.CENSIG,0),y.writeUInt16LE(t,Y.CENVEM),y.writeUInt16LE(e,Y.CENVER),y.writeUInt16LE(r,Y.CENFLG),y.writeUInt16LE(n,Y.CENHOW),y.writeUInt32LE(o,Y.CENTIM),y.writeUInt32LE(i,Y.CENCRC),y.writeUInt32LE(a,Y.CENSIZ),y.writeUInt32LE(s,Y.CENLEN),y.writeUInt16LE(u,Y.CENNAM),y.writeUInt16LE(c,Y.CENEXT),y.writeUInt16LE(f,Y.CENCOM),y.writeUInt16LE(d,Y.CENDSK),y.writeUInt16LE(p,Y.CENATT),y.writeUInt32LE(h,Y.CENATX),y.writeUInt32LE(m,Y.CENOFF),y},toJSON:function(){let y=function(_){return _+" bytes"};return{made:t,version:e,flags:r,method:kn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:y(a),size:y(s),fileNameLength:y(u),extraLength:y(c),commentLength:y(f),diskNumStart:d,inAttr:p,attr:h,offset:m,centralHeaderSize:y(Y.CENHDR+u+c+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var sb=x((Hz,ab)=>{var fi=li(),ze=fi.Constants;ab.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 ze.ENDHDR+o},loadFromBinary:function(i){if((i.length!==ze.ENDHDR||i.readUInt32LE(0)!==ze.ENDSIG)&&(i.length<ze.ZIP64HDR||i.readUInt32LE(0)!==ze.ZIP64SIG))throw fi.Errors.INVALID_END();i.readUInt32LE(0)===ze.ENDSIG?(t=i.readUInt16LE(ze.ENDSUB),e=i.readUInt16LE(ze.ENDTOT),r=i.readUInt32LE(ze.ENDSIZ),n=i.readUInt32LE(ze.ENDOFF),o=i.readUInt16LE(ze.ENDCOM)):(t=fi.readBigUInt64LE(i,ze.ZIP64SUB),e=fi.readBigUInt64LE(i,ze.ZIP64TOT),r=fi.readBigUInt64LE(i,ze.ZIP64SIZE),n=fi.readBigUInt64LE(i,ze.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(ze.ENDHDR+o);return i.writeUInt32LE(ze.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,ze.ENDSUB),i.writeUInt16LE(e,ze.ENDTOT),i.writeUInt32LE(r,ze.ENDSIZ),i.writeUInt32LE(n,ze.ENDOFF),i.writeUInt16LE(o,ze.ENDCOM),i.fill(" ",ze.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 nh=x(rh=>{rh.EntryHeader=ib();rh.MainHeader=sb()});var cb=x((zz,ub)=>{ub.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 f=i[c];f.copy(s,u),u+=f.length}n&&n(s)}),o.end(t)}}}});var fb=x((Kz,lb)=>{var U$=+(process.versions?process.versions.node:"").split(".")[0]||0;lb.exports=function(t,e){var r=require("zlib");let n=U$>=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 f=0;f<a.length;f++){var d=a[f];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var gb=x((Gz,mb)=>{"use strict";var{randomFillSync:db}=require("crypto"),M$=rc(),q$=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}),hb=(t,e)=>Math.imul(t,e)>>>0,pb=(t,e)=>q$[(t^e)&255]^t>>>8,Va=()=>typeof db=="function"?db(Buffer.alloc(12)):Va.node();Va.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 nc={genSalt:Va};function oc(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])}oc.prototype.updateKeys=function(t){let e=this.keys;return e[0]=pb(e[0],t),e[1]+=e[0]&255,e[1]=hb(e[1],134775813)+1,e[2]=pb(e[2],e[1]>>>24),t};oc.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return hb(t,t^1)>>8&255};function H$(t){let e=new oc(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 V$(t){let e=new oc(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 z$(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=H$(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw M$.WRONG_PASSWORD();return n(t.slice(12))}function K$(t){Buffer.isBuffer(t)&&t.length>=12?nc.genSalt=function(){return t.slice(0,12)}:t==="node"?nc.genSalt=Va.node:nc.genSalt=Va}function G$(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=V$(r),i=nc.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)}mb.exports={decrypt:z$,encrypt:G$,_salter:K$}});var yb=x(ic=>{ic.Deflater=cb();ic.Inflater=fb();ic.ZipCrypto=gb()});var ih=x((Yz,Db)=>{var Pe=li(),W$=nh(),Je=Pe.Constants,oh=yb();Db.exports=function(t,e){var r=new W$.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let f=t,d=typeof f.decoder=="object"?f.decoder:Pe.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function p(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function h(y){if(r.flags_desc){let _={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Je.LOCSIG||e.readUInt32LE(S)==Je.CENSIG)throw Pe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Je.EXTSIG)_.crc=e.readUInt32LE(S+Je.EXTCRC),_.compressedSize=e.readUInt32LE(S+Je.EXTSIZ),_.size=e.readUInt32LE(S+Je.EXTLEN);else if(e.readUInt16LE(S+12)===19280)_.crc=e.readUInt32LE(S+Je.EXTCRC-4),_.compressedSize=e.readUInt32LE(S+Je.EXTSIZ-4),_.size=e.readUInt32LE(S+Je.EXTLEN-4);else throw Pe.Errors.DESCRIPTOR_UNKNOWN();if(_.compressedSize!==r.compressedSize||_.size!==r.size||_.crc!==r.crc)throw Pe.Errors.DESCRIPTOR_FAULTY();if(Pe.crc32(y)!==_.crc)return!1}else if(Pe.crc32(y)!==r.localHeader.crc)return!1;return!0}function m(y,_,S){if(typeof _>"u"&&typeof y=="string"&&(S=y,y=void 0),i)return y&&_&&_(Buffer.alloc(0),Pe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var k=p();if(k.length===0)return y&&_&&_(k),k;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw Pe.Errors.INVALID_PASS_PARAM();k=oh.ZipCrypto.decrypt(k,r,S)}var T=Buffer.alloc(r.size);switch(r.method){case Pe.Constants.STORED:if(k.copy(T),h(T))return y&&_&&_(T),T;throw y&&_&&_(T,Pe.Errors.BAD_CRC()),Pe.Errors.BAD_CRC();case Pe.Constants.DEFLATED:var B=new oh.Inflater(k,r.size);if(y)B.inflateAsync(function(F){F.copy(F,0),_&&(h(F)?_(F):_(F,Pe.Errors.BAD_CRC()))});else{if(B.inflate(T).copy(T,0),!h(T))throw Pe.Errors.BAD_CRC(`"${d.decode(n)}"`);return T}break;default:throw y&&_&&_(Buffer.alloc(0),Pe.Errors.UNKNOWN_METHOD()),Pe.Errors.UNKNOWN_METHOD()}}function g(y,_){if((!a||!a.length)&&Buffer.isBuffer(e))return y&&_&&_(p()),p();if(a.length&&!i){var S;switch(r.method){case Pe.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),y&&_&&_(S),S;default:case Pe.Constants.DEFLATED:var k=new oh.Deflater(a);if(y)k.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),_&&_(S)});else{var T=k.deflate();return r.compressedSize=T.length,T}k=null;break}}else if(y&&_)_(Buffer.alloc(0));else return Buffer.alloc(0)}function D(y,_){return(y.readUInt32LE(_+4)<<4)+y.readUInt32LE(_)}function v(y){try{for(var _=0,S,k,T;_+4<y.length;)S=y.readUInt16LE(_),_+=2,k=y.readUInt16LE(_),_+=2,T=y.slice(_,_+k),_+=k,Je.ID_ZIP64===S&&E(T)}catch{throw Pe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function E(y){var _,S,k,T;y.length>=Je.EF_ZIP64_SCOMP&&(_=D(y,Je.EF_ZIP64_SUNCOMP),r.size===Je.EF_ZIP64_OR_32&&(r.size=_)),y.length>=Je.EF_ZIP64_RHO&&(S=D(y,Je.EF_ZIP64_SCOMP),r.compressedSize===Je.EF_ZIP64_OR_32&&(r.compressedSize=S)),y.length>=Je.EF_ZIP64_DSN&&(k=D(y,Je.EF_ZIP64_RHO),r.offset===Je.EF_ZIP64_OR_32&&(r.offset=k)),y.length>=Je.EF_ZIP64_DSN+4&&(T=y.readUInt32LE(Je.EF_ZIP64_DSN),r.diskNumStart===Je.EF_ZIP64_OR_16&&(r.diskNumStart=T))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(y){n=Pe.toBuffer(y,d.encode);var _=n[n.length-1];i=_===47||_===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(y){s=y,r.extraLength=y.length,v(y)},get comment(){return d.decode(o)},set comment(y){if(o=Pe.toBuffer(y,d.encode),r.commentLength=o.length,o.length>65535)throw Pe.Errors.COMMENT_TOO_LONG()},get name(){var y=d.decode(n);return i?y.substr(y.length-1).split("/").pop():y.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return g(!1,null)},getCompressedDataAsync:function(y){g(!0,y)},setData:function(y){a=Pe.toBuffer(y,Pe.decoder.encode),!i&&a.length?(r.size=a.length,r.method=Pe.Constants.DEFLATED,r.crc=Pe.crc32(y),r.changed=!0):r.method=Pe.Constants.STORED},getData:function(y){return r.changed?a:m(!1,null,y)},getDataAsync:function(y,_){r.changed?y(a):m(!0,y,_)},set attr(y){r.attr=y},get attr(){return r.attr},set header(y){r.loadFromBinary(y)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var y=r.centralHeaderToBinary(),_=Pe.Constants.CENHDR;return n.copy(y,_),_+=n.length,s.copy(y,_),_+=r.extraLength,o.copy(y,_),y},packLocalHeader:function(){let y=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let _=r.localHeaderToBinary(),S=Buffer.alloc(_.length+n.length+r.extraLocalLength);return _.copy(S,y),y+=_.length,n.copy(S,y),y+=n.length,u.copy(S,y),y+=u.length,S},toJSON:function(){let y=function(_){return"<"+(_&&_.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:y(e),data:y(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var vb=x((Jz,wb)=>{var bb=ih(),Y$=nh(),yt=li();wb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new Y$.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:f,decoder:d}=c;t?m(c.readEntries):a=!0;function p(){let D=new Set;for(let v of Object.keys(n)){let E=v.split("/");if(E.pop(),!!E.length)for(let y=0;y<E.length;y++){let _=E.slice(0,y+1).join("/")+"/";D.add(_)}}for(let v of D)if(!(v in n)){let E=new bb(c);E.entryName=v,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)/yt.Constants.CENHDR)throw yt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,v=0;v<r.length;v++){var E=D,y=new bb(c,t);y.header=t.slice(E,E+=yt.Constants.CENHDR),y.entryName=t.slice(E,E+=y.header.fileNameLength),y.header.extraLength&&(y.extra=t.slice(E,E+=y.header.extraLength)),y.header.commentLength&&(y.comment=t.slice(E,E+y.header.commentLength)),D+=y.header.centralHeaderSize,r[v]=y,n[y.entryName]=y}u.clear(),p()}function m(D){var v=t.length-yt.Constants.ENDHDR,E=Math.max(0,v-65535),y=E,_=t.length,S=-1,k=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(E=0),v;v>=y;v--)if(t[v]===80){if(t.readUInt32LE(v)===yt.Constants.ENDSIG){S=v,k=v,_=v+yt.Constants.ENDHDR,y=v-yt.Constants.END64HDR;continue}if(t.readUInt32LE(v)===yt.Constants.END64SIG){y=E;continue}if(t.readUInt32LE(v)===yt.Constants.ZIP64SIG){S=v,_=v+yt.readBigUInt64LE(t,v+yt.Constants.ZIP64SIZE)+yt.Constants.ZIP64LEAD;break}}if(S==-1)throw yt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,_)),i.commentLength&&(o=t.slice(k+yt.Constants.ENDHDR)),D&&h()}function g(){r.length>1&&!f&&r.sort((D,v)=>D.entryName.toLowerCase().localeCompare(v.entryName.toLowerCase()))}return{get entries(){return a||h(),r.filter(D=>!u.has(D))},get comment(){return d.decode(o)},set comment(D){o=yt.toBuffer(D,d.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||h(),n[D]||null},setEntry:function(D){a||h(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,v=!0){a||h();let E=n[D];this.getEntryChildren(E,v).map(_=>_.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||h();let v=n[D],E=r.indexOf(v);E>=0&&(r.splice(E,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,v=!0){if(a||h(),typeof D=="object")if(D.isDirectory&&v){let E=[],y=D.entryName;for(let _ of r)_.entryName.startsWith(y)&&E.push(_);return E}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let v=this.getEntryChildren(D);return v.includes(D)?v.length-1:v.length}return 0},compressToBuffer:function(){a||h(),g();let D=[],v=[],E=0,y=0;i.size=0,i.offset=0;let _=0;for(let T of this.entries){let B=T.getCompressedData();T.header.offset=y;let F=T.packLocalHeader(),L=F.length+B.length;y+=L,D.push(F),D.push(B);let A=T.packCentralHeader();v.push(A),i.size+=A.length,E+=L+A.length,_++}E+=i.mainHeaderSize,i.offset=y,i.totalEntries=_,y=0;let S=Buffer.alloc(E);for(let T of D)T.copy(S,y),y+=T.length;for(let T of v)T.copy(S,y),y+=T.length;let k=i.toBinary();return o&&o.copy(k,yt.Constants.ENDHDR),k.copy(S,y),t=S,a=!1,S},toAsyncBuffer:function(D,v,E,y){try{a||h(),g();let _=[],S=[],k=0,T=0,B=0;i.size=0,i.offset=0;let F=function(L){if(L.length>0){let A=L.shift(),q=A.entryName+A.extra.toString();E&&E(q),A.getCompressedDataAsync(function(j){y&&y(q),A.header.offset=T;let Z=A.packLocalHeader(),P=Z.length+j.length;T+=P,_.push(Z),_.push(j);let b=A.packCentralHeader();S.push(b),i.size+=b.length,k+=P+b.length,B++,F(L)})}else{k+=i.mainHeaderSize,i.offset=T,i.totalEntries=B,T=0;let A=Buffer.alloc(k);_.forEach(function(j){j.copy(A,T),T+=j.length}),S.forEach(function(j){j.copy(A,T),T+=j.length});let q=i.toBinary();o&&o.copy(q,yt.Constants.ENDHDR),q.copy(A,T),t=A,a=!1,D(A)}};F(Array.from(this.entries))}catch(_){v(_)}}}}});var ah=x((Xz,Eb)=>{var Ke=li(),Xe=require("path"),J$=ih(),X$=vb(),Qn=(...t)=>Ke.findLast(t,e=>typeof e=="boolean"),Cb=(...t)=>Ke.findLast(t,e=>typeof e=="string"),Z$=(...t)=>Ke.findLast(t,e=>typeof e=="function"),Q$={noSort:!1,readEntries:!1,method:Ke.Constants.NONE,fs:null};Eb.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),Q$);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=Ke.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ke(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ke.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ke.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ke.Errors.INVALID_FILENAME();let i=new X$(r,n),{canonical:a,sanitize:s,zipnamefix:u}=Ke;function c(h){if(h&&i){var m;if(typeof h=="string"&&(m=i.getEntry(Xe.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 f(h){let{join:m,normalize:g,sep:D}=Xe.posix;return m(".",g(D+h.split("\\").join(D)+D))}function d(h){return h instanceof RegExp?(function(m){return function(g){return m.test(g)}})(h):typeof h!="function"?()=>!0:h}let p=(h,m)=>{let g=m.slice(-1);return g=g===o.sep?o.sep:"",Xe.relative(h,m)+g};return{readFile:function(h,m){var g=c(h);return g&&g.getData(m)||null},childCount:function(h){let m=c(h);if(m)return i.getChildCount(m)},readFileAsync:function(h,m){var g=c(h);g?g.getDataAsync(m):m(null,"getEntry failed for:"+h)},readAsText:function(h,m){var g=c(h);if(g){var D=g.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(h,m,g){var D=c(h);D?D.getDataAsync(function(v,E){if(E){m(v,E);return}v&&v.length?m(v.toString(g||"utf8")):m("")}):m("")},deleteFile:function(h,m=!0){var g=c(h);g&&i.deleteFile(g.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 g=c(h);g&&(g.comment=m)},getZipEntryComment:function(h){var m=c(h);return m&&m.comment||""},updateFile:function(h,m){var g=c(h);g&&g.setData(m)},addLocalFile:function(h,m,g,D){if(o.fs.existsSync(h)){m=m?f(m):"";let v=Xe.win32.basename(Xe.win32.normalize(h));m+=g||v;let E=o.fs.statSync(h),y=E.isFile()?o.fs.readFileSync(h):Buffer.alloc(0);E.isDirectory()&&(m+=o.sep),this.addFile(m,y,D,E)}else throw Ke.Errors.FILE_NOT_FOUND(h)},addLocalFileAsync:function(h,m){h=typeof h=="object"?h:{localPath:h};let g=Xe.resolve(h.localPath),{comment:D}=h,{zipPath:v,zipName:E}=h,y=this;o.fs.stat(g,function(_,S){if(_)return m(_,!1);v=v?f(v):"";let k=Xe.win32.basename(Xe.win32.normalize(g));if(v+=E||k,S.isFile())o.fs.readFile(g,function(T,B){return T?m(T,!1):(y.addFile(v,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return v+=o.sep,y.addFile(v,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(h,m,g){if(g=d(g),m=m?f(m):"",h=Xe.normalize(h),o.fs.existsSync(h)){let D=o.findFiles(h),v=this;if(D.length)for(let E of D){let y=Xe.join(m,p(h,E));g(y)&&v.addLocalFile(E,Xe.dirname(y))}}else throw Ke.Errors.FILE_NOT_FOUND(h)},addLocalFolderAsync:function(h,m,g,D){D=d(D),g=g?f(g):"",h=Xe.normalize(h);var v=this;o.fs.open(h,"r",function(E){if(E&&E.code==="ENOENT")m(void 0,Ke.Errors.FILE_NOT_FOUND(h));else if(E)m(void 0,E);else{var y=o.findFiles(h),_=-1,S=function(){if(_+=1,_<y.length){var k=y[_],T=p(h,k).split("\\").join("/");T=T.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(T)?o.fs.stat(k,function(B,F){B&&m(void 0,B),F.isFile()?o.fs.readFile(k,function(L,A){L?m(void 0,L):(v.addFile(g+T,A,"",F),S())}):(v.addFile(g+T+"/",Buffer.alloc(0),"",F),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(h,m){let g=this;h=typeof h=="object"?h:{localPath:h},localPath=Xe.resolve(f(h.localPath));let{zipPath:D,filter:v,namefix:E}=h;v instanceof RegExp?v=(function(S){return function(k){return S.test(k)}})(v):typeof v!="function"&&(v=function(){return!0}),D=D?f(D):"",E=="latin1"&&(E=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof E!="function"&&(E=S=>S);let y=S=>Xe.join(D,E(p(localPath,S))),_=S=>Xe.win32.basename(Xe.win32.normalize(E(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ke.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(k,T){if(k)return m(k);T=T.filter(B=>v(y(B))),T.length||m(void 0,!1),setImmediate(T.reverse().reduce(function(B,F){return function(L,A){if(L||A===!1)return setImmediate(B,L,!1);g.addLocalFileAsync({localPath:F,zipPath:Xe.dirname(y(F)),zipName:_(F)},B)}},m))})})},addLocalFolderPromise:function(h,m){return new Promise((g,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:h},m),(v,E)=>{v&&D(v),E&&g(this)})})},addFile:function(h,m,g,D){h=u(h);let v=c(h),E=v!=null;E||(v=new J$(n),v.entryName=h),v.comment=g||"";let y=typeof D=="object"&&D instanceof o.fs.Stats;y&&(v.header.time=D.mtime);var _=v.isDirectory?16:0;let S=v.isDirectory?16384:32768;return y?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=v.isDirectory?493:420,_=(_|S<<16)>>>0,v.attr=_,v.setData(m),E||i.setEntry(v),v},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,g,D,v,E){D=Qn(!1,D),v=Qn(!1,v),g=Qn(!0,g),E=Cb(v,E);var y=c(h);if(!y)throw Ke.Errors.NO_ENTRY();var _=a(y.entryName),S=s(m,E&&!y.isDirectory?E:g?_:Xe.basename(_));if(y.isDirectory){var k=i.getEntryChildren(y);return k.forEach(function(F){if(F.isDirectory)return;var L=F.getData();if(!L)throw Ke.Errors.CANT_EXTRACT_FILE();var A=a(F.entryName),q=s(m,g?A:Xe.basename(A));let j=v?F.header.fileAttr:void 0;o.writeFileTo(q,L,D,j)}),!0}var T=y.getData(i.password);if(!T)throw Ke.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ke.Errors.CANT_OVERRIDE();let B=v?h.header.fileAttr:void 0;return o.writeFileTo(S,T,D,B),!0},test:function(h){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var g=i.entries[m].getData(h);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(h,m,g,D){if(g=Qn(!1,g),D=Cb(g,D),m=Qn(!1,m),!i)throw Ke.Errors.NO_ZIP();i.entries.forEach(function(v){var E=s(h,a(v.entryName));if(v.isDirectory){o.makeDir(E);return}var y=v.getData(D);if(!y)throw Ke.Errors.CANT_EXTRACT_FILE();let _=g?v.header.fileAttr:void 0;o.writeFileTo(E,y,m,_);try{o.fs.utimesSync(E,v.header.time,v.header.time)}catch{throw Ke.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(h,m,g,D){if(D=Z$(m,g,D),g=Qn(!1,g),m=Qn(!1,m),!D)return new Promise((S,k)=>{this.extractAllToAsync(h,m,g,function(T){T?k(T):S(this)})});if(!i){D(Ke.Errors.NO_ZIP());return}h=Xe.resolve(h);let v=S=>s(h,Xe.normalize(a(S.entryName))),E=(S,k)=>new Error(S+': "'+k+'"'),y=[],_=[];i.entries.forEach(S=>{S.isDirectory?y.push(S):_.push(S)});for(let S of y){let k=v(S),T=g?S.header.fileAttr:void 0;try{o.makeDir(k),T&&o.fs.chmodSync(k,T),o.fs.utimesSync(k,S.header.time,S.header.time)}catch{D(E("Unable to create folder",k))}}_.reverse().reduce(function(S,k){return function(T){if(T)S(T);else{let B=Xe.normalize(a(k.entryName)),F=s(h,B);k.getDataAsync(function(L,A){if(A)S(A);else if(!L)S(Ke.Errors.CANT_EXTRACT_FILE());else{let q=g?k.header.fileAttr:void 0;o.writeFileToAsync(F,L,m,q,function(j){j||S(E("Unable to write file",F)),o.fs.utimes(F,k.header.time,k.header.time,function(Z){Z?S(E("Unable to set times",F)):S()})})}})}}},D)()},writeZip:function(h,m){if(arguments.length===1&&typeof h=="function"&&(m=h,h=""),!h&&n.filename&&(h=n.filename),!!h){var g=i.compressToBuffer();if(g){var D=o.writeFileTo(h,g,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(h,m){let{overwrite:g,perm:D}=Object.assign({overwrite:!0},m);return new Promise((v,E)=>{!h&&n.filename&&(h=n.filename),h||E("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(y=>{let _=S=>S?v(S):E("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(h,y,g,D,_)},E)})},toBufferPromise:function(){return new Promise((h,m)=>{i.toAsyncBuffer(h,m)})},toBuffer:function(h,m,g,D){return typeof h=="function"?(i.toAsyncBuffer(h,m,g,D),null):i.compressToBuffer()}}}});var Ab=x((Zz,xb)=>{var Sb={};xb.exports=Sb;var _b={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(_b).forEach(function(t){var e=_b[t],r=Sb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var Fb=x((Qz,Ob)=>{"use strict";Ob.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 kb=x((eK,Pb)=>{"use strict";var e3=require("os"),Pr=Fb(),Tt=process.env,di=void 0;Pr("no-color")||Pr("no-colors")||Pr("color=false")?di=!1:(Pr("color")||Pr("colors")||Pr("color=true")||Pr("color=always"))&&(di=!0);"FORCE_COLOR"in Tt&&(di=Tt.FORCE_COLOR.length===0||parseInt(Tt.FORCE_COLOR,10)!==0);function t3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function r3(t){if(di===!1)return 0;if(Pr("color=16m")||Pr("color=full")||Pr("color=truecolor"))return 3;if(Pr("color=256"))return 2;if(t&&!t.isTTY&&di!==!0)return 0;var e=di?1:0;if(process.platform==="win32"){var r=e3.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 Tt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Tt})||Tt.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Tt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Tt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Tt){var n=parseInt((Tt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Tt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Tt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Tt.TERM)||"COLORTERM"in Tt?1:(Tt.TERM==="dumb",e)}function sh(t){var e=r3(t);return t3(e)}Pb.exports={supportsColor:sh,stdout:sh(process.stdout),stderr:sh(process.stderr)}});var Ib=x((tK,$b)=>{$b.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 Rb=x((rK,Tb)=>{Tb.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(f){c=f===u}),c}function s(u,c){var f="",d,p;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(p in u)if(!a(p)){switch(f=f+u[p],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var h=["up","mid","down"];for(var m in h)for(var g=h[m],D=0;D<=d[g];D++)c[g]&&(f=f+n[g][i(n[g].length)])}return f}return s(e,r)}});var Nb=x((nK,Bb)=>{Bb.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 jb=x((oK,Lb)=>{Lb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var Mb=x((iK,Ub)=>{Ub.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 Hb=x((aK,qb)=>{qb.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 Yb=x((uK,Wb)=>{var me={};Wb.exports=me;me.themes={};var n3=require("util"),eo=me.styles=Ab(),zb=Object.defineProperties,o3=new RegExp(/[\r\n]+/g);me.supportsColor=kb().supportsColor;typeof me.enabled>"u"&&(me.enabled=me.supportsColor()!==!1);me.enable=function(){me.enabled=!0};me.disable=function(){me.enabled=!1};me.stripColors=me.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var sK=me.stylize=function(e,r){if(!me.enabled)return e+"";var n=eo[r];return!n&&r in me?me[r](e):n.open+e+n.close},i3=/[|\\{}()[\]^$+*?.]/g,a3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(i3,"\\$&")};function Kb(t){var e=function r(){return u3.apply(r,arguments)};return e._styles=t,e.__proto__=s3,e}var Gb=(function(){var t={};return eo.grey=eo.gray,Object.keys(eo).forEach(function(e){eo[e].closeRe=new RegExp(a3(eo[e].close),"g"),t[e]={get:function(){return Kb(this._styles.concat(e))}}}),t})(),s3=zb(function(){},Gb);function u3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:n3.inspect(a)}).join(" ");if(!me.enabled||!e)return e;for(var r=e.indexOf(`
31
- `)!=-1,n=this._styles,o=n.length;o--;){var i=eo[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(o3,function(a){return i.close+a+i.open}))}return e}me.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){me[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=me[t[r][i]](o);return o}return me[t[r]](n)}})(e)};function c3(){var t={};return Object.keys(Gb).forEach(function(e){t[e]={get:function(){return Kb([e])}}}),t}var l3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};me.trap=Ib();me.zalgo=Rb();me.maps={};me.maps.america=Nb()(me);me.maps.zebra=jb()(me);me.maps.rainbow=Mb()(me);me.maps.random=Hb()(me);for(Vb in me.maps)(function(t){me[t]=function(e){return l3(me.maps[t],e)}})(Vb);var Vb;zb(me,c3())});var Xb=x((cK,Jb)=>{var f3=Yb();Jb.exports=f3});var Zb=x(uh=>{"use strict";uh.indent=function(e){return new Array(e+1).join(" ")};uh.getMaxIndexLength=function(t){var e=0;return Object.getOwnPropertyNames(t).forEach(function(r){t[r]!==void 0&&(e=Math.max(e,r.length))}),e}});var Qb=x((fK,d3)=>{d3.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 ew=x(za=>{"use strict";var Br=Xb(),$n=Zb(),p3=/[^\w\s\n\r\v\t\.,]/i;za.version=Qb().version;var ch=function(t,e){return t!==void 0||e.renderUndefined},ac=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
32
- `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&ac(t[0],!0,r))},h3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Br[e.stringColor](t):t;var r=t+"";return t===!0?Br.green(r):t===!1?Br.red(r):t==null?Br.grey(r):typeof t=="number"?t>=0?Br[e.positiveNumberColor](r):Br[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},lh=function(t,e){return t.multilineStringColor===null||t.noColor?e:Br[t.multilineStringColor](e)},m3=function(t,e,r){var n=t.split(`
33
- `);return n=n.map(function(o){return $n.indent(e)+lh(r,o)}),n.join(`
34
- `)},pi=function(t,e,r){if(typeof t=="string"&&t.match(p3)&&e.escape&&(t=JSON.stringify(t)),!ch(t,e))return[];if(ac(t,!1,e))return[$n.indent(r)+h3(t,e)];if(typeof t=="string")return[$n.indent(r)+lh(e,'"""'),m3(t,r+e.defaultIndentation,e),$n.indent(r)+lh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[$n.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(ch(s,e)){var u="- ";e.noColor||(u=Br[e.dashColor](u)),u=$n.indent(r)+u,ac(s,!1,e)?(u+=pi(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,pi(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return pi({message:t.message,stack:t.stack.split(`
35
- `)},e,r);var o=e.noAlign?0:$n.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(ch(t[s],e))if(i=s+": ",e.noColor||(i=Br[e.keysColor](i)),i=$n.indent(r)+i,ac(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=pi(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,pi(t[s],e,r+e.defaultIndentation))}),a};za.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,pi(e,r,n).join(`
36
- `)};za.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
37
- `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Br.red("Error:")+" Not valid JSON!"}return o+=za.render(i,r,n),o}});var ph=x(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});sc.default=void 0;function hi(t){"@babel/helpers - typeof";return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hi(t)}function 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,y3(n.key),n)}}function g3(t,e,r){return e&&tw(t.prototype,e),r&&tw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function y3(t){var e=D3(t,"string");return hi(e)=="symbol"?e:e+""}function D3(t,e){if(hi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function b3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w3(t,e,r){return e=Ga(e),v3(t,dh()?Reflect.construct(e,r||[],Ga(t).constructor):e.apply(t,r))}function v3(t,e){if(e&&(hi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return C3(t)}function C3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function E3(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&&Ka(t,e)}function fh(t){var e=typeof Map=="function"?new Map:void 0;return fh=function(n){if(n===null||!S3(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 _3(n,arguments,Ga(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ka(o,n)},fh(t)}function _3(t,e,r){if(dh())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ka(o,r.prototype),o}function dh(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dh=function(){return!!t})()}function S3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ka(t,e){return Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ka(t,e)}function Ga(t){return Ga=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Ga(t)}var x3=(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(b3(this,e),n=w3(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(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return E3(e,t),g3(e)})(fh(Error)),pK=sc.default=x3});var hh=x(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.enableDebugLog=A3;uc.log=O3;var rw=!1;function A3(){rw=!0}function O3(t){rw&&console.log(t)}});var ow=x(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.default=void 0;function Wa(t){"@babel/helpers - typeof";return Wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wa(t)}function F3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nw(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 P3(t,e,r){return e&&nw(t.prototype,e),r&&nw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function k3(t){var e=$3(t,"string");return Wa(e)=="symbol"?e:e+""}function $3(t,e){if(Wa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gK=cc.default=(function(){function t(){F3(this,t)}return P3(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 iw=x((mh,gh)=>{(function(t,e){typeof mh=="object"&&typeof gh<"u"?gh.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:mh,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 N={};return I.forEach(function(X,U){return N[X]=U}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(I){return new Uint8Array(Array.prototype.slice.call(I,0))},d=function(I){return I.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},p=function(I){return I.replace(/[^A-Za-z0-9\+\/]/g,"")},h=function(I){for(var N,X,U,oe,Zt="",K=I.length%3,Se=0;Se<I.length;){if((X=I.charCodeAt(Se++))>255||(U=I.charCodeAt(Se++))>255||(oe=I.charCodeAt(Se++))>255)throw new TypeError("invalid character found");N=X<<16|U<<8|oe,Zt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return K?Zt.slice(0,K-3)+"===".substring(K):Zt},m=typeof btoa=="function"?function(I){return btoa(I)}:r?function(I){return Buffer.from(I,"binary").toString("base64")}:h,g=r?function(I){return Buffer.from(I).toString("base64")}:function(I){for(var N=4096,X=[],U=0,oe=I.length;U<oe;U+=N)X.push(c.apply(null,I.subarray(U,U+N)));return m(X.join(""))},D=function(I,N){return N===void 0&&(N=!1),N?d(g(I)):g(I)},v=function(I){if(I.length<2){var N=I.charCodeAt(0);return N<128?I:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},E=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,y=function(I){return I.replace(E,v)},_=r?function(I){return Buffer.from(I,"utf8").toString("base64")}:o?function(I){return g(o.encode(I))}:function(I){return m(y(I))},S=function(I,N){return N===void 0&&(N=!1),N?d(_(I)):_(I)},k=function(I){return S(I,!0)},T=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(I){switch(I.length){case 4:var N=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),X=N-65536;return c((X>>>10)+55296)+c((X&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))}},F=function(I){return I.replace(T,B)},L=function(I){if(I=I.replace(/\s+/g,""),!u.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));for(var N,X,U,oe=[],Zt=0;Zt<I.length;)N=s[I.charAt(Zt++)]<<18|s[I.charAt(Zt++)]<<12|(X=s[I.charAt(Zt++)])<<6|(U=s[I.charAt(Zt++)]),X===64?oe.push(c(N>>16&255)):U===64?oe.push(c(N>>16&255,N>>8&255)):oe.push(c(N>>16&255,N>>8&255,N&255));return oe.join("")},A=typeof atob=="function"?function(I){return atob(p(I))}:r?function(I){return Buffer.from(I,"base64").toString("binary")}:L,q=r?function(I){return f(Buffer.from(I,"base64"))}:function(I){return f(A(I).split("").map(function(N){return N.charCodeAt(0)}))},j=function(I){return q(P(I))},Z=r?function(I){return Buffer.from(I,"base64").toString("utf8")}:n?function(I){return n.decode(q(I))}:function(I){return F(A(I))},P=function(I){return p(I.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},b=function(I){return Z(P(I))},w=function(I){if(typeof I!="string")return!1;var N=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},C=function(I){return{value:I,enumerable:!1,writable:!0,configurable:!0}},O=function(){var I=function(N,X){return Object.defineProperty(String.prototype,N,C(X))};I("fromBase64",function(){return b(this)}),I("toBase64",function(N){return S(this,N)}),I("toBase64URI",function(){return S(this,!0)}),I("toBase64URL",function(){return S(this,!0)}),I("toUint8Array",function(){return j(this)})},R=function(){var I=function(N,X){return Object.defineProperty(Uint8Array.prototype,N,C(X))};I("toBase64",function(N){return D(this,N)}),I("toBase64URI",function(){return D(this,!0)}),I("toBase64URL",function(){return D(this,!0)})},$=function(){O(),R()},H={version:t,VERSION:e,atob:A,atobPolyfill:L,btoa:m,btoaPolyfill:h,fromBase64:b,toBase64:S,encode:S,encodeURI:k,encodeURL:k,utob:y,btou:F,decode:b,isValid:w,fromUint8Array:D,toUint8Array:j,extendString:O,extendUint8Array:R,extendBuiltins:$};return H.Base64={},Object.keys(H).forEach(function(I){return H.Base64[I]=H[I]}),H})});var sw=x((DK,aw)=>{"use strict";aw.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 lw=x(yh=>{"use strict";var I3=Object.prototype.hasOwnProperty,T3;function uw(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function cw(t){try{return encodeURIComponent(t)}catch{return null}}function R3(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=uw(n[1]),i=uw(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function B3(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(I3.call(t,o)){if(n=t[o],!n&&(n===null||n===T3||isNaN(n))&&(n=""),o=cw(o),n=cw(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}yh.stringify=B3;yh.parse=R3});var Dw=x((wK,yw)=>{"use strict";var dw=sw(),lc=lw(),N3=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,pw=/[\n\r\t]/g,L3=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,hw=/:\d+$/,j3=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,U3=/^[a-zA-Z]:/;function bh(t){return(t||"").toString().replace(N3,"")}var Dh=[["#","hash"],["?","query"],function(e,r){return Nr(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]],fw={hash:1,query:1};function mw(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 Lr(unescape(t.pathname),{});else if(o==="string"){n=new Lr(t,{});for(i in fw)delete n[i]}else if(o==="object"){for(i in t)i in fw||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=L3.test(t.href))}return n}function Nr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function gw(t,e){t=bh(t),t=t.replace(pw,""),e=e||{};var r=j3.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)):Nr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Nr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Nr(n),slashesCount:a,rest:s}}function M3(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 Lr(t,e,r){if(t=bh(t),t=t.replace(pw,""),!(this instanceof Lr))return new Lr(t,e,r);var n,o,i,a,s,u,c=Dh.slice(),f=typeof e,d=this,p=0;for(f!=="object"&&f!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=lc.parse),e=mw(e),o=gw(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||U3.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Nr(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=M3(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Nr(d.protocol)&&(d.pathname="/"+d.pathname),dw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Nr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function q3(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||lc.parse)(e)),n[t]=e;break;case"port":n[t]=e,dw(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,hw.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<Dh.length;a++){var s=Dh[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:"&&Nr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function H3(t){(!t||typeof t!="function")&&(t=lc.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||Nr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Nr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||hw.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}Lr.prototype={set:q3,toString:H3};Lr.extractProtocol=gw;Lr.location=mw;Lr.trimLeft=bh;Lr.qs=lc;yw.exports=Lr});var bw=x(wh=>{"use strict";Object.defineProperty(wh,"__esModule",{value:!0});wh.default=V3;function V3(){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 Tw=x(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});hc.default=void 0;var z3=iw(),K3=Eh(Dw()),fc=Eh(ph()),to=hh(),G3=Eh(bw());function Eh(t){return t&&t.__esModule?t:{default:t}}function vh(){"use strict";vh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",g="completed",D={};function v(){}function E(){}function y(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var T=y.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&ro(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){X.value=oe,H(X)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function P(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(ro(b)+" is not iterable")}return E.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:E,configurable:!0}),E.displayName=c(y,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,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function ww(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 W3(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){ww(i,n,o,a,s,"next",u)}function s(u){ww(i,n,o,a,s,"throw",u)}a(void 0)})}}function Fw(t,e){return X3(t)||J3(t,e)||Pw(t,e)||Y3()}function Y3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function J3(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(f){c=!0,o=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function X3(t){if(Array.isArray(t))return t}function ro(t){"@babel/helpers - typeof";return ro=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},ro(t)}function Z3(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
39
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Pw(t,e){if(t){if(typeof t=="string")return vw(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 vw(t,e)}}function vw(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 Cw(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 mi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Cw(Object(r),!0).forEach(function(n){Q3(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Cw(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Q3(t,e,r){return e=kw(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eI(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,kw(n.key),n)}}function tI(t,e,r){return e&&Ew(t.prototype,e),r&&Ew(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function kw(t){var e=rI(t,"string");return ro(e)=="symbol"?e:e+""}function rI(t,e){if(ro(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ro(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dc="tus-v1",pc="ietf-draft-03",Ya="ietf-draft-05",nI={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:Iw,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:dc},$w=(function(){function t(e,r){eI(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 tI(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(![dc,pc,Ya].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,to.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,to.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:iI(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(f,d){f.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(f,d){var p=0;return n._source.slice(f.start,f.end).then(function(h){var m=h.value;return new Promise(function(g,D){var v=mi(mi({},n.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:mi(mi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:D,onProgress:function(_){i=i-p+_,p=_,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=E.url,n._parallelUploadUrls.filter(function(_){return!!_}).length===s.length&&n._saveUploadInUrlStorage()}}),E=new t(m,v);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 f=_w(n.options.metadata);return f!==""&&c.setHeader("Upload-Metadata",f),n._sendRequest(c,null)}).then(function(f){if(!gi(f.getStatus(),200)){n._emitHttpError(c,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){n._emitHttpError(c,f,"tus: invalid or missing Location header");return}n.url=Ow(n.options.endpoint,d),(0,to.log)("Created upload at ".concat(n.url)),n._emitSuccess(f)}).catch(function(f){n._emitError(f)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,to.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,to.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,to.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=Z3(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 fc.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),Aw(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=_w(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===pc||this.options.protocol===Ya)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!gi(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=Ow(r.options.endpoint,s),(0,to.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(!gi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(gi(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===dc){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(!gi(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===dc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ya&&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 f=n._offset+c;return!n.options.uploadLengthDeferred&&u&&f!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(f," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===pc||n.options.protocol===Ya)&&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=Sw(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 xw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=Sw("DELETE",r,n);return xw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new fc.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof fc.default||(i=new fc.default("tus: failed to terminate upload",i,o,null)),!Aw(i,0,n))throw i;var a=n.retryDelays[0],s=n.retryDelays.slice(1),u=mi(mi({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function _w(t){return Object.entries(t).map(function(e){var r=Fw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(z3.Base64.encode(String(o)))}).join(",")}function gi(t,e){return t>=e&&t<e+100}function Sw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===pc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ya?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=Fw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var f=(0,G3.default)();n.setHeader("X-Request-ID",f)}return n}function xw(t,e,r){return Ch.apply(this,arguments)}function Ch(){return Ch=W3(vh().mark(function t(e,r,n){var o;return vh().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)})),Ch.apply(this,arguments)}function oI(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function Aw(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):Iw(t)}function Iw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!gi(e,400)||e===409||e===423)&&oI()}function Ow(t,e){return new K3.default(e,t).toString()}function iI(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}$w.defaultOptions=nI;var CK=hc.default=$w});var Bw=x((_K,Rw)=>{"use strict";var jr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";jr.writable=t=>jr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";jr.readable=t=>jr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";jr.duplex=t=>jr.writable(t)&&jr.readable(t);jr.transform=t=>jr.duplex(t)&&typeof t._transform=="function";Rw.exports=jr});var Lw=x(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.default=void 0;function Ja(t){"@babel/helpers - typeof";return Ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ja(t)}function aI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Nw(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,uI(n.key),n)}}function sI(t,e,r){return e&&Nw(t.prototype,e),r&&Nw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function uI(t){var e=cI(t,"string");return Ja(e)=="symbol"?e:e+""}function cI(t,e){if(Ja(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ja(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var SK=mc.default=(function(){function t(e){aI(this,t),this._buffer=e,this.size=e.length}return sI(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 qw=x(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.default=mI;var Mw=require("fs");function no(t){"@babel/helpers - typeof";return no=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},no(t)}function _h(){"use strict";_h=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",g="completed",D={};function v(){}function E(){}function y(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var T=y.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&no(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){X.value=oe,H(X)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function P(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(no(b)+" is not iterable")}return E.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:E,configurable:!0}),E.displayName=c(y,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,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function lI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jw(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,dI(n.key),n)}}function fI(t,e,r){return e&&jw(t.prototype,e),r&&jw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dI(t){var e=pI(t,"string");return no(e)=="symbol"?e:e+""}function pI(t,e){if(no(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(no(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Uw(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 hI(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Uw(i,n,o,a,s,"next",u)}function s(u){Uw(i,n,o,a,s,"throw",u)}a(void 0)})}}function mI(t){return Sh.apply(this,arguments)}function Sh(){return Sh=hI(_h().mark(function t(e){var r,n,o,i,a,s,u;return _h().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return n=e.path.toString(),f.next=3,Mw.promises.stat(n);case 3:return o=f.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,f.abrupt("return",new gI(e,n,u));case 9:case"end":return f.stop()}},t)})),Sh.apply(this,arguments)}var gI=(function(){function t(e,r,n){lI(this,t),this._stream=e,this._path=r,this.size=n}return fI(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,Mw.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 Oh=x(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.default=void 0;function oo(t){"@babel/helpers - typeof";return oo=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},oo(t)}function Xa(){"use strict";Xa=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var p="suspendedStart",h="suspendedYield",m="executing",g="completed",D={};function v(){}function E(){}function y(){}var _={};c(_,a,function(){return this});var S=Object.getPrototypeOf,k=S&&S(S(P([])));k&&k!==r&&n.call(k,a)&&(_=k);var T=y.prototype=v.prototype=Object.create(_);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&oo(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(oe){C("next",oe,H,I)},function(oe){C("throw",oe,H,I)}):w.resolve(U).then(function(oe){X.value=oe,H(X)},function(oe){return C("throw",oe,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=p;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===p)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:h,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function P(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(oo(b)+" is not iterable")}return E.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:E,configurable:!0}),E.displayName=c(y,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,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=P,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:P(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function yI(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,bI(n.key),n)}}function DI(t,e,r){return e&&Hw(t.prototype,e),r&&Hw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function bI(t){var e=wI(t,"string");return oo(e)=="symbol"?e:e+""}function wI(t,e){if(oo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(oo(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 zw(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 vI(t,e){return Ah.apply(this,arguments)}function Ah(){return Ah=zw(Xa().mark(function t(e,r){return Xa().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",new Promise(function(i,a){var s=function(f){e.off("readable",u),a(f)},u=function c(){var f=e.read(r);f!==null&&(e.off("error",s),e.off("readable",c),i(f))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Ah.apply(this,arguments)}var OK=gc.default=(function(){function t(e){var r=this;yI(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 DI(t,[{key:"slice",value:(function(){var e=zw(Xa().mark(function n(o,i){var a,s,u,c,f;return Xa().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(!(o<this._bufPos)){p.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){p.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){p.next=6;break}throw this._error;case 6:if(o<this._bufPos+this._buf.length?(s=o-this._bufPos,u=Math.min(this._buf.length,i-this._bufPos),a=this._buf.slice(s,u)):a=Buffer.alloc(0),!this._ended){p.next=10;break}return a.size=a.length,p.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){p.next=16;break}return p.next=14,vI(this._stream,c-a.length);case 14:f=p.sent,a=Buffer.concat([a,f]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,p.abrupt("return",{value:a,done:this._ended});case 20:case"end":return p.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Gw=x(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});Dc.default=void 0;var CI=require("fs"),EI=yc(Bw()),_I=yc(Lw()),SI=yc(qw()),xI=yc(Oh());function yc(t){return t&&t.__esModule?t:{default:t}}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 AI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Kw(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,FI(n.key),n)}}function OI(t,e,r){return e&&Kw(t.prototype,e),r&&Kw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function FI(t){var e=PI(t,"string");return Za(e)=="symbol"?e:e+""}function PI(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 PK=Dc.default=(function(){function t(){AI(this,t)}return OI(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new _I.default(r)):r instanceof CI.ReadStream&&r.path!=null?(0,SI.default)(r):EI.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new xI.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 Xw=x(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.default=II;var kI=require("crypto"),Ww=Jw(require("fs")),$I=Jw(require("path"));function Yw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Yw=function(n){return n?r:e})(t)}function Jw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Yw(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 II(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,kI.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof Ww.ReadStream&&t.path!=null?new Promise(function(a,s){var u=$I.resolve(t.path);Ww.stat(t.path,function(c,f){if(c){s(c);return}var d=["node-file",u,f.size,f.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var rv=x((IK,tv)=>{var ev="Expected a function",Zw=NaN,TI="[object Symbol]",RI=/^\s+|\s+$/g,BI=/^[-+]0x[0-9a-f]+$/i,NI=/^0b[01]+$/i,LI=/^0o[0-7]+$/i,jI=parseInt,UI=typeof global=="object"&&global&&global.Object===Object&&global,MI=typeof self=="object"&&self&&self.Object===Object&&self,qI=UI||MI||Function("return this")(),HI=Object.prototype,VI=HI.toString,zI=Math.max,KI=Math.min,Ph=function(){return qI.Date.now()};function GI(t,e,r){var n,o,i,a,s,u,c=0,f=!1,d=!1,p=!0;if(typeof t!="function")throw new TypeError(ev);e=Qw(e)||0,bc(r)&&(f=!!r.leading,d="maxWait"in r,i=d?zI(Qw(r.maxWait)||0,e):i,p="trailing"in r?!!r.trailing:p);function h(k){var T=n,B=o;return n=o=void 0,c=k,a=t.apply(B,T),a}function m(k){return c=k,s=setTimeout(v,e),f?h(k):a}function g(k){var T=k-u,B=k-c,F=e-T;return d?KI(F,i-B):F}function D(k){var T=k-u,B=k-c;return u===void 0||T>=e||T<0||d&&B>=i}function v(){var k=Ph();if(D(k))return E(k);s=setTimeout(v,g(k))}function E(k){return s=void 0,p&&n?h(k):(n=o=void 0,a)}function y(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function _(){return s===void 0?a:E(Ph())}function S(){var k=Ph(),T=D(k);if(n=arguments,o=this,u=k,T){if(s===void 0)return m(u);if(d)return s=setTimeout(v,e),h(u)}return s===void 0&&(s=setTimeout(v,e)),a}return S.cancel=y,S.flush=_,S}function WI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(ev);return bc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),GI(t,e,{leading:n,maxWait:e,trailing:o})}function bc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function YI(t){return!!t&&typeof t=="object"}function JI(t){return typeof t=="symbol"||YI(t)&&VI.call(t)==TI}function Qw(t){if(typeof t=="number")return t;if(JI(t))return Zw;if(bc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=bc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(RI,"");var r=NI.test(t);return r||LI.test(t)?jI(t.slice(2),r?2:8):BI.test(t)?Zw:+t}tv.exports=WI});var fv=x(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});Ec.default=void 0;var XI=uv(require("http")),ZI=uv(require("https")),iv=require("stream"),QI=require("url"),av=eT(rv());function eT(t){return t&&t.__esModule?t:{default:t}}function sv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(sv=function(n){return n?r:e})(t)}function uv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=sv(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 tT(t,e,r){return e=wc(e),rT(t,cv()?Reflect.construct(e,r||[],wc(t).constructor):e.apply(t,r))}function rT(t,e){if(e&&(yi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nT(t)}function nT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function cv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(cv=function(){return!!t})()}function wc(t){return wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wc(t)}function oT(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&&kh(t,e)}function kh(t,e){return kh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},kh(t,e)}function nv(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 Qa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nv(Object(r),!0).forEach(function(n){iT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nv(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function iT(t,e,r){return e=lv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yi(t){"@babel/helpers - typeof";return yi=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},yi(t)}function vc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ov(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,lv(n.key),n)}}function Cc(t,e,r){return e&&ov(t.prototype,e),r&&ov(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function lv(t){var e=aT(t,"string");return yi(e)=="symbol"?e:e+""}function aT(t,e){if(yi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(yi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var TK=Ec.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vc(this,t),this._requestOptions=e}return Cc(t,[{key:"createRequest",value:function(r,n){return new sT(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),sT=(function(){function t(e,r,n){vc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Cc(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=Qa(Qa(Qa({},(0,QI.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Qa(Qa({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?ZI:XI;r._request=s.request(a);var u=r._request;u.on("response",function(c){var f=[];c.on("data",function(d){f.push(d)}),c.on("end",function(){var d=Buffer.concat(f).toString("utf8");o(new uT(c,d))})}),u.on("error",function(c){i(c)}),n instanceof iv.Readable?n.pipe(new cT(r._progressHandler)).pipe(u):n instanceof Uint8Array?lT(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}}])})(),uT=(function(){function t(e,r){vc(this,t),this._response=e,this._body=r}return Cc(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}}])})(),cT=(function(t){function e(r){var n;return vc(this,e),n=tT(this,e),n._onprogress=(0,av.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return oT(e,t),Cc(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(iv.Transform),lT=function(e,r,n){n=(0,av.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 dv=x($h=>{"use strict";$h.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};$h.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 Gy(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 ed(){if(Ae.env.NO_COLOR||Ae.env.FORCE_COLOR==="0"||Ae.env.FORCE_COLOR==="false")return!1;if(Ae.env.FORCE_COLOR||Ae.env.CLICOLOR_FORCE!==void 0)return!0}td.Command=Qf;td.useColor=ed});var Zy=x(fr=>{var{Argument:Yy}=su(),{Command:rd}=Wy(),{CommanderError:T2,InvalidArgumentError:Jy}=Sa(),{Help:R2}=Kf(),{Option:Xy}=Jf();fr.program=new rd;fr.createCommand=t=>new rd(t);fr.createOption=(t,e)=>new Xy(t,e);fr.createArgument=(t,e)=>new Yy(t,e);fr.Command=rd;fr.Option=Xy;fr.Argument=Yy;fr.Help=R2;fr.CommanderError=T2;fr.InvalidArgumentError=Jy;fr.InvalidOptionArgumentError=Jy});var od=x((Yq,eD)=>{"use strict";var nd={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"},N2={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},L2={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?nd.up():"");return t&&(e+=nd.left),e}};eD.exports={cursor:nd,scroll:N2,erase:L2,beep:"\x07"}});var ad=x((Jq,id)=>{var lu=process||{},tD=lu.argv||[],cu=lu.env||{},j2=!(cu.NO_COLOR||tD.includes("--no-color"))&&(!!cu.FORCE_COLOR||tD.includes("--color")||lu.platform==="win32"||(lu.stdout||{}).isTTY&&cu.TERM!=="dumb"||!!cu.CI),U2=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+M2(o,e,r,i)+e:t+o+e},M2=(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)},rD=(t=j2)=>{let e=t?U2:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};id.exports=rD();id.exports.createColors=rD});var vu=x(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.isNXMonorepo=Ht.isMonorepo=Ht.findPackageRelativePathInMonorepo=Ht.findPackagePath=Ht.findNXMonorepoRoot=Ht.findMonorepoRoot=void 0;var Oa=require("node:fs"),Sn=require("node:path");function wu(t){let e=(0,Sn.join)(t,"package.json"),r=(0,Sn.join)(t,"pnpm-workspace.yaml");if((0,Oa.existsSync)(r)||(0,Oa.existsSync)(e)&&JSON.parse((0,Oa.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Sn.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return wu(n)}Ht.findMonorepoRoot=wu;function Dd(t){let e=(0,Sn.join)(t,"nx.json");if((0,Oa.existsSync)(e))return t;let r=(0,Sn.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Dd(r)}Ht.findNXMonorepoRoot=Dd;function bd(t,e,r){let n=(0,Sn.join)(e,"node_modules",t);if((0,Oa.existsSync)(n))return n;if(e===r)return null;let o=(0,Sn.dirname)(e);return bd(t,o,r)}Ht.findPackagePath=bd;function Ck(t,e){let r=wu(e),n=bd(t,e,r);return n?(0,Sn.relative)(e,n):null}Ht.findPackageRelativePathInMonorepo=Ck;function Ek(t){try{return wu(t),!0}catch{return!1}}Ht.isMonorepo=Ek;function _k(t){try{return Dd(t),!0}catch{return!1}}Ht.isNXMonorepo=_k});var we={};Qr(we,{__addDisposableResource:()=>a0,__assign:()=>Ou,__asyncDelegator:()=>ZD,__asyncGenerator:()=>XD,__asyncValues:()=>QD,__await:()=>Qo,__awaiter:()=>zD,__classPrivateFieldGet:()=>n0,__classPrivateFieldIn:()=>i0,__classPrivateFieldSet:()=>o0,__createBinding:()=>ku,__decorate:()=>LD,__disposeResources:()=>s0,__esDecorate:()=>UD,__exportStar:()=>GD,__extends:()=>BD,__generator:()=>KD,__importDefault:()=>r0,__importStar:()=>t0,__makeTemplateObject:()=>e0,__metadata:()=>VD,__param:()=>jD,__propKey:()=>qD,__read:()=>Od,__rest:()=>ND,__rewriteRelativeImportExtension:()=>u0,__runInitializers:()=>MD,__setFunctionName:()=>HD,__spread:()=>WD,__spreadArray:()=>JD,__spreadArrays:()=>YD,__values:()=>Fu,default:()=>Wk});function BD(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");xd(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function ND(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 LD(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 jD(t,e){return function(r,n){e(r,n,t)}}function UD(t,e,r,n,o,i){function a(v){if(v!==void 0&&typeof v!="function")throw new TypeError("Function expected");return v}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,h=!1,p=r.length-1;p>=0;p--){var m={};for(var g in n)m[g]=g==="access"?{}:n[g];for(var g in n.access)m.access[g]=n.access[g];m.addInitializer=function(v){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(a(v||null))};var D=(0,r[p])(s==="accessor"?{get:f.get,set:f.set}:f[u],m);if(s==="accessor"){if(D===void 0)continue;if(D===null||typeof D!="object")throw new TypeError("Object expected");(d=a(D.get))&&(f.get=d),(d=a(D.set))&&(f.set=d),(d=a(D.init))&&o.unshift(d)}else(d=a(D))&&(s==="field"?o.unshift(d):f[u]=d)}c&&Object.defineProperty(c,n.name,f),h=!0}function MD(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 qD(t){return typeof t=="symbol"?t:"".concat(t)}function HD(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 VD(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function zD(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(f){try{c(n.next(f))}catch(d){a(d)}}function u(f){try{c(n.throw(f))}catch(d){a(d)}}function c(f){f.done?i(f.value):o(f.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function KD(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(f){return u([c,f])}}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(f){c=[6,f],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function GD(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ku(e,t,r)}function Fu(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 Od(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 WD(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Od(arguments[e]));return t}function YD(){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 JD(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 Qo(t){return this instanceof Qo?(this.v=t,this):new Qo(t)}function XD(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(p){return function(m){return Promise.resolve(m).then(p,d)}}function s(p,m){n[p]&&(o[p]=function(g){return new Promise(function(D,v){i.push([p,g,D,v])>1||u(p,g)})},m&&(o[p]=m(o[p])))}function u(p,m){try{c(n[p](m))}catch(g){h(i[0][3],g)}}function c(p){p.value instanceof Qo?Promise.resolve(p.value.v).then(f,d):h(i[0][2],p)}function f(p){u("next",p)}function d(p){u("throw",p)}function h(p,m){p(m),i.shift(),i.length&&u(i[0][0],i[0][1])}}function ZD(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:Qo(t[o](a)),done:!1}:i?i(a):a}:i}}function QD(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 Fu=="function"?Fu(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 e0(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function t0(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Ad(t),n=0;n<r.length;n++)r[n]!=="default"&&ku(e,t,r[n]);return Kk(e,t),e}function r0(t){return t&&t.__esModule?t:{default:t}}function n0(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 o0(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 i0(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 a0(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 s0(t){function e(i){t.error=t.hasError?new Gk(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 u0(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 xd,Ou,ku,Kk,Ad,Gk,Wk,ve=et(()=>{xd=function(t,e){return xd=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])},xd(t,e)};Ou=function(){return Ou=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},Ou.apply(this,arguments)};ku=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]});Kk=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Ad=function(t){return Ad=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Ad(t)};Gk=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};Wk={__extends:BD,__assign:Ou,__rest:ND,__decorate:LD,__param:jD,__esDecorate:UD,__runInitializers:MD,__propKey:qD,__setFunctionName:HD,__metadata:VD,__awaiter:zD,__generator:KD,__createBinding:ku,__exportStar:GD,__values:Fu,__read:Od,__spread:WD,__spreadArrays:YD,__spreadArray:JD,__await:Qo,__asyncGenerator:XD,__asyncDelegator:ZD,__asyncValues:QD,__makeTemplateObject:e0,__importStar:t0,__importDefault:r0,__classPrivateFieldGet:n0,__classPrivateFieldSet:o0,__classPrivateFieldIn:i0,__addDisposableResource:a0,__disposeResources:s0,__rewriteRelativeImportExtension:u0}});var c0=x(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});Pu.resolveFetch=void 0;var Yk=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Pu.resolveFetch=Yk});var $d=x(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.FunctionRegion=hr.FunctionsHttpError=hr.FunctionsRelayError=hr.FunctionsFetchError=hr.FunctionsError=void 0;var ei=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};hr.FunctionsError=ei;var Fd=class extends ei{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};hr.FunctionsFetchError=Fd;var kd=class extends ei{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};hr.FunctionsRelayError=kd;var Pd=class extends ei{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};hr.FunctionsHttpError=Pd;var l0;(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"})(l0||(hr.FunctionRegion=l0={}))});var f0=x($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.FunctionsClient=void 0;var Jk=(ve(),ae(we)),Xk=c0(),ti=$d(),Id=class{constructor(e,{headers:r={},customFetch:n,region:o=ti.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=o,this.fetch=(0,Xk.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Jk.__awaiter(this,arguments,void 0,function*(r,n={}){var o;let i,a;try{let{headers:s,method:u,body:c,signal:f,timeout:d}=n,h={},{region:p}=n;p||(p=this.region);let m=new URL(`${this.url}/${r}`);p&&p!=="any"&&(h["x-region"]=p,m.searchParams.set("forceFunctionRegion",p));let g;c&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(h["Content-Type"]="application/octet-stream",g=c):typeof c=="string"?(h["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(h["Content-Type"]="application/json",g=JSON.stringify(c)):g=c;let D=f;d&&(a=new AbortController,i=setTimeout(()=>a.abort(),d),f?(D=a.signal,f.addEventListener("abort",()=>a.abort())):D=a.signal);let v=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},h),this.headers),s),body:g,signal:D}).catch(S=>{throw new ti.FunctionsFetchError(S)}),_=v.headers.get("x-relay-error");if(_&&_==="true")throw new ti.FunctionsRelayError(v);if(!v.ok)throw new ti.FunctionsHttpError(v);let y=((o=v.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),E;return y==="application/json"?E=yield v.json():y==="application/octet-stream"||y==="application/pdf"?E=yield v.blob():y==="text/event-stream"?E=v:y==="multipart/form-data"?E=yield v.formData():E=yield v.text(),{data:E,error:null,response:v}}catch(s){return{data:null,error:s,response:s instanceof ti.FunctionsHttpError||s instanceof ti.FunctionsRelayError?s.context:void 0}}finally{i&&clearTimeout(i)}})}};$u.FunctionsClient=Id});var Td=x(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.FunctionRegion=zt.FunctionsRelayError=zt.FunctionsHttpError=zt.FunctionsFetchError=zt.FunctionsError=zt.FunctionsClient=void 0;var Zk=f0();Object.defineProperty(zt,"FunctionsClient",{enumerable:!0,get:function(){return Zk.FunctionsClient}});var $a=$d();Object.defineProperty(zt,"FunctionsError",{enumerable:!0,get:function(){return $a.FunctionsError}});Object.defineProperty(zt,"FunctionsFetchError",{enumerable:!0,get:function(){return $a.FunctionsFetchError}});Object.defineProperty(zt,"FunctionsHttpError",{enumerable:!0,get:function(){return $a.FunctionsHttpError}});Object.defineProperty(zt,"FunctionsRelayError",{enumerable:!0,get:function(){return $a.FunctionsRelayError}});Object.defineProperty(zt,"FunctionRegion",{enumerable:!0,get:function(){return $a.FunctionRegion}})});var Nd=x(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});var Rd=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Bd.default=Rd});var Ud=x(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var Qk=(ve(),ae(we)),eP=Qk.__importDefault(Nd()),Ld=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 f=null,d=null,h=null,p=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let _=await i.text();_===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((a=this.headers.get("Accept"))===null||a===void 0)&&a.includes("application/vnd.pgrst.plan+text"))?d=_:d=JSON.parse(_))}let D=(s=this.headers.get("Prefer"))===null||s===void 0?void 0:s.match(/count=(exact|planned|estimated)/),v=(u=i.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");D&&v&&v.length>1&&(h=parseInt(v[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(f={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,h=null,p=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let D=await i.text();try{f=JSON.parse(D),Array.isArray(f)&&i.status===404&&(d=[],f=null,p=200,m="OK")}catch{i.status===404&&D===""?(p=204,m="No Content"):f={message:D}}if(f&&this.isMaybeSingle&&(!((c=f?.details)===null||c===void 0)&&c.includes("0 rows"))&&(f=null,p=200,m="OK"),f&&this.shouldThrowOnError)throw new eP.default(f)}return{error:f,data:d,count:h,status:p,statusText:m}});return this.shouldThrowOnError||(o=o.catch(i=>{var a,s,u,c,f,d;let h="",p=i?.cause;if(p){let m=(a=p?.message)!==null&&a!==void 0?a:"",g=(s=p?.code)!==null&&s!==void 0?s:"";h=`${(u=i?.name)!==null&&u!==void 0?u:"FetchError"}: ${i?.message}`,h+=`
28
+
29
+ Caused by: ${(c=p?.name)!==null&&c!==void 0?c:"Error"}: ${m}`,g&&(h+=` (${g})`),p?.stack&&(h+=`
30
+ ${p.stack}`)}else h=(f=i?.stack)!==null&&f!==void 0?f:"";return{error:{message:`${(d=i?.name)!==null&&d!==void 0?d:"FetchError"}: ${i?.message}`,details:h,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),o.then(e,r)}returns(){return this}overrideTypes(){return this}};jd.default=Ld});var Hd=x(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});var tP=(ve(),ae(we)),rP=tP.__importDefault(Ud()),Md=class extends rP.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}};qd.default=Md});var Iu=x(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var nP=(ve(),ae(we)),oP=nP.__importDefault(Hd()),iP=new RegExp("[,()]"),Vd=class extends oP.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(o=>typeof o=="string"&&iP.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}};zd.default=Vd});var Wd=x(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var aP=(ve(),ae(we)),Ia=aP.__importDefault(Iu()),Kd=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 Ia.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 Ia.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,f)=>c.concat(Object.keys(f)),[]);if(u.length>0){let c=[...new Set(u)].map(f=>`"${f}"`);this.url.searchParams.set("columns",c.join(","))}}return new Ia.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 Ia.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 Ia.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};Gd.default=Kd});var p0=x(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});var d0=(ve(),ae(we)),sP=d0.__importDefault(Wd()),uP=d0.__importDefault(Iu()),Yd=class t{constructor(e,{headers:r={},schema:n,fetch:o}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=o}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new sP.default(r,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new t(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,r={},{head:n=!1,get:o=!1,count:i}={}){var a;let s,u=new URL(`${this.url}/rpc/${e}`),c;n||o?(s=n?"HEAD":"GET",Object.entries(r).filter(([d,h])=>h!==void 0).map(([d,h])=>[d,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([d,h])=>{u.searchParams.append(d,h)})):(s="POST",c=r);let f=new Headers(this.headers);return i&&f.set("Prefer",`count=${i}`),new uP.default({method:s,url:u,headers:f,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};Jd.default=Yd});var Xd=x($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.PostgrestError=$t.PostgrestBuilder=$t.PostgrestTransformBuilder=$t.PostgrestFilterBuilder=$t.PostgrestQueryBuilder=$t.PostgrestClient=void 0;var ri=(ve(),ae(we)),h0=ri.__importDefault(p0());$t.PostgrestClient=h0.default;var m0=ri.__importDefault(Wd());$t.PostgrestQueryBuilder=m0.default;var g0=ri.__importDefault(Iu());$t.PostgrestFilterBuilder=g0.default;var y0=ri.__importDefault(Hd());$t.PostgrestTransformBuilder=y0.default;var D0=ri.__importDefault(Ud());$t.PostgrestBuilder=D0.default;var b0=ri.__importDefault(Nd());$t.PostgrestError=b0.default;$t.default={PostgrestClient:h0.default,PostgrestQueryBuilder:m0.default,PostgrestFilterBuilder:g0.default,PostgrestTransformBuilder:y0.default,PostgrestBuilder:D0.default,PostgrestError:b0.default}});var Qd={};Qr(Qd,{RealtimeClient:()=>Zd});var Zd,ep=et(()=>{Zd=class{constructor(){}connect(){}disconnect(){}}});var On=x(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.StorageUnknownError=rn.StorageApiError=rn.StorageError=void 0;rn.isStorageError=cP;var Ta=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};rn.StorageError=Ta;function cP(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var tp=class extends Ta{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}}};rn.StorageApiError=tp;var rp=class extends Ta{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};rn.StorageUnknownError=rp});var Ra=x(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.isPlainObject=mr.recursiveToCamel=mr.resolveResponse=mr.resolveFetch=void 0;var lP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);mr.resolveFetch=lP;var fP=()=>Response;mr.resolveResponse=fP;var dP=t=>{if(Array.isArray(t))return t.map(r=>(0,mr.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,mr.recursiveToCamel)(n)}),e};mr.recursiveToCamel=dP;var pP=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)};mr.isPlainObject=pP});var Tu=x(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.get=gP;Qn.post=yP;Qn.put=DP;Qn.head=bP;Qn.remove=wP;var Zn=(ve(),ae(we)),np=On(),w0=Ra(),op=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)},hP=(t,e,r)=>Zn.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,w0.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(o=>{let i=t.status||500,a=o?.statusCode||i+"";e(new np.StorageApiError(op(o),i,a))}).catch(o=>{e(new np.StorageUnknownError(op(o),o))}):e(new np.StorageUnknownError(op(t),t))}),mP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,w0.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 Ba(t,e,r,n,o,i){return Zn.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,mP(e,n,o,i)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>a(u)).catch(u=>hP(u,s,n))})})}function gP(t,e,r,n){return Zn.__awaiter(this,void 0,void 0,function*(){return Ba(t,"GET",e,r,n)})}function yP(t,e,r,n,o){return Zn.__awaiter(this,void 0,void 0,function*(){return Ba(t,"POST",e,n,o,r)})}function DP(t,e,r,n,o){return Zn.__awaiter(this,void 0,void 0,function*(){return Ba(t,"PUT",e,n,o,r)})}function bP(t,e,r,n){return Zn.__awaiter(this,void 0,void 0,function*(){return Ba(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function wP(t,e,r,n,o){return Zn.__awaiter(this,void 0,void 0,function*(){return Ba(t,"DELETE",e,n,o,r)})}});var v0=x(ap=>{"use strict";Object.defineProperty(ap,"__esModule",{value:!0});var vP=(ve(),ae(we)),CP=On(),ip=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return vP.__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,CP.isStorageError)(e))return{data:null,error:e};throw e}})}};ap.default=ip});var _0=x(up=>{"use strict";var C0;Object.defineProperty(up,"__esModule",{value:!0});var E0=(ve(),ae(we)),EP=On(),_P=E0.__importDefault(v0()),sp=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[C0]="BlobDownloadBuilder",this.promise=null}asStream(){return new _P.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 E0.__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,EP.isStorageError)(e))return{data:null,error:e};throw e}})}};C0=Symbol.toStringTag;up.default=sp});var A0=x(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var It=(ve(),ae(we)),Kt=On(),Gt=Tu(),S0=Ra(),SP=It.__importDefault(_0()),xP={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},x0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},cp=class{constructor(e,r={},n,o){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,S0.resolveFetch)(o)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,o){return It.__awaiter(this,void 0,void 0,function*(){try{let i,a=Object.assign(Object.assign({},x0),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),f=this._getFinalPath(c),d=yield(e=="PUT"?Gt.put:Gt.post)(this.fetch,`${this.url}/object/${f}`,i,Object.assign({headers:s},a?.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Kt.isStorageError)(i))return{data:null,error:i};throw i}})}upload(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,o){return It.__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:x0.upsert},o),f=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,f["cache-control"]=`max-age=${c.cacheControl}`,f["content-type"]=c.contentType);let d=yield(0,Gt.put)(this.fetch,s.toString(),u,{headers:f});return{data:{path:i,fullPath:d.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,Kt.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return It.__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,Gt.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 Kt.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,Kt.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}copy(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrl(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=this._getFinalPath(e),i=yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}createSignedUrls(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=yield(0,Gt.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,Kt.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,Gt.get)(this.fetch,`${this.url}/${o}/${s}${a}`,{headers:this.headers,noResolveJson:!0});return new SP.default(u,this.shouldThrowOnError)}info(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Gt.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,S0.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Kt.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return It.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Gt.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Kt.isStorageError)(n)&&n instanceof Kt.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 It.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gt.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Kt.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return It.__awaiter(this,void 0,void 0,function*(){try{let o=Object.assign(Object.assign(Object.assign({},xP),r),{prefix:e||""});return{data:yield(0,Gt.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,Kt.isStorageError)(o))return{data:null,error:o};throw o}})}listV2(e,r){return It.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Gt.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,Kt.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("&")}};lp.default=cp});var fp=x(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});Ru.version=void 0;Ru.version="2.84.0"});var dp=x(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});Bu.DEFAULT_HEADERS=void 0;var AP=fp();Bu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${AP.version}`}});var O0=x(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var ni=(ve(),ae(we)),OP=dp(),oi=On(),ii=Tu(),FP=Ra(),pp=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({},OP.DEFAULT_HEADERS),r),this.fetch=(0,FP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return ni.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,ii.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,oi.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return ni.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ii.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,oi.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return ni.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,ii.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,oi.isStorageError)(o))return{data:null,error:o};throw o}})}updateBucket(e,r){return ni.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ii.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,oi.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return ni.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ii.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,oi.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ni.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ii.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,oi.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():""}};hp.default=pp});var wp=x(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var mp=(ve(),ae(we)),kP=dp(),gp=On(),yp=Tu(),PP=Ra(),Dp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},kP.DEFAULT_HEADERS),r),this.fetch=(0,PP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return mp.__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,gp.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return mp.__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,gp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return mp.__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,gp.isStorageError)(r))return{data:null,error:r};throw r}})}};bp.default=Dp});var Lu=x(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});Nu.DEFAULT_HEADERS=void 0;var $P=fp();Nu.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${$P.version}`,"Content-Type":"application/json"}});var ai=x(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.StorageVectorsErrorCode=Or.StorageVectorsUnknownError=Or.StorageVectorsApiError=Or.StorageVectorsError=void 0;Or.isStorageVectorsError=IP;var Na=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};Or.StorageVectorsError=Na;function IP(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var vp=class extends Na{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}}};Or.StorageVectorsApiError=vp;var Cp=class extends Na{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};Or.StorageVectorsUnknownError=Cp;var F0;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(F0||(Or.StorageVectorsErrorCode=F0={}))});var si=x(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.validateVectorDimension=gr.normalizeToFloat32=gr.isPlainObject=gr.resolveResponse=gr.resolveFetch=void 0;var TP=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);gr.resolveFetch=TP;var RP=()=>Response;gr.resolveResponse=RP;var BP=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)};gr.isPlainObject=BP;var NP=t=>Array.from(new Float32Array(t));gr.normalizeToFloat32=NP;var LP=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};gr.validateVectorDimension=LP});var Mu=x(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.get=qP;ci.post=HP;ci.put=VP;ci.remove=zP;var ui=(ve(),ae(we)),ju=ai(),jP=si(),k0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),UP=(t,e,r)=>ui.__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 ju.StorageVectorsApiError(k0(a),o,s))}).catch(()=>{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new ju.StorageVectorsApiError(s,o,a))});else{let a=o+"",s=i.statusText||`HTTP ${o} error`;e(new ju.StorageVectorsApiError(s,o,a))}}else e(new ju.StorageVectorsUnknownError(k0(t),t))}),MP=(t,e,r,n)=>{let o={method:t,headers:e?.headers||{}};return t==="GET"||!n?o:((0,jP.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 Uu(t,e,r,n,o,i){return ui.__awaiter(this,void 0,void 0,function*(){return new Promise((a,s)=>{t(r,MP(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=>UP(u,s,n))})})}function qP(t,e,r,n){return ui.__awaiter(this,void 0,void 0,function*(){return Uu(t,"GET",e,r,n)})}function HP(t,e,r,n,o){return ui.__awaiter(this,void 0,void 0,function*(){return Uu(t,"POST",e,n,o,r)})}function VP(t,e,r,n,o){return ui.__awaiter(this,void 0,void 0,function*(){return Uu(t,"PUT",e,n,o,r)})}function zP(t,e,r,n,o){return ui.__awaiter(this,void 0,void 0,function*(){return Uu(t,"DELETE",e,n,o,r)})}});var Sp=x(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var qu=(ve(),ae(we)),KP=Lu(),Hu=ai(),Vu=Mu(),GP=si(),Ep=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},KP.DEFAULT_HEADERS),r),this.fetch=(0,GP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Vu.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vu.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Hu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Vu.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Hu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return qu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Vu.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Hu.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};_p.default=Ep});var Op=x(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var La=(ve(),ae(we)),WP=Lu(),ja=ai(),Ua=Mu(),YP=si(),xp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},WP.DEFAULT_HEADERS),r),this.fetch=(0,YP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return La.__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,Ua.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ja.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return La.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ua.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ja.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return La.__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,Ua.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ja.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return La.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ua.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ja.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return La.__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,Ua.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ja.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Ap.default=xp});var Pp=x(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var zu=(ve(),ae(we)),JP=Lu(),Ku=ai(),Gu=Mu(),XP=si(),Fp=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},JP.DEFAULT_HEADERS),r),this.fetch=(0,XP.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return zu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Gu.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 zu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Gu.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 zu.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Gu.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 zu.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Gu.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}})}};kp.default=Fp});var P0=x(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.VectorIndexScope=Fn.VectorBucketScope=Fn.StorageVectorsClient=void 0;var yr=(ve(),ae(we)),ZP=yr.__importDefault(Sp()),QP=yr.__importDefault(Op()),e$=yr.__importDefault(Pp()),$p=class extends e$.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Wu(this.url,this.headers,e,this.fetch)}};Fn.StorageVectorsClient=$p;var Wu=class extends ZP.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 yr.__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 yr.__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 yr.__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 yr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new Yu(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fn.VectorBucketScope=Wu;var Yu=class extends QP.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 yr.__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 yr.__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 yr.__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 yr.__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 yr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Fn.VectorIndexScope=Yu});var Rp=x(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var Ip=(ve(),ae(we)),Tp=P0();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Tp.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Tp.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Tp.VectorIndexScope}});var t$=Pp();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return Ip.__importDefault(t$).default}});var r$=Sp();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return Ip.__importDefault(r$).default}});var n$=Op();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return Ip.__importDefault(n$).default}});var Ma=ai();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Ma.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Ma.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Ma.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Ma.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Ma.isStorageVectorsError}});var qa=si();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return qa.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return qa.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return qa.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return qa.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return qa.validateVectorDimension}})});var $0=x(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.StorageClient=void 0;var Np=(ve(),ae(we)),o$=Np.__importDefault(A0()),i$=Np.__importDefault(O0()),a$=Np.__importDefault(wp()),s$=Rp(),Bp=class extends i$.default{constructor(e,r={},n,o){super(e,r,n,o)}from(e){return new o$.default(this.url,this.headers,e,this.fetch)}get vectors(){return new s$.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new a$.default(this.url+"/iceberg",this.headers,this.fetch)}};Ju.StorageClient=Bp});var T0=x(I0=>{"use strict";Object.defineProperty(I0,"__esModule",{value:!0})});var R0=x(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.StorageAnalyticsClient=nn.StorageClient=void 0;var Xu=(ve(),ae(we)),u$=$0();Object.defineProperty(nn,"StorageClient",{enumerable:!0,get:function(){return u$.StorageClient}});var c$=wp();Object.defineProperty(nn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Xu.__importDefault(c$).default}});Xu.__exportStar(T0(),nn);Xu.__exportStar(On(),nn);Xu.__exportStar(Rp(),nn)});var B0=x(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.version=void 0;Zu.version="2.84.0"});var N0=x(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_REALTIME_OPTIONS=tr.DEFAULT_AUTH_OPTIONS=tr.DEFAULT_DB_OPTIONS=tr.DEFAULT_GLOBAL_OPTIONS=tr.DEFAULT_HEADERS=void 0;var l$=B0(),Ha="";typeof Deno<"u"?Ha="deno":typeof document<"u"?Ha="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Ha="react-native":Ha="node";tr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Ha}/${l$.version}`};tr.DEFAULT_GLOBAL_OPTIONS={headers:tr.DEFAULT_HEADERS};tr.DEFAULT_DB_OPTIONS={schema:"public"};tr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};tr.DEFAULT_REALTIME_OPTIONS={}});var L0=x(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.fetchWithAuth=Rr.resolveHeadersConstructor=Rr.resolveFetch=void 0;var f$=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Rr.resolveFetch=f$;var d$=()=>Headers;Rr.resolveHeadersConstructor=d$;var p$=(t,e,r)=>{let n=(0,Rr.resolveFetch)(r),o=(0,Rr.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}))}};Rr.fetchWithAuth=p$});var U0=x(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.isBrowser=void 0;kn.uuid=h$;kn.ensureTrailingSlash=j0;kn.applySettingDefaults=g$;kn.validateSupabaseUrl=y$;function h$(){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 j0(t){return t.endsWith("/")?t:t+"/"}var m$=()=>typeof window<"u";kn.isBrowser=m$;function g$(t,e){var r,n;let{db:o,auth:i,realtime:a,global:s}=t,{db:u,auth:c,realtime:f,global:d}=e,h={db:Object.assign(Object.assign({},u),o),auth:Object.assign(Object.assign({},c),i),realtime:Object.assign(Object.assign({},f),a),storage:{},global:Object.assign(Object.assign(Object.assign({},d),s),{headers:Object.assign(Object.assign({},(r=d?.headers)!==null&&r!==void 0?r:{}),(n=s?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?h.accessToken=t.accessToken:delete h.accessToken,h}function y$(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(j0(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var Jp={};Qr(Jp,{AuthAdminApi:()=>jp,AuthApiError:()=>Up,AuthClient:()=>Lp,AuthError:()=>Fr,AuthImplicitGrantRedirectError:()=>zp,AuthInvalidCredentialsError:()=>Vp,AuthInvalidTokenResponseError:()=>Hp,AuthPKCEGrantCodeExchangeError:()=>Kp,AuthRetryableError:()=>Mp,AuthSessionMissingError:()=>qp,AuthWeakPasswordError:()=>Gp,GoTrueAdminApi:()=>ec,GoTrueClient:()=>Qu,NavigatorLockAcquireTimeoutError:()=>Wp,isAuthApiError:()=>C$,isAuthError:()=>v$,isAuthRetryableError:()=>E$,isAuthSessionMissingError:()=>_$,isAuthWeakPasswordError:()=>S$,lockInternals:()=>w$,navigatorLock:()=>D$,processLock:()=>b$});var Yp,M0,Qu,ec,Lp,jp,Fr,Up,Mp,qp,Hp,Vp,zp,Kp,Gp,D$,b$,Wp,w$,v$,C$,E$,_$,S$,Xp=et(()=>{Yp=()=>Promise.resolve({data:{session:null,user:null},error:null}),M0={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}):Yp}},Qu=class{constructor(e){return this.options=e,new Proxy(this,M0)}},ec=class{constructor(e){return this.options=e,new Proxy(this,M0)}},Lp=class extends Qu{},jp=class extends ec{},Fr=class extends Error{},Up=class extends Fr{},Mp=class extends Fr{},qp=class extends Fr{},Hp=class extends Fr{},Vp=class extends Fr{},zp=class extends Fr{},Kp=class extends Fr{},Gp=class extends Fr{},D$=Yp,b$=Yp,Wp=class extends Error{},w$={},v$=()=>!1,C$=()=>!1,E$=()=>!1,_$=()=>!1,S$=()=>!1});var q0=x(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});tc.SupabaseAuthClient=void 0;var x$=(Xp(),ae(Jp)),Zp=class extends x$.AuthClient{constructor(e){super(e)}};tc.SupabaseAuthClient=Zp});var th=x(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var A$=Td(),O$=Xd(),F$=(ep(),ae(Qd)),k$=R0(),rc=N0(),P$=L0(),H0=U0(),$$=q0(),Qp=class{constructor(e,r,n){var o,i,a;this.supabaseUrl=e,this.supabaseKey=r;let s=(0,H0.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:rc.DEFAULT_DB_OPTIONS,realtime:rc.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},rc.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:rc.DEFAULT_GLOBAL_OPTIONS},f=(0,H0.applySettingDefaults)(n??{},c);this.storageKey=(o=f.auth.storageKey)!==null&&o!==void 0?o:"",this.headers=(i=f.global.headers)!==null&&i!==void 0?i:{},f.accessToken?(this.accessToken=f.accessToken,this.auth=new Proxy({},{get:(d,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((a=f.auth)!==null&&a!==void 0?a:{},this.headers,f.global.fetch),this.fetch=(0,P$.fetchWithAuth)(r,this._getAccessToken.bind(this),f.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},f.realtime)),this.accessToken&&this.accessToken().then(d=>this.realtime.setAuth(d)).catch(d=>console.warn("Failed to set initial Realtime auth token:",d)),this.rest=new O$.PostgrestClient(new URL("rest/v1",s).href,{headers:this.headers,schema:f.db.schema,fetch:this.fetch}),this.storage=new k$.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),f.accessToken||this._listenForAuthEvents()}get functions(){return new A$.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:f},d,h){let p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new $$.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},p),d),storageKey:a,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:o,userStorage:i,flowType:s,lock:u,debug:c,throwOnError:f,fetch:h,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new F$.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)}};eh.default=Qp});var K0=x(Be=>{"use strict";var I$=Be&&Be.__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]})),V0=Be&&Be.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&I$(e,t,r)},z0=Be&&Be.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Be,"__esModule",{value:!0});Be.createClient=Be.SupabaseClient=Be.FunctionRegion=Be.FunctionsError=Be.FunctionsRelayError=Be.FunctionsFetchError=Be.FunctionsHttpError=Be.PostgrestError=void 0;var T$=z0(th());V0((Xp(),ae(Jp)),Be);var R$=Xd();Object.defineProperty(Be,"PostgrestError",{enumerable:!0,get:function(){return R$.PostgrestError}});var Va=Td();Object.defineProperty(Be,"FunctionsHttpError",{enumerable:!0,get:function(){return Va.FunctionsHttpError}});Object.defineProperty(Be,"FunctionsFetchError",{enumerable:!0,get:function(){return Va.FunctionsFetchError}});Object.defineProperty(Be,"FunctionsRelayError",{enumerable:!0,get:function(){return Va.FunctionsRelayError}});Object.defineProperty(Be,"FunctionsError",{enumerable:!0,get:function(){return Va.FunctionsError}});Object.defineProperty(Be,"FunctionRegion",{enumerable:!0,get:function(){return Va.FunctionRegion}});V0((ep(),ae(Qd)),Be);var B$=th();Object.defineProperty(Be,"SupabaseClient",{enumerable:!0,get:function(){return z0(B$).default}});var N$=(t,e,r)=>new T$.default(t,e,r);Be.createClient=N$;function L$(){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}L$()&&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 rh=x((qz,G0)=>{G0.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 nc=x(Y0=>{var W0={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 j$(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(W0))Y0[t]=j$(W0[t])});var eb=x((Vz,Q0)=>{var U$=require("fs"),it=require("path"),J0=rh(),M$=nc(),q$=typeof process=="object"&&process.platform==="win32",X0=t=>typeof t=="object"&&t!==null,Z0=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 Je(t){this.sep=it.sep,this.fs=U$,X0(t)&&X0(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}Q0.exports=Je;Je.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 M$.FILE_IN_THE_WAY(`"${o}"`)}})}r(t)};Je.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=it.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};Je.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=it.dirname(t);i.fs.exists(c,function(f){f||i.makeDir(c),i.fs.open(t,"w",438,function(d,h){d?i.fs.chmod(t,438,function(){i.fs.open(t,"w",438,function(p,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)})})})})}):h?i.fs.write(h,e,0,e.length,0,function(){i.fs.close(h,function(){i.fs.chmod(t,n||438,function(){o(!0)})})}):i.fs.chmod(t,n||438,function(){o(!0)})})})})})};Je.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=it.join(n,s),c=e.fs.statSync(u);(!o||o.test(u))&&a.push(it.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&i&&(a=a.concat(r(u,o,i)))}),a}return r(t,void 0,!0)};Je.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=it.join(t,s),r.fs.stat(s,function(u,c){if(u)return e(u);c&&(n.push(it.normalize(s)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(s,function(f,d){if(f)return e(f);n=n.concat(d),--a||e(null,n)}):--a||e(null,n))})})})};Je.prototype.getAttributes=function(){};Je.prototype.setAttributes=function(){};Je.crc32update=function(t,e){return Z0[(t^e)&255]^t>>>8};Je.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=Je.crc32update(r,t[n++]);return~r>>>0};Je.methodToString=function(t){switch(t){case J0.STORED:return"STORED ("+t+")";case J0.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Je.canonical=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.join(".",e)};Je.zipnamefix=function(t){if(!t)return"";let e=it.posix.normalize("/"+t.split("\\").join("/"));return it.posix.join(".",e)};Je.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]};Je.sanitize=function(t,e){t=it.resolve(it.normalize(t));for(var r=e.split("/"),n=0,o=r.length;n<o;n++){var i=it.normalize(it.join(t,r.slice(n,o).join(it.sep)));if(i.indexOf(t)===0)return i}return it.normalize(it.join(t,it.basename(e)))};Je.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};Je.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};Je.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)};Je.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};Je.isWin=q$;Je.crcTable=Z0});var rb=x((zz,tb)=>{var H$=require("path");tb.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=H$.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 ob=x((Kz,nb)=>{nb.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var fi=x((Gz,li)=>{li.exports=eb();li.exports.Constants=rh();li.exports.Errors=nc();li.exports.FileAttr=rb();li.exports.decoder=ob()});var ab=x((Wz,ib)=>{var Pn=fi(),Y=Pn.Constants;ib.exports=function(){var t=20,e=10,r=0,n=0,o=0,i=0,a=0,s=0,u=0,c=0,f=0,d=0,h=0,p=0,m=0;t|=Pn.isWin?2560:768,r|=Y.FLG_EFS;let g={extraLen:0},D=y=>Math.max(0,y)>>>0,v=y=>Math.max(0,y)&65535,_=y=>Math.max(0,y)&255;return o=Pn.fromDate2DOS(new Date),{get made(){return t},set made(y){t=y},get version(){return e},set version(y){e=y},get flags(){return r},set flags(y){r=y},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(y){y?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(y){y?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(y){switch(y){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=y},get time(){return Pn.fromDOS2Date(this.timeval)},set time(y){this.timeval=Pn.fromDate2DOS(y)},get timeval(){return o},set timeval(y){o=D(y)},get timeHighByte(){return _(o>>>8)},get crc(){return i},set crc(y){i=D(y)},get compressedSize(){return a},set compressedSize(y){a=D(y)},get size(){return s},set size(y){s=D(y)},get fileNameLength(){return u},set fileNameLength(y){u=y},get extraLength(){return c},set extraLength(y){c=y},get extraLocalLength(){return g.extraLen},set extraLocalLength(y){g.extraLen=y},get commentLength(){return f},set commentLength(y){f=y},get diskNumStart(){return d},set diskNumStart(y){d=D(y)},get inAttr(){return h},set inAttr(y){h=D(y)},get attr(){return p},set attr(y){p=D(y)},get fileAttr(){return(p||0)>>16&4095},get offset(){return m},set offset(y){m=D(y)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+f},get realDataOffset(){return m+Y.LOCHDR+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(y){var E=y.slice(m,m+Y.LOCHDR);if(E.readUInt32LE(0)!==Y.LOCSIG)throw Pn.Errors.INVALID_LOC();g.version=E.readUInt16LE(Y.LOCVER),g.flags=E.readUInt16LE(Y.LOCFLG),g.method=E.readUInt16LE(Y.LOCHOW),g.time=E.readUInt32LE(Y.LOCTIM),g.crc=E.readUInt32LE(Y.LOCCRC),g.compressedSize=E.readUInt32LE(Y.LOCSIZ),g.size=E.readUInt32LE(Y.LOCLEN),g.fnameLen=E.readUInt16LE(Y.LOCNAM),g.extraLen=E.readUInt16LE(Y.LOCEXT);let S=m+Y.LOCHDR+g.fnameLen,P=S+g.extraLen;return y.slice(S,P)},loadFromBinary:function(y){if(y.length!==Y.CENHDR||y.readUInt32LE(0)!==Y.CENSIG)throw Pn.Errors.INVALID_CEN();t=y.readUInt16LE(Y.CENVEM),e=y.readUInt16LE(Y.CENVER),r=y.readUInt16LE(Y.CENFLG),n=y.readUInt16LE(Y.CENHOW),o=y.readUInt32LE(Y.CENTIM),i=y.readUInt32LE(Y.CENCRC),a=y.readUInt32LE(Y.CENSIZ),s=y.readUInt32LE(Y.CENLEN),u=y.readUInt16LE(Y.CENNAM),c=y.readUInt16LE(Y.CENEXT),f=y.readUInt16LE(Y.CENCOM),d=y.readUInt16LE(Y.CENDSK),h=y.readUInt16LE(Y.CENATT),p=y.readUInt32LE(Y.CENATX),m=y.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var y=Buffer.alloc(Y.LOCHDR);return y.writeUInt32LE(Y.LOCSIG,0),y.writeUInt16LE(e,Y.LOCVER),y.writeUInt16LE(r,Y.LOCFLG),y.writeUInt16LE(n,Y.LOCHOW),y.writeUInt32LE(o,Y.LOCTIM),y.writeUInt32LE(i,Y.LOCCRC),y.writeUInt32LE(a,Y.LOCSIZ),y.writeUInt32LE(s,Y.LOCLEN),y.writeUInt16LE(u,Y.LOCNAM),y.writeUInt16LE(g.extraLen,Y.LOCEXT),y},centralHeaderToBinary:function(){var y=Buffer.alloc(Y.CENHDR+u+c+f);return y.writeUInt32LE(Y.CENSIG,0),y.writeUInt16LE(t,Y.CENVEM),y.writeUInt16LE(e,Y.CENVER),y.writeUInt16LE(r,Y.CENFLG),y.writeUInt16LE(n,Y.CENHOW),y.writeUInt32LE(o,Y.CENTIM),y.writeUInt32LE(i,Y.CENCRC),y.writeUInt32LE(a,Y.CENSIZ),y.writeUInt32LE(s,Y.CENLEN),y.writeUInt16LE(u,Y.CENNAM),y.writeUInt16LE(c,Y.CENEXT),y.writeUInt16LE(f,Y.CENCOM),y.writeUInt16LE(d,Y.CENDSK),y.writeUInt16LE(h,Y.CENATT),y.writeUInt32LE(p,Y.CENATX),y.writeUInt32LE(m,Y.CENOFF),y},toJSON:function(){let y=function(E){return E+" bytes"};return{made:t,version:e,flags:r,method:Pn.methodToString(n),time:this.time,crc:"0x"+i.toString(16).toUpperCase(),compressedSize:y(a),size:y(s),fileNameLength:y(u),extraLength:y(c),commentLength:y(f),diskNumStart:d,inAttr:h,attr:p,offset:m,centralHeaderSize:y(Y.CENHDR+u+c+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var ub=x((Yz,sb)=>{var di=fi(),Ke=di.Constants;sb.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 Ke.ENDHDR+o},loadFromBinary:function(i){if((i.length!==Ke.ENDHDR||i.readUInt32LE(0)!==Ke.ENDSIG)&&(i.length<Ke.ZIP64HDR||i.readUInt32LE(0)!==Ke.ZIP64SIG))throw di.Errors.INVALID_END();i.readUInt32LE(0)===Ke.ENDSIG?(t=i.readUInt16LE(Ke.ENDSUB),e=i.readUInt16LE(Ke.ENDTOT),r=i.readUInt32LE(Ke.ENDSIZ),n=i.readUInt32LE(Ke.ENDOFF),o=i.readUInt16LE(Ke.ENDCOM)):(t=di.readBigUInt64LE(i,Ke.ZIP64SUB),e=di.readBigUInt64LE(i,Ke.ZIP64TOT),r=di.readBigUInt64LE(i,Ke.ZIP64SIZE),n=di.readBigUInt64LE(i,Ke.ZIP64OFF),o=0)},toBinary:function(){var i=Buffer.alloc(Ke.ENDHDR+o);return i.writeUInt32LE(Ke.ENDSIG,0),i.writeUInt32LE(0,4),i.writeUInt16LE(t,Ke.ENDSUB),i.writeUInt16LE(e,Ke.ENDTOT),i.writeUInt32LE(r,Ke.ENDSIZ),i.writeUInt32LE(n,Ke.ENDOFF),i.writeUInt16LE(o,Ke.ENDCOM),i.fill(" ",Ke.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 oh=x(nh=>{nh.EntryHeader=ab();nh.MainHeader=ub()});var lb=x((Xz,cb)=>{cb.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 f=i[c];f.copy(s,u),u+=f.length}n&&n(s)}),o.end(t)}}}});var db=x((Zz,fb)=>{var V$=+(process.versions?process.versions.node:"").split(".")[0]||0;fb.exports=function(t,e){var r=require("zlib");let n=V$>=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 f=0;f<a.length;f++){var d=a[f];d.copy(u,c),c+=d.length}o&&o(u)}),i.end(t)}}}});var yb=x((Qz,gb)=>{"use strict";var{randomFillSync:pb}=require("crypto"),z$=nc(),K$=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}),mb=(t,e)=>Math.imul(t,e)>>>0,hb=(t,e)=>K$[(t^e)&255]^t>>>8,za=()=>typeof pb=="function"?pb(Buffer.alloc(12)):za.node();za.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 oc={genSalt:za};function ic(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])}ic.prototype.updateKeys=function(t){let e=this.keys;return e[0]=hb(e[0],t),e[1]+=e[0]&255,e[1]=mb(e[1],134775813)+1,e[2]=hb(e[2],e[1]>>>24),t};ic.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return mb(t,t^1)>>8&255};function G$(t){let e=new ic(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 W$(t){let e=new ic(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 Y$(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=G$(r),o=n(t.slice(0,12)),i=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(o[11]!==i)throw z$.WRONG_PASSWORD();return n(t.slice(12))}function J$(t){Buffer.isBuffer(t)&&t.length>=12?oc.genSalt=function(){return t.slice(0,12)}:t==="node"?oc.genSalt=za.node:oc.genSalt=za}function X$(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let o=W$(r),i=oc.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)}gb.exports={decrypt:Y$,encrypt:X$,_salter:J$}});var Db=x(ac=>{ac.Deflater=lb();ac.Inflater=db();ac.ZipCrypto=yb()});var ah=x((tK,bb)=>{var ke=fi(),Z$=oh(),Xe=ke.Constants,ih=Db();bb.exports=function(t,e){var r=new Z$.EntryHeader,n=Buffer.alloc(0),o=Buffer.alloc(0),i=!1,a=null,s=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let f=t,d=typeof f.decoder=="object"?f.decoder:ke.decoder;c=d.hasOwnProperty("efs")?d.efs:!1;function h(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function p(y){if(r.flags_desc){let E={},S=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(S)==Xe.LOCSIG||e.readUInt32LE(S)==Xe.CENSIG)throw ke.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(S)==Xe.EXTSIG)E.crc=e.readUInt32LE(S+Xe.EXTCRC),E.compressedSize=e.readUInt32LE(S+Xe.EXTSIZ),E.size=e.readUInt32LE(S+Xe.EXTLEN);else if(e.readUInt16LE(S+12)===19280)E.crc=e.readUInt32LE(S+Xe.EXTCRC-4),E.compressedSize=e.readUInt32LE(S+Xe.EXTSIZ-4),E.size=e.readUInt32LE(S+Xe.EXTLEN-4);else throw ke.Errors.DESCRIPTOR_UNKNOWN();if(E.compressedSize!==r.compressedSize||E.size!==r.size||E.crc!==r.crc)throw ke.Errors.DESCRIPTOR_FAULTY();if(ke.crc32(y)!==E.crc)return!1}else if(ke.crc32(y)!==r.localHeader.crc)return!1;return!0}function m(y,E,S){if(typeof E>"u"&&typeof y=="string"&&(S=y,y=void 0),i)return y&&E&&E(Buffer.alloc(0),ke.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var P=h();if(P.length===0)return y&&E&&E(P),P;if(r.encrypted){if(typeof S!="string"&&!Buffer.isBuffer(S))throw ke.Errors.INVALID_PASS_PARAM();P=ih.ZipCrypto.decrypt(P,r,S)}var T=Buffer.alloc(r.size);switch(r.method){case ke.Constants.STORED:if(P.copy(T),p(T))return y&&E&&E(T),T;throw y&&E&&E(T,ke.Errors.BAD_CRC()),ke.Errors.BAD_CRC();case ke.Constants.DEFLATED:var B=new ih.Inflater(P,r.size);if(y)B.inflateAsync(function(F){F.copy(F,0),E&&(p(F)?E(F):E(F,ke.Errors.BAD_CRC()))});else{if(B.inflate(T).copy(T,0),!p(T))throw ke.Errors.BAD_CRC(`"${d.decode(n)}"`);return T}break;default:throw y&&E&&E(Buffer.alloc(0),ke.Errors.UNKNOWN_METHOD()),ke.Errors.UNKNOWN_METHOD()}}function g(y,E){if((!a||!a.length)&&Buffer.isBuffer(e))return y&&E&&E(h()),h();if(a.length&&!i){var S;switch(r.method){case ke.Constants.STORED:return r.compressedSize=r.size,S=Buffer.alloc(a.length),a.copy(S),y&&E&&E(S),S;default:case ke.Constants.DEFLATED:var P=new ih.Deflater(a);if(y)P.deflateAsync(function(B){S=Buffer.alloc(B.length),r.compressedSize=B.length,B.copy(S),E&&E(S)});else{var T=P.deflate();return r.compressedSize=T.length,T}P=null;break}}else if(y&&E)E(Buffer.alloc(0));else return Buffer.alloc(0)}function D(y,E){return(y.readUInt32LE(E+4)<<4)+y.readUInt32LE(E)}function v(y){try{for(var E=0,S,P,T;E+4<y.length;)S=y.readUInt16LE(E),E+=2,P=y.readUInt16LE(E),E+=2,T=y.slice(E,E+P),E+=P,Xe.ID_ZIP64===S&&_(T)}catch{throw ke.Errors.EXTRA_FIELD_PARSE_ERROR()}}function _(y){var E,S,P,T;y.length>=Xe.EF_ZIP64_SCOMP&&(E=D(y,Xe.EF_ZIP64_SUNCOMP),r.size===Xe.EF_ZIP64_OR_32&&(r.size=E)),y.length>=Xe.EF_ZIP64_RHO&&(S=D(y,Xe.EF_ZIP64_SCOMP),r.compressedSize===Xe.EF_ZIP64_OR_32&&(r.compressedSize=S)),y.length>=Xe.EF_ZIP64_DSN&&(P=D(y,Xe.EF_ZIP64_RHO),r.offset===Xe.EF_ZIP64_OR_32&&(r.offset=P)),y.length>=Xe.EF_ZIP64_DSN+4&&(T=y.readUInt32LE(Xe.EF_ZIP64_DSN),r.diskNumStart===Xe.EF_ZIP64_OR_16&&(r.diskNumStart=T))}return{get entryName(){return d.decode(n)},get rawEntryName(){return n},set entryName(y){n=ke.toBuffer(y,d.encode);var E=n[n.length-1];i=E===47||E===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return s},set extra(y){s=y,r.extraLength=y.length,v(y)},get comment(){return d.decode(o)},set comment(y){if(o=ke.toBuffer(y,d.encode),r.commentLength=o.length,o.length>65535)throw ke.Errors.COMMENT_TOO_LONG()},get name(){var y=d.decode(n);return i?y.substr(y.length-1).split("/").pop():y.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return g(!1,null)},getCompressedDataAsync:function(y){g(!0,y)},setData:function(y){a=ke.toBuffer(y,ke.decoder.encode),!i&&a.length?(r.size=a.length,r.method=ke.Constants.DEFLATED,r.crc=ke.crc32(y),r.changed=!0):r.method=ke.Constants.STORED},getData:function(y){return r.changed?a:m(!1,null,y)},getDataAsync:function(y,E){r.changed?y(a):m(!0,y,E)},set attr(y){r.attr=y},get attr(){return r.attr},set header(y){r.loadFromBinary(y)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=s.length;var y=r.centralHeaderToBinary(),E=ke.Constants.CENHDR;return n.copy(y,E),E+=n.length,s.copy(y,E),E+=r.extraLength,o.copy(y,E),y},packLocalHeader:function(){let y=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let E=r.localHeaderToBinary(),S=Buffer.alloc(E.length+n.length+r.extraLocalLength);return E.copy(S,y),y+=E.length,n.copy(S,y),y+=n.length,u.copy(S,y),y+=u.length,S},toJSON:function(){let y=function(E){return"<"+(E&&E.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:y(e),data:y(a)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Cb=x((rK,vb)=>{var wb=ah(),Q$=oh(),gt=fi();vb.exports=function(t,e){var r=[],n={},o=Buffer.alloc(0),i=new Q$.MainHeader,a=!1,s=null;let u=new Set,c=e,{noSort:f,decoder:d}=c;t?m(c.readEntries):a=!0;function h(){let D=new Set;for(let v of Object.keys(n)){let _=v.split("/");if(_.pop(),!!_.length)for(let y=0;y<_.length;y++){let E=_.slice(0,y+1).join("/")+"/";D.add(E)}}for(let v of D)if(!(v in n)){let _=new wb(c);_.entryName=v,_.attr=16,_.temporary=!0,r.push(_),n[_.entryName]=_,u.add(_)}}function p(){if(a=!0,n={},i.diskEntries>(t.length-i.offset)/gt.Constants.CENHDR)throw gt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(i.diskEntries);for(var D=i.offset,v=0;v<r.length;v++){var _=D,y=new wb(c,t);y.header=t.slice(_,_+=gt.Constants.CENHDR),y.entryName=t.slice(_,_+=y.header.fileNameLength),y.header.extraLength&&(y.extra=t.slice(_,_+=y.header.extraLength)),y.header.commentLength&&(y.comment=t.slice(_,_+y.header.commentLength)),D+=y.header.centralHeaderSize,r[v]=y,n[y.entryName]=y}u.clear(),h()}function m(D){var v=t.length-gt.Constants.ENDHDR,_=Math.max(0,v-65535),y=_,E=t.length,S=-1,P=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(_=0),v;v>=y;v--)if(t[v]===80){if(t.readUInt32LE(v)===gt.Constants.ENDSIG){S=v,P=v,E=v+gt.Constants.ENDHDR,y=v-gt.Constants.END64HDR;continue}if(t.readUInt32LE(v)===gt.Constants.END64SIG){y=_;continue}if(t.readUInt32LE(v)===gt.Constants.ZIP64SIG){S=v,E=v+gt.readBigUInt64LE(t,v+gt.Constants.ZIP64SIZE)+gt.Constants.ZIP64LEAD;break}}if(S==-1)throw gt.Errors.INVALID_FORMAT();i.loadFromBinary(t.slice(S,E)),i.commentLength&&(o=t.slice(P+gt.Constants.ENDHDR)),D&&p()}function g(){r.length>1&&!f&&r.sort((D,v)=>D.entryName.toLowerCase().localeCompare(v.entryName.toLowerCase()))}return{get entries(){return a||p(),r.filter(D=>!u.has(D))},get comment(){return d.decode(o)},set comment(D){o=gt.toBuffer(D,d.encode),i.commentLength=o.length},getEntryCount:function(){return a?r.length:i.diskEntries},forEach:function(D){this.entries.forEach(D)},getEntry:function(D){return a||p(),n[D]||null},setEntry:function(D){a||p(),r.push(D),n[D.entryName]=D,i.totalEntries=r.length},deleteFile:function(D,v=!0){a||p();let _=n[D];this.getEntryChildren(_,v).map(E=>E.entryName).forEach(this.deleteEntry)},deleteEntry:function(D){a||p();let v=n[D],_=r.indexOf(v);_>=0&&(r.splice(_,1),delete n[D],i.totalEntries=r.length)},getEntryChildren:function(D,v=!0){if(a||p(),typeof D=="object")if(D.isDirectory&&v){let _=[],y=D.entryName;for(let E of r)E.entryName.startsWith(y)&&_.push(E);return _}else return[D];return[]},getChildCount:function(D){if(D&&D.isDirectory){let v=this.getEntryChildren(D);return v.includes(D)?v.length-1:v.length}return 0},compressToBuffer:function(){a||p(),g();let D=[],v=[],_=0,y=0;i.size=0,i.offset=0;let E=0;for(let T of this.entries){let B=T.getCompressedData();T.header.offset=y;let F=T.packLocalHeader(),L=F.length+B.length;y+=L,D.push(F),D.push(B);let A=T.packCentralHeader();v.push(A),i.size+=A.length,_+=L+A.length,E++}_+=i.mainHeaderSize,i.offset=y,i.totalEntries=E,y=0;let S=Buffer.alloc(_);for(let T of D)T.copy(S,y),y+=T.length;for(let T of v)T.copy(S,y),y+=T.length;let P=i.toBinary();return o&&o.copy(P,gt.Constants.ENDHDR),P.copy(S,y),t=S,a=!1,S},toAsyncBuffer:function(D,v,_,y){try{a||p(),g();let E=[],S=[],P=0,T=0,B=0;i.size=0,i.offset=0;let F=function(L){if(L.length>0){let A=L.shift(),q=A.entryName+A.extra.toString();_&&_(q),A.getCompressedDataAsync(function(j){y&&y(q),A.header.offset=T;let Z=A.packLocalHeader(),k=Z.length+j.length;T+=k,E.push(Z),E.push(j);let b=A.packCentralHeader();S.push(b),i.size+=b.length,P+=k+b.length,B++,F(L)})}else{P+=i.mainHeaderSize,i.offset=T,i.totalEntries=B,T=0;let A=Buffer.alloc(P);E.forEach(function(j){j.copy(A,T),T+=j.length}),S.forEach(function(j){j.copy(A,T),T+=j.length});let q=i.toBinary();o&&o.copy(q,gt.Constants.ENDHDR),q.copy(A,T),t=A,a=!1,D(A)}};F(Array.from(this.entries))}catch(E){v(E)}}}}});var sh=x((nK,_b)=>{var Ge=fi(),Ze=require("path"),e3=ah(),t3=Cb(),eo=(...t)=>Ge.findLast(t,e=>typeof e=="boolean"),Eb=(...t)=>Ge.findLast(t,e=>typeof e=="string"),r3=(...t)=>Ge.findLast(t,e=>typeof e=="function"),n3={noSort:!1,readEntries:!1,method:Ge.Constants.NONE,fs:null};_b.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),n3);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=Ge.Constants.BUFFER,t=void 0)),Object.assign(n,e);let o=new Ge(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=Ge.decoder),t&&typeof t=="string")if(o.fs.existsSync(t))n.method=Ge.Constants.FILE,n.filename=t,r=o.fs.readFileSync(t);else throw Ge.Errors.INVALID_FILENAME();let i=new t3(r,n),{canonical:a,sanitize:s,zipnamefix:u}=Ge;function c(p){if(p&&i){var m;if(typeof p=="string"&&(m=i.getEntry(Ze.posix.normalize(p))),typeof p=="object"&&typeof p.entryName<"u"&&typeof p.header<"u"&&(m=i.getEntry(p.entryName)),m)return m}return null}function f(p){let{join:m,normalize:g,sep:D}=Ze.posix;return m(".",g(D+p.split("\\").join(D)+D))}function d(p){return p instanceof RegExp?(function(m){return function(g){return m.test(g)}})(p):typeof p!="function"?()=>!0:p}let h=(p,m)=>{let g=m.slice(-1);return g=g===o.sep?o.sep:"",Ze.relative(p,m)+g};return{readFile:function(p,m){var g=c(p);return g&&g.getData(m)||null},childCount:function(p){let m=c(p);if(m)return i.getChildCount(m)},readFileAsync:function(p,m){var g=c(p);g?g.getDataAsync(m):m(null,"getEntry failed for:"+p)},readAsText:function(p,m){var g=c(p);if(g){var D=g.getData();if(D&&D.length)return D.toString(m||"utf8")}return""},readAsTextAsync:function(p,m,g){var D=c(p);D?D.getDataAsync(function(v,_){if(_){m(v,_);return}v&&v.length?m(v.toString(g||"utf8")):m("")}):m("")},deleteFile:function(p,m=!0){var g=c(p);g&&i.deleteFile(g.entryName,m)},deleteEntry:function(p){var m=c(p);m&&i.deleteEntry(m.entryName)},addZipComment:function(p){i.comment=p},getZipComment:function(){return i.comment||""},addZipEntryComment:function(p,m){var g=c(p);g&&(g.comment=m)},getZipEntryComment:function(p){var m=c(p);return m&&m.comment||""},updateFile:function(p,m){var g=c(p);g&&g.setData(m)},addLocalFile:function(p,m,g,D){if(o.fs.existsSync(p)){m=m?f(m):"";let v=Ze.win32.basename(Ze.win32.normalize(p));m+=g||v;let _=o.fs.statSync(p),y=_.isFile()?o.fs.readFileSync(p):Buffer.alloc(0);_.isDirectory()&&(m+=o.sep),this.addFile(m,y,D,_)}else throw Ge.Errors.FILE_NOT_FOUND(p)},addLocalFileAsync:function(p,m){p=typeof p=="object"?p:{localPath:p};let g=Ze.resolve(p.localPath),{comment:D}=p,{zipPath:v,zipName:_}=p,y=this;o.fs.stat(g,function(E,S){if(E)return m(E,!1);v=v?f(v):"";let P=Ze.win32.basename(Ze.win32.normalize(g));if(v+=_||P,S.isFile())o.fs.readFile(g,function(T,B){return T?m(T,!1):(y.addFile(v,B,D,S),setImmediate(m,void 0,!0))});else if(S.isDirectory())return v+=o.sep,y.addFile(v,Buffer.alloc(0),D,S),setImmediate(m,void 0,!0)})},addLocalFolder:function(p,m,g){if(g=d(g),m=m?f(m):"",p=Ze.normalize(p),o.fs.existsSync(p)){let D=o.findFiles(p),v=this;if(D.length)for(let _ of D){let y=Ze.join(m,h(p,_));g(y)&&v.addLocalFile(_,Ze.dirname(y))}}else throw Ge.Errors.FILE_NOT_FOUND(p)},addLocalFolderAsync:function(p,m,g,D){D=d(D),g=g?f(g):"",p=Ze.normalize(p);var v=this;o.fs.open(p,"r",function(_){if(_&&_.code==="ENOENT")m(void 0,Ge.Errors.FILE_NOT_FOUND(p));else if(_)m(void 0,_);else{var y=o.findFiles(p),E=-1,S=function(){if(E+=1,E<y.length){var P=y[E],T=h(p,P).split("\\").join("/");T=T.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),D(T)?o.fs.stat(P,function(B,F){B&&m(void 0,B),F.isFile()?o.fs.readFile(P,function(L,A){L?m(void 0,L):(v.addFile(g+T,A,"",F),S())}):(v.addFile(g+T+"/",Buffer.alloc(0),"",F),S())}):process.nextTick(()=>{S()})}else m(!0,void 0)};S()}})},addLocalFolderAsync2:function(p,m){let g=this;p=typeof p=="object"?p:{localPath:p},localPath=Ze.resolve(f(p.localPath));let{zipPath:D,filter:v,namefix:_}=p;v instanceof RegExp?v=(function(S){return function(P){return S.test(P)}})(v):typeof v!="function"&&(v=function(){return!0}),D=D?f(D):"",_=="latin1"&&(_=S=>S.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof _!="function"&&(_=S=>S);let y=S=>Ze.join(D,_(h(localPath,S))),E=S=>Ze.win32.basename(Ze.win32.normalize(_(S)));o.fs.open(localPath,"r",function(S){S&&S.code==="ENOENT"?m(void 0,Ge.Errors.FILE_NOT_FOUND(localPath)):S?m(void 0,S):o.findFilesAsync(localPath,function(P,T){if(P)return m(P);T=T.filter(B=>v(y(B))),T.length||m(void 0,!1),setImmediate(T.reverse().reduce(function(B,F){return function(L,A){if(L||A===!1)return setImmediate(B,L,!1);g.addLocalFileAsync({localPath:F,zipPath:Ze.dirname(y(F)),zipName:E(F)},B)}},m))})})},addLocalFolderPromise:function(p,m){return new Promise((g,D)=>{this.addLocalFolderAsync2(Object.assign({localPath:p},m),(v,_)=>{v&&D(v),_&&g(this)})})},addFile:function(p,m,g,D){p=u(p);let v=c(p),_=v!=null;_||(v=new e3(n),v.entryName=p),v.comment=g||"";let y=typeof D=="object"&&D instanceof o.fs.Stats;y&&(v.header.time=D.mtime);var E=v.isDirectory?16:0;let S=v.isDirectory?16384:32768;return y?S|=4095&D.mode:typeof D=="number"?S|=4095&D:S|=v.isDirectory?493:420,E=(E|S<<16)>>>0,v.attr=E,v.setData(m),_||i.setEntry(v),v},getEntries:function(p){return i.password=p,i?i.entries:[]},getEntry:function(p){return c(p)},getEntryCount:function(){return i.getEntryCount()},forEach:function(p){return i.forEach(p)},extractEntryTo:function(p,m,g,D,v,_){D=eo(!1,D),v=eo(!1,v),g=eo(!0,g),_=Eb(v,_);var y=c(p);if(!y)throw Ge.Errors.NO_ENTRY();var E=a(y.entryName),S=s(m,_&&!y.isDirectory?_:g?E:Ze.basename(E));if(y.isDirectory){var P=i.getEntryChildren(y);return P.forEach(function(F){if(F.isDirectory)return;var L=F.getData();if(!L)throw Ge.Errors.CANT_EXTRACT_FILE();var A=a(F.entryName),q=s(m,g?A:Ze.basename(A));let j=v?F.header.fileAttr:void 0;o.writeFileTo(q,L,D,j)}),!0}var T=y.getData(i.password);if(!T)throw Ge.Errors.CANT_EXTRACT_FILE();if(o.fs.existsSync(S)&&!D)throw Ge.Errors.CANT_OVERRIDE();let B=v?p.header.fileAttr:void 0;return o.writeFileTo(S,T,D,B),!0},test:function(p){if(!i)return!1;for(var m in i.entries)try{if(m.isDirectory)continue;var g=i.entries[m].getData(p);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(p,m,g,D){if(g=eo(!1,g),D=Eb(g,D),m=eo(!1,m),!i)throw Ge.Errors.NO_ZIP();i.entries.forEach(function(v){var _=s(p,a(v.entryName));if(v.isDirectory){o.makeDir(_);return}var y=v.getData(D);if(!y)throw Ge.Errors.CANT_EXTRACT_FILE();let E=g?v.header.fileAttr:void 0;o.writeFileTo(_,y,m,E);try{o.fs.utimesSync(_,v.header.time,v.header.time)}catch{throw Ge.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(p,m,g,D){if(D=r3(m,g,D),g=eo(!1,g),m=eo(!1,m),!D)return new Promise((S,P)=>{this.extractAllToAsync(p,m,g,function(T){T?P(T):S(this)})});if(!i){D(Ge.Errors.NO_ZIP());return}p=Ze.resolve(p);let v=S=>s(p,Ze.normalize(a(S.entryName))),_=(S,P)=>new Error(S+': "'+P+'"'),y=[],E=[];i.entries.forEach(S=>{S.isDirectory?y.push(S):E.push(S)});for(let S of y){let P=v(S),T=g?S.header.fileAttr:void 0;try{o.makeDir(P),T&&o.fs.chmodSync(P,T),o.fs.utimesSync(P,S.header.time,S.header.time)}catch{D(_("Unable to create folder",P))}}E.reverse().reduce(function(S,P){return function(T){if(T)S(T);else{let B=Ze.normalize(a(P.entryName)),F=s(p,B);P.getDataAsync(function(L,A){if(A)S(A);else if(!L)S(Ge.Errors.CANT_EXTRACT_FILE());else{let q=g?P.header.fileAttr:void 0;o.writeFileToAsync(F,L,m,q,function(j){j||S(_("Unable to write file",F)),o.fs.utimes(F,P.header.time,P.header.time,function(Z){Z?S(_("Unable to set times",F)):S()})})}})}}},D)()},writeZip:function(p,m){if(arguments.length===1&&typeof p=="function"&&(m=p,p=""),!p&&n.filename&&(p=n.filename),!!p){var g=i.compressToBuffer();if(g){var D=o.writeFileTo(p,g,!0);typeof m=="function"&&m(D?null:new Error("failed"),"")}}},writeZipPromise:function(p,m){let{overwrite:g,perm:D}=Object.assign({overwrite:!0},m);return new Promise((v,_)=>{!p&&n.filename&&(p=n.filename),p||_("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(y=>{let E=S=>S?v(S):_("ADM-ZIP: Wasn't able to write zip file");o.writeFileToAsync(p,y,g,D,E)},_)})},toBufferPromise:function(){return new Promise((p,m)=>{i.toAsyncBuffer(p,m)})},toBuffer:function(p,m,g,D){return typeof p=="function"?(i.toAsyncBuffer(p,m,g,D),null):i.compressToBuffer()}}}});var Ob=x((oK,Ab)=>{var xb={};Ab.exports=xb;var Sb={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(Sb).forEach(function(t){var e=Sb[t],r=xb[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var kb=x((iK,Fb)=>{"use strict";Fb.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 $b=x((aK,Pb)=>{"use strict";var o3=require("os"),kr=kb(),Tt=process.env,pi=void 0;kr("no-color")||kr("no-colors")||kr("color=false")?pi=!1:(kr("color")||kr("colors")||kr("color=true")||kr("color=always"))&&(pi=!0);"FORCE_COLOR"in Tt&&(pi=Tt.FORCE_COLOR.length===0||parseInt(Tt.FORCE_COLOR,10)!==0);function i3(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function a3(t){if(pi===!1)return 0;if(kr("color=16m")||kr("color=full")||kr("color=truecolor"))return 3;if(kr("color=256"))return 2;if(t&&!t.isTTY&&pi!==!0)return 0;var e=pi?1:0;if(process.platform==="win32"){var r=o3.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 Tt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(o){return o in Tt})||Tt.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Tt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Tt.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in Tt){var n=parseInt((Tt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Tt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Tt.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(Tt.TERM)||"COLORTERM"in Tt?1:(Tt.TERM==="dumb",e)}function uh(t){var e=a3(t);return i3(e)}Pb.exports={supportsColor:uh,stdout:uh(process.stdout),stderr:uh(process.stderr)}});var Tb=x((sK,Ib)=>{Ib.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var o={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(i){i=i.toLowerCase();var a=o[i]||[" "],s=Math.floor(Math.random()*a.length);typeof o[i]<"u"?n+=o[i][s]:n+=i}),n}});var Bb=x((uK,Rb)=>{Rb.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(f){c=f===u}),c}function s(u,c){var f="",d,h;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(h in u)if(!a(h)){switch(f=f+u[h],d={up:0,down:0,mid:0},c.size){case"mini":d.up=i(8),d.mid=i(2),d.down=i(8);break;case"maxi":d.up=i(16)+3,d.mid=i(4)+1,d.down=i(64)+3;break;default:d.up=i(8)+1,d.mid=i(6)/2,d.down=i(8)+1;break}var p=["up","mid","down"];for(var m in p)for(var g=p[m],D=0;D<=d[g];D++)c[g]&&(f=f+n[g][i(n[g].length)])}return f}return s(e,r)}});var Lb=x((cK,Nb)=>{Nb.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 Ub=x((lK,jb)=>{jb.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var qb=x((fK,Mb)=>{Mb.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((dK,Hb)=>{Hb.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 Jb=x((hK,Yb)=>{var ge={};Yb.exports=ge;ge.themes={};var s3=require("util"),to=ge.styles=Ob(),Kb=Object.defineProperties,u3=new RegExp(/[\r\n]+/g);ge.supportsColor=$b().supportsColor;typeof ge.enabled>"u"&&(ge.enabled=ge.supportsColor()!==!1);ge.enable=function(){ge.enabled=!0};ge.disable=function(){ge.enabled=!1};ge.stripColors=ge.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var pK=ge.stylize=function(e,r){if(!ge.enabled)return e+"";var n=to[r];return!n&&r in ge?ge[r](e):n.open+e+n.close},c3=/[|\\{}()[\]^$+*?.]/g,l3=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(c3,"\\$&")};function Gb(t){var e=function r(){return d3.apply(r,arguments)};return e._styles=t,e.__proto__=f3,e}var Wb=(function(){var t={};return to.grey=to.gray,Object.keys(to).forEach(function(e){to[e].closeRe=new RegExp(l3(to[e].close),"g"),t[e]={get:function(){return Gb(this._styles.concat(e))}}}),t})(),f3=Kb(function(){},Wb);function d3(){var t=Array.prototype.slice.call(arguments),e=t.map(function(a){return a!=null&&a.constructor===String?a:s3.inspect(a)}).join(" ");if(!ge.enabled||!e)return e;for(var r=e.indexOf(`
31
+ `)!=-1,n=this._styles,o=n.length;o--;){var i=to[n[o]];e=i.open+e.replace(i.closeRe,i.open)+i.close,r&&(e=e.replace(u3,function(a){return i.close+a+i.open}))}return e}ge.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){ge[r]=function(n){if(typeof t[r]=="object"){var o=n;for(var i in t[r])o=ge[t[r][i]](o);return o}return ge[t[r]](n)}})(e)};function p3(){var t={};return Object.keys(Wb).forEach(function(e){t[e]={get:function(){return Gb([e])}}}),t}var h3=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ge.trap=Tb();ge.zalgo=Bb();ge.maps={};ge.maps.america=Lb()(ge);ge.maps.zebra=Ub()(ge);ge.maps.rainbow=qb()(ge);ge.maps.random=Vb()(ge);for(zb in ge.maps)(function(t){ge[t]=function(e){return h3(ge.maps[t],e)}})(zb);var zb;Kb(ge,p3())});var Zb=x((mK,Xb)=>{var m3=Jb();Xb.exports=m3});var Qb=x(ch=>{"use strict";ch.indent=function(e){return new Array(e+1).join(" ")};ch.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 ew=x((yK,g3)=>{g3.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 tw=x(Ka=>{"use strict";var Br=Zb(),$n=Qb(),y3=/[^\w\s\n\r\v\t\.,]/i;Ka.version=ew().version;var lh=function(t,e){return t!==void 0||e.renderUndefined},sc=function(t,e,r){return!!(typeof t=="boolean"||typeof t=="number"||typeof t=="function"||t===null||t===void 0||t instanceof Date||typeof t=="string"&&t.indexOf(`
32
+ `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&sc(t[0],!0,r))},D3=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?Br[e.stringColor](t):t;var r=t+"";return t===!0?Br.green(r):t===!1?Br.red(r):t==null?Br.grey(r):typeof t=="number"?t>=0?Br[e.positiveNumberColor](r):Br[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},fh=function(t,e){return t.multilineStringColor===null||t.noColor?e:Br[t.multilineStringColor](e)},b3=function(t,e,r){var n=t.split(`
33
+ `);return n=n.map(function(o){return $n.indent(e)+fh(r,o)}),n.join(`
34
+ `)},hi=function(t,e,r){if(typeof t=="string"&&t.match(y3)&&e.escape&&(t=JSON.stringify(t)),!lh(t,e))return[];if(sc(t,!1,e))return[$n.indent(r)+D3(t,e)];if(typeof t=="string")return[$n.indent(r)+fh(e,'"""'),b3(t,r+e.defaultIndentation,e),$n.indent(r)+fh(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[$n.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(s){if(lh(s,e)){var u="- ";e.noColor||(u=Br[e.dashColor](u)),u=$n.indent(r)+u,sc(s,!1,e)?(u+=hi(s,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,hi(s,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return hi({message:t.message,stack:t.stack.split(`
35
+ `)},e,r);var o=e.noAlign?0:$n.getMaxIndexLength(t),i,a=[];return Object.getOwnPropertyNames(t).forEach(function(s){if(lh(t[s],e))if(i=s+": ",e.noColor||(i=Br[e.keysColor](i)),i=$n.indent(r)+i,sc(t[s],!1,e)){var u=e.noAlign?0:o-s.length;i+=hi(t[s],e,u)[0],a.push(i)}else a.push(i),a.push.apply(a,hi(t[s],e,r+e.defaultIndentation))}),a};Ka.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,hi(e,r,n).join(`
36
+ `)};Ka.renderString=function(e,r,n){var o="",i;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var a;e.indexOf("{")===-1?a=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?a=e.indexOf("{"):a=e.indexOf("["),o+=e.substr(0,a)+`
37
+ `,e=e.substr(a)}try{i=JSON.parse(e)}catch{return Br.red("Error:")+" Not valid JSON!"}return o+=Ka.render(i,r,n),o}});var hh=x(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});uc.default=void 0;function mi(t){"@babel/helpers - typeof";return mi=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},mi(t)}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,v3(n.key),n)}}function w3(t,e,r){return e&&rw(t.prototype,e),r&&rw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function v3(t){var e=C3(t,"string");return mi(e)=="symbol"?e:e+""}function C3(t,e){if(mi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(mi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function E3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _3(t,e,r){return e=Wa(e),S3(t,ph()?Reflect.construct(e,r||[],Wa(t).constructor):e.apply(t,r))}function S3(t,e){if(e&&(mi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return x3(t)}function x3(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function A3(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&&Ga(t,e)}function dh(t){var e=typeof Map=="function"?new Map:void 0;return dh=function(n){if(n===null||!F3(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 O3(n,arguments,Wa(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ga(o,n)},dh(t)}function O3(t,e,r){if(ph())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&Ga(o,r.prototype),o}function ph(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ph=function(){return!!t})()}function F3(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Ga(t,e){return Ga=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},Ga(t,e)}function Wa(t){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Wa(t)}var k3=(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(E3(this,e),n=_3(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(),f=a?a.getStatus():"n/a",d=a?a.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(f,", response text: ").concat(d,", request id: ").concat(s,")")}return n.message=r,n}return A3(e,t),w3(e)})(dh(Error)),bK=uc.default=k3});var mh=x(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.enableDebugLog=P3;cc.log=$3;var nw=!1;function P3(){nw=!0}function $3(t){nw&&console.log(t)}});var iw=x(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.default=void 0;function Ya(t){"@babel/helpers - typeof";return Ya=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},Ya(t)}function I3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ow(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,R3(n.key),n)}}function T3(t,e,r){return e&&ow(t.prototype,e),r&&ow(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function R3(t){var e=B3(t,"string");return Ya(e)=="symbol"?e:e+""}function B3(t,e){if(Ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var CK=lc.default=(function(){function t(){I3(this,t)}return T3(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 aw=x((gh,yh)=>{(function(t,e){typeof gh=="object"&&typeof yh<"u"?yh.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:gh,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 N={};return I.forEach(function(X,U){return N[X]=U}),N})(a),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(I){return new Uint8Array(Array.prototype.slice.call(I,0))},d=function(I){return I.replace(/=/g,"").replace(/[+\/]/g,function(N){return N=="+"?"-":"_"})},h=function(I){return I.replace(/[^A-Za-z0-9\+\/]/g,"")},p=function(I){for(var N,X,U,ie,Zt="",K=I.length%3,Se=0;Se<I.length;){if((X=I.charCodeAt(Se++))>255||(U=I.charCodeAt(Se++))>255||(ie=I.charCodeAt(Se++))>255)throw new TypeError("invalid character found");N=X<<16|U<<8|ie,Zt+=a[N>>18&63]+a[N>>12&63]+a[N>>6&63]+a[N&63]}return K?Zt.slice(0,K-3)+"===".substring(K):Zt},m=typeof btoa=="function"?function(I){return btoa(I)}:r?function(I){return Buffer.from(I,"binary").toString("base64")}:p,g=r?function(I){return Buffer.from(I).toString("base64")}:function(I){for(var N=4096,X=[],U=0,ie=I.length;U<ie;U+=N)X.push(c.apply(null,I.subarray(U,U+N)));return m(X.join(""))},D=function(I,N){return N===void 0&&(N=!1),N?d(g(I)):g(I)},v=function(I){if(I.length<2){var N=I.charCodeAt(0);return N<128?I:N<2048?c(192|N>>>6)+c(128|N&63):c(224|N>>>12&15)+c(128|N>>>6&63)+c(128|N&63)}else{var N=65536+(I.charCodeAt(0)-55296)*1024+(I.charCodeAt(1)-56320);return c(240|N>>>18&7)+c(128|N>>>12&63)+c(128|N>>>6&63)+c(128|N&63)}},_=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,y=function(I){return I.replace(_,v)},E=r?function(I){return Buffer.from(I,"utf8").toString("base64")}:o?function(I){return g(o.encode(I))}:function(I){return m(y(I))},S=function(I,N){return N===void 0&&(N=!1),N?d(E(I)):E(I)},P=function(I){return S(I,!0)},T=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,B=function(I){switch(I.length){case 4:var N=(7&I.charCodeAt(0))<<18|(63&I.charCodeAt(1))<<12|(63&I.charCodeAt(2))<<6|63&I.charCodeAt(3),X=N-65536;return c((X>>>10)+55296)+c((X&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))}},F=function(I){return I.replace(T,B)},L=function(I){if(I=I.replace(/\s+/g,""),!u.test(I))throw new TypeError("malformed base64.");I+="==".slice(2-(I.length&3));for(var N,X,U,ie=[],Zt=0;Zt<I.length;)N=s[I.charAt(Zt++)]<<18|s[I.charAt(Zt++)]<<12|(X=s[I.charAt(Zt++)])<<6|(U=s[I.charAt(Zt++)]),X===64?ie.push(c(N>>16&255)):U===64?ie.push(c(N>>16&255,N>>8&255)):ie.push(c(N>>16&255,N>>8&255,N&255));return ie.join("")},A=typeof atob=="function"?function(I){return atob(h(I))}:r?function(I){return Buffer.from(I,"base64").toString("binary")}:L,q=r?function(I){return f(Buffer.from(I,"base64"))}:function(I){return f(A(I).split("").map(function(N){return N.charCodeAt(0)}))},j=function(I){return q(k(I))},Z=r?function(I){return Buffer.from(I,"base64").toString("utf8")}:n?function(I){return n.decode(q(I))}:function(I){return F(A(I))},k=function(I){return h(I.replace(/[-_]/g,function(N){return N=="-"?"+":"/"}))},b=function(I){return Z(k(I))},w=function(I){if(typeof I!="string")return!1;var N=I.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(N)||!/[^\s0-9a-zA-Z\-_]/.test(N)},C=function(I){return{value:I,enumerable:!1,writable:!0,configurable:!0}},O=function(){var I=function(N,X){return Object.defineProperty(String.prototype,N,C(X))};I("fromBase64",function(){return b(this)}),I("toBase64",function(N){return S(this,N)}),I("toBase64URI",function(){return S(this,!0)}),I("toBase64URL",function(){return S(this,!0)}),I("toUint8Array",function(){return j(this)})},R=function(){var I=function(N,X){return Object.defineProperty(Uint8Array.prototype,N,C(X))};I("toBase64",function(N){return D(this,N)}),I("toBase64URI",function(){return D(this,!0)}),I("toBase64URL",function(){return D(this,!0)})},$=function(){O(),R()},H={version:t,VERSION:e,atob:A,atobPolyfill:L,btoa:m,btoaPolyfill:p,fromBase64:b,toBase64:S,encode:S,encodeURI:P,encodeURL:P,utob:y,btou:F,decode:b,isValid:w,fromUint8Array:D,toUint8Array:j,extendString:O,extendUint8Array:R,extendBuiltins:$};return H.Base64={},Object.keys(H).forEach(function(I){return H.Base64[I]=H[I]}),H})});var uw=x((_K,sw)=>{"use strict";sw.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 fw=x(Dh=>{"use strict";var N3=Object.prototype.hasOwnProperty,L3;function cw(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function lw(t){try{return encodeURIComponent(t)}catch{return null}}function j3(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var o=cw(n[1]),i=cw(n[2]);o===null||i===null||o in r||(r[o]=i)}return r}function U3(t,e){e=e||"";var r=[],n,o;typeof e!="string"&&(e="?");for(o in t)if(N3.call(t,o)){if(n=t[o],!n&&(n===null||n===L3||isNaN(n))&&(n=""),o=lw(o),n=lw(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?e+r.join("&"):""}Dh.stringify=U3;Dh.parse=j3});var bw=x((xK,Dw)=>{"use strict";var pw=uw(),fc=fw(),M3=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,hw=/[\n\r\t]/g,q3=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,mw=/:\d+$/,H3=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,V3=/^[a-zA-Z]:/;function wh(t){return(t||"").toString().replace(M3,"")}var bh=[["#","hash"],["?","query"],function(e,r){return Nr(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]],dw={hash:1,query:1};function gw(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 Lr(unescape(t.pathname),{});else if(o==="string"){n=new Lr(t,{});for(i in dw)delete n[i]}else if(o==="object"){for(i in t)i in dw||(n[i]=t[i]);n.slashes===void 0&&(n.slashes=q3.test(t.href))}return n}function Nr(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function yw(t,e){t=wh(t),t=t.replace(hw,""),e=e||{};var r=H3.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)):Nr(n)?s=r[4]:n?o&&(s=s.slice(2)):a>=2&&Nr(e.protocol)&&(s=r[4]),{protocol:n,slashes:o||Nr(n),slashesCount:a,rest:s}}function z3(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 Lr(t,e,r){if(t=wh(t),t=t.replace(hw,""),!(this instanceof Lr))return new Lr(t,e,r);var n,o,i,a,s,u,c=bh.slice(),f=typeof e,d=this,h=0;for(f!=="object"&&f!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=fc.parse),e=gw(e),o=yw(t||"",e),n=!o.protocol&&!o.slashes,d.slashes=o.slashes||n&&e.slashes,d.protocol=o.protocol||e.protocol||"",t=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||V3.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!Nr(d.protocol)))&&(c[3]=[/(.*)/,"pathname"]);h<c.length;h++){if(a=c[h],typeof a=="function"){t=a(t,d);continue}i=a[0],u=a[1],i!==i?d[u]=t:typeof i=="string"?(s=i==="@"?t.lastIndexOf(i):t.indexOf(i),~s&&(typeof a[2]=="number"?(d[u]=t.slice(0,s),t=t.slice(s+a[2])):(d[u]=t.slice(s),t=t.slice(0,s)))):(s=i.exec(t))&&(d[u]=s[1],t=t.slice(0,s.index)),d[u]=d[u]||n&&a[3]&&e[u]||"",a[4]&&(d[u]=d[u].toLowerCase())}r&&(d.query=r(d.query)),n&&e.slashes&&d.pathname.charAt(0)!=="/"&&(d.pathname!==""||e.pathname!=="")&&(d.pathname=z3(d.pathname,e.pathname)),d.pathname.charAt(0)!=="/"&&Nr(d.protocol)&&(d.pathname="/"+d.pathname),pw(d.port,d.protocol)||(d.host=d.hostname,d.port=""),d.username=d.password="",d.auth&&(s=d.auth.indexOf(":"),~s?(d.username=d.auth.slice(0,s),d.username=encodeURIComponent(decodeURIComponent(d.username)),d.password=d.auth.slice(s+1),d.password=encodeURIComponent(decodeURIComponent(d.password))):d.username=encodeURIComponent(decodeURIComponent(d.auth)),d.auth=d.password?d.username+":"+d.password:d.username),d.origin=d.protocol!=="file:"&&Nr(d.protocol)&&d.host?d.protocol+"//"+d.host:"null",d.href=d.toString()}function K3(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||fc.parse)(e)),n[t]=e;break;case"port":n[t]=e,pw(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,mw.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<bh.length;a++){var s=bh[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:"&&Nr(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function G3(t){(!t||typeof t!="function")&&(t=fc.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||Nr(r.protocol)?"//":"");return r.username?(i+=r.username,r.password&&(i+=":"+r.password),i+="@"):r.password?(i+=":"+r.password,i+="@"):r.protocol!=="file:"&&Nr(r.protocol)&&!n&&r.pathname!=="/"&&(i+="@"),(n[n.length-1]===":"||mw.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}Lr.prototype={set:K3,toString:G3};Lr.extractProtocol=yw;Lr.location=gw;Lr.trimLeft=wh;Lr.qs=fc;Dw.exports=Lr});var ww=x(vh=>{"use strict";Object.defineProperty(vh,"__esModule",{value:!0});vh.default=W3;function W3(){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 Rw=x(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});mc.default=void 0;var Y3=aw(),J3=_h(bw()),dc=_h(hh()),ro=mh(),X3=_h(ww());function _h(t){return t&&t.__esModule?t:{default:t}}function Ch(){"use strict";Ch=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",m="executing",g="completed",D={};function v(){}function _(){}function y(){}var E={};c(E,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(E=P);var T=y.prototype=v.prototype=Object.create(E);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&no(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(ie){C("next",ie,H,I)},function(ie){C("throw",ie,H,I)}):w.resolve(U).then(function(ie){X.value=ie,H(X)},function(ie){return C("throw",ie,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=h;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===h)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:p,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function k(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(no(b)+" is not iterable")}return _.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:_,configurable:!0}),_.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}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 Z3(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 kw(t,e){return tI(t)||eI(t,e)||Pw(t,e)||Q3()}function Q3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
38
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eI(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(f){c=!0,o=f}finally{try{if(!u&&r.return!=null&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function tI(t){if(Array.isArray(t))return t}function no(t){"@babel/helpers - typeof";return no=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},no(t)}function rI(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Pw(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
39
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return i=c.done,c},e:function(c){a=!0,s=c},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Pw(t,e){if(t){if(typeof t=="string")return Cw(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 Cw(t,e)}}function Cw(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 gi(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){nI(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 nI(t,e,r){return e=$w(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oI(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,$w(n.key),n)}}function iI(t,e,r){return e&&_w(t.prototype,e),r&&_w(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $w(t){var e=aI(t,"string");return no(e)=="symbol"?e:e+""}function aI(t,e){if(no(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(no(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pc="tus-v1",hc="ietf-draft-03",Ja="ietf-draft-05",sI={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:Tw,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:pc},Iw=(function(){function t(e,r){oI(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 iI(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(![pc,hc,Ja].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,ro.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,ro.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:cI(this._source.size,a);this._parallelUploadUrls&&s.forEach(function(f,d){f.uploadUrl=n._parallelUploadUrls[d]||null}),this._parallelUploadUrls=new Array(s.length);var u=s.map(function(f,d){var h=0;return n._source.slice(f.start,f.end).then(function(p){var m=p.value;return new Promise(function(g,D){var v=gi(gi({},n.options),{},{uploadUrl:f.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:gi(gi({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,onError:D,onProgress:function(E){i=i-h+E,h=E,n._emitProgress(i,o)},onUploadUrlAvailable:function(){n._parallelUploadUrls[d]=_.url,n._parallelUploadUrls.filter(function(E){return!!E}).length===s.length&&n._saveUploadInUrlStorage()}}),_=new t(m,v);_.start(),n._parallelUploads.push(_)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var f=Sw(n.options.metadata);return f!==""&&c.setHeader("Upload-Metadata",f),n._sendRequest(c,null)}).then(function(f){if(!yi(f.getStatus(),200)){n._emitHttpError(c,f,"tus: unexpected response while creating upload");return}var d=f.getHeader("Location");if(d==null){n._emitHttpError(c,f,"tus: invalid or missing Location header");return}n.url=Fw(n.options.endpoint,d),(0,ro.log)("Created upload at ".concat(n.url)),n._emitSuccess(f)}).catch(function(f){n._emitError(f)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,ro.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,ro.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,ro.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var o=rI(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 dc.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=Sw(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===hc||this.options.protocol===Ja)&&n.setHeader("Upload-Complete","?0"),i=this._sendRequest(n,null)),i.then(function(a){if(!yi(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=Fw(r.options.endpoint,s),(0,ro.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(!yi(a,200)){if(a===423){r._emitHttpError(n,i,"tus: upload is currently locked; retry later");return}if(yi(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===pc){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(!yi(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===pc?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ja&&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 f=n._offset+c;return!n.options.uploadLengthDeferred&&u&&f!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(f," bytes"))):s===null?n._sendRequest(r):((n.options.protocol===hc||n.options.protocol===Ja)&&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=xw(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 Aw(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=xw("DELETE",r,n);return Aw(o,null,n).then(function(i){if(i.getStatus()!==204)throw new dc.default("tus: unexpected response while terminating upload",null,o,i)}).catch(function(i){if(i instanceof dc.default||(i=new dc.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=gi(gi({},n),{},{retryDelays:s});return new Promise(function(c){return setTimeout(c,a)}).then(function(){return t.terminate(r,u)})})}}])})();function Sw(t){return Object.entries(t).map(function(e){var r=kw(e,2),n=r[0],o=r[1];return"".concat(n," ").concat(Y3.Base64.encode(String(o)))}).join(",")}function yi(t,e){return t>=e&&t<e+100}function xw(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===hc?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ja?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=kw(a[i],2),u=s[0],c=s[1];n.setHeader(u,c)}if(r.addRequestId){var f=(0,X3.default)();n.setHeader("X-Request-ID",f)}return n}function Aw(t,e,r){return Eh.apply(this,arguments)}function Eh(){return Eh=Z3(Ch().mark(function t(e,r,n){var o;return Ch().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 uI(){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):Tw(t)}function Tw(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!yi(e,400)||e===409||e===423)&&uI()}function Fw(t,e){return new J3.default(e,t).toString()}function cI(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}Iw.defaultOptions=sI;var OK=mc.default=Iw});var Nw=x((kK,Bw)=>{"use strict";var jr=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";jr.writable=t=>jr(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";jr.readable=t=>jr(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";jr.duplex=t=>jr.writable(t)&&jr.readable(t);jr.transform=t=>jr.duplex(t)&&typeof t._transform=="function";Bw.exports=jr});var jw=x(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});gc.default=void 0;function Xa(t){"@babel/helpers - typeof";return Xa=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},Xa(t)}function lI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lw(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,dI(n.key),n)}}function fI(t,e,r){return e&&Lw(t.prototype,e),r&&Lw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function dI(t){var e=pI(t,"string");return Xa(e)=="symbol"?e:e+""}function pI(t,e){if(Xa(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xa(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var PK=gc.default=(function(){function t(e){lI(this,t),this._buffer=e,this.size=e.length}return fI(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 Hw=x(Ah=>{"use strict";Object.defineProperty(Ah,"__esModule",{value:!0});Ah.default=bI;var qw=require("fs");function oo(t){"@babel/helpers - typeof";return oo=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},oo(t)}function Sh(){"use strict";Sh=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",m="executing",g="completed",D={};function v(){}function _(){}function y(){}var E={};c(E,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(E=P);var T=y.prototype=v.prototype=Object.create(E);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&oo(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(ie){C("next",ie,H,I)},function(ie){C("throw",ie,H,I)}):w.resolve(U).then(function(ie){X.value=ie,H(X)},function(ie){return C("throw",ie,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=h;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===h)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:p,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function k(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(oo(b)+" is not iterable")}return _.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:_,configurable:!0}),_.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function hI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Uw(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,gI(n.key),n)}}function mI(t,e,r){return e&&Uw(t.prototype,e),r&&Uw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gI(t){var e=yI(t,"string");return oo(e)=="symbol"?e:e+""}function yI(t,e){if(oo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(oo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mw(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 DI(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){Mw(i,n,o,a,s,"next",u)}function s(u){Mw(i,n,o,a,s,"throw",u)}a(void 0)})}}function bI(t){return xh.apply(this,arguments)}function xh(){return xh=DI(Sh().mark(function t(e){var r,n,o,i,a,s,u;return Sh().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return n=e.path.toString(),f.next=3,qw.promises.stat(n);case 3:return o=f.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,f.abrupt("return",new wI(e,n,u));case 9:case"end":return f.stop()}},t)})),xh.apply(this,arguments)}var wI=(function(){function t(e,r,n){hI(this,t),this._stream=e,this._path=r,this.size=n}return mI(t,[{key:"slice",value:function(r,n){var o,i=(o=this._stream.start)!==null&&o!==void 0?o:0,a=(0,qw.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 Fh=x(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});yc.default=void 0;function io(t){"@babel/helpers - typeof";return io=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},io(t)}function Za(){"use strict";Za=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(b,w,C){b[w]=C.value},i=typeof Symbol=="function"?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(b,w,C){return Object.defineProperty(b,w,{value:C,enumerable:!0,configurable:!0,writable:!0}),b[w]}try{c({},"")}catch{c=function(C,O,R){return C[O]=R}}function f(b,w,C,O){var R=w&&w.prototype instanceof v?w:v,$=Object.create(R.prototype),H=new Z(O||[]);return o($,"_invoke",{value:L(b,C,H)}),$}function d(b,w,C){try{return{type:"normal",arg:b.call(w,C)}}catch(O){return{type:"throw",arg:O}}}e.wrap=f;var h="suspendedStart",p="suspendedYield",m="executing",g="completed",D={};function v(){}function _(){}function y(){}var E={};c(E,a,function(){return this});var S=Object.getPrototypeOf,P=S&&S(S(k([])));P&&P!==r&&n.call(P,a)&&(E=P);var T=y.prototype=v.prototype=Object.create(E);function B(b){["next","throw","return"].forEach(function(w){c(b,w,function(C){return this._invoke(w,C)})})}function F(b,w){function C(R,$,H,I){var N=d(b[R],b,$);if(N.type!=="throw"){var X=N.arg,U=X.value;return U&&io(U)=="object"&&n.call(U,"__await")?w.resolve(U.__await).then(function(ie){C("next",ie,H,I)},function(ie){C("throw",ie,H,I)}):w.resolve(U).then(function(ie){X.value=ie,H(X)},function(ie){return C("throw",ie,H,I)})}I(N.arg)}var O;o(this,"_invoke",{value:function($,H){function I(){return new w(function(N,X){C($,H,N,X)})}return O=O?O.then(I,I):I()}})}function L(b,w,C){var O=h;return function(R,$){if(O===m)throw Error("Generator is already running");if(O===g){if(R==="throw")throw $;return{value:t,done:!0}}for(C.method=R,C.arg=$;;){var H=C.delegate;if(H){var I=A(H,C);if(I){if(I===D)continue;return I}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(O===h)throw O=g,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);O=m;var N=d(b,w,C);if(N.type==="normal"){if(O=C.done?g:p,N.arg===D)continue;return{value:N.arg,done:C.done}}N.type==="throw"&&(O=g,C.method="throw",C.arg=N.arg)}}}function A(b,w){var C=w.method,O=b.iterator[C];if(O===t)return w.delegate=null,C==="throw"&&b.iterator.return&&(w.method="return",w.arg=t,A(b,w),w.method==="throw")||C!=="return"&&(w.method="throw",w.arg=new TypeError("The iterator does not provide a '"+C+"' method")),D;var R=d(O,b.iterator,w.arg);if(R.type==="throw")return w.method="throw",w.arg=R.arg,w.delegate=null,D;var $=R.arg;return $?$.done?(w[b.resultName]=$.value,w.next=b.nextLoc,w.method!=="return"&&(w.method="next",w.arg=t),w.delegate=null,D):$:(w.method="throw",w.arg=new TypeError("iterator result is not an object"),w.delegate=null,D)}function q(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 j(b){var w=b.completion||{};w.type="normal",delete w.arg,b.completion=w}function Z(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(q,this),this.reset(!0)}function k(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 C=-1,O=function R(){for(;++C<b.length;)if(n.call(b,C))return R.value=b[C],R.done=!1,R;return R.value=t,R.done=!0,R};return O.next=O}}throw new TypeError(io(b)+" is not iterable")}return _.prototype=y,o(T,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:_,configurable:!0}),_.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(b){var w=typeof b=="function"&&b.constructor;return!!w&&(w===_||(w.displayName||w.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,y):(b.__proto__=y,c(b,u,"GeneratorFunction")),b.prototype=Object.create(T),b},e.awrap=function(b){return{__await:b}},B(F.prototype),c(F.prototype,s,function(){return this}),e.AsyncIterator=F,e.async=function(b,w,C,O,R){R===void 0&&(R=Promise);var $=new F(f(b,w,C,O),R);return e.isGeneratorFunction(w)?$:$.next().then(function(H){return H.done?H.value:$.next()})},B(T),c(T,u,"Generator"),c(T,a,function(){return this}),c(T,"toString",function(){return"[object Generator]"}),e.keys=function(b){var w=Object(b),C=[];for(var O in w)C.push(O);return C.reverse(),function R(){for(;C.length;){var $=C.pop();if($ in w)return R.value=$,R.done=!1,R}return R.done=!0,R}},e.values=k,Z.prototype={constructor:Z,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(j),!w)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=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 C=this;function O(X,U){return H.type="throw",H.arg=w,C.next=X,U&&(C.method="next",C.arg=t),!!U}for(var R=this.tryEntries.length-1;R>=0;--R){var $=this.tryEntries[R],H=$.completion;if($.tryLoc==="root")return O("end");if($.tryLoc<=this.prev){var I=n.call($,"catchLoc"),N=n.call($,"finallyLoc");if(I&&N){if(this.prev<$.catchLoc)return O($.catchLoc,!0);if(this.prev<$.finallyLoc)return O($.finallyLoc)}else if(I){if(this.prev<$.catchLoc)return O($.catchLoc,!0)}else{if(!N)throw Error("try statement without catch or finally");if(this.prev<$.finallyLoc)return O($.finallyLoc)}}}},abrupt:function(w,C){for(var O=this.tryEntries.length-1;O>=0;--O){var R=this.tryEntries[O];if(R.tryLoc<=this.prev&&n.call(R,"finallyLoc")&&this.prev<R.finallyLoc){var $=R;break}}$&&(w==="break"||w==="continue")&&$.tryLoc<=C&&C<=$.finallyLoc&&($=null);var H=$?$.completion:{};return H.type=w,H.arg=C,$?(this.method="next",this.next=$.finallyLoc,D):this.complete(H)},complete:function(w,C){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"&&C&&(this.next=C),D},finish:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.finallyLoc===w)return this.complete(O.completion,O.afterLoc),j(O),D}},catch:function(w){for(var C=this.tryEntries.length-1;C>=0;--C){var O=this.tryEntries[C];if(O.tryLoc===w){var R=O.completion;if(R.type==="throw"){var $=R.arg;j(O)}return $}}throw Error("illegal catch attempt")},delegateYield:function(w,C,O){return this.delegate={iterator:k(w),resultName:C,nextLoc:O},this.method==="next"&&(this.arg=t),D}},e}function vI(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,EI(n.key),n)}}function CI(t,e,r){return e&&Vw(t.prototype,e),r&&Vw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function EI(t){var e=_I(t,"string");return io(e)=="symbol"?e:e+""}function _I(t,e){if(io(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(io(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function zw(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 Kw(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(u){zw(i,n,o,a,s,"next",u)}function s(u){zw(i,n,o,a,s,"throw",u)}a(void 0)})}}function SI(t,e){return Oh.apply(this,arguments)}function Oh(){return Oh=Kw(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(f){e.off("readable",u),a(f)},u=function c(){var f=e.read(r);f!==null&&(e.off("error",s),e.off("readable",c),i(f))};e.once("error",s),e.on("readable",u)}));case 1:case"end":return o.stop()}},t)})),Oh.apply(this,arguments)}var TK=yc.default=(function(){function t(e){var r=this;vI(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 CI(t,[{key:"slice",value:(function(){var e=Kw(Za().mark(function n(o,i){var a,s,u,c,f;return Za().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(!(o<this._bufPos)){h.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(o>this._bufPos+this._buf.length)){h.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){h.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){h.next=10;break}return a.size=a.length,h.abrupt("return",{value:a,done:!0});case 10:if(c=i-o,!(c>a.length)){h.next=16;break}return h.next=14,SI(this._stream,c-a.length);case 14:f=h.sent,a=Buffer.concat([a,f]);case 16:return this._buf=a,this._bufPos=o,a.size=a.length,h.abrupt("return",{value:a,done:this._ended});case 20:case"end":return h.stop()}},n,this)}));function r(n,o){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var Ww=x(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});bc.default=void 0;var xI=require("fs"),AI=Dc(Nw()),OI=Dc(jw()),FI=Dc(Hw()),kI=Dc(Fh());function Dc(t){return t&&t.__esModule?t:{default:t}}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 PI(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,II(n.key),n)}}function $I(t,e,r){return e&&Gw(t.prototype,e),r&&Gw(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function II(t){var e=TI(t,"string");return Qa(e)=="symbol"?e:e+""}function TI(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 BK=bc.default=(function(){function t(){PI(this,t)}return $I(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new OI.default(r)):r instanceof xI.ReadStream&&r.path!=null?(0,FI.default)(r):AI.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new kI.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 Zw=x(kh=>{"use strict";Object.defineProperty(kh,"__esModule",{value:!0});kh.default=NI;var RI=require("crypto"),Yw=Xw(require("fs")),BI=Xw(require("path"));function Jw(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Jw=function(n){return n?r:e})(t)}function Xw(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=Jw(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&{}.hasOwnProperty.call(t,i)){var a=o?Object.getOwnPropertyDescriptor(t,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}function NI(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),o=(0,RI.createHash)("md5").update(n).digest("hex"),i=["node-buffer",o,t.length,e.endpoint].join("-");return Promise.resolve(i)}return t instanceof Yw.ReadStream&&t.path!=null?new Promise(function(a,s){var u=BI.resolve(t.path);Yw.stat(t.path,function(c,f){if(c){s(c);return}var d=["node-file",u,f.size,f.mtime.getTime(),e.endpoint].join("-");a(d)})}):Promise.resolve(null)}});var nv=x((jK,rv)=>{var tv="Expected a function",Qw=NaN,LI="[object Symbol]",jI=/^\s+|\s+$/g,UI=/^[-+]0x[0-9a-f]+$/i,MI=/^0b[01]+$/i,qI=/^0o[0-7]+$/i,HI=parseInt,VI=typeof global=="object"&&global&&global.Object===Object&&global,zI=typeof self=="object"&&self&&self.Object===Object&&self,KI=VI||zI||Function("return this")(),GI=Object.prototype,WI=GI.toString,YI=Math.max,JI=Math.min,Ph=function(){return KI.Date.now()};function XI(t,e,r){var n,o,i,a,s,u,c=0,f=!1,d=!1,h=!0;if(typeof t!="function")throw new TypeError(tv);e=ev(e)||0,wc(r)&&(f=!!r.leading,d="maxWait"in r,i=d?YI(ev(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h);function p(P){var T=n,B=o;return n=o=void 0,c=P,a=t.apply(B,T),a}function m(P){return c=P,s=setTimeout(v,e),f?p(P):a}function g(P){var T=P-u,B=P-c,F=e-T;return d?JI(F,i-B):F}function D(P){var T=P-u,B=P-c;return u===void 0||T>=e||T<0||d&&B>=i}function v(){var P=Ph();if(D(P))return _(P);s=setTimeout(v,g(P))}function _(P){return s=void 0,h&&n?p(P):(n=o=void 0,a)}function y(){s!==void 0&&clearTimeout(s),c=0,n=u=o=s=void 0}function E(){return s===void 0?a:_(Ph())}function S(){var P=Ph(),T=D(P);if(n=arguments,o=this,u=P,T){if(s===void 0)return m(u);if(d)return s=setTimeout(v,e),p(u)}return s===void 0&&(s=setTimeout(v,e)),a}return S.cancel=y,S.flush=E,S}function ZI(t,e,r){var n=!0,o=!0;if(typeof t!="function")throw new TypeError(tv);return wc(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),XI(t,e,{leading:n,maxWait:e,trailing:o})}function wc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function QI(t){return!!t&&typeof t=="object"}function eT(t){return typeof t=="symbol"||QI(t)&&WI.call(t)==LI}function ev(t){if(typeof t=="number")return t;if(eT(t))return Qw;if(wc(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=wc(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(jI,"");var r=MI.test(t);return r||qI.test(t)?HI(t.slice(2),r?2:8):UI.test(t)?Qw:+t}rv.exports=ZI});var dv=x(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});_c.default=void 0;var tT=cv(require("http")),rT=cv(require("https")),av=require("stream"),nT=require("url"),sv=oT(nv());function oT(t){return t&&t.__esModule?t:{default:t}}function uv(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(uv=function(n){return n?r:e})(t)}function cv(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=uv(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 iT(t,e,r){return e=vc(e),aT(t,lv()?Reflect.construct(e,r||[],vc(t).constructor):e.apply(t,r))}function aT(t,e){if(e&&(Di(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sT(t)}function sT(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lv(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lv=function(){return!!t})()}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vc(t)}function uT(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&&$h(t,e)}function $h(t,e){return $h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},$h(t,e)}function ov(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 es(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ov(Object(r),!0).forEach(function(n){cT(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ov(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function cT(t,e,r){return e=fv(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Di(t){"@babel/helpers - typeof";return Di=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Di(t)}function Cc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iv(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,fv(n.key),n)}}function Ec(t,e,r){return e&&iv(t.prototype,e),r&&iv(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function fv(t){var e=lT(t,"string");return Di(e)=="symbol"?e:e+""}function lT(t,e){if(Di(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Di(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var UK=_c.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Cc(this,t),this._requestOptions=e}return Ec(t,[{key:"createRequest",value:function(r,n){return new fT(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),fT=(function(){function t(e,r,n){Cc(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Ec(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=es(es(es({},(0,nT.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:es(es({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(a.headers["Content-Length"]=n.size);var s=a.protocol==="https:"?rT:tT;r._request=s.request(a);var u=r._request;u.on("response",function(c){var f=[];c.on("data",function(d){f.push(d)}),c.on("end",function(){var d=Buffer.concat(f).toString("utf8");o(new dT(c,d))})}),u.on("error",function(c){i(c)}),n instanceof av.Readable?n.pipe(new pT(r._progressHandler)).pipe(u):n instanceof Uint8Array?hT(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}}])})(),dT=(function(){function t(e,r){Cc(this,t),this._response=e,this._body=r}return Ec(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}}])})(),pT=(function(t){function e(r){var n;return Cc(this,e),n=iT(this,e),n._onprogress=(0,sv.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return uT(e,t),Ec(e,[{key:"_transform",value:function(n,o,i){this._position+=n.length,this._onprogress(this._position),i(null,n)}}])})(av.Transform),hT=function(e,r,n){n=(0,sv.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 pv=x(Ih=>{"use strict";Ih.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};Ih.root=function(t,e,r){var n=this,o,i={stackLength:Error.stackTraceLimit,rootOnly:!0},a="",s=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
40
40
  `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(i.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(i.rootOnly=e.rootOnly),(!i.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(f){switch(f){case"code":o=t.code||void 0;break;case"message":a=t.message||"";break;default:n[f]=t[f]}}),Error.stackTraceLimit=i.stackLength+2,u=new Error().stack.split(`
41
41
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=s,this.stack=u.join(`
42
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(f){o=f,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(f){a=f,c()}}),c())}});var mv=x((NK,hv)=>{"use strict";hv.exports=io;io.factory=dv();var Rh=io("CustomError");Rh.order=io(Rh,{message:"Arguments out of order.",code:"EOARG"});function io(t,e,r,n){var o,i;return e=_c(arguments,1,Error,pv,[Ih,Sc]),r=_c(arguments,2,{},Ih,[Sc]),n=_c(arguments,3,Th,Sc,[]),t=_c(arguments,0,e===Error?"Error":e.prototype.CustomError.name,fT,[pv,Ih,Sc]),i=e===Error,i&&n===Th&&(n=io.factory.root),o=function(a,s){var u,c,f,d,p,h;if(!(this instanceof o))return new o(a,s);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof a=="string"&&(a={message:a}),a||(a={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(a),c.unshift({}),h=Object.assign.apply(Object,c),u=this,f={},Object.keys(io.factory).forEach(function(m){f[m]=function(g,D){io.factory[m].call(u,g,D,f)}}),d=this.CustomError.chain.length-1;d>=0;d--)p=this.CustomError.chain[d],p.factory!==Th&&p.factory.call(this,h,s,f)},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 _c(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,f;for(s=0;s<=c;s++){if(f=t[s],i===-1)for(u=0;u<o.length;u++)o[u](f)&&(i=s);a===-1&&n(f)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Rh.order;return a!==-1?t[a]:r}function Sc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function fT(t){return typeof t=="string"}function pv(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Ih(t){return t&&typeof t=="object"}function Th(){}});var yv=x((LK,gv)=>{gv.exports=mv()});var Cv=x((ao,Di)=>{var dT=1/0,pT="[object Symbol]",es={function:!0,object:!0},hT=es[typeof ao]&&ao&&!ao.nodeType?ao:void 0,mT=es[typeof Di]&&Di&&!Di.nodeType?Di:void 0,gT=xc(hT&&mT&&typeof global=="object"&&global),yT=xc(es[typeof self]&&self),Dv=xc(es[typeof window]&&window),Bh=xc(es[typeof ao]&&ao),DT=gT||Dv!==(Bh&&Bh.window)&&Dv||yT||Bh||Function("return this")();function xc(t){return t&&t.Object===Object?t:null}var bT=Object.prototype,wT=bT.toString,bv=DT.Symbol,wv=bv?bv.prototype:void 0,vv=wv?wv.toString:void 0;function vT(t){if(typeof t=="string")return t;if(ET(t))return vv?vv.call(t):"";var e=t+"";return e=="0"&&1/t==-dT?"-0":e}function CT(t){return!!t&&typeof t=="object"}function ET(t){return typeof t=="symbol"||CT(t)&&wT.call(t)==pT}Di.exports=vT});var Fv=x((so,bi)=>{var _T=Cv(),ST="Expected a function",_v="__lodash_hash_undefined__",xT="[object Function]",AT="[object GeneratorFunction]",OT=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,FT=/[\\^$.*+?()[\]{}|]/g,PT=/\\(\\)?/g,kT=/^\[object .+?Constructor\]$/,rs={function:!0,object:!0},$T=rs[typeof so]&&so&&!so.nodeType?so:void 0,IT=rs[typeof bi]&&bi&&!bi.nodeType?bi:void 0,TT=Ac($T&&IT&&typeof global=="object"&&global),RT=Ac(rs[typeof self]&&self),Ev=Ac(rs[typeof window]&&window),Nh=Ac(rs[typeof so]&&so),BT=TT||Ev!==(Nh&&Nh.window)&&Ev||RT||Nh||Function("return this")();function Ac(t){return t&&t.Object===Object?t:null}function NT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var LT=Array.prototype,Sv=Object.prototype,xv=Function.prototype.toString,Lh=Sv.hasOwnProperty,jT=Sv.toString,UT=RegExp("^"+xv.call(Lh).replace(FT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),MT=LT.splice,qT=Av(BT,"Map"),ts=Av(Object,"create");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 HT(){this.__data__=ts?ts(null):{}}function VT(t){return this.has(t)&&delete this.__data__[t]}function zT(t){var e=this.__data__;if(ts){var r=e[t];return r===_v?void 0:r}return Lh.call(e,t)?e[t]:void 0}function KT(t){var e=this.__data__;return ts?e[t]!==void 0:Lh.call(e,t)}function GT(t,e){var r=this.__data__;return r[t]=ts&&e===void 0?_v:e,this}uo.prototype.clear=HT;uo.prototype.delete=VT;uo.prototype.get=zT;uo.prototype.has=KT;uo.prototype.set=GT;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 WT(){this.__data__=[]}function YT(t){var e=this.__data__,r=Oc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():MT.call(e,r,1),!0}function JT(t){var e=this.__data__,r=Oc(e,t);return r<0?void 0:e[r][1]}function XT(t){return Oc(this.__data__,t)>-1}function ZT(t,e){var r=this.__data__,n=Oc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}wi.prototype.clear=WT;wi.prototype.delete=YT;wi.prototype.get=JT;wi.prototype.has=XT;wi.prototype.set=ZT;function co(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function QT(){this.__data__={hash:new uo,map:new(qT||wi),string:new uo}}function eR(t){return Fc(this,t).delete(t)}function tR(t){return Fc(this,t).get(t)}function rR(t){return Fc(this,t).has(t)}function nR(t,e){return Fc(this,t).set(t,e),this}co.prototype.clear=QT;co.prototype.delete=eR;co.prototype.get=tR;co.prototype.has=rR;co.prototype.set=nR;function Oc(t,e){for(var r=t.length;r--;)if(sR(t[r][0],e))return r;return-1}function Fc(t,e){var r=t.__data__;return oR(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Av(t,e){var r=t[e];return cR(r)?r:void 0}function oR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var iR=jh(function(t){var e=[];return lR(t).replace(OT,function(r,n,o,i){e.push(o?i.replace(PT,"$1"):n||r)}),e});function aR(t){if(t!=null){try{return xv.call(t)}catch{}try{return t+""}catch{}}return""}function jh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(ST);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(jh.Cache||co),r}jh.Cache=co;function sR(t,e){return t===e||t!==t&&e!==e}function uR(t){var e=Ov(t)?jT.call(t):"";return e==xT||e==AT}function Ov(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function cR(t){if(!Ov(t))return!1;var e=uR(t)||NT(t)?UT:kT;return e.test(aR(t))}function lR(t){return t==null?"":_T(t)}bi.exports=iR});var iC=x((lo,Ci)=>{var fR=Fv(),dR=200,Jh="__lodash_hash_undefined__",Tc=1,Ei=2,pR=1/0,Rv=9007199254740991,Pc="[object Arguments]",qh="[object Array]",Bv="[object Boolean]",Nv="[object Date]",Lv="[object Error]",jv="[object Function]",hR="[object GeneratorFunction]",ns="[object Map]",Uv="[object Number]",vi="[object Object]",Pv="[object Promise]",Mv="[object RegExp]",os="[object Set]",Xh="[object String]",qv="[object Symbol]",Hh="[object WeakMap]",Hv="[object ArrayBuffer]",kc="[object DataView]",mR="[object Float32Array]",gR="[object Float64Array]",yR="[object Int8Array]",DR="[object Int16Array]",bR="[object Int32Array]",wR="[object Uint8Array]",vR="[object Uint8ClampedArray]",CR="[object Uint16Array]",ER="[object Uint32Array]",_R=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SR=/^\w*$/,xR=/[\\^$.*+?()[\]{}|]/g,AR=/^\[object .+?Constructor\]$/,OR=/^(?:0|[1-9]\d*)$/,Le={};Le[mR]=Le[gR]=Le[yR]=Le[DR]=Le[bR]=Le[wR]=Le[vR]=Le[CR]=Le[ER]=!0;Le[Pc]=Le[qh]=Le[Hv]=Le[Bv]=Le[kc]=Le[Nv]=Le[Lv]=Le[jv]=Le[ns]=Le[Uv]=Le[vi]=Le[Mv]=Le[os]=Le[Xh]=Le[Hh]=!1;var as={function:!0,object:!0},FR=as[typeof lo]&&lo&&!lo.nodeType?lo:void 0,PR=as[typeof Ci]&&Ci&&!Ci.nodeType?Ci:void 0,kR=Rc(FR&&PR&&typeof global=="object"&&global),$R=Rc(as[typeof self]&&self),kv=Rc(as[typeof window]&&window),Uh=Rc(as[typeof lo]&&lo),ho=kR||kv!==(Uh&&Uh.window)&&kv||$R||Uh||Function("return this")();function IR(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function TR(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function RR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function BR(t,e){return IR(e,function(r){return[r,t[r]]})}function Rc(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 NR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function LR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var jR=Array.prototype,Bc=Object.prototype,zv=Function.prototype.toString,fo=Bc.hasOwnProperty,mo=Bc.toString,UR=RegExp("^"+zv.call(fo).replace(xR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$v=ho.Symbol,Iv=ho.Uint8Array,MR=Bc.propertyIsEnumerable,qR=jR.splice,HR=Object.getPrototypeOf,VR=Object.keys,zh=_i(ho,"DataView"),$c=_i(ho,"Map"),Kh=_i(ho,"Promise"),Gh=_i(ho,"Set"),Wh=_i(ho,"WeakMap"),is=_i(Object,"create"),zR=yo(zh),KR=yo($c),GR=yo(Kh),WR=yo(Gh),YR=yo(Wh),Tv=$v?$v.prototype:void 0,Mh=Tv?Tv.valueOf:void 0;function po(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function JR(){this.__data__=is?is(null):{}}function XR(t){return this.has(t)&&delete this.__data__[t]}function ZR(t){var e=this.__data__;if(is){var r=e[t];return r===Jh?void 0:r}return fo.call(e,t)?e[t]:void 0}function QR(t){var e=this.__data__;return is?e[t]!==void 0:fo.call(e,t)}function eB(t,e){var r=this.__data__;return r[t]=is&&e===void 0?Jh:e,this}po.prototype.clear=JR;po.prototype.delete=XR;po.prototype.get=ZR;po.prototype.has=QR;po.prototype.set=eB;function sn(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 tB(){this.__data__=[]}function rB(t){var e=this.__data__,r=Nc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():qR.call(e,r,1),!0}function nB(t){var e=this.__data__,r=Nc(e,t);return r<0?void 0:e[r][1]}function oB(t){return Nc(this.__data__,t)>-1}function iB(t,e){var r=this.__data__,n=Nc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}sn.prototype.clear=tB;sn.prototype.delete=rB;sn.prototype.get=nB;sn.prototype.has=oB;sn.prototype.set=iB;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 aB(){this.__data__={hash:new po,map:new($c||sn),string:new po}}function sB(t){return Lc(this,t).delete(t)}function uB(t){return Lc(this,t).get(t)}function cB(t){return Lc(this,t).has(t)}function lB(t,e){return Lc(this,t).set(t,e),this}go.prototype.clear=aB;go.prototype.delete=sB;go.prototype.get=uB;go.prototype.has=cB;go.prototype.set=lB;function Ic(t){var e=-1,r=t?t.length:0;for(this.__data__=new go;++e<r;)this.add(t[e])}function fB(t){return this.__data__.set(t,Jh),this}function dB(t){return this.__data__.has(t)}Ic.prototype.add=Ic.prototype.push=fB;Ic.prototype.has=dB;function an(t){this.__data__=new sn(t)}function pB(){this.__data__=new sn}function hB(t){return this.__data__.delete(t)}function mB(t){return this.__data__.get(t)}function gB(t){return this.__data__.has(t)}function yB(t,e){var r=this.__data__;return r instanceof sn&&r.__data__.length==dR&&(r=this.__data__=new go(r.__data__)),r.set(t,e),this}an.prototype.clear=pB;an.prototype.delete=hB;an.prototype.get=mB;an.prototype.has=gB;an.prototype.set=yB;function Nc(t,e){for(var r=t.length;r--;)if(BB(t[r][0],e))return r;return-1}function Kv(t,e){e=jc(e,t)?[e]:Yv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Uc(e[r++])];return r&&r==n?t:void 0}function Gv(t,e){return fo.call(t,e)||typeof t=="object"&&e in t&&kB(t)===null}function DB(t,e){return e in Object(t)}function Zh(t,e,r,n,o){return t===e?!0:t==null||e==null||!qc(t)&&!ss(e)?t!==t&&e!==e:bB(t,e,Zh,r,n,o)}function bB(t,e,r,n,o,i){var a=In(t),s=In(e),u=qh,c=qh;a||(u=on(t),u=u==Pc?vi:u),s||(c=on(e),c=c==Pc?vi:c);var f=u==vi&&!Vh(t),d=c==vi&&!Vh(e),p=u==c;if(p&&!f)return i||(i=new an),a||jB(t)?Jv(t,e,r,n,o,i):AB(t,e,u,r,n,o,i);if(!(o&Ei)){var h=f&&fo.call(t,"__wrapped__"),m=d&&fo.call(e,"__wrapped__");if(h||m){var g=h?t.value():t,D=m?e.value():e;return i||(i=new an),r(g,D,n,o,i)}}return p?(i||(i=new an),OB(t,e,r,n,o,i)):!1}function wB(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],f=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new an;if(n)var p=n(c,f,u,t,e,d);if(!(p===void 0?Zh(f,c,n,Tc|Ei,d):p))return!1}}return!0}function vB(t){return typeof t=="function"?t:t==null?HB:typeof t=="object"?In(t)?_B(t[0],t[1]):EB(t):VB(t)}function CB(t){return VR(Object(t))}function EB(t){var e=PB(t);return e.length==1&&e[0][2]?Qv(e[0][0],e[0][1]):function(r){return r===t||wB(r,t,e)}}function _B(t,e){return jc(t)&&Zv(e)?Qv(Uc(t),e):function(r){var n=UB(r,t);return n===void 0&&n===e?MB(r,t):Zh(e,n,void 0,Tc|Ei)}}function Wv(t){return function(e){return e?.[t]}}function SB(t){return function(e){return Kv(e,t)}}function Yv(t){return In(t)?t:fR(t)}function xB(t){return function(e){var r=on(e);return r==ns?Vv(e):r==os?LR(e):BR(e,t(e))}}function Jv(t,e,r,n,o,i){var a=o&Ei,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 f=-1,d=!0,p=o&Tc?new Ic:void 0;for(i.set(t,e);++f<s;){var h=t[f],m=e[f];if(n)var g=a?n(m,h,f,e,t,i):n(h,m,f,t,e,i);if(g!==void 0){if(g)continue;d=!1;break}if(p){if(!TR(e,function(D,v){if(!p.has(v)&&(h===D||r(h,D,n,o,i)))return p.add(v)})){d=!1;break}}else if(!(h===m||r(h,m,n,o,i))){d=!1;break}}return i.delete(t),d}function AB(t,e,r,n,o,i,a){switch(r){case kc:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Hv:return!(t.byteLength!=e.byteLength||!n(new Iv(t),new Iv(e)));case Bv:case Nv:return+t==+e;case Lv:return t.name==e.name&&t.message==e.message;case Uv:return t!=+t?e!=+e:t==+e;case Mv:case Xh:return t==e+"";case ns:var s=Vv;case os:var u=i&Ei;if(s||(s=NR),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=Tc,a.set(t,e),Jv(s(t),s(e),n,o,i,a));case qv:if(Mh)return Mh.call(t)==Mh.call(e)}return!1}function OB(t,e,r,n,o,i){var a=o&Ei,s=Yh(t),u=s.length,c=Yh(e),f=c.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var p=s[d];if(!(a?p in e:Gv(e,p)))return!1}var h=i.get(t);if(h)return h==e;var m=!0;i.set(t,e);for(var g=a;++d<u;){p=s[d];var D=t[p],v=e[p];if(n)var E=a?n(v,D,p,e,t,i):n(D,v,p,t,e,i);if(!(E===void 0?D===v||r(D,v,n,o,i):E)){m=!1;break}g||(g=p=="constructor")}if(m&&!g){var y=t.constructor,_=e.constructor;y!=_&&"constructor"in t&&"constructor"in e&&!(typeof y=="function"&&y instanceof y&&typeof _=="function"&&_ instanceof _)&&(m=!1)}return i.delete(t),m}var FB=Wv("length");function Lc(t,e){var r=t.__data__;return TB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function PB(t){for(var e=qB(t),r=e.length;r--;)e[r][2]=Zv(e[r][1]);return e}function _i(t,e){var r=t[e];return LB(r)?r:void 0}function kB(t){return HR(Object(t))}function on(t){return mo.call(t)}(zh&&on(new zh(new ArrayBuffer(1)))!=kc||$c&&on(new $c)!=ns||Kh&&on(Kh.resolve())!=Pv||Gh&&on(new Gh)!=os||Wh&&on(new Wh)!=Hh)&&(on=function(t){var e=mo.call(t),r=e==vi?t.constructor:void 0,n=r?yo(r):void 0;if(n)switch(n){case zR:return kc;case KR:return ns;case GR:return Pv;case WR:return os;case YR:return Hh}return e});function $B(t,e,r){e=jc(e,t)?[e]:Yv(e);for(var n,o=-1,a=e.length;++o<a;){var i=Uc(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&&Mc(a)&&Xv(i,a)&&(In(t)||nC(t)||eC(t))}function IB(t){var e=t?t.length:void 0;return Mc(e)&&(In(t)||nC(t)||eC(t))?RR(e,String):null}function Xv(t,e){return e=e??Rv,!!e&&(typeof t=="number"||OR.test(t))&&t>-1&&t%1==0&&t<e}function jc(t,e){if(In(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||oC(t)?!0:SR.test(t)||!_R.test(t)||e!=null&&t in Object(e)}function TB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function RB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Bc;return t===r}function Zv(t){return t===t&&!qc(t)}function Qv(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Uc(t){if(typeof t=="string"||oC(t))return t;var e=t+"";return e=="0"&&1/t==-pR?"-0":e}function yo(t){if(t!=null){try{return zv.call(t)}catch{}try{return t+""}catch{}}return""}function BB(t,e){return t===e||t!==t&&e!==e}function eC(t){return NB(t)&&fo.call(t,"callee")&&(!MR.call(t,"callee")||mo.call(t)==Pc)}var In=Array.isArray;function tC(t){return t!=null&&Mc(FB(t))&&!rC(t)}function NB(t){return ss(t)&&tC(t)}function rC(t){var e=qc(t)?mo.call(t):"";return e==jv||e==hR}function Mc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rv}function qc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ss(t){return!!t&&typeof t=="object"}function LB(t){if(!qc(t))return!1;var e=rC(t)||Vh(t)?UR:AR;return e.test(yo(t))}function nC(t){return typeof t=="string"||!In(t)&&ss(t)&&mo.call(t)==Xh}function oC(t){return typeof t=="symbol"||ss(t)&&mo.call(t)==qv}function jB(t){return ss(t)&&Mc(t.length)&&!!Le[mo.call(t)]}function UB(t,e,r){var n=t==null?void 0:Kv(t,e);return n===void 0?r:n}function MB(t,e){return t!=null&&$B(t,e,DB)}function Yh(t){var e=RB(t);if(!(e||tC(t)))return CB(t);var r=IB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Gv(t,a)&&!(n&&(a=="length"||Xv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var qB=xB(Yh);function HB(t){return t}function VB(t){return jc(t)?Wv(Uc(t)):SB(t)}Ci.exports=vB});var lC=x((Do,Si)=>{var zB=1/0,KB="[object Function]",GB="[object GeneratorFunction]",WB=/[\\^$.*+?()[\]{}|]/g,YB=/^\[object .+?Constructor\]$/,us={function:!0,object:!0},JB=us[typeof Do]&&Do&&!Do.nodeType?Do:void 0,XB=us[typeof Si]&&Si&&!Si.nodeType?Si:void 0,ZB=Hc(JB&&XB&&typeof global=="object"&&global),QB=Hc(us[typeof self]&&self),aC=Hc(us[typeof window]&&window),Qh=Hc(us[typeof Do]&&Do),e6=ZB||aC!==(Qh&&Qh.window)&&aC||QB||Qh||Function("return this")();function Hc(t){return t&&t.Object===Object?t:null}function t6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function r6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var sC=Object.prototype,uC=Function.prototype.toString,n6=sC.hasOwnProperty,o6=sC.toString,i6=RegExp("^"+uC.call(n6).replace(WB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),em=s6(e6,"Set"),a6=em&&1/r6(new em([,-0]))[1]==zB?function(t){return new em(t)}:f6;function s6(t,e){var r=t[e];return l6(r)?r:void 0}function u6(t){if(t!=null){try{return uC.call(t)}catch{}try{return t+""}catch{}}return""}function c6(t){var e=cC(t)?o6.call(t):"";return e==KB||e==GB}function cC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function l6(t){if(!cC(t))return!1;var e=c6(t)||t6(t)?i6:YB;return e.test(u6(t))}function f6(){}Si.exports=a6});var dC=x((bo,xi)=>{var cs={function:!0,object:!0},d6=cs[typeof bo]&&bo&&!bo.nodeType?bo:void 0,p6=cs[typeof xi]&&xi&&!xi.nodeType?xi:void 0,h6=Vc(d6&&p6&&typeof global=="object"&&global),m6=Vc(cs[typeof self]&&self),fC=Vc(cs[typeof window]&&window),tm=Vc(cs[typeof bo]&&bo),g6=h6||fC!==(tm&&tm.window)&&fC||m6||tm||Function("return this")();function Vc(t){return t&&t.Object===Object?t:null}xi.exports=g6});var DC=x((jK,yC)=>{var y6=lC(),D6=dC(),b6=200,rm="__lodash_hash_undefined__",w6="[object Function]",v6="[object GeneratorFunction]",C6=/[\\^$.*+?()[\]{}|]/g,E6=/^\[object .+?Constructor\]$/;function _6(t,e){return!!t.length&&x6(t,e,0)>-1}function S6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function x6(t,e,r){if(e!==e)return O6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function A6(t,e){return t.has(e)}function O6(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 F6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function P6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var k6=Array.prototype,pC=Object.prototype,hC=Function.prototype.toString,nm=pC.hasOwnProperty,$6=pC.toString,I6=RegExp("^"+hC.call(nm).replace(C6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T6=k6.splice,R6=mC(D6,"Map"),ls=mC(Object,"create");function wo(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 B6(){this.__data__=ls?ls(null):{}}function N6(t){return this.has(t)&&delete this.__data__[t]}function L6(t){var e=this.__data__;if(ls){var r=e[t];return r===rm?void 0:r}return nm.call(e,t)?e[t]:void 0}function j6(t){var e=this.__data__;return ls?e[t]!==void 0:nm.call(e,t)}function U6(t,e){var r=this.__data__;return r[t]=ls&&e===void 0?rm:e,this}wo.prototype.clear=B6;wo.prototype.delete=N6;wo.prototype.get=L6;wo.prototype.has=j6;wo.prototype.set=U6;function Ai(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function M6(){this.__data__=[]}function q6(t){var e=this.__data__,r=Kc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():T6.call(e,r,1),!0}function H6(t){var e=this.__data__,r=Kc(e,t);return r<0?void 0:e[r][1]}function V6(t){return Kc(this.__data__,t)>-1}function z6(t,e){var r=this.__data__,n=Kc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Ai.prototype.clear=M6;Ai.prototype.delete=q6;Ai.prototype.get=H6;Ai.prototype.has=V6;Ai.prototype.set=z6;function Oi(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 K6(){this.__data__={hash:new wo,map:new(R6||Ai),string:new wo}}function G6(t){return Gc(this,t).delete(t)}function W6(t){return Gc(this,t).get(t)}function Y6(t){return Gc(this,t).has(t)}function J6(t,e){return Gc(this,t).set(t,e),this}Oi.prototype.clear=K6;Oi.prototype.delete=G6;Oi.prototype.get=W6;Oi.prototype.has=Y6;Oi.prototype.set=J6;function zc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Oi;++e<r;)this.add(t[e])}function X6(t){return this.__data__.set(t,rm),this}function Z6(t){return this.__data__.has(t)}zc.prototype.add=zc.prototype.push=X6;zc.prototype.has=Z6;function Kc(t,e){for(var r=t.length;r--;)if(r8(t[r][0],e))return r;return-1}function Q6(t,e,r){var n=-1,o=_6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=S6;else if(i>=b6){var c=e?null:y6(t);if(c)return P6(c);a=!1,o=A6,u=new zc}else u=e?[]:s;e:for(;++n<i;){var f=t[n],d=e?e(f):f;if(f=r||f!==0?f:0,a&&d===d){for(var p=u.length;p--;)if(u[p]===d)continue e;e&&u.push(d),s.push(f)}else o(u,d,r)||(u!==s&&u.push(d),s.push(f))}return s}function Gc(t,e){var r=t.__data__;return e8(e)?r[typeof e=="string"?"string":"hash"]:r.map}function mC(t,e){var r=t[e];return o8(r)?r:void 0}function e8(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function t8(t){if(t!=null){try{return hC.call(t)}catch{}try{return t+""}catch{}}return""}function r8(t,e){return t===e||t!==t&&e!==e}function n8(t){var e=gC(t)?$6.call(t):"";return e==w6||e==v6}function gC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function o8(t){if(!gC(t))return!1;var e=n8(t)||F6(t)?I6:E6;return e.test(t8(t))}yC.exports=Q6});var wC=x((UK,bC)=>{var i8=iC(),a8=DC();function s8(t,e){return t&&t.length?a8(t,i8(e)):[]}bC.exports=s8});var CC=x((MK,vC)=>{"use strict";var u8=yv(),c8=wC(),l8=u8("MultiError");vC.exports=om;function om(t){if(!(this instanceof om))return new om(t);if(t=Array.isArray(t)?t:[t],t=c8(t,function(r){return r.stack}),t.length===1)return t[0];var e=new l8({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
42
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return o},set:function(f){o=f,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return a},set:function(f){a=f,c()}}),c())}});var gv=x((HK,mv)=>{"use strict";mv.exports=ao;ao.factory=pv();var Bh=ao("CustomError");Bh.order=ao(Bh,{message:"Arguments out of order.",code:"EOARG"});function ao(t,e,r,n){var o,i;return e=Sc(arguments,1,Error,hv,[Th,xc]),r=Sc(arguments,2,{},Th,[xc]),n=Sc(arguments,3,Rh,xc,[]),t=Sc(arguments,0,e===Error?"Error":e.prototype.CustomError.name,mT,[hv,Th,xc]),i=e===Error,i&&n===Rh&&(n=ao.factory.root),o=function(a,s){var u,c,f,d,h,p;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({}),p=Object.assign.apply(Object,c),u=this,f={},Object.keys(ao.factory).forEach(function(m){f[m]=function(g,D){ao.factory[m].call(u,g,D,f)}}),d=this.CustomError.chain.length-1;d>=0;d--)h=this.CustomError.chain[d],h.factory!==Rh&&h.factory.call(this,p,s,f)},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 Sc(t,e,r,n,o){var i=-1,a=-1,s,u,c=e<t.length?e:t.length,f;for(s=0;s<=c;s++){if(f=t[s],i===-1)for(u=0;u<o.length;u++)o[u](f)&&(i=s);a===-1&&n(f)&&(a=s)}if(a!==-1&&i!==-1&&i<a)throw new Bh.order;return a!==-1?t[a]:r}function xc(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function mT(t){return typeof t=="string"}function hv(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function Th(t){return t&&typeof t=="object"}function Rh(){}});var Dv=x((VK,yv)=>{yv.exports=gv()});var Ev=x((so,bi)=>{var gT=1/0,yT="[object Symbol]",ts={function:!0,object:!0},DT=ts[typeof so]&&so&&!so.nodeType?so:void 0,bT=ts[typeof bi]&&bi&&!bi.nodeType?bi:void 0,wT=Ac(DT&&bT&&typeof global=="object"&&global),vT=Ac(ts[typeof self]&&self),bv=Ac(ts[typeof window]&&window),Nh=Ac(ts[typeof so]&&so),CT=wT||bv!==(Nh&&Nh.window)&&bv||vT||Nh||Function("return this")();function Ac(t){return t&&t.Object===Object?t:null}var ET=Object.prototype,_T=ET.toString,wv=CT.Symbol,vv=wv?wv.prototype:void 0,Cv=vv?vv.toString:void 0;function ST(t){if(typeof t=="string")return t;if(AT(t))return Cv?Cv.call(t):"";var e=t+"";return e=="0"&&1/t==-gT?"-0":e}function xT(t){return!!t&&typeof t=="object"}function AT(t){return typeof t=="symbol"||xT(t)&&_T.call(t)==yT}bi.exports=ST});var kv=x((uo,wi)=>{var OT=Ev(),FT="Expected a function",Sv="__lodash_hash_undefined__",kT="[object Function]",PT="[object GeneratorFunction]",$T=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,IT=/[\\^$.*+?()[\]{}|]/g,TT=/\\(\\)?/g,RT=/^\[object .+?Constructor\]$/,ns={function:!0,object:!0},BT=ns[typeof uo]&&uo&&!uo.nodeType?uo:void 0,NT=ns[typeof wi]&&wi&&!wi.nodeType?wi:void 0,LT=Oc(BT&&NT&&typeof global=="object"&&global),jT=Oc(ns[typeof self]&&self),_v=Oc(ns[typeof window]&&window),Lh=Oc(ns[typeof uo]&&uo),UT=LT||_v!==(Lh&&Lh.window)&&_v||jT||Lh||Function("return this")();function Oc(t){return t&&t.Object===Object?t:null}function MT(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var qT=Array.prototype,xv=Object.prototype,Av=Function.prototype.toString,jh=xv.hasOwnProperty,HT=xv.toString,VT=RegExp("^"+Av.call(jh).replace(IT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zT=qT.splice,KT=Ov(UT,"Map"),rs=Ov(Object,"create");function co(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function GT(){this.__data__=rs?rs(null):{}}function WT(t){return this.has(t)&&delete this.__data__[t]}function YT(t){var e=this.__data__;if(rs){var r=e[t];return r===Sv?void 0:r}return jh.call(e,t)?e[t]:void 0}function JT(t){var e=this.__data__;return rs?e[t]!==void 0:jh.call(e,t)}function XT(t,e){var r=this.__data__;return r[t]=rs&&e===void 0?Sv:e,this}co.prototype.clear=GT;co.prototype.delete=WT;co.prototype.get=YT;co.prototype.has=JT;co.prototype.set=XT;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 ZT(){this.__data__=[]}function QT(t){var e=this.__data__,r=Fc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():zT.call(e,r,1),!0}function eR(t){var e=this.__data__,r=Fc(e,t);return r<0?void 0:e[r][1]}function tR(t){return Fc(this.__data__,t)>-1}function rR(t,e){var r=this.__data__,n=Fc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}vi.prototype.clear=ZT;vi.prototype.delete=QT;vi.prototype.get=eR;vi.prototype.has=tR;vi.prototype.set=rR;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 nR(){this.__data__={hash:new co,map:new(KT||vi),string:new co}}function oR(t){return kc(this,t).delete(t)}function iR(t){return kc(this,t).get(t)}function aR(t){return kc(this,t).has(t)}function sR(t,e){return kc(this,t).set(t,e),this}lo.prototype.clear=nR;lo.prototype.delete=oR;lo.prototype.get=iR;lo.prototype.has=aR;lo.prototype.set=sR;function Fc(t,e){for(var r=t.length;r--;)if(fR(t[r][0],e))return r;return-1}function kc(t,e){var r=t.__data__;return uR(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Ov(t,e){var r=t[e];return pR(r)?r:void 0}function uR(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var cR=Uh(function(t){var e=[];return hR(t).replace($T,function(r,n,o,i){e.push(o?i.replace(TT,"$1"):n||r)}),e});function lR(t){if(t!=null){try{return Av.call(t)}catch{}try{return t+""}catch{}}return""}function Uh(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(FT);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(Uh.Cache||lo),r}Uh.Cache=lo;function fR(t,e){return t===e||t!==t&&e!==e}function dR(t){var e=Fv(t)?HT.call(t):"";return e==kT||e==PT}function Fv(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function pR(t){if(!Fv(t))return!1;var e=dR(t)||MT(t)?VT:RT;return e.test(lR(t))}function hR(t){return t==null?"":OT(t)}wi.exports=cR});var aC=x((fo,Ei)=>{var mR=kv(),gR=200,Xh="__lodash_hash_undefined__",Rc=1,_i=2,yR=1/0,Bv=9007199254740991,Pc="[object Arguments]",Hh="[object Array]",Nv="[object Boolean]",Lv="[object Date]",jv="[object Error]",Uv="[object Function]",DR="[object GeneratorFunction]",os="[object Map]",Mv="[object Number]",Ci="[object Object]",Pv="[object Promise]",qv="[object RegExp]",is="[object Set]",Zh="[object String]",Hv="[object Symbol]",Vh="[object WeakMap]",Vv="[object ArrayBuffer]",$c="[object DataView]",bR="[object Float32Array]",wR="[object Float64Array]",vR="[object Int8Array]",CR="[object Int16Array]",ER="[object Int32Array]",_R="[object Uint8Array]",SR="[object Uint8ClampedArray]",xR="[object Uint16Array]",AR="[object Uint32Array]",OR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,FR=/^\w*$/,kR=/[\\^$.*+?()[\]{}|]/g,PR=/^\[object .+?Constructor\]$/,$R=/^(?:0|[1-9]\d*)$/,Le={};Le[bR]=Le[wR]=Le[vR]=Le[CR]=Le[ER]=Le[_R]=Le[SR]=Le[xR]=Le[AR]=!0;Le[Pc]=Le[Hh]=Le[Vv]=Le[Nv]=Le[$c]=Le[Lv]=Le[jv]=Le[Uv]=Le[os]=Le[Mv]=Le[Ci]=Le[qv]=Le[is]=Le[Zh]=Le[Vh]=!1;var ss={function:!0,object:!0},IR=ss[typeof fo]&&fo&&!fo.nodeType?fo:void 0,TR=ss[typeof Ei]&&Ei&&!Ei.nodeType?Ei:void 0,RR=Bc(IR&&TR&&typeof global=="object"&&global),BR=Bc(ss[typeof self]&&self),$v=Bc(ss[typeof window]&&window),Mh=Bc(ss[typeof fo]&&fo),mo=RR||$v!==(Mh&&Mh.window)&&$v||BR||Mh||Function("return this")();function NR(t,e){for(var r=-1,n=t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function LR(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function jR(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function UR(t,e){return NR(e,function(r){return[r,t[r]]})}function Bc(t){return t&&t.Object===Object?t:null}function zh(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function zv(t){var e=-1,r=Array(t.size);return t.forEach(function(n,o){r[++e]=[o,n]}),r}function MR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function qR(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var HR=Array.prototype,Nc=Object.prototype,Kv=Function.prototype.toString,po=Nc.hasOwnProperty,go=Nc.toString,VR=RegExp("^"+Kv.call(po).replace(kR,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Iv=mo.Symbol,Tv=mo.Uint8Array,zR=Nc.propertyIsEnumerable,KR=HR.splice,GR=Object.getPrototypeOf,WR=Object.keys,Kh=Si(mo,"DataView"),Ic=Si(mo,"Map"),Gh=Si(mo,"Promise"),Wh=Si(mo,"Set"),Yh=Si(mo,"WeakMap"),as=Si(Object,"create"),YR=Do(Kh),JR=Do(Ic),XR=Do(Gh),ZR=Do(Wh),QR=Do(Yh),Rv=Iv?Iv.prototype:void 0,qh=Rv?Rv.valueOf:void 0;function ho(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 eB(){this.__data__=as?as(null):{}}function tB(t){return this.has(t)&&delete this.__data__[t]}function rB(t){var e=this.__data__;if(as){var r=e[t];return r===Xh?void 0:r}return po.call(e,t)?e[t]:void 0}function nB(t){var e=this.__data__;return as?e[t]!==void 0:po.call(e,t)}function oB(t,e){var r=this.__data__;return r[t]=as&&e===void 0?Xh:e,this}ho.prototype.clear=eB;ho.prototype.delete=tB;ho.prototype.get=rB;ho.prototype.has=nB;ho.prototype.set=oB;function sn(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 iB(){this.__data__=[]}function aB(t){var e=this.__data__,r=Lc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():KR.call(e,r,1),!0}function sB(t){var e=this.__data__,r=Lc(e,t);return r<0?void 0:e[r][1]}function uB(t){return Lc(this.__data__,t)>-1}function cB(t,e){var r=this.__data__,n=Lc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}sn.prototype.clear=iB;sn.prototype.delete=aB;sn.prototype.get=sB;sn.prototype.has=uB;sn.prototype.set=cB;function yo(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 lB(){this.__data__={hash:new ho,map:new(Ic||sn),string:new ho}}function fB(t){return jc(this,t).delete(t)}function dB(t){return jc(this,t).get(t)}function pB(t){return jc(this,t).has(t)}function hB(t,e){return jc(this,t).set(t,e),this}yo.prototype.clear=lB;yo.prototype.delete=fB;yo.prototype.get=dB;yo.prototype.has=pB;yo.prototype.set=hB;function Tc(t){var e=-1,r=t?t.length:0;for(this.__data__=new yo;++e<r;)this.add(t[e])}function mB(t){return this.__data__.set(t,Xh),this}function gB(t){return this.__data__.has(t)}Tc.prototype.add=Tc.prototype.push=mB;Tc.prototype.has=gB;function an(t){this.__data__=new sn(t)}function yB(){this.__data__=new sn}function DB(t){return this.__data__.delete(t)}function bB(t){return this.__data__.get(t)}function wB(t){return this.__data__.has(t)}function vB(t,e){var r=this.__data__;return r instanceof sn&&r.__data__.length==gR&&(r=this.__data__=new yo(r.__data__)),r.set(t,e),this}an.prototype.clear=yB;an.prototype.delete=DB;an.prototype.get=bB;an.prototype.has=wB;an.prototype.set=vB;function Lc(t,e){for(var r=t.length;r--;)if(UB(t[r][0],e))return r;return-1}function Gv(t,e){e=Uc(e,t)?[e]:Jv(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Mc(e[r++])];return r&&r==n?t:void 0}function Wv(t,e){return po.call(t,e)||typeof t=="object"&&e in t&&RB(t)===null}function CB(t,e){return e in Object(t)}function Qh(t,e,r,n,o){return t===e?!0:t==null||e==null||!Hc(t)&&!us(e)?t!==t&&e!==e:EB(t,e,Qh,r,n,o)}function EB(t,e,r,n,o,i){var a=In(t),s=In(e),u=Hh,c=Hh;a||(u=on(t),u=u==Pc?Ci:u),s||(c=on(e),c=c==Pc?Ci:c);var f=u==Ci&&!zh(t),d=c==Ci&&!zh(e),h=u==c;if(h&&!f)return i||(i=new an),a||HB(t)?Xv(t,e,r,n,o,i):PB(t,e,u,r,n,o,i);if(!(o&_i)){var p=f&&po.call(t,"__wrapped__"),m=d&&po.call(e,"__wrapped__");if(p||m){var g=p?t.value():t,D=m?e.value():e;return i||(i=new an),r(g,D,n,o,i)}}return h?(i||(i=new an),$B(t,e,r,n,o,i)):!1}function _B(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],f=s[1];if(a&&s[2]){if(c===void 0&&!(u in t))return!1}else{var d=new an;if(n)var h=n(c,f,u,t,e,d);if(!(h===void 0?Qh(f,c,n,Rc|_i,d):h))return!1}}return!0}function SB(t){return typeof t=="function"?t:t==null?GB:typeof t=="object"?In(t)?OB(t[0],t[1]):AB(t):WB(t)}function xB(t){return WR(Object(t))}function AB(t){var e=TB(t);return e.length==1&&e[0][2]?eC(e[0][0],e[0][1]):function(r){return r===t||_B(r,t,e)}}function OB(t,e){return Uc(t)&&Qv(e)?eC(Mc(t),e):function(r){var n=VB(r,t);return n===void 0&&n===e?zB(r,t):Qh(e,n,void 0,Rc|_i)}}function Yv(t){return function(e){return e?.[t]}}function FB(t){return function(e){return Gv(e,t)}}function Jv(t){return In(t)?t:mR(t)}function kB(t){return function(e){var r=on(e);return r==os?zv(e):r==is?qR(e):UR(e,t(e))}}function Xv(t,e,r,n,o,i){var a=o&_i,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 f=-1,d=!0,h=o&Rc?new Tc:void 0;for(i.set(t,e);++f<s;){var p=t[f],m=e[f];if(n)var g=a?n(m,p,f,e,t,i):n(p,m,f,t,e,i);if(g!==void 0){if(g)continue;d=!1;break}if(h){if(!LR(e,function(D,v){if(!h.has(v)&&(p===D||r(p,D,n,o,i)))return h.add(v)})){d=!1;break}}else if(!(p===m||r(p,m,n,o,i))){d=!1;break}}return i.delete(t),d}function PB(t,e,r,n,o,i,a){switch(r){case $c: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 Tv(t),new Tv(e)));case Nv:case Lv:return+t==+e;case jv:return t.name==e.name&&t.message==e.message;case Mv:return t!=+t?e!=+e:t==+e;case qv:case Zh:return t==e+"";case os:var s=zv;case is:var u=i&_i;if(s||(s=MR),t.size!=e.size&&!u)return!1;var c=a.get(t);return c?c==e:(i|=Rc,a.set(t,e),Xv(s(t),s(e),n,o,i,a));case Hv:if(qh)return qh.call(t)==qh.call(e)}return!1}function $B(t,e,r,n,o,i){var a=o&_i,s=Jh(t),u=s.length,c=Jh(e),f=c.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var h=s[d];if(!(a?h in e:Wv(e,h)))return!1}var p=i.get(t);if(p)return p==e;var m=!0;i.set(t,e);for(var g=a;++d<u;){h=s[d];var D=t[h],v=e[h];if(n)var _=a?n(v,D,h,e,t,i):n(D,v,h,t,e,i);if(!(_===void 0?D===v||r(D,v,n,o,i):_)){m=!1;break}g||(g=h=="constructor")}if(m&&!g){var y=t.constructor,E=e.constructor;y!=E&&"constructor"in t&&"constructor"in e&&!(typeof y=="function"&&y instanceof y&&typeof E=="function"&&E instanceof E)&&(m=!1)}return i.delete(t),m}var IB=Yv("length");function jc(t,e){var r=t.__data__;return LB(e)?r[typeof e=="string"?"string":"hash"]:r.map}function TB(t){for(var e=KB(t),r=e.length;r--;)e[r][2]=Qv(e[r][1]);return e}function Si(t,e){var r=t[e];return qB(r)?r:void 0}function RB(t){return GR(Object(t))}function on(t){return go.call(t)}(Kh&&on(new Kh(new ArrayBuffer(1)))!=$c||Ic&&on(new Ic)!=os||Gh&&on(Gh.resolve())!=Pv||Wh&&on(new Wh)!=is||Yh&&on(new Yh)!=Vh)&&(on=function(t){var e=go.call(t),r=e==Ci?t.constructor:void 0,n=r?Do(r):void 0;if(n)switch(n){case YR:return $c;case JR:return os;case XR:return Pv;case ZR:return is;case QR:return Vh}return e});function BB(t,e,r){e=Uc(e,t)?[e]:Jv(e);for(var n,o=-1,a=e.length;++o<a;){var i=Mc(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&&qc(a)&&Zv(i,a)&&(In(t)||oC(t)||tC(t))}function NB(t){var e=t?t.length:void 0;return qc(e)&&(In(t)||oC(t)||tC(t))?jR(e,String):null}function Zv(t,e){return e=e??Bv,!!e&&(typeof t=="number"||$R.test(t))&&t>-1&&t%1==0&&t<e}function Uc(t,e){if(In(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||iC(t)?!0:FR.test(t)||!OR.test(t)||e!=null&&t in Object(e)}function LB(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function jB(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Nc;return t===r}function Qv(t){return t===t&&!Hc(t)}function eC(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Mc(t){if(typeof t=="string"||iC(t))return t;var e=t+"";return e=="0"&&1/t==-yR?"-0":e}function Do(t){if(t!=null){try{return Kv.call(t)}catch{}try{return t+""}catch{}}return""}function UB(t,e){return t===e||t!==t&&e!==e}function tC(t){return MB(t)&&po.call(t,"callee")&&(!zR.call(t,"callee")||go.call(t)==Pc)}var In=Array.isArray;function rC(t){return t!=null&&qc(IB(t))&&!nC(t)}function MB(t){return us(t)&&rC(t)}function nC(t){var e=Hc(t)?go.call(t):"";return e==Uv||e==DR}function qc(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Bv}function Hc(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function us(t){return!!t&&typeof t=="object"}function qB(t){if(!Hc(t))return!1;var e=nC(t)||zh(t)?VR:PR;return e.test(Do(t))}function oC(t){return typeof t=="string"||!In(t)&&us(t)&&go.call(t)==Zh}function iC(t){return typeof t=="symbol"||us(t)&&go.call(t)==Hv}function HB(t){return us(t)&&qc(t.length)&&!!Le[go.call(t)]}function VB(t,e,r){var n=t==null?void 0:Gv(t,e);return n===void 0?r:n}function zB(t,e){return t!=null&&BB(t,e,CB)}function Jh(t){var e=jB(t);if(!(e||rC(t)))return xB(t);var r=NB(t),n=!!r,o=r||[],i=o.length;for(var a in t)Wv(t,a)&&!(n&&(a=="length"||Zv(a,i)))&&!(e&&a=="constructor")&&o.push(a);return o}var KB=kB(Jh);function GB(t){return t}function WB(t){return Uc(t)?Yv(Mc(t)):FB(t)}Ei.exports=SB});var fC=x((bo,xi)=>{var YB=1/0,JB="[object Function]",XB="[object GeneratorFunction]",ZB=/[\\^$.*+?()[\]{}|]/g,QB=/^\[object .+?Constructor\]$/,cs={function:!0,object:!0},e6=cs[typeof bo]&&bo&&!bo.nodeType?bo:void 0,t6=cs[typeof xi]&&xi&&!xi.nodeType?xi:void 0,r6=Vc(e6&&t6&&typeof global=="object"&&global),n6=Vc(cs[typeof self]&&self),sC=Vc(cs[typeof window]&&window),em=Vc(cs[typeof bo]&&bo),o6=r6||sC!==(em&&em.window)&&sC||n6||em||Function("return this")();function Vc(t){return t&&t.Object===Object?t:null}function i6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function a6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var uC=Object.prototype,cC=Function.prototype.toString,s6=uC.hasOwnProperty,u6=uC.toString,c6=RegExp("^"+cC.call(s6).replace(ZB,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tm=f6(o6,"Set"),l6=tm&&1/a6(new tm([,-0]))[1]==YB?function(t){return new tm(t)}:m6;function f6(t,e){var r=t[e];return h6(r)?r:void 0}function d6(t){if(t!=null){try{return cC.call(t)}catch{}try{return t+""}catch{}}return""}function p6(t){var e=lC(t)?u6.call(t):"";return e==JB||e==XB}function lC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function h6(t){if(!lC(t))return!1;var e=p6(t)||i6(t)?c6:QB;return e.test(d6(t))}function m6(){}xi.exports=l6});var pC=x((wo,Ai)=>{var ls={function:!0,object:!0},g6=ls[typeof wo]&&wo&&!wo.nodeType?wo:void 0,y6=ls[typeof Ai]&&Ai&&!Ai.nodeType?Ai:void 0,D6=zc(g6&&y6&&typeof global=="object"&&global),b6=zc(ls[typeof self]&&self),dC=zc(ls[typeof window]&&window),rm=zc(ls[typeof wo]&&wo),w6=D6||dC!==(rm&&rm.window)&&dC||b6||rm||Function("return this")();function zc(t){return t&&t.Object===Object?t:null}Ai.exports=w6});var bC=x((zK,DC)=>{var v6=fC(),C6=pC(),E6=200,nm="__lodash_hash_undefined__",_6="[object Function]",S6="[object GeneratorFunction]",x6=/[\\^$.*+?()[\]{}|]/g,A6=/^\[object .+?Constructor\]$/;function O6(t,e){return!!t.length&&k6(t,e,0)>-1}function F6(t,e,r){for(var n=-1,o=t.length;++n<o;)if(r(e,t[n]))return!0;return!1}function k6(t,e,r){if(e!==e)return $6(t,r);for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}function P6(t,e){return t.has(e)}function $6(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 I6(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function T6(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var R6=Array.prototype,hC=Object.prototype,mC=Function.prototype.toString,om=hC.hasOwnProperty,B6=hC.toString,N6=RegExp("^"+mC.call(om).replace(x6,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),L6=R6.splice,j6=gC(C6,"Map"),fs=gC(Object,"create");function vo(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 U6(){this.__data__=fs?fs(null):{}}function M6(t){return this.has(t)&&delete this.__data__[t]}function q6(t){var e=this.__data__;if(fs){var r=e[t];return r===nm?void 0:r}return om.call(e,t)?e[t]:void 0}function H6(t){var e=this.__data__;return fs?e[t]!==void 0:om.call(e,t)}function V6(t,e){var r=this.__data__;return r[t]=fs&&e===void 0?nm:e,this}vo.prototype.clear=U6;vo.prototype.delete=M6;vo.prototype.get=q6;vo.prototype.has=H6;vo.prototype.set=V6;function Oi(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 z6(){this.__data__=[]}function K6(t){var e=this.__data__,r=Gc(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():L6.call(e,r,1),!0}function G6(t){var e=this.__data__,r=Gc(e,t);return r<0?void 0:e[r][1]}function W6(t){return Gc(this.__data__,t)>-1}function Y6(t,e){var r=this.__data__,n=Gc(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Oi.prototype.clear=z6;Oi.prototype.delete=K6;Oi.prototype.get=G6;Oi.prototype.has=W6;Oi.prototype.set=Y6;function Fi(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 J6(){this.__data__={hash:new vo,map:new(j6||Oi),string:new vo}}function X6(t){return Wc(this,t).delete(t)}function Z6(t){return Wc(this,t).get(t)}function Q6(t){return Wc(this,t).has(t)}function e8(t,e){return Wc(this,t).set(t,e),this}Fi.prototype.clear=J6;Fi.prototype.delete=X6;Fi.prototype.get=Z6;Fi.prototype.has=Q6;Fi.prototype.set=e8;function Kc(t){var e=-1,r=t?t.length:0;for(this.__data__=new Fi;++e<r;)this.add(t[e])}function t8(t){return this.__data__.set(t,nm),this}function r8(t){return this.__data__.has(t)}Kc.prototype.add=Kc.prototype.push=t8;Kc.prototype.has=r8;function Gc(t,e){for(var r=t.length;r--;)if(a8(t[r][0],e))return r;return-1}function n8(t,e,r){var n=-1,o=O6,i=t.length,a=!0,s=[],u=s;if(r)a=!1,o=F6;else if(i>=E6){var c=e?null:v6(t);if(c)return T6(c);a=!1,o=P6,u=new Kc}else u=e?[]:s;e:for(;++n<i;){var f=t[n],d=e?e(f):f;if(f=r||f!==0?f:0,a&&d===d){for(var h=u.length;h--;)if(u[h]===d)continue e;e&&u.push(d),s.push(f)}else o(u,d,r)||(u!==s&&u.push(d),s.push(f))}return s}function Wc(t,e){var r=t.__data__;return o8(e)?r[typeof e=="string"?"string":"hash"]:r.map}function gC(t,e){var r=t[e];return u8(r)?r:void 0}function o8(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function i8(t){if(t!=null){try{return mC.call(t)}catch{}try{return t+""}catch{}}return""}function a8(t,e){return t===e||t!==t&&e!==e}function s8(t){var e=yC(t)?B6.call(t):"";return e==_6||e==S6}function yC(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function u8(t){if(!yC(t))return!1;var e=s8(t)||I6(t)?N6:A6;return e.test(i8(t))}DC.exports=n8});var vC=x((KK,wC)=>{var c8=aC(),l8=bC();function f8(t,e){return t&&t.length?l8(t,c8(e)):[]}wC.exports=f8});var EC=x((GK,CC)=>{"use strict";var d8=Dv(),p8=vC(),h8=d8("MultiError");CC.exports=im;function im(t){if(!(this instanceof im))return new im(t);if(t=Array.isArray(t)?t:[t],t=p8(t,function(r){return r.stack}),t.length===1)return t[0];var e=new h8({message:t.map(function(r){return r.message}).join("; "),errors:t.reduce(function(r,n){return r.concat(n.errors||n)},[])});return e.__defineGetter__("stack",function(){return t.map(function(r){return r.stack}).join(`
43
43
 
44
44
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
45
45
 
46
- `)}),e}});var _C=x((qK,EC)=>{var Tn=require("constants"),f8=process.cwd,Wc=null,d8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Wc||(Wc=f8.call(process)),Wc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(im=process.chdir,process.chdir=function(t){Wc=null,im.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,im));var im;EC.exports=p8;function p8(t){Tn.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(f,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(f,d,p,h){h&&process.nextTick(h)},t.lchownSync=function(){}),d8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(f){function d(p,h,m){var g=Date.now(),D=0;f(p,h,function v(E){if(E&&(E.code==="EACCES"||E.code==="EPERM"||E.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){t.stat(h,function(y,_){y&&y.code==="ENOENT"?f(p,h,v):m(E)})},D),D<100&&(D+=10);return}m&&m(E)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(f){function d(p,h,m,g,D,v){var E;if(v&&typeof v=="function"){var y=0;E=function(_,S,k){if(_&&_.code==="EAGAIN"&&y<10)return y++,f.call(t,p,h,m,g,D,E);v.apply(this,arguments)}}return f.call(t,p,h,m,g,D,E)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(f){return function(d,p,h,m,g){for(var D=0;;)try{return f.call(t,d,p,h,m,g)}catch(v){if(v.code==="EAGAIN"&&D<10){D++;continue}throw v}}})(t.readSync);function e(f){f.lchmod=function(d,p,h){f.open(d,Tn.O_WRONLY|Tn.O_SYMLINK,p,function(m,g){if(m){h&&h(m);return}f.fchmod(g,p,function(D){f.close(g,function(v){h&&h(D||v)})})})},f.lchmodSync=function(d,p){var h=f.openSync(d,Tn.O_WRONLY|Tn.O_SYMLINK,p),m=!0,g;try{g=f.fchmodSync(h,p),m=!1}finally{if(m)try{f.closeSync(h)}catch{}else f.closeSync(h)}return g}}function r(f){Tn.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,p,h,m){f.open(d,Tn.O_SYMLINK,function(g,D){if(g){m&&m(g);return}f.futimes(D,p,h,function(v){f.close(D,function(E){m&&m(v||E)})})})},f.lutimesSync=function(d,p,h){var m=f.openSync(d,Tn.O_SYMLINK),g,D=!0;try{g=f.futimesSync(m,p,h),D=!1}finally{if(D)try{f.closeSync(m)}catch{}else f.closeSync(m)}return g}):f.futimes&&(f.lutimes=function(d,p,h,m){m&&process.nextTick(m)},f.lutimesSync=function(){})}function n(f){return f&&function(d,p,h){return f.call(t,d,p,function(m){c(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(f){return f&&function(d,p){try{return f.call(t,d,p)}catch(h){if(!c(h))throw h}}}function i(f){return f&&function(d,p,h,m){return f.call(t,d,p,h,function(g){c(g)&&(g=null),m&&m.apply(this,arguments)})}}function a(f){return f&&function(d,p,h){try{return f.call(t,d,p,h)}catch(m){if(!c(m))throw m}}}function s(f){return f&&function(d,p,h){typeof p=="function"&&(h=p,p=null);function m(g,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),h&&h.apply(this,arguments)}return p?f.call(t,d,p,m):f.call(t,d,m)}}function u(f){return f&&function(d,p){var h=p?f.call(t,d,p):f.call(t,d);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function c(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var AC=x((HK,xC)=>{var SC=require("stream").Stream;xC.exports=h8;function h8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);SC.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(f,d){if(f){i.emit("error",f),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);SC.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 FC=x((VK,OC)=>{"use strict";OC.exports=g8;var m8=Object.getPrototypeOf||function(t){return t.__proto__};function g8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:m8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Rn=x((zK,um)=>{var Ge=require("fs"),y8=_C(),D8=AC(),b8=FC(),Yc=require("util"),Dt,Xc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Dt=Symbol.for("graceful-fs.queue"),Xc=Symbol.for("graceful-fs.previous")):(Dt="___graceful-fs.queue",Xc="___graceful-fs.previous");function w8(){}function $C(t,e){Object.defineProperty(t,Dt,{get:function(){return e}})}var vo=w8;Yc.debuglog?vo=Yc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(vo=function(){var t=Yc.format.apply(Yc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
- GFS4: `),console.error(t)});Ge[Dt]||(PC=global[Dt]||[],$C(Ge,PC),Ge.close=(function(t){function e(r,n){return t.call(Ge,r,function(o){o||kC(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Xc,{value:t}),e})(Ge.close),Ge.closeSync=(function(t){function e(r){t.apply(Ge,arguments),kC()}return Object.defineProperty(e,Xc,{value:t}),e})(Ge.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){vo(Ge[Dt]),require("assert").equal(Ge[Dt].length,0)}));var PC;global[Dt]||$C(global,Ge[Dt]);um.exports=am(b8(Ge));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ge.__patched&&(um.exports=am(Ge),Ge.__patched=!0);function am(t){y8(t),t.gracefulify=am,t.createReadStream=S,t.createWriteStream=k;var e=t.readFile;t.readFile=r;function r(F,L,A){return typeof L=="function"&&(A=L,L=null),q(F,L,A);function q(j,Z,P,b){return e(j,Z,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?Fi([q,[j,Z,P],w,b||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,P,b,w,C){return n(Z,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Fi([j,[Z,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,P,b,w,C){return i(Z,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Fi([j,[Z,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(F,L,A,q){return typeof A=="function"&&(q=A,A=0),j(F,L,A,q);function j(Z,P,b,w,C){return s(Z,P,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Fi([j,[Z,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var f=/^v[0-5]\./;function d(F,L,A){typeof L=="function"&&(A=L,L=null);var q=f.test(process.version)?function(P,b,w,C){return c(P,j(P,b,w,C))}:function(P,b,w,C){return c(P,b,j(P,b,w,C))};return q(F,L,A);function j(Z,P,b,w){return function(C,O){C&&(C.code==="EMFILE"||C.code==="ENFILE")?Fi([q,[Z,P,b],C,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof b=="function"&&b.call(this,C,O))}}}if(process.version.substr(0,4)==="v0.8"){var p=D8(t);v=p.ReadStream,y=p.WriteStream}var h=t.ReadStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=E);var m=t.WriteStream;m&&(y.prototype=Object.create(m.prototype),y.prototype.open=_),Object.defineProperty(t,"ReadStream",{get:function(){return v},set:function(F){v=F},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return y},set:function(F){y=F},enumerable:!0,configurable:!0});var g=v;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(F){g=F},enumerable:!0,configurable:!0});var D=y;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(F){D=F},enumerable:!0,configurable:!0});function v(F,L){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function E(){var F=this;B(F.path,F.flags,F.mode,function(L,A){L?(F.autoClose&&F.destroy(),F.emit("error",L)):(F.fd=A,F.emit("open",A),F.read())})}function y(F,L){return this instanceof y?(m.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function _(){var F=this;B(F.path,F.flags,F.mode,function(L,A){L?(F.destroy(),F.emit("error",L)):(F.fd=A,F.emit("open",A))})}function S(F,L){return new t.ReadStream(F,L)}function k(F,L){return new t.WriteStream(F,L)}var T=t.open;t.open=B;function B(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,P,b,w,C){return T(Z,P,b,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?Fi([j,[Z,P,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function Fi(t){vo("ENQUEUE",t[0].name,t[1]),Ge[Dt].push(t),sm()}var Jc;function kC(){for(var t=Date.now(),e=0;e<Ge[Dt].length;++e)Ge[Dt][e].length>2&&(Ge[Dt][e][3]=t,Ge[Dt][e][4]=t);sm()}function sm(){if(clearTimeout(Jc),Jc=void 0,Ge[Dt].length!==0){var t=Ge[Dt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)vo("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){vo("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?(vo("RETRY",e.name,r),e.apply(null,r.concat([o]))):Ge[Dt].push(t)}Jc===void 0&&(Jc=setTimeout(sm,0))}}});var TC=x((KK,IC)=>{function Dr(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))}IC.exports=Dr;Dr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Dr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Dr.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};Dr.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)};Dr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Dr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Dr.prototype.start=Dr.prototype.try;Dr.prototype.errors=function(){return this._errors};Dr.prototype.attempts=function(){return this._attempts};Dr.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 RC=x(Co=>{var v8=TC();Co.operation=function(t){var e=Co.timeouts(t);return new v8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Co.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};Co.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};Co.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=Co.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(p){c.retry(p)||(p&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,f)})}.bind(t,a),t[i].options=e}}});var NC=x((WK,BC)=>{BC.exports=RC()});var LC=x((YK,Zc)=>{Zc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Zc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Zc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var fm=x((JK,$i)=>{var Me=global.process,Eo=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"};Eo(Me)?(jC=require("assert"),Pi=LC(),UC=/^win/i.test(Me.platform),fs=require("events"),typeof fs!="function"&&(fs=fs.EventEmitter),Me.__signal_exit_emitter__?st=Me.__signal_exit_emitter__:(st=Me.__signal_exit_emitter__=new fs,st.count=0,st.emitted={}),st.infinite||(st.setMaxListeners(1/0),st.infinite=!0),$i.exports=function(t,e){if(!Eo(global.process))return function(){};jC.equal(typeof t,"function","a callback must be provided for exit handler"),ki===!1&&cm();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){st.removeListener(r,t),st.listeners("exit").length===0&&st.listeners("afterexit").length===0&&Qc()};return st.on(r,t),n},Qc=function(){!ki||!Eo(global.process)||(ki=!1,Pi.forEach(function(e){try{Me.removeListener(e,el[e])}catch{}}),Me.emit=tl,Me.reallyExit=lm,st.count-=1)},$i.exports.unload=Qc,_o=function(e,r,n){st.emitted[e]||(st.emitted[e]=!0,st.emit(e,r,n))},el={},Pi.forEach(function(t){el[t]=function(){if(Eo(global.process)){var r=Me.listeners(t);r.length===st.count&&(Qc(),_o("exit",null,t),_o("afterexit",null,t),UC&&t==="SIGHUP"&&(t="SIGINT"),Me.kill(Me.pid,t))}}}),$i.exports.signals=function(){return Pi},ki=!1,cm=function(){ki||!Eo(global.process)||(ki=!0,st.count+=1,Pi=Pi.filter(function(e){try{return Me.on(e,el[e]),!0}catch{return!1}}),Me.emit=qC,Me.reallyExit=MC)},$i.exports.load=cm,lm=Me.reallyExit,MC=function(e){Eo(global.process)&&(Me.exitCode=e||0,_o("exit",Me.exitCode,null),_o("afterexit",Me.exitCode,null),lm.call(Me,Me.exitCode))},tl=Me.emit,qC=function(e,r){if(e==="exit"&&Eo(global.process)){r!==void 0&&(Me.exitCode=r);var n=tl.apply(this,arguments);return _o("exit",Me.exitCode,null),_o("afterexit",Me.exitCode,null),n}else return tl.apply(this,arguments)}):$i.exports=function(){return function(){}};var jC,Pi,UC,fs,st,Qc,_o,el,ki,cm,lm,MC,tl,qC});var VC=x((XK,dm)=>{"use strict";var HC=Symbol();function C8(t,e,r){let n=e[HC];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,HC,{value:u}),r(null,s.mtime,u)})})}function E8(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}dm.exports.probe=C8;dm.exports.getMtime=E8});var YC=x((ZK,ps)=>{"use strict";var _8=require("path"),mm=Rn(),S8=NC(),x8=fm(),zC=VC(),un={};function ds(t,e){return e.lockfilePath||`${t}.lock`}function gm(t,e,r){if(!e.realpath)return r(null,_8.resolve(t));e.fs.realpath(t,r)}function hm(t,e,r){let n=ds(t,e);e.fs.mkdir(n,o=>{if(!o)return zC.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"?hm(t,{...e,stale:0},r):r(i);if(!KC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));GC(t,e,s=>{if(s)return r(s);hm(t,{...e,stale:0},r)})})})}function KC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function GC(t,e,r){e.fs.rmdir(ds(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function rl(t,e){let r=un[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?pm(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,rl(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return pm(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=zC.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?pm(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,rl(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,rl(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function pm(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),un[t]===e&&delete un[t],e.options.onCompromised(r)}function A8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:mm,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),gm(t,e,(n,o)=>{if(n)return r(n);let i=S8.operation(e.retries);i.attempt(()=>{hm(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=un[o]={lockfilePath:ds(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};rl(o,e),r(null,f=>{if(c.released)return f&&f(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));WC(o,{...e,realpath:!1},f)})})})})}function WC(t,e,r){e={fs:mm,realpath:!0,...e},gm(t,e,(n,o)=>{if(n)return r(n);let i=un[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 un[o],GC(o,e,r)})}function O8(t,e,r){e={stale:1e4,realpath:!0,fs:mm,...e},e.stale=Math.max(e.stale||0,2e3),gm(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ds(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!KC(a,e)))})}function F8(){return un}x8(()=>{for(let t in un){let e=un[t].options;try{e.fs.rmdirSync(ds(t,e))}catch{}}});ps.exports.lock=A8;ps.exports.unlock=WC;ps.exports.check=O8;ps.exports.getLocks=F8});var XC=x((QK,JC)=>{"use strict";var P8=Rn();function k8(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 $8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function I8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function T8(t){if(t={...t},t.fs=k8(t.fs||P8),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}JC.exports={toPromise:$8,toSync:I8,toSyncOptions:T8}});var QC=x((eG,Bn)=>{"use strict";var Ii=YC(),{toPromise:nl,toSync:ol,toSyncOptions:ym}=XC();async function ZC(t,e){let r=await nl(Ii.lock)(t,e);return nl(r)}function R8(t,e){let r=ol(Ii.lock)(t,ym(e));return ol(r)}function B8(t,e){return nl(Ii.unlock)(t,e)}function N8(t,e){return ol(Ii.unlock)(t,ym(e))}function L8(t,e){return nl(Ii.check)(t,e)}function j8(t,e){return ol(Ii.check)(t,ym(e))}Bn.exports=ZC;Bn.exports.lock=ZC;Bn.exports.unlock=B8;Bn.exports.lockSync=R8;Bn.exports.unlockSync=N8;Bn.exports.check=L8;Bn.exports.checkSync=j8});var oE=x(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});Ti.canStoreURLs=Ti.FileUrlStorage=void 0;var eE=require("fs"),U8=q8(CC()),tE=M8(QC());function nE(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(nE=function(n){return n?r:e})(t)}function M8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=nE(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 q8(t){return t&&t.__esModule?t:{default:t}}function hs(t){"@babel/helpers - typeof";return hs=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},hs(t)}function H8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function rE(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,z8(n.key),n)}}function V8(t,e,r){return e&&rE(t.prototype,e),r&&rE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function z8(t){var e=K8(t,"string");return hs(e)=="symbol"?e:e+""}function K8(t,e){if(hs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var tG=Ti.canStoreURLs=!0,rG=Ti.FileUrlStorage=(function(){function t(e){H8(this,t),this.path=e}return V8(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;tE.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;tE.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,U8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,eE.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,eE.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 al=x(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Object.defineProperty(Wt,"DefaultHttpStack",{enumerable:!0,get:function(){return uE.default}});Object.defineProperty(Wt,"DetailedError",{enumerable:!0,get:function(){return G8.default}});Object.defineProperty(Wt,"FileUrlStorage",{enumerable:!0,get:function(){return cE.FileUrlStorage}});Object.defineProperty(Wt,"StreamSource",{enumerable:!0,get:function(){return Z8.default}});Wt.Upload=void 0;Object.defineProperty(Wt,"canStoreURLs",{enumerable:!0,get:function(){return cE.canStoreURLs}});Wt.defaultOptions=void 0;Object.defineProperty(Wt,"enableDebugLog",{enumerable:!0,get:function(){return W8.enableDebugLog}});Wt.isSupported=void 0;var G8=So(ph()),W8=hh(),Y8=So(ow()),Dm=So(Tw()),J8=So(Gw()),X8=So(Xw()),uE=So(fv()),Z8=So(Oh()),cE=oE();function So(t){return t&&t.__esModule?t:{default:t}}function Bi(t){"@babel/helpers - typeof";return Bi=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},Bi(t)}function Q8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iE(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,fE(n.key),n)}}function eN(t,e,r){return e&&iE(t.prototype,e),r&&iE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tN(t,e,r){return e=il(e),rN(t,lE()?Reflect.construct(e,r||[],il(t).constructor):e.apply(t,r))}function rN(t,e){if(e&&(Bi(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return nN(t)}function nN(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(lE=function(){return!!t})()}function il(t){return il=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},il(t)}function oN(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&&bm(t,e)}function bm(t,e){return bm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},bm(t,e)}function aE(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 Ri(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aE(Object(r),!0).forEach(function(n){iN(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function iN(t,e,r){return e=fE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fE(t){var e=aN(t,"string");return Bi(e)=="symbol"?e:e+""}function aN(t,e){if(Bi(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bi(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var sE=Wt.defaultOptions=Ri(Ri({},Dm.default.defaultOptions),{},{httpStack:new uE.default,fileReader:new J8.default,urlStorage:new Y8.default,fingerprint:X8.default}),oG=Wt.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 Q8(this,e),n=Ri(Ri({},sE),n),tN(this,e,[r,n])}return oN(e,t),eN(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Ri(Ri({},sE),o),Dm.default.terminate(n,o)}}])})(Dm.default),iG=Wt.isSupported=!0});var gE=x((vG,mE)=>{var Ni=1e3,Li=Ni*60,ji=Li*60,xo=ji*24,mN=xo*7,gN=xo*365.25;mE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return yN(t);if(r==="number"&&isFinite(t))return e.long?bN(t):DN(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function yN(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*gN;case"weeks":case"week":case"w":return r*mN;case"days":case"day":case"d":return r*xo;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ji;case"minutes":case"minute":case"mins":case"min":case"m":return r*Li;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ni;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function DN(t){var e=Math.abs(t);return e>=xo?Math.round(t/xo)+"d":e>=ji?Math.round(t/ji)+"h":e>=Li?Math.round(t/Li)+"m":e>=Ni?Math.round(t/Ni)+"s":t+"ms"}function bN(t){var e=Math.abs(t);return e>=xo?ul(t,e,xo,"day"):e>=ji?ul(t,e,ji,"hour"):e>=Li?ul(t,e,Li,"minute"):e>=Ni?ul(t,e,Ni,"second"):t+" ms"}function ul(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Cm=x((CG,yE)=>{function wN(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=gE(),r.destroy=c,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let d=0;for(let p=0;p<f.length;p++)d=(d<<5)-d+f.charCodeAt(p),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(f){let d,p=null,h,m;function g(...D){if(!g.enabled)return;let v=g,E=Number(new Date),y=E-(d||E);v.diff=y,v.prev=d,v.curr=E,d=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,(k,T)=>{if(k==="%%")return"%";_++;let B=r.formatters[T];if(typeof B=="function"){let F=D[_];k=B.call(v,F),D.splice(_,1),_--}return k}),r.formatArgs.call(v,D),(v.log||r.log).apply(v,D)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(h!==r.namespaces&&(h=r.namespaces,m=r.enabled(f)),m),set:D=>{p=D}}),typeof r.init=="function"&&r.init(g),g}function n(f,d){let p=r(this.namespace+(typeof d>"u"?":":d)+f);return p.log=this.log,p}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let p of d)p[0]==="-"?r.skips.push(p.slice(1)):r.names.push(p)}function i(f,d){let p=0,h=0,m=-1,g=0;for(;p<f.length;)if(h<d.length&&(d[h]===f[p]||d[h]==="*"))d[h]==="*"?(m=h,g=p,h++):(p++,h++);else if(m!==-1)h=m+1,g++,p=g;else return!1;for(;h<d.length&&d[h]==="*";)h++;return h===d.length}function a(){let f=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),f}function s(f){for(let d of r.skips)if(i(f,d))return!1;for(let d of r.names)if(i(f,d))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}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}yE.exports=wN});var DE=x((Yt,cl)=>{Yt.formatArgs=CN;Yt.save=EN;Yt.load=_N;Yt.useColors=vN;Yt.storage=SN();Yt.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`."))}})();Yt.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 vN(){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 CN(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+cl.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)}Yt.log=console.debug||console.log||(()=>{});function EN(t){try{t?Yt.storage.setItem("debug",t):Yt.storage.removeItem("debug")}catch{}}function _N(){let t;try{t=Yt.storage.getItem("debug")||Yt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function SN(){try{return localStorage}catch{}}cl.exports=Cm()(Yt);var{formatters:xN}=cl.exports;xN.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var wE=x((EG,bE)=>{"use strict";bE.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((_G,CE)=>{"use strict";var AN=require("os"),vE=require("tty"),wr=wE(),{env:ct}=process,Nn;wr("no-color")||wr("no-colors")||wr("color=false")||wr("color=never")?Nn=0:(wr("color")||wr("colors")||wr("color=true")||wr("color=always"))&&(Nn=1);"FORCE_COLOR"in ct&&(ct.FORCE_COLOR==="true"?Nn=1:ct.FORCE_COLOR==="false"?Nn=0:Nn=ct.FORCE_COLOR.length===0?1:Math.min(parseInt(ct.FORCE_COLOR,10),3));function Em(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function _m(t,e){if(Nn===0)return 0;if(wr("color=16m")||wr("color=full")||wr("color=truecolor"))return 3;if(wr("color=256"))return 2;if(t&&!e&&Nn===void 0)return 0;let r=Nn||0;if(ct.TERM==="dumb")return r;if(process.platform==="win32"){let n=AN.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in ct)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in ct)||ct.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in ct)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ct.TEAMCITY_VERSION)?1:0;if(ct.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ct){let n=parseInt((ct.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ct.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ct.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ct.TERM)||"COLORTERM"in ct?1:r}function ON(t){let e=_m(t,t&&t.isTTY);return Em(e)}CE.exports={supportsColor:ON,stdout:Em(_m(!0,vE.isatty(1))),stderr:Em(_m(!0,vE.isatty(2)))}});var SE=x((lt,fl)=>{var FN=require("tty"),ll=require("util");lt.init=BN;lt.log=IN;lt.formatArgs=kN;lt.save=TN;lt.load=RN;lt.useColors=PN;lt.destroy=ll.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");lt.colors=[6,2,3,4,5,1];try{let t=EE();t&&(t.stderr||t).level>=2&&(lt.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{}lt.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 PN(){return"colors"in lt.inspectOpts?!!lt.inspectOpts.colors:FN.isatty(process.stderr.fd)}function kN(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
46
+ `)}),e}});var SC=x((WK,_C)=>{var Tn=require("constants"),m8=process.cwd,Yc=null,g8=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Yc||(Yc=m8.call(process)),Yc};try{process.cwd()}catch{}typeof process.chdir=="function"&&(am=process.chdir,process.chdir=function(t){Yc=null,am.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,am));var am;_C.exports=y8;function y8(t){Tn.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(f,d,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(f,d,h,p){p&&process.nextTick(p)},t.lchownSync=function(){}),g8==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(f){function d(h,p,m){var g=Date.now(),D=0;f(h,p,function v(_){if(_&&(_.code==="EACCES"||_.code==="EPERM"||_.code==="EBUSY")&&Date.now()-g<6e4){setTimeout(function(){t.stat(p,function(y,E){y&&y.code==="ENOENT"?f(h,p,v):m(_)})},D),D<100&&(D+=10);return}m&&m(_)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(f){function d(h,p,m,g,D,v){var _;if(v&&typeof v=="function"){var y=0;_=function(E,S,P){if(E&&E.code==="EAGAIN"&&y<10)return y++,f.call(t,h,p,m,g,D,_);v.apply(this,arguments)}}return f.call(t,h,p,m,g,D,_)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,f),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(f){return function(d,h,p,m,g){for(var D=0;;)try{return f.call(t,d,h,p,m,g)}catch(v){if(v.code==="EAGAIN"&&D<10){D++;continue}throw v}}})(t.readSync);function e(f){f.lchmod=function(d,h,p){f.open(d,Tn.O_WRONLY|Tn.O_SYMLINK,h,function(m,g){if(m){p&&p(m);return}f.fchmod(g,h,function(D){f.close(g,function(v){p&&p(D||v)})})})},f.lchmodSync=function(d,h){var p=f.openSync(d,Tn.O_WRONLY|Tn.O_SYMLINK,h),m=!0,g;try{g=f.fchmodSync(p,h),m=!1}finally{if(m)try{f.closeSync(p)}catch{}else f.closeSync(p)}return g}}function r(f){Tn.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(d,h,p,m){f.open(d,Tn.O_SYMLINK,function(g,D){if(g){m&&m(g);return}f.futimes(D,h,p,function(v){f.close(D,function(_){m&&m(v||_)})})})},f.lutimesSync=function(d,h,p){var m=f.openSync(d,Tn.O_SYMLINK),g,D=!0;try{g=f.futimesSync(m,h,p),D=!1}finally{if(D)try{f.closeSync(m)}catch{}else f.closeSync(m)}return g}):f.futimes&&(f.lutimes=function(d,h,p,m){m&&process.nextTick(m)},f.lutimesSync=function(){})}function n(f){return f&&function(d,h,p){return f.call(t,d,h,function(m){c(m)&&(m=null),p&&p.apply(this,arguments)})}}function o(f){return f&&function(d,h){try{return f.call(t,d,h)}catch(p){if(!c(p))throw p}}}function i(f){return f&&function(d,h,p,m){return f.call(t,d,h,p,function(g){c(g)&&(g=null),m&&m.apply(this,arguments)})}}function a(f){return f&&function(d,h,p){try{return f.call(t,d,h,p)}catch(m){if(!c(m))throw m}}}function s(f){return f&&function(d,h,p){typeof h=="function"&&(p=h,h=null);function m(g,D){D&&(D.uid<0&&(D.uid+=4294967296),D.gid<0&&(D.gid+=4294967296)),p&&p.apply(this,arguments)}return h?f.call(t,d,h,m):f.call(t,d,m)}}function u(f){return f&&function(d,h){var p=h?f.call(t,d,h):f.call(t,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function c(f){if(!f||f.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var OC=x((YK,AC)=>{var xC=require("stream").Stream;AC.exports=D8;function D8(t){return{ReadStream:e,WriteStream:r};function e(n,o){if(!(this instanceof e))return new e(n,o);xC.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(f,d){if(f){i.emit("error",f),i.readable=!1;return}i.fd=d,i.emit("open",d),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);xC.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 kC=x((JK,FC)=>{"use strict";FC.exports=w8;var b8=Object.getPrototypeOf||function(t){return t.__proto__};function w8(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:b8(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Rn=x((XK,cm)=>{var We=require("fs"),v8=SC(),C8=OC(),E8=kC(),Jc=require("util"),yt,Zc;typeof Symbol=="function"&&typeof Symbol.for=="function"?(yt=Symbol.for("graceful-fs.queue"),Zc=Symbol.for("graceful-fs.previous")):(yt="___graceful-fs.queue",Zc="___graceful-fs.previous");function _8(){}function IC(t,e){Object.defineProperty(t,yt,{get:function(){return e}})}var Co=_8;Jc.debuglog?Co=Jc.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Co=function(){var t=Jc.format.apply(Jc,arguments);t="GFS4: "+t.split(/\n/).join(`
47
+ GFS4: `),console.error(t)});We[yt]||(PC=global[yt]||[],IC(We,PC),We.close=(function(t){function e(r,n){return t.call(We,r,function(o){o||$C(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Zc,{value:t}),e})(We.close),We.closeSync=(function(t){function e(r){t.apply(We,arguments),$C()}return Object.defineProperty(e,Zc,{value:t}),e})(We.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Co(We[yt]),require("assert").equal(We[yt].length,0)}));var PC;global[yt]||IC(global,We[yt]);cm.exports=sm(E8(We));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!We.__patched&&(cm.exports=sm(We),We.__patched=!0);function sm(t){v8(t),t.gracefulify=sm,t.createReadStream=S,t.createWriteStream=P;var e=t.readFile;t.readFile=r;function r(F,L,A){return typeof L=="function"&&(A=L,L=null),q(F,L,A);function q(j,Z,k,b){return e(j,Z,function(w){w&&(w.code==="EMFILE"||w.code==="ENFILE")?ki([q,[j,Z,k],w,b||Date.now(),Date.now()]):typeof k=="function"&&k.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=o;function o(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,k,b,w,C){return n(Z,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?ki([j,[Z,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var i=t.appendFile;i&&(t.appendFile=a);function a(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,k,b,w,C){return i(Z,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?ki([j,[Z,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var s=t.copyFile;s&&(t.copyFile=u);function u(F,L,A,q){return typeof A=="function"&&(q=A,A=0),j(F,L,A,q);function j(Z,k,b,w,C){return s(Z,k,b,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?ki([j,[Z,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}var c=t.readdir;t.readdir=d;var f=/^v[0-5]\./;function d(F,L,A){typeof L=="function"&&(A=L,L=null);var q=f.test(process.version)?function(k,b,w,C){return c(k,j(k,b,w,C))}:function(k,b,w,C){return c(k,b,j(k,b,w,C))};return q(F,L,A);function j(Z,k,b,w){return function(C,O){C&&(C.code==="EMFILE"||C.code==="ENFILE")?ki([q,[Z,k,b],C,w||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof b=="function"&&b.call(this,C,O))}}}if(process.version.substr(0,4)==="v0.8"){var h=C8(t);v=h.ReadStream,y=h.WriteStream}var p=t.ReadStream;p&&(v.prototype=Object.create(p.prototype),v.prototype.open=_);var m=t.WriteStream;m&&(y.prototype=Object.create(m.prototype),y.prototype.open=E),Object.defineProperty(t,"ReadStream",{get:function(){return v},set:function(F){v=F},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return y},set:function(F){y=F},enumerable:!0,configurable:!0});var g=v;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(F){g=F},enumerable:!0,configurable:!0});var D=y;Object.defineProperty(t,"FileWriteStream",{get:function(){return D},set:function(F){D=F},enumerable:!0,configurable:!0});function v(F,L){return this instanceof v?(p.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function _(){var F=this;B(F.path,F.flags,F.mode,function(L,A){L?(F.autoClose&&F.destroy(),F.emit("error",L)):(F.fd=A,F.emit("open",A),F.read())})}function y(F,L){return this instanceof y?(m.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function E(){var F=this;B(F.path,F.flags,F.mode,function(L,A){L?(F.destroy(),F.emit("error",L)):(F.fd=A,F.emit("open",A))})}function S(F,L){return new t.ReadStream(F,L)}function P(F,L){return new t.WriteStream(F,L)}var T=t.open;t.open=B;function B(F,L,A,q){return typeof A=="function"&&(q=A,A=null),j(F,L,A,q);function j(Z,k,b,w,C){return T(Z,k,b,function(O,R){O&&(O.code==="EMFILE"||O.code==="ENFILE")?ki([j,[Z,k,b,w],O,C||Date.now(),Date.now()]):typeof w=="function"&&w.apply(this,arguments)})}}return t}function ki(t){Co("ENQUEUE",t[0].name,t[1]),We[yt].push(t),um()}var Xc;function $C(){for(var t=Date.now(),e=0;e<We[yt].length;++e)We[yt][e].length>2&&(We[yt][e][3]=t,We[yt][e][4]=t);um()}function um(){if(clearTimeout(Xc),Xc=void 0,We[yt].length!==0){var t=We[yt].shift(),e=t[0],r=t[1],n=t[2],o=t[3],i=t[4];if(o===void 0)Co("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-o>=6e4){Co("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?(Co("RETRY",e.name,r),e.apply(null,r.concat([o]))):We[yt].push(t)}Xc===void 0&&(Xc=setTimeout(um,0))}}});var RC=x((ZK,TC)=>{function Dr(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))}TC.exports=Dr;Dr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Dr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Dr.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};Dr.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)};Dr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Dr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Dr.prototype.start=Dr.prototype.try;Dr.prototype.errors=function(){return this._errors};Dr.prototype.attempts=function(){return this._attempts};Dr.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 BC=x(Eo=>{var S8=RC();Eo.operation=function(t){var e=Eo.timeouts(t);return new S8(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Eo.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};Eo.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};Eo.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=Eo.operation(e),f=Array.prototype.slice.call(arguments,1),d=f.pop();f.push(function(h){c.retry(h)||(h&&(arguments[0]=c.mainError()),d.apply(this,arguments))}),c.attempt(function(){u.apply(t,f)})}.bind(t,a),t[i].options=e}}});var LC=x((eG,NC)=>{NC.exports=BC()});var jC=x((tG,Qc)=>{Qc.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Qc.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Qc.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var dm=x((rG,Ii)=>{var Me=global.process,_o=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"};_o(Me)?(UC=require("assert"),Pi=jC(),MC=/^win/i.test(Me.platform),ds=require("events"),typeof ds!="function"&&(ds=ds.EventEmitter),Me.__signal_exit_emitter__?st=Me.__signal_exit_emitter__:(st=Me.__signal_exit_emitter__=new ds,st.count=0,st.emitted={}),st.infinite||(st.setMaxListeners(1/0),st.infinite=!0),Ii.exports=function(t,e){if(!_o(global.process))return function(){};UC.equal(typeof t,"function","a callback must be provided for exit handler"),$i===!1&&lm();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){st.removeListener(r,t),st.listeners("exit").length===0&&st.listeners("afterexit").length===0&&el()};return st.on(r,t),n},el=function(){!$i||!_o(global.process)||($i=!1,Pi.forEach(function(e){try{Me.removeListener(e,tl[e])}catch{}}),Me.emit=rl,Me.reallyExit=fm,st.count-=1)},Ii.exports.unload=el,So=function(e,r,n){st.emitted[e]||(st.emitted[e]=!0,st.emit(e,r,n))},tl={},Pi.forEach(function(t){tl[t]=function(){if(_o(global.process)){var r=Me.listeners(t);r.length===st.count&&(el(),So("exit",null,t),So("afterexit",null,t),MC&&t==="SIGHUP"&&(t="SIGINT"),Me.kill(Me.pid,t))}}}),Ii.exports.signals=function(){return Pi},$i=!1,lm=function(){$i||!_o(global.process)||($i=!0,st.count+=1,Pi=Pi.filter(function(e){try{return Me.on(e,tl[e]),!0}catch{return!1}}),Me.emit=HC,Me.reallyExit=qC)},Ii.exports.load=lm,fm=Me.reallyExit,qC=function(e){_o(global.process)&&(Me.exitCode=e||0,So("exit",Me.exitCode,null),So("afterexit",Me.exitCode,null),fm.call(Me,Me.exitCode))},rl=Me.emit,HC=function(e,r){if(e==="exit"&&_o(global.process)){r!==void 0&&(Me.exitCode=r);var n=rl.apply(this,arguments);return So("exit",Me.exitCode,null),So("afterexit",Me.exitCode,null),n}else return rl.apply(this,arguments)}):Ii.exports=function(){return function(){}};var UC,Pi,MC,ds,st,el,So,tl,$i,lm,fm,qC,rl,HC});var zC=x((nG,pm)=>{"use strict";var VC=Symbol();function x8(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 A8(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}pm.exports.probe=x8;pm.exports.getMtime=A8});var JC=x((oG,hs)=>{"use strict";var O8=require("path"),gm=Rn(),F8=LC(),k8=dm(),KC=zC(),un={};function ps(t,e){return e.lockfilePath||`${t}.lock`}function ym(t,e,r){if(!e.realpath)return r(null,O8.resolve(t));e.fs.realpath(t,r)}function mm(t,e,r){let n=ps(t,e);e.fs.mkdir(n,o=>{if(!o)return KC.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"?mm(t,{...e,stale:0},r):r(i);if(!GC(a,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));WC(t,e,s=>{if(s)return r(s);mm(t,{...e,stale:0},r)})})})}function GC(t,e){return t.mtime.getTime()<Date.now()-e.stale}function WC(t,e,r){e.fs.rmdir(ps(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function nl(t,e){let r=un[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?hm(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,nl(t,e));if(!(r.mtime.getTime()===o.mtime.getTime()))return hm(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let s=KC.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?hm(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,nl(t,e));r.mtime=s,r.lastUpdate=Date.now(),r.updateDelay=null,nl(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function hm(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),un[t]===e&&delete un[t],e.options.onCompromised(r)}function P8(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:gm,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),ym(t,e,(n,o)=>{if(n)return r(n);let i=F8.operation(e.retries);i.attempt(()=>{mm(o,e,(a,s,u)=>{if(i.retry(a))return;if(a)return r(i.mainError());let c=un[o]={lockfilePath:ps(o,e),mtime:s,mtimePrecision:u,options:e,lastUpdate:Date.now()};nl(o,e),r(null,f=>{if(c.released)return f&&f(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));YC(o,{...e,realpath:!1},f)})})})})}function YC(t,e,r){e={fs:gm,realpath:!0,...e},ym(t,e,(n,o)=>{if(n)return r(n);let i=un[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 un[o],WC(o,e,r)})}function $8(t,e,r){e={stale:1e4,realpath:!0,fs:gm,...e},e.stale=Math.max(e.stale||0,2e3),ym(t,e,(n,o)=>{if(n)return r(n);e.fs.stat(ps(o,e),(i,a)=>i?i.code==="ENOENT"?r(null,!1):r(i):r(null,!GC(a,e)))})}function I8(){return un}k8(()=>{for(let t in un){let e=un[t].options;try{e.fs.rmdirSync(ps(t,e))}catch{}}});hs.exports.lock=P8;hs.exports.unlock=YC;hs.exports.check=$8;hs.exports.getLocks=I8});var ZC=x((iG,XC)=>{"use strict";var T8=Rn();function R8(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 B8(t){return(...e)=>new Promise((r,n)=>{e.push((o,i)=>{o?n(o):r(i)}),t(...e)})}function N8(t){return(...e)=>{let r,n;if(e.push((o,i)=>{r=o,n=i}),t(...e),r)throw r;return n}}function L8(t){if(t={...t},t.fs=R8(t.fs||T8),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}XC.exports={toPromise:B8,toSync:N8,toSyncOptions:L8}});var eE=x((aG,Bn)=>{"use strict";var Ti=JC(),{toPromise:ol,toSync:il,toSyncOptions:Dm}=ZC();async function QC(t,e){let r=await ol(Ti.lock)(t,e);return ol(r)}function j8(t,e){let r=il(Ti.lock)(t,Dm(e));return il(r)}function U8(t,e){return ol(Ti.unlock)(t,e)}function M8(t,e){return il(Ti.unlock)(t,Dm(e))}function q8(t,e){return ol(Ti.check)(t,e)}function H8(t,e){return il(Ti.check)(t,Dm(e))}Bn.exports=QC;Bn.exports.lock=QC;Bn.exports.unlock=U8;Bn.exports.lockSync=j8;Bn.exports.unlockSync=M8;Bn.exports.check=q8;Bn.exports.checkSync=H8});var iE=x(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.canStoreURLs=Ri.FileUrlStorage=void 0;var tE=require("fs"),V8=K8(EC()),rE=z8(eE());function oE(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(oE=function(n){return n?r:e})(t)}function z8(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=oE(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 K8(t){return t&&t.__esModule?t:{default:t}}function ms(t){"@babel/helpers - typeof";return ms=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},ms(t)}function G8(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nE(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,Y8(n.key),n)}}function W8(t,e,r){return e&&nE(t.prototype,e),r&&nE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Y8(t){var e=J8(t,"string");return ms(e)=="symbol"?e:e+""}function J8(t,e){if(ms(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ms(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var sG=Ri.canStoreURLs=!0,uG=Ri.FileUrlStorage=(function(){function t(e){G8(this,t),this.path=e}return W8(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;rE.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;rE.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,V8.default)([o,i]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var o={encoding:"utf8",mode:432,flag:"w"};(0,tE.writeFile)(this.path,JSON.stringify(r),o,function(i){return n(i)})}},{key:"_getData",value:function(r){(0,tE.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 sl=x(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Object.defineProperty(Wt,"DefaultHttpStack",{enumerable:!0,get:function(){return cE.default}});Object.defineProperty(Wt,"DetailedError",{enumerable:!0,get:function(){return X8.default}});Object.defineProperty(Wt,"FileUrlStorage",{enumerable:!0,get:function(){return lE.FileUrlStorage}});Object.defineProperty(Wt,"StreamSource",{enumerable:!0,get:function(){return rN.default}});Wt.Upload=void 0;Object.defineProperty(Wt,"canStoreURLs",{enumerable:!0,get:function(){return lE.canStoreURLs}});Wt.defaultOptions=void 0;Object.defineProperty(Wt,"enableDebugLog",{enumerable:!0,get:function(){return Z8.enableDebugLog}});Wt.isSupported=void 0;var X8=xo(hh()),Z8=mh(),Q8=xo(iw()),bm=xo(Rw()),eN=xo(Ww()),tN=xo(Zw()),cE=xo(dv()),rN=xo(Fh()),lE=iE();function xo(t){return t&&t.__esModule?t:{default:t}}function Ni(t){"@babel/helpers - typeof";return Ni=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},Ni(t)}function nN(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aE(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,dE(n.key),n)}}function oN(t,e,r){return e&&aE(t.prototype,e),r&&aE(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function iN(t,e,r){return e=al(e),aN(t,fE()?Reflect.construct(e,r||[],al(t).constructor):e.apply(t,r))}function aN(t,e){if(e&&(Ni(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return sN(t)}function sN(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(fE=function(){return!!t})()}function al(t){return al=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},al(t)}function uN(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&&wm(t,e)}function wm(t,e){return wm=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},wm(t,e)}function sE(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 Bi(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sE(Object(r),!0).forEach(function(n){cN(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sE(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function cN(t,e,r){return e=dE(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dE(t){var e=lN(t,"string");return Ni(e)=="symbol"?e:e+""}function lN(t,e){if(Ni(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ni(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uE=Wt.defaultOptions=Bi(Bi({},bm.default.defaultOptions),{},{httpStack:new cE.default,fileReader:new eN.default,urlStorage:new Q8.default,fingerprint:tN.default}),lG=Wt.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 nN(this,e),n=Bi(Bi({},uE),n),iN(this,e,[r,n])}return uN(e,t),oN(e,null,[{key:"terminate",value:function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=Bi(Bi({},uE),o),bm.default.terminate(n,o)}}])})(bm.default),fG=Wt.isSupported=!0});var yE=x((AG,gE)=>{var Li=1e3,ji=Li*60,Ui=ji*60,Ao=Ui*24,bN=Ao*7,wN=Ao*365.25;gE.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return vN(t);if(r==="number"&&isFinite(t))return e.long?EN(t):CN(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function vN(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*wN;case"weeks":case"week":case"w":return r*bN;case"days":case"day":case"d":return r*Ao;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Ui;case"minutes":case"minute":case"mins":case"min":case"m":return r*ji;case"seconds":case"second":case"secs":case"sec":case"s":return r*Li;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function CN(t){var e=Math.abs(t);return e>=Ao?Math.round(t/Ao)+"d":e>=Ui?Math.round(t/Ui)+"h":e>=ji?Math.round(t/ji)+"m":e>=Li?Math.round(t/Li)+"s":t+"ms"}function EN(t){var e=Math.abs(t);return e>=Ao?cl(t,e,Ao,"day"):e>=Ui?cl(t,e,Ui,"hour"):e>=ji?cl(t,e,ji,"minute"):e>=Li?cl(t,e,Li,"second"):t+" ms"}function cl(t,e,r,n){var o=e>=r*1.5;return Math.round(t/r)+" "+n+(o?"s":"")}});var Em=x((OG,DE)=>{function _N(t){r.debug=r,r.default=r,r.coerce=u,r.disable=a,r.enable=o,r.enabled=s,r.humanize=yE(),r.destroy=c,Object.keys(t).forEach(f=>{r[f]=t[f]}),r.names=[],r.skips=[],r.formatters={};function e(f){let d=0;for(let h=0;h<f.length;h++)d=(d<<5)-d+f.charCodeAt(h),d|=0;return r.colors[Math.abs(d)%r.colors.length]}r.selectColor=e;function r(f){let d,h=null,p,m;function g(...D){if(!g.enabled)return;let v=g,_=Number(new Date),y=_-(d||_);v.diff=y,v.prev=d,v.curr=_,d=_,D[0]=r.coerce(D[0]),typeof D[0]!="string"&&D.unshift("%O");let E=0;D[0]=D[0].replace(/%([a-zA-Z%])/g,(P,T)=>{if(P==="%%")return"%";E++;let B=r.formatters[T];if(typeof B=="function"){let F=D[E];P=B.call(v,F),D.splice(E,1),E--}return P}),r.formatArgs.call(v,D),(v.log||r.log).apply(v,D)}return g.namespace=f,g.useColors=r.useColors(),g.color=r.selectColor(f),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(p!==r.namespaces&&(p=r.namespaces,m=r.enabled(f)),m),set:D=>{h=D}}),typeof r.init=="function"&&r.init(g),g}function n(f,d){let h=r(this.namespace+(typeof d>"u"?":":d)+f);return h.log=this.log,h}function o(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];let d=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let h of d)h[0]==="-"?r.skips.push(h.slice(1)):r.names.push(h)}function i(f,d){let h=0,p=0,m=-1,g=0;for(;h<f.length;)if(p<d.length&&(d[p]===f[h]||d[p]==="*"))d[p]==="*"?(m=p,g=h,p++):(h++,p++);else if(m!==-1)p=m+1,g++,h=g;else return!1;for(;p<d.length&&d[p]==="*";)p++;return p===d.length}function a(){let f=[...r.names,...r.skips.map(d=>"-"+d)].join(",");return r.enable(""),f}function s(f){for(let d of r.skips)if(i(f,d))return!1;for(let d of r.names)if(i(f,d))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}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}DE.exports=_N});var bE=x((Yt,ll)=>{Yt.formatArgs=xN;Yt.save=AN;Yt.load=ON;Yt.useColors=SN;Yt.storage=FN();Yt.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`."))}})();Yt.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 SN(){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 xN(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+ll.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)}Yt.log=console.debug||console.log||(()=>{});function AN(t){try{t?Yt.storage.setItem("debug",t):Yt.storage.removeItem("debug")}catch{}}function ON(){let t;try{t=Yt.storage.getItem("debug")||Yt.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function FN(){try{return localStorage}catch{}}ll.exports=Em()(Yt);var{formatters:kN}=ll.exports;kN.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var vE=x((FG,wE)=>{"use strict";wE.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 _E=x((kG,EE)=>{"use strict";var PN=require("os"),CE=require("tty"),wr=vE(),{env:ut}=process,Nn;wr("no-color")||wr("no-colors")||wr("color=false")||wr("color=never")?Nn=0:(wr("color")||wr("colors")||wr("color=true")||wr("color=always"))&&(Nn=1);"FORCE_COLOR"in ut&&(ut.FORCE_COLOR==="true"?Nn=1:ut.FORCE_COLOR==="false"?Nn=0:Nn=ut.FORCE_COLOR.length===0?1:Math.min(parseInt(ut.FORCE_COLOR,10),3));function _m(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Sm(t,e){if(Nn===0)return 0;if(wr("color=16m")||wr("color=full")||wr("color=truecolor"))return 3;if(wr("color=256"))return 2;if(t&&!e&&Nn===void 0)return 0;let r=Nn||0;if(ut.TERM==="dumb")return r;if(process.platform==="win32"){let n=PN.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in ut)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in ut)||ut.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in ut)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ut.TEAMCITY_VERSION)?1:0;if(ut.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ut){let n=parseInt((ut.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ut.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ut.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ut.TERM)||"COLORTERM"in ut?1:r}function $N(t){let e=Sm(t,t&&t.isTTY);return _m(e)}EE.exports={supportsColor:$N,stdout:_m(Sm(!0,CE.isatty(1))),stderr:_m(Sm(!0,CE.isatty(2)))}});var xE=x((ct,dl)=>{var IN=require("tty"),fl=require("util");ct.init=UN;ct.log=NN;ct.formatArgs=RN;ct.save=LN;ct.load=jN;ct.useColors=TN;ct.destroy=fl.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ct.colors=[6,2,3,4,5,1];try{let t=_E();t&&(t.stderr||t).level>=2&&(ct.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{}ct.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 TN(){return"colors"in ct.inspectOpts?!!ct.inspectOpts.colors:IN.isatty(process.stderr.fd)}function RN(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${e} \x1B[0m`;t[0]=i+t[0].split(`
48
48
  `).join(`
49
- `+i),t.push(o+"m+"+fl.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=$N()+e+" "+t[0]}function $N(){return lt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function IN(...t){return process.stderr.write(ll.formatWithOptions(lt.inspectOpts,...t)+`
50
- `)}function TN(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function RN(){return process.env.DEBUG}function BN(t){t.inspectOpts={};let e=Object.keys(lt.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=lt.inspectOpts[e[r]]}fl.exports=Cm()(lt);var{formatters:_E}=fl.exports;_E.o=function(t){return this.inspectOpts.colors=this.useColors,ll.inspect(t,this.inspectOpts).split(`
51
- `).map(e=>e.trim()).join(" ")};_E.O=function(t){return this.inspectOpts.colors=this.useColors,ll.inspect(t,this.inspectOpts)}});var xm=x((SG,Sm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Sm.exports=DE():Sm.exports=SE()});var ft=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 Bt=x(ln=>{"use strict";var xE=ft().fromCallback,Rt=Rn(),NN=["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 Rt[t]=="function");Object.assign(ln,Rt);NN.forEach(t=>{ln[t]=xE(Rt[t])});ln.exists=function(t,e){return typeof e=="function"?Rt.exists(t,e):new Promise(r=>Rt.exists(t,r))};ln.read=function(t,e,r,n,o,i){return typeof i=="function"?Rt.read(t,e,r,n,o,i):new Promise((a,s)=>{Rt.read(t,e,r,n,o,(u,c,f)=>{if(u)return s(u);a({bytesRead:c,buffer:f})})})};ln.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.write(t,e,...r):new Promise((n,o)=>{Rt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};ln.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.readv(t,e,...r):new Promise((n,o)=>{Rt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};ln.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.writev(t,e,...r):new Promise((n,o)=>{Rt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Rt.realpath.native=="function"?ln.realpath.native=xE(Rt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var OE=x((OG,AE)=>{"use strict";var LN=require("path");AE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(LN.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var $E=x((FG,Om)=>{"use strict";var FE=Bt(),{checkPath:PE}=OE(),kE=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Om.exports.makeDir=async(t,e)=>(PE(t),FE.mkdir(t,{mode:kE(e),recursive:!0}));Om.exports.makeDirSync=(t,e)=>(PE(t),FE.mkdirSync(t,{mode:kE(e),recursive:!0}))});var kr=x((PG,IE)=>{"use strict";var jN=ft().fromPromise,{makeDir:UN,makeDirSync:Fm}=$E(),Pm=jN(UN);IE.exports={mkdirs:Pm,mkdirsSync:Fm,mkdirp:Pm,mkdirpSync:Fm,ensureDir:Pm,ensureDirSync:Fm}});var Ln=x((kG,RE)=>{"use strict";var MN=ft().fromPromise,TE=Bt();function qN(t){return TE.access(t).then(()=>!0).catch(()=>!1)}RE.exports={pathExists:MN(qN),pathExistsSync:TE.existsSync}});var km=x(($G,BE)=>{"use strict";var Ui=Bt(),HN=ft().fromPromise;async function VN(t,e,r){let n=await Ui.open(t,"r+"),o=null;try{await Ui.futimes(n,e,r)}finally{try{await Ui.close(n)}catch(i){o=i}}if(o)throw o}function zN(t,e,r){let n=Ui.openSync(t,"r+");return Ui.futimesSync(n,e,r),Ui.closeSync(n)}BE.exports={utimesMillis:HN(VN),utimesMillisSync:zN}});var Ao=x((IG,UE)=>{"use strict";var Mi=Bt(),dt=require("path"),NE=ft().fromPromise;function KN(t,e,r){let n=r.dereference?o=>Mi.stat(o,{bigint:!0}):o=>Mi.lstat(o,{bigint:!0});return Promise.all([n(t),n(e).catch(o=>{if(o.code==="ENOENT")return null;throw o})]).then(([o,i])=>({srcStat:o,destStat:i}))}function GN(t,e,r){let n,o=r.dereference?a=>Mi.statSync(a,{bigint:!0}):a=>Mi.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 WN(t,e,r,n){let{srcStat:o,destStat:i}=await KN(t,e,n);if(i){if(ms(o,i)){let a=dt.basename(t),s=dt.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()&&$m(t,e))throw new Error(dl(t,e,r));return{srcStat:o,destStat:i}}function YN(t,e,r,n){let{srcStat:o,destStat:i}=GN(t,e,n);if(i){if(ms(o,i)){let a=dt.basename(t),s=dt.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()&&$m(t,e))throw new Error(dl(t,e,r));return{srcStat:o,destStat:i}}async function LE(t,e,r,n){let o=dt.resolve(dt.dirname(t)),i=dt.resolve(dt.dirname(r));if(i===o||i===dt.parse(i).root)return;let a;try{a=await Mi.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ms(e,a))throw new Error(dl(t,r,n));return LE(t,e,i,n)}function jE(t,e,r,n){let o=dt.resolve(dt.dirname(t)),i=dt.resolve(dt.dirname(r));if(i===o||i===dt.parse(i).root)return;let a;try{a=Mi.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(ms(e,a))throw new Error(dl(t,r,n));return jE(t,e,i,n)}function ms(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function $m(t,e){let r=dt.resolve(t).split(dt.sep).filter(o=>o),n=dt.resolve(e).split(dt.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function dl(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}UE.exports={checkPaths:NE(WN),checkPathsSync:YN,checkParentPaths:NE(LE),checkParentPathsSync:jE,isSrcSubdir:$m,areIdentical:ms}});var qE=x((TG,ME)=>{"use strict";async function JN(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})))}ME.exports={asyncIteratorConcurrentProcess:JN}});var GE=x((RG,KE)=>{"use strict";var _t=Bt(),gs=require("path"),{mkdirs:XN}=kr(),{pathExists:ZN}=Ln(),{utimesMillis:QN}=km(),ys=Ao(),{asyncIteratorConcurrentProcess:eL}=qE();async function tL(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
49
+ `+i),t.push(o+"m+"+dl.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=BN()+e+" "+t[0]}function BN(){return ct.inspectOpts.hideDate?"":new Date().toISOString()+" "}function NN(...t){return process.stderr.write(fl.formatWithOptions(ct.inspectOpts,...t)+`
50
+ `)}function LN(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function jN(){return process.env.DEBUG}function UN(t){t.inspectOpts={};let e=Object.keys(ct.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=ct.inspectOpts[e[r]]}dl.exports=Em()(ct);var{formatters:SE}=dl.exports;SE.o=function(t){return this.inspectOpts.colors=this.useColors,fl.inspect(t,this.inspectOpts).split(`
51
+ `).map(e=>e.trim()).join(" ")};SE.O=function(t){return this.inspectOpts.colors=this.useColors,fl.inspect(t,this.inspectOpts)}});var Am=x((PG,xm)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?xm.exports=bE():xm.exports=xE()});var lt=x(Om=>{"use strict";Om.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})};Om.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 Bt=x(ln=>{"use strict";var AE=lt().fromCallback,Rt=Rn(),MN=["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 Rt[t]=="function");Object.assign(ln,Rt);MN.forEach(t=>{ln[t]=AE(Rt[t])});ln.exists=function(t,e){return typeof e=="function"?Rt.exists(t,e):new Promise(r=>Rt.exists(t,r))};ln.read=function(t,e,r,n,o,i){return typeof i=="function"?Rt.read(t,e,r,n,o,i):new Promise((a,s)=>{Rt.read(t,e,r,n,o,(u,c,f)=>{if(u)return s(u);a({bytesRead:c,buffer:f})})})};ln.write=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.write(t,e,...r):new Promise((n,o)=>{Rt.write(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffer:s})})})};ln.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.readv(t,e,...r):new Promise((n,o)=>{Rt.readv(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesRead:a,buffers:s})})})};ln.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?Rt.writev(t,e,...r):new Promise((n,o)=>{Rt.writev(t,e,...r,(i,a,s)=>{if(i)return o(i);n({bytesWritten:a,buffers:s})})})};typeof Rt.realpath.native=="function"?ln.realpath.native=AE(Rt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var FE=x((TG,OE)=>{"use strict";var qN=require("path");OE.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(qN.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var IE=x((RG,Fm)=>{"use strict";var kE=Bt(),{checkPath:PE}=FE(),$E=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};Fm.exports.makeDir=async(t,e)=>(PE(t),kE.mkdir(t,{mode:$E(e),recursive:!0}));Fm.exports.makeDirSync=(t,e)=>(PE(t),kE.mkdirSync(t,{mode:$E(e),recursive:!0}))});var Pr=x((BG,TE)=>{"use strict";var HN=lt().fromPromise,{makeDir:VN,makeDirSync:km}=IE(),Pm=HN(VN);TE.exports={mkdirs:Pm,mkdirsSync:km,mkdirp:Pm,mkdirpSync:km,ensureDir:Pm,ensureDirSync:km}});var Ln=x((NG,BE)=>{"use strict";var zN=lt().fromPromise,RE=Bt();function KN(t){return RE.access(t).then(()=>!0).catch(()=>!1)}BE.exports={pathExists:zN(KN),pathExistsSync:RE.existsSync}});var $m=x((LG,NE)=>{"use strict";var Mi=Bt(),GN=lt().fromPromise;async function WN(t,e,r){let n=await Mi.open(t,"r+"),o=null;try{await Mi.futimes(n,e,r)}finally{try{await Mi.close(n)}catch(i){o=i}}if(o)throw o}function YN(t,e,r){let n=Mi.openSync(t,"r+");return Mi.futimesSync(n,e,r),Mi.closeSync(n)}NE.exports={utimesMillis:GN(WN),utimesMillisSync:YN}});var Oo=x((jG,ME)=>{"use strict";var qi=Bt(),ft=require("path"),LE=lt().fromPromise;function JN(t,e,r){let n=r.dereference?o=>qi.stat(o,{bigint:!0}):o=>qi.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 XN(t,e,r){let n,o=r.dereference?a=>qi.statSync(a,{bigint:!0}):a=>qi.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 ZN(t,e,r,n){let{srcStat:o,destStat:i}=await JN(t,e,n);if(i){if(gs(o,i)){let a=ft.basename(t),s=ft.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()&&Im(t,e))throw new Error(pl(t,e,r));return{srcStat:o,destStat:i}}function QN(t,e,r,n){let{srcStat:o,destStat:i}=XN(t,e,n);if(i){if(gs(o,i)){let a=ft.basename(t),s=ft.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()&&Im(t,e))throw new Error(pl(t,e,r));return{srcStat:o,destStat:i}}async function jE(t,e,r,n){let o=ft.resolve(ft.dirname(t)),i=ft.resolve(ft.dirname(r));if(i===o||i===ft.parse(i).root)return;let a;try{a=await qi.stat(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(gs(e,a))throw new Error(pl(t,r,n));return jE(t,e,i,n)}function UE(t,e,r,n){let o=ft.resolve(ft.dirname(t)),i=ft.resolve(ft.dirname(r));if(i===o||i===ft.parse(i).root)return;let a;try{a=qi.statSync(i,{bigint:!0})}catch(s){if(s.code==="ENOENT")return;throw s}if(gs(e,a))throw new Error(pl(t,r,n));return UE(t,e,i,n)}function gs(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function Im(t,e){let r=ft.resolve(t).split(ft.sep).filter(o=>o),n=ft.resolve(e).split(ft.sep).filter(o=>o);return r.every((o,i)=>n[i]===o)}function pl(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}ME.exports={checkPaths:LE(ZN),checkPathsSync:QN,checkParentPaths:LE(jE),checkParentPathsSync:UE,isSrcSubdir:Im,areIdentical:gs}});var HE=x((UG,qE)=>{"use strict";async function eL(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})))}qE.exports={asyncIteratorConcurrentProcess:eL}});var WE=x((MG,GE)=>{"use strict";var _t=Bt(),ys=require("path"),{mkdirs:tL}=Pr(),{pathExists:rL}=Ln(),{utimesMillis:nL}=$m(),Ds=Oo(),{asyncIteratorConcurrentProcess:oL}=HE();async function iL(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
52
52
 
53
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await ys.checkPaths(t,e,"copy",r);if(await ys.checkParentPaths(t,n,e,"copy"),!await VE(t,e,r))return;let a=gs.dirname(e);await ZN(a)||await XN(a),await zE(o,t,e,r)}async function VE(t,e,r){return r.filter?r.filter(t,e):!0}async function zE(t,e,r,n){let i=await(n.dereference?_t.stat:_t.lstat)(e);if(i.isDirectory())return iL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return rL(i,t,e,r,n);if(i.isSymbolicLink())return aL(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 rL(t,e,r,n,o){if(!e)return HE(t,r,n,o);if(o.overwrite)return await _t.unlink(n),HE(t,r,n,o);if(o.errorOnExist)throw new Error(`'${n}' already exists`)}async function HE(t,e,r,n){if(await _t.copyFile(e,r),n.preserveTimestamps){nL(t.mode)&&await oL(r,t.mode);let o=await _t.stat(e);await QN(r,o.atime,o.mtime)}return _t.chmod(r,t.mode)}function nL(t){return(t&128)===0}function oL(t,e){return _t.chmod(t,e|128)}async function iL(t,e,r,n,o){e||await _t.mkdir(n),await eL(await _t.opendir(r),async i=>{let a=gs.join(r,i.name),s=gs.join(n,i.name);if(await VE(a,s,o)){let{destStat:c}=await ys.checkPaths(a,s,"copy",o);await zE(c,a,s,o)}}),e||await _t.chmod(n,t.mode)}async function aL(t,e,r,n){let o=await _t.readlink(e);if(n.dereference&&(o=gs.resolve(process.cwd(),o)),!t)return _t.symlink(o,r);let i=null;try{i=await _t.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return _t.symlink(o,r);throw a}if(n.dereference&&(i=gs.resolve(process.cwd(),i)),ys.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ys.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return await _t.unlink(r),_t.symlink(o,r)}KE.exports=tL});var ZE=x((BG,XE)=>{"use strict";var Nt=Rn(),Ds=require("path"),sL=kr().mkdirsSync,uL=km().utimesMillisSync,bs=Ao();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;
53
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:o}=await Ds.checkPaths(t,e,"copy",r);if(await Ds.checkParentPaths(t,n,e,"copy"),!await zE(t,e,r))return;let a=ys.dirname(e);await rL(a)||await tL(a),await KE(o,t,e,r)}async function zE(t,e,r){return r.filter?r.filter(t,e):!0}async function KE(t,e,r,n){let i=await(n.dereference?_t.stat:_t.lstat)(e);if(i.isDirectory())return cL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return aL(i,t,e,r,n);if(i.isSymbolicLink())return lL(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 aL(t,e,r,n,o){if(!e)return VE(t,r,n,o);if(o.overwrite)return await _t.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 _t.copyFile(e,r),n.preserveTimestamps){sL(t.mode)&&await uL(r,t.mode);let o=await _t.stat(e);await nL(r,o.atime,o.mtime)}return _t.chmod(r,t.mode)}function sL(t){return(t&128)===0}function uL(t,e){return _t.chmod(t,e|128)}async function cL(t,e,r,n,o){e||await _t.mkdir(n),await oL(await _t.opendir(r),async i=>{let a=ys.join(r,i.name),s=ys.join(n,i.name);if(await zE(a,s,o)){let{destStat:c}=await Ds.checkPaths(a,s,"copy",o);await KE(c,a,s,o)}}),e||await _t.chmod(n,t.mode)}async function lL(t,e,r,n){let o=await _t.readlink(e);if(n.dereference&&(o=ys.resolve(process.cwd(),o)),!t)return _t.symlink(o,r);let i=null;try{i=await _t.readlink(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return _t.symlink(o,r);throw a}if(n.dereference&&(i=ys.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 await _t.unlink(r),_t.symlink(o,r)}GE.exports=iL});var QE=x((qG,ZE)=>{"use strict";var Nt=Rn(),bs=require("path"),fL=Pr().mkdirsSync,dL=$m().utimesMillisSync,ws=Oo();function pL(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
54
54
 
55
- see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=bs.checkPathsSync(t,e,"copy",r);if(bs.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=Ds.dirname(e);return Nt.existsSync(i)||sL(i),WE(o,t,e,r)}function WE(t,e,r,n){let i=(n.dereference?Nt.statSync:Nt.lstatSync)(e);if(i.isDirectory())return gL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return lL(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}`)}function lL(t,e,r,n,o){return e?fL(t,r,n,o):YE(t,r,n,o)}function fL(t,e,r,n){if(n.overwrite)return Nt.unlinkSync(r),YE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function YE(t,e,r,n){return Nt.copyFileSync(e,r),n.preserveTimestamps&&dL(t.mode,e,r),Im(r,t.mode)}function dL(t,e,r){return pL(t)&&hL(r,t),mL(e,r)}function pL(t){return(t&128)===0}function hL(t,e){return Im(t,e|128)}function Im(t,e){return Nt.chmodSync(t,e)}function mL(t,e){let r=Nt.statSync(t);return uL(e,r.atime,r.mtime)}function gL(t,e,r,n,o){return e?JE(r,n,o):yL(t.mode,r,n,o)}function yL(t,e,r,n){return Nt.mkdirSync(r),JE(e,r,n),Im(r,t)}function JE(t,e,r){let n=Nt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)DL(o.name,t,e,r)}finally{n.closeSync()}}function DL(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}=bs.checkPathsSync(o,i,"copy",n);return WE(a,o,i,n)}function bL(t,e,r,n){let o=Nt.readlinkSync(e);if(n.dereference&&(o=Ds.resolve(process.cwd(),o)),t){let i;try{i=Nt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Nt.symlinkSync(o,r);throw a}if(n.dereference&&(i=Ds.resolve(process.cwd(),i)),bs.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(bs.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return wL(o,r)}else return Nt.symlinkSync(o,r)}function wL(t,e){return Nt.unlinkSync(e),Nt.symlinkSync(t,e)}XE.exports=cL});var pl=x((NG,QE)=>{"use strict";var vL=ft().fromPromise;QE.exports={copy:vL(GE()),copySync:ZE()}});var ws=x((LG,t_)=>{"use strict";var e_=Rn(),CL=ft().fromCallback;function EL(t,e){e_.rm(t,{recursive:!0,force:!0},e)}function _L(t){e_.rmSync(t,{recursive:!0,force:!0})}t_.exports={remove:CL(EL),removeSync:_L}});var c_=x((jG,u_)=>{"use strict";var SL=ft().fromPromise,o_=Bt(),i_=require("path"),a_=kr(),s_=ws(),r_=SL(async function(e){let r;try{r=await o_.readdir(e)}catch{return a_.mkdirs(e)}return Promise.all(r.map(n=>s_.remove(i_.join(e,n))))});function n_(t){let e;try{e=o_.readdirSync(t)}catch{return a_.mkdirsSync(t)}e.forEach(r=>{r=i_.join(t,r),s_.removeSync(r)})}u_.exports={emptyDirSync:n_,emptydirSync:n_,emptyDir:r_,emptydir:r_}});var p_=x((UG,d_)=>{"use strict";var xL=ft().fromPromise,l_=require("path"),fn=Bt(),f_=kr();async function AL(t){let e;try{e=await fn.stat(t)}catch{}if(e&&e.isFile())return;let r=l_.dirname(t),n=null;try{n=await fn.stat(r)}catch(o){if(o.code==="ENOENT"){await f_.mkdirs(r),await fn.writeFile(t,"");return}else throw o}n.isDirectory()?await fn.writeFile(t,""):await fn.readdir(r)}function OL(t){let e;try{e=fn.statSync(t)}catch{}if(e&&e.isFile())return;let r=l_.dirname(t);try{fn.statSync(r).isDirectory()||fn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")f_.mkdirsSync(r);else throw n}fn.writeFileSync(t,"")}d_.exports={createFile:xL(AL),createFileSync:OL}});var D_=x((MG,y_)=>{"use strict";var FL=ft().fromPromise,h_=require("path"),jn=Bt(),m_=kr(),{pathExists:PL}=Ln(),{areIdentical:g_}=Ao();async function kL(t,e){let r;try{r=await jn.lstat(e)}catch{}let n;try{n=await jn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&g_(n,r))return;let o=h_.dirname(e);await PL(o)||await m_.mkdirs(o),await jn.link(t,e)}function $L(t,e){let r;try{r=jn.lstatSync(e)}catch{}try{let i=jn.lstatSync(t);if(r&&g_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=h_.dirname(e);return jn.existsSync(n)||m_.mkdirsSync(n),jn.linkSync(t,e)}y_.exports={createLink:FL(kL),createLinkSync:$L}});var w_=x((qG,b_)=>{"use strict";var Un=require("path"),vs=Bt(),{pathExists:IL}=Ln(),TL=ft().fromPromise;async function RL(t,e){if(Un.isAbsolute(t)){try{await vs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(await IL(n))return{toCwd:n,toDst:t};try{await vs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Un.relative(r,t)}}function BL(t,e){if(Un.isAbsolute(t)){if(!vs.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(vs.existsSync(n))return{toCwd:n,toDst:t};if(!vs.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Un.relative(r,t)}}b_.exports={symlinkPaths:TL(RL),symlinkPathsSync:BL}});var E_=x((HG,C_)=>{"use strict";var v_=Bt(),NL=ft().fromPromise;async function LL(t,e){if(e)return e;let r;try{r=await v_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function jL(t,e){if(e)return e;let r;try{r=v_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}C_.exports={symlinkType:NL(LL),symlinkTypeSync:jL}});var A_=x((VG,x_)=>{"use strict";var UL=ft().fromPromise,__=require("path"),Ur=Bt(),{mkdirs:ML,mkdirsSync:qL}=kr(),{symlinkPaths:HL,symlinkPathsSync:VL}=w_(),{symlinkType:zL,symlinkTypeSync:KL}=E_(),{pathExists:GL}=Ln(),{areIdentical:S_}=Ao();async function WL(t,e,r){let n;try{n=await Ur.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Ur.stat(t),Ur.stat(e)]);if(S_(s,u))return}let o=await HL(t,e);t=o.toDst;let i=await zL(o.toCwd,r),a=__.dirname(e);return await GL(a)||await ML(a),Ur.symlink(t,e,i)}function YL(t,e,r){let n;try{n=Ur.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Ur.statSync(t),u=Ur.statSync(e);if(S_(s,u))return}let o=VL(t,e);t=o.toDst,r=KL(o.toCwd,r);let i=__.dirname(e);return Ur.existsSync(i)||qL(i),Ur.symlinkSync(t,e,r)}x_.exports={createSymlink:UL(WL),createSymlinkSync:YL}});var R_=x((zG,T_)=>{"use strict";var{createFile:O_,createFileSync:F_}=p_(),{createLink:P_,createLinkSync:k_}=D_(),{createSymlink:$_,createSymlinkSync:I_}=A_();T_.exports={createFile:O_,createFileSync:F_,ensureFile:O_,ensureFileSync:F_,createLink:P_,createLinkSync:k_,ensureLink:P_,ensureLinkSync:k_,createSymlink:$_,createSymlinkSync:I_,ensureSymlink:$_,ensureSymlinkSync:I_}});var hl=x((KG,B_)=>{function JL(t,{EOL:e=`
56
- `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function XL(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}B_.exports={stringify:JL,stripBom:XL}});var U_=x((GG,j_)=>{var qi;try{qi=Rn()}catch{qi=require("fs")}var ml=ft(),{stringify:N_,stripBom:L_}=hl();async function ZL(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||qi,n="throws"in e?e.throws:!0,o=await ml.fromCallback(r.readFile)(t,e);o=L_(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 QL=ml.fromPromise(ZL);function ej(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||qi,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=L_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function tj(t,e,r={}){let n=r.fs||qi,o=N_(e,r);await ml.fromCallback(n.writeFile)(t,o,r)}var rj=ml.fromPromise(tj);function nj(t,e,r={}){let n=r.fs||qi,o=N_(e,r);return n.writeFileSync(t,o,r)}j_.exports={readFile:QL,readFileSync:ej,writeFile:rj,writeFileSync:nj}});var q_=x((WG,M_)=>{"use strict";var gl=U_();M_.exports={readJson:gl.readFile,readJsonSync:gl.readFileSync,writeJson:gl.writeFile,writeJsonSync:gl.writeFileSync}});var yl=x((YG,z_)=>{"use strict";var oj=ft().fromPromise,Tm=Bt(),H_=require("path"),V_=kr(),ij=Ln().pathExists;async function aj(t,e,r="utf-8"){let n=H_.dirname(t);return await ij(n)||await V_.mkdirs(n),Tm.writeFile(t,e,r)}function sj(t,...e){let r=H_.dirname(t);Tm.existsSync(r)||V_.mkdirsSync(r),Tm.writeFileSync(t,...e)}z_.exports={outputFile:oj(aj),outputFileSync:sj}});var G_=x((JG,K_)=>{"use strict";var{stringify:uj}=hl(),{outputFile:cj}=yl();async function lj(t,e,r={}){let n=uj(e,r);await cj(t,n,r)}K_.exports=lj});var Y_=x((XG,W_)=>{"use strict";var{stringify:fj}=hl(),{outputFileSync:dj}=yl();function pj(t,e,r){let n=fj(e,r);dj(t,n,r)}W_.exports=pj});var X_=x((ZG,J_)=>{"use strict";var hj=ft().fromPromise,Lt=q_();Lt.outputJson=hj(G_());Lt.outputJsonSync=Y_();Lt.outputJSON=Lt.outputJson;Lt.outputJSONSync=Lt.outputJsonSync;Lt.writeJSON=Lt.writeJson;Lt.writeJSONSync=Lt.writeJsonSync;Lt.readJSON=Lt.readJson;Lt.readJSONSync=Lt.readJsonSync;J_.exports=Lt});var rS=x((QG,tS)=>{"use strict";var mj=Bt(),Z_=require("path"),{copy:gj}=pl(),{remove:eS}=ws(),{mkdirp:yj}=kr(),{pathExists:Dj}=Ln(),Q_=Ao();async function bj(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await Q_.checkPaths(t,e,"move",r);await Q_.checkParentPaths(t,o,e,"move");let a=Z_.dirname(e);return Z_.parse(a).root!==a&&await yj(a),wj(t,e,n,i)}async function wj(t,e,r,n){if(!n){if(r)await eS(e);else if(await Dj(e))throw new Error("dest already exists.")}try{await mj.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await vj(t,e,r)}}async function vj(t,e,r){return await gj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),eS(t)}tS.exports=bj});var sS=x((eW,aS)=>{"use strict";var oS=Rn(),Bm=require("path"),Cj=pl().copySync,iS=ws().removeSync,Ej=kr().mkdirpSync,nS=Ao();function _j(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=nS.checkPathsSync(t,e,"move",r);return nS.checkParentPathsSync(t,o,e,"move"),Sj(e)||Ej(Bm.dirname(e)),xj(t,e,n,i)}function Sj(t){let e=Bm.dirname(t);return Bm.parse(e).root===e}function xj(t,e,r,n){if(n)return Rm(t,e,r);if(r)return iS(e),Rm(t,e,r);if(oS.existsSync(e))throw new Error("dest already exists.");return Rm(t,e,r)}function Rm(t,e,r){try{oS.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Aj(t,e,r)}}function Aj(t,e,r){return Cj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),iS(t)}aS.exports=_j});var cS=x((tW,uS)=>{"use strict";var Oj=ft().fromPromise;uS.exports={move:Oj(rS()),moveSync:sS()}});var Hi=x((rW,lS)=>{"use strict";lS.exports={...Bt(),...pl(),...c_(),...R_(),...X_(),...kr(),...cS(),...yl(),...Ln(),...ws()}});var yS=x((nW,gS)=>{"use strict";var Nm,dS,pS,hS,mS=!0;typeof process<"u"&&({FORCE_COLOR:Nm,NODE_DISABLE_COLORS:dS,NO_COLOR:pS,TERM:hS}=process.env||{},mS=process.stdout&&process.stdout.isTTY);var ke={enabled:!dS&&pS==null&&hS!=="dumb"&&(Nm!=null&&Nm!=="0"||mS),reset:Ne(0,0),bold:Ne(1,22),dim:Ne(2,22),italic:Ne(3,23),underline:Ne(4,24),inverse:Ne(7,27),hidden:Ne(8,28),strikethrough:Ne(9,29),black:Ne(30,39),red:Ne(31,39),green:Ne(32,39),yellow:Ne(33,39),blue:Ne(34,39),magenta:Ne(35,39),cyan:Ne(36,39),white:Ne(37,39),gray:Ne(90,39),grey:Ne(90,39),bgBlack:Ne(40,49),bgRed:Ne(41,49),bgGreen:Ne(42,49),bgYellow:Ne(43,49),bgBlue:Ne(44,49),bgMagenta:Ne(45,49),bgCyan:Ne(46,49),bgWhite:Ne(47,49)};function fS(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 Fj(t,e){let r={has:t,keys:e};return r.reset=ke.reset.bind(r),r.bold=ke.bold.bind(r),r.dim=ke.dim.bind(r),r.italic=ke.italic.bind(r),r.underline=ke.underline.bind(r),r.inverse=ke.inverse.bind(r),r.hidden=ke.hidden.bind(r),r.strikethrough=ke.strikethrough.bind(r),r.black=ke.black.bind(r),r.red=ke.red.bind(r),r.green=ke.green.bind(r),r.yellow=ke.yellow.bind(r),r.blue=ke.blue.bind(r),r.magenta=ke.magenta.bind(r),r.cyan=ke.cyan.bind(r),r.white=ke.white.bind(r),r.gray=ke.gray.bind(r),r.grey=ke.grey.bind(r),r.bgBlack=ke.bgBlack.bind(r),r.bgRed=ke.bgRed.bind(r),r.bgGreen=ke.bgGreen.bind(r),r.bgYellow=ke.bgYellow.bind(r),r.bgBlue=ke.bgBlue.bind(r),r.bgMagenta=ke.bgMagenta.bind(r),r.bgCyan=ke.bgCyan.bind(r),r.bgWhite=ke.bgWhite.bind(r),r}function Ne(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:ke.enabled?fS(this.keys,n+""):n+""):n===void 0?Fj([t],[r]):ke.enabled?fS([r],n+""):n+""}}gS.exports=ke});var Vi=x(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.ancillary=tt.failure=tt.success=tt.input=tt.weak=tt.strong=void 0;var Pj=(ve(),ie(we)),Mr=Pj.__importDefault(yS());tt.strong=Mr.default.bold;tt.weak=Mr.default.dim;tt.input=Mr.default.cyan;tt.success=Mr.default.green;tt.failure=Mr.default.red;tt.ancillary=Mr.default.cyan;var kj={strong:tt.strong,weak:tt.weak,input:tt.input,success:tt.success,failure:tt.failure,ancillary:tt.ancillary,log:{DEBUG:Mr.default.magenta,INFO:Mr.default.cyan,WARN:Mr.default.yellow,ERROR:Mr.default.red}};tt.default=kj});var Lm=x(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});Dl.EscapeCode=void 0;var $r="\x1B[",pt=class{};Dl.EscapeCode=pt;pt.cursorLeft=()=>`${$r}G`;pt.cursorUp=(t=1)=>`${$r}${t}A`;pt.cursorDown=(t=1)=>`${$r}${t}B`;pt.cursorForward=(t=1)=>`${$r}${t}C`;pt.cursorBackward=(t=1)=>`${$r}${t}D`;pt.cursorHide=()=>`${$r}?25l`;pt.cursorShow=()=>`${$r}?25h`;pt.eraseLine=()=>`${$r}2K`;pt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=pt.eraseLine(),r<t-1&&(e+=pt.cursorUp());return`${e}${pt.cursorLeft()}`};pt.eraseUp=()=>`${$r}1J`;pt.eraseDown=()=>`${$r}J`;pt.eraseScreen=()=>`${$r}2J`});var bS=x(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.Cursor=void 0;var $j=(ve(),ie(we)),Ij=$j.__importDefault(fm()),DS=Lm(),zi=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(DS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,Ij.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(DS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};bl.Cursor=zi;zi.stream=process.stderr;zi._isVisible=!0;zi._listenerAttached=!1});var Um=x((sW,jm)=>{"use strict";var wS=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);jm.exports=wS;jm.exports.default=wS});var ES=x((uW,CS)=>{"use strict";var vS="[\uD800-\uDBFF][\uDC00-\uDFFF]",Tj=t=>t&&t.exact?new RegExp(`^${vS}$`):new RegExp(vS,"g");CS.exports=Tj});var SS=x((cW,_S)=>{"use strict";_S.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 Mm=x((lW,AS)=>{var Cs=SS(),xS={};for(let t of Object.keys(Cs))xS[Cs[t]]=t;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};AS.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};Q.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),f=c-Math.min(a,s,u),d=function(p){return(c-p)/6/f+1/2};return f===0?(o=0,i=0):(i=f/c,e=d(a),r=d(s),n=d(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};Q.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function Rj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=xS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(Cs)){let i=Cs[o],a=Rj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return Cs[t]};Q.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};Q.rgb.lab=function(t){let e=Q.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};Q.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};Q.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};Q.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};Q.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};Q.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,f,d;switch(a){default:case 6:case 0:c=s,f=u,d=r;break;case 1:c=u,f=s,d=r;break;case 2:c=r,f=s,d=u;break;case 3:c=r,f=u,d=s;break;case 4:c=u,f=r,d=s;break;case 5:c=s,f=r,d=u;break}return[c*255,f*255,d*255]};Q.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};Q.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};Q.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};Q.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};Q.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};Q.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};Q.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};Q.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};Q.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};Q.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};Q.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};Q.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};Q.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};Q.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};Q.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};Q.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};Q.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var FS=x((fW,OS)=>{var wl=Mm();function Bj(){let t={},e=Object.keys(wl);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function Nj(t){let e=Bj(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(wl[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 Lj(t,e){return function(r){return e(t(r))}}function jj(t,e){let r=[e[t].parent,t],n=wl[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=Lj(wl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}OS.exports=function(t){let e=Nj(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]=jj(a,e))}return r}});var kS=x((dW,PS)=>{var qm=Mm(),Uj=FS(),Ki={},Mj=Object.keys(qm);function qj(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 Hj(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}Mj.forEach(t=>{Ki[t]={},Object.defineProperty(Ki[t],"channels",{value:qm[t].channels}),Object.defineProperty(Ki[t],"labels",{value:qm[t].labels});let e=Uj(t);Object.keys(e).forEach(n=>{let o=e[n];Ki[t][n]=Hj(o),Ki[t][n].raw=qj(o)})});PS.exports=Ki});var Vm=x((pW,BS)=>{"use strict";var $S=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,IS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},TS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},vl=t=>t,RS=(t,e,r)=>[t,e,r],Gi=(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})},Hm,Wi=(t,e,r,n)=>{Hm===void 0&&(Hm=kS());let o=n?10:0,i={};for(let[a,s]of Object.entries(Hm)){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 Vj(){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",Gi(e.color,"ansi",()=>Wi($S,"ansi16",vl,!1)),Gi(e.color,"ansi256",()=>Wi(IS,"ansi256",vl,!1)),Gi(e.color,"ansi16m",()=>Wi(TS,"rgb",RS,!1)),Gi(e.bgColor,"ansi",()=>Wi($S,"ansi16",vl,!0)),Gi(e.bgColor,"ansi256",()=>Wi(IS,"ansi256",vl,!0)),Gi(e.bgColor,"ansi16m",()=>Wi(TS,"rgb",RS,!0)),e}Object.defineProperty(BS,"exports",{enumerable:!0,get:Vj})});var MS=x((hW,US)=>{"use strict";var zj=Um(),Kj=ES(),NS=Vm(),jS=["\x1B","\x9B"],Cl=t=>`${jS[0]}[${t}m`,LS=(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=NS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(Cl(e?a:i)):t.splice(s,1)}else if(e){n.push(Cl(0));break}else n.push(Cl(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=Cl(NS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};US.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[f,d]of n.entries()){let p=!1;if(jS.includes(d)){let h=/\d[^m]*/.exec(t.slice(f,f+18));s=h&&h.length>0?h[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,p=!0);if(!a&&!p&&u++,!Kj({exact:!0}).test(d)&&zj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=LS(o);else if(u>=i){c+=LS(o,!0,s);break}}return c}});var HS=x((mW,qS)=>{"use strict";qS.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 El=x((gW,VS)=>{"use strict";var Gj=HS();VS.exports=t=>typeof t=="string"?t.replace(Gj(),""):t});var KS=x((yW,zS)=>{"use strict";zS.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 Km=x((DW,zm)=>{"use strict";var Wj=El(),Yj=Um(),Jj=KS(),GS=t=>{if(typeof t!="string"||t.length===0||(t=Wj(t),t.length===0))return 0;t=t.replace(Jj()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=Yj(n)?2:1)}return e};zm.exports=GS;zm.exports.default=GS});var QS=x((bW,ZS)=>{"use strict";var Es=Km(),Xj=El(),Zj=Vm(),_l=new Set(["\x1B","\x9B"]),Qj=39,Wm="\x07",JS="[",eU="]",XS="m",Ym=`${eU}8;;`,WS=t=>`${_l.values().next().value}${JS}${t}${XS}`,YS=t=>`${_l.values().next().value}${Ym}${t}${Wm}`,tU=t=>t.split(" ").map(e=>Es(e)),Gm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Es(Xj(t[t.length-1]));for(let[s,u]of n.entries()){let c=Es(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),_l.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Ym)),o){i?u===Wm&&(o=!1,i=!1):u===XS&&(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())},rU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Es(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},nU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=tU(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Es(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Gm(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Gm(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Gm(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(rU));let u=[...s.join(`
57
- `)];for(let[c,f]of u.entries()){if(n+=f,_l.has(f)){let{groups:p}=new RegExp(`(?:\\${JS}(?<code>\\d+)m|\\${Ym}(?<uri>.*)${Wm})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===Qj?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=Zj.codes.get(Number(o));u[c+1]===`
58
- `?(i&&(n+=YS("")),o&&d&&(n+=WS(d))):f===`
59
- `&&(o&&d&&(n+=WS(o)),i&&(n+=YS(i)))}return n};ZS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
55
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:o}=ws.checkPathsSync(t,e,"copy",r);if(ws.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let i=bs.dirname(e);return Nt.existsSync(i)||fL(i),YE(o,t,e,r)}function YE(t,e,r,n){let i=(n.dereference?Nt.statSync:Nt.lstatSync)(e);if(i.isDirectory())return wL(i,t,e,r,n);if(i.isFile()||i.isCharacterDevice()||i.isBlockDevice())return hL(i,t,e,r,n);if(i.isSymbolicLink())return EL(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 hL(t,e,r,n,o){return e?mL(t,r,n,o):JE(t,r,n,o)}function mL(t,e,r,n){if(n.overwrite)return Nt.unlinkSync(r),JE(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function JE(t,e,r,n){return Nt.copyFileSync(e,r),n.preserveTimestamps&&gL(t.mode,e,r),Tm(r,t.mode)}function gL(t,e,r){return yL(t)&&DL(r,t),bL(e,r)}function yL(t){return(t&128)===0}function DL(t,e){return Tm(t,e|128)}function Tm(t,e){return Nt.chmodSync(t,e)}function bL(t,e){let r=Nt.statSync(t);return dL(e,r.atime,r.mtime)}function wL(t,e,r,n,o){return e?XE(r,n,o):vL(t.mode,r,n,o)}function vL(t,e,r,n){return Nt.mkdirSync(r),XE(e,r,n),Tm(r,t)}function XE(t,e,r){let n=Nt.opendirSync(t);try{let o;for(;(o=n.readSync())!==null;)CL(o.name,t,e,r)}finally{n.closeSync()}}function CL(t,e,r,n){let o=bs.join(e,t),i=bs.join(r,t);if(n.filter&&!n.filter(o,i))return;let{destStat:a}=ws.checkPathsSync(o,i,"copy",n);return YE(a,o,i,n)}function EL(t,e,r,n){let o=Nt.readlinkSync(e);if(n.dereference&&(o=bs.resolve(process.cwd(),o)),t){let i;try{i=Nt.readlinkSync(r)}catch(a){if(a.code==="EINVAL"||a.code==="UNKNOWN")return Nt.symlinkSync(o,r);throw a}if(n.dereference&&(i=bs.resolve(process.cwd(),i)),ws.isSrcSubdir(o,i))throw new Error(`Cannot copy '${o}' to a subdirectory of itself, '${i}'.`);if(ws.isSrcSubdir(i,o))throw new Error(`Cannot overwrite '${i}' with '${o}'.`);return _L(o,r)}else return Nt.symlinkSync(o,r)}function _L(t,e){return Nt.unlinkSync(e),Nt.symlinkSync(t,e)}ZE.exports=pL});var hl=x((HG,e_)=>{"use strict";var SL=lt().fromPromise;e_.exports={copy:SL(WE()),copySync:QE()}});var vs=x((VG,r_)=>{"use strict";var t_=Rn(),xL=lt().fromCallback;function AL(t,e){t_.rm(t,{recursive:!0,force:!0},e)}function OL(t){t_.rmSync(t,{recursive:!0,force:!0})}r_.exports={remove:xL(AL),removeSync:OL}});var l_=x((zG,c_)=>{"use strict";var FL=lt().fromPromise,i_=Bt(),a_=require("path"),s_=Pr(),u_=vs(),n_=FL(async function(e){let r;try{r=await i_.readdir(e)}catch{return s_.mkdirs(e)}return Promise.all(r.map(n=>u_.remove(a_.join(e,n))))});function o_(t){let e;try{e=i_.readdirSync(t)}catch{return s_.mkdirsSync(t)}e.forEach(r=>{r=a_.join(t,r),u_.removeSync(r)})}c_.exports={emptyDirSync:o_,emptydirSync:o_,emptyDir:n_,emptydir:n_}});var h_=x((KG,p_)=>{"use strict";var kL=lt().fromPromise,f_=require("path"),fn=Bt(),d_=Pr();async function PL(t){let e;try{e=await fn.stat(t)}catch{}if(e&&e.isFile())return;let r=f_.dirname(t),n=null;try{n=await fn.stat(r)}catch(o){if(o.code==="ENOENT"){await d_.mkdirs(r),await fn.writeFile(t,"");return}else throw o}n.isDirectory()?await fn.writeFile(t,""):await fn.readdir(r)}function $L(t){let e;try{e=fn.statSync(t)}catch{}if(e&&e.isFile())return;let r=f_.dirname(t);try{fn.statSync(r).isDirectory()||fn.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")d_.mkdirsSync(r);else throw n}fn.writeFileSync(t,"")}p_.exports={createFile:kL(PL),createFileSync:$L}});var b_=x((GG,D_)=>{"use strict";var IL=lt().fromPromise,m_=require("path"),jn=Bt(),g_=Pr(),{pathExists:TL}=Ln(),{areIdentical:y_}=Oo();async function RL(t,e){let r;try{r=await jn.lstat(e)}catch{}let n;try{n=await jn.lstat(t)}catch(a){throw a.message=a.message.replace("lstat","ensureLink"),a}if(r&&y_(n,r))return;let o=m_.dirname(e);await TL(o)||await g_.mkdirs(o),await jn.link(t,e)}function BL(t,e){let r;try{r=jn.lstatSync(e)}catch{}try{let i=jn.lstatSync(t);if(r&&y_(i,r))return}catch(i){throw i.message=i.message.replace("lstat","ensureLink"),i}let n=m_.dirname(e);return jn.existsSync(n)||g_.mkdirsSync(n),jn.linkSync(t,e)}D_.exports={createLink:IL(RL),createLinkSync:BL}});var v_=x((WG,w_)=>{"use strict";var Un=require("path"),Cs=Bt(),{pathExists:NL}=Ln(),LL=lt().fromPromise;async function jL(t,e){if(Un.isAbsolute(t)){try{await Cs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(await NL(n))return{toCwd:n,toDst:t};try{await Cs.lstat(t)}catch(i){throw i.message=i.message.replace("lstat","ensureSymlink"),i}return{toCwd:t,toDst:Un.relative(r,t)}}function UL(t,e){if(Un.isAbsolute(t)){if(!Cs.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Un.dirname(e),n=Un.join(r,t);if(Cs.existsSync(n))return{toCwd:n,toDst:t};if(!Cs.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Un.relative(r,t)}}w_.exports={symlinkPaths:LL(jL),symlinkPathsSync:UL}});var __=x((YG,E_)=>{"use strict";var C_=Bt(),ML=lt().fromPromise;async function qL(t,e){if(e)return e;let r;try{r=await C_.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function HL(t,e){if(e)return e;let r;try{r=C_.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}E_.exports={symlinkType:ML(qL),symlinkTypeSync:HL}});var O_=x((JG,A_)=>{"use strict";var VL=lt().fromPromise,S_=require("path"),Ur=Bt(),{mkdirs:zL,mkdirsSync:KL}=Pr(),{symlinkPaths:GL,symlinkPathsSync:WL}=v_(),{symlinkType:YL,symlinkTypeSync:JL}=__(),{pathExists:XL}=Ln(),{areIdentical:x_}=Oo();async function ZL(t,e,r){let n;try{n=await Ur.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[s,u]=await Promise.all([Ur.stat(t),Ur.stat(e)]);if(x_(s,u))return}let o=await GL(t,e);t=o.toDst;let i=await YL(o.toCwd,r),a=S_.dirname(e);return await XL(a)||await zL(a),Ur.symlink(t,e,i)}function QL(t,e,r){let n;try{n=Ur.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let s=Ur.statSync(t),u=Ur.statSync(e);if(x_(s,u))return}let o=WL(t,e);t=o.toDst,r=JL(o.toCwd,r);let i=S_.dirname(e);return Ur.existsSync(i)||KL(i),Ur.symlinkSync(t,e,r)}A_.exports={createSymlink:VL(ZL),createSymlinkSync:QL}});var B_=x((XG,R_)=>{"use strict";var{createFile:F_,createFileSync:k_}=h_(),{createLink:P_,createLinkSync:$_}=b_(),{createSymlink:I_,createSymlinkSync:T_}=O_();R_.exports={createFile:F_,createFileSync:k_,ensureFile:F_,ensureFileSync:k_,createLink:P_,createLinkSync:$_,ensureLink:P_,ensureLinkSync:$_,createSymlink:I_,createSymlinkSync:T_,ensureSymlink:I_,ensureSymlinkSync:T_}});var ml=x((ZG,N_)=>{function ej(t,{EOL:e=`
56
+ `,finalEOL:r=!0,replacer:n=null,spaces:o}={}){let i=r?e:"";return JSON.stringify(t,n,o).replace(/\n/g,e)+i}function tj(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}N_.exports={stringify:ej,stripBom:tj}});var M_=x((QG,U_)=>{var Hi;try{Hi=Rn()}catch{Hi=require("fs")}var gl=lt(),{stringify:L_,stripBom:j_}=ml();async function rj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Hi,n="throws"in e?e.throws:!0,o=await gl.fromCallback(r.readFile)(t,e);o=j_(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 nj=gl.fromPromise(rj);function oj(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||Hi,n="throws"in e?e.throws:!0;try{let o=r.readFileSync(t,e);return o=j_(o),JSON.parse(o,e.reviver)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}}async function ij(t,e,r={}){let n=r.fs||Hi,o=L_(e,r);await gl.fromCallback(n.writeFile)(t,o,r)}var aj=gl.fromPromise(ij);function sj(t,e,r={}){let n=r.fs||Hi,o=L_(e,r);return n.writeFileSync(t,o,r)}U_.exports={readFile:nj,readFileSync:oj,writeFile:aj,writeFileSync:sj}});var H_=x((eW,q_)=>{"use strict";var yl=M_();q_.exports={readJson:yl.readFile,readJsonSync:yl.readFileSync,writeJson:yl.writeFile,writeJsonSync:yl.writeFileSync}});var Dl=x((tW,K_)=>{"use strict";var uj=lt().fromPromise,Rm=Bt(),V_=require("path"),z_=Pr(),cj=Ln().pathExists;async function lj(t,e,r="utf-8"){let n=V_.dirname(t);return await cj(n)||await z_.mkdirs(n),Rm.writeFile(t,e,r)}function fj(t,...e){let r=V_.dirname(t);Rm.existsSync(r)||z_.mkdirsSync(r),Rm.writeFileSync(t,...e)}K_.exports={outputFile:uj(lj),outputFileSync:fj}});var W_=x((rW,G_)=>{"use strict";var{stringify:dj}=ml(),{outputFile:pj}=Dl();async function hj(t,e,r={}){let n=dj(e,r);await pj(t,n,r)}G_.exports=hj});var J_=x((nW,Y_)=>{"use strict";var{stringify:mj}=ml(),{outputFileSync:gj}=Dl();function yj(t,e,r){let n=mj(e,r);gj(t,n,r)}Y_.exports=yj});var Z_=x((oW,X_)=>{"use strict";var Dj=lt().fromPromise,Lt=H_();Lt.outputJson=Dj(W_());Lt.outputJsonSync=J_();Lt.outputJSON=Lt.outputJson;Lt.outputJSONSync=Lt.outputJsonSync;Lt.writeJSON=Lt.writeJson;Lt.writeJSONSync=Lt.writeJsonSync;Lt.readJSON=Lt.readJson;Lt.readJSONSync=Lt.readJsonSync;X_.exports=Lt});var nS=x((iW,rS)=>{"use strict";var bj=Bt(),Q_=require("path"),{copy:wj}=hl(),{remove:tS}=vs(),{mkdirp:vj}=Pr(),{pathExists:Cj}=Ln(),eS=Oo();async function Ej(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=await eS.checkPaths(t,e,"move",r);await eS.checkParentPaths(t,o,e,"move");let a=Q_.dirname(e);return Q_.parse(a).root!==a&&await vj(a),_j(t,e,n,i)}async function _j(t,e,r,n){if(!n){if(r)await tS(e);else if(await Cj(e))throw new Error("dest already exists.")}try{await bj.rename(t,e)}catch(o){if(o.code!=="EXDEV")throw o;await Sj(t,e,r)}}async function Sj(t,e,r){return await wj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),tS(t)}rS.exports=Ej});var uS=x((aW,sS)=>{"use strict";var iS=Rn(),Nm=require("path"),xj=hl().copySync,aS=vs().removeSync,Aj=Pr().mkdirpSync,oS=Oo();function Oj(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:o,isChangingCase:i=!1}=oS.checkPathsSync(t,e,"move",r);return oS.checkParentPathsSync(t,o,e,"move"),Fj(e)||Aj(Nm.dirname(e)),kj(t,e,n,i)}function Fj(t){let e=Nm.dirname(t);return Nm.parse(e).root===e}function kj(t,e,r,n){if(n)return Bm(t,e,r);if(r)return aS(e),Bm(t,e,r);if(iS.existsSync(e))throw new Error("dest already exists.");return Bm(t,e,r)}function Bm(t,e,r){try{iS.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return Pj(t,e,r)}}function Pj(t,e,r){return xj(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),aS(t)}sS.exports=Oj});var lS=x((sW,cS)=>{"use strict";var $j=lt().fromPromise;cS.exports={move:$j(nS()),moveSync:uS()}});var Vi=x((uW,fS)=>{"use strict";fS.exports={...Bt(),...hl(),...l_(),...B_(),...Z_(),...Pr(),...lS(),...Dl(),...Ln(),...vs()}});var DS=x((cW,yS)=>{"use strict";var Lm,pS,hS,mS,gS=!0;typeof process<"u"&&({FORCE_COLOR:Lm,NODE_DISABLE_COLORS:pS,NO_COLOR:hS,TERM:mS}=process.env||{},gS=process.stdout&&process.stdout.isTTY);var Pe={enabled:!pS&&hS==null&&mS!=="dumb"&&(Lm!=null&&Lm!=="0"||gS),reset:Ne(0,0),bold:Ne(1,22),dim:Ne(2,22),italic:Ne(3,23),underline:Ne(4,24),inverse:Ne(7,27),hidden:Ne(8,28),strikethrough:Ne(9,29),black:Ne(30,39),red:Ne(31,39),green:Ne(32,39),yellow:Ne(33,39),blue:Ne(34,39),magenta:Ne(35,39),cyan:Ne(36,39),white:Ne(37,39),gray:Ne(90,39),grey:Ne(90,39),bgBlack:Ne(40,49),bgRed:Ne(41,49),bgGreen:Ne(42,49),bgYellow:Ne(43,49),bgBlue:Ne(44,49),bgMagenta:Ne(45,49),bgCyan:Ne(46,49),bgWhite:Ne(47,49)};function dS(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 Ij(t,e){let r={has:t,keys:e};return r.reset=Pe.reset.bind(r),r.bold=Pe.bold.bind(r),r.dim=Pe.dim.bind(r),r.italic=Pe.italic.bind(r),r.underline=Pe.underline.bind(r),r.inverse=Pe.inverse.bind(r),r.hidden=Pe.hidden.bind(r),r.strikethrough=Pe.strikethrough.bind(r),r.black=Pe.black.bind(r),r.red=Pe.red.bind(r),r.green=Pe.green.bind(r),r.yellow=Pe.yellow.bind(r),r.blue=Pe.blue.bind(r),r.magenta=Pe.magenta.bind(r),r.cyan=Pe.cyan.bind(r),r.white=Pe.white.bind(r),r.gray=Pe.gray.bind(r),r.grey=Pe.grey.bind(r),r.bgBlack=Pe.bgBlack.bind(r),r.bgRed=Pe.bgRed.bind(r),r.bgGreen=Pe.bgGreen.bind(r),r.bgYellow=Pe.bgYellow.bind(r),r.bgBlue=Pe.bgBlue.bind(r),r.bgMagenta=Pe.bgMagenta.bind(r),r.bgCyan=Pe.bgCyan.bind(r),r.bgWhite=Pe.bgWhite.bind(r),r}function Ne(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:Pe.enabled?dS(this.keys,n+""):n+""):n===void 0?Ij([t],[r]):Pe.enabled?dS([r],n+""):n+""}}yS.exports=Pe});var zi=x(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.ancillary=rt.failure=rt.success=rt.input=rt.weak=rt.strong=void 0;var Tj=(ve(),ae(we)),Mr=Tj.__importDefault(DS());rt.strong=Mr.default.bold;rt.weak=Mr.default.dim;rt.input=Mr.default.cyan;rt.success=Mr.default.green;rt.failure=Mr.default.red;rt.ancillary=Mr.default.cyan;var Rj={strong:rt.strong,weak:rt.weak,input:rt.input,success:rt.success,failure:rt.failure,ancillary:rt.ancillary,log:{DEBUG:Mr.default.magenta,INFO:Mr.default.cyan,WARN:Mr.default.yellow,ERROR:Mr.default.red}};rt.default=Rj});var jm=x(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl.EscapeCode=void 0;var $r="\x1B[",dt=class{};bl.EscapeCode=dt;dt.cursorLeft=()=>`${$r}G`;dt.cursorUp=(t=1)=>`${$r}${t}A`;dt.cursorDown=(t=1)=>`${$r}${t}B`;dt.cursorForward=(t=1)=>`${$r}${t}C`;dt.cursorBackward=(t=1)=>`${$r}${t}D`;dt.cursorHide=()=>`${$r}?25l`;dt.cursorShow=()=>`${$r}?25h`;dt.eraseLine=()=>`${$r}2K`;dt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=dt.eraseLine(),r<t-1&&(e+=dt.cursorUp());return`${e}${dt.cursorLeft()}`};dt.eraseUp=()=>`${$r}1J`;dt.eraseDown=()=>`${$r}J`;dt.eraseScreen=()=>`${$r}2J`});var wS=x(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.Cursor=void 0;var Bj=(ve(),ae(we)),Nj=Bj.__importDefault(dm()),bS=jm(),Ki=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(bS.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,Nj.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(bS.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};wl.Cursor=Ki;Ki.stream=process.stderr;Ki._isVisible=!0;Ki._listenerAttached=!1});var Mm=x((pW,Um)=>{"use strict";var vS=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);Um.exports=vS;Um.exports.default=vS});var _S=x((hW,ES)=>{"use strict";var CS="[\uD800-\uDBFF][\uDC00-\uDFFF]",Lj=t=>t&&t.exact?new RegExp(`^${CS}$`):new RegExp(CS,"g");ES.exports=Lj});var xS=x((mW,SS)=>{"use strict";SS.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 qm=x((gW,OS)=>{var Es=xS(),AS={};for(let t of Object.keys(Es))AS[Es[t]]=t;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};OS.exports=Q;for(let t of Object.keys(Q)){if(!("channels"in Q[t]))throw new Error("missing channels property: "+t);if(!("labels"in Q[t]))throw new Error("missing channel labels property: "+t);if(Q[t].labels.length!==Q[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=Q[t];delete Q[t].channels,delete Q[t].labels,Object.defineProperty(Q[t],"channels",{value:e}),Object.defineProperty(Q[t],"labels",{value:r})}Q.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(e,r,n),i=Math.max(e,r,n),a=i-o,s,u;i===o?s=0:e===i?s=(r-n)/a:r===i?s=2+(n-e)/a:n===i&&(s=4+(e-r)/a),s=Math.min(s*60,360),s<0&&(s+=360);let c=(o+i)/2;return i===o?u=0:c<=.5?u=a/(i+o):u=a/(2-i-o),[s,u*100,c*100]};Q.rgb.hsv=function(t){let e,r,n,o,i,a=t[0]/255,s=t[1]/255,u=t[2]/255,c=Math.max(a,s,u),f=c-Math.min(a,s,u),d=function(h){return(c-h)/6/f+1/2};return f===0?(o=0,i=0):(i=f/c,e=d(a),r=d(s),n=d(u),a===c?o=n-r:s===c?o=1/3+e-n:u===c&&(o=2/3+r-e),o<0?o+=1:o>1&&(o-=1)),[o*360,i*100,c*100]};Q.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],o=Q.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[o,i*100,n*100]};Q.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.min(1-e,1-r,1-n),i=(1-e-o)/(1-o)||0,a=(1-r-o)/(1-o)||0,s=(1-n-o)/(1-o)||0;return[i*100,a*100,s*100,o*100]};function jj(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}Q.rgb.keyword=function(t){let e=AS[t];if(e)return e;let r=1/0,n;for(let o of Object.keys(Es)){let i=Es[o],a=jj(t,i);a<r&&(r=a,n=o)}return n};Q.keyword.rgb=function(t){return Es[t]};Q.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,a=e*.0193+r*.1192+n*.9505;return[o*100,i*100,a*100]};Q.rgb.lab=function(t){let e=Q.rgb.xyz(t),r=e[0],n=e[1],o=e[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let i=116*n-16,a=500*(r-n),s=200*(n-o);return[i,a,s]};Q.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o,i,a;if(r===0)return a=n*255,[a,a,a];n<.5?o=n*(1+r):o=n+r-n*r;let s=2*n-o,u=[0,0,0];for(let c=0;c<3;c++)i=e+1/3*-(c-1),i<0&&i++,i>1&&i--,6*i<1?a=s+(o-s)*6*i:2*i<1?a=o:3*i<2?a=s+(o-s)*(2/3-i)*6:a=s,u[c]=a*255;return u};Q.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=r,i=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let a=(n+r)/2,s=n===0?2*o/(i+o):2*r/(n+r);return[e,s*100,a*100]};Q.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,o=Math.floor(e)%6,i=e-Math.floor(e),a=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,u,a];case 1:return[s,n,a];case 2:return[a,n,u];case 3:return[a,s,n];case 4:return[u,a,n];case 5:return[n,a,s]}};Q.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,o=Math.max(n,.01),i,a;a=(2-r)*n;let s=(2-r)*o;return i=r*o,i/=s<=1?s:2-s,i=i||0,a/=2,[e,i*100,a*100]};Q.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,o=r+n,i;o>1&&(r/=o,n/=o);let a=Math.floor(6*e),s=1-n;i=6*e-a,(a&1)!==0&&(i=1-i);let u=r+i*(s-r),c,f,d;switch(a){default:case 6:case 0:c=s,f=u,d=r;break;case 1:c=u,f=s,d=r;break;case 2:c=r,f=s,d=u;break;case 3:c=r,f=u,d=s;break;case 4:c=u,f=r,d=s;break;case 5:c=s,f=r,d=u;break}return[c*255,f*255,d*255]};Q.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o=t[3]/100,i=1-Math.min(1,e*(1-o)+o),a=1-Math.min(1,r*(1-o)+o),s=1-Math.min(1,n*(1-o)+o);return[i*255,a*255,s*255]};Q.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,o,i,a;return o=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,a=e*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),[o*255,i*255,a*255]};Q.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,i=500*(e-r),a=200*(r-n);return[o,i,a]};Q.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],o,i,a;i=(e+16)/116,o=r/500+i,a=i-n/200;let s=i**3,u=o**3,c=a**3;return i=s>.008856?s:(i-16/116)/7.787,o=u>.008856?u:(o-16/116)/7.787,a=c>.008856?c:(a-16/116)/7.787,o*=95.047,i*=100,a*=108.883,[o,i,a]};Q.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let a=Math.sqrt(r*r+n*n);return[e,a,o]};Q.lch.lab=function(t){let e=t[0],r=t[1],o=t[2]/360*2*Math.PI,i=r*Math.cos(o),a=r*Math.sin(o);return[e,i,a]};Q.rgb.ansi16=function(t,e=null){let[r,n,o]=t,i=e===null?Q.rgb.hsv(t)[2]:e;if(i=Math.round(i/50),i===0)return 30;let a=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return i===2&&(a+=60),a};Q.hsv.ansi16=function(t){return Q.rgb.ansi16(Q.hsv.rgb(t),t[2])};Q.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Q.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,o=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,o,i]};Q.ansi256.rgb=function(t){if(t>=232){let i=(t-232)*10+8;return[i,i,i]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,o=e%6/5*255;return[r,n,o]};Q.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};Q.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(s=>s+s).join(""));let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,a=n&255;return[o,i,a]};Q.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,o=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),a=o-i,s,u;return a<1?s=i/(1-a):s=0,a<=0?u=0:o===e?u=(r-n)/a%6:o===r?u=2+(n-e)/a:u=4+(e-r)/a,u/=6,u%=1,[u*360,a*100,s*100]};Q.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[t[0],n*100,o*100]};Q.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,o=0;return n<1&&(o=(r-n)/(1-n)),[t[0],n*100,o*100]};Q.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=e%1*6,a=i%1,s=1-a,u=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=s,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=s,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=s}return u=(1-r)*n,[(r*o[0]+u)*255,(r*o[1]+u)*255,(r*o[2]+u)*255]};Q.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),o=0;return n>0&&(o=e/n),[t[0],o*100,n*100]};Q.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,o=0;return n>0&&n<.5?o=e/(2*n):n>=.5&&n<1&&(o=e/(2*(1-n))),[t[0],o*100,n*100]};Q.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};Q.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,o=n-e,i=0;return o<1&&(i=(n-o)/(1-o)),[t[0],o*100,i*100]};Q.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};Q.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};Q.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};Q.gray.hsl=function(t){return[0,0,t[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(t){return[0,100,t[0]]};Q.gray.cmyk=function(t){return[0,0,0,t[0]]};Q.gray.lab=function(t){return[t[0],0,0]};Q.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};Q.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var kS=x((yW,FS)=>{var vl=qm();function Uj(){let t={},e=Object.keys(vl);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function Mj(t){let e=Uj(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),o=Object.keys(vl[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 qj(t,e){return function(r){return e(t(r))}}function Hj(t,e){let r=[e[t].parent,t],n=vl[e[t].parent][t],o=e[t].parent;for(;e[o].parent;)r.unshift(e[o].parent),n=qj(vl[e[o].parent][o],n),o=e[o].parent;return n.conversion=r,n}FS.exports=function(t){let e=Mj(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]=Hj(a,e))}return r}});var $S=x((DW,PS)=>{var Hm=qm(),Vj=kS(),Gi={},zj=Object.keys(Hm);function Kj(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 Gj(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}zj.forEach(t=>{Gi[t]={},Object.defineProperty(Gi[t],"channels",{value:Hm[t].channels}),Object.defineProperty(Gi[t],"labels",{value:Hm[t].labels});let e=Vj(t);Object.keys(e).forEach(n=>{let o=e[n];Gi[t][n]=Gj(o),Gi[t][n].raw=Kj(o)})});PS.exports=Gi});var zm=x((bW,NS)=>{"use strict";var IS=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,TS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},RS=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},Cl=t=>t,BS=(t,e,r)=>[t,e,r],Wi=(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,Yi=(t,e,r,n)=>{Vm===void 0&&(Vm=$S());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 Wj(){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",Wi(e.color,"ansi",()=>Yi(IS,"ansi16",Cl,!1)),Wi(e.color,"ansi256",()=>Yi(TS,"ansi256",Cl,!1)),Wi(e.color,"ansi16m",()=>Yi(RS,"rgb",BS,!1)),Wi(e.bgColor,"ansi",()=>Yi(IS,"ansi16",Cl,!0)),Wi(e.bgColor,"ansi256",()=>Yi(TS,"ansi256",Cl,!0)),Wi(e.bgColor,"ansi16m",()=>Yi(RS,"rgb",BS,!0)),e}Object.defineProperty(NS,"exports",{enumerable:!0,get:Wj})});var qS=x((wW,MS)=>{"use strict";var Yj=Mm(),Jj=_S(),LS=zm(),US=["\x1B","\x9B"],El=t=>`${US[0]}[${t}m`,jS=(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=LS.codes.get(Number.parseInt(o,10));if(a){let s=t.indexOf(a.toString());s===-1?n.push(El(e?a:i)):t.splice(s,1)}else if(e){n.push(El(0));break}else n.push(El(i))}if(e&&(n=n.filter((o,i)=>n.indexOf(o)===i),r!==void 0)){let o=El(LS.codes.get(Number.parseInt(r,10)));n=n.reduce((i,a)=>a===o?[a,...i]:[...i,a],[])}return n.join("")};MS.exports=(t,e,r)=>{let n=[...t],o=[],i=typeof r=="number"?r:n.length,a=!1,s,u=0,c="";for(let[f,d]of n.entries()){let h=!1;if(US.includes(d)){let p=/\d[^m]*/.exec(t.slice(f,f+18));s=p&&p.length>0?p[0]:void 0,u<i&&(a=!0,s!==void 0&&o.push(s))}else a&&d==="m"&&(a=!1,h=!0);if(!a&&!h&&u++,!Jj({exact:!0}).test(d)&&Yj(d.codePointAt())&&(u++,typeof r!="number"&&i++),u>e&&u<=i)c+=d;else if(u===e&&!a&&s!==void 0)c=jS(o);else if(u>=i){c+=jS(o,!0,s);break}}return c}});var VS=x((vW,HS)=>{"use strict";HS.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 _l=x((CW,zS)=>{"use strict";var Xj=VS();zS.exports=t=>typeof t=="string"?t.replace(Xj(),""):t});var GS=x((EW,KS)=>{"use strict";KS.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 Gm=x((_W,Km)=>{"use strict";var Zj=_l(),Qj=Mm(),eU=GS(),WS=t=>{if(typeof t!="string"||t.length===0||(t=Zj(t),t.length===0))return 0;t=t.replace(eU()," ");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+=Qj(n)?2:1)}return e};Km.exports=WS;Km.exports.default=WS});var ex=x((SW,QS)=>{"use strict";var _s=Gm(),tU=_l(),rU=zm(),Sl=new Set(["\x1B","\x9B"]),nU=39,Ym="\x07",XS="[",oU="]",ZS="m",Jm=`${oU}8;;`,YS=t=>`${Sl.values().next().value}${XS}${t}${ZS}`,JS=t=>`${Sl.values().next().value}${Jm}${t}${Ym}`,iU=t=>t.split(" ").map(e=>_s(e)),Wm=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=_s(tU(t[t.length-1]));for(let[s,u]of n.entries()){let c=_s(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),Sl.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(Jm)),o){i?u===Ym&&(o=!1,i=!1):u===ZS&&(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())},aU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(_s(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},sU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=iU(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=_s(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let h=e-d,p=1+Math.floor((a[c]-h-1)/e);Math.floor((a[c]-1)/e)<p&&s.push(""),Wm(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Wm(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Wm(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(aU));let u=[...s.join(`
57
+ `)];for(let[c,f]of u.entries()){if(n+=f,Sl.has(f)){let{groups:h}=new RegExp(`(?:\\${XS}(?<code>\\d+)m|\\${Jm}(?<uri>.*)${Ym})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let p=Number.parseFloat(h.code);o=p===nU?void 0:p}else h.uri!==void 0&&(i=h.uri.length===0?void 0:h.uri)}let d=rU.codes.get(Number(o));u[c+1]===`
58
+ `?(i&&(n+=JS("")),o&&d&&(n+=YS(d))):f===`
59
+ `&&(o&&d&&(n+=YS(o)),i&&(n+=JS(i)))}return n};QS.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
60
60
  `).split(`
61
- `).map(n=>nU(n,e,r)).join(`
62
- `)});var rx=x((wW,tx)=>{"use strict";var oU=require("os"),ex=oU.homedir();tx.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return ex?t.replace(/^~(?=$|\/|\\)/,ex):t}});var ux=x(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.columnar=We.generateFillSpaceStringList=We.expandPath=We.prettyPath=We.wordWrap=We.indent=We.TTY_WIDTH=We.stripAnsi=We.stringWidth=We.sliceAnsi=void 0;var nx=(ve(),ie(we)),iU=nx.__importStar(require("os")),dn=nx.__importStar(require("path")),ox=MS();We.sliceAnsi=ox;var Sl=Km();We.stringWidth=Sl;var aU=El();We.stripAnsi=aU;var sU=QS(),uU=rx(),cU=80,lU=120;We.TTY_WIDTH=process.stdout.columns?Math.max(cU,Math.min(process.stdout.columns,lU)):1/0;function ix(t=4){return" ".repeat(t)}We.indent=ix;function fU(t,{width:e=We.TTY_WIDTH,indentation:r=0,append:n=""}){return sU(t,e-r-n.length,{trim:!0}).split(`
61
+ `).map(n=>sU(n,e,r)).join(`
62
+ `)});var nx=x((xW,rx)=>{"use strict";var uU=require("os"),tx=uU.homedir();rx.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return tx?t.replace(/^~(?=$|\/|\\)/,tx):t}});var cx=x(Ye=>{"use strict";Object.defineProperty(Ye,"__esModule",{value:!0});Ye.columnar=Ye.generateFillSpaceStringList=Ye.expandPath=Ye.prettyPath=Ye.wordWrap=Ye.indent=Ye.TTY_WIDTH=Ye.stripAnsi=Ye.stringWidth=Ye.sliceAnsi=void 0;var ox=(ve(),ae(we)),cU=ox.__importStar(require("os")),dn=ox.__importStar(require("path")),ix=qS();Ye.sliceAnsi=ix;var xl=Gm();Ye.stringWidth=xl;var lU=_l();Ye.stripAnsi=lU;var fU=ex(),dU=nx(),pU=80,hU=120;Ye.TTY_WIDTH=process.stdout.columns?Math.max(pU,Math.min(process.stdout.columns,hU)):1/0;function ax(t=4){return" ".repeat(t)}Ye.indent=ax;function mU(t,{width:e=Ye.TTY_WIDTH,indentation:r=0,append:n=""}){return fU(t,e-r-n.length,{trim:!0}).split(`
63
63
  `).join(`${n}
64
- ${ix(r)}`)}We.wordWrap=fU;function dU(t){t=ax(t);let e=process.cwd(),r=dn.dirname(t),n=iU.homedir(),o=Math.abs(r.split(dn.sep).length-e.split(dn.sep).length);if(e===r)return"."+dn.sep+dn.basename(t);if(r.startsWith(e))return"."+dn.sep+t.substring(e.length+1);if(o<=2){let i=dn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+dn.sep+t.substring(n.length+1)}return t}We.prettyPath=dU;function ax(t){return dn.resolve(uU(t))}We.expandPath=ax;function sx(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>Sl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>ox(i,0,o-Sl(a)))}We.generateFillSpaceStringList=sx;function pU(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(f=>[f]):t[0].map(()=>[]);for(let f of t){let d=0,p=f.map(h=>{let m=h.split(`
65
- `);return d=Math.max(d,m.length),m});for(let h in f)a[h]&&a[h].push(...p[h],...Array(d-p[h].length).fill(""))}let s=a.map((f,d)=>{if(d<i-1){let p=sx(f);return f.map((h,m)=>`${h}${p[m]}${r===""?"":`${r} `}`)}else return f}),u=0,c=s.reduce((f,d)=>f.map((p,h)=>{let m=f[h]+d[h];return u=Math.max(u,Sl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
- `)}We.columnar=pU});var cx=x(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.TERMINAL_INFO=vr.CI_ENVIRONMENT_VARIABLES_DETECTED=vr.CI_ENVIRONMENT_VARIABLES=void 0;var hU=(ve(),ie(we)),mU=xm(),gU=hU.__importStar(require("os")),yU=(0,mU.debug)("ionic:utils-terminal:info");vr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];vr.CI_ENVIRONMENT_VARIABLES_DETECTED=vr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function DU(){let{shell:t}=gU.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")}vr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&yU(`Environment variables for CI detected: ${vr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);vr.TERMINAL_INFO=Object.freeze({ci:vr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:DU(),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 Jm=x(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var xl=(ve(),ie(we));xl.__exportStar(Lm(),Yi);xl.__exportStar(bS(),Yi);xl.__exportStar(ux(),Yi);xl.__exportStar(cx(),Yi)});var Ol=x(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isFatal=qr.fatal=qr.FatalException=qr.BaseException=void 0;var Al=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};qr.BaseException=Al;var _s=class extends Al{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};qr.FatalException=_s;function bU(t){throw new _s(t)}qr.fatal=bU;function wU(t){return t&&t instanceof _s}qr.isFatal=wU});var Qm={};Qr(Qm,{LOGGER_LEVELS:()=>OU,Logger:()=>Zm,NO_COLORS:()=>lx,StreamOutputStrategy:()=>Fl,TTYOutputStrategy:()=>Xm,TTY_WIDTH:()=>vU,createDefaultLogger:()=>AU,indent:()=>CU,sliceAnsi:()=>EU,stringWidth:()=>_U,stripAnsi:()=>SU,wordWrap:()=>xU});var vU,CU,EU,_U,SU,xU,AU,lx,Fl,Xm,Zm,OU,eg=Qe(()=>{vU=80,CU=t=>t,EU=t=>t,_U=t=>t.length,SU=t=>t,xU=t=>t,AU=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),lx={},Fl=class{constructor(){this.colors=lx,this.stream=process.stdout}},Xm=class extends Fl{constructor(e){super(),this.options=e}},Zm=class{constructor(){}info(){}warn(){}error(){}debug(){}},OU={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var dx=x(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.isInteractive=Oo.checkInteractive=void 0;var FU=(ve(),ie(we)),fx=Jm(),PU=FU.__importDefault(Vi()),kU=Ss(),$U=(...t)=>(0,Oo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(kU.logger.error(`Non-interactive shell detected.
67
- Run the command with ${PU.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Oo.checkInteractive=$U;var IU=()=>fx.TERMINAL_INFO.tty&&!fx.TERMINAL_INFO.ci;Oo.isInteractive=IU});var Pl={};Qr(Pl,{default:()=>px});function px(){throw new Error("Prompts are not supported in this CLI build")}var kl=Qe(()=>{});var Ss=x(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.logSuccess=Jt.logPrompt=Jt.logger=Jt.output=void 0;var tg=(ve(),ie(we)),Fo=(eg(),ie(Qm)),Po=tg.__importDefault(Vi()),TU=dx(),hx={colors:Po.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Jt.output=(0,TU.isInteractive)()?new Fo.TTYOutputStrategy(hx):new Fo.StreamOutputStrategy(hx);Jt.logger=(0,Fo.createDefaultLogger)({output:Jt.output,formatterOptions:{titleize:!1,tags:new Map([[Fo.LOGGER_LEVELS.DEBUG,Po.default.log.DEBUG("[debug]")],[Fo.LOGGER_LEVELS.INFO,Po.default.log.INFO("[info]")],[Fo.LOGGER_LEVELS.WARN,Po.default.log.WARN("[warn]")],[Fo.LOGGER_LEVELS.ERROR,Po.default.log.ERROR("[error]")]])}});async function RU(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>tg.__importStar((eg(),ie(Qm)))),{prompt:n}=await Promise.resolve().then(()=>tg.__importStar((kl(),ie(Pl))));return Jt.logger.log({msg:`${Po.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Jt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Jt.logPrompt=RU;function BU(t){Jt.logger.msg(`${Po.default.success("[success]")} ${t}`)}Jt.logSuccess=BU});var $l=x(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.resolveNode=Ji.requireTS=void 0;var NU=require("fs"),LU=Hi(),jU=require("path"),UU=(t,e)=>{let r=(0,jU.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,LU.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};Ji.requireTS=UU;function MU(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,NU.existsSync)(n)?n:null}}Ji.resolveNode=MU});var mx={};Qr(mx,{default:()=>qU});var qU,gx=Qe(()=>{qU={}});var yx=x(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.buildXmlElement=Hr.writeXML=Hr.parseXML=Hr.readXML=void 0;var HU=(ve(),ie(we)),VU=Hi(),xs=HU.__importDefault((gx(),ie(mx)));async function zU(t){var e;try{let r=await(0,VU.readFile)(t,{encoding:"utf-8"});try{return await xs.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Hr.readXML=zU;function KU(t,e){let r=e!==void 0?new xs.default.Parser({...e}):new xs.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Hr.parseXML=KU;async function GU(t){return new Promise(e=>{let n=new xs.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Hr.writeXML=GU;function WU(t,e){return new xs.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Hr.buildXmlElement=WU});var Cx=x(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.getAllElements=Ie.getFilePath=Ie.getAssets=Ie.getJSModules=Ie.getPluginType=Ie.getPlatformElement=Ie.getPluginPlatform=Ie.printPlugins=Ie.fixName=Ie.getDependencies=Ie.resolvePlugin=Ie.getPlugins=Ie.getIncludedPluginPackages=void 0;var YU=(ve(),ie(we)),JU=Hi(),rg=require("path"),Xi=YU.__importDefault(Vi()),XU=Ol(),ZU=Ss(),Dx=$l(),QU=yx();function bx(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}}Ie.getIncludedPluginPackages=bx;async function e4(t,e){var r;let n=(r=bx(t,e))!==null&&r!==void 0?r:vx(t);return(await Promise.all(n.map(async i=>wx(t,i)))).filter(i=>!!i)}Ie.getPlugins=e4;async function wx(t,e){try{let r=(0,Dx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,XU.fatal)(`Unable to find ${Xi.default.strong(`node_modules/${e}`)}.
68
- Are you sure ${Xi.default.strong(e)} is installed?`);let n=(0,rg.dirname)(r),o=await(0,JU.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:ng(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,rg.join)(n,"plugin.xml"),a=await(0,QU.readXML)(i);return{id:e,name:ng(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Ie.resolvePlugin=wx;function vx(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:{})]}Ie.getDependencies=vx;function ng(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Ie.fixName=ng;function t4(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 ${Xi.default.strong(e)}:
69
- `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Xi.default.strong(e)}, skipped install:
70
- `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Xi.default.strong(e)}:
71
- `;break}n+=t.map(i=>`${i.id}${Xi.default.weak(`@${i.version}`)}`).join(`
72
- `),ZU.logger.info(n)}Ie.printPlugins=t4;function og(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Ie.getPluginPlatform=og;function r4(t,e,r){let n=og(t,e);if(n){let o=n[r];if(o)return o}return[]}Ie.getPlatformElement=r4;function n4(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}Ie.getPluginType=n4;function o4(t,e){return ig(t,e,"js-module")}Ie.getJSModules=o4;function i4(t,e){return ig(t,e,"asset")}Ie.getAssets=i4;function a4(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,Dx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,rg.join)(e.rootPath,r)}Ie.getFilePath=a4;function ig(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=og(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Ie.getAllElements=ig});var Ex={};Qr(Ex,{default:()=>s4});var s4,_x=Qe(()=>{s4={}});var Il=x(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.isInstalled=Mn.getCommandOutput=Mn.runCommand=void 0;var ag=(_x(),ie(Ex));async function Sx(t,e,r={}){let n=new ag.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof ag.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Mn.runCommand=Sx;async function u4(t,e,r={}){try{return(await Sx(t,e,r)).trim()}catch{return null}}Mn.getCommandOutput=u4;async function c4(t){try{await(0,ag.which)(t)}catch{return!1}return!0}Mn.isInstalled=c4});var xx={};Qr(xx,{Comparator:()=>N4,Range:()=>R4,SemVer:()=>B4,clean:()=>p4,coerce:()=>T4,compare:()=>D4,diff:()=>l4,eq:()=>C4,gt:()=>w4,gte:()=>_4,gtr:()=>k4,inc:()=>h4,intersects:()=>I4,lt:()=>v4,lte:()=>S4,ltr:()=>$4,major:()=>m4,maxSatisfying:()=>A4,minSatisfying:()=>O4,minor:()=>g4,neq:()=>E4,outside:()=>P4,parse:()=>f4,patch:()=>y4,rcompare:()=>b4,satisfies:()=>x4,valid:()=>d4,validRange:()=>F4});var l4,f4,d4,p4,h4,m4,g4,y4,D4,b4,w4,v4,C4,E4,_4,S4,x4,A4,O4,F4,P4,k4,$4,I4,T4,R4,B4,N4,Ax=Qe(()=>{l4=()=>null,f4=()=>null,d4=()=>null,p4=()=>null,h4=()=>null,m4=()=>null,g4=()=>null,y4=()=>null,D4=()=>0,b4=()=>0,w4=()=>!1,v4=()=>!1,C4=()=>!1,E4=()=>!0,_4=()=>!1,S4=()=>!1,x4=()=>!1,A4=()=>null,O4=()=>null,F4=()=>null,P4=()=>!1,k4=()=>!1,$4=()=>!1,I4=()=>!1,T4=()=>null,R4=class{},B4=class{},N4=class{}});var jx=x(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.parseApkNameFromFlavor=J.checkJDKMajorVersion=J.resolvePlatform=J.checkPlatformVersions=J.getAddedPlatforms=J.getPlatformTargetName=J.promptForPlatformTarget=J.promptForPlatform=J.isValidEnterprisePlatform=J.getKnownEnterprisePlatforms=J.isValidCommunityPlatform=J.getKnownCommunityPlatforms=J.isValidPlatform=J.getKnownPlatforms=J.selectPlatforms=J.getProjectPlatformDirectory=J.getCLIVersion=J.getCoreVersion=J.getCapacitorPackageVersion=J.requireCapacitorPackage=J.getCapacitorPackage=J.runTask=J.runPlatformHook=J.runHooks=J.wait=J.checkAppName=J.checkAppId=J.checkAppDir=J.checkAppConfig=J.checkCapacitorPlatform=J.checkPackage=J.checkWebDir=J.check=void 0;var Os=(ve(),ie(we)),Ox=Jm(),qn=Hi(),ko=require("path"),$e=Os.__importDefault(Vi()),$o=Ol(),Px=Ss(),L4=Cx(),Fx=wu(),As=$l(),j4=Il();async function U4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
- `)}J.check=U4;async function M4(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,qn.pathExists)(t.app.webDirAbs)?await(0,qn.pathExists)((0,ko.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${$e.default.strong((0,Ox.prettyPath)(t.app.webDirAbs))}) must contain an ${$e.default.strong("index.html")} file.
74
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${$e.default.strong((0,Ox.prettyPath)(t.app.webDirAbs))}.
75
- Please create it and make sure it has an ${$e.default.strong("index.html")} file. You can change the path of this directory in ${$e.default.strong(t.app.extConfigName)} (${$e.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${$e.default.input("npm run build")}). More info: ${$e.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}J.checkWebDir=M4;async function q4(){return await(0,qn.pathExists)("package.json")||await(0,qn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
64
+ ${ax(r)}`)}Ye.wordWrap=mU;function gU(t){t=sx(t);let e=process.cwd(),r=dn.dirname(t),n=cU.homedir(),o=Math.abs(r.split(dn.sep).length-e.split(dn.sep).length);if(e===r)return"."+dn.sep+dn.basename(t);if(r.startsWith(e))return"."+dn.sep+t.substring(e.length+1);if(o<=2){let i=dn.relative(e,t);return i||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+dn.sep+t.substring(n.length+1)}return t}Ye.prettyPath=gU;function sx(t){return dn.resolve(dU(t))}Ye.expandPath=sx;function ux(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(a=>xl(a))),o=n>e?n+1:e,i=r.repeat(o);return t.map(a=>ix(i,0,o-xl(a)))}Ye.generateFillSpaceStringList=ux;function yU(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(f=>[f]):t[0].map(()=>[]);for(let f of t){let d=0,h=f.map(p=>{let m=p.split(`
65
+ `);return d=Math.max(d,m.length),m});for(let p in f)a[p]&&a[p].push(...h[p],...Array(d-h[p].length).fill(""))}let s=a.map((f,d)=>{if(d<i-1){let h=ux(f);return f.map((p,m)=>`${p}${h[m]}${r===""?"":`${r} `}`)}else return f}),u=0,c=s.reduce((f,d)=>f.map((h,p)=>{let m=f[p]+d[p];return u=Math.max(u,xl(m)),m}));return o&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
66
+ `)}Ye.columnar=yU});var lx=x(vr=>{"use strict";Object.defineProperty(vr,"__esModule",{value:!0});vr.TERMINAL_INFO=vr.CI_ENVIRONMENT_VARIABLES_DETECTED=vr.CI_ENVIRONMENT_VARIABLES=void 0;var DU=(ve(),ae(we)),bU=Am(),wU=DU.__importStar(require("os")),vU=(0,bU.debug)("ionic:utils-terminal:info");vr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];vr.CI_ENVIRONMENT_VARIABLES_DETECTED=vr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function CU(){let{shell:t}=wU.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")}vr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&vU(`Environment variables for CI detected: ${vr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);vr.TERMINAL_INFO=Object.freeze({ci:vr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:CU(),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 Xm=x(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var Al=(ve(),ae(we));Al.__exportStar(jm(),Ji);Al.__exportStar(wS(),Ji);Al.__exportStar(cx(),Ji);Al.__exportStar(lx(),Ji)});var Fl=x(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isFatal=qr.fatal=qr.FatalException=qr.BaseException=void 0;var Ol=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};qr.BaseException=Ol;var Ss=class extends Ol{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};qr.FatalException=Ss;function EU(t){throw new Ss(t)}qr.fatal=EU;function _U(t){return t&&t instanceof Ss}qr.isFatal=_U});var eg={};Qr(eg,{LOGGER_LEVELS:()=>$U,Logger:()=>Qm,NO_COLORS:()=>fx,StreamOutputStrategy:()=>kl,TTYOutputStrategy:()=>Zm,TTY_WIDTH:()=>SU,createDefaultLogger:()=>PU,indent:()=>xU,sliceAnsi:()=>AU,stringWidth:()=>OU,stripAnsi:()=>FU,wordWrap:()=>kU});var SU,xU,AU,OU,FU,kU,PU,fx,kl,Zm,Qm,$U,tg=et(()=>{SU=80,xU=t=>t,AU=t=>t,OU=t=>t.length,FU=t=>t,kU=t=>t,PU=()=>({info:console.log,warn:console.warn,error:console.error,debug:console.debug}),fx={},kl=class{constructor(){this.colors=fx,this.stream=process.stdout}},Zm=class extends kl{constructor(e){super(),this.options=e}},Qm=class{constructor(){}info(){}warn(){}error(){}debug(){}},$U={DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"}});var px=x(Fo=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});Fo.isInteractive=Fo.checkInteractive=void 0;var IU=(ve(),ae(we)),dx=Xm(),TU=IU.__importDefault(zi()),RU=xs(),BU=(...t)=>(0,Fo.isInteractive)()?!0:t.length?t.filter(e=>!e).length?(RU.logger.error(`Non-interactive shell detected.
67
+ Run the command with ${TU.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Fo.checkInteractive=BU;var NU=()=>dx.TERMINAL_INFO.tty&&!dx.TERMINAL_INFO.ci;Fo.isInteractive=NU});var Pl={};Qr(Pl,{default:()=>hx});function hx(){throw new Error("Prompts are not supported in this CLI build")}var $l=et(()=>{});var xs=x(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.logSuccess=Jt.logPrompt=Jt.logger=Jt.output=void 0;var rg=(ve(),ae(we)),ko=(tg(),ae(eg)),Po=rg.__importDefault(zi()),LU=px(),mx={colors:Po.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Jt.output=(0,LU.isInteractive)()?new ko.TTYOutputStrategy(mx):new ko.StreamOutputStrategy(mx);Jt.logger=(0,ko.createDefaultLogger)({output:Jt.output,formatterOptions:{titleize:!1,tags:new Map([[ko.LOGGER_LEVELS.DEBUG,Po.default.log.DEBUG("[debug]")],[ko.LOGGER_LEVELS.INFO,Po.default.log.INFO("[info]")],[ko.LOGGER_LEVELS.WARN,Po.default.log.WARN("[warn]")],[ko.LOGGER_LEVELS.ERROR,Po.default.log.ERROR("[error]")]])}});async function jU(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>rg.__importStar((tg(),ae(eg)))),{prompt:n}=await Promise.resolve().then(()=>rg.__importStar(($l(),ae(Pl))));return Jt.logger.log({msg:`${Po.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Jt.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Jt.logPrompt=jU;function UU(t){Jt.logger.msg(`${Po.default.success("[success]")} ${t}`)}Jt.logSuccess=UU});var Il=x(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});Xi.resolveNode=Xi.requireTS=void 0;var MU=require("fs"),qU=Vi(),HU=require("path"),VU=(t,e)=>{let r=(0,HU.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(o,i)=>{var a;let s=(0,qU.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};Xi.requireTS=VU;function zU(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,MU.existsSync)(n)?n:null}}Xi.resolveNode=zU});var gx={};Qr(gx,{default:()=>KU});var KU,yx=et(()=>{KU={}});var Dx=x(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.buildXmlElement=Hr.writeXML=Hr.parseXML=Hr.readXML=void 0;var GU=(ve(),ae(we)),WU=Vi(),As=GU.__importDefault((yx(),ae(gx)));async function YU(t){var e;try{let r=await(0,WU.readFile)(t,{encoding:"utf-8"});try{return await As.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Hr.readXML=YU;function JU(t,e){let r=e!==void 0?new As.default.Parser({...e}):new As.default.Parser,n;return r.parseString(t,(o,i)=>{o||(n=i)}),n}Hr.parseXML=JU;async function XU(t){return new Promise(e=>{let n=new As.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Hr.writeXML=XU;function ZU(t,e){return new As.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Hr.buildXmlElement=ZU});var Ex=x(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.getAllElements=Ie.getFilePath=Ie.getAssets=Ie.getJSModules=Ie.getPluginType=Ie.getPlatformElement=Ie.getPluginPlatform=Ie.printPlugins=Ie.fixName=Ie.getDependencies=Ie.resolvePlugin=Ie.getPlugins=Ie.getIncludedPluginPackages=void 0;var QU=(ve(),ae(we)),e4=Vi(),ng=require("path"),Zi=QU.__importDefault(zi()),t4=Fl(),r4=xs(),bx=Il(),n4=Dx();function wx(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}}Ie.getIncludedPluginPackages=wx;async function o4(t,e){var r;let n=(r=wx(t,e))!==null&&r!==void 0?r:Cx(t);return(await Promise.all(n.map(async i=>vx(t,i)))).filter(i=>!!i)}Ie.getPlugins=o4;async function vx(t,e){try{let r=(0,bx.resolveNode)(t.app.rootDir,e,"package.json");r||(0,t4.fatal)(`Unable to find ${Zi.default.strong(`node_modules/${e}`)}.
68
+ Are you sure ${Zi.default.strong(e)} is installed?`);let n=(0,ng.dirname)(r),o=await(0,e4.readJSON)(r);if(!o)return null;if(o.capacitor)return{id:e,name:og(e),version:o.version,rootPath:n,repository:o.repository,manifest:o.capacitor};let i=(0,ng.join)(n,"plugin.xml"),a=await(0,n4.readXML)(i);return{id:e,name:og(e),version:o.version,rootPath:n,repository:o.repository,xml:a.plugin}}catch{}return null}Ie.resolvePlugin=vx;function Cx(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:{})]}Ie.getDependencies=Cx;function og(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Ie.fixName=og;function i4(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)}:
69
+ `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${o} for ${Zi.default.strong(e)}, skipped install:
70
+ `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${o} for ${Zi.default.strong(e)}:
71
+ `;break}n+=t.map(i=>`${i.id}${Zi.default.weak(`@${i.version}`)}`).join(`
72
+ `),r4.logger.info(n)}Ie.printPlugins=i4;function ig(t,e){return t.xml.platform?t.xml.platform.filter(function(o){return o.$.name===e})[0]:[]}Ie.getPluginPlatform=ig;function a4(t,e,r){let n=ig(t,e);if(n){let o=n[r];if(o)return o}return[]}Ie.getPlatformElement=a4;function s4(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}Ie.getPluginType=s4;function u4(t,e){return ag(t,e,"js-module")}Ie.getJSModules=u4;function c4(t,e){return ag(t,e,"asset")}Ie.getAssets=c4;function l4(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,bx.resolveNode)(t.app.rootDir,...n);if(!o)throw new Error(`Can't resolve module ${n[0]}`);return o}return(0,ng.join)(e.rootPath,r)}Ie.getFilePath=l4;function ag(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let o=ig(t,e);return o?.[r]&&(n=n.concat(o[r])),n}Ie.getAllElements=ag});var _x={};Qr(_x,{default:()=>f4});var f4,Sx=et(()=>{f4={}});var Tl=x(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.isInstalled=Mn.getCommandOutput=Mn.runCommand=void 0;var sg=(Sx(),ae(_x));async function xx(t,e,r={}){let n=new sg.Subprocess(t,e,r);try{return await n.output()}catch(o){throw o instanceof sg.SubprocessError?o.output?o.output:o.cause?`${o.message} ${o.cause.toString()}`:o.code?o.code:"Unknown error":o}}Mn.runCommand=xx;async function d4(t,e,r={}){try{return(await xx(t,e,r)).trim()}catch{return null}}Mn.getCommandOutput=d4;async function p4(t){try{await(0,sg.which)(t)}catch{return!1}return!0}Mn.isInstalled=p4});var Ax={};Qr(Ax,{Comparator:()=>M4,Range:()=>j4,SemVer:()=>U4,clean:()=>y4,coerce:()=>L4,compare:()=>C4,diff:()=>h4,eq:()=>x4,gt:()=>_4,gte:()=>O4,gtr:()=>R4,inc:()=>D4,intersects:()=>N4,lt:()=>S4,lte:()=>F4,ltr:()=>B4,major:()=>b4,maxSatisfying:()=>P4,minSatisfying:()=>$4,minor:()=>w4,neq:()=>A4,outside:()=>T4,parse:()=>m4,patch:()=>v4,rcompare:()=>E4,satisfies:()=>k4,valid:()=>g4,validRange:()=>I4});var h4,m4,g4,y4,D4,b4,w4,v4,C4,E4,_4,S4,x4,A4,O4,F4,k4,P4,$4,I4,T4,R4,B4,N4,L4,j4,U4,M4,Ox=et(()=>{h4=()=>null,m4=()=>null,g4=()=>null,y4=()=>null,D4=()=>null,b4=()=>null,w4=()=>null,v4=()=>null,C4=()=>0,E4=()=>0,_4=()=>!1,S4=()=>!1,x4=()=>!1,A4=()=>!0,O4=()=>!1,F4=()=>!1,k4=()=>!1,P4=()=>null,$4=()=>null,I4=()=>null,T4=()=>!1,R4=()=>!1,B4=()=>!1,N4=()=>!1,L4=()=>null,j4=class{},U4=class{},M4=class{}});var Ux=x(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.parseApkNameFromFlavor=J.checkJDKMajorVersion=J.resolvePlatform=J.checkPlatformVersions=J.getAddedPlatforms=J.getPlatformTargetName=J.promptForPlatformTarget=J.promptForPlatform=J.isValidEnterprisePlatform=J.getKnownEnterprisePlatforms=J.isValidCommunityPlatform=J.getKnownCommunityPlatforms=J.isValidPlatform=J.getKnownPlatforms=J.selectPlatforms=J.getProjectPlatformDirectory=J.getCLIVersion=J.getCoreVersion=J.getCapacitorPackageVersion=J.requireCapacitorPackage=J.getCapacitorPackage=J.runTask=J.runPlatformHook=J.runHooks=J.wait=J.checkAppName=J.checkAppId=J.checkAppDir=J.checkAppConfig=J.checkCapacitorPlatform=J.checkPackage=J.checkWebDir=J.check=void 0;var Fs=(ve(),ae(we)),Fx=Xm(),qn=Vi(),$o=require("path"),$e=Fs.__importDefault(zi()),Io=Fl(),Px=xs(),q4=Ex(),kx=vu(),Os=Il(),H4=Tl();async function V4(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
73
+ `)}J.check=V4;async function z4(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,qn.pathExists)(t.app.webDirAbs)?await(0,qn.pathExists)((0,$o.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${$e.default.strong((0,Fx.prettyPath)(t.app.webDirAbs))}) must contain an ${$e.default.strong("index.html")} file.
74
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${$e.default.strong((0,Fx.prettyPath)(t.app.webDirAbs))}.
75
+ Please create it and make sure it has an ${$e.default.strong("index.html")} file. You can change the path of this directory in ${$e.default.strong(t.app.extConfigName)} (${$e.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${$e.default.input("npm run build")}). More info: ${$e.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}J.checkWebDir=z4;async function K4(){return await(0,qn.pathExists)("package.json")||await(0,qn.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
76
76
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
77
- More info: ${$e.default.strong("https://docs.npmjs.com/cli/init")}`}J.checkPackage=q4;async function H4(t,e){return await ug(t,e)?null:`Could not find the ${$e.default.input(e)} platform.
78
- You must install it in your project first, e.g. w/ ${$e.default.input(`npm install @capacitor/${e}`)}`}J.checkCapacitorPlatform=H4;async function V4(t){if(!t.app.appId)return`Missing ${$e.default.input("appId")} for new platform.
77
+ More info: ${$e.default.strong("https://docs.npmjs.com/cli/init")}`}J.checkPackage=K4;async function G4(t,e){return await cg(t,e)?null:`Could not find the ${$e.default.input(e)} platform.
78
+ You must install it in your project first, e.g. w/ ${$e.default.input(`npm install @capacitor/${e}`)}`}J.checkCapacitorPlatform=G4;async function W4(t){if(!t.app.appId)return`Missing ${$e.default.input("appId")} for new platform.
79
79
  Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${$e.default.input("appName")} for new platform.
80
- Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;let e=await kx(t,t.app.appId);if(e)return e;let r=await $x(t,t.app.appName);return r||null}J.checkAppConfig=V4;async function z4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}J.checkAppDir=z4;async function kx(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
80
+ Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init")}.`;let e=await $x(t,t.app.appId);if(e)return e;let r=await Ix(t,t.app.appName);return r||null}J.checkAppConfig=W4;async function Y4(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}J.checkAppDir=Y4;async function $x(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
81
81
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
82
82
  - Must be in Java package form with no dashes (ex: com.example.app)
83
83
  - It must have at least two segments (one or more dots).
@@ -85,123 +85,123 @@ Please add it in ${t.app.extConfigName} or run ${$e.default.input("npx cap init"
85
85
  - All characters must be alphanumeric or an underscore [a-zA-Z][a-zA-Z0-9]+.
86
86
 
87
87
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
88
- `:"Invalid App ID. App ID is required and cannot be blank."}J.checkAppId=kx;async function $x(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}J.checkAppName=$x;async function K4(t){return new Promise(e=>setTimeout(e,t))}J.wait=K4;async function G4(t,e,r,n){await sg(t,e,r,n);let o=await(0,L4.getPlugins)(t,e);for(let i of o)await sg(t,e,i.rootPath,n)}J.runHooks=G4;async function sg(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Os.__importStar(require("child_process"))),a;(0,Fx.isNXMonorepo)(r)?a=await(0,qn.readJSON)((0,ko.join)((0,Fx.findNXMonorepoRoot)(r),"package.json")):a=await(0,qn.readJSON)((0,ko.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 f=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}});f.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),f.on("error",d=>{c(d)})})}J.runPlatformHook=sg;async function W4(t,e){let r=Px.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}J.runTask=W4;async function ug(t,e){let r=(0,As.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,qn.readJSON)(r):null}J.getCapacitorPackage=ug;async function Ix(t,e){let r=await ug(t,e);return r||(0,$o.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
- Are you sure ${$e.default.strong(`@capacitor/${e}`)} is installed?`),r}J.requireCapacitorPackage=Ix;async function Rl(t,e){return(await Ix(t,e)).version}J.getCapacitorPackageVersion=Rl;async function Tx(t){return Rl(t,"core")}J.getCoreVersion=Tx;async function Y4(t){return Rl(t,"cli")}J.getCLIVersion=Y4;function J4(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 Tl(t,e){let r=J4(t,e);return r&&await(0,qn.pathExists)(r)?r:null}J.getProjectPlatformDirectory=Tl;async function X4(t,e){if(e){let r=e.toLowerCase().trim();return await lg(r)?await Tl(t,r)||(r==="web"&&(0,$o.fatal)(`Could not find the web platform directory.
90
- Make sure ${$e.default.strong(t.app.webDir)} exists.`),(0,$o.fatal)(`${$e.default.strong(r)} platform has not been added yet.
91
- See the docs for adding the ${$e.default.strong(r)} platform: ${$e.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,$o.fatal)(`Invalid platform: ${$e.default.input(r)}`),[r]}return Lx(t)}J.selectPlatforms=X4;async function cg(){return["web","android","ios"]}J.getKnownPlatforms=cg;async function lg(t){return(await cg()).includes(t)}J.isValidPlatform=lg;async function Rx(){return["electron"]}J.getKnownCommunityPlatforms=Rx;async function Z4(t){return(await Rx()).includes(t)}J.isValidCommunityPlatform=Z4;async function Bx(){return["windows"]}J.getKnownEnterprisePlatforms=Bx;async function Q4(t){return(await Bx()).includes(t)}J.isValidEnterprisePlatform=Q4;async function eM(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Os.__importStar((kl(),ie(Pl))));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 lg(o)){let i=await cg();(0,$o.fatal)(`Invalid platform: ${$e.default.input(o)}.
92
- Valid platforms include: ${i.join(", ")}`)}return o}J.promptForPlatform=eM;async function tM(t,e,r,n){let{prompt:o}=await Promise.resolve().then(()=>Os.__importStar((kl(),ie(Pl)))),i=t.filter(u=>u.id!==void 0);if(!e)return i.length===1?i[0]:(await o([{type:"select",name:"target",message:"Please choose a target device:",choices:i.map(c=>({title:`${Nx(c)} (${c.id})`,value:c}))}],{onCancel:()=>process.exit(1)})).target;let a=e.trim(),s=t.find(u=>{var c;if(n===!0){let f=(c=u.name)!==null&&c!==void 0?c:u.model;return f&&(f=f.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"')),r?f===a&&u.sdkVersion===r:f===a}return u.id===a});if(!s){if(n){let u=a;r&&(u+=` [${r}]`),(0,$o.fatal)(`Invalid target name: ${$e.default.input(u)}.
88
+ `:"Invalid App ID. App ID is required and cannot be blank."}J.checkAppId=$x;async function Ix(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}J.checkAppName=Ix;async function J4(t){return new Promise(e=>setTimeout(e,t))}J.wait=J4;async function X4(t,e,r,n){await ug(t,e,r,n);let o=await(0,q4.getPlugins)(t,e);for(let i of o)await ug(t,e,i.rootPath,n)}J.runHooks=X4;async function ug(t,e,r,n){var o;let{spawn:i}=await Promise.resolve().then(()=>Fs.__importStar(require("child_process"))),a;(0,kx.isNXMonorepo)(r)?a=await(0,qn.readJSON)((0,$o.join)((0,kx.findNXMonorepoRoot)(r),"package.json")):a=await(0,qn.readJSON)((0,$o.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 f=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}});f.on("close",d=>{d===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${d} while running command: ${s}`))}),f.on("error",d=>{c(d)})})}J.runPlatformHook=ug;async function Z4(t,e){let r=Px.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}J.runTask=Z4;async function cg(t,e){let r=(0,Os.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,qn.readJSON)(r):null}J.getCapacitorPackage=cg;async function Tx(t,e){let r=await cg(t,e);return r||(0,Io.fatal)(`Unable to find node_modules/@capacitor/${e}.
89
+ Are you sure ${$e.default.strong(`@capacitor/${e}`)} is installed?`),r}J.requireCapacitorPackage=Tx;async function Bl(t,e){return(await Tx(t,e)).version}J.getCapacitorPackageVersion=Bl;async function Rx(t){return Bl(t,"core")}J.getCoreVersion=Rx;async function Q4(t){return Bl(t,"cli")}J.getCLIVersion=Q4;function eM(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 Rl(t,e){let r=eM(t,e);return r&&await(0,qn.pathExists)(r)?r:null}J.getProjectPlatformDirectory=Rl;async function tM(t,e){if(e){let r=e.toLowerCase().trim();return await fg(r)?await Rl(t,r)||(r==="web"&&(0,Io.fatal)(`Could not find the web platform directory.
90
+ Make sure ${$e.default.strong(t.app.webDir)} exists.`),(0,Io.fatal)(`${$e.default.strong(r)} platform has not been added yet.
91
+ See the docs for adding the ${$e.default.strong(r)} platform: ${$e.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Io.fatal)(`Invalid platform: ${$e.default.input(r)}`),[r]}return jx(t)}J.selectPlatforms=tM;async function lg(){return["web","android","ios"]}J.getKnownPlatforms=lg;async function fg(t){return(await lg()).includes(t)}J.isValidPlatform=fg;async function Bx(){return["electron"]}J.getKnownCommunityPlatforms=Bx;async function rM(t){return(await Bx()).includes(t)}J.isValidCommunityPlatform=rM;async function Nx(){return["windows"]}J.getKnownEnterprisePlatforms=Nx;async function nM(t){return(await Nx()).includes(t)}J.isValidEnterprisePlatform=nM;async function oM(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Fs.__importStar(($l(),ae(Pl))));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 fg(o)){let i=await lg();(0,Io.fatal)(`Invalid platform: ${$e.default.input(o)}.
92
+ Valid platforms include: ${i.join(", ")}`)}return o}J.promptForPlatform=oM;async function iM(t,e,r,n){let{prompt:o}=await Promise.resolve().then(()=>Fs.__importStar(($l(),ae(Pl)))),i=t.filter(u=>u.id!==void 0);if(!e)return i.length===1?i[0]:(await o([{type:"select",name:"target",message:"Please choose a target device:",choices:i.map(c=>({title:`${Lx(c)} (${c.id})`,value:c}))}],{onCancel:()=>process.exit(1)})).target;let a=e.trim(),s=t.find(u=>{var c;if(n===!0){let f=(c=u.name)!==null&&c!==void 0?c:u.model;return f&&(f=f.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"')),r?f===a&&u.sdkVersion===r:f===a}return u.id===a});if(!s){if(n){let u=a;r&&(u+=` [${r}]`),(0,Io.fatal)(`Invalid target name: ${$e.default.input(u)}.
93
93
  Valid targets are:
94
94
  ${t.map(c=>{var f;return`${(f=c.name)!==null&&f!==void 0?f:c.model} [${c.sdkVersion}]`}).join(`
95
- `)}`)}(0,$o.fatal)(`Invalid target ID: ${$e.default.input(a)}.
95
+ `)}`)}(0,Io.fatal)(`Invalid target ID: ${$e.default.input(a)}.
96
96
  Valid targets are:
97
97
  ${t.map(u=>u.id).join(`
98
- `)}`)}return s}J.promptForPlatformTarget=tM;function Nx(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"})`:""}`}J.getPlatformTargetName=Nx;async function Lx(t){let e=[];return await Tl(t,t.android.name)&&e.push(t.android.name),await Tl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}J.getAddedPlatforms=Lx;async function rM(t,e){let r=await Promise.resolve().then(()=>Os.__importStar((Ax(),ie(xx)))),n=await Tx(t),o=await Rl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&Px.logger.warn(`${$e.default.strong("@capacitor/core")}${$e.default.weak(`@${n}`)} version doesn't match ${$e.default.strong(`@capacitor/${e}`)}${$e.default.weak(`@${o}`)} version.
99
- Consider updating to a matching version, e.g. w/ ${$e.default.input(`npm install @capacitor/core@${o}`)}`)}J.checkPlatformVersions=rM;function nM(t,e){if(e[0]!=="@"){let n=(0,As.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ko.dirname)(n);let o=(0,As.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,ko.dirname)(o);let i=(0,As.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,ko.dirname)(i)}let r=(0,As.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ko.dirname)(r):null}J.resolvePlatform=nM;async function oM(){try{let t=await(0,j4.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}}J.checkJDKMajorVersion=oM;function iM(t){let e=t.replace(/([A-Z])/g,"-$1").toLowerCase();return e.startsWith("-")&&(e=e.replace("-","")),`app-${e?`${e}-`:""}debug.apk`}J.parseApkNameFromFlavor=iM});var Ux=x(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.tryFn=void 0;var aM=async(t,...e)=>{try{return await t(...e)}catch{}return null};Bl.tryFn=aM});var Mx=x(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.formatJSObject=void 0;var sM=(ve(),ie(we)),uM=sM.__importDefault(require("util"));function cM(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return uM.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Nl.formatJSObject=cM});var qx=x(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.lazy=Hn.LazyPromise=Hn.allSerial=void 0;function lM(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Hn.allSerial=lM;var Ll=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)}};Hn.LazyPromise=Ll;function fM(t){return new Ll(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Hn.lazy=fM});var zx=x(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.writeConfig=ht.loadConfig=ht.CONFIG_FILE_NAME_JSON=ht.CONFIG_FILE_NAME_JS=ht.CONFIG_FILE_NAME_TS=void 0;var pg=(ve(),ie(we)),dM=pg.__importDefault(xm()),jt=Hi(),le=require("path"),Io=pg.__importDefault(Vi()),pM=jx(),jl=Ol(),hM=Ss(),fg=Ux(),mM=Mx(),Hx=wu(),Vx=$l(),Zi=qx(),gM=Il(),dg=(0,dM.default)("capacitor:config");ht.CONFIG_FILE_NAME_TS="capacitor.config.ts";ht.CONFIG_FILE_NAME_JS="capacitor.config.js";ht.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function yM(){var t,e,r,n;let o=process.cwd(),i=(0,le.dirname)(__dirname),a=await vM(o),s=await(async()=>{var h,m;if((0,Hx.isNXMonorepo)(o)){let g=(0,Hx.findNXMonorepoRoot)(o),D=await(0,fg.tryFn)(jt.readJSON,(0,le.resolve)(g,"package.json")),v=(h=D?.devDependencies)!==null&&h!==void 0?h:{},E=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:v,dependencies:E}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",f=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await CM(i),p={android:await EM(o,a.extConfig,d),ios:await _M(o,a.extConfig),web:await SM(o,f),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:f,webDirAbs:(0,le.resolve)(o,f),package:(n=await(0,fg.tryFn)(jt.readJSON,(0,le.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return dg("config: %O",p),p}ht.loadConfig=yM;async function DM(t,e){switch((0,le.extname)(e)){case".json":{await(0,jt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,jt.writeFile)(e,kM(t));break}}}ht.writeConfig=DM;async function bM(t,e,r){var n;try{let o=(0,Vx.resolveNode)(t,"typescript");o||(0,jl.fatal)(`Could not find installation of TypeScript.
100
- To use ${Io.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Io.default.input("npm install -D typescript")}`);let i=require(o),a=(0,Vx.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,jl.isFatal)(o)||(0,jl.fatal)(`Parsing ${Io.default.strong(e)} failed.
98
+ `)}`)}return s}J.promptForPlatformTarget=iM;function Lx(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"})`:""}`}J.getPlatformTargetName=Lx;async function jx(t){let e=[];return await Rl(t,t.android.name)&&e.push(t.android.name),await Rl(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}J.getAddedPlatforms=jx;async function aM(t,e){let r=await Promise.resolve().then(()=>Fs.__importStar((Ox(),ae(Ax)))),n=await Rx(t),o=await Bl(t,e);(r.diff(n,o)==="minor"||r.diff(n,o)==="major")&&Px.logger.warn(`${$e.default.strong("@capacitor/core")}${$e.default.weak(`@${n}`)} version doesn't match ${$e.default.strong(`@capacitor/${e}`)}${$e.default.weak(`@${o}`)} version.
99
+ Consider updating to a matching version, e.g. w/ ${$e.default.input(`npm install @capacitor/core@${o}`)}`)}J.checkPlatformVersions=aM;function sM(t,e){if(e[0]!=="@"){let n=(0,Os.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,$o.dirname)(n);let o=(0,Os.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(o)return(0,$o.dirname)(o);let i=(0,Os.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(i)return(0,$o.dirname)(i)}let r=(0,Os.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,$o.dirname)(r):null}J.resolvePlatform=sM;async function uM(){try{let t=await(0,H4.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}}J.checkJDKMajorVersion=uM;function cM(t){let e=t.replace(/([A-Z])/g,"-$1").toLowerCase();return e.startsWith("-")&&(e=e.replace("-","")),`app-${e?`${e}-`:""}debug.apk`}J.parseApkNameFromFlavor=cM});var Mx=x(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});Nl.tryFn=void 0;var lM=async(t,...e)=>{try{return await t(...e)}catch{}return null};Nl.tryFn=lM});var qx=x(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.formatJSObject=void 0;var fM=(ve(),ae(we)),dM=fM.__importDefault(require("util"));function pM(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return dM.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Ll.formatJSObject=pM});var Hx=x(Hn=>{"use strict";Object.defineProperty(Hn,"__esModule",{value:!0});Hn.lazy=Hn.LazyPromise=Hn.allSerial=void 0;function hM(t){return t.reduce((e,r)=>e.then(n=>r().then(o=>n.concat(o))),Promise.resolve([]))}Hn.allSerial=hM;var jl=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)}};Hn.LazyPromise=jl;function mM(t){return new jl(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Hn.lazy=mM});var Kx=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 hg=(ve(),ae(we)),gM=hg.__importDefault(Am()),jt=Vi(),de=require("path"),To=hg.__importDefault(zi()),yM=Ux(),Ul=Fl(),DM=xs(),dg=Mx(),bM=qx(),Vx=vu(),zx=Il(),Qi=Hx(),wM=Tl(),pg=(0,gM.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 vM(){var t,e,r,n;let o=process.cwd(),i=(0,de.dirname)(__dirname),a=await SM(o),s=await(async()=>{var p,m;if((0,Vx.isNXMonorepo)(o)){let g=(0,Vx.findNXMonorepoRoot)(o),D=await(0,dg.tryFn)(jt.readJSON,(0,de.resolve)(g,"package.json")),v=(p=D?.devDependencies)!==null&&p!==void 0?p:{},_=(m=D?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:v,dependencies:_}}return{}})(),u=(t=a.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=a.extConfig.appName)!==null&&e!==void 0?e:"",f=(r=a.extConfig.webDir)!==null&&r!==void 0?r:"www",d=await xM(i),h={android:await AM(o,a.extConfig,d),ios:await OM(o,a.extConfig),web:await FM(o,f),cli:d,app:{rootDir:o,appId:u,appName:c,webDir:f,webDirAbs:(0,de.resolve)(o,f),package:(n=await(0,dg.tryFn)(jt.readJSON,(0,de.resolve)(o,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...s},...a}};return pg("config: %O",h),h}pt.loadConfig=vM;async function CM(t,e){switch((0,de.extname)(e)){case".json":{await(0,jt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,jt.writeFile)(e,RM(t));break}}}pt.writeConfig=CM;async function EM(t,e,r){var n;try{let o=(0,zx.resolveNode)(t,"typescript");o||(0,Ul.fatal)(`Could not find installation of TypeScript.
100
+ To use ${To.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${To.default.input("npm install -D typescript")}`);let i=require(o),a=(0,zx.requireTS)(i,r),s=a.default?await a.default:a;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:s}}catch(o){throw(0,Ul.isFatal)(o)||(0,Ul.fatal)(`Parsing ${To.default.strong(e)} failed.
101
101
 
102
- ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function wM(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,jl.fatal)(`Parsing ${Io.default.strong(e)} failed.
102
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`),o}}async function _M(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(o){(0,Ul.fatal)(`Parsing ${To.default.strong(e)} failed.
103
103
 
104
- ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function vM(t){var e;let r=(0,le.resolve)(t,ht.CONFIG_FILE_NAME_TS);if(await(0,jt.pathExists)(r))return bM(t,ht.CONFIG_FILE_NAME_TS,r);let n=(0,le.resolve)(t,ht.CONFIG_FILE_NAME_JS);if(await(0,jt.pathExists)(n))return wM(t,ht.CONFIG_FILE_NAME_JS,n);let o=(0,le.resolve)(t,ht.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:ht.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,fg.tryFn)(jt.readJSON,o))!==null&&e!==void 0?e:{}}}async function CM(t){let e="assets",r=(0,le.join)(t,e),n="ios-spm-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,le.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,le.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,le.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,le.resolve)(r,a)}},package:await(0,jt.readJSON)((0,le.resolve)(t,"package.json")),os:xM(process.platform)}}async function EM(t,e,r){var n,o,i,a,s,u,c,f,d,p,h,m,g,D,v,E,y;let _="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",k=(0,le.resolve)(t,S),T="app",B=`${T}/src`,F=`${B}/main`,L=`${F}/assets`,A=`${L}/public`,q=`${F}/res`,j=`${T}/build/outputs/apk/`,Z=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(j=`${j}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let P=(0,pM.parseApkNameFromFlavor)(Z),b=`${j}/debug`,w="capacitor-cordova-android-plugins",C=(0,Zi.lazy)(()=>FM(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(f=e.android)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(h=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.keystoreAlias,keystoreAliasPassword:(g=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||g===void 0?void 0:g.keystoreAliasPassword,signingType:(v=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||v===void 0?void 0:v.signingType,releaseType:(y=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||y===void 0?void 0:y.releaseType};return{name:_,minVersion:"24",studioPath:C,platformDir:S,platformDirAbs:k,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,le.resolve)(k,w),appDir:T,appDirAbs:(0,le.resolve)(k,T),srcDir:B,srcDirAbs:(0,le.resolve)(k,B),srcMainDir:F,srcMainDirAbs:(0,le.resolve)(k,F),assetsDir:L,assetsDirAbs:(0,le.resolve)(k,L),webDir:A,webDirAbs:(0,le.resolve)(k,A),resDir:q,resDirAbs:(0,le.resolve)(k,q),apkName:P,buildOutputDir:b,buildOutputDirAbs:(0,le.resolve)(k,b),flavor:Z,buildOptions:O}}async function _M(t,e){var r,n,o,i,a,s,u,c,f,d,p,h;let g=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,le.resolve)(t,g),v=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",E="App",y=(0,le.resolve)(D,E),_=`${E}/App`,S=(0,le.resolve)(D,_),k=`${E}/App.xcodeproj`,T=(0,le.resolve)(D,k),B=(0,Zi.lazy)(()=>AM(y)),F=(0,Zi.lazy)(()=>PM(t,D,y)),L=(0,Zi.lazy)(()=>OM(y,S,T)),A="capacitor-cordova-ios-plugins",q={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(d=(f=e.ios)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(h=(p=e.ios)===null||p===void 0?void 0:p.buildOptions)===null||h===void 0?void 0:h.provisioningProfile};return{name:"ios",minVersion:"15.0",platformDir:g,platformDirAbs:D,scheme:v,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,le.resolve)(D,A),nativeProjectDir:E,nativeProjectDirAbs:y,nativeTargetDir:_,nativeTargetDirAbs:S,nativeXcodeProjDir:k,nativeXcodeProjDirAbs:T,nativeXcodeWorkspaceDir:(0,Zi.lazy)(async()=>(0,le.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Zi.lazy)(async()=>(0,le.relative)(D,await L)),webDirAbs:L,podPath:F,buildOptions:q}}async function SM(t,e){let r=e,n=(0,le.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function xM(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function AM(t){return(0,le.resolve)(t,"App.xcworkspace")}async function OM(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,le.resolve)(r,"project.pbxproj");try{let a=(await(0,jt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return hM.logger.warn(`Using the iOS project root for the ${Io.default.strong("public")} directory is deprecated.
105
- Please follow the Upgrade Guide to move ${Io.default.strong("public")} inside the iOS target directory: ${Io.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,le.resolve)(t,"public")}catch{}return(0,le.resolve)(e,"public")}async function FM(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(()=>pg.__importStar(Il())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,jt.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){dg("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":{let e="/usr/local/android-studio/bin/studio",r="/usr/local/android-studio/bin/studio.sh";try{if(await(0,jt.pathExists)(e))return e}catch(n){dg("Error checking for studio executable: %O",n)}return r}}return""}async function PM(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,jt.pathExists)((0,le.resolve)(t,"Gemfile"))?n=(0,le.resolve)(t,"Gemfile"):await(0,jt.pathExists)((0,le.resolve)(e,"Gemfile"))?n=(0,le.resolve)(e,"Gemfile"):await(0,jt.pathExists)((0,le.resolve)(r,"Gemfile"))&&(n=(0,le.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,gM.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,le.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,jt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function kM(t){return`import type { CapacitorConfig } from '@capacitor/cli';
104
+ ${(n=o.stack)!==null&&n!==void 0?n:o}`)}}async function SM(t){var e;let r=(0,de.resolve)(t,pt.CONFIG_FILE_NAME_TS);if(await(0,jt.pathExists)(r))return EM(t,pt.CONFIG_FILE_NAME_TS,r);let n=(0,de.resolve)(t,pt.CONFIG_FILE_NAME_JS);if(await(0,jt.pathExists)(n))return _M(t,pt.CONFIG_FILE_NAME_JS,n);let o=(0,de.resolve)(t,pt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:pt.CONFIG_FILE_NAME_JSON,extConfigFilePath:o,extConfig:(e=await(0,dg.tryFn)(jt.readJSON,o))!==null&&e!==void 0?e:{}}}async function xM(t){let e="assets",r=(0,de.join)(t,e),n="ios-spm-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,de.resolve)(r,n),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,de.resolve)(r,o)},android:{platformTemplateArchive:i,platformTemplateArchiveAbs:(0,de.resolve)(r,i),cordovaPluginsTemplateArchive:a,cordovaPluginsTemplateArchiveAbs:(0,de.resolve)(r,a)}},package:await(0,jt.readJSON)((0,de.resolve)(t,"package.json")),os:kM(process.platform)}}async function AM(t,e,r){var n,o,i,a,s,u,c,f,d,h,p,m,g,D,v,_,y;let E="android",S=(o=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&o!==void 0?o:"android",P=(0,de.resolve)(t,S),T="app",B=`${T}/src`,F=`${B}/main`,L=`${F}/assets`,A=`${L}/public`,q=`${F}/res`,j=`${T}/build/outputs/apk/`,Z=((i=e.android)===null||i===void 0?void 0:i.flavor)||"";!((a=e.android)===null||a===void 0)&&a.flavor&&(j=`${j}/${(s=e.android)===null||s===void 0?void 0:s.flavor}`);let k=(0,yM.parseApkNameFromFlavor)(Z),b=`${j}/debug`,w="capacitor-cordova-android-plugins",C=(0,Qi.lazy)(()=>IM(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(d=(f=e.android)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.keystorePassword,keystoreAlias:(p=(h=e.android)===null||h===void 0?void 0:h.buildOptions)===null||p===void 0?void 0:p.keystoreAlias,keystoreAliasPassword:(g=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||g===void 0?void 0:g.keystoreAliasPassword,signingType:(v=(D=e.android)===null||D===void 0?void 0:D.buildOptions)===null||v===void 0?void 0:v.signingType,releaseType:(y=(_=e.android)===null||_===void 0?void 0:_.buildOptions)===null||y===void 0?void 0:y.releaseType};return{name:E,minVersion:"24",studioPath:C,platformDir:S,platformDirAbs:P,cordovaPluginsDir:w,cordovaPluginsDirAbs:(0,de.resolve)(P,w),appDir:T,appDirAbs:(0,de.resolve)(P,T),srcDir:B,srcDirAbs:(0,de.resolve)(P,B),srcMainDir:F,srcMainDirAbs:(0,de.resolve)(P,F),assetsDir:L,assetsDirAbs:(0,de.resolve)(P,L),webDir:A,webDirAbs:(0,de.resolve)(P,A),resDir:q,resDirAbs:(0,de.resolve)(P,q),apkName:k,buildOutputDir:b,buildOutputDirAbs:(0,de.resolve)(P,b),flavor:Z,buildOptions:O}}async function OM(t,e){var r,n,o,i,a,s,u,c,f,d,h,p;let g=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",D=(0,de.resolve)(t,g),v=(i=(o=e.ios)===null||o===void 0?void 0:o.scheme)!==null&&i!==void 0?i:"App",_="App",y=(0,de.resolve)(D,_),E=`${_}/App`,S=(0,de.resolve)(D,E),P=`${_}/App.xcodeproj`,T=(0,de.resolve)(D,P),B=(0,Qi.lazy)(()=>PM(y)),F=(0,Qi.lazy)(()=>TM(t,D,y)),L=(0,Qi.lazy)(()=>$M(y,S,T)),A="capacitor-cordova-ios-plugins",q={exportMethod:(s=(a=e.ios)===null||a===void 0?void 0:a.buildOptions)===null||s===void 0?void 0:s.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(d=(f=e.ios)===null||f===void 0?void 0:f.buildOptions)===null||d===void 0?void 0:d.signingCertificate,provisioningProfile:(p=(h=e.ios)===null||h===void 0?void 0:h.buildOptions)===null||p===void 0?void 0:p.provisioningProfile};return{name:"ios",minVersion:"15.0",platformDir:g,platformDirAbs:D,scheme:v,cordovaPluginsDir:A,cordovaPluginsDirAbs:(0,de.resolve)(D,A),nativeProjectDir:_,nativeProjectDirAbs:y,nativeTargetDir:E,nativeTargetDirAbs:S,nativeXcodeProjDir:P,nativeXcodeProjDirAbs:T,nativeXcodeWorkspaceDir:(0,Qi.lazy)(async()=>(0,de.relative)(D,await B)),nativeXcodeWorkspaceDirAbs:B,webDir:(0,Qi.lazy)(async()=>(0,de.relative)(D,await L)),webDirAbs:L,podPath:F,buildOptions:q}}async function FM(t,e){let r=e,n=(0,de.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function kM(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function PM(t){return(0,de.resolve)(t,"App.xcworkspace")}async function $M(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,o=(0,de.resolve)(r,"project.pbxproj");try{let a=(await(0,jt.readFile)(o,{encoding:"utf8"})).match(n);if(a&&a[1]==="SOURCE_ROOT")return DM.logger.warn(`Using the iOS project root for the ${To.default.strong("public")} directory is deprecated.
105
+ Please follow the Upgrade Guide to move ${To.default.strong("public")} inside the iOS target directory: ${To.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,de.resolve)(t,"public")}catch{}return(0,de.resolve)(e,"public")}async function IM(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(()=>hg.__importStar(Tl())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,jt.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){pg("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":{let e="/usr/local/android-studio/bin/studio",r="/usr/local/android-studio/bin/studio.sh";try{if(await(0,jt.pathExists)(e))return e}catch(n){pg("Error checking for studio executable: %O",n)}return r}}return""}async function TM(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,jt.pathExists)((0,de.resolve)(t,"Gemfile"))?n=(0,de.resolve)(t,"Gemfile"):await(0,jt.pathExists)((0,de.resolve)(e,"Gemfile"))?n=(0,de.resolve)(e,"Gemfile"):await(0,jt.pathExists)((0,de.resolve)(r,"Gemfile"))&&(n=(0,de.resolve)(r,"Gemfile")),!(n!=""))try{let i=await(0,wM.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});i!=null&&(n=(0,de.resolve)(i,"Gemfile"))}catch{}try{let i=(await(0,jt.readFile)(n)).toString();return i&&new RegExp(/gem\s+['"]cocoapods/).test(i)?"bundle exec pod":"pod"}catch{return"pod"}}function RM(t){return`import type { CapacitorConfig } from '@capacitor/cli';
106
106
 
107
- const config: CapacitorConfig = ${(0,mM.formatJSObject)(t)};
107
+ const config: CapacitorConfig = ${(0,bM.formatJSObject)(t)};
108
108
 
109
109
  export default config;
110
- `}});function $M(){try{return gg.default.statSync("/.dockerenv"),!0}catch{return!1}}function IM(){try{return gg.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function yg(){return mg===void 0&&(mg=$M()||IM()),mg}var gg,mg,Gx=Qe(()=>{gg=de(require("node:fs"),1)});function ea(){return Dg===void 0&&(Dg=TM()||yg()),Dg}var Wx,Dg,TM,bg=Qe(()=>{Wx=de(require("node:fs"),1);Gx();TM=()=>{try{return Wx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var wg,Jx,Xx,Yx,pn,vg=Qe(()=>{wg=de(require("node:process"),1),Jx=de(require("node:os"),1),Xx=de(require("node:fs"),1);bg();Yx=()=>{if(wg.default.platform!=="linux")return!1;if(Jx.default.release().toLowerCase().includes("microsoft"))return!ea();try{return Xx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ea():!1}catch{return!1}},pn=wg.default.env.__IS_WSL_TEST__?Yx:Yx()});var Cg,Zx,Qx,eA,RM,Eg,rr,_g=Qe(()=>{Cg=de(require("node:process"),1),Zx=require("node:buffer"),Qx=require("node:util"),eA=de(require("node:child_process"),1),RM=(0,Qx.promisify)(eA.default.execFile),Eg=()=>`${Cg.default.env.SYSTEMROOT||Cg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,rr=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=rr.encodeCommand(t);return RM(r??Eg(),[...rr.argumentsPrefix,o],{encoding:"utf8",...n})};rr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];rr.encodeCommand=t=>Zx.Buffer.from(t,"utf16le").toString("base64");rr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var rA,nA,To,BM,NM,LM,Ul,tA,oA,iA,aA,sA=Qe(()=>{rA=require("node:util"),nA=de(require("node:child_process"),1),To=de(require("node:fs/promises"),1);vg();_g();vg();BM=(0,rA.promisify)(nA.default.execFile),NM=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await To.default.access(r,To.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await To.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}})(),LM=async()=>`${await NM()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Ul=pn?LM:Eg,oA=async()=>(tA??=(async()=>{try{let t=await Ul();return await To.default.access(t,To.constants.X_OK),!0}catch{return!1}})(),tA),iA=async()=>{let t=await Ul(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await rr(e,{powerShellPath:t});return r.trim()},aA=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await BM("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function Ro(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 uA=Qe(()=>{});async function Sg(){if(lA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await jM("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var cA,lA,fA,jM,dA=Qe(()=>{cA=require("node:util"),lA=de(require("node:process"),1),fA=require("node:child_process"),jM=(0,cA.promisify)(fA.execFile)});async function mA(t,{humanReadableOutput:e=!0,signal:r}={}){if(pA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await UM("osascript",["-e",t,n],o);return i.trim()}var pA,hA,xg,UM,gA=Qe(()=>{pA=de(require("node:process"),1),hA=require("node:util"),xg=require("node:child_process"),UM=(0,hA.promisify)(xg.execFile)});async function Ag(t){return mA(`tell application "Finder" to set app_path to application file id "${t}" as string
111
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var yA=Qe(()=>{gA()});async function Fg(t=MM){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 Ml(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=wA[n];if(!o)throw new Ml(`Unknown browser ID: ${n}`);return o}var DA,bA,MM,wA,Og,Ml,Pg=Qe(()=>{DA=require("node:util"),bA=require("node:child_process"),MM=(0,DA.promisify)(bA.execFile),wA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Og=new Map(Object.entries(wA)),Ml=class extends Error{}});async function kg(){if(ql.default.platform==="darwin"){let t=await Sg();return{name:await Ag(t),id:t}}if(ql.default.platform==="linux"){let{stdout:t}=await qM("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:HM(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(ql.default.platform==="win32")return Fg();throw new Error("Only macOS, Linux, and Windows are supported")}var vA,ql,CA,qM,HM,EA=Qe(()=>{vA=require("node:util"),ql=de(require("node:process"),1),CA=require("node:child_process");dA();yA();Pg();Pg();qM=(0,vA.promisify)(CA.execFile),HM=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Hl,VM,_A,SA=Qe(()=>{Hl=de(require("node:process"),1),VM=!!(Hl.default.env.SSH_CONNECTION||Hl.default.env.SSH_CLIENT||Hl.default.env.SSH_TTY),_A=VM});var Rg={};Qr(Rg,{apps:()=>Bo,default:()=>GM,openApp:()=>KM});function FA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[AA]:e}=t;if(!e)throw new Error(`${AA} is not supported`);return e}function ks({[ta]:t},{wsl:e}={}){if(e&&pn)return FA(e);if(!t)throw new Error(`${ta} is not supported`);return FA(t)}var Ig,Tg,kA,$A,zl,PA,Vl,$g,xA,ta,AA,OA,Ps,zM,KM,Bo,GM,Bg=Qe(()=>{Ig=de(require("node:process"),1),Tg=de(require("node:path"),1),kA=require("node:url"),$A=de(require("node:child_process"),1),zl=de(require("node:fs/promises"),1);sA();_g();uA();EA();bg();SA();PA={},Vl=Symbol("fallbackAttempt"),$g=PA.url?Tg.default.dirname((0,kA.fileURLToPath)(PA.url)):"",xA=Tg.default.join($g,"xdg-open"),{platform:ta,arch:AA}=Ig.default,OA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Ps=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Vl]===!0;if(delete t[Vl],Array.isArray(t.app))return OA(t.app,c=>Ps({...t,app:c,[Vl]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return OA(r,c=>Ps({...t,app:{name:c,arguments:n},[Vl]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},f={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(pn){let p=await iA();d=Og.get(p)??{}}else d=await kg();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(f[p])}return Ps({...t,app:{name:Bo[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(pn&&!ea()&&!_A&&!r&&(s=await oA()),ta==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(ta==="win32"||s){o=await Ul(),i.push(...rr.argumentsPrefix),pn||(a.windowsVerbatimArguments=!0),pn&&t.target&&(t.target=await aA(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(rr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(rr.escapeArgument(t.target)),n.length>0&&(n=n.map(f=>rr.escapeArgument(f)),c.push("-ArgumentList",n.join(","))),t.target=rr.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!$g||$g==="/",f=!1;try{await zl.default.access(xA,zl.constants.X_OK),f=!0}catch{}o=Ig.default.versions.electron??(ta==="android"||c||!f)?"xdg-open":xA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}ta==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=$A.default.spawn(o,i,a);return t.wait?new Promise((c,f)=>{u.once("error",f),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){f(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",f),d!==0){f(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.off("error",f),c(u)})}))},zM=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Ps({...e,target:t})},KM=(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 Ps({...e,app:{name:t,arguments:r}})};Bo={browser:"browser",browserPrivate:"browserPrivate"};Ro(Bo,"chrome",()=>ks({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Ro(Bo,"brave",()=>ks({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"]}}));Ro(Bo,"firefox",()=>ks({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Ro(Bo,"edge",()=>ks({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Ro(Bo,"safari",()=>ks({darwin:"Safari"}));GM=zM});var wf=x(xr=>{"use strict";xr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;xr.find=(t,e)=>t.nodes.find(r=>r.type===e);xr.exceedsLimit=(t,e,r=1,n)=>n===!1||!xr.isInteger(t)||!xr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;xr.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)};xr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;xr.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;xr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;xr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);xr.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 vf=x((DX,f1)=>{"use strict";var l1=wf();f1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&l1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&l1.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 p1=x((bX,d1)=>{"use strict";d1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var C1=x((wX,v1)=>{"use strict";var h1=p1(),Vo=(t,e,r)=>{if(h1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(h1(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(Vo.cache.hasOwnProperty(u))return Vo.cache[u].result;let c=Math.min(t,e),f=Math.max(t,e);if(Math.abs(c-f)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}let d=w1(t)||w1(e),p={min:t,max:e,a:c,b:f},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let g=f<0?Math.abs(f):1;m=m1(g,Math.abs(c),p,n),c=p.a=0}return f>=0&&(h=m1(c,f,p,n)),p.negatives=m,p.positives=h,p.result=q5(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Vo.cache[u]=p,p.result};function q5(t,e,r){let n=sy(t,e,"-",!1,r)||[],o=sy(e,t,"",!1,r)||[],i=sy(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function H5(t,e){let r=1,n=1,o=y1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=y1(t,r);for(o=D1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=D1(e+1,n)-1;return i=[...i],i.sort(K5),i}function V5(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=z5(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+=G5(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function m1(t,e,r,n){let o=H5(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],f=V5(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===f.pattern){s.count.length>1&&s.count.pop(),s.count.push(f.count[0]),s.string=s.pattern+b1(s.count),a=c+1;continue}r.isPadded&&(d=W5(c,r,n)),f.string=d+f.pattern+b1(f.count),i.push(f),a=c+1,s=f}return i}function sy(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!g1(e,"string",s)&&i.push(r+s),n&&g1(e,"string",s)&&i.push(r+s)}return i}function z5(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function K5(t,e){return t>e?1:e>t?-1:0}function g1(t,e,r){return t.some(n=>n[e]===r)}function y1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function D1(t,e){return t-t%Math.pow(10,e)}function b1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function G5(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function w1(t){return/^-?(0+)\d/.test(t)}function W5(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}}`}}Vo.cache={};Vo.clearCache=()=>Vo.cache={};v1.exports=Vo});var ly=x((vX,F1)=>{"use strict";var Y5=require("util"),_1=C1(),E1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),J5=t=>e=>t===!0?Number(e):String(e),uy=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ws=t=>Number.isInteger(+t),cy=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},X5=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Z5=(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},Ef=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Q5=(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=>Ef(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>Ef(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},S1=(t,e,r,n)=>{if(r)return _1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},x1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return _1(t,e,r)},A1=(...t)=>new RangeError("Invalid range arguments: "+Y5.inspect(...t)),O1=(t,e,r)=>{if(r.strictRanges===!0)throw A1([t,e]);return[]},e9=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},t9=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw A1([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 f=cy(s)||cy(u)||cy(c),d=f?Math.max(s.length,u.length,c.length):0,p=f===!1&&X5(t,e,n)===!1,h=n.transform||J5(p);if(n.toRegex&&r===1)return S1(Ef(t,d),Ef(e,d),!0,n);let m={negatives:[],positives:[]},g=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),D=[],v=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?g(o):D.push(Z5(h(o,v),d,p)),o=a?o-r:o+r,v++;return n.toRegex===!0?r>1?Q5(m,n,d):x1(D,null,{wrap:!1,...n}):D},r9=(t,e,r=1,n={})=>{if(!Ws(t)&&t.length>1||!Ws(e)&&e.length>1)return O1(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return S1(u,c,!1,n);let f=[],d=0;for(;s?i>=a:i<=a;)f.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?x1(f,null,{wrap:!1,options:n}):f},Cf=(t,e,r,n={})=>{if(e==null&&uy(t))return[t];if(!uy(t)||!uy(e))return O1(t,e,n);if(typeof r=="function")return Cf(t,e,1,{transform:r});if(E1(r))return Cf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Ws(r)?Ws(t)&&Ws(e)?t9(t,e,r,o):r9(t,e,Math.max(Math.abs(r),1),o):r!=null&&!E1(r)?e9(r,o):Cf(t,e,1,r)};F1.exports=Cf});var $1=x((CX,k1)=>{"use strict";var n9=ly(),P1=wf(),o9=(t,e={})=>{let r=(n,o={})=>{let i=P1.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 f=P1.reduce(n.nodes),d=n9(...f,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return f.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let f of n.nodes)c+=r(f,n);return c};return r(t)};k1.exports=o9});var R1=x((EX,T1)=>{"use strict";var i9=ly(),I1=vf(),ya=wf(),zo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ya.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(zo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?zo(o,i,r):o+i);return ya.flatten(n)},a9=(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(zo(s.pop(),I1(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(zo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ya.reduce(o.nodes);if(ya.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=i9(...d,e);p.length===0&&(p=I1(o,e)),s.push(zo(s.pop(),p)),o.nodes=[];return}let u=ya.encloseBrace(o),c=o.queue,f=o;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,c=f.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(zo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(zo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ya.flatten(n(t))};T1.exports=a9});var N1=x((_X,B1)=>{"use strict";B1.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:`
112
- `,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 q1=x((SX,M1)=>{"use strict";var s9=vf(),{MAX_LENGTH:L1,CHAR_BACKSLASH:fy,CHAR_BACKTICK:u9,CHAR_COMMA:c9,CHAR_DOT:l9,CHAR_LEFT_PARENTHESES:f9,CHAR_RIGHT_PARENTHESES:d9,CHAR_LEFT_CURLY_BRACE:p9,CHAR_RIGHT_CURLY_BRACE:h9,CHAR_LEFT_SQUARE_BRACKET:j1,CHAR_RIGHT_SQUARE_BRACKET:U1,CHAR_DOUBLE_QUOTE:m9,CHAR_SINGLE_QUOTE:g9,CHAR_NO_BREAK_SPACE:y9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:D9}=N1(),b9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(L1,r.maxLength):L1;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,f=0,d=0,p,h=()=>t[f++],m=g=>{if(g.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&g.type==="text"){s.value+=g.value;return}return a.nodes.push(g),g.parent=a,g.prev=s,s=g,g};for(m({type:"bos"});f<c;)if(a=i[i.length-1],p=h(),!(p===D9||p===y9)){if(p===fy){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===U1){m({type:"text",value:"\\"+p});continue}if(p===j1){u++;let g;for(;f<c&&(g=h());){if(p+=g,g===j1){u++;continue}if(g===fy){p+=h();continue}if(g===U1&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===f9){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===d9){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===m9||p===g9||p===u9){let g=p,D;for(e.keepQuotes!==!0&&(p="");f<c&&(D=h());){if(D===fy){p+=D+h();continue}if(D===g){e.keepQuotes===!0&&(p+=D);break}p+=D}m({type:"text",value:p});continue}if(p===p9){d++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:p});continue}if(p===h9){if(a.type!=="brace"){m({type:"text",value:p});continue}let g="close";a=i.pop(),a.close=!0,m({type:g,value:p}),d--,a=i[i.length-1];continue}if(p===c9&&d>0){if(a.ranges>0){a.ranges=0;let g=a.nodes.shift();a.nodes=[g,{type:"text",value:s9(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===l9&&d>0&&a.commas===0){let g=a.nodes;if(d===0||g.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){g.pop();let D=g[g.length-1];D.value+=s.value+p,s=D,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(v=>{v.nodes||(v.type==="open"&&(v.isOpen=!0),v.type==="close"&&(v.isClose=!0),v.nodes||(v.type="text"),v.invalid=!0)});let g=i[i.length-1],D=g.nodes.indexOf(a);g.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};M1.exports=b9});var z1=x((xX,V1)=>{"use strict";var H1=vf(),w9=$1(),v9=R1(),C9=q1(),ur=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=ur.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(ur.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};ur.parse=(t,e={})=>C9(t,e);ur.stringify=(t,e={})=>H1(typeof t=="string"?ur.parse(t,e):t,e);ur.compile=(t,e={})=>(typeof t=="string"&&(t=ur.parse(t,e)),w9(t,e));ur.expand=(t,e={})=>{typeof t=="string"&&(t=ur.parse(t,e));let r=v9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};ur.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?ur.compile(t,e):ur.expand(t,e);V1.exports=ur});var Ys=x((AX,J1)=>{"use strict";var E9=require("path"),Yr="\\\\/",K1=`[^${Yr}]`,wn="\\.",_9="\\+",S9="\\?",_f="\\/",x9="(?=.)",G1="[^/]",dy=`(?:${_f}|$)`,W1=`(?:^|${_f})`,py=`${wn}{1,2}${dy}`,A9=`(?!${wn})`,O9=`(?!${W1}${py})`,F9=`(?!${wn}{0,1}${dy})`,P9=`(?!${py})`,k9=`[^.${_f}]`,$9=`${G1}*?`,Y1={DOT_LITERAL:wn,PLUS_LITERAL:_9,QMARK_LITERAL:S9,SLASH_LITERAL:_f,ONE_CHAR:x9,QMARK:G1,END_ANCHOR:dy,DOTS_SLASH:py,NO_DOT:A9,NO_DOTS:O9,NO_DOT_SLASH:F9,NO_DOTS_SLASH:P9,QMARK_NO_DOT:k9,STAR:$9,START_ANCHOR:W1},I9={...Y1,SLASH_LITERAL:`[${Yr}]`,QMARK:K1,STAR:`${K1}*?`,DOTS_SLASH:`${wn}{1,2}(?:[${Yr}]|$)`,NO_DOT:`(?!${wn})`,NO_DOTS:`(?!(?:^|[${Yr}])${wn}{1,2}(?:[${Yr}]|$))`,NO_DOT_SLASH:`(?!${wn}{0,1}(?:[${Yr}]|$))`,NO_DOTS_SLASH:`(?!${wn}{1,2}(?:[${Yr}]|$))`,QMARK_NO_DOT:`[^.${Yr}]`,START_ANCHOR:`(?:^|[${Yr}])`,END_ANCHOR:`(?:[${Yr}]|$)`},T9={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};J1.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:T9,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:E9.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?I9:Y1}}});var Js=x(Xt=>{"use strict";var R9=require("path"),B9=process.platform==="win32",{REGEX_BACKSLASH:N9,REGEX_REMOVE_BACKSLASH:L9,REGEX_SPECIAL_CHARS:j9,REGEX_SPECIAL_CHARS_GLOBAL:U9}=Ys();Xt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Xt.hasRegexChars=t=>j9.test(t);Xt.isRegexChar=t=>t.length===1&&Xt.hasRegexChars(t);Xt.escapeRegex=t=>t.replace(U9,"\\$1");Xt.toPosixSlashes=t=>t.replace(N9,"/");Xt.removeBackslashes=t=>t.replace(L9,e=>e==="\\"?"":e);Xt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Xt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:B9===!0||R9.sep==="\\";Xt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Xt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Xt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Xt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var oF=x((FX,nF)=>{"use strict";var X1=Js(),{CHAR_ASTERISK:hy,CHAR_AT:M9,CHAR_BACKWARD_SLASH:Xs,CHAR_COMMA:q9,CHAR_DOT:my,CHAR_EXCLAMATION_MARK:gy,CHAR_FORWARD_SLASH:rF,CHAR_LEFT_CURLY_BRACE:yy,CHAR_LEFT_PARENTHESES:Dy,CHAR_LEFT_SQUARE_BRACKET:H9,CHAR_PLUS:V9,CHAR_QUESTION_MARK:Z1,CHAR_RIGHT_CURLY_BRACE:z9,CHAR_RIGHT_PARENTHESES:Q1,CHAR_RIGHT_SQUARE_BRACKET:K9}=Ys(),eF=t=>t===rF||t===Xs,tF=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},G9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,f=0,d=0,p=!1,h=!1,m=!1,g=!1,D=!1,v=!1,E=!1,y=!1,_=!1,S=!1,k=0,T,B,F={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),q=()=>(T=B,u.charCodeAt(++c));for(;c<n;){B=q();let w;if(B===Xs){E=F.backslashes=!0,B=q(),B===yy&&(v=!0);continue}if(v===!0||B===yy){for(k++;L()!==!0&&(B=q());){if(B===Xs){E=F.backslashes=!0,q();continue}if(B===yy){k++;continue}if(v!==!0&&B===my&&(B=q())===my){if(p=F.isBrace=!0,m=F.isGlob=!0,S=!0,o===!0)continue;break}if(v!==!0&&B===q9){if(p=F.isBrace=!0,m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===z9&&(k--,k===0)){v=!1,p=F.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===rF){if(i.push(c),a.push(F),F={value:"",depth:0,isGlob:!1},S===!0)continue;if(T===my&&c===f+1){f+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===V9||B===M9||B===hy||B===Z1||B===gy)===!0&&A()===Dy){if(m=F.isGlob=!0,g=F.isExtglob=!0,S=!0,B===gy&&c===f&&(_=!0),o===!0){for(;L()!==!0&&(B=q());){if(B===Xs){E=F.backslashes=!0,B=q();continue}if(B===Q1){m=F.isGlob=!0,S=!0;break}}continue}break}if(B===hy){if(T===hy&&(D=F.isGlobstar=!0),m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===Z1){if(m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===H9){for(;L()!==!0&&(w=q());){if(w===Xs){E=F.backslashes=!0,q();continue}if(w===K9){h=F.isBracket=!0,m=F.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===gy&&c===f){y=F.negated=!0,f++;continue}if(r.noparen!==!0&&B===Dy){if(m=F.isGlob=!0,o===!0){for(;L()!==!0&&(B=q());){if(B===Dy){E=F.backslashes=!0,B=q();continue}if(B===Q1){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(g=!1,m=!1);let j=u,Z="",P="";f>0&&(Z=u.slice(0,f),u=u.slice(f),d-=f),j&&m===!0&&d>0?(j=u.slice(0,d),P=u.slice(d)):m===!0?(j="",P=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&eF(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(P&&(P=X1.removeBackslashes(P)),j&&E===!0&&(j=X1.removeBackslashes(j)));let b={prefix:Z,input:t,start:f,base:j,glob:P,isBrace:p,isBracket:h,isGlob:m,isExtglob:g,isGlobstar:D,negated:y,negatedExtglob:_};if(r.tokens===!0&&(b.maxDepth=0,eF(B)||a.push(F),b.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let C=0;C<i.length;C++){let O=w?w+1:f,R=i[C],$=t.slice(O,R);r.tokens&&(C===0&&f!==0?(a[C].isPrefix=!0,a[C].value=Z):a[C].value=$,tF(a[C]),b.maxDepth+=a[C].depth),(C!==0||$!=="")&&s.push($),w=R}if(w&&w+1<t.length){let C=t.slice(w+1);s.push(C),r.tokens&&(a[a.length-1].value=C,tF(a[a.length-1]),b.maxDepth+=a[a.length-1].depth)}b.slashes=i,b.parts=s}return b};nF.exports=G9});var sF=x((PX,aF)=>{"use strict";var Sf=Ys(),cr=Js(),{MAX_LENGTH:xf,POSIX_REGEX_SOURCE:W9,REGEX_NON_SPECIAL_CHARS:Y9,REGEX_SPECIAL_CHARS_BACKREF:J9,REPLACEMENTS:iF}=Sf,X9=(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=>cr.escapeRegex(o)).join("..")}return r},Da=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,by=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=iF[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(xf,r.maxLength):xf,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=cr.isWindows(e),c=Sf.globChars(u),f=Sf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:D,NO_DOT_SLASH:v,NO_DOTS_SLASH:E,QMARK:y,QMARK_NO_DOT:_,STAR:S,START_ANCHOR:k}=c,T=K=>`(${s}(?:(?!${k}${K.dot?g:d}).)*?)`,B=r.dot?"":D,F=r.dot?y:_,L=r.bash===!0?T(r):S;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=cr.removePrefix(t,A),o=t.length;let q=[],j=[],Z=[],P=i,b,w=()=>A.index===o-1,C=A.peek=(K=1)=>t[A.index+K],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),$=(K="",Se=0)=>{A.consumed+=K,A.index+=Se},H=K=>{A.output+=K.output!=null?K.output:K.value,$(K.value)},I=()=>{let K=1;for(;C()==="!"&&(C(2)!=="("||C(3)==="?");)O(),A.start++,K++;return K%2===0?!1:(A.negated=!0,A.start++,!0)},N=K=>{A[K]++,Z.push(K)},X=K=>{A[K]--,Z.pop()},U=K=>{if(P.type==="globstar"){let Se=A.braces>0&&(K.type==="comma"||K.type==="brace"),z=K.extglob===!0||q.length&&(K.type==="pipe"||K.type==="paren");K.type!=="slash"&&K.type!=="paren"&&!Se&&!z&&(A.output=A.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=L,A.output+=P.output)}if(q.length&&K.type!=="paren"&&(q[q.length-1].inner+=K.value),(K.value||K.output)&&H(K),P&&P.type==="text"&&K.type==="text"){P.value+=K.value,P.output=(P.output||"")+K.value;return}K.prev=P,a.push(K),P=K},oe=(K,Se)=>{let z={...f[Se],conditions:1,inner:""};z.prev=P,z.parens=A.parens,z.output=A.output;let he=(r.capture?"(":"")+z.open;N("parens"),U({type:K,value:Se,output:A.output?"":m}),U({type:"paren",extglob:!0,value:O(),output:he}),q.push(z)},Zt=K=>{let Se=K.close+(r.capture?")":""),z;if(K.type==="negate"){let he=L;if(K.inner&&K.inner.length>1&&K.inner.includes("/")&&(he=T(r)),(he!==L||w()||/^\)+$/.test(R()))&&(Se=K.close=`)$))${he}`),K.inner.includes("*")&&(z=R())&&/^\.[^\\/.]+$/.test(z)){let Ve=by(z,{...e,fastpaths:!1}).output;Se=K.close=`)${Ve})${he})`}K.prev.type==="bos"&&(A.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:b,output:Se}),X("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let K=!1,Se=t.replace(J9,(z,he,Ve,Ot,ot,Lf)=>Ot==="\\"?(K=!0,z):Ot==="?"?he?he+Ot+(ot?y.repeat(ot.length):""):Lf===0?F+(ot?y.repeat(ot.length):""):y.repeat(Ve.length):Ot==="."?d.repeat(Ve.length):Ot==="*"?he?he+Ot+(ot?L:""):L:he?z:`\\${z}`);return K===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=cr.wrapOutput(Se,A,e),A)}for(;!w();){if(b=O(),b==="\0")continue;if(b==="\\"){let z=C();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){b+="\\",U({type:"text",value:b});continue}let he=/^\\+/.exec(R()),Ve=0;if(he&&he[0].length>2&&(Ve=he[0].length,A.index+=Ve,Ve%2!==0&&(b+="\\")),r.unescape===!0?b=O():b+=O(),A.brackets===0){U({type:"text",value:b});continue}}if(A.brackets>0&&(b!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&b===":"){let z=P.value.slice(1);if(z.includes("[")&&(P.posix=!0,z.includes(":"))){let he=P.value.lastIndexOf("["),Ve=P.value.slice(0,he),Ot=P.value.slice(he+2),ot=W9[Ot];if(ot){P.value=Ve+ot,A.backtrack=!0,O(),!i.output&&a.indexOf(P)===1&&(i.output=m);continue}}}(b==="["&&C()!==":"||b==="-"&&C()==="]")&&(b=`\\${b}`),b==="]"&&(P.value==="["||P.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&P.value==="["&&(b="^"),P.value+=b,H({value:b});continue}if(A.quotes===1&&b!=='"'){b=cr.escapeRegex(b),P.value+=b,H({value:b});continue}if(b==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&U({type:"text",value:b});continue}if(b==="("){N("parens"),U({type:"paren",value:b});continue}if(b===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Da("opening","("));let z=q[q.length-1];if(z&&A.parens===z.parens+1){Zt(q.pop());continue}U({type:"paren",value:b,output:A.parens?")":"\\)"}),X("parens");continue}if(b==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Da("closing","]"));b=`\\${b}`}else N("brackets");U({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){U({type:"text",value:b,output:`\\${b}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Da("opening","["));U({type:"text",value:b,output:`\\${b}`});continue}X("brackets");let z=P.value.slice(1);if(P.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(b=`/${b}`),P.value+=b,H({value:b}),r.literalBrackets===!1||cr.hasRegexChars(z))continue;let he=cr.escapeRegex(P.value);if(A.output=A.output.slice(0,-P.value.length),r.literalBrackets===!0){A.output+=he,P.value=he;continue}P.value=`(${s}${he}|${P.value})`,A.output+=P.value;continue}if(b==="{"&&r.nobrace!==!0){N("braces");let z={type:"brace",value:b,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};j.push(z),U(z);continue}if(b==="}"){let z=j[j.length-1];if(r.nobrace===!0||!z){U({type:"text",value:b,output:b});continue}let he=")";if(z.dots===!0){let Ve=a.slice(),Ot=[];for(let ot=Ve.length-1;ot>=0&&(a.pop(),Ve[ot].type!=="brace");ot--)Ve[ot].type!=="dots"&&Ot.unshift(Ve[ot].value);he=X9(Ot,r),A.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let Ve=A.output.slice(0,z.outputIndex),Ot=A.tokens.slice(z.tokensIndex);z.value=z.output="\\{",b=he="\\}",A.output=Ve;for(let ot of Ot)A.output+=ot.output||ot.value}U({type:"brace",value:b,output:he}),X("braces"),j.pop();continue}if(b==="|"){q.length>0&&q[q.length-1].conditions++,U({type:"text",value:b});continue}if(b===","){let z=b,he=j[j.length-1];he&&Z[Z.length-1]==="braces"&&(he.comma=!0,z="|"),U({type:"comma",value:b,output:z});continue}if(b==="/"){if(P.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),P=i;continue}U({type:"slash",value:b,output:h});continue}if(b==="."){if(A.braces>0&&P.type==="dot"){P.value==="."&&(P.output=d);let z=j[j.length-1];P.type="dots",P.output+=b,P.value+=b,z.dots=!0;continue}if(A.braces+A.parens===0&&P.type!=="bos"&&P.type!=="slash"){U({type:"text",value:b,output:d});continue}U({type:"dot",value:b,output:d});continue}if(b==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("qmark",b);continue}if(P&&P.type==="paren"){let he=C(),Ve=b;if(he==="<"&&!cr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(P.value==="("&&!/[!=<:]/.test(he)||he==="<"&&!/<([!=]|\w+>)/.test(R()))&&(Ve=`\\${b}`),U({type:"text",value:b,output:Ve});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){U({type:"qmark",value:b,output:_});continue}U({type:"qmark",value:b,output:y});continue}if(b==="!"){if(r.noextglob!==!0&&C()==="("&&(C(2)!=="?"||!/[!=<:]/.test(C(3)))){oe("negate",b);continue}if(r.nonegate!==!0&&A.index===0){I();continue}}if(b==="+"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){oe("plus",b);continue}if(P&&P.value==="("||r.regex===!1){U({type:"plus",value:b,output:p});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||A.parens>0){U({type:"plus",value:b});continue}U({type:"plus",value:p});continue}if(b==="@"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){U({type:"at",extglob:!0,value:b,output:""});continue}U({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let z=Y9.exec(R());z&&(b+=z[0],A.index+=z[0].length),U({type:"text",value:b});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=b,P.output=L,A.backtrack=!0,A.globstar=!0,$(b);continue}let K=R();if(r.noextglob!==!0&&/^\([^?]/.test(K)){oe("star",b);continue}if(P.type==="star"){if(r.noglobstar===!0){$(b);continue}let z=P.prev,he=z.prev,Ve=z.type==="slash"||z.type==="bos",Ot=he&&(he.type==="star"||he.type==="globstar");if(r.bash===!0&&(!Ve||K[0]&&K[0]!=="/")){U({type:"star",value:b,output:""});continue}let ot=A.braces>0&&(z.type==="comma"||z.type==="brace"),Lf=q.length&&(z.type==="pipe"||z.type==="paren");if(!Ve&&z.type!=="paren"&&!ot&&!Lf){U({type:"star",value:b,output:""});continue}for(;K.slice(0,3)==="/**";){let nu=t[A.index+4];if(nu&&nu!=="/")break;K=K.slice(3),$("/**",3)}if(z.type==="bos"&&w()){P.type="globstar",P.value+=b,P.output=T(r),A.output=P.output,A.globstar=!0,$(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Ot&&w()){A.output=A.output.slice(0,-(z.output+P.output).length),z.output=`(?:${z.output}`,P.type="globstar",P.output=T(r)+(r.strictSlashes?")":"|$)"),P.value+=b,A.globstar=!0,A.output+=z.output+P.output,$(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&K[0]==="/"){let nu=K[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(z.output+P.output).length),z.output=`(?:${z.output}`,P.type="globstar",P.output=`${T(r)}${h}|${h}${nu})`,P.value+=b,A.output+=z.output+P.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&K[0]==="/"){P.type="globstar",P.value+=b,P.output=`(?:^|${h}|${T(r)}${h})`,A.output=P.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-P.output.length),P.type="globstar",P.output=T(r),P.value+=b,A.output+=P.output,A.globstar=!0,$(b);continue}let Se={type:"star",value:b,output:L};if(r.bash===!0){Se.output=".*?",(P.type==="bos"||P.type==="slash")&&(Se.output=B+Se.output),U(Se);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){Se.output=b,U(Se);continue}(A.index===A.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(A.output+=v,P.output+=v):r.dot===!0?(A.output+=E,P.output+=E):(A.output+=B,P.output+=B),C()!=="*"&&(A.output+=m,P.output+=m)),U(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing","]"));A.output=cr.escapeLast(A.output,"["),X("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing",")"));A.output=cr.escapeLast(A.output,"("),X("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Da("closing","}"));A.output=cr.escapeLast(A.output,"{"),X("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let K of A.tokens)A.output+=K.output!=null?K.output:K.value,K.suffix&&(A.output+=K.suffix)}return A};by.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(xf,r.maxLength):xf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=iF[t]||t;let i=cr.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:f,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=Sf.globChars(i),g=r.dot?d:f,D=r.dot?p:f,v=r.capture?"":"?:",E={negated:!1,prefix:""},y=r.bash===!0?".*?":h;r.capture&&(y=`(${y})`);let _=B=>B.noglobstar===!0?y:`(${v}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${g}${u}${y}`;case".*":return`${a}${u}${y}`;case"*.*":return`${g}${y}${a}${u}${y}`;case"*/*":return`${g}${y}${s}${u}${D}${y}`;case"**":return g+_(r);case"**/*":return`(?:${g}${_(r)}${s})?${D}${u}${y}`;case"**/*.*":return`(?:${g}${_(r)}${s})?${D}${y}${a}${u}${y}`;case"**/.*":return`(?:${g}${_(r)}${s})?${a}${u}${y}`;default:{let F=/^(.*?)\.(\w+)$/.exec(B);if(!F)return;let L=S(F[1]);return L?L+a+F[2]:void 0}}},k=cr.removePrefix(t,E),T=S(k);return T&&r.strictSlashes!==!0&&(T+=`${s}?`),T};aF.exports=by});var cF=x((kX,uF)=>{"use strict";var Z9=require("path"),Q9=oF(),wy=sF(),vy=Js(),e7=Ys(),t7=t=>t&&typeof t=="object"&&!Array.isArray(t),rt=(t,e,r=!1)=>{if(Array.isArray(t)){let f=t.map(p=>rt(p,e,r));return p=>{for(let h of f){let m=h(p);if(m)return m}return!1}}let n=t7(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=vy.isWindows(e),a=n?rt.compileRe(t,e):rt.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};u=rt(o.ignore,f,r)}let c=(f,d=!1)=>{let{isMatch:p,match:h,output:m}=rt.test(f,a,e,{glob:t,posix:i}),g={glob:t,state:s,regex:a,posix:i,input:f,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(g),p===!1?(g.isMatch=!1,d?g:!1):u(f)?(typeof o.onIgnore=="function"&&o.onIgnore(g),g.isMatch=!1,d?g:!1):(typeof o.onMatch=="function"&&o.onMatch(g),d?g:!0)};return r&&(c.state=s),c};rt.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?vy.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=rt.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};rt.matchBase=(t,e,r,n=vy.isWindows(r))=>(e instanceof RegExp?e:rt.makeRe(e,r)).test(Z9.basename(t));rt.isMatch=(t,e,r)=>rt(e,r)(t);rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>rt.parse(r,e)):wy(t,{...e,fastpaths:!1});rt.scan=(t,e)=>Q9(t,e);rt.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=rt.toRegex(s,e);return n===!0&&(u.state=t),u};rt.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=wy.fastpaths(t,e)),o.output||(o=wy(t,e)),rt.compileRe(o,e,r,n)};rt.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/$^/}};rt.constants=e7;uF.exports=rt});var fF=x(($X,lF)=>{"use strict";lF.exports=cF()});var yF=x((IX,gF)=>{"use strict";var pF=require("util"),hF=z1(),Jr=fF(),Cy=Js(),dF=t=>t===""||t==="./",mF=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=f=>{i.add(f.output),r&&r.onResult&&r.onResult(f)};for(let f=0;f<e.length;f++){let d=Jr(String(e[f]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(f=>!n.has(f));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(f=>f.replace(/\\/g,"")):e}return c};je.match=je;je.matcher=(t,e)=>Jr(t,e);je.isMatch=(t,e,r)=>Jr(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: "${pF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>je.contains(t,n,r));if(typeof e=="string"){if(dF(t)||dF(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(!Cy.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=Jr(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=Jr(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: "${pF.inspect(t)}"`);return[].concat(e).every(n=>Jr(n,r)(t))};je.capture=(t,e,r)=>{let n=Cy.isWindows(r),i=Jr.makeRe(String(t),{...r,capture:!0}).exec(n?Cy.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};je.makeRe=(...t)=>Jr.makeRe(...t);je.scan=(...t)=>Jr.scan(...t);je.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of hF(String(n),e))r.push(Jr.parse(o,e));return r};je.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!mF(t)?[t]:hF(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=mF;gF.exports=je});var t2=x(($Z,vn)=>{var Te=require("fs"),If=require("os"),wt=require("path"),LF=require("crypto"),Zr={fs:Te.constants,os:If.constants},jF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",HF=/XXXXXX/,O7=3,VF=(Zr.O_CREAT||Zr.fs.O_CREAT)|(Zr.O_EXCL||Zr.fs.O_EXCL)|(Zr.O_RDWR||Zr.fs.O_RDWR),F7=If.platform()==="win32",P7=Zr.EBADF||Zr.os.errno.EBADF,k7=Zr.ENOENT||Zr.os.errno.ENOENT,zF=448,KF=384,$7="exit",wa=[],GF=Te.rmdirSync.bind(Te),WF=!1;function I7(t,e){return Te.rm(t,{recursive:!0},e)}function YF(t){return Te.rmSync(t,{recursive:!0})}function Ay(t,e){let r=va(t,e),n=r[0],o=r[1];H7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=XF(a);Te.stat(c,function(f){if(!f)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 Oy(t){let e=va(t),r=e[0],n=V7(r),o=n.tries;do{let i=XF(n);try{Te.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function T7(t,e){let r=va(t,e),n=r[0],o=r[1];Ay(n,function(a,s){if(a)return o(a);Te.open(s,VF,n.mode||KF,function(c,f){if(c)return o(c);if(n.discardDescriptor)return Te.close(f,function(p){return o(p,s,void 0,Sy(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,f,Sy(s,d?-1:f,n,!1))}})})}function R7(t){let e=va(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Oy(r),i=Te.openSync(o,VF,r.mode||KF);return r.discardDescriptor&&(Te.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:Sy(o,n?-1:i,r,!0)}}function B7(t,e){let r=va(t,e),n=r[0],o=r[1];Ay(n,function(a,s){if(a)return o(a);Te.mkdir(s,n.mode||zF,function(c){if(c)return o(c);o(null,s,JF(s,n,!1))})})}function N7(t){let e=va(t),r=e[0],n=Oy(r);return Te.mkdirSync(n,r.mode||zF),{name:n,removeCallback:JF(n,r,!0)}}function L7(t,e){let r=function(n){if(n&&!xy(n))return e(n);e()};0<=t[0]?Te.close(t[0],function(){Te.unlink(t[1],r)}):Te.unlink(t[1],r)}function j7(t){let e=null;try{0<=t[0]&&Te.closeSync(t[0])}catch(r){if(!z7(r)&&!xy(r))throw r}finally{try{Te.unlinkSync(t[1])}catch(r){xy(r)||(e=r)}}if(e!==null)throw e}function Sy(t,e,r,n){let o=$f(j7,[e,t],n),i=$f(L7,[e,t],n,o);return r.keep||wa.unshift(o),n?o:i}function JF(t,e,r){let n=e.unsafeCleanup?I7:Te.rmdir.bind(Te),o=e.unsafeCleanup?YF:GF,i=$f(o,t,r),a=$f(n,t,r,i);return e.keep||wa.unshift(i),r?i:a}function $f(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=wa.indexOf(s);return u>=0&&wa.splice(u,1),o=!0,r||t===GF||t===YF?t(e):t(e,a||function(){})}}}function U7(){if(WF)for(;wa.length;)try{wa[0]()}catch{}}function UF(t){let e=[],r=null;try{r=LF.randomBytes(t)}catch{r=LF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(jF[r[n]%jF.length]);return e.join("")}function lr(t){return typeof t>"u"}function va(t,e){if(typeof t=="function")return[{},t];if(lr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function M7(t,e,r){let n=wt.isAbsolute(t)?t:wt.join(e,t);Te.stat(n,function(o){o?Te.realpath(wt.dirname(n),function(i,a){if(i)return r(i);r(null,wt.join(a,wt.basename(n)))}):Te.realpath(n,r)})}function q7(t,e){let r=wt.isAbsolute(t)?t:wt.join(e,t);try{return Te.statSync(r),Te.realpathSync(r)}catch{let o=Te.realpathSync(wt.dirname(r));return wt.join(o,wt.basename(r))}}function XF(t){let e=t.tmpdir;if(!lr(t.name))return wt.join(e,t.dir,t.name);if(!lr(t.template))return wt.join(e,t.dir,t.template).replace(HF,UF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",UF(12),t.postfix?"-"+t.postfix:""].join("");return wt.join(e,t.dir,r)}function ZF(t){if(!lr(t.name)){let e=t.name;if(wt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=wt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!lr(t.template)&&!t.template.match(HF))throw new Error(`Invalid template, found "${t.template}".`);if(!lr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=lr(t.name)?t.tries||O7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=lr(t.prefix)?"":t.prefix,t.postfix=lr(t.postfix)?"":t.postfix}function MF(t,e,r,n){if(lr(e))return n(null);M7(e,r,function(o,i){if(o)return n(o);let a=wt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function qF(t,e,r){if(lr(e))return;let n=q7(e,r),o=wt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function H7(t,e){G7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{ZF(t,n)}catch(o){return e(o)}MF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=lr(i)?"":i,MF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function V7(t){let e=t.tmpdir=e2(t);ZF(t,e);let r=qF("dir",t.dir,e);return t.dir=lr(r)?"":r,t.template=qF("template",t.template,e),t}function z7(t){return QF(t,-P7,"EBADF")}function xy(t){return QF(t,-k7,"ENOENT")}function QF(t,e,r){return F7?t.code===r:t.code===r&&t.errno===e}function K7(){WF=!0}function G7(t,e){return Te.realpath(t&&t.tmpdir||If.tmpdir(),e)}function e2(t){return Te.realpathSync(t&&t.tmpdir||If.tmpdir())}process.addListener($7,U7);Object.defineProperty(vn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return e2()}});vn.exports.dir=B7;vn.exports.dirSync=N7;vn.exports.file=T7;vn.exports.fileSync=R7;vn.exports.tmpName=Ay;vn.exports.tmpNameSync=Oy;vn.exports.setGracefulCleanup=K7});var Rf=require("node:process");var Zy=de(Xy(),1),{program:at,createCommand:kq,createArgument:$q,createOption:Iq,CommanderError:Tq,InvalidArgumentError:Rq,InvalidOptionArgumentError:Bq,Command:Nq,Argument:Lq,Option:jq,Help:Uq}=Zy.default;var dr={name:"@capgo/cli",version:"7.59.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:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",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 && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@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","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var la=require("node:fs");var vt=de(nd(),1),Yo=require("node:process"),En=de(require("node:readline"),1),ud=de(require("node:readline"),1),lD=require("node:stream"),Sa=de(id(),1);function L2({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var j2=L2();function fD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(j2,"")}function dD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pD={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 f=u[c],d=e.length(f);if(s>=o-(d==2?1:0))if(s+d<=i)a+=f;else break;s+=d}return a}})(pD);var U2=pD.exports,M2=dD(U2),q2=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},H2=dD(q2);function xa(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=fD(t),t.length===0))return 0;t=t.replace(H2()," ");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(M2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var ad=10,rD=(t=0)=>e=>`\x1B[${e+t}m`,nD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,oD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Ue={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(Ue.modifier);var V2=Object.keys(Ue.color),z2=Object.keys(Ue.bgColor);[...V2,...z2];function K2(){let t=new Map;for(let[e,r]of Object.entries(Ue)){for(let[n,o]of Object.entries(r))Ue[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ue[n],t.set(o[0],o[1]);Object.defineProperty(Ue,e,{value:r,enumerable:!1})}return Object.defineProperty(Ue,"codes",{value:t,enumerable:!1}),Ue.color.close="\x1B[39m",Ue.bgColor.close="\x1B[49m",Ue.color.ansi=rD(),Ue.color.ansi256=nD(),Ue.color.ansi16m=oD(),Ue.bgColor.ansi=rD(ad),Ue.bgColor.ansi256=nD(ad),Ue.bgColor.ansi16m=oD(ad),Object.defineProperties(Ue,{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=>Ue.rgbToAnsi256(...Ue.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)=>Ue.ansi256ToAnsi(Ue.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Ue.ansi256ToAnsi(Ue.hexToAnsi256(e)),enumerable:!1}}),Ue}var G2=K2(),gu=new Set(["\x1B","\x9B"]),W2=39,ld="\x07",hD="[",Y2="]",mD="m",fd=`${Y2}8;;`,iD=t=>`${gu.values().next().value}${hD}${t}${mD}`,aD=t=>`${gu.values().next().value}${fd}${t}${ld}`,J2=t=>t.split(" ").map(e=>xa(e)),sd=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=xa(fD(t[t.length-1]));for(let[s,u]of n.entries()){let c=xa(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),gu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(fd)),o){i?u===ld&&(o=!1,i=!1):u===mD&&(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())},X2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(xa(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Z2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=J2(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=xa(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),sd(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){sd(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){sd(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(c=>X2(c)));let u=[...s.join(`
113
- `)];for(let[c,f]of u.entries()){if(n+=f,gu.has(f)){let{groups:p}=new RegExp(`(?:\\${hD}(?<code>\\d+)m|\\${fd}(?<uri>.*)${ld})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===W2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=G2.codes.get(Number(o));u[c+1]===`
114
- `?(i&&(n+=aD("")),o&&d&&(n+=iD(d))):f===`
115
- `&&(o&&d&&(n+=iD(o)),i&&(n+=aD(i)))}return n};function sD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
110
+ `}});function BM(){try{return yg.default.statSync("/.dockerenv"),!0}catch{return!1}}function NM(){try{return yg.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Dg(){return gg===void 0&&(gg=BM()||NM()),gg}var yg,gg,Wx=et(()=>{yg=pe(require("node:fs"),1)});function ta(){return bg===void 0&&(bg=LM()||Dg()),bg}var Yx,bg,LM,wg=et(()=>{Yx=pe(require("node:fs"),1);Wx();LM=()=>{try{return Yx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var vg,Xx,Zx,Jx,pn,Cg=et(()=>{vg=pe(require("node:process"),1),Xx=pe(require("node:os"),1),Zx=pe(require("node:fs"),1);wg();Jx=()=>{if(vg.default.platform!=="linux")return!1;if(Xx.default.release().toLowerCase().includes("microsoft"))return!ta();try{return Zx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ta():!1}catch{return!1}},pn=vg.default.env.__IS_WSL_TEST__?Jx:Jx()});var Eg,Qx,eA,tA,jM,_g,rr,Sg=et(()=>{Eg=pe(require("node:process"),1),Qx=require("node:buffer"),eA=require("node:util"),tA=pe(require("node:child_process"),1),jM=(0,eA.promisify)(tA.default.execFile),_g=()=>`${Eg.default.env.SYSTEMROOT||Eg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,rr=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=rr.encodeCommand(t);return jM(r??_g(),[...rr.argumentsPrefix,o],{encoding:"utf8",...n})};rr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];rr.encodeCommand=t=>Qx.Buffer.from(t,"utf16le").toString("base64");rr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var nA,oA,Ro,UM,MM,qM,Ml,rA,iA,aA,sA,uA=et(()=>{nA=require("node:util"),oA=pe(require("node:child_process"),1),Ro=pe(require("node:fs/promises"),1);Cg();Sg();Cg();UM=(0,nA.promisify)(oA.default.execFile),MM=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ro.default.access(r,Ro.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Ro.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}})(),qM=async()=>`${await MM()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Ml=pn?qM:_g,iA=async()=>(rA??=(async()=>{try{let t=await Ml();return await Ro.default.access(t,Ro.constants.X_OK),!0}catch{return!1}})(),rA),aA=async()=>{let t=await Ml(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await rr(e,{powerShellPath:t});return r.trim()},sA=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await UM("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function Bo(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 cA=et(()=>{});async function xg(){if(fA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await HM("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var lA,fA,dA,HM,pA=et(()=>{lA=require("node:util"),fA=pe(require("node:process"),1),dA=require("node:child_process"),HM=(0,lA.promisify)(dA.execFile)});async function gA(t,{humanReadableOutput:e=!0,signal:r}={}){if(hA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await VM("osascript",["-e",t,n],o);return i.trim()}var hA,mA,Ag,VM,yA=et(()=>{hA=pe(require("node:process"),1),mA=require("node:util"),Ag=require("node:child_process"),VM=(0,mA.promisify)(Ag.execFile)});async function Og(t){return gA(`tell application "Finder" to set app_path to application file id "${t}" as string
111
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var DA=et(()=>{yA()});async function kg(t=zM){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 ql(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=vA[n];if(!o)throw new ql(`Unknown browser ID: ${n}`);return o}var bA,wA,zM,vA,Fg,ql,Pg=et(()=>{bA=require("node:util"),wA=require("node:child_process"),zM=(0,bA.promisify)(wA.execFile),vA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Fg=new Map(Object.entries(vA)),ql=class extends Error{}});async function $g(){if(Hl.default.platform==="darwin"){let t=await xg();return{name:await Og(t),id:t}}if(Hl.default.platform==="linux"){let{stdout:t}=await KM("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:GM(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Hl.default.platform==="win32")return kg();throw new Error("Only macOS, Linux, and Windows are supported")}var CA,Hl,EA,KM,GM,_A=et(()=>{CA=require("node:util"),Hl=pe(require("node:process"),1),EA=require("node:child_process");pA();DA();Pg();Pg();KM=(0,CA.promisify)(EA.execFile),GM=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Vl,WM,SA,xA=et(()=>{Vl=pe(require("node:process"),1),WM=!!(Vl.default.env.SSH_CONNECTION||Vl.default.env.SSH_CLIENT||Vl.default.env.SSH_TTY),SA=WM});var Bg={};Qr(Bg,{apps:()=>No,default:()=>XM,openApp:()=>JM});function kA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[OA]:e}=t;if(!e)throw new Error(`${OA} is not supported`);return e}function $s({[ra]:t},{wsl:e}={}){if(e&&pn)return kA(e);if(!t)throw new Error(`${ra} is not supported`);return kA(t)}var Tg,Rg,$A,IA,Kl,PA,zl,Ig,AA,ra,OA,FA,Ps,YM,JM,No,XM,Ng=et(()=>{Tg=pe(require("node:process"),1),Rg=pe(require("node:path"),1),$A=require("node:url"),IA=pe(require("node:child_process"),1),Kl=pe(require("node:fs/promises"),1);uA();Sg();cA();_A();wg();xA();PA={},zl=Symbol("fallbackAttempt"),Ig=PA.url?Rg.default.dirname((0,$A.fileURLToPath)(PA.url)):"",AA=Rg.default.join(Ig,"xdg-open"),{platform:ra,arch:OA}=Tg.default,FA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Ps=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[zl]===!0;if(delete t[zl],Array.isArray(t.app))return FA(t.app,c=>Ps({...t,app:c,[zl]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return FA(r,c=>Ps({...t,app:{name:c,arguments:n},[zl]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},f={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(pn){let h=await aA();d=Fg.get(h)??{}}else d=await $g();if(d.id in c){let h=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(h==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(f[h])}return Ps({...t,app:{name:No[h],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(pn&&!ta()&&!SA&&!r&&(s=await iA()),ra==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(ra==="win32"||s){o=await Ml(),i.push(...rr.argumentsPrefix),pn||(a.windowsVerbatimArguments=!0),pn&&t.target&&(t.target=await sA(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(rr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(rr.escapeArgument(t.target)),n.length>0&&(n=n.map(f=>rr.escapeArgument(f)),c.push("-ArgumentList",n.join(","))),t.target=rr.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!Ig||Ig==="/",f=!1;try{await Kl.default.access(AA,Kl.constants.X_OK),f=!0}catch{}o=Tg.default.versions.electron??(ra==="android"||c||!f)?"xdg-open":AA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}ra==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=IA.default.spawn(o,i,a);return t.wait?new Promise((c,f)=>{u.once("error",f),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){f(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",f),d!==0){f(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,f)=>{u.once("error",f),u.once("spawn",()=>{u.off("error",f),c(u)})}))},YM=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Ps({...e,target:t})},JM=(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 Ps({...e,app:{name:t,arguments:r}})};No={browser:"browser",browserPrivate:"browserPrivate"};Bo(No,"chrome",()=>$s({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));Bo(No,"brave",()=>$s({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"]}}));Bo(No,"firefox",()=>$s({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Bo(No,"edge",()=>$s({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Bo(No,"safari",()=>$s({darwin:"Safari"}));XM=YM});var vf=x(xr=>{"use strict";xr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;xr.find=(t,e)=>t.nodes.find(r=>r.type===e);xr.exceedsLimit=(t,e,r=1,n)=>n===!1||!xr.isInteger(t)||!xr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;xr.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)};xr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;xr.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;xr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;xr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);xr.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 Cf=x((_X,h1)=>{"use strict";var p1=vf();h1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&p1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&p1.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 g1=x((SX,m1)=>{"use strict";m1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var S1=x((xX,_1)=>{"use strict";var y1=g1(),zo=(t,e,r)=>{if(y1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(y1(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(zo.cache.hasOwnProperty(u))return zo.cache[u].result;let c=Math.min(t,e),f=Math.max(t,e);if(Math.abs(c-f)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}let d=E1(t)||E1(e),h={min:t,max:e,a:c,b:f},p=[],m=[];if(d&&(h.isPadded=d,h.maxLen=String(h.max).length),c<0){let g=f<0?Math.abs(f):1;m=D1(g,Math.abs(c),h,n),c=h.a=0}return f>=0&&(p=D1(c,f,h,n)),h.negatives=m,h.positives=p,h.result=G5(m,p,n),n.capture===!0?h.result=`(${h.result})`:n.wrap!==!1&&p.length+m.length>1&&(h.result=`(?:${h.result})`),zo.cache[u]=h,h.result};function G5(t,e,r){let n=uy(t,e,"-",!1,r)||[],o=uy(e,t,"",!1,r)||[],i=uy(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function W5(t,e){let r=1,n=1,o=w1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=w1(t,r);for(o=v1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=v1(e+1,n)-1;return i=[...i],i.sort(X5),i}function Y5(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=J5(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+=Z5(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function D1(t,e,r,n){let o=W5(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],f=Y5(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===f.pattern){s.count.length>1&&s.count.pop(),s.count.push(f.count[0]),s.string=s.pattern+C1(s.count),a=c+1;continue}r.isPadded&&(d=Q5(c,r,n)),f.string=d+f.pattern+C1(f.count),i.push(f),a=c+1,s=f}return i}function uy(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!b1(e,"string",s)&&i.push(r+s),n&&b1(e,"string",s)&&i.push(r+s)}return i}function J5(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function X5(t,e){return t>e?1:e>t?-1:0}function b1(t,e,r){return t.some(n=>n[e]===r)}function w1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function v1(t,e){return t-t%Math.pow(10,e)}function C1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function Z5(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function E1(t){return/^-?(0+)\d/.test(t)}function Q5(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}}`}}zo.cache={};zo.clearCache=()=>zo.cache={};_1.exports=zo});var fy=x((AX,$1)=>{"use strict";var e9=require("util"),A1=S1(),x1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),t9=t=>e=>t===!0?Number(e):String(e),cy=t=>typeof t=="number"||typeof t=="string"&&t!=="",Ys=t=>Number.isInteger(+t),ly=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},r9=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,n9=(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},_f=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},o9=(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=>_f(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>_f(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},O1=(t,e,r,n)=>{if(r)return A1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},F1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return A1(t,e,r)},k1=(...t)=>new RangeError("Invalid range arguments: "+e9.inspect(...t)),P1=(t,e,r)=>{if(r.strictRanges===!0)throw k1([t,e]);return[]},i9=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},a9=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw k1([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 f=ly(s)||ly(u)||ly(c),d=f?Math.max(s.length,u.length,c.length):0,h=f===!1&&r9(t,e,n)===!1,p=n.transform||t9(h);if(n.toRegex&&r===1)return O1(_f(t,d),_f(e,d),!0,n);let m={negatives:[],positives:[]},g=_=>m[_<0?"negatives":"positives"].push(Math.abs(_)),D=[],v=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?g(o):D.push(n9(p(o,v),d,h)),o=a?o-r:o+r,v++;return n.toRegex===!0?r>1?o9(m,n,d):F1(D,null,{wrap:!1,...n}):D},s9=(t,e,r=1,n={})=>{if(!Ys(t)&&t.length>1||!Ys(e)&&e.length>1)return P1(t,e,n);let o=n.transform||(h=>String.fromCharCode(h)),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 O1(u,c,!1,n);let f=[],d=0;for(;s?i>=a:i<=a;)f.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?F1(f,null,{wrap:!1,options:n}):f},Ef=(t,e,r,n={})=>{if(e==null&&cy(t))return[t];if(!cy(t)||!cy(e))return P1(t,e,n);if(typeof r=="function")return Ef(t,e,1,{transform:r});if(x1(r))return Ef(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Ys(r)?Ys(t)&&Ys(e)?a9(t,e,r,o):s9(t,e,Math.max(Math.abs(r),1),o):r!=null&&!x1(r)?i9(r,o):Ef(t,e,1,r)};$1.exports=Ef});var R1=x((OX,T1)=>{"use strict";var u9=fy(),I1=vf(),c9=(t,e={})=>{let r=(n,o={})=>{let i=I1.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 f=I1.reduce(n.nodes),d=u9(...f,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return f.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let f of n.nodes)c+=r(f,n);return c};return r(t)};T1.exports=c9});var L1=x((FX,N1)=>{"use strict";var l9=fy(),B1=Cf(),Da=vf(),Ko=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?Da.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(Ko(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Ko(o,i,r):o+i);return Da.flatten(n)},f9=(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(Ko(s.pop(),B1(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(Ko(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=Da.reduce(o.nodes);if(Da.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let h=l9(...d,e);h.length===0&&(h=B1(o,e)),s.push(Ko(s.pop(),h)),o.nodes=[];return}let u=Da.encloseBrace(o),c=o.queue,f=o;for(;f.type!=="brace"&&f.type!=="root"&&f.parent;)f=f.parent,c=f.queue;for(let d=0;d<o.nodes.length;d++){let h=o.nodes[d];if(h.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(h.type==="close"){s.push(Ko(s.pop(),c,u));continue}if(h.value&&h.type!=="open"){c.push(Ko(c.pop(),h.value));continue}h.nodes&&n(h,o)}return c};return Da.flatten(n(t))};N1.exports=f9});var U1=x((kX,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:`
112
+ `,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 z1=x((PX,V1)=>{"use strict";var d9=Cf(),{MAX_LENGTH:M1,CHAR_BACKSLASH:dy,CHAR_BACKTICK:p9,CHAR_COMMA:h9,CHAR_DOT:m9,CHAR_LEFT_PARENTHESES:g9,CHAR_RIGHT_PARENTHESES:y9,CHAR_LEFT_CURLY_BRACE:D9,CHAR_RIGHT_CURLY_BRACE:b9,CHAR_LEFT_SQUARE_BRACKET:q1,CHAR_RIGHT_SQUARE_BRACKET:H1,CHAR_DOUBLE_QUOTE:w9,CHAR_SINGLE_QUOTE:v9,CHAR_NO_BREAK_SPACE:C9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:E9}=U1(),_9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(M1,r.maxLength):M1;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,f=0,d=0,h,p=()=>t[f++],m=g=>{if(g.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&g.type==="text"){s.value+=g.value;return}return a.nodes.push(g),g.parent=a,g.prev=s,s=g,g};for(m({type:"bos"});f<c;)if(a=i[i.length-1],h=p(),!(h===E9||h===C9)){if(h===dy){m({type:"text",value:(e.keepEscaping?h:"")+p()});continue}if(h===H1){m({type:"text",value:"\\"+h});continue}if(h===q1){u++;let g;for(;f<c&&(g=p());){if(h+=g,g===q1){u++;continue}if(g===dy){h+=p();continue}if(g===H1&&(u--,u===0))break}m({type:"text",value:h});continue}if(h===g9){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:h});continue}if(h===y9){if(a.type!=="paren"){m({type:"text",value:h});continue}a=i.pop(),m({type:"text",value:h}),a=i[i.length-1];continue}if(h===w9||h===v9||h===p9){let g=h,D;for(e.keepQuotes!==!0&&(h="");f<c&&(D=p());){if(D===dy){h+=D+p();continue}if(D===g){e.keepQuotes===!0&&(h+=D);break}h+=D}m({type:"text",value:h});continue}if(h===D9){d++;let D={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(D),i.push(a),m({type:"open",value:h});continue}if(h===b9){if(a.type!=="brace"){m({type:"text",value:h});continue}let g="close";a=i.pop(),a.close=!0,m({type:g,value:h}),d--,a=i[i.length-1];continue}if(h===h9&&d>0){if(a.ranges>0){a.ranges=0;let g=a.nodes.shift();a.nodes=[g,{type:"text",value:d9(a)}]}m({type:"comma",value:h}),a.commas++;continue}if(h===m9&&d>0&&a.commas===0){let g=a.nodes;if(d===0||g.length===0){m({type:"text",value:h});continue}if(s.type==="dot"){if(a.range=[],s.value+=h,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"){g.pop();let D=g[g.length-1];D.value+=s.value+h,s=D,a.ranges--;continue}m({type:"dot",value:h});continue}m({type:"text",value:h})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(v=>{v.nodes||(v.type==="open"&&(v.isOpen=!0),v.type==="close"&&(v.isClose=!0),v.nodes||(v.type="text"),v.invalid=!0)});let g=i[i.length-1],D=g.nodes.indexOf(a);g.nodes.splice(D,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};V1.exports=_9});var W1=x(($X,G1)=>{"use strict";var K1=Cf(),S9=R1(),x9=L1(),A9=z1(),ur=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=ur.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(ur.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};ur.parse=(t,e={})=>A9(t,e);ur.stringify=(t,e={})=>K1(typeof t=="string"?ur.parse(t,e):t,e);ur.compile=(t,e={})=>(typeof t=="string"&&(t=ur.parse(t,e)),S9(t,e));ur.expand=(t,e={})=>{typeof t=="string"&&(t=ur.parse(t,e));let r=x9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};ur.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?ur.compile(t,e):ur.expand(t,e);G1.exports=ur});var Js=x((IX,Q1)=>{"use strict";var O9=require("path"),Yr="\\\\/",Y1=`[^${Yr}]`,wn="\\.",F9="\\+",k9="\\?",Sf="\\/",P9="(?=.)",J1="[^/]",py=`(?:${Sf}|$)`,X1=`(?:^|${Sf})`,hy=`${wn}{1,2}${py}`,$9=`(?!${wn})`,I9=`(?!${X1}${hy})`,T9=`(?!${wn}{0,1}${py})`,R9=`(?!${hy})`,B9=`[^.${Sf}]`,N9=`${J1}*?`,Z1={DOT_LITERAL:wn,PLUS_LITERAL:F9,QMARK_LITERAL:k9,SLASH_LITERAL:Sf,ONE_CHAR:P9,QMARK:J1,END_ANCHOR:py,DOTS_SLASH:hy,NO_DOT:$9,NO_DOTS:I9,NO_DOT_SLASH:T9,NO_DOTS_SLASH:R9,QMARK_NO_DOT:B9,STAR:N9,START_ANCHOR:X1},L9={...Z1,SLASH_LITERAL:`[${Yr}]`,QMARK:Y1,STAR:`${Y1}*?`,DOTS_SLASH:`${wn}{1,2}(?:[${Yr}]|$)`,NO_DOT:`(?!${wn})`,NO_DOTS:`(?!(?:^|[${Yr}])${wn}{1,2}(?:[${Yr}]|$))`,NO_DOT_SLASH:`(?!${wn}{0,1}(?:[${Yr}]|$))`,NO_DOTS_SLASH:`(?!${wn}{1,2}(?:[${Yr}]|$))`,QMARK_NO_DOT:`[^.${Yr}]`,START_ANCHOR:`(?:^|[${Yr}])`,END_ANCHOR:`(?:[${Yr}]|$)`},j9={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"};Q1.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:j9,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:O9.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?L9:Z1}}});var Xs=x(Xt=>{"use strict";var U9=require("path"),M9=process.platform==="win32",{REGEX_BACKSLASH:q9,REGEX_REMOVE_BACKSLASH:H9,REGEX_SPECIAL_CHARS:V9,REGEX_SPECIAL_CHARS_GLOBAL:z9}=Js();Xt.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Xt.hasRegexChars=t=>V9.test(t);Xt.isRegexChar=t=>t.length===1&&Xt.hasRegexChars(t);Xt.escapeRegex=t=>t.replace(z9,"\\$1");Xt.toPosixSlashes=t=>t.replace(q9,"/");Xt.removeBackslashes=t=>t.replace(H9,e=>e==="\\"?"":e);Xt.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Xt.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:M9===!0||U9.sep==="\\";Xt.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Xt.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Xt.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Xt.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var sF=x((RX,aF)=>{"use strict";var eF=Xs(),{CHAR_ASTERISK:my,CHAR_AT:K9,CHAR_BACKWARD_SLASH:Zs,CHAR_COMMA:G9,CHAR_DOT:gy,CHAR_EXCLAMATION_MARK:yy,CHAR_FORWARD_SLASH:iF,CHAR_LEFT_CURLY_BRACE:Dy,CHAR_LEFT_PARENTHESES:by,CHAR_LEFT_SQUARE_BRACKET:W9,CHAR_PLUS:Y9,CHAR_QUESTION_MARK:tF,CHAR_RIGHT_CURLY_BRACE:J9,CHAR_RIGHT_PARENTHESES:rF,CHAR_RIGHT_SQUARE_BRACKET:X9}=Js(),nF=t=>t===iF||t===Zs,oF=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Z9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,f=0,d=0,h=!1,p=!1,m=!1,g=!1,D=!1,v=!1,_=!1,y=!1,E=!1,S=!1,P=0,T,B,F={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),q=()=>(T=B,u.charCodeAt(++c));for(;c<n;){B=q();let w;if(B===Zs){_=F.backslashes=!0,B=q(),B===Dy&&(v=!0);continue}if(v===!0||B===Dy){for(P++;L()!==!0&&(B=q());){if(B===Zs){_=F.backslashes=!0,q();continue}if(B===Dy){P++;continue}if(v!==!0&&B===gy&&(B=q())===gy){if(h=F.isBrace=!0,m=F.isGlob=!0,S=!0,o===!0)continue;break}if(v!==!0&&B===G9){if(h=F.isBrace=!0,m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===J9&&(P--,P===0)){v=!1,h=F.isBrace=!0,S=!0;break}}if(o===!0)continue;break}if(B===iF){if(i.push(c),a.push(F),F={value:"",depth:0,isGlob:!1},S===!0)continue;if(T===gy&&c===f+1){f+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===Y9||B===K9||B===my||B===tF||B===yy)===!0&&A()===by){if(m=F.isGlob=!0,g=F.isExtglob=!0,S=!0,B===yy&&c===f&&(E=!0),o===!0){for(;L()!==!0&&(B=q());){if(B===Zs){_=F.backslashes=!0,B=q();continue}if(B===rF){m=F.isGlob=!0,S=!0;break}}continue}break}if(B===my){if(T===my&&(D=F.isGlobstar=!0),m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===tF){if(m=F.isGlob=!0,S=!0,o===!0)continue;break}if(B===W9){for(;L()!==!0&&(w=q());){if(w===Zs){_=F.backslashes=!0,q();continue}if(w===X9){p=F.isBracket=!0,m=F.isGlob=!0,S=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===yy&&c===f){y=F.negated=!0,f++;continue}if(r.noparen!==!0&&B===by){if(m=F.isGlob=!0,o===!0){for(;L()!==!0&&(B=q());){if(B===by){_=F.backslashes=!0,B=q();continue}if(B===rF){S=!0;break}}continue}break}if(m===!0){if(S=!0,o===!0)continue;break}}r.noext===!0&&(g=!1,m=!1);let j=u,Z="",k="";f>0&&(Z=u.slice(0,f),u=u.slice(f),d-=f),j&&m===!0&&d>0?(j=u.slice(0,d),k=u.slice(d)):m===!0?(j="",k=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&nF(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(k&&(k=eF.removeBackslashes(k)),j&&_===!0&&(j=eF.removeBackslashes(j)));let b={prefix:Z,input:t,start:f,base:j,glob:k,isBrace:h,isBracket:p,isGlob:m,isExtglob:g,isGlobstar:D,negated:y,negatedExtglob:E};if(r.tokens===!0&&(b.maxDepth=0,nF(B)||a.push(F),b.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let C=0;C<i.length;C++){let O=w?w+1:f,R=i[C],$=t.slice(O,R);r.tokens&&(C===0&&f!==0?(a[C].isPrefix=!0,a[C].value=Z):a[C].value=$,oF(a[C]),b.maxDepth+=a[C].depth),(C!==0||$!=="")&&s.push($),w=R}if(w&&w+1<t.length){let C=t.slice(w+1);s.push(C),r.tokens&&(a[a.length-1].value=C,oF(a[a.length-1]),b.maxDepth+=a[a.length-1].depth)}b.slashes=i,b.parts=s}return b};aF.exports=Z9});var lF=x((BX,cF)=>{"use strict";var xf=Js(),cr=Xs(),{MAX_LENGTH:Af,POSIX_REGEX_SOURCE:Q9,REGEX_NON_SPECIAL_CHARS:e7,REGEX_SPECIAL_CHARS_BACKREF:t7,REPLACEMENTS:uF}=xf,r7=(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=>cr.escapeRegex(o)).join("..")}return r},ba=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,wy=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=uF[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=cr.isWindows(e),c=xf.globChars(u),f=xf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:h,SLASH_LITERAL:p,ONE_CHAR:m,DOTS_SLASH:g,NO_DOT:D,NO_DOT_SLASH:v,NO_DOTS_SLASH:_,QMARK:y,QMARK_NO_DOT:E,STAR:S,START_ANCHOR:P}=c,T=K=>`(${s}(?:(?!${P}${K.dot?g:d}).)*?)`,B=r.dot?"":D,F=r.dot?y:E,L=r.bash===!0?T(r):S;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=cr.removePrefix(t,A),o=t.length;let q=[],j=[],Z=[],k=i,b,w=()=>A.index===o-1,C=A.peek=(K=1)=>t[A.index+K],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),$=(K="",Se=0)=>{A.consumed+=K,A.index+=Se},H=K=>{A.output+=K.output!=null?K.output:K.value,$(K.value)},I=()=>{let K=1;for(;C()==="!"&&(C(2)!=="("||C(3)==="?");)O(),A.start++,K++;return K%2===0?!1:(A.negated=!0,A.start++,!0)},N=K=>{A[K]++,Z.push(K)},X=K=>{A[K]--,Z.pop()},U=K=>{if(k.type==="globstar"){let Se=A.braces>0&&(K.type==="comma"||K.type==="brace"),z=K.extglob===!0||q.length&&(K.type==="pipe"||K.type==="paren");K.type!=="slash"&&K.type!=="paren"&&!Se&&!z&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=L,A.output+=k.output)}if(q.length&&K.type!=="paren"&&(q[q.length-1].inner+=K.value),(K.value||K.output)&&H(K),k&&k.type==="text"&&K.type==="text"){k.value+=K.value,k.output=(k.output||"")+K.value;return}K.prev=k,a.push(K),k=K},ie=(K,Se)=>{let z={...f[Se],conditions:1,inner:""};z.prev=k,z.parens=A.parens,z.output=A.output;let me=(r.capture?"(":"")+z.open;N("parens"),U({type:K,value:Se,output:A.output?"":m}),U({type:"paren",extglob:!0,value:O(),output:me}),q.push(z)},Zt=K=>{let Se=K.close+(r.capture?")":""),z;if(K.type==="negate"){let me=L;if(K.inner&&K.inner.length>1&&K.inner.includes("/")&&(me=T(r)),(me!==L||w()||/^\)+$/.test(R()))&&(Se=K.close=`)$))${me}`),K.inner.includes("*")&&(z=R())&&/^\.[^\\/.]+$/.test(z)){let ze=wy(z,{...e,fastpaths:!1}).output;Se=K.close=`)${ze})${me})`}K.prev.type==="bos"&&(A.negatedExtglob=!0)}U({type:"paren",extglob:!0,value:b,output:Se}),X("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let K=!1,Se=t.replace(t7,(z,me,ze,Ot,ot,jf)=>Ot==="\\"?(K=!0,z):Ot==="?"?me?me+Ot+(ot?y.repeat(ot.length):""):jf===0?F+(ot?y.repeat(ot.length):""):y.repeat(ze.length):Ot==="."?d.repeat(ze.length):Ot==="*"?me?me+Ot+(ot?L:""):L:me?z:`\\${z}`);return K===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=cr.wrapOutput(Se,A,e),A)}for(;!w();){if(b=O(),b==="\0")continue;if(b==="\\"){let z=C();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){b+="\\",U({type:"text",value:b});continue}let me=/^\\+/.exec(R()),ze=0;if(me&&me[0].length>2&&(ze=me[0].length,A.index+=ze,ze%2!==0&&(b+="\\")),r.unescape===!0?b=O():b+=O(),A.brackets===0){U({type:"text",value:b});continue}}if(A.brackets>0&&(b!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&b===":"){let z=k.value.slice(1);if(z.includes("[")&&(k.posix=!0,z.includes(":"))){let me=k.value.lastIndexOf("["),ze=k.value.slice(0,me),Ot=k.value.slice(me+2),ot=Q9[Ot];if(ot){k.value=ze+ot,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(b==="["&&C()!==":"||b==="-"&&C()==="]")&&(b=`\\${b}`),b==="]"&&(k.value==="["||k.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&k.value==="["&&(b="^"),k.value+=b,H({value:b});continue}if(A.quotes===1&&b!=='"'){b=cr.escapeRegex(b),k.value+=b,H({value:b});continue}if(b==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&U({type:"text",value:b});continue}if(b==="("){N("parens"),U({type:"paren",value:b});continue}if(b===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ba("opening","("));let z=q[q.length-1];if(z&&A.parens===z.parens+1){Zt(q.pop());continue}U({type:"paren",value:b,output:A.parens?")":"\\)"}),X("parens");continue}if(b==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ba("closing","]"));b=`\\${b}`}else N("brackets");U({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){U({type:"text",value:b,output:`\\${b}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ba("opening","["));U({type:"text",value:b,output:`\\${b}`});continue}X("brackets");let z=k.value.slice(1);if(k.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(b=`/${b}`),k.value+=b,H({value:b}),r.literalBrackets===!1||cr.hasRegexChars(z))continue;let me=cr.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=me,k.value=me;continue}k.value=`(${s}${me}|${k.value})`,A.output+=k.value;continue}if(b==="{"&&r.nobrace!==!0){N("braces");let z={type:"brace",value:b,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};j.push(z),U(z);continue}if(b==="}"){let z=j[j.length-1];if(r.nobrace===!0||!z){U({type:"text",value:b,output:b});continue}let me=")";if(z.dots===!0){let ze=a.slice(),Ot=[];for(let ot=ze.length-1;ot>=0&&(a.pop(),ze[ot].type!=="brace");ot--)ze[ot].type!=="dots"&&Ot.unshift(ze[ot].value);me=r7(Ot,r),A.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let ze=A.output.slice(0,z.outputIndex),Ot=A.tokens.slice(z.tokensIndex);z.value=z.output="\\{",b=me="\\}",A.output=ze;for(let ot of Ot)A.output+=ot.output||ot.value}U({type:"brace",value:b,output:me}),X("braces"),j.pop();continue}if(b==="|"){q.length>0&&q[q.length-1].conditions++,U({type:"text",value:b});continue}if(b===","){let z=b,me=j[j.length-1];me&&Z[Z.length-1]==="braces"&&(me.comma=!0,z="|"),U({type:"comma",value:b,output:z});continue}if(b==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}U({type:"slash",value:b,output:p});continue}if(b==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let z=j[j.length-1];k.type="dots",k.output+=b,k.value+=b,z.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){U({type:"text",value:b,output:d});continue}U({type:"dot",value:b,output:d});continue}if(b==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&C()==="("&&C(2)!=="?"){ie("qmark",b);continue}if(k&&k.type==="paren"){let me=C(),ze=b;if(me==="<"&&!cr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(me)||me==="<"&&!/<([!=]|\w+>)/.test(R()))&&(ze=`\\${b}`),U({type:"text",value:b,output:ze});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){U({type:"qmark",value:b,output:E});continue}U({type:"qmark",value:b,output:y});continue}if(b==="!"){if(r.noextglob!==!0&&C()==="("&&(C(2)!=="?"||!/[!=<:]/.test(C(3)))){ie("negate",b);continue}if(r.nonegate!==!0&&A.index===0){I();continue}}if(b==="+"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){ie("plus",b);continue}if(k&&k.value==="("||r.regex===!1){U({type:"plus",value:b,output:h});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){U({type:"plus",value:b});continue}U({type:"plus",value:h});continue}if(b==="@"){if(r.noextglob!==!0&&C()==="("&&C(2)!=="?"){U({type:"at",extglob:!0,value:b,output:""});continue}U({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let z=e7.exec(R());z&&(b+=z[0],A.index+=z[0].length),U({type:"text",value:b});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=b,k.output=L,A.backtrack=!0,A.globstar=!0,$(b);continue}let K=R();if(r.noextglob!==!0&&/^\([^?]/.test(K)){ie("star",b);continue}if(k.type==="star"){if(r.noglobstar===!0){$(b);continue}let z=k.prev,me=z.prev,ze=z.type==="slash"||z.type==="bos",Ot=me&&(me.type==="star"||me.type==="globstar");if(r.bash===!0&&(!ze||K[0]&&K[0]!=="/")){U({type:"star",value:b,output:""});continue}let ot=A.braces>0&&(z.type==="comma"||z.type==="brace"),jf=q.length&&(z.type==="pipe"||z.type==="paren");if(!ze&&z.type!=="paren"&&!ot&&!jf){U({type:"star",value:b,output:""});continue}for(;K.slice(0,3)==="/**";){let ou=t[A.index+4];if(ou&&ou!=="/")break;K=K.slice(3),$("/**",3)}if(z.type==="bos"&&w()){k.type="globstar",k.value+=b,k.output=T(r),A.output=k.output,A.globstar=!0,$(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Ot&&w()){A.output=A.output.slice(0,-(z.output+k.output).length),z.output=`(?:${z.output}`,k.type="globstar",k.output=T(r)+(r.strictSlashes?")":"|$)"),k.value+=b,A.globstar=!0,A.output+=z.output+k.output,$(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&K[0]==="/"){let ou=K[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(z.output+k.output).length),z.output=`(?:${z.output}`,k.type="globstar",k.output=`${T(r)}${p}|${p}${ou})`,k.value+=b,A.output+=z.output+k.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&K[0]==="/"){k.type="globstar",k.value+=b,k.output=`(?:^|${p}|${T(r)}${p})`,A.output=k.output,A.globstar=!0,$(b+O()),U({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=T(r),k.value+=b,A.output+=k.output,A.globstar=!0,$(b);continue}let Se={type:"star",value:b,output:L};if(r.bash===!0){Se.output=".*?",(k.type==="bos"||k.type==="slash")&&(Se.output=B+Se.output),U(Se);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Se.output=b,U(Se);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=v,k.output+=v):r.dot===!0?(A.output+=_,k.output+=_):(A.output+=B,k.output+=B),C()!=="*"&&(A.output+=m,k.output+=m)),U(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ba("closing","]"));A.output=cr.escapeLast(A.output,"["),X("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ba("closing",")"));A.output=cr.escapeLast(A.output,"("),X("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ba("closing","}"));A.output=cr.escapeLast(A.output,"{"),X("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&U({type:"maybe_slash",value:"",output:`${p}?`}),A.backtrack===!0){A.output="";for(let K of A.tokens)A.output+=K.output!=null?K.output:K.value,K.suffix&&(A.output+=K.suffix)}return A};wy.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=uF[t]||t;let i=cr.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:f,NO_DOTS:d,NO_DOTS_SLASH:h,STAR:p,START_ANCHOR:m}=xf.globChars(i),g=r.dot?d:f,D=r.dot?h:f,v=r.capture?"":"?:",_={negated:!1,prefix:""},y=r.bash===!0?".*?":p;r.capture&&(y=`(${y})`);let E=B=>B.noglobstar===!0?y:`(${v}(?:(?!${m}${B.dot?c:a}).)*?)`,S=B=>{switch(B){case"*":return`${g}${u}${y}`;case".*":return`${a}${u}${y}`;case"*.*":return`${g}${y}${a}${u}${y}`;case"*/*":return`${g}${y}${s}${u}${D}${y}`;case"**":return g+E(r);case"**/*":return`(?:${g}${E(r)}${s})?${D}${u}${y}`;case"**/*.*":return`(?:${g}${E(r)}${s})?${D}${y}${a}${u}${y}`;case"**/.*":return`(?:${g}${E(r)}${s})?${a}${u}${y}`;default:{let F=/^(.*?)\.(\w+)$/.exec(B);if(!F)return;let L=S(F[1]);return L?L+a+F[2]:void 0}}},P=cr.removePrefix(t,_),T=S(P);return T&&r.strictSlashes!==!0&&(T+=`${s}?`),T};cF.exports=wy});var dF=x((NX,fF)=>{"use strict";var n7=require("path"),o7=sF(),vy=lF(),Cy=Xs(),i7=Js(),a7=t=>t&&typeof t=="object"&&!Array.isArray(t),nt=(t,e,r=!1)=>{if(Array.isArray(t)){let f=t.map(h=>nt(h,e,r));return h=>{for(let p of f){let m=p(h);if(m)return m}return!1}}let n=a7(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=Cy.isWindows(e),a=n?nt.compileRe(t,e):nt.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let f={...e,ignore:null,onMatch:null,onResult:null};u=nt(o.ignore,f,r)}let c=(f,d=!1)=>{let{isMatch:h,match:p,output:m}=nt.test(f,a,e,{glob:t,posix:i}),g={glob:t,state:s,regex:a,posix:i,input:f,output:m,match:p,isMatch:h};return typeof o.onResult=="function"&&o.onResult(g),h===!1?(g.isMatch=!1,d?g:!1):u(f)?(typeof o.onIgnore=="function"&&o.onIgnore(g),g.isMatch=!1,d?g:!1):(typeof o.onMatch=="function"&&o.onMatch(g),d?g:!0)};return r&&(c.state=s),c};nt.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?Cy.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=nt.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};nt.matchBase=(t,e,r,n=Cy.isWindows(r))=>(e instanceof RegExp?e:nt.makeRe(e,r)).test(n7.basename(t));nt.isMatch=(t,e,r)=>nt(e,r)(t);nt.parse=(t,e)=>Array.isArray(t)?t.map(r=>nt.parse(r,e)):vy(t,{...e,fastpaths:!1});nt.scan=(t,e)=>o7(t,e);nt.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=nt.toRegex(s,e);return n===!0&&(u.state=t),u};nt.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=vy.fastpaths(t,e)),o.output||(o=vy(t,e)),nt.compileRe(o,e,r,n)};nt.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/$^/}};nt.constants=i7;fF.exports=nt});var hF=x((LX,pF)=>{"use strict";pF.exports=dF()});var wF=x((jX,bF)=>{"use strict";var gF=require("util"),yF=W1(),Jr=hF(),Ey=Xs(),mF=t=>t===""||t==="./",DF=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=f=>{i.add(f.output),r&&r.onResult&&r.onResult(f)};for(let f=0;f<e.length;f++){let d=Jr(String(e[f]),{...r,onResult:s},!0),h=d.state.negated||d.state.negatedExtglob;h&&a++;for(let p of t){let m=d(p,!0);(h?!m.isMatch:m.isMatch)&&(h?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(f=>!n.has(f));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(f=>f.replace(/\\/g,"")):e}return c};je.match=je;je.matcher=(t,e)=>Jr(t,e);je.isMatch=(t,e,r)=>Jr(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: "${gF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>je.contains(t,n,r));if(typeof e=="string"){if(mF(t)||mF(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(!Ey.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=Jr(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=Jr(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: "${gF.inspect(t)}"`);return[].concat(e).every(n=>Jr(n,r)(t))};je.capture=(t,e,r)=>{let n=Ey.isWindows(r),i=Jr.makeRe(String(t),{...r,capture:!0}).exec(n?Ey.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};je.makeRe=(...t)=>Jr.makeRe(...t);je.scan=(...t)=>Jr.scan(...t);je.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of yF(String(n),e))r.push(Jr.parse(o,e));return r};je.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!DF(t)?[t]:yF(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=DF;bF.exports=je});var i2=x((UZ,vn)=>{var Te=require("fs"),Tf=require("os"),wt=require("path"),qF=require("crypto"),Zr={fs:Te.constants,os:Tf.constants},HF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",GF=/XXXXXX/,T7=3,WF=(Zr.O_CREAT||Zr.fs.O_CREAT)|(Zr.O_EXCL||Zr.fs.O_EXCL)|(Zr.O_RDWR||Zr.fs.O_RDWR),R7=Tf.platform()==="win32",B7=Zr.EBADF||Zr.os.errno.EBADF,N7=Zr.ENOENT||Zr.os.errno.ENOENT,YF=448,JF=384,L7="exit",va=[],XF=Te.rmdirSync.bind(Te),ZF=!1;function j7(t,e){return Te.rm(t,{recursive:!0},e)}function QF(t){return Te.rmSync(t,{recursive:!0})}function Oy(t,e){let r=Ca(t,e),n=r[0],o=r[1];Y7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=t2(a);Te.stat(c,function(f){if(!f)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 Fy(t){let e=Ca(t),r=e[0],n=J7(r),o=n.tries;do{let i=t2(n);try{Te.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function U7(t,e){let r=Ca(t,e),n=r[0],o=r[1];Oy(n,function(a,s){if(a)return o(a);Te.open(s,WF,n.mode||JF,function(c,f){if(c)return o(c);if(n.discardDescriptor)return Te.close(f,function(h){return o(h,s,void 0,xy(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,f,xy(s,d?-1:f,n,!1))}})})}function M7(t){let e=Ca(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Fy(r),i=Te.openSync(o,WF,r.mode||JF);return r.discardDescriptor&&(Te.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:xy(o,n?-1:i,r,!0)}}function q7(t,e){let r=Ca(t,e),n=r[0],o=r[1];Oy(n,function(a,s){if(a)return o(a);Te.mkdir(s,n.mode||YF,function(c){if(c)return o(c);o(null,s,e2(s,n,!1))})})}function H7(t){let e=Ca(t),r=e[0],n=Fy(r);return Te.mkdirSync(n,r.mode||YF),{name:n,removeCallback:e2(n,r,!0)}}function V7(t,e){let r=function(n){if(n&&!Ay(n))return e(n);e()};0<=t[0]?Te.close(t[0],function(){Te.unlink(t[1],r)}):Te.unlink(t[1],r)}function z7(t){let e=null;try{0<=t[0]&&Te.closeSync(t[0])}catch(r){if(!X7(r)&&!Ay(r))throw r}finally{try{Te.unlinkSync(t[1])}catch(r){Ay(r)||(e=r)}}if(e!==null)throw e}function xy(t,e,r,n){let o=If(z7,[e,t],n),i=If(V7,[e,t],n,o);return r.keep||va.unshift(o),n?o:i}function e2(t,e,r){let n=e.unsafeCleanup?j7:Te.rmdir.bind(Te),o=e.unsafeCleanup?QF:XF,i=If(o,t,r),a=If(n,t,r,i);return e.keep||va.unshift(i),r?i:a}function If(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=va.indexOf(s);return u>=0&&va.splice(u,1),o=!0,r||t===XF||t===QF?t(e):t(e,a||function(){})}}}function K7(){if(ZF)for(;va.length;)try{va[0]()}catch{}}function VF(t){let e=[],r=null;try{r=qF.randomBytes(t)}catch{r=qF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(HF[r[n]%HF.length]);return e.join("")}function lr(t){return typeof t>"u"}function Ca(t,e){if(typeof t=="function")return[{},t];if(lr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function G7(t,e,r){let n=wt.isAbsolute(t)?t:wt.join(e,t);Te.stat(n,function(o){o?Te.realpath(wt.dirname(n),function(i,a){if(i)return r(i);r(null,wt.join(a,wt.basename(n)))}):Te.realpath(n,r)})}function W7(t,e){let r=wt.isAbsolute(t)?t:wt.join(e,t);try{return Te.statSync(r),Te.realpathSync(r)}catch{let o=Te.realpathSync(wt.dirname(r));return wt.join(o,wt.basename(r))}}function t2(t){let e=t.tmpdir;if(!lr(t.name))return wt.join(e,t.dir,t.name);if(!lr(t.template))return wt.join(e,t.dir,t.template).replace(GF,VF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",VF(12),t.postfix?"-"+t.postfix:""].join("");return wt.join(e,t.dir,r)}function r2(t){if(!lr(t.name)){let e=t.name;if(wt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=wt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!lr(t.template)&&!t.template.match(GF))throw new Error(`Invalid template, found "${t.template}".`);if(!lr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=lr(t.name)?t.tries||T7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=lr(t.prefix)?"":t.prefix,t.postfix=lr(t.postfix)?"":t.postfix}function zF(t,e,r,n){if(lr(e))return n(null);G7(e,r,function(o,i){if(o)return n(o);let a=wt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function KF(t,e,r){if(lr(e))return;let n=W7(e,r),o=wt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function Y7(t,e){Q7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{r2(t,n)}catch(o){return e(o)}zF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=lr(i)?"":i,zF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function J7(t){let e=t.tmpdir=o2(t);r2(t,e);let r=KF("dir",t.dir,e);return t.dir=lr(r)?"":r,t.template=KF("template",t.template,e),t}function X7(t){return n2(t,-B7,"EBADF")}function Ay(t){return n2(t,-N7,"ENOENT")}function n2(t,e,r){return R7?t.code===r:t.code===r&&t.errno===e}function Z7(){ZF=!0}function Q7(t,e){return Te.realpath(t&&t.tmpdir||Tf.tmpdir(),e)}function o2(t){return Te.realpathSync(t&&t.tmpdir||Tf.tmpdir())}process.addListener(L7,K7);Object.defineProperty(vn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return o2()}});vn.exports.dir=q7;vn.exports.dirSync=H7;vn.exports.file=U7;vn.exports.fileSync=M7;vn.exports.tmpName=Oy;vn.exports.tmpNameSync=Fy;vn.exports.setGracefulCleanup=Z7});var Bf=require("node:process");var Qy=pe(Zy(),1),{program:at,createCommand:Nq,createArgument:Lq,createOption:jq,CommanderError:Uq,InvalidArgumentError:Mq,InvalidOptionArgumentError:qq,Command:Hq,Argument:Vq,Option:zq,Help:Kq}=Qy.default;var dr={name:"@capgo/cli",version:"7.61.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:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",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 && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^8.0.0","@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","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var fa=require("node:fs");var vt=pe(od(),1),Jo=require("node:process"),En=pe(require("node:readline"),1),cd=pe(require("node:readline"),1),fD=require("node:stream"),xa=pe(ad(),1);function q2({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 H2=q2();function dD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(H2,"")}function pD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hD={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 f=u[c],d=e.length(f);if(s>=o-(d==2?1:0))if(s+d<=i)a+=f;else break;s+=d}return a}})(hD);var V2=hD.exports,z2=pD(V2),K2=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},G2=pD(K2);function Aa(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=dD(t),t.length===0))return 0;t=t.replace(G2()," ");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(z2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var sd=10,nD=(t=0)=>e=>`\x1B[${e+t}m`,oD=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,iD=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,Ue={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(Ue.modifier);var W2=Object.keys(Ue.color),Y2=Object.keys(Ue.bgColor);[...W2,...Y2];function J2(){let t=new Map;for(let[e,r]of Object.entries(Ue)){for(let[n,o]of Object.entries(r))Ue[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=Ue[n],t.set(o[0],o[1]);Object.defineProperty(Ue,e,{value:r,enumerable:!1})}return Object.defineProperty(Ue,"codes",{value:t,enumerable:!1}),Ue.color.close="\x1B[39m",Ue.bgColor.close="\x1B[49m",Ue.color.ansi=nD(),Ue.color.ansi256=oD(),Ue.color.ansi16m=iD(),Ue.bgColor.ansi=nD(sd),Ue.bgColor.ansi256=oD(sd),Ue.bgColor.ansi16m=iD(sd),Object.defineProperties(Ue,{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=>Ue.rgbToAnsi256(...Ue.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)=>Ue.ansi256ToAnsi(Ue.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>Ue.ansi256ToAnsi(Ue.hexToAnsi256(e)),enumerable:!1}}),Ue}var X2=J2(),yu=new Set(["\x1B","\x9B"]),Z2=39,fd="\x07",mD="[",Q2="]",gD="m",dd=`${Q2}8;;`,aD=t=>`${yu.values().next().value}${mD}${t}${gD}`,sD=t=>`${yu.values().next().value}${dd}${t}${fd}`,ek=t=>t.split(" ").map(e=>Aa(e)),ud=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Aa(dD(t[t.length-1]));for(let[s,u]of n.entries()){let c=Aa(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),yu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(dd)),o){i?u===fd&&(o=!1,i=!1):u===gD&&(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())},tk=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Aa(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},rk=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=ek(t),s=[""];for(let[c,f]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Aa(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let h=e-d,p=1+Math.floor((a[c]-h-1)/e);Math.floor((a[c]-1)/e)<p&&s.push(""),ud(s,f,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){ud(s,f,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){ud(s,f,e);continue}s[s.length-1]+=f}r.trim!==!1&&(s=s.map(c=>tk(c)));let u=[...s.join(`
113
+ `)];for(let[c,f]of u.entries()){if(n+=f,yu.has(f)){let{groups:h}=new RegExp(`(?:\\${mD}(?<code>\\d+)m|\\${dd}(?<uri>.*)${fd})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let p=Number.parseFloat(h.code);o=p===Z2?void 0:p}else h.uri!==void 0&&(i=h.uri.length===0?void 0:h.uri)}let d=X2.codes.get(Number(o));u[c+1]===`
114
+ `?(i&&(n+=sD("")),o&&d&&(n+=aD(d))):f===`
115
+ `&&(o&&d&&(n+=aD(o)),i&&(n+=sD(i)))}return n};function uD(t,e,r){return String(t).normalize().replace(/\r\n/g,`
116
116
  `).split(`
117
- `).map(n=>Z2(n,e,r)).join(`
118
- `)}var Q2=["up","down","left","right","space","enter","cancel"],fu={actions:new Set(Q2),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function dd(t,e){if(typeof t=="string")return fu.aliases.get(t)===e;for(let r of t)if(r!==void 0&&dd(r,e))return!0;return!1}function eP(t,e){if(t===e)return;let r=t.split(`
117
+ `).map(n=>rk(n,e,r)).join(`
118
+ `)}var nk=["up","down","left","right","space","enter","cancel"],du={actions:new Set(nk),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function pd(t,e){if(typeof t=="string")return du.aliases.get(t)===e;for(let r of t)if(r!==void 0&&pd(r,e))return!0;return!1}function ok(t,e){if(t===e)return;let r=t.split(`
119
119
  `),n=e.split(`
120
- `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var tP=globalThis.process.platform.startsWith("win"),cd=Symbol("clack:cancel");function ue(t){return t===cd}function lu(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function gD({input:t=Yo.stdin,output:e=Yo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=En.createInterface({input:t,output:e,prompt:"",tabSize:1});En.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(dd([c,s,u],"cancel")){n&&e.write(vt.cursor.show),process.exit(0);return}if(!r)return;En.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{En.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(vt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(vt.cursor.show),t.isTTY&&!tP&&t.setRawMode(!1),o.terminal=!1,o.close()}}var rP=Object.defineProperty,nP=(t,e,r)=>e in t?rP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qt=(t,e,r)=>(nP(t,typeof e!="symbol"?e+"":e,r),r),Wo=class{constructor(e,r=!0){Qt(this,"input"),Qt(this,"output"),Qt(this,"_abortSignal"),Qt(this,"rl"),Qt(this,"opts"),Qt(this,"_render"),Qt(this,"_track",!1),Qt(this,"_prevFrame",""),Qt(this,"_subscribers",new Map),Qt(this,"_cursor",0),Qt(this,"state","initial"),Qt(this,"error",""),Qt(this,"value");let{input:n=Yo.stdin,output:o=Yo.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(cd);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new lD.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=ud.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),ud.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),lu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),lu(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),lu(this.input,!1),e(cd)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&fu.aliases.has(r.name)&&this.emit("cursor",fu.aliases.get(r.name)),fu.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")}dd([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(`
121
- `),lu(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=sD(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
122
- `).length-1;this.output.write(vt.cursor.move(-999,e*-1))}render(){let e=sD(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(vt.cursor.hide);else{let r=eP(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(vt.cursor.move(0,n)),this.output.write(vt.erase.lines(1));let o=e.split(`
120
+ `),o=[];for(let i=0;i<Math.max(r.length,n.length);i++)r[i]!==n[i]&&o.push(i);return o}var ik=globalThis.process.platform.startsWith("win"),ld=Symbol("clack:cancel");function le(t){return t===ld}function fu(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function yD({input:t=Jo.stdin,output:e=Jo.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let o=En.createInterface({input:t,output:e,prompt:"",tabSize:1});En.emitKeypressEvents(t,o),t.isTTY&&t.setRawMode(!0);let i=(a,{name:s,sequence:u})=>{let c=String(a);if(pd([c,s,u],"cancel")){n&&e.write(vt.cursor.show),process.exit(0);return}if(!r)return;En.moveCursor(e,s==="return"?0:-1,s==="return"?-1:0,()=>{En.clearLine(e,1,()=>{t.once("keypress",i)})})};return n&&e.write(vt.cursor.hide),t.once("keypress",i),()=>{t.off("keypress",i),n&&e.write(vt.cursor.show),t.isTTY&&!ik&&t.setRawMode(!1),o.terminal=!1,o.close()}}var ak=Object.defineProperty,sk=(t,e,r)=>e in t?ak(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qt=(t,e,r)=>(sk(t,typeof e!="symbol"?e+"":e,r),r),Yo=class{constructor(e,r=!0){Qt(this,"input"),Qt(this,"output"),Qt(this,"_abortSignal"),Qt(this,"rl"),Qt(this,"opts"),Qt(this,"_render"),Qt(this,"_track",!1),Qt(this,"_prevFrame",""),Qt(this,"_subscribers",new Map),Qt(this,"_cursor",0),Qt(this,"state","initial"),Qt(this,"error",""),Qt(this,"value");let{input:n=Jo.stdin,output:o=Jo.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(ld);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new fD.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=cd.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),cd.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),fu(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),fu(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(vt.cursor.show),this.output.off("resize",this.render),fu(this.input,!1),e(ld)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&du.aliases.has(r.name)&&this.emit("cursor",du.aliases.get(r.name)),du.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")}pd([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(`
121
+ `),fu(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(`
122
+ `).length-1;this.output.write(vt.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(vt.cursor.hide);else{let r=ok(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(vt.cursor.move(0,n)),this.output.write(vt.erase.lines(1));let o=e.split(`
123
123
  `);this.output.write(o[n]),this._prevFrame=e,this.output.write(vt.cursor.move(0,o.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(vt.cursor.move(0,n)),this.output.write(vt.erase.down());let o=e.split(`
124
124
  `).slice(n);this.output.write(o.join(`
125
- `)),this._prevFrame=e;return}this.output.write(vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},du=class extends Wo{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(vt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var oP;oP=new WeakMap;var iP=Object.defineProperty,aP=(t,e,r)=>e in t?iP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,uD=(t,e,r)=>(aP(t,typeof e!="symbol"?e+"":e,r),r),pu=class extends Wo{constructor({mask:e,...r}){super(r),uD(this,"valueWithCursor",""),uD(this,"_mask","\u2022"),this._mask=e??"\u2022",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${Sa.default.inverse(Sa.default.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),o=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${Sa.default.inverse(o[0])}${o.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},sP=Object.defineProperty,uP=(t,e,r)=>e in t?sP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cD=(t,e,r)=>(uP(t,typeof e!="symbol"?e+"":e,r),r),hu=class extends Wo{constructor(e){super(e,!1),cD(this,"options"),cD(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 mu=class extends Wo{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}${Sa.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var pr=de(require("node:process"),1),V=de(id(),1),yu=de(nd(),1);function cP(){return pr.default.platform!=="win32"?pr.default.env.TERM!=="linux":!!pr.default.env.CI||!!pr.default.env.WT_SESSION||!!pr.default.env.TERMINUS_SUBLIME||pr.default.env.ConEmuTask==="{cmd::Cmder}"||pr.default.env.TERM_PROGRAM==="Terminus-Sublime"||pr.default.env.TERM_PROGRAM==="vscode"||pr.default.env.TERM==="xterm-256color"||pr.default.env.TERM==="alacritty"||pr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var pd=cP(),et=(t,e)=>pd?t:e,lP=et("\u25C6","*"),yD=et("\u25A0","x"),DD=et("\u25B2","x"),gd=et("\u25C7","o"),fP=et("\u250C","T"),Fe=et("\u2502","|"),_n=et("\u2514","\u2014"),hd=et("\u25CF",">"),md=et("\u25CB"," "),Xq=et("\u25FB","[\u2022]"),Zq=et("\u25FC","[+]"),Qq=et("\u25FB","[ ]"),dP=et("\u25AA","\u2022"),eH=et("\u2500","-"),tH=et("\u256E","+"),rH=et("\u251C","+"),nH=et("\u256F","+"),pP=et("\u25CF","\u2022"),hP=et("\u25C6","*"),mP=et("\u25B2","!"),gP=et("\u25A0","x"),Du=t=>{switch(t){case"initial":case"active":return V.default.cyan(lP);case"cancel":return V.default.red(yD);case"error":return V.default.yellow(DD);case"submit":return V.default.green(gd)}},yP=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((f,d,p)=>{let h=d===0&&u,m=d===p.length-1&&c;return h||m?V.default.dim("..."):n(f,d+s===e)})},qt=t=>new mu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${V.default.gray(Fe)}
126
- ${Du(this.state)} ${t.message}
125
+ `)),this._prevFrame=e;return}this.output.write(vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},pu=class extends Yo{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(vt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var uk;uk=new WeakMap;var ck=Object.defineProperty,lk=(t,e,r)=>e in t?ck(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cD=(t,e,r)=>(lk(t,typeof e!="symbol"?e+"":e,r),r),hu=class extends Yo{constructor({mask:e,...r}){super(r),cD(this,"valueWithCursor",""),cD(this,"_mask","\u2022"),this._mask=e??"\u2022",this.on("finalize",()=>{this.valueWithCursor=this.masked}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${xa.default.inverse(xa.default.hidden("_"))}`;else{let n=this.masked.slice(0,this.cursor),o=this.masked.slice(this.cursor);this.valueWithCursor=`${n}${xa.default.inverse(o[0])}${o.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},fk=Object.defineProperty,dk=(t,e,r)=>e in t?fk(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lD=(t,e,r)=>(dk(t,typeof e!="symbol"?e+"":e,r),r),mu=class extends Yo{constructor(e){super(e,!1),lD(this,"options"),lD(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 gu=class extends Yo{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}${xa.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var pr=pe(require("node:process"),1),V=pe(ad(),1),Du=pe(od(),1);function pk(){return pr.default.platform!=="win32"?pr.default.env.TERM!=="linux":!!pr.default.env.CI||!!pr.default.env.WT_SESSION||!!pr.default.env.TERMINUS_SUBLIME||pr.default.env.ConEmuTask==="{cmd::Cmder}"||pr.default.env.TERM_PROGRAM==="Terminus-Sublime"||pr.default.env.TERM_PROGRAM==="vscode"||pr.default.env.TERM==="xterm-256color"||pr.default.env.TERM==="alacritty"||pr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var hd=pk(),tt=(t,e)=>hd?t:e,hk=tt("\u25C6","*"),DD=tt("\u25A0","x"),bD=tt("\u25B2","x"),yd=tt("\u25C7","o"),mk=tt("\u250C","T"),Fe=tt("\u2502","|"),_n=tt("\u2514","\u2014"),md=tt("\u25CF",">"),gd=tt("\u25CB"," "),nH=tt("\u25FB","[\u2022]"),oH=tt("\u25FC","[+]"),iH=tt("\u25FB","[ ]"),gk=tt("\u25AA","\u2022"),aH=tt("\u2500","-"),sH=tt("\u256E","+"),uH=tt("\u251C","+"),cH=tt("\u256F","+"),yk=tt("\u25CF","\u2022"),Dk=tt("\u25C6","*"),bk=tt("\u25B2","!"),wk=tt("\u25A0","x"),bu=t=>{switch(t){case"initial":case"active":return V.default.cyan(hk);case"cancel":return V.default.red(DD);case"error":return V.default.yellow(bD);case"submit":return V.default.green(yd)}},vk=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((f,d,h)=>{let p=d===0&&u,m=d===h.length-1&&c;return p||m?V.default.dim("..."):n(f,d+s===e)})},qt=t=>new gu({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${V.default.gray(Fe)}
126
+ ${bu(this.state)} ${t.message}
127
127
  `,r=t.placeholder?V.default.inverse(t.placeholder[0])+V.default.dim(t.placeholder.slice(1)):V.default.inverse(V.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
128
128
  ${V.default.yellow(Fe)} ${n}
129
129
  ${V.default.yellow(_n)} ${V.default.yellow(this.error)}
130
130
  `;case"submit":return`${e}${V.default.gray(Fe)} ${V.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${V.default.gray(Fe)} ${V.default.strikethrough(V.default.dim(this.value??""))}${this.value?.trim()?`
131
131
  ${V.default.gray(Fe)}`:""}`;default:return`${e}${V.default.cyan(Fe)} ${n}
132
132
  ${V.default.cyan(_n)}
133
- `}}}).prompt(),bD=t=>new pu({validate:t.validate,mask:t.mask??dP,render(){let e=`${V.default.gray(Fe)}
134
- ${Du(this.state)} ${t.message}
133
+ `}}}).prompt(),wD=t=>new hu({validate:t.validate,mask:t.mask??gk,render(){let e=`${V.default.gray(Fe)}
134
+ ${bu(this.state)} ${t.message}
135
135
  `,r=this.valueWithCursor,n=this.masked;switch(this.state){case"error":return`${e.trim()}
136
136
  ${V.default.yellow(Fe)} ${n}
137
137
  ${V.default.yellow(_n)} ${V.default.yellow(this.error)}
138
138
  `;case"submit":return`${e}${V.default.gray(Fe)} ${V.default.dim(n)}`;case"cancel":return`${e}${V.default.gray(Fe)} ${V.default.strikethrough(V.default.dim(n??""))}${n?`
139
139
  ${V.default.gray(Fe)}`:""}`;default:return`${e}${V.default.cyan(Fe)} ${r}
140
140
  ${V.default.cyan(_n)}
141
- `}}}).prompt(),ce=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new du({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${V.default.gray(Fe)}
142
- ${Du(this.state)} ${t.message}
141
+ `}}}).prompt(),fe=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new pu({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${V.default.gray(Fe)}
142
+ ${bu(this.state)} ${t.message}
143
143
  `,o=this.value?e:r;switch(this.state){case"submit":return`${n}${V.default.gray(Fe)} ${V.default.dim(o)}`;case"cancel":return`${n}${V.default.gray(Fe)} ${V.default.strikethrough(V.default.dim(o))}
144
- ${V.default.gray(Fe)}`;default:return`${n}${V.default.cyan(Fe)} ${this.value?`${V.default.green(hd)} ${e}`:`${V.default.dim(md)} ${V.default.dim(e)}`} ${V.default.dim("/")} ${this.value?`${V.default.dim(md)} ${V.default.dim(r)}`:`${V.default.green(hd)} ${r}`}
144
+ ${V.default.gray(Fe)}`;default:return`${n}${V.default.cyan(Fe)} ${this.value?`${V.default.green(md)} ${e}`:`${V.default.dim(gd)} ${V.default.dim(e)}`} ${V.default.dim("/")} ${this.value?`${V.default.dim(gd)} ${V.default.dim(r)}`:`${V.default.green(md)} ${r}`}
145
145
  ${V.default.cyan(_n)}
146
- `}}}).prompt()},gt=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${V.default.dim(o)}`;case"active":return`${V.default.green(hd)} ${o} ${r.hint?V.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${V.default.strikethrough(V.default.dim(o))}`;default:return`${V.default.dim(md)} ${V.default.dim(o)}`}};return new hu({options:t.options,initialValue:t.initialValue,render(){let r=`${V.default.gray(Fe)}
147
- ${Du(this.state)} ${t.message}
146
+ `}}}).prompt()},mt=t=>{let e=(r,n)=>{let o=r.label??String(r.value);switch(n){case"selected":return`${V.default.dim(o)}`;case"active":return`${V.default.green(md)} ${o} ${r.hint?V.default.dim(`(${r.hint})`):""}`;case"cancelled":return`${V.default.strikethrough(V.default.dim(o))}`;default:return`${V.default.dim(gd)} ${V.default.dim(o)}`}};return new mu({options:t.options,initialValue:t.initialValue,render(){let r=`${V.default.gray(Fe)}
147
+ ${bu(this.state)} ${t.message}
148
148
  `;switch(this.state){case"submit":return`${r}${V.default.gray(Fe)} ${e(this.options[this.cursor],"selected")}`;case"cancel":return`${r}${V.default.gray(Fe)} ${e(this.options[this.cursor],"cancelled")}
149
- ${V.default.gray(Fe)}`;default:return`${r}${V.default.cyan(Fe)} ${yP({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
149
+ ${V.default.gray(Fe)}`;default:return`${r}${V.default.cyan(Fe)} ${vk({cursor:this.cursor,options:this.options,maxItems:t.maxItems,style:(n,o)=>e(n,o?"active":"inactive")}).join(`
150
150
  ${V.default.cyan(Fe)} `)}
151
151
  ${V.default.cyan(_n)}
152
- `}}}).prompt()};var Jn=(t="")=>{process.stdout.write(`${V.default.gray(_n)} ${V.default.red(t)}
152
+ `}}}).prompt()};var Xn=(t="")=>{process.stdout.write(`${V.default.gray(_n)} ${V.default.red(t)}
153
153
 
154
- `)},ee=(t="")=>{process.stdout.write(`${V.default.gray(fP)} ${t}
154
+ `)},ee=(t="")=>{process.stdout.write(`${V.default.gray(mk)} ${t}
155
155
  `)},G=(t="")=>{process.stdout.write(`${V.default.gray(Fe)}
156
156
  ${V.default.gray(_n)} ${t}
157
157
 
158
158
  `)},l={message:(t="",{symbol:e=V.default.gray(Fe)}={})=>{let r=[`${V.default.gray(Fe)}`];if(t){let[n,...o]=t.split(`
159
159
  `);r.push(`${e} ${n}`,...o.map(i=>`${V.default.gray(Fe)} ${i}`))}process.stdout.write(`${r.join(`
160
160
  `)}
161
- `)},info:t=>{l.message(t,{symbol:V.default.blue(pP)})},success:t=>{l.message(t,{symbol:V.default.green(hP)})},step:t=>{l.message(t,{symbol:V.default.green(gd)})},warn:t=>{l.message(t,{symbol:V.default.yellow(mP)})},warning:t=>{l.warn(t)},error:t=>{l.message(t,{symbol:V.default.red(gP)})}},oH=`${V.default.gray(Fe)} `;var _e=({indicator:t="dots"}={})=>{let e=pd?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=pd?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),f=_=>{let S=_>1?"Something went wrong":"Canceled";a&&y(S,_)},d=()=>f(2),p=()=>f(1),h=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",p),process.on("SIGTERM",p),process.on("exit",f)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",p),process.removeListener("SIGTERM",p),process.removeListener("exit",f)},g=()=>{if(u===void 0)return;n&&process.stdout.write(`
162
- `);let _=u.split(`
163
- `);process.stdout.write(yu.cursor.move(-999,_.length-1)),process.stdout.write(yu.erase.down(_.length))},D=_=>_.replace(/\.+$/,""),v=_=>{let S=(performance.now()-_)/1e3,k=Math.floor(S/60),T=Math.floor(S%60);return k>0?`[${k}m ${T}s]`:`[${T}s]`},E=(_="")=>{a=!0,o=gD(),s=D(_),c=performance.now(),process.stdout.write(`${V.default.gray(Fe)}
164
- `);let S=0,k=0;h(),i=setInterval(()=>{if(n&&s===u)return;g(),u=s;let T=V.default.magenta(e[S]);if(n)process.stdout.write(`${T} ${s}...`);else if(t==="timer")process.stdout.write(`${T} ${s} ${v(c)}`);else{let B=".".repeat(Math.floor(k)).slice(0,3);process.stdout.write(`${T} ${s}${B}`)}S=S+1<e.length?S+1:0,k=k<e.length?k+.125:0},r)},y=(_="",S=0)=>{a=!1,clearInterval(i),g();let k=S===0?V.default.green(gd):S===1?V.default.red(yD):V.default.red(DD);s=D(_??s),t==="timer"?process.stdout.write(`${k} ${s} ${v(c)}
165
- `):process.stdout.write(`${k} ${s}
166
- `),m(),o()};return{start:E,stop:y,message:(_="")=>{s=D(_??s)}}};var LA=require("node:child_process"),De=require("node:fs"),Gl=require("node:os"),fe=de(require("node:path")),nr=require("node:process"),Vr=de(wu());var Ft=require("fs"),Oa=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bun":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm":(0,Ft.existsSync)(a)?"yarn":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npm":e},vu=(t=Oa(),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"}},wD=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bunx":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm exec":(0,Ft.existsSync)(a)?"yarn dlx":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npx":e};function Cu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function ED(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function wd(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 Jo="0|[1-9]\\d*",vP="\\d*[a-zA-Z-][a-zA-Z0-9-]*",CP=`(?<major>${Jo})\\.(?<minor>${Jo})\\.(?<patch>${Jo})`,vD=`(?:${Jo}|${vP})`,_D=`(?:-(?<prerelease>${vD}(?:\\.${vD})*))`,CD="[0-9A-Za-z-]+",SD=`(?:\\+(?<buildmetadata>${CD}(?:\\.${CD})*))`,xD=`v?${CP}${_D}?${SD}?`,AD=new RegExp(`^${xD}$`),OD="(?:<|>)?=?",EP="x|X|\\*",bd=`${Jo}|${EP}`,Eu=`[v=\\s]*(?<major>${bd})(?:\\.(?<minor>${bd})(?:\\.(?<patch>${bd})${_D}?${SD}?)?)?`,FD=new RegExp(`^(?<operator>~>?|\\^|${OD})\\s*${Eu}$`),PD=new RegExp(`^(?<operator>${OD})\\s*(${xD})$|^$`);function vd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Cd=256;var _P=new RegExp(`^${Jo}$`);function Pt(t){return t.split(".").filter(Boolean).map(e=>{if(_P.test(e)){let r=Number(e);if(vd(r))return r}return e})}function Ar(t){return t.split(".").filter(Boolean)}function xn(t,e){let r=Number(t);if(!vd(r))throw new TypeError(e);return r}function tn(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 kt(t,e){return t===e?0:Cu(t.major,e.major)||Cu(t.minor,e.minor)||Cu(t.patch,e.patch)||ED(t.prerelease,e.prerelease)||wd(t.prerelease,e.prerelease)}function Ed(t){return t.toFixed(0)}function Vt(t){let e=Ed(t.major),r=Ed(t.minor),n=Ed(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 SP(t,e){if(tn(e))return!0;let r=kt(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 _u(t,e){for(let r of e)if(!SP(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(tn(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 Fa(t,e){return e.some(r=>_u(t,r))}function xP(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 Pa(t=[],e){let r=xP(t);if(!e)return r;let n=Pt(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 An(t,e,r={}){let n=r.build!==void 0?Ar(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Pa(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:Pa(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:Pa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Su={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Xo={operator:void 0,...Su};function _d(t,e){return kt(t,e)>0}function er(t,e){return kt(t,e)<0}function AP(t){let r=t.match(PD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:xn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:xn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:xn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?Pt(o):[],build:i?Ar(i):[]}:Su;return{operator:n||void 0,...a}}function Re(t){return!t||t.toLowerCase()==="x"||t==="*"}function OP(t){if(!Re(t.major))return Re(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Re(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?Pt(t.prerelease):[],build:[]}}function FP(t){if(!Re(t.major))return Re(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Re(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:Pt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function PP(t){let e=t.match(new RegExp(`^${Eu}`)),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(`^${Eu}\\s*$`))?.groups;if(!s)return null;let u=OP(r),c=FP(s);return[u,c].filter(Boolean)}function kP(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Xo];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=Pt(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 $P(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Xo];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=Pt(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function IP(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function TP(t){let e=Re(t.minor),r=Re(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=Pt(t.prerelease??""),s=Ar(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function RP(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function BP(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Xo];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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function NP(t){let e=Re(t.major),r=Re(t.minor),n=Re(t.patch),o=+t.major,i=+t.minor,a=+t.patch;if(e)return[Xo];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=Pt(t.prerelease??""),u=Ar(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function LP(t){let e=t.match(FD)?.groups;if(!e)return AP(t);switch(e.operator){case"^":return kP(e);case"~":case"~>":return $P(e);case"<":return IP(e);case"<=":return TP(e);case">":return RP(e);case">=":return BP(e);case"=":case"":return NP(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function jP(t){return t.split(/\s+/).flatMap(LP)}function xu(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>PP(r)||jP(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function ye(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Cd)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Cd}`);t=t.trim();let e=t.match(AD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=xn(e.major,`Cannot parse version ${t}: invalid major version`),n=xn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=xn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?Pt(e.prerelease):[],a=e.buildmetadata?Ar(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function kD(t,e){let r=t.operator,n=e.operator;if(r===void 0)return tn(t)?!0:Fa(t,[[e]]);if(n===void 0)return tn(e)?!0:Fa(e,[[t]]);let o=kt(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 UP(t){return t.every(e=>e.some(r=>MP(r)))}function MP(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!kD(r,n))return!1}return!0}function $D(t,e){return UP([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>kD(o,i)))))}function ID(t){try{return ye(t),!0}catch{return!1}}function TD(t,e){return kt(t,e)>=0}var na=de(z0()),Lg=de(ah()),jA=de(ew()),Wl=de(al());function dE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var ut=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?dE("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))+dE("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(`
167
- `)}};async function sl(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 Ee(){let t=await sl("@capgo/cli")??"",e=t?.split(".")[0];t!==dr.version&&l.warning(`\u{1F6A8} You are using @capgo/cli@${dr.version} it's not the latest version.
168
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function sN(t){return new Promise(e=>{setTimeout(e,t)})}function uN(t){return new Date(t||"").toLocaleTimeString()}async function Ct(t,e,r,n,o,i="\u2705"){await ge(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function cN(t,e,r,n){if(ue(e))throw await Ct(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function lN(t,e,r){try{let n=await br(),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),l.error(`Cannot get stats ${M(n)}`)}return[]}function fN(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}/settings/organization/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"},disableProdBuild:{summary:()=>"Prod build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},disableDevice:{summary:()=>"Physical device 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 dN(t,e,r,n,o,i){let a=fN(t);if(!a)return{};a.snag&&await Ct(e,r,n,a.snag);let s=uN(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",f=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${f}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function wm(t,e,r,n,o){let i=!0,a=await br(),s=`${a.hostWeb}/app/${r}`;await Ct(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,f=new Set,d=_e(),p=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`);i;){await sN(5e3);let h=await lN(e,u,c);if(h.length>0){let m=h.reduce((E,y)=>{let _=new Date(y.created_at).getTime();return Math.max(E,_)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let g=h.filter(E=>{let y=`${E.app_id}|${E.device_id}|${E.action}|${E.version_id}|${E.created_at}`;return f.has(y)?!1:(f.add(y),!0)}).sort((E,y)=>new Date(E.created_at).getTime()-new Date(y.created_at).getTime()),D=new ut;D.headers=["Time","Device","Key","Message"],D.theme=ut.roundTheme,D.rows=[];let v=!1;for(let E of g){let{row:y,stop:_}=await dN(E,t,n,e,s,a.hostWeb);y&&D.rows.push(y),_&&(v=!0)}if(D.rows.length&&(d.stop(""),l.info(D.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${p}`)),v){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function pE(t,e){ee("Debug Live update in Capgo"),await Ee(),e.apikey=e.apikey||ne();let r=await te();t=pe(t,r?.config);let n=e.device;if(!e.apikey)throw l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw l.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 Et(o,t),a=await ce({message:"Automatic check if update working in device ?"});await cN("debug",a,i,e.apikey),a?(l.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await wm("debug",e.apikey,t,i,n),G("Done \u2705")):G("Canceled \u274C")}var vm=require("node:buffer"),hE=require("node:crypto"),pN=(()=>{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 hN(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=pN[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function cn(t,e="sha256"){let r=vm.Buffer.isBuffer(t)?t:vm.Buffer.from(t);if(e==="crc32")return hN(r);let n=(0,hE.createHash)(e);return n.update(r),n.digest("hex")}var Fs=de(zx());async function Kx(){let t=await(0,Fs.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function hg(t,e,r=!1){let n=await(0,Fs.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,Fs.writeConfig)(o,n.app.extConfigFilePath))}async function Qi(t,e=!1){await hg("CapacitorUpdater",t,e)}var oa=".capgo_key",ir=".capgo_key_v2",Yl=`${oa}.pub`,hn=`${ir}.pub`,IA="https://capgo.app",TA="https://files.capgo.app",RA="https://api.capgo.app",BA="https://console.capgo.app",jg=12e4,WM=1024*1024*20,YM=1024*1024*1024,JM=1024*1024*99,or="package.json",ia=/^(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,M=t=>t?`
169
- ${jA.default.render(t)}`:"";function Kl(t){return new Promise(e=>{setTimeout(e,t)})}function UA(t){return(0,Vr.isMonorepo)(t)||(0,Vr.isNXMonorepo)(t)}function bt(t){return(0,Vr.isMonorepo)(t)?(0,Vr.findMonorepoRoot)(t):(0,Vr.isNXMonorepo)(t)?(0,Vr.findNXMonorepoRoot)(t):t}function MA(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,De.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw l.error(o),new Error(o)}let n=(0,De.readFileSync)(r??(0,fe.join)(t,or));return JSON.parse(n)}function Ug(t=bt((0,nr.cwd)()),e=void 0){return MA(t,e).scripts}function Ir(t=bt((0,nr.cwd)()),e=void 0){return MA(t,e).version??""}function XM(t){let e=t.replace("^","").replace("~","");if(ID(e))try{let r=ye(e);return Vt(r)}catch{return e}return e}async function zr(t,e=(0,nr.cwd)(),r){let n=r?(0,fe.dirname)(r):e;try{let a=`${t}/package.json`,{createRequire:s}=await import("node:module"),c=s((0,fe.join)(n,"package.json")).resolve(a),f=JSON.parse((0,De.readFileSync)(c,"utf-8"));if(f.version)return f.version}catch{}let o=n,i=fe.default.parse(o).root;for(;o!==i;){let a=(0,fe.join)(o,"node_modules",t,or);if((0,De.existsSync)(a))try{let u=JSON.parse((0,De.readFileSync)(a,"utf-8"));if(u.version)return u.version}catch{}let s=(0,fe.dirname)(o);if(s===o)break;o=s}if(t==="@capgo/capacitor-updater"){let a=null,s=(0,fe.join)(e,"ios","App","Podfile");if((0,De.existsSync)(s))try{let c=(0,De.readFileSync)(s,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(a=(0,fe.resolve)((0,fe.join)(e,"ios","App",c[1])))}catch{}if(!a){let u=(0,fe.join)(e,"android","capacitor.settings.gradle");if((0,De.existsSync)(u))try{let f=(0,De.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);f?.[1]&&(a=(0,fe.resolve)((0,fe.join)(e,"android",f[1])).replace(/\/android$/,""))}catch{}}if(a){let u=(0,fe.join)(a,or);if((0,De.existsSync)(u))try{let c=JSON.parse((0,De.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}}try{let s=(await Cr(e)).get(t);if(s)return s}catch{}return null}async function Cr(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,fe.join)(t,or)],r){for(let i of r)if(!(0,De.existsSync)(i)){let a=`Package.json at ${i} does not exist`;throw l.error(a),new Error(a)}}let n=new Map,{createRequire:o}=await import("node:module");for(let i of r){let a=(0,De.readFileSync)(i),s=JSON.parse(a),u=(0,fe.dirname)(i),c=(f,d)=>{try{let g=o((0,fe.join)(u,"package.json")).resolve(`${f}/package.json`),D=JSON.parse((0,De.readFileSync)(g,"utf-8"));if(D.version)return D.version}catch{}let p=u,h=fe.default.parse(p).root;for(;p!==h;){let m=(0,fe.join)(p,"node_modules",f,or);if((0,De.existsSync)(m))try{let D=JSON.parse((0,De.readFileSync)(m,"utf-8"));if(D.version)return D.version}catch{}let g=(0,fe.dirname)(p);if(g===p)break;p=g}return XM(d)};for(let f in s.dependencies)n.set(f,c(f,s.dependencies[f]));for(let f in s.devDependencies)n.set(f,c(f,s.devDependencies[f]))}return n}async function te(){try{let t=await Kx();if(!t){let e="No capacitor config file found, run `cap init` first";throw l.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${M(t)}`;throw l.error(e),new Error(e)}}async function Mg(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 hg(t,r)),r}async function Is(t){return Mg("CapacitorUpdater",t)}async function br(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||IA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||BA,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&&(l.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:IA,hostWeb:BA,hostFilesApi:TA,hostApi:RA}}}var ZM=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Jl(){let t=await br();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 l.info(`Local config ${M(t)}`),t}}async function qA(){let t=await br();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:YM,maxChunkSize:JM,alertUploadSize:WM}}}async function re(t,e,r){let n=await Jl();if(e&&r&&(l.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw l.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,na.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function QM(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){l.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 l.error(i),new Error("Invalid API key or insufficient permissions.")}}async function HA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function VA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function e5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function t5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var St=(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))(St||{}),aa=(t,e)=>t>=e;async function zA(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 l.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")?(l.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(l.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 l.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 KA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){l.error(`Cannot get cli warnings: ${M(o)}`);return}if(n.length>0){l.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"){l.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(l.error(`${s.message.replaceAll("\\n",`
161
+ `)},info:t=>{l.message(t,{symbol:V.default.blue(yk)})},success:t=>{l.message(t,{symbol:V.default.green(Dk)})},step:t=>{l.message(t,{symbol:V.default.green(yd)})},warn:t=>{l.message(t,{symbol:V.default.yellow(bk)})},warning:t=>{l.warn(t)},error:t=>{l.message(t,{symbol:V.default.red(wk)})}},lH=`${V.default.gray(Fe)} `;var _e=({indicator:t="dots"}={})=>{let e=hd?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=hd?80:120,n=process.env.CI==="true",o,i,a=!1,s="",u,c=performance.now(),f=E=>{let S=E>1?"Something went wrong":"Canceled";a&&y(S,E)},d=()=>f(2),h=()=>f(1),p=()=>{process.on("uncaughtExceptionMonitor",d),process.on("unhandledRejection",d),process.on("SIGINT",h),process.on("SIGTERM",h),process.on("exit",f)},m=()=>{process.removeListener("uncaughtExceptionMonitor",d),process.removeListener("unhandledRejection",d),process.removeListener("SIGINT",h),process.removeListener("SIGTERM",h),process.removeListener("exit",f)},g=()=>{if(u===void 0)return;n&&process.stdout.write(`
162
+ `);let E=u.split(`
163
+ `);process.stdout.write(Du.cursor.move(-999,E.length-1)),process.stdout.write(Du.erase.down(E.length))},D=E=>E.replace(/\.+$/,""),v=E=>{let S=(performance.now()-E)/1e3,P=Math.floor(S/60),T=Math.floor(S%60);return P>0?`[${P}m ${T}s]`:`[${T}s]`},_=(E="")=>{a=!0,o=yD(),s=D(E),c=performance.now(),process.stdout.write(`${V.default.gray(Fe)}
164
+ `);let S=0,P=0;p(),i=setInterval(()=>{if(n&&s===u)return;g(),u=s;let T=V.default.magenta(e[S]);if(n)process.stdout.write(`${T} ${s}...`);else if(t==="timer")process.stdout.write(`${T} ${s} ${v(c)}`);else{let B=".".repeat(Math.floor(P)).slice(0,3);process.stdout.write(`${T} ${s}${B}`)}S=S+1<e.length?S+1:0,P=P<e.length?P+.125:0},r)},y=(E="",S=0)=>{a=!1,clearInterval(i),g();let P=S===0?V.default.green(yd):S===1?V.default.red(DD):V.default.red(bD);s=D(E??s),t==="timer"?process.stdout.write(`${P} ${s} ${v(c)}
165
+ `):process.stdout.write(`${P} ${s}
166
+ `),m(),o()};return{start:_,stop:y,message:(E="")=>{s=D(E??s)}}};var jA=require("node:child_process"),se=require("node:fs"),Wl=require("node:os"),re=pe(require("node:path")),nr=require("node:process"),Vr=pe(vu());var Ft=require("fs"),Fa=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bun":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm":(0,Ft.existsSync)(a)?"yarn":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npm":e},Cu=(t=Fa(),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"}},vD=(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,Ft.existsSync)(r)||(0,Ft.existsSync)(n)?"bunx":(0,Ft.existsSync)(o)||(0,Ft.existsSync)(i)?"pnpm exec":(0,Ft.existsSync)(a)?"yarn dlx":(0,Ft.existsSync)(s)||(0,Ft.existsSync)(u)?"npx":e};function Eu(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function _D(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function vd(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 Xo="0|[1-9]\\d*",Sk="\\d*[a-zA-Z-][a-zA-Z0-9-]*",xk=`(?<major>${Xo})\\.(?<minor>${Xo})\\.(?<patch>${Xo})`,CD=`(?:${Xo}|${Sk})`,SD=`(?:-(?<prerelease>${CD}(?:\\.${CD})*))`,ED="[0-9A-Za-z-]+",xD=`(?:\\+(?<buildmetadata>${ED}(?:\\.${ED})*))`,AD=`v?${xk}${SD}?${xD}?`,OD=new RegExp(`^${AD}$`),FD="(?:<|>)?=?",Ak="x|X|\\*",wd=`${Xo}|${Ak}`,_u=`[v=\\s]*(?<major>${wd})(?:\\.(?<minor>${wd})(?:\\.(?<patch>${wd})${SD}?${xD}?)?)?`,kD=new RegExp(`^(?<operator>~>?|\\^|${FD})\\s*${_u}$`),PD=new RegExp(`^(?<operator>${FD})\\s*(${AD})$|^$`);function Cd(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Ed=256;var Ok=new RegExp(`^${Xo}$`);function kt(t){return t.split(".").filter(Boolean).map(e=>{if(Ok.test(e)){let r=Number(e);if(Cd(r))return r}return e})}function Ar(t){return t.split(".").filter(Boolean)}function xn(t,e){let r=Number(t);if(!Cd(r))throw new TypeError(e);return r}function tn(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 Pt(t,e){return t===e?0:Eu(t.major,e.major)||Eu(t.minor,e.minor)||Eu(t.patch,e.patch)||_D(t.prerelease,e.prerelease)||vd(t.prerelease,e.prerelease)}function _d(t){return t.toFixed(0)}function Vt(t){let e=_d(t.major),r=_d(t.minor),n=_d(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 Fk(t,e){if(tn(e))return!0;let r=Pt(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 Su(t,e){for(let r of e)if(!Fk(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(tn(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 ka(t,e){return e.some(r=>Su(t,r))}function kk(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 Pa(t=[],e){let r=kk(t);if(!e)return r;let n=kt(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 An(t,e,r={}){let n=r.build!==void 0?Ar(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Pa(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Pa(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:Pa(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:Pa(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var xu={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Zo={operator:void 0,...xu};function Sd(t,e){return Pt(t,e)>0}function er(t,e){return Pt(t,e)<0}function Pk(t){let r=t.match(PD)?.groups;if(!r)return null;let{operator:n,prerelease:o,buildmetadata:i}=r,a=r.major?{major:xn(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:xn(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:xn(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:o?kt(o):[],build:i?Ar(i):[]}:xu;return{operator:n||void 0,...a}}function Re(t){return!t||t.toLowerCase()==="x"||t==="*"}function $k(t){if(!Re(t.major))return Re(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Re(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?kt(t.prerelease):[],build:[]}}function Ik(t){if(!Re(t.major))return Re(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Re(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:kt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function Tk(t){let e=t.match(new RegExp(`^${_u}`)),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(`^${_u}\\s*$`))?.groups;if(!s)return null;let u=$k(r),c=Ik(s);return[u,c].filter(Boolean)}function Rk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(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 Bk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(t.prerelease??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s},{operator:"<",major:o,minor:i+1,patch:0}]}function Nk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(t.prerelease??""),u=Ar(t.build??"");return[{operator:"<",major:o,minor:i,patch:a,prerelease:s,build:u}]}function Lk(t){let e=Re(t.minor),r=Re(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=kt(t.prerelease??""),s=Ar(t.build??"");return[{operator:"<=",major:n,minor:o,patch:i,prerelease:a,build:s}]}function jk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">",major:o,minor:i,patch:a,prerelease:s,build:u}]}function Uk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(t.prerelease??""),u=Ar(t.build??"");return[{operator:">=",major:o,minor:i,patch:a,prerelease:s,build:u}]}function Mk(t){let e=Re(t.major),r=Re(t.minor),n=Re(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=kt(t.prerelease??""),u=Ar(t.build??"");return[{operator:void 0,major:o,minor:i,patch:a,prerelease:s,build:u}]}function qk(t){let e=t.match(kD)?.groups;if(!e)return Pk(t);switch(e.operator){case"^":return Rk(e);case"~":case"~>":return Bk(e);case"<":return Nk(e);case"<=":return Lk(e);case">":return jk(e);case">=":return Uk(e);case"=":case"":return Mk(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function Hk(t){return t.split(/\s+/).flatMap(qk)}function Au(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>Tk(r)||Hk(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function De(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Ed)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Ed}`);t=t.trim();let e=t.match(OD)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=xn(e.major,`Cannot parse version ${t}: invalid major version`),n=xn(e.minor,`Cannot parse version ${t}: invalid minor version`),o=xn(e.patch,`Cannot parse version ${t}: invalid patch version`),i=e.prerelease?kt(e.prerelease):[],a=e.buildmetadata?Ar(e.buildmetadata):[];return{major:r,minor:n,patch:o,prerelease:i,build:a}}function $D(t,e){let r=t.operator,n=e.operator;if(r===void 0)return tn(t)?!0:ka(t,[[e]]);if(n===void 0)return tn(e)?!0:ka(e,[[t]]);let o=Pt(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 Vk(t){return t.every(e=>e.some(r=>zk(r)))}function zk(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!$D(r,n))return!1}return!0}function ID(t,e){return Vk([t,e])&&t.some(r=>e.some(n=>r.every(o=>n.every(i=>$D(o,i)))))}function TD(t){try{return De(t),!0}catch{return!1}}function RD(t,e){return Pt(t,e)>=0}var oa=pe(K0()),jg=pe(sh()),UA=pe(tw()),Yl=pe(sl());function pE(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),o="\x1B[";return o+n+"m"+e+o+"0m"}var qe=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?pE("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))+pE("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(`
167
+ `)}};async function ul(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 Ee(){let t=await ul("@capgo/cli")??"",e=t?.split(".")[0];t!==dr.version&&l.warning(`\u{1F6A8} You are using @capgo/cli@${dr.version} it's not the latest version.
168
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}function fN(t){return new Promise(e=>{setTimeout(e,t)})}function dN(t){return new Date(t||"").toLocaleTimeString()}async function Ct(t,e,r,n,o,i="\u2705"){await ye(r,{channel:t,event:n,icon:i,user_id:e,...o?{tags:{"app-id":o}}:{},notify:!1})}async function pN(t,e,r,n){if(le(e))throw await Ct(t,r,n,"canceled",void 0,"\u{1F937}"),new Error("Command cancelled")}async function hN(t,e,r){try{let n=await br(),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),l.error(`Cannot get stats ${M(n)}`)}return[]}function mN(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}/settings/organization/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"},disableProdBuild:{summary:()=>"Prod build updates disabled in channel",level:"error"},disableEmulator:{summary:()=>"Emulator updates disabled in channel",level:"error"},disableDevice:{summary:()=>"Physical device 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 gN(t,e,r,n,o,i){let a=mN(t);if(!a)return{};a.snag&&await Ct(e,r,n,a.snag);let s=dN(t.created_at),u=t.action,c=t.version_id?`(version #${t.version_id})`:"",f=t.version?` (version ${t.version})`:c,d=`${a.summary({data:t,baseAppUrl:o,baseUrl:i})}${f}`;return{row:[s,t.device_id,u,d],stop:a.stop}}async function vm(t,e,r,n,o){let i=!0,a=await br(),s=`${a.hostWeb}/app/${r}`;await Ct(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,f=new Set,d=_e(),h=`${a.host}/docs/plugins/updater/debugging/#sent-from-the-backend`;for(d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${h}`);i;){await fN(5e3);let p=await hN(e,u,c);if(p.length>0){let m=p.reduce((_,y)=>{let E=new Date(y.created_at).getTime();return Math.max(_,E)},c?new Date(c).getTime():0);m>0&&(c=new Date(m).toISOString());let g=p.filter(_=>{let y=`${_.app_id}|${_.device_id}|${_.action}|${_.version_id}|${_.created_at}`;return f.has(y)?!1:(f.add(y),!0)}).sort((_,y)=>new Date(_.created_at).getTime()-new Date(y.created_at).getTime()),D=new qe;D.headers=["Time","Device","Key","Message"],D.theme=qe.roundTheme,D.rows=[];let v=!1;for(let _ of g){let{row:y,stop:E}=await gN(_,t,n,e,s,a.hostWeb);y&&D.rows.push(y),E&&(v=!0)}if(D.rows.length&&(d.stop(""),l.info(D.toString()),d.start(`Waiting for logs (Expect delay of 30 sec) more info: ${h}`)),v){i=!1;break}}}return d.stop("Stop watching logs"),Promise.resolve()}async function hE(t,e){ee("Debug Live update in Capgo"),await Ee(),e.apikey=e.apikey||oe();let r=await te();t=he(t,r?.config);let n=e.device;if(!e.apikey)throw l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),i=await Et(o,t),a=await fe({message:"Automatic check if update working in device ?"});await pN("debug",a,i,e.apikey),a?(l.info(`Wait logs sent to Capgo from ${t} device, Please background your app and open it again \u{1F4AA}`),await vm("debug",e.apikey,t,i,n),G("Done \u2705")):G("Canceled \u274C")}var Cm=require("node:buffer"),mE=require("node:crypto"),yN=(()=>{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 DN(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=yN[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function cn(t,e="sha256"){let r=Cm.Buffer.isBuffer(t)?t:Cm.Buffer.from(t);if(e==="crc32")return DN(r);let n=(0,mE.createHash)(e);return n.update(r),n.digest("hex")}var ks=pe(Kx());async function Gx(){let t=await(0,ks.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function mg(t,e,r=!1){let n=await(0,ks.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,ks.writeConfig)(o,n.app.extConfigFilePath))}async function ea(t,e=!1){await mg("CapacitorUpdater",t,e)}var ia=".capgo_key",ir=".capgo_key_v2",Jl=`${ia}.pub`,hn=`${ir}.pub`,TA="https://capgo.app",RA="https://files.capgo.app",BA="https://api.capgo.app",NA="https://console.capgo.app",Ug=12e4,ZM=1024*1024*20,QM=1024*1024*1024,e5=1024*1024*99,or="package.json",aa=/^(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,M=t=>t?`
169
+ ${UA.default.render(t)}`:"";function Gl(t){return new Promise(e=>{setTimeout(e,t)})}function MA(t){return(0,Vr.isMonorepo)(t)||(0,Vr.isNXMonorepo)(t)}function bt(t){return(0,Vr.isMonorepo)(t)?(0,Vr.findMonorepoRoot)(t):(0,Vr.isNXMonorepo)(t)?(0,Vr.findNXMonorepoRoot)(t):t}function qA(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,se.existsSync)(r)){let o=`Package.json at ${r} does not exist`;throw l.error(o),new Error(o)}let n=(0,se.readFileSync)(r??(0,re.join)(t,or));return JSON.parse(n)}function Mg(t=bt((0,nr.cwd)()),e=void 0){return qA(t,e).scripts}function Ir(t=bt((0,nr.cwd)()),e=void 0){return qA(t,e).version??""}function t5(t){let e=t.replace("^","").replace("~","");if(TD(e))try{let r=De(e);return Vt(r)}catch{return e}return e}async function zr(t,e=(0,nr.cwd)(),r){let n=r?(0,re.dirname)(r):e;try{let a=`${t}/package.json`,{createRequire:s}=await import("node:module"),c=s((0,re.join)(n,"package.json")).resolve(a),f=JSON.parse((0,se.readFileSync)(c,"utf-8"));if(f.version)return f.version}catch{}let o=n,i=re.default.parse(o).root;for(;o!==i;){let a=(0,re.join)(o,"node_modules",t,or);if((0,se.existsSync)(a))try{let u=JSON.parse((0,se.readFileSync)(a,"utf-8"));if(u.version)return u.version}catch{}let s=(0,re.dirname)(o);if(s===o)break;o=s}if(t==="@capgo/capacitor-updater"){let a=null,s=(0,re.join)(e,"ios","App","Podfile");if((0,se.existsSync)(s))try{let c=(0,se.readFileSync)(s,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(a=(0,re.resolve)((0,re.join)(e,"ios","App",c[1])))}catch{}if(!a){let u=(0,re.join)(e,"android","capacitor.settings.gradle");if((0,se.existsSync)(u))try{let f=(0,se.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);f?.[1]&&(a=(0,re.resolve)((0,re.join)(e,"android",f[1])).replace(/\/android$/,""))}catch{}}if(a){let u=(0,re.join)(a,or);if((0,se.existsSync)(u))try{let c=JSON.parse((0,se.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}}try{let s=(await Cr(e)).get(t);if(s)return s}catch{}return null}async function Cr(t=bt((0,nr.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,re.join)(t,or)],r){for(let i of r)if(!(0,se.existsSync)(i)){let a=`Package.json at ${i} does not exist`;throw l.error(a),new Error(a)}}let n=new Map,{createRequire:o}=await import("node:module");for(let i of r){let a=(0,se.readFileSync)(i),s=JSON.parse(a),u=(0,re.dirname)(i),c=(f,d)=>{try{let g=o((0,re.join)(u,"package.json")).resolve(`${f}/package.json`),D=JSON.parse((0,se.readFileSync)(g,"utf-8"));if(D.version)return D.version}catch{}let h=u,p=re.default.parse(h).root;for(;h!==p;){let m=(0,re.join)(h,"node_modules",f,or);if((0,se.existsSync)(m))try{let D=JSON.parse((0,se.readFileSync)(m,"utf-8"));if(D.version)return D.version}catch{}let g=(0,re.dirname)(h);if(g===h)break;h=g}return t5(d)};for(let f in s.dependencies)n.set(f,c(f,s.dependencies[f]));for(let f in s.devDependencies)n.set(f,c(f,s.devDependencies[f]))}return n}async function te(){try{let t=await Gx();if(!t){let e="No capacitor config file found, run `cap init` first";throw l.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${M(t)}`;throw l.error(e),new Error(e)}}async function qg(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 mg(t,r)),r}async function Ts(t){return qg("CapacitorUpdater",t)}async function br(){try{let t=await te(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||TA,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||NA,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||RA,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||BA};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(l.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:TA,hostWeb:NA,hostFilesApi:RA,hostApi:BA}}}var HA=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Xl(){let t=await br();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 l.info(`Local config ${M(t)}`),t}}async function VA(){let t=await br();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:QM,maxChunkSize:e5,alertUploadSize:ZM}}}async function ne(t,e,r){let n=await Xl();if(e&&r&&(l.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw l.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,oa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function r5(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){l.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 l.error(i),new Error("Invalid API key or insufficient permissions.")}}async function zA(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function KA(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function n5(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function o5(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var St=(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))(St||{}),sa=(t,e)=>t>=e;async function GA(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 l.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")?(l.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(l.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 l.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 WA(t,e,r){let{data:n,error:o}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(o){l.error(`Cannot get cli warnings: ${M(o)}`);return}if(n.length>0){l.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"){l.error(`Invalid cli warning: ${a}`);continue}let s=a;s.fatal?(l.error(`${s.message.replaceAll("\\n",`
170
170
  `)}`),i=new Error(s.message)):l.warn(`${s.message.replaceAll("\\n",`
171
- `)}`)}if(i)throw l.error("Please fix the warnings and try again."),i;l.info("End of cli warnings.")}}async function GA(t,e,r,n,o=!0){let i=await Jl();if(!await(n?t5(t,n,r):e5(t,e)))throw l.error(`You need to upgrade your plan to continue to use capgo.
171
+ `)}`)}if(i)throw l.error("Please fix the warnings and try again."),i;l.info("End of cli warnings.")}}async function YA(t,e,r,n,o=!0){let i=await Xl();if(!await(n?o5(t,n,r):n5(t,e)))throw l.error(`You need to upgrade your plan to continue to use capgo.
172
172
  Upgrade here: ${i.hostWeb}/settings/organization/plans
173
- `),Kl(100),Promise.resolve().then(()=>(Bg(),Rg)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Kl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([VA(t,e),HA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
173
+ `),Gl(100),Promise.resolve().then(()=>(Ng(),Bg)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Gl(500),new Error("Plan upgrade required");let[s,u]=await Promise.all([KA(t,e),zA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
174
174
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/settings/organization/plans
175
- `)}async function WA(t,e,r,n,o=!0){let i=await Jl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw l.error(`You need to upgrade your plan to continue to use capgo.
175
+ `)}async function JA(t,e,r,n,o=!0){let i=await Xl(),{data:a}=await t.rpc("is_allowed_action_org_action",{orgid:e,actions:["storage"]});if(!a)throw l.error(`You need to upgrade your plan to continue to use capgo.
176
176
  Upgrade here: ${i.hostWeb}/settings/organization/plans
177
- `),Kl(100),Promise.resolve().then(()=>(Bg(),Rg)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Kl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([VA(t,e),HA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
177
+ `),Gl(100),Promise.resolve().then(()=>(Ng(),Bg)).then(c=>{c.default(`${i.hostWeb}/settings/organization/plans`)}),Gl(500),new Error("Plan upgrade required for upload");let[s,u]=await Promise.all([KA(t,e),zA(t,e)]);s>0&&o&&!u&&l.warn(`WARNING !!
178
178
  Trial expires in ${s} days, upgrade here: ${i.hostWeb}/settings/organization/plans
179
- `)}function ne(t=!1){let e=nr.env.CAPGO_TOKEN?.trim();if(e)return t||l.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Gl.homedir)(),n,o=`${r}/.capgo`;if((0,De.existsSync)(o)&&(t||l.info(`Use global API key ${o}`),n=(0,De.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,De.existsSync)(o)&&(t||l.info(`Use local API key ${o}`),n=(0,De.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${nt().runner} @capgo/cli login`;throw l.error(i),new Error(i)}return n}async function*qg(t){let e=await(0,De.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*qg(n):yield n}}function sa(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 Xl(){let t=(0,nr.cwd)(),e=!1,r=(0,fe.resolve)(t,"tsconfig.json");(0,De.existsSync)(r)&&(e=!0);for await(let n of qg(t)){if(n.includes("angular.json"))return l.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return l.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return l.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return l.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return l.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return l.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(or)){let o=(0,fe.dirname)(n),i=await Cr(o);if(i){if(i.get("react"))return l.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return l.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function YA(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 Hg(t){if(t==="angular")return l.info("Angular project detected"),"build";if(t==="nuxtjs")return l.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(l.info("Nextjs project detected"),l.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"),l.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await ce({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(l.info("Sveltekit project detected"),l.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),l.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await ce({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}return"build"}async function JA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,nr.cwd)(),n=r.split("/").length;for await(let o of qg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,l.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 XA(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){l.error(`Cannot get upload url ${M(o)}`)}return""}async function*ZA(t){let e=(0,De.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,fe.join)(t,r.name);r.isDirectory()?yield*ZA(n):yield n}}var QA="5.10.0",eO="6.25.0",Ts="7.0.30";function Vn(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&er(t,ye(e))||t.major===6&&er(t,ye(r))||t.major===7&&er(t,ye(n)))}async function tO(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 ZA(t)){if(r.some(s=>n.includes(s))){l.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,De.readFileSync)(n);if(o.length===0){l.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await cn(o,"sha256"),a=(0,fe.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Zl(t){return(0,Gl.platform)()==="win32"?n5(t):r5(t)}function r5(t){let e=new Lg.default;return e.addLocalFolder(t),e.toBuffer()}async function n5(t){l.info("Zipping file windows mode");let e=new Lg.default,r=(n,o)=>{let i=(0,De.readdirSync)(n);for(let a of i){let s=(0,fe.join)(n,a),u=(0,De.statSync)(s);if(u.isFile()){let c=(0,De.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 rO(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{ge(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Wl.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(d){if(l.error(`Error uploading bundle: ${d.message}`),d instanceof Wl.DetailedError){let p=d.originalResponse?.getBody(),h=JSON.parse(p||'{"error": "unknown error"}');c(h.status||h.error||h.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,p){let h=(d/p*100).toFixed(2);i.message(`Uploaded ${h}%`)},async onSuccess(){await ge(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function nO(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 na.FunctionsHttpError){let a=await i.error.context.json();l.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof na.FunctionsHttpError){let i=await o.context.json();l.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else l.error(`Cannot delete failed version: ${M(o)}`)}}async function Ql(t,e){if(!e.app_id||!e.name||!e.created_by)return l.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 ge(t,e,r){try{r&&l.info(`Get remove config: for ${e.event}`);let n=await Jl();r&&l.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&&l.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(l.error("Failed to send Stats event details:"),l.error(M(n)))}}async function ua(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw l.error("Cannot get the list of organizations - exiting"),l.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 l.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw l.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 gt({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(ue(i))throw l.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return l.info(`Using the organization "${s.name}" as the app owner`),s}async function ae(t,e,r=["all"]){await QM(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw l.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function Et(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw l.error(`Cannot get organization id for app id ${e}`),M(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function ca(t){return new Date(t||"").toLocaleString()}var NA=!1,ra="npm",$s="install",Ng="npx";function nt(){if(NA)return{pm:ra,command:$s,installCommand:`${ra} ${$s}`,runner:Ng};let t=bt((0,nr.cwd)());return ra=Oa(t,"npm"),$s=vu(ra),NA=!0,Ng=wD(t),{pm:ra,command:$s,installCommand:`${ra} ${$s}`,runner:Ng}}function oO(t){return(0,De.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,fe.join)(t,n.name);return n.isDirectory()?oO(o):o.split(`node_modules${fe.sep}`)[1]||o})}async function zg(t,e){let r=e?e.split(","):[],n;try{n=await Cr("",t)}catch(f){throw l.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",f),f instanceof Error?f:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?fe.default.resolve(o).replace(or,""):bt((0,nr.cwd)());if(!n)throw l.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[f,d]of Object.entries(n))if(typeof d!="string")throw l.error(`Invalid dependency ${f}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${f}: expected string version`);let a=r.length===0?[(0,fe.join)((0,nr.cwd)(),"node_modules")]:r;if(!a.some(f=>(0,De.existsSync)(f))){let f=Oa(i,"npm"),d=vu(f);throw l.error(`Missing node_modules folder at ${a.join(", ")}, please run ${f} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([f,d])=>{let p=!1,h=!1,m=d;for(let g of a){let D=(0,fe.join)(g,f);if((0,De.existsSync)(D)){p=!0;try{let v=(0,fe.join)(D,or);if((0,De.existsSync)(v)){let E=JSON.parse((0,De.readFileSync)(v,"utf-8"));E.version&&(m=E.version)}}catch{}try{if(oO(D).some(E=>ZM.test(E))){h=!0;break}}catch(v){throw l.error(`Error reading node_modules files for ${f} package in ${g}`),console.error(v),v instanceof Error?v:new Error(`Error reading node_modules files for ${f}`)}}}if(!p){u=!0;let g=Oa(i,"npm"),D=vu(g);return l.error(`Missing dependency ${f}, please run ${g} ${D}`),{name:f,version:d}}return{name:f,version:m,native:h}})).catch(()=>[]);if(u||c.find(f=>f.native===void 0))throw l.error("Missing dependencies or invalid dependencies"),l.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 o5(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 i5(t){if(!t)throw l.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 l.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 l.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 l.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 iO(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
179
+ `)}function oe(t=!1){let e=nr.env.CAPGO_TOKEN?.trim();if(e)return t||l.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,Wl.homedir)(),n,o=`${r}/.capgo`;if((0,se.existsSync)(o)&&(t||l.info(`Use global API key ${o}`),n=(0,se.readFileSync)(o,"utf8").trim()),o=".capgo",!n&&(0,se.existsSync)(o)&&(t||l.info(`Use local API key ${o}`),n=(0,se.readFileSync)(o,"utf8").trim()),!n){let i=`Cannot find API key in local folder or global, please login first with ${Dt().runner} @capgo/cli login`;throw l.error(i),new Error(i)}return n}async function*Hg(t){let e=await(0,se.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,re.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*Hg(n):yield n}}function ua(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 Zl(){let t=(0,nr.cwd)(),e=!1,r=(0,re.resolve)(t,"tsconfig.json");(0,se.existsSync)(r)&&(e=!0);for await(let n of Hg(t)){if(n.includes("angular.json"))return l.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return l.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return l.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return l.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return l.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return l.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes(or)){let o=(0,re.dirname)(n),i=await Cr(o);if(i){if(i.get("react"))return l.info("Found react project test"),e?"react-ts":"react-js";if(i.get("vue"))return l.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function XA(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 Vg(t){if(t==="angular")return l.info("Angular project detected"),"build";if(t==="nuxtjs")return l.info("Nuxtjs project detected"),"generate";if(t==="nextjs"){if(l.info("Nextjs project detected"),l.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"),l.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),!await fe({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}if(t==="sveltekit"){if(l.info("Sveltekit project detected"),l.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),l.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adapter"),!await fe({message:"Do you want to continue?"})){let r="Build command selection aborted by user";throw l.error(r),new Error(r)}return"build"}return"build"}async function ZA(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,nr.cwd)(),n=r.split("/").length;for await(let o of Hg(r))if(o.split("/").length-n<=2&&t.test(o)){e=o,l.info(`Found main file here ${o}`);break}return e}async function zg(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function QA(t,e,r){let n={app_id:e,name:r,version:0};try{let i=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(i.error){if(i.error instanceof oa.FunctionsHttpError){let a=await i.error.context.json();l.error(`Upload URL error: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot get upload url: ${i.error.message}`);return""}return i.data.url}catch(o){l.error(`Cannot get upload url ${M(o)}`)}return""}async function*eO(t){let e=(0,se.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,re.join)(t,r.name);r.isDirectory()?yield*eO(n):yield n}}var tO="5.10.0",rO="6.25.0",Rs="7.0.30";function Vn(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&er(t,De(e))||t.major===6&&er(t,De(r))||t.major===7&&er(t,De(n)))}async function nO(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 eO(t)){if(r.some(s=>n.includes(s))){l.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let o=(0,se.readFileSync)(n);if(o.length===0){l.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let i=await cn(o,"sha256"),a=(0,re.relative)(t,n);a.startsWith("/")&&(a=a.substring(1)),e.push({file:a,hash:i})}return e}async function Ql(t){return(0,Wl.platform)()==="win32"?a5(t):i5(t)}function i5(t){let e=new jg.default;return e.addLocalFolder(t),e.toBuffer()}async function a5(t){l.info("Zipping file windows mode");let e=new jg.default,r=(n,o)=>{let i=(0,se.readdirSync)(n);for(let a of i){let s=(0,re.join)(n,a),u=(0,se.statSync)(s);if(u.isFile()){let c=(0,se.readFileSync)(s);e.addFile((0,re.join)(o,a).split(re.sep).join("/"),c)}else u.isDirectory()&&r(s,(0,re.join)(o,a))}};return r(t,""),e.toBuffer()}async function oO(t,e,r,n,o,i,a,s){return new Promise((u,c)=>{ye(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Yl.Upload(e,{endpoint:`${a.hostFilesApi}/files/upload/attachments/`,chunkSize:s,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${o}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(d){if(l.error(`Error uploading bundle: ${d.message}`),d instanceof Yl.DetailedError){let h=d.originalResponse?.getBody(),p=JSON.parse(h||'{"error": "unknown error"}');c(p.status||p.error||p.message||"unknown error")}else c(d.message||d.toString()||"unknown error")},onProgress(d,h){let p=(d/h*100).toFixed(2);i.message(`Uploaded ${p}%`)},async onSuccess(){await ye(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function iO(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 oa.FunctionsHttpError){let a=await i.error.context.json();l.error(`Cannot delete failed version: ${a.status||JSON.stringify(a)}`)}else l.error(`Cannot delete failed version: ${i.error.message}`);return}return i.data?.status}catch(o){if(o instanceof oa.FunctionsHttpError){let i=await o.context.json();l.error(`Cannot delete failed version: ${i.message||JSON.stringify(i)}`)}else l.error(`Cannot delete failed version: ${M(o)}`)}}async function ef(t,e){if(!e.app_id||!e.name||!e.created_by)return l.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 ye(t,e,r){try{r&&l.info(`Get remove config: for ${e.event}`);let n=await Xl();r&&l.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&&l.error(`Failed to send LogSnag event: ${s.error}`)}finally{clearTimeout(i)}}catch(n){r&&(l.error("Failed to send Stats event details:"),l.error(M(n)))}}async function ca(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw l.error("Cannot get the list of organizations - exiting"),l.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 l.error("Could not get organization please create an organization first"),new Error("No organizations available");if(o.length===0)throw l.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 mt({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(le(i))throw l.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let a=i,s=n.find(u=>u.gid===a);return l.info(`Using the organization "${s.name}" as the app owner`),s}async function ue(t,e,r=["all"]){await r5(t,e,r);let{data:n,error:o}=await t.rpc("get_user_id",{apikey:e}).single(),i=(n||"").toString();if(!i||o)throw l.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return i}async function Et(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw l.error(`Cannot get organization id for app id ${e}`),M(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function la(t){return new Date(t||"").toLocaleString()}var LA=!1,na="npm",Is="install",Lg="npx";function Dt(){if(LA)return{pm:na,command:Is,installCommand:`${na} ${Is}`,runner:Lg};let t=bt((0,nr.cwd)());return na=Fa(t,"npm"),Is=Cu(na),LA=!0,Lg=vD(t),{pm:na,command:Is,installCommand:`${na} ${Is}`,runner:Lg}}function aO(t){return(0,se.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,re.join)(t,n.name);return n.isDirectory()?aO(o):o.split(`node_modules${re.sep}`)[1]||o})}function sO(t){if(!(0,se.existsSync)(t))return[];try{return(0,se.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let o=(0,re.join)(t,n.name);return n.isDirectory()?sO(o):o})}catch{return[]}}function s5(t,e){let r=[];if(e==="ios"){try{let i=(0,se.readdirSync)(t);for(let a of i)a.endsWith(".podspec")&&r.push((0,re.join)(t,a))}catch{}let n=(0,re.join)(t,"Package.swift"),o=(0,re.join)(t,"ios","Package.swift");(0,se.existsSync)(n)&&r.push(n),(0,se.existsSync)(o)&&r.push(o)}else if(e==="android"){let n=(0,re.join)(t,"android"),o=(0,re.join)(n,"build.gradle"),i=(0,re.join)(n,"build.gradle.kts");(0,se.existsSync)(o)&&r.push(o),(0,se.existsSync)(i)&&r.push(i)}return r}async function u5(t){let e=(0,re.join)(t,"ios"),r=(0,re.join)(t,"android"),n=async(a,s)=>{let u=(0,se.existsSync)(a)?sO(a).filter(p=>HA.test(p)):[],c=s5(t,s),f=[...u,...c].sort((p,m)=>p.localeCompare(m));if(f.length===0)return;let{createHash:d}=await import("node:crypto"),h=d("sha256");for(let p of f)try{let m=(0,re.relative)(t,p);h.update(m);let g=(0,se.readFileSync)(p);h.update(g)}catch{}return h.digest("hex")},[o,i]=await Promise.all([n(e,"ios"),n(r,"android")]);return{ios_checksum:o,android_checksum:i}}async function Kg(t,e){let r=e?e.split(","):[],n;try{n=await Cr("",t)}catch(f){throw l.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",f),f instanceof Error?f:new Error("Invalid package.json")}let o=t?.split(",")[0],i=o?re.default.resolve(o).replace(or,""):bt((0,nr.cwd)());if(!n)throw l.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[f,d]of Object.entries(n))if(typeof d!="string")throw l.error(`Invalid dependency ${f}: ${d}, expected string, got ${typeof d}`),new Error(`Invalid dependency ${f}: expected string version`);let a=r.length===0?[(0,re.join)((0,nr.cwd)(),"node_modules")]:r;if(!a.some(f=>(0,se.existsSync)(f))){let f=Fa(i,"npm"),d=Cu(f);throw l.error(`Missing node_modules folder at ${a.join(", ")}, please run ${f} ${d}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([f,d])=>{let h=!1,p=!1,m=d,g;for(let _ of a){let y=(0,re.join)(_,f);if((0,se.existsSync)(y)){h=!0,g=y;try{let E=(0,re.join)(y,or);if((0,se.existsSync)(E)){let S=JSON.parse((0,se.readFileSync)(E,"utf-8"));S.version&&(m=S.version)}}catch{}try{if(aO(y).some(S=>HA.test(S))){p=!0;break}}catch(E){throw l.error(`Error reading node_modules files for ${f} package in ${_}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${f}`)}}}if(!h){u=!0;let _=Fa(i,"npm"),y=Cu(_);return l.error(`Missing dependency ${f}, please run ${_} ${y}`),{name:f,version:d}}let D,v;if(p&&g){let _=await u5(g);D=_.ios_checksum,v=_.android_checksum}return{name:f,version:m,native:p,ios_checksum:D,android_checksum:v}})).catch(()=>[]);if(u||c.find(f=>f.native===void 0))throw l.error("Missing dependencies or invalid dependencies"),l.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 c5(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 l5(t){if(!t)throw l.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 l.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 l.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 l.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 uO(t,e,r){let{data:n,error:o}=await t.from("channels").select(`version (
180
180
  native_packages
181
- )`).eq("name",r).eq("app_id",e).single();if(o)throw l.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return i5(n.version.native_packages??[])}async function aO(t,e,r,n){let o=_e();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await o5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw o.stop("Checksum check failed"),l.error(`Cannot upload the same bundle content.
181
+ )`).eq("name",r).eq("app_id",e).single();if(o)throw l.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return l5(n.version.native_packages??[])}async function cO(t,e,r,n){let o=_e();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await c5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw o.stop("Checksum check failed"),l.error(`Cannot upload the same bundle content.
182
182
  Current bundle checksum matches remote bundle for channel ${r}
183
183
  Did you build your app before uploading?
184
- 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 pe(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function No(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=xu(t.localVersion),r=xu(t.remoteVersion);return $D(e,r)}catch{return!1}}async function ef(t,e,r,n,o){let i=await zg(n,o),a=await iO(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let f=a.get(c.name);return f?{name:c.name,localVersion:c.version,remoteVersion:f.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(f=>f.name===c)===void 0).map(([c,f])=>({name:c,localVersion:void 0,remoteVersion:f.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Kg(t,e,r,n){let o=await iO(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 tf(t,e,r){let n=await ce({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(ue(n))throw t&&e&&r&&await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),l.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=nt(),i=_e();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,LA.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"),l.error(`Failed to run Capacitor sync: ${a}`),l.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=nt();l.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),l.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function sO(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function qe(t,e,r,n,o=!1){let i=nt(),a=await zA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||l.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||l.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||l.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${St[a.data]}, required for this action: ${St[n]}.`;throw o||l.error(c),new Error(c)}return a.data}var Er="assets/icon.png";var a5=/^[a-z0-9]+(\.[\w-]+)+$/i;function s5(t,e,r){if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||l.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!a5.test(t))throw r||(l.error(`Invalid app ID format: "${t}"`),l.info("App ID must be in reverse domain notation (e.g., com.example.app)"),l.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),l.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function u5(t,e,r){if(await sO(t,e))throw e==="io.ionic.starter"?(r||l.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||l.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Gg(t,e,r,n=!1){n||ee("Adding"),await Ee(),e.apikey=e.apikey||ne();let o=await te(),i=pe(t,o?.config);s5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ae(a,e.apikey,["write","all"]);await u5(a,i,n),r||(r=await ua(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:f}=e;if(c=c||o.config?.appName||"Unknown",f=f||"resources/icon.png",!f||!c)throw n||l.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||l.info(`Adding ${i} to Capgo`);let d=null,p=null;f&&(0,la.existsSync)(f)?(d=(0,la.readFileSync)(f),p=sa(f)||"image/png",n||l.warn(`Found app icon ${f}`)):(0,la.existsSync)(Er)?(d=(0,la.readFileSync)(Er),p=sa(Er)||"image/png",n||l.warn(`Found app icon ${Er}`)):n||l.warn(`Cannot find app icon in any of the following locations: ${f}, ${Er}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(D)throw n||console.error(D),n||l.error(`Could not add app ${M(D)}`),new Error(`Could not add app ${M(D)}`);let{data:v}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=v?.publicUrl||m}let{error:g}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(g)throw n||l.error(`Could not add app ${M(g)}`),new Error(`Could not add app ${M(g)}`);return n||(l.success(`App ${i} added to Capgo. You can upload a bundle now`),G("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function uO(t,e){await Gg(t,e,void 0)}async function c5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=pe(t,o?.config);if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(a,e.apikey,["write","all"]);await qe(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(),f=u;if(!n&&!c&&(f?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{l.warn("Deleting the app is not recommended for users that are not the organization owner"),l.warn("You are invited as a super_admin but your are not the owner"),l.warn("It's strongly recommended that you do not continue!");let g=await gt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(ue(g)||g==="no")throw l.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&l.warn(`Cannot get the app owner ${M(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${f?.owner_org.id}/${i}/icon`]);d&&!r&&l.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&l.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||l.error("Could not delete app"),new Error(`Could not delete app: ${M(h)}`);let m=await Et(a,i);return await ge(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(l.success("App deleted in Capgo"),G("Done \u2705")),!0}async function cO(t,e){return c5(t,e,!1,!1)}var rf=require("node:os"),fO=require("node:process");async function lO(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>sl(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function l5(){let t=await Cr(),e={"@capgo/cli":dr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function f5(t,e=!1){e||l.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Ir("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=pe("",r?.config),s=r?.config?.webDir||"";e||(l.info(` App Name: ${i}`),l.info(` App ID: ${a}`),l.info(` App Version: ${o}`),l.info(` Web Dir: ${s}`),l.info(` OS: ${(0,rf.platform)()} ${(0,rf.version)()}`),l.info(` Node: ${fO.version}`),l.info(" Installed Dependencies:"));let u=await l5();if(Object.keys(u).length===0)throw e||l.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let f of Object.keys(u))l.info(` ${f}: ${u[f]}`);let c={};if(e)c=await lO(u);else{let f=_e();f.start("Running: Loading latest dependencies"),c=await lO(u),f.stop("Latest Dependencies:");for(let d of Object.keys(c))l.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||l.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||l.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 dO(t){return f5(t)}function d5(t){let e=new ut;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,ca(r.created_at)]);l.success("Apps"),l.success(e.toString())}async function p5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||l.error("Apps not found"),new Error("Apps not found");return r??[]}async function h5(t,e=!1){e||ee("List apps in Capgo"),await Ee(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ae(r,t.apikey,["write","all","read","upload"]),e||l.info("Getting active bundle in Capgo");let n=await p5(r,e);if(!n.length)throw e||l.error("No apps found"),new Error("No apps found");return e||(l.info(`Active app in Capgo: ${n.length}`),d5(n),G("Done \u2705")),n}async function pO(t){return h5(t,!1)}var hO=require("node:crypto"),fa=require("node:fs");async function m5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ua(o,["admin","super_admin"])).gid,s=await ae(o,e.apikey,["write","all"]);await qe(o,e.apikey,t,4,r);let{name:u,icon:c,retention:f,exposeMetadata:d}=e;if(f&&Number.isNaN(Number(f)))throw r||l.error("retention value must be a number"),new Error("Retention value must be a number");if(f&&f<0)throw r||l.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(f&&f>=63113904)throw r||l.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,h,m=`icon_${(0,hO.randomUUID)()}`,g="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,fa.existsSync)(c)?(p=(0,fa.readFileSync)(c),h=sa(c)||"image/png",r||l.warn(`Found app icon ${c}`)):(0,fa.existsSync)(Er)?(p=(0,fa.readFileSync)(Er),h=sa(Er)||"image/png",r||l.warn(`Found app icon ${Er}`)):r||l.warn(`Cannot find app icon in any of the following locations: ${c}, ${Er}`),p&&h){let{error:v}=await o.storage.from(`images/org/${a}/${t}`).upload(m,p,{contentType:h});if(v)throw r||l.error(`Could not set app ${M(v)}`),new Error(`Could not set app: ${M(v)}`);let{data:E}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(m);g=E?.publicUrl||g}let{error:D}=await o.from("apps").update({icon_url:g,name:u,retention:f?f*24*60*60:void 0,expose_metadata:d}).eq("app_id",t).eq("user_id",s);if(D)throw r||l.error(`Could not set app ${M(D)}`),new Error(`Could not set app: ${M(D)}`);return r||G("Done \u2705"),!0}async function mO(t,e){return m5(t,e)}async function g5(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||l.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||l.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||l.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||l.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 Qi(n,!0),r||l.success(`Set "${t}" to "${a}"`)}catch(n){throw r||l.error(`Cannot set config in capacitor settings ${M(n)}`),new Error(`Cannot set capacitor config: ${M(n)}`)}r||G("Done \u2705")}async function gO(t,e){return g5(t,e)}var ar=require("node:fs"),sr=require("node:path"),He=require("node:process");var Lo=require("node:fs/promises"),yO=require("node:os"),Rs=require("node:path"),xe=require("node:process"),DO=(0,Rs.join)((0,yO.homedir)(),".capgo-credentials"),bO=(0,Rs.join)(DO,"credentials.json"),wO=".capgo-credentials.json";function vO(t){return t?(0,Rs.join)((0,xe.cwd)(),wO):bO}function y5(t){return t?null:DO}async function da(t){return(await(0,Lo.readFile)(t)).toString("base64")}async function pa(t){try{let e=vO(t),r=await(0,Lo.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Bs(t,e){if(e!==void 0){let o=await pa(e);if(!t){let i=Object.keys(o);return i.length===0?null:o[i[0]]||null}return o[t]||null}let r=await pa(!0),n=await pa(!1);if(!t){let o=Object.keys(r);if(o.length>0)return r[o[0]]||null;let i=Object.keys(n);return i.length===0?null:n[i[0]]||null}return r[t]||n[t]||null}async function nf(t,e){let r=vO(e),n=y5(e);n&&await(0,Lo.mkdir)(n,{recursive:!0}),await(0,Lo.writeFile)(r,JSON.stringify(t,null,2),"utf-8")}function D5(){let t={};return xe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=xe.env.BUILD_CERTIFICATE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=xe.env.BUILD_PROVISION_PROFILE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),xe.env.P12_PASSWORD&&(t.P12_PASSWORD=xe.env.P12_PASSWORD),xe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=xe.env.APPLE_KEY_ID),xe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=xe.env.APPLE_ISSUER_ID),xe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=xe.env.APPLE_KEY_CONTENT),xe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=xe.env.APPLE_PROFILE_NAME),xe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=xe.env.APP_STORE_CONNECT_TEAM_ID),xe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=xe.env.ANDROID_KEYSTORE_FILE),xe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=xe.env.KEYSTORE_KEY_ALIAS),xe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=xe.env.KEYSTORE_KEY_PASSWORD),xe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=xe.env.KEYSTORE_STORE_PASSWORD),xe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=xe.env.PLAY_CONFIG_JSON),t}async function CO(t,e,r){let n=await Bs(t),o=D5(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function Wg(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await da(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await da(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await da(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await da(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await da(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await da(e.PLAY_CONFIG_JSON_PATH))),n}async function Yg(t,e,r,n){let o=await pa(n),i=o[t]||{};i[e]={...i[e],...r},o[t]=i,await nf(o,n)}async function of(t,e,r){let n=await pa(r);if(!t){await nf({},r);return}if(!e){delete n[t],await nf(n,r);return}let o=n[t]||{};delete o[e],Object.keys(o).length===0?delete n[t]:n[t]=o,await nf(n,r)}async function Jg(t,e,r){return(await Bs(t,r))?.[e]||null}async function af(t){let e=await pa(t);return Object.keys(e)}function Ns(){return(0,Rs.join)((0,xe.cwd)(),wO)}function Ls(){return bO}async function EO(t){try{t.platform||(l.error("Platform is required. Use --platform ios or --platform android"),(0,He.exit)(1));let e=await te(),r=pe(t.appId,e?.config);r||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),l.error(""),(0,He.exit)(1));let n=t.platform;l.info(`
184
+ 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 he(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function Lo(t){let e=[];if(!t.localVersion)return{compatible:!0,reasons:[],message:"Package only exists on remote (will be removed)"};if(!t.remoteVersion)return e.push("new_plugin"),{compatible:!1,reasons:e,message:"New native plugin added (requires app store update)"};let r=!1;try{let a=Au(t.localVersion),s=Au(t.remoteVersion);r=ID(a,s)}catch{r=!1}r||e.push("version_mismatch");let n=t.localIosChecksum&&t.remoteIosChecksum&&t.localIosChecksum!==t.remoteIosChecksum,o=t.localAndroidChecksum&&t.remoteAndroidChecksum&&t.localAndroidChecksum!==t.remoteAndroidChecksum;if(n&&o?e.push("both_platforms_changed"):n?e.push("ios_code_changed"):o&&e.push("android_code_changed"),e.length===0)return{compatible:!0,reasons:[],message:"Compatible"};let i=[];for(let a of e)switch(a){case"version_mismatch":i.push(`version changed: ${t.remoteVersion} \u2192 ${t.localVersion}`);break;case"ios_code_changed":i.push("iOS native code changed");break;case"android_code_changed":i.push("Android native code changed");break;case"both_platforms_changed":i.push("iOS and Android native code changed");break;case"new_plugin":i.push("new plugin (requires app store update)");break;case"removed_plugin":i.push("plugin removed");break}return{compatible:!1,reasons:e,message:i.join(", ")}}function zn(t){return Lo(t).compatible}async function tf(t,e,r,n,o){let i=await Kg(n,o),a=await uO(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let f=a.get(c.name);return f?{name:c.name,localVersion:c.version,remoteVersion:f.version,localIosChecksum:c.ios_checksum,remoteIosChecksum:f.ios_checksum,localAndroidChecksum:c.android_checksum,remoteAndroidChecksum:f.android_checksum}:{name:c.name,localVersion:c.version,remoteVersion:void 0,localIosChecksum:c.ios_checksum,localAndroidChecksum:c.android_checksum}}),u=[...a].filter(([c])=>i.find(f=>f.name===c)===void 0).map(([c,f])=>({name:c,localVersion:void 0,remoteVersion:f.version,remoteIosChecksum:f.ios_checksum,remoteAndroidChecksum:f.android_checksum}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Gg(t,e,r,n){let o=await uO(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version,localIosChecksum:s.ios_checksum,remoteIosChecksum:u.ios_checksum,localAndroidChecksum:s.android_checksum,remoteAndroidChecksum:u.android_checksum}:{name:s.name,localVersion:s.version,remoteVersion:void 0,localIosChecksum:s.ios_checksum,localAndroidChecksum:s.android_checksum}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version,remoteIosChecksum:u.ios_checksum,remoteAndroidChecksum:u.android_checksum}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function rf(t,e,r){let n=await fe({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(le(n))throw t&&e&&r&&await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),l.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=Dt(),i=_e();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,jA.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"),l.error(`Failed to run Capacitor sync: ${a}`),l.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=Dt();l.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),l.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function lO(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function He(t,e,r,n,o=!1){let i=Dt(),a=await GA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||l.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||l.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||l.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${St[a.data]}, required for this action: ${St[n]}.`;throw o||l.error(c),new Error(c)}return a.data}var Er="assets/icon.png";var f5=/^[a-z0-9]+(\.[\w-]+)+$/i;function d5(t,e,r){if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||l.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!f5.test(t))throw r||(l.error(`Invalid app ID format: "${t}"`),l.info("App ID must be in reverse domain notation (e.g., com.example.app)"),l.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),l.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function p5(t,e,r){if(await lO(t,e))throw e==="io.ionic.starter"?(r||l.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||l.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Wg(t,e,r,n=!1){n||ee("Adding"),await Ee(),e.apikey=e.apikey||oe();let o=await te(),i=he(t,o?.config);d5(i,e,n);let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await ue(a,e.apikey,["write","all"]);await p5(a,i,n),r||(r=await ca(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:f}=e;if(c=c||o.config?.appName||"Unknown",f=f||"resources/icon.png",!f||!c)throw n||l.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||l.info(`Adding ${i} to Capgo`);let d=null,h=null;f&&(0,fa.existsSync)(f)?(d=(0,fa.readFileSync)(f),h=ua(f)||"image/png",n||l.warn(`Found app icon ${f}`)):(0,fa.existsSync)(Er)?(d=(0,fa.readFileSync)(Er),h=ua(Er)||"image/png",n||l.warn(`Found app icon ${Er}`)):n||l.warn(`Cannot find app icon in any of the following locations: ${f}, ${Er}`);let p="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&h){let{error:D}=await a.storage.from(`images/org/${u}/${i}`).upload(p,d,{contentType:h});if(D)throw n||console.error(D),n||l.error(`Could not add app ${M(D)}`),new Error(`Could not add app ${M(D)}`);let{data:v}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(p);m=v?.publicUrl||m}let{error:g}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(g)throw n||l.error(`Could not add app ${M(g)}`),new Error(`Could not add app ${M(g)}`);return n||(l.success(`App ${i} added to Capgo. You can upload a bundle now`),G("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function fO(t,e){await Wg(t,e,void 0)}async function h5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||oe();let o=await te(),i=he(t,o?.config);if(!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(e.apikey,e.supaHost,e.supaAnon),s=await ue(a,e.apikey,["write","all"]);await He(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(),f=u;if(!n&&!c&&(f?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{l.warn("Deleting the app is not recommended for users that are not the organization owner"),l.warn("You are invited as a super_admin but your are not the owner"),l.warn("It's strongly recommended that you do not continue!");let g=await mt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(g)||g==="no")throw l.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&l.warn(`Cannot get the app owner ${M(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${f?.owner_org.id}/${i}/icon`]);d&&!r&&l.error("Could not delete app logo");let{error:h}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);h&&!r&&l.error("Could not delete app version");let{error:p}=await a.from("apps").delete().eq("app_id",i);if(p)throw r||l.error("Could not delete app"),new Error(`Could not delete app: ${M(p)}`);let m=await Et(a,i);return await ye(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(l.success("App deleted in Capgo"),G("Done \u2705")),!0}async function dO(t,e){return h5(t,e,!1,!1)}var nf=require("node:os"),hO=require("node:process");async function pO(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>ul(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function m5(){let t=await Cr(),e={"@capgo/cli":dr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function g5(t,e=!1){e||l.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Ir("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=he("",r?.config),s=r?.config?.webDir||"";e||(l.info(` App Name: ${i}`),l.info(` App ID: ${a}`),l.info(` App Version: ${o}`),l.info(` Web Dir: ${s}`),l.info(` OS: ${(0,nf.platform)()} ${(0,nf.version)()}`),l.info(` Node: ${hO.version}`),l.info(" Installed Dependencies:"));let u=await m5();if(Object.keys(u).length===0)throw e||l.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let f of Object.keys(u))l.info(` ${f}: ${u[f]}`);let c={};if(e)c=await pO(u);else{let f=_e();f.start("Running: Loading latest dependencies"),c=await pO(u),f.stop("Latest Dependencies:");for(let d of Object.keys(c))l.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||l.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||l.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 mO(t){return g5(t)}function y5(t){let e=new qe;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,la(r.created_at)]);l.success("Apps"),l.success(e.toString())}async function D5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||l.error("Apps not found"),new Error("Apps not found");return r??[]}async function b5(t,e=!1){e||ee("List apps in Capgo"),await Ee(),t.apikey=t.apikey||oe();let r=await ne(t.apikey,t.supaHost,t.supaAnon);await ue(r,t.apikey,["write","all","read","upload"]),e||l.info("Getting active bundle in Capgo");let n=await D5(r,e);if(!n.length)throw e||l.error("No apps found"),new Error("No apps found");return e||(l.info(`Active app in Capgo: ${n.length}`),y5(n),G("Done \u2705")),n}async function gO(t){return b5(t,!1)}var yO=require("node:crypto"),da=require("node:fs");async function w5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||oe();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),a=(await ca(o,["admin","super_admin"])).gid,s=await ue(o,e.apikey,["write","all"]);await He(o,e.apikey,t,4,r);let{name:u,icon:c,retention:f,exposeMetadata:d}=e;if(f&&Number.isNaN(Number(f)))throw r||l.error("retention value must be a number"),new Error("Retention value must be a number");if(f&&f<0)throw r||l.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(f&&f>=63113904)throw r||l.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let h,p,m=`icon_${(0,yO.randomUUID)()}`,g="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,da.existsSync)(c)?(h=(0,da.readFileSync)(c),p=ua(c)||"image/png",r||l.warn(`Found app icon ${c}`)):(0,da.existsSync)(Er)?(h=(0,da.readFileSync)(Er),p=ua(Er)||"image/png",r||l.warn(`Found app icon ${Er}`)):r||l.warn(`Cannot find app icon in any of the following locations: ${c}, ${Er}`),h&&p){let{error:v}=await o.storage.from(`images/org/${a}/${t}`).upload(m,h,{contentType:p});if(v)throw r||l.error(`Could not set app ${M(v)}`),new Error(`Could not set app: ${M(v)}`);let{data:_}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(m);g=_?.publicUrl||g}let{error:D}=await o.from("apps").update({icon_url:g,name:u,retention:f?f*24*60*60:void 0,expose_metadata:d}).eq("app_id",t).eq("user_id",s);if(D)throw r||l.error(`Could not set app ${M(D)}`),new Error(`Could not set app: ${M(D)}`);return r||G("Done \u2705"),!0}async function DO(t,e){return w5(t,e)}async function v5(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||l.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||l.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||l.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||l.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 ea(n,!0),r||l.success(`Set "${t}" to "${a}"`)}catch(n){throw r||l.error(`Cannot set config in capacitor settings ${M(n)}`),new Error(`Cannot set capacitor config: ${M(n)}`)}r||G("Done \u2705")}async function bO(t,e){return v5(t,e)}var ar=require("node:fs"),sr=require("node:path"),Ve=require("node:process");var jo=require("node:fs/promises"),wO=require("node:os"),Bs=require("node:path"),xe=require("node:process"),vO=(0,Bs.join)((0,wO.homedir)(),".capgo-credentials"),CO=(0,Bs.join)(vO,"credentials.json"),EO=".capgo-credentials.json";function _O(t){return t?(0,Bs.join)((0,xe.cwd)(),EO):CO}function C5(t){return t?null:vO}async function pa(t){return(await(0,jo.readFile)(t)).toString("base64")}async function ha(t){try{let e=_O(t),r=await(0,jo.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Ns(t,e){if(e!==void 0){let o=await ha(e);if(!t){let i=Object.keys(o);return i.length===0?null:o[i[0]]||null}return o[t]||null}let r=await ha(!0),n=await ha(!1);if(!t){let o=Object.keys(r);if(o.length>0)return r[o[0]]||null;let i=Object.keys(n);return i.length===0?null:n[i[0]]||null}return r[t]||n[t]||null}async function of(t,e){let r=_O(e),n=C5(e);n&&await(0,jo.mkdir)(n,{recursive:!0}),await(0,jo.writeFile)(r,JSON.stringify(t,null,2),"utf-8")}function E5(){let t={};return xe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=xe.env.BUILD_CERTIFICATE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=xe.env.BUILD_PROVISION_PROFILE_BASE64),xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=xe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),xe.env.P12_PASSWORD&&(t.P12_PASSWORD=xe.env.P12_PASSWORD),xe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=xe.env.APPLE_KEY_ID),xe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=xe.env.APPLE_ISSUER_ID),xe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=xe.env.APPLE_KEY_CONTENT),xe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=xe.env.APPLE_PROFILE_NAME),xe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=xe.env.APP_STORE_CONNECT_TEAM_ID),xe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=xe.env.ANDROID_KEYSTORE_FILE),xe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=xe.env.KEYSTORE_KEY_ALIAS),xe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=xe.env.KEYSTORE_KEY_PASSWORD),xe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=xe.env.KEYSTORE_STORE_PASSWORD),xe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=xe.env.PLAY_CONFIG_JSON),t}async function SO(t,e,r){let n=await Ns(t),o=E5(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function Yg(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await pa(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await pa(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await pa(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await pa(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await pa(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await pa(e.PLAY_CONFIG_JSON_PATH))),n}async function Jg(t,e,r,n){let o=await ha(n),i=o[t]||{};i[e]={...i[e],...r},o[t]=i,await of(o,n)}async function af(t,e,r){let n=await ha(r);if(!t){await of({},r);return}if(!e){delete n[t],await of(n,r);return}let o=n[t]||{};delete o[e],Object.keys(o).length===0?delete n[t]:n[t]=o,await of(n,r)}async function Xg(t,e,r){return(await Ns(t,r))?.[e]||null}async function sf(t){let e=await ha(t);return Object.keys(e)}function Ls(){return(0,Bs.join)((0,xe.cwd)(),EO)}function js(){return CO}async function xO(t){try{t.platform||(l.error("Platform is required. Use --platform ios or --platform android"),(0,Ve.exit)(1));let e=await te(),r=he(t.appId,e?.config);r||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),l.error(""),(0,Ve.exit)(1));let n=t.platform;l.info(`
185
185
  \u{1F512} SECURITY NOTICE:`),l.info(" - Credentials saved to ~/.capgo-credentials/credentials.json (local only)"),l.info(" - When building, credentials are sent to Capgo servers"),l.info(" - Credentials are NEVER stored on Capgo servers"),l.info(" - Auto-deleted after build"),l.info(` - Builds sent directly to app stores - Capgo keeps nothing
186
- `);let o={},i={};if(n==="ios"){if(t.certificate){let c=(0,sr.resolve)(t.certificate);(0,ar.existsSync)(c)||(l.error(`Certificate file not found: ${c}`),(0,He.exit)(1)),i.BUILD_CERTIFICATE_FILE=c,l.info(`\u2713 Certificate file: ${c}`)}if(t.provisioningProfile){let c=(0,sr.resolve)(t.provisioningProfile);(0,ar.existsSync)(c)||(l.error(`Provisioning profile not found: ${c}`),(0,He.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE=c,l.info(`\u2713 Provisioning profile: ${c}`)}if(t.provisioningProfileProd){let c=(0,sr.resolve)(t.provisioningProfileProd);(0,ar.existsSync)(c)||(l.error(`Production provisioning profile not found: ${c}`),(0,He.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=c,l.info(`\u2713 Production provisioning profile: ${c}`)}if(t.appleKey){let c=(0,sr.resolve)(t.appleKey);(0,ar.existsSync)(c)||(l.error(`Apple key file not found: ${c}`),(0,He.exit)(1)),i.APPLE_KEY_FILE=c,l.info(`\u2713 Apple key file: ${c}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(l.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),l.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let d=(0,sr.resolve)(t.keystore);(0,ar.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,He.exit)(1)),i.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Keystore file: ${d}`)}if(t.playConfig){let d=(0,sr.resolve)(t.playConfig);(0,ar.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,He.exit)(1)),i.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Play Store config: ${d}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let c=!!t.keystoreKeyPassword,f=!!t.keystoreStorePassword;c&&!f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!c&&f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):c&&f&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await Wg(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){l.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),l.error("");for(let c of s)l.error(` \u2022 ${c}`);l.error(""),l.error("Example:"),n==="ios"?(l.error(" npx @capgo/cli build credentials save --platform ios \\"),l.error(" --certificate ./cert.p12 \\"),l.error(' --p12-password "your-password" \\ # Optional if cert has no password'),l.error(" --provisioning-profile ./profile.mobileprovision \\"),l.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),l.error(' --apple-key-id "XXXXXXXXXX" \\'),l.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),l.error(' --apple-team-id "XXXXXXXXXX" \\'),l.error(' --apple-profile-name "match AppStore com.example.app"')):(l.error(" npx @capgo/cli build credentials save --platform android \\"),l.error(" --keystore ./release.keystore \\"),l.error(' --keystore-alias "my-key-alias" \\'),l.error(' --keystore-key-password "password" \\'),l.error(" --play-config ./play-store-service-account.json"),l.error(""),l.error(" Note: If both key and store passwords are the same, you only need to provide one."),l.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),l.error(" The --play-config is required for uploading to Google Play Store.")),l.error(""),(0,He.exit)(1)}await Yg(r,n,a,t.local);try{let c=ne(!0);if(c){let f=await re(c),d=await Et(f,r);await ge(c,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:d,tags:{"app-id":r,platform:n,storage:t.local?"local":"global"},notify:!1}).catch()}}catch{}let u=t.local?Ns():Ls();l.success(`
186
+ `);let o={},i={};if(n==="ios"){if(t.certificate){let c=(0,sr.resolve)(t.certificate);(0,ar.existsSync)(c)||(l.error(`Certificate file not found: ${c}`),(0,Ve.exit)(1)),i.BUILD_CERTIFICATE_FILE=c,l.info(`\u2713 Certificate file: ${c}`)}if(t.provisioningProfile){let c=(0,sr.resolve)(t.provisioningProfile);(0,ar.existsSync)(c)||(l.error(`Provisioning profile not found: ${c}`),(0,Ve.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE=c,l.info(`\u2713 Provisioning profile: ${c}`)}if(t.provisioningProfileProd){let c=(0,sr.resolve)(t.provisioningProfileProd);(0,ar.existsSync)(c)||(l.error(`Production provisioning profile not found: ${c}`),(0,Ve.exit)(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=c,l.info(`\u2713 Production provisioning profile: ${c}`)}if(t.appleKey){let c=(0,sr.resolve)(t.appleKey);(0,ar.existsSync)(c)||(l.error(`Apple key file not found: ${c}`),(0,Ve.exit)(1)),i.APPLE_KEY_FILE=c,l.info(`\u2713 Apple key file: ${c}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(l.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),l.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let d=(0,sr.resolve)(t.keystore);(0,ar.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,Ve.exit)(1)),i.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Keystore file: ${d}`)}if(t.playConfig){let d=(0,sr.resolve)(t.playConfig);(0,ar.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,Ve.exit)(1)),i.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Play Store config: ${d}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let c=!!t.keystoreKeyPassword,f=!!t.keystoreStorePassword;c&&!f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!c&&f?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):c&&f&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await Yg(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){l.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),l.error("");for(let c of s)l.error(` \u2022 ${c}`);l.error(""),l.error("Example:"),n==="ios"?(l.error(" npx @capgo/cli build credentials save --platform ios \\"),l.error(" --certificate ./cert.p12 \\"),l.error(' --p12-password "your-password" \\ # Optional if cert has no password'),l.error(" --provisioning-profile ./profile.mobileprovision \\"),l.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),l.error(' --apple-key-id "XXXXXXXXXX" \\'),l.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),l.error(' --apple-team-id "XXXXXXXXXX" \\'),l.error(' --apple-profile-name "match AppStore com.example.app"')):(l.error(" npx @capgo/cli build credentials save --platform android \\"),l.error(" --keystore ./release.keystore \\"),l.error(' --keystore-alias "my-key-alias" \\'),l.error(' --keystore-key-password "password" \\'),l.error(" --play-config ./play-store-service-account.json"),l.error(""),l.error(" Note: If both key and store passwords are the same, you only need to provide one."),l.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),l.error(" The --play-config is required for uploading to Google Play Store.")),l.error(""),(0,Ve.exit)(1)}await Jg(r,n,a,t.local);try{let c=oe(!0);if(c){let f=await ne(c),d=await Et(f,r);await ye(c,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:d,tags:{"app-id":r,platform:n,storage:t.local?"local":"global"},notify:!1}).catch()}}catch{}let u=t.local?Ls():js();l.success(`
187
187
  \u2705 ${n.toUpperCase()} credentials saved successfully for ${r}!`),l.info(` Location: ${u}`),l.info(` Use: npx @capgo/cli build ${r} --platform ${n}
188
- `)}catch(e){l.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),(0,He.exit)(1)}}async function _O(t){try{let e=t?.local?await af(!0):[],r=t?.local?[]:await af(!1),n=[...new Set([...e,...r])];if(n.length===0){l.info("No saved credentials found."),l.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}l.info(`
188
+ `)}catch(e){l.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),(0,Ve.exit)(1)}}async function AO(t){try{let e=t?.local?await sf(!0):[],r=t?.local?[]:await sf(!1),n=[...new Set([...e,...r])];if(n.length===0){l.info("No saved credentials found."),l.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}l.info(`
189
189
  \u{1F4CB} Saved Build Credentials:
190
- `);let o=await te(),i=t?.appId||pe(void 0,o?.config),a=i?[i]:n;for(let s of a){let u=await Bs(s,t?.local);if(!u)continue;let f=e.includes(s)?" (local)":" (global)";if(l.info(`
190
+ `);let o=await te(),i=t?.appId||he(void 0,o?.config),a=i?[i]:n;for(let s of a){let u=await Ns(s,t?.local);if(!u)continue;let f=e.includes(s)?" (local)":" (global)";if(l.info(`
191
191
  \u{1F539} App: ${s}${f}`),u.ios){l.info(" iOS Credentials:");let d=u.ios;d.BUILD_CERTIFICATE_BASE64&&l.info(" \u2713 Certificate (base64)"),d.BUILD_PROVISION_PROFILE_BASE64&&l.info(" \u2713 Provisioning Profile (base64)"),d.BUILD_PROVISION_PROFILE_BASE64_PROD&&l.info(" \u2713 Production Provisioning Profile (base64)"),d.APPLE_KEY_CONTENT&&l.info(" \u2713 Apple Key Content (base64)"),d.P12_PASSWORD&&l.info(" \u2713 P12 Password: ********"),d.APPLE_KEY_ID&&l.info(` \u2713 Apple Key ID: ${d.APPLE_KEY_ID}`),d.APPLE_ISSUER_ID&&l.info(` \u2713 Apple Issuer ID: ${d.APPLE_ISSUER_ID}`),d.APP_STORE_CONNECT_TEAM_ID&&l.info(` \u2713 Team ID: ${d.APP_STORE_CONNECT_TEAM_ID}`)}if(u.android){l.info(" Android Credentials:");let d=u.android;d.ANDROID_KEYSTORE_FILE&&l.info(" \u2713 Keystore (base64)"),d.PLAY_CONFIG_JSON&&l.info(" \u2713 Play Store Config (base64)"),d.KEYSTORE_KEY_ALIAS&&l.info(` \u2713 Keystore Alias: ${d.KEYSTORE_KEY_ALIAS}`),d.KEYSTORE_KEY_PASSWORD&&l.info(" \u2713 Key Password: ********"),d.KEYSTORE_STORE_PASSWORD&&l.info(" \u2713 Store Password: ********")}}l.info(`
192
- Global: ${Ls()}`),l.info(`Local: ${Ns()}`),l.info(`
192
+ Global: ${js()}`),l.info(`Local: ${Ls()}`),l.info(`
193
193
  \u{1F512} These credentials are stored locally on your machine only.`),l.info(` When building, they are sent to Capgo but NEVER stored there.
194
- `)}catch(e){l.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),(0,He.exit)(1)}}async function SO(t){try{let e=await te(),r=t.appId||pe(void 0,e?.config),n=t.local?Ns():Ls();if(r&&t.platform){if(!await Jg(r,t.platform,t.local)){l.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await of(r,t.platform,t.local),l.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let o=await Bs(r,t.local);if(!o||!o.ios&&!o.android){l.info(`No credentials found for ${r}.`);return}await of(r,void 0,t.local),l.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await af(t.local)).length===0){l.info("No saved credentials found.");return}await of(void 0,void 0,t.local),l.success("\u2705 All credentials cleared!")}l.info(` Location: ${n}
195
- `)}catch(e){l.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),(0,He.exit)(1)}}async function xO(t){try{let e=!!(t.certificate||t.provisioningProfile||t.provisioningProfileProd||t.p12Password||t.appleKey||t.appleKeyId||t.appleIssuerId||t.appleProfileName||t.appleTeamId),r=!!(t.keystore||t.keystoreAlias||t.keystoreKeyPassword||t.keystoreStorePassword||t.playConfig),n=t.platform;n||(e&&!r?n="ios":r&&!e?n="android":e&&r?(l.error("Cannot mix iOS and Android options. Please use --platform to specify which platform."),(0,He.exit)(1)):(l.error("No credentials provided to update."),l.error(""),l.error("Usage: npx @capgo/cli build credentials update [options]"),l.error(""),l.error("iOS options: --certificate, --provisioning-profile, --apple-key, etc."),l.error("Android options: --keystore, --keystore-alias, --play-config, etc."),(0,He.exit)(1)));let o=await te(),i=pe(t.appId,o?.config);i||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),(0,He.exit)(1)),await Jg(i,n,t.local)||(l.error(`\u274C No existing ${n.toUpperCase()} credentials found for ${i}.`),l.error(""),l.error('Use "build credentials save" to create credentials first.'),(0,He.exit)(1));let s={},u={};if(n==="ios"){if(t.certificate){let d=(0,sr.resolve)(t.certificate);(0,ar.existsSync)(d)||(l.error(`Certificate file not found: ${d}`),(0,He.exit)(1)),u.BUILD_CERTIFICATE_FILE=d,l.info(`\u2713 Updating certificate: ${d}`)}if(t.provisioningProfile){let d=(0,sr.resolve)(t.provisioningProfile);(0,ar.existsSync)(d)||(l.error(`Provisioning profile not found: ${d}`),(0,He.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE=d,l.info(`\u2713 Updating provisioning profile: ${d}`)}if(t.provisioningProfileProd){let d=(0,sr.resolve)(t.provisioningProfileProd);(0,ar.existsSync)(d)||(l.error(`Production provisioning profile not found: ${d}`),(0,He.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE_PROD=d,l.info(`\u2713 Updating production provisioning profile: ${d}`)}if(t.appleKey){let d=(0,sr.resolve)(t.appleKey);(0,ar.existsSync)(d)||(l.error(`Apple key file not found: ${d}`),(0,He.exit)(1)),u.APPLE_KEY_FILE=d,l.info(`\u2713 Updating Apple key file: ${d}`)}t.p12Password&&(s.P12_PASSWORD=t.p12Password,l.info("\u2713 Updating P12 password")),t.appleKeyId&&(s.APPLE_KEY_ID=t.appleKeyId,l.info(`\u2713 Updating Apple Key ID: ${t.appleKeyId}`)),t.appleIssuerId&&(s.APPLE_ISSUER_ID=t.appleIssuerId,l.info(`\u2713 Updating Apple Issuer ID: ${t.appleIssuerId}`)),t.appleProfileName&&(s.APPLE_PROFILE_NAME=t.appleProfileName,l.info(`\u2713 Updating Apple Profile Name: ${t.appleProfileName}`)),t.appleTeamId&&(s.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId,l.info(`\u2713 Updating Apple Team ID: ${t.appleTeamId}`))}else if(n==="android"){if(t.keystore){let d=(0,sr.resolve)(t.keystore);(0,ar.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,He.exit)(1)),u.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Updating keystore: ${d}`)}if(t.playConfig){let d=(0,sr.resolve)(t.playConfig);(0,ar.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,He.exit)(1)),u.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Updating Play Store config: ${d}`)}t.keystoreAlias&&(s.KEYSTORE_KEY_ALIAS=t.keystoreAlias,l.info(`\u2713 Updating keystore alias: ${t.keystoreAlias}`)),t.keystoreKeyPassword&&(s.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,l.info("\u2713 Updating keystore key password")),t.keystoreStorePassword&&(s.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword,l.info("\u2713 Updating keystore store password"))}let c=await Wg(n,u,s);await Yg(i,n,c,t.local);let f=t.local?Ns():Ls();l.success(`
194
+ `)}catch(e){l.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),(0,Ve.exit)(1)}}async function OO(t){try{let e=await te(),r=t.appId||he(void 0,e?.config),n=t.local?Ls():js();if(r&&t.platform){if(!await Xg(r,t.platform,t.local)){l.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await af(r,t.platform,t.local),l.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let o=await Ns(r,t.local);if(!o||!o.ios&&!o.android){l.info(`No credentials found for ${r}.`);return}await af(r,void 0,t.local),l.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await sf(t.local)).length===0){l.info("No saved credentials found.");return}await af(void 0,void 0,t.local),l.success("\u2705 All credentials cleared!")}l.info(` Location: ${n}
195
+ `)}catch(e){l.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),(0,Ve.exit)(1)}}async function FO(t){try{let e=!!(t.certificate||t.provisioningProfile||t.provisioningProfileProd||t.p12Password||t.appleKey||t.appleKeyId||t.appleIssuerId||t.appleProfileName||t.appleTeamId),r=!!(t.keystore||t.keystoreAlias||t.keystoreKeyPassword||t.keystoreStorePassword||t.playConfig),n=t.platform;n||(e&&!r?n="ios":r&&!e?n="android":e&&r?(l.error("Cannot mix iOS and Android options. Please use --platform to specify which platform."),(0,Ve.exit)(1)):(l.error("No credentials provided to update."),l.error(""),l.error("Usage: npx @capgo/cli build credentials update [options]"),l.error(""),l.error("iOS options: --certificate, --provisioning-profile, --apple-key, etc."),l.error("Android options: --keystore, --keystore-alias, --play-config, etc."),(0,Ve.exit)(1)));let o=await te(),i=he(t.appId,o?.config);i||(l.error("\u274C App ID is required."),l.error(""),l.error("Either:"),l.error(" 1. Run this command from a Capacitor project directory, OR"),l.error(" 2. Provide --appId explicitly: --appId com.example.app"),(0,Ve.exit)(1)),await Xg(i,n,t.local)||(l.error(`\u274C No existing ${n.toUpperCase()} credentials found for ${i}.`),l.error(""),l.error('Use "build credentials save" to create credentials first.'),(0,Ve.exit)(1));let s={},u={};if(n==="ios"){if(t.certificate){let d=(0,sr.resolve)(t.certificate);(0,ar.existsSync)(d)||(l.error(`Certificate file not found: ${d}`),(0,Ve.exit)(1)),u.BUILD_CERTIFICATE_FILE=d,l.info(`\u2713 Updating certificate: ${d}`)}if(t.provisioningProfile){let d=(0,sr.resolve)(t.provisioningProfile);(0,ar.existsSync)(d)||(l.error(`Provisioning profile not found: ${d}`),(0,Ve.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE=d,l.info(`\u2713 Updating provisioning profile: ${d}`)}if(t.provisioningProfileProd){let d=(0,sr.resolve)(t.provisioningProfileProd);(0,ar.existsSync)(d)||(l.error(`Production provisioning profile not found: ${d}`),(0,Ve.exit)(1)),u.BUILD_PROVISION_PROFILE_FILE_PROD=d,l.info(`\u2713 Updating production provisioning profile: ${d}`)}if(t.appleKey){let d=(0,sr.resolve)(t.appleKey);(0,ar.existsSync)(d)||(l.error(`Apple key file not found: ${d}`),(0,Ve.exit)(1)),u.APPLE_KEY_FILE=d,l.info(`\u2713 Updating Apple key file: ${d}`)}t.p12Password&&(s.P12_PASSWORD=t.p12Password,l.info("\u2713 Updating P12 password")),t.appleKeyId&&(s.APPLE_KEY_ID=t.appleKeyId,l.info(`\u2713 Updating Apple Key ID: ${t.appleKeyId}`)),t.appleIssuerId&&(s.APPLE_ISSUER_ID=t.appleIssuerId,l.info(`\u2713 Updating Apple Issuer ID: ${t.appleIssuerId}`)),t.appleProfileName&&(s.APPLE_PROFILE_NAME=t.appleProfileName,l.info(`\u2713 Updating Apple Profile Name: ${t.appleProfileName}`)),t.appleTeamId&&(s.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId,l.info(`\u2713 Updating Apple Team ID: ${t.appleTeamId}`))}else if(n==="android"){if(t.keystore){let d=(0,sr.resolve)(t.keystore);(0,ar.existsSync)(d)||(l.error(`Keystore file not found: ${d}`),(0,Ve.exit)(1)),u.ANDROID_KEYSTORE_PATH=d,l.info(`\u2713 Updating keystore: ${d}`)}if(t.playConfig){let d=(0,sr.resolve)(t.playConfig);(0,ar.existsSync)(d)||(l.error(`Play config file not found: ${d}`),(0,Ve.exit)(1)),u.PLAY_CONFIG_JSON_PATH=d,l.info(`\u2713 Updating Play Store config: ${d}`)}t.keystoreAlias&&(s.KEYSTORE_KEY_ALIAS=t.keystoreAlias,l.info(`\u2713 Updating keystore alias: ${t.keystoreAlias}`)),t.keystoreKeyPassword&&(s.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,l.info("\u2713 Updating keystore key password")),t.keystoreStorePassword&&(s.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword,l.info("\u2713 Updating keystore store password"))}let c=await Yg(n,u,s);await Jg(i,n,c,t.local);let f=t.local?Ls():js();l.success(`
196
196
  \u2705 ${n.toUpperCase()} credentials updated for ${i}!`),l.info(` Location: ${f}
197
- `)}catch(e){l.error(`Failed to update credentials: ${e instanceof Error?e.message:String(e)}`),(0,He.exit)(1)}}var Kr=require("node:fs"),_r=require("node:fs/promises"),OO=require("node:os"),Sr=require("node:path"),sf=require("node:process");var FO=de(ah()),uf=de(al());async function b5(t,e,r,n,o,i=!1){if(o)return null;let a=null,s=!1,u=`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`;l.info(`Connecting to log stream: ${u}`);try{let c=await fetch(u,{headers:{authorization:n}});if(l.info(`Log stream response: ${c.status}`),!c.ok){let m=await c.text().catch(()=>"unknown error");return l.warn(`Could not stream logs (${c.status}): ${m}`),null}let f=c.body?.getReader();if(!f)return l.warn("No response body for log stream"),null;l.info("Reading log stream...");let d=new TextDecoder,p="",h=m=>{if(!m.trim())return;let g=m.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(g){a=g[1].toLowerCase();return}a||(s||(s=!0,l.info("")),l.info(m))};for(;;){let{done:m,value:g}=await f.read();if(m)break;p+=d.decode(g,{stream:!0});let D=p.split(`
198
- `);p=D.pop()||"";for(let v of D)if(v.startsWith("data: ")){let E=v.slice(6);h(E)}}if(p.startsWith("data: ")){let m=p.slice(6);h(m)}return a}catch(c){return o||l.warn(`Log streaming interrupted${c instanceof Error?`: ${c.message}`:""}`),null}}async function w5(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||l.warn(`Status check failed: ${u.status}`),await new Promise(f=>setTimeout(f,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(f=>setTimeout(f,5e3)),s++}catch(u){i||l.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||l.warn("Build status polling timed out"),"timeout"}async function v5(t,e){let r=new Set,n=!1;if(e==="ios"){let o=(0,Sr.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Kr.existsSync)(o)){n=!0;let a=(await(0,_r.readFile)(o,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let s of a)r.add(s[1])}else{let i=(0,Sr.join)(t,"ios/App/Podfile");if((0,Kr.existsSync)(i)){let s=(await(0,_r.readFile)(i,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of s)r.add(u[1])}}}else if(e==="android"){let o=(0,Sr.join)(t,"android/capacitor.settings.gradle");if((0,Kr.existsSync)(o)){let a=(await(0,_r.readFile)(o,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let s of a){let c=s[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function AO(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r.packages){let i=`node_modules/${o}/`;if(e==="android"){if(n.startsWith(`${i}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${i}ios/`))return!0;if(r.usesSPM){if(n===`${i}Package.swift`)return!0}else if(n.startsWith(i)&&n.endsWith(".podspec"))return!0}}return!1}function js(t,e,r,n,o){let i=(0,Kr.readdirSync)(e);for(let a of i){let s=(0,Sr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,Kr.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite"||a===".gradle"||a===".idea"||a===".swiftpm")continue;if(a===n){js(t,s,u,n,o);continue}if(a==="node_modules"){js(t,s,u,n,o);continue}if(a==="resources"){js(t,s,u,n,o);continue}let f=u.replace(/\\/g,"/");(AO(u,n,o)||Array.from(o.packages).some(p=>`node_modules/${p}/`.startsWith(`${f}/`)||f.startsWith(`node_modules/${p}`)))&&js(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;AO(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function C5(t,e,r){let n=await v5(t,r),o=new FO.default;js(o,t,"",r,n),await(0,_r.writeFile)(e,o.toBuffer())}async function E5(t,e,r=!1){let n=Date.now(),o=e.verbose??!1;try{e.apikey=e.apikey||ne(r);let i=await te();if(t=t||i?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let a=(0,Sr.resolve)(e.path||(0,sf.cwd)()),s=e.supaHost||"https://api.capgo.app",u=await re(e.apikey,e.supaHost,e.supaAnon);await ae(u,e.apikey,["write","all"]);let c=await Et(u,t);r||(l.info(`Requesting native build for ${t}`),l.info(`Platform: ${e.platform}`),l.info(`Project: ${a}`),l.info(`
197
+ `)}catch(e){l.error(`Failed to update credentials: ${e instanceof Error?e.message:String(e)}`),(0,Ve.exit)(1)}}var Kr=require("node:fs"),_r=require("node:fs/promises"),PO=require("node:os"),Sr=require("node:path"),uf=require("node:process");var $O=pe(sh()),cf=pe(sl());async function _5(t,e,r,n,o,i=!1){if(o)return null;let a=null,s=!1,u=`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`;l.info(`Connecting to log stream: ${u}`);try{let c=await fetch(u,{headers:{authorization:n}});if(l.info(`Log stream response: ${c.status}`),!c.ok){let m=await c.text().catch(()=>"unknown error");return l.warn(`Could not stream logs (${c.status}): ${m}`),null}let f=c.body?.getReader();if(!f)return l.warn("No response body for log stream"),null;l.info("Reading log stream...");let d=new TextDecoder,h="",p=m=>{if(!m.trim())return;let g=m.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(g){a=g[1].toLowerCase();return}a||(s||(s=!0,l.info("")),l.info(m))};for(;;){let{done:m,value:g}=await f.read();if(m)break;h+=d.decode(g,{stream:!0});let D=h.split(`
198
+ `);h=D.pop()||"";for(let v of D)if(v.startsWith("data: ")){let _=v.slice(6);p(_)}}if(h.startsWith("data: ")){let m=h.slice(6);p(m)}return a}catch(c){return o||l.warn(`Log streaming interrupted${c instanceof Error?`: ${c.message}`:""}`),null}}async function S5(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||l.warn(`Status check failed: ${u.status}`),await new Promise(f=>setTimeout(f,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(f=>setTimeout(f,5e3)),s++}catch(u){i||l.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||l.warn("Build status polling timed out"),"timeout"}async function x5(t,e){let r=new Set,n=!1;if(e==="ios"){let o=(0,Sr.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Kr.existsSync)(o)){n=!0;let a=(await(0,_r.readFile)(o,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let s of a)r.add(s[1])}else{let i=(0,Sr.join)(t,"ios/App/Podfile");if((0,Kr.existsSync)(i)){let s=(await(0,_r.readFile)(i,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of s)r.add(u[1])}}}else if(e==="android"){let o=(0,Sr.join)(t,"android/capacitor.settings.gradle");if((0,Kr.existsSync)(o)){let a=(await(0,_r.readFile)(o,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let s of a){let c=s[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function kO(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r.packages){let i=`node_modules/${o}/`;if(e==="android"){if(n.startsWith(`${i}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${i}ios/`))return!0;if(r.usesSPM){if(n===`${i}Package.swift`)return!0}else if(n.startsWith(i)&&n.endsWith(".podspec"))return!0}}return!1}function Us(t,e,r,n,o){let i=(0,Kr.readdirSync)(e);for(let a of i){let s=(0,Sr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,Kr.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite"||a===".gradle"||a===".idea"||a===".swiftpm")continue;if(a===n){Us(t,s,u,n,o);continue}if(a==="node_modules"){Us(t,s,u,n,o);continue}if(a==="resources"){Us(t,s,u,n,o);continue}let f=u.replace(/\\/g,"/");(kO(u,n,o)||Array.from(o.packages).some(h=>`node_modules/${h}/`.startsWith(`${f}/`)||f.startsWith(`node_modules/${h}`)))&&Us(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;kO(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function A5(t,e,r){let n=await x5(t,r),o=new $O.default;Us(o,t,"",r,n),await(0,_r.writeFile)(e,o.toBuffer())}async function O5(t,e,r=!1){let n=Date.now(),o=e.verbose??!1;try{e.apikey=e.apikey||oe(r);let i=await te();if(t=t||i?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let a=(0,Sr.resolve)(e.path||(0,uf.cwd)()),s=e.supaHost||"https://api.capgo.app",u=await ne(e.apikey,e.supaHost,e.supaAnon);await ue(u,e.apikey,["write","all"]);let c=await Et(u,t);r||(l.info(`Requesting native build for ${t}`),l.info(`Platform: ${e.platform}`),l.info(`Project: ${a}`),l.info(`
199
199
  \u{1F512} Security: Credentials are never stored on Capgo servers`),l.info(" They are used only during build and deleted after"),l.info(` Builds sent directly to app stores - Capgo keeps nothing
200
- `)),o&&l.info(`API host: ${s}`);let f={};e.buildCertificateBase64&&(f.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(f.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(f.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(f.P12_PASSWORD=e.p12Password),e.appleKeyId&&(f.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(f.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(f.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(f.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(f.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(f.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(f.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let d=!!e.keystoreKeyPassword,p=!!e.keystoreStorePassword;d&&!p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!d&&p?(f.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):d&&p&&(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(f.PLAY_CONFIG_JSON=e.playConfigJson);let h=await CO(t,e.platform,Object.keys(f).length>0?f:void 0),m={app_id:t,platform:e.platform};if(!h)throw r||(l.error("\u274C No credentials found for this app and platform"),l.error(""),l.error("You must provide credentials via:"),l.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),l.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),l.error(" 3. Saved credentials file:"),l.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),l.error(""),l.error("Documentation:"),l.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let g=[];if(e.platform==="ios"?(h.BUILD_CERTIFICATE_BASE64||g.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!h.P12_PASSWORD&&!r&&(l.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),l.warn(" If your certificate requires a password, provide it with --p12-password")),h.BUILD_PROVISION_PROFILE_BASE64||g.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),h.APPLE_KEY_ID||g.push("APPLE_KEY_ID (or --apple-key-id)"),h.APPLE_ISSUER_ID||g.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),h.APPLE_KEY_CONTENT||g.push("APPLE_KEY_CONTENT (or --apple-key-content)"),h.APP_STORE_CONNECT_TEAM_ID||g.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(h.ANDROID_KEYSTORE_FILE||g.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),h.KEYSTORE_KEY_ALIAS||g.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!h.KEYSTORE_KEY_PASSWORD&&!h.KEYSTORE_STORE_PASSWORD&&g.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!h.PLAY_CONFIG_JSON&&!r&&l.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),g.length>0){if(!r){l.error(`\u274C Missing required credentials for ${e.platform}:`),l.error("");for(let _ of g)l.error(` \u2022 ${_}`);l.error(""),l.error("Provide credentials via:"),l.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),l.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),l.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),l.error(""),l.error("Documentation:"),l.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${g.join(", ")}`)}if(m.credentials=h,r||l.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),o){let _=Object.keys(h).filter(S=>h[S]);l.info(`Credentials provided: ${_.join(", ")}`)}r||l.info("Requesting build from Capgo...");let D=await fetch(`${s}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!D.ok){let _=await D.text();throw new Error(`Failed to request build: ${D.status} - ${_}`)}let v=await D.json();r||(l.success(`Build job created: ${v.job_id}`),l.info(`Status: ${v.status}`)),o&&(l.info(`Upload URL: ${v.upload_url}`),l.info(`Upload expires: ${v.upload_expires_at}`)),await ge(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let E=(0,Sr.join)((0,OO.tmpdir)(),`capgo-build-${Date.now()}`);await(0,_r.mkdir)(E,{recursive:!0});let y=(0,Sr.join)(E,`${(0,Sr.basename)(a)}.zip`);try{r||l.info(`Zipping ${e.platform} project from ${a}...`),await C5(a,y,e.platform);let S=((await(0,_r.stat)(y)).size/1024/1024).toFixed(2);r||l.success(`Created zip: ${y} (${S} MB)`),r||l.info("Uploading to builder..."),o&&(l.info(`Upload endpoint: ${v.upload_url}`),l.info(`File size: ${S} MB`),l.info(`Job ID: ${v.job_id}`));let k=(0,Kr.readFileSync)(y),T=_e();r||T.start("Uploading bundle"),await new Promise((j,Z)=>{let P=new uf.Upload(k,{endpoint:v.upload_url,chunkSize:5242880,metadata:{filename:(0,Sr.basename)(y),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(b){if(o){l.info(`[TUS] ${b.getMethod()} ${b.getURL()}`);let w=b.getHeader("authorization");l.info(`[TUS] Authorization header present: ${!!w}`)}},onAfterResponse(b,w){if(o){l.info(`[TUS] Response status: ${w.getStatus()}`);let C=w.getHeader("upload-offset"),O=w.getHeader("tus-resumable");l.info(`[TUS] Upload-Offset: ${C}, Tus-Resumable: ${O}`)}},onError(b){if(r||(T.stop("Upload failed"),l.error(`Upload error: ${b.message}`)),b instanceof uf.DetailedError){let w=b.originalResponse?.getBody(),C=b.originalResponse?.getStatus(),O=b.originalRequest?.getURL();o&&(l.error(`[TUS] Request URL: ${O}`),l.error(`[TUS] Response status: ${C}`),l.error(`[TUS] Response body: ${w}`));let R="Unknown error";try{let $=JSON.parse(w||'{"error": "unknown error"}');R=$.status||$.error||$.message||"unknown error"}catch{R=w||b.message}Z(new Error(`TUS upload failed: ${R}`))}else Z(new Error(`TUS upload failed: ${b.message||b.toString()}`))},onProgress(b,w){let C=(b/w*100).toFixed(2);r||T.message(`Uploading ${C}%`)},onSuccess(){r||T.stop("Upload complete!"),o&&l.success("TUS upload completed successfully"),j()}});o&&l.info("[TUS] Starting upload..."),P.start()}),r||l.info("Starting build job...");let B=await fetch(`${s}/build/start/${v.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!B.ok){let j=await B.text();throw new Error(`Failed to start build: ${B.status} - ${j}`)}let F=await B.json();r||(l.success("Build started!"),l.info("Streaming build logs..."));let L,A=await b5(s,v.job_id,t,e.apikey,r,o);A?L=A:L=await w5(s,v.job_id,t,e.platform,e.apikey,r),r||(L==="succeeded"?l.success("Build completed successfully!"):L==="failed"?l.error("Build failed"):l.warn(`Build finished with status: ${L}`));let q=((Date.now()-n)/1e3).toFixed(2);return await ge(e.apikey,{channel:"native-builder",event:L==="succeeded"?"Build succeeded":"Build failed",icon:L==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:L||"unknown",time:q},notify:!1}).catch(),{success:L==="succeeded",jobId:v.job_id,uploadUrl:v.upload_url,status:L||F.status||v.status}}finally{await(0,_r.rm)(E,{recursive:!0,force:!0})}}catch(i){let a=i instanceof Error?i.message:String(i);return r||l.error(a),{success:!1,error:a}}}async function PO(t,e){(await E5(t,e,!1)).success||(0,sf.exit)(1)}async function kO(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||l.error(`Cannot check Version ${e}@${r.name}: ${M(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${M(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ce({message:"unlink it?"})===!0),!u)throw l.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let f=_e();f.start(`Unlinking channel ${c.name}`);let d=await Xg(t,e,{silent:o});if(!d)throw f.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw f.stop(`Cannot update channel ${c.name} ${M(p)}`),new Error(`Cannot update channel ${c.name}: ${M(p)}`);f.stop(`\u2705 Channel ${c.name} unlinked`)}G(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Xg(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||l.error(`Cannot call findUnknownVersion as it returned an error.
201
- ${M(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${M(i)}`)}function $O(t,e){return t.from("channels").insert(e).select().single()}function IO(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function TO(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function RO(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function BO(t,e,r){return t.from("channels").select(`
200
+ `)),o&&l.info(`API host: ${s}`);let f={};e.buildCertificateBase64&&(f.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(f.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(f.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(f.P12_PASSWORD=e.p12Password),e.appleKeyId&&(f.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(f.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(f.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(f.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(f.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(f.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(f.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let d=!!e.keystoreKeyPassword,h=!!e.keystoreStorePassword;d&&!h?(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!d&&h?(f.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):d&&h&&(f.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,f.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(f.PLAY_CONFIG_JSON=e.playConfigJson);let p=await SO(t,e.platform,Object.keys(f).length>0?f:void 0),m={app_id:t,platform:e.platform};if(!p)throw r||(l.error("\u274C No credentials found for this app and platform"),l.error(""),l.error("You must provide credentials via:"),l.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),l.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),l.error(" 3. Saved credentials file:"),l.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),l.error(""),l.error("Documentation:"),l.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let g=[];if(e.platform==="ios"?(p.BUILD_CERTIFICATE_BASE64||g.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!p.P12_PASSWORD&&!r&&(l.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),l.warn(" If your certificate requires a password, provide it with --p12-password")),p.BUILD_PROVISION_PROFILE_BASE64||g.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),p.APPLE_KEY_ID||g.push("APPLE_KEY_ID (or --apple-key-id)"),p.APPLE_ISSUER_ID||g.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),p.APPLE_KEY_CONTENT||g.push("APPLE_KEY_CONTENT (or --apple-key-content)"),p.APP_STORE_CONNECT_TEAM_ID||g.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(p.ANDROID_KEYSTORE_FILE||g.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),p.KEYSTORE_KEY_ALIAS||g.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!p.KEYSTORE_KEY_PASSWORD&&!p.KEYSTORE_STORE_PASSWORD&&g.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!p.PLAY_CONFIG_JSON&&!r&&l.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),g.length>0){if(!r){l.error(`\u274C Missing required credentials for ${e.platform}:`),l.error("");for(let E of g)l.error(` \u2022 ${E}`);l.error(""),l.error("Provide credentials via:"),l.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),l.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),l.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),l.error(""),l.error("Documentation:"),l.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${g.join(", ")}`)}if(m.credentials=p,r||l.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),o){let E=Object.keys(p).filter(S=>p[S]);l.info(`Credentials provided: ${E.join(", ")}`)}r||l.info("Requesting build from Capgo...");let D=await fetch(`${s}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!D.ok){let E=await D.text();throw new Error(`Failed to request build: ${D.status} - ${E}`)}let v=await D.json();r||(l.success(`Build job created: ${v.job_id}`),l.info(`Status: ${v.status}`)),o&&(l.info(`Upload URL: ${v.upload_url}`),l.info(`Upload expires: ${v.upload_expires_at}`)),await ye(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let _=(0,Sr.join)((0,PO.tmpdir)(),`capgo-build-${Date.now()}`);await(0,_r.mkdir)(_,{recursive:!0});let y=(0,Sr.join)(_,`${(0,Sr.basename)(a)}.zip`);try{r||l.info(`Zipping ${e.platform} project from ${a}...`),await A5(a,y,e.platform);let S=((await(0,_r.stat)(y)).size/1024/1024).toFixed(2);r||l.success(`Created zip: ${y} (${S} MB)`),r||l.info("Uploading to builder..."),o&&(l.info(`Upload endpoint: ${v.upload_url}`),l.info(`File size: ${S} MB`),l.info(`Job ID: ${v.job_id}`));let P=(0,Kr.readFileSync)(y),T=_e();r||T.start("Uploading bundle"),await new Promise((j,Z)=>{let k=new cf.Upload(P,{endpoint:v.upload_url,chunkSize:5242880,metadata:{filename:(0,Sr.basename)(y),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(b){if(o){l.info(`[TUS] ${b.getMethod()} ${b.getURL()}`);let w=b.getHeader("authorization");l.info(`[TUS] Authorization header present: ${!!w}`)}},onAfterResponse(b,w){if(o){l.info(`[TUS] Response status: ${w.getStatus()}`);let C=w.getHeader("upload-offset"),O=w.getHeader("tus-resumable");l.info(`[TUS] Upload-Offset: ${C}, Tus-Resumable: ${O}`)}},onError(b){if(r||(T.stop("Upload failed"),l.error(`Upload error: ${b.message}`)),b instanceof cf.DetailedError){let w=b.originalResponse?.getBody(),C=b.originalResponse?.getStatus(),O=b.originalRequest?.getURL();o&&(l.error(`[TUS] Request URL: ${O}`),l.error(`[TUS] Response status: ${C}`),l.error(`[TUS] Response body: ${w}`));let R="Unknown error";try{let $=JSON.parse(w||'{"error": "unknown error"}');R=$.status||$.error||$.message||"unknown error"}catch{R=w||b.message}Z(new Error(`TUS upload failed: ${R}`))}else Z(new Error(`TUS upload failed: ${b.message||b.toString()}`))},onProgress(b,w){let C=(b/w*100).toFixed(2);r||T.message(`Uploading ${C}%`)},onSuccess(){r||T.stop("Upload complete!"),o&&l.success("TUS upload completed successfully"),j()}});o&&l.info("[TUS] Starting upload..."),k.start()}),r||l.info("Starting build job...");let B=await fetch(`${s}/build/start/${v.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!B.ok){let j=await B.text();throw new Error(`Failed to start build: ${B.status} - ${j}`)}let F=await B.json();r||(l.success("Build started!"),l.info("Streaming build logs..."));let L,A=await _5(s,v.job_id,t,e.apikey,r,o);A?L=A:L=await S5(s,v.job_id,t,e.platform,e.apikey,r),r||(L==="succeeded"?l.success("Build completed successfully!"):L==="failed"?l.error("Build failed"):l.warn(`Build finished with status: ${L}`));let q=((Date.now()-n)/1e3).toFixed(2);return await ye(e.apikey,{channel:"native-builder",event:L==="succeeded"?"Build succeeded":"Build failed",icon:L==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:L||"unknown",time:q},notify:!1}).catch(),{success:L==="succeeded",jobId:v.job_id,uploadUrl:v.upload_url,status:L||F.status||v.status}}finally{await(0,_r.rm)(_,{recursive:!0,force:!0})}}catch(i){let a=i instanceof Error?i.message:String(i);return r||l.error(a),{success:!1,error:a}}}async function IO(t,e){(await O5(t,e,!1)).success||(0,uf.exit)(1)}async function TO(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||l.error(`Cannot check Version ${e}@${r.name}: ${M(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${M(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await fe({message:"unlink it?"})===!0),!u)throw l.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let f=_e();f.start(`Unlinking channel ${c.name}`);let d=await Zg(t,e,{silent:o});if(!d)throw f.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:h}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(h)throw f.stop(`Cannot update channel ${c.name} ${M(h)}`),new Error(`Cannot update channel ${c.name}: ${M(h)}`);f.stop(`\u2705 Channel ${c.name} unlinked`)}G(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Zg(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||l.error(`Cannot call findUnknownVersion as it returned an error.
201
+ ${M(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${M(i)}`)}function RO(t,e){return t.from("channels").insert(e).select().single()}function BO(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function NO(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function LO(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function jO(t,e,r){return t.from("channels").select(`
202
202
  id,
203
203
  version (id, name)
204
- `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function NO(t,e=!1){if(e)return;let r=new ut;r.theme=ut.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","Device","Dev","Prod"],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_device?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C",n.allow_prod?"\u2705":"\u274C"]);l.success("Channels"),l.success(r.toString())}async function LO(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
204
+ `).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function UO(t,e=!1){if(e)return;let r=new qe;r.theme=qe.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","Device","Dev","Prod"],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_device?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C",n.allow_prod?"\u2705":"\u274C"]);l.success("Channels"),l.success(r.toString())}async function MO(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
205
205
  id,
206
206
  name,
207
207
  public,
@@ -218,52 +218,54 @@ ${M(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${M(i)}`)}fun
218
218
  created_by,
219
219
  app_id,
220
220
  version (id, name)
221
- `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||l.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${M(o)}`);return n}async function Zg(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||l.error(a),new Error(`${a}: ${M(i)}`)}}async function cf(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await _5(t,e,r,{silent:o});await kO(t,e,a,{silent:o,autoUnlink:i}),await Zg(t,e,r,{silent:o})}function lf(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new ut;r.theme=ut.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,ca(n.created_at),n.keep??""]);l.success("Bundles"),l.success(r.toString())}async function ff(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||l.error(a),new Error(`${a}: ${M(i)}`)}return o??[]}async function jO(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||l.error(a),new Error(`${a}: ${M(i)}`)}return(o??[]).map(a=>a.version)}async function _5(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||l.error(s),new Error(`${s}${a?`: ${M(a)}`:""}`)}return i}async function S5(t,e,r,n){for await(let o of t)n||l.warn(`Removing ${o.name} created on ${ca(o.created_at)}`),await cf(e,r,o.name)}function x5(t,e,r){let n=[];for(let o of t??[]){let i=ye(o.name);_d(i,e)&&er(i,r)&&n.push(o)}return n}async function A5(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await Ee(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=pe(t,s?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||l.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 ae(u,e.apikey,["write","all"]),await qe(u,e.apikey,t,3,r),r||l.info("Querying all available versions in Capgo");let c=await ff(u,t),f=await jO(u,t);if(r||l.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||l.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=ye(n),m=An(h,"major");r||l.info(`Querying available versions in Capgo between ${Vt(h)} and ${Vt(m)}`),c=x5(c,h,m),r||l.info(`Active versions in Capgo between ${Vt(h)} and ${Vt(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=f.find(g=>g===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||l.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||lf(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ce({message:"Do you want to continue removing the versions specified?"});if(ue(h)||!h)throw l.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||l.success("You have confirmed removal, removing versions now"),await S5(d,u,t,r),r||G("Done \u2705"),{removed:d.length,kept:p}}async function UO(t,e){return A5(t,e)}async function O5(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=pe(t,o?.config),a=n.channel;if(!a)throw r||l.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.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 ae(s,n.apikey,["write","all","read","upload"]),await qe(s,n.apikey,i,1,r);let u=await ef(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new ut;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=ut.roundTheme,c.rows=[];let f=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:g}=p,D=No(p)?f:d;c.rows.push([h,m,g,D])}l.success("Compatibility"),l.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function MO(t,e){try{await O5(t,e,!1)}catch(r){throw l.error(`Error checking compatibility ${M(r)}`),r}}var yn=require("node:fs");var mn=require("node:buffer"),mt=require("node:crypto"),HO="aes-128-cbc",gn="base64",qO="hex",Us=mt.constants.RSA_PKCS1_PADDING;function df(t){let e=(0,mt.randomBytes)(16),r=(0,mt.randomBytes)(16),n=e.toString(gn),o=(0,mt.privateEncrypt)({key:t,padding:Us},r).toString(gn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ha(t,e,r){let[n]=r.split(":"),o=mn.Buffer.from(n,gn),i=(0,mt.createCipheriv)(HO,e,o);return i.setAutoPadding(!0),mn.Buffer.concat([i.update(t),i.final()])}function VO(t,e,r){let[n,o]=e.split(":"),i=(0,mt.publicDecrypt)({key:r,padding:Us},mn.Buffer.from(o,gn)),a=mn.Buffer.from(n,gn),s=(0,mt.createDecipheriv)(HO,i,a);return s.setAutoPadding(!0),mn.Buffer.concat([s.update(t),s.final()])}function ma(t,e){return(0,mt.privateEncrypt)({key:e,padding:Us},mn.Buffer.from(t,gn)).toString(gn)}function pf(t,e){return(0,mt.privateEncrypt)({key:e,padding:Us},mn.Buffer.from(t,qO)).toString(qO)}function zO(t,e){return(0,mt.publicDecrypt)({key:e,padding:Us},mn.Buffer.from(t,gn)).toString(gn)}function KO(){let{publicKey:t,privateKey:e}=(0,mt.generateKeyPairSync)("rsa",{modulusLength:2048});return{publicKey:t.export({type:"pkcs1",format:"pem"}),privateKey:e.export({type:"pkcs1",format:"pem"})}}function GO(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,20):""}function F5(t,e){let r=t.key||hn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,yn.existsSync)(r)?n=(0,yn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function P5(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await Ee(),!(0,yn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||l.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,yn.existsSync)(hn)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${hn} or in ${o.path}`;throw n||l.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=F5(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||l.error(d),new Error(d)}let s=(0,yn.readFileSync)(t),u=VO(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,yn.writeFileSync)(c,u),n||l.info(`Decrypted zip file at ${c}`);let f;if(r.checksum){let d=await cn(u,"sha256"),p=zO(r.checksum,r.keyData??i);if(f=d===p,!f){let h=`Checksum does not match ${d} !== ${p}`;throw n||l.error(h),new Error(h)}n||l.info("Checksum matches")}return n||G("\u2705 done"),{outputPath:c,checksumMatches:f}}catch(o){throw n||l.error(`Error decrypting zip file ${M(o)}`),o instanceof Error?o:new Error(String(o))}}async function WO(t,e,r){await P5(t,e,r,!1)}async function k5(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]),await qe(i,r.apikey,e,3,n),n||(l.info(`Deleting bundle ${e}@${t} from Capgo`),l.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await cf(i,e,t),n||(l.success(`Bundle ${e}@${t} deleted in Capgo`),G("Done")),!0}async function YO(t,e,r){return k5(t,e,r)}var Dn=require("node:fs");function Ms(t){console.error(M(t))}async function $5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await Ee());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&l.warning("There is still a privateKey in the config"),!(0,Dn.existsSync)(t)){let v=`Zip not found at the path ${t}`;throw n||(o?Ms({error:"zip_not_found"}):l.error(`Error: ${v}`)),new Error(v)}if(!u)throw n||(o?Ms({error:"missing_public_key"}):l.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||ir,f=r.keyData||"";if(!(0,Dn.existsSync)(c)&&!f)throw n||(o?Ms({error:"missing_key"}):(l.warning(`Cannot find a private key at ${c} or as a keyData option`),l.error("Error: Missing key"))),new Error("Missing private key");if((0,Dn.existsSync)(c)&&(f=(0,Dn.readFileSync)(c,"utf8")),f&&!f.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Ms({error:"invalid_private_key"}):l.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,Dn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=df(f),m=ha(d,p,h),g=ma(e,f),D=`${t}_encrypted.zip`;return(0,Dn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:g,filename:D,ivSessionKey:h},null,2)):(l.success(`Encoded Checksum: ${g}`),l.success(`ivSessionKey: ${h}`),l.success(`Encrypted zip saved at ${D}`),G("Done \u2705"))),{checksum:g,filename:D,ivSessionKey:h}}catch(a){throw n||(r.json?Ms(a):l.error(`Error encrypting zip file ${M(a)}`)),a instanceof Error?a:new Error(String(a))}}async function JO(t,e,r){await $5(t,e,r,!1)}async function XO(t,e,r=!1){r||ee("List bundles"),await Ee(),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]),await qe(o,e.apikey,t,1,r),r||l.info(`Querying available versions of: ${t} in Capgo`);let i=await ff(o,t);return r||(l.info(`Active versions in Capgo: ${i?.length??0}`),lf(i),G("Done \u2705")),i}var AF=require("node:crypto"),Go=require("node:fs"),Of=require("node:process");var hf=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 zn(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(c()||f("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||f(">")||f("?>")||f("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function f(d){return t.startsWith(d)}}var Gr=class extends Error{};var xt=class extends Gr{},qs=class extends Gr{},mf=class extends Gr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Wr=class extends Gr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Kn=class extends Gr{constructor(){super("accessKey is required")}},ga=class extends Gr{constructor(){super("secretKey is required")}},Hs=class extends Gr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},bn=class extends Gr{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 ZO(t){try{let r=zn(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 bn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new bn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function QO(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function e1(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 Gn(t){return!(!I5(t)||t.length===0)}function I5(t){return!(typeof t!="string"||t.length>1024)}function Vs(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function jo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function ey(t){return t.get("x-amz-version-id")??null}function Uo(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 ty(t){return Uo(t).slice(0,8)}function ry(t,e){return`${ty(e)}/${t}/s3/aws4_request`}async function gf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),Vs(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var T5=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],yf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],f,d=[];super({start(){},async write(p,h){let g=s++;try{if(g==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:jo(E.headers.get("etag")??void 0),versionId:ey(E.headers)};return}g===1&&(u=(await R5({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(p.length)};for(let E of T5){let y=i[E];y&&(D[E]=y)}let v=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:p}).then(E=>{let y=E.headers.get("etag")??"";return y&&(y=y.replace(/^"/,"").replace(/"$/,"")),c.push({part:g,etag:y}),E});d.push(v.catch(E=>{f||(f=E)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(d),f)throw f;c.sort((p,h)=>p.part>h.part?1:-1),a=await B5({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 R5(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=zn(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 B5({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
221
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||l.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${M(o)}`);return n}async function Qg(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||l.error(a),new Error(`${a}: ${M(i)}`)}}async function lf(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await F5(t,e,r,{silent:o});await TO(t,e,a,{silent:o,autoUnlink:i}),await Qg(t,e,r,{silent:o})}function ff(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new qe;r.theme=qe.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,la(n.created_at),n.keep??""]);l.success("Bundles"),l.success(r.toString())}async function df(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||l.error(a),new Error(`${a}: ${M(i)}`)}return o??[]}async function qO(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||l.error(a),new Error(`${a}: ${M(i)}`)}return(o??[]).map(a=>a.version)}async function F5(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||l.error(s),new Error(`${s}${a?`: ${M(a)}`:""}`)}return i}async function k5(t,e,r,n){for await(let o of t)n||l.warn(`Removing ${o.name} created on ${la(o.created_at)}`),await lf(e,r,o.name)}function P5(t,e,r){let n=[];for(let o of t??[]){let i=De(o.name);Sd(i,e)&&er(i,r)&&n.push(o)}return n}async function $5(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await Ee(),e.apikey=e.apikey||oe();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=he(t,s?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await ne(e.apikey,e.supaHost,e.supaAnon);await ue(u,e.apikey,["write","all"]),await He(u,e.apikey,t,3,r),r||l.info("Querying all available versions in Capgo");let c=await df(u,t),f=await qO(u,t);if(r||l.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||l.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let p=De(n),m=An(p,"major");r||l.info(`Querying available versions in Capgo between ${Vt(p)} and ${Vt(m)}`),c=P5(c,p,m),r||l.info(`Active versions in Capgo between ${Vt(p)} and ${Vt(m)}: ${c?.length??0}`)}let d=[],h=0;for(let p of c){let m=f.find(g=>g===p.id);h<o||m&&!a?(p.keep=m?"\u2705 (Linked to channel)":"\u2705",h+=1):(p.keep="\u274C",d.push(p))}if(!d.length)return r||l.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:h};if(r||ff(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let p=await fe({message:"Do you want to continue removing the versions specified?"});if(le(p)||!p)throw l.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||l.success("You have confirmed removal, removing versions now"),await k5(d,u,t,r),r||G("Done \u2705"),{removed:d.length,kept:h}}async function HO(t,e){return $5(t,e)}async function I5(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||oe()},o=await te(),i=he(t,o?.config),a=n.channel;if(!a)throw r||l.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||l.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await ne(n.apikey,n.supaHost,n.supaAnon);await ue(s,n.apikey,["write","all","read","upload"]),await He(s,n.apikey,i,1,r);let u=await tf(s,i,a,n.packageJson,n.nodeModules),c=u.finalCompatibility.some(f=>!zn(f));if(!r){let f=new qe;f.headers=["Package","Local","Remote","Status","Details"],f.theme=qe.roundTheme,f.rows=[];let d=n.text?"OK":"\u2705",h=n.text?"FAIL":"\u274C";for(let p of u.finalCompatibility){let{name:m,localVersion:g,remoteVersion:D}=p,v=Lo(p),_=v.compatible?d:h;f.rows.push([m,g||"-",D||"-",_,v.message])}if(l.success("Compatibility Check Results"),l.info(f.toString()),c){let p=u.finalCompatibility.filter(m=>!zn(m)).length;l.warn(`
222
+ ${p} package(s) are incompatible with channel "${a}"`),l.warn("An app store update may be required for these changes to take effect.")}else l.success(`
223
+ All packages are compatible with channel "${a}"`)}return{finalCompatibility:u.finalCompatibility,hasIncompatible:c}}async function VO(t,e){try{await I5(t,e,!1)}catch(r){throw l.error(`Error checking compatibility ${M(r)}`),r}}var yn=require("node:fs");var mn=require("node:buffer"),ht=require("node:crypto"),KO="aes-128-cbc",gn="base64",zO="hex",Ms=ht.constants.RSA_PKCS1_PADDING;function pf(t){let e=(0,ht.randomBytes)(16),r=(0,ht.randomBytes)(16),n=e.toString(gn),o=(0,ht.privateEncrypt)({key:t,padding:Ms},r).toString(gn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function ma(t,e,r){let[n]=r.split(":"),o=mn.Buffer.from(n,gn),i=(0,ht.createCipheriv)(KO,e,o);return i.setAutoPadding(!0),mn.Buffer.concat([i.update(t),i.final()])}function GO(t,e,r){let[n,o]=e.split(":"),i=(0,ht.publicDecrypt)({key:r,padding:Ms},mn.Buffer.from(o,gn)),a=mn.Buffer.from(n,gn),s=(0,ht.createDecipheriv)(KO,i,a);return s.setAutoPadding(!0),mn.Buffer.concat([s.update(t),s.final()])}function ga(t,e){return(0,ht.privateEncrypt)({key:e,padding:Ms},mn.Buffer.from(t,gn)).toString(gn)}function hf(t,e){return(0,ht.privateEncrypt)({key:e,padding:Ms},mn.Buffer.from(t,zO)).toString(zO)}function WO(t,e){return(0,ht.publicDecrypt)({key:e,padding:Ms},mn.Buffer.from(t,gn)).toString(gn)}function YO(){let{publicKey:t,privateKey:e}=(0,ht.generateKeyPairSync)("rsa",{modulusLength:2048});return{publicKey:t.export({type:"pkcs1",format:"pem"}),privateKey:e.export({type:"pkcs1",format:"pem"})}}function JO(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,20):""}function T5(t,e){let r=t.key||hn,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,yn.existsSync)(r)?n=(0,yn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function R5(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await Ee(),!(0,yn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||l.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,yn.existsSync)(hn)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${hn} or in ${o.path}`;throw n||l.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=T5(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||l.error(d),new Error(d)}let s=(0,yn.readFileSync)(t),u=GO(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,yn.writeFileSync)(c,u),n||l.info(`Decrypted zip file at ${c}`);let f;if(r.checksum){let d=await cn(u,"sha256"),h=WO(r.checksum,r.keyData??i);if(f=d===h,!f){let p=`Checksum does not match ${d} !== ${h}`;throw n||l.error(p),new Error(p)}n||l.info("Checksum matches")}return n||G("\u2705 done"),{outputPath:c,checksumMatches:f}}catch(o){throw n||l.error(`Error decrypting zip file ${M(o)}`),o instanceof Error?o:new Error(String(o))}}async function XO(t,e,r){await R5(t,e,r,!1)}async function B5(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||oe();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);return await ue(i,r.apikey,["write","all"]),await He(i,r.apikey,e,3,n),n||(l.info(`Deleting bundle ${e}@${t} from Capgo`),l.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await lf(i,e,t),n||(l.success(`Bundle ${e}@${t} deleted in Capgo`),G("Done")),!0}async function ZO(t,e,r){return B5(t,e,r)}var Dn=require("node:fs");function qs(t){console.error(M(t))}async function N5(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await Ee());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&l.warning("There is still a privateKey in the config"),!(0,Dn.existsSync)(t)){let v=`Zip not found at the path ${t}`;throw n||(o?qs({error:"zip_not_found"}):l.error(`Error: ${v}`)),new Error(v)}if(!u)throw n||(o?qs({error:"missing_public_key"}):l.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||ir,f=r.keyData||"";if(!(0,Dn.existsSync)(c)&&!f)throw n||(o?qs({error:"missing_key"}):(l.warning(`Cannot find a private key at ${c} or as a keyData option`),l.error("Error: Missing key"))),new Error("Missing private key");if((0,Dn.existsSync)(c)&&(f=(0,Dn.readFileSync)(c,"utf8")),f&&!f.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?qs({error:"invalid_private_key"}):l.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,Dn.readFileSync)(t),{sessionKey:h,ivSessionKey:p}=pf(f),m=ma(d,h,p),g=ga(e,f),D=`${t}_encrypted.zip`;return(0,Dn.writeFileSync)(D,m),n||(o?console.log(JSON.stringify({checksum:g,filename:D,ivSessionKey:p},null,2)):(l.success(`Encoded Checksum: ${g}`),l.success(`ivSessionKey: ${p}`),l.success(`Encrypted zip saved at ${D}`),G("Done \u2705"))),{checksum:g,filename:D,ivSessionKey:p}}catch(a){throw n||(r.json?qs(a):l.error(`Error encrypting zip file ${M(a)}`)),a instanceof Error?a:new Error(String(a))}}async function QO(t,e,r){await N5(t,e,r,!1)}async function e1(t,e,r=!1){r||ee("List bundles"),await Ee(),e.apikey=e.apikey||oe();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon);await ue(o,e.apikey,["write","all","read","upload"]),await He(o,e.apikey,t,1,r),r||l.info(`Querying available versions of: ${t} in Capgo`);let i=await df(o,t);return r||(l.info(`Active versions in Capgo: ${i?.length??0}`),ff(i),G("Done \u2705")),i}var kF=require("node:crypto"),Wo=require("node:fs"),Ff=require("node:process");var mf=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 Kn(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 h={attributes:{}};for(;!(c()||f("?>"));){let p=i();if(!p)return h;h.attributes[p.name]=p.value}return u(/\?>\s*/),h}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let h={name:d[1],attributes:{},children:[]};for(;!(c()||f(">")||f("?>")||f("/>"));){let m=i();if(!m)return h;h.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return h;u(/\??>\s*/),h.content=o();let p;for(;p=n();)h.children.push(p);return u(/^<\/[\w-:.]+>\s*/),h}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(d){let h=t.match(d);if(h)return t=t.slice(h[0].length),h}function c(){return t.length===0}function f(d){return t.startsWith(d)}}var Gr=class extends Error{};var xt=class extends Gr{},Hs=class extends Gr{},gf=class extends Gr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Wr=class extends Gr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Gn=class extends Gr{constructor(){super("accessKey is required")}},ya=class extends Gr{constructor(){super("secretKey is required")}},Vs=class extends Gr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},bn=class extends Gr{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 t1(t){try{let r=Kn(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 bn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new bn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function r1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function n1(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 Wn(t){return!(!L5(t)||t.length===0)}function L5(t){return!(typeof t!="string"||t.length>1024)}function zs(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Uo(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function ty(t){return t.get("x-amz-version-id")??null}function Mo(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 ry(t){return Mo(t).slice(0,8)}function ny(t,e){return`${ry(e)}/${t}/s3/aws4_request`}async function yf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),zs(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var j5=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Df=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],f,d=[];super({start(){},async write(h,p){let g=s++;try{if(g==1&&h.length<o){let _=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(h.length)}),bucketName:r,objectName:n,payload:h});a={etag:Uo(_.headers.get("etag")??void 0),versionId:ty(_.headers)};return}g===1&&(u=(await U5({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let D={"Content-Length":String(h.length)};for(let _ of j5){let y=i[_];y&&(D[_]=y)}let v=e.makeRequest({method:"PUT",query:{partNumber:g.toString(),uploadId:u},headers:new Headers(D),bucketName:r,objectName:n,payload:h}).then(_=>{let y=_.headers.get("etag")??"";return y&&(y=y.replace(/^"/,"").replace(/"$/,"")),c.push({part:g,etag:y}),_});d.push(v.catch(_=>{f||(f=_)}))}catch(D){throw D}},async close(){if(!a)if(u){if(await Promise.all(d),f)throw f;c.sort((h,p)=>h.part>p.part?1:-1),a=await M5({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 U5(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=Kn(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 M5({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
222
224
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
223
225
  ${o.map(d=>` <Part><PartNumber>${d.part}</PartNumber><ETag>${d.etag}</ETag></Part>`).join(`
224
226
  `)}
225
227
  </CompleteMultipartUpload>
226
- `,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=zn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let f=ey(a.headers);return{etag:jo(c),versionId:f}}var zs="AWS4-HMAC-SHA256";async function t1(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;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=n1(t.headers),n=o1(t.method,t.path,t.headers,r,e),o=await i1(n,t.date,t.region),i=await oy(t.date,t.region,t.secretKey),a=iy(t.accessKey,t.region,t.date),s=Vs(await qo(i,o)).toLowerCase();return`${zs} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function r1(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Hs;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=Uo(t.date),o=n1(t.headers),i=iy(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",zs),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,f=e.split("/").map(D=>encodeURIComponent(D)).join("/"),d=o1(t.method,c,t.headers,o,a),p=await i1(d,t.date,t.region),h=await oy(t.date,t.region,t.secretKey),m=Vs(await qo(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${f}?${u}&X-Amz-Signature=${m}`}function n1(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 Mo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},N5="-._~".split("").map(t=>t.charCodeAt(0));function ny(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Mo.A&&o<=Mo.Z||o>=Mo.a&&o<=Mo.z||o>=Mo[0]&&o<=Mo[9]||N5.includes(o)||o==Mo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function o1(t,e,r,n,o){let i=n.reduce((u,c)=>{let f=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${f}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,f]=u.split("=",2);return ny(decodeURIComponent(c))+"="+ny(decodeURIComponent(f||""))}).sort().join("&"):s="",[t.toUpperCase(),ny(a,!0),s,i.join(`
228
+ `,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=Kn(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let f=ty(a.headers);return{etag:Uo(c),versionId:f}}var Ks="AWS4-HMAC-SHA256";async function o1(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new ya;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=a1(t.headers),n=s1(t.method,t.path,t.headers,r,e),o=await u1(n,t.date,t.region),i=await iy(t.date,t.region,t.secretKey),a=ay(t.accessKey,t.region,t.date),s=zs(await Ho(i,o)).toLowerCase();return`${Ks} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function i1(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new ya;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Vs;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=Mo(t.date),o=a1(t.headers),i=ay(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Ks),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,f=e.split("/").map(D=>encodeURIComponent(D)).join("/"),d=s1(t.method,c,t.headers,o,a),h=await u1(d,t.date,t.region),p=await iy(t.date,t.region,t.secretKey),m=zs(await Ho(p,h)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${f}?${u}&X-Amz-Signature=${m}`}function a1(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 qo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},q5="-._~".split("").map(t=>t.charCodeAt(0));function oy(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=qo.A&&o<=qo.Z||o>=qo.a&&o<=qo.z||o>=qo[0]&&o<=qo[9]||q5.includes(o)||o==qo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function s1(t,e,r,n,o){let i=n.reduce((u,c)=>{let f=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${f}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,f]=u.split("=",2);return oy(decodeURIComponent(c))+"="+oy(decodeURIComponent(f||""))}).sort().join("&"):s="",[t.toUpperCase(),oy(a,!0),s,i.join(`
227
229
  `)+`
228
230
  `,n.join(";").toLowerCase(),o].join(`
229
- `)}async function i1(t,e,r){let n=await gf(t),o=ry(r,e);return[zs,Uo(e),o,n].join(`
230
- `)}async function oy(t,e,r){let n=ty(t),o=await qo("AWS4"+r,n),i=await qo(o,e),a=await qo(i,"s3");return await qo(a,"aws4_request")}function iy(t,e,r){return`${t}/${ry(e,r)}`}async function qo(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 a1(t){if(!t.accessKey)throw new Kn;if(!t.secretKey)throw new ga;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Hs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=iy(t.accessKey,t.region,t.date),n=Uo(t.date),o={"X-Amz-Algorithm":zs,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":zs},{"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,f=await oy(t.date,t.region,t.secretKey),d=Vs(await qo(f,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var L5=["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,U5=5*1024*1024*1024,ay=5*1024*1024*1024*1024,Ks=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 xt("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 qs(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new qs(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!QO(n))throw new xt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new xt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new xt("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 xt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new xt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new xt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!e1(r))throw new mf(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(f=>encodeURIComponent(f)).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 f=await gf(r??new Uint8Array);i.set("x-amz-date",Uo(o)),i.set("x-amz-content-sha256",f),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await t1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await ZO(p):p.status===301?new bn(p.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new bn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Gn(e))throw new Wr(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 bn&&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(!Gn(e))throw new Wr(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 Kn;if(!Gn(r))throw new Wr(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 r1({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 xt("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=zn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let f=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of f)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:jo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((h,m)=>{let g=h.type==="Object"?h.key:h.prefix,D=m.type==="Object"?m.key:m.prefix;return g>D?1:g<D?-1:0});for(let h of d)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Gn(e))throw new Wr(e);let i,a;if(typeof r=="string"){let f=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([f]):a=new ReadableStream({start(d){d.enqueue(f),d.close()}}),i=f.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(f){f.enqueue(r),f.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new xt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new xt(`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 xt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<j5)throw new xt("Part size should be greater than 5MB");if(s>U5)throw new xt("Part size should be less than 6MB");let u=new hf(s),c=new yf({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=ay),e>ay)throw new TypeError(`size should not be more than ${ay}`);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(!Gn(e))throw new Wr(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 L5)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:jo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Gn(r))throw new Wr(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(),f=zn(c).root;if(!f||f.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=f.children.find(h=>h.name==="ETag")?.content??"",p=f.children.find(h=>h.name==="LastModified")?.content;if(p===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:jo(d),lastModified:new Date(p),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof bn&&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(!Gn(e))throw new Wr(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 a1({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})}};function s1(t){try{let e=ye(t);return Vt(An(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,o]=e;return`${r}.${n}.${Number.parseInt(o)+1}`}return"1.0.1"}}async function u1(t,e){let r=s1(t),n=e?` for ${e}`:"",o=await gt({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(ue(o))return null;if(o==="auto")return l.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let i=await qt({message:`Current version is ${t}. Enter new version:`,validate:a=>{if(!a)return"Version is required";if(!a.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return ue(i)?null:i}function c1(t){let e=s1(t);try{let r=ye(t);return[e,Vt(An(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Ho=require("node:fs"),Df=require("node:path");function M5(t,e){return(0,Ho.readFileSync)(t,"utf8").includes(e)}function Gs(t,e){let r=(0,Ho.readdirSync)(t);for(let n of r){let o=(0,Df.join)(t,n),i=(0,Ho.statSync)(o);if(i.isDirectory()){if(Gs(o,e))return!0}else if(i.isFile()&&(0,Df.extname)(o)===".js"&&M5(o,e))return!0}return!1}function bf(t){return(0,Ho.readdirSync)(t).indexOf("index.html")>-1}var DF=require("node:buffer"),bF=require("node:crypto"),ba=require("node:fs"),wF=require("node:os"),Ko=require("node:path"),vF=require("node:process"),Af=require("node:stream/consumers"),CF=require("node:zlib");var EF=de(yF()),_F=de(al());async function r7(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var n7=8192;async function o7(t){let e=bt((0,vF.cwd)()),r=await zr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?ye(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!Vn(n,void 0,void 0,Ts);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function i7(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:EF.isMatch(t,r)}async function a7(t,e,r){let o=(0,ba.statSync)(t).size,i=await(0,Af.buffer)((0,ba.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(i7(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<n7)return{buffer:i,useBrotli:!1};try{let a=await(0,Af.buffer)((0,ba.createReadStream)(t).pipe((0,CF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return l.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function SF(t,e,r,n,o,i,a=!1){let s=_e();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await tO(t);if(o==="v2")for(let c of u)c.hash=a?pf(c.hash,i):ma(c.hash,i);return s.stop("Manifest generated successfully"),await ge(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function s7(t){return(0,wF.platform)()!=="win32"?t:Ko.win32.normalize(t).split(Ko.win32.sep).join(Ko.posix.sep)}function u7(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&l.warn(`File "${t}" contains spaces in its name.`),e}async function xF(t,e,r,n,o,i,a){let s=_e();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await br(),f=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await o7(a);if(p)a.disableBrotli?l.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&l.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${QA} (v5), ${eO} (v6) or ${Ts} (v7) or higher.`);let h=e.filter(v=>v.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(v=>v.file).join(", ")}). Please rename the files.`);let m=0,g=e.length,D=0;try{s.message(`Uploading ${g} files using TUS protocol`);let v=async k=>{let T=(0,Ko.join)(r,k.file),B=s7(k.file),F,L=!1;if(a.disableBrotli)F=await(0,Af.buffer)((0,ba.createReadStream)(T)),L=!1;else{let b=await a7(T,B,a);F=b.buffer,L=b.useBrotli}let A=F;i&&(A=ha(F,i.sessionKey,i.ivSessionKey));let q=B;L&&(q=`${B}.br`,D++);let j=u7(q),Z=(0,bF.createHash)("sha256").update(k.hash).digest("hex"),P;if(i){let b=DF.Buffer.from(i.ivSessionKey).toString("hex");P=`orgs/${o}/apps/${n}/delta/${b}/${Z}_${j}`}else P=`orgs/${o}/apps/${n}/delta/${Z}_${j}`;return!i&&await r7(c,P)?(m++,Promise.resolve({file_name:j,s3_path:P,file_hash:k.hash})):new Promise((b,w)=>{s.message(`Prepare upload partial file: ${B}`),new _F.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:P},headers:{Authorization:t},onError:O=>{let R=O.toString(),$;try{let I=R.match(/response text: (\{.*?\})/);I&&I[1]&&($=JSON.parse(I[1]).moreInfo?.requestId)}catch{}let H=$?` [requestId: ${$}]`:"";l.error(`Failed to upload ${B}: ${R}${H}`),w(O)},onProgress(){let O=(m/g*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,b({file_name:j,s3_path:P,file_hash:k.hash})}}).start()})},E=500,y=[];for(let k=0;k<e.length;k+=E){let T=e.slice(k,k+E),B=Math.floor(k/E)+1,F=Math.ceil(e.length/E);F>1&&s.message(`Processing batch ${B}/${F} (${T.length} files)`);let L=await Promise.all(T.map(A=>v(A)));y.push(...L)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&l.info(`${D} of ${g} files were compressed with brotli and use .br extension`),await ge(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 ge(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},notify:!1}),y}catch(v){let y=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${y} seconds)`),f)throw l.error(`Error uploading partial update: ${v}`),l.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),v;return l.info(`Error uploading partial update: ${v}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function be(t){throw l.error(t),new Error(t)}async function c7(t,e){let r=Ir("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,AF.randomUUID)().split("-")[0]}`;return ia.test(n)||be(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function l7(t){let e=t.apikey||ne();return e||be("Missing API key, you need to provide an API key to upload your bundle"),e}function f7(t,e,r){let n=pe(t,r),o=e.path||r?.webDir;return n||be("Missing argument, you need to provide a appid or be in a capacitor project"),o||be("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Go.existsSync)(o)||be(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function d7(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Gs(e,"notifyAppReady")||be(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
231
- If you are sure your app has this code, you can use the --no-code-check option`),bf(e)||be(`index.html is missing in the root folder of ${e}`))}async function p7(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:f}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!f&&c&&c.version&&c.version.native_packages&&!a){let D=_e();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:v,localDependencies:E}=await ef(t,o,n,r.packageJson,r.nodeModules);if(h=v,p=E,h.find(y=>!No(y)))D.stop(`Bundle NOT compatible with ${n} channel`),l.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,l.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:y}=c.version;(!y||!ia.test(y))&&be("Invalid remote min update version, skipping auto setting compatibility"),u=y,D.stop(`Auto set min-update-version to ${u}`)}catch{be(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(l.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await zg(r.packageJson,r.nodeModules),s&&(u=i,l.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&be("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ia.test(u)||be(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.filter(D=>!!D.native&&D.native!==void 0).map(D=>[D.name,D])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([D,v])=>({name:D,version:v.version})):void 0,minUpdateVersion:u}}async function h7(t,e,r,n=!1,o=!1){let{data:i,error:a}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||a){if(n)return l.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),G("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(o){l.error(`\u274C Version ${r} already exists`);let s=c1(r);l.info("\u{1F4A1} Here are some suggestions:"),s.forEach((f,d)=>{l.info(` ${d+1}. ${f}`)});let u=await gt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${s[0]}`},{value:"suggest2",label:`Use ${s[1]}`},{value:"suggest3",label:`Use ${s[2]}`},{value:"suggest4",label:`Use ${s[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(ue(u)||u==="cancel")&&be("Upload cancelled by user");let c;if(u==="custom"){let f=await u1(r,"upload");f||be("Upload cancelled by user"),c=f}else{let f=Number.parseInt(u.replace("suggest",""))-1;c=s[f]}return l.info(`\u{1F504} Retrying with new version: ${c}`),c}be(`Version ${r} already exists ${M(a)}`)}return!1}async function m7(t,e,r,n,o,i,a,s){let u,c,f="",d=null,p="none",h="",m="",g=e.keyV2,D=e.key===!1,v=_e();v.start(`Zipping bundle from ${t}`),d=await Zl(t),v.message("Calculating checksum");let E=bt((0,Of.cwd)()),y=await zr("@capgo/capacitor-updater",E,e.packageJson),_=!1,S;try{S=y?ye(y):void 0}catch{S=void 0}if(y?S?_=!Vn(S,Ts):(y==="link:@capgo/capacitor-updater"||y==="file:.."||y==="file:../")&&(l.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),_=!0):be("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(g||e.keyDataV2||(0,Go.existsSync)(ir))&&!D||_?f=await cn(d,"sha256"):f=await cn(d,"crc32"),v.stop(`Checksum ${_?"SHA256":"CRC32"}: ${f}`),D)l.info("Encryption ignored");else if((g||(0,Go.existsSync)(ir)||e.keyDataV2)&&!e.oldEncryption){let B=typeof g=="string"?g:ir,F=e.keyDataV2||"";!F&&!(0,Go.existsSync)(B)&&be(`Cannot find private key ${B}`),await ge(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),F||(F=(0,Go.readFileSync)(B).toString());let L=S&&!Vn(S,"5.30.0","6.30.0","7.30.0");l.info(`Encrypting your bundle with ${L?"V3":"V2"}`);let{sessionKey:A,ivSessionKey:q}=df(F),j=ha(d,A,q);f=L?pf(f,F):ma(f,F),u=q,c=A,p="v2",h=F,s&&(m=GO(s),e.verbose&&l.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&l.info(`Your Iv Session key is ${u},
231
+ `)}async function u1(t,e,r){let n=await yf(t),o=ny(r,e);return[Ks,Mo(e),o,n].join(`
232
+ `)}async function iy(t,e,r){let n=ry(t),o=await Ho("AWS4"+r,n),i=await Ho(o,e),a=await Ho(i,"s3");return await Ho(a,"aws4_request")}function ay(t,e,r){return`${t}/${ny(e,r)}`}async function Ho(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 c1(t){if(!t.accessKey)throw new Gn;if(!t.secretKey)throw new ya;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Vs;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=ay(t.accessKey,t.region,t.date),n=Mo(t.date),o={"X-Amz-Algorithm":Ks,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Ks},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[p,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(p)||i.push({[p]: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,f=await iy(t.date,t.region,t.secretKey),d=zs(await Ho(f,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var H5=["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"],V5=5*1024*1024,z5=5*1024*1024*1024,sy=5*1024*1024*1024*1024,Gs=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 xt("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 Hs(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Hs(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!r1(n))throw new xt(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new xt("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new xt("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 xt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new xt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new xt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!n1(r))throw new gf(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(f=>encodeURIComponent(f)).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 f=await yf(r??new Uint8Array);i.set("x-amz-date",Mo(o)),i.set("x-amz-content-sha256",f),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await o1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,h=await fetch(d,{method:e,headers:i,body:r});if(h.status!==c)throw h.status>=400?await t1(h):h.status===301?new bn(h.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 bn(h.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${h.status} ${h.statusText}).`);return n.returnBody||await h.body?.getReader().read(),h}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!Wn(e))throw new Wr(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 bn&&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(!Wn(e))throw new Wr(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 Gn;if(!Wn(r))throw new Wr(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 i1({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 xt("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=Kn(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let f=c.children.filter(p=>p.name==="CommonPrefixes").flatMap(p=>p.children),d=[];for(let p of f)d.push({type:"CommonPrefix",prefix:p.content??""}),i++;for(let p of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:p.children.find(m=>m.name==="Key")?.content??"",etag:Uo(p.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(p.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(p.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((p,m)=>{let g=p.type==="Object"?p.key:p.prefix,D=m.type==="Object"?m.key:m.prefix;return g>D?1:g<D?-1:0});for(let p of d)yield p;if(c.children.find(p=>p.name==="IsTruncated")?.content==="true"){let p=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!p)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=p}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!Wn(e))throw new Wr(e);let i,a;if(typeof r=="string"){let f=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([f]):a=new ReadableStream({start(d){d.enqueue(f),d.close()}}),i=f.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(f){f.enqueue(r),f.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new xt("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new xt(`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 xt(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<V5)throw new xt("Part size should be greater than 5MB");if(s>z5)throw new xt("Part size should be less than 6MB");let u=new mf(s),c=new Df({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=sy),e>sy)throw new TypeError(`size should not be more than ${sy}`);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(!Wn(e))throw new Wr(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 H5)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:Uo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!Wn(r))throw new Wr(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(),f=Kn(c).root;if(!f||f.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=f.children.find(p=>p.name==="ETag")?.content??"",h=f.children.find(p=>p.name==="LastModified")?.content;if(h===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:Uo(d),lastModified:new Date(h),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 bn&&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(!Wn(e))throw new Wr(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 c1({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})}};function l1(t){try{let e=De(t);return Vt(An(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,o]=e;return`${r}.${n}.${Number.parseInt(o)+1}`}return"1.0.1"}}async function f1(t,e){let r=l1(t),n=e?` for ${e}`:"",o=await mt({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(le(o))return null;if(o==="auto")return l.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let i=await qt({message:`Current version is ${t}. Enter new version:`,validate:a=>{if(!a)return"Version is required";if(!a.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return le(i)?null:i}function d1(t){let e=l1(t);try{let r=De(t);return[e,Vt(An(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Vo=require("node:fs"),bf=require("node:path");function K5(t,e){return(0,Vo.readFileSync)(t,"utf8").includes(e)}function Ws(t,e){let r=(0,Vo.readdirSync)(t);for(let n of r){let o=(0,bf.join)(t,n),i=(0,Vo.statSync)(o);if(i.isDirectory()){if(Ws(o,e))return!0}else if(i.isFile()&&(0,bf.extname)(o)===".js"&&K5(o,e))return!0}return!1}function wf(t){return(0,Vo.readdirSync)(t).indexOf("index.html")>-1}var vF=require("node:buffer"),CF=require("node:crypto"),wa=require("node:fs"),EF=require("node:os"),Go=require("node:path"),_F=require("node:process"),Of=require("node:stream/consumers"),SF=require("node:zlib");var xF=pe(wF()),AF=pe(sl());async function s7(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var u7=8192;async function c7(t){let e=bt((0,_F.cwd)()),r=await zr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?De(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!Vn(n,void 0,void 0,Rs);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function l7(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:xF.isMatch(t,r)}async function f7(t,e,r){let o=(0,wa.statSync)(t).size,i=await(0,Of.buffer)((0,wa.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(l7(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<u7)return{buffer:i,useBrotli:!1};try{let a=await(0,Of.buffer)((0,wa.createReadStream)(t).pipe((0,SF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return l.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function OF(t,e,r,n,o,i,a=!1){let s=_e();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await nO(t);if(o==="v2")for(let c of u)c.hash=a?hf(c.hash,i):ga(c.hash,i);return s.stop("Manifest generated successfully"),await ye(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function d7(t){return(0,EF.platform)()!=="win32"?t:Go.win32.normalize(t).split(Go.win32.sep).join(Go.posix.sep)}function p7(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&l.warn(`File "${t}" contains spaces in its name.`),e}async function FF(t,e,r,n,o,i,a){let s=_e();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await br(),f=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:h}=await c7(a);if(h)a.disableBrotli?l.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&l.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${tO} (v5), ${rO} (v6) or ${Rs} (v7) or higher.`);let p=e.filter(v=>v.file.includes(" "));if(p.length>0)throw new Error(`Files with spaces in their names (${p.map(v=>v.file).join(", ")}). Please rename the files.`);let m=0,g=e.length,D=0;try{s.message(`Uploading ${g} files using TUS protocol`);let v=async P=>{let T=(0,Go.join)(r,P.file),B=d7(P.file),F,L=!1;if(a.disableBrotli)F=await(0,Of.buffer)((0,wa.createReadStream)(T)),L=!1;else{let b=await f7(T,B,a);F=b.buffer,L=b.useBrotli}let A=F;i&&(A=ma(F,i.sessionKey,i.ivSessionKey));let q=B;L&&(q=`${B}.br`,D++);let j=p7(q),Z=(0,CF.createHash)("sha256").update(P.hash).digest("hex"),k;if(i){let b=vF.Buffer.from(i.ivSessionKey).toString("hex");k=`orgs/${o}/apps/${n}/delta/${b}/${Z}_${j}`}else k=`orgs/${o}/apps/${n}/delta/${Z}_${j}`;return!i&&await s7(c,k)?(m++,Promise.resolve({file_name:j,s3_path:k,file_hash:P.hash})):new Promise((b,w)=>{s.message(`Prepare upload partial file: ${B}`),new AF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),$;try{let I=R.match(/response text: (\{.*?\})/);I&&I[1]&&($=JSON.parse(I[1]).moreInfo?.requestId)}catch{}let H=$?` [requestId: ${$}]`:"";l.error(`Failed to upload ${B}: ${R}${H}`),w(O)},onProgress(){let O=(m/g*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,b({file_name:j,s3_path:k,file_hash:P.hash})}}).start()})},_=500,y=[];for(let P=0;P<e.length;P+=_){let T=e.slice(P,P+_),B=Math.floor(P/_)+1,F=Math.ceil(e.length/_);F>1&&s.message(`Processing batch ${B}/${F} (${T.length} files)`);let L=await Promise.all(T.map(A=>v(A)));y.push(...L)}let S=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${S} seconds)`),D>0&&l.info(`${D} of ${g} files were compressed with brotli and use .br extension`),await ye(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 ye(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:S},notify:!1}),y}catch(v){let y=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${y} seconds)`),f)throw l.error(`Error uploading partial update: ${v}`),l.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),v;return l.info(`Error uploading partial update: ${v}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function be(t){throw l.error(t),new Error(t)}function h7(t){let e=new qe;e.headers=["Package","Local","Remote","Status","Details"],e.theme=qe.roundTheme,e.rows=[];for(let r of t){let{name:n,localVersion:o,remoteVersion:i}=r,a=Lo(r),s=a.compatible?"\u2705":"\u274C";e.rows.push([n,o||"-",i||"-",s,a.message])}l.info(e.toString())}async function m7(t,e){let r=Ir("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,kF.randomUUID)().split("-")[0]}`;return aa.test(n)||be(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function g7(t){let e=t.apikey||oe();return e||be("Missing API key, you need to provide an API key to upload your bundle"),e}function y7(t,e,r){let n=he(t,r),o=e.path||r?.webDir;return n||be("Missing argument, you need to provide a appid or be in a capacitor project"),o||be("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Wo.existsSync)(o)||be(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function D7(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Ws(e,"notifyAppReady")||be(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
233
+ If you are sure your app has this code, you can use the --no-code-check option`),wf(e)||be(`index.html is missing in the root folder of ${e}`))}async function b7(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:f}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",o).single(),d=!!c&&c.disable_auto_update==="version_number",h,p;if(!f&&c&&c.version&&c.version.native_packages&&!a){let D=_e();D.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:v,localDependencies:_}=await tf(t,o,n,r.packageJson,r.nodeModules);if(p=v,h=_,p.filter(E=>!zn(E)).length>0)D.stop(`Bundle NOT compatible with ${n} channel`),l.warn(""),h7(p),l.warn(""),l.warn("An app store update may be required for these changes to take effect."),s&&(u=i,l.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:E}=c.version;(!E||!aa.test(E))&&be("Invalid remote min update version, skipping auto setting compatibility"),u=E,D.stop(`Auto set min-update-version to ${u}`)}catch{be(`Cannot auto set compatibility, invalid data ${c}`)}else D.stop(`Bundle compatible with ${n} channel`)}else a||(l.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),h=await Kg(r.packageJson,r.nodeModules),s&&(u=i,l.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&be("You need to provide a min-update-version to upload a bundle to this channel"),u&&(aa.test(u)||be(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=h?new Map(h.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,v])=>({name:D,version:v.version,...v.ios_checksum&&{ios_checksum:v.ios_checksum},...v.android_checksum&&{android_checksum:v.android_checksum}})):void 0,minUpdateVersion:u}}async function w7(t,e,r,n=!1,o=!1){let{data:i,error:a}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||a){if(n)return l.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),G("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(o){l.error(`\u274C Version ${r} already exists`);let s=d1(r);l.info("\u{1F4A1} Here are some suggestions:"),s.forEach((f,d)=>{l.info(` ${d+1}. ${f}`)});let u=await mt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${s[0]}`},{value:"suggest2",label:`Use ${s[1]}`},{value:"suggest3",label:`Use ${s[2]}`},{value:"suggest4",label:`Use ${s[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(le(u)||u==="cancel")&&be("Upload cancelled by user");let c;if(u==="custom"){let f=await f1(r,"upload");f||be("Upload cancelled by user"),c=f}else{let f=Number.parseInt(u.replace("suggest",""))-1;c=s[f]}return l.info(`\u{1F504} Retrying with new version: ${c}`),c}be(`Version ${r} already exists ${M(a)}`)}return!1}async function v7(t,e,r,n,o,i,a,s){let u,c,f="",d=null,h="none",p="",m="",g=e.keyV2,D=e.key===!1,v=_e();v.start(`Zipping bundle from ${t}`),d=await Ql(t),v.message("Calculating checksum");let _=bt((0,Ff.cwd)()),y=await zr("@capgo/capacitor-updater",_,e.packageJson),E=!1,S;try{S=y?De(y):void 0}catch{S=void 0}if(y?S?E=!Vn(S,Rs):(y==="link:@capgo/capacitor-updater"||y==="file:.."||y==="file:../")&&(l.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):be("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(g||e.keyDataV2||(0,Wo.existsSync)(ir))&&!D||E?f=await cn(d,"sha256"):f=await cn(d,"crc32"),v.stop(`Checksum ${E?"SHA256":"CRC32"}: ${f}`),D)l.info("Encryption ignored");else if((g||(0,Wo.existsSync)(ir)||e.keyDataV2)&&!e.oldEncryption){let B=typeof g=="string"?g:ir,F=e.keyDataV2||"";!F&&!(0,Wo.existsSync)(B)&&be(`Cannot find private key ${B}`),await ye(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),F||(F=(0,Wo.readFileSync)(B).toString());let L=S&&!Vn(S,"5.30.0","6.30.0","7.30.0");l.info(`Encrypting your bundle with ${L?"V3":"V2"}`);let{sessionKey:A,ivSessionKey:q}=pf(F),j=ma(d,A,q);f=L?hf(f,F):ga(f,F),u=q,c=A,h="v2",p=F,s&&(m=JO(s),e.verbose&&l.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&l.info(`Your Iv Session key is ${u},
232
234
  keep it safe, you will need it to decrypt your bundle.
233
235
  It will be also visible in your dashboard
234
- `),d=j}let k=Math.floor((d?.byteLength??0)/1024/1024),T=Math.floor(i/1024/1024);return d?.byteLength>i?be(`The bundle size is ${k} Mb, this is greater than the maximum upload length ${T} Mb, please reduce the size of your bundle`):d?.byteLength>a?(l.warn(`WARNING !!
235
- The bundle size is ${k} Mb, this may take a while to download for users
236
+ `),d=j}let P=Math.floor((d?.byteLength??0)/1024/1024),T=Math.floor(i/1024/1024);return d?.byteLength>i?be(`The bundle size is ${P} Mb, this is greater than the maximum upload length ${T} Mb, please reduce the size of your bundle`):d?.byteLength>a?(l.warn(`WARNING !!
237
+ The bundle size is ${P} Mb, this may take a while to download for users
236
238
  `),l.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
237
- `),e.verbose&&(l.info("[Verbose] Bundle size details:"),l.info(` - Actual size: ${k} MB (${d?.byteLength} bytes)`),l.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),l.info(` - Maximum allowed: ${T} MB`),l.info("[Verbose] Sending 'App Too Large' event to analytics...")),await ge(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&l.info("[Verbose] Event sent successfully")):e.verbose&&l.info(`[Verbose] Bundle size OK: ${k} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&l.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:d,ivSessionKey:u,sessionKey:c,checksum:f,encryptionMethod:p,finalKeyData:h,keyId:m}}async function g7(t,e,r,n,o,i,a,s){let u=_e();u.start("Uploading Bundle");let c=performance.now(),f=!1;if(a.verbose&&(l.info("[Verbose] uploadBundleToCapgoCloud called:"),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info(` - App ID: ${r}`),l.info(` - Bundle version: ${n}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
238
- Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&l.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await br();if(a.verbose&&l.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?l.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):l.info("Uploading bundle with TUS protocol"),a.verbose&&(l.info("[Verbose] Starting TUS resumable upload..."),l.info(` - Host: ${h.hostWeb}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await rO(t,i,o,r,n,u,h,s),f=!0,a.verbose&&l.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(g)return l.error(`Cannot finish TUS upload ${M(g)}`),a.verbose&&l.info(`[Verbose] Database update failed: ${M(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&l.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&l.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await XA(e,r,n);if(!m)return l.error("Cannot get upload url"),a.verbose&&l.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(l.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),l.info(` - Timeout: ${a.timeout||jg}ms`),l.info(" - Retry attempts: 5"),l.info(" - Content-Type: application/zip"));let g=new AbortController,D=setTimeout(()=>g.abort(),a.timeout||jg);try{let v=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`)}finally{clearTimeout(D)}a.verbose&&l.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),a.verbose&&(l.info(`[Verbose] Upload failed after ${g} seconds`),l.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+)/),v=D?D[1]:"unknown";l.error(`Upload failed with status ${v}: ${h.message}`)}catch{l.error(`Upload failed: ${h.message}`)}else a.verbose&&l.info(`[Verbose] Non-HTTP error: ${M(h)}`),a.tus?l.error(`Cannot upload bundle please contact support if the issue persists ${M(h)}`):l.error(`Cannot upload bundle ( try again with --tus option) ${M(h)}`);throw a.verbose&&l.info("[Verbose] Cleaning up failed version from database..."),await nO(e,r,n),a.verbose&&l.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(l.info("[Verbose] Upload successful:"),l.info(` - Upload time: ${p} seconds`),l.info(` - Upload method: ${f?"TUS (resumable)":"Standard HTTP PUT"}`),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info("[Verbose] Sending performance event...")),await ge(t,{channel:"performance",event:f?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&l.info("[Verbose] Performance event sent successfully")}async function y7(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){l.error(`Cannot delete linked bundle on upload ${M(o)}`);return}if(n.length===0){l.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){l.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){l.error(`Cannot delete linked bundle on upload ${M(a)}`);return}l.info("Linked bundle deleted")}async function D7(t,e,r,n,o,i,a,s,u,c){let{data:f}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();f||be("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await Ql(t,{name:o,app_id:s,created_by:i,version:f,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&be(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${M(p)}`);let m=`${u.hostWeb}/app/${s}/channel/${h.id}`;h?.public?l.info("Your update is now available in your public channel \u{1F389}"):h?.id&&l.info(`Link device to this bundle to try it: ${m}`),r&&l.info(`Bundle url: ${m}`)}else l.warn("The upload key is not allowed to set the version in the channel")}async function b7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(l.warn("Cannot find default upload channel"),l.info(`You can set it here: ${r}/app/${t}/info`),null):o.default_upload_channel}async function Pf(t,e,r=!1){r||ee(`Uploading with CLI version ${dr.version}`);let n,o=nt();await Ee();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:f,s3SSL:d}=e;e.verbose&&(l.info("[Verbose] Starting upload process with options:"),l.info(` - API key: ${e.apikey?"provided":"from saved key"}`),l.info(` - Path: ${e.path||"from capacitor config"}`),l.info(` - Channel: ${e.channel||"from default upload channel"}`),l.info(` - Bundle: ${e.bundle||"auto-detected"}`),l.info(` - External: ${e.external||"false"}`),l.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),l.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),l.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=l7(e);e.verbose&&l.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&l.info("[Verbose] Capacitor config loaded successfully");let m=await qA();e.verbose&&(l.info("[Verbose] Remote file config retrieved:"),l.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),l.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),l.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),l.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),l.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),l.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:D}=f7(t,e,h.config);e.verbose&&l.info(`[Verbose] App ID: ${g}, Build path: ${D}`);let v=await c7(h.config,e);e.verbose&&l.info(`[Verbose] Bundle version: ${v}`);let E=e.external?"external":"r2-direct",y="none";e.autoSetBundle&&(await Is({version:v}),e.verbose&&l.info("[Verbose] Auto-set bundle version in capacitor.config.json")),d7(e,D),e.verbose&&l.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),l.info(`Upload ${g}@${v} started from path "${D}" to Capgo cloud`);let _=await br();e.verbose&&l.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(l.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&l.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await re(p,e.supaHost,e.supaAnon);e.verbose&&l.info("[Verbose] Supabase client created successfully");let k=await ae(S,p,["write","all","upload"]);e.verbose&&l.info(`[Verbose] User verified successfully, user_id: ${k}`);let T=e.channel||await b7(g,S,_.hostWeb)||"production";e.verbose&&l.info(`[Verbose] Target channel: ${T}`);let B=await Et(S,g);e.verbose&&l.info(`[Verbose] Organization ID: ${B}`),await KA(S,B,dr.version),e.verbose&&l.info("[Verbose] Remote CLI messages checked"),await WA(S,B,p,g,!0),e.verbose&&l.info("[Verbose] Plan validation passed"),e.verbose&&l.info("[Verbose] Trial check completed"),e.verbose&&l.info(`[Verbose] Checking compatibility with channel ${T}...`);let{nativePackages:F,minUpdateVersion:L}=await p7(S,o,e,T,g,v);e.verbose&&(l.info("[Verbose] Compatibility check completed:"),l.info(` - Native packages: ${F?F.length:0}`),l.info(` - Min update version: ${L||"none"}`)),e.verbose&&l.info(`[Verbose] Checking if version ${v} already exists...`);let A=!r,q=await h7(S,g,v,e.versionExistsOk,A);if(e.verbose&&l.info(`[Verbose] Version exists check: ${q?typeof q=="string"?`retry with ${q}`:"yes (skipping)":"no (continuing)"}`),q===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:v,checksum:null,encryptionMethod:y,storageProvider:E};if(typeof q=="string")return l.info(`Retrying upload with new version: ${q}`),Pf(t,{...e,bundle:q},r);e.external&&!e.external.startsWith("https://")&&be(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(l.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),l.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:v,app_id:g,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:L,native_packages:F,owner_org:B,user_id:k,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0,cli_version:dr.version},Z=null,P="";if(e.external)e.verbose&&l.info(`[Verbose] Using external URL: ${e.external}`),await ge(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(l.info("[Verbose] External bundle configured:"),l.info(` - URL: ${e.external}`),l.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),l.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&l.info(`[Verbose] Preparing bundle file from path: ${D}`);let N=h.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:X,ivSessionKey:U,checksum:oe,sessionKey:Zt,encryptionMethod:K,finalKeyData:Se,keyId:z}=await m7(D,e,p,B,g,m.maxUploadLength,m.alertUploadSize,N);j.session_key=U,j.checksum=oe,j.key_id=z||void 0,n=Zt,Z=X,y=K,P=Se,e.verbose&&(l.info("[Verbose] Bundle prepared:"),l.info(` - Size: ${Math.floor((X?.byteLength??0)/1024)} KB`),l.info(` - Checksum: ${oe}`),l.info(` - Encryption: ${K}`),l.info(` - IV Session Key: ${U?"present":"none"}`),l.info(` - Key ID: ${z||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&l.info("[Verbose] Checking for duplicate checksum..."),await aO(S,g,T,oe),e.verbose&&l.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&l.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&l.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&l.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&y==="v1"&&be("You cannot encrypt the partial update if you are not using the v2 encryption method");let b="5.30.0",w="6.30.0",C="7.30.0",O=!1;if(e.delta&&y==="v2"&&!e.encryptPartial){let N=bt((0,Of.cwd)()),X=await zr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=X?ye(X):void 0}catch{U=void 0}X&&U&&TD(U,ye("6.14.4"))&&(l.info(`Auto-enabling partial update encryption for updater version ${U} (> 6.14.4)`),e.verbose&&l.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||y==="v2")){let N=bt((0,Of.cwd)()),X=await zr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=X?ye(X):void 0}catch{U=void 0}X&&U&&(O=!Vn(U,b,w,C),e.verbose&&O&&l.info(`[Verbose] Using hex checksum format for updater version ${U}`))}e.verbose&&e.delta&&l.info("[Verbose] Preparing delta/partial update manifest...");let R=e.delta?await SF(D,p,B,g,e.encryptPartial?y:"none",P,O):[];e.verbose&&e.delta&&l.info(`[Verbose] Delta manifest prepared with ${R.length} files`),e.verbose&&l.info("[Verbose] Creating version record in database...");let{error:$}=await Vg(S,j);if($&&be(`Cannot add bundle ${M($)}`),e.verbose&&l.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(l.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&&l.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),Z&&(u||c||i||a||s||f||d)){(!u||!c||!i||!a||!s||!f)&&be("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),l.info("Uploading to S3"),e.verbose&&(l.info("[Verbose] S3 configuration:"),l.info(` - Endpoint: ${c}`),l.info(` - Region: ${i}`),l.info(` - Bucket: ${u}`),l.info(` - Port: ${f}`),l.info(` - SSL: ${d?"enabled":"disabled"}`));let N=d?`https://${c}`:`http://${c}`,X=new Ks({endPoint:c,region:i,port:f,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),U=`${g}-${v}`,oe=encodeURIComponent(U);e.verbose&&l.info(`[Verbose] Uploading to S3 as: ${U}`),await X.putObject(U,Uint8Array.from(Z)),j.external_url=`${N}/${oe}`,j.storage_provider="external",e.verbose&&l.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(Z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&l.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await g7(p,S,g,v,B,Z,e,e.tusChunkSize)):e.verbose&&l.info("[Verbose] Skipping full bundle upload (delta-only mode)");let N=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&l.info("[Verbose] Dry upload mode: skipping delta upload"));let U=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(l.info("[Verbose] Starting delta/partial file upload..."),l.info(` - Manifest entries: ${R.length}`),l.info(` - Encryption: ${U?"enabled":"disabled"}`)),N=e.delta?await xF(p,R,D,g,B,U,e):null,e.verbose&&N&&l.info(`[Verbose] Delta upload complete with ${N.length} files`)}catch(U){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw U;l.info(`Failed to upload partial files to capgo cloud. Error: ${M(U)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&l.info(`[Verbose] Delta upload error details: ${M(U)}`)}j.storage_provider="r2",j.manifest=N,e.verbose&&l.info("[Verbose] Updating version record with storage provider and manifest...");let{error:X}=await Vg(S,j);X&&be(`Cannot update bundle ${M(X)}`),e.verbose&&l.info("[Verbose] Version record updated successfully")}e.verbose&&l.info("[Verbose] Checking app permissions...");let H=await qe(S,p,g,2);e.verbose&&(l.info("[Verbose] Permissions:"),l.info(` - Upload: ${aa(H,2)?"yes":"no"}`),l.info(` - Write: ${aa(H,3)?"yes":"no"}`),l.info(` - Admin: ${aa(H,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&aa(H,3)?(e.verbose&&l.info(`[Verbose] Deleting linked bundle in channel ${T}...`),await y7(S,g,T)):e.deleteLinkedBundleOnUpload&&l.warn("Cannot delete linked bundle on upload as a upload organization member"),aa(H,3)?(e.verbose&&l.info(`[Verbose] Setting bundle ${v} to channel ${T}...`),await D7(S,p,!!e.bundleUrl,v,T,k,B,g,_,e.selfAssign),e.verbose&&l.info("[Verbose] Channel updated successfully")):l.warn("Cannot set channel as a upload organization member"),e.verbose&&l.info("[Verbose] Sending upload event..."),await ge(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":g},notify:!1},e.verbose);let I={success:!0,bundle:v,checksum:j.checksum??null,encryptionMethod:y,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(l.info("[Verbose] Upload completed successfully:"),l.info(` - Bundle: ${I.bundle}`),l.info(` - Checksum: ${I.checksum}`),l.info(` - Encryption: ${I.encryptionMethod}`),l.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&G("Time to share your update to the world \u{1F30D}"),I}function w7(t){t.ivSessionKey&&!t.external&&be("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&be("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&&be("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&be("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&be("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&be("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&be("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&be("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)&&be("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&be("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&be("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function Ff(t,e){try{w7(e),await Pf(t,e)}catch(r){let n=r instanceof Error?r.message:String(r),o=M(r);e.verbose?l.error(`uploadBundle failed:${o}`):l.error(`uploadBundle failed: ${n}`);let i=n.includes("Cannot upload the same bundle content");if(!e.versionExistsOk)try{if(i){let a=await gt({message:"Would you like to retry the upload?",options:[{value:"ignore",label:"Retry with --ignore-checksum-check (force upload same content)"},{value:"cancel",label:"Cancel upload"}]});if(ue(a)||a==="cancel")throw r instanceof Error?r:new Error(String(r));if(a==="ignore")return l.info("\u{1F504} Retrying upload with --ignore-checksum-check..."),Ff(t,{...e,ignoreChecksumCheck:!0})}else{let a=await ce({message:"Would you like to retry the upload?"});if(ue(a))throw r instanceof Error?r:new Error(String(r));if(a)return l.info("\u{1F504} Retrying upload..."),Ff(t,e)}}catch{throw r instanceof Error?r:new Error(String(r))}throw r instanceof Error?r:new Error(String(r))}}var OF=require("node:crypto"),kf=require("node:fs"),FF=require("node:process");var v7=20;function C7(t){console.log(JSON.stringify(t,null,2))}function Zs(t){console.error(M(t))}async function E7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await Ee();let s=await te(),u=pe(t,s?.config),c=(0,OF.randomUUID)().split("-")[0],f=Ir("",e.packageJson);if(o=o||f||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!ia.test(o)){let k=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Zs({error:"invalid_semver"}):l.error(k)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let k="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Zs({error:"missing_argument"}):l.error(k)),new Error(k)}if(a&&l.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Gs(i,"notifyAppReady"))throw r||(n?Zs({error:"notifyAppReady_not_in_source_code"}):l.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(!bf(i))throw r||(n?Zs({error:"index_html_not_found"}):l.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Zl(i);a&&l.info(`Zipped ${p.byteLength} bytes`);let h=a?_e():null;h&&h.start("Calculating checksum");let m=bt((0,FF.cwd)()),g=await zr("@capgo/capacitor-updater",m,e.packageJson);if(!g){let k="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||l.warn(k),new Error(k)}let D=!1,v;try{v=g?ye(g):void 0}catch{v=void 0}v?D=!Vn(v,void 0,void 0,"7.0.0"):g==="link:@capgo/capacitor-updater"&&(r||l.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let E=await cn(p,e.keyV2||(0,kf.existsSync)(ir)||D?"sha256":"crc32");h&&h.stop(`Checksum ${D?"SHA256":"CRC32"}: ${E}`);let y=Math.floor(p.byteLength/1024/1024);y>v7&&a&&(l.warn(`WARNING !!
239
+ `),e.verbose&&(l.info("[Verbose] Bundle size details:"),l.info(` - Actual size: ${P} MB (${d?.byteLength} bytes)`),l.info(` - Alert threshold: ${Math.floor(a/1024/1024)} MB`),l.info(` - Maximum allowed: ${T} MB`),l.info("[Verbose] Sending 'App Too Large' event to analytics...")),await ye(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),e.verbose&&l.info("[Verbose] Event sent successfully")):e.verbose&&l.info(`[Verbose] Bundle size OK: ${P} MB (under ${Math.floor(a/1024/1024)} MB alert threshold)`),e.verbose&&l.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:d,ivSessionKey:u,sessionKey:c,checksum:f,encryptionMethod:h,finalKeyData:p,keyId:m}}async function C7(t,e,r,n,o,i,a,s){let u=_e();u.start("Uploading Bundle");let c=performance.now(),f=!1;if(a.verbose&&(l.info("[Verbose] uploadBundleToCapgoCloud called:"),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info(` - App ID: ${r}`),l.info(` - Bundle version: ${n}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),a.dryUpload){u.stop(`Dry run, bundle not uploaded
240
+ Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&l.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let p=await br();if(a.verbose&&l.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?l.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):l.info("Uploading bundle with TUS protocol"),a.verbose&&(l.info("[Verbose] Starting TUS resumable upload..."),l.info(` - Host: ${p.hostWeb}`),l.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await oO(t,i,o,r,n,u,p,s),f=!0,a.verbose&&l.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(g)return l.error(`Cannot finish TUS upload ${M(g)}`),a.verbose&&l.info(`[Verbose] Database update failed: ${M(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&l.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&l.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await QA(e,r,n);if(!m)return l.error("Cannot get upload url"),a.verbose&&l.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(l.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),l.info(` - Timeout: ${a.timeout||Ug}ms`),l.info(" - Retry attempts: 5"),l.info(" - Content-Type: application/zip"));let g=new AbortController,D=setTimeout(()=>g.abort(),a.timeout||Ug);try{let v=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`)}finally{clearTimeout(D)}a.verbose&&l.info("[Verbose] HTTP PUT upload completed successfully")}}catch(p){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),a.verbose&&(l.info(`[Verbose] Upload failed after ${g} seconds`),l.info(`[Verbose] Error type: ${p instanceof Error?"Error":typeof p}`)),p instanceof Error&&p.message.includes("HTTP error"))try{let D=p.message.match(/status: (\d+)/),v=D?D[1]:"unknown";l.error(`Upload failed with status ${v}: ${p.message}`)}catch{l.error(`Upload failed: ${p.message}`)}else a.verbose&&l.info(`[Verbose] Non-HTTP error: ${M(p)}`),a.tus?l.error(`Cannot upload bundle please contact support if the issue persists ${M(p)}`):l.error(`Cannot upload bundle ( try again with --tus option) ${M(p)}`);throw a.verbose&&l.info("[Verbose] Cleaning up failed version from database..."),await iO(e,r,n),a.verbose&&l.info("[Verbose] Failed version cleaned up"),p instanceof Error?p:new Error(String(p))}let h=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${h} seconds)`),a.verbose&&(l.info("[Verbose] Upload successful:"),l.info(` - Upload time: ${h} seconds`),l.info(` - Upload method: ${f?"TUS (resumable)":"Standard HTTP PUT"}`),l.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),l.info("[Verbose] Sending performance event...")),await ye(t,{channel:"performance",event:f?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:h},notify:!1},a.verbose),a.verbose&&l.info("[Verbose] Performance event sent successfully")}async function E7(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){l.error(`Cannot delete linked bundle on upload ${M(o)}`);return}if(n.length===0){l.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){l.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){l.error(`Cannot delete linked bundle on upload ${M(a)}`);return}l.info("Linked bundle deleted")}async function _7(t,e,r,n,o,i,a,s,u,c){let{data:f}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();f||be("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:h,data:p}=await ef(t,{name:o,app_id:s,created_by:i,version:f,owner_org:a,...c?{allow_device_self_set:!0}:{}});h&&be(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${M(h)}`);let m=`${u.hostWeb}/app/${s}/channel/${p.id}`;p?.public?l.info("Your update is now available in your public channel \u{1F389}"):p?.id&&l.info(`Link device to this bundle to try it: ${m}`),r&&l.info(`Bundle url: ${m}`)}else l.warn("The upload key is not allowed to set the version in the channel")}async function S7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(l.warn("Cannot find default upload channel"),l.info(`You can set it here: ${r}/app/${t}/info`),null):o.default_upload_channel}async function Pf(t,e,r=!1){r||ee(`Uploading with CLI version ${dr.version}`);let n,o=Dt();await Ee();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:f,s3SSL:d}=e;e.verbose&&(l.info("[Verbose] Starting upload process with options:"),l.info(` - API key: ${e.apikey?"provided":"from saved key"}`),l.info(` - Path: ${e.path||"from capacitor config"}`),l.info(` - Channel: ${e.channel||"from default upload channel"}`),l.info(` - Bundle: ${e.bundle||"auto-detected"}`),l.info(` - External: ${e.external||"false"}`),l.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),l.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),l.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let h=g7(e);e.verbose&&l.info("[Verbose] API key retrieved successfully");let p=await te();e.verbose&&l.info("[Verbose] Capacitor config loaded successfully");let m=await VA();e.verbose&&(l.info("[Verbose] Remote file config retrieved:"),l.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),l.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),l.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),l.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),l.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),l.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:g,path:D}=y7(t,e,p.config);e.verbose&&l.info(`[Verbose] App ID: ${g}, Build path: ${D}`);let v=await m7(p.config,e);e.verbose&&l.info(`[Verbose] Bundle version: ${v}`);let _=e.external?"external":"r2-direct",y="none";e.autoSetBundle&&(await Ts({version:v}),e.verbose&&l.info("[Verbose] Auto-set bundle version in capacitor.config.json")),D7(e,D),e.verbose&&l.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),l.info(`Upload ${g}@${v} started from path "${D}" to Capgo cloud`);let E=await br();e.verbose&&l.info(`[Verbose] Local config loaded: host=${E.hostWeb}`),e.supaHost&&e.supaAnon&&(l.info("Using custom supabase instance from provided options"),E.supaHost=e.supaHost,E.supaKey=e.supaAnon,e.verbose&&l.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let S=await ne(h,e.supaHost,e.supaAnon);e.verbose&&l.info("[Verbose] Supabase client created successfully");let P=await ue(S,h,["write","all","upload"]);e.verbose&&l.info(`[Verbose] User verified successfully, user_id: ${P}`);let T=e.channel||await S7(g,S,E.hostWeb)||"production";e.verbose&&l.info(`[Verbose] Target channel: ${T}`);let B=await Et(S,g);e.verbose&&l.info(`[Verbose] Organization ID: ${B}`),await WA(S,B,dr.version),e.verbose&&l.info("[Verbose] Remote CLI messages checked"),await JA(S,B,h,g,!0),e.verbose&&l.info("[Verbose] Plan validation passed"),e.verbose&&l.info("[Verbose] Trial check completed"),e.verbose&&l.info(`[Verbose] Checking compatibility with channel ${T}...`);let{nativePackages:F,minUpdateVersion:L}=await b7(S,o,e,T,g,v);e.verbose&&(l.info("[Verbose] Compatibility check completed:"),l.info(` - Native packages: ${F?F.length:0}`),l.info(` - Min update version: ${L||"none"}`)),e.verbose&&l.info(`[Verbose] Checking if version ${v} already exists...`);let A=!r,q=await w7(S,g,v,e.versionExistsOk,A);if(e.verbose&&l.info(`[Verbose] Version exists check: ${q?typeof q=="string"?`retry with ${q}`:"yes (skipping)":"no (continuing)"}`),q===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:v,checksum:null,encryptionMethod:y,storageProvider:_};if(typeof q=="string")return l.info(`Retrying upload with new version: ${q}`),Pf(t,{...e,bundle:q},r);e.external&&!e.external.startsWith("https://")&&be(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(l.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),l.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:v,app_id:g,session_key:void 0,external_url:e.external,storage_provider:_,min_update_version:L,native_packages:F,owner_org:B,user_id:P,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0,cli_version:dr.version},Z=null,k="";if(e.external)e.verbose&&l.info(`[Verbose] Using external URL: ${e.external}`),await ye(h,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(l.info("[Verbose] External bundle configured:"),l.info(` - URL: ${e.external}`),l.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),l.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&l.info(`[Verbose] Preparing bundle file from path: ${D}`);let N=p.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:X,ivSessionKey:U,checksum:ie,sessionKey:Zt,encryptionMethod:K,finalKeyData:Se,keyId:z}=await v7(D,e,h,B,g,m.maxUploadLength,m.alertUploadSize,N);j.session_key=U,j.checksum=ie,j.key_id=z||void 0,n=Zt,Z=X,y=K,k=Se,e.verbose&&(l.info("[Verbose] Bundle prepared:"),l.info(` - Size: ${Math.floor((X?.byteLength??0)/1024)} KB`),l.info(` - Checksum: ${ie}`),l.info(` - Encryption: ${K}`),l.info(` - IV Session Key: ${U?"present":"none"}`),l.info(` - Key ID: ${z||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&l.info("[Verbose] Checking for duplicate checksum..."),await cO(S,g,T,ie),e.verbose&&l.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&l.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&l.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&l.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&l.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&y==="v1"&&be("You cannot encrypt the partial update if you are not using the v2 encryption method");let b="5.30.0",w="6.30.0",C="7.30.0",O=!1;if(e.delta&&y==="v2"&&!e.encryptPartial){let N=bt((0,Ff.cwd)()),X=await zr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=X?De(X):void 0}catch{U=void 0}X&&U&&RD(U,De("6.14.4"))&&(l.info(`Auto-enabling partial update encryption for updater version ${U} (> 6.14.4)`),e.verbose&&l.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||y==="v2")){let N=bt((0,Ff.cwd)()),X=await zr("@capgo/capacitor-updater",N,e.packageJson),U;try{U=X?De(X):void 0}catch{U=void 0}X&&U&&(O=!Vn(U,b,w,C),e.verbose&&O&&l.info(`[Verbose] Using hex checksum format for updater version ${U}`))}e.verbose&&e.delta&&l.info("[Verbose] Preparing delta/partial update manifest...");let R=e.delta?await OF(D,h,B,g,e.encryptPartial?y:"none",k,O):[];e.verbose&&e.delta&&l.info(`[Verbose] Delta manifest prepared with ${R.length} files`),e.verbose&&l.info("[Verbose] Creating version record in database...");let{error:$}=await zg(S,j);if($&&be(`Cannot add bundle ${M($)}`),e.verbose&&l.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(l.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&&l.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),Z&&(u||c||i||a||s||f||d)){(!u||!c||!i||!a||!s||!f)&&be("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),l.info("Uploading to S3"),e.verbose&&(l.info("[Verbose] S3 configuration:"),l.info(` - Endpoint: ${c}`),l.info(` - Region: ${i}`),l.info(` - Bucket: ${u}`),l.info(` - Port: ${f}`),l.info(` - SSL: ${d?"enabled":"disabled"}`));let N=d?`https://${c}`:`http://${c}`,X=new Gs({endPoint:c,region:i,port:f,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),U=`${g}-${v}`,ie=encodeURIComponent(U);e.verbose&&l.info(`[Verbose] Uploading to S3 as: ${U}`),await X.putObject(U,Uint8Array.from(Z)),j.external_url=`${N}/${ie}`,j.storage_provider="external",e.verbose&&l.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(Z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&l.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await C7(h,S,g,v,B,Z,e,e.tusChunkSize)):e.verbose&&l.info("[Verbose] Skipping full bundle upload (delta-only mode)");let N=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&l.info("[Verbose] Dry upload mode: skipping delta upload"));let U=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(l.info("[Verbose] Starting delta/partial file upload..."),l.info(` - Manifest entries: ${R.length}`),l.info(` - Encryption: ${U?"enabled":"disabled"}`)),N=e.delta?await FF(h,R,D,g,B,U,e):null,e.verbose&&N&&l.info(`[Verbose] Delta upload complete with ${N.length} files`)}catch(U){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw U;l.info(`Failed to upload partial files to capgo cloud. Error: ${M(U)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&l.info(`[Verbose] Delta upload error details: ${M(U)}`)}j.storage_provider="r2",j.manifest=N,e.verbose&&l.info("[Verbose] Updating version record with storage provider and manifest...");let{error:X}=await zg(S,j);X&&be(`Cannot update bundle ${M(X)}`),e.verbose&&l.info("[Verbose] Version record updated successfully")}e.verbose&&l.info("[Verbose] Checking app permissions...");let H=await He(S,h,g,2);e.verbose&&(l.info("[Verbose] Permissions:"),l.info(` - Upload: ${sa(H,2)?"yes":"no"}`),l.info(` - Write: ${sa(H,3)?"yes":"no"}`),l.info(` - Admin: ${sa(H,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&sa(H,3)?(e.verbose&&l.info(`[Verbose] Deleting linked bundle in channel ${T}...`),await E7(S,g,T)):e.deleteLinkedBundleOnUpload&&l.warn("Cannot delete linked bundle on upload as a upload organization member"),sa(H,3)?(e.verbose&&l.info(`[Verbose] Setting bundle ${v} to channel ${T}...`),await _7(S,h,!!e.bundleUrl,v,T,P,B,g,E,e.selfAssign),e.verbose&&l.info("[Verbose] Channel updated successfully")):l.warn("Cannot set channel as a upload organization member"),e.verbose&&l.info("[Verbose] Sending upload event..."),await ye(h,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":g},notify:!1},e.verbose);let I={success:!0,bundle:v,checksum:j.checksum??null,encryptionMethod:y,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(l.info("[Verbose] Upload completed successfully:"),l.info(` - Bundle: ${I.bundle}`),l.info(` - Checksum: ${I.checksum}`),l.info(` - Encryption: ${I.encryptionMethod}`),l.info(` - Storage: ${I.storageProvider}`)),r&&!I.skipped&&G("Time to share your update to the world \u{1F30D}"),I}function x7(t){t.ivSessionKey&&!t.external&&be("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&be("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&&be("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&be("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&be("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&be("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&be("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&be("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)&&be("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&be("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&be("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function kf(t,e){try{x7(e),await Pf(t,e)}catch(r){let n=r instanceof Error?r.message:String(r),o=M(r);e.verbose?l.error(`uploadBundle failed:${o}`):l.error(`uploadBundle failed: ${n}`);let i=n.includes("Cannot upload the same bundle content");if(!e.versionExistsOk)try{if(i){let a=await mt({message:"Would you like to retry the upload?",options:[{value:"ignore",label:"Retry with --ignore-checksum-check (force upload same content)"},{value:"cancel",label:"Cancel upload"}]});if(le(a)||a==="cancel")throw r instanceof Error?r:new Error(String(r));if(a==="ignore")return l.info("\u{1F504} Retrying upload with --ignore-checksum-check..."),kf(t,{...e,ignoreChecksumCheck:!0})}else{let a=await fe({message:"Would you like to retry the upload?"});if(le(a))throw r instanceof Error?r:new Error(String(r));if(a)return l.info("\u{1F504} Retrying upload..."),kf(t,e)}}catch{throw r instanceof Error?r:new Error(String(r))}throw r instanceof Error?r:new Error(String(r))}}var PF=require("node:crypto"),$f=require("node:fs"),$F=require("node:process");var A7=20;function O7(t){console.log(JSON.stringify(t,null,2))}function Qs(t){console.error(M(t))}async function F7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await Ee();let s=await te(),u=he(t,s?.config),c=(0,PF.randomUUID)().split("-")[0],f=Ir("",e.packageJson);if(o=o||f||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!aa.test(o)){let P=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Qs({error:"invalid_semver"}):l.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?Qs({error:"missing_argument"}):l.error(P)),new Error(P)}if(a&&l.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!Ws(i,"notifyAppReady"))throw r||(n?Qs({error:"notifyAppReady_not_in_source_code"}):l.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(!wf(i))throw r||(n?Qs({error:"index_html_not_found"}):l.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let h=await Ql(i);a&&l.info(`Zipped ${h.byteLength} bytes`);let p=a?_e():null;p&&p.start("Calculating checksum");let m=bt((0,$F.cwd)()),g=await zr("@capgo/capacitor-updater",m,e.packageJson);if(!g){let P="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||l.warn(P),new Error(P)}let D=!1,v;try{v=g?De(g):void 0}catch{v=void 0}v?D=!Vn(v,void 0,void 0,"7.0.0"):g==="link:@capgo/capacitor-updater"&&(r||l.warn("Using local @capgo/capacitor-updater. Assuming v7"),D=!0);let _=await cn(h,e.keyV2||(0,$f.existsSync)(ir)||D?"sha256":"crc32");p&&p.stop(`Checksum ${D?"SHA256":"CRC32"}: ${_}`);let y=Math.floor(h.byteLength/1024/1024);y>A7&&a&&(l.warn(`WARNING !!
239
241
  The bundle size is ${y} Mb, this may take a while to download for users
240
242
  `),l.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
241
- `));let _=a?_e():null,S=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${S}`),(0,kf.writeFileSync)(S,p),_&&_.stop(`Saved to ${S}`),a&&G("Done \u2705"),!r&&n&&C7({bundle:o,filename:S,checksum:E}),{bundle:o,filename:S,checksum:E}}catch(s){throw r||(n?Zs(s):l.error(M(s))),s instanceof Error?s:new Error(String(s))}}async function PF(t,e){await E7(t,e,!1)}async function Ey(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["write","all"]),await qe(i,r.apikey,e,4,n),n||l.info(`Creating channel ${e}#${t} to Capgo`);let a=await Xg(i,e);if(!a)throw n||l.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 Et(i,e),u=await ae(i,r.apikey,["write","all"]),c=await $O(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||l.error(`Cannot create Channel \u{1F640}
242
- ${M(c.error)}`),new Error(`Cannot create channel: ${M(c.error)}`);return await ge(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel created \u2705"),G("Done \u2705")),c.data??!0}async function kF(t,e,r){await Ey(t,e,r,!1)}async function _7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=pe(e,i?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(a,r.apikey,["write","all","read"]),await qe(a,r.apikey,e,1,n),!t)throw n||l.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||l.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||l.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?l.info(c.name):l.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function $F(t,e,r){return _7(t,e,r)}async function S7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.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 ae(i,r.apikey,["all"]);if(await qe(i,r.apikey,e,4,n),r.deleteBundle&&!n&&l.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await BO(i,e,t);p?.name&&!n&&l.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Zg(i,e,p.name)}let{data:s,error:u}=await TO(i,e,t);if(u||!s){if(n||l.error(`Channel ${t} not found`),r.successIfNotFound)return n||l.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await RO(i,e,s.id);if(c)throw n||l.error(`Cannot delete channel devices: ${M(c)}`),new Error(`Cannot delete channel devices: ${M(c)}`);n||l.info(`Deleting channel ${e}#${t} from Capgo`);let f=await IO(i,t,e,a);if(f.error)throw n||l.error(`Cannot delete Channel \u{1F640} ${M(f.error)}`),new Error(`Cannot delete channel: ${M(f.error)}`);let d=await Et(i,e);return await ge(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel deleted"),G("Done \u2705")),!0}async function IF(t,e,r){return S7(t,e,r,!1)}async function x7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=pe(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.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 ae(o,e.apikey,["write","all","read","upload"]);await qe(o,e.apikey,t,1,r),r||l.info("Querying available channels in Capgo");let a=await LO(o,t);return r||(l.info(`Active channels in Capgo: ${a?.length??0}`),NO(a)),await ge(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||G("Done \u2705"),a}async function TF(t,e){return x7(t,e,!1)}var RF=["major","minor","metadata","patch","none"];async function A7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=pe(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.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 ae(i,r.apikey,["write","all"]);await qe(i,r.apikey,e,4,n);let s=await Et(i,e),{bundle:u,state:c,downgrade:f,latest:d,latestRemote:p,ios:h,android:m,selfAssign:g,disableAutoUpdate:D,dev:v,emulator:E,device:y,prod:_}=r;if(d&&u)throw n||l.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||l.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||l.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&p==null&&f==null&&h==null&&m==null&&g==null&&v==null&&E==null&&y==null&&_==null&&D==null)throw n||l.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await GA(i,s,r.apikey,e);let S={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:k}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(k)throw n||l.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let T=d?o?.config?.plugins?.CapacitorUpdater?.version||Ir("",r.packageJson):u;if(T!=null){let{data:F,error:L}=await i.from("app_versions").select().eq("app_id",e).eq("name",T).eq("user_id",a).eq("deleted",!1).single();if(L||!F)throw n||l.error(`Cannot find version ${T}`),new Error(`Cannot find version ${T}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:A,localDependencies:q}=await Kg(i,e,t,F.native_packages??[]),j=nt();if(q.length>0&&A.some(Z=>!No(Z)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${j.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(q.length===0&&A.length>0?l.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):l.info(`Bundle is compatible with ${t} channel`))}n||l.info(`Set ${e} channel: ${t} to @${T}`),S.version=F.id}if(p){let{data:F,error:L}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(L||!F)throw n||l.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:A}=await Kg(i,e,t,F.native_packages??[]),q=nt();if(A.some(j=>!No(j)))throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(`You can check compatibility with "${q.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||l.info(`Set ${e} channel: ${t} to @${F.name}`),S.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||l.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||l.info(`Set ${e} channel: ${t} to ${c}`),S.public=c==="default"}if(f!=null&&(n||l.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} downgrade`),S.disable_auto_update_under_native=!f),h!=null&&(n||l.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),S.ios=!!h),m!=null&&(n||l.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),S.android=!!m),g!=null&&(n||l.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),S.allow_device_self_set=!!g),v!=null&&(n||l.info(`Set ${e} channel: ${t} to ${v?"allow":"disallow"} dev devices`),S.allow_dev=!!v),E!=null&&(n||l.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),S.allow_emulator=!!E),y!=null&&(n||l.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} physical devices`),S.allow_device=!!y),_!=null&&(n||l.info(`Set ${e} channel: ${t} to ${_?"allow":"disallow"} prod builds`),S.allow_prod=!!_),D!=null){let F=D.toLowerCase();if(!RF.includes(F))throw n||l.error(`Channel strategy ${F} is not known. The possible values are: ${RF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),S.disable_auto_update=F,n||l.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:B}=await Ql(i,S);if(B)throw n||l.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 ge(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||G("Done \u2705"),!0}async function BF(t,e,r){return A7(t,e,r,!1)}var Xr=require("node:fs");function _y(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 NF(t="./README.md",e){let r=at.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 f=c,d=f._actionHandler!==null&&f._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),f;i?f=a?`${a}-${u}`:u:f=s?"options":u;let d=i?"###":"##",p="",h=_y(u);s&&!i||(p+=`${d} <a id="${f}"></a> ${h} **${c}**
243
+ `));let E=a?_e():null,S=e.name||`${u}_${o}.zip`;return E&&E.start(`Saving to ${S}`),(0,$f.writeFileSync)(S,h),E&&E.stop(`Saved to ${S}`),a&&G("Done \u2705"),!r&&n&&O7({bundle:o,filename:S,checksum:_}),{bundle:o,filename:S,checksum:_}}catch(s){throw r||(n?Qs(s):l.error(M(s))),s instanceof Error?s:new Error(String(s))}}async function IF(t,e){await F7(t,e,!1)}async function _y(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||oe();let o=await te().catch(()=>{});if(e=he(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon);await ue(i,r.apikey,["write","all"]),await He(i,r.apikey,e,4,n),n||l.info(`Creating channel ${e}#${t} to Capgo`);let a=await Zg(i,e);if(!a)throw n||l.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 Et(i,e),u=await ue(i,r.apikey,["write","all"]),c=await RO(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||l.error(`Cannot create Channel \u{1F640}
244
+ ${M(c.error)}`),new Error(`Cannot create channel: ${M(c.error)}`);return await ye(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel created \u2705"),G("Done \u2705")),c.data??!0}async function TF(t,e,r){await _y(t,e,r,!1)}async function k7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||oe(o);let i=await te();if(e=he(e,i?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await ne(r.apikey,r.supaHost,r.supaAnon);if(await ue(a,r.apikey,["write","all","read"]),await He(a,r.apikey,e,1,n),!t)throw n||l.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||l.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||l.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?l.info(c.name):l.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function RF(t,e,r){return k7(t,e,r)}async function P7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||oe();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await ue(i,r.apikey,["all"]);if(await He(i,r.apikey,e,4,n),r.deleteBundle&&!n&&l.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let h=await jO(i,e,t);h?.name&&!n&&l.info(`Deleting bundle ${h.name} from Capgo`),h?.name&&await Qg(i,e,h.name)}let{data:s,error:u}=await NO(i,e,t);if(u||!s){if(n||l.error(`Channel ${t} not found`),r.successIfNotFound)return n||l.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await LO(i,e,s.id);if(c)throw n||l.error(`Cannot delete channel devices: ${M(c)}`),new Error(`Cannot delete channel devices: ${M(c)}`);n||l.info(`Deleting channel ${e}#${t} from Capgo`);let f=await BO(i,t,e,a);if(f.error)throw n||l.error(`Cannot delete Channel \u{1F640} ${M(f.error)}`),new Error(`Cannot delete channel: ${M(f.error)}`);let d=await Et(i,e);return await ye(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(l.success("Channel deleted"),G("Done \u2705")),!0}async function BF(t,e,r){return P7(t,e,r,!1)}async function $7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||oe();let n=await te();if(t=he(t,n?.config),!e.apikey)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await ne(e.apikey,e.supaHost,e.supaAnon),i=await ue(o,e.apikey,["write","all","read","upload"]);await He(o,e.apikey,t,1,r),r||l.info("Querying available channels in Capgo");let a=await MO(o,t);return r||(l.info(`Active channels in Capgo: ${a?.length??0}`),UO(a)),await ye(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||G("Done \u2705"),a}async function NF(t,e){return $7(t,e,!1)}function LF(t){let e=new qe;e.headers=["Package","Local","Remote","Status","Details"],e.theme=qe.roundTheme,e.rows=[];for(let r of t){let{name:n,localVersion:o,remoteVersion:i}=r,a=Lo(r),s=a.compatible?"\u2705":"\u274C";e.rows.push([n,o||"-",i||"-",s,a.message])}l.info(e.toString())}var jF=["major","minor","metadata","patch","none"];async function I7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||oe();let o=await te();if(e=he(e,o?.config),!r.apikey)throw n||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||l.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||l.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await ne(r.apikey,r.supaHost,r.supaAnon),a=await ue(i,r.apikey,["write","all"]);await He(i,r.apikey,e,4,n);let s=await Et(i,e),{bundle:u,state:c,downgrade:f,latest:d,latestRemote:h,ios:p,android:m,selfAssign:g,disableAutoUpdate:D,dev:v,emulator:_,device:y,prod:E}=r;if(d&&u)throw n||l.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(h&&u)throw n||l.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(h&&d)throw n||l.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&h==null&&f==null&&p==null&&m==null&&g==null&&v==null&&_==null&&y==null&&E==null&&D==null)throw n||l.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await YA(i,s,r.apikey,e);let S={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:P}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(P)throw n||l.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let T=d?o?.config?.plugins?.CapacitorUpdater?.version||Ir("",r.packageJson):u;if(T!=null){let{data:F,error:L}=await i.from("app_versions").select().eq("app_id",e).eq("name",T).eq("user_id",a).eq("deleted",!1).single();if(L||!F)throw n||l.error(`Cannot find version ${T}`),new Error(`Cannot find version ${T}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:A,localDependencies:q}=await Gg(i,e,t,F.native_packages??[]),j=A.filter(Z=>!zn(Z));if(q.length>0&&j.length>0)throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(""),LF(A),l.warn(""),l.warn("An app store update may be required for these changes to take effect.")),new Error(`Bundle is not compatible with ${t} channel`);n||(q.length===0&&A.length>0?l.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):l.info(`Bundle is compatible with ${t} channel`))}n||l.info(`Set ${e} channel: ${t} to @${T}`),S.version=F.id}if(h){let{data:F,error:L}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(L||!F)throw n||l.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:A}=await Gg(i,e,t,F.native_packages??[]);if(A.filter(j=>!zn(j)).length>0)throw n||(l.warn(`Bundle NOT compatible with ${t} channel`),l.warn(""),LF(A),l.warn(""),l.warn("An app store update may be required for these changes to take effect.")),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||l.info(`Set ${e} channel: ${t} to @${F.name}`),S.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||l.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||l.info(`Set ${e} channel: ${t} to ${c}`),S.public=c==="default"}if(f!=null&&(n||l.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} downgrade`),S.disable_auto_update_under_native=!f),p!=null&&(n||l.info(`Set ${e} channel: ${t} to ${p?"allow":"disallow"} ios update`),S.ios=!!p),m!=null&&(n||l.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),S.android=!!m),g!=null&&(n||l.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),S.allow_device_self_set=!!g),v!=null&&(n||l.info(`Set ${e} channel: ${t} to ${v?"allow":"disallow"} dev devices`),S.allow_dev=!!v),_!=null&&(n||l.info(`Set ${e} channel: ${t} to ${_?"allow":"disallow"} emulator devices`),S.allow_emulator=!!_),y!=null&&(n||l.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} physical devices`),S.allow_device=!!y),E!=null&&(n||l.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} prod builds`),S.allow_prod=!!E),D!=null){let F=D.toLowerCase();if(!jF.includes(F))throw n||l.error(`Channel strategy ${F} is not known. The possible values are: ${jF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),S.disable_auto_update=F,n||l.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:B}=await ef(i,S);if(B)throw n||l.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 ye(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||G("Done \u2705"),!0}async function UF(t,e,r){return I7(t,e,r,!1)}var Xr=require("node:fs");function Sy(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 MF(t="./README.md",e){let r=at.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 f=c,d=f._actionHandler!==null&&f._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(h=>({flags:h.flags,description:h.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),f;i?f=a?`${a}-${u}`:u:f=s?"options":u;let d=i?"###":"##",h="",p=Sy(u);s&&!i||(h+=`${d} <a id="${f}"></a> ${p} **${c}**
243
245
 
244
- `),o.alias&&(p+=`**Alias:** \`${o.alias}\`
246
+ `),o.alias&&(h+=`**Alias:** \`${o.alias}\`
245
247
 
246
- `),o.isCommandGroup||(p+="```bash\n",i?p+=`npx @capgo/cli@latest ${a} ${u}
247
- `:p+=`npx @capgo/cli@latest ${u}
248
- `,p+="```\n\n");let m=o.description.split(`
249
- `),g=!i&&s?1:0;for(let v=g;v<m.length;v++){let E=m[v];E.trim().startsWith("Note:")?p+=`> \u2139\uFE0F ${E.trim().substring(5).trim()}
248
+ `),o.isCommandGroup||(h+="```bash\n",i?h+=`npx @capgo/cli@latest ${a} ${u}
249
+ `:h+=`npx @capgo/cli@latest ${u}
250
+ `,h+="```\n\n");let m=o.description.split(`
251
+ `),g=!i&&s?1:0;for(let v=g;v<m.length;v++){let _=m[v];_.trim().startsWith("Note:")?h+=`> \u2139\uFE0F ${_.trim().substring(5).trim()}
250
252
 
251
- `:E.includes("Example:")||E.trim()&&(p+=`${E}
252
- `)}p+=`
253
+ `:_.includes("Example:")||_.trim()&&(h+=`${_}
254
+ `)}h+=`
253
255
  `;let D=o.description.split(`
254
- `).find(v=>v.includes("Example:"));if(D&&!o.isCommandGroup&&(p+=`**Example:**
256
+ `).find(v=>v.includes("Example:"));if(D&&!o.isCommandGroup&&(h+=`**Example:**
255
257
 
256
- `,p+="```bash\n",p+=`${D.replace("Example: ","")}
257
- `,p+="```\n\n"),o.options.length>0){i?p+=`**Options:**
258
+ `,h+="```bash\n",h+=`${D.replace("Example: ","")}
259
+ `,h+="```\n\n"),o.options.length>0){i?h+=`**Options:**
258
260
 
259
- `:p+=`## <a id="options"></a> Options
261
+ `:h+=`## <a id="options"></a> Options
260
262
 
261
- `,p+=`| Param | Type | Description |
262
- `,p+=`| -------------- | ------------- | -------------------- |
263
- `;for(let v of o.options){let E=v.flags.split(" ")[0],y=v.flags.split(" ").length>1?"string":"boolean";p+=`| **${E}** | <code>${y}</code> | ${v.description} |
264
- `}p+=`
265
- `}return p};if(e){(0,Xr.existsSync)(e)||(0,Xr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
266
- title: ${_y(o.name)} ${o.name}
263
+ `,h+=`| Param | Type | Description |
264
+ `,h+=`| -------------- | ------------- | -------------------- |
265
+ `;for(let v of o.options){let _=v.flags.split(" ")[0],y=v.flags.split(" ").length>1?"string":"boolean";h+=`| **${_}** | <code>${y}</code> | ${v.description} |
266
+ `}h+=`
267
+ `}return h};if(e){(0,Xr.existsSync)(e)||(0,Xr.mkdirSync)(e,{recursive:!0});for(let o of r){if(o.name==="generate-docs")return;let a=`---
268
+ title: ${Sy(o.name)} ${o.name}
267
269
  description: ${o.description.split(`
268
270
  `)[0]}
269
271
  sidebar_label: ${o.name}
@@ -278,51 +280,51 @@ sidebar:
278
280
 
279
281
  `;o+=`## \u{1F4CB} Table of Contents
280
282
 
281
- `;for(let f of r){if(f.name==="generate-docs")continue;let d=_y(f.name);if(o+=`- ${d} [${f.name.charAt(0).toUpperCase()+f.name.slice(1)}](#${f.name})
282
- `,f.subcommands.length>0)for(let p of f.subcommands)o+=` - [${p.name.charAt(0).toUpperCase()+p.name.slice(1)}](#${f.name}-${p.name})
283
+ `;for(let f of r){if(f.name==="generate-docs")continue;let d=Sy(f.name);if(o+=`- ${d} [${f.name.charAt(0).toUpperCase()+f.name.slice(1)}](#${f.name})
284
+ `,f.subcommands.length>0)for(let h of f.subcommands)o+=` - [${h.name.charAt(0).toUpperCase()+h.name.slice(1)}](#${f.name}-${h.name})
283
285
  `}o+=`
284
286
  `;for(let f of r)if(f.name!=="generate-docs"){if(o+=n(f,!1,void 0,!1),f.subcommands.length>0){f.isCommandGroup||(o+=`#### ${f.name.toUpperCase()} Subcommands:
285
287
 
286
288
  `);for(let d of f.subcommands)o+=n(d,!0,f.name)}o+=`
287
- `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Xr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let f=s.substring(0,u+i.length),d=s.substring(c),p=`${f}
289
+ `}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Xr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let f=s.substring(0,u+i.length),d=s.substring(c),h=`${f}
288
290
  ${o}
289
- ${d}`;(0,Xr.writeFileSync)(t,p,"utf8"),l.success(`Documentation updated in ${t}`)}else(0,Xr.writeFileSync)(t,o,"utf8"),l.success(`Documentation written to ${t}`)}}var Ca=require("node:child_process"),Oe=require("node:fs"),Tr=require("node:path"),se=require("node:process");var Tf=de(t2());var Ut=require("node:fs");function r2(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function W7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||hn,o=t.keyData||"";if(!(0,Ut.existsSync)(n)&&!o)throw e||l.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Ut.existsSync)(n)&&(o=(0,Ut.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||l.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=r2(r.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ce({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 Qi(r)}return e||(l.success(`Public key saved into ${r.path} file in local directory`),l.success("Your app will decode the zip archive with this key")),!0}async function Y7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Qi(r),(0,Ut.existsSync)(oa))try{(0,Ut.unlinkSync)(oa),e||l.success(`Old private key file deleted: ${oa}`)}catch(o){e||l.error(`Failed to delete old private key file: ${oa} (${String(o)})`)}if((0,Ut.existsSync)(Yl))try{(0,Ut.unlinkSync)(Yl),e||l.success(`Old public key file deleted: ${Yl}`)}catch(o){e||l.error(`Failed to delete old public key file: ${hn} (${String(o)})`)}return e||(l.success(`Old private key deleted from ${r.path} file`),G("Done \u2705")),!0}return e||l.info("No old private key found in config file"),!1}async function n2(t){await Ee(),await W7(t,!1)}async function Fy(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=KO();if((0,Ut.existsSync)(hn)&&!t.force)throw e||l.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Ut.writeFileSync)(hn,r),(0,Ut.existsSync)(ir)&&!t.force)throw e||l.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Ut.writeFileSync)(ir,n);let o=await te();if(o){let i=r2(o.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ce({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 Qi(o)}if(!e){l.success("Your RSA key has been generated"),l.success(`Private key saved in ${ir}`),l.success("This key will be used to encrypt your bundle before sending it to Capgo"),l.success("Keep it safe"),l.success("Then make it unreadable by Capgo and unmodifiable by anyone"),l.success(`Public key saved in ${o.path}`),l.success("Your app will be the only one having it"),l.success("Only your users can decrypt your update"),l.success("Only you can send them an update");try{await tf(),G("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function o2(t){await Ee(),await Fy(t,!1)}async function i2(t){await Ee(),await Y7(t,!1)}var Cn=require("node:fs"),Py=require("node:os");function a2(){let t=(0,Py.homedir)();return(0,Cn.existsSync)(`${t}/.capgo`)||(0,Cn.existsSync)(".capgo")}async function ky(t,e,r=!1){if(r||ee("Login to Capgo"),!t&&!r){let a=await bD({message:"Enter your API key:",mask:"*"});if(ue(a))throw l.error("Login cancelled"),new Error("Login cancelled");t=a}if(!t)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ee();let{local:n}=e;if(n){if(!(0,Cn.existsSync)(".git"))throw r||l.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,Cn.writeFileSync)(".capgo",`${t}
291
+ ${d}`;(0,Xr.writeFileSync)(t,h,"utf8"),l.success(`Documentation updated in ${t}`)}else(0,Xr.writeFileSync)(t,o,"utf8"),l.success(`Documentation written to ${t}`)}}var Ea=require("node:child_process"),Oe=require("node:fs"),Tr=require("node:path"),ce=require("node:process");var Rf=pe(i2());var Ut=require("node:fs");function a2(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function eq(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||hn,o=t.keyData||"";if(!(0,Ut.existsSync)(n)&&!o)throw e||l.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Ut.existsSync)(n)&&(o=(0,Ut.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||l.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=a2(r.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await fe({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 ea(r)}return e||(l.success(`Public key saved into ${r.path} file in local directory`),l.success("Your app will decode the zip archive with this key")),!0}async function tq(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await ea(r),(0,Ut.existsSync)(ia))try{(0,Ut.unlinkSync)(ia),e||l.success(`Old private key file deleted: ${ia}`)}catch(o){e||l.error(`Failed to delete old private key file: ${ia} (${String(o)})`)}if((0,Ut.existsSync)(Jl))try{(0,Ut.unlinkSync)(Jl),e||l.success(`Old public key file deleted: ${Jl}`)}catch(o){e||l.error(`Failed to delete old public key file: ${hn} (${String(o)})`)}return e||(l.success(`Old private key deleted from ${r.path} file`),G("Done \u2705")),!0}return e||l.info("No old private key found in config file"),!1}async function s2(t){await Ee(),await eq(t,!1)}async function ky(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=YO();if((0,Ut.existsSync)(hn)&&!t.force)throw e||l.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Ut.writeFileSync)(hn,r),(0,Ut.existsSync)(ir)&&!t.force)throw e||l.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Ut.writeFileSync)(ir,n);let o=await te();if(o){let i=a2(o.config);i.privateKey&&(delete i.privateKey,e||l.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await fe({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 ea(o)}if(!e){l.success("Your RSA key has been generated"),l.success(`Private key saved in ${ir}`),l.success("This key will be used to encrypt your bundle before sending it to Capgo"),l.success("Keep it safe"),l.success("Then make it unreadable by Capgo and unmodifiable by anyone"),l.success(`Public key saved in ${o.path}`),l.success("Your app will be the only one having it"),l.success("Only your users can decrypt your update"),l.success("Only you can send them an update");try{await rf(),G("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function u2(t){await Ee(),await ky(t,!1)}async function c2(t){await Ee(),await tq(t,!1)}var Cn=require("node:fs"),Py=require("node:os");function l2(){let t=(0,Py.homedir)();return(0,Cn.existsSync)(`${t}/.capgo`)||(0,Cn.existsSync)(".capgo")}async function $y(t,e,r=!1){if(r||ee("Login to Capgo"),!t&&!r){let a=await wD({message:"Enter your API key:",mask:"*"});if(le(a))throw l.error("Login cancelled"),new Error("Login cancelled");t=a}if(!t)throw r||l.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ee();let{local:n}=e;if(n){if(!(0,Cn.existsSync)(".git"))throw r||l.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,Cn.writeFileSync)(".capgo",`${t}
290
292
  `),(0,Cn.appendFileSync)(".gitignore",`.capgo
291
293
  `)}else{let a=(0,Py.homedir)();(0,Cn.writeFileSync)(`${a}/.capgo`,`${t}
292
- `)}let o=await re(t,e.supaHost,e.supaAnon),i=await ae(o,t,["write","all","upload"]);await ge(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(l.success(`login saved into .capgo file in ${n?"local":"home"} directory`),G("Done \u2705"))}async function s2(t,e){await ky(t,e,!1)}var $y="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Qs="CapacitorUpdater.notifyAppReady()",J7=/import.*from.*/g,eu="production",Iy={stdio:"pipe"},tu,Wn;function u2(){tu??=(0,Oe.readdirSync)(Tf.default.tmpdir).map(t=>({name:t,full:`${Tf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??Tf.default.fileSync({prefix:"capgocli"}).name}function Mt(t,e){try{u2(),(0,Oe.writeFileSync)(tu,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Wn})),e&&(Wn=e)}catch(r){l.error(`Cannot mark step as done in the CLI, error:
293
- ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!")}}async function X7(t,e){try{u2();let r=(0,Oe.readFileSync)(tu,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);l.info(`You have already got to the step ${n}/10 in the previous session`);let i=await ce({message:"Would you like to continue from where you left off?"});return await Ze(i,t,e),i?(o&&(Wn=o),n):void 0}catch(r){l.error(`Cannot read which steps have been completed, error:
294
- ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!");return}}function Z7(){if(tu)try{(0,Oe.rmSync)(tu)}catch(t){l.error(`Cannot delete the tmp steps file.
295
- Error: ${t}`)}}async function Ze(t,e,r){ue(t)&&(await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
296
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}async function At(t,e,r,n){return Ct("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function Q7(t,e){l.info("\u{1F4CB} Checking development environment prerequisites"),l.info(" For mobile development, you need at least one platform setup");let r=se.platform==="darwin"&&(0,Oe.existsSync)("/Applications/Xcode.app"),n=se.env.HOME||se.env.USERPROFILE||"~",i=[se.env.ANDROID_HOME,se.env.ANDROID_SDK_ROOT,(0,Tr.join)(n,"Library","Android","sdk"),(0,Tr.join)(n,"Android","Sdk"),(0,Tr.join)(n,"AppData","Local","Android","Sdk")].filter(Boolean).some(a=>a&&(0,Oe.existsSync)(a));if(r?l.success("\u2705 Xcode detected - iOS development ready"):se.platform==="darwin"&&l.warn("\u26A0\uFE0F Xcode not found"),i?l.success("\u2705 Android SDK detected - Android development ready"):l.warn("\u26A0\uFE0F Android SDK not found"),!r&&!i){l.error("\u274C No development environment detected"),l.info(""),l.info("\u{1F4F1} To develop mobile apps with Capacitor, you need:"),l.info(" \u2022 For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/"),l.info(" \u2022 For Android: Android Studio - https://developer.android.com/studio"),l.info("");let a=await ce({message:"Continue onboarding without a development environment? (You won't be able to build or test)",initialValue:!1});await Ze(a,t,e),a||(l.info("\u{1F4DD} Please install a development environment and run the onboarding again"),G(`Bye \u{1F44B}
297
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.warn("\u26A0\uFE0F Continuing without development environment - you'll need to set it up later")}else if(!r&&se.platform==="darwin"){let a=await ce({message:"Xcode is not installed. Do you plan to develop for iOS?",initialValue:!1});if(await Ze(a,t,e),a){l.info("\u{1F4E5} Please install Xcode from: https://developer.apple.com/xcode/"),l.info("\u{1F4A1} After installing Xcode, you can continue the onboarding");let s=await ce({message:"Have you installed Xcode? (Choose No to continue with Android only)",initialValue:!1});await Ze(s,t,e),s||l.info("\u{1F4F1} Continuing with Android development only")}}else if(!i){let a=await ce({message:"Android SDK is not installed. Do you plan to develop for Android?",initialValue:!1});if(await Ze(a,t,e),a){l.info("\u{1F4E5} Please install Android Studio from: https://developer.android.com/studio"),l.info("\u{1F4A1} After installing Android Studio, set up the Android SDK");let s=await ce({message:"Have you installed Android Studio? (Choose No to continue with iOS only)",initialValue:!1});await Ze(s,t,e),s||l.info("\u{1F4F1} Continuing with iOS development only")}}await At(t,e,"check-prerequisites","checked")}async function eq(t,e,r,n){let o=nt(),i=r,a=0,s=5;for(;a<s;){let u=await ce({message:`Add ${i} in Capgo?`});if(await Ze(u,t.gid,e),!u)return l.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${i}"`),await At(t.gid,e,"add-app",i),i;try{let c=_e();return c.start(`Running: ${o.runner} @capgo/cli@latest app add ${i}`),await Gg(i,n,t,!0)?c.stop("App add Done \u2705"):c.stop("App already add \u2705"),await At(t.gid,e,"add-app",i),i}catch(c){if((c instanceof Error?c.message:String(c)).includes("already exist")){a++,l.error(`\u274C App ID "${i}" is already taken`);let d=[`${r}2`,`${r}3`,`${r}.new`,`${r}.app`];l.info("\u{1F4A1} Here are some suggestions:"),d.forEach((h,m)=>{l.info(` ${m+1}. ${h}`)});let p=await gt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${d[0]}`},{value:"suggest2",label:`Use ${d[1]}`},{value:"suggest3",label:`Use ${d[2]}`},{value:"suggest4",label:`Use ${d[3]}`},{value:"custom",label:"Enter a custom app ID"},{value:"cancel",label:"Cancel onboarding"}]});if(ue(p)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
298
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="cancel"&&(await Ct("onboarding-v2",t.gid,e,"canceled-appid-conflict","\u{1F937}"),G(`Bye \u{1F44B}
299
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),p==="custom"){let h=await qt({message:"Enter your custom app ID (e.g., com.example.myapp):",validate:m=>{if(!m)return"App ID is required";if(m.includes("--"))return'App ID cannot contain "--"';if(!/^[a-z0-9]+(?:\.[\w-]+)+$/i.test(m))return"Invalid format. Use reverse domain notation (e.g., com.example.app)"}});ue(h)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
300
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),i=h}else{let h=Number.parseInt(p.replace("suggest",""))-1;i=d[h]}l.info(`\u{1F504} Trying with new app ID: ${i}`);continue}throw c}}l.error(`\u274C Maximum retry attempts (${s}) reached`),G(`Bye \u{1F44B}
301
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1)}async function tq(t,e,r){let n=nt(),o=await ce({message:`Create default channel ${eu} for ${r} in Capgo?`});if(await Ze(o,t,e),o){let i=_e();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${eu} ${r} --default`),await Ey(eu,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else l.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${eu} ${r} --default"`);await At(t,e,"add-channel",r)}async function rq(t){let e=(0,Tr.join)(bt((0,se.cwd)()),or),r=Wn?await Cr(void 0,Wn):await Cr(void 0,e);if(r.size===0||!r.has("@capacitor/core")){l.warn("No adequate dependencies found");let n=await ce({message:"Would you like to select the package.json file manually?"});if(ue(n)&&(Jn("Operation cancelled."),(0,se.exit)(1)),n){let o=await ce({message:"Would you like to use a tree selector to choose the package.json file?"});if(ue(o)&&(Jn("Operation cancelled."),(0,se.exit)(1)),o){let a=(0,se.cwd)(),s=or;for(;;){let u=(0,Oe.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await gt({message:"Select package.json file:",options:u}),ue(s)&&(Jn("Operation cancelled."),(0,se.exit)(1)),!(0,Oe.statSync)((0,Tr.join)(a,s)).isDirectory()&&s!==or){l.error("Selected a file that is not a package.json file");continue}if(a=(0,Tr.join)(a,s),s===or)break}return await Mt(t,a),{dependencies:await Cr(void 0,a),path:a}}let i=await qt({message:"Enter path to node_modules folder:"});return ue(i)&&(Jn("Operation cancelled."),(0,se.exit)(1)),(0,Oe.existsSync)(i)||(l.error(`Path ${i} does not exist`),(0,se.exit)(1)),{dependencies:await Cr(void 0,i),path:i}}}return await Mt(t,e),{dependencies:await Cr(void 0,e),path:e}}var nq="https://capacitorjs.com/docs/updating/5-0",oq="https://capacitorjs.com/docs/updating/6-0",iq="https://capacitorjs.com/docs/updating/7-0",aq="https://capacitorjs.com/docs/updating/8-0";async function sq(t,e,r){let n=nt(),o="1.0.0",i=!1,a=await ce({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Ze(a,t,e),a){let s=_e(),u="latest",{dependencies:c,path:f}=await rq(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json"),G(`Bye \u{1F44B}
302
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let d=c.get("@capacitor/core");if(d||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),G(`Bye \u{1F44B}
303
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),d==="latest"?(s.stop(`@capacitor/core version is ${d}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),G(`Bye \u{1F44B}
304
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):er(ye(d),ye("5.0.0"))?(s.stop("Error"),l.warn(`@capacitor/core version is ${d}, Capgo only supports Capacitor v5 and above, please update to Capacitor v5 minimum: ${nq}`),G(`Bye \u{1F44B}
305
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()):er(ye(d),ye("6.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v5`),l.warn(`Consider upgrading to Capacitor v6 or higher to support the latest mobile OS features: ${oq}`),u="^5.0.0"):er(ye(d),ye("7.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v6`),l.warn(`Consider upgrading to Capacitor v7 or higher to support the latest mobile OS features: ${iq}`),u="^6.0.0"):er(ye(d),ye("8.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v7`),l.warn(`Consider upgrading to Capacitor v8 to support the latest mobile OS features: ${aq}`),u="^7.0.0"):(l.info(`@capacitor/core version is ${d}, installing latest capacitor-updater v8+`),u="^8.0.0"),n.pm==="unknown"&&(s.stop("Error"),l.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),G(`Bye \u{1F44B}
306
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),await zr("@capgo/capacitor-updater",f.replace("/package.json",""),f))s.stop("Capgo already installed \u2705");else{await(0,Ca.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Iy,cwd:f.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Ir(void 0,f)||"1.0.0";let h=!1;u==="latest"&&(h=await ce({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 Ze(h,t,e)),s.start("Updating config file"),i=!!h;let m=h?{directUpdate:"always",autoSplashscreen:!0}:{};h&&await Mg("SplashScreen",{launchAutoHide:!1}),await Is({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else l.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await At(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function uq(t,e,r){let n=await ce({message:`Automatic Add "${Qs}" code and import in ${r}?`});if(await Ze(n,t,e),n){let o=_e();o.start("Adding @capacitor-updater to your main file");let i=await Xl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Tr.join)("plugins");(0,Oe.existsSync)(a)||(0,Oe.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Tr.join)(a,"capacitorUpdater.client.ts"):s=(0,Tr.join)(a,"capacitorUpdater.client.js");let u=`
294
+ `)}let o=await ne(t,e.supaHost,e.supaAnon),i=await ue(o,t,["write","all","upload"]);await ye(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(l.success(`login saved into .capgo file in ${n?"local":"home"} directory`),G("Done \u2705"))}async function f2(t,e){await $y(t,e,!1)}var Iy="import { CapacitorUpdater } from '@capgo/capacitor-updater'",eu="CapacitorUpdater.notifyAppReady()",rq=/import.*from.*/g,tu="production",Ty={stdio:"pipe"},ru,Yn;function d2(){ru??=(0,Oe.readdirSync)(Rf.default.tmpdir).map(t=>({name:t,full:`${Rf.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??Rf.default.fileSync({prefix:"capgocli"}).name}function Mt(t,e){try{d2(),(0,Oe.writeFileSync)(ru,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Yn})),e&&(Yn=e)}catch(r){l.error(`Cannot mark step as done in the CLI, error:
295
+ ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!")}}async function nq(t,e){try{d2();let r=(0,Oe.readFileSync)(ru,"utf-8");if(!r||r.length===0)return;let{step_done:n,pathToPackageJson:o}=JSON.parse(r);l.info(`You have already got to the step ${n}/10 in the previous session`);let i=await fe({message:"Would you like to continue from where you left off?"});return await Qe(i,t,e),i?(o&&(Yn=o),n):void 0}catch(r){l.error(`Cannot read which steps have been completed, error:
296
+ ${r}`),l.warn("Onboarding will continue but please report it to the capgo team!");return}}function oq(){if(ru)try{(0,Oe.rmSync)(ru)}catch(t){l.error(`Cannot delete the tmp steps file.
297
+ Error: ${t}`)}}async function Qe(t,e,r){le(t)&&(await Ct("onboarding-v2",e,r,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
298
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)())}async function At(t,e,r,n){return Ct("onboarding-v2",t,e,`onboarding-step-${r}`,n)}async function iq(t,e){l.info("\u{1F4CB} Checking development environment prerequisites"),l.info(" For mobile development, you need at least one platform setup");let r=ce.platform==="darwin"&&(0,Oe.existsSync)("/Applications/Xcode.app"),n=ce.env.HOME||ce.env.USERPROFILE||"~",i=[ce.env.ANDROID_HOME,ce.env.ANDROID_SDK_ROOT,(0,Tr.join)(n,"Library","Android","sdk"),(0,Tr.join)(n,"Android","Sdk"),(0,Tr.join)(n,"AppData","Local","Android","Sdk")].filter(Boolean).some(a=>a&&(0,Oe.existsSync)(a));if(r?l.success("\u2705 Xcode detected - iOS development ready"):ce.platform==="darwin"&&l.warn("\u26A0\uFE0F Xcode not found"),i?l.success("\u2705 Android SDK detected - Android development ready"):l.warn("\u26A0\uFE0F Android SDK not found"),!r&&!i){l.error("\u274C No development environment detected"),l.info(""),l.info("\u{1F4F1} To develop mobile apps with Capacitor, you need:"),l.info(" \u2022 For iOS: Xcode (macOS only) - https://developer.apple.com/xcode/"),l.info(" \u2022 For Android: Android Studio - https://developer.android.com/studio"),l.info("");let a=await fe({message:"Continue onboarding without a development environment? (You won't be able to build or test)",initialValue:!1});await Qe(a,t,e),a||(l.info("\u{1F4DD} Please install a development environment and run the onboarding again"),G(`Bye \u{1F44B}
299
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),l.warn("\u26A0\uFE0F Continuing without development environment - you'll need to set it up later")}else if(!r&&ce.platform==="darwin"){let a=await fe({message:"Xcode is not installed. Do you plan to develop for iOS?",initialValue:!1});if(await Qe(a,t,e),a){l.info("\u{1F4E5} Please install Xcode from: https://developer.apple.com/xcode/"),l.info("\u{1F4A1} After installing Xcode, you can continue the onboarding");let s=await fe({message:"Have you installed Xcode? (Choose No to continue with Android only)",initialValue:!1});await Qe(s,t,e),s||l.info("\u{1F4F1} Continuing with Android development only")}}else if(!i){let a=await fe({message:"Android SDK is not installed. Do you plan to develop for Android?",initialValue:!1});if(await Qe(a,t,e),a){l.info("\u{1F4E5} Please install Android Studio from: https://developer.android.com/studio"),l.info("\u{1F4A1} After installing Android Studio, set up the Android SDK");let s=await fe({message:"Have you installed Android Studio? (Choose No to continue with iOS only)",initialValue:!1});await Qe(s,t,e),s||l.info("\u{1F4F1} Continuing with iOS development only")}}await At(t,e,"check-prerequisites","checked")}async function aq(t,e,r,n){let o=Dt(),i=r,a=0,s=5;for(;a<s;){let u=await fe({message:`Add ${i} in Capgo?`});if(await Qe(u,t.gid,e),!u)return l.info(`If you change your mind, run it for yourself with: "${o.runner} @capgo/cli@latest app add ${i}"`),await At(t.gid,e,"add-app",i),i;try{let c=_e();return c.start(`Running: ${o.runner} @capgo/cli@latest app add ${i}`),await Wg(i,n,t,!0)?c.stop("App add Done \u2705"):c.stop("App already add \u2705"),await At(t.gid,e,"add-app",i),i}catch(c){if((c instanceof Error?c.message:String(c)).includes("already exist")){a++,l.error(`\u274C App ID "${i}" is already taken`);let d=[`${r}2`,`${r}3`,`${r}.new`,`${r}.app`];l.info("\u{1F4A1} Here are some suggestions:"),d.forEach((p,m)=>{l.info(` ${m+1}. ${p}`)});let h=await mt({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${d[0]}`},{value:"suggest2",label:`Use ${d[1]}`},{value:"suggest3",label:`Use ${d[2]}`},{value:"suggest4",label:`Use ${d[3]}`},{value:"custom",label:"Enter a custom app ID"},{value:"cancel",label:"Cancel onboarding"}]});if(le(h)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
300
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),h==="cancel"&&(await Ct("onboarding-v2",t.gid,e,"canceled-appid-conflict","\u{1F937}"),G(`Bye \u{1F44B}
301
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),h==="custom"){let p=await qt({message:"Enter your custom app ID (e.g., com.example.myapp):",validate:m=>{if(!m)return"App ID is required";if(m.includes("--"))return'App ID cannot contain "--"';if(!/^[a-z0-9]+(?:\.[\w-]+)+$/i.test(m))return"Invalid format. Use reverse domain notation (e.g., com.example.app)"}});le(p)&&(await Ct("onboarding-v2",t.gid,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
302
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),i=p}else{let p=Number.parseInt(h.replace("suggest",""))-1;i=d[p]}l.info(`\u{1F504} Trying with new app ID: ${i}`);continue}throw c}}l.error(`\u274C Maximum retry attempts (${s}) reached`),G(`Bye \u{1F44B}
303
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)(1)}async function sq(t,e,r){let n=Dt(),o=await fe({message:`Create default channel ${tu} for ${r} in Capgo?`});if(await Qe(o,t,e),o){let i=_e();i.start(`Running: ${n.runner} @capgo/cli@latest channel add ${tu} ${r} --default`),await _y(tu,r,{default:!0,apikey:e},!0)?i.stop("Channel add Done \u2705"):i.stop("Channel already added \u2705")}else l.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${tu} ${r} --default"`);await At(t,e,"add-channel",r)}async function uq(t){let e=(0,Tr.join)(bt((0,ce.cwd)()),or),r=Yn?await Cr(void 0,Yn):await Cr(void 0,e);if(r.size===0||!r.has("@capacitor/core")){l.warn("No adequate dependencies found");let n=await fe({message:"Would you like to select the package.json file manually?"});if(le(n)&&(Xn("Operation cancelled."),(0,ce.exit)(1)),n){let o=await fe({message:"Would you like to use a tree selector to choose the package.json file?"});if(le(o)&&(Xn("Operation cancelled."),(0,ce.exit)(1)),o){let a=(0,ce.cwd)(),s=or;for(;;){let u=(0,Oe.readdirSync)(a).map(c=>({value:c,label:c}));if(u.push({value:"..",label:".."}),s=await mt({message:"Select package.json file:",options:u}),le(s)&&(Xn("Operation cancelled."),(0,ce.exit)(1)),!(0,Oe.statSync)((0,Tr.join)(a,s)).isDirectory()&&s!==or){l.error("Selected a file that is not a package.json file");continue}if(a=(0,Tr.join)(a,s),s===or)break}return await Mt(t,a),{dependencies:await Cr(void 0,a),path:a}}let i=await qt({message:"Enter path to node_modules folder:"});return le(i)&&(Xn("Operation cancelled."),(0,ce.exit)(1)),(0,Oe.existsSync)(i)||(l.error(`Path ${i} does not exist`),(0,ce.exit)(1)),{dependencies:await Cr(void 0,i),path:i}}}return await Mt(t,e),{dependencies:await Cr(void 0,e),path:e}}var cq="https://capacitorjs.com/docs/updating/5-0",lq="https://capacitorjs.com/docs/updating/6-0",fq="https://capacitorjs.com/docs/updating/7-0",dq="https://capacitorjs.com/docs/updating/8-0";async function pq(t,e,r){let n=Dt(),o="1.0.0",i=!1,a=await fe({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${r}?`});if(await Qe(a,t,e),a){let s=_e(),u="latest",{dependencies:c,path:f}=await uq(3);s.start("Checking if @capgo/capacitor-updater is installed"),c.has("@capacitor/core")||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json"),G(`Bye \u{1F44B}
304
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)());let d=c.get("@capacitor/core");if(d||(s.stop("Error"),l.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),G(`Bye \u{1F44B}
305
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),d==="latest"?(s.stop(`@capacitor/core version is ${d}, make sure to use a proper version, using Latest as value is not recommended and will lead to unexpected behavior`),G(`Bye \u{1F44B}
306
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()):er(De(d),De("5.0.0"))?(s.stop("Error"),l.warn(`@capacitor/core version is ${d}, Capgo only supports Capacitor v5 and above, please update to Capacitor v5 minimum: ${cq}`),G(`Bye \u{1F44B}
307
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()):er(De(d),De("6.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v5`),l.warn(`Consider upgrading to Capacitor v6 or higher to support the latest mobile OS features: ${lq}`),u="^5.0.0"):er(De(d),De("7.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v6`),l.warn(`Consider upgrading to Capacitor v7 or higher to support the latest mobile OS features: ${fq}`),u="^6.0.0"):er(De(d),De("8.0.0"))?(l.info(`@capacitor/core version is ${d}, installing compatible capacitor-updater v7`),l.warn(`Consider upgrading to Capacitor v8 to support the latest mobile OS features: ${dq}`),u="^7.0.0"):(l.info(`@capacitor/core version is ${d}, installing latest capacitor-updater v8+`),u="^8.0.0"),n.pm==="unknown"&&(s.stop("Error"),l.warn("Cannot recognize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),G(`Bye \u{1F44B}
308
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),await zr("@capgo/capacitor-updater",f.replace("/package.json",""),f))s.stop("Capgo already installed \u2705");else{await(0,Ea.execSync)(`${n.installCommand} --force @capgo/capacitor-updater@${u}`,{...Ty,cwd:f.replace("/package.json","")}),s.stop("Install Done \u2705"),o=Ir(void 0,f)||"1.0.0";let p=!1;u==="latest"&&(p=await fe({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 Qe(p,t,e)),s.start("Updating config file"),i=!!p;let m=p?{directUpdate:"always",autoSplashscreen:!0}:{};p&&await qg("SplashScreen",{launchAutoHide:!1}),await Ts({version:o,appId:r,autoUpdate:!0,...m}),s.stop("Config file updated \u2705")}}else l.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);return await At(t,e,"add-updater",r),{pkgVersion:o,delta:i}}async function hq(t,e,r){let n=await fe({message:`Automatic Add "${eu}" code and import in ${r}?`});if(await Qe(n,t,e),n){let o=_e();o.start("Adding @capacitor-updater to your main file");let i=await Zl();if(i==="nuxtjs-js"||i==="nuxtjs-ts"){let a=(0,Tr.join)("plugins");(0,Oe.existsSync)(a)||(0,Oe.mkdirSync)(a,{recursive:!0});let s;i==="nuxtjs-ts"?s=(0,Tr.join)(a,"capacitorUpdater.client.ts"):s=(0,Tr.join)(a,"capacitorUpdater.client.js");let u=`
307
309
  import { CapacitorUpdater } from '@capgo/capacitor-updater'
308
310
 
309
311
  export default defineNuxtPlugin(() => {
310
312
  CapacitorUpdater.notifyAppReady()
311
313
  })
312
- `;(0,Oe.existsSync)(s)?(0,Oe.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Updated capacitorUpdater.client.ts file with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await JA();else{let d=i.endsWith("-ts");a=await YA(i,d)}if(!a||!(0,Oe.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await qt({message:"Provide the correct relative path to your main file (JS or TS):",validate:p=>{if(!(0,Oe.existsSync)(p))return"File does not exist. Please provide a valid path."}});ue(d)&&(Jn("Operation cancelled."),(0,se.exit)(1)),a=d}let u=(0,Oe.readFileSync)(a,"utf8").toString(),f=u.match(J7)?.pop();if(f)if(u.includes(Qs))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(f,`${f}
313
- ${$y};
314
+ `;(0,Oe.existsSync)(s)?(0,Oe.readFileSync)(s,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(o.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Updated capacitorUpdater.client.ts file with required code")):((0,Oe.writeFileSync)(s,u,"utf8"),o.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),l.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let a;if(i==="unknown")a=await ZA();else{let d=i.endsWith("-ts");a=await XA(i,d)}if(!a||!(0,Oe.existsSync)(a)){o.stop("Cannot find main file to install Updater plugin");let d=await qt({message:"Provide the correct relative path to your main file (JS or TS):",validate:h=>{if(!(0,Oe.existsSync)(h))return"File does not exist. Please provide a valid path."}});le(d)&&(Xn("Operation cancelled."),(0,ce.exit)(1)),a=d}let u=(0,Oe.readFileSync)(a,"utf8").toString(),f=u.match(rq)?.pop();if(f)if(u.includes(eu))o.stop(`Code already added to ${a} \u2705`);else{let d=u.replace(f,`${f}
315
+ ${Iy};
314
316
 
315
- ${Qs};
316
- `);(0,Oe.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}else{o.stop("Cannot auto-inject code"),l.warn(`\u274C Cannot find import statements in ${a}`),l.info("\u{1F4A1} You'll need to add the code manually"),l.info("\u{1F4DD} Add this to your main file:"),l.info(` ${$y}`),l.info(` ${Qs}`),l.info("\u{1F4DA} Or follow: https://capgo.app/docs/getting-started/add-an-app/");let d=await ce({message:"Continue without auto-injecting the code? (You'll add it manually)"});await Ze(d,t,e),d||(G(`Bye \u{1F44B}
317
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),l.info("\u23ED\uFE0F Skipping auto-injection - remember to add the code manually!"),await At(t,e,"add-code-manual",r)}}await At(t,e,"add-code",r)}else l.info(`Add to your main file the following code:
317
+ ${eu};
318
+ `);(0,Oe.writeFileSync)(a,d,"utf8"),o.stop(`Code added to ${a} \u2705`)}else{o.stop("Cannot auto-inject code"),l.warn(`\u274C Cannot find import statements in ${a}`),l.info("\u{1F4A1} You'll need to add the code manually"),l.info("\u{1F4DD} Add this to your main file:"),l.info(` ${Iy}`),l.info(` ${eu}`),l.info("\u{1F4DA} Or follow: https://capgo.app/docs/getting-started/add-an-app/");let d=await fe({message:"Continue without auto-injecting the code? (You'll add it manually)"});await Qe(d,t,e),d||(G(`Bye \u{1F44B}
319
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),l.info("\u23ED\uFE0F Skipping auto-injection - remember to add the code manually!"),await At(t,e,"add-code-manual",r)}}await At(t,e,"add-code",r)}else l.info(`Add to your main file the following code:
318
320
 
319
- ${$y};
321
+ ${Iy};
320
322
 
321
- ${Qs};
322
- `)}async function cq(t,e,r){let o=(await Cr()).get("@capacitor/core");o||l.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=nt();l.info("\u{1F510} End-to-end encryption"),l.info(" \u2705 Use this for: Banking, healthcare, or apps with legal encryption requirements"),l.info(" \u26A0\uFE0F Note: Makes debugging harder - skip if you don't need it");let a=await ce({message:`Enable end-to-end encryption for ${r} updates?`,initialValue:!1});if(await Ze(a,t,e),a){if(o==="latest"){l.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&&er(ye(o),ye("6.0.0"))){l.warn("Encryption is not supported in Capacitor V5.");return}let s=_e();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await Fy({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),l.warn("Cannot create key \u274C"),G("Bye \u{1F44B}"),(0,se.exit)(1));try{await tf(!0,t,e),Ct("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await At(t,e,"add-encryption",r)}async function lq(t,e,r,n){let o=nt(),i=await ce({message:`Automatic build ${r} with "${o.pm} run build" ?`});if(await Ze(i,t,e),i){let a=_e();a.start("Checking project type");let s=await Xl(),u=await Hg(s);if(a.message(`Running: ${o.pm} run ${u} && ${o.runner} cap sync ${n}`),!Ug()[u]){a.stop("Missing build script"),l.warn(`\u274C Cannot find "${u}" script in package.json`),l.info(`\u{1F4A1} Your package.json needs a "${u}" script to build the app`);let f=await ce({message:"Would you like to skip the build for now and continue? You can build manually later."});if(await Ze(f,t,e),f){l.info(`\u23ED\uFE0F Skipping build step - you can build manually with: ${o.pm} run ${u}`),l.info(`\u{1F4DD} After building, run: ${o.runner} cap sync ${n}`),await At(t,e,"build-project-skipped",r);return}G(`Bye \u{1F44B}
323
- \u{1F4A1} Add a "${u}" script to package.json and run the command again`),(0,se.exit)()}(0,Ca.execSync)(`${o.pm} run ${u} && ${o.runner} cap sync ${n}`,Iy),a.stop("Build & Sync Done \u2705")}else l.info(`Build yourself with command: ${o.pm} run build && ${o.runner} cap sync ${n}`);await At(t,e,"build-project",r)}async function fq(t,e){l.info("\u{1F4F1} Platform selection for onboarding"),l.info(" This is just for testing during onboarding - your app will work on all platforms");let r=await gt({message:"Which platform do you want to test with during this onboarding?",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});ue(r)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
324
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let n=r;return l.info(`\u{1F3AF} Testing with: ${n.toUpperCase()}`),l.info(`\u{1F4A1} Note: Onboarding builds will use ${n} only`),await At(t,e,"select-platform",n),n}async function dq(t,e,r,n){let o=nt(),i=await ce({message:`Run ${r} on ${n.toUpperCase()} device now to test the initial version?`});if(await Ze(i,t,e),i){let a=_e();a.start(`Running: ${o.runner} cap run ${n}`),await(0,Ca.spawnSync)(o.runner,["cap","run",n],{stdio:"inherit"}),a.stop("App started \u2705"),l.info(`\u{1F4F1} Your app should now be running on your ${n} device with Capgo integrated`),l.info("\u{1F504} This is your baseline version - we'll create an update next")}else l.info(`If you change your mind, run it for yourself with: ${o.runner} cap run ${n}`);await At(t,e,"run-device",r)}async function pq(t,e,r,n,o){l.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let i=await gt({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(ue(i)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
325
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),i==="auto"){let d=_e();d.start("Making automatic changes to test Capgo updates");let p=!1,h=["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 m of h)if((0,Oe.existsSync)(m)&&!p)try{let g=(0,Oe.readFileSync)(m,"utf8"),D=g;if(m.endsWith(".html")?g.includes("<body>")&&!g.includes("capgo-test-banner")&&(D=g.replace("<body>",`<body>
323
+ ${eu};
324
+ `)}async function mq(t,e,r){let o=(await Cr()).get("@capacitor/core");o||l.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=Dt();l.info("\u{1F510} End-to-end encryption"),l.info(" \u2705 Use this for: Banking, healthcare, or apps with legal encryption requirements"),l.info(" \u26A0\uFE0F Note: Makes debugging harder - skip if you don't need it");let a=await fe({message:`Enable end-to-end encryption for ${r} updates?`,initialValue:!1});if(await Qe(a,t,e),a){if(o==="latest"){l.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&&er(De(o),De("6.0.0"))){l.warn("Encryption is not supported in Capacitor V5.");return}let s=_e();s.start(`Running: ${i.runner} @capgo/cli@latest key create`),await ky({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),l.warn("Cannot create key \u274C"),G("Bye \u{1F44B}"),(0,ce.exit)(1));try{await rf(!0,t,e),Ct("onboarding-v2",t,e,"Use encryption v2",r)}catch(c){if(!(c instanceof Error&&c.message==="Capacitor sync cancelled"))throw c}}await At(t,e,"add-encryption",r)}async function gq(t,e,r,n){let o=Dt(),i=await fe({message:`Automatic build ${r} with "${o.pm} run build" ?`});if(await Qe(i,t,e),i){let a=_e();a.start("Checking project type");let s=await Zl(),u=await Vg(s);if(a.message(`Running: ${o.pm} run ${u} && ${o.runner} cap sync ${n}`),!Mg()[u]){a.stop("Missing build script"),l.warn(`\u274C Cannot find "${u}" script in package.json`),l.info(`\u{1F4A1} Your package.json needs a "${u}" script to build the app`);let f=await fe({message:"Would you like to skip the build for now and continue? You can build manually later."});if(await Qe(f,t,e),f){l.info(`\u23ED\uFE0F Skipping build step - you can build manually with: ${o.pm} run ${u}`),l.info(`\u{1F4DD} After building, run: ${o.runner} cap sync ${n}`),await At(t,e,"build-project-skipped",r);return}G(`Bye \u{1F44B}
325
+ \u{1F4A1} Add a "${u}" script to package.json and run the command again`),(0,ce.exit)()}(0,Ea.execSync)(`${o.pm} run ${u} && ${o.runner} cap sync ${n}`,Ty),a.stop("Build & Sync Done \u2705")}else l.info(`Build yourself with command: ${o.pm} run build && ${o.runner} cap sync ${n}`);await At(t,e,"build-project",r)}async function yq(t,e){l.info("\u{1F4F1} Platform selection for onboarding"),l.info(" This is just for testing during onboarding - your app will work on all platforms");let r=await mt({message:"Which platform do you want to test with during this onboarding?",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});le(r)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
326
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)());let n=r;return l.info(`\u{1F3AF} Testing with: ${n.toUpperCase()}`),l.info(`\u{1F4A1} Note: Onboarding builds will use ${n} only`),await At(t,e,"select-platform",n),n}async function Dq(t,e,r,n){let o=Dt(),i=await fe({message:`Run ${r} on ${n.toUpperCase()} device now to test the initial version?`});if(await Qe(i,t,e),i){let a=_e();a.start(`Running: ${o.runner} cap run ${n}`),await(0,Ea.spawnSync)(o.runner,["cap","run",n],{stdio:"inherit"}),a.stop("App started \u2705"),l.info(`\u{1F4F1} Your app should now be running on your ${n} device with Capgo integrated`),l.info("\u{1F504} This is your baseline version - we'll create an update next")}else l.info(`If you change your mind, run it for yourself with: ${o.runner} cap run ${n}`);await At(t,e,"run-device",r)}async function bq(t,e,r,n,o){l.info("\u{1F3AF} Now let's test Capgo by making a visible change and deploying an update!");let i=await mt({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(le(i)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
327
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),i==="auto"){let d=_e();d.start("Making automatic changes to test Capgo updates");let h=!1,p=["src/index.html","public/index.html","index.html","src/App.vue","src/app/app.component.html","src/app/home/home.page.html","src/main.css","src/style.css","public/style.css"];for(let m of p)if((0,Oe.existsSync)(m)&&!h)try{let g=(0,Oe.readFileSync)(m,"utf8"),D=g;if(m.endsWith(".html")?g.includes("<body>")&&!g.includes("capgo-test-banner")&&(D=g.replace("<body>",`<body>
326
328
  <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));">
327
329
  \u{1F680} Capgo Update Test - This banner shows the update worked!
328
330
  </div>
@@ -337,110 +339,110 @@ body {
337
339
  /* capgo-test-background */
338
340
  }
339
341
 
340
- ${g}`)),D!==g){(0,Oe.writeFileSync)(m,D,"utf8"),d.stop(`\u2705 Made test changes to ${m}`),l.info("\u{1F4DD} Added visible test modification to verify the update works"),p=!0;break}}catch{}if(!p){d.stop("\u26A0\uFE0F Could not automatically modify files"),l.warn("Please make a visible change manually (like editing a text or color)");let m=await ce({message:"Continue after making your changes?"});await Ze(m,t,e)}}else{l.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),l.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let d=await ce({message:"Have you made your changes and ready to continue?"});await Ze(d,t,e)}let a="1.0.1";try{let d=ye(n);a=Vt(An(d,"patch"))}catch{a="1.0.1"}let s=await gt({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${a})`},{value:"manual",label:"Manual: I'll provide the version number"}]});ue(s)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
341
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)());let u=n;if(s==="auto")try{let d=ye(n);u=Vt(An(d,"patch")),l.info(`\u{1F522} Auto-bumped version from ${n} to ${u}`)}catch{u="1.0.1",l.warn(`Could not parse version ${n}, using fallback ${u}`)}else{let d=await qt({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)"}});ue(d)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
342
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)()),u=d}let c=nt(),f=await ce({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 Ze(f,t,e),f){let d=_e();d.start("Checking project type");let p=await Xl(),h=await Hg(p);if(d.message(`Running: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`),Ug()[h])(0,Ca.execSync)(`${c.pm} run ${h} && ${c.runner} cap sync ${o}`,Iy),d.stop("\u2705 Build with changes completed"),l.info("\u{1F4E6} Your modifications have been built and synced");else{d.stop("Missing build script"),l.warn(`\u274C Cannot find "${h}" script in package.json`),l.info("\u{1F4A1} Build manually in another terminal, then come back and continue");let g=await ce({message:"Have you built the app manually? (If not, we'll skip the build)"});await Ze(g,t,e),g?l.info("\u2705 Great! Continuing with your manual build"):(l.warn("\u26A0\uFE0F Continuing without build - upload may fail if app isn't built"),l.info(`\u{1F4A1} Build with: ${c.pm} run ${h} && ${c.runner} cap sync ${o}`))}}else l.info(`Build yourself with command: ${c.pm} run build && ${c.runner} cap sync ${o}`);return await At(t,e,"add-code-change",r),u}async function hq(t,e,r,n,o){let i=nt(),a=await ce({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Ze(a,t,e),a){let s=_e(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=UA((0,se.cwd)());Wn&&c&&(l.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"),l.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,Tr.join)(bt((0,se.cwd)()),"node_modules"),l.warn(`Guessed node modules path at: ${u}`),(0,Oe.existsSync)(u)||(l.error("Node modules path does not exist, upload skipped"),G(`Bye \u{1F44B}
343
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)(1))),(await Pf(r,{channel:eu,apikey:e,packageJson:c?Wn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),l.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),l.warn("Upload failed \u274C"),G(`Bye \u{1F44B}
344
- \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,se.exit)())}else l.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await At(t,e,"upload",r)}async function mq(t,e,r,n,o){l.info("\u{1F9EA} Time to test the Capgo update system!"),l.info("\u{1F4F1} Go to your device where the app is running"),o?(l.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),l.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(l.info("\u{1F4F1} With standard updates, you will need to:"),l.info(" 1. Background the app (swipe up/press home button) to start download"),l.info(" 2. Wait a few seconds for download to complete"),l.info(" 3. Background and foreground again to see the update")),l.info("\u{1F440} You should see your changes appear in the app!");let i=await ce({message:"Monitor Capgo logs to verify the update worked?"});await Ze(i,t,e),i?(l.info(`\u{1F4CA} Watching logs from ${r}...`),l.info("\u{1F504} Please background and reopen your app now to trigger the update"),await wm("onboarding-v2",e,r,e,t)):l.info(`\u{1F4CA} Check logs manually at ${n}/app/${r}/logs to verify the update`),await At(t,e,"test-update",r)}async function c2(t,e,r){let n=nt();ee("Capgo onboarding \u{1F6EB}"),await Ee();let o=!r.supaAnon||!r.supaHost?await te():await Is({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 br();e=pe(e,o?.config),r.apikey=t||ne(),e===void 0&&(e=await qt({message:"Enter your appId:"}),ue(e)&&(Jn("Operation cancelled."),(0,se.exit)(1)));let a=_e();(!a2()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await ky(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await re(r.apikey,r.supaHost,r.supaAnon);await ae(s,r.apikey,["upload","all","read","write"]);let u=await ua(s,["admin","super_admin"]),c=u.gid,f=await X7(c,r.apikey)??0,d=Ir(void 0,Wn)||"1.0.0",p=!1,h=d,m="ios";try{if(f<1&&(await Q7(c,r.apikey),Mt(1)),f<2&&(e=await eq(u,r.apikey,e,r),Mt(2)),f<3&&(await tq(c,r.apikey,e),Mt(3)),f<4){let g=await sq(c,r.apikey,e);d=g.pkgVersion,h=d,p=g.delta,Mt(4)}f<5&&(await uq(c,r.apikey,e),Mt(5)),f<6&&(await cq(c,r.apikey,e),Mt(6)),f<7&&(m=await fq(c,r.apikey),Mt(7)),f<8&&(await lq(c,r.apikey,e,m),Mt(8)),f<9&&(await dq(c,r.apikey,e,m),Mt(9)),f<10&&(h=await pq(c,r.apikey,e,d,m),Mt(10)),f<11&&(await hq(c,r.apikey,e,h,p),Mt(11)),f<12&&(await mq(c,r.apikey,e,i.hostWeb,p),Mt(12)),f<13&&Mt(13),await At(c,r.apikey,"done",e),Z7()}catch(g){console.error(g),l.error(`Error during onboarding.
342
+ ${g}`)),D!==g){(0,Oe.writeFileSync)(m,D,"utf8"),d.stop(`\u2705 Made test changes to ${m}`),l.info("\u{1F4DD} Added visible test modification to verify the update works"),h=!0;break}}catch{}if(!h){d.stop("\u26A0\uFE0F Could not automatically modify files"),l.warn("Please make a visible change manually (like editing a text or color)");let m=await fe({message:"Continue after making your changes?"});await Qe(m,t,e)}}else{l.info("\u270B Please make a visible change to your app now (example: change a text, color, or add an element)"),l.info("\u{1F4A1} This change will help you see that Capgo updates work correctly");let d=await fe({message:"Have you made your changes and ready to continue?"});await Qe(d,t,e)}let a="1.0.1";try{let d=De(n);a=Vt(An(d,"patch"))}catch{a="1.0.1"}let s=await mt({message:"How do you want to handle the version for this update?",options:[{value:"auto",label:`Auto: Bump patch version (${n} \u2192 ${a})`},{value:"manual",label:"Manual: I'll provide the version number"}]});le(s)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
343
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)());let u=n;if(s==="auto")try{let d=De(n);u=Vt(An(d,"patch")),l.info(`\u{1F522} Auto-bumped version from ${n} to ${u}`)}catch{u="1.0.1",l.warn(`Could not parse version ${n}, using fallback ${u}`)}else{let d=await qt({message:`Current version is ${n}. Enter new version:`,validate:h=>{if(!h.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});le(d)&&(await Ct("onboarding-v2",t,e,"canceled","\u{1F937}"),G(`Bye \u{1F44B}
344
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)()),u=d}let c=Dt(),f=await fe({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 Qe(f,t,e),f){let d=_e();d.start("Checking project type");let h=await Zl(),p=await Vg(h);if(d.message(`Running: ${c.pm} run ${p} && ${c.runner} cap sync ${o}`),Mg()[p])(0,Ea.execSync)(`${c.pm} run ${p} && ${c.runner} cap sync ${o}`,Ty),d.stop("\u2705 Build with changes completed"),l.info("\u{1F4E6} Your modifications have been built and synced");else{d.stop("Missing build script"),l.warn(`\u274C Cannot find "${p}" script in package.json`),l.info("\u{1F4A1} Build manually in another terminal, then come back and continue");let g=await fe({message:"Have you built the app manually? (If not, we'll skip the build)"});await Qe(g,t,e),g?l.info("\u2705 Great! Continuing with your manual build"):(l.warn("\u26A0\uFE0F Continuing without build - upload may fail if app isn't built"),l.info(`\u{1F4A1} Build with: ${c.pm} run ${p} && ${c.runner} cap sync ${o}`))}}else l.info(`Build yourself with command: ${c.pm} run build && ${c.runner} cap sync ${o}`);return await At(t,e,"add-code-change",r),u}async function wq(t,e,r,n,o){let i=Dt(),a=await fe({message:`Upload the updated ${r} bundle (v${n}) to Capgo?`});if(await Qe(a,t,e),a){let s=_e(),u;s.start(`Running: ${i.runner} @capgo/cli@latest bundle upload ${o?"--delta-only":""}`);let c=MA((0,ce.cwd)());Yn&&c&&(l.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"),l.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,Tr.join)(bt((0,ce.cwd)()),"node_modules"),l.warn(`Guessed node modules path at: ${u}`),(0,Oe.existsSync)(u)||(l.error("Node modules path does not exist, upload skipped"),G(`Bye \u{1F44B}
345
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)(1))),(await Pf(r,{channel:tu,apikey:e,packageJson:c?Yn:void 0,nodeModules:c?u:void 0,deltaOnly:o,bundle:n},!1))?.success?(s.stop(`\u2705 Update v${n} uploaded successfully!`),l.info("\u{1F389} Your updated bundle is now available on Capgo")):(s.stop("Error"),l.warn("Upload failed \u274C"),G(`Bye \u{1F44B}
346
+ \u{1F4A1} You can resume the onboarding anytime by running the same command again`),(0,ce.exit)())}else l.info(`Upload yourself with command: ${i.runner} @capgo/cli@latest bundle upload`);await At(t,e,"upload",r)}async function vq(t,e,r,n,o){l.info("\u{1F9EA} Time to test the Capgo update system!"),l.info("\u{1F4F1} Go to your device where the app is running"),o?(l.info("\u{1F504} IMPORTANT: Background your app (swipe up/press home button) and then reopen it"),l.info("\u23F1\uFE0F The update should be downloaded and applied automatically")):(l.info("\u{1F4F1} With standard updates, you will need to:"),l.info(" 1. Background the app (swipe up/press home button) to start download"),l.info(" 2. Wait a few seconds for download to complete"),l.info(" 3. Background and foreground again to see the update")),l.info("\u{1F440} You should see your changes appear in the app!");let i=await fe({message:"Monitor Capgo logs to verify the update worked?"});await Qe(i,t,e),i?(l.info(`\u{1F4CA} Watching logs from ${r}...`),l.info("\u{1F504} Please background and reopen your app now to trigger the update"),await vm("onboarding-v2",e,r,e,t)):l.info(`\u{1F4CA} Check logs manually at ${n}/app/${r}/logs to verify the update`),await At(t,e,"test-update",r)}async function p2(t,e,r){let n=Dt();ee("Capgo onboarding \u{1F6EB}"),await Ee();let o=!r.supaAnon||!r.supaHost?await te():await Ts({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 br();e=he(e,o?.config),r.apikey=t||oe(),e===void 0&&(e=await qt({message:"Enter your appId:"}),le(e)&&(Xn("Operation cancelled."),(0,ce.exit)(1)));let a=_e();(!l2()||t)&&(a.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await $y(r.apikey,r,!1),a.stop("Login Done \u2705"));let s=await ne(r.apikey,r.supaHost,r.supaAnon);await ue(s,r.apikey,["upload","all","read","write"]);let u=await ca(s,["admin","super_admin"]),c=u.gid,f=await nq(c,r.apikey)??0,d=Ir(void 0,Yn)||"1.0.0",h=!1,p=d,m="ios";try{if(f<1&&(await iq(c,r.apikey),Mt(1)),f<2&&(e=await aq(u,r.apikey,e,r),Mt(2)),f<3&&(await sq(c,r.apikey,e),Mt(3)),f<4){let g=await pq(c,r.apikey,e);d=g.pkgVersion,p=d,h=g.delta,Mt(4)}f<5&&(await hq(c,r.apikey,e),Mt(5)),f<6&&(await mq(c,r.apikey,e),Mt(6)),f<7&&(m=await yq(c,r.apikey),Mt(7)),f<8&&(await gq(c,r.apikey,e,m),Mt(8)),f<9&&(await Dq(c,r.apikey,e,m),Mt(9)),f<10&&(p=await bq(c,r.apikey,e,d,m),Mt(10)),f<11&&(await wq(c,r.apikey,e,p,h),Mt(11)),f<12&&(await vq(c,r.apikey,e,i.hostWeb,h),Mt(12)),f<13&&Mt(13),await At(c,r.apikey,"done",e),oq()}catch(g){console.error(g),l.error(`Error during onboarding.
345
347
  if the error persists please contact support@capgo.app
346
- Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,se.exit)(1)}l.info("Welcome onboard \u2708\uFE0F!"),l.info("Your Capgo update system is setup"),l.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),l.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),G("Bye \u{1F44B}"),(0,se.exit)()}async function gq(t,e=!1){e||ee("Adding organization"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await qt({message:"Organization name:",placeholder:"My Organization"});if(ue(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await qt({message:"Management email:",placeholder:"admin@example.com"});if(ue(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||l.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||l.error(`Could not add organization ${M(u)}`),new Error(`Could not add organization: ${M(u)}`);return await ge(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(l.success(`Organization "${i}" added to Capgo`),G("Done \u2705")),s}async function Ty(t){await gq(t,!1)}async function yq(t,e,r=!1){r||ee("Deleting organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${M(s)}`),new Error(`Cannot get organization details: ${M(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");l.warn("Deleting an organization is restricted to the organization owner"),l.warn("You are not the owner of this organization"),l.warn("It's strongly recommended that you do not continue!");let c=await gt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(ue(c)||c==="no")throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await ce({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(ue(c)||!c)throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||l.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||l.error(`Could not delete organization ${M(u)}`),new Error(`Could not delete organization: ${M(u)}`);return await ge(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(l.success(`Organization "${a.name}" deleted from Capgo`),G("Done \u2705")),!0}async function Ry(t,e){await yq(t,e,!1)}function Dq(t,e){if(e)return;if(!t.length){l.error("No organizations found");return}let r=new ut;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"]);l.success("Organizations"),l.success(r.toString())}async function bq(t,e=!1){e||ee("List organizations"),await Ee();let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","write","all"]),e||l.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||l.error(`Cannot get organizations ${M(o)}`),new Error(`Cannot get organizations: ${M(o)}`);let a=i||[];return e||(l.info(`Organizations found: ${a.length}`),Dq(a,e),G("Done \u2705")),a}async function By(t){await bq(t,!1)}async function wq(t,e,r=!1){r||ee("Updating organization"),await Ee();let n={...e,apikey:e.apikey||ne()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||l.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 ae(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||l.error(`Cannot get organization details ${M(a)}`),new Error(`Cannot get organization details: ${M(a)}`);let{name:s,email:u}=n;if(!r&&!s){let f=await qt({message:"New organization name:",placeholder:i.name||"My Organization"});if(ue(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");s=f}if(!r&&!u){let f=await qt({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(ue(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");u=f}if(!s||!u)throw r||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||l.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||l.error(`Could not update organization ${M(c)}`),new Error(`Could not update organization: ${M(c)}`);return await ge(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(l.success("Organization updated"),G("Done \u2705")),{orgId:t,name:s,email:u}}async function Ny(t,e){await wq(t,e,!1)}async function vq(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||ne()};if(!r.apikey)throw e||l.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 ae(n,r.apikey,["read","all","write"]);return e||G(`Done \u2705: ${o}`),o}catch(n){throw e||l.error(`Error getting user id ${M(n)}`),n instanceof Error?n:new Error(String(n))}}async function l2(t){await vq(t,!1)}var W={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 with detailed logging"};at.name(dr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(dr.version,"-v, --version","output the current version");at.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
348
+ Or use manual installation: https://capgo.app/docs/getting-started/add-an-app/`),(0,ce.exit)(1)}l.info("Welcome onboard \u2708\uFE0F!"),l.info("Your Capgo update system is setup"),l.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),l.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),G("Bye \u{1F44B}"),(0,ce.exit)()}async function Cq(t,e=!1){e||ee("Adding organization"),await Ee();let r={...t,apikey:t.apikey||oe()};if(!r.apikey)throw e||l.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon),o=await ue(n,r.apikey,["write","all"]),{name:i,email:a}=r;if(!e&&!i){let c=await qt({message:"Organization name:",placeholder:"My Organization"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");i=c}if(!e&&!a){let c=await qt({message:"Management email:",placeholder:"admin@example.com"});if(le(c))throw l.error("Canceled adding organization"),new Error("Organization creation cancelled");a=c}if(!i||!a)throw e||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||l.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||l.error(`Could not add organization ${M(u)}`),new Error(`Could not add organization: ${M(u)}`);return await ye(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:s.id,tags:{"org-name":i},notify:!1}).catch(()=>{}),e||(l.success(`Organization "${i}" added to Capgo`),G("Done \u2705")),s}async function Ry(t){await Cq(t,!1)}async function Eq(t,e,r=!1){r||ee("Deleting organization"),await Ee();let n={...e,apikey:e.apikey||oe()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon),i=await ue(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||l.error(`Cannot get organization details ${M(s)}`),new Error(`Cannot get organization details: ${M(s)}`);if(a.created_by!==i){if(r)throw new Error("Deleting an organization is restricted to the organization owner");l.warn("Deleting an organization is restricted to the organization owner"),l.warn("You are not the owner of this organization"),l.warn("It's strongly recommended that you do not continue!");let c=await mt({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(le(c)||c==="no")throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await fe({message:`Are you sure you want to delete organization "${a.name}"? This action cannot be undone.`});if(le(c)||!c)throw l.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||l.info(`Deleting organization "${a.name}"`);let{error:u}=await o.from("orgs").delete().eq("id",t);if(u)throw r||l.error(`Could not delete organization ${M(u)}`),new Error(`Could not delete organization: ${M(u)}`);return await ye(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":a.name},notify:!1}).catch(()=>{}),r||(l.success(`Organization "${a.name}" deleted from Capgo`),G("Done \u2705")),!0}async function By(t,e){await Eq(t,e,!1)}function _q(t,e){if(e)return;if(!t.length){l.error("No organizations found");return}let r=new qe;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"]);l.success("Organizations"),l.success(r.toString())}async function Sq(t,e=!1){e||ee("List organizations"),await Ee();let r={...t,apikey:t.apikey||oe()};if(!r.apikey)throw e||l.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await ne(r.apikey,r.supaHost,r.supaAnon);await ue(n,r.apikey,["read","write","all"]),e||l.info("Getting organizations from Capgo");let{error:o,data:i}=await n.rpc("get_orgs_v6");if(o)throw e||l.error(`Cannot get organizations ${M(o)}`),new Error(`Cannot get organizations: ${M(o)}`);let a=i||[];return e||(l.info(`Organizations found: ${a.length}`),_q(a,e),G("Done \u2705")),a}async function Ny(t){await Sq(t,!1)}async function xq(t,e,r=!1){r||ee("Updating organization"),await Ee();let n={...e,apikey:e.apikey||oe()};if(!n.apikey)throw r||l.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||l.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let o=await ne(n.apikey,n.supaHost,n.supaAnon);await ue(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||l.error(`Cannot get organization details ${M(a)}`),new Error(`Cannot get organization details: ${M(a)}`);let{name:s,email:u}=n;if(!r&&!s){let f=await qt({message:"New organization name:",placeholder:i.name||"My Organization"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");s=f}if(!r&&!u){let f=await qt({message:"Management email:",placeholder:i.management_email||"admin@example.com"});if(le(f))throw l.error("Canceled updating organization"),new Error("Organization update cancelled");u=f}if(!s||!u)throw r||l.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||l.info(`Updating organization "${t}"`);let{error:c}=await o.from("orgs").update({name:s,management_email:u}).eq("id",t);if(c)throw r||l.error(`Could not update organization ${M(c)}`),new Error(`Could not update organization: ${M(c)}`);return await ye(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":s},notify:!1}).catch(()=>{}),r||(l.success("Organization updated"),G("Done \u2705")),{orgId:t,name:s,email:u}}async function Ly(t,e){await xq(t,e,!1)}async function Aq(t,e=!1){e||ee("Getting user id");let r={...t,apikey:t.apikey||oe()};if(!r.apikey)throw e||l.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 ne(r.apikey,r.supaHost,r.supaAnon),o=await ue(n,r.apikey,["read","all","write"]);return e||G(`Done \u2705: ${o}`),o}catch(n){throw e||l.error(`Error getting user id ${M(n)}`),n instanceof Error?n:new Error(String(n))}}async function h2(t){await Aq(t,!1)}var W={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 with detailed logging"};at.name(dr.name).description("\u{1F4E6} Manage packages and bundle versions in Capgo Cloud").version(dr.version,"-v, --version","output the current version");at.command("init [apikey] [appId]").alias("i").description(`\u{1F680} Initialize a new app in Capgo Cloud with step-by-step guidance.
347
349
 
348
350
  This includes adding code for updates, building, uploading your app, and verifying update functionality.
349
351
 
350
- Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(c2).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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);at.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.
352
+ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(p2).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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);at.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.
351
353
 
352
354
  This command helps diagnose issues with your setup.
353
355
 
354
- Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",W.packageJson).action(async(...t)=>{let e=t.at(-1);await dO(e)});at.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.
356
+ Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",W.packageJson).action(async(...t)=>{let e=t.at(-1);await mO(e)});at.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.
355
357
 
356
358
  Use --apikey=******** in any command to override it.
357
359
 
358
- Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(s2).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var Yn=at.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Yn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
360
+ Example: npx @capgo/cli@latest login YOUR_API_KEY`).action(f2).option("--local","Only save in local folder, git ignored for security.").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var Jn=at.command("bundle").description("\u{1F4E6} Manage app bundles for deployment in Capgo Cloud, including upload, compatibility checks, and encryption.");Jn.command("upload [appId]").alias("u").description(`\u2B06\uFE0F Upload a new app bundle to Capgo Cloud for distribution.
359
361
 
360
362
  Version must be > 0.0.0 and unique. Deleted versions cannot be reused for security.
361
363
 
362
364
  External option: Store only a URL link (useful for apps >200MB or privacy requirements).
363
365
  Capgo never inspects external content. Add encryption for trustless security.
364
366
 
365
- Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(Ff).option("-a, --apikey <apikey>",W.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>",W.packageJson).option("--node-modules <nodeModules>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon).option("--verbose",W.verbose);Yn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
367
+ Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(kf).option("-a, --apikey <apikey>",W.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>",W.packageJson).option("--node-modules <nodeModules>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon).option("--verbose",W.verbose);Jn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
366
368
 
367
- Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(MO).option("-a, --apikey <apikey>",W.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",W.packageJson).option("--node-modules <nodeModules>",W.nodeModules).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Yn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
369
+ Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action(VO).option("-a, --apikey <apikey>",W.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",W.packageJson).option("--node-modules <nodeModules>",W.nodeModules).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Jn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
368
370
 
369
- Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await YO(t,e,r)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Yn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
371
+ Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await ZO(t,e,r)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Jn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
370
372
 
371
- Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await XO(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Yn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
373
+ Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await e1(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Jn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
372
374
 
373
375
  Bundles linked to channels are preserved unless --ignore-channel is used.
374
376
 
375
- Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await UO(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Yn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
377
+ Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await HO(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Jn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
376
378
 
377
379
  Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
378
380
 
379
- Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(JO).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Yn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
381
+ Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(QO).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");Jn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
380
382
 
381
383
  Prints base64 session key for verification.
382
384
 
383
- Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(WO).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");Yn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
385
+ Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(XO).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");Jn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
384
386
 
385
387
  Returns checksum for use with encryption. Use --json for machine-readable output.
386
388
 
387
- Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(PF).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>",W.packageJson);var Ea=at.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");Ea.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.
389
+ Example: npx @capgo/cli@latest bundle zip com.example.app --path ./dist`).action(IF).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>",W.packageJson);var _a=at.command("app").description("\u{1F4F1} Manage your Capgo app settings and configurations in Capgo Cloud.");_a.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.
388
390
 
389
391
  All options can be guessed from config if not provided.
390
392
 
391
- Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(uO).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>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Ea.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
393
+ Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(fO).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>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);_a.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
392
394
 
393
- Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await cO(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Ea.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
395
+ Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await dO(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);_a.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
394
396
 
395
- Example: npx @capgo/cli@latest app list`).action(async t=>{await pO(t)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Ea.command("debug [appId]").action(pE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
397
+ Example: npx @capgo/cli@latest app list`).action(async t=>{await gO(t)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);_a.command("debug [appId]").action(hE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
396
398
 
397
399
  Optionally target a specific device for detailed diagnostics.
398
400
 
399
- Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",W.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Ea.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
401
+ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).option("-a, --apikey <apikey>",W.apikey).option("-d, --device <device>","The specific device ID to debug").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);_a.command("setting [path]").description(`\u2699\uFE0F Modify Capacitor configuration programmatically.
400
402
 
401
403
  Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
402
404
 
403
- 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(gO);Ea.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.
405
+ 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(bO);_a.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.
404
406
 
405
407
  Retention of 0 means infinite storage.
406
408
 
407
- Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await mO(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>",W.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--expose-metadata <exposeMetadata>","Expose bundle metadata (link and comment) to the plugin (true/false, default: false)").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var ru=at.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");ru.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
409
+ Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await DO(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>",W.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--expose-metadata <exposeMetadata>","Expose bundle metadata (link and comment) to the plugin (true/false, default: false)").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var nu=at.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");nu.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
408
410
 
409
- 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>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);ru.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
411
+ Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(TF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);nu.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
410
412
 
411
- Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await IF(t,e,r)}).option("-a, --apikey <apikey>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);ru.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
413
+ Example: npx @capgo/cli@latest channel delete production com.example.app`).action(async(t,e,r)=>{await BF(t,e,r)}).option("-a, --apikey <apikey>",W.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>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);nu.command("list [appId]").alias("l").description(`\u{1F4CB} List all channels configured for an app in Capgo Cloud to review distribution settings.
412
414
 
413
- Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await TF(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);ru.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
415
+ Example: npx @capgo/cli@latest channel list com.example.app`).action(async(t,e)=>{await NF(t,e)}).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);nu.command("currentBundle [channel] [appId]").description(`\u{1F4E6} Get the current bundle linked to a specific channel in Capgo Cloud for update tracking.
414
416
 
415
- Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await $F(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",W.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);ru.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, prod, emulator, device).
417
+ Example: npx @capgo/cli@latest channel currentBundle production com.example.app`).action(async(t,e,r)=>{await RF(t,e,r)}).option("-c, --channel <channel>","Channel to get the current bundle from").option("-a, --apikey <apikey>",W.apikey).option("--quiet","Only print the bundle version").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);nu.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, prod, emulator, device).
416
418
 
417
419
  One channel must be default.
418
420
 
419
- Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await BF(t,e,r)}).option("-a, --apikey <apikey>",W.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("--prod","Allow sending update to production devices").option("--no-prod","Disable sending update to production devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--device","Allow sending update to physical devices").option("--no-device","Disable sending update to physical devices").option("--package-json <packageJson>",W.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var Ly=at.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.");Ly.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
421
+ Example: npx @capgo/cli@latest channel set production com.example.app --bundle 1.0.0 --state default`).action(async(t,e,r)=>{await UF(t,e,r)}).option("-a, --apikey <apikey>",W.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("--prod","Allow sending update to production devices").option("--no-prod","Disable sending update to production devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--device","Allow sending update to physical devices").option("--no-device","Disable sending update to physical devices").option("--package-json <packageJson>",W.packageJson).option("--ignore-metadata-check","Ignore checking node_modules compatibility if present in the bundle").option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var jy=at.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.");jy.command("save").description(`\u{1F4BE} Save the public key in the Capacitor config, useful for CI environments.
420
422
 
421
423
  Recommended not to commit the key for security.
422
424
 
423
- Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(n2).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");Ly.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
425
+ Example: npx @capgo/cli@latest key save --key ./path/to/key.pub`).action(s2).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");jy.command("create").description(`\u{1F528} Create RSA key pair for end-to-end encryption.
424
426
 
425
427
  Creates .capgo_key_v2 (private) and .capgo_key_v2.pub (public) in project root.
426
428
  Public key is saved to capacitor.config for mobile app decryption.
427
429
  NEVER commit the private key - store it securely!
428
430
 
429
- Example: npx @capgo/cli@latest key create`).action(o2).option("-f, --force","Force generate a new one");Ly.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
431
+ Example: npx @capgo/cli@latest key create`).action(u2).option("-f, --force","Force generate a new one");jy.command("delete_old").description(`\u{1F9F9} Delete the old encryption key from the Capacitor config to ensure only the current key is used.
430
432
 
431
- Example: npx @capgo/cli@latest key delete_old`).action(i2);var Cq=at.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");Cq.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
433
+ Example: npx @capgo/cli@latest key delete_old`).action(c2);var Oq=at.command("account").description("\u{1F464} Manage your Capgo account details and retrieve information for support or collaboration.");Oq.command("id").description(`\u{1FAAA} Retrieve your account ID, safe to share for collaboration or support purposes in Discord or other platforms.
432
434
 
433
- Example: npx @capgo/cli@latest account id`).action(l2).option("-a, --apikey <apikey>",W.apikey);var Bf=at.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");Bf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
435
+ Example: npx @capgo/cli@latest account id`).action(h2).option("-a, --apikey <apikey>",W.apikey);var Nf=at.command("organisation").description("\u{1F3E2} Manage your organizations in Capgo Cloud for team collaboration and app management.");Nf.command("list").alias("l").description(`\u{1F4CB} List all organizations you have access to in Capgo Cloud.
434
436
 
435
- Example: npx @capgo/cli@latest organisation list`).action(By).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Bf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
437
+ Example: npx @capgo/cli@latest organisation list`).action(Ny).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Nf.command("add").alias("a").description(`\u2795 Create a new organization in Capgo Cloud for team collaboration.
436
438
 
437
- Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Ty).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Bf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
439
+ Example: npx @capgo/cli@latest organisation add --name "My Company" --email admin@mycompany.com`).action(Ry).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Nf.command("set [orgId]").alias("s").description(`\u2699\uFE0F Update organization settings such as name and management email.
438
440
 
439
- Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(Ny).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Bf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
441
+ Example: npx @capgo/cli@latest organisation set ORG_ID --name "Updated Company Name"`).action(Ly).option("-n, --name <name>","Organization name").option("-e, --email <email>","Management email for the organization").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);Nf.command("delete [orgId]").alias("d").description(`\u{1F5D1}\uFE0F Delete an organization from Capgo Cloud. This action cannot be undone.
440
442
 
441
443
  Only organization owners can delete organizations.
442
444
 
443
- Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(Ry).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var f2=at.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
445
+ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(By).option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon);var m2=at.command("build").description(`\u{1F3D7}\uFE0F Manage native iOS/Android builds through Capgo Cloud.
444
446
 
445
447
  \u26A0\uFE0F This feature is currently in PUBLIC BETA and cannot be used by anyone at this time.
446
448
 
@@ -452,7 +454,7 @@ Example: npx @capgo/cli@latest organisation delete ORG_ID`).action(Ry).option("-
452
454
  \u{1F4CB} BEFORE BUILDING:
453
455
  Save your credentials first:
454
456
  npx @capgo/cli build credentials save --appId <your-app-id> --platform ios
455
- npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);f2.command("request [appId]").description(`Request a native build from Capgo Cloud.
457
+ npx @capgo/cli build credentials save --appId <your-app-id> --platform android`);m2.command("request [appId]").description(`Request a native build from Capgo Cloud.
456
458
 
457
459
  This command will zip your project directory and upload it to Capgo for building.
458
460
  The build will be processed and sent directly to app stores.
@@ -463,7 +465,7 @@ The build will be processed and sent directly to app stores.
463
465
  \u{1F4CB} PREREQUISITE: Save credentials first with:
464
466
  npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>
465
467
 
466
- Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(PO).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon).option("--verbose",W.verbose);var Nf=f2.command("credentials").description(`Manage build credentials stored locally on your machine.
468
+ Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(IO).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",W.apikey).option("--supa-host <supaHost>",W.supaHost).option("--supa-anon <supaAnon>",W.supaAnon).option("--verbose",W.verbose);var Lf=m2.command("credentials").description(`Manage build credentials stored locally on your machine.
467
469
 
468
470
  \u{1F512} SECURITY:
469
471
  - Credentials saved to ~/.capgo-credentials/credentials.json (global) or .capgo-credentials.json (local)
@@ -473,7 +475,7 @@ Example: npx @capgo/cli@latest build request com.example.app --platform ios --pa
473
475
 
474
476
  \u{1F4DA} DOCUMENTATION:
475
477
  iOS setup: https://capgo.app/docs/cli/cloud-build/ios/
476
- Android setup: https://capgo.app/docs/cli/cloud-build/android/`);Nf.command("save").description(`Save build credentials locally for iOS or Android.
478
+ Android setup: https://capgo.app/docs/cli/cloud-build/android/`);Lf.command("save").description(`Save build credentials locally for iOS or Android.
477
479
 
478
480
  Credentials are stored in:
479
481
  - ~/.capgo-credentials/credentials.json (default, global)
@@ -503,13 +505,13 @@ Android Example:
503
505
  --play-config ./service-account.json
504
506
 
505
507
  Local storage (per-project):
506
- npx @capgo/cli build credentials save --local --platform ios ...`).action(EO).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON").option("--local","Save to .capgo-credentials.json in project root instead of global ~/.capgo-credentials/");Nf.command("list").description(`List saved build credentials (passwords masked).
508
+ npx @capgo/cli build credentials save --local --platform ios ...`).action(xO).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON").option("--local","Save to .capgo-credentials.json in project root instead of global ~/.capgo-credentials/");Lf.command("list").description(`List saved build credentials (passwords masked).
507
509
 
508
510
  Shows what credentials are currently saved (both global and local).
509
511
 
510
512
  Examples:
511
513
  npx @capgo/cli build credentials list # List all apps
512
- npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(_O).option("--appId <appId>","App ID to list (optional, lists all if omitted)").option("--local","List credentials from local .capgo-credentials.json only");Nf.command("clear").description(`Clear saved build credentials.
514
+ npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(AO).option("--appId <appId>","App ID to list (optional, lists all if omitted)").option("--local","List credentials from local .capgo-credentials.json only");Lf.command("clear").description(`Clear saved build credentials.
513
515
 
514
516
  Remove credentials from storage.
515
517
  Use --appId and --platform to target specific credentials.
@@ -517,14 +519,14 @@ Use --appId and --platform to target specific credentials.
517
519
  Examples:
518
520
  npx @capgo/cli build credentials clear # Clear all apps (global)
519
521
  npx @capgo/cli build credentials clear --local # Clear local credentials
520
- npx @capgo/cli build credentials clear --appId com.example.app --platform ios`).action(SO).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)").option("--local","Clear from local .capgo-credentials.json instead of global");Nf.command("update").description(`Update specific credentials without providing all of them again.
522
+ npx @capgo/cli build credentials clear --appId com.example.app --platform ios`).action(OO).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)").option("--local","Clear from local .capgo-credentials.json instead of global");Lf.command("update").description(`Update specific credentials without providing all of them again.
521
523
 
522
524
  Update existing credentials by providing only the fields you want to change.
523
525
  Platform is auto-detected from the options you provide.
524
526
 
525
527
  Examples:
526
528
  npx @capgo/cli build credentials update --provisioning-profile ./new-profile.mobileprovision
527
- npx @capgo/cli build credentials update --local --keystore ./new-keystore.jks`).action(xO).option("--appId <appId>","App ID (auto-detected from capacitor.config if omitted)").option("--platform <platform>","Platform: ios or android (auto-detected from options)").option("--local","Update local .capgo-credentials.json instead of global").option("--certificate <path>","Path to P12 certificate file").option("--provisioning-profile <path>","Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","Path to production provisioning profile").option("--p12-password <password>","P12 certificate password").option("--apple-key <path>","Path to App Store Connect API key (.p8 file)").option("--apple-key-id <id>","App Store Connect API Key ID").option("--apple-issuer-id <id>","App Store Connect Issuer ID").option("--apple-profile-name <name>","Provisioning profile name").option("--apple-team-id <id>","App Store Connect Team ID").option("--keystore <path>","Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Keystore key alias").option("--keystore-key-password <password>","Keystore key password").option("--keystore-store-password <password>","Keystore store password").option("--play-config <path>","Path to Google Play service account JSON");at.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)=>{NF(t,e.folder)});at.exitOverride();at.configureOutput({writeErr:t=>{}});at.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Rf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Rf.exit)(r)}console.error(`Error: ${M(t)}`),(0,Rf.exit)(1)});
529
+ npx @capgo/cli build credentials update --local --keystore ./new-keystore.jks`).action(FO).option("--appId <appId>","App ID (auto-detected from capacitor.config if omitted)").option("--platform <platform>","Platform: ios or android (auto-detected from options)").option("--local","Update local .capgo-credentials.json instead of global").option("--certificate <path>","Path to P12 certificate file").option("--provisioning-profile <path>","Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","Path to production provisioning profile").option("--p12-password <password>","P12 certificate password").option("--apple-key <path>","Path to App Store Connect API key (.p8 file)").option("--apple-key-id <id>","App Store Connect API Key ID").option("--apple-issuer-id <id>","App Store Connect Issuer ID").option("--apple-profile-name <name>","Provisioning profile name").option("--apple-team-id <id>","App Store Connect Team ID").option("--keystore <path>","Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Keystore key alias").option("--keystore-key-password <password>","Keystore key password").option("--keystore-store-password <password>","Keystore store password").option("--play-config <path>","Path to Google Play service account JSON");at.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)=>{MF(t,e.folder)});at.exitOverride();at.configureOutput({writeErr:t=>{}});at.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Bf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Bf.exit)(r)}console.error(`Error: ${M(t)}`),(0,Bf.exit)(1)});
528
530
  /*! Bundled license information:
529
531
 
530
532
  tus-js-client/lib.es5/upload.js: