@capgo/cli 7.31.1 → 7.33.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/src/sdk.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var $q=Object.create;var yl=Object.defineProperty;var Lq=Object.getOwnPropertyDescriptor;var jq=Object.getOwnPropertyNames;var Bq=Object.getPrototypeOf,Mq=Object.prototype.hasOwnProperty;var Nr=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fm=(t,e)=>{for(var r in e)yl(t,r,{get:e[r],enumerable:!0})},kv=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jq(e))!Mq.call(t,i)&&i!==r&&yl(t,i,{get:()=>e[i],enumerable:!(n=Lq(e,i))||n.enumerable});return t};var Oe=(t,e,r)=>(r=t!=null?$q(Bq(t)):{},kv(e||!t||!t.__esModule?yl(r,"default",{value:t,enumerable:!0}):r,t)),ue=t=>kv(yl({},"__esModule",{value:!0}),t);var Je=v((hde,Nv)=>{"use strict";var hm={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"},qq={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},Uq={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?hm.up():"");return t&&(e+=hm.left),e}};Nv.exports={cursor:hm,scroll:qq,erase:Uq,beep:"\x07"}});var pm=v((dde,dm)=>{var wl=process||{},$v=wl.argv||[],Dl=wl.env||{},Hq=!(Dl.NO_COLOR||$v.includes("--no-color"))&&(!!Dl.FORCE_COLOR||$v.includes("--color")||wl.platform==="win32"||(wl.stdout||{}).isTTY&&Dl.TERM!=="dumb"||!!Dl.CI),Vq=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+zq(i,e,r,s)+e:t+i+e},zq=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},Lv=(t=Hq)=>{let e=t?Vq:()=>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")}};dm.exports=Lv();dm.exports.createColors=Lv});var xl=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.isNXMonorepo=mr.isMonorepo=mr.findPackageRelativePathInMonorepo=mr.findPackagePath=mr.findNXMonorepoRoot=mr.findMonorepoRoot=void 0;var fu=require("node:fs"),Ei=require("node:path");function Ol(t){let e=(0,Ei.join)(t,"package.json"),r=(0,Ei.join)(t,"pnpm-workspace.yaml");if((0,fu.existsSync)(r)||(0,fu.existsSync)(e)&&JSON.parse((0,fu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ei.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Ol(n)}mr.findMonorepoRoot=Ol;function Om(t){let e=(0,Ei.join)(t,"nx.json");if((0,fu.existsSync)(e))return t;let r=(0,Ei.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Om(r)}mr.findNXMonorepoRoot=Om;function xm(t,e,r){let n=(0,Ei.join)(e,"node_modules",t);if((0,fu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ei.dirname)(e);return xm(t,i,r)}mr.findPackagePath=xm;function _U(t,e){let r=Ol(e),n=xm(t,e,r);return n?(0,Ei.relative)(e,n):null}mr.findPackageRelativePathInMonorepo=_U;function CU(t){try{return Ol(t),!0}catch{return!1}}mr.isMonorepo=CU;function SU(t){try{return Om(t),!0}catch{return!1}}mr.isNXMonorepo=SU});var le={};fm(le,{__addDisposableResource:()=>q_,__assign:()=>Nl,__asyncDelegator:()=>R_,__asyncGenerator:()=>P_,__asyncValues:()=>k_,__await:()=>_o,__awaiter:()=>A_,__classPrivateFieldGet:()=>j_,__classPrivateFieldIn:()=>M_,__classPrivateFieldSet:()=>B_,__createBinding:()=>Ll,__decorate:()=>w_,__disposeResources:()=>U_,__esDecorate:()=>b_,__exportStar:()=>x_,__extends:()=>y_,__generator:()=>O_,__importDefault:()=>L_,__importStar:()=>$_,__makeTemplateObject:()=>N_,__metadata:()=>S_,__param:()=>E_,__propKey:()=>__,__read:()=>jm,__rest:()=>D_,__rewriteRelativeImportExtension:()=>H_,__runInitializers:()=>v_,__setFunctionName:()=>C_,__spread:()=>T_,__spreadArray:()=>F_,__spreadArrays:()=>I_,__values:()=>$l,default:()=>XU});function y_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$m(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function D_(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 i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function w_(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function E_(t,e){return function(r,n){e(r,n,t)}}function b_(t,e,r,n,i,s){function o(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var a=n.kind,u=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h,d=!1,f=r.length-1;f>=0;f--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(C){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(C||null))};var E=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(E===void 0)continue;if(E===null||typeof E!="object")throw new TypeError("Object expected");(h=o(E.get))&&(l.get=h),(h=o(E.set))&&(l.set=h),(h=o(E.init))&&i.unshift(h)}else(h=o(E))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function v_(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0}function __(t){return typeof t=="symbol"?t:"".concat(t)}function C_(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 S_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function A_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(n.next(l))}catch(h){o(h)}}function u(l){try{c(n.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function O_(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],i=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function x_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ll(e,t,r)}function $l(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 jm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function T_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(jm(arguments[e]));return t}function I_(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function F_(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function _o(t){return this instanceof _o?(this.v=t,this):new _o(t)}function P_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(f){return function(m){return Promise.resolve(m).then(f,h)}}function a(f,m){n[f]&&(i[f]=function(y){return new Promise(function(E,C){s.push([f,y,E,C])>1||u(f,y)})},m&&(i[f]=m(i[f])))}function u(f,m){try{c(n[f](m))}catch(y){d(s[0][3],y)}}function c(f){f.value instanceof _o?Promise.resolve(f.value.v).then(l,h):d(s[0][2],f)}function l(f){u("next",f)}function h(f){u("throw",f)}function d(f,m){f(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function R_(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:_o(t[i](o)),done:!1}:s?s(o):o}:s}}function k_(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 $l=="function"?$l(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function N_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Lm(t),n=0;n<r.length;n++)r[n]!=="default"&&Ll(e,t,r[n]);return GU(e,t),e}function L_(t){return t&&t.__esModule?t:{default:t}}function j_(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 B_(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function M_(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 q_(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;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&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function U_(t){function e(s){t.error=t.hasError?new WU(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}var r,n=0;function i(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(i);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i()}function H_(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,i,s,o){return n?e?".jsx":".js":i&&(!s||!o)?r:i+s+"."+o.toLowerCase()+"js"}):t}var $m,Nl,Ll,GU,Lm,WU,XU,fe=Nr(()=>{$m=function(t,e){return $m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},$m(t,e)};Nl=function(){return Nl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Nl.apply(this,arguments)};Ll=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});GU=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Lm=function(t){return Lm=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Lm(t)};WU=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};XU={__extends:y_,__assign:Nl,__rest:D_,__decorate:w_,__param:E_,__esDecorate:b_,__runInitializers:v_,__propKey:__,__setFunctionName:C_,__metadata:S_,__awaiter:A_,__generator:O_,__createBinding:Ll,__exportStar:x_,__values:$l,__read:jm,__spread:T_,__spreadArrays:I_,__spreadArray:F_,__await:_o,__asyncGenerator:P_,__asyncDelegator:R_,__asyncValues:k_,__makeTemplateObject:N_,__importStar:$_,__importDefault:L_,__classPrivateFieldGet:j_,__classPrivateFieldSet:B_,__classPrivateFieldIn:M_,__addDisposableResource:q_,__disposeResources:U_,__rewriteRelativeImportExtension:H_}});var V_=v(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.resolveFetch=void 0;var YU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);jl.resolveFetch=YU});var Um=v(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.FunctionRegion=jr.FunctionsHttpError=jr.FunctionsRelayError=jr.FunctionsFetchError=jr.FunctionsError=void 0;var Co=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};jr.FunctionsError=Co;var Bm=class extends Co{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};jr.FunctionsFetchError=Bm;var Mm=class extends Co{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};jr.FunctionsRelayError=Mm;var qm=class extends Co{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};jr.FunctionsHttpError=qm;var z_;(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"})(z_||(jr.FunctionRegion=z_={}))});var K_=v(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.FunctionsClient=void 0;var JU=(fe(),ue(le)),ZU=V_(),cs=Um(),Hm=class{constructor(e,{headers:r={},customFetch:n,region:i=cs.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,ZU.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return JU.__awaiter(this,arguments,void 0,function*(r,n={}){var i;try{let{headers:s,method:o,body:a,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let h=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,h.searchParams.set("forceFunctionRegion",l));let d;a&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=a):typeof a=="string"?(c["Content-Type"]="text/plain",d=a):typeof FormData<"u"&&a instanceof FormData?d=a:(c["Content-Type"]="application/json",d=JSON.stringify(a)):d=a;let f=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),s),body:d,signal:u}).catch(C=>{throw C.name==="AbortError"?C:new cs.FunctionsFetchError(C)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new cs.FunctionsRelayError(f);if(!f.ok)throw new cs.FunctionsHttpError(f);let y=((i=f.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),E;return y==="application/json"?E=yield f.json():y==="application/octet-stream"||y==="application/pdf"?E=yield f.blob():y==="text/event-stream"?E=f:y==="multipart/form-data"?E=yield f.formData():E=yield f.text(),{data:E,error:null,response:f}}catch(s){return s instanceof Error&&s.name==="AbortError"?{data:null,error:new cs.FunctionsFetchError(s)}:{data:null,error:s,response:s instanceof cs.FunctionsHttpError||s instanceof cs.FunctionsRelayError?s.context:void 0}}})}};Bl.FunctionsClient=Hm});var Vm=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.FunctionRegion=gr.FunctionsRelayError=gr.FunctionsHttpError=gr.FunctionsFetchError=gr.FunctionsError=gr.FunctionsClient=void 0;var QU=K_();Object.defineProperty(gr,"FunctionsClient",{enumerable:!0,get:function(){return QU.FunctionsClient}});var mu=Um();Object.defineProperty(gr,"FunctionsError",{enumerable:!0,get:function(){return mu.FunctionsError}});Object.defineProperty(gr,"FunctionsFetchError",{enumerable:!0,get:function(){return mu.FunctionsFetchError}});Object.defineProperty(gr,"FunctionsHttpError",{enumerable:!0,get:function(){return mu.FunctionsHttpError}});Object.defineProperty(gr,"FunctionsRelayError",{enumerable:!0,get:function(){return mu.FunctionsRelayError}});Object.defineProperty(gr,"FunctionRegion",{enumerable:!0,get:function(){return mu.FunctionRegion}})});var Gm=v(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var zm=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Km.default=zm});var Ym=v(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var e4=(fe(),ue(le)),t4=e4.__importDefault(Gm()),Wm=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,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,u,c;let l=null,h=null,d=null,f=s.status,m=s.statusText;if(s.ok){if(this.method!=="HEAD"){let A=await s.text();A===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=A:h=JSON.parse(A))}let E=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),C=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");E&&C&&C.length>1&&(d=parseInt(C[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(l={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,d=null,f=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{let E=await s.text();try{l=JSON.parse(E),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,m="OK")}catch{s.status===404&&E===""?(f=204,m="No Content"):l={message:E}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,m="OK"),l&&this.shouldThrowOnError)throw new t4.default(l)}return{error:l,data:h,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u;return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:`${(a=s?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(u=s?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,r)}returns(){return this}overrideTypes(){return this}};Xm.default=Wm});var Qm=v(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});var r4=(fe(),ue(le)),n4=r4.__importDefault(Ym()),Jm=class extends n4.default{select(e){let r=!1,n=(e??"*").split("").map(i=>/\s/.test(i)&&!r?"":(i==='"'&&(r=!r),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:i,referencedTable:s=i}={}){let o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:i=n}={}){let s=typeof i>"u"?"offset":`${i}.offset`,o=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${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:i=!1,wal:s=!1,format:o="text"}={}){var a;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${u};`),o==="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}};Zm.default=Jm});var Ml=v(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});var i4=(fe(),ue(le)),s4=i4.__importDefault(Qm()),o4=new RegExp("[,()]"),eg=class extends s4.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(i=>typeof i=="string"&&o4.test(i)?`"${i}"`:`${i}`).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:i}={}){let s="";i==="plain"?s="pl":i==="phrase"?s="ph":i==="websearch"&&(s="w");let o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${o}.${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 i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};tg.default=eg});var ig=v(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});var a4=(fe(),ue(le)),gu=a4.__importDefault(Ml()),rg=class{constructor(e,{headers:r={},schema:n,fetch:i}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=i}select(e,r){let{head:n=!1,count:i}=r??{},s=n?"HEAD":"GET",o=!1,a=(e??"*").split("").map(u=>/\s/.test(u)&&!o?"":(u==='"'&&(o=!o),u)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new gu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var i;let s="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let o=e.reduce((a,u)=>a.concat(Object.keys(u)),[]);if(o.length>0){let a=[...new Set(o)].map(u=>`"${u}"`);this.url.searchParams.set("columns",a.join(","))}}return new gu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:i,defaultToNull:s=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),i&&this.headers.append("Prefer",`count=${i}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new gu.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:r}={}){var n;let i="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new gu.default({method:i,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 gu.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};ng.default=rg});var W_=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var G_=(fe(),ue(le)),u4=G_.__importDefault(ig()),c4=G_.__importDefault(Ml()),sg=class t{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){let r=new URL(`${this.url}/${e}`);return new u4.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:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new c4.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};og.default=sg});var ag=v(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.PostgrestError=tr.PostgrestBuilder=tr.PostgrestTransformBuilder=tr.PostgrestFilterBuilder=tr.PostgrestQueryBuilder=tr.PostgrestClient=void 0;var So=(fe(),ue(le)),X_=So.__importDefault(W_());tr.PostgrestClient=X_.default;var Y_=So.__importDefault(ig());tr.PostgrestQueryBuilder=Y_.default;var J_=So.__importDefault(Ml());tr.PostgrestFilterBuilder=J_.default;var Z_=So.__importDefault(Qm());tr.PostgrestTransformBuilder=Z_.default;var Q_=So.__importDefault(Ym());tr.PostgrestBuilder=Q_.default;var eC=So.__importDefault(Gm());tr.PostgrestError=eC.default;tr.default={PostgrestClient:X_.default,PostgrestQueryBuilder:Y_.default,PostgrestFilterBuilder:J_.default,PostgrestTransformBuilder:Z_.default,PostgrestBuilder:Q_.default,PostgrestError:eC.default}});var ug=v(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.WebSocketFactory=void 0;var ql=class{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){let r=process.versions;if(r&&r.node){let n=r.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
1
+ "use strict";var $q=Object.create;var yl=Object.defineProperty;var Lq=Object.getOwnPropertyDescriptor;var jq=Object.getOwnPropertyNames;var Bq=Object.getPrototypeOf,Mq=Object.prototype.hasOwnProperty;var $r=(t,e)=>()=>(t&&(e=t(t=0)),e);var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fm=(t,e)=>{for(var r in e)yl(t,r,{get:e[r],enumerable:!0})},kv=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jq(e))!Mq.call(t,i)&&i!==r&&yl(t,i,{get:()=>e[i],enumerable:!(n=Lq(e,i))||n.enumerable});return t};var Oe=(t,e,r)=>(r=t!=null?$q(Bq(t)):{},kv(e||!t||!t.__esModule?yl(r,"default",{value:t,enumerable:!0}):r,t)),ue=t=>kv(yl({},"__esModule",{value:!0}),t);var Je=v((hde,Nv)=>{"use strict";var hm={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"},qq={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},Uq={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?hm.up():"");return t&&(e+=hm.left),e}};Nv.exports={cursor:hm,scroll:qq,erase:Uq,beep:"\x07"}});var pm=v((dde,dm)=>{var wl=process||{},$v=wl.argv||[],Dl=wl.env||{},Hq=!(Dl.NO_COLOR||$v.includes("--no-color"))&&(!!Dl.FORCE_COLOR||$v.includes("--color")||wl.platform==="win32"||(wl.stdout||{}).isTTY&&Dl.TERM!=="dumb"||!!Dl.CI),Vq=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+zq(i,e,r,s)+e:t+i+e},zq=(t,e,r,n)=>{let i="",s=0;do i+=t.substring(s,n)+r,s=n+e.length,n=t.indexOf(e,s);while(~n);return i+t.substring(s)},Lv=(t=Hq)=>{let e=t?Vq:()=>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")}};dm.exports=Lv();dm.exports.createColors=Lv});var xl=v(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.isNXMonorepo=mr.isMonorepo=mr.findPackageRelativePathInMonorepo=mr.findPackagePath=mr.findNXMonorepoRoot=mr.findMonorepoRoot=void 0;var fu=require("node:fs"),Ei=require("node:path");function Ol(t){let e=(0,Ei.join)(t,"package.json"),r=(0,Ei.join)(t,"pnpm-workspace.yaml");if((0,fu.existsSync)(r)||(0,fu.existsSync)(e)&&JSON.parse((0,fu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ei.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Ol(n)}mr.findMonorepoRoot=Ol;function Om(t){let e=(0,Ei.join)(t,"nx.json");if((0,fu.existsSync)(e))return t;let r=(0,Ei.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Om(r)}mr.findNXMonorepoRoot=Om;function xm(t,e,r){let n=(0,Ei.join)(e,"node_modules",t);if((0,fu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ei.dirname)(e);return xm(t,i,r)}mr.findPackagePath=xm;function _U(t,e){let r=Ol(e),n=xm(t,e,r);return n?(0,Ei.relative)(e,n):null}mr.findPackageRelativePathInMonorepo=_U;function CU(t){try{return Ol(t),!0}catch{return!1}}mr.isMonorepo=CU;function SU(t){try{return Om(t),!0}catch{return!1}}mr.isNXMonorepo=SU});var le={};fm(le,{__addDisposableResource:()=>q_,__assign:()=>Nl,__asyncDelegator:()=>R_,__asyncGenerator:()=>P_,__asyncValues:()=>k_,__await:()=>_o,__awaiter:()=>A_,__classPrivateFieldGet:()=>j_,__classPrivateFieldIn:()=>M_,__classPrivateFieldSet:()=>B_,__createBinding:()=>Ll,__decorate:()=>w_,__disposeResources:()=>U_,__esDecorate:()=>b_,__exportStar:()=>x_,__extends:()=>y_,__generator:()=>O_,__importDefault:()=>L_,__importStar:()=>$_,__makeTemplateObject:()=>N_,__metadata:()=>S_,__param:()=>E_,__propKey:()=>__,__read:()=>jm,__rest:()=>D_,__rewriteRelativeImportExtension:()=>H_,__runInitializers:()=>v_,__setFunctionName:()=>C_,__spread:()=>T_,__spreadArray:()=>F_,__spreadArrays:()=>I_,__values:()=>$l,default:()=>XU});function y_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$m(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function D_(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 i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function w_(t,e,r,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function E_(t,e){return function(r,n){e(r,n,t)}}function b_(t,e,r,n,i,s){function o(S){if(S!==void 0&&typeof S!="function")throw new TypeError("Function expected");return S}for(var a=n.kind,u=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,l=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),h,d=!1,f=r.length-1;f>=0;f--){var m={};for(var y in n)m[y]=y==="access"?{}:n[y];for(var y in n.access)m.access[y]=n.access[y];m.addInitializer=function(S){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(S||null))};var E=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(E===void 0)continue;if(E===null||typeof E!="object")throw new TypeError("Object expected");(h=o(E.get))&&(l.get=h),(h=o(E.set))&&(l.set=h),(h=o(E.init))&&i.unshift(h)}else(h=o(E))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function v_(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0}function __(t){return typeof t=="symbol"?t:"".concat(t)}function C_(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 S_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function A_(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(l){try{c(n.next(l))}catch(h){o(h)}}function u(l){try{c(n.throw(l))}catch(h){o(h)}}function c(l){l.done?s(l.value):i(l.value).then(a,u)}c((n=n.apply(t,e||[])).next())})}function O_(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(l){return u([c,l])}}function u(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,i=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){r.label=c[1];break}if(c[0]===6&&r.label<s[1]){r.label=s[1],s=c;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(c);break}s[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],i=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function x_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ll(e,t,r)}function $l(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 jm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function T_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(jm(arguments[e]));return t}function I_(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var n=Array(t),i=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function F_(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function _o(t){return this instanceof _o?(this.v=t,this):new _o(t)}function P_(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(f){return function(m){return Promise.resolve(m).then(f,h)}}function a(f,m){n[f]&&(i[f]=function(y){return new Promise(function(E,S){s.push([f,y,E,S])>1||u(f,y)})},m&&(i[f]=m(i[f])))}function u(f,m){try{c(n[f](m))}catch(y){d(s[0][3],y)}}function c(f){f.value instanceof _o?Promise.resolve(f.value.v).then(l,h):d(s[0][2],f)}function l(f){u("next",f)}function h(f){u("throw",f)}function d(f,m){f(m),s.shift(),s.length&&u(s[0][0],s[0][1])}}function R_(t){var e,r;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,s){e[i]=t[i]?function(o){return(r=!r)?{value:_o(t[i](o)),done:!1}:s?s(o):o}:s}}function k_(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 $l=="function"?$l(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=t[s]&&function(o){return new Promise(function(a,u){o=t[s](o),i(a,u,o.done,o.value)})}}function i(s,o,a,u){Promise.resolve(u).then(function(c){s({value:c,done:a})},o)}}function N_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function $_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Lm(t),n=0;n<r.length;n++)r[n]!=="default"&&Ll(e,t,r[n]);return GU(e,t),e}function L_(t){return t&&t.__esModule?t:{default:t}}function j_(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 B_(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function M_(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 q_(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;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&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(s){return Promise.reject(s)}}),t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}function U_(t){function e(s){t.error=t.hasError?new WU(s,t.error,"An error was suppressed during disposal."):s,t.hasError=!0}var r,n=0;function i(){for(;r=t.stack.pop();)try{if(!r.async&&n===1)return n=0,t.stack.push(r),Promise.resolve().then(i);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return n|=2,Promise.resolve(s).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return i()}function H_(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,n,i,s,o){return n?e?".jsx":".js":i&&(!s||!o)?r:i+s+"."+o.toLowerCase()+"js"}):t}var $m,Nl,Ll,GU,Lm,WU,XU,fe=$r(()=>{$m=function(t,e){return $m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},$m(t,e)};Nl=function(){return Nl=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Nl.apply(this,arguments)};Ll=Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]});GU=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Lm=function(t){return Lm=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Lm(t)};WU=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};XU={__extends:y_,__assign:Nl,__rest:D_,__decorate:w_,__param:E_,__esDecorate:b_,__runInitializers:v_,__propKey:__,__setFunctionName:C_,__metadata:S_,__awaiter:A_,__generator:O_,__createBinding:Ll,__exportStar:x_,__values:$l,__read:jm,__spread:T_,__spreadArrays:I_,__spreadArray:F_,__await:_o,__asyncGenerator:P_,__asyncDelegator:R_,__asyncValues:k_,__makeTemplateObject:N_,__importStar:$_,__importDefault:L_,__classPrivateFieldGet:j_,__classPrivateFieldSet:B_,__classPrivateFieldIn:M_,__addDisposableResource:q_,__disposeResources:U_,__rewriteRelativeImportExtension:H_}});var V_=v(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});jl.resolveFetch=void 0;var YU=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);jl.resolveFetch=YU});var Um=v(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.FunctionRegion=Br.FunctionsHttpError=Br.FunctionsRelayError=Br.FunctionsFetchError=Br.FunctionsError=void 0;var Co=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Br.FunctionsError=Co;var Bm=class extends Co{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Br.FunctionsFetchError=Bm;var Mm=class extends Co{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Br.FunctionsRelayError=Mm;var qm=class extends Co{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Br.FunctionsHttpError=qm;var z_;(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"})(z_||(Br.FunctionRegion=z_={}))});var K_=v(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.FunctionsClient=void 0;var JU=(fe(),ue(le)),ZU=V_(),cs=Um(),Hm=class{constructor(e,{headers:r={},customFetch:n,region:i=cs.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,ZU.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return JU.__awaiter(this,arguments,void 0,function*(r,n={}){var i;try{let{headers:s,method:o,body:a,signal:u}=n,c={},{region:l}=n;l||(l=this.region);let h=new URL(`${this.url}/${r}`);l&&l!=="any"&&(c["x-region"]=l,h.searchParams.set("forceFunctionRegion",l));let d;a&&(s&&!Object.prototype.hasOwnProperty.call(s,"Content-Type")||!s)?typeof Blob<"u"&&a instanceof Blob||a instanceof ArrayBuffer?(c["Content-Type"]="application/octet-stream",d=a):typeof a=="string"?(c["Content-Type"]="text/plain",d=a):typeof FormData<"u"&&a instanceof FormData?d=a:(c["Content-Type"]="application/json",d=JSON.stringify(a)):d=a;let f=yield this.fetch(h.toString(),{method:o||"POST",headers:Object.assign(Object.assign(Object.assign({},c),this.headers),s),body:d,signal:u}).catch(S=>{throw S.name==="AbortError"?S:new cs.FunctionsFetchError(S)}),m=f.headers.get("x-relay-error");if(m&&m==="true")throw new cs.FunctionsRelayError(f);if(!f.ok)throw new cs.FunctionsHttpError(f);let y=((i=f.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),E;return y==="application/json"?E=yield f.json():y==="application/octet-stream"||y==="application/pdf"?E=yield f.blob():y==="text/event-stream"?E=f:y==="multipart/form-data"?E=yield f.formData():E=yield f.text(),{data:E,error:null,response:f}}catch(s){return s instanceof Error&&s.name==="AbortError"?{data:null,error:new cs.FunctionsFetchError(s)}:{data:null,error:s,response:s instanceof cs.FunctionsHttpError||s instanceof cs.FunctionsRelayError?s.context:void 0}}})}};Bl.FunctionsClient=Hm});var Vm=v(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.FunctionRegion=gr.FunctionsRelayError=gr.FunctionsHttpError=gr.FunctionsFetchError=gr.FunctionsError=gr.FunctionsClient=void 0;var QU=K_();Object.defineProperty(gr,"FunctionsClient",{enumerable:!0,get:function(){return QU.FunctionsClient}});var mu=Um();Object.defineProperty(gr,"FunctionsError",{enumerable:!0,get:function(){return mu.FunctionsError}});Object.defineProperty(gr,"FunctionsFetchError",{enumerable:!0,get:function(){return mu.FunctionsFetchError}});Object.defineProperty(gr,"FunctionsHttpError",{enumerable:!0,get:function(){return mu.FunctionsHttpError}});Object.defineProperty(gr,"FunctionsRelayError",{enumerable:!0,get:function(){return mu.FunctionsRelayError}});Object.defineProperty(gr,"FunctionRegion",{enumerable:!0,get:function(){return mu.FunctionRegion}})});var Gm=v(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});var zm=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};Km.default=zm});var Ym=v(Xm=>{"use strict";Object.defineProperty(Xm,"__esModule",{value:!0});var e4=(fe(),ue(le)),t4=e4.__importDefault(Gm()),Wm=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,i=n(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{var o,a,u,c;let l=null,h=null,d=null,f=s.status,m=s.statusText;if(s.ok){if(this.method!=="HEAD"){let A=await s.text();A===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?h=A:h=JSON.parse(A))}let E=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),S=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");E&&S&&S.length>1&&(d=parseInt(S[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(h)&&(h.length>1?(l={code:"PGRST116",details:`Results contain ${h.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},h=null,d=null,f=406,m="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{let E=await s.text();try{l=JSON.parse(E),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,m="OK")}catch{s.status===404&&E===""?(f=204,m="No Content"):l={message:E}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,m="OK"),l&&this.shouldThrowOnError)throw new t4.default(l)}return{error:l,data:h,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u;return{error:{message:`${(o=s?.name)!==null&&o!==void 0?o:"FetchError"}: ${s?.message}`,details:`${(a=s?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(u=s?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),i.then(e,r)}returns(){return this}overrideTypes(){return this}};Xm.default=Wm});var Qm=v(Zm=>{"use strict";Object.defineProperty(Zm,"__esModule",{value:!0});var r4=(fe(),ue(le)),n4=r4.__importDefault(Ym()),Jm=class extends n4.default{select(e){let r=!1,n=(e??"*").split("").map(i=>/\s/.test(i)&&!r?"":(i==='"'&&(r=!r),i)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:r=!0,nullsFirst:n,foreignTable:i,referencedTable:s=i}={}){let o=s?`${s}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${e}.${r?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:r,referencedTable:n=r}={}){let i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(i,`${e}`),this}range(e,r,{foreignTable:n,referencedTable:i=n}={}){let s=typeof i>"u"?"offset":`${i}.offset`,o=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(s,`${e}`),this.url.searchParams.set(o,`${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:i=!1,wal:s=!1,format:o="text"}={}){var a;let u=[e?"analyze":null,r?"verbose":null,n?"settings":null,i?"buffers":null,s?"wal":null].filter(Boolean).join("|"),c=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${o}; for="${c}"; options=${u};`),o==="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}};Zm.default=Jm});var Ml=v(tg=>{"use strict";Object.defineProperty(tg,"__esModule",{value:!0});var i4=(fe(),ue(le)),s4=i4.__importDefault(Qm()),o4=new RegExp("[,()]"),eg=class extends s4.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(i=>typeof i=="string"&&o4.test(i)?`"${i}"`:`${i}`).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:i}={}){let s="";i==="plain"?s="pl":i==="phrase"?s="ph":i==="websearch"&&(s="w");let o=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${s}fts${o}.${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 i=n?`${n}.or`:"or";return this.url.searchParams.append(i,`(${e})`),this}filter(e,r,n){return this.url.searchParams.append(e,`${r}.${n}`),this}};tg.default=eg});var ig=v(ng=>{"use strict";Object.defineProperty(ng,"__esModule",{value:!0});var a4=(fe(),ue(le)),gu=a4.__importDefault(Ml()),rg=class{constructor(e,{headers:r={},schema:n,fetch:i}){this.url=e,this.headers=new Headers(r),this.schema=n,this.fetch=i}select(e,r){let{head:n=!1,count:i}=r??{},s=n?"HEAD":"GET",o=!1,a=(e??"*").split("").map(u=>/\s/.test(u)&&!o?"":(u==='"'&&(o=!o),u)).join("");return this.url.searchParams.set("select",a),i&&this.headers.append("Prefer",`count=${i}`),new gu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:r,defaultToNull:n=!0}={}){var i;let s="POST";if(r&&this.headers.append("Prefer",`count=${r}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let o=e.reduce((a,u)=>a.concat(Object.keys(u)),[]);if(o.length>0){let a=[...new Set(o)].map(u=>`"${u}"`);this.url.searchParams.set("columns",a.join(","))}}return new gu.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(e,{onConflict:r,ignoreDuplicates:n=!1,count:i,defaultToNull:s=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),r!==void 0&&this.url.searchParams.set("on_conflict",r),i&&this.headers.append("Prefer",`count=${i}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let u=e.reduce((c,l)=>c.concat(Object.keys(l)),[]);if(u.length>0){let c=[...new Set(u)].map(l=>`"${l}"`);this.url.searchParams.set("columns",c.join(","))}}return new gu.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(e,{count:r}={}){var n;let i="PATCH";return r&&this.headers.append("Prefer",`count=${r}`),new gu.default({method:i,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 gu.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};ng.default=rg});var W_=v(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var G_=(fe(),ue(le)),u4=G_.__importDefault(ig()),c4=G_.__importDefault(Ml()),sg=class t{constructor(e,{headers:r={},schema:n,fetch:i}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.fetch=i}from(e){let r=new URL(`${this.url}/${e}`);return new u4.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:i=!1,count:s}={}){var o;let a,u=new URL(`${this.url}/rpc/${e}`),c;n||i?(a=n?"HEAD":"GET",Object.entries(r).filter(([h,d])=>d!==void 0).map(([h,d])=>[h,Array.isArray(d)?`{${d.join(",")}}`:`${d}`]).forEach(([h,d])=>{u.searchParams.append(h,d)})):(a="POST",c=r);let l=new Headers(this.headers);return s&&l.set("Prefer",`count=${s}`),new c4.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};og.default=sg});var ag=v(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.PostgrestError=tr.PostgrestBuilder=tr.PostgrestTransformBuilder=tr.PostgrestFilterBuilder=tr.PostgrestQueryBuilder=tr.PostgrestClient=void 0;var So=(fe(),ue(le)),X_=So.__importDefault(W_());tr.PostgrestClient=X_.default;var Y_=So.__importDefault(ig());tr.PostgrestQueryBuilder=Y_.default;var J_=So.__importDefault(Ml());tr.PostgrestFilterBuilder=J_.default;var Z_=So.__importDefault(Qm());tr.PostgrestTransformBuilder=Z_.default;var Q_=So.__importDefault(Ym());tr.PostgrestBuilder=Q_.default;var eC=So.__importDefault(Gm());tr.PostgrestError=eC.default;tr.default={PostgrestClient:X_.default,PostgrestQueryBuilder:Y_.default,PostgrestFilterBuilder:J_.default,PostgrestTransformBuilder:Z_.default,PostgrestBuilder:Q_.default,PostgrestError:eC.default}});var ug=v(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});yu.WebSocketFactory=void 0;var ql=class{static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){let r=process.versions;if(r&&r.node){let n=r.node,i=parseInt(n.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
2
2
  import ws from "ws"
3
3
  new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
4
4
 
5
- Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};yu.WebSocketFactory=ql;yu.default=ql});var tC=v(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.version=void 0;Ul.version="2.79.0"});var Hl=v(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.CONNECTION_STATE=it.TRANSPORTS=it.CHANNEL_EVENTS=it.CHANNEL_STATES=it.SOCKET_STATES=it.MAX_PUSH_BUFFER_SIZE=it.WS_CLOSE_NORMAL=it.DEFAULT_TIMEOUT=it.VERSION=it.VSN=it.DEFAULT_VERSION=void 0;var aC=tC();it.DEFAULT_VERSION=`realtime-js/${aC.version}`;it.VSN="1.0.0";it.VERSION=aC.version;it.DEFAULT_TIMEOUT=1e4;it.WS_CLOSE_NORMAL=1e3;it.MAX_PUSH_BUFFER_SIZE=100;var rC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(rC||(it.SOCKET_STATES=rC={}));var nC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(nC||(it.CHANNEL_STATES=nC={}));var iC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(iC||(it.CHANNEL_EVENTS=iC={}));var sC;(function(t){t.websocket="websocket"})(sC||(it.TRANSPORTS=sC={}));var oC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(oC||(it.CONNECTION_STATE=oC={}))});var uC=v(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});var cg=class{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=this.HEADER_LENGTH+2,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let c=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:u,payload:c}}};lg.default=cg});var dg=v(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});var fg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};hg.default=fg});var Vl=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.httpEndpointURL=Te.toTimestampString=Te.toArray=Te.toJson=Te.toNumber=Te.toBoolean=Te.convertCell=Te.convertColumn=Te.convertChangeData=Te.PostgresTypes=void 0;var He;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(He||(Te.PostgresTypes=He={}));var l4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Te.convertColumn)(o,t,e,i),s),{}):{}};Te.convertChangeData=l4;var f4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Te.convertCell)(s,o):pg(o)};Te.convertColumn=f4;var h4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Te.toArray)(e,r)}switch(t){case He.bool:return(0,Te.toBoolean)(e);case He.float4:case He.float8:case He.int2:case He.int4:case He.int8:case He.numeric:case He.oid:return(0,Te.toNumber)(e);case He.json:case He.jsonb:return(0,Te.toJson)(e);case He.timestamp:return(0,Te.toTimestampString)(e);case He.abstime:case He.date:case He.daterange:case He.int4range:case He.int8range:case He.money:case He.reltime:case He.text:case He.time:case He.timestamptz:case He.timetz:case He.tsrange:case He.tstzrange:return pg(e);default:return pg(e)}};Te.convertCell=h4;var pg=t=>t,d4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Te.toBoolean=d4;var p4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Te.toNumber=p4;var m4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Te.toJson=m4;var g4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Te.convertCell)(e,a))}return t};Te.toArray=g4;var y4=t=>typeof t=="string"?t.replace(" ","T"):t;Te.toTimestampString=y4;var D4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Te.httpEndpointURL=D4});var cC=v(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});var w4=Hl(),mg=class{constructor(e,r,n={},i=w4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};gg.default=mg});var Dg=v(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var lC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(lC||(Du.REALTIME_PRESENCE_LISTEN_EVENTS=lC={}));var yg=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(E=>E.presence_ref),f=h.map(E=>E.presence_ref),m=l.filter(E=>f.indexOf(E.presence_ref)<0),y=h.filter(E=>d.indexOf(E.presence_ref)<0);m.length>0&&(a[c]=m),y.length>0&&(u[c]=y)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};Du.default=yg});var bg=v(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.REALTIME_CHANNEL_STATES=en.REALTIME_SUBSCRIBE_STATES=en.REALTIME_LISTEN_TYPES=en.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var zl=(fe(),ue(le)),Ve=Hl(),wg=zl.__importDefault(cC()),E4=zl.__importDefault(dg()),b4=zl.__importDefault(Dg()),fC=zl.__importStar(Vl()),v4=Vl(),hC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(hC||(en.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=hC={}));var wu;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(wu||(en.REALTIME_LISTEN_TYPES=wu={}));var Hn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Hn||(en.REALTIME_SUBSCRIBE_STATES=Hn={}));en.REALTIME_CHANNEL_STATES=Ve.CHANNEL_STATES;var Eg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ve.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new wg.default(this,Ve.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new E4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ve.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ve.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ve.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new b4.default(this),this.broadcastEndpointURL=(0,v4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ve.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[wu.PRESENCE]&&this.bindings[wu.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Hn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Hn.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Hn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,E=(m=y?.length)!==null&&m!==void 0?m:0,C=[];for(let A=0;A<E;A++){let p=y[A],{filter:{event:D,schema:w,table:_,filter:P}}=p,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===_&&b.filter===P)C.push(Object.assign(Object.assign({},p),{id:b.id}));else{this.unsubscribe(),this.state=Ve.CHANNEL_STATES.errored,e?.(Hn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=C,e&&e(Hn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ve.CHANNEL_STATES.errored,e?.(Hn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Hn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ve.CHANNEL_STATES.joined&&e===wu.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ve.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ve.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new wg.default(this,Ve.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ve.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new wg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ve.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=Ve.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,y,E;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((E=(y=f.filter)===null||y===void 0?void 0:y.event)===null||E===void 0?void 0:E.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,E,C,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return D&&((y=r.ids)===null||y===void 0?void 0:y.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((E=r.data)===null||E===void 0?void 0:E.type.toLocaleLowerCase()))}else{let D=(A=(C=f?.filter)===null||C===void 0?void 0:C.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:y,table:E,commit_timestamp:C,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:y,table:E,commit_timestamp:C,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===Ve.CHANNEL_STATES.closed}_isJoined(){return this.state===Ve.CHANNEL_STATES.joined}_isJoining(){return this.state===Ve.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ve.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ve.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ve.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ve.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=fC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=fC.convertChangeData(e.columns,e.old_record)),r}};en.default=Eg});var dC=v(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});var Gl=(fe(),ue(le)),_4=Gl.__importDefault(ug()),zt=Hl(),C4=Gl.__importDefault(uC()),S4=Gl.__importDefault(dg()),A4=Vl(),O4=Gl.__importDefault(bg()),vg=()=>{},Kl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},x4=[1e3,2e3,5e3,1e4],T4=1e4,I4=`
5
+ Suggested solution: ${e.workaround}`),new Error(r)}static createWebSocket(e,r){let n=this.getWebSocketConstructor();return new n(e,r)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}};yu.WebSocketFactory=ql;yu.default=ql});var tC=v(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});Ul.version=void 0;Ul.version="2.79.0"});var Hl=v(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.CONNECTION_STATE=it.TRANSPORTS=it.CHANNEL_EVENTS=it.CHANNEL_STATES=it.SOCKET_STATES=it.MAX_PUSH_BUFFER_SIZE=it.WS_CLOSE_NORMAL=it.DEFAULT_TIMEOUT=it.VERSION=it.VSN=it.DEFAULT_VERSION=void 0;var aC=tC();it.DEFAULT_VERSION=`realtime-js/${aC.version}`;it.VSN="1.0.0";it.VERSION=aC.version;it.DEFAULT_TIMEOUT=1e4;it.WS_CLOSE_NORMAL=1e3;it.MAX_PUSH_BUFFER_SIZE=100;var rC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(rC||(it.SOCKET_STATES=rC={}));var nC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(nC||(it.CHANNEL_STATES=nC={}));var iC;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(iC||(it.CHANNEL_EVENTS=iC={}));var sC;(function(t){t.websocket="websocket"})(sC||(it.TRANSPORTS=sC={}));var oC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(oC||(it.CONNECTION_STATE=oC={}))});var uC=v(lg=>{"use strict";Object.defineProperty(lg,"__esModule",{value:!0});var cg=class{constructor(){this.HEADER_LENGTH=1}decode(e,r){return e.constructor===ArrayBuffer?r(this._binaryDecode(e)):r(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){let r=new DataView(e),n=new TextDecoder;return this._decodeBroadcast(e,r,n)}_decodeBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=this.HEADER_LENGTH+2,a=n.decode(e.slice(o,o+i));o=o+i;let u=n.decode(e.slice(o,o+s));o=o+s;let c=JSON.parse(n.decode(e.slice(o,e.byteLength)));return{ref:null,topic:a,event:u,payload:c}}};lg.default=cg});var dg=v(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});var fg=class{constructor(e,r){this.callback=e,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}};hg.default=fg});var Vl=v(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.httpEndpointURL=Te.toTimestampString=Te.toArray=Te.toJson=Te.toNumber=Te.toBoolean=Te.convertCell=Te.convertColumn=Te.convertChangeData=Te.PostgresTypes=void 0;var He;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(He||(Te.PostgresTypes=He={}));var l4=(t,e,r={})=>{var n;let i=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((s,o)=>(s[o]=(0,Te.convertColumn)(o,t,e,i),s),{}):{}};Te.convertChangeData=l4;var f4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Te.convertCell)(s,o):pg(o)};Te.convertColumn=f4;var h4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Te.toArray)(e,r)}switch(t){case He.bool:return(0,Te.toBoolean)(e);case He.float4:case He.float8:case He.int2:case He.int4:case He.int8:case He.numeric:case He.oid:return(0,Te.toNumber)(e);case He.json:case He.jsonb:return(0,Te.toJson)(e);case He.timestamp:return(0,Te.toTimestampString)(e);case He.abstime:case He.date:case He.daterange:case He.int4range:case He.int8range:case He.money:case He.reltime:case He.text:case He.time:case He.timestamptz:case He.timetz:case He.tsrange:case He.tstzrange:return pg(e);default:return pg(e)}};Te.convertCell=h4;var pg=t=>t,d4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Te.toBoolean=d4;var p4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Te.toNumber=p4;var m4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Te.toJson=m4;var g4=(t,e)=>{if(typeof t!="string")return t;let r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let s,o=t.slice(1,r);try{s=JSON.parse("["+o+"]")}catch{s=o?o.split(","):[]}return s.map(a=>(0,Te.convertCell)(e,a))}return t};Te.toArray=g4;var y4=t=>typeof t=="string"?t.replace(" ","T"):t;Te.toTimestampString=y4;var D4=t=>{let e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};Te.httpEndpointURL=D4});var cC=v(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});var w4=Hl(),mg=class{constructor(e,r,n={},i=w4.DEFAULT_TIMEOUT){this.channel=e,this.event=r,this.payload=n,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,r){var n;return this._hasReceived(e)&&r((n=this.receivedResp)===null||n===void 0?void 0:n.response),this.recHooks.push({status:e,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:r}){this.recHooks.filter(n=>n.status===e).forEach(n=>n.callback(r))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}};gg.default=mg});var Dg=v(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});Du.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var lC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(lC||(Du.REALTIME_PRESENCE_LISTEN_EVENTS=lC={}));var yg=class t{constructor(e,r){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let n=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(n.state,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=t.syncState(this.state,i,s,o),this.pendingDiffs.forEach(u=>{this.state=t.syncDiff(this.state,u,s,o)}),this.pendingDiffs=[],a()}),this.channel._on(n.diff,{},i=>{let{onJoin:s,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=t.syncDiff(this.state,i,s,o),a())}),this.onJoin((i,s,o)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:o})}),this.onLeave((i,s,o)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,r,n,i){let s=this.cloneDeep(e),o=this.transformState(r),a={},u={};return this.map(s,(c,l)=>{o[c]||(u[c]=l)}),this.map(o,(c,l)=>{let h=s[c];if(h){let d=l.map(E=>E.presence_ref),f=h.map(E=>E.presence_ref),m=l.filter(E=>f.indexOf(E.presence_ref)<0),y=h.filter(E=>d.indexOf(E.presence_ref)<0);m.length>0&&(a[c]=m),y.length>0&&(u[c]=y)}else a[c]=l}),this.syncDiff(s,{joins:a,leaves:u},n,i)}static syncDiff(e,r,n,i){let{joins:s,leaves:o}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return n||(n=()=>{}),i||(i=()=>{}),this.map(s,(a,u)=>{var c;let l=(c=e[a])!==null&&c!==void 0?c:[];if(e[a]=this.cloneDeep(u),l.length>0){let h=e[a].map(f=>f.presence_ref),d=l.filter(f=>h.indexOf(f.presence_ref)<0);e[a].unshift(...d)}n(a,l,u)}),this.map(o,(a,u)=>{let c=e[a];if(!c)return;let l=u.map(h=>h.presence_ref);c=c.filter(h=>l.indexOf(h.presence_ref)<0),e[a]=c,i(a,c,u),c.length===0&&delete e[a]}),e}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{let i=e[n];return"metas"in i?r[n]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):r[n]=i,r},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}};Du.default=yg});var bg=v(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.REALTIME_CHANNEL_STATES=tn.REALTIME_SUBSCRIBE_STATES=tn.REALTIME_LISTEN_TYPES=tn.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var zl=(fe(),ue(le)),Ve=Hl(),wg=zl.__importDefault(cC()),E4=zl.__importDefault(dg()),b4=zl.__importDefault(Dg()),fC=zl.__importStar(Vl()),v4=Vl(),hC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(hC||(tn.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=hC={}));var wu;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(wu||(tn.REALTIME_LISTEN_TYPES=wu={}));var Hn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Hn||(tn.REALTIME_SUBSCRIBE_STATES=Hn={}));tn.REALTIME_CHANNEL_STATES=Ve.CHANNEL_STATES;var Eg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ve.CHANNEL_STATES.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new wg.default(this,Ve.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new E4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ve.CHANNEL_STATES.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(o=>o.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ve.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ve.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ve.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new b4.default(this),this.broadcastEndpointURL=(0,v4.httpEndpointURL)(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,r=this.timeout){var n,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ve.CHANNEL_STATES.closed){let{config:{broadcast:o,presence:a,private:u}}=this.params,c=(i=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&i!==void 0?i:[],l=!!this.bindings[wu.PRESENCE]&&this.bindings[wu.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:l}),postgres_changes:c,private:u};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>e?.(Hn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Hn.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var m;if(this.socket.setAuth(),f===void 0){e?.(Hn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,E=(m=y?.length)!==null&&m!==void 0?m:0,S=[];for(let A=0;A<E;A++){let p=y[A],{filter:{event:D,schema:w,table:_,filter:P}}=p,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===_&&b.filter===P)S.push(Object.assign(Object.assign({},p),{id:b.id}));else{this.unsubscribe(),this.state=Ve.CHANNEL_STATES.errored,e?.(Hn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=S,e&&e(Hn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ve.CHANNEL_STATES.errored,e?.(Hn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Hn.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){return this.state===Ve.CHANNEL_STATES.joined&&e===wu.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,r,n)}async httpSend(e,r,n={}){var i;let s=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(r==null)return Promise.reject("Payload is required for httpSend()");let o={method:"POST",headers:{Authorization:s,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(i=n.timeout)!==null&&i!==void 0?i:this.timeout);if(a.status===202)return{success:!0};let u=a.statusText;try{let c=await a.json();u=c.error||c.message||u}catch{}return Promise.reject(new Error(u))}async send(e,r={}){var n,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:s,payload:o}=e,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:o,private:this.private}]})};try{let c=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var o,a,u;let c=this._push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((u=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||u===void 0)&&u.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ve.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ve.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new wg.default(this,Ve.CHANNEL_EVENTS.leave,{},e),n.receive("ok",()=>{r(),i("ok")}).receive("timeout",()=>{r(),i("timed out")}).receive("error",()=>{i("error")}),n.send(),this._canPush()||n.trigger("ok",{})}).finally(()=>{n?.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ve.CHANNEL_STATES.closed,this.bindings={}}async _fetchWithTimeout(e,r,n){let i=new AbortController,s=setTimeout(()=>i.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:i.signal}));return clearTimeout(s),o}_push(e,r,n=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new wg.default(this,e,r,n);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ve.MAX_PUSH_BUFFER_SIZE){let r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(e,r,n){return r}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,r,n){var i,s;let o=e.toLocaleLowerCase(),{close:a,error:u,leave:c,join:l}=Ve.CHANNEL_EVENTS;if(n&&[a,u,c,l].indexOf(o)>=0&&n!==this._joinRef())return;let d=this._onMessage(o,r,n);if(r&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(f=>{var m,y,E;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((E=(y=f.filter)===null||y===void 0?void 0:y.event)===null||E===void 0?void 0:E.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,E,S,A,p;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(m=f.filter)===null||m===void 0?void 0:m.event;return D&&((y=r.ids)===null||y===void 0?void 0:y.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((E=r.data)===null||E===void 0?void 0:E.type.toLocaleLowerCase()))}else{let D=(A=(S=f?.filter)===null||S===void 0?void 0:S.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((p=r?.event)===null||p===void 0?void 0:p.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let m=d.data,{schema:y,table:E,commit_timestamp:S,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:y,table:E,commit_timestamp:S,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===Ve.CHANNEL_STATES.closed}_isJoined(){return this.state===Ve.CHANNEL_STATES.joined}_isJoining(){return this.state===Ve.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ve.CHANNEL_STATES.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,r,n){let i=e.toLocaleLowerCase(),s={type:i,filter:r,callback:n};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,r){let n=e.toLocaleLowerCase();return this.bindings[n]&&(this.bindings[n]=this.bindings[n].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===n&&t.isEqual(i.filter,r))})),this}static isEqual(e,r){if(Object.keys(e).length!==Object.keys(r).length)return!1;for(let n in e)if(e[n]!==r[n])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Ve.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ve.CHANNEL_EVENTS.error,{},r=>e(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ve.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=fC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=fC.convertChangeData(e.columns,e.old_record)),r}};tn.default=Eg});var dC=v(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});var Gl=(fe(),ue(le)),_4=Gl.__importDefault(ug()),zt=Hl(),C4=Gl.__importDefault(uC()),S4=Gl.__importDefault(dg()),A4=Vl(),O4=Gl.__importDefault(bg()),vg=()=>{},Kl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},x4=[1e3,2e3,5e3,1e4],T4=1e4,I4=`
6
6
  addEventListener("message", (e) => {
7
7
  if (e.data.event === "start") {
8
8
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -20,41 +20,41 @@ Option 2: Install and provide the "ws" package:
20
20
  const client = new RealtimeClient(url, {
21
21
  ...options,
22
22
  transport: ws
23
- })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:zt.VSN}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},e?this.conn.close(e,r??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case zt.SOCKET_STATES.connecting:return zt.CONNECTION_STATE.Connecting;case zt.SOCKET_STATES.open:return zt.CONNECTION_STATE.Open;case zt.SOCKET_STATES.closing:return zt.CONNECTION_STATE.Closing;default:return zt.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===zt.CONNECTION_STATE.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){let n=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===n);if(i)return i;{let s=new O4.default(`realtime:${e}`,r,this);return this.channels.push(s),s}}push(e){let{topic:r,event:n,payload:i,ref:s}=e,o=()=>{this.encode(e,a=>{var u;(u=this.conn)===null||u===void 0||u.send(a)})};this.log("push",`${r} ${n} (${s})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(zt.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},Kl.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:n,event:i,payload:s,ref:o}=r,a=o?`(${o})`:"",u=s.status||"";this.log("receive",`${u} ${n} ${i} ${a}`.trim(),s),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(i,s,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(zt.CHANNEL_EVENTS.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;let n=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${n}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{let n=new Blob([I4],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{let i={access_token:r,version:zt.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(zt.CHANNEL_EVENTS.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new S4.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Kl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l;if(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:zt.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:Kl.HEARTBEAT_INTERVAL,this.worker=(s=e?.worker)!==null&&s!==void 0?s:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:vg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=e?.reconnectAfterMs)!==null&&u!==void 0?u:(h=>x4[h-1]||T4),this.encode=(c=e?.encode)!==null&&c!==void 0?c:((h,d)=>d(JSON.stringify(h))),this.decode=(l=e?.decode)!==null&&l!==void 0?l:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Cg.default=_g});var Sg=v(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.WebSocketFactory=At.REALTIME_CHANNEL_STATES=At.REALTIME_SUBSCRIBE_STATES=At.REALTIME_PRESENCE_LISTEN_EVENTS=At.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=At.REALTIME_LISTEN_TYPES=At.RealtimeClient=At.RealtimeChannel=At.RealtimePresence=void 0;var Wl=(fe(),ue(le)),F4=Wl.__importDefault(dC());At.RealtimeClient=F4.default;var Eu=Wl.__importStar(bg());At.RealtimeChannel=Eu.default;Object.defineProperty(At,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Eu.REALTIME_LISTEN_TYPES}});Object.defineProperty(At,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Eu.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(At,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Eu.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(At,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Eu.REALTIME_CHANNEL_STATES}});var pC=Wl.__importStar(Dg());At.RealtimePresence=pC.default;Object.defineProperty(At,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return pC.REALTIME_PRESENCE_LISTEN_EVENTS}});var P4=Wl.__importDefault(ug());At.WebSocketFactory=P4.default});var Ci=v(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.StorageUnknownError=Vn.StorageApiError=Vn.StorageError=void 0;Vn.isStorageError=R4;var bu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Vn.StorageError=bu;function R4(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ag=class extends bu{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}}};Vn.StorageApiError=Ag;var Og=class extends bu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Vn.StorageUnknownError=Og});var vu=v(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.isPlainObject=Br.recursiveToCamel=Br.resolveResponse=Br.resolveFetch=void 0;var k4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Br.resolveFetch=k4;var N4=()=>Response;Br.resolveResponse=N4;var $4=t=>{if(Array.isArray(t))return t.map(r=>(0,Br.recursiveToCamel)(r));if(typeof t=="function"||t!==Object(t))return t;let e={};return Object.entries(t).forEach(([r,n])=>{let i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=(0,Br.recursiveToCamel)(n)}),e};Br.recursiveToCamel=$4;var L4=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)};Br.isPlainObject=L4});var Xl=v(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.get=M4;fs.post=q4;fs.put=U4;fs.head=H4;fs.remove=V4;var ls=(fe(),ue(le)),xg=Ci(),mC=vu(),Tg=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)},j4=(t,e,r)=>ls.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,mC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new xg.StorageApiError(Tg(i),s,o))}).catch(i=>{e(new xg.StorageUnknownError(Tg(i),i))}):e(new xg.StorageUnknownError(Tg(t),t))}),B4=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,mC.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),r))};function _u(t,e,r,n,i,s){return ls.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,B4(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>j4(u,a,n))})})}function M4(t,e,r,n){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"GET",e,r,n)})}function q4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"POST",e,n,i,r)})}function U4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"PUT",e,n,i,r)})}function H4(t,e,r,n){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function V4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"DELETE",e,n,i,r)})}});var gC=v(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});var z4=(fe(),ue(le)),K4=Ci(),Ig=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return z4.__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,K4.isStorageError)(e))return{data:null,error:e};throw e}})}};Fg.default=Ig});var wC=v(Rg=>{"use strict";var yC;Object.defineProperty(Rg,"__esModule",{value:!0});var DC=(fe(),ue(le)),G4=Ci(),W4=DC.__importDefault(gC()),Pg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[yC]="BlobDownloadBuilder",this.promise=null}asStream(){return new W4.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 DC.__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,G4.isStorageError)(e))return{data:null,error:e};throw e}})}};yC=Symbol.toStringTag;Rg.default=Pg});var vC=v(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});var rr=(fe(),ue(le)),yr=Ci(),Dr=Xl(),EC=vu(),X4=rr.__importDefault(wC()),Y4={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bC={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},kg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,EC.resolveFetch)(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){try{let s,o=Object.assign(Object.assign({},bC),i),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",this.encodeMetadata(u)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",this.encodeMetadata(u))):(s=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),i?.headers&&(a=Object.assign(Object.assign({},a),i.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),h=yield(e=="PUT"?Dr.put:Dr.post)(this.fetch,`${this.url}/object/${l}`,s,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if((0,yr.isStorageError)(s))return{data:null,error:s};throw s}})}upload(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",r);try{let u,c=Object.assign({upsert:bC.upsert},i),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let h=yield(0,Dr.put)(this.fetch,a.toString(),u,{headers:l});return{data:{path:s,fullPath:h.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,yr.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=Object.assign({},this.headers);r?.upsert&&(i["x-upsert"]="true");let s=yield(0,Dr.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(this.url+s.url),a=o.searchParams.get("token");if(!a)throw new yr.StorageError("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Dr.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}copy(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Dr.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrl(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield(0,Dr.post)(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrls(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=yield(0,Dr.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}download(e,r){let i=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),o=s?`?${s}`:"",a=this._getFinalPath(e),u=()=>(0,Dr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new X4.default(u,this.shouldThrowOnError)}info(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Dr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,EC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Dr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n)&&n instanceof yr.StorageUnknownError){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),i=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&i.push(s);let a=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&i.push(u);let c=i.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${c}`)}}}remove(e){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Dr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yr.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},Y4),r),{prefix:e||""});return{data:yield(0,Dr.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}listV2(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Dr.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,yr.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("&")}};Ng.default=kg});var $g=v(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.version=void 0;Yl.version="2.79.0"});var Lg=v(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.DEFAULT_HEADERS=void 0;var J4=$g();Jl.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${J4.version}`}});var _C=v(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});var Ao=(fe(),ue(le)),Z4=Lg(),Oo=Ci(),xo=Xl(),Q4=vu(),jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Z4.DEFAULT_HEADERS),r),this.fetch=(0,Q4.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,xo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Ao.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,xo.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Oo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Oo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.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():""}};Bg.default=jg});var zg=v(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var Mg=(fe(),ue(le)),e5=Lg(),qg=Ci(),Ug=Xl(),t5=vu(),Hg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},e5.DEFAULT_HEADERS),r),this.fetch=(0,t5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Mg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ug.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Mg.__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(),i=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,Ug.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Mg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ug.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}};Vg.default=Hg});var Ql=v(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.DEFAULT_HEADERS=void 0;var r5=$g();Zl.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${r5.version}`,"Content-Type":"application/json"}});var To=v(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.StorageVectorsErrorCode=tn.StorageVectorsUnknownError=tn.StorageVectorsApiError=tn.StorageVectorsError=void 0;tn.isStorageVectorsError=n5;var Cu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};tn.StorageVectorsError=Cu;function n5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Kg=class extends Cu{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}}};tn.StorageVectorsApiError=Kg;var Gg=class extends Cu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};tn.StorageVectorsUnknownError=Gg;var CC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(CC||(tn.StorageVectorsErrorCode=CC={}))});var Io=v(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.validateVectorDimension=Mr.normalizeToFloat32=Mr.isPlainObject=Mr.resolveResponse=Mr.resolveFetch=void 0;var i5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mr.resolveFetch=i5;var s5=()=>Response;Mr.resolveResponse=s5;var o5=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=o5;var a5=t=>Array.from(new Float32Array(t));Mr.normalizeToFloat32=a5;var u5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};Mr.validateVectorDimension=u5});var rf=v(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.get=h5;Po.post=d5;Po.put=p5;Po.remove=m5;var Fo=(fe(),ue(le)),ef=To(),c5=Io(),SC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),l5=(t,e,r)=>Fo.__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 i=t.status||500,s=t;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new ef.StorageVectorsApiError(SC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new ef.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new ef.StorageVectorsApiError(a,i,o))}}else e(new ef.StorageVectorsUnknownError(SC(t),t))}),f5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,c5.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,Object.assign(Object.assign({},i),r))};function tf(t,e,r,n,i,s){return Fo.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,f5(e,n,i,s)).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=>o(u)).catch(u=>l5(u,a,n))})})}function h5(t,e,r,n){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"GET",e,r,n)})}function d5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"POST",e,n,i,r)})}function p5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"PUT",e,n,i,r)})}function m5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"DELETE",e,n,i,r)})}});var Yg=v(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});var nf=(fe(),ue(le)),g5=Ql(),sf=To(),of=rf(),y5=Io(),Wg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},g5.DEFAULT_HEADERS),r),this.fetch=(0,y5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,of.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,sf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,of.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,sf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,of.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,sf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,of.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,sf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};Xg.default=Wg});var Qg=v(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Su=(fe(),ue(le)),D5=Ql(),Au=To(),Ou=rf(),w5=Io(),Jg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},D5.DEFAULT_HEADERS),r),this.fetch=(0,w5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Zg.default=Jg});var ry=v(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});var af=(fe(),ue(le)),E5=Ql(),uf=To(),cf=rf(),b5=Io(),ey=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},E5.DEFAULT_HEADERS),r),this.fetch=(0,b5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,cf.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,cf.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return af.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,cf.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,cf.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};ty.default=ey});var AC=v(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.VectorIndexScope=Si.VectorBucketScope=Si.StorageVectorsClient=void 0;var qr=(fe(),ue(le)),v5=qr.__importDefault(Yg()),_5=qr.__importDefault(Qg()),C5=qr.__importDefault(ry()),ny=class extends C5.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new lf(this.url,this.headers,e,this.fetch)}};Si.StorageVectorsClient=ny;var lf=class extends v5.default{constructor(e,r,n,i){super(e,r,i),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return qr.__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 qr.__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 qr.__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 qr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new ff(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Si.VectorBucketScope=lf;var ff=class extends _5.default{constructor(e,r,n,i,s){super(e,r,s),this.vectorBucketName=n,this.indexName=i}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return qr.__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 qr.__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 qr.__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 qr.__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 qr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Si.VectorIndexScope=ff});var oy=v(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.validateVectorDimension=ve.normalizeToFloat32=ve.isPlainObject=ve.resolveResponse=ve.resolveFetch=ve.isStorageVectorsError=ve.StorageVectorsErrorCode=ve.StorageVectorsUnknownError=ve.StorageVectorsApiError=ve.StorageVectorsError=ve.VectorDataApi=ve.VectorIndexApi=ve.VectorBucketApi=ve.VectorIndexScope=ve.VectorBucketScope=ve.StorageVectorsClient=void 0;var iy=(fe(),ue(le)),sy=AC();Object.defineProperty(ve,"StorageVectorsClient",{enumerable:!0,get:function(){return sy.StorageVectorsClient}});Object.defineProperty(ve,"VectorBucketScope",{enumerable:!0,get:function(){return sy.VectorBucketScope}});Object.defineProperty(ve,"VectorIndexScope",{enumerable:!0,get:function(){return sy.VectorIndexScope}});var S5=ry();Object.defineProperty(ve,"VectorBucketApi",{enumerable:!0,get:function(){return iy.__importDefault(S5).default}});var A5=Yg();Object.defineProperty(ve,"VectorIndexApi",{enumerable:!0,get:function(){return iy.__importDefault(A5).default}});var O5=Qg();Object.defineProperty(ve,"VectorDataApi",{enumerable:!0,get:function(){return iy.__importDefault(O5).default}});var xu=To();Object.defineProperty(ve,"StorageVectorsError",{enumerable:!0,get:function(){return xu.StorageVectorsError}});Object.defineProperty(ve,"StorageVectorsApiError",{enumerable:!0,get:function(){return xu.StorageVectorsApiError}});Object.defineProperty(ve,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return xu.StorageVectorsUnknownError}});Object.defineProperty(ve,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return xu.StorageVectorsErrorCode}});Object.defineProperty(ve,"isStorageVectorsError",{enumerable:!0,get:function(){return xu.isStorageVectorsError}});var Tu=Io();Object.defineProperty(ve,"resolveFetch",{enumerable:!0,get:function(){return Tu.resolveFetch}});Object.defineProperty(ve,"resolveResponse",{enumerable:!0,get:function(){return Tu.resolveResponse}});Object.defineProperty(ve,"isPlainObject",{enumerable:!0,get:function(){return Tu.isPlainObject}});Object.defineProperty(ve,"normalizeToFloat32",{enumerable:!0,get:function(){return Tu.normalizeToFloat32}});Object.defineProperty(ve,"validateVectorDimension",{enumerable:!0,get:function(){return Tu.validateVectorDimension}})});var OC=v(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.StorageClient=void 0;var uy=(fe(),ue(le)),x5=uy.__importDefault(vC()),T5=uy.__importDefault(_C()),I5=uy.__importDefault(zg()),F5=oy(),ay=class extends T5.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new x5.default(this.url,this.headers,e,this.fetch)}get vectors(){return new F5.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new I5.default(this.url+"/iceberg",this.headers,this.fetch)}};hf.StorageClient=ay});var TC=v(xC=>{"use strict";Object.defineProperty(xC,"__esModule",{value:!0})});var IC=v(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.StorageAnalyticsApi=zn.StorageClient=void 0;var df=(fe(),ue(le)),P5=OC();Object.defineProperty(zn,"StorageClient",{enumerable:!0,get:function(){return P5.StorageClient}});var R5=zg();Object.defineProperty(zn,"StorageAnalyticsApi",{enumerable:!0,get:function(){return df.__importDefault(R5).default}});df.__exportStar(TC(),zn);df.__exportStar(Ci(),zn);df.__exportStar(oy(),zn)});var FC=v(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.version=void 0;pf.version="2.79.0"});var PC=v(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.DEFAULT_REALTIME_OPTIONS=Ir.DEFAULT_AUTH_OPTIONS=Ir.DEFAULT_DB_OPTIONS=Ir.DEFAULT_GLOBAL_OPTIONS=Ir.DEFAULT_HEADERS=void 0;var k5=FC(),Iu="";typeof Deno<"u"?Iu="deno":typeof document<"u"?Iu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Iu="react-native":Iu="node";Ir.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Iu}/${k5.version}`};Ir.DEFAULT_GLOBAL_OPTIONS={headers:Ir.DEFAULT_HEADERS};Ir.DEFAULT_DB_OPTIONS={schema:"public"};Ir.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Ir.DEFAULT_REALTIME_OPTIONS={}});var RC=v(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.fetchWithAuth=hn.resolveHeadersConstructor=hn.resolveFetch=void 0;var N5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);hn.resolveFetch=N5;var $5=()=>Headers;hn.resolveHeadersConstructor=$5;var L5=(t,e,r)=>{let n=(0,hn.resolveFetch)(r),i=(0,hn.resolveHeadersConstructor)();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,Object.assign(Object.assign({},o),{headers:c}))}};hn.fetchWithAuth=L5});var NC=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.isBrowser=void 0;Ai.uuid=j5;Ai.ensureTrailingSlash=kC;Ai.applySettingDefaults=M5;Ai.validateSupabaseUrl=q5;function j5(){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 kC(t){return t.endsWith("/")?t:t+"/"}var B5=()=>typeof window<"u";Ai.isBrowser=B5;function M5(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:Object.assign(Object.assign({},u),i),auth:Object.assign(Object.assign({},c),s),realtime:Object.assign(Object.assign({},l),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),a),{headers:Object.assign(Object.assign({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function q5(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(kC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var cy=v(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.version=void 0;mf.version="2.79.0"});var gf=v($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.JWKS_TTL=$e.BASE64URL_REGEX=$e.API_VERSIONS=$e.API_VERSION_HEADER_NAME=$e.NETWORK_FAILURE=$e.DEFAULT_HEADERS=$e.AUDIENCE=$e.STORAGE_KEY=$e.GOTRUE_URL=$e.EXPIRY_MARGIN_MS=$e.AUTO_REFRESH_TICK_THRESHOLD=$e.AUTO_REFRESH_TICK_DURATION_MS=void 0;var U5=cy();$e.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;$e.AUTO_REFRESH_TICK_THRESHOLD=3;$e.EXPIRY_MARGIN_MS=$e.AUTO_REFRESH_TICK_THRESHOLD*$e.AUTO_REFRESH_TICK_DURATION_MS;$e.GOTRUE_URL="http://localhost:9999";$e.STORAGE_KEY="supabase.auth.token";$e.AUDIENCE="";$e.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${U5.version}`};$e.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};$e.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";$e.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};$e.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;$e.JWKS_TTL=600*1e3});var hs=v(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.AuthInvalidJwtError=Ce.AuthWeakPasswordError=Ce.AuthRetryableFetchError=Ce.AuthPKCEGrantCodeExchangeError=Ce.AuthImplicitGrantRedirectError=Ce.AuthInvalidCredentialsError=Ce.AuthInvalidTokenResponseError=Ce.AuthSessionMissingError=Ce.CustomAuthError=Ce.AuthUnknownError=Ce.AuthApiError=Ce.AuthError=void 0;Ce.isAuthError=ko;Ce.isAuthApiError=H5;Ce.isAuthSessionMissingError=V5;Ce.isAuthImplicitGrantRedirectError=z5;Ce.isAuthRetryableFetchError=K5;Ce.isAuthWeakPasswordError=G5;var Ro=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ce.AuthError=Ro;function ko(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var ly=class extends Ro{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ce.AuthApiError=ly;function H5(t){return ko(t)&&t.name==="AuthApiError"}var fy=class extends Ro{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ce.AuthUnknownError=fy;var rn=class extends Ro{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ce.CustomAuthError=rn;var hy=class extends rn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ce.AuthSessionMissingError=hy;function V5(t){return ko(t)&&t.name==="AuthSessionMissingError"}var dy=class extends rn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ce.AuthInvalidTokenResponseError=dy;var py=class extends rn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ce.AuthInvalidCredentialsError=py;var my=class extends rn{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ce.AuthImplicitGrantRedirectError=my;function z5(t){return ko(t)&&t.name==="AuthImplicitGrantRedirectError"}var gy=class extends rn{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Ce.AuthPKCEGrantCodeExchangeError=gy;var yy=class extends rn{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ce.AuthRetryableFetchError=yy;function K5(t){return ko(t)&&t.name==="AuthRetryableFetchError"}var Dy=class extends rn{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ce.AuthWeakPasswordError=Dy;function G5(t){return ko(t)&&t.name==="AuthWeakPasswordError"}var wy=class extends rn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ce.AuthInvalidJwtError=wy});var Df=v(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.byteToBase64URL=Fu;Ur.byteFromBase64URL=Ey;Ur.stringToBase64URL=X5;Ur.stringFromBase64URL=Y5;Ur.codepointToUTF8=LC;Ur.stringToUTF8=by;Ur.stringFromUTF8=jC;Ur.base64UrlToUint8Array=J5;Ur.stringToUint8Array=Z5;Ur.bytesToBase64URL=Q5;var yf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$C=`
23
+ })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:zt.VSN}))}disconnect(e,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let n=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(n),this._setConnectionState("disconnected")},e?this.conn.close(e,r??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let r=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let e=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,r,n){this.logger(e,r,n)}connectionState(){switch(this.conn&&this.conn.readyState){case zt.SOCKET_STATES.connecting:return zt.CONNECTION_STATE.Connecting;case zt.SOCKET_STATES.open:return zt.CONNECTION_STATE.Open;case zt.SOCKET_STATES.closing:return zt.CONNECTION_STATE.Closing;default:return zt.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===zt.CONNECTION_STATE.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,r={config:{}}){let n=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===n);if(i)return i;{let s=new O4.default(`realtime:${e}`,r,this);return this.channels.push(s),s}}push(e){let{topic:r,event:n,payload:i,ref:s}=e,o=()=>{this.encode(e,a=>{var u;(u=this.conn)===null||u===void 0||u.send(a)})};this.log("push",`${r} ${n} (${s})`,i),this.isConnected()?o():this.sendBuffer.push(o)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(zt.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},Kl.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let r=this.channels.find(n=>n.topic===e&&(n._isJoined()||n._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${e}"`),r.unsubscribe())}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply")try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}r.ref&&r.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:n,event:i,payload:s,ref:o}=r,a=o?`(${o})`:"",u=s.status||"";this.log("receive",`${u} ${n} ${i} ${a}`.trim(),s),this.channels.filter(c=>c._isMember(n)).forEach(c=>c._trigger(i,s,o)),this._triggerStateCallbacks("message",r)})}_clearTimer(e){var r;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this.workerRef.terminate()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var r;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(zt.CHANNEL_EVENTS.error))}_appendParams(e,r){if(Object.keys(r).length===0)return e;let n=e.match(/\?/)?"&":"?",i=new URLSearchParams(r);return`${e}${n}${i}`}_workerObjectUrl(e){let r;if(e)r=e;else{let n=new Blob([I4],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_setConnectionState(e,r=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(e=null){let r;e?r=e:this.accessToken?r=await this.accessToken():r=this.accessTokenValue,this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(n=>{let i={access_token:r,version:zt.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(zt.CHANNEL_EVENTS.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(r=>{this.log("error",`error setting auth in ${e}`,r)})}_triggerStateCallbacks(e,r){try{this.stateChangeCallbacks[e].forEach(n=>{try{n(r)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}_setupReconnectionTimer(){this.reconnectTimer=new S4.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},Kl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l;if(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:zt.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:Kl.HEARTBEAT_INTERVAL,this.worker=(s=e?.worker)!==null&&s!==void 0?s:!1,this.accessToken=(o=e?.accessToken)!==null&&o!==void 0?o:null,this.heartbeatCallback=(a=e?.heartbeatCallback)!==null&&a!==void 0?a:vg,e?.params&&(this.params=e.params),e?.logger&&(this.logger=e.logger),(e?.logLevel||e?.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=e?.reconnectAfterMs)!==null&&u!==void 0?u:(h=>x4[h-1]||T4),this.encode=(c=e?.encode)!==null&&c!==void 0?c:((h,d)=>d(JSON.stringify(h))),this.decode=(l=e?.decode)!==null&&l!==void 0?l:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Cg.default=_g});var Sg=v(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.WebSocketFactory=At.REALTIME_CHANNEL_STATES=At.REALTIME_SUBSCRIBE_STATES=At.REALTIME_PRESENCE_LISTEN_EVENTS=At.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=At.REALTIME_LISTEN_TYPES=At.RealtimeClient=At.RealtimeChannel=At.RealtimePresence=void 0;var Wl=(fe(),ue(le)),F4=Wl.__importDefault(dC());At.RealtimeClient=F4.default;var Eu=Wl.__importStar(bg());At.RealtimeChannel=Eu.default;Object.defineProperty(At,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Eu.REALTIME_LISTEN_TYPES}});Object.defineProperty(At,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Eu.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(At,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Eu.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(At,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Eu.REALTIME_CHANNEL_STATES}});var pC=Wl.__importStar(Dg());At.RealtimePresence=pC.default;Object.defineProperty(At,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return pC.REALTIME_PRESENCE_LISTEN_EVENTS}});var P4=Wl.__importDefault(ug());At.WebSocketFactory=P4.default});var Ci=v(Vn=>{"use strict";Object.defineProperty(Vn,"__esModule",{value:!0});Vn.StorageUnknownError=Vn.StorageApiError=Vn.StorageError=void 0;Vn.isStorageError=R4;var bu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Vn.StorageError=bu;function R4(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Ag=class extends bu{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}}};Vn.StorageApiError=Ag;var Og=class extends bu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Vn.StorageUnknownError=Og});var vu=v(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.isPlainObject=Mr.recursiveToCamel=Mr.resolveResponse=Mr.resolveFetch=void 0;var k4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Mr.resolveFetch=k4;var N4=()=>Response;Mr.resolveResponse=N4;var $4=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 i=r.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=(0,Mr.recursiveToCamel)(n)}),e};Mr.recursiveToCamel=$4;var L4=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=L4});var Xl=v(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.get=M4;fs.post=q4;fs.put=U4;fs.head=H4;fs.remove=V4;var ls=(fe(),ue(le)),xg=Ci(),mC=vu(),Tg=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)},j4=(t,e,r)=>ls.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,mC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new xg.StorageApiError(Tg(i),s,o))}).catch(i=>{e(new xg.StorageUnknownError(Tg(i),i))}):e(new xg.StorageUnknownError(Tg(t),t))}),B4=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,mC.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,e?.duplex&&(i.duplex=e.duplex),Object.assign(Object.assign({},i),r))};function _u(t,e,r,n,i,s){return ls.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,B4(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>j4(u,a,n))})})}function M4(t,e,r,n){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"GET",e,r,n)})}function q4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"POST",e,n,i,r)})}function U4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"PUT",e,n,i,r)})}function H4(t,e,r,n){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function V4(t,e,r,n,i){return ls.__awaiter(this,void 0,void 0,function*(){return _u(t,"DELETE",e,n,i,r)})}});var gC=v(Fg=>{"use strict";Object.defineProperty(Fg,"__esModule",{value:!0});var z4=(fe(),ue(le)),K4=Ci(),Ig=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return z4.__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,K4.isStorageError)(e))return{data:null,error:e};throw e}})}};Fg.default=Ig});var wC=v(Rg=>{"use strict";var yC;Object.defineProperty(Rg,"__esModule",{value:!0});var DC=(fe(),ue(le)),G4=Ci(),W4=DC.__importDefault(gC()),Pg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[yC]="BlobDownloadBuilder",this.promise=null}asStream(){return new W4.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 DC.__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,G4.isStorageError)(e))return{data:null,error:e};throw e}})}};yC=Symbol.toStringTag;Rg.default=Pg});var vC=v(Ng=>{"use strict";Object.defineProperty(Ng,"__esModule",{value:!0});var rr=(fe(),ue(le)),yr=Ci(),Dr=Xl(),EC=vu(),X4=rr.__importDefault(wC()),Y4={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},bC={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},kg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,EC.resolveFetch)(i)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){try{let s,o=Object.assign(Object.assign({},bC),i),a=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)}),u=o.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",o.cacheControl),u&&s.append("metadata",this.encodeMetadata(u)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",o.cacheControl),u&&!s.has("metadata")&&s.append("metadata",this.encodeMetadata(u))):(s=n,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,u&&(a["x-metadata"]=this.toBase64(this.encodeMetadata(u))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!o.duplex&&(o.duplex="half")),i?.headers&&(a=Object.assign(Object.assign({},a),i.headers));let c=this._removeEmptyFolders(r),l=this._getFinalPath(c),h=yield(e=="PUT"?Dr.put:Dr.post)(this.fetch,`${this.url}/object/${l}`,s,Object.assign({headers:a},o?.duplex?{duplex:o.duplex}:{}));return{data:{path:c,id:h.Id,fullPath:h.Key},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if((0,yr.isStorageError)(s))return{data:null,error:s};throw s}})}upload(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,r,n)})}uploadToSignedUrl(e,r,n,i){return rr.__awaiter(this,void 0,void 0,function*(){let s=this._removeEmptyFolders(e),o=this._getFinalPath(s),a=new URL(this.url+`/object/upload/sign/${o}`);a.searchParams.set("token",r);try{let u,c=Object.assign({upsert:bC.upsert},i),l=Object.assign(Object.assign({},this.headers),{"x-upsert":String(c.upsert)});typeof Blob<"u"&&n instanceof Blob?(u=new FormData,u.append("cacheControl",c.cacheControl),u.append("",n)):typeof FormData<"u"&&n instanceof FormData?(u=n,u.append("cacheControl",c.cacheControl)):(u=n,l["cache-control"]=`max-age=${c.cacheControl}`,l["content-type"]=c.contentType);let h=yield(0,Dr.put)(this.fetch,a.toString(),u,{headers:l});return{data:{path:s,fullPath:h.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if((0,yr.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=this._getFinalPath(e),i=Object.assign({},this.headers);r?.upsert&&(i["x-upsert"]="true");let s=yield(0,Dr.post)(this.fetch,`${this.url}/object/upload/sign/${n}`,{},{headers:i}),o=new URL(this.url+s.url),a=o.searchParams.get("token");if(!a)throw new yr.StorageError("No token returned by API");return{data:{signedUrl:o.toString(),path:e,token:a},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n))return{data:null,error:n};throw n}})}update(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,r,n)})}move(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Dr.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}copy(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Dr.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:r,destinationBucket:n?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrl(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=this._getFinalPath(e),s=yield(0,Dr.post)(this.fetch,`${this.url}/object/sign/${i}`,Object.assign({expiresIn:r},n?.transform?{transform:n.transform}:{}),{headers:this.headers}),o=n?.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${this.url}${s.signedURL}${o}`)},{data:s,error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}createSignedUrls(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=yield(0,Dr.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:e},{headers:this.headers}),s=n?.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${s}`):null})),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}download(e,r){let i=typeof r?.transform<"u"?"render/image/authenticated":"object",s=this.transformOptsToQueryString(r?.transform||{}),o=s?`?${s}`:"",a=this._getFinalPath(e),u=()=>(0,Dr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new X4.default(u,this.shouldThrowOnError)}info(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{let n=yield(0,Dr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,EC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n))return{data:null,error:n};throw n}})}exists(e){return rr.__awaiter(this,void 0,void 0,function*(){let r=this._getFinalPath(e);try{return yield(0,Dr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,yr.isStorageError)(n)&&n instanceof yr.StorageUnknownError){let i=n.originalError;if([400,404].includes(i?.status))return{data:!1,error:n}}throw n}})}getPublicUrl(e,r){let n=this._getFinalPath(e),i=[],s=r?.download?`download=${r.download===!0?"":r.download}`:"";s!==""&&i.push(s);let a=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&i.push(u);let c=i.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${a}/public/${n}${c}`)}}}remove(e){return rr.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Dr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yr.isStorageError)(r))return{data:null,error:r};throw r}})}list(e,r,n){return rr.__awaiter(this,void 0,void 0,function*(){try{let i=Object.assign(Object.assign(Object.assign({},Y4),r),{prefix:e||""});return{data:yield(0,Dr.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,i,{headers:this.headers},n),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,yr.isStorageError)(i))return{data:null,error:i};throw i}})}listV2(e,r){return rr.__awaiter(this,void 0,void 0,function*(){try{let n=Object.assign({},e);return{data:yield(0,Dr.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,yr.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("&")}};Ng.default=kg});var $g=v(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});Yl.version=void 0;Yl.version="2.79.0"});var Lg=v(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.DEFAULT_HEADERS=void 0;var J4=$g();Jl.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${J4.version}`}});var _C=v(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});var Ao=(fe(),ue(le)),Z4=Lg(),Oo=Ci(),xo=Xl(),Q4=vu(),jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Z4.DEFAULT_HEADERS),r),this.fetch=(0,Q4.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,xo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Ao.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,xo.post)(this.fetch,`${this.url}/bucket`,{id:r,name:r,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if(this.shouldThrowOnError)throw i;if((0,Oo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.put)(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Oo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Ao.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,xo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Oo.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():""}};Bg.default=jg});var zg=v(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var Mg=(fe(),ue(le)),e5=Lg(),qg=Ci(),Ug=Xl(),t5=vu(),Hg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},e5.DEFAULT_HEADERS),r),this.fetch=(0,t5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Mg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ug.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Mg.__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(),i=n?`${this.url}/bucket?${n}`:`${this.url}/bucket`;return{data:yield(0,Ug.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Mg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ug.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,qg.isStorageError)(r))return{data:null,error:r};throw r}})}};Vg.default=Hg});var Ql=v(Zl=>{"use strict";Object.defineProperty(Zl,"__esModule",{value:!0});Zl.DEFAULT_HEADERS=void 0;var r5=$g();Zl.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${r5.version}`,"Content-Type":"application/json"}});var To=v(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.StorageVectorsErrorCode=rn.StorageVectorsUnknownError=rn.StorageVectorsApiError=rn.StorageVectorsError=void 0;rn.isStorageVectorsError=n5;var Cu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};rn.StorageVectorsError=Cu;function n5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var Kg=class extends Cu{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}}};rn.StorageVectorsApiError=Kg;var Gg=class extends Cu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};rn.StorageVectorsUnknownError=Gg;var CC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(CC||(rn.StorageVectorsErrorCode=CC={}))});var Io=v(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.validateVectorDimension=qr.normalizeToFloat32=qr.isPlainObject=qr.resolveResponse=qr.resolveFetch=void 0;var i5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);qr.resolveFetch=i5;var s5=()=>Response;qr.resolveResponse=s5;var o5=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)};qr.isPlainObject=o5;var a5=t=>Array.from(new Float32Array(t));qr.normalizeToFloat32=a5;var u5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};qr.validateVectorDimension=u5});var rf=v(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.get=h5;Po.post=d5;Po.put=p5;Po.remove=m5;var Fo=(fe(),ue(le)),ef=To(),c5=Io(),SC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),l5=(t,e,r)=>Fo.__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 i=t.status||500,s=t;if(typeof s.json=="function")s.json().then(o=>{let a=o?.statusCode||o?.code||i+"";e(new ef.StorageVectorsApiError(SC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new ef.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new ef.StorageVectorsApiError(a,i,o))}}else e(new ef.StorageVectorsUnknownError(SC(t),t))}),f5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,c5.isPlainObject)(n)?(i.headers=Object.assign({"Content-Type":"application/json"},e?.headers),i.body=JSON.stringify(n)):i.body=n,Object.assign(Object.assign({},i),r))};function tf(t,e,r,n,i,s){return Fo.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,f5(e,n,i,s)).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=>o(u)).catch(u=>l5(u,a,n))})})}function h5(t,e,r,n){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"GET",e,r,n)})}function d5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"POST",e,n,i,r)})}function p5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"PUT",e,n,i,r)})}function m5(t,e,r,n,i){return Fo.__awaiter(this,void 0,void 0,function*(){return tf(t,"DELETE",e,n,i,r)})}});var Yg=v(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});var nf=(fe(),ue(le)),g5=Ql(),sf=To(),of=rf(),y5=Io(),Wg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},g5.DEFAULT_HEADERS),r),this.fetch=(0,y5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,of.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,sf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,of.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,sf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,of.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,sf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return nf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,of.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,sf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};Xg.default=Wg});var Qg=v(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Su=(fe(),ue(le)),D5=Ql(),Au=To(),Ou=rf(),w5=Io(),Jg=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},D5.DEFAULT_HEADERS),r),this.fetch=(0,w5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Su.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ou.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Su.__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,Ou.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Au.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};Zg.default=Jg});var ry=v(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});var af=(fe(),ue(le)),E5=Ql(),uf=To(),cf=rf(),b5=Io(),ey=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},E5.DEFAULT_HEADERS),r),this.fetch=(0,b5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,cf.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,cf.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return af.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,cf.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return af.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,cf.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,uf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};ty.default=ey});var AC=v(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.VectorIndexScope=Si.VectorBucketScope=Si.StorageVectorsClient=void 0;var Ur=(fe(),ue(le)),v5=Ur.__importDefault(Yg()),_5=Ur.__importDefault(Qg()),C5=Ur.__importDefault(ry()),ny=class extends C5.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new lf(this.url,this.headers,e,this.fetch)}};Si.StorageVectorsClient=ny;var lf=class extends v5.default{constructor(e,r,n,i){super(e,r,i),this.vectorBucketName=n}createIndex(e){let r=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Ur.__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 Ur.__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 Ur.__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 Ur.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new ff(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Si.VectorBucketScope=lf;var ff=class extends _5.default{constructor(e,r,n,i,s){super(e,r,s),this.vectorBucketName=n,this.indexName=i}putVectors(e){let r=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Ur.__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 Ur.__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 Ur.__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 Ur.__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 Ur.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Si.VectorIndexScope=ff});var oy=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.validateVectorDimension=_e.normalizeToFloat32=_e.isPlainObject=_e.resolveResponse=_e.resolveFetch=_e.isStorageVectorsError=_e.StorageVectorsErrorCode=_e.StorageVectorsUnknownError=_e.StorageVectorsApiError=_e.StorageVectorsError=_e.VectorDataApi=_e.VectorIndexApi=_e.VectorBucketApi=_e.VectorIndexScope=_e.VectorBucketScope=_e.StorageVectorsClient=void 0;var iy=(fe(),ue(le)),sy=AC();Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return sy.StorageVectorsClient}});Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return sy.VectorBucketScope}});Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return sy.VectorIndexScope}});var S5=ry();Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return iy.__importDefault(S5).default}});var A5=Yg();Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return iy.__importDefault(A5).default}});var O5=Qg();Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return iy.__importDefault(O5).default}});var xu=To();Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return xu.StorageVectorsError}});Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return xu.StorageVectorsApiError}});Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return xu.StorageVectorsUnknownError}});Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return xu.StorageVectorsErrorCode}});Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return xu.isStorageVectorsError}});var Tu=Io();Object.defineProperty(_e,"resolveFetch",{enumerable:!0,get:function(){return Tu.resolveFetch}});Object.defineProperty(_e,"resolveResponse",{enumerable:!0,get:function(){return Tu.resolveResponse}});Object.defineProperty(_e,"isPlainObject",{enumerable:!0,get:function(){return Tu.isPlainObject}});Object.defineProperty(_e,"normalizeToFloat32",{enumerable:!0,get:function(){return Tu.normalizeToFloat32}});Object.defineProperty(_e,"validateVectorDimension",{enumerable:!0,get:function(){return Tu.validateVectorDimension}})});var OC=v(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});hf.StorageClient=void 0;var uy=(fe(),ue(le)),x5=uy.__importDefault(vC()),T5=uy.__importDefault(_C()),I5=uy.__importDefault(zg()),F5=oy(),ay=class extends T5.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new x5.default(this.url,this.headers,e,this.fetch)}get vectors(){return new F5.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new I5.default(this.url+"/iceberg",this.headers,this.fetch)}};hf.StorageClient=ay});var TC=v(xC=>{"use strict";Object.defineProperty(xC,"__esModule",{value:!0})});var IC=v(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.StorageAnalyticsApi=zn.StorageClient=void 0;var df=(fe(),ue(le)),P5=OC();Object.defineProperty(zn,"StorageClient",{enumerable:!0,get:function(){return P5.StorageClient}});var R5=zg();Object.defineProperty(zn,"StorageAnalyticsApi",{enumerable:!0,get:function(){return df.__importDefault(R5).default}});df.__exportStar(TC(),zn);df.__exportStar(Ci(),zn);df.__exportStar(oy(),zn)});var FC=v(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.version=void 0;pf.version="2.79.0"});var PC=v(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.DEFAULT_REALTIME_OPTIONS=Ir.DEFAULT_AUTH_OPTIONS=Ir.DEFAULT_DB_OPTIONS=Ir.DEFAULT_GLOBAL_OPTIONS=Ir.DEFAULT_HEADERS=void 0;var k5=FC(),Iu="";typeof Deno<"u"?Iu="deno":typeof document<"u"?Iu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Iu="react-native":Iu="node";Ir.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Iu}/${k5.version}`};Ir.DEFAULT_GLOBAL_OPTIONS={headers:Ir.DEFAULT_HEADERS};Ir.DEFAULT_DB_OPTIONS={schema:"public"};Ir.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Ir.DEFAULT_REALTIME_OPTIONS={}});var RC=v(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.fetchWithAuth=hn.resolveHeadersConstructor=hn.resolveFetch=void 0;var N5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);hn.resolveFetch=N5;var $5=()=>Headers;hn.resolveHeadersConstructor=$5;var L5=(t,e,r)=>{let n=(0,hn.resolveFetch)(r),i=(0,hn.resolveHeadersConstructor)();return async(s,o)=>{var a;let u=(a=await e())!==null&&a!==void 0?a:t,c=new i(o?.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${u}`),n(s,Object.assign(Object.assign({},o),{headers:c}))}};hn.fetchWithAuth=L5});var NC=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});Ai.isBrowser=void 0;Ai.uuid=j5;Ai.ensureTrailingSlash=kC;Ai.applySettingDefaults=M5;Ai.validateSupabaseUrl=q5;function j5(){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 kC(t){return t.endsWith("/")?t:t+"/"}var B5=()=>typeof window<"u";Ai.isBrowser=B5;function M5(t,e){var r,n;let{db:i,auth:s,realtime:o,global:a}=t,{db:u,auth:c,realtime:l,global:h}=e,d={db:Object.assign(Object.assign({},u),i),auth:Object.assign(Object.assign({},c),s),realtime:Object.assign(Object.assign({},l),o),storage:{},global:Object.assign(Object.assign(Object.assign({},h),a),{headers:Object.assign(Object.assign({},(r=h?.headers)!==null&&r!==void 0?r:{}),(n=a?.headers)!==null&&n!==void 0?n:{})}),accessToken:async()=>""};return t.accessToken?d.accessToken=t.accessToken:delete d.accessToken,d}function q5(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(kC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var cy=v(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.version=void 0;mf.version="2.79.0"});var gf=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.JWKS_TTL=Le.BASE64URL_REGEX=Le.API_VERSIONS=Le.API_VERSION_HEADER_NAME=Le.NETWORK_FAILURE=Le.DEFAULT_HEADERS=Le.AUDIENCE=Le.STORAGE_KEY=Le.GOTRUE_URL=Le.EXPIRY_MARGIN_MS=Le.AUTO_REFRESH_TICK_THRESHOLD=Le.AUTO_REFRESH_TICK_DURATION_MS=void 0;var U5=cy();Le.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;Le.AUTO_REFRESH_TICK_THRESHOLD=3;Le.EXPIRY_MARGIN_MS=Le.AUTO_REFRESH_TICK_THRESHOLD*Le.AUTO_REFRESH_TICK_DURATION_MS;Le.GOTRUE_URL="http://localhost:9999";Le.STORAGE_KEY="supabase.auth.token";Le.AUDIENCE="";Le.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${U5.version}`};Le.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};Le.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";Le.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};Le.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;Le.JWKS_TTL=600*1e3});var hs=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.AuthInvalidJwtError=Se.AuthWeakPasswordError=Se.AuthRetryableFetchError=Se.AuthPKCEGrantCodeExchangeError=Se.AuthImplicitGrantRedirectError=Se.AuthInvalidCredentialsError=Se.AuthInvalidTokenResponseError=Se.AuthSessionMissingError=Se.CustomAuthError=Se.AuthUnknownError=Se.AuthApiError=Se.AuthError=void 0;Se.isAuthError=ko;Se.isAuthApiError=H5;Se.isAuthSessionMissingError=V5;Se.isAuthImplicitGrantRedirectError=z5;Se.isAuthRetryableFetchError=K5;Se.isAuthWeakPasswordError=G5;var Ro=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Se.AuthError=Ro;function ko(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var ly=class extends Ro{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Se.AuthApiError=ly;function H5(t){return ko(t)&&t.name==="AuthApiError"}var fy=class extends Ro{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Se.AuthUnknownError=fy;var nn=class extends Ro{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Se.CustomAuthError=nn;var hy=class extends nn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Se.AuthSessionMissingError=hy;function V5(t){return ko(t)&&t.name==="AuthSessionMissingError"}var dy=class extends nn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Se.AuthInvalidTokenResponseError=dy;var py=class extends nn{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Se.AuthInvalidCredentialsError=py;var my=class extends nn{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Se.AuthImplicitGrantRedirectError=my;function z5(t){return ko(t)&&t.name==="AuthImplicitGrantRedirectError"}var gy=class extends nn{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Se.AuthPKCEGrantCodeExchangeError=gy;var yy=class extends nn{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Se.AuthRetryableFetchError=yy;function K5(t){return ko(t)&&t.name==="AuthRetryableFetchError"}var Dy=class extends nn{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Se.AuthWeakPasswordError=Dy;function G5(t){return ko(t)&&t.name==="AuthWeakPasswordError"}var wy=class extends nn{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Se.AuthInvalidJwtError=wy});var Df=v(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.byteToBase64URL=Fu;Hr.byteFromBase64URL=Ey;Hr.stringToBase64URL=X5;Hr.stringFromBase64URL=Y5;Hr.codepointToUTF8=LC;Hr.stringToUTF8=by;Hr.stringFromUTF8=jC;Hr.base64UrlToUint8Array=J5;Hr.stringToUint8Array=Z5;Hr.bytesToBase64URL=Q5;var yf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),$C=`
24
24
  \r=`.split(""),W5=(()=>{let t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<$C.length;e+=1)t[$C[e].charCodeAt(0)]=-2;for(let e=0;e<yf.length;e+=1)t[yf[e].charCodeAt(0)]=e;return t})();function Fu(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;r(yf[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){let n=e.queue>>e.queuedBits-6&63;r(yf[n]),e.queuedBits-=6}}function Ey(t,e,r){let n=W5[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function X5(t){let e=[],r=i=>{e.push(i)},n={queue:0,queuedBits:0};return by(t,i=>{Fu(i,n,r)}),Fu(null,n,r),e.join("")}function Y5(t){let e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=o=>{jC(o,n,r)};for(let o=0;o<t.length;o+=1)Ey(t.charCodeAt(o),i,s);return e.join("")}function LC(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function by(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){let i=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|i)+65536,r+=1}LC(n,e)}}function jC(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function J5(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)Ey(t.charCodeAt(i),r,n);return new Uint8Array(e)}function Z5(t){let e=[];return by(t,r=>e.push(r)),new Uint8Array(e)}function Q5(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>Fu(i,r,n)),Fu(null,r,n),e.join("")}});var No=v(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.Deferred=be.removeItemAsync=be.getItemAsync=be.setItemAsync=be.looksLikeFetchResponse=be.resolveFetch=be.supportsLocalStorage=be.isBrowser=void 0;be.expiresAt=e9;be.uuid=t9;be.parseParametersFromURL=i9;be.decodeJWT=l9;be.sleep=f9;be.retryable=h9;be.generatePKCEVerifier=qC;be.generatePKCEChallenge=UC;be.getCodeChallengeAndMethod=m9;be.parseResponseAPIVersion=y9;be.validateExp=D9;be.getAlgorithm=w9;be.validateUUID=b9;be.userNotAvailableProxy=v9;be.insecureUserWarningProxy=_9;be.deepClone=C9;var MC=gf(),BC=hs(),vy=Df();function e9(t){return Math.round(Date.now()/1e3)+t}function t9(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}var r9=()=>typeof window<"u"&&typeof document<"u";be.isBrowser=r9;var ds={tested:!1,writable:!1},n9=()=>{if(!(0,be.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ds.tested)return ds.writable;let t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ds.tested=!0,ds.writable=!0}catch{ds.tested=!0,ds.writable=!1}return ds.writable};be.supportsLocalStorage=n9;function i9(t){let e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return r.searchParams.forEach((n,i)=>{e[i]=n}),e}var s9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);be.resolveFetch=s9;var o9=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function";be.looksLikeFetchResponse=o9;var a9=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))};be.setItemAsync=a9;var u9=async(t,e)=>{let r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}};be.getItemAsync=u9;var c9=async(t,e)=>{await t.removeItem(e)};be.removeItemAsync=c9;var wf=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=wf;wf.promiseConstructor=Promise;function l9(t){let e=t.split(".");if(e.length!==3)throw new BC.AuthInvalidJwtError("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!MC.BASE64URL_REGEX.test(e[n]))throw new BC.AuthInvalidJwtError("JWT not in base64url format");return{header:JSON.parse((0,vy.stringFromBase64URL)(e[0])),payload:JSON.parse((0,vy.stringFromBase64URL)(e[1])),signature:(0,vy.base64UrlToUint8Array)(e[2]),raw:{header:e[0],payload:e[1]}}}async function f9(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function h9(t,e){return new Promise((n,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{let o=await t(s);if(!e(s,null,o)){n(o);return}}catch(o){if(!e(s,o)){i(o);return}}})()})}function d9(t){return("0"+t.toString(16)).substr(-2)}function qC(){let e=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length,i="";for(let s=0;s<56;s++)i+=r.charAt(Math.floor(Math.random()*n));return i}return crypto.getRandomValues(e),Array.from(e,d9).join("")}async function p9(t){let r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),i=new Uint8Array(n);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function UC(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;let r=await p9(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function m9(t,e,r=!1){let n=qC(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await(0,be.setItemAsync)(t,`${e}-code-verifier`,i);let s=await UC(n);return[s,n===s?"plain":"s256"]}var g9=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function y9(t){let e=t.headers.get(MC.API_VERSION_HEADER_NAME);if(!e||!e.match(g9))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function D9(t){if(!t)throw new Error("Missing exp claim");let e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function w9(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}var E9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function b9(t){if(!E9.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function v9(){let t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){let n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function _9(t,e){return new Proxy(t,{get:(r,n,i)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){let s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,i)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,i)}})}function C9(t){return JSON.parse(JSON.stringify(t))}});var Sy=v(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.handleError=Cy;dn._request=x9;dn._sessionResponse=HC;dn._sessionResponsePassword=I9;dn._userResponse=F9;dn._ssoResponse=P9;dn._generateLinkResponse=R9;dn._noResolveJsonResponse=k9;var S9=(fe(),ue(le)),Ef=gf(),_y=No(),Oi=hs(),ps=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),A9=[502,503,504];async function Cy(t){var e;if(!(0,_y.looksLikeFetchResponse)(t))throw new Oi.AuthRetryableFetchError(ps(t),0);if(A9.includes(t.status))throw new Oi.AuthRetryableFetchError(ps(t),t.status);let r;try{r=await t.json()}catch(s){throw new Oi.AuthUnknownError(ps(s),s)}let n,i=(0,_y.parseResponseAPIVersion)(t);if(i&&i.getTime()>=Ef.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new Oi.AuthWeakPasswordError(ps(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Oi.AuthSessionMissingError}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((s,o)=>s&&typeof o=="string",!0))throw new Oi.AuthWeakPasswordError(ps(r),t.status,r.weak_password.reasons);throw new Oi.AuthApiError(ps(r),t.status||500,n)}var O9=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e?.headers),i.body=JSON.stringify(n),Object.assign(Object.assign({},i),r))};async function x9(t,e,r,n){var i;let s=Object.assign({},n?.headers);s[Ef.API_VERSION_HEADER_NAME]||(s[Ef.API_VERSION_HEADER_NAME]=Ef.API_VERSIONS["2024-01-01"].name),n?.jwt&&(s.Authorization=`Bearer ${n.jwt}`);let o=(i=n?.query)!==null&&i!==void 0?i:{};n?.redirectTo&&(o.redirect_to=n.redirectTo);let a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",u=await T9(t,e,r+a,{headers:s,noResolveJson:n?.noResolveJson},{},n?.body);return n?.xform?n?.xform(u):{data:Object.assign({},u),error:null}}async function T9(t,e,r,n,i,s){let o=O9(e,n,i,s),a;try{a=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new Oi.AuthRetryableFetchError(ps(u),0)}if(a.ok||await Cy(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await Cy(u)}}function HC(t){var e;let r=null;N9(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,_y.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function I9(t){let e=HC(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function F9(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function P9(t){return{data:t,error:null}}function R9(t){let{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=t,o=S9.__rest(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s},u=Object.assign({},o);return{data:{properties:a,user:u},error:null}}function k9(t){return t}function N9(t){return t.access_token&&t.refresh_token&&t.expires_in}});var Ay=v(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.SIGN_OUT_SCOPES=void 0;bf.SIGN_OUT_SCOPES=["global","local","others"]});var vf=v(Ty=>{"use strict";Object.defineProperty(Ty,"__esModule",{value:!0});var $9=(fe(),ue(le)),st=Sy(),ms=No(),Oy=Ay(),Kt=hs(),xy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,ms.resolveFetch)(n),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,r=Oy.SIGN_OUT_SCOPES[0]){if(Oy.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Oy.SIGN_OUT_SCOPES.join(", ")}`);try{return await(0,st._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if((0,Kt.isAuthError)(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await(0,st._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:st._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{let{options:r}=e,n=$9.__rest(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n?.newEmail,delete i.newEmail),await(0,st._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:st._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Kt.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await(0,st._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:st._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,i,s,o,a,u;try{let c={nextPage:null,lastPage:0,total:0},l=await(0,st._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e?.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:st._noResolveJsonResponse});if(l.error)throw l.error;let h=await l.json(),d=(o=l.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(u=(a=l.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(m=>{let y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(m.split(";")[1].split("=")[1]);c[`${E}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if((0,Kt.isAuthError)(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){(0,ms.validateUUID)(e);try{return await(0,st._request)(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:st._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){(0,ms.validateUUID)(e);try{return await(0,st._request)(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:st._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){(0,ms.validateUUID)(e);try{return await(0,st._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:st._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){(0,ms.validateUUID)(e.userId);try{let{data:r,error:n}=await(0,st._request)(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:r,error:n}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(e){(0,ms.validateUUID)(e.userId),(0,ms.validateUUID)(e.id);try{return{data:await(0,st._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,i,s,o,a,u;try{let c={nextPage:null,lastPage:0,total:0},l=await(0,st._request)(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e?.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(s=(i=e?.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:st._noResolveJsonResponse});if(l.error)throw l.error;let h=await l.json(),d=(o=l.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(u=(a=l.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(m=>{let y=parseInt(m.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(m.split(";")[1].split("=")[1]);c[`${E}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if((0,Kt.isAuthError)(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await(0,st._request)(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{return await(0,st._request)(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{return await(0,st._request)(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:r,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if((0,Kt.isAuthError)(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{return await(0,st._request)(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{return await(0,st._request)(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if((0,Kt.isAuthError)(r))return{data:null,error:r};throw r}}};Ty.default=xy});var VC=v(Iy=>{"use strict";Object.defineProperty(Iy,"__esModule",{value:!0});Iy.memoryLocalStorageAdapter=L9;function L9(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var Fy=v(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.ProcessLockAcquireTimeoutError=Pt.NavigatorLockAcquireTimeoutError=Pt.LockAcquireTimeoutError=Pt.internals=void 0;Pt.navigatorLock=B9;Pt.processLock=M9;var j9=No();Pt.internals={debug:!!(globalThis&&(0,j9.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var Pu=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Pt.LockAcquireTimeoutError=Pu;var _f=class extends Pu{};Pt.NavigatorLockAcquireTimeoutError=_f;var Cf=class extends Pu{};Pt.ProcessLockAcquireTimeoutError=Cf;async function B9(t,e,r){Pt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Pt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){Pt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{Pt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Pt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new _f(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Pt.internals.debug)try{let s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null," "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}var zC={};async function M9(t,e,r){var n;let i=(n=zC[t])!==null&&n!==void 0?n:Promise.resolve(),s=Promise.race([i.catch(()=>null),e>=0?new Promise((o,a)=>{setTimeout(()=>{a(new Cf(`Acquring process lock with name "${t}" timed out`))},e)}):null].filter(o=>o)).catch(o=>{if(o&&o.isAcquireTimeout)throw o;return null}).then(async()=>await r());return zC[t]=s.catch(async o=>{if(o&&o.isAcquireTimeout)return await i,null;throw o}),await s}});var KC=v(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.polyfillGlobalThis=q9;function q9(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}});var WC=v($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.getAddress=GC;$o.fromHex=U9;$o.toHex=H9;$o.createSiweMessage=V9;function GC(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function U9(t){return parseInt(t,16)}function H9(t){let e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function V9(t){var e;let{chainId:r,domain:n,expirationTime:i,issuedAt:s=new Date,nonce:o,notBefore:a,requestId:u,resources:c,scheme:l,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
25
25
  `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}let f=GC(t.address),m=l?`${l}://${n}`:n,y=t.statement?`${t.statement}
26
26
  `:"",E=`${m} wants you to sign in with your Ethereum account:
27
27
  ${f}
28
28
 
29
- ${y}`,C=`URI: ${h}
29
+ ${y}`,S=`URI: ${h}
30
30
  Version: ${d}
31
31
  Chain ID: ${r}${o?`
32
32
  Nonce: ${o}`:""}
33
- Issued At: ${s.toISOString()}`;if(i&&(C+=`
34
- Expiration Time: ${i.toISOString()}`),a&&(C+=`
35
- Not Before: ${a.toISOString()}`),u&&(C+=`
33
+ Issued At: ${s.toISOString()}`;if(i&&(S+=`
34
+ Expiration Time: ${i.toISOString()}`),a&&(S+=`
35
+ Not Before: ${a.toISOString()}`),u&&(S+=`
36
36
  Request ID: ${u}`),c){let A=`
37
37
  Resources:`;for(let p of c){if(!p||typeof p!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${p}`);A+=`
38
- - ${p}`}C+=A}return`${E}
39
- ${C}`}});var YC=v(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.WebAuthnUnknownError=Kn.WebAuthnError=void 0;Kn.isWebAuthnError=z9;Kn.identifyRegistrationError=K9;Kn.identifyAuthenticationError=G9;var XC=ky(),ut=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};Kn.WebAuthnError=ut;var Ry=class extends ut{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Kn.WebAuthnUnknownError=Ry;function z9(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function K9({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ut({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ut({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ut({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ut({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ut({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ut({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ut({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,XC.isValidDomain)(o)){if(s.rp.id!==o)return new ut({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new ut({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function G9({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ut({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,XC.isValidDomain)(n)){if(r.rpId!==n)return new ut({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var ky=v(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.WebAuthnApi=Se.DEFAULT_REQUEST_OPTIONS=Se.DEFAULT_CREATION_OPTIONS=Se.webAuthnAbortService=Se.WebAuthnAbortService=Se.identifyAuthenticationError=Se.identifyRegistrationError=Se.isWebAuthnError=Se.WebAuthnError=void 0;Se.deserializeCredentialCreationOptions=X9;Se.deserializeCredentialRequestOptions=Y9;Se.serializeCredentialCreationResponse=J9;Se.serializeCredentialRequestResponse=Z9;Se.isValidDomain=Q9;Se.createCredential=QC;Se.getCredential=eS;Se.mergeCredentialCreationOptions=tS;Se.mergeCredentialRequestOptions=rS;var ZC=(fe(),ue(le)),nn=Df(),pn=hs(),W9=No(),mn=YC();Object.defineProperty(Se,"identifyAuthenticationError",{enumerable:!0,get:function(){return mn.identifyAuthenticationError}});Object.defineProperty(Se,"identifyRegistrationError",{enumerable:!0,get:function(){return mn.identifyRegistrationError}});Object.defineProperty(Se,"isWebAuthnError",{enumerable:!0,get:function(){return mn.isWebAuthnError}});Object.defineProperty(Se,"WebAuthnError",{enumerable:!0,get:function(){return mn.WebAuthnError}});var Sf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Se.WebAuthnAbortService=Sf;Se.webAuthnAbortService=new Sf;function X9(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=ZC.__rest(t,["challenge","user","excludeCredentials"]),s=(0,nn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,nn.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,nn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Y9(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=ZC.__rest(t,["challenge","allowCredentials"]),i=(0,nn.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,nn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function J9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,nn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,nn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Z9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,nn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,nn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,nn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,nn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Q9(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function JC(){var t,e;return!!((0,W9.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function QC(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new mn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new mn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,mn.identifyRegistrationError)({error:e,options:t})}}}async function eS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new mn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new mn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,mn.identifyAuthenticationError)({error:e,options:t})}}}Se.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"};Se.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"]};function Af(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Af(a,o):n[s]=Af(o)}else n[s]=o}return n}function tS(t,e){return Af(Se.DEFAULT_CREATION_OPTIONS,t,e||{})}function rS(t,e){return Af(Se.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Ny=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Se.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=tS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await QC({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=rS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await eS(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}},s){if(!r)return{data:null,error:new pn.AuthError("rpId is required for WebAuthn authentication")};try{if(!JC())return{data:null,error:new pn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i},s){if(!r)return{data:null,error:new pn.AuthError("rpId is required for WebAuthn registration")};try{if(!JC())return{data:null,error:new pn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in register",o)}}}};Se.WebAuthnApi=Ny});var Ly=v($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});var e7=(fe(),ue(le)),t7=e7.__importDefault(vf()),wr=gf(),ee=hs(),he=Sy(),se=No(),nS=VC(),iS=Fy(),r7=KC(),n7=cy(),sS=Df(),Of=WC(),Ru=ky();(0,r7.polyfillGlobalThis)();var i7={url:wr.GOTRUE_URL,storageKey:wr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:wr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function oS(t,e,r){return await r()}var Lo={},xf=class t{get jwks(){var e,r;return(r=(e=Lo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Lo[this.storageKey]=Object.assign(Object.assign({},Lo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Lo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Lo[this.storageKey]=Object.assign(Object.assign({},Lo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=t.nextInstanceID,t.nextInstanceID+=1,this.instanceID>0&&(0,se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let i=Object.assign(Object.assign({},i7),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new t7.default({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=(0,se.resolveFetch)(i.fetch),this.lock=i.lock||oS,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:(0,se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=iS.navigatorLock:this.lock=oS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Ru.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,nS.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,nS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${n7.version}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,ee.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,ee.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new ee.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:he._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:he._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:he._sessionResponse})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:y,wallet:E,statement:C,options:A}=e,p;if((0,se.isBrowser)())if(typeof E=="object")p=E;else{let k=window;if("ethereum"in k&&typeof k.ethereum=="object"&&"request"in k.ethereum&&typeof k.ethereum.request=="function")p=k.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=E}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(k=>k).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let _=(0,Of.getAddress)(w[0]),P=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!P){let k=await p.request({method:"eth_chainId"});P=(0,Of.fromHex)(k)}let b={domain:D.host,address:_,statement:C,uri:D.href,version:"1",chainId:P,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,Of.createSiweMessage)(b),m=await p.request({method:"personal_sign",params:[(0,Of.toHex)(f),_]})}try{let{data:y,error:E}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:he._sessionResponse});if(E)throw E;if(!y||!y.session||!y.user){let C=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:C})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:E})}catch(y){if((0,ee.isAuthError)(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{let{chain:E,wallet:C,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof C=="object")D=C;else{let _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))D=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof C!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=C}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let _=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),P;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")P=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)P=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)m=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),y=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
40
- `);let _=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=_}}try{let{data:E,error:C}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,sS.bytesToBase64URL)(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:he._sessionResponse});if(C)throw C;if(!E||!E.session||!E.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:C})}catch(E){if((0,ee.isAuthError)(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:he._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:he._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,ee.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,he._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:he._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i;try{let s=null,o=null;this.flowType==="pkce"&&([s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let a=await(0,he._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:he._ssoResponse});return this._returnResult(a)}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new ee.AuthSessionMissingError;let{error:i}=await(0,he._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,ee.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<wr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:he._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ee.AuthSessionMissingError}:await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:he._userResponse})})}catch(r){if((0,ee.isAuthError)(r))return(0,ee.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new ee.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,he._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:he._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ee.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new ee.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new ee.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ee.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ee.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ee.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ee.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new ee.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=wr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:y,error:E}=await this._getUser(s);if(E)throw E;let C={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:C,redirectType:e.type},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,ee.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.uuid)(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,he._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,he._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:he._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ee.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,he._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:he._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,ee.isAuthRetryableFetchError)(s)&&Date.now()+o-n<wr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,ee.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<wr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${wr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,ee.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new ee.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new ee.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,ee.isAuthError)(s)){let o={data:null,error:s};return(0,ee.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),wr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/wr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${wr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${wr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=wr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof iS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,he._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Ru.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Ru.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Ru.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Ru.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,he._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ee.AuthSessionMissingError})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+wr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,he._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,sS.stringToUint8Array)(`${a}.${u}`)))throw new ee.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};xf.nextInstanceID=0;$y.default=xf});var aS=v(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});var s7=(fe(),ue(le)),o7=s7.__importDefault(vf()),a7=o7.default;jy.default=a7});var uS=v(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var u7=(fe(),ue(le)),c7=u7.__importDefault(Ly()),l7=c7.default;By.default=l7});var My=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.processLock=Ot.lockInternals=Ot.NavigatorLockAcquireTimeoutError=Ot.navigatorLock=Ot.AuthClient=Ot.AuthAdminApi=Ot.GoTrueClient=Ot.GoTrueAdminApi=void 0;var jo=(fe(),ue(le)),f7=jo.__importDefault(vf());Ot.GoTrueAdminApi=f7.default;var h7=jo.__importDefault(Ly());Ot.GoTrueClient=h7.default;var d7=jo.__importDefault(aS());Ot.AuthAdminApi=d7.default;var p7=jo.__importDefault(uS());Ot.AuthClient=p7.default;jo.__exportStar(Ay(),Ot);jo.__exportStar(hs(),Ot);var Tf=Fy();Object.defineProperty(Ot,"navigatorLock",{enumerable:!0,get:function(){return Tf.navigatorLock}});Object.defineProperty(Ot,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Tf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(Ot,"lockInternals",{enumerable:!0,get:function(){return Tf.internals}});Object.defineProperty(Ot,"processLock",{enumerable:!0,get:function(){return Tf.processLock}})});var cS=v(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.SupabaseAuthClient=void 0;var m7=My(),qy=class extends m7.AuthClient{constructor(e){super(e)}};If.SupabaseAuthClient=qy});var Vy=v(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});var g7=Vm(),y7=ag(),D7=Sg(),w7=IC(),Ff=PC(),E7=RC(),lS=NC(),b7=cS(),Uy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,lS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Ff.DEFAULT_DB_OPTIONS,realtime:Ff.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Ff.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Ff.DEFAULT_GLOBAL_OPTIONS},l=(0,lS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,E7.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new y7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new w7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new g7.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:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new b7.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new D7.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)}};Hy.default=Uy});var dS=v(ze=>{"use strict";var v7=ze&&ze.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),fS=ze&&ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v7(e,t,r)},hS=ze&&ze.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ze,"__esModule",{value:!0});ze.createClient=ze.SupabaseClient=ze.FunctionRegion=ze.FunctionsError=ze.FunctionsRelayError=ze.FunctionsFetchError=ze.FunctionsHttpError=ze.PostgrestError=void 0;var _7=hS(Vy());fS(My(),ze);var C7=ag();Object.defineProperty(ze,"PostgrestError",{enumerable:!0,get:function(){return C7.PostgrestError}});var ku=Vm();Object.defineProperty(ze,"FunctionsHttpError",{enumerable:!0,get:function(){return ku.FunctionsHttpError}});Object.defineProperty(ze,"FunctionsFetchError",{enumerable:!0,get:function(){return ku.FunctionsFetchError}});Object.defineProperty(ze,"FunctionsRelayError",{enumerable:!0,get:function(){return ku.FunctionsRelayError}});Object.defineProperty(ze,"FunctionsError",{enumerable:!0,get:function(){return ku.FunctionsError}});Object.defineProperty(ze,"FunctionRegion",{enumerable:!0,get:function(){return ku.FunctionRegion}});fS(Sg(),ze);var S7=Vy();Object.defineProperty(ze,"SupabaseClient",{enumerable:!0,get:function(){return hS(S7).default}});var A7=(t,e,r)=>new _7.default(t,e,r);ze.createClient=A7;function O7(){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}O7()&&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 zy=v((Bge,pS)=>{pS.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 Pf=v(gS=>{var mS={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 x7(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(mS))gS[t]=x7(mS[t])});var bS=v((qge,ES)=>{var T7=require("fs"),It=require("path"),yS=zy(),I7=Pf(),F7=typeof process=="object"&&process.platform==="win32",DS=t=>typeof t=="object"&&t!==null,wS=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 pt(t){this.sep=It.sep,this.fs=T7,DS(t)&&DS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}ES.exports=pt;pt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw I7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};pt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=It.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};pt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=It.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};pt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=It.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(It.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};pt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=It.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(It.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};pt.prototype.getAttributes=function(){};pt.prototype.setAttributes=function(){};pt.crc32update=function(t,e){return wS[(t^e)&255]^t>>>8};pt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=pt.crc32update(r,t[n++]);return~r>>>0};pt.methodToString=function(t){switch(t){case yS.STORED:return"STORED ("+t+")";case yS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};pt.canonical=function(t){if(!t)return"";let e=It.posix.normalize("/"+t.split("\\").join("/"));return It.join(".",e)};pt.zipnamefix=function(t){if(!t)return"";let e=It.posix.normalize("/"+t.split("\\").join("/"));return It.posix.join(".",e)};pt.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]};pt.sanitize=function(t,e){t=It.resolve(It.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=It.normalize(It.join(t,r.slice(n,i).join(It.sep)));if(s.indexOf(t)===0)return s}return It.normalize(It.join(t,It.basename(e)))};pt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};pt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};pt.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)};pt.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};pt.isWin=F7;pt.crcTable=wS});var _S=v((Uge,vS)=>{var P7=require("path");vS.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=P7.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 SS=v((Hge,CS)=>{CS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Mo=v((Vge,Bo)=>{Bo.exports=bS();Bo.exports.Constants=zy();Bo.exports.Errors=Pf();Bo.exports.FileAttr=_S();Bo.exports.decoder=SS()});var OS=v((zge,AS)=>{var xi=Mo(),X=xi.Constants;AS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=xi.isWin?2560:768,r|=X.FLG_EFS;let y={extraLen:0},E=p=>Math.max(0,p)>>>0,C=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=xi.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&X.FLG_EFS)>0},set flags_efs(p){p?r|=X.FLG_EFS:r&=~X.FLG_EFS},get flags_desc(){return(r&X.FLG_DESC)>0},set flags_desc(p){p?r|=X.FLG_DESC:r&=~X.FLG_DESC},get method(){return n},set method(p){switch(p){case X.STORED:this.version=10;case X.DEFLATED:default:this.version=20}n=p},get time(){return xi.fromDOS2Date(this.timeval)},set time(p){this.timeval=xi.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=E(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=E(p)},get compressedSize(){return o},set compressedSize(p){o=E(p)},get size(){return a},set size(p){a=E(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return y.extraLen},set extraLocalLength(p){y.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=E(p)},get inAttr(){return d},set inAttr(p){d=E(p)},get attr(){return f},set attr(p){f=E(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=E(p)},get encrypted(){return(r&X.FLG_ENC)===X.FLG_ENC},get centralHeaderSize(){return X.CENHDR+u+c+l},get realDataOffset(){return m+X.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+X.LOCHDR);if(D.readUInt32LE(0)!==X.LOCSIG)throw xi.Errors.INVALID_LOC();y.version=D.readUInt16LE(X.LOCVER),y.flags=D.readUInt16LE(X.LOCFLG),y.method=D.readUInt16LE(X.LOCHOW),y.time=D.readUInt32LE(X.LOCTIM),y.crc=D.readUInt32LE(X.LOCCRC),y.compressedSize=D.readUInt32LE(X.LOCSIZ),y.size=D.readUInt32LE(X.LOCLEN),y.fnameLen=D.readUInt16LE(X.LOCNAM),y.extraLen=D.readUInt16LE(X.LOCEXT);let w=m+X.LOCHDR+y.fnameLen,_=w+y.extraLen;return p.slice(w,_)},loadFromBinary:function(p){if(p.length!==X.CENHDR||p.readUInt32LE(0)!==X.CENSIG)throw xi.Errors.INVALID_CEN();t=p.readUInt16LE(X.CENVEM),e=p.readUInt16LE(X.CENVER),r=p.readUInt16LE(X.CENFLG),n=p.readUInt16LE(X.CENHOW),i=p.readUInt32LE(X.CENTIM),s=p.readUInt32LE(X.CENCRC),o=p.readUInt32LE(X.CENSIZ),a=p.readUInt32LE(X.CENLEN),u=p.readUInt16LE(X.CENNAM),c=p.readUInt16LE(X.CENEXT),l=p.readUInt16LE(X.CENCOM),h=p.readUInt16LE(X.CENDSK),d=p.readUInt16LE(X.CENATT),f=p.readUInt32LE(X.CENATX),m=p.readUInt32LE(X.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(X.LOCHDR);return p.writeUInt32LE(X.LOCSIG,0),p.writeUInt16LE(e,X.LOCVER),p.writeUInt16LE(r,X.LOCFLG),p.writeUInt16LE(n,X.LOCHOW),p.writeUInt32LE(i,X.LOCTIM),p.writeUInt32LE(s,X.LOCCRC),p.writeUInt32LE(o,X.LOCSIZ),p.writeUInt32LE(a,X.LOCLEN),p.writeUInt16LE(u,X.LOCNAM),p.writeUInt16LE(y.extraLen,X.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(X.CENHDR+u+c+l);return p.writeUInt32LE(X.CENSIG,0),p.writeUInt16LE(t,X.CENVEM),p.writeUInt16LE(e,X.CENVER),p.writeUInt16LE(r,X.CENFLG),p.writeUInt16LE(n,X.CENHOW),p.writeUInt32LE(i,X.CENTIM),p.writeUInt32LE(s,X.CENCRC),p.writeUInt32LE(o,X.CENSIZ),p.writeUInt32LE(a,X.CENLEN),p.writeUInt16LE(u,X.CENNAM),p.writeUInt16LE(c,X.CENEXT),p.writeUInt16LE(l,X.CENCOM),p.writeUInt16LE(h,X.CENDSK),p.writeUInt16LE(d,X.CENATT),p.writeUInt32LE(f,X.CENATX),p.writeUInt32LE(m,X.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:xi.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(X.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var TS=v((Kge,xS)=>{var qo=Mo(),ct=qo.Constants;xS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ct.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ct.ENDHDR||s.readUInt32LE(0)!==ct.ENDSIG)&&(s.length<ct.ZIP64HDR||s.readUInt32LE(0)!==ct.ZIP64SIG))throw qo.Errors.INVALID_END();s.readUInt32LE(0)===ct.ENDSIG?(t=s.readUInt16LE(ct.ENDSUB),e=s.readUInt16LE(ct.ENDTOT),r=s.readUInt32LE(ct.ENDSIZ),n=s.readUInt32LE(ct.ENDOFF),i=s.readUInt16LE(ct.ENDCOM)):(t=qo.readBigUInt64LE(s,ct.ZIP64SUB),e=qo.readBigUInt64LE(s,ct.ZIP64TOT),r=qo.readBigUInt64LE(s,ct.ZIP64SIZE),n=qo.readBigUInt64LE(s,ct.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ct.ENDHDR+i);return s.writeUInt32LE(ct.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ct.ENDSUB),s.writeUInt16LE(e,ct.ENDTOT),s.writeUInt32LE(r,ct.ENDSIZ),s.writeUInt32LE(n,ct.ENDOFF),s.writeUInt16LE(i,ct.ENDCOM),s.fill(" ",ct.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Gy=v(Ky=>{Ky.EntryHeader=OS();Ky.MainHeader=TS()});var FS=v((Wge,IS)=>{IS.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 i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var RS=v((Xge,PS)=>{var R7=+(process.versions?process.versions.node:"").split(".")[0]||0;PS.exports=function(t,e){var r=require("zlib");let n=R7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var jS=v((Yge,LS)=>{"use strict";var{randomFillSync:kS}=require("crypto"),k7=Pf(),N7=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}),$S=(t,e)=>Math.imul(t,e)>>>0,NS=(t,e)=>N7[(t^e)&255]^t>>>8,Nu=()=>typeof kS=="function"?kS(Buffer.alloc(12)):Nu.node();Nu.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 Rf={genSalt:Nu};function kf(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])}kf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=NS(e[0],t),e[1]+=e[0]&255,e[1]=$S(e[1],134775813)+1,e[2]=NS(e[2],e[1]>>>24),t};kf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return $S(t,t^1)>>8&255};function $7(t){let e=new kf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function L7(t){let e=new kf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function j7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=$7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw k7.WRONG_PASSWORD();return n(t.slice(12))}function B7(t){Buffer.isBuffer(t)&&t.length>=12?Rf.genSalt=function(){return t.slice(0,12)}:t==="node"?Rf.genSalt=Nu.node:Rf.genSalt=Nu}function M7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=L7(r),s=Rf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}LS.exports={decrypt:j7,encrypt:M7,_salter:B7}});var BS=v(Nf=>{Nf.Deflater=FS();Nf.Inflater=RS();Nf.ZipCrypto=jS()});var Xy=v((Zge,MS)=>{var Pe=Mo(),q7=Gy(),mt=Pe.Constants,Wy=BS();MS.exports=function(t,e){var r=new q7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Pe.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==mt.LOCSIG||e.readUInt32LE(w)==mt.CENSIG)throw Pe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==mt.EXTSIG)D.crc=e.readUInt32LE(w+mt.EXTCRC),D.compressedSize=e.readUInt32LE(w+mt.EXTSIZ),D.size=e.readUInt32LE(w+mt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+mt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+mt.EXTSIZ-4),D.size=e.readUInt32LE(w+mt.EXTLEN-4);else throw Pe.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw Pe.Errors.DESCRIPTOR_FAULTY();if(Pe.crc32(p)!==D.crc)return!1}else if(Pe.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,D,w){if(typeof D>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&D&&D(Buffer.alloc(0),Pe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var _=d();if(_.length===0)return p&&D&&D(_),_;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Pe.Errors.INVALID_PASS_PARAM();_=Wy.ZipCrypto.decrypt(_,r,w)}var P=Buffer.alloc(r.size);switch(r.method){case Pe.Constants.STORED:if(_.copy(P),f(P))return p&&D&&D(P),P;throw p&&D&&D(P,Pe.Errors.BAD_CRC()),Pe.Errors.BAD_CRC();case Pe.Constants.DEFLATED:var b=new Wy.Inflater(_,r.size);if(p)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,Pe.Errors.BAD_CRC()))});else{if(b.inflate(P).copy(P,0),!f(P))throw Pe.Errors.BAD_CRC(`"${h.decode(n)}"`);return P}break;default:throw p&&D&&D(Buffer.alloc(0),Pe.Errors.UNKNOWN_METHOD()),Pe.Errors.UNKNOWN_METHOD()}}function y(p,D){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case Pe.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case Pe.Constants.DEFLATED:var _=new Wy.Deflater(o);if(p)_.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var P=_.deflate();return r.compressedSize=P.length,P}_=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function E(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function C(p){try{for(var D=0,w,_,P;D+4<p.length;)w=p.readUInt16LE(D),D+=2,_=p.readUInt16LE(D),D+=2,P=p.slice(D,D+_),D+=_,mt.ID_ZIP64===w&&A(P)}catch{throw Pe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,_,P;p.length>=mt.EF_ZIP64_SCOMP&&(D=E(p,mt.EF_ZIP64_SUNCOMP),r.size===mt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=mt.EF_ZIP64_RHO&&(w=E(p,mt.EF_ZIP64_SCOMP),r.compressedSize===mt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=mt.EF_ZIP64_DSN&&(_=E(p,mt.EF_ZIP64_RHO),r.offset===mt.EF_ZIP64_OR_32&&(r.offset=_)),p.length>=mt.EF_ZIP64_DSN+4&&(P=p.readUInt32LE(mt.EF_ZIP64_DSN),r.diskNumStart===mt.EF_ZIP64_OR_16&&(r.diskNumStart=P))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Pe.toBuffer(p,h.encode);var D=n[n.length-1];s=D===47||D===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,C(p)},get comment(){return h.decode(i)},set comment(p){if(i=Pe.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Pe.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(p){y(!0,p)},setData:function(p){o=Pe.toBuffer(p,Pe.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Pe.Constants.DEFLATED,r.crc=Pe.crc32(p),r.changed=!0):r.method=Pe.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,D){r.changed?p(o):m(!0,p,D)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),D=Pe.Constants.CENHDR;return n.copy(p,D),D+=n.length,a.copy(p,D),D+=r.extraLength,i.copy(p,D),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let D=r.localHeaderToBinary(),w=Buffer.alloc(D.length+n.length+r.extraLocalLength);return D.copy(w,p),p+=D.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(D){return"<"+(D&&D.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var HS=v((Qge,US)=>{var qS=Xy(),U7=Gy(),Mt=Mo();US.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new U7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let E=new Set;for(let C of Object.keys(n)){let A=C.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";E.add(D)}}for(let C of E)if(!(C in n)){let A=new qS(c);A.entryName=C,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/Mt.Constants.CENHDR)throw Mt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var E=s.offset,C=0;C<r.length;C++){var A=E,p=new qS(c,t);p.header=t.slice(A,A+=Mt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),E+=p.header.centralHeaderSize,r[C]=p,n[p.entryName]=p}u.clear(),d()}function m(E){var C=t.length-Mt.Constants.ENDHDR,A=Math.max(0,C-65535),p=A,D=t.length,w=-1,_=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(A=0),C;C>=p;C--)if(t[C]===80){if(t.readUInt32LE(C)===Mt.Constants.ENDSIG){w=C,_=C,D=C+Mt.Constants.ENDHDR,p=C-Mt.Constants.END64HDR;continue}if(t.readUInt32LE(C)===Mt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(C)===Mt.Constants.ZIP64SIG){w=C,D=C+Mt.readBigUInt64LE(t,C+Mt.Constants.ZIP64SIZE)+Mt.Constants.ZIP64LEAD;break}}if(w==-1)throw Mt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(_+Mt.Constants.ENDHDR)),E&&f()}function y(){r.length>1&&!l&&r.sort((E,C)=>E.entryName.toLowerCase().localeCompare(C.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(E=>!u.has(E))},get comment(){return h.decode(i)},set comment(E){i=Mt.toBuffer(E,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(E){this.entries.forEach(E)},getEntry:function(E){return o||f(),n[E]||null},setEntry:function(E){o||f(),r.push(E),n[E.entryName]=E,s.totalEntries=r.length},deleteFile:function(E,C=!0){o||f();let A=n[E];this.getEntryChildren(A,C).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(E){o||f();let C=n[E],A=r.indexOf(C);A>=0&&(r.splice(A,1),delete n[E],s.totalEntries=r.length)},getEntryChildren:function(E,C=!0){if(o||f(),typeof E=="object")if(E.isDirectory&&C){let A=[],p=E.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[E];return[]},getChildCount:function(E){if(E&&E.isDirectory){let C=this.getEntryChildren(E);return C.includes(E)?C.length-1:C.length}return 0},compressToBuffer:function(){o||f(),y();let E=[],C=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let P of this.entries){let b=P.getCompressedData();P.header.offset=p;let k=P.packLocalHeader(),R=k.length+b.length;p+=R,E.push(k),E.push(b);let I=P.packCentralHeader();C.push(I),s.size+=I.length,A+=R+I.length,D++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=D,p=0;let w=Buffer.alloc(A);for(let P of E)P.copy(w,p),p+=P.length;for(let P of C)P.copy(w,p),p+=P.length;let _=s.toBinary();return i&&i.copy(_,Mt.Constants.ENDHDR),_.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(E,C,A,p){try{o||f(),y();let D=[],w=[],_=0,P=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),j=I.entryName+I.extra.toString();A&&A(j),I.getCompressedDataAsync(function(U){p&&p(j),I.header.offset=P;let K=I.packLocalHeader(),L=K.length+U.length;P+=L,D.push(K),D.push(U);let S=I.packCentralHeader();w.push(S),s.size+=S.length,_+=L+S.length,b++,k(R)})}else{_+=s.mainHeaderSize,s.offset=P,s.totalEntries=b,P=0;let I=Buffer.alloc(_);D.forEach(function(U){U.copy(I,P),P+=U.length}),w.forEach(function(U){U.copy(I,P),P+=U.length});let j=s.toBinary();i&&i.copy(j,Mt.Constants.ENDHDR),j.copy(I,P),t=I,o=!1,E(I)}};k(Array.from(this.entries))}catch(D){C(D)}}}}});var KS=v((eye,zS)=>{var lt=Mo(),gt=require("path"),H7=Xy(),V7=HS(),gs=(...t)=>lt.findLast(t,e=>typeof e=="boolean"),VS=(...t)=>lt.findLast(t,e=>typeof e=="string"),z7=(...t)=>lt.findLast(t,e=>typeof e=="function"),K7={noSort:!1,readEntries:!1,method:lt.Constants.NONE,fs:null};zS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),K7);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=lt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new lt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=lt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=lt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw lt.Errors.INVALID_FILENAME();let s=new V7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=lt;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(gt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:y,sep:E}=gt.posix;return m(".",y(E+f.split("\\").join(E)+E))}function h(f){return f instanceof RegExp?(function(m){return function(y){return m.test(y)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let y=m.slice(-1);return y=y===i.sep?i.sep:"",gt.relative(f,m)+y};return{readFile:function(f,m){var y=c(f);return y&&y.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var y=c(f);y?y.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var y=c(f);if(y){var E=y.getData();if(E&&E.length)return E.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,y){var E=c(f);E?E.getDataAsync(function(C,A){if(A){m(C,A);return}C&&C.length?m(C.toString(y||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var y=c(f);y&&s.deleteFile(y.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var y=c(f);y&&(y.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var y=c(f);y&&y.setData(m)},addLocalFile:function(f,m,y,E){if(i.fs.existsSync(f)){m=m?l(m):"";let C=gt.win32.basename(gt.win32.normalize(f));m+=y||C;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,E,A)}else throw lt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let y=gt.resolve(f.localPath),{comment:E}=f,{zipPath:C,zipName:A}=f,p=this;i.fs.stat(y,function(D,w){if(D)return m(D,!1);C=C?l(C):"";let _=gt.win32.basename(gt.win32.normalize(y));if(C+=A||_,w.isFile())i.fs.readFile(y,function(P,b){return P?m(P,!1):(p.addFile(C,b,E,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return C+=i.sep,p.addFile(C,Buffer.alloc(0),E,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,y){if(y=h(y),m=m?l(m):"",f=gt.normalize(f),i.fs.existsSync(f)){let E=i.findFiles(f),C=this;if(E.length)for(let A of E){let p=gt.join(m,d(f,A));y(p)&&C.addLocalFile(A,gt.dirname(p))}}else throw lt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,y,E){E=h(E),y=y?l(y):"",f=gt.normalize(f);var C=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,lt.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),D=-1,w=function(){if(D+=1,D<p.length){var _=p[D],P=d(f,_).split("\\").join("/");P=P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),E(P)?i.fs.stat(_,function(b,k){b&&m(void 0,b),k.isFile()?i.fs.readFile(_,function(R,I){R?m(void 0,R):(C.addFile(y+P,I,"",k),w())}):(C.addFile(y+P+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let y=this;f=typeof f=="object"?f:{localPath:f},localPath=gt.resolve(l(f.localPath));let{zipPath:E,filter:C,namefix:A}=f;C instanceof RegExp?C=(function(w){return function(_){return w.test(_)}})(C):typeof C!="function"&&(C=function(){return!0}),E=E?l(E):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>gt.join(E,A(d(localPath,w))),D=w=>gt.win32.basename(gt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,lt.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(_,P){if(_)return m(_);P=P.filter(b=>C(p(b))),P.length||m(void 0,!1),setImmediate(P.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:gt.dirname(p(k)),zipName:D(k)},b)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((y,E)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(C,A)=>{C&&E(C),A&&y(this)})})},addFile:function(f,m,y,E){f=u(f);let C=c(f),A=C!=null;A||(C=new H7(n),C.entryName=f),C.comment=y||"";let p=typeof E=="object"&&E instanceof i.fs.Stats;p&&(C.header.time=E.mtime);var D=C.isDirectory?16:0;let w=C.isDirectory?16384:32768;return p?w|=4095&E.mode:typeof E=="number"?w|=4095&E:w|=C.isDirectory?493:420,D=(D|w<<16)>>>0,C.attr=D,C.setData(m),A||s.setEntry(C),C},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,y,E,C,A){E=gs(!1,E),C=gs(!1,C),y=gs(!0,y),A=VS(C,A);var p=c(f);if(!p)throw lt.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:y?D:gt.basename(D));if(p.isDirectory){var _=s.getEntryChildren(p);return _.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw lt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),j=a(m,y?I:gt.basename(I));let U=C?k.header.fileAttr:void 0;i.writeFileTo(j,R,E,U)}),!0}var P=p.getData(s.password);if(!P)throw lt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!E)throw lt.Errors.CANT_OVERRIDE();let b=C?f.header.fileAttr:void 0;return i.writeFileTo(w,P,E,b),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var y=s.entries[m].getData(f);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(f,m,y,E){if(y=gs(!1,y),E=VS(y,E),m=gs(!1,m),!s)throw lt.Errors.NO_ZIP();s.entries.forEach(function(C){var A=a(f,o(C.entryName));if(C.isDirectory){i.makeDir(A);return}var p=C.getData(E);if(!p)throw lt.Errors.CANT_EXTRACT_FILE();let D=y?C.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,C.header.time,C.header.time)}catch{throw lt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,y,E){if(E=z7(m,y,E),y=gs(!1,y),m=gs(!1,m),!E)return new Promise((w,_)=>{this.extractAllToAsync(f,m,y,function(P){P?_(P):w(this)})});if(!s){E(lt.Errors.NO_ZIP());return}f=gt.resolve(f);let C=w=>a(f,gt.normalize(o(w.entryName))),A=(w,_)=>new Error(w+': "'+_+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let _=C(w),P=y?w.header.fileAttr:void 0;try{i.makeDir(_),P&&i.fs.chmodSync(_,P),i.fs.utimesSync(_,w.header.time,w.header.time)}catch{E(A("Unable to create folder",_))}}D.reverse().reduce(function(w,_){return function(P){if(P)w(P);else{let b=gt.normalize(o(_.entryName)),k=a(f,b);_.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(lt.Errors.CANT_EXTRACT_FILE());else{let j=y?_.header.fileAttr:void 0;i.writeFileToAsync(k,R,m,j,function(U){U||w(A("Unable to write file",k)),i.fs.utimes(k,_.header.time,_.header.time,function(K){K?w(A("Unable to set times",k)):w()})})}})}}},E)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var y=s.compressToBuffer();if(y){var E=i.writeFileTo(f,y,!0);typeof m=="function"&&m(E?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:y,perm:E}=Object.assign({overwrite:!0},m);return new Promise((C,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?C(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,y,E,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,y,E){return typeof f=="function"?(s.toAsyncBuffer(f,m,y,E),null):s.compressToBuffer()}}}});var YS=v((tye,XS)=>{var WS={};XS.exports=WS;var GS={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(GS).forEach(function(t){var e=GS[t],r=WS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var ZS=v((rye,JS)=>{"use strict";JS.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var eA=v((nye,QS)=>{"use strict";var G7=require("os"),sn=ZS(),nr=process.env,Uo=void 0;sn("no-color")||sn("no-colors")||sn("color=false")?Uo=!1:(sn("color")||sn("colors")||sn("color=true")||sn("color=always"))&&(Uo=!0);"FORCE_COLOR"in nr&&(Uo=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function W7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function X7(t){if(Uo===!1)return 0;if(sn("color=16m")||sn("color=full")||sn("color=truecolor"))return 3;if(sn("color=256"))return 2;if(t&&!t.isTTY&&Uo!==!0)return 0;var e=Uo?1:0;if(process.platform==="win32"){var r=G7.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 nr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in nr})||nr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in nr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nr){var n=parseInt((nr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nr.TERM)||"COLORTERM"in nr?1:(nr.TERM==="dumb",e)}function Yy(t){var e=X7(t);return W7(e)}QS.exports={supportsColor:Yy,stdout:Yy(process.stdout),stderr:Yy(process.stderr)}});var rA=v((iye,tA)=>{tA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={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(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var iA=v((sye,nA)=>{nA.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"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var y=f[m],E=0;E<=h[y];E++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var oA=v((oye,sA)=>{sA.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 uA=v((aye,aA)=>{aA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var lA=v((uye,cA)=>{cA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var hA=v((cye,fA)=>{fA.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,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var DA=v((fye,yA)=>{var Ee={};yA.exports=Ee;Ee.themes={};var Y7=require("util"),ys=Ee.styles=YS(),pA=Object.defineProperties,J7=new RegExp(/[\r\n]+/g);Ee.supportsColor=eA().supportsColor;typeof Ee.enabled>"u"&&(Ee.enabled=Ee.supportsColor()!==!1);Ee.enable=function(){Ee.enabled=!0};Ee.disable=function(){Ee.enabled=!1};Ee.stripColors=Ee.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var lye=Ee.stylize=function(e,r){if(!Ee.enabled)return e+"";var n=ys[r];return!n&&r in Ee?Ee[r](e):n.open+e+n.close},Z7=/[|\\{}()[\]^$+*?.]/g,Q7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Z7,"\\$&")};function mA(t){var e=function r(){return tH.apply(r,arguments)};return e._styles=t,e.__proto__=eH,e}var gA=(function(){var t={};return ys.grey=ys.gray,Object.keys(ys).forEach(function(e){ys[e].closeRe=new RegExp(Q7(ys[e].close),"g"),t[e]={get:function(){return mA(this._styles.concat(e))}}}),t})(),eH=pA(function(){},gA);function tH(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:Y7.inspect(o)}).join(" ");if(!Ee.enabled||!e)return e;for(var r=e.indexOf(`
38
+ - ${p}`}S+=A}return`${E}
39
+ ${S}`}});var YC=v(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.WebAuthnUnknownError=Kn.WebAuthnError=void 0;Kn.isWebAuthnError=z9;Kn.identifyRegistrationError=K9;Kn.identifyAuthenticationError=G9;var XC=ky(),ut=class extends Error{constructor({message:e,code:r,cause:n,name:i}){var s;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(s=i??(n instanceof Error?n.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=r}};Kn.WebAuthnError=ut;var Ry=class extends ut{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Kn.WebAuthnUnknownError=Ry;function z9(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function K9({error:t,options:e}){var r,n,i;let{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ut({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=s.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ut({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=s.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new ut({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new ut({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new ut({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new ut({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ut({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){let o=window.location.hostname;if((0,XC.isValidDomain)(o)){if(s.rp.id!==o)return new ut({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new ut({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function G9({error:t,options:e}){let{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new ut({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,XC.isValidDomain)(n)){if(r.rpId!==n)return new ut({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ut({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var ky=v(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WebAuthnApi=Ae.DEFAULT_REQUEST_OPTIONS=Ae.DEFAULT_CREATION_OPTIONS=Ae.webAuthnAbortService=Ae.WebAuthnAbortService=Ae.identifyAuthenticationError=Ae.identifyRegistrationError=Ae.isWebAuthnError=Ae.WebAuthnError=void 0;Ae.deserializeCredentialCreationOptions=X9;Ae.deserializeCredentialRequestOptions=Y9;Ae.serializeCredentialCreationResponse=J9;Ae.serializeCredentialRequestResponse=Z9;Ae.isValidDomain=Q9;Ae.createCredential=QC;Ae.getCredential=eS;Ae.mergeCredentialCreationOptions=tS;Ae.mergeCredentialRequestOptions=rS;var ZC=(fe(),ue(le)),sn=Df(),pn=hs(),W9=No(),mn=YC();Object.defineProperty(Ae,"identifyAuthenticationError",{enumerable:!0,get:function(){return mn.identifyAuthenticationError}});Object.defineProperty(Ae,"identifyRegistrationError",{enumerable:!0,get:function(){return mn.identifyRegistrationError}});Object.defineProperty(Ae,"isWebAuthnError",{enumerable:!0,get:function(){return mn.isWebAuthnError}});Object.defineProperty(Ae,"WebAuthnError",{enumerable:!0,get:function(){return mn.WebAuthnError}});var Sf=class{createNewAbortSignal(){if(this.controller){let r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}};Ae.WebAuthnAbortService=Sf;Ae.webAuthnAbortService=new Sf;function X9(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);let{challenge:e,user:r,excludeCredentials:n}=t,i=ZC.__rest(t,["challenge","user","excludeCredentials"]),s=(0,sn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,sn.base64UrlToUint8Array)(r.id).buffer}),a=Object.assign(Object.assign({},i),{challenge:s,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let u=0;u<n.length;u++){let c=n[u];a.excludeCredentials[u]=Object.assign(Object.assign({},c),{id:(0,sn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Y9(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);let{challenge:e,allowCredentials:r}=t,n=ZC.__rest(t,["challenge","allowCredentials"]),i=(0,sn.base64UrlToUint8Array)(e).buffer,s=Object.assign(Object.assign({},n),{challenge:i});if(r&&r.length>0){s.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){let a=r[o];s.allowCredentials[o]=Object.assign(Object.assign({},a),{id:(0,sn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function J9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t;return{id:t.id,rawId:t.id,response:{attestationObject:(0,sn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,sn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Z9(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();let r=t,n=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:(0,sn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,sn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,sn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,sn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Q9(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function JC(){var t,e;return!!((0,W9.isBrowser)()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.get)=="function")}async function QC(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new mn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new mn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,mn.identifyRegistrationError)({error:e,options:t})}}}async function eS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new mn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new mn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,mn.identifyAuthenticationError)({error:e,options:t})}}}Ae.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"};Ae.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"]};function Af(...t){let e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),r=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),n={};for(let i of t)if(i)for(let s in i){let o=i[s];if(o!==void 0)if(Array.isArray(o))n[s]=o;else if(r(o))n[s]=o;else if(e(o)){let a=n[s];e(a)?n[s]=Af(a,o):n[s]=Af(o)}else n[s]=o}return n}function tS(t,e){return Af(Ae.DEFAULT_CREATION_OPTIONS,t,e||{})}function rS(t,e){return Af(Ae.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Ny=class{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:i},s){try{let{data:o,error:a}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!o)return{data:null,error:a};let u=i??Ae.webAuthnAbortService.createNewAbortSignal();if(o.webauthn.type==="create"){let{user:c}=o.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${n}`),c.displayName||(c.displayName=c.name)}switch(o.webauthn.type){case"create":{let c=tS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await QC({publicKey:c,signal:u});return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}case"request":{let c=rS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await eS(Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:c,signal:u}));return l?{data:{factorId:e,challengeId:o.id,webauthn:{type:o.webauthn.type,credential_response:l}},error:null}:{data:null,error:h}}}}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in challenge",o)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i}},s){if(!r)return{data:null,error:new pn.AuthError("rpId is required for WebAuthn authentication")};try{if(!JC())return{data:null,error:new pn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:i},{request:s});if(!o)return{data:null,error:a};let{webauthn:u}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:u.type,rpId:r,rpOrigins:n,credential_response:u.credential_response}})}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:i},s){if(!r)return{data:null,error:new pn.AuthError("rpId is required for WebAuthn registration")};try{if(!JC())return{data:null,error:new pn.AuthUnknownError("Browser does not support WebAuthn",null)};let{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(l=>{var h;return(h=l.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(l=>l?this.client.mfa.unenroll({factorId:l?.id}):void 0),{data:null,error:a};let{data:u,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:i},{create:s});return u?this._verify({factorId:o.id,challengeId:u.challengeId,webauthn:{rpId:r,rpOrigins:n,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:c}}catch(o){return(0,pn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new pn.AuthUnknownError("Unexpected error in register",o)}}}};Ae.WebAuthnApi=Ny});var Ly=v($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});var e7=(fe(),ue(le)),t7=e7.__importDefault(vf()),wr=gf(),ee=hs(),he=Sy(),se=No(),nS=VC(),iS=Fy(),r7=KC(),n7=cy(),sS=Df(),Of=WC(),Ru=ky();(0,r7.polyfillGlobalThis)();var i7={url:wr.GOTRUE_URL,storageKey:wr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:wr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function oS(t,e,r){return await r()}var Lo={},xf=class t{get jwks(){var e,r;return(r=(e=Lo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Lo[this.storageKey]=Object.assign(Object.assign({},Lo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Lo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Lo[this.storageKey]=Object.assign(Object.assign({},Lo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=t.nextInstanceID,t.nextInstanceID+=1,this.instanceID>0&&(0,se.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let i=Object.assign(Object.assign({},i7),e);if(this.logDebugMessages=!!i.debug,typeof i.debug=="function"&&(this.logger=i.debug),this.persistSession=i.persistSession,this.storageKey=i.storageKey,this.autoRefreshToken=i.autoRefreshToken,this.admin=new t7.default({url:i.url,headers:i.headers,fetch:i.fetch}),this.url=i.url,this.headers=i.headers,this.fetch=(0,se.resolveFetch)(i.fetch),this.lock=i.lock||oS,this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,i.lock?this.lock=i.lock:(0,se.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=iS.navigatorLock:this.lock=oS,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Ru.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,nS.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,nS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(s){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",s)}(n=this.broadcastChannel)===null||n===void 0||n.addEventListener("message",async s=>{this._debug("received broadcast notification from other tab or client",s),await this._notifyAllSubscribers(s.data.event,s.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${n7.version}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if((0,se.isBrowser)()&&(r=(0,se.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),(0,se.isBrowser)()&&this.detectSessionInUrl&&n!=="none"){let{data:i,error:s}=await this._getSessionFromURL(r,n);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),(0,ee.isAuthImplicitGrantRedirectError)(s)){let u=(e=s.details)===null||e===void 0?void 0:e.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}let{session:o,redirectType:a}=i;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return(0,ee.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new ee.AuthUnknownError("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,i;try{let s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e?.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(i=e?.options)===null||i===void 0?void 0:i.captchaToken}},xform:he._sessionResponse}),{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var r,n,i;try{let s;if("email"in e){let{email:l,password:h,options:d}=e,f=null,m=null;this.flowType==="pkce"&&([f,m]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:l,password:h,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:m},xform:he._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,he._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:l,password:h,data:(n=d?.data)!==null&&n!==void 0?n:{},channel:(i=d?.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:he._sessionResponse})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:o,error:a}=s;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});let u=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let r;if("email"in e){let{email:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:o,gotrue_meta_security:{captcha_token:a?.captchaToken}},xform:he._sessionResponsePassword})}else throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:n,error:i}=r;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!n||!n.session||!n.user){let s=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:s})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:i})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,i,s,o,a,u,c,l,h,d;let f,m;if("message"in e)f=e.message,m=e.signature;else{let{chain:y,wallet:E,statement:S,options:A}=e,p;if((0,se.isBrowser)())if(typeof E=="object")p=E;else{let k=window;if("ethereum"in k&&typeof k.ethereum=="object"&&"request"in k.ethereum&&typeof k.ethereum.request=="function")p=k.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=E}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await p.request({method:"eth_requestAccounts"}).then(k=>k).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||w.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let _=(0,Of.getAddress)(w[0]),P=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!P){let k=await p.request({method:"eth_chainId"});P=(0,Of.fromHex)(k)}let b={domain:D.host,address:_,statement:S,uri:D.href,version:"1",chainId:P,nonce:(i=A?.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(o=(s=A?.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=A?.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(u=A?.signInWithEthereum)===null||u===void 0?void 0:u.notBefore,requestId:(c=A?.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(l=A?.signInWithEthereum)===null||l===void 0?void 0:l.resources};f=(0,Of.createSiweMessage)(b),m=await p.request({method:"personal_sign",params:[(0,Of.toHex)(f),_]})}try{let{data:y,error:E}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:m},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:he._sessionResponse});if(E)throw E;if(!y||!y.session||!y.user){let S=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:S})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:E})}catch(y){if((0,ee.isAuthError)(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let m,y;if("message"in e)m=e.message,y=e.signature;else{let{chain:E,wallet:S,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof S=="object")D=S;else{let _=window;if("solana"in _&&typeof _.solana=="object"&&("signIn"in _.solana&&typeof _.solana.signIn=="function"||"signMessage"in _.solana&&typeof _.solana.signMessage=="function"))D=_.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof S!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=S}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let _=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},p?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),P;if(Array.isArray(_)&&_[0]&&typeof _[0]=="object")P=_[0];else if(_&&typeof _=="object"&&"signedMessage"in _&&"signature"in _)P=_;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)m=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),y=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in D)||typeof D.signMessage!="function"||!("publicKey"in D)||typeof D!="object"||!D.publicKey||!("toBase58"in D.publicKey)||typeof D.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");m=[`${w.host} wants you to sign in with your Solana account:`,D.publicKey.toBase58(),...A?["",A,""]:[""],"Version: 1",`URI: ${w.href}`,`Issued At: ${(i=(n=p?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=p?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${p.signInWithSolana.notBefore}`]:[],...!((o=p?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${p.signInWithSolana.expirationTime}`]:[],...!((a=p?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${p.signInWithSolana.chainId}`]:[],...!((u=p?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${p.signInWithSolana.nonce}`]:[],...!((c=p?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${p.signInWithSolana.requestId}`]:[],...!((h=(l=p?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...p.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
40
+ `);let _=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!_||!(_ instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=_}}try{let{data:E,error:S}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,sS.bytesToBase64URL)(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:he._sessionResponse});if(S)throw S;if(!E||!E.session||!E.user){let A=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:S})}catch(E){if((0,ee.isAuthError)(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[n,i]=(r??"").split("/");try{let{data:s,error:o}=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:he._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:o})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{let{options:r,provider:n,token:i,access_token:s,nonce:o}=e,a=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:i,access_token:s,nonce:o,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:he._sessionResponse}),{data:u,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!u||!u.session||!u.user){let l=new ee.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:l})}return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),this._returnResult({data:u,error:c})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,i,s,o;try{if("email"in e){let{email:a,options:u}=e,c=null,l=null;this.flowType==="pkce"&&([c,l]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:h}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(n=u?.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:c,code_challenge_method:l},redirectTo:u?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){let{phone:a,options:u}=e,{data:c,error:l}=await(0,he._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(i=u?.data)!==null&&i!==void 0?i:{},create_user:(s=u?.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(o=u?.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c?.message_id},error:l})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,ee.isAuthError)(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let i,s;"options"in e&&(i=(r=e.options)===null||r===void 0?void 0:r.redirectTo,s=(n=e.options)===null||n===void 0?void 0:n.captchaToken);let{data:o,error:a}=await(0,he._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:he._sessionResponse});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");let u=o.session,c=o.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),this._returnResult({data:{user:c,session:u},error:null})}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i;try{let s=null,o=null;this.flowType==="pkce"&&([s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let a=await(0,he._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((i=e?.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:s,code_challenge_method:o}),headers:this.headers,xform:he._ssoResponse});return this._returnResult(a)}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new ee.AuthSessionMissingError;let{error:i}=await(0,he._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if((0,ee.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{let r=`${this.url}/resend`;if("email"in e){let{email:n,type:i,options:s}=e,{error:o}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}},redirectTo:s?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){let{phone:n,type:i,options:s}=e,{data:o,error:a}=await(0,he._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:i,gotrue_meta_security:{captcha_token:s?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o?.message_id},error:a})}throw new ee.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){let i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null,r=await(0,se.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};let n=e.expires_at?e.expires_at*1e3-Date.now()<wr.EXPIRY_MARGIN_MS:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");o?.user?e.user=o.user:e.user=(0,se.userNotAvailableProxy)()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){let o={value:this.suppressGetSessionWarning};e.user=(0,se.insecureUserWarningProxy)(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:he._userResponse}):await this._useSession(async r=>{var n,i,s;let{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ee.AuthSessionMissingError}:await(0,he._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=o.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:he._userResponse})})}catch(r){if((0,ee.isAuthError)(r))return(0,ee.isAuthSessionMissingError)(r)&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{let{data:i,error:s}=n;if(s)throw s;if(!i.session)throw new ee.AuthSessionMissingError;let o=i.session,a=null,u=null;this.flowType==="pkce"&&e.email!=null&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:c,error:l}=await(0,he._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:u}),jwt:o.access_token,xform:he._userResponse});if(l)throw l;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new ee.AuthSessionMissingError;let r=Date.now()/1e3,n=r,i=!0,s=null,{payload:o}=(0,se.decodeJWT)(e.access_token);if(o.exp&&(n=o.exp,i=n<=r),i){let{data:a,error:u}=await this._callRefreshToken(e.refresh_token);if(u)return this._returnResult({data:{user:null,session:null},error:u});if(!a)return{data:{user:null,session:null},error:null};s=a}else{let{data:a,error:u}=await this._getUser(e.access_token);if(u)throw u;s={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){let{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!e?.refresh_token)throw new ee.AuthSessionMissingError;let{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){try{if(!(0,se.isBrowser)())throw new ee.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ee.AuthImplicitGrantRedirectError(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new ee.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ee.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new ee.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:p}=await this._exchangeCodeForSession(e.code);if(p)throw p;let D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:A.session,redirectType:null},error:null}}let{provider_token:n,provider_refresh_token:i,access_token:s,refresh_token:o,expires_in:a,expires_at:u,token_type:c}=e;if(!s||!a||!o||!c)throw new ee.AuthImplicitGrantRedirectError("No session defined in URL");let l=Math.round(Date.now()/1e3),h=parseInt(a),d=l+h;u&&(d=parseInt(u));let f=d-l;f*1e3<=wr.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${h}s`);let m=d-h;l-m>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",m,d,l):l-m<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",m,d,l);let{data:y,error:E}=await this._getUser(s);if(E)throw E;let S={provider_token:n,provider_refresh_token:i,access_token:s,expires_in:h,expires_at:d,refresh_token:o,token_type:c,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:S,redirectType:e.type},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{session:null,redirectType:null},error:n});throw n}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let r=await(0,se.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({error:s});let o=(n=i.session)===null||n===void 0?void 0:n.access_token;if(o){let{error:a}=await this.admin.signOut(o,e);if(a&&!((0,ee.isAuthApiError)(a)&&(a.status===404||a.status===401||a.status===403)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){let r=(0,se.uuid)(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,i;try{let{data:{session:s},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,r={}){let n=null,i=null;this.flowType==="pkce"&&([n,i]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,he._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:i,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(s){if((0,ee.isAuthError)(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{let{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{let{data:n,error:i}=await this._useSession(async s=>{var o,a,u,c,l;let{data:h,error:d}=s;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(u=e.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,he._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(l=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&l!==void 0?l:void 0})});if(i)throw i;return(0,se.isBrowser)()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n?.url),this._returnResult({data:{provider:e.provider,url:n?.url},error:null})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{let{error:i,data:{session:s}}=r;if(i)throw i;let{options:o,provider:a,token:u,access_token:c,nonce:l}=e,h=await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=s?.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:u,access_token:c,nonce:l,link_identity:!0,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:he._sessionResponse}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new ee.AuthInvalidTokenResponseError}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(i){if((0,ee.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)throw o;return await(0,he._request)(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&i!==void 0?i:void 0})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){let r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{let n=Date.now();return await(0,se.retryable)(async i=>(i>0&&await(0,se.sleep)(200*Math.pow(2,i-1)),this._debug(r,"refreshing attempt",i),await(0,he._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:he._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,ee.isAuthRetryableFetchError)(s)&&Date.now()+o-n<wr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,ee.isAuthError)(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){let n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),(0,se.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;let n="#_recoverAndRefresh()";this._debug(n,"begin");try{let i=await(0,se.getItemAsync)(this.storage,this.storageKey);if(i&&this.userStorage){let o=await(0,se.getItemAsync)(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:i.user},await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",o)),i.user=(e=o?.user)!==null&&e!==void 0?e:(0,se.userNotAvailableProxy)()}else if(i&&!i.user&&!i.user){let o=await(0,se.getItemAsync)(this.storage,this.storageKey+"-user");o&&o?.user?(i.user=o.user,await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),await(0,se.setItemAsync)(this.storage,this.storageKey,i)):i.user=(0,se.userNotAvailableProxy)()}if(this._debug(n,"session from storage",i),!this._isValidSession(i)){this._debug(n,"session is not valid"),i!==null&&await this._removeSession();return}let s=((r=i.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<wr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${wr.EXPIRY_MARGIN_MS}s`),s){if(this.autoRefreshToken&&i.refresh_token){let{error:o}=await this._callRefreshToken(i.refresh_token);o&&(console.error(o),(0,ee.isAuthRetryableFetchError)(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{let{data:o,error:a}=await this._getUser(i.access_token);!a&&o?.user?(i.user=o.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(n,"error",i),console.error(i);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new ee.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new se.Deferred;let{data:s,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!s.session)throw new ee.AuthSessionMissingError;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);let a={data:s.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(s){if(this._debug(i,"error",s),(0,ee.isAuthError)(s)){let o={data:null,error:s};return(0,ee.isAuthRetryableFetchError)(s)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,r,n=!0){let i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});let s=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(u){s.push(u)}});if(await Promise.all(o),s.length>0){for(let a=0;a<s.length;a+=1)console.error(s[a]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await(0,se.setItemAsync)(this.userStorage,this.storageKey+"-user",{user:r.user});let i=Object.assign({},r);delete i.user;let s=(0,se.deepClone)(i);await(0,se.setItemAsync)(this.storage,this.storageKey,s)}else{let i=(0,se.deepClone)(r);await(0,se.setItemAsync)(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),await(0,se.removeItemAsync)(this.storage,this.storageKey),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-code-verifier"),await(0,se.removeItemAsync)(this.storage,this.storageKey+"-user"),this.userStorage&&await(0,se.removeItemAsync)(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&(0,se.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),wr.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async r=>{let{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let i=Math.floor((n.expires_at*1e3-e)/wr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${wr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${wr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=wr.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof iS.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,se.isBrowser)()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){let i=[`provider=${encodeURIComponent(r)}`];if(n?.redirectTo&&i.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n?.scopes&&i.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){let[s,o]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(o)}`});i.push(a.toString())}if(n?.queryParams){let s=new URLSearchParams(n.queryParams);i.push(s.toString())}return n?.skipBrowserRedirect&&i.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;return s?this._returnResult({data:null,error:s}):await(0,he._request)(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,i;let{data:s,error:o}=r;if(o)return this._returnResult({data:null,error:o});let a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:u,error:c}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=s?.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&u.type==="totp"&&(!((i=u?.totp)===null||i===void 0)&&i.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),this._returnResult({data:u,error:null}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?(0,Ru.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Ru.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});return u?this._returnResult({data:null,error:u}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:u}))})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var n;let{data:i,error:s}=r;if(s)return this._returnResult({data:null,error:s});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=i?.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;let{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Ru.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,Ru.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){let{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;let{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};let i={all:[],phone:[],totp:[],webauthn:[]};for(let s of(e=r?.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,r;let{data:{session:n},error:i}=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:s}=(0,se.decodeJWT)(n.access_token),o=null;s.aal&&(o=s.aal);let a=o;((r=(e=n.user.factors)===null||e===void 0?void 0:e.filter(l=>l.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(a="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:a,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{let{data:{session:n},error:i}=r;return i?this._returnResult({data:null,error:i}):n?await(0,he._request)(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new ee.AuthSessionMissingError})})}catch(r){if((0,ee.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{let{data:{session:i},error:s}=n;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new ee.AuthSessionMissingError});let o=await(0,he._request)(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&(0,se.isBrowser)()&&!r?.skipBrowserRedirect&&window.location.assign(o.data.redirect_url),o})}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;let i=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+wr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,he._request)(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,n=s.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){let{data:f,error:m}=await this.getSession();if(m||!f.session)return this._returnResult({data:null,error:m});n=f.session.access_token}let{header:i,payload:s,signature:o,raw:{header:a,payload:u}}=(0,se.decodeJWT)(n);r?.allowExpired||(0,se.validateExp)(s.exp);let c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!c){let{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:s,header:i,signature:o},error:null}}let l=(0,se.getAlgorithm)(i.alg),h=await crypto.subtle.importKey("jwk",c,l,!0,["verify"]);if(!await crypto.subtle.verify(l,h,o,(0,sS.stringToUint8Array)(`${a}.${u}`)))throw new ee.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,ee.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};xf.nextInstanceID=0;$y.default=xf});var aS=v(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});var s7=(fe(),ue(le)),o7=s7.__importDefault(vf()),a7=o7.default;jy.default=a7});var uS=v(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var u7=(fe(),ue(le)),c7=u7.__importDefault(Ly()),l7=c7.default;By.default=l7});var My=v(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.processLock=Ot.lockInternals=Ot.NavigatorLockAcquireTimeoutError=Ot.navigatorLock=Ot.AuthClient=Ot.AuthAdminApi=Ot.GoTrueClient=Ot.GoTrueAdminApi=void 0;var jo=(fe(),ue(le)),f7=jo.__importDefault(vf());Ot.GoTrueAdminApi=f7.default;var h7=jo.__importDefault(Ly());Ot.GoTrueClient=h7.default;var d7=jo.__importDefault(aS());Ot.AuthAdminApi=d7.default;var p7=jo.__importDefault(uS());Ot.AuthClient=p7.default;jo.__exportStar(Ay(),Ot);jo.__exportStar(hs(),Ot);var Tf=Fy();Object.defineProperty(Ot,"navigatorLock",{enumerable:!0,get:function(){return Tf.navigatorLock}});Object.defineProperty(Ot,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Tf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(Ot,"lockInternals",{enumerable:!0,get:function(){return Tf.internals}});Object.defineProperty(Ot,"processLock",{enumerable:!0,get:function(){return Tf.processLock}})});var cS=v(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.SupabaseAuthClient=void 0;var m7=My(),qy=class extends m7.AuthClient{constructor(e){super(e)}};If.SupabaseAuthClient=qy});var Vy=v(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});var g7=Vm(),y7=ag(),D7=Sg(),w7=IC(),Ff=PC(),E7=RC(),lS=NC(),b7=cS(),Uy=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,lS.validateSupabaseUrl)(e);if(!r)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",a),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",a),this.storageUrl=new URL("storage/v1",a),this.functionsUrl=new URL("functions/v1",a);let u=`sb-${a.hostname.split(".")[0]}-auth-token`,c={db:Ff.DEFAULT_DB_OPTIONS,realtime:Ff.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Ff.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Ff.DEFAULT_GLOBAL_OPTIONS},l=(0,lS.applySettingDefaults)(n??{},c);this.storageKey=(i=l.auth.storageKey)!==null&&i!==void 0?i:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(h,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((o=l.auth)!==null&&o!==void 0?o:{},this.headers,l.global.fetch),this.fetch=(0,E7.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new y7.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new w7.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new g7.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:i,userStorage:s,storageKey:o,flowType:a,lock:u,debug:c,throwOnError:l},h,d){let f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new b7.SupabaseAuthClient({url:this.authUrl.href,headers:Object.assign(Object.assign({},f),h),storageKey:o,autoRefreshToken:e,persistSession:r,detectSessionInUrl:n,storage:i,userStorage:s,flowType:a,lock:u,debug:c,throwOnError:l,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(m=>m.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new D7.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)}};Hy.default=Uy});var dS=v(ze=>{"use strict";var v7=ze&&ze.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),fS=ze&&ze.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&v7(e,t,r)},hS=ze&&ze.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ze,"__esModule",{value:!0});ze.createClient=ze.SupabaseClient=ze.FunctionRegion=ze.FunctionsError=ze.FunctionsRelayError=ze.FunctionsFetchError=ze.FunctionsHttpError=ze.PostgrestError=void 0;var _7=hS(Vy());fS(My(),ze);var C7=ag();Object.defineProperty(ze,"PostgrestError",{enumerable:!0,get:function(){return C7.PostgrestError}});var ku=Vm();Object.defineProperty(ze,"FunctionsHttpError",{enumerable:!0,get:function(){return ku.FunctionsHttpError}});Object.defineProperty(ze,"FunctionsFetchError",{enumerable:!0,get:function(){return ku.FunctionsFetchError}});Object.defineProperty(ze,"FunctionsRelayError",{enumerable:!0,get:function(){return ku.FunctionsRelayError}});Object.defineProperty(ze,"FunctionsError",{enumerable:!0,get:function(){return ku.FunctionsError}});Object.defineProperty(ze,"FunctionRegion",{enumerable:!0,get:function(){return ku.FunctionRegion}});fS(Sg(),ze);var S7=Vy();Object.defineProperty(ze,"SupabaseClient",{enumerable:!0,get:function(){return hS(S7).default}});var A7=(t,e,r)=>new _7.default(t,e,r);ze.createClient=A7;function O7(){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}O7()&&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 zy=v((Bge,pS)=>{pS.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 Pf=v(gS=>{var mS={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 x7(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(mS))gS[t]=x7(mS[t])});var bS=v((qge,ES)=>{var T7=require("fs"),It=require("path"),yS=zy(),I7=Pf(),F7=typeof process=="object"&&process.platform==="win32",DS=t=>typeof t=="object"&&t!==null,wS=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 pt(t){this.sep=It.sep,this.fs=T7,DS(t)&&DS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}ES.exports=pt;pt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw I7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};pt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=It.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};pt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var c=It.dirname(t);s.fs.exists(c,function(l){l||s.makeDir(c),s.fs.open(t,"w",438,function(h,d){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(f,m){s.fs.write(m,e,0,e.length,0,function(){s.fs.close(m,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):d?s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};pt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){let u=It.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(It.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};pt.prototype.findFilesAsync=function(t,e){let r=this,n=[];r.fs.readdir(t,function(i,s){if(i)return e(i);let o=s.length;if(!o)return e(null,n);s.forEach(function(a){a=It.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(It.normalize(a)+(c.isDirectory()?r.sep:"")),c.isDirectory()?r.findFilesAsync(a,function(l,h){if(l)return e(l);n=n.concat(h),--o||e(null,n)}):--o||e(null,n))})})})};pt.prototype.getAttributes=function(){};pt.prototype.setAttributes=function(){};pt.crc32update=function(t,e){return wS[(t^e)&255]^t>>>8};pt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=pt.crc32update(r,t[n++]);return~r>>>0};pt.methodToString=function(t){switch(t){case yS.STORED:return"STORED ("+t+")";case yS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};pt.canonical=function(t){if(!t)return"";let e=It.posix.normalize("/"+t.split("\\").join("/"));return It.join(".",e)};pt.zipnamefix=function(t){if(!t)return"";let e=It.posix.normalize("/"+t.split("\\").join("/"));return It.posix.join(".",e)};pt.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]};pt.sanitize=function(t,e){t=It.resolve(It.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=It.normalize(It.join(t,r.slice(n,i).join(It.sep)));if(s.indexOf(t)===0)return s}return It.normalize(It.join(t,It.basename(e)))};pt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};pt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};pt.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)};pt.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};pt.isWin=F7;pt.crcTable=wS});var _S=v((Uge,vS)=>{var P7=require("path");vS.exports=function(t,{fs:e}){var r=t||"",n=s(),i=null;function s(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return r&&e.existsSync(r)?(i=e.statSync(r),n.directory=i.isDirectory(),n.mtime=i.mtime,n.atime=i.atime,n.executable=(73&i.mode)!==0,n.readonly=(128&i.mode)===0,n.hidden=P7.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 SS=v((Hge,CS)=>{CS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Mo=v((Vge,Bo)=>{Bo.exports=bS();Bo.exports.Constants=zy();Bo.exports.Errors=Pf();Bo.exports.FileAttr=_S();Bo.exports.decoder=SS()});var OS=v((zge,AS)=>{var xi=Mo(),X=xi.Constants;AS.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,c=0,l=0,h=0,d=0,f=0,m=0;t|=xi.isWin?2560:768,r|=X.FLG_EFS;let y={extraLen:0},E=p=>Math.max(0,p)>>>0,S=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=xi.fromDate2DOS(new Date),{get made(){return t},set made(p){t=p},get version(){return e},set version(p){e=p},get flags(){return r},set flags(p){r=p},get flags_efs(){return(r&X.FLG_EFS)>0},set flags_efs(p){p?r|=X.FLG_EFS:r&=~X.FLG_EFS},get flags_desc(){return(r&X.FLG_DESC)>0},set flags_desc(p){p?r|=X.FLG_DESC:r&=~X.FLG_DESC},get method(){return n},set method(p){switch(p){case X.STORED:this.version=10;case X.DEFLATED:default:this.version=20}n=p},get time(){return xi.fromDOS2Date(this.timeval)},set time(p){this.timeval=xi.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=E(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=E(p)},get compressedSize(){return o},set compressedSize(p){o=E(p)},get size(){return a},set size(p){a=E(p)},get fileNameLength(){return u},set fileNameLength(p){u=p},get extraLength(){return c},set extraLength(p){c=p},get extraLocalLength(){return y.extraLen},set extraLocalLength(p){y.extraLen=p},get commentLength(){return l},set commentLength(p){l=p},get diskNumStart(){return h},set diskNumStart(p){h=E(p)},get inAttr(){return d},set inAttr(p){d=E(p)},get attr(){return f},set attr(p){f=E(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=E(p)},get encrypted(){return(r&X.FLG_ENC)===X.FLG_ENC},get centralHeaderSize(){return X.CENHDR+u+c+l},get realDataOffset(){return m+X.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+X.LOCHDR);if(D.readUInt32LE(0)!==X.LOCSIG)throw xi.Errors.INVALID_LOC();y.version=D.readUInt16LE(X.LOCVER),y.flags=D.readUInt16LE(X.LOCFLG),y.method=D.readUInt16LE(X.LOCHOW),y.time=D.readUInt32LE(X.LOCTIM),y.crc=D.readUInt32LE(X.LOCCRC),y.compressedSize=D.readUInt32LE(X.LOCSIZ),y.size=D.readUInt32LE(X.LOCLEN),y.fnameLen=D.readUInt16LE(X.LOCNAM),y.extraLen=D.readUInt16LE(X.LOCEXT);let w=m+X.LOCHDR+y.fnameLen,_=w+y.extraLen;return p.slice(w,_)},loadFromBinary:function(p){if(p.length!==X.CENHDR||p.readUInt32LE(0)!==X.CENSIG)throw xi.Errors.INVALID_CEN();t=p.readUInt16LE(X.CENVEM),e=p.readUInt16LE(X.CENVER),r=p.readUInt16LE(X.CENFLG),n=p.readUInt16LE(X.CENHOW),i=p.readUInt32LE(X.CENTIM),s=p.readUInt32LE(X.CENCRC),o=p.readUInt32LE(X.CENSIZ),a=p.readUInt32LE(X.CENLEN),u=p.readUInt16LE(X.CENNAM),c=p.readUInt16LE(X.CENEXT),l=p.readUInt16LE(X.CENCOM),h=p.readUInt16LE(X.CENDSK),d=p.readUInt16LE(X.CENATT),f=p.readUInt32LE(X.CENATX),m=p.readUInt32LE(X.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(X.LOCHDR);return p.writeUInt32LE(X.LOCSIG,0),p.writeUInt16LE(e,X.LOCVER),p.writeUInt16LE(r,X.LOCFLG),p.writeUInt16LE(n,X.LOCHOW),p.writeUInt32LE(i,X.LOCTIM),p.writeUInt32LE(s,X.LOCCRC),p.writeUInt32LE(o,X.LOCSIZ),p.writeUInt32LE(a,X.LOCLEN),p.writeUInt16LE(u,X.LOCNAM),p.writeUInt16LE(y.extraLen,X.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(X.CENHDR+u+c+l);return p.writeUInt32LE(X.CENSIG,0),p.writeUInt16LE(t,X.CENVEM),p.writeUInt16LE(e,X.CENVER),p.writeUInt16LE(r,X.CENFLG),p.writeUInt16LE(n,X.CENHOW),p.writeUInt32LE(i,X.CENTIM),p.writeUInt32LE(s,X.CENCRC),p.writeUInt32LE(o,X.CENSIZ),p.writeUInt32LE(a,X.CENLEN),p.writeUInt16LE(u,X.CENNAM),p.writeUInt16LE(c,X.CENEXT),p.writeUInt16LE(l,X.CENCOM),p.writeUInt16LE(h,X.CENDSK),p.writeUInt16LE(d,X.CENATT),p.writeUInt32LE(f,X.CENATX),p.writeUInt32LE(m,X.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:xi.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:p(o),size:p(a),fileNameLength:p(u),extraLength:p(c),commentLength:p(l),diskNumStart:h,inAttr:d,attr:f,offset:m,centralHeaderSize:p(X.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var TS=v((Kge,xS)=>{var qo=Mo(),ct=qo.Constants;xS.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return ct.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ct.ENDHDR||s.readUInt32LE(0)!==ct.ENDSIG)&&(s.length<ct.ZIP64HDR||s.readUInt32LE(0)!==ct.ZIP64SIG))throw qo.Errors.INVALID_END();s.readUInt32LE(0)===ct.ENDSIG?(t=s.readUInt16LE(ct.ENDSUB),e=s.readUInt16LE(ct.ENDTOT),r=s.readUInt32LE(ct.ENDSIZ),n=s.readUInt32LE(ct.ENDOFF),i=s.readUInt16LE(ct.ENDCOM)):(t=qo.readBigUInt64LE(s,ct.ZIP64SUB),e=qo.readBigUInt64LE(s,ct.ZIP64TOT),r=qo.readBigUInt64LE(s,ct.ZIP64SIZE),n=qo.readBigUInt64LE(s,ct.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ct.ENDHDR+i);return s.writeUInt32LE(ct.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ct.ENDSUB),s.writeUInt16LE(e,ct.ENDTOT),s.writeUInt32LE(r,ct.ENDSIZ),s.writeUInt32LE(n,ct.ENDOFF),s.writeUInt16LE(i,ct.ENDCOM),s.fill(" ",ct.ENDHDR),s},toJSON:function(){let s=function(o,a){let u=o.toString(16).toUpperCase();for(;u.length<a;)u="0"+u;return"0x"+u};return{diskEntries:t,totalEntries:e,size:r+" bytes",offset:s(n,4),commentLength:i}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Gy=v(Ky=>{Ky.EntryHeader=OS();Ky.MainHeader=TS()});var FS=v((Wge,IS)=>{IS.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 i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var c=0;c<s.length;c++){var l=s[c];l.copy(a,u),u+=l.length}n&&n(a)}),i.end(t)}}}});var RS=v((Xge,PS)=>{var R7=+(process.versions?process.versions.node:"").split(".")[0]||0;PS.exports=function(t,e){var r=require("zlib");let n=R7>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),c=0;u.fill(0);for(var l=0;l<o.length;l++){var h=o[l];h.copy(u,c),c+=h.length}i&&i(u)}),s.end(t)}}}});var jS=v((Yge,LS)=>{"use strict";var{randomFillSync:kS}=require("crypto"),k7=Pf(),N7=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}),$S=(t,e)=>Math.imul(t,e)>>>0,NS=(t,e)=>N7[(t^e)&255]^t>>>8,Nu=()=>typeof kS=="function"?kS(Buffer.alloc(12)):Nu.node();Nu.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 Rf={genSalt:Nu};function kf(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])}kf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=NS(e[0],t),e[1]+=e[0]&255,e[1]=$S(e[1],134775813)+1,e[2]=NS(e[2],e[1]>>>24),t};kf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return $S(t,t^1)>>8&255};function $7(t){let e=new kf(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}function L7(t){let e=new kf(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}function j7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=$7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw k7.WRONG_PASSWORD();return n(t.slice(12))}function B7(t){Buffer.isBuffer(t)&&t.length>=12?Rf.genSalt=function(){return t.slice(0,12)}:t==="node"?Rf.genSalt=Nu.node:Rf.genSalt=Nu}function M7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=L7(r),s=Rf.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}LS.exports={decrypt:j7,encrypt:M7,_salter:B7}});var BS=v(Nf=>{Nf.Deflater=FS();Nf.Inflater=RS();Nf.ZipCrypto=jS()});var Xy=v((Zge,MS)=>{var Pe=Mo(),q7=Gy(),mt=Pe.Constants,Wy=BS();MS.exports=function(t,e){var r=new q7.EntryHeader,n=Buffer.alloc(0),i=Buffer.alloc(0),s=!1,o=null,a=Buffer.alloc(0),u=Buffer.alloc(0),c=!0;let l=t,h=typeof l.decoder=="object"?l.decoder:Pe.decoder;c=h.hasOwnProperty("efs")?h.efs:!1;function d(){return!e||!(e instanceof Uint8Array)?Buffer.alloc(0):(u=r.loadLocalHeaderFromBinary(e),e.slice(r.realDataOffset,r.realDataOffset+r.compressedSize))}function f(p){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==mt.LOCSIG||e.readUInt32LE(w)==mt.CENSIG)throw Pe.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==mt.EXTSIG)D.crc=e.readUInt32LE(w+mt.EXTCRC),D.compressedSize=e.readUInt32LE(w+mt.EXTSIZ),D.size=e.readUInt32LE(w+mt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+mt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+mt.EXTSIZ-4),D.size=e.readUInt32LE(w+mt.EXTLEN-4);else throw Pe.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw Pe.Errors.DESCRIPTOR_FAULTY();if(Pe.crc32(p)!==D.crc)return!1}else if(Pe.crc32(p)!==r.localHeader.crc)return!1;return!0}function m(p,D,w){if(typeof D>"u"&&typeof p=="string"&&(w=p,p=void 0),s)return p&&D&&D(Buffer.alloc(0),Pe.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var _=d();if(_.length===0)return p&&D&&D(_),_;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw Pe.Errors.INVALID_PASS_PARAM();_=Wy.ZipCrypto.decrypt(_,r,w)}var P=Buffer.alloc(r.size);switch(r.method){case Pe.Constants.STORED:if(_.copy(P),f(P))return p&&D&&D(P),P;throw p&&D&&D(P,Pe.Errors.BAD_CRC()),Pe.Errors.BAD_CRC();case Pe.Constants.DEFLATED:var b=new Wy.Inflater(_,r.size);if(p)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,Pe.Errors.BAD_CRC()))});else{if(b.inflate(P).copy(P,0),!f(P))throw Pe.Errors.BAD_CRC(`"${h.decode(n)}"`);return P}break;default:throw p&&D&&D(Buffer.alloc(0),Pe.Errors.UNKNOWN_METHOD()),Pe.Errors.UNKNOWN_METHOD()}}function y(p,D){if((!o||!o.length)&&Buffer.isBuffer(e))return p&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case Pe.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case Pe.Constants.DEFLATED:var _=new Wy.Deflater(o);if(p)_.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var P=_.deflate();return r.compressedSize=P.length,P}_=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function E(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function S(p){try{for(var D=0,w,_,P;D+4<p.length;)w=p.readUInt16LE(D),D+=2,_=p.readUInt16LE(D),D+=2,P=p.slice(D,D+_),D+=_,mt.ID_ZIP64===w&&A(P)}catch{throw Pe.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,_,P;p.length>=mt.EF_ZIP64_SCOMP&&(D=E(p,mt.EF_ZIP64_SUNCOMP),r.size===mt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=mt.EF_ZIP64_RHO&&(w=E(p,mt.EF_ZIP64_SCOMP),r.compressedSize===mt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=mt.EF_ZIP64_DSN&&(_=E(p,mt.EF_ZIP64_RHO),r.offset===mt.EF_ZIP64_OR_32&&(r.offset=_)),p.length>=mt.EF_ZIP64_DSN+4&&(P=p.readUInt32LE(mt.EF_ZIP64_DSN),r.diskNumStart===mt.EF_ZIP64_OR_16&&(r.diskNumStart=P))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=Pe.toBuffer(p,h.encode);var D=n[n.length-1];s=D===47||D===92,r.fileNameLength=n.length},get efs(){return typeof c=="function"?c(this.entryName):c},get extra(){return a},set extra(p){a=p,r.extraLength=p.length,S(p)},get comment(){return h.decode(i)},set comment(p){if(i=Pe.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw Pe.Errors.COMMENT_TOO_LONG()},get name(){var p=h.decode(n);return s?p.substr(p.length-1).split("/").pop():p.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(p){y(!0,p)},setData:function(p){o=Pe.toBuffer(p,Pe.decoder.encode),!s&&o.length?(r.size=o.length,r.method=Pe.Constants.DEFLATED,r.crc=Pe.crc32(p),r.changed=!0):r.method=Pe.Constants.STORED},getData:function(p){return r.changed?o:m(!1,null,p)},getDataAsync:function(p,D){r.changed?p(o):m(!0,p,D)},set attr(p){r.attr=p},get attr(){return r.attr},set header(p){r.loadFromBinary(p)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var p=r.centralHeaderToBinary(),D=Pe.Constants.CENHDR;return n.copy(p,D),D+=n.length,a.copy(p,D),D+=r.extraLength,i.copy(p,D),p},packLocalHeader:function(){let p=0;r.flags_efs=this.efs,r.extraLocalLength=u.length;let D=r.localHeaderToBinary(),w=Buffer.alloc(D.length+n.length+r.extraLocalLength);return D.copy(w,p),p+=D.length,n.copy(w,p),p+=n.length,u.copy(w,p),p+=u.length,w},toJSON:function(){let p=function(D){return"<"+(D&&D.length+" bytes buffer"||"null")+">"};return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:r.toJSON(),compressedData:p(e),data:p(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var HS=v((Qge,US)=>{var qS=Xy(),U7=Gy(),Mt=Mo();US.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new U7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?m(c.readEntries):o=!0;function d(){let E=new Set;for(let S of Object.keys(n)){let A=S.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";E.add(D)}}for(let S of E)if(!(S in n)){let A=new qS(c);A.entryName=S,A.attr=16,A.temporary=!0,r.push(A),n[A.entryName]=A,u.add(A)}}function f(){if(o=!0,n={},s.diskEntries>(t.length-s.offset)/Mt.Constants.CENHDR)throw Mt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var E=s.offset,S=0;S<r.length;S++){var A=E,p=new qS(c,t);p.header=t.slice(A,A+=Mt.Constants.CENHDR),p.entryName=t.slice(A,A+=p.header.fileNameLength),p.header.extraLength&&(p.extra=t.slice(A,A+=p.header.extraLength)),p.header.commentLength&&(p.comment=t.slice(A,A+p.header.commentLength)),E+=p.header.centralHeaderSize,r[S]=p,n[p.entryName]=p}u.clear(),d()}function m(E){var S=t.length-Mt.Constants.ENDHDR,A=Math.max(0,S-65535),p=A,D=t.length,w=-1,_=0;for((typeof c.trailingSpace=="boolean"?c.trailingSpace:!1)&&(A=0),S;S>=p;S--)if(t[S]===80){if(t.readUInt32LE(S)===Mt.Constants.ENDSIG){w=S,_=S,D=S+Mt.Constants.ENDHDR,p=S-Mt.Constants.END64HDR;continue}if(t.readUInt32LE(S)===Mt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(S)===Mt.Constants.ZIP64SIG){w=S,D=S+Mt.readBigUInt64LE(t,S+Mt.Constants.ZIP64SIZE)+Mt.Constants.ZIP64LEAD;break}}if(w==-1)throw Mt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(_+Mt.Constants.ENDHDR)),E&&f()}function y(){r.length>1&&!l&&r.sort((E,S)=>E.entryName.toLowerCase().localeCompare(S.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(E=>!u.has(E))},get comment(){return h.decode(i)},set comment(E){i=Mt.toBuffer(E,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(E){this.entries.forEach(E)},getEntry:function(E){return o||f(),n[E]||null},setEntry:function(E){o||f(),r.push(E),n[E.entryName]=E,s.totalEntries=r.length},deleteFile:function(E,S=!0){o||f();let A=n[E];this.getEntryChildren(A,S).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(E){o||f();let S=n[E],A=r.indexOf(S);A>=0&&(r.splice(A,1),delete n[E],s.totalEntries=r.length)},getEntryChildren:function(E,S=!0){if(o||f(),typeof E=="object")if(E.isDirectory&&S){let A=[],p=E.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[E];return[]},getChildCount:function(E){if(E&&E.isDirectory){let S=this.getEntryChildren(E);return S.includes(E)?S.length-1:S.length}return 0},compressToBuffer:function(){o||f(),y();let E=[],S=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let P of this.entries){let b=P.getCompressedData();P.header.offset=p;let k=P.packLocalHeader(),R=k.length+b.length;p+=R,E.push(k),E.push(b);let I=P.packCentralHeader();S.push(I),s.size+=I.length,A+=R+I.length,D++}A+=s.mainHeaderSize,s.offset=p,s.totalEntries=D,p=0;let w=Buffer.alloc(A);for(let P of E)P.copy(w,p),p+=P.length;for(let P of S)P.copy(w,p),p+=P.length;let _=s.toBinary();return i&&i.copy(_,Mt.Constants.ENDHDR),_.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(E,S,A,p){try{o||f(),y();let D=[],w=[],_=0,P=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),j=I.entryName+I.extra.toString();A&&A(j),I.getCompressedDataAsync(function(U){p&&p(j),I.header.offset=P;let K=I.packLocalHeader(),L=K.length+U.length;P+=L,D.push(K),D.push(U);let C=I.packCentralHeader();w.push(C),s.size+=C.length,_+=L+C.length,b++,k(R)})}else{_+=s.mainHeaderSize,s.offset=P,s.totalEntries=b,P=0;let I=Buffer.alloc(_);D.forEach(function(U){U.copy(I,P),P+=U.length}),w.forEach(function(U){U.copy(I,P),P+=U.length});let j=s.toBinary();i&&i.copy(j,Mt.Constants.ENDHDR),j.copy(I,P),t=I,o=!1,E(I)}};k(Array.from(this.entries))}catch(D){S(D)}}}}});var KS=v((eye,zS)=>{var lt=Mo(),gt=require("path"),H7=Xy(),V7=HS(),gs=(...t)=>lt.findLast(t,e=>typeof e=="boolean"),VS=(...t)=>lt.findLast(t,e=>typeof e=="string"),z7=(...t)=>lt.findLast(t,e=>typeof e=="function"),K7={noSort:!1,readEntries:!1,method:lt.Constants.NONE,fs:null};zS.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),K7);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=lt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new lt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=lt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=lt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw lt.Errors.INVALID_FILENAME();let s=new V7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=lt;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(gt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(m=s.getEntry(f.entryName)),m)return m}return null}function l(f){let{join:m,normalize:y,sep:E}=gt.posix;return m(".",y(E+f.split("\\").join(E)+E))}function h(f){return f instanceof RegExp?(function(m){return function(y){return m.test(y)}})(f):typeof f!="function"?()=>!0:f}let d=(f,m)=>{let y=m.slice(-1);return y=y===i.sep?i.sep:"",gt.relative(f,m)+y};return{readFile:function(f,m){var y=c(f);return y&&y.getData(m)||null},childCount:function(f){let m=c(f);if(m)return s.getChildCount(m)},readFileAsync:function(f,m){var y=c(f);y?y.getDataAsync(m):m(null,"getEntry failed for:"+f)},readAsText:function(f,m){var y=c(f);if(y){var E=y.getData();if(E&&E.length)return E.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,y){var E=c(f);E?E.getDataAsync(function(S,A){if(A){m(S,A);return}S&&S.length?m(S.toString(y||"utf8")):m("")}):m("")},deleteFile:function(f,m=!0){var y=c(f);y&&s.deleteFile(y.entryName,m)},deleteEntry:function(f){var m=c(f);m&&s.deleteEntry(m.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,m){var y=c(f);y&&(y.comment=m)},getZipEntryComment:function(f){var m=c(f);return m&&m.comment||""},updateFile:function(f,m){var y=c(f);y&&y.setData(m)},addLocalFile:function(f,m,y,E){if(i.fs.existsSync(f)){m=m?l(m):"";let S=gt.win32.basename(gt.win32.normalize(f));m+=y||S;let A=i.fs.statSync(f),p=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(m+=i.sep),this.addFile(m,p,E,A)}else throw lt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let y=gt.resolve(f.localPath),{comment:E}=f,{zipPath:S,zipName:A}=f,p=this;i.fs.stat(y,function(D,w){if(D)return m(D,!1);S=S?l(S):"";let _=gt.win32.basename(gt.win32.normalize(y));if(S+=A||_,w.isFile())i.fs.readFile(y,function(P,b){return P?m(P,!1):(p.addFile(S,b,E,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return S+=i.sep,p.addFile(S,Buffer.alloc(0),E,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,y){if(y=h(y),m=m?l(m):"",f=gt.normalize(f),i.fs.existsSync(f)){let E=i.findFiles(f),S=this;if(E.length)for(let A of E){let p=gt.join(m,d(f,A));y(p)&&S.addLocalFile(A,gt.dirname(p))}}else throw lt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,y,E){E=h(E),y=y?l(y):"",f=gt.normalize(f);var S=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,lt.Errors.FILE_NOT_FOUND(f));else if(A)m(void 0,A);else{var p=i.findFiles(f),D=-1,w=function(){if(D+=1,D<p.length){var _=p[D],P=d(f,_).split("\\").join("/");P=P.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),E(P)?i.fs.stat(_,function(b,k){b&&m(void 0,b),k.isFile()?i.fs.readFile(_,function(R,I){R?m(void 0,R):(S.addFile(y+P,I,"",k),w())}):(S.addFile(y+P+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else m(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,m){let y=this;f=typeof f=="object"?f:{localPath:f},localPath=gt.resolve(l(f.localPath));let{zipPath:E,filter:S,namefix:A}=f;S instanceof RegExp?S=(function(w){return function(_){return w.test(_)}})(S):typeof S!="function"&&(S=function(){return!0}),E=E?l(E):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>gt.join(E,A(d(localPath,w))),D=w=>gt.win32.basename(gt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,lt.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(_,P){if(_)return m(_);P=P.filter(b=>S(p(b))),P.length||m(void 0,!1),setImmediate(P.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:gt.dirname(p(k)),zipName:D(k)},b)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((y,E)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(S,A)=>{S&&E(S),A&&y(this)})})},addFile:function(f,m,y,E){f=u(f);let S=c(f),A=S!=null;A||(S=new H7(n),S.entryName=f),S.comment=y||"";let p=typeof E=="object"&&E instanceof i.fs.Stats;p&&(S.header.time=E.mtime);var D=S.isDirectory?16:0;let w=S.isDirectory?16384:32768;return p?w|=4095&E.mode:typeof E=="number"?w|=4095&E:w|=S.isDirectory?493:420,D=(D|w<<16)>>>0,S.attr=D,S.setData(m),A||s.setEntry(S),S},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return c(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,m,y,E,S,A){E=gs(!1,E),S=gs(!1,S),y=gs(!0,y),A=VS(S,A);var p=c(f);if(!p)throw lt.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:y?D:gt.basename(D));if(p.isDirectory){var _=s.getEntryChildren(p);return _.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw lt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),j=a(m,y?I:gt.basename(I));let U=S?k.header.fileAttr:void 0;i.writeFileTo(j,R,E,U)}),!0}var P=p.getData(s.password);if(!P)throw lt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!E)throw lt.Errors.CANT_OVERRIDE();let b=S?f.header.fileAttr:void 0;return i.writeFileTo(w,P,E,b),!0},test:function(f){if(!s)return!1;for(var m in s.entries)try{if(m.isDirectory)continue;var y=s.entries[m].getData(f);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(f,m,y,E){if(y=gs(!1,y),E=VS(y,E),m=gs(!1,m),!s)throw lt.Errors.NO_ZIP();s.entries.forEach(function(S){var A=a(f,o(S.entryName));if(S.isDirectory){i.makeDir(A);return}var p=S.getData(E);if(!p)throw lt.Errors.CANT_EXTRACT_FILE();let D=y?S.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,S.header.time,S.header.time)}catch{throw lt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,y,E){if(E=z7(m,y,E),y=gs(!1,y),m=gs(!1,m),!E)return new Promise((w,_)=>{this.extractAllToAsync(f,m,y,function(P){P?_(P):w(this)})});if(!s){E(lt.Errors.NO_ZIP());return}f=gt.resolve(f);let S=w=>a(f,gt.normalize(o(w.entryName))),A=(w,_)=>new Error(w+': "'+_+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let _=S(w),P=y?w.header.fileAttr:void 0;try{i.makeDir(_),P&&i.fs.chmodSync(_,P),i.fs.utimesSync(_,w.header.time,w.header.time)}catch{E(A("Unable to create folder",_))}}D.reverse().reduce(function(w,_){return function(P){if(P)w(P);else{let b=gt.normalize(o(_.entryName)),k=a(f,b);_.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(lt.Errors.CANT_EXTRACT_FILE());else{let j=y?_.header.fileAttr:void 0;i.writeFileToAsync(k,R,m,j,function(U){U||w(A("Unable to write file",k)),i.fs.utimes(k,_.header.time,_.header.time,function(K){K?w(A("Unable to set times",k)):w()})})}})}}},E)()},writeZip:function(f,m){if(arguments.length===1&&typeof f=="function"&&(m=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var y=s.compressToBuffer();if(y){var E=i.writeFileTo(f,y,!0);typeof m=="function"&&m(E?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:y,perm:E}=Object.assign({overwrite:!0},m);return new Promise((S,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?S(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,y,E,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,y,E){return typeof f=="function"?(s.toAsyncBuffer(f,m,y,E),null):s.compressToBuffer()}}}});var YS=v((tye,XS)=>{var WS={};XS.exports=WS;var GS={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(GS).forEach(function(t){var e=GS[t],r=WS[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var ZS=v((rye,JS)=>{"use strict";JS.exports=function(t,e){e=e||process.argv;var r=e.indexOf("--"),n=/^-{1,2}/.test(t)?"":"--",i=e.indexOf(n+t);return i!==-1&&(r===-1?!0:i<r)}});var eA=v((nye,QS)=>{"use strict";var G7=require("os"),on=ZS(),nr=process.env,Uo=void 0;on("no-color")||on("no-colors")||on("color=false")?Uo=!1:(on("color")||on("colors")||on("color=true")||on("color=always"))&&(Uo=!0);"FORCE_COLOR"in nr&&(Uo=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function W7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function X7(t){if(Uo===!1)return 0;if(on("color=16m")||on("color=full")||on("color=truecolor"))return 3;if(on("color=256"))return 2;if(t&&!t.isTTY&&Uo!==!0)return 0;var e=Uo?1:0;if(process.platform==="win32"){var r=G7.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 nr)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(i){return i in nr})||nr.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in nr)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(nr.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in nr){var n=parseInt((nr.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(nr.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(nr.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(nr.TERM)||"COLORTERM"in nr?1:(nr.TERM==="dumb",e)}function Yy(t){var e=X7(t);return W7(e)}QS.exports={supportsColor:Yy,stdout:Yy(process.stdout),stderr:Yy(process.stderr)}});var rA=v((iye,tA)=>{tA.exports=function(e,r){var n="";e=e||"Run the trap, drop the bass",e=e.split("");var i={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(s){s=s.toLowerCase();var o=i[s]||[" "],a=Math.floor(Math.random()*o.length);typeof i[s]<"u"?n+=i[s][a]:n+=s}),n}});var iA=v((sye,nA)=>{nA.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"]},i=[].concat(n.up,n.down,n.mid);function s(u){var c=Math.floor(Math.random()*u);return c}function o(u){var c=!1;return i.filter(function(l){c=l===u}),c}function a(u,c){var l="",h,d;c=c||{},c.up=typeof c.up<"u"?c.up:!0,c.mid=typeof c.mid<"u"?c.mid:!0,c.down=typeof c.down<"u"?c.down:!0,c.size=typeof c.size<"u"?c.size:"maxi",u=u.split("");for(d in u)if(!o(d)){switch(l=l+u[d],h={up:0,down:0,mid:0},c.size){case"mini":h.up=s(8),h.mid=s(2),h.down=s(8);break;case"maxi":h.up=s(16)+3,h.mid=s(4)+1,h.down=s(64)+3;break;default:h.up=s(8)+1,h.mid=s(6)/2,h.down=s(8)+1;break}var f=["up","mid","down"];for(var m in f)for(var y=f[m],E=0;E<=h[y];E++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var oA=v((oye,sA)=>{sA.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 uA=v((aye,aA)=>{aA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var lA=v((uye,cA)=>{cA.exports=function(t){var e=["red","yellow","green","blue","magenta"];return function(r,n,i){return r===" "?r:t[e[n++%e.length]](r)}}});var hA=v((cye,fA)=>{fA.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,i){return r===" "?r:t[e[Math.round(Math.random()*(e.length-2))]](r)}}});var DA=v((fye,yA)=>{var Ee={};yA.exports=Ee;Ee.themes={};var Y7=require("util"),ys=Ee.styles=YS(),pA=Object.defineProperties,J7=new RegExp(/[\r\n]+/g);Ee.supportsColor=eA().supportsColor;typeof Ee.enabled>"u"&&(Ee.enabled=Ee.supportsColor()!==!1);Ee.enable=function(){Ee.enabled=!0};Ee.disable=function(){Ee.enabled=!1};Ee.stripColors=Ee.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var lye=Ee.stylize=function(e,r){if(!Ee.enabled)return e+"";var n=ys[r];return!n&&r in Ee?Ee[r](e):n.open+e+n.close},Z7=/[|\\{}()[\]^$+*?.]/g,Q7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(Z7,"\\$&")};function mA(t){var e=function r(){return tH.apply(r,arguments)};return e._styles=t,e.__proto__=eH,e}var gA=(function(){var t={};return ys.grey=ys.gray,Object.keys(ys).forEach(function(e){ys[e].closeRe=new RegExp(Q7(ys[e].close),"g"),t[e]={get:function(){return mA(this._styles.concat(e))}}}),t})(),eH=pA(function(){},gA);function tH(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:Y7.inspect(o)}).join(" ");if(!Ee.enabled||!e)return e;for(var r=e.indexOf(`
41
41
  `)!=-1,n=this._styles,i=n.length;i--;){var s=ys[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(J7,function(o){return s.close+o+s.open}))}return e}Ee.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){Ee[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=Ee[t[r][s]](i);return i}return Ee[t[r]](n)}})(e)};function rH(){var t={};return Object.keys(gA).forEach(function(e){t[e]={get:function(){return mA([e])}}}),t}var nH=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};Ee.trap=rA();Ee.zalgo=iA();Ee.maps={};Ee.maps.america=oA()(Ee);Ee.maps.zebra=uA()(Ee);Ee.maps.rainbow=lA()(Ee);Ee.maps.random=hA()(Ee);for(dA in Ee.maps)(function(t){Ee[t]=function(e){return nH(Ee.maps[t],e)}})(dA);var dA;pA(Ee,rH())});var EA=v((hye,wA)=>{var iH=DA();wA.exports=iH});var bA=v(Jy=>{"use strict";Jy.indent=function(e){return new Array(e+1).join(" ")};Jy.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 vA=v((pye,sH)=>{sH.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 _A=v($u=>{"use strict";var gn=EA(),Ti=bA(),oH=/[^\w\s\n\r\v\t\.,]/i;$u.version=vA().version;var Zy=function(t,e){return t!==void 0||e.renderUndefined},$f=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(`
42
42
  `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&$f(t[0],!0,r))},aH=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?gn[e.stringColor](t):t;var r=t+"";return t===!0?gn.green(r):t===!1?gn.red(r):t==null?gn.grey(r):typeof t=="number"?t>=0?gn[e.positiveNumberColor](r):gn[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},Qy=function(t,e){return t.multilineStringColor===null||t.noColor?e:gn[t.multilineStringColor](e)},uH=function(t,e,r){var n=t.split(`
43
43
  `);return n=n.map(function(i){return Ti.indent(e)+Qy(r,i)}),n.join(`
44
44
  `)},Ho=function(t,e,r){if(typeof t=="string"&&t.match(oH)&&e.escape&&(t=JSON.stringify(t)),!Zy(t,e))return[];if($f(t,!1,e))return[Ti.indent(r)+aH(t,e)];if(typeof t=="string")return[Ti.indent(r)+Qy(e,'"""'),uH(t,r+e.defaultIndentation,e),Ti.indent(r)+Qy(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[Ti.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(Zy(a,e)){var u="- ";e.noColor||(u=gn[e.dashColor](u)),u=Ti.indent(r)+u,$f(a,!1,e)?(u+=Ho(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Ho(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Ho({message:t.message,stack:t.stack.split(`
45
45
  `)},e,r);var i=e.noAlign?0:Ti.getMaxIndexLength(t),s,o=[];return Object.getOwnPropertyNames(t).forEach(function(a){if(Zy(t[a],e))if(s=a+": ",e.noColor||(s=gn[e.keysColor](s)),s=Ti.indent(r)+s,$f(t[a],!1,e)){var u=e.noAlign?0:i-a.length;s+=Ho(t[a],e,u)[0],o.push(s)}else o.push(s),o.push.apply(o,Ho(t[a],e,r+e.defaultIndentation))}),o};$u.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,Ho(e,r,n).join(`
46
46
  `)};$u.renderString=function(e,r,n){var i="",s;if(typeof e!="string"||e==="")return"";if(e[0]!=="{"&&e[0]!=="["){var o;e.indexOf("{")===-1?o=e.indexOf("["):e.indexOf("[")===-1||e.indexOf("{")<e.indexOf("[")?o=e.indexOf("{"):o=e.indexOf("["),i+=e.substr(0,o)+`
47
- `,e=e.substr(o)}try{s=JSON.parse(e)}catch{return gn.red("Error:")+" Not valid JSON!"}return i+=$u.render(s,r,n),i}});var rD=v(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.default=void 0;function Vo(t){"@babel/helpers - typeof";return Vo=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},Vo(t)}function CA(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,lH(n.key),n)}}function cH(t,e,r){return e&&CA(t.prototype,e),r&&CA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function lH(t){var e=fH(t,"string");return Vo(e)=="symbol"?e:e+""}function fH(t,e){if(Vo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dH(t,e,r){return e=ju(e),pH(t,tD()?Reflect.construct(e,r||[],ju(t).constructor):e.apply(t,r))}function pH(t,e){if(e&&(Vo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mH(t)}function mH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gH(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&&Lu(t,e)}function eD(t){var e=typeof Map=="function"?new Map:void 0;return eD=function(n){if(n===null||!DH(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,i)}function i(){return yH(n,arguments,ju(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Lu(i,n)},eD(t)}function yH(t,e,r){if(tD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Lu(i,r.prototype),i}function tD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tD=function(){return!!t})()}function DH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Lu(t,e){return Lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Lu(t,e)}function ju(t){return ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ju(t)}var wH=(function(t){function e(r){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(hH(this,e),n=dH(this,e,[r]),n.originalRequest=s,n.originalResponse=o,n.causingError=i,i!=null&&(r+=", caused by ".concat(i.toString())),s!=null){var a=s.getHeader("X-Request-ID")||"n/a",u=s.getMethod(),c=s.getURL(),l=o?o.getStatus():"n/a",h=o?o.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(h,", request id: ").concat(a,")")}return n.message=r,n}return gH(e,t),cH(e)})(eD(Error)),gye=Lf.default=wH});var nD=v(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.enableDebugLog=EH;jf.log=bH;var SA=!1;function EH(){SA=!0}function bH(t){SA&&console.log(t)}});var OA=v(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.default=void 0;function Bu(t){"@babel/helpers - typeof";return Bu=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},Bu(t)}function vH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AA(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,CH(n.key),n)}}function _H(t,e,r){return e&&AA(t.prototype,e),r&&AA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function CH(t){var e=SH(t,"string");return Bu(e)=="symbol"?e:e+""}function SH(t,e){if(Bu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wye=Bf.default=(function(){function t(){vH(this,t)}return _H(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 xA=v((iD,sD)=>{(function(t,e){typeof iD=="object"&&typeof sD<"u"?sD.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:iD,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,i=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=Array.prototype.slice.call(s),a=(function(q){var V={};return q.forEach(function(ae,x){return V[ae]=x}),V})(o),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},h=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(V){return V=="+"?"-":"_"})},d=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(q){for(var V,ae,x,O,H="",N=q.length%3,ne=0;ne<q.length;){if((ae=q.charCodeAt(ne++))>255||(x=q.charCodeAt(ne++))>255||(O=q.charCodeAt(ne++))>255)throw new TypeError("invalid character found");V=ae<<16|x<<8|O,H+=o[V>>18&63]+o[V>>12&63]+o[V>>6&63]+o[V&63]}return N?H.slice(0,N-3)+"===".substring(N):H},m=typeof btoa=="function"?function(q){return btoa(q)}:r?function(q){return Buffer.from(q,"binary").toString("base64")}:f,y=r?function(q){return Buffer.from(q).toString("base64")}:function(q){for(var V=4096,ae=[],x=0,O=q.length;x<O;x+=V)ae.push(c.apply(null,q.subarray(x,x+V)));return m(ae.join(""))},E=function(q,V){return V===void 0&&(V=!1),V?h(y(q)):y(q)},C=function(q){if(q.length<2){var V=q.charCodeAt(0);return V<128?q:V<2048?c(192|V>>>6)+c(128|V&63):c(224|V>>>12&15)+c(128|V>>>6&63)+c(128|V&63)}else{var V=65536+(q.charCodeAt(0)-55296)*1024+(q.charCodeAt(1)-56320);return c(240|V>>>18&7)+c(128|V>>>12&63)+c(128|V>>>6&63)+c(128|V&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,p=function(q){return q.replace(A,C)},D=r?function(q){return Buffer.from(q,"utf8").toString("base64")}:i?function(q){return y(i.encode(q))}:function(q){return m(p(q))},w=function(q,V){return V===void 0&&(V=!1),V?h(D(q)):D(q)},_=function(q){return w(q,!0)},P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,b=function(q){switch(q.length){case 4:var V=(7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3),ae=V-65536;return c((ae>>>10)+55296)+c((ae&1023)+56320);case 3:return c((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return c((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},k=function(q){return q.replace(P,b)},R=function(q){if(q=q.replace(/\s+/g,""),!u.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(q.length&3));for(var V,ae,x,O=[],H=0;H<q.length;)V=a[q.charAt(H++)]<<18|a[q.charAt(H++)]<<12|(ae=a[q.charAt(H++)])<<6|(x=a[q.charAt(H++)]),ae===64?O.push(c(V>>16&255)):x===64?O.push(c(V>>16&255,V>>8&255)):O.push(c(V>>16&255,V>>8&255,V&255));return O.join("")},I=typeof atob=="function"?function(q){return atob(d(q))}:r?function(q){return Buffer.from(q,"base64").toString("binary")}:R,j=r?function(q){return l(Buffer.from(q,"base64"))}:function(q){return l(I(q).split("").map(function(V){return V.charCodeAt(0)}))},U=function(q){return j(L(q))},K=r?function(q){return Buffer.from(q,"base64").toString("utf8")}:n?function(q){return n.decode(j(q))}:function(q){return k(I(q))},L=function(q){return d(q.replace(/[-_]/g,function(V){return V=="-"?"+":"/"}))},S=function(q){return K(L(q))},T=function(q){if(typeof q!="string")return!1;var V=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(V)||!/[^\s0-9a-zA-Z\-_]/.test(V)},F=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},$=function(){var q=function(V,ae){return Object.defineProperty(String.prototype,V,F(ae))};q("fromBase64",function(){return S(this)}),q("toBase64",function(V){return w(this,V)}),q("toBase64URI",function(){return w(this,!0)}),q("toBase64URL",function(){return w(this,!0)}),q("toUint8Array",function(){return U(this)})},M=function(){var q=function(V,ae){return Object.defineProperty(Uint8Array.prototype,V,F(ae))};q("toBase64",function(V){return E(this,V)}),q("toBase64URI",function(){return E(this,!0)}),q("toBase64URL",function(){return E(this,!0)})},B=function(){$(),M()},G={version:t,VERSION:e,atob:I,atobPolyfill:R,btoa:m,btoaPolyfill:f,fromBase64:S,toBase64:w,encode:w,encodeURI:_,encodeURL:_,utob:p,btou:k,decode:S,isValid:T,fromUint8Array:E,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:B};return G.Base64={},Object.keys(G).forEach(function(q){return G.Base64[q]=G[q]}),G})});var IA=v((bye,TA)=>{"use strict";TA.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 RA=v(oD=>{"use strict";var AH=Object.prototype.hasOwnProperty,OH;function FA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function PA(t){try{return encodeURIComponent(t)}catch{return null}}function xH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=FA(n[1]),s=FA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function TH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(AH.call(t,i)){if(n=t[i],!n&&(n===null||n===OH||isNaN(n))&&(n=""),i=PA(i),n=PA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}oD.stringify=TH;oD.parse=xH});var qA=v((_ye,MA)=>{"use strict";var NA=IA(),Mf=RA(),IH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,$A=/[\n\r\t]/g,FH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,LA=/:\d+$/,PH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,RH=/^[a-zA-Z]:/;function uD(t){return(t||"").toString().replace(IH,"")}var aD=[["#","hash"],["?","query"],function(e,r){return yn(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]],kA={hash:1,query:1};function jA(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={},i=typeof t,s;if(t.protocol==="blob:")n=new Dn(unescape(t.pathname),{});else if(i==="string"){n=new Dn(t,{});for(s in kA)delete n[s]}else if(i==="object"){for(s in t)s in kA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=FH.test(t.href))}return n}function yn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function BA(t,e){t=uD(t),t=t.replace($A,""),e=e||{};var r=PH.exec(t),n=r[1]?r[1].toLowerCase():"",i=!!r[2],s=!!r[3],o=0,a;return i?s?(a=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(a=r[2]+r[4],o=r[2].length):s?(a=r[3]+r[4],o=r[3].length):a=r[4],n==="file:"?o>=2&&(a=a.slice(2)):yn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&yn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||yn(n),slashesCount:o,rest:a}}function kH(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,i=r[n-1],s=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(s=!0),r.splice(n,1),o--);return s&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Dn(t,e,r){if(t=uD(t),t=t.replace($A,""),!(this instanceof Dn))return new Dn(t,e,r);var n,i,s,o,a,u,c=aD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Mf.parse),e=jA(e),i=BA(t||"",e),n=!i.protocol&&!i.slashes,h.slashes=i.slashes||n&&e.slashes,h.protocol=i.protocol||e.protocol||"",t=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||RH.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!yn(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(o=c[d],typeof o=="function"){t=o(t,h);continue}s=o[0],u=o[1],s!==s?h[u]=t:typeof s=="string"?(a=s==="@"?t.lastIndexOf(s):t.indexOf(s),~a&&(typeof o[2]=="number"?(h[u]=t.slice(0,a),t=t.slice(a+o[2])):(h[u]=t.slice(a),t=t.slice(0,a)))):(a=s.exec(t))&&(h[u]=a[1],t=t.slice(0,a.index)),h[u]=h[u]||n&&o[3]&&e[u]||"",o[4]&&(h[u]=h[u].toLowerCase())}r&&(h.query=r(h.query)),n&&e.slashes&&h.pathname.charAt(0)!=="/"&&(h.pathname!==""||e.pathname!=="")&&(h.pathname=kH(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&yn(h.protocol)&&(h.pathname="/"+h.pathname),NA(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(a=h.auth.indexOf(":"),~a?(h.username=h.auth.slice(0,a),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(a+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.auth=h.password?h.username+":"+h.password:h.username),h.origin=h.protocol!=="file:"&&yn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function NH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Mf.parse)(e)),n[t]=e;break;case"port":n[t]=e,NA(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,LA.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 i=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==i?i+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<aD.length;o++){var a=aD[o];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&yn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function $H(t){(!t||typeof t!="function")&&(t=Mf.stringify);var e,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var s=i+(r.protocol&&r.slashes||yn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&yn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||LA.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(s+=r.hash),s}Dn.prototype={set:NH,toString:$H};Dn.extractProtocol=BA;Dn.location=jA;Dn.trimLeft=uD;Dn.qs=Mf;MA.exports=Dn});var UA=v(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0});cD.default=LH;function LH(){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 nO=v(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.default=void 0;var jH=xA(),BH=hD(qA()),qf=hD(rD()),Ds=nD(),MH=hD(UA());function hD(t){return t&&t.__esModule?t:{default:t}}function lD(){"use strict";lD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,F){S[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,F){return Object.defineProperty(S,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(S,T,F,$){var M=T&&T.prototype instanceof C?T:C,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(S,F,G)}),B}function h(S,T,F){try{return{type:"normal",arg:S.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function C(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=C.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(F){return this._invoke(T,F)})})}function k(S,T){function F(M,B,G,q){var V=h(S[M],S,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ws(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(S,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(S,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(S,T){var F=T.method,$=S.iterator[F];if($===t)return T.delegate=null,F==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,S.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[S.resultName]=B.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(S){var T={tryLoc:S[0]};1 in S&&(T.catchLoc=S[1]),2 in S&&(T.finallyLoc=S[2],T.afterLoc=S[3]),this.tryEntries.push(T)}function U(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function K(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(j,this),this.reset(!0)}function L(S){if(S||S===""){var T=S[o];if(T)return T.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var F=-1,$=function M(){for(;++F<S.length;)if(n.call(S,F))return M.value=S[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(S)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(S){var T=typeof S=="function"&&S.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,p):(S.__proto__=p,c(S,u,"GeneratorFunction")),S.prototype=Object.create(P),S},e.awrap=function(S){return{__await:S}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(S,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(S,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function HA(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function qH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){HA(s,n,i,o,a,"next",u)}function a(u){HA(s,n,i,o,a,"throw",u)}o(void 0)})}}function ZA(t,e){return VH(t)||HH(t,e)||QA(t,e)||UH()}function UH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
47
+ `,e=e.substr(o)}try{s=JSON.parse(e)}catch{return gn.red("Error:")+" Not valid JSON!"}return i+=$u.render(s,r,n),i}});var rD=v(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});Lf.default=void 0;function Vo(t){"@babel/helpers - typeof";return Vo=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},Vo(t)}function CA(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,lH(n.key),n)}}function cH(t,e,r){return e&&CA(t.prototype,e),r&&CA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function lH(t){var e=fH(t,"string");return Vo(e)=="symbol"?e:e+""}function fH(t,e){if(Vo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Vo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dH(t,e,r){return e=ju(e),pH(t,tD()?Reflect.construct(e,r||[],ju(t).constructor):e.apply(t,r))}function pH(t,e){if(e&&(Vo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mH(t)}function mH(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gH(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&&Lu(t,e)}function eD(t){var e=typeof Map=="function"?new Map:void 0;return eD=function(n){if(n===null||!DH(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,i)}function i(){return yH(n,arguments,ju(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Lu(i,n)},eD(t)}function yH(t,e,r){if(tD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Lu(i,r.prototype),i}function tD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tD=function(){return!!t})()}function DH(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Lu(t,e){return Lu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Lu(t,e)}function ju(t){return ju=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ju(t)}var wH=(function(t){function e(r){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;if(hH(this,e),n=dH(this,e,[r]),n.originalRequest=s,n.originalResponse=o,n.causingError=i,i!=null&&(r+=", caused by ".concat(i.toString())),s!=null){var a=s.getHeader("X-Request-ID")||"n/a",u=s.getMethod(),c=s.getURL(),l=o?o.getStatus():"n/a",h=o?o.getBody()||"":"n/a";r+=", originated from request (method: ".concat(u,", url: ").concat(c,", response code: ").concat(l,", response text: ").concat(h,", request id: ").concat(a,")")}return n.message=r,n}return gH(e,t),cH(e)})(eD(Error)),gye=Lf.default=wH});var nD=v(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.enableDebugLog=EH;jf.log=bH;var SA=!1;function EH(){SA=!0}function bH(t){SA&&console.log(t)}});var OA=v(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.default=void 0;function Bu(t){"@babel/helpers - typeof";return Bu=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},Bu(t)}function vH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AA(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,CH(n.key),n)}}function _H(t,e,r){return e&&AA(t.prototype,e),r&&AA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function CH(t){var e=SH(t,"string");return Bu(e)=="symbol"?e:e+""}function SH(t,e){if(Bu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Bu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var wye=Bf.default=(function(){function t(){vH(this,t)}return _H(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 xA=v((iD,sD)=>{(function(t,e){typeof iD=="object"&&typeof sD<"u"?sD.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:iD,function(){"use strict";var t="3.7.8",e=t,r=typeof Buffer=="function",n=typeof TextDecoder=="function"?new TextDecoder:void 0,i=typeof TextEncoder=="function"?new TextEncoder:void 0,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=Array.prototype.slice.call(s),a=(function(q){var V={};return q.forEach(function(ae,x){return V[ae]=x}),V})(o),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),l=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},h=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(V){return V=="+"?"-":"_"})},d=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(q){for(var V,ae,x,O,H="",N=q.length%3,ne=0;ne<q.length;){if((ae=q.charCodeAt(ne++))>255||(x=q.charCodeAt(ne++))>255||(O=q.charCodeAt(ne++))>255)throw new TypeError("invalid character found");V=ae<<16|x<<8|O,H+=o[V>>18&63]+o[V>>12&63]+o[V>>6&63]+o[V&63]}return N?H.slice(0,N-3)+"===".substring(N):H},m=typeof btoa=="function"?function(q){return btoa(q)}:r?function(q){return Buffer.from(q,"binary").toString("base64")}:f,y=r?function(q){return Buffer.from(q).toString("base64")}:function(q){for(var V=4096,ae=[],x=0,O=q.length;x<O;x+=V)ae.push(c.apply(null,q.subarray(x,x+V)));return m(ae.join(""))},E=function(q,V){return V===void 0&&(V=!1),V?h(y(q)):y(q)},S=function(q){if(q.length<2){var V=q.charCodeAt(0);return V<128?q:V<2048?c(192|V>>>6)+c(128|V&63):c(224|V>>>12&15)+c(128|V>>>6&63)+c(128|V&63)}else{var V=65536+(q.charCodeAt(0)-55296)*1024+(q.charCodeAt(1)-56320);return c(240|V>>>18&7)+c(128|V>>>12&63)+c(128|V>>>6&63)+c(128|V&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,p=function(q){return q.replace(A,S)},D=r?function(q){return Buffer.from(q,"utf8").toString("base64")}:i?function(q){return y(i.encode(q))}:function(q){return m(p(q))},w=function(q,V){return V===void 0&&(V=!1),V?h(D(q)):D(q)},_=function(q){return w(q,!0)},P=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,b=function(q){switch(q.length){case 4:var V=(7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3),ae=V-65536;return c((ae>>>10)+55296)+c((ae&1023)+56320);case 3:return c((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return c((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},k=function(q){return q.replace(P,b)},R=function(q){if(q=q.replace(/\s+/g,""),!u.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(q.length&3));for(var V,ae,x,O=[],H=0;H<q.length;)V=a[q.charAt(H++)]<<18|a[q.charAt(H++)]<<12|(ae=a[q.charAt(H++)])<<6|(x=a[q.charAt(H++)]),ae===64?O.push(c(V>>16&255)):x===64?O.push(c(V>>16&255,V>>8&255)):O.push(c(V>>16&255,V>>8&255,V&255));return O.join("")},I=typeof atob=="function"?function(q){return atob(d(q))}:r?function(q){return Buffer.from(q,"base64").toString("binary")}:R,j=r?function(q){return l(Buffer.from(q,"base64"))}:function(q){return l(I(q).split("").map(function(V){return V.charCodeAt(0)}))},U=function(q){return j(L(q))},K=r?function(q){return Buffer.from(q,"base64").toString("utf8")}:n?function(q){return n.decode(j(q))}:function(q){return k(I(q))},L=function(q){return d(q.replace(/[-_]/g,function(V){return V=="-"?"+":"/"}))},C=function(q){return K(L(q))},T=function(q){if(typeof q!="string")return!1;var V=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(V)||!/[^\s0-9a-zA-Z\-_]/.test(V)},F=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},$=function(){var q=function(V,ae){return Object.defineProperty(String.prototype,V,F(ae))};q("fromBase64",function(){return C(this)}),q("toBase64",function(V){return w(this,V)}),q("toBase64URI",function(){return w(this,!0)}),q("toBase64URL",function(){return w(this,!0)}),q("toUint8Array",function(){return U(this)})},M=function(){var q=function(V,ae){return Object.defineProperty(Uint8Array.prototype,V,F(ae))};q("toBase64",function(V){return E(this,V)}),q("toBase64URI",function(){return E(this,!0)}),q("toBase64URL",function(){return E(this,!0)})},B=function(){$(),M()},G={version:t,VERSION:e,atob:I,atobPolyfill:R,btoa:m,btoaPolyfill:f,fromBase64:C,toBase64:w,encode:w,encodeURI:_,encodeURL:_,utob:p,btou:k,decode:C,isValid:T,fromUint8Array:E,toUint8Array:U,extendString:$,extendUint8Array:M,extendBuiltins:B};return G.Base64={},Object.keys(G).forEach(function(q){return G.Base64[q]=G[q]}),G})});var IA=v((bye,TA)=>{"use strict";TA.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 RA=v(oD=>{"use strict";var AH=Object.prototype.hasOwnProperty,OH;function FA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function PA(t){try{return encodeURIComponent(t)}catch{return null}}function xH(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=FA(n[1]),s=FA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function TH(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(AH.call(t,i)){if(n=t[i],!n&&(n===null||n===OH||isNaN(n))&&(n=""),i=PA(i),n=PA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}oD.stringify=TH;oD.parse=xH});var qA=v((_ye,MA)=>{"use strict";var NA=IA(),Mf=RA(),IH=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,$A=/[\n\r\t]/g,FH=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,LA=/:\d+$/,PH=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,RH=/^[a-zA-Z]:/;function uD(t){return(t||"").toString().replace(IH,"")}var aD=[["#","hash"],["?","query"],function(e,r){return yn(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]],kA={hash:1,query:1};function jA(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={},i=typeof t,s;if(t.protocol==="blob:")n=new Dn(unescape(t.pathname),{});else if(i==="string"){n=new Dn(t,{});for(s in kA)delete n[s]}else if(i==="object"){for(s in t)s in kA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=FH.test(t.href))}return n}function yn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function BA(t,e){t=uD(t),t=t.replace($A,""),e=e||{};var r=PH.exec(t),n=r[1]?r[1].toLowerCase():"",i=!!r[2],s=!!r[3],o=0,a;return i?s?(a=r[2]+r[3]+r[4],o=r[2].length+r[3].length):(a=r[2]+r[4],o=r[2].length):s?(a=r[3]+r[4],o=r[3].length):a=r[4],n==="file:"?o>=2&&(a=a.slice(2)):yn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&yn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||yn(n),slashesCount:o,rest:a}}function kH(t,e){if(t==="")return e;for(var r=(e||"/").split("/").slice(0,-1).concat(t.split("/")),n=r.length,i=r[n-1],s=!1,o=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),o++):o&&(n===0&&(s=!0),r.splice(n,1),o--);return s&&r.unshift(""),(i==="."||i==="..")&&r.push(""),r.join("/")}function Dn(t,e,r){if(t=uD(t),t=t.replace($A,""),!(this instanceof Dn))return new Dn(t,e,r);var n,i,s,o,a,u,c=aD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Mf.parse),e=jA(e),i=BA(t||"",e),n=!i.protocol&&!i.slashes,h.slashes=i.slashes||n&&e.slashes,h.protocol=i.protocol||e.protocol||"",t=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||RH.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!yn(h.protocol)))&&(c[3]=[/(.*)/,"pathname"]);d<c.length;d++){if(o=c[d],typeof o=="function"){t=o(t,h);continue}s=o[0],u=o[1],s!==s?h[u]=t:typeof s=="string"?(a=s==="@"?t.lastIndexOf(s):t.indexOf(s),~a&&(typeof o[2]=="number"?(h[u]=t.slice(0,a),t=t.slice(a+o[2])):(h[u]=t.slice(a),t=t.slice(0,a)))):(a=s.exec(t))&&(h[u]=a[1],t=t.slice(0,a.index)),h[u]=h[u]||n&&o[3]&&e[u]||"",o[4]&&(h[u]=h[u].toLowerCase())}r&&(h.query=r(h.query)),n&&e.slashes&&h.pathname.charAt(0)!=="/"&&(h.pathname!==""||e.pathname!=="")&&(h.pathname=kH(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&yn(h.protocol)&&(h.pathname="/"+h.pathname),NA(h.port,h.protocol)||(h.host=h.hostname,h.port=""),h.username=h.password="",h.auth&&(a=h.auth.indexOf(":"),~a?(h.username=h.auth.slice(0,a),h.username=encodeURIComponent(decodeURIComponent(h.username)),h.password=h.auth.slice(a+1),h.password=encodeURIComponent(decodeURIComponent(h.password))):h.username=encodeURIComponent(decodeURIComponent(h.auth)),h.auth=h.password?h.username+":"+h.password:h.username),h.origin=h.protocol!=="file:"&&yn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function NH(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Mf.parse)(e)),n[t]=e;break;case"port":n[t]=e,NA(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,LA.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 i=t==="pathname"?"/":"#";n[t]=e.charAt(0)!==i?i+e:e}else n[t]=e;break;case"username":case"password":n[t]=encodeURIComponent(e);break;case"auth":var s=e.indexOf(":");~s?(n.username=e.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var o=0;o<aD.length;o++){var a=aD[o];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&yn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function $H(t){(!t||typeof t!="function")&&(t=Mf.stringify);var e,r=this,n=r.host,i=r.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var s=i+(r.protocol&&r.slashes||yn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&yn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||LA.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,e=typeof r.query=="object"?t(r.query):r.query,e&&(s+=e.charAt(0)!=="?"?"?"+e:e),r.hash&&(s+=r.hash),s}Dn.prototype={set:NH,toString:$H};Dn.extractProtocol=BA;Dn.location=jA;Dn.trimLeft=uD;Dn.qs=Mf;MA.exports=Dn});var UA=v(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0});cD.default=LH;function LH(){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 nO=v(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});Vf.default=void 0;var jH=xA(),BH=hD(qA()),qf=hD(rD()),Ds=nD(),MH=hD(UA());function hD(t){return t&&t.__esModule?t:{default:t}}function lD(){"use strict";lD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,F){C[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,F){return Object.defineProperty(C,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(C,T,F,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(C,F,G)}),B}function h(C,T,F){try{return{type:"normal",arg:C.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function b(C){["next","throw","return"].forEach(function(T){c(C,T,function(F){return this._invoke(T,F)})})}function k(C,T){function F(M,B,G,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&ws(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(C,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(C,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(C,T){var F=T.method,$=C.iterator[F];if($===t)return T.delegate=null,F==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,I(C,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function K(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var F=-1,$=function M(){for(;++F<C.length;)if(n.call(C,F))return M.value=C[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(ws(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(C,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(C,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function HA(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function qH(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){HA(s,n,i,o,a,"next",u)}function a(u){HA(s,n,i,o,a,"throw",u)}o(void 0)})}}function ZA(t,e){return VH(t)||HH(t,e)||QA(t,e)||UH()}function UH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
48
48
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function HH(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,i,s,o,a=[],u=!0,c=!1;try{if(s=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);u=!0);}catch(l){c=!0,i=l}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function VH(t){if(Array.isArray(t))return t}function ws(t){"@babel/helpers - typeof";return ws=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},ws(t)}function zH(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=QA(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
49
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function QA(t,e){if(t){if(typeof t=="string")return VA(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 VA(t,e)}}function VA(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 zA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zA(Object(r),!0).forEach(function(n){KH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function KH(t,e,r){return e=eO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function KA(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,eO(n.key),n)}}function WH(t,e,r){return e&&KA(t.prototype,e),r&&KA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function eO(t){var e=XH(t,"string");return ws(e)=="symbol"?e:e+""}function XH(t,e){if(ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Uf="tus-v1",Hf="ietf-draft-03",Mu="ietf-draft-05",YH={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:rO,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:Uf},tO=(function(){function t(e,r){GH(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 WH(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(![Uf,Hf,Mu].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 i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[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 s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," 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,Ds.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Ds.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,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:ZH(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(l,h){l.uploadUrl=n._parallelUploadUrls[h]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,h){var d=0;return n._source.slice(l.start,l.end).then(function(f){var m=f.value;return new Promise(function(y,E){var C=zo(zo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:zo(zo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:E,onProgress:function(D){s=s-d+D,d=D,n._emitProgress(s,i)},onUploadUrlAvailable:function(){n._parallelUploadUrls[h]=A.url,n._parallelUploadUrls.filter(function(D){return!!D}).length===a.length&&n._saveUploadInUrlStorage()}}),A=new t(m,C);A.start(),n._parallelUploads.push(A)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=GA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Ko(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var h=l.getHeader("Location");if(h==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=JA(n.options.endpoint,h),(0,Ds.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Ds.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Ds.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Ds.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=zH(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(r)}}catch(a){i.e(a)}finally{i.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,i,s){this._emitError(new qf.default(i,s,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),YA(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);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,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,i)}},{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 i=GA(this.options.metadata);i!==""&&n.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):((this.options.protocol===Hf||this.options.protocol===Mu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Ko(o.getStatus(),200)){r._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){r._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(r.url=JA(r.options.endpoint,a),(0,Ds.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(o),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,o):(r._offset=0,r._performUpload())})}).catch(function(o){r._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),i=this._sendRequest(n,null);i.then(function(s){var o=s.getStatus();if(!Ko(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Ko(o,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var u=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===Uf){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(s);return}r._offset=a,r._performUpload()})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{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 i=this._addChunkToRequest(n);i.then(function(s){if(!Ko(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s)}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,i=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(o){n._emitProgress(i+o,n._size)}),this.options.protocol===Uf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Mu&&r.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,u=o.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===Hf||n.options.protocol===Mu)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{key:"_handleUploadResponse",value:function(r,n){var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var i=WA(r,n,this.options);return this._req=i,i}},{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(i){r._urlStorageKey=i})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return XA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=WA("DELETE",r,n);return XA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new qf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof qf.default||(s=new qf.default("tus: failed to terminate upload",s,i,null)),!YA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=zo(zo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function GA(t){return Object.entries(t).map(function(e){var r=ZA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(jH.Base64.encode(String(i)))}).join(",")}function Ko(t,e){return t>=e&&t<e+100}function WA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Hf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Mu?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var i=r.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=ZA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,MH.default)();n.setHeader("X-Request-ID",l)}return n}function XA(t,e,r){return fD.apply(this,arguments)}function fD(){return fD=qH(lD().mark(function t(e,r,n){var i;return lD().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(r);case 5:if(i=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},t)})),fD.apply(this,arguments)}function JH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function YA(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):rO(t)}function rO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Ko(e,400)||e===409||e===423)&&JH()}function JA(t,e){return new BH.default(e,t).toString()}function ZH(t,e){for(var r=Math.floor(t/e),n=[],i=0;i<e;i++)n.push({start:r*i,end:r*(i+1)});return n[e-1].end=t,n}tO.defaultOptions=YH;var Sye=Vf.default=tO});var sO=v((Oye,iO)=>{"use strict";var wn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";wn.writable=t=>wn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";wn.readable=t=>wn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";wn.duplex=t=>wn.writable(t)&&wn.readable(t);wn.transform=t=>wn.duplex(t)&&typeof t._transform=="function";iO.exports=wn});var aO=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;function qu(t){"@babel/helpers - typeof";return qu=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},qu(t)}function QH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oO(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,tV(n.key),n)}}function eV(t,e,r){return e&&oO(t.prototype,e),r&&oO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tV(t){var e=rV(t,"string");return qu(e)=="symbol"?e:e+""}function rV(t,e){if(qu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xye=zf.default=(function(){function t(e){QH(this,t),this._buffer=e,this.size=e.length}return eV(t,[{key:"slice",value:function(r,n){var i=this._buffer.slice(r,n);i.size=i.length;var s=n>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])})()});var fO=v(mD=>{"use strict";Object.defineProperty(mD,"__esModule",{value:!0});mD.default=uV;var lO=require("fs");function Es(t){"@babel/helpers - typeof";return Es=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},Es(t)}function dD(){"use strict";dD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,F){S[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,F){return Object.defineProperty(S,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(S,T,F,$){var M=T&&T.prototype instanceof C?T:C,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(S,F,G)}),B}function h(S,T,F){try{return{type:"normal",arg:S.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function C(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=C.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(F){return this._invoke(T,F)})})}function k(S,T){function F(M,B,G,q){var V=h(S[M],S,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&Es(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(S,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(S,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(S,T){var F=T.method,$=S.iterator[F];if($===t)return T.delegate=null,F==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,S.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[S.resultName]=B.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(S){var T={tryLoc:S[0]};1 in S&&(T.catchLoc=S[1]),2 in S&&(T.finallyLoc=S[2],T.afterLoc=S[3]),this.tryEntries.push(T)}function U(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function K(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(j,this),this.reset(!0)}function L(S){if(S||S===""){var T=S[o];if(T)return T.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var F=-1,$=function M(){for(;++F<S.length;)if(n.call(S,F))return M.value=S[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Es(S)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(S){var T=typeof S=="function"&&S.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,p):(S.__proto__=p,c(S,u,"GeneratorFunction")),S.prototype=Object.create(P),S},e.awrap=function(S){return{__await:S}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(S,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(S,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function nV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uO(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,sV(n.key),n)}}function iV(t,e,r){return e&&uO(t.prototype,e),r&&uO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function sV(t){var e=oV(t,"string");return Es(e)=="symbol"?e:e+""}function oV(t,e){if(Es(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Es(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function aV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){cO(s,n,i,o,a,"next",u)}function a(u){cO(s,n,i,o,a,"throw",u)}o(void 0)})}}function uV(t){return pD.apply(this,arguments)}function pD(){return pD=aV(dD().mark(function t(e){var r,n,i,s,o,a,u;return dD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,lO.promises.stat(n);case 3:return i=l.sent,s=i.size,o=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:s,u=a-o,l.abrupt("return",new cV(e,n,u));case 9:case"end":return l.stop()}},t)})),pD.apply(this,arguments)}var cV=(function(){function t(e,r,n){nV(this,t),this._stream=e,this._path=r,this.size=n}return iV(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,lO.createReadStream)(this._path,{start:s+r,end:s+n-1,autoClose:!0});o.size=Math.min(n-r,this.size);var a=o.size>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var yD=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;function bs(t){"@babel/helpers - typeof";return bs=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},bs(t)}function Uu(){"use strict";Uu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,F){S[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,F){return Object.defineProperty(S,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(S,T,F,$){var M=T&&T.prototype instanceof C?T:C,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(S,F,G)}),B}function h(S,T,F){try{return{type:"normal",arg:S.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function C(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=C.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(F){return this._invoke(T,F)})})}function k(S,T){function F(M,B,G,q){var V=h(S[M],S,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&bs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(S,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(S,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(S,T){var F=T.method,$=S.iterator[F];if($===t)return T.delegate=null,F==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,S.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[S.resultName]=B.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(S){var T={tryLoc:S[0]};1 in S&&(T.catchLoc=S[1]),2 in S&&(T.finallyLoc=S[2],T.afterLoc=S[3]),this.tryEntries.push(T)}function U(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function K(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(j,this),this.reset(!0)}function L(S){if(S||S===""){var T=S[o];if(T)return T.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var F=-1,$=function M(){for(;++F<S.length;)if(n.call(S,F))return M.value=S[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(bs(S)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(S){var T=typeof S=="function"&&S.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,p):(S.__proto__=p,c(S,u,"GeneratorFunction")),S.prototype=Object.create(P),S},e.awrap=function(S){return{__await:S}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(S,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(S,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function lV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hO(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,hV(n.key),n)}}function fV(t,e,r){return e&&hO(t.prototype,e),r&&hO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hV(t){var e=dV(t,"string");return bs(e)=="symbol"?e:e+""}function dV(t,e){if(bs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(bs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function pO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){dO(s,n,i,o,a,"next",u)}function a(u){dO(s,n,i,o,a,"throw",u)}o(void 0)})}}function pV(t,e){return gD.apply(this,arguments)}function gD(){return gD=pO(Uu().mark(function t(e,r){return Uu().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(s,o){var a=function(l){e.off("readable",u),o(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),s(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return i.stop()}},t)})),gD.apply(this,arguments)}var Fye=Kf.default=(function(){function t(e){var r=this;lV(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 fV(t,[{key:"slice",value:(function(){var e=pO(Uu().mark(function n(i,s){var o,a,u,c,l;return Uu().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(i>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(i<this._bufPos+this._buf.length?(a=i-this._bufPos,u=Math.min(this._buf.length,s-this._bufPos),o=this._buf.slice(a,u)):o=Buffer.alloc(0),!this._ended){d.next=10;break}return o.size=o.length,d.abrupt("return",{value:o,done:!0});case 10:if(c=s-i,!(c>o.length)){d.next=16;break}return d.next=14,pV(this._stream,c-o.length);case 14:l=d.sent,o=Buffer.concat([o,l]);case 16:return this._buf=o,this._bufPos=i,o.size=o.length,d.abrupt("return",{value:o,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,i){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var gO=v(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.default=void 0;var mV=require("fs"),gV=Gf(sO()),yV=Gf(aO()),DV=Gf(fO()),wV=Gf(yD());function Gf(t){return t&&t.__esModule?t:{default:t}}function Hu(t){"@babel/helpers - typeof";return Hu=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},Hu(t)}function EV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mO(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,vV(n.key),n)}}function bV(t,e,r){return e&&mO(t.prototype,e),r&&mO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vV(t){var e=_V(t,"string");return Hu(e)=="symbol"?e:e+""}function _V(t,e){if(Hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rye=Wf.default=(function(){function t(){EV(this,t)}return bV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new yV.default(r)):r instanceof mV.ReadStream&&r.path!=null?(0,DV.default)(r):gV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new wV.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 EO=v(DD=>{"use strict";Object.defineProperty(DD,"__esModule",{value:!0});DD.default=AV;var CV=require("crypto"),yO=wO(require("fs")),SV=wO(require("path"));function DO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(DO=function(n){return n?r:e})(t)}function wO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=DO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function AV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,CV.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof yO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=SV.resolve(t.path);yO.stat(t.path,function(c,l){if(c){a(c);return}var h=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");o(h)})}):Promise.resolve(null)}});var SO=v(($ye,CO)=>{var _O="Expected a function",bO=NaN,OV="[object Symbol]",xV=/^\s+|\s+$/g,TV=/^[-+]0x[0-9a-f]+$/i,IV=/^0b[01]+$/i,FV=/^0o[0-7]+$/i,PV=parseInt,RV=typeof global=="object"&&global&&global.Object===Object&&global,kV=typeof self=="object"&&self&&self.Object===Object&&self,NV=RV||kV||Function("return this")(),$V=Object.prototype,LV=$V.toString,jV=Math.max,BV=Math.min,wD=function(){return NV.Date.now()};function MV(t,e,r){var n,i,s,o,a,u,c=0,l=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError(_O);e=vO(e)||0,Xf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?jV(vO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(_){var P=n,b=i;return n=i=void 0,c=_,o=t.apply(b,P),o}function m(_){return c=_,a=setTimeout(C,e),l?f(_):o}function y(_){var P=_-u,b=_-c,k=e-P;return h?BV(k,s-b):k}function E(_){var P=_-u,b=_-c;return u===void 0||P>=e||P<0||h&&b>=s}function C(){var _=wD();if(E(_))return A(_);a=setTimeout(C,y(_))}function A(_){return a=void 0,d&&n?f(_):(n=i=void 0,o)}function p(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function D(){return a===void 0?o:A(wD())}function w(){var _=wD(),P=E(_);if(n=arguments,i=this,u=_,P){if(a===void 0)return m(u);if(h)return a=setTimeout(C,e),f(u)}return a===void 0&&(a=setTimeout(C,e)),o}return w.cancel=p,w.flush=D,w}function qV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(_O);return Xf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),MV(t,e,{leading:n,maxWait:e,trailing:i})}function Xf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function UV(t){return!!t&&typeof t=="object"}function HV(t){return typeof t=="symbol"||UV(t)&&LV.call(t)==OV}function vO(t){if(typeof t=="number")return t;if(HV(t))return bO;if(Xf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Xf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(xV,"");var r=IV.test(t);return r||FV.test(t)?PV(t.slice(2),r?2:8):TV.test(t)?bO:+t}CO.exports=qV});var kO=v(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.default=void 0;var VV=FO(require("http")),zV=FO(require("https")),xO=require("stream"),KV=require("url"),TO=GV(SO());function GV(t){return t&&t.__esModule?t:{default:t}}function IO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(IO=function(n){return n?r:e})(t)}function FO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=IO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function WV(t,e,r){return e=Yf(e),XV(t,PO()?Reflect.construct(e,r||[],Yf(t).constructor):e.apply(t,r))}function XV(t,e){if(e&&(Go(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YV(t)}function YV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PO=function(){return!!t})()}function Yf(t){return Yf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Yf(t)}function JV(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&&ED(t,e)}function ED(t,e){return ED=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ED(t,e)}function AO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AO(Object(r),!0).forEach(function(n){ZV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ZV(t,e,r){return e=RO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Go(t){"@babel/helpers - typeof";return Go=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},Go(t)}function Jf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OO(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,RO(n.key),n)}}function Zf(t,e,r){return e&&OO(t.prototype,e),r&&OO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RO(t){var e=QV(t,"string");return Go(e)=="symbol"?e:e+""}function QV(t,e){if(Go(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Go(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lye=Qf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jf(this,t),this._requestOptions=e}return Zf(t,[{key:"createRequest",value:function(r,n){return new ez(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),ez=(function(){function t(e,r,n){Jf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Zf(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(i,s){var o=Vu(Vu(Vu({},(0,KV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Vu(Vu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?zV:VV;r._request=a.request(o);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(h){l.push(h)}),c.on("end",function(){var h=Buffer.concat(l).toString("utf8");i(new tz(c,h))})}),u.on("error",function(c){s(c)}),n instanceof xO.Readable?n.pipe(new rz(r._progressHandler)).pipe(u):n instanceof Uint8Array?nz(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}}])})(),tz=(function(){function t(e,r){Jf(this,t),this._response=e,this._body=r}return Zf(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}}])})(),rz=(function(t){function e(r){var n;return Jf(this,e),n=WV(this,e),n._onprogress=(0,TO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return JV(e,t),Zf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(xO.Transform),nz=function(e,r,n){n=(0,TO.default)(n,100,{leading:!0,trailing:!1});var i=0;function s(){var o=Math.min(e.writableHighWaterMark,r.length-i),a=r.subarray(i,i+o);i+=a.length;var u=e.write(a);u?i<r.length?s():e.end():(e.once("drain",s),n(i))}s()}});var NO=v(bD=>{"use strict";bD.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};bD.root=function(t,e,r){var n=this,i,s={stackLength:Error.stackTraceLimit,rootOnly:!0},o="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
49
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function QA(t,e){if(t){if(typeof t=="string")return VA(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 VA(t,e)}}function VA(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 zA(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function zo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zA(Object(r),!0).forEach(function(n){KH(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zA(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function KH(t,e,r){return e=eO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function GH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function KA(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,eO(n.key),n)}}function WH(t,e,r){return e&&KA(t.prototype,e),r&&KA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function eO(t){var e=XH(t,"string");return ws(e)=="symbol"?e:e+""}function XH(t,e){if(ws(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ws(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Uf="tus-v1",Hf="ietf-draft-03",Mu="ietf-draft-05",YH={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:rO,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:Uf},tO=(function(){function t(e,r){GH(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 WH(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(![Uf,Hf,Mu].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 i=this.options.retryDelays;if(i!=null&&Object.prototype.toString.call(i)!=="[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 s=0,o=["uploadUrl","uploadSize","uploadLengthDeferred"];s<o.length;s++){var a=o[s];if(this.options[a]){this._emitError(new Error("tus: cannot use the ".concat(a," 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,Ds.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,Ds.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,i=this._size,s=0;this._parallelUploads=[];var o=this._parallelUploadUrls!=null?this._parallelUploadUrls.length:this.options.parallelUploads,a=(r=this.options.parallelUploadBoundaries)!==null&&r!==void 0?r:ZH(this._source.size,o);this._parallelUploadUrls&&a.forEach(function(l,h){l.uploadUrl=n._parallelUploadUrls[h]||null}),this._parallelUploadUrls=new Array(a.length);var u=a.map(function(l,h){var d=0;return n._source.slice(l.start,l.end).then(function(f){var m=f.value;return new Promise(function(y,E){var S=zo(zo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:zo(zo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:E,onProgress:function(D){s=s-d+D,d=D,n._emitProgress(s,i)},onUploadUrlAvailable:function(){n._parallelUploadUrls[h]=A.url,n._parallelUploadUrls.filter(function(D){return!!D}).length===a.length&&n._saveUploadInUrlStorage()}}),A=new t(m,S);A.start(),n._parallelUploads.push(A)})})}),c;Promise.all(u).then(function(){c=n._openRequest("POST",n.options.endpoint),c.setHeader("Upload-Concat","final;".concat(n._parallelUploadUrls.join(" ")));var l=GA(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Ko(l.getStatus(),200)){n._emitHttpError(c,l,"tus: unexpected response while creating upload");return}var h=l.getHeader("Location");if(h==null){n._emitHttpError(c,l,"tus: invalid or missing Location header");return}n.url=JA(n.options.endpoint,h),(0,Ds.log)("Created upload at ".concat(n.url)),n._emitSuccess(l)}).catch(function(l){n._emitError(l)})}},{key:"_startSingleUpload",value:function(){if(this._aborted=!1,this.url!=null){(0,Ds.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,Ds.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,Ds.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=zH(this._parallelUploads),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;o.abort(r)}}catch(a){i.e(a)}finally{i.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,i,s){this._emitError(new qf.default(i,s,r,n))}},{key:"_emitError",value:function(r){var n=this;if(!this._aborted){if(this.options.retryDelays!=null){var i=this._offset!=null&&this._offset>this._offsetBeforeRetry;if(i&&(this._retryAttempt=0),YA(r,this._retryAttempt,this.options)){var s=this.options.retryDelays[this._retryAttempt++];this._offsetBeforeRetry=this._offset,this._retryTimeout=setTimeout(function(){n.start()},s);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,i){typeof this.options.onChunkComplete=="function"&&this.options.onChunkComplete(r,n,i)}},{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 i=GA(this.options.metadata);i!==""&&n.setHeader("Upload-Metadata",i);var s;this.options.uploadDataDuringCreation&&!this.options.uploadLengthDeferred?(this._offset=0,s=this._addChunkToRequest(n)):((this.options.protocol===Hf||this.options.protocol===Mu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Ko(o.getStatus(),200)){r._emitHttpError(n,o,"tus: unexpected response while creating upload");return}var a=o.getHeader("Location");if(a==null){r._emitHttpError(n,o,"tus: invalid or missing Location header");return}if(r.url=JA(r.options.endpoint,a),(0,Ds.log)("Created upload at ".concat(r.url)),typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._size===0){r._emitSuccess(o),r._source.close();return}r._saveUploadInUrlStorage().then(function(){r.options.uploadDataDuringCreation?r._handleUploadResponse(n,o):(r._offset=0,r._performUpload())})}).catch(function(o){r._emitHttpError(n,null,"tus: failed to create upload",o)})}},{key:"_resumeUpload",value:function(){var r=this,n=this._openRequest("HEAD",this.url),i=this._sendRequest(n,null);i.then(function(s){var o=s.getStatus();if(!Ko(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Ko(o,400)&&r._removeFromUrlStorage(),!r.options.endpoint){r._emitHttpError(n,s,"tus: unable to resume upload (new upload cannot be created without an endpoint)");return}r.url=null,r._createUpload();return}var a=Number.parseInt(s.getHeader("Upload-Offset"),10);if(Number.isNaN(a)){r._emitHttpError(n,s,"tus: invalid or missing offset value");return}var u=Number.parseInt(s.getHeader("Upload-Length"),10);if(Number.isNaN(u)&&!r.options.uploadLengthDeferred&&r.options.protocol===Uf){r._emitHttpError(n,s,"tus: invalid or missing length value");return}typeof r.options.onUploadUrlAvailable=="function"&&r.options.onUploadUrlAvailable(),r._saveUploadInUrlStorage().then(function(){if(a===u){r._emitProgress(u,u),r._emitSuccess(s);return}r._offset=a,r._performUpload()})}).catch(function(s){r._emitHttpError(n,null,"tus: failed to resume upload",s)})}},{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 i=this._addChunkToRequest(n);i.then(function(s){if(!Ko(s.getStatus(),200)){r._emitHttpError(n,s,"tus: unexpected response while uploading chunk");return}r._handleUploadResponse(n,s)}).catch(function(s){r._aborted||r._emitHttpError(n,null,"tus: failed to upload chunk at offset ".concat(r._offset),s)})}}},{key:"_addChunkToRequest",value:function(r){var n=this,i=this._offset,s=this._offset+this.options.chunkSize;return r.setProgressHandler(function(o){n._emitProgress(i+o,n._size)}),this.options.protocol===Uf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Mu&&r.setHeader("Content-Type","application/partial-upload"),(s===Number.POSITIVE_INFINITY||s>this._size)&&!this.options.uploadLengthDeferred&&(s=this._size),this._source.slice(i,s).then(function(o){var a=o.value,u=o.done,c=a!=null&&a.size?a.size:0;n.options.uploadLengthDeferred&&u&&(n._size=n._offset+c,r.setHeader("Upload-Length","".concat(n._size)));var l=n._offset+c;return!n.options.uploadLengthDeferred&&u&&l!==n._size?Promise.reject(new Error("upload was configured with a size of ".concat(n._size," bytes, but the source is done after ").concat(l," bytes"))):a===null?n._sendRequest(r):((n.options.protocol===Hf||n.options.protocol===Mu)&&r.setHeader("Upload-Complete",u?"?1":"?0"),n._emitProgress(n._offset,n._size),n._sendRequest(r,a))})}},{key:"_handleUploadResponse",value:function(r,n){var i=Number.parseInt(n.getHeader("Upload-Offset"),10);if(Number.isNaN(i)){this._emitHttpError(r,n,"tus: invalid or missing offset value");return}if(this._emitProgress(i,this._size),this._emitChunkComplete(i-this._offset,i,this._size),this._offset=i,i===this._size){this._emitSuccess(n),this._source.close();return}this._performUpload()}},{key:"_openRequest",value:function(r,n){var i=WA(r,n,this.options);return this._req=i,i}},{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(i){r._urlStorageKey=i})}},{key:"_sendRequest",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return XA(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=WA("DELETE",r,n);return XA(i,null,n).then(function(s){if(s.getStatus()!==204)throw new qf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof qf.default||(s=new qf.default("tus: failed to terminate upload",s,i,null)),!YA(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=zo(zo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function GA(t){return Object.entries(t).map(function(e){var r=ZA(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(jH.Base64.encode(String(i)))}).join(",")}function Ko(t,e){return t>=e&&t<e+100}function WA(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Hf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Mu?n.setHeader("Upload-Draft-Interop-Version","6"):n.setHeader("Tus-Resumable","1.0.0");for(var i=r.headers||{},s=0,o=Object.entries(i);s<o.length;s++){var a=ZA(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,MH.default)();n.setHeader("X-Request-ID",l)}return n}function XA(t,e,r){return fD.apply(this,arguments)}function fD(){return fD=qH(lD().mark(function t(e,r,n){var i;return lD().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(typeof n.onBeforeRequest!="function"){o.next=3;break}return o.next=3,n.onBeforeRequest(e);case 3:return o.next=5,e.send(r);case 5:if(i=o.sent,typeof n.onAfterResponse!="function"){o.next=9;break}return o.next=9,n.onAfterResponse(e,i);case 9:return o.abrupt("return",i);case 10:case"end":return o.stop()}},t)})),fD.apply(this,arguments)}function JH(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function YA(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):rO(t)}function rO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Ko(e,400)||e===409||e===423)&&JH()}function JA(t,e){return new BH.default(e,t).toString()}function ZH(t,e){for(var r=Math.floor(t/e),n=[],i=0;i<e;i++)n.push({start:r*i,end:r*(i+1)});return n[e-1].end=t,n}tO.defaultOptions=YH;var Sye=Vf.default=tO});var sO=v((Oye,iO)=>{"use strict";var wn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";wn.writable=t=>wn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";wn.readable=t=>wn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";wn.duplex=t=>wn.writable(t)&&wn.readable(t);wn.transform=t=>wn.duplex(t)&&typeof t._transform=="function";iO.exports=wn});var aO=v(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;function qu(t){"@babel/helpers - typeof";return qu=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},qu(t)}function QH(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oO(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,tV(n.key),n)}}function eV(t,e,r){return e&&oO(t.prototype,e),r&&oO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function tV(t){var e=rV(t,"string");return qu(e)=="symbol"?e:e+""}function rV(t,e){if(qu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(qu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xye=zf.default=(function(){function t(e){QH(this,t),this._buffer=e,this.size=e.length}return eV(t,[{key:"slice",value:function(r,n){var i=this._buffer.slice(r,n);i.size=i.length;var s=n>=this.size;return Promise.resolve({value:i,done:s})}},{key:"close",value:function(){}}])})()});var fO=v(mD=>{"use strict";Object.defineProperty(mD,"__esModule",{value:!0});mD.default=uV;var lO=require("fs");function Es(t){"@babel/helpers - typeof";return Es=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},Es(t)}function dD(){"use strict";dD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,F){C[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,F){return Object.defineProperty(C,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(C,T,F,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(C,F,G)}),B}function h(C,T,F){try{return{type:"normal",arg:C.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function b(C){["next","throw","return"].forEach(function(T){c(C,T,function(F){return this._invoke(T,F)})})}function k(C,T){function F(M,B,G,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&Es(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(C,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(C,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(C,T){var F=T.method,$=C.iterator[F];if($===t)return T.delegate=null,F==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,I(C,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function K(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var F=-1,$=function M(){for(;++F<C.length;)if(n.call(C,F))return M.value=C[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(Es(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(C,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(C,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function nV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uO(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,sV(n.key),n)}}function iV(t,e,r){return e&&uO(t.prototype,e),r&&uO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function sV(t){var e=oV(t,"string");return Es(e)=="symbol"?e:e+""}function oV(t,e){if(Es(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Es(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function aV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){cO(s,n,i,o,a,"next",u)}function a(u){cO(s,n,i,o,a,"throw",u)}o(void 0)})}}function uV(t){return pD.apply(this,arguments)}function pD(){return pD=aV(dD().mark(function t(e){var r,n,i,s,o,a,u;return dD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,lO.promises.stat(n);case 3:return i=l.sent,s=i.size,o=(r=e.start)!==null&&r!==void 0?r:0,a=Number.isFinite(e.end)?e.end+1:s,u=a-o,l.abrupt("return",new cV(e,n,u));case 9:case"end":return l.stop()}},t)})),pD.apply(this,arguments)}var cV=(function(){function t(e,r,n){nV(this,t),this._stream=e,this._path=r,this.size=n}return iV(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,lO.createReadStream)(this._path,{start:s+r,end:s+n-1,autoClose:!0});o.size=Math.min(n-r,this.size);var a=o.size>=this.size;return Promise.resolve({value:o,done:a})}},{key:"close",value:function(){this._stream.destroy()}}])})()});var yD=v(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;function bs(t){"@babel/helpers - typeof";return bs=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},bs(t)}function Uu(){"use strict";Uu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(C,T,F){C[T]=F.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(C,T,F){return Object.defineProperty(C,T,{value:F,enumerable:!0,configurable:!0,writable:!0}),C[T]}try{c({},"")}catch{c=function(F,$,M){return F[$]=M}}function l(C,T,F,$){var M=T&&T.prototype instanceof S?T:S,B=Object.create(M.prototype),G=new K($||[]);return i(B,"_invoke",{value:R(C,F,G)}),B}function h(C,T,F){try{return{type:"normal",arg:C.call(T,F)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",E={};function S(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,o)&&(D=_);var P=p.prototype=S.prototype=Object.create(D);function b(C){["next","throw","return"].forEach(function(T){c(C,T,function(F){return this._invoke(T,F)})})}function k(C,T){function F(M,B,G,q){var V=h(C[M],C,B);if(V.type!=="throw"){var ae=V.arg,x=ae.value;return x&&bs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){F("next",O,G,q)},function(O){F("throw",O,G,q)}):T.resolve(x).then(function(O){ae.value=O,G(ae)},function(O){return F("throw",O,G,q)})}q(V.arg)}var $;i(this,"_invoke",{value:function(B,G){function q(){return new T(function(V,ae){F(B,G,V,ae)})}return $=$?$.then(q,q):q()}})}function R(C,T,F){var $=d;return function(M,B){if($===m)throw Error("Generator is already running");if($===y){if(M==="throw")throw B;return{value:t,done:!0}}for(F.method=M,F.arg=B;;){var G=F.delegate;if(G){var q=I(G,F);if(q){if(q===E)continue;return q}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if($===d)throw $=y,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);$=m;var V=h(C,T,F);if(V.type==="normal"){if($=F.done?y:f,V.arg===E)continue;return{value:V.arg,done:F.done}}V.type==="throw"&&($=y,F.method="throw",F.arg=V.arg)}}}function I(C,T){var F=T.method,$=C.iterator[F];if($===t)return T.delegate=null,F==="throw"&&C.iterator.return&&(T.method="return",T.arg=t,I(C,T),T.method==="throw")||F!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+F+"' method")),E;var M=h($,C.iterator,T.arg);if(M.type==="throw")return T.method="throw",T.arg=M.arg,T.delegate=null,E;var B=M.arg;return B?B.done?(T[C.resultName]=B.value,T.next=C.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,E):B:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,E)}function j(C){var T={tryLoc:C[0]};1 in C&&(T.catchLoc=C[1]),2 in C&&(T.finallyLoc=C[2],T.afterLoc=C[3]),this.tryEntries.push(T)}function U(C){var T=C.completion||{};T.type="normal",delete T.arg,C.completion=T}function K(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(j,this),this.reset(!0)}function L(C){if(C||C===""){var T=C[o];if(T)return T.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var F=-1,$=function M(){for(;++F<C.length;)if(n.call(C,F))return M.value=C[F],M.done=!1,M;return M.value=t,M.done=!0,M};return $.next=$}}throw new TypeError(bs(C)+" is not iterable")}return A.prototype=p,i(P,"constructor",{value:p,configurable:!0}),i(p,"constructor",{value:A,configurable:!0}),A.displayName=c(p,u,"GeneratorFunction"),e.isGeneratorFunction=function(C){var T=typeof C=="function"&&C.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,p):(C.__proto__=p,c(C,u,"GeneratorFunction")),C.prototype=Object.create(P),C},e.awrap=function(C){return{__await:C}},b(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(C,T,F,$,M){M===void 0&&(M=Promise);var B=new k(l(C,T,F,$),M);return e.isGeneratorFunction(T)?B:B.next().then(function(G){return G.done?G.value:B.next()})},b(P),c(P,u,"Generator"),c(P,o,function(){return this}),c(P,"toString",function(){return"[object Generator]"}),e.keys=function(C){var T=Object(C),F=[];for(var $ in T)F.push($);return F.reverse(),function M(){for(;F.length;){var B=F.pop();if(B in T)return M.value=B,M.done=!1,M}return M.done=!0,M}},e.values=L,K.prototype={constructor:K,reset:function(T){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(U),!T)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=t)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var F=this;function $(ae,x){return G.type="throw",G.arg=T,F.next=ae,x&&(F.method="next",F.arg=t),!!x}for(var M=this.tryEntries.length-1;M>=0;--M){var B=this.tryEntries[M],G=B.completion;if(B.tryLoc==="root")return $("end");if(B.tryLoc<=this.prev){var q=n.call(B,"catchLoc"),V=n.call(B,"finallyLoc");if(q&&V){if(this.prev<B.catchLoc)return $(B.catchLoc,!0);if(this.prev<B.finallyLoc)return $(B.finallyLoc)}else if(q){if(this.prev<B.catchLoc)return $(B.catchLoc,!0)}else{if(!V)throw Error("try statement without catch or finally");if(this.prev<B.finallyLoc)return $(B.finallyLoc)}}}},abrupt:function(T,F){for(var $=this.tryEntries.length-1;$>=0;--$){var M=this.tryEntries[$];if(M.tryLoc<=this.prev&&n.call(M,"finallyLoc")&&this.prev<M.finallyLoc){var B=M;break}}B&&(T==="break"||T==="continue")&&B.tryLoc<=F&&F<=B.finallyLoc&&(B=null);var G=B?B.completion:{};return G.type=T,G.arg=F,B?(this.method="next",this.next=B.finallyLoc,E):this.complete(G)},complete:function(T,F){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&F&&(this.next=F),E},finish:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),U($),E}},catch:function(T){for(var F=this.tryEntries.length-1;F>=0;--F){var $=this.tryEntries[F];if($.tryLoc===T){var M=$.completion;if(M.type==="throw"){var B=M.arg;U($)}return B}}throw Error("illegal catch attempt")},delegateYield:function(T,F,$){return this.delegate={iterator:L(T),resultName:F,nextLoc:$},this.method==="next"&&(this.arg=t),E}},e}function lV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function hO(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,hV(n.key),n)}}function fV(t,e,r){return e&&hO(t.prototype,e),r&&hO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function hV(t){var e=dV(t,"string");return bs(e)=="symbol"?e:e+""}function dV(t,e){if(bs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(bs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function dO(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function pO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){dO(s,n,i,o,a,"next",u)}function a(u){dO(s,n,i,o,a,"throw",u)}o(void 0)})}}function pV(t,e){return gD.apply(this,arguments)}function gD(){return gD=pO(Uu().mark(function t(e,r){return Uu().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",new Promise(function(s,o){var a=function(l){e.off("readable",u),o(l)},u=function c(){var l=e.read(r);l!==null&&(e.off("error",a),e.off("readable",c),s(l))};e.once("error",a),e.on("readable",u)}));case 1:case"end":return i.stop()}},t)})),gD.apply(this,arguments)}var Fye=Kf.default=(function(){function t(e){var r=this;lV(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 fV(t,[{key:"slice",value:(function(){var e=pO(Uu().mark(function n(i,s){var o,a,u,c,l;return Uu().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!(i<this._bufPos)){d.next=2;break}throw new Error("cannot slice from position which we already seeked away");case 2:if(!(i>this._bufPos+this._buf.length)){d.next=4;break}throw new Error("slice start is outside of buffer (currently not implemented)");case 4:if(!this._error){d.next=6;break}throw this._error;case 6:if(i<this._bufPos+this._buf.length?(a=i-this._bufPos,u=Math.min(this._buf.length,s-this._bufPos),o=this._buf.slice(a,u)):o=Buffer.alloc(0),!this._ended){d.next=10;break}return o.size=o.length,d.abrupt("return",{value:o,done:!0});case 10:if(c=s-i,!(c>o.length)){d.next=16;break}return d.next=14,pV(this._stream,c-o.length);case 14:l=d.sent,o=Buffer.concat([o,l]);case 16:return this._buf=o,this._bufPos=i,o.size=o.length,d.abrupt("return",{value:o,done:this._ended});case 20:case"end":return d.stop()}},n,this)}));function r(n,i){return e.apply(this,arguments)}return r})()},{key:"close",value:function(){this._stream.destroy()}}])})()});var gO=v(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.default=void 0;var mV=require("fs"),gV=Gf(sO()),yV=Gf(aO()),DV=Gf(fO()),wV=Gf(yD());function Gf(t){return t&&t.__esModule?t:{default:t}}function Hu(t){"@babel/helpers - typeof";return Hu=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},Hu(t)}function EV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mO(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,vV(n.key),n)}}function bV(t,e,r){return e&&mO(t.prototype,e),r&&mO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function vV(t){var e=_V(t,"string");return Hu(e)=="symbol"?e:e+""}function _V(t,e){if(Hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Rye=Wf.default=(function(){function t(){EV(this,t)}return bV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new yV.default(r)):r instanceof mV.ReadStream&&r.path!=null?(0,DV.default)(r):gV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new wV.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 EO=v(DD=>{"use strict";Object.defineProperty(DD,"__esModule",{value:!0});DD.default=AV;var CV=require("crypto"),yO=wO(require("fs")),SV=wO(require("path"));function DO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(DO=function(n){return n?r:e})(t)}function wO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=DO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function AV(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,CV.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof yO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=SV.resolve(t.path);yO.stat(t.path,function(c,l){if(c){a(c);return}var h=["node-file",u,l.size,l.mtime.getTime(),e.endpoint].join("-");o(h)})}):Promise.resolve(null)}});var SO=v(($ye,CO)=>{var _O="Expected a function",bO=NaN,OV="[object Symbol]",xV=/^\s+|\s+$/g,TV=/^[-+]0x[0-9a-f]+$/i,IV=/^0b[01]+$/i,FV=/^0o[0-7]+$/i,PV=parseInt,RV=typeof global=="object"&&global&&global.Object===Object&&global,kV=typeof self=="object"&&self&&self.Object===Object&&self,NV=RV||kV||Function("return this")(),$V=Object.prototype,LV=$V.toString,jV=Math.max,BV=Math.min,wD=function(){return NV.Date.now()};function MV(t,e,r){var n,i,s,o,a,u,c=0,l=!1,h=!1,d=!0;if(typeof t!="function")throw new TypeError(_O);e=vO(e)||0,Xf(r)&&(l=!!r.leading,h="maxWait"in r,s=h?jV(vO(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(_){var P=n,b=i;return n=i=void 0,c=_,o=t.apply(b,P),o}function m(_){return c=_,a=setTimeout(S,e),l?f(_):o}function y(_){var P=_-u,b=_-c,k=e-P;return h?BV(k,s-b):k}function E(_){var P=_-u,b=_-c;return u===void 0||P>=e||P<0||h&&b>=s}function S(){var _=wD();if(E(_))return A(_);a=setTimeout(S,y(_))}function A(_){return a=void 0,d&&n?f(_):(n=i=void 0,o)}function p(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function D(){return a===void 0?o:A(wD())}function w(){var _=wD(),P=E(_);if(n=arguments,i=this,u=_,P){if(a===void 0)return m(u);if(h)return a=setTimeout(S,e),f(u)}return a===void 0&&(a=setTimeout(S,e)),o}return w.cancel=p,w.flush=D,w}function qV(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(_O);return Xf(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),MV(t,e,{leading:n,maxWait:e,trailing:i})}function Xf(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function UV(t){return!!t&&typeof t=="object"}function HV(t){return typeof t=="symbol"||UV(t)&&LV.call(t)==OV}function vO(t){if(typeof t=="number")return t;if(HV(t))return bO;if(Xf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Xf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(xV,"");var r=IV.test(t);return r||FV.test(t)?PV(t.slice(2),r?2:8):TV.test(t)?bO:+t}CO.exports=qV});var kO=v(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.default=void 0;var VV=FO(require("http")),zV=FO(require("https")),xO=require("stream"),KV=require("url"),TO=GV(SO());function GV(t){return t&&t.__esModule?t:{default:t}}function IO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(IO=function(n){return n?r:e})(t)}function FO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=IO(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function WV(t,e,r){return e=Yf(e),XV(t,PO()?Reflect.construct(e,r||[],Yf(t).constructor):e.apply(t,r))}function XV(t,e){if(e&&(Go(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YV(t)}function YV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function PO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(PO=function(){return!!t})()}function Yf(t){return Yf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Yf(t)}function JV(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&&ED(t,e)}function ED(t,e){return ED=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ED(t,e)}function AO(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Vu(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?AO(Object(r),!0).forEach(function(n){ZV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):AO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ZV(t,e,r){return e=RO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Go(t){"@babel/helpers - typeof";return Go=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},Go(t)}function Jf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OO(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,RO(n.key),n)}}function Zf(t,e,r){return e&&OO(t.prototype,e),r&&OO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RO(t){var e=QV(t,"string");return Go(e)=="symbol"?e:e+""}function QV(t,e){if(Go(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Go(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lye=Qf.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jf(this,t),this._requestOptions=e}return Zf(t,[{key:"createRequest",value:function(r,n){return new ez(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),ez=(function(){function t(e,r,n){Jf(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return Zf(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(i,s){var o=Vu(Vu(Vu({},(0,KV.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Vu(Vu({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?zV:VV;r._request=a.request(o);var u=r._request;u.on("response",function(c){var l=[];c.on("data",function(h){l.push(h)}),c.on("end",function(){var h=Buffer.concat(l).toString("utf8");i(new tz(c,h))})}),u.on("error",function(c){s(c)}),n instanceof xO.Readable?n.pipe(new rz(r._progressHandler)).pipe(u):n instanceof Uint8Array?nz(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}}])})(),tz=(function(){function t(e,r){Jf(this,t),this._response=e,this._body=r}return Zf(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}}])})(),rz=(function(t){function e(r){var n;return Jf(this,e),n=WV(this,e),n._onprogress=(0,TO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return JV(e,t),Zf(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(xO.Transform),nz=function(e,r,n){n=(0,TO.default)(n,100,{leading:!0,trailing:!1});var i=0;function s(){var o=Math.min(e.writableHighWaterMark,r.length-i),a=r.subarray(i,i+o);i+=a.length;var u=e.write(a);u?i<r.length?s():e.end():(e.once("drain",s),n(i))}s()}});var NO=v(bD=>{"use strict";bD.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};bD.root=function(t,e,r){var n=this,i,s={stackLength:Error.stackTraceLimit,rootOnly:!0},o="",a=Error.stackTraceLimit,u;function c(){u[0]=n.toString(),n.stack=u.join(`
50
50
  `)}(!e||typeof e!="object")&&(e={}),e.hasOwnProperty("stackLength")&&typeof e.stackLength=="number"&&!isNaN(e.stackLength)&&e.stackLength>=0&&(s.stackLength=e.stackLength),e.hasOwnProperty("rootOnly")||(s.rootOnly=e.rootOnly),(!s.rootOnly||this.CustomError.parent===Error)&&(Object.keys(t).forEach(function(l){switch(l){case"code":i=t.code||void 0;break;case"message":o=t.message||"";break;default:n[l]=t[l]}}),Error.stackTraceLimit=s.stackLength+2,u=new Error().stack.split(`
51
51
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=a,this.stack=u.join(`
52
- `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var jO=v((Mye,LO)=>{"use strict";LO.exports=vs;vs.factory=NO();var CD=vs("CustomError");CD.order=vs(CD,{message:"Arguments out of order.",code:"EOARG"});function vs(t,e,r,n){var i,s;return e=eh(arguments,1,Error,$O,[vD,th]),r=eh(arguments,2,{},vD,[th]),n=eh(arguments,3,_D,th,[]),t=eh(arguments,0,e===Error?"Error":e.prototype.CustomError.name,iz,[$O,vD,th]),s=e===Error,s&&n===_D&&(n=vs.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(vs.factory).forEach(function(m){l[m]=function(y,E){vs.factory[m].call(u,y,E,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==_D&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function eh(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new CD.order;return o!==-1?t[o]:r}function th(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function iz(t){return typeof t=="string"}function $O(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function vD(t){return t&&typeof t=="object"}function _D(){}});var MO=v((qye,BO)=>{BO.exports=jO()});var zO=v((_s,Wo)=>{var sz=1/0,oz="[object Symbol]",zu={function:!0,object:!0},az=zu[typeof _s]&&_s&&!_s.nodeType?_s:void 0,uz=zu[typeof Wo]&&Wo&&!Wo.nodeType?Wo:void 0,cz=rh(az&&uz&&typeof global=="object"&&global),lz=rh(zu[typeof self]&&self),qO=rh(zu[typeof window]&&window),SD=rh(zu[typeof _s]&&_s),fz=cz||qO!==(SD&&SD.window)&&qO||lz||SD||Function("return this")();function rh(t){return t&&t.Object===Object?t:null}var hz=Object.prototype,dz=hz.toString,UO=fz.Symbol,HO=UO?UO.prototype:void 0,VO=HO?HO.toString:void 0;function pz(t){if(typeof t=="string")return t;if(gz(t))return VO?VO.call(t):"";var e=t+"";return e=="0"&&1/t==-sz?"-0":e}function mz(t){return!!t&&typeof t=="object"}function gz(t){return typeof t=="symbol"||mz(t)&&dz.call(t)==oz}Wo.exports=pz});var ZO=v((Cs,Xo)=>{var yz=zO(),Dz="Expected a function",GO="__lodash_hash_undefined__",wz="[object Function]",Ez="[object GeneratorFunction]",bz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,vz=/[\\^$.*+?()[\]{}|]/g,_z=/\\(\\)?/g,Cz=/^\[object .+?Constructor\]$/,Gu={function:!0,object:!0},Sz=Gu[typeof Cs]&&Cs&&!Cs.nodeType?Cs:void 0,Az=Gu[typeof Xo]&&Xo&&!Xo.nodeType?Xo:void 0,Oz=nh(Sz&&Az&&typeof global=="object"&&global),xz=nh(Gu[typeof self]&&self),KO=nh(Gu[typeof window]&&window),AD=nh(Gu[typeof Cs]&&Cs),Tz=Oz||KO!==(AD&&AD.window)&&KO||xz||AD||Function("return this")();function nh(t){return t&&t.Object===Object?t:null}function Iz(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var Fz=Array.prototype,WO=Object.prototype,XO=Function.prototype.toString,OD=WO.hasOwnProperty,Pz=WO.toString,Rz=RegExp("^"+XO.call(OD).replace(vz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kz=Fz.splice,Nz=YO(Tz,"Map"),Ku=YO(Object,"create");function Ss(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 $z(){this.__data__=Ku?Ku(null):{}}function Lz(t){return this.has(t)&&delete this.__data__[t]}function jz(t){var e=this.__data__;if(Ku){var r=e[t];return r===GO?void 0:r}return OD.call(e,t)?e[t]:void 0}function Bz(t){var e=this.__data__;return Ku?e[t]!==void 0:OD.call(e,t)}function Mz(t,e){var r=this.__data__;return r[t]=Ku&&e===void 0?GO:e,this}Ss.prototype.clear=$z;Ss.prototype.delete=Lz;Ss.prototype.get=jz;Ss.prototype.has=Bz;Ss.prototype.set=Mz;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 qz(){this.__data__=[]}function Uz(t){var e=this.__data__,r=ih(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kz.call(e,r,1),!0}function Hz(t){var e=this.__data__,r=ih(e,t);return r<0?void 0:e[r][1]}function Vz(t){return ih(this.__data__,t)>-1}function zz(t,e){var r=this.__data__,n=ih(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Yo.prototype.clear=qz;Yo.prototype.delete=Uz;Yo.prototype.get=Hz;Yo.prototype.has=Vz;Yo.prototype.set=zz;function As(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 Kz(){this.__data__={hash:new Ss,map:new(Nz||Yo),string:new Ss}}function Gz(t){return sh(this,t).delete(t)}function Wz(t){return sh(this,t).get(t)}function Xz(t){return sh(this,t).has(t)}function Yz(t,e){return sh(this,t).set(t,e),this}As.prototype.clear=Kz;As.prototype.delete=Gz;As.prototype.get=Wz;As.prototype.has=Xz;As.prototype.set=Yz;function ih(t,e){for(var r=t.length;r--;)if(eK(t[r][0],e))return r;return-1}function sh(t,e){var r=t.__data__;return Jz(e)?r[typeof e=="string"?"string":"hash"]:r.map}function YO(t,e){var r=t[e];return rK(r)?r:void 0}function Jz(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Zz=xD(function(t){var e=[];return nK(t).replace(bz,function(r,n,i,s){e.push(i?s.replace(_z,"$1"):n||r)}),e});function Qz(t){if(t!=null){try{return XO.call(t)}catch{}try{return t+""}catch{}}return""}function xD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Dz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(xD.Cache||As),r}xD.Cache=As;function eK(t,e){return t===e||t!==t&&e!==e}function tK(t){var e=JO(t)?Pz.call(t):"";return e==wz||e==Ez}function JO(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function rK(t){if(!JO(t))return!1;var e=tK(t)||Iz(t)?Rz:Cz;return e.test(Qz(t))}function nK(t){return t==null?"":yz(t)}Xo.exports=Zz});var xx=v((Os,Zo)=>{var iK=ZO(),sK=200,BD="__lodash_hash_undefined__",lh=1,Qo=2,oK=1/0,ix=9007199254740991,oh="[object Arguments]",FD="[object Array]",sx="[object Boolean]",ox="[object Date]",ax="[object Error]",ux="[object Function]",aK="[object GeneratorFunction]",Wu="[object Map]",cx="[object Number]",Jo="[object Object]",QO="[object Promise]",lx="[object RegExp]",Xu="[object Set]",MD="[object String]",fx="[object Symbol]",PD="[object WeakMap]",hx="[object ArrayBuffer]",ah="[object DataView]",uK="[object Float32Array]",cK="[object Float64Array]",lK="[object Int8Array]",fK="[object Int16Array]",hK="[object Int32Array]",dK="[object Uint8Array]",pK="[object Uint8ClampedArray]",mK="[object Uint16Array]",gK="[object Uint32Array]",yK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,DK=/^\w*$/,wK=/[\\^$.*+?()[\]{}|]/g,EK=/^\[object .+?Constructor\]$/,bK=/^(?:0|[1-9]\d*)$/,Ze={};Ze[uK]=Ze[cK]=Ze[lK]=Ze[fK]=Ze[hK]=Ze[dK]=Ze[pK]=Ze[mK]=Ze[gK]=!0;Ze[oh]=Ze[FD]=Ze[hx]=Ze[sx]=Ze[ah]=Ze[ox]=Ze[ax]=Ze[ux]=Ze[Wu]=Ze[cx]=Ze[Jo]=Ze[lx]=Ze[Xu]=Ze[MD]=Ze[PD]=!1;var Ju={function:!0,object:!0},vK=Ju[typeof Os]&&Os&&!Os.nodeType?Os:void 0,_K=Ju[typeof Zo]&&Zo&&!Zo.nodeType?Zo:void 0,CK=fh(vK&&_K&&typeof global=="object"&&global),SK=fh(Ju[typeof self]&&self),ex=fh(Ju[typeof window]&&window),TD=fh(Ju[typeof Os]&&Os),Is=CK||ex!==(TD&&TD.window)&&ex||SK||TD||Function("return this")();function AK(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function OK(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function xK(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function TK(t,e){return AK(e,function(r){return[r,t[r]]})}function fh(t){return t&&t.Object===Object?t:null}function RD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function dx(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function IK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function FK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var PK=Array.prototype,hh=Object.prototype,px=Function.prototype.toString,xs=hh.hasOwnProperty,Fs=hh.toString,RK=RegExp("^"+px.call(xs).replace(wK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tx=Is.Symbol,rx=Is.Uint8Array,kK=hh.propertyIsEnumerable,NK=PK.splice,$K=Object.getPrototypeOf,LK=Object.keys,kD=ea(Is,"DataView"),uh=ea(Is,"Map"),ND=ea(Is,"Promise"),$D=ea(Is,"Set"),LD=ea(Is,"WeakMap"),Yu=ea(Object,"create"),jK=Rs(kD),BK=Rs(uh),MK=Rs(ND),qK=Rs($D),UK=Rs(LD),nx=tx?tx.prototype:void 0,ID=nx?nx.valueOf:void 0;function Ts(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 HK(){this.__data__=Yu?Yu(null):{}}function VK(t){return this.has(t)&&delete this.__data__[t]}function zK(t){var e=this.__data__;if(Yu){var r=e[t];return r===BD?void 0:r}return xs.call(e,t)?e[t]:void 0}function KK(t){var e=this.__data__;return Yu?e[t]!==void 0:xs.call(e,t)}function GK(t,e){var r=this.__data__;return r[t]=Yu&&e===void 0?BD:e,this}Ts.prototype.clear=HK;Ts.prototype.delete=VK;Ts.prototype.get=zK;Ts.prototype.has=KK;Ts.prototype.set=GK;function Xn(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 WK(){this.__data__=[]}function XK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():NK.call(e,r,1),!0}function YK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function JK(t){return dh(this.__data__,t)>-1}function ZK(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Xn.prototype.clear=WK;Xn.prototype.delete=XK;Xn.prototype.get=YK;Xn.prototype.has=JK;Xn.prototype.set=ZK;function Ps(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 QK(){this.__data__={hash:new Ts,map:new(uh||Xn),string:new Ts}}function eG(t){return ph(this,t).delete(t)}function tG(t){return ph(this,t).get(t)}function rG(t){return ph(this,t).has(t)}function nG(t,e){return ph(this,t).set(t,e),this}Ps.prototype.clear=QK;Ps.prototype.delete=eG;Ps.prototype.get=tG;Ps.prototype.has=rG;Ps.prototype.set=nG;function ch(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ps;++e<r;)this.add(t[e])}function iG(t){return this.__data__.set(t,BD),this}function sG(t){return this.__data__.has(t)}ch.prototype.add=ch.prototype.push=iG;ch.prototype.has=sG;function Wn(t){this.__data__=new Xn(t)}function oG(){this.__data__=new Xn}function aG(t){return this.__data__.delete(t)}function uG(t){return this.__data__.get(t)}function cG(t){return this.__data__.has(t)}function lG(t,e){var r=this.__data__;return r instanceof Xn&&r.__data__.length==sK&&(r=this.__data__=new Ps(r.__data__)),r.set(t,e),this}Wn.prototype.clear=oG;Wn.prototype.delete=aG;Wn.prototype.get=uG;Wn.prototype.has=cG;Wn.prototype.set=lG;function dh(t,e){for(var r=t.length;r--;)if(TG(t[r][0],e))return r;return-1}function mx(t,e){e=mh(e,t)?[e]:Dx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[gh(e[r++])];return r&&r==n?t:void 0}function gx(t,e){return xs.call(t,e)||typeof t=="object"&&e in t&&CG(t)===null}function fG(t,e){return e in Object(t)}function qD(t,e,r,n,i){return t===e?!0:t==null||e==null||!Dh(t)&&!Zu(e)?t!==t&&e!==e:hG(t,e,qD,r,n,i)}function hG(t,e,r,n,i,s){var o=Ii(t),a=Ii(e),u=FD,c=FD;o||(u=Gn(t),u=u==oh?Jo:u),a||(c=Gn(e),c=c==oh?Jo:c);var l=u==Jo&&!RD(t),h=c==Jo&&!RD(e),d=u==c;if(d&&!l)return s||(s=new Wn),o||PG(t)?wx(t,e,r,n,i,s):EG(t,e,u,r,n,i,s);if(!(i&Qo)){var f=l&&xs.call(t,"__wrapped__"),m=h&&xs.call(e,"__wrapped__");if(f||m){var y=f?t.value():t,E=m?e.value():e;return s||(s=new Wn),r(y,E,n,i,s)}}return d?(s||(s=new Wn),bG(t,e,r,n,i,s)):!1}function dG(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new Wn;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?qD(l,c,n,lh|Qo,h):d))return!1}}return!0}function pG(t){return typeof t=="function"?t:t==null?$G:typeof t=="object"?Ii(t)?yG(t[0],t[1]):gG(t):LG(t)}function mG(t){return LK(Object(t))}function gG(t){var e=_G(t);return e.length==1&&e[0][2]?vx(e[0][0],e[0][1]):function(r){return r===t||dG(r,t,e)}}function yG(t,e){return mh(t)&&bx(e)?vx(gh(t),e):function(r){var n=RG(r,t);return n===void 0&&n===e?kG(r,t):qD(e,n,void 0,lh|Qo)}}function yx(t){return function(e){return e?.[t]}}function DG(t){return function(e){return mx(e,t)}}function Dx(t){return Ii(t)?t:iK(t)}function wG(t){return function(e){var r=Gn(e);return r==Wu?dx(e):r==Xu?FK(e):TK(e,t(e))}}function wx(t,e,r,n,i,s){var o=i&Qo,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&lh?new ch:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var y=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(d){if(!OK(e,function(E,C){if(!d.has(C)&&(f===E||r(f,E,n,i,s)))return d.add(C)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function EG(t,e,r,n,i,s,o){switch(r){case ah:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hx:return!(t.byteLength!=e.byteLength||!n(new rx(t),new rx(e)));case sx:case ox:return+t==+e;case ax:return t.name==e.name&&t.message==e.message;case cx:return t!=+t?e!=+e:t==+e;case lx:case MD:return t==e+"";case Wu:var a=dx;case Xu:var u=s&Qo;if(a||(a=IK),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=lh,o.set(t,e),wx(a(t),a(e),n,i,s,o));case fx:if(ID)return ID.call(t)==ID.call(e)}return!1}function bG(t,e,r,n,i,s){var o=i&Qo,a=jD(t),u=a.length,c=jD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:gx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var y=o;++h<u;){d=a[h];var E=t[d],C=e[d];if(n)var A=o?n(C,E,d,e,t,s):n(E,C,d,t,e,s);if(!(A===void 0?E===C||r(E,C,n,i,s):A)){m=!1;break}y||(y=d=="constructor")}if(m&&!y){var p=t.constructor,D=e.constructor;p!=D&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof D=="function"&&D instanceof D)&&(m=!1)}return s.delete(t),m}var vG=yx("length");function ph(t,e){var r=t.__data__;return OG(e)?r[typeof e=="string"?"string":"hash"]:r.map}function _G(t){for(var e=NG(t),r=e.length;r--;)e[r][2]=bx(e[r][1]);return e}function ea(t,e){var r=t[e];return FG(r)?r:void 0}function CG(t){return $K(Object(t))}function Gn(t){return Fs.call(t)}(kD&&Gn(new kD(new ArrayBuffer(1)))!=ah||uh&&Gn(new uh)!=Wu||ND&&Gn(ND.resolve())!=QO||$D&&Gn(new $D)!=Xu||LD&&Gn(new LD)!=PD)&&(Gn=function(t){var e=Fs.call(t),r=e==Jo?t.constructor:void 0,n=r?Rs(r):void 0;if(n)switch(n){case jK:return ah;case BK:return Wu;case MK:return QO;case qK:return Xu;case UK:return PD}return e});function SG(t,e,r){e=mh(e,t)?[e]:Dx(e);for(var n,i=-1,o=e.length;++i<o;){var s=gh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&yh(o)&&Ex(s,o)&&(Ii(t)||Ax(t)||_x(t))}function AG(t){var e=t?t.length:void 0;return yh(e)&&(Ii(t)||Ax(t)||_x(t))?xK(e,String):null}function Ex(t,e){return e=e??ix,!!e&&(typeof t=="number"||bK.test(t))&&t>-1&&t%1==0&&t<e}function mh(t,e){if(Ii(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ox(t)?!0:DK.test(t)||!yK.test(t)||e!=null&&t in Object(e)}function OG(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function xG(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||hh;return t===r}function bx(t){return t===t&&!Dh(t)}function vx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function gh(t){if(typeof t=="string"||Ox(t))return t;var e=t+"";return e=="0"&&1/t==-oK?"-0":e}function Rs(t){if(t!=null){try{return px.call(t)}catch{}try{return t+""}catch{}}return""}function TG(t,e){return t===e||t!==t&&e!==e}function _x(t){return IG(t)&&xs.call(t,"callee")&&(!kK.call(t,"callee")||Fs.call(t)==oh)}var Ii=Array.isArray;function Cx(t){return t!=null&&yh(vG(t))&&!Sx(t)}function IG(t){return Zu(t)&&Cx(t)}function Sx(t){var e=Dh(t)?Fs.call(t):"";return e==ux||e==aK}function yh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ix}function Dh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Zu(t){return!!t&&typeof t=="object"}function FG(t){if(!Dh(t))return!1;var e=Sx(t)||RD(t)?RK:EK;return e.test(Rs(t))}function Ax(t){return typeof t=="string"||!Ii(t)&&Zu(t)&&Fs.call(t)==MD}function Ox(t){return typeof t=="symbol"||Zu(t)&&Fs.call(t)==fx}function PG(t){return Zu(t)&&yh(t.length)&&!!Ze[Fs.call(t)]}function RG(t,e,r){var n=t==null?void 0:mx(t,e);return n===void 0?r:n}function kG(t,e){return t!=null&&SG(t,e,fG)}function jD(t){var e=xG(t);if(!(e||Cx(t)))return mG(t);var r=AG(t),n=!!r,i=r||[],s=i.length;for(var o in t)gx(t,o)&&!(n&&(o=="length"||Ex(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var NG=wG(jD);function $G(t){return t}function LG(t){return mh(t)?yx(gh(t)):DG(t)}Zo.exports=pG});var Rx=v((ks,ta)=>{var jG=1/0,BG="[object Function]",MG="[object GeneratorFunction]",qG=/[\\^$.*+?()[\]{}|]/g,UG=/^\[object .+?Constructor\]$/,Qu={function:!0,object:!0},HG=Qu[typeof ks]&&ks&&!ks.nodeType?ks:void 0,VG=Qu[typeof ta]&&ta&&!ta.nodeType?ta:void 0,zG=wh(HG&&VG&&typeof global=="object"&&global),KG=wh(Qu[typeof self]&&self),Tx=wh(Qu[typeof window]&&window),UD=wh(Qu[typeof ks]&&ks),GG=zG||Tx!==(UD&&UD.window)&&Tx||KG||UD||Function("return this")();function wh(t){return t&&t.Object===Object?t:null}function WG(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function XG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Ix=Object.prototype,Fx=Function.prototype.toString,YG=Ix.hasOwnProperty,JG=Ix.toString,ZG=RegExp("^"+Fx.call(YG).replace(qG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),HD=eW(GG,"Set"),QG=HD&&1/XG(new HD([,-0]))[1]==jG?function(t){return new HD(t)}:iW;function eW(t,e){var r=t[e];return nW(r)?r:void 0}function tW(t){if(t!=null){try{return Fx.call(t)}catch{}try{return t+""}catch{}}return""}function rW(t){var e=Px(t)?JG.call(t):"";return e==BG||e==MG}function Px(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function nW(t){if(!Px(t))return!1;var e=rW(t)||WG(t)?ZG:UG;return e.test(tW(t))}function iW(){}ta.exports=QG});var Nx=v((Ns,ra)=>{var ec={function:!0,object:!0},sW=ec[typeof Ns]&&Ns&&!Ns.nodeType?Ns:void 0,oW=ec[typeof ra]&&ra&&!ra.nodeType?ra:void 0,aW=Eh(sW&&oW&&typeof global=="object"&&global),uW=Eh(ec[typeof self]&&self),kx=Eh(ec[typeof window]&&window),VD=Eh(ec[typeof Ns]&&Ns),cW=aW||kx!==(VD&&VD.window)&&kx||uW||VD||Function("return this")();function Eh(t){return t&&t.Object===Object?t:null}ra.exports=cW});var qx=v((Uye,Mx)=>{var lW=Rx(),fW=Nx(),hW=200,zD="__lodash_hash_undefined__",dW="[object Function]",pW="[object GeneratorFunction]",mW=/[\\^$.*+?()[\]{}|]/g,gW=/^\[object .+?Constructor\]$/;function yW(t,e){return!!t.length&&wW(t,e,0)>-1}function DW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function wW(t,e,r){if(e!==e)return bW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function EW(t,e){return t.has(e)}function bW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function vW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function _W(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var CW=Array.prototype,$x=Object.prototype,Lx=Function.prototype.toString,KD=$x.hasOwnProperty,SW=$x.toString,AW=RegExp("^"+Lx.call(KD).replace(mW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),OW=CW.splice,xW=jx(fW,"Map"),tc=jx(Object,"create");function $s(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 TW(){this.__data__=tc?tc(null):{}}function IW(t){return this.has(t)&&delete this.__data__[t]}function FW(t){var e=this.__data__;if(tc){var r=e[t];return r===zD?void 0:r}return KD.call(e,t)?e[t]:void 0}function PW(t){var e=this.__data__;return tc?e[t]!==void 0:KD.call(e,t)}function RW(t,e){var r=this.__data__;return r[t]=tc&&e===void 0?zD:e,this}$s.prototype.clear=TW;$s.prototype.delete=IW;$s.prototype.get=FW;$s.prototype.has=PW;$s.prototype.set=RW;function na(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 kW(){this.__data__=[]}function NW(t){var e=this.__data__,r=vh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():OW.call(e,r,1),!0}function $W(t){var e=this.__data__,r=vh(e,t);return r<0?void 0:e[r][1]}function LW(t){return vh(this.__data__,t)>-1}function jW(t,e){var r=this.__data__,n=vh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}na.prototype.clear=kW;na.prototype.delete=NW;na.prototype.get=$W;na.prototype.has=LW;na.prototype.set=jW;function ia(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 BW(){this.__data__={hash:new $s,map:new(xW||na),string:new $s}}function MW(t){return _h(this,t).delete(t)}function qW(t){return _h(this,t).get(t)}function UW(t){return _h(this,t).has(t)}function HW(t,e){return _h(this,t).set(t,e),this}ia.prototype.clear=BW;ia.prototype.delete=MW;ia.prototype.get=qW;ia.prototype.has=UW;ia.prototype.set=HW;function bh(t){var e=-1,r=t?t.length:0;for(this.__data__=new ia;++e<r;)this.add(t[e])}function VW(t){return this.__data__.set(t,zD),this}function zW(t){return this.__data__.has(t)}bh.prototype.add=bh.prototype.push=VW;bh.prototype.has=zW;function vh(t,e){for(var r=t.length;r--;)if(XW(t[r][0],e))return r;return-1}function KW(t,e,r){var n=-1,i=yW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=DW;else if(s>=hW){var c=e?null:lW(t);if(c)return _W(c);o=!1,i=EW,u=new bh}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function _h(t,e){var r=t.__data__;return GW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function jx(t,e){var r=t[e];return JW(r)?r:void 0}function GW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function WW(t){if(t!=null){try{return Lx.call(t)}catch{}try{return t+""}catch{}}return""}function XW(t,e){return t===e||t!==t&&e!==e}function YW(t){var e=Bx(t)?SW.call(t):"";return e==dW||e==pW}function Bx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function JW(t){if(!Bx(t))return!1;var e=YW(t)||vW(t)?AW:gW;return e.test(WW(t))}Mx.exports=KW});var Hx=v((Hye,Ux)=>{var ZW=xx(),QW=qx();function eX(t,e){return t&&t.length?QW(t,ZW(e)):[]}Ux.exports=eX});var zx=v((Vye,Vx)=>{"use strict";var tX=MO(),rX=Hx(),nX=tX("MultiError");Vx.exports=GD;function GD(t){if(!(this instanceof GD))return new GD(t);if(t=Array.isArray(t)?t:[t],t=rX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new nX({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(`
52
+ `),Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,get:function(){return i},set:function(l){i=l,c()}}),Object.defineProperty(this,"message",{configurable:!0,enumerable:!0,get:function(){return o},set:function(l){o=l,c()}}),c())}});var jO=v((Mye,LO)=>{"use strict";LO.exports=vs;vs.factory=NO();var CD=vs("CustomError");CD.order=vs(CD,{message:"Arguments out of order.",code:"EOARG"});function vs(t,e,r,n){var i,s;return e=eh(arguments,1,Error,$O,[vD,th]),r=eh(arguments,2,{},vD,[th]),n=eh(arguments,3,_D,th,[]),t=eh(arguments,0,e===Error?"Error":e.prototype.CustomError.name,iz,[$O,vD,th]),s=e===Error,s&&n===_D&&(n=vs.factory.root),i=function(o,a){var u,c,l,h,d,f;if(!(this instanceof i))return new i(o,a);for(delete this.constructor.name,Object.defineProperty(this.constructor,"name",{enumerable:!1,configurable:!0,value:t,writable:!1}),typeof o=="string"&&(o={message:o}),o||(o={}),c=this.CustomError.chain.slice(0).reverse().map(function(m){return m.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(vs.factory).forEach(function(m){l[m]=function(y,E){vs.factory[m].call(u,y,E,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==_D&&d.factory.call(this,f,a,l)},i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.name=t,i.prototype.CustomError={chain:s?[]:e.prototype.CustomError.chain.slice(0),factory:n,name:t,parent:e,properties:r},i.prototype.CustomError.chain.unshift(i.prototype.CustomError),i.prototype.toString=function(){var o=this.CustomError.chain[this.CustomError.chain.length-1].name;return this.code&&(o+=" "+this.code),this.message&&(o+=": "+this.message),o},i}function eh(t,e,r,n,i){var s=-1,o=-1,a,u,c=e<t.length?e:t.length,l;for(a=0;a<=c;a++){if(l=t[a],s===-1)for(u=0;u<i.length;u++)i[u](l)&&(s=a);o===-1&&n(l)&&(o=a)}if(o!==-1&&s!==-1&&s<o)throw new CD.order;return o!==-1?t[o]:r}function th(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function iz(t){return typeof t=="string"}function $O(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function vD(t){return t&&typeof t=="object"}function _D(){}});var MO=v((qye,BO)=>{BO.exports=jO()});var zO=v((_s,Wo)=>{var sz=1/0,oz="[object Symbol]",zu={function:!0,object:!0},az=zu[typeof _s]&&_s&&!_s.nodeType?_s:void 0,uz=zu[typeof Wo]&&Wo&&!Wo.nodeType?Wo:void 0,cz=rh(az&&uz&&typeof global=="object"&&global),lz=rh(zu[typeof self]&&self),qO=rh(zu[typeof window]&&window),SD=rh(zu[typeof _s]&&_s),fz=cz||qO!==(SD&&SD.window)&&qO||lz||SD||Function("return this")();function rh(t){return t&&t.Object===Object?t:null}var hz=Object.prototype,dz=hz.toString,UO=fz.Symbol,HO=UO?UO.prototype:void 0,VO=HO?HO.toString:void 0;function pz(t){if(typeof t=="string")return t;if(gz(t))return VO?VO.call(t):"";var e=t+"";return e=="0"&&1/t==-sz?"-0":e}function mz(t){return!!t&&typeof t=="object"}function gz(t){return typeof t=="symbol"||mz(t)&&dz.call(t)==oz}Wo.exports=pz});var ZO=v((Cs,Xo)=>{var yz=zO(),Dz="Expected a function",GO="__lodash_hash_undefined__",wz="[object Function]",Ez="[object GeneratorFunction]",bz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,vz=/[\\^$.*+?()[\]{}|]/g,_z=/\\(\\)?/g,Cz=/^\[object .+?Constructor\]$/,Gu={function:!0,object:!0},Sz=Gu[typeof Cs]&&Cs&&!Cs.nodeType?Cs:void 0,Az=Gu[typeof Xo]&&Xo&&!Xo.nodeType?Xo:void 0,Oz=nh(Sz&&Az&&typeof global=="object"&&global),xz=nh(Gu[typeof self]&&self),KO=nh(Gu[typeof window]&&window),AD=nh(Gu[typeof Cs]&&Cs),Tz=Oz||KO!==(AD&&AD.window)&&KO||xz||AD||Function("return this")();function nh(t){return t&&t.Object===Object?t:null}function Iz(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var Fz=Array.prototype,WO=Object.prototype,XO=Function.prototype.toString,OD=WO.hasOwnProperty,Pz=WO.toString,Rz=RegExp("^"+XO.call(OD).replace(vz,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),kz=Fz.splice,Nz=YO(Tz,"Map"),Ku=YO(Object,"create");function Ss(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 $z(){this.__data__=Ku?Ku(null):{}}function Lz(t){return this.has(t)&&delete this.__data__[t]}function jz(t){var e=this.__data__;if(Ku){var r=e[t];return r===GO?void 0:r}return OD.call(e,t)?e[t]:void 0}function Bz(t){var e=this.__data__;return Ku?e[t]!==void 0:OD.call(e,t)}function Mz(t,e){var r=this.__data__;return r[t]=Ku&&e===void 0?GO:e,this}Ss.prototype.clear=$z;Ss.prototype.delete=Lz;Ss.prototype.get=jz;Ss.prototype.has=Bz;Ss.prototype.set=Mz;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 qz(){this.__data__=[]}function Uz(t){var e=this.__data__,r=ih(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():kz.call(e,r,1),!0}function Hz(t){var e=this.__data__,r=ih(e,t);return r<0?void 0:e[r][1]}function Vz(t){return ih(this.__data__,t)>-1}function zz(t,e){var r=this.__data__,n=ih(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Yo.prototype.clear=qz;Yo.prototype.delete=Uz;Yo.prototype.get=Hz;Yo.prototype.has=Vz;Yo.prototype.set=zz;function As(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 Kz(){this.__data__={hash:new Ss,map:new(Nz||Yo),string:new Ss}}function Gz(t){return sh(this,t).delete(t)}function Wz(t){return sh(this,t).get(t)}function Xz(t){return sh(this,t).has(t)}function Yz(t,e){return sh(this,t).set(t,e),this}As.prototype.clear=Kz;As.prototype.delete=Gz;As.prototype.get=Wz;As.prototype.has=Xz;As.prototype.set=Yz;function ih(t,e){for(var r=t.length;r--;)if(eK(t[r][0],e))return r;return-1}function sh(t,e){var r=t.__data__;return Jz(e)?r[typeof e=="string"?"string":"hash"]:r.map}function YO(t,e){var r=t[e];return rK(r)?r:void 0}function Jz(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Zz=xD(function(t){var e=[];return nK(t).replace(bz,function(r,n,i,s){e.push(i?s.replace(_z,"$1"):n||r)}),e});function Qz(t){if(t!=null){try{return XO.call(t)}catch{}try{return t+""}catch{}}return""}function xD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Dz);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new(xD.Cache||As),r}xD.Cache=As;function eK(t,e){return t===e||t!==t&&e!==e}function tK(t){var e=JO(t)?Pz.call(t):"";return e==wz||e==Ez}function JO(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function rK(t){if(!JO(t))return!1;var e=tK(t)||Iz(t)?Rz:Cz;return e.test(Qz(t))}function nK(t){return t==null?"":yz(t)}Xo.exports=Zz});var xx=v((Os,Zo)=>{var iK=ZO(),sK=200,BD="__lodash_hash_undefined__",lh=1,Qo=2,oK=1/0,ix=9007199254740991,oh="[object Arguments]",FD="[object Array]",sx="[object Boolean]",ox="[object Date]",ax="[object Error]",ux="[object Function]",aK="[object GeneratorFunction]",Wu="[object Map]",cx="[object Number]",Jo="[object Object]",QO="[object Promise]",lx="[object RegExp]",Xu="[object Set]",MD="[object String]",fx="[object Symbol]",PD="[object WeakMap]",hx="[object ArrayBuffer]",ah="[object DataView]",uK="[object Float32Array]",cK="[object Float64Array]",lK="[object Int8Array]",fK="[object Int16Array]",hK="[object Int32Array]",dK="[object Uint8Array]",pK="[object Uint8ClampedArray]",mK="[object Uint16Array]",gK="[object Uint32Array]",yK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,DK=/^\w*$/,wK=/[\\^$.*+?()[\]{}|]/g,EK=/^\[object .+?Constructor\]$/,bK=/^(?:0|[1-9]\d*)$/,Ze={};Ze[uK]=Ze[cK]=Ze[lK]=Ze[fK]=Ze[hK]=Ze[dK]=Ze[pK]=Ze[mK]=Ze[gK]=!0;Ze[oh]=Ze[FD]=Ze[hx]=Ze[sx]=Ze[ah]=Ze[ox]=Ze[ax]=Ze[ux]=Ze[Wu]=Ze[cx]=Ze[Jo]=Ze[lx]=Ze[Xu]=Ze[MD]=Ze[PD]=!1;var Ju={function:!0,object:!0},vK=Ju[typeof Os]&&Os&&!Os.nodeType?Os:void 0,_K=Ju[typeof Zo]&&Zo&&!Zo.nodeType?Zo:void 0,CK=fh(vK&&_K&&typeof global=="object"&&global),SK=fh(Ju[typeof self]&&self),ex=fh(Ju[typeof window]&&window),TD=fh(Ju[typeof Os]&&Os),Is=CK||ex!==(TD&&TD.window)&&ex||SK||TD||Function("return this")();function AK(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function OK(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function xK(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function TK(t,e){return AK(e,function(r){return[r,t[r]]})}function fh(t){return t&&t.Object===Object?t:null}function RD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function dx(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function IK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function FK(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var PK=Array.prototype,hh=Object.prototype,px=Function.prototype.toString,xs=hh.hasOwnProperty,Fs=hh.toString,RK=RegExp("^"+px.call(xs).replace(wK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),tx=Is.Symbol,rx=Is.Uint8Array,kK=hh.propertyIsEnumerable,NK=PK.splice,$K=Object.getPrototypeOf,LK=Object.keys,kD=ea(Is,"DataView"),uh=ea(Is,"Map"),ND=ea(Is,"Promise"),$D=ea(Is,"Set"),LD=ea(Is,"WeakMap"),Yu=ea(Object,"create"),jK=Rs(kD),BK=Rs(uh),MK=Rs(ND),qK=Rs($D),UK=Rs(LD),nx=tx?tx.prototype:void 0,ID=nx?nx.valueOf:void 0;function Ts(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 HK(){this.__data__=Yu?Yu(null):{}}function VK(t){return this.has(t)&&delete this.__data__[t]}function zK(t){var e=this.__data__;if(Yu){var r=e[t];return r===BD?void 0:r}return xs.call(e,t)?e[t]:void 0}function KK(t){var e=this.__data__;return Yu?e[t]!==void 0:xs.call(e,t)}function GK(t,e){var r=this.__data__;return r[t]=Yu&&e===void 0?BD:e,this}Ts.prototype.clear=HK;Ts.prototype.delete=VK;Ts.prototype.get=zK;Ts.prototype.has=KK;Ts.prototype.set=GK;function Xn(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 WK(){this.__data__=[]}function XK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():NK.call(e,r,1),!0}function YK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function JK(t){return dh(this.__data__,t)>-1}function ZK(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}Xn.prototype.clear=WK;Xn.prototype.delete=XK;Xn.prototype.get=YK;Xn.prototype.has=JK;Xn.prototype.set=ZK;function Ps(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 QK(){this.__data__={hash:new Ts,map:new(uh||Xn),string:new Ts}}function eG(t){return ph(this,t).delete(t)}function tG(t){return ph(this,t).get(t)}function rG(t){return ph(this,t).has(t)}function nG(t,e){return ph(this,t).set(t,e),this}Ps.prototype.clear=QK;Ps.prototype.delete=eG;Ps.prototype.get=tG;Ps.prototype.has=rG;Ps.prototype.set=nG;function ch(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ps;++e<r;)this.add(t[e])}function iG(t){return this.__data__.set(t,BD),this}function sG(t){return this.__data__.has(t)}ch.prototype.add=ch.prototype.push=iG;ch.prototype.has=sG;function Wn(t){this.__data__=new Xn(t)}function oG(){this.__data__=new Xn}function aG(t){return this.__data__.delete(t)}function uG(t){return this.__data__.get(t)}function cG(t){return this.__data__.has(t)}function lG(t,e){var r=this.__data__;return r instanceof Xn&&r.__data__.length==sK&&(r=this.__data__=new Ps(r.__data__)),r.set(t,e),this}Wn.prototype.clear=oG;Wn.prototype.delete=aG;Wn.prototype.get=uG;Wn.prototype.has=cG;Wn.prototype.set=lG;function dh(t,e){for(var r=t.length;r--;)if(TG(t[r][0],e))return r;return-1}function mx(t,e){e=mh(e,t)?[e]:Dx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[gh(e[r++])];return r&&r==n?t:void 0}function gx(t,e){return xs.call(t,e)||typeof t=="object"&&e in t&&CG(t)===null}function fG(t,e){return e in Object(t)}function qD(t,e,r,n,i){return t===e?!0:t==null||e==null||!Dh(t)&&!Zu(e)?t!==t&&e!==e:hG(t,e,qD,r,n,i)}function hG(t,e,r,n,i,s){var o=Ii(t),a=Ii(e),u=FD,c=FD;o||(u=Gn(t),u=u==oh?Jo:u),a||(c=Gn(e),c=c==oh?Jo:c);var l=u==Jo&&!RD(t),h=c==Jo&&!RD(e),d=u==c;if(d&&!l)return s||(s=new Wn),o||PG(t)?wx(t,e,r,n,i,s):EG(t,e,u,r,n,i,s);if(!(i&Qo)){var f=l&&xs.call(t,"__wrapped__"),m=h&&xs.call(e,"__wrapped__");if(f||m){var y=f?t.value():t,E=m?e.value():e;return s||(s=new Wn),r(y,E,n,i,s)}}return d?(s||(s=new Wn),bG(t,e,r,n,i,s)):!1}function dG(t,e,r,n){var i=r.length,s=i,o=!n;if(t==null)return!s;for(t=Object(t);i--;){var a=r[i];if(o&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++i<s;){a=r[i];var u=a[0],c=t[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in t))return!1}else{var h=new Wn;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?qD(l,c,n,lh|Qo,h):d))return!1}}return!0}function pG(t){return typeof t=="function"?t:t==null?$G:typeof t=="object"?Ii(t)?yG(t[0],t[1]):gG(t):LG(t)}function mG(t){return LK(Object(t))}function gG(t){var e=_G(t);return e.length==1&&e[0][2]?vx(e[0][0],e[0][1]):function(r){return r===t||dG(r,t,e)}}function yG(t,e){return mh(t)&&bx(e)?vx(gh(t),e):function(r){var n=RG(r,t);return n===void 0&&n===e?kG(r,t):qD(e,n,void 0,lh|Qo)}}function yx(t){return function(e){return e?.[t]}}function DG(t){return function(e){return mx(e,t)}}function Dx(t){return Ii(t)?t:iK(t)}function wG(t){return function(e){var r=Gn(e);return r==Wu?dx(e):r==Xu?FK(e):TK(e,t(e))}}function wx(t,e,r,n,i,s){var o=i&Qo,a=t.length,u=e.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(t);if(c)return c==e;var l=-1,h=!0,d=i&lh?new ch:void 0;for(s.set(t,e);++l<a;){var f=t[l],m=e[l];if(n)var y=o?n(m,f,l,e,t,s):n(f,m,l,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(d){if(!OK(e,function(E,S){if(!d.has(S)&&(f===E||r(f,E,n,i,s)))return d.add(S)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function EG(t,e,r,n,i,s,o){switch(r){case ah:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case hx:return!(t.byteLength!=e.byteLength||!n(new rx(t),new rx(e)));case sx:case ox:return+t==+e;case ax:return t.name==e.name&&t.message==e.message;case cx:return t!=+t?e!=+e:t==+e;case lx:case MD:return t==e+"";case Wu:var a=dx;case Xu:var u=s&Qo;if(a||(a=IK),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=lh,o.set(t,e),wx(a(t),a(e),n,i,s,o));case fx:if(ID)return ID.call(t)==ID.call(e)}return!1}function bG(t,e,r,n,i,s){var o=i&Qo,a=jD(t),u=a.length,c=jD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:gx(e,d)))return!1}var f=s.get(t);if(f)return f==e;var m=!0;s.set(t,e);for(var y=o;++h<u;){d=a[h];var E=t[d],S=e[d];if(n)var A=o?n(S,E,d,e,t,s):n(E,S,d,t,e,s);if(!(A===void 0?E===S||r(E,S,n,i,s):A)){m=!1;break}y||(y=d=="constructor")}if(m&&!y){var p=t.constructor,D=e.constructor;p!=D&&"constructor"in t&&"constructor"in e&&!(typeof p=="function"&&p instanceof p&&typeof D=="function"&&D instanceof D)&&(m=!1)}return s.delete(t),m}var vG=yx("length");function ph(t,e){var r=t.__data__;return OG(e)?r[typeof e=="string"?"string":"hash"]:r.map}function _G(t){for(var e=NG(t),r=e.length;r--;)e[r][2]=bx(e[r][1]);return e}function ea(t,e){var r=t[e];return FG(r)?r:void 0}function CG(t){return $K(Object(t))}function Gn(t){return Fs.call(t)}(kD&&Gn(new kD(new ArrayBuffer(1)))!=ah||uh&&Gn(new uh)!=Wu||ND&&Gn(ND.resolve())!=QO||$D&&Gn(new $D)!=Xu||LD&&Gn(new LD)!=PD)&&(Gn=function(t){var e=Fs.call(t),r=e==Jo?t.constructor:void 0,n=r?Rs(r):void 0;if(n)switch(n){case jK:return ah;case BK:return Wu;case MK:return QO;case qK:return Xu;case UK:return PD}return e});function SG(t,e,r){e=mh(e,t)?[e]:Dx(e);for(var n,i=-1,o=e.length;++i<o;){var s=gh(e[i]);if(!(n=t!=null&&r(t,s)))break;t=t[s]}if(n)return n;var o=t?t.length:0;return!!o&&yh(o)&&Ex(s,o)&&(Ii(t)||Ax(t)||_x(t))}function AG(t){var e=t?t.length:void 0;return yh(e)&&(Ii(t)||Ax(t)||_x(t))?xK(e,String):null}function Ex(t,e){return e=e??ix,!!e&&(typeof t=="number"||bK.test(t))&&t>-1&&t%1==0&&t<e}function mh(t,e){if(Ii(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ox(t)?!0:DK.test(t)||!yK.test(t)||e!=null&&t in Object(e)}function OG(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function xG(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||hh;return t===r}function bx(t){return t===t&&!Dh(t)}function vx(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function gh(t){if(typeof t=="string"||Ox(t))return t;var e=t+"";return e=="0"&&1/t==-oK?"-0":e}function Rs(t){if(t!=null){try{return px.call(t)}catch{}try{return t+""}catch{}}return""}function TG(t,e){return t===e||t!==t&&e!==e}function _x(t){return IG(t)&&xs.call(t,"callee")&&(!kK.call(t,"callee")||Fs.call(t)==oh)}var Ii=Array.isArray;function Cx(t){return t!=null&&yh(vG(t))&&!Sx(t)}function IG(t){return Zu(t)&&Cx(t)}function Sx(t){var e=Dh(t)?Fs.call(t):"";return e==ux||e==aK}function yh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=ix}function Dh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function Zu(t){return!!t&&typeof t=="object"}function FG(t){if(!Dh(t))return!1;var e=Sx(t)||RD(t)?RK:EK;return e.test(Rs(t))}function Ax(t){return typeof t=="string"||!Ii(t)&&Zu(t)&&Fs.call(t)==MD}function Ox(t){return typeof t=="symbol"||Zu(t)&&Fs.call(t)==fx}function PG(t){return Zu(t)&&yh(t.length)&&!!Ze[Fs.call(t)]}function RG(t,e,r){var n=t==null?void 0:mx(t,e);return n===void 0?r:n}function kG(t,e){return t!=null&&SG(t,e,fG)}function jD(t){var e=xG(t);if(!(e||Cx(t)))return mG(t);var r=AG(t),n=!!r,i=r||[],s=i.length;for(var o in t)gx(t,o)&&!(n&&(o=="length"||Ex(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var NG=wG(jD);function $G(t){return t}function LG(t){return mh(t)?yx(gh(t)):DG(t)}Zo.exports=pG});var Rx=v((ks,ta)=>{var jG=1/0,BG="[object Function]",MG="[object GeneratorFunction]",qG=/[\\^$.*+?()[\]{}|]/g,UG=/^\[object .+?Constructor\]$/,Qu={function:!0,object:!0},HG=Qu[typeof ks]&&ks&&!ks.nodeType?ks:void 0,VG=Qu[typeof ta]&&ta&&!ta.nodeType?ta:void 0,zG=wh(HG&&VG&&typeof global=="object"&&global),KG=wh(Qu[typeof self]&&self),Tx=wh(Qu[typeof window]&&window),UD=wh(Qu[typeof ks]&&ks),GG=zG||Tx!==(UD&&UD.window)&&Tx||KG||UD||Function("return this")();function wh(t){return t&&t.Object===Object?t:null}function WG(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function XG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Ix=Object.prototype,Fx=Function.prototype.toString,YG=Ix.hasOwnProperty,JG=Ix.toString,ZG=RegExp("^"+Fx.call(YG).replace(qG,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),HD=eW(GG,"Set"),QG=HD&&1/XG(new HD([,-0]))[1]==jG?function(t){return new HD(t)}:iW;function eW(t,e){var r=t[e];return nW(r)?r:void 0}function tW(t){if(t!=null){try{return Fx.call(t)}catch{}try{return t+""}catch{}}return""}function rW(t){var e=Px(t)?JG.call(t):"";return e==BG||e==MG}function Px(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function nW(t){if(!Px(t))return!1;var e=rW(t)||WG(t)?ZG:UG;return e.test(tW(t))}function iW(){}ta.exports=QG});var Nx=v((Ns,ra)=>{var ec={function:!0,object:!0},sW=ec[typeof Ns]&&Ns&&!Ns.nodeType?Ns:void 0,oW=ec[typeof ra]&&ra&&!ra.nodeType?ra:void 0,aW=Eh(sW&&oW&&typeof global=="object"&&global),uW=Eh(ec[typeof self]&&self),kx=Eh(ec[typeof window]&&window),VD=Eh(ec[typeof Ns]&&Ns),cW=aW||kx!==(VD&&VD.window)&&kx||uW||VD||Function("return this")();function Eh(t){return t&&t.Object===Object?t:null}ra.exports=cW});var qx=v((Uye,Mx)=>{var lW=Rx(),fW=Nx(),hW=200,zD="__lodash_hash_undefined__",dW="[object Function]",pW="[object GeneratorFunction]",mW=/[\\^$.*+?()[\]{}|]/g,gW=/^\[object .+?Constructor\]$/;function yW(t,e){return!!t.length&&wW(t,e,0)>-1}function DW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function wW(t,e,r){if(e!==e)return bW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function EW(t,e){return t.has(e)}function bW(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i<n;){var s=t[i];if(s!==s)return i}return-1}function vW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function _W(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var CW=Array.prototype,$x=Object.prototype,Lx=Function.prototype.toString,KD=$x.hasOwnProperty,SW=$x.toString,AW=RegExp("^"+Lx.call(KD).replace(mW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),OW=CW.splice,xW=jx(fW,"Map"),tc=jx(Object,"create");function $s(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 TW(){this.__data__=tc?tc(null):{}}function IW(t){return this.has(t)&&delete this.__data__[t]}function FW(t){var e=this.__data__;if(tc){var r=e[t];return r===zD?void 0:r}return KD.call(e,t)?e[t]:void 0}function PW(t){var e=this.__data__;return tc?e[t]!==void 0:KD.call(e,t)}function RW(t,e){var r=this.__data__;return r[t]=tc&&e===void 0?zD:e,this}$s.prototype.clear=TW;$s.prototype.delete=IW;$s.prototype.get=FW;$s.prototype.has=PW;$s.prototype.set=RW;function na(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 kW(){this.__data__=[]}function NW(t){var e=this.__data__,r=vh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():OW.call(e,r,1),!0}function $W(t){var e=this.__data__,r=vh(e,t);return r<0?void 0:e[r][1]}function LW(t){return vh(this.__data__,t)>-1}function jW(t,e){var r=this.__data__,n=vh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}na.prototype.clear=kW;na.prototype.delete=NW;na.prototype.get=$W;na.prototype.has=LW;na.prototype.set=jW;function ia(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 BW(){this.__data__={hash:new $s,map:new(xW||na),string:new $s}}function MW(t){return _h(this,t).delete(t)}function qW(t){return _h(this,t).get(t)}function UW(t){return _h(this,t).has(t)}function HW(t,e){return _h(this,t).set(t,e),this}ia.prototype.clear=BW;ia.prototype.delete=MW;ia.prototype.get=qW;ia.prototype.has=UW;ia.prototype.set=HW;function bh(t){var e=-1,r=t?t.length:0;for(this.__data__=new ia;++e<r;)this.add(t[e])}function VW(t){return this.__data__.set(t,zD),this}function zW(t){return this.__data__.has(t)}bh.prototype.add=bh.prototype.push=VW;bh.prototype.has=zW;function vh(t,e){for(var r=t.length;r--;)if(XW(t[r][0],e))return r;return-1}function KW(t,e,r){var n=-1,i=yW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=DW;else if(s>=hW){var c=e?null:lW(t);if(c)return _W(c);o=!1,i=EW,u=new bh}else u=e?[]:a;e:for(;++n<s;){var l=t[n],h=e?e(l):l;if(l=r||l!==0?l:0,o&&h===h){for(var d=u.length;d--;)if(u[d]===h)continue e;e&&u.push(h),a.push(l)}else i(u,h,r)||(u!==a&&u.push(h),a.push(l))}return a}function _h(t,e){var r=t.__data__;return GW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function jx(t,e){var r=t[e];return JW(r)?r:void 0}function GW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function WW(t){if(t!=null){try{return Lx.call(t)}catch{}try{return t+""}catch{}}return""}function XW(t,e){return t===e||t!==t&&e!==e}function YW(t){var e=Bx(t)?SW.call(t):"";return e==dW||e==pW}function Bx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function JW(t){if(!Bx(t))return!1;var e=YW(t)||vW(t)?AW:gW;return e.test(WW(t))}Mx.exports=KW});var Hx=v((Hye,Ux)=>{var ZW=xx(),QW=qx();function eX(t,e){return t&&t.length?QW(t,ZW(e)):[]}Ux.exports=eX});var zx=v((Vye,Vx)=>{"use strict";var tX=MO(),rX=Hx(),nX=tX("MultiError");Vx.exports=GD;function GD(t){if(!(this instanceof GD))return new GD(t);if(t=Array.isArray(t)?t:[t],t=rX(t,function(r){return r.stack}),t.length===1)return t[0];var e=new nX({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(`
53
53
 
54
54
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
55
55
 
56
- `)}),e}});var Gx=v((zye,Kx)=>{var Fi=require("constants"),iX=process.cwd,Ch=null,sX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Ch||(Ch=iX.call(process)),Ch};try{process.cwd()}catch{}typeof process.chdir=="function"&&(WD=process.chdir,process.chdir=function(t){Ch=null,WD.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,WD));var WD;Kx.exports=oX;function oX(t){Fi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,h,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,h,d,f){f&&process.nextTick(f)},t.lchownSync=function(){}),sX==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var y=Date.now(),E=0;l(d,f,function C(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(f,function(p,D){p&&p.code==="ENOENT"?l(d,f,C):m(A)})},E),E<100&&(E+=10);return}m&&m(A)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function h(d,f,m,y,E,C){var A;if(C&&typeof C=="function"){var p=0;A=function(D,w,_){if(D&&D.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,y,E,A);C.apply(this,arguments)}}return l.call(t,d,f,m,y,E,A)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(h,d,f,m,y){for(var E=0;;)try{return l.call(t,h,d,f,m,y)}catch(C){if(C.code==="EAGAIN"&&E<10){E++;continue}throw C}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,Fi.O_WRONLY|Fi.O_SYMLINK,d,function(m,y){if(m){f&&f(m);return}l.fchmod(y,d,function(E){l.close(y,function(C){f&&f(E||C)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,Fi.O_WRONLY|Fi.O_SYMLINK,d),m=!0,y;try{y=l.fchmodSync(f,d),m=!1}finally{if(m)try{l.closeSync(f)}catch{}else l.closeSync(f)}return y}}function r(l){Fi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,m){l.open(h,Fi.O_SYMLINK,function(y,E){if(y){m&&m(y);return}l.futimes(E,d,f,function(C){l.close(E,function(A){m&&m(C||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,Fi.O_SYMLINK),y,E=!0;try{y=l.futimesSync(m,d,f),E=!1}finally{if(E)try{l.closeSync(m)}catch{}else l.closeSync(m)}return y}):l.futimes&&(l.lutimes=function(h,d,f,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(h,d,f){return l.call(t,h,d,function(m){c(m)&&(m=null),f&&f.apply(this,arguments)})}}function i(l){return l&&function(h,d){try{return l.call(t,h,d)}catch(f){if(!c(f))throw f}}}function s(l){return l&&function(h,d,f,m){return l.call(t,h,d,f,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function o(l){return l&&function(h,d,f){try{return l.call(t,h,d,f)}catch(m){if(!c(m))throw m}}}function a(l){return l&&function(h,d,f){typeof d=="function"&&(f=d,d=null);function m(y,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),f&&f.apply(this,arguments)}return d?l.call(t,h,d,m):l.call(t,h,m)}}function u(l){return l&&function(h,d){var f=d?l.call(t,h,d):l.call(t,h);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function c(l){if(!l||l.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Yx=v((Kye,Xx)=>{var Wx=require("stream").Stream;Xx.exports=aX;function aX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Wx.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,u=o.length;a<u;a++){var c=o[a];this[c]=i[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(){s._read()});return}t.open(this.path,this.flags,this.mode,function(l,h){if(l){s.emit("error",l),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Wx.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var u=s[o];this[u]=i[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 Zx=v((Gye,Jx)=>{"use strict";Jx.exports=cX;var uX=Object.getPrototypeOf||function(t){return t.__proto__};function cX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:uX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var yt=v((Wye,JD)=>{var ft=require("fs"),lX=Gx(),fX=Yx(),hX=Zx(),Sh=require("util"),qt,Oh;typeof Symbol=="function"&&typeof Symbol.for=="function"?(qt=Symbol.for("graceful-fs.queue"),Oh=Symbol.for("graceful-fs.previous")):(qt="___graceful-fs.queue",Oh="___graceful-fs.previous");function dX(){}function tT(t,e){Object.defineProperty(t,qt,{get:function(){return e}})}var Ls=dX;Sh.debuglog?Ls=Sh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ls=function(){var t=Sh.format.apply(Sh,arguments);t="GFS4: "+t.split(/\n/).join(`
57
- GFS4: `),console.error(t)});ft[qt]||(Qx=global[qt]||[],tT(ft,Qx),ft.close=(function(t){function e(r,n){return t.call(ft,r,function(i){i||eT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Oh,{value:t}),e})(ft.close),ft.closeSync=(function(t){function e(r){t.apply(ft,arguments),eT()}return Object.defineProperty(e,Oh,{value:t}),e})(ft.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ls(ft[qt]),require("assert").equal(ft[qt].length,0)}));var Qx;global[qt]||tT(global,ft[qt]);JD.exports=XD(hX(ft));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ft.__patched&&(JD.exports=XD(ft),ft.__patched=!0);function XD(t){lX(t),t.gracefulify=XD,t.createReadStream=w,t.createWriteStream=_;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),j(k,R,I);function j(U,K,L,S){return e(U,K,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?sa([j,[U,K,L],T,S||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,S,T,F){return n(K,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,S,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,S,T,F){return s(K,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,S,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,j){return typeof I=="function"&&(j=I,I=0),U(k,R,I,j);function U(K,L,S,T,F){return a(K,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,S,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(k,R,I){typeof R=="function"&&(I=R,R=null);var j=l.test(process.version)?function(L,S,T,F){return c(L,U(L,S,T,F))}:function(L,S,T,F){return c(L,S,U(L,S,T,F))};return j(k,R,I);function U(K,L,S,T){return function(F,$){F&&(F.code==="EMFILE"||F.code==="ENFILE")?sa([j,[K,L,S],F,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof S=="function"&&S.call(this,F,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=fX(t);C=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(C.prototype=Object.create(f.prototype),C.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return C},set:function(k){C=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var y=C;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var E=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return E},set:function(k){E=k},enumerable:!0,configurable:!0});function C(k,R){return this instanceof C?(f.apply(this,arguments),this):C.apply(Object.create(C.prototype),arguments)}function A(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.autoClose&&k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I),k.read())})}function p(k,R){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function D(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I))})}function w(k,R){return new t.ReadStream(k,R)}function _(k,R){return new t.WriteStream(k,R)}var P=t.open;t.open=b;function b(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,S,T,F){return P(K,L,S,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,S,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function sa(t){Ls("ENQUEUE",t[0].name,t[1]),ft[qt].push(t),YD()}var Ah;function eT(){for(var t=Date.now(),e=0;e<ft[qt].length;++e)ft[qt][e].length>2&&(ft[qt][e][3]=t,ft[qt][e][4]=t);YD()}function YD(){if(clearTimeout(Ah),Ah=void 0,ft[qt].length!==0){var t=ft[qt].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)Ls("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Ls("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?(Ls("RETRY",e.name,r),e.apply(null,r.concat([i]))):ft[qt].push(t)}Ah===void 0&&(Ah=setTimeout(YD,0))}}});var nT=v((Xye,rT)=>{function Hr(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))}rT.exports=Hr;Hr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Hr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Hr.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,i=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&&i.unref(),!0};Hr.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)};Hr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Hr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Hr.prototype.start=Hr.prototype.try;Hr.prototype.errors=function(){return this._errors};Hr.prototype.attempts=function(){return this._attempts};Hr.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 i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var iT=v(js=>{var pX=nT();js.operation=function(t){var e=js.timeouts(t);return new pX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};js.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=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};js.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};js.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 i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=js.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var oT=v((Jye,sT)=>{sT.exports=iT()});var aT=v((Zye,xh)=>{xh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&xh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&xh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ph=v((Qye,ua)=>{var ot=global.process,Bs=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"};Bs(ot)?(uT=require("assert"),oa=aT(),cT=/^win/i.test(ot.platform),rc=require("events"),typeof rc!="function"&&(rc=rc.EventEmitter),ot.__signal_exit_emitter__?Rt=ot.__signal_exit_emitter__:(Rt=ot.__signal_exit_emitter__=new rc,Rt.count=0,Rt.emitted={}),Rt.infinite||(Rt.setMaxListeners(1/0),Rt.infinite=!0),ua.exports=function(t,e){if(!Bs(global.process))return function(){};uT.equal(typeof t,"function","a callback must be provided for exit handler"),aa===!1&&ZD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){Rt.removeListener(r,t),Rt.listeners("exit").length===0&&Rt.listeners("afterexit").length===0&&Th()};return Rt.on(r,t),n},Th=function(){!aa||!Bs(global.process)||(aa=!1,oa.forEach(function(e){try{ot.removeListener(e,Ih[e])}catch{}}),ot.emit=Fh,ot.reallyExit=QD,Rt.count-=1)},ua.exports.unload=Th,Ms=function(e,r,n){Rt.emitted[e]||(Rt.emitted[e]=!0,Rt.emit(e,r,n))},Ih={},oa.forEach(function(t){Ih[t]=function(){if(Bs(global.process)){var r=ot.listeners(t);r.length===Rt.count&&(Th(),Ms("exit",null,t),Ms("afterexit",null,t),cT&&t==="SIGHUP"&&(t="SIGINT"),ot.kill(ot.pid,t))}}}),ua.exports.signals=function(){return oa},aa=!1,ZD=function(){aa||!Bs(global.process)||(aa=!0,Rt.count+=1,oa=oa.filter(function(e){try{return ot.on(e,Ih[e]),!0}catch{return!1}}),ot.emit=fT,ot.reallyExit=lT)},ua.exports.load=ZD,QD=ot.reallyExit,lT=function(e){Bs(global.process)&&(ot.exitCode=e||0,Ms("exit",ot.exitCode,null),Ms("afterexit",ot.exitCode,null),QD.call(ot,ot.exitCode))},Fh=ot.emit,fT=function(e,r){if(e==="exit"&&Bs(global.process)){r!==void 0&&(ot.exitCode=r);var n=Fh.apply(this,arguments);return Ms("exit",ot.exitCode,null),Ms("afterexit",ot.exitCode,null),n}else return Fh.apply(this,arguments)}):ua.exports=function(){return function(){}};var uT,oa,cT,rc,Rt,Th,Ms,Ih,aa,ZD,QD,lT,Fh,fT});var dT=v((eDe,e0)=>{"use strict";var hT=Symbol();function mX(t,e,r){let n=e[hT];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,hT,{value:u}),r(null,a.mtime,u)})})}function gX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}e0.exports.probe=mX;e0.exports.getMtime=gX});var DT=v((tDe,ic)=>{"use strict";var yX=require("path"),n0=yt(),DX=oT(),wX=Ph(),pT=dT(),Yn={};function nc(t,e){return e.lockfilePath||`${t}.lock`}function i0(t,e,r){if(!e.realpath)return r(null,yX.resolve(t));e.fs.realpath(t,r)}function r0(t,e,r){let n=nc(t,e);e.fs.mkdir(n,i=>{if(!i)return pT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?r0(t,{...e,stale:0},r):r(s);if(!mT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));gT(t,e,a=>{if(a)return r(a);r0(t,{...e,stale:0},r)})})})}function mT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function gT(t,e,r){e.fs.rmdir(nc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Rh(t,e){let r=Yn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?t0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return t0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=pT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?t0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Rh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function t0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Yn[t]===e&&delete Yn[t],e.options.onCompromised(r)}function EX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:n0,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),i0(t,e,(n,i)=>{if(n)return r(n);let s=DX.operation(e.retries);s.attempt(()=>{r0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Yn[i]={lockfilePath:nc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Rh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));yT(i,{...e,realpath:!1},l)})})})})}function yT(t,e,r){e={fs:n0,realpath:!0,...e},i0(t,e,(n,i)=>{if(n)return r(n);let s=Yn[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete Yn[i],gT(i,e,r)})}function bX(t,e,r){e={stale:1e4,realpath:!0,fs:n0,...e},e.stale=Math.max(e.stale||0,2e3),i0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(nc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!mT(o,e)))})}function vX(){return Yn}wX(()=>{for(let t in Yn){let e=Yn[t].options;try{e.fs.rmdirSync(nc(t,e))}catch{}}});ic.exports.lock=EX;ic.exports.unlock=yT;ic.exports.check=bX;ic.exports.getLocks=vX});var ET=v((rDe,wT)=>{"use strict";var _X=yt();function CX(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function SX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function AX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function OX(t){if(t={...t},t.fs=CX(t.fs||_X),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}wT.exports={toPromise:SX,toSync:AX,toSyncOptions:OX}});var vT=v((nDe,Pi)=>{"use strict";var ca=DT(),{toPromise:kh,toSync:Nh,toSyncOptions:s0}=ET();async function bT(t,e){let r=await kh(ca.lock)(t,e);return kh(r)}function xX(t,e){let r=Nh(ca.lock)(t,s0(e));return Nh(r)}function TX(t,e){return kh(ca.unlock)(t,e)}function IX(t,e){return Nh(ca.unlock)(t,s0(e))}function FX(t,e){return kh(ca.check)(t,e)}function PX(t,e){return Nh(ca.check)(t,s0(e))}Pi.exports=bT;Pi.exports.lock=bT;Pi.exports.unlock=TX;Pi.exports.lockSync=xX;Pi.exports.unlockSync=IX;Pi.exports.check=FX;Pi.exports.checkSync=PX});var OT=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.canStoreURLs=la.FileUrlStorage=void 0;var _T=require("fs"),RX=NX(zx()),CT=kX(vT());function AT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(AT=function(n){return n?r:e})(t)}function kX(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=AT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function NX(t){return t&&t.__esModule?t:{default:t}}function sc(t){"@babel/helpers - typeof";return sc=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},sc(t)}function $X(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ST(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,jX(n.key),n)}}function LX(t,e,r){return e&&ST(t.prototype,e),r&&ST(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function jX(t){var e=BX(t,"string");return sc(e)=="symbol"?e:e+""}function BX(t,e){if(sc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(sc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var iDe=la.canStoreURLs=!0,sDe=la.FileUrlStorage=(function(){function t(e){$X(this,t),this.path=e}return LX(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;CT.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;CT.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,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(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,RX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,_T.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,_T.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var u0=v(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return FT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return MX.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return PT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return zX.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return PT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return qX.enableDebugLog}});Er.isSupported=void 0;var MX=qs(rD()),qX=nD(),UX=qs(OA()),o0=qs(nO()),HX=qs(gO()),VX=qs(EO()),FT=qs(kO()),zX=qs(yD()),PT=OT();function qs(t){return t&&t.__esModule?t:{default:t}}function ha(t){"@babel/helpers - typeof";return ha=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ha(t)}function KX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xT(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,kT(n.key),n)}}function GX(t,e,r){return e&&xT(t.prototype,e),r&&xT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function WX(t,e,r){return e=$h(e),XX(t,RT()?Reflect.construct(e,r||[],$h(t).constructor):e.apply(t,r))}function XX(t,e){if(e&&(ha(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YX(t)}function YX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RT=function(){return!!t})()}function $h(t){return $h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$h(t)}function JX(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&&a0(t,e)}function a0(t,e){return a0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},a0(t,e)}function TT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?TT(Object(r),!0).forEach(function(n){ZX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):TT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ZX(t,e,r){return e=kT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kT(t){var e=QX(t,"string");return ha(e)=="symbol"?e:e+""}function QX(t,e){if(ha(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ha(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var IT=Er.defaultOptions=fa(fa({},o0.default.defaultOptions),{},{httpStack:new FT.default,fileReader:new HX.default,urlStorage:new UX.default,fingerprint:VX.default}),aDe=Er.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 KX(this,e),n=fa(fa({},IT),n),WX(this,e,[r,n])}return JX(e,t),GX(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=fa(fa({},IT),i),o0.default.terminate(n,i)}}])})(o0.default),uDe=Er.isSupported=!0});var jT=v((vDe,LT)=>{var da=1e3,pa=da*60,ma=pa*60,Us=ma*24,nY=Us*7,iY=Us*365.25;LT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return sY(t);if(r==="number"&&isFinite(t))return e.long?aY(t):oY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function sY(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*iY;case"weeks":case"week":case"w":return r*nY;case"days":case"day":case"d":return r*Us;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ma;case"minutes":case"minute":case"mins":case"min":case"m":return r*pa;case"seconds":case"second":case"secs":case"sec":case"s":return r*da;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function oY(t){var e=Math.abs(t);return e>=Us?Math.round(t/Us)+"d":e>=ma?Math.round(t/ma)+"h":e>=pa?Math.round(t/pa)+"m":e>=da?Math.round(t/da)+"s":t+"ms"}function aY(t){var e=Math.abs(t);return e>=Us?jh(t,e,Us,"day"):e>=ma?jh(t,e,ma,"hour"):e>=pa?jh(t,e,pa,"minute"):e>=da?jh(t,e,da,"second"):t+" ms"}function jh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var l0=v((_De,BT)=>{function uY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=jT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function y(...E){if(!y.enabled)return;let C=y,A=Number(new Date),p=A-(h||A);C.diff=p,C.prev=h,C.curr=A,h=A,E[0]=r.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let D=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(_,P)=>{if(_==="%%")return"%";D++;let b=r.formatters[P];if(typeof b=="function"){let k=E[D];_=b.call(C,k),E.splice(D,1),D--}return _}),r.formatArgs.call(C,E),(C.log||r.log).apply(C,E)}return y.namespace=l,y.useColors=r.useColors(),y.color=r.selectColor(l),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:E=>{d=E}}),typeof r.init=="function"&&r.init(y),y}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,y=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,y=d,f++):(d++,f++);else if(m!==-1)f=m+1,y++,d=y;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}BT.exports=uY});var MT=v((br,Bh)=>{br.formatArgs=lY;br.save=fY;br.load=hY;br.useColors=cY;br.storage=dY();br.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`."))}})();br.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 cY(){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 lY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Bh.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,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function fY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function hY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function dY(){try{return localStorage}catch{}}Bh.exports=l0()(br);var{formatters:pY}=Bh.exports;pY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var UT=v((CDe,qT)=>{"use strict";qT.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var zT=v((SDe,VT)=>{"use strict";var mY=require("os"),HT=require("tty"),Vr=UT(),{env:kt}=process,ki;Vr("no-color")||Vr("no-colors")||Vr("color=false")||Vr("color=never")?ki=0:(Vr("color")||Vr("colors")||Vr("color=true")||Vr("color=always"))&&(ki=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?ki=1:kt.FORCE_COLOR==="false"?ki=0:ki=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function f0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function h0(t,e){if(ki===0)return 0;if(Vr("color=16m")||Vr("color=full")||Vr("color=truecolor"))return 3;if(Vr("color=256"))return 2;if(t&&!e&&ki===void 0)return 0;let r=ki||0;if(kt.TERM==="dumb")return r;if(process.platform==="win32"){let n=mY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in kt)||kt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let n=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:r}function gY(t){let e=h0(t,t&&t.isTTY);return f0(e)}VT.exports={supportsColor:gY,stdout:f0(h0(!0,HT.isatty(1))),stderr:f0(h0(!0,HT.isatty(2)))}});var GT=v((Nt,qh)=>{var yY=require("tty"),Mh=require("util");Nt.init=CY;Nt.log=bY;Nt.formatArgs=wY;Nt.save=vY;Nt.load=_Y;Nt.useColors=DY;Nt.destroy=Mh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Nt.colors=[6,2,3,4,5,1];try{let t=zT();t&&(t.stderr||t).level>=2&&(Nt.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{}Nt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.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 DY(){return"colors"in Nt.inspectOpts?!!Nt.inspectOpts.colors:yY.isatty(process.stderr.fd)}function wY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
56
+ `)}),e}});var Gx=v((zye,Kx)=>{var Fi=require("constants"),iX=process.cwd,Ch=null,sX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Ch||(Ch=iX.call(process)),Ch};try{process.cwd()}catch{}typeof process.chdir=="function"&&(WD=process.chdir,process.chdir=function(t){Ch=null,WD.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,WD));var WD;Kx.exports=oX;function oX(t){Fi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,h,d){d&&process.nextTick(d)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,h,d,f){f&&process.nextTick(f)},t.lchownSync=function(){}),sX==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var y=Date.now(),E=0;l(d,f,function S(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(f,function(p,D){p&&p.code==="ENOENT"?l(d,f,S):m(A)})},E),E<100&&(E+=10);return}m&&m(A)})}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function h(d,f,m,y,E,S){var A;if(S&&typeof S=="function"){var p=0;A=function(D,w,_){if(D&&D.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,y,E,A);S.apply(this,arguments)}}return l.call(t,d,f,m,y,E,A)}return Object.setPrototypeOf&&Object.setPrototypeOf(h,l),h})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(h,d,f,m,y){for(var E=0;;)try{return l.call(t,h,d,f,m,y)}catch(S){if(S.code==="EAGAIN"&&E<10){E++;continue}throw S}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,Fi.O_WRONLY|Fi.O_SYMLINK,d,function(m,y){if(m){f&&f(m);return}l.fchmod(y,d,function(E){l.close(y,function(S){f&&f(E||S)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,Fi.O_WRONLY|Fi.O_SYMLINK,d),m=!0,y;try{y=l.fchmodSync(f,d),m=!1}finally{if(m)try{l.closeSync(f)}catch{}else l.closeSync(f)}return y}}function r(l){Fi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,m){l.open(h,Fi.O_SYMLINK,function(y,E){if(y){m&&m(y);return}l.futimes(E,d,f,function(S){l.close(E,function(A){m&&m(S||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,Fi.O_SYMLINK),y,E=!0;try{y=l.futimesSync(m,d,f),E=!1}finally{if(E)try{l.closeSync(m)}catch{}else l.closeSync(m)}return y}):l.futimes&&(l.lutimes=function(h,d,f,m){m&&process.nextTick(m)},l.lutimesSync=function(){})}function n(l){return l&&function(h,d,f){return l.call(t,h,d,function(m){c(m)&&(m=null),f&&f.apply(this,arguments)})}}function i(l){return l&&function(h,d){try{return l.call(t,h,d)}catch(f){if(!c(f))throw f}}}function s(l){return l&&function(h,d,f,m){return l.call(t,h,d,f,function(y){c(y)&&(y=null),m&&m.apply(this,arguments)})}}function o(l){return l&&function(h,d,f){try{return l.call(t,h,d,f)}catch(m){if(!c(m))throw m}}}function a(l){return l&&function(h,d,f){typeof d=="function"&&(f=d,d=null);function m(y,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),f&&f.apply(this,arguments)}return d?l.call(t,h,d,m):l.call(t,h,m)}}function u(l){return l&&function(h,d){var f=d?l.call(t,h,d):l.call(t,h);return f&&(f.uid<0&&(f.uid+=4294967296),f.gid<0&&(f.gid+=4294967296)),f}}function c(l){if(!l||l.code==="ENOSYS")return!0;var h=!process.getuid||process.getuid()!==0;return!!(h&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Yx=v((Kye,Xx)=>{var Wx=require("stream").Stream;Xx.exports=aX;function aX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Wx.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,u=o.length;a<u;a++){var c=o[a];this[c]=i[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(){s._read()});return}t.open(this.path,this.flags,this.mode,function(l,h){if(l){s.emit("error",l),s.readable=!1;return}s.fd=h,s.emit("open",h),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Wx.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var u=s[o];this[u]=i[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 Zx=v((Gye,Jx)=>{"use strict";Jx.exports=cX;var uX=Object.getPrototypeOf||function(t){return t.__proto__};function cX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:uX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var yt=v((Wye,JD)=>{var ft=require("fs"),lX=Gx(),fX=Yx(),hX=Zx(),Sh=require("util"),qt,Oh;typeof Symbol=="function"&&typeof Symbol.for=="function"?(qt=Symbol.for("graceful-fs.queue"),Oh=Symbol.for("graceful-fs.previous")):(qt="___graceful-fs.queue",Oh="___graceful-fs.previous");function dX(){}function tT(t,e){Object.defineProperty(t,qt,{get:function(){return e}})}var Ls=dX;Sh.debuglog?Ls=Sh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Ls=function(){var t=Sh.format.apply(Sh,arguments);t="GFS4: "+t.split(/\n/).join(`
57
+ GFS4: `),console.error(t)});ft[qt]||(Qx=global[qt]||[],tT(ft,Qx),ft.close=(function(t){function e(r,n){return t.call(ft,r,function(i){i||eT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Oh,{value:t}),e})(ft.close),ft.closeSync=(function(t){function e(r){t.apply(ft,arguments),eT()}return Object.defineProperty(e,Oh,{value:t}),e})(ft.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Ls(ft[qt]),require("assert").equal(ft[qt].length,0)}));var Qx;global[qt]||tT(global,ft[qt]);JD.exports=XD(hX(ft));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ft.__patched&&(JD.exports=XD(ft),ft.__patched=!0);function XD(t){lX(t),t.gracefulify=XD,t.createReadStream=w,t.createWriteStream=_;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),j(k,R,I);function j(U,K,L,C){return e(U,K,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?sa([j,[U,K,L],T,C||Date.now(),Date.now()]):typeof L=="function"&&L.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,C,T,F){return n(K,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,C,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,C,T,F){return s(K,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,C,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,j){return typeof I=="function"&&(j=I,I=0),U(k,R,I,j);function U(K,L,C,T,F){return a(K,L,C,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,C,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var c=t.readdir;t.readdir=h;var l=/^v[0-5]\./;function h(k,R,I){typeof R=="function"&&(I=R,R=null);var j=l.test(process.version)?function(L,C,T,F){return c(L,U(L,C,T,F))}:function(L,C,T,F){return c(L,C,U(L,C,T,F))};return j(k,R,I);function U(K,L,C,T){return function(F,$){F&&(F.code==="EMFILE"||F.code==="ENFILE")?sa([j,[K,L,C],F,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof C=="function"&&C.call(this,F,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=fX(t);S=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(S.prototype=Object.create(f.prototype),S.prototype.open=A);var m=t.WriteStream;m&&(p.prototype=Object.create(m.prototype),p.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return S},set:function(k){S=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var y=S;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var E=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return E},set:function(k){E=k},enumerable:!0,configurable:!0});function S(k,R){return this instanceof S?(f.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function A(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.autoClose&&k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I),k.read())})}function p(k,R){return this instanceof p?(m.apply(this,arguments),this):p.apply(Object.create(p.prototype),arguments)}function D(){var k=this;b(k.path,k.flags,k.mode,function(R,I){R?(k.destroy(),k.emit("error",R)):(k.fd=I,k.emit("open",I))})}function w(k,R){return new t.ReadStream(k,R)}function _(k,R){return new t.WriteStream(k,R)}var P=t.open;t.open=b;function b(k,R,I,j){return typeof I=="function"&&(j=I,I=null),U(k,R,I,j);function U(K,L,C,T,F){return P(K,L,C,function($,M){$&&($.code==="EMFILE"||$.code==="ENFILE")?sa([U,[K,L,C,T],$,F||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function sa(t){Ls("ENQUEUE",t[0].name,t[1]),ft[qt].push(t),YD()}var Ah;function eT(){for(var t=Date.now(),e=0;e<ft[qt].length;++e)ft[qt][e].length>2&&(ft[qt][e][3]=t,ft[qt][e][4]=t);YD()}function YD(){if(clearTimeout(Ah),Ah=void 0,ft[qt].length!==0){var t=ft[qt].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)Ls("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Ls("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,u=Math.max(s-i,1),c=Math.min(u*1.2,100);a>=c?(Ls("RETRY",e.name,r),e.apply(null,r.concat([i]))):ft[qt].push(t)}Ah===void 0&&(Ah=setTimeout(YD,0))}}});var nT=v((Xye,rT)=>{function Vr(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))}rT.exports=Vr;Vr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Vr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Vr.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,i=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&&i.unref(),!0};Vr.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)};Vr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Vr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Vr.prototype.start=Vr.prototype.try;Vr.prototype.errors=function(){return this._errors};Vr.prototype.attempts=function(){return this._attempts};Vr.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 i=this._errors[n],s=i.message,o=(t[s]||0)+1;t[s]=o,o>=r&&(e=i,r=o)}return e}});var iT=v(js=>{var pX=nT();js.operation=function(t){var e=js.timeouts(t);return new pX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};js.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=[],i=0;i<e.retries;i++)n.push(this.createTimeout(i,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(i,e)),n.sort(function(s,o){return s-o}),n};js.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};js.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 i=0;i<r.length;i++){var s=r[i],o=t[s];t[s]=function(u){var c=js.operation(e),l=Array.prototype.slice.call(arguments,1),h=l.pop();l.push(function(d){c.retry(d)||(d&&(arguments[0]=c.mainError()),h.apply(this,arguments))}),c.attempt(function(){u.apply(t,l)})}.bind(t,o),t[s].options=e}}});var oT=v((Jye,sT)=>{sT.exports=iT()});var aT=v((Zye,xh)=>{xh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&xh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&xh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Ph=v((Qye,ua)=>{var ot=global.process,Bs=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"};Bs(ot)?(uT=require("assert"),oa=aT(),cT=/^win/i.test(ot.platform),rc=require("events"),typeof rc!="function"&&(rc=rc.EventEmitter),ot.__signal_exit_emitter__?Rt=ot.__signal_exit_emitter__:(Rt=ot.__signal_exit_emitter__=new rc,Rt.count=0,Rt.emitted={}),Rt.infinite||(Rt.setMaxListeners(1/0),Rt.infinite=!0),ua.exports=function(t,e){if(!Bs(global.process))return function(){};uT.equal(typeof t,"function","a callback must be provided for exit handler"),aa===!1&&ZD();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){Rt.removeListener(r,t),Rt.listeners("exit").length===0&&Rt.listeners("afterexit").length===0&&Th()};return Rt.on(r,t),n},Th=function(){!aa||!Bs(global.process)||(aa=!1,oa.forEach(function(e){try{ot.removeListener(e,Ih[e])}catch{}}),ot.emit=Fh,ot.reallyExit=QD,Rt.count-=1)},ua.exports.unload=Th,Ms=function(e,r,n){Rt.emitted[e]||(Rt.emitted[e]=!0,Rt.emit(e,r,n))},Ih={},oa.forEach(function(t){Ih[t]=function(){if(Bs(global.process)){var r=ot.listeners(t);r.length===Rt.count&&(Th(),Ms("exit",null,t),Ms("afterexit",null,t),cT&&t==="SIGHUP"&&(t="SIGINT"),ot.kill(ot.pid,t))}}}),ua.exports.signals=function(){return oa},aa=!1,ZD=function(){aa||!Bs(global.process)||(aa=!0,Rt.count+=1,oa=oa.filter(function(e){try{return ot.on(e,Ih[e]),!0}catch{return!1}}),ot.emit=fT,ot.reallyExit=lT)},ua.exports.load=ZD,QD=ot.reallyExit,lT=function(e){Bs(global.process)&&(ot.exitCode=e||0,Ms("exit",ot.exitCode,null),Ms("afterexit",ot.exitCode,null),QD.call(ot,ot.exitCode))},Fh=ot.emit,fT=function(e,r){if(e==="exit"&&Bs(global.process)){r!==void 0&&(ot.exitCode=r);var n=Fh.apply(this,arguments);return Ms("exit",ot.exitCode,null),Ms("afterexit",ot.exitCode,null),n}else return Fh.apply(this,arguments)}):ua.exports=function(){return function(){}};var uT,oa,cT,rc,Rt,Th,Ms,Ih,aa,ZD,QD,lT,Fh,fT});var dT=v((eDe,e0)=>{"use strict";var hT=Symbol();function mX(t,e,r){let n=e[hT];if(n)return e.stat(t,(s,o)=>{if(s)return r(s);r(null,o.mtime,n)});let i=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,i,i,s=>{if(s)return r(s);e.stat(t,(o,a)=>{if(o)return r(o);let u=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,hT,{value:u}),r(null,a.mtime,u)})})}function gX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}e0.exports.probe=mX;e0.exports.getMtime=gX});var DT=v((tDe,ic)=>{"use strict";var yX=require("path"),n0=yt(),DX=oT(),wX=Ph(),pT=dT(),Yn={};function nc(t,e){return e.lockfilePath||`${t}.lock`}function i0(t,e,r){if(!e.realpath)return r(null,yX.resolve(t));e.fs.realpath(t,r)}function r0(t,e,r){let n=nc(t,e);e.fs.mkdir(n,i=>{if(!i)return pT.probe(n,e.fs,(s,o,a)=>{if(s)return e.fs.rmdir(n,()=>{}),r(s);r(null,o,a)});if(i.code!=="EEXIST")return r(i);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(s,o)=>{if(s)return s.code==="ENOENT"?r0(t,{...e,stale:0},r):r(s);if(!mT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));gT(t,e,a=>{if(a)return r(a);r0(t,{...e,stale:0},r)})})})}function mT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function gT(t,e,r){e.fs.rmdir(nc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Rh(t,e){let r=Yn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,i)=>{let s=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||s?t0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return t0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=pT.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,u=>{let c=r.lastUpdate+e.stale<Date.now();if(!r.released){if(u)return u.code==="ENOENT"||c?t0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Rh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Rh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function t0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),Yn[t]===e&&delete Yn[t],e.options.onCompromised(r)}function EX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:n0,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),i0(t,e,(n,i)=>{if(n)return r(n);let s=DX.operation(e.retries);s.attempt(()=>{r0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=Yn[i]={lockfilePath:nc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Rh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));yT(i,{...e,realpath:!1},l)})})})})}function yT(t,e,r){e={fs:n0,realpath:!0,...e},i0(t,e,(n,i)=>{if(n)return r(n);let s=Yn[i];if(!s)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));s.updateTimeout&&clearTimeout(s.updateTimeout),s.released=!0,delete Yn[i],gT(i,e,r)})}function bX(t,e,r){e={stale:1e4,realpath:!0,fs:n0,...e},e.stale=Math.max(e.stale||0,2e3),i0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(nc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!mT(o,e)))})}function vX(){return Yn}wX(()=>{for(let t in Yn){let e=Yn[t].options;try{e.fs.rmdirSync(nc(t,e))}catch{}}});ic.exports.lock=EX;ic.exports.unlock=yT;ic.exports.check=bX;ic.exports.getLocks=vX});var ET=v((rDe,wT)=>{"use strict";var _X=yt();function CX(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...i)=>{let s=i.pop(),o;try{o=t[`${n}Sync`](...i)}catch(a){return s(a)}s(null,o)}}),r}function SX(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function AX(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function OX(t){if(t={...t},t.fs=CX(t.fs||_X),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}wT.exports={toPromise:SX,toSync:AX,toSyncOptions:OX}});var vT=v((nDe,Pi)=>{"use strict";var ca=DT(),{toPromise:kh,toSync:Nh,toSyncOptions:s0}=ET();async function bT(t,e){let r=await kh(ca.lock)(t,e);return kh(r)}function xX(t,e){let r=Nh(ca.lock)(t,s0(e));return Nh(r)}function TX(t,e){return kh(ca.unlock)(t,e)}function IX(t,e){return Nh(ca.unlock)(t,s0(e))}function FX(t,e){return kh(ca.check)(t,e)}function PX(t,e){return Nh(ca.check)(t,s0(e))}Pi.exports=bT;Pi.exports.lock=bT;Pi.exports.unlock=TX;Pi.exports.lockSync=xX;Pi.exports.unlockSync=IX;Pi.exports.check=FX;Pi.exports.checkSync=PX});var OT=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});la.canStoreURLs=la.FileUrlStorage=void 0;var _T=require("fs"),RX=NX(zx()),CT=kX(vT());function AT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(AT=function(n){return n?r:e})(t)}function kX(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=AT(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function NX(t){return t&&t.__esModule?t:{default:t}}function sc(t){"@babel/helpers - typeof";return sc=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},sc(t)}function $X(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ST(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,jX(n.key),n)}}function LX(t,e,r){return e&&ST(t.prototype,e),r&&ST(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function jX(t){var e=BX(t,"string");return sc(e)=="symbol"?e:e+""}function BX(t,e){if(sc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(sc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var iDe=la.canStoreURLs=!0,sDe=la.FileUrlStorage=(function(){function t(e){$X(this,t),this.path=e}return LX(t,[{key:"findAllUploads",value:function(){var r=this;return new Promise(function(n,i){r._getItems("tus::",function(s,o){s?i(s):n(o)})})}},{key:"findUploadsByFingerprint",value:function(r){var n=this;return new Promise(function(i,s){n._getItems("tus::".concat(r),function(o,a){o?s(o):i(a)})})}},{key:"removeUpload",value:function(r){var n=this;return new Promise(function(i,s){n._removeItem(r,function(o){o?s(o):i()})})}},{key:"addUpload",value:function(r,n){var i=this,s=Math.round(Math.random()*1e12),o="tus::".concat(r,"::").concat(s);return new Promise(function(a,u){i._setItem(o,n,function(c){c?u(c):a(o)})})}},{key:"_setItem",value:function(r,n,i){var s=this;CT.lock(this.path,this._lockfileOptions()).then(function(o){i=s._releaseAndCb(o,i),s._getData(function(a,u){if(a){i(a);return}u[r]=n,s._writeData(u,function(c){return i(c)})})}).catch(i)}},{key:"_getItems",value:function(r,n){this._getData(function(i,s){if(i){n(i);return}var o=Object.keys(s).filter(function(a){return a.startsWith(r)}).map(function(a){var u=s[a];return u.urlStorageKey=a,u});n(null,o)})}},{key:"_removeItem",value:function(r,n){var i=this;CT.lock(this.path,this._lockfileOptions()).then(function(s){n=i._releaseAndCb(s,n),i._getData(function(o,a){if(o){n(o);return}delete a[r],i._writeData(a,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(i){if(i){r().then(function(){return n(i)}).catch(function(s){return n((0,RX.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,_T.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,_T.readFile)(this.path,"utf8",function(n,i){if(n){n.code==="ENOENT"?r(null,{}):r(n);return}try{i=i.trim().length?JSON.parse(i):{}}catch(s){r(s);return}r(null,i)})}}])})()});var u0=v(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return FT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return MX.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return PT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return zX.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return PT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return qX.enableDebugLog}});Er.isSupported=void 0;var MX=qs(rD()),qX=nD(),UX=qs(OA()),o0=qs(nO()),HX=qs(gO()),VX=qs(EO()),FT=qs(kO()),zX=qs(yD()),PT=OT();function qs(t){return t&&t.__esModule?t:{default:t}}function ha(t){"@babel/helpers - typeof";return ha=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ha(t)}function KX(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xT(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,kT(n.key),n)}}function GX(t,e,r){return e&&xT(t.prototype,e),r&&xT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function WX(t,e,r){return e=$h(e),XX(t,RT()?Reflect.construct(e,r||[],$h(t).constructor):e.apply(t,r))}function XX(t,e){if(e&&(ha(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YX(t)}function YX(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function RT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RT=function(){return!!t})()}function $h(t){return $h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$h(t)}function JX(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&&a0(t,e)}function a0(t,e){return a0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},a0(t,e)}function TT(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function fa(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?TT(Object(r),!0).forEach(function(n){ZX(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):TT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ZX(t,e,r){return e=kT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kT(t){var e=QX(t,"string");return ha(e)=="symbol"?e:e+""}function QX(t,e){if(ha(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ha(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var IT=Er.defaultOptions=fa(fa({},o0.default.defaultOptions),{},{httpStack:new FT.default,fileReader:new HX.default,urlStorage:new UX.default,fingerprint:VX.default}),aDe=Er.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 KX(this,e),n=fa(fa({},IT),n),WX(this,e,[r,n])}return JX(e,t),GX(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=fa(fa({},IT),i),o0.default.terminate(n,i)}}])})(o0.default),uDe=Er.isSupported=!0});var jT=v((vDe,LT)=>{var da=1e3,pa=da*60,ma=pa*60,Us=ma*24,nY=Us*7,iY=Us*365.25;LT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return sY(t);if(r==="number"&&isFinite(t))return e.long?aY(t):oY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function sY(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*iY;case"weeks":case"week":case"w":return r*nY;case"days":case"day":case"d":return r*Us;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ma;case"minutes":case"minute":case"mins":case"min":case"m":return r*pa;case"seconds":case"second":case"secs":case"sec":case"s":return r*da;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function oY(t){var e=Math.abs(t);return e>=Us?Math.round(t/Us)+"d":e>=ma?Math.round(t/ma)+"h":e>=pa?Math.round(t/pa)+"m":e>=da?Math.round(t/da)+"s":t+"ms"}function aY(t){var e=Math.abs(t);return e>=Us?jh(t,e,Us,"day"):e>=ma?jh(t,e,ma,"hour"):e>=pa?jh(t,e,pa,"minute"):e>=da?jh(t,e,da,"second"):t+" ms"}function jh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var l0=v((_De,BT)=>{function uY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=jT(),r.destroy=c,Object.keys(t).forEach(l=>{r[l]=t[l]}),r.names=[],r.skips=[],r.formatters={};function e(l){let h=0;for(let d=0;d<l.length;d++)h=(h<<5)-h+l.charCodeAt(d),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(l){let h,d=null,f,m;function y(...E){if(!y.enabled)return;let S=y,A=Number(new Date),p=A-(h||A);S.diff=p,S.prev=h,S.curr=A,h=A,E[0]=r.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let D=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(_,P)=>{if(_==="%%")return"%";D++;let b=r.formatters[P];if(typeof b=="function"){let k=E[D];_=b.call(S,k),E.splice(D,1),D--}return _}),r.formatArgs.call(S,E),(S.log||r.log).apply(S,E)}return y.namespace=l,y.useColors=r.useColors(),y.color=r.selectColor(l),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(f!==r.namespaces&&(f=r.namespaces,m=r.enabled(l)),m),set:E=>{d=E}}),typeof r.init=="function"&&r.init(y),y}function n(l,h){let d=r(this.namespace+(typeof h>"u"?":":h)+l);return d.log=this.log,d}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let h=(typeof l=="string"?l:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of h)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(l,h){let d=0,f=0,m=-1,y=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(m=f,y=d,f++):(d++,f++);else if(m!==-1)f=m+1,y++,d=y;else return!1;for(;f<h.length&&h[f]==="*";)f++;return f===h.length}function o(){let l=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),l}function a(l){for(let h of r.skips)if(s(l,h))return!1;for(let h of r.names)if(s(l,h))return!0;return!1}function u(l){return l instanceof Error?l.stack||l.message:l}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}BT.exports=uY});var MT=v((br,Bh)=>{br.formatArgs=lY;br.save=fY;br.load=hY;br.useColors=cY;br.storage=dY();br.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`."))}})();br.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 cY(){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 lY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Bh.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,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}br.log=console.debug||console.log||(()=>{});function fY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function hY(){let t;try{t=br.storage.getItem("debug")||br.storage.getItem("DEBUG")}catch{}return!t&&typeof process<"u"&&"env"in process&&(t=process.env.DEBUG),t}function dY(){try{return localStorage}catch{}}Bh.exports=l0()(br);var{formatters:pY}=Bh.exports;pY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var UT=v((CDe,qT)=>{"use strict";qT.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var zT=v((SDe,VT)=>{"use strict";var mY=require("os"),HT=require("tty"),zr=UT(),{env:kt}=process,ki;zr("no-color")||zr("no-colors")||zr("color=false")||zr("color=never")?ki=0:(zr("color")||zr("colors")||zr("color=true")||zr("color=always"))&&(ki=1);"FORCE_COLOR"in kt&&(kt.FORCE_COLOR==="true"?ki=1:kt.FORCE_COLOR==="false"?ki=0:ki=kt.FORCE_COLOR.length===0?1:Math.min(parseInt(kt.FORCE_COLOR,10),3));function f0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function h0(t,e){if(ki===0)return 0;if(zr("color=16m")||zr("color=full")||zr("color=truecolor"))return 3;if(zr("color=256"))return 2;if(t&&!e&&ki===void 0)return 0;let r=ki||0;if(kt.TERM==="dumb")return r;if(process.platform==="win32"){let n=mY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in kt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in kt)||kt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in kt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(kt.TEAMCITY_VERSION)?1:0;if(kt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in kt){let n=parseInt((kt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(kt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(kt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(kt.TERM)||"COLORTERM"in kt?1:r}function gY(t){let e=h0(t,t&&t.isTTY);return f0(e)}VT.exports={supportsColor:gY,stdout:f0(h0(!0,HT.isatty(1))),stderr:f0(h0(!0,HT.isatty(2)))}});var GT=v((Nt,qh)=>{var yY=require("tty"),Mh=require("util");Nt.init=CY;Nt.log=bY;Nt.formatArgs=wY;Nt.save=vY;Nt.load=_Y;Nt.useColors=DY;Nt.destroy=Mh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Nt.colors=[6,2,3,4,5,1];try{let t=zT();t&&(t.stderr||t).level>=2&&(Nt.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{}Nt.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{let r=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.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 DY(){return"colors"in Nt.inspectOpts?!!Nt.inspectOpts.colors:yY.isatty(process.stderr.fd)}function wY(t){let{namespace:e,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${e} \x1B[0m`;t[0]=s+t[0].split(`
58
58
  `).join(`
59
59
  `+s),t.push(i+"m+"+qh.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=EY()+e+" "+t[0]}function EY(){return Nt.inspectOpts.hideDate?"":new Date().toISOString()+" "}function bY(...t){return process.stderr.write(Mh.formatWithOptions(Nt.inspectOpts,...t)+`
60
60
  `)}function vY(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function _Y(){return process.env.DEBUG}function CY(t){t.inspectOpts={};let e=Object.keys(Nt.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=Nt.inspectOpts[e[r]]}qh.exports=l0()(Nt);var{formatters:KT}=qh.exports;KT.o=function(t){return this.inspectOpts.colors=this.useColors,Mh.inspect(t,this.inspectOpts).split(`
@@ -73,13 +73,13 @@ GFS4: `),console.error(t)});ft[qt]||(Qx=global[qt]||[],tT(ft,Qx),ft.close=(funct
73
73
  `).join(`${n}
74
74
  ${AF(r)}`)}ht.wordWrap=QZ;function eQ(t){t=OF(t);let e=process.cwd(),r=ei.dirname(t),n=GZ.homedir(),i=Math.abs(r.split(ei.sep).length-e.split(ei.sep).length);if(e===r)return"."+ei.sep+ei.basename(t);if(r.startsWith(e))return"."+ei.sep+t.substring(e.length+1);if(i<=2){let s=ei.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+ei.sep+t.substring(n.length+1)}return t}ht.prettyPath=eQ;function OF(t){return ei.resolve(YZ(t))}ht.expandPath=OF;function xF(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>td(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>SF(s,0,i-td(o)))}ht.generateFillSpaceStringList=xF;function tQ(t,{hsep:e="-",vsep:r="|",headers:n}){let i=!!n;if(!t[0])return"";let s=n?n.length:t[0].length,o=n?n.map(l=>[l]):t[0].map(()=>[]);for(let l of t){let h=0,d=l.map(f=>{let m=f.split(`
75
75
  `);return h=Math.max(h,m.length),m});for(let f in l)o[f]&&o[f].push(...d[f],...Array(h-d[f].length).fill(""))}let a=o.map((l,h)=>{if(h<s-1){let d=xF(l);return l.map((f,m)=>`${f}${d[m]}${r===""?"":`${r} `}`)}else return l}),u=0,c=a.reduce((l,h)=>l.map((d,f)=>{let m=l[f]+h[f];return u=Math.max(u,td(m)),m}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
76
- `)}ht.columnar=tQ});var IF=v(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.TERMINAL_INFO=zr.CI_ENVIRONMENT_VARIABLES_DETECTED=zr.CI_ENVIRONMENT_VARIABLES=void 0;var rQ=(fe(),ue(le)),nQ=Uh(),iQ=rQ.__importStar(require("os")),sQ=(0,nQ.debug)("ionic:utils-terminal:info");zr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];zr.CI_ENVIRONMENT_VARIABLES_DETECTED=zr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function oQ(){let{shell:t}=iQ.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")}zr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&sQ(`Environment variables for CI detected: ${zr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);zr.TERMINAL_INFO=Object.freeze({ci:zr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:oQ(),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 ji=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var rd=(fe(),ue(le));rd.__exportStar(A0(),Aa);rd.__exportStar(MI(),Aa);rd.__exportStar(TF(),Aa);rd.__exportStar(IF(),Aa)});var id=v(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.isFatal=_n.fatal=_n.FatalException=_n.BaseException=void 0;var nd=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};_n.BaseException=nd;var mc=class extends nd{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};_n.FatalException=mc;function aQ(t){throw new mc(t)}_n.fatal=aQ;function uQ(t){return t&&t instanceof mc}_n.isFatal=uQ});var sd=v(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.formatHrTime=Cn.dropWhile=Cn.enforceLF=Cn.identity=void 0;function cQ(t){return t}Cn.identity=cQ;function lQ(t){return t.match(/[\r\n]$/)?t:t+`
77
- `}Cn.enforceLF=lQ;function fQ(t,e=r=>!!r){let r=!1;return t.filter(n=>r?!0:e(n)?!1:(r=!0,!0))}Cn.dropWhile=fQ;var FF=["s","ms","\u03BCs"];function hQ(t){let e=t[0]+t[1]/1e9,r=0;for(;r<FF.length-1&&!(e>=1);r++,e*=1e3);return e.toFixed(2)+FF[r]}Cn.formatHrTime=hQ});var gc=v(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.NO_COLORS=void 0;var Sn=sd();od.NO_COLORS=Object.freeze({strong:Sn.identity,weak:Sn.identity,input:Sn.identity,success:Sn.identity,failure:Sn.identity,ancillary:Sn.identity,log:Object.freeze({DEBUG:Sn.identity,INFO:Sn.identity,WARN:Sn.identity,ERROR:Sn.identity})})});var q0=v(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.createPrefixedFormatter=_e.createTaggedFormatter=_e.Logger=_e.DEFAULT_LOGGER_HANDLERS=_e.StreamHandler=_e.getLoggerLevelColor=_e.getLoggerLevelName=_e.LOGGER_LEVEL_NAMES=_e.LOGGER_LEVELS=void 0;var dQ=(fe(),ue(le)),PF=ji(),pQ=require("stream"),mQ=dQ.__importStar(require("util")),gQ=gc(),RF=sd();_e.LOGGER_LEVELS=Object.freeze({DEBUG:10,INFO:20,WARN:30,ERROR:40});_e.LOGGER_LEVEL_NAMES=new Map([[_e.LOGGER_LEVELS.DEBUG,"DEBUG"],[_e.LOGGER_LEVELS.INFO,"INFO"],[_e.LOGGER_LEVELS.WARN,"WARN"],[_e.LOGGER_LEVELS.ERROR,"ERROR"]]);function M0(t){if(t){let e=_e.LOGGER_LEVEL_NAMES.get(t);if(e)return e}}_e.getLoggerLevelName=M0;function j0(t,e){let r=M0(e);if(r)return t.log[r]}_e.getLoggerLevelColor=j0;var yc=class t{constructor({stream:e,filter:r,formatter:n}){this.stream=e,this.filter=r,this.formatter=n}clone(e){let{stream:r,filter:n,formatter:i}=this;return new t({stream:r,filter:n,formatter:i,...e})}handle(e){if(this.filter&&!this.filter(e))return;let r=this.formatter&&e.format!==!1?this.formatter(e):e.msg;this.stream.write((0,RF.enforceLF)(r))}};_e.StreamHandler=yc;var yQ=t=>!t.level||t.level===_e.LOGGER_LEVELS.INFO,DQ=t=>!!t.level&&t.level!==_e.LOGGER_LEVELS.INFO;_e.DEFAULT_LOGGER_HANDLERS=new Set([new yc({stream:process.stdout,filter:yQ}),new yc({stream:process.stderr,filter:DQ})]);var B0=class t{constructor({level:e=_e.LOGGER_LEVELS.INFO,handlers:r}={}){this.level=e,this.handlers=r||t.cloneHandlers(_e.DEFAULT_LOGGER_HANDLERS)}static cloneHandlers(e){return new Set([...e].map(r=>r.clone()))}clone(e={}){let{level:r,handlers:n}=this;return new t({level:r,handlers:t.cloneHandlers(n),...e})}msg(e){this.log(this.createRecord(e))}debug(e){this.log(this.createRecord(e,_e.LOGGER_LEVELS.DEBUG))}info(e){this.log(this.createRecord(e,_e.LOGGER_LEVELS.INFO))}warn(e){this.log(this.createRecord(e,_e.LOGGER_LEVELS.WARN))}error(e){this.log(this.createRecord(e,_e.LOGGER_LEVELS.ERROR))}createRecord(e,r,n){return{msg:mQ.format(e),level:r,logger:this,format:n}}nl(e=1,r){this.log({...this.createRecord(`
78
- `.repeat(e),r),format:!1})}log(e){if(!(typeof e.level=="number"&&this.level>e.level))for(let r of this.handlers)r.handle(e)}createWriteStream(e,r){let n=this;return new class extends pQ.Writable{_write(i,s,o){n.log(n.createRecord(i.toString(),e,r)),o()}}}};_e.Logger=B0;function wQ({colors:t=gQ.NO_COLORS,prefix:e="",tags:r,titleize:n,wrap:i}={}){let{strong:s,weak:o}=t,a=u=>{if(!u)return"";if(r){let h=r.get(u);return h||""}let c=M0(u);if(!c)return"";let l=j0(t,u);return`${o("[")}\x1B[40m${s(l?l(c):c)}\x1B[49m${o("]")}`};return({msg:u,level:c,format:l})=>{if(l===!1)return u;let[h,...d]=u.split(`
76
+ `)}ht.columnar=tQ});var IF=v(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.TERMINAL_INFO=Kr.CI_ENVIRONMENT_VARIABLES_DETECTED=Kr.CI_ENVIRONMENT_VARIABLES=void 0;var rQ=(fe(),ue(le)),nQ=Uh(),iQ=rQ.__importStar(require("os")),sQ=(0,nQ.debug)("ionic:utils-terminal:info");Kr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];Kr.CI_ENVIRONMENT_VARIABLES_DETECTED=Kr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function oQ(){let{shell:t}=iQ.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")}Kr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&sQ(`Environment variables for CI detected: ${Kr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);Kr.TERMINAL_INFO=Object.freeze({ci:Kr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:oQ(),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 ji=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var rd=(fe(),ue(le));rd.__exportStar(A0(),Aa);rd.__exportStar(MI(),Aa);rd.__exportStar(TF(),Aa);rd.__exportStar(IF(),Aa)});var id=v(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.isFatal=_n.fatal=_n.FatalException=_n.BaseException=void 0;var nd=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};_n.BaseException=nd;var mc=class extends nd{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};_n.FatalException=mc;function aQ(t){throw new mc(t)}_n.fatal=aQ;function uQ(t){return t&&t instanceof mc}_n.isFatal=uQ});var sd=v(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.formatHrTime=Cn.dropWhile=Cn.enforceLF=Cn.identity=void 0;function cQ(t){return t}Cn.identity=cQ;function lQ(t){return t.match(/[\r\n]$/)?t:t+`
77
+ `}Cn.enforceLF=lQ;function fQ(t,e=r=>!!r){let r=!1;return t.filter(n=>r?!0:e(n)?!1:(r=!0,!0))}Cn.dropWhile=fQ;var FF=["s","ms","\u03BCs"];function hQ(t){let e=t[0]+t[1]/1e9,r=0;for(;r<FF.length-1&&!(e>=1);r++,e*=1e3);return e.toFixed(2)+FF[r]}Cn.formatHrTime=hQ});var gc=v(od=>{"use strict";Object.defineProperty(od,"__esModule",{value:!0});od.NO_COLORS=void 0;var Sn=sd();od.NO_COLORS=Object.freeze({strong:Sn.identity,weak:Sn.identity,input:Sn.identity,success:Sn.identity,failure:Sn.identity,ancillary:Sn.identity,log:Object.freeze({DEBUG:Sn.identity,INFO:Sn.identity,WARN:Sn.identity,ERROR:Sn.identity})})});var q0=v(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.createPrefixedFormatter=Ce.createTaggedFormatter=Ce.Logger=Ce.DEFAULT_LOGGER_HANDLERS=Ce.StreamHandler=Ce.getLoggerLevelColor=Ce.getLoggerLevelName=Ce.LOGGER_LEVEL_NAMES=Ce.LOGGER_LEVELS=void 0;var dQ=(fe(),ue(le)),PF=ji(),pQ=require("stream"),mQ=dQ.__importStar(require("util")),gQ=gc(),RF=sd();Ce.LOGGER_LEVELS=Object.freeze({DEBUG:10,INFO:20,WARN:30,ERROR:40});Ce.LOGGER_LEVEL_NAMES=new Map([[Ce.LOGGER_LEVELS.DEBUG,"DEBUG"],[Ce.LOGGER_LEVELS.INFO,"INFO"],[Ce.LOGGER_LEVELS.WARN,"WARN"],[Ce.LOGGER_LEVELS.ERROR,"ERROR"]]);function M0(t){if(t){let e=Ce.LOGGER_LEVEL_NAMES.get(t);if(e)return e}}Ce.getLoggerLevelName=M0;function j0(t,e){let r=M0(e);if(r)return t.log[r]}Ce.getLoggerLevelColor=j0;var yc=class t{constructor({stream:e,filter:r,formatter:n}){this.stream=e,this.filter=r,this.formatter=n}clone(e){let{stream:r,filter:n,formatter:i}=this;return new t({stream:r,filter:n,formatter:i,...e})}handle(e){if(this.filter&&!this.filter(e))return;let r=this.formatter&&e.format!==!1?this.formatter(e):e.msg;this.stream.write((0,RF.enforceLF)(r))}};Ce.StreamHandler=yc;var yQ=t=>!t.level||t.level===Ce.LOGGER_LEVELS.INFO,DQ=t=>!!t.level&&t.level!==Ce.LOGGER_LEVELS.INFO;Ce.DEFAULT_LOGGER_HANDLERS=new Set([new yc({stream:process.stdout,filter:yQ}),new yc({stream:process.stderr,filter:DQ})]);var B0=class t{constructor({level:e=Ce.LOGGER_LEVELS.INFO,handlers:r}={}){this.level=e,this.handlers=r||t.cloneHandlers(Ce.DEFAULT_LOGGER_HANDLERS)}static cloneHandlers(e){return new Set([...e].map(r=>r.clone()))}clone(e={}){let{level:r,handlers:n}=this;return new t({level:r,handlers:t.cloneHandlers(n),...e})}msg(e){this.log(this.createRecord(e))}debug(e){this.log(this.createRecord(e,Ce.LOGGER_LEVELS.DEBUG))}info(e){this.log(this.createRecord(e,Ce.LOGGER_LEVELS.INFO))}warn(e){this.log(this.createRecord(e,Ce.LOGGER_LEVELS.WARN))}error(e){this.log(this.createRecord(e,Ce.LOGGER_LEVELS.ERROR))}createRecord(e,r,n){return{msg:mQ.format(e),level:r,logger:this,format:n}}nl(e=1,r){this.log({...this.createRecord(`
78
+ `.repeat(e),r),format:!1})}log(e){if(!(typeof e.level=="number"&&this.level>e.level))for(let r of this.handlers)r.handle(e)}createWriteStream(e,r){let n=this;return new class extends pQ.Writable{_write(i,s,o){n.log(n.createRecord(i.toString(),e,r)),o()}}}};Ce.Logger=B0;function wQ({colors:t=gQ.NO_COLORS,prefix:e="",tags:r,titleize:n,wrap:i}={}){let{strong:s,weak:o}=t,a=u=>{if(!u)return"";if(r){let h=r.get(u);return h||""}let c=M0(u);if(!c)return"";let l=j0(t,u);return`${o("[")}\x1B[40m${s(l?l(c):c)}\x1B[49m${o("]")}`};return({msg:u,level:c,format:l})=>{if(l===!1)return u;let[h,...d]=u.split(`
79
79
  `),f=j0(t,c),m=(typeof e=="function"?e():e)+a(c),y=n&&d.length>0?`${s(f?f(h):h)}
80
- `:h,E=m?(0,PF.stringWidth)(m)+1:0,C=n?(0,RF.dropWhile)(d,A=>A===""):d;return(m?`${m} `:"")+(i?(0,PF.wordWrap)([y,...C].join(`
81
- `),{indentation:E,...typeof i=="object"?i:{}}):[y,...C.map(A=>A?" ".repeat(E)+A:"")].join(`
82
- `))}}_e.createTaggedFormatter=wQ;function EQ(t){return({msg:e,format:r})=>r===!1?e:`${typeof t=="function"?t():t} ${e}`}_e.createPrefixedFormatter=EQ});var z0=v(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.TaskChain=Kr.Task=Kr.Spinner=Kr.ICON_FAILURE=Kr.ICON_SUCCESS=void 0;var kF=require("events"),V0=process.platform==="win32";Kr.ICON_SUCCESS=V0?"\u221A":"\u2714";Kr.ICON_FAILURE=V0?"\xD7":"\u2716";var bQ=V0?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],U0=class{constructor(e=bQ){this.frames=e,this.i=0}frame(){return this.frames[this.i=++this.i%this.frames.length]}};Kr.Spinner=U0;var ad=class extends kF.EventEmitter{constructor({msg:e="",tickInterval:r}={}){super(),this.running=!1,this._msg="",this._success=!1,this.msg=e,this.tickInterval=r}get msg(){return this._msg}set msg(e){this._msg=e,this.tick()}start(){return!this.running&&this.tickInterval&&(this.intervalId=setInterval(()=>{this.tick()},this.tickInterval)),this.running=!0,this._startTime=process.hrtime(),this}tick(){return this.emit("tick"),this}progress(e,r){return this.progressRatio=e/r,this.tick(),this}clear(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.emit("clear"),this}end(){return this.running=!1,this.tick(),this.clear(),this.emit("end",{elapsedTime:process.hrtime(this._startTime),success:this._success}),this}succeed(){return this.running&&(this._success=!0,this.end(),this.emit("success")),this}fail(){return this.running&&(this._success=!1,this.end(),this.emit("failure")),this}};Kr.Task=ad;var H0=class extends kF.EventEmitter{constructor({taskOptions:e={}}={}){super(),this.tasks=[],this.taskOptions=e}next(e){return this.nextTask(this.createTask({msg:e,...this.taskOptions}))}createTask(e){return new ad(e)}nextTask(e){return this.current&&this.current.succeed(),this.tasks.push(e),this.current=e,e.start(),this.emit("next",e),e}end(){let e=this.current;return e&&e.succeed(),this.current=void 0,this.emit("end",e),this}fail(){let e=this.current;return e&&e.fail(),this.emit("failure",e),this}cleanup(){for(let e of this.tasks)e.running?e.fail():e.clear();return this}};Kr.TaskChain=H0});var G0=v(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.TTYOutputRedrawer=Bi.TTYOutputStrategy=Bi.StreamOutputStrategy=void 0;var ud=ji(),NF=gc(),Vs=z0(),$F=sd(),cd=class{constructor({stream:e=process.stdout,colors:r=NF.NO_COLORS}){this.stream=e,this.colors=r}write(e){return this.stream.write(e)}createTaskChain(){let{failure:e,success:r,weak:n}=this.colors,i=new Vs.TaskChain;return i.on("next",s=>{s.on("end",o=>{o.success?this.write(`${r(Vs.ICON_SUCCESS)} ${s.msg} ${n(`in ${(0,$F.formatHrTime)(o.elapsedTime)}`)}
80
+ `:h,E=m?(0,PF.stringWidth)(m)+1:0,S=n?(0,RF.dropWhile)(d,A=>A===""):d;return(m?`${m} `:"")+(i?(0,PF.wordWrap)([y,...S].join(`
81
+ `),{indentation:E,...typeof i=="object"?i:{}}):[y,...S.map(A=>A?" ".repeat(E)+A:"")].join(`
82
+ `))}}Ce.createTaggedFormatter=wQ;function EQ(t){return({msg:e,format:r})=>r===!1?e:`${typeof t=="function"?t():t} ${e}`}Ce.createPrefixedFormatter=EQ});var z0=v(Gr=>{"use strict";Object.defineProperty(Gr,"__esModule",{value:!0});Gr.TaskChain=Gr.Task=Gr.Spinner=Gr.ICON_FAILURE=Gr.ICON_SUCCESS=void 0;var kF=require("events"),V0=process.platform==="win32";Gr.ICON_SUCCESS=V0?"\u221A":"\u2714";Gr.ICON_FAILURE=V0?"\xD7":"\u2716";var bQ=V0?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],U0=class{constructor(e=bQ){this.frames=e,this.i=0}frame(){return this.frames[this.i=++this.i%this.frames.length]}};Gr.Spinner=U0;var ad=class extends kF.EventEmitter{constructor({msg:e="",tickInterval:r}={}){super(),this.running=!1,this._msg="",this._success=!1,this.msg=e,this.tickInterval=r}get msg(){return this._msg}set msg(e){this._msg=e,this.tick()}start(){return!this.running&&this.tickInterval&&(this.intervalId=setInterval(()=>{this.tick()},this.tickInterval)),this.running=!0,this._startTime=process.hrtime(),this}tick(){return this.emit("tick"),this}progress(e,r){return this.progressRatio=e/r,this.tick(),this}clear(){return this.intervalId&&(clearInterval(this.intervalId),this.intervalId=void 0),this.emit("clear"),this}end(){return this.running=!1,this.tick(),this.clear(),this.emit("end",{elapsedTime:process.hrtime(this._startTime),success:this._success}),this}succeed(){return this.running&&(this._success=!0,this.end(),this.emit("success")),this}fail(){return this.running&&(this._success=!1,this.end(),this.emit("failure")),this}};Gr.Task=ad;var H0=class extends kF.EventEmitter{constructor({taskOptions:e={}}={}){super(),this.tasks=[],this.taskOptions=e}next(e){return this.nextTask(this.createTask({msg:e,...this.taskOptions}))}createTask(e){return new ad(e)}nextTask(e){return this.current&&this.current.succeed(),this.tasks.push(e),this.current=e,e.start(),this.emit("next",e),e}end(){let e=this.current;return e&&e.succeed(),this.current=void 0,this.emit("end",e),this}fail(){let e=this.current;return e&&e.fail(),this.emit("failure",e),this}cleanup(){for(let e of this.tasks)e.running?e.fail():e.clear();return this}};Gr.TaskChain=H0});var G0=v(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});Bi.TTYOutputRedrawer=Bi.TTYOutputStrategy=Bi.StreamOutputStrategy=void 0;var ud=ji(),NF=gc(),Vs=z0(),$F=sd(),cd=class{constructor({stream:e=process.stdout,colors:r=NF.NO_COLORS}){this.stream=e,this.colors=r}write(e){return this.stream.write(e)}createTaskChain(){let{failure:e,success:r,weak:n}=this.colors,i=new Vs.TaskChain;return i.on("next",s=>{s.on("end",o=>{o.success?this.write(`${r(Vs.ICON_SUCCESS)} ${s.msg} ${n(`in ${(0,$F.formatHrTime)(o.elapsedTime)}`)}
83
83
  `):this.write(`${e(Vs.ICON_FAILURE)} ${s.msg} ${e(n("- failed!"))}
84
84
  `)})}),i}};Bi.StreamOutputStrategy=cd;var K0=class extends cd{constructor({stream:e=process.stdout,colors:r=NF.NO_COLORS}={}){super({stream:e,colors:r}),this.stream=e,this.redrawer=new ld({stream:e})}createTaskChain(){let{failure:e,strong:r,success:n,weak:i}=this.colors,s=new Vs.TaskChain({taskOptions:{tickInterval:50}});return s.on("next",o=>{o.on("end",u=>{u.success?this.write(`${n(Vs.ICON_SUCCESS)} ${o.msg} ${i(`in ${(0,$F.formatHrTime)(u.elapsedTime)}`)}
85
85
  `):this.write(`${e(Vs.ICON_FAILURE)} ${o.msg} ${e(i("- failed!"))}
@@ -133,7 +133,7 @@ Filtered results for: ${this.inputValue?this.inputValue:ii.gray("Enter something
133
133
  `}renderOption(e,r,n){let i;return r.disabled?i=e===n?ii.gray().underline(r.title):ii.strikethrough().gray(r.title):i=e===n?ii.cyan().underline(r.title):r.title,(r.selected?ii.green(Ta.radioOn):Ta.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ii.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ii.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Yee.hide),super.render();let e=[g2.symbol(this.done,this.aborted),ii.bold(this.msg),g2.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ii.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=m2(e,this.out.columns)}};y2.exports=Cw});var S2=v((cwe,C2)=>{"use strict";var w2=dt(),Zee=ti(),v2=cn(),E2=v2.style,Qee=v2.clear,_2=Je(),ete=_2.erase,b2=_2.cursor,Aw=class extends Zee{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
134
134
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
135
135
  `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(b2.hide):this.out.write(Qee(this.outputText,this.out.columns)),super.render(),this.outputText=[E2.symbol(this.done,this.aborted),w2.bold(this.msg),E2.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:w2.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(ete.line+b2.to(0)+this.outputText))}};C2.exports=Aw});var O2=v((lwe,A2)=>{"use strict";A2.exports={TextPrompt:hP(),SelectPrompt:gP(),TogglePrompt:vP(),DatePrompt:JP(),NumberPrompt:i2(),MultiselectPrompt:Ew(),AutocompletePrompt:p2(),AutocompleteMultiselectPrompt:D2(),ConfirmPrompt:S2()}});var T2=v(x2=>{"use strict";var vr=x2,tte=O2(),Ed=t=>t;function xn(t,e,r={}){return new Promise((n,i)=>{let s=new tte[t](e),o=r.onAbort||Ed,a=r.onSubmit||Ed,u=r.onExit||Ed;s.on("state",e.onState||Ed),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}vr.text=t=>xn("TextPrompt",t);vr.password=t=>(t.style="password",vr.text(t));vr.invisible=t=>(t.style="invisible",vr.text(t));vr.number=t=>xn("NumberPrompt",t);vr.date=t=>xn("DatePrompt",t);vr.confirm=t=>xn("ConfirmPrompt",t);vr.list=t=>{let e=t.separator||",";return xn("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};vr.toggle=t=>xn("TogglePrompt",t);vr.select=t=>xn("SelectPrompt",t);vr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return xn("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};vr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return xn("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var rte=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));vr.autocomplete=t=>(t.suggest=t.suggest||rte,t.choices=[].concat(t.choices||[]),xn("AutocompletePrompt",t))});var L2=v((hwe,$2)=>{"use strict";function I2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function F2(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?I2(Object(r),!0).forEach(function(n){nte(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I2(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function nte(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ite(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ste(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
136
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ste(t,e){if(t){if(typeof t=="string")return P2(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 P2(t,e)}}function P2(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 R2(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function k2(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){R2(s,n,i,o,a,"next",u)}function a(u){R2(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ow=T2(),ote=["suggest","format","onState","validate","onRender","type"],N2=()=>{};function qi(){return xw.apply(this,arguments)}function xw(){return xw=k2(function*(t=[],{onSubmit:e=N2,onCancel:r=N2}={}){let n={},i=qi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var E=k2(function*(C,A,p=!1){if(!(!p&&C.validate&&C.validate(A)!==!0))return C.format?yield C.format(A,n):A});return function(A,p){return E.apply(this,arguments)}})();var d=ite(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var m=o;if(u=m.name,c=m.type,typeof c=="function"&&(c=yield c(s,F2({},n),o),o.type=c),!!c){for(let E in o){if(ote.includes(E))continue;let C=o[E];o[E]=typeof C=="function"?yield C(s,F2({},n),l):C}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var y=o;if(u=y.name,c=y.type,Ow[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=yield h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=qi._injected?ate(qi._injected,o.initial):yield Ow[c](o),n[u]=s=yield h(o,s,!0),a=yield e(o,s,n)}catch{a=!(yield r(o,n))}if(a)return n}}}catch(E){d.e(E)}finally{d.f()}return n}),xw.apply(this,arguments)}function ate(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function ute(t){qi._injected=(qi._injected||[]).concat(t)}function cte(t){qi._override=Object.assign({},t)}$2.exports=Object.assign(qi,{prompt:qi,prompts:Ow,inject:ute,override:cte})});var B2=v((dwe,j2)=>{"use strict";j2.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var bd=v((pwe,M2)=>{"use strict";M2.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var H2=v((mwe,U2)=>{"use strict";var lte=bd(),{erase:q2,cursor:fte}=Je(),hte=t=>[...lte(t)].length;U2.exports=function(t,e){if(!e)return q2.line+fte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(hte(i)-1,0)/e);return q2.lines(r)}});var Tw=v((gwe,V2)=>{"use strict";var Ac={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},dte={arrowUp:Ac.arrowUp,arrowDown:Ac.arrowDown,arrowLeft:Ac.arrowLeft,arrowRight:Ac.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},pte=process.platform==="win32"?dte:Ac;V2.exports=pte});var K2=v((ywe,z2)=>{"use strict";var Ia=dt(),Gs=Tw(),Iw=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),mte=t=>Iw[t]||Iw.default,Oc=Object.freeze({aborted:Ia.red(Gs.cross),done:Ia.green(Gs.tick),exited:Ia.yellow(Gs.cross),default:Ia.cyan("?")}),gte=(t,e,r)=>e?Oc.aborted:r?Oc.exited:t?Oc.done:Oc.default,yte=t=>Ia.gray(t?Gs.ellipsis:Gs.pointerSmall),Dte=(t,e)=>Ia.gray(t?e?Gs.pointerSmall:"+":Gs.line);z2.exports={styles:Iw,render:mte,symbols:Oc,symbol:gte,delimiter:yte,item:Dte}});var W2=v((Dwe,G2)=>{"use strict";var wte=bd();G2.exports=function(t,e){let r=String(wte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var Y2=v((wwe,X2)=>{"use strict";X2.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
136
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(t)},n:function(){var c=r.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}function ste(t,e){if(t){if(typeof t=="string")return P2(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 P2(t,e)}}function P2(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 R2(t,e,r,n,i,s,o){try{var a=t[s](o),u=a.value}catch(c){r(c);return}a.done?e(u):Promise.resolve(u).then(n,i)}function k2(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){R2(s,n,i,o,a,"next",u)}function a(u){R2(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ow=T2(),ote=["suggest","format","onState","validate","onRender","type"],N2=()=>{};function qi(){return xw.apply(this,arguments)}function xw(){return xw=k2(function*(t=[],{onSubmit:e=N2,onCancel:r=N2}={}){let n={},i=qi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var E=k2(function*(S,A,p=!1){if(!(!p&&S.validate&&S.validate(A)!==!0))return S.format?yield S.format(A,n):A});return function(A,p){return E.apply(this,arguments)}})();var d=ite(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var m=o;if(u=m.name,c=m.type,typeof c=="function"&&(c=yield c(s,F2({},n),o),o.type=c),!!c){for(let E in o){if(ote.includes(E))continue;let S=o[E];o[E]=typeof S=="function"?yield S(s,F2({},n),l):S}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var y=o;if(u=y.name,c=y.type,Ow[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=yield h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=qi._injected?ate(qi._injected,o.initial):yield Ow[c](o),n[u]=s=yield h(o,s,!0),a=yield e(o,s,n)}catch{a=!(yield r(o,n))}if(a)return n}}}catch(E){d.e(E)}finally{d.f()}return n}),xw.apply(this,arguments)}function ate(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function ute(t){qi._injected=(qi._injected||[]).concat(t)}function cte(t){qi._override=Object.assign({},t)}$2.exports=Object.assign(qi,{prompt:qi,prompts:Ow,inject:ute,override:cte})});var B2=v((dwe,j2)=>{"use strict";j2.exports=(t,e)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(e){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}});var bd=v((pwe,M2)=>{"use strict";M2.exports=t=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(e,"g");return typeof t=="string"?t.replace(r,""):t}});var H2=v((mwe,U2)=>{"use strict";var lte=bd(),{erase:q2,cursor:fte}=Je(),hte=t=>[...lte(t)].length;U2.exports=function(t,e){if(!e)return q2.line+fte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(hte(i)-1,0)/e);return q2.lines(r)}});var Tw=v((gwe,V2)=>{"use strict";var Ac={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},dte={arrowUp:Ac.arrowUp,arrowDown:Ac.arrowDown,arrowLeft:Ac.arrowLeft,arrowRight:Ac.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},pte=process.platform==="win32"?dte:Ac;V2.exports=pte});var K2=v((ywe,z2)=>{"use strict";var Ia=dt(),Gs=Tw(),Iw=Object.freeze({password:{scale:1,render:t=>"*".repeat(t.length)},emoji:{scale:2,render:t=>"\u{1F603}".repeat(t.length)},invisible:{scale:0,render:t=>""},default:{scale:1,render:t=>`${t}`}}),mte=t=>Iw[t]||Iw.default,Oc=Object.freeze({aborted:Ia.red(Gs.cross),done:Ia.green(Gs.tick),exited:Ia.yellow(Gs.cross),default:Ia.cyan("?")}),gte=(t,e,r)=>e?Oc.aborted:r?Oc.exited:t?Oc.done:Oc.default,yte=t=>Ia.gray(t?Gs.ellipsis:Gs.pointerSmall),Dte=(t,e)=>Ia.gray(t?e?Gs.pointerSmall:"+":Gs.line);z2.exports={styles:Iw,render:mte,symbols:Oc,symbol:gte,delimiter:yte,item:Dte}});var W2=v((Dwe,G2)=>{"use strict";var wte=bd();G2.exports=function(t,e){let r=String(wte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var Y2=v((wwe,X2)=>{"use strict";X2.exports=(t,e={})=>{let r=Number.isSafeInteger(parseInt(e.margin))?new Array(parseInt(e.margin)).fill(" ").join(""):e.margin||"",n=e.width;return(t||"").split(/\r?\n/g).map(i=>i.split(/\s+/g).reduce((s,o)=>(o.length+r.length>=n||s[s.length-1].length+o.length+1<n?s[s.length-1]+=` ${o}`:s.push(`${r}${o}`),s),[r]).join(`
137
137
  `)).join(`
138
138
  `)}});var Z2=v((Ewe,J2)=>{"use strict";J2.exports=(t,e,r)=>{r=r||e;let n=Math.min(e-r,t-Math.floor(r/2));n<0&&(n=0);let i=Math.min(n+r,e);return{startIndex:n,endIndex:i}}});var ln=v((bwe,Q2)=>{"use strict";Q2.exports={action:B2(),clear:H2(),style:K2(),strip:bd(),figures:Tw(),lines:W2(),wrap:Y2(),entriesToDisplay:Z2()}});var si=v((vwe,tR)=>{"use strict";var eR=require("readline"),{action:Ete}=ln(),bte=require("events"),{beep:vte,cursor:_te}=Je(),Cte=dt(),Fw=class extends bte{constructor(e={}){super(),this.firstRender=!0,this.in=e.stdin||process.stdin,this.out=e.stdout||process.stdout,this.onRender=(e.onRender||(()=>{})).bind(this);let r=eR.createInterface({input:this.in,escapeCodeTimeout:50});eR.emitKeypressEvents(this.in,r),this.in.isTTY&&this.in.setRawMode(!0);let n=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,i=(s,o)=>{let a=Ete(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(_te.show),this.in.removeListener("keypress",i),this.in.isTTY&&this.in.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",i)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(vte)}render(){this.onRender(Cte),this.firstRender&&(this.firstRender=!1)}};tR.exports=Fw});var nR=v((_we,rR)=>{var vd=dt(),Ste=si(),{erase:Ate,cursor:xc}=Je(),{style:Pw,clear:Rw,lines:Ote,figures:xte}=ln(),kw=class extends Ste{constructor(e={}){super(e),this.transform=Pw.render(e.style),this.scale=this.transform.scale,this.msg=e.message,this.initial=e.initial||"",this.validator=e.validate||(()=>!0),this.value="",this.errorMsg=e.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=Rw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=vd.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(e)),this._value=e,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
139
139
  `),this.close()}async validate(){let e=await this.validator(this.value);typeof e=="string"&&(this.errorMsg=e,e=!1),this.error=!e}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
@@ -181,34 +181,34 @@ Filtered results for: ${this.inputValue?this.inputValue:ai.gray("Enter something
181
181
  `}renderOption(e,r,n){let i;return r.disabled?i=e===n?ai.gray().underline(r.title):ai.strikethrough().gray(r.title):i=e===n?ai.cyan().underline(r.title):r.title,(r.selected?ai.green(Fa.radioOn):Fa.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[ai.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(ai.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(wre.hide),super.render();let e=[JR.symbol(this.done,this.aborted),ai.bold(this.msg),JR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=ai.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+e),this.clear=YR(e,this.out.columns)}};ZR.exports=rE});var ik=v((qwe,nk)=>{var ek=dt(),bre=si(),{style:tk,clear:vre}=ln(),{erase:_re,cursor:rk}=Je(),nE=class extends bre{constructor(e={}){super(e),this.msg=e.message,this.value=e.initial,this.initialValue=!!e.initial,this.yesMsg=e.yes||"yes",this.yesOption=e.yesOption||"(Y/n)",this.noMsg=e.no||"no",this.noOption=e.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
182
182
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
183
183
  `),this.close()}_(e,r){return e.toLowerCase()==="y"?(this.value=!0,this.submit()):e.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(rk.hide):this.out.write(vre(this.outputText,this.out.columns)),super.render(),this.outputText=[tk.symbol(this.done,this.aborted),ek.bold(this.msg),tk.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:ek.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(_re.line+rk.to(0)+this.outputText))}};nk.exports=nE});var ok=v((Uwe,sk)=>{"use strict";sk.exports={TextPrompt:nR(),SelectPrompt:aR(),TogglePrompt:fR(),DatePrompt:LR(),NumberPrompt:qR(),MultiselectPrompt:Zw(),AutocompletePrompt:XR(),AutocompleteMultiselectPrompt:QR(),ConfirmPrompt:ik()}});var uk=v(ak=>{"use strict";var _r=ak,Cre=ok(),Od=t=>t;function Fn(t,e,r={}){return new Promise((n,i)=>{let s=new Cre[t](e),o=r.onAbort||Od,a=r.onSubmit||Od,u=r.onExit||Od;s.on("state",e.onState||Od),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}_r.text=t=>Fn("TextPrompt",t);_r.password=t=>(t.style="password",_r.text(t));_r.invisible=t=>(t.style="invisible",_r.text(t));_r.number=t=>Fn("NumberPrompt",t);_r.date=t=>Fn("DatePrompt",t);_r.confirm=t=>Fn("ConfirmPrompt",t);_r.list=t=>{let e=t.separator||",";return Fn("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};_r.toggle=t=>Fn("TogglePrompt",t);_r.select=t=>Fn("SelectPrompt",t);_r.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Fn("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};_r.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Fn("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var Sre=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));_r.autocomplete=t=>(t.suggest=t.suggest||Sre,t.choices=[].concat(t.choices||[]),Fn("AutocompletePrompt",t))});var fk=v((Vwe,lk)=>{"use strict";var iE=uk(),Are=["suggest","format","onState","validate","onRender","type"],ck=()=>{};async function Hi(t=[],{onSubmit:e=ck,onCancel:r=ck}={}){let n={},i=Hi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=async(d,f,m=!1)=>{if(!(!m&&d.validate&&d.validate(f)!==!0))return d.format?await d.format(f,n):f};for(o of t)if({name:u,type:c}=o,typeof c=="function"&&(c=await c(s,{...n},o),o.type=c),!!c){for(let d in o){if(Are.includes(d))continue;let f=o[d];o[d]=typeof f=="function"?await f(s,{...n},l):f}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");if({name:u,type:c}=o,iE[c]===void 0)throw new Error(`prompt type (${c}) is not defined`);if(i[o.name]!==void 0&&(s=await h(o,i[o.name]),s!==void 0)){n[u]=s;continue}try{s=Hi._injected?Ore(Hi._injected,o.initial):await iE[c](o),n[u]=s=await h(o,s,!0),a=await e(o,s,n)}catch{a=!await r(o,n)}if(a)return n}return n}function Ore(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function xre(t){Hi._injected=(Hi._injected||[]).concat(t)}function Tre(t){Hi._override=Object.assign({},t)}lk.exports=Object.assign(Hi,{prompt:Hi,prompts:iE,inject:xre,override:Tre})});var xd=v((zwe,hk)=>{function Ire(t){t=(Array.isArray(t)?t:t.split(".")).map(Number);let e=0,r=process.versions.node.split(".").map(Number);for(;e<t.length;e++){if(r[e]>t[e])return!1;if(t[e]>r[e])return!0}return!1}hk.exports=Ire("8.6.0")?L2():fk()});var Dc=v(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.logSuccess=Cr.logPrompt=Cr.logger=Cr.output=void 0;var sE=(fe(),ue(le)),Ws=X0(),Xs=sE.__importDefault(ba()),Fre=jF(),dk={colors:Xs.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Cr.output=(0,Fre.isInteractive)()?new Ws.TTYOutputStrategy(dk):new Ws.StreamOutputStrategy(dk);Cr.logger=(0,Ws.createDefaultLogger)({output:Cr.output,formatterOptions:{titleize:!1,tags:new Map([[Ws.LOGGER_LEVELS.DEBUG,Xs.default.log.DEBUG("[debug]")],[Ws.LOGGER_LEVELS.INFO,Xs.default.log.INFO("[info]")],[Ws.LOGGER_LEVELS.WARN,Xs.default.log.WARN("[warn]")],[Ws.LOGGER_LEVELS.ERROR,Xs.default.log.ERROR("[error]")]])}});async function Pre(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>sE.__importStar(X0())),{prompt:n}=await Promise.resolve().then(()=>sE.__importStar(xd()));return Cr.logger.log({msg:`${Xs.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Cr.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Cr.logPrompt=Pre;function Rre(t){Cr.logger.msg(`${Xs.default.success("[success]")} ${t}`)}Cr.logSuccess=Rre});var Td=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.resolveNode=Pa.requireTS=void 0;var kre=require("fs"),Nre=Ea(),$re=require("path"),Lre=(t,e)=>{let r=(0,$re.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,Nre.readFileSync)(s,"utf8");s.endsWith(".ts")?a=t.transpileModule(a,{fileName:s,compilerOptions:{module:t.ModuleKind.CommonJS,moduleResolution:t.ModuleResolutionKind.NodeJs,esModuleInterop:!0,strict:!0,target:t.ScriptTarget.ES2017},reportDiagnostics:!0}).outputText:a=a.replace(/export\s+\w+\s+(\w+)/gm,"exports.$1"),(o=i._compile)===null||o===void 0||o.call(i,a,s)};let n=require(r);return delete require.extensions[".ts"],n};Pa.requireTS=Lre;function jre(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,kre.existsSync)(n)?n:null}}Pa.resolveNode=jre});var Id=v(oE=>{(function(){oE.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
184
- `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(oE)});var Pn=v((pk,Vi)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,m;if(m=arguments[0],f=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=f.length;c<h;c++)if(d=f[c],d!=null)for(l in d)u.call(d,l)&&(m[l]=d[l]);return m},i=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},s=function(c){var l;return!!c&&((l=typeof c)=="function"||l==="object")},r=function(c){return i(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},n=function(c){var l;if(r(c))return!c.length;for(l in c)if(u.call(c,l))return!1;return!0},o=function(c){var l,h;return s(c)&&(h=Object.getPrototypeOf(c))&&(l=h.constructor)&&typeof l=="function"&&l instanceof l&&Function.prototype.toString.call(l)===Function.prototype.toString.call(Object)},e=function(c){return i(c.valueOf)?c.valueOf():c},Vi.exports.assign=t,Vi.exports.isFunction=i,Vi.exports.isObject=s,Vi.exports.isArray=r,Vi.exports.isEmpty=n,Vi.exports.isPlainObject=o,Vi.exports.getValue=e}).call(pk)});var aE=v((mk,gk)=>{(function(){var t;gk.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(r,n){return!0},e.prototype.createDocumentType=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(mk)});var wk=v((yk,Dk)=>{(function(){var t;Dk.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(yk)});var vk=v((Ek,bk)=>{(function(){var t;bk.exports=t=(function(){function e(r){this.arr=r||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(r){return this.arr[r]||null},e.prototype.contains=function(r){return this.arr.indexOf(r)!==-1},e})()}).call(Ek)});var Sk=v((_k,Ck)=>{(function(){var t,e,r;e=wk(),r=vk(),Ck.exports=t=(function(){function n(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=i=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},n.prototype.canSetParameter=function(i,s){return!0},n.prototype.setParameter=function(i,s){return s!=null?this.params[i]=s:delete this.params[i]},n})()}).call(_k)});var _t=v((Ak,Ok)=>{(function(){Ok.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(Ak)});var uE=v((xk,Tk)=>{(function(){var t,e,r;t=_t(),r=Fr(),Tk.exports=e=(function(){function n(i,s,o){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),s==null)throw new Error("Missing attribute name. "+this.debugInfo(s));this.name=this.stringify.name(s),this.value=this.stringify.attValue(o),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},n.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},n})()}).call(xk)});var Fd=v((Ik,Fk)=>{(function(){var t;Fk.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(r){return this.nodes[r]},e.prototype.setNamedItem=function(r){var n;return n=this.nodes[r.nodeName],this.nodes[r.nodeName]=r,n||null},e.prototype.removeNamedItem=function(r){var n;return n=this.nodes[r],delete this.nodes[r],n||null},e.prototype.item=function(r){return this.nodes[Object.keys(this.nodes)[r]]||null},e.prototype.getNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(Ik)});var Pd=v((Pk,Rk)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Pn(),a=u.isObject,o=u.isFunction,s=u.getValue,i=Fr(),t=_t(),e=uE(),n=Fd(),Rk.exports=r=(function(h){c(d,h);function d(f,m,y){var E,C,A,p;if(d.__super__.constructor.call(this,f),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,y!=null&&this.attribute(y),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(p=f.children,C=0,A=p.length;C<A;C++)if(E=p[C],E.type===t.DocType){E.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,m,y,E;y=Object.create(this),y.isRoot&&(y.documentObject=null),y.attribs={},E=this.attribs;for(m in E)l.call(E,m)&&(f=E[m],y.attribs[m]=f.clone());return y.children=[],this.children.forEach(function(C){var A;return A=C.clone(),A.parent=y,y.children.push(A)}),y},d.prototype.attribute=function(f,m){var y,E;if(f!=null&&(f=s(f)),a(f))for(y in f)l.call(f,y)&&(E=f[y],this.attribute(y,E));else o(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[f]=new e(this,f,""):m!=null&&(this.attribs[f]=new e(this,f,m));return this},d.prototype.removeAttribute=function(f){var m,y,E;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(y=0,E=f.length;y<E;y++)m=f[y],delete this.attribs[m];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,m){return this.attribute(f,m)},d.prototype.a=function(f,m){return this.attribute(f,m)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,m){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:m},d.prototype.setIdAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var m,y,E;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(m=y=0,E=this.attribs.length-1;0<=E?y<=E:y>=E;m=0<=E?++y:--y)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(Pk)});var Ic=v((kk,Nk)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=Fr(),Nk.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(o,a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(o){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},s})(e)}).call(kk)});var Rd=v(($k,Lk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),r=Ic(),Lk.exports=e=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.cdata(this,this.options.writer.filterOptions(a))},o})(r)}).call($k)});var kd=v((jk,Bk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),Bk.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.comment(this,this.options.writer.filterOptions(a))},o})(e)}).call(jk)});var Nd=v((Mk,qk)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Pn().isObject,r=Fr(),t=_t(),qk.exports=e=(function(o){i(a,o);function a(u,c,l,h){var d;a.__super__.constructor.call(this,u),n(c)&&(d=c,c=d.version,l=d.encoding,h=d.standalone),c||(c="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(c),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),h!=null&&(this.standalone=this.stringify.xmlStandalone(h))}return a.prototype.toString=function(u){return this.options.writer.declaration(this,this.options.writer.filterOptions(u))},a})(r)}).call(Mk)});var $d=v((Uk,Hk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=_t(),Hk.exports=e=(function(s){n(o,s);function o(a,u,c,l,h,d){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(u));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(u));if(!h)throw new Error("Missing DTD attribute default. "+this.debugInfo(u));if(h.indexOf("#")!==0&&(h="#"+h),!h.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(u));if(d&&!h.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(u));this.elementName=this.stringify.name(u),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(l),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=h}return o.prototype.toString=function(a){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(a))},o})(r)}).call(Uk)});var Ld=v((Vk,zk)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Pn().isObject,r=Fr(),t=_t(),zk.exports=e=(function(o){i(a,o);function a(u,c,l,h){if(a.__super__.constructor.call(this,u),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(h==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!c,this.name=this.stringify.name(l),this.type=t.EntityDeclaration,!n(h))this.value=this.stringify.dtdEntityValue(h),this.internal=!0;else{if(!h.pubID&&!h.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(h.pubID&&!h.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,h.pubID!=null&&(this.pubID=this.stringify.dtdPubID(h.pubID)),h.sysID!=null&&(this.sysID=this.stringify.dtdSysID(h.sysID)),h.nData!=null&&(this.nData=this.stringify.dtdNData(h.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(a.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return null}}),a.prototype.toString=function(u){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(u))},a})(r)}).call(Vk)});var jd=v((Kk,Gk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=_t(),Gk.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(u),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return o.prototype.toString=function(a){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(a))},o})(r)}).call(Kk)});var Bd=v((Wk,Xk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=_t(),Xk.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD notation name. "+this.debugInfo(u));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(u));this.name=this.stringify.name(u),this.type=t.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(a){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(a))},o})(r)}).call(Wk)});var Md=v((Yk,Jk)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Pn().isObject,a=Fr(),t=_t(),e=$d(),n=Ld(),r=jd(),i=Bd(),o=Fd(),Jk.exports=s=(function(h){c(d,h);function d(f,m,y){var E,C,A,p,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,C=0,A=p.length;C<A;C++)if(E=p[C],E.type===t.Element){this.name=E.name;break}}this.documentObject=f,u(m)&&(D=m,m=D.pubID,y=D.sysID),y==null&&(w=[m,y],y=w[0],m=w[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),y!=null&&(this.sysID=this.stringify.dtdSysID(y))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,m,y,E,C;for(E={},C=this.children,m=0,y=C.length;m<y;m++)f=C[m],f.type===t.EntityDeclaration&&!f.pe&&(E[f.name]=f);return new o(E)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,y,E,C;for(E={},C=this.children,m=0,y=C.length;m<y;m++)f=C[m],f.type===t.NotationDeclaration&&(E[f.name]=f);return new o(E)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,m){var y;return y=new r(this,f,m),this.children.push(y),this},d.prototype.attList=function(f,m,y,E,C){var A;return A=new e(this,f,m,y,E,C),this.children.push(A),this},d.prototype.entity=function(f,m){var y;return y=new n(this,!1,f,m),this.children.push(y),this},d.prototype.pEntity=function(f,m){var y;return y=new n(this,!0,f,m),this.children.push(y),this},d.prototype.notation=function(f,m){var y;return y=new i(this,f,m),this.children.push(y),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,m){return this.element(f,m)},d.prototype.att=function(f,m,y,E,C){return this.attList(f,m,y,E,C)},d.prototype.ent=function(f,m){return this.entity(f,m)},d.prototype.pent=function(f,m){return this.pEntity(f,m)},d.prototype.not=function(f,m){return this.notation(f,m)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d})(a)}).call(Yk)});var qd=v((Zk,Qk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Fr(),Qk.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.raw(this,this.options.writer.filterOptions(a))},o})(e)}).call(Zk)});var Ud=v((eN,tN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),tN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(u)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var a,u,c;for(c="",u=this.previousSibling;u;)c=u.data+c,u=u.previousSibling;for(c+=this.data,a=this.nextSibling;a;)c=c+a.data,a=a.nextSibling;return c}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.text(this,this.options.writer.filterOptions(a))},o.prototype.splitText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o})(e)}).call(eN)});var Hd=v((rN,nN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),nN.exports=r=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(u),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(a))},o.prototype.isEqualNode=function(a){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.target!==this.target)},o})(e)}).call(rN)});var cE=v((iN,sN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Fr(),t=_t(),sN.exports=e=(function(s){n(o,s);function o(a){o.__super__.constructor.call(this,a),this.type=t.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return""},o})(r)}).call(iN)});var uN=v((oN,aN)=>{(function(){var t;aN.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(r){return this.nodes[r]||null},e})()}).call(oN)});var fN=v((cN,lN)=>{(function(){lN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(cN)});var Fr=v((hN,dN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,C,A,p={}.hasOwnProperty;A=Pn(),C=A.isObject,E=A.isFunction,y=A.isEmpty,m=A.getValue,a=null,r=null,n=null,i=null,s=null,d=null,f=null,h=null,o=null,e=null,l=null,u=null,t=null,dN.exports=c=(function(){function D(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Pd(),r=Rd(),n=kd(),i=Nd(),s=Md(),d=qd(),f=Ud(),h=Hd(),o=cE(),e=_t(),l=uN(),u=Fd(),t=fN())}return Object.defineProperty(D.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(D.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(D.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(D.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(D.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(D.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(D.prototype,"previousSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w-1]||null}}),Object.defineProperty(D.prototype,"nextSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w+1]||null}}),Object.defineProperty(D.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(D.prototype,"textContent",{get:function(){var w,_,P,b,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",b=this.children,_=0,P=b.length;_<P;_++)w=b[_],w.textContent&&(k+=w.textContent);return k}else return null},set:function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),D.prototype.setParent=function(w){var _,P,b,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],P=0,b=k.length;P<b;P++)_=k[P],R.push(_.setParent(this));return R},D.prototype.element=function(w,_,P){var b,k,R,I,j,U,K,L,S,T,F;if(U=null,_===null&&P==null&&(S=[{},null],_=S[0],P=S[1]),_==null&&(_={}),_=m(_),C(_)||(T=[_,P],P=T[0],_=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(R=0,K=w.length;R<K;R++)k=w[R],U=this.element(k);else if(E(w))U=this.element(w.apply());else if(C(w)){for(j in w)if(p.call(w,j))if(F=w[j],E(F)&&(F=F.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&j.indexOf(this.stringify.convertAttKey)===0)U=this.attribute(j.substr(this.stringify.convertAttKey.length),F);else if(!this.options.separateArrayItems&&Array.isArray(F)&&y(F))U=this.dummy();else if(C(F)&&y(F))U=this.element(j);else if(!this.options.keepNullNodes&&F==null)U=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(F))for(I=0,L=F.length;I<L;I++)k=F[I],b={},b[j]=k,U=this.element(b);else C(F)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?U=this.element(F):(U=this.element(j),U.element(F)):U=this.element(j,F)}else!this.options.keepNullNodes&&P===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?U=this.text(P):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(P):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(P):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?U=this.raw(P):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(w.substr(this.stringify.convertPIKey.length),P):U=this.node(w,_,P);if(U==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return U},D.prototype.insertBefore=function(w,_,P){var b,k,R,I,j;if(w?.type)return R=w,I=_,R.setParent(this),I?(k=children.indexOf(I),j=children.splice(k),children.push(R),Array.prototype.push.apply(children,j)):children.push(R),R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),j=this.parent.children.splice(k),b=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,j),b},D.prototype.insertAfter=function(w,_,P){var b,k,R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),R=this.parent.children.splice(k+1),b=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,R),b},D.prototype.remove=function(){var w,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return w=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[w,w-w+1].concat(_=[])),this.parent},D.prototype.node=function(w,_,P){var b,k;return w!=null&&(w=m(w)),_||(_={}),_=m(_),C(_)||(k=[_,P],P=k[0],_=k[1]),b=new a(this,w,_),P!=null&&b.text(P),this.children.push(b),b},D.prototype.text=function(w){var _;return C(w)&&this.element(w),_=new f(this,w),this.children.push(_),this},D.prototype.cdata=function(w){var _;return _=new r(this,w),this.children.push(_),this},D.prototype.comment=function(w){var _;return _=new n(this,w),this.children.push(_),this},D.prototype.commentBefore=function(w){var _,P,b;return P=this.parent.children.indexOf(this),b=this.parent.children.splice(P),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.commentAfter=function(w){var _,P,b;return P=this.parent.children.indexOf(this),b=this.parent.children.splice(P+1),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.raw=function(w){var _;return _=new d(this,w),this.children.push(_),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,_){var P,b,k,R,I;if(w!=null&&(w=m(w)),_!=null&&(_=m(_)),Array.isArray(w))for(R=0,I=w.length;R<I;R++)P=w[R],this.instruction(P);else if(C(w))for(P in w)p.call(w,P)&&(b=w[P],this.instruction(P,b));else E(_)&&(_=_.apply()),k=new h(this,w,_),this.children.push(k);return this},D.prototype.instructionBefore=function(w,_){var P,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,_){var P,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b+1),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,_,P){var b,k;return b=this.document(),k=new i(b,w,_,P),b.children.length===0?b.children.unshift(k):b.children[0].type===e.Declaration?b.children[0]=k:b.children.unshift(k),b.root()||b},D.prototype.dtd=function(w,_){var P,b,k,R,I,j,U,K,L,S;for(b=this.document(),k=new s(b,w,_),L=b.children,R=I=0,U=L.length;I<U;R=++I)if(P=L[R],P.type===e.DocType)return b.children[R]=k,k;for(S=b.children,R=j=0,K=S.length;j<K;R=++j)if(P=S[R],P.isRoot)return b.children.splice(R,0,k),k;return b.children.push(k),k},D.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},D.prototype.root=function(){var w;for(w=this;w;){if(w.type===e.Document)return w.rootObject;if(w.isRoot)return w;w=w.parent}},D.prototype.document=function(){var w;for(w=this;w;){if(w.type===e.Document)return w;w=w.parent}},D.prototype.end=function(w){return this.document().end(w)},D.prototype.prev=function(){var w;if(w=this.parent.children.indexOf(this),w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},D.prototype.next=function(){var w;if(w=this.parent.children.indexOf(this),w===-1||w===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[w+1]},D.prototype.importDocument=function(w){var _;return _=w.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},D.prototype.debugInfo=function(w){var _,P;return w=w||this.name,w==null&&!((_=this.parent)!=null&&_.name)?"":w==null?"parent: <"+this.parent.name+">":(P=this.parent)!=null&&P.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,_,P){return this.element(w,_,P)},D.prototype.nod=function(w,_,P){return this.node(w,_,P)},D.prototype.txt=function(w){return this.text(w)},D.prototype.dat=function(w){return this.cdata(w)},D.prototype.com=function(w){return this.comment(w)},D.prototype.ins=function(w,_){return this.instruction(w,_)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,_,P){return this.declaration(w,_,P)},D.prototype.e=function(w,_,P){return this.element(w,_,P)},D.prototype.n=function(w,_,P){return this.node(w,_,P)},D.prototype.t=function(w){return this.text(w)},D.prototype.d=function(w){return this.cdata(w)},D.prototype.c=function(w){return this.comment(w)},D.prototype.r=function(w){return this.raw(w)},D.prototype.i=function(w,_){return this.instruction(w,_)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.appendChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.hasChildNodes=function(){return this.children.length!==0},D.prototype.cloneNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isSupported=function(w,_){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var _,P;return _=this,_===w?0:this.document()!==w.document()?(P=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?P|=t.Preceding:P|=t.Following,P):_.isAncestor(w)?t.Contains|t.Preceding:_.isDescendant(w)?t.Contains|t.Following:_.isPreceding(w)?t.Preceding:t.Following},D.prototype.isSameNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupPrefix=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isDefaultNamespace=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupNamespaceURI=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isEqualNode=function(w){var _,P,b;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(_=P=0,b=this.children.length-1;0<=b?P<=b:P>=b;_=0<=b?++P:--P)if(!this.children[_].isEqualNode(w.children[_]))return!1;return!0},D.prototype.getFeature=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,_,P){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getUserData=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.contains=function(w){return w?w===this||this.isDescendant(w):!1},D.prototype.isDescendant=function(w){var _,P,b,k,R;for(R=this.children,b=0,k=R.length;b<k;b++)if(_=R[b],w===_||(P=_.isDescendant(w),P))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_<P},D.prototype.isFollowing=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_>P},D.prototype.treePosition=function(w){var _,P;return P=0,_=!1,this.foreachTreeNode(this.document(),function(b){if(P++,!_&&b===w)return _=!0}),_?P:-1},D.prototype.foreachTreeNode=function(w,_){var P,b,k,R,I;for(w||(w=this.document()),R=w.children,b=0,k=R.length;b<k;b++){if(P=R[b],I=_(P))return I;if(I=this.foreachTreeNode(P,_),I)return I}},D})()}).call(hN)});var lE=v((pN,mN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;mN.exports=t=(function(){function n(i){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),o=i.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return n.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},n.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},n.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},n.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},n.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},n.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},n.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},n.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},n.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var s,o;if(this.options.noValidation)return i;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s))throw new Error("Invalid character in string: "+i+" at index "+o.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s)))throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.assertLegalName=function(i){var s;if(this.options.noValidation)return i;if(this.assertLegalChar(i),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!i.match(s))throw new Error("Invalid character in name");return i},n.prototype.textEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n})()}).call(pN)});var Fc=v((gN,yN)=>{(function(){yN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(gN)});var fE=v((DN,wN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,C={}.hasOwnProperty;E=Pn().assign,t=_t(),u=Nd(),c=Md(),r=Rd(),n=kd(),h=Pd(),f=qd(),m=Ud(),d=Hd(),l=cE(),i=$d(),s=jd(),o=Ld(),a=Bd(),e=Fc(),wN.exports=y=(function(){function A(p){var D,w,_;p||(p={}),this.options=p,w=p.writer||{};for(D in w)C.call(w,D)&&(_=w[D],this["_"+D]=this[D],this[D]=_)}return A.prototype.filterOptions=function(p){var D,w,_,P,b,k,R,I;return p||(p={}),p=E({},this.options,p),D={writer:this},D.pretty=p.pretty||!1,D.allowEmpty=p.allowEmpty||!1,D.indent=(w=p.indent)!=null?w:" ",D.newline=(_=p.newline)!=null?_:`
185
- `,D.offset=(P=p.offset)!=null?P:0,D.dontPrettyTextNodes=(b=(k=p.dontPrettyTextNodes)!=null?k:p.dontprettytextnodes)!=null?b:0,D.spaceBeforeSlash=(R=(I=p.spaceBeforeSlash)!=null?I:p.spacebeforeslash)!=null?R:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(p,D,w){var _;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(_=(w||0)+D.offset+1,_>0)?new Array(_).join(D.indent):""},A.prototype.endline=function(p,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(p,D,w){var _;return this.openAttribute(p,D,w),_=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),_},A.prototype.cdata=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.comment=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.declaration=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,_+=' version="'+p.version+'"',p.encoding!=null&&(_+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(_+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.docType=function(p,D,w){var _,P,b,k,R;if(w||(w=0),this.openNode(p,D,w),D.state=e.OpenTag,k=this.indent(p,D,w),k+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?k+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(k+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(k+=" [",k+=this.endline(p,D,w),D.state=e.InsideTag,R=p.children,P=0,b=R.length;P<b;P++)_=R[P],k+=this.writeChildNode(_,D,w+1);D.state=e.CloseTag,k+="]"}return D.state=e.CloseTag,k+=D.spaceBeforeSlash+">",k+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),k},A.prototype.element=function(p,D,w){var _,P,b,k,R,I,j,U,K,L,S,T,F,$;w||(w=0),L=!1,S="",this.openNode(p,D,w),D.state=e.OpenTag,S+=this.indent(p,D,w)+"<"+p.name,T=p.attribs;for(K in T)C.call(T,K)&&(_=T[K],S+=this.attribute(_,D,w));if(b=p.children.length,k=b===0?null:p.children[0],b===0||p.children.every(function(M){return(M.type===t.Text||M.type===t.Raw)&&M.value===""}))D.allowEmpty?(S+=">",D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w)):(D.state=e.CloseTag,S+=D.spaceBeforeSlash+"/>"+this.endline(p,D,w));else if(D.pretty&&b===1&&(k.type===t.Text||k.type===t.Raw)&&k.value!=null)S+=">",D.state=e.InsideTag,D.suppressPrettyCount++,L=!0,S+=this.writeChildNode(k,D,w+1),D.suppressPrettyCount--,L=!1,D.state=e.CloseTag,S+="</"+p.name+">"+this.endline(p,D,w);else{if(D.dontPrettyTextNodes){for(F=p.children,R=0,j=F.length;R<j;R++)if(P=F[R],(P.type===t.Text||P.type===t.Raw)&&P.value!=null){D.suppressPrettyCount++,L=!0;break}}for(S+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,I=0,U=$.length;I<U;I++)P=$[I],S+=this.writeChildNode(P,D,w+1);D.state=e.CloseTag,S+=this.indent(p,D,w)+"</"+p.name+">",L&&D.suppressPrettyCount--,S+=this.endline(p,D,w),D.state=e.None}return this.closeNode(p,D,w),S},A.prototype.writeChildNode=function(p,D,w){switch(p.type){case t.CData:return this.cdata(p,D,w);case t.Comment:return this.comment(p,D,w);case t.Element:return this.element(p,D,w);case t.Raw:return this.raw(p,D,w);case t.Text:return this.text(p,D,w);case t.ProcessingInstruction:return this.processingInstruction(p,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,D,w);case t.DocType:return this.docType(p,D,w);case t.AttributeDeclaration:return this.dtdAttList(p,D,w);case t.ElementDeclaration:return this.dtdElement(p,D,w);case t.EntityDeclaration:return this.dtdEntity(p,D,w);case t.NotationDeclaration:return this.dtdNotation(p,D,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?",D.state=e.InsideTag,_+=p.target,p.value&&(_+=" "+p.value),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.raw=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.text=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdAttList=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,_+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(_+=" "+p.defaultValueType),p.defaultValue&&(_+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdElement=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,_+=" "+p.name+" "+p.value,D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdEntity=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(_+=" %"),_+=" "+p.name,p.value?_+=' "'+p.value+'"':(p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),p.nData&&(_+=" NDATA "+p.nData)),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdNotation=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,_+=" "+p.name,p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?_+=' PUBLIC "'+p.pubID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.openNode=function(p,D,w){},A.prototype.closeNode=function(p,D,w){},A.prototype.openAttribute=function(p,D,w){},A.prototype.closeAttribute=function(p,D,w){},A})()}).call(DN)});var Vd=v((EN,bN)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=fE(),bN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(EN)});var hE=v((vN,_N)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=Pn().isPlainObject,r=aE(),e=Sk(),i=Fr(),t=_t(),o=lE(),s=Vd(),_N.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,y;for(y=this.children,f=0,m=y.length;f<m;f++)if(d=y[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(vN)});var AN=v((CN,SN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,C,A,p,D,w,_,P,b={}.hasOwnProperty;P=Pn(),w=P.isObject,D=P.isFunction,_=P.isPlainObject,p=P.getValue,t=_t(),h=hE(),f=Pd(),n=Rd(),i=kd(),y=qd(),A=Ud(),m=Hd(),c=Nd(),l=Md(),s=$d(),a=Ld(),o=jd(),u=Bd(),r=uE(),C=lE(),E=Vd(),e=Fc(),SN.exports=d=(function(){function k(R,I,j){var U;this.name="?xml",this.type=t.Document,R||(R={}),U={},R.writer?_(R.writer)&&(U=R.writer,R.writer=new E):R.writer=new E,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new C(R),this.onDataCallback=I||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(R){var I,j,U,K,L,S,T,F;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:U={},T=R.attribs;for(j in T)b.call(T,j)&&(I=T[j],U[j]=I.value);this.node(R.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(R.value);break;case t.Text:this.text(R.value);break;case t.ProcessingInstruction:this.instruction(R.target,R.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+R.constructor.name)}for(F=R.children,L=0,S=F.length;L<S;L++)K=F[L],this.createChildNode(K),K.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,j){var U;if(R==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(R));return this.openCurrent(),R=p(R),I==null&&(I={}),I=p(I),w(I)||(U=[I,j],j=U[0],I=U[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},k.prototype.element=function(R,I,j){var U,K,L,S,T,F;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(R)||w(R)||D(R))for(S=this.options.noValidation,this.options.noValidation=!0,F=new h(this.options).element("TEMP_ROOT"),F.element(R),this.options.noValidation=S,T=F.children,K=0,L=T.length;K<L;K++)U=T[K],this.createChildNode(U),U.type===t.Element&&this.up();else this.node(R,I,j);return this},k.prototype.attribute=function(R,I){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(R));if(R!=null&&(R=p(R)),w(R))for(j in R)b.call(R,j)&&(U=R[j],this.attribute(j,U));else D(I)&&(I=I.apply()),this.options.keepNullAttributes&&I==null?this.currentNode.attribs[R]=new r(this,R,""):I!=null&&(this.currentNode.attribs[R]=new r(this,R,I));return this},k.prototype.text=function(R){var I;return this.openCurrent(),I=new A(this,R),this.onData(this.writer.text(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(R){var I;return this.openCurrent(),I=new n(this,R),this.onData(this.writer.cdata(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(R){var I;return this.openCurrent(),I=new i(this,R),this.onData(this.writer.comment(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(R){var I;return this.openCurrent(),I=new y(this,R),this.onData(this.writer.raw(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(R,I){var j,U,K,L,S;if(this.openCurrent(),R!=null&&(R=p(R)),I!=null&&(I=p(I)),Array.isArray(R))for(j=0,L=R.length;j<L;j++)U=R[j],this.instruction(U);else if(w(R))for(U in R)b.call(R,U)&&(K=R[U],this.instruction(U,K));else D(I)&&(I=I.apply()),S=new m(this,R,I),this.onData(this.writer.processingInstruction(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(R,I,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,R,I,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,j){if(this.openCurrent(),R==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,I,j),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var j;return this.openCurrent(),j=new o(this,R,I),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,j,U,K){var L;return this.openCurrent(),L=new s(this,R,I,j,U,K),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var j;return this.openCurrent(),j=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var j;return this.openCurrent(),j=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var j;return this.openCurrent(),j=new u(this,R,I),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(R){var I,j,U,K;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),j="",R.type===t.Element){this.writerOptions.state=e.OpenTag,j=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,K=R.attribs;for(U in K)b.call(K,U)&&(I=K[U],j+=this.writer.attribute(I,this.writerOptions,this.currentLevel));j+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,j=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?j+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(j+=' SYSTEM "'+R.sysID+'"'),R.children?(j+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,j+=">"),j+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),R.isOpen=!0}},k.prototype.closeNode=function(R){var I;if(!R.isClosed)return I="",this.writerOptions.state=e.CloseTag,R.type===t.Element?I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"</"+R.name+">"+this.writer.endline(R,this.writerOptions,this.currentLevel):I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(I,this.currentLevel),R.isClosed=!0},k.prototype.onData=function(R,I){return this.documentStarted=!0,this.onDataCallback(R,I+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(R){return R==null?"":"node: <"+R+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(R,I,j){return this.node(R,I,j)},k.prototype.txt=function(R){return this.text(R)},k.prototype.dat=function(R){return this.cdata(R)},k.prototype.com=function(R){return this.comment(R)},k.prototype.ins=function(R,I){return this.instruction(R,I)},k.prototype.dec=function(R,I,j){return this.declaration(R,I,j)},k.prototype.dtd=function(R,I,j){return this.doctype(R,I,j)},k.prototype.e=function(R,I,j){return this.element(R,I,j)},k.prototype.n=function(R,I,j){return this.node(R,I,j)},k.prototype.t=function(R){return this.text(R)},k.prototype.d=function(R){return this.cdata(R)},k.prototype.c=function(R){return this.comment(R)},k.prototype.r=function(R){return this.raw(R)},k.prototype.i=function(R,I){return this.instruction(R,I)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(R,I){return this.entity(R,I)},k.prototype.pent=function(R,I){return this.pEntity(R,I)},k.prototype.not=function(R,I){return this.notation(R,I)},k})()}).call(CN)});var TN=v((ON,xN)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;t=_t(),n=fE(),e=Fc(),xN.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,y,E,C,A;for(E=u.children,h=d=0,m=E.length;d<m;h=++d)l=E[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),C=u.children,A=[],f=0,y=C.length;f<y;f++)l=C[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,y,E,C,A,p,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(C in p)s.call(p,C)&&(h=p[C],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,D=u.children,y=0,E=D.length;y<E;y++)d=D[y],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(ON)});var FN=v((IN,zi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Pn(),a=c.assign,u=c.isFunction,r=aE(),n=hE(),i=AN(),o=Vd(),s=TN(),t=_t(),e=Fc(),zi.exports.create=function(l,h,d,f){var m,y;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),y=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),y},zi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},zi.exports.stringWriter=function(l){return new o(l)},zi.exports.streamWriter=function(l,h){return new s(l,h)},zi.exports.implementation=new r,zi.exports.nodeType=t,zi.exports.writerState=e}).call(IN)});var PN=v(dE=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=FN(),e=Id().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},dE.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,y){var E,C,A,p,D,w;if(typeof y!="object")f.options.cdata&&n(y)?m.raw(i(y)):m.txt(y);else if(Array.isArray(y)){for(p in y)if(s.call(y,p)){C=y[p];for(D in C)A=C[D],m=l(m.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(C=y[D],D===u){if(typeof C=="object")for(E in C)w=C[E],m=m.att(E,w)}else if(D===c)f.options.cdata&&n(C)?m=m.raw(i(C)):m=m.txt(C);else if(Array.isArray(C))for(p in C)s.call(C,p)&&(A=C[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(D).raw(i(A)).up():m=m.ele(D,A).up():m=l(m.ele(D),A).up());else typeof C=="object"?m=l(m.ele(D),C).up():typeof C=="string"&&f.options.cdata&&n(C)?m=m.ele(D).raw(i(C)).up():(C==null&&(C=""),m=m.ele(D,C.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(dE)});var RN=v(zd=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var H=this;i(H),H.q=H.c="",H.bufferCheckPosition=t.MAX_BUFFER_LENGTH,H.opt=O||{},H.opt.lowercase=H.opt.lowercase||H.opt.lowercasetags,H.looseCase=H.opt.lowercase?"toLowerCase":"toUpperCase",H.tags=[],H.closed=H.closedRoot=H.sawRoot=!1,H.tag=H.error=null,H.strict=!!x,H.noscript=!!(x||H.opt.noscript),H.state=b.BEGIN,H.strictEntities=H.opt.strictEntities,H.ENTITIES=H.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),H.attribList=[],H.opt.xmlns&&(H.ns=Object.create(m)),H.opt.unquotedAttributeValues===void 0&&(H.opt.unquotedAttributeValues=!x),H.trackPosition=H.opt.position!==!1,H.trackPosition&&(H.position=H.line=H.column=0),R(H,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var H=new O;return H}),Object.keys||(Object.keys=function(x){var O=[];for(var H in x)x.hasOwnProperty(H)&&O.push(H);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),H=0,N=0,ne=e.length;N<ne;N++){var z=x[e[N]].length;if(z>O)switch(e[N]){case"textNode":j(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:K(x,"Max buffer length exceeded: "+e[N])}H=Math.max(H,z)}var ie=t.MAX_BUFFER_LENGTH-H;x.bufferCheckPosition=ie+x.position}function i(x){for(var O=0,H=e.length;O<H;O++)x[e[O]]=""}function s(x){j(x),x.cdata!==""&&(I(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(I(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:ae,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var H=this;this._parser.onend=function(){H.emit("end")},this._parser.onerror=function(N){H.emit("error",N),H._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(H,"on"+N,{get:function(){return H._parser["on"+N]},set:function(ne){if(!ne)return H.removeAllListeners(N),H._parser["on"+N]=ne,ne;H.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var H=this;return!H._parser["on"+x]&&a.indexOf(x)!==-1&&(H._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),H.emit.apply(H,N)}),o.prototype.on.call(H,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,E=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,C=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
184
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(oE)});var Pn=v((pk,Vi)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,m;if(m=arguments[0],f=2<=arguments.length?a.call(arguments,1):[],i(Object.assign))Object.assign.apply(null,arguments);else for(c=0,h=f.length;c<h;c++)if(d=f[c],d!=null)for(l in d)u.call(d,l)&&(m[l]=d[l]);return m},i=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},s=function(c){var l;return!!c&&((l=typeof c)=="function"||l==="object")},r=function(c){return i(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},n=function(c){var l;if(r(c))return!c.length;for(l in c)if(u.call(c,l))return!1;return!0},o=function(c){var l,h;return s(c)&&(h=Object.getPrototypeOf(c))&&(l=h.constructor)&&typeof l=="function"&&l instanceof l&&Function.prototype.toString.call(l)===Function.prototype.toString.call(Object)},e=function(c){return i(c.valueOf)?c.valueOf():c},Vi.exports.assign=t,Vi.exports.isFunction=i,Vi.exports.isObject=s,Vi.exports.isArray=r,Vi.exports.isEmpty=n,Vi.exports.isPlainObject=o,Vi.exports.getValue=e}).call(pk)});var aE=v((mk,gk)=>{(function(){var t;gk.exports=t=(function(){function e(){}return e.prototype.hasFeature=function(r,n){return!0},e.prototype.createDocumentType=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(r,n,i){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(mk)});var wk=v((yk,Dk)=>{(function(){var t;Dk.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(yk)});var vk=v((Ek,bk)=>{(function(){var t;bk.exports=t=(function(){function e(r){this.arr=r||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(r){return this.arr[r]||null},e.prototype.contains=function(r){return this.arr.indexOf(r)!==-1},e})()}).call(Ek)});var Sk=v((_k,Ck)=>{(function(){var t,e,r;e=wk(),r=vk(),Ck.exports=t=(function(){function n(){var i;this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=i=Object.create(this.defaultParams)}return Object.defineProperty(n.prototype,"parameterNames",{get:function(){return new r(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(i){return this.params.hasOwnProperty(i)?this.params[i]:null},n.prototype.canSetParameter=function(i,s){return!0},n.prototype.setParameter=function(i,s){return s!=null?this.params[i]=s:delete this.params[i]},n})()}).call(_k)});var _t=v((Ak,Ok)=>{(function(){Ok.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(Ak)});var uE=v((xk,Tk)=>{(function(){var t,e,r;t=_t(),r=Pr(),Tk.exports=e=(function(){function n(i,s,o){if(this.parent=i,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),s==null)throw new Error("Missing attribute name. "+this.debugInfo(s));this.name=this.stringify.name(s),this.value=this.stringify.attValue(o),this.type=t.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(i){return this.options.writer.attribute(this,this.options.writer.filterOptions(i))},n.prototype.debugInfo=function(i){return i=i||this.name,i==null?"parent: <"+this.parent.name+">":"attribute: {"+i+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(i){return!(i.namespaceURI!==this.namespaceURI||i.prefix!==this.prefix||i.localName!==this.localName||i.value!==this.value)},n})()}).call(xk)});var Fd=v((Ik,Fk)=>{(function(){var t;Fk.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(r){return this.nodes[r]},e.prototype.setNamedItem=function(r){var n;return n=this.nodes[r.nodeName],this.nodes[r.nodeName]=r,n||null},e.prototype.removeNamedItem=function(r){var n;return n=this.nodes[r],delete this.nodes[r],n||null},e.prototype.item=function(r){return this.nodes[Object.keys(this.nodes)[r]]||null},e.prototype.getNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(r){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(r,n){throw new Error("This DOM method is not implemented.")},e})()}).call(Ik)});var Pd=v((Pk,Rk)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Pn(),a=u.isObject,o=u.isFunction,s=u.getValue,i=Pr(),t=_t(),e=uE(),n=Fd(),Rk.exports=r=(function(h){c(d,h);function d(f,m,y){var E,S,A,p;if(d.__super__.constructor.call(this,f),m==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(m),this.type=t.Element,this.attribs={},this.schemaTypeInfo=null,y!=null&&this.attribute(y),f.type===t.Document&&(this.isRoot=!0,this.documentObject=f,f.rootObject=this,f.children)){for(p=f.children,S=0,A=p.length;S<A;S++)if(E=p[S],E.type===t.DocType){E.name=this.name;break}}}return Object.defineProperty(d.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(d.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(d.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(d.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(d.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),d.prototype.clone=function(){var f,m,y,E;y=Object.create(this),y.isRoot&&(y.documentObject=null),y.attribs={},E=this.attribs;for(m in E)l.call(E,m)&&(f=E[m],y.attribs[m]=f.clone());return y.children=[],this.children.forEach(function(S){var A;return A=S.clone(),A.parent=y,y.children.push(A)}),y},d.prototype.attribute=function(f,m){var y,E;if(f!=null&&(f=s(f)),a(f))for(y in f)l.call(f,y)&&(E=f[y],this.attribute(y,E));else o(m)&&(m=m.apply()),this.options.keepNullAttributes&&m==null?this.attribs[f]=new e(this,f,""):m!=null&&(this.attribs[f]=new e(this,f,m));return this},d.prototype.removeAttribute=function(f){var m,y,E;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(y=0,E=f.length;y<E;y++)m=f[y],delete this.attribs[m];else delete this.attribs[f];return this},d.prototype.toString=function(f){return this.options.writer.element(this,this.options.writer.filterOptions(f))},d.prototype.att=function(f,m){return this.attribute(f,m)},d.prototype.a=function(f,m){return this.attribute(f,m)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNode=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f]:null},d.prototype.setAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNodeNS=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.hasAttribute=function(f){return this.attribs.hasOwnProperty(f)},d.prototype.hasAttributeNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,m){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:m},d.prototype.setIdAttributeNS=function(f,m,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.isEqualNode=function(f){var m,y,E;if(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.namespaceURI!==this.namespaceURI||f.prefix!==this.prefix||f.localName!==this.localName||f.attribs.length!==this.attribs.length)return!1;for(m=y=0,E=this.attribs.length-1;0<=E?y<=E:y>=E;m=0<=E?++y:--y)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(Pk)});var Ic=v((kk,Nk)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=Pr(),Nk.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(o,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(o,a,u){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(o){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},s})(e)}).call(kk)});var Rd=v(($k,Lk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),r=Ic(),Lk.exports=e=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=t.CData,this.value=this.stringify.cdata(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.cdata(this,this.options.writer.filterOptions(a))},o})(r)}).call($k)});var kd=v((jk,Bk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),Bk.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=t.Comment,this.value=this.stringify.comment(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.comment(this,this.options.writer.filterOptions(a))},o})(e)}).call(jk)});var Nd=v((Mk,qk)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Pn().isObject,r=Pr(),t=_t(),qk.exports=e=(function(o){i(a,o);function a(u,c,l,h){var d;a.__super__.constructor.call(this,u),n(c)&&(d=c,c=d.version,l=d.encoding,h=d.standalone),c||(c="1.0"),this.type=t.Declaration,this.version=this.stringify.xmlVersion(c),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),h!=null&&(this.standalone=this.stringify.xmlStandalone(h))}return a.prototype.toString=function(u){return this.options.writer.declaration(this,this.options.writer.filterOptions(u))},a})(r)}).call(Mk)});var $d=v((Uk,Hk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Pr(),t=_t(),Hk.exports=e=(function(s){n(o,s);function o(a,u,c,l,h,d){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(u));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(u));if(!h)throw new Error("Missing DTD attribute default. "+this.debugInfo(u));if(h.indexOf("#")!==0&&(h="#"+h),!h.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(u));if(d&&!h.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(u));this.elementName=this.stringify.name(u),this.type=t.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(l),d&&(this.defaultValue=this.stringify.dtdAttDefault(d)),this.defaultValueType=h}return o.prototype.toString=function(a){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(a))},o})(r)}).call(Uk)});var Ld=v((Vk,zk)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;n=Pn().isObject,r=Pr(),t=_t(),zk.exports=e=(function(o){i(a,o);function a(u,c,l,h){if(a.__super__.constructor.call(this,u),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(h==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!c,this.name=this.stringify.name(l),this.type=t.EntityDeclaration,!n(h))this.value=this.stringify.dtdEntityValue(h),this.internal=!0;else{if(!h.pubID&&!h.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(h.pubID&&!h.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,h.pubID!=null&&(this.pubID=this.stringify.dtdPubID(h.pubID)),h.sysID!=null&&(this.sysID=this.stringify.dtdSysID(h.sysID)),h.nData!=null&&(this.nData=this.stringify.dtdNData(h.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(a.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(a.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(a.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(a.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(a.prototype,"xmlVersion",{get:function(){return null}}),a.prototype.toString=function(u){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(u))},a})(r)}).call(Vk)});var jd=v((Kk,Gk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Pr(),t=_t(),Gk.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(u),this.type=t.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return o.prototype.toString=function(a){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(a))},o})(r)}).call(Kk)});var Bd=v((Wk,Xk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Pr(),t=_t(),Xk.exports=e=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing DTD notation name. "+this.debugInfo(u));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(u));this.name=this.stringify.name(u),this.type=t.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(a){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(a))},o})(r)}).call(Wk)});var Md=v((Yk,Jk)=>{(function(){var t,e,r,n,i,s,o,a,u,c=function(h,d){for(var f in d)l.call(d,f)&&(h[f]=d[f]);function m(){this.constructor=h}return m.prototype=d.prototype,h.prototype=new m,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Pn().isObject,a=Pr(),t=_t(),e=$d(),n=Ld(),r=jd(),i=Bd(),o=Fd(),Jk.exports=s=(function(h){c(d,h);function d(f,m,y){var E,S,A,p,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,S=0,A=p.length;S<A;S++)if(E=p[S],E.type===t.Element){this.name=E.name;break}}this.documentObject=f,u(m)&&(D=m,m=D.pubID,y=D.sysID),y==null&&(w=[m,y],y=w[0],m=w[1]),m!=null&&(this.pubID=this.stringify.dtdPubID(m)),y!=null&&(this.sysID=this.stringify.dtdSysID(y))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,m,y,E,S;for(E={},S=this.children,m=0,y=S.length;m<y;m++)f=S[m],f.type===t.EntityDeclaration&&!f.pe&&(E[f.name]=f);return new o(E)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,y,E,S;for(E={},S=this.children,m=0,y=S.length;m<y;m++)f=S[m],f.type===t.NotationDeclaration&&(E[f.name]=f);return new o(E)}}),Object.defineProperty(d.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(d.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(d.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),d.prototype.element=function(f,m){var y;return y=new r(this,f,m),this.children.push(y),this},d.prototype.attList=function(f,m,y,E,S){var A;return A=new e(this,f,m,y,E,S),this.children.push(A),this},d.prototype.entity=function(f,m){var y;return y=new n(this,!1,f,m),this.children.push(y),this},d.prototype.pEntity=function(f,m){var y;return y=new n(this,!0,f,m),this.children.push(y),this},d.prototype.notation=function(f,m){var y;return y=new i(this,f,m),this.children.push(y),this},d.prototype.toString=function(f){return this.options.writer.docType(this,this.options.writer.filterOptions(f))},d.prototype.ele=function(f,m){return this.element(f,m)},d.prototype.att=function(f,m,y,E,S){return this.attList(f,m,y,E,S)},d.prototype.ent=function(f,m){return this.entity(f,m)},d.prototype.pent=function(f,m){return this.pEntity(f,m)},d.prototype.not=function(f,m){return this.notation(f,m)},d.prototype.up=function(){return this.root()||this.documentObject},d.prototype.isEqualNode=function(f){return!(!d.__super__.isEqualNode.apply(this,arguments).isEqualNode(f)||f.name!==this.name||f.publicId!==this.publicId||f.systemId!==this.systemId)},d})(a)}).call(Yk)});var qd=v((Zk,Qk)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Pr(),Qk.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=t.Raw,this.value=this.stringify.raw(u)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.raw(this,this.options.writer.filterOptions(a))},o})(e)}).call(Zk)});var Ud=v((eN,tN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),tN.exports=r=(function(s){n(o,s);function o(a,u){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=t.Text,this.value=this.stringify.text(u)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var a,u,c;for(c="",u=this.previousSibling;u;)c=u.data+c,u=u.previousSibling;for(c+=this.data,a=this.nextSibling;a;)c=c+a.data,a=a.nextSibling;return c}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.text(this,this.options.writer.filterOptions(a))},o.prototype.splitText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o})(e)}).call(eN)});var Hd=v((rN,nN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;t=_t(),e=Ic(),nN.exports=r=(function(s){n(o,s);function o(a,u,c){if(o.__super__.constructor.call(this,a),u==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=t.ProcessingInstruction,this.target=this.stringify.insTarget(u),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(a))},o.prototype.isEqualNode=function(a){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(a)||a.target!==this.target)},o})(e)}).call(rN)});var cE=v((iN,sN)=>{(function(){var t,e,r,n=function(s,o){for(var a in o)i.call(o,a)&&(s[a]=o[a]);function u(){this.constructor=s}return u.prototype=o.prototype,s.prototype=new u,s.__super__=o.prototype,s},i={}.hasOwnProperty;r=Pr(),t=_t(),sN.exports=e=(function(s){n(o,s);function o(a){o.__super__.constructor.call(this,a),this.type=t.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(a){return""},o})(r)}).call(iN)});var uN=v((oN,aN)=>{(function(){var t;aN.exports=t=(function(){function e(r){this.nodes=r}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(r){return this.nodes[r]||null},e})()}).call(oN)});var fN=v((cN,lN)=>{(function(){lN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(cN)});var Pr=v((hN,dN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,S,A,p={}.hasOwnProperty;A=Pn(),S=A.isObject,E=A.isFunction,y=A.isEmpty,m=A.getValue,a=null,r=null,n=null,i=null,s=null,d=null,f=null,h=null,o=null,e=null,l=null,u=null,t=null,dN.exports=c=(function(){function D(w){this.parent=w,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Pd(),r=Rd(),n=kd(),i=Nd(),s=Md(),d=qd(),f=Ud(),h=Hd(),o=cE(),e=_t(),l=uN(),u=Fd(),t=fN())}return Object.defineProperty(D.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(D.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(D.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(D.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(D.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(D.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(D.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(D.prototype,"previousSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w-1]||null}}),Object.defineProperty(D.prototype,"nextSibling",{get:function(){var w;return w=this.parent.children.indexOf(this),this.parent.children[w+1]||null}}),Object.defineProperty(D.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(D.prototype,"textContent",{get:function(){var w,_,P,b,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",b=this.children,_=0,P=b.length;_<P;_++)w=b[_],w.textContent&&(k+=w.textContent);return k}else return null},set:function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),D.prototype.setParent=function(w){var _,P,b,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],P=0,b=k.length;P<b;P++)_=k[P],R.push(_.setParent(this));return R},D.prototype.element=function(w,_,P){var b,k,R,I,j,U,K,L,C,T,F;if(U=null,_===null&&P==null&&(C=[{},null],_=C[0],P=C[1]),_==null&&(_={}),_=m(_),S(_)||(T=[_,P],P=T[0],_=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(R=0,K=w.length;R<K;R++)k=w[R],U=this.element(k);else if(E(w))U=this.element(w.apply());else if(S(w)){for(j in w)if(p.call(w,j))if(F=w[j],E(F)&&(F=F.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&j.indexOf(this.stringify.convertAttKey)===0)U=this.attribute(j.substr(this.stringify.convertAttKey.length),F);else if(!this.options.separateArrayItems&&Array.isArray(F)&&y(F))U=this.dummy();else if(S(F)&&y(F))U=this.element(j);else if(!this.options.keepNullNodes&&F==null)U=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(F))for(I=0,L=F.length;I<L;I++)k=F[I],b={},b[j]=k,U=this.element(b);else S(F)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&j.indexOf(this.stringify.convertTextKey)===0?U=this.element(F):(U=this.element(j),U.element(F)):U=this.element(j,F)}else!this.options.keepNullNodes&&P===null?U=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?U=this.text(P):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?U=this.cdata(P):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?U=this.comment(P):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?U=this.raw(P):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?U=this.instruction(w.substr(this.stringify.convertPIKey.length),P):U=this.node(w,_,P);if(U==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return U},D.prototype.insertBefore=function(w,_,P){var b,k,R,I,j;if(w?.type)return R=w,I=_,R.setParent(this),I?(k=children.indexOf(I),j=children.splice(k),children.push(R),Array.prototype.push.apply(children,j)):children.push(R),R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),j=this.parent.children.splice(k),b=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,j),b},D.prototype.insertAfter=function(w,_,P){var b,k,R;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(w));return k=this.parent.children.indexOf(this),R=this.parent.children.splice(k+1),b=this.parent.element(w,_,P),Array.prototype.push.apply(this.parent.children,R),b},D.prototype.remove=function(){var w,_;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return w=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[w,w-w+1].concat(_=[])),this.parent},D.prototype.node=function(w,_,P){var b,k;return w!=null&&(w=m(w)),_||(_={}),_=m(_),S(_)||(k=[_,P],P=k[0],_=k[1]),b=new a(this,w,_),P!=null&&b.text(P),this.children.push(b),b},D.prototype.text=function(w){var _;return S(w)&&this.element(w),_=new f(this,w),this.children.push(_),this},D.prototype.cdata=function(w){var _;return _=new r(this,w),this.children.push(_),this},D.prototype.comment=function(w){var _;return _=new n(this,w),this.children.push(_),this},D.prototype.commentBefore=function(w){var _,P,b;return P=this.parent.children.indexOf(this),b=this.parent.children.splice(P),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.commentAfter=function(w){var _,P,b;return P=this.parent.children.indexOf(this),b=this.parent.children.splice(P+1),_=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.raw=function(w){var _;return _=new d(this,w),this.children.push(_),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,_){var P,b,k,R,I;if(w!=null&&(w=m(w)),_!=null&&(_=m(_)),Array.isArray(w))for(R=0,I=w.length;R<I;R++)P=w[R],this.instruction(P);else if(S(w))for(P in w)p.call(w,P)&&(b=w[P],this.instruction(P,b));else E(_)&&(_=_.apply()),k=new h(this,w,_),this.children.push(k);return this},D.prototype.instructionBefore=function(w,_){var P,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,_){var P,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b+1),P=this.parent.instruction(w,_),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,_,P){var b,k;return b=this.document(),k=new i(b,w,_,P),b.children.length===0?b.children.unshift(k):b.children[0].type===e.Declaration?b.children[0]=k:b.children.unshift(k),b.root()||b},D.prototype.dtd=function(w,_){var P,b,k,R,I,j,U,K,L,C;for(b=this.document(),k=new s(b,w,_),L=b.children,R=I=0,U=L.length;I<U;R=++I)if(P=L[R],P.type===e.DocType)return b.children[R]=k,k;for(C=b.children,R=j=0,K=C.length;j<K;R=++j)if(P=C[R],P.isRoot)return b.children.splice(R,0,k),k;return b.children.push(k),k},D.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},D.prototype.root=function(){var w;for(w=this;w;){if(w.type===e.Document)return w.rootObject;if(w.isRoot)return w;w=w.parent}},D.prototype.document=function(){var w;for(w=this;w;){if(w.type===e.Document)return w;w=w.parent}},D.prototype.end=function(w){return this.document().end(w)},D.prototype.prev=function(){var w;if(w=this.parent.children.indexOf(this),w<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[w-1]},D.prototype.next=function(){var w;if(w=this.parent.children.indexOf(this),w===-1||w===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[w+1]},D.prototype.importDocument=function(w){var _;return _=w.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},D.prototype.debugInfo=function(w){var _,P;return w=w||this.name,w==null&&!((_=this.parent)!=null&&_.name)?"":w==null?"parent: <"+this.parent.name+">":(P=this.parent)!=null&&P.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,_,P){return this.element(w,_,P)},D.prototype.nod=function(w,_,P){return this.node(w,_,P)},D.prototype.txt=function(w){return this.text(w)},D.prototype.dat=function(w){return this.cdata(w)},D.prototype.com=function(w){return this.comment(w)},D.prototype.ins=function(w,_){return this.instruction(w,_)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,_,P){return this.declaration(w,_,P)},D.prototype.e=function(w,_,P){return this.element(w,_,P)},D.prototype.n=function(w,_,P){return this.node(w,_,P)},D.prototype.t=function(w){return this.text(w)},D.prototype.d=function(w){return this.cdata(w)},D.prototype.c=function(w){return this.comment(w)},D.prototype.r=function(w){return this.raw(w)},D.prototype.i=function(w,_){return this.instruction(w,_)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.removeChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.appendChild=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.hasChildNodes=function(){return this.children.length!==0},D.prototype.cloneNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isSupported=function(w,_){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var _,P;return _=this,_===w?0:this.document()!==w.document()?(P=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?P|=t.Preceding:P|=t.Following,P):_.isAncestor(w)?t.Contains|t.Preceding:_.isDescendant(w)?t.Contains|t.Following:_.isPreceding(w)?t.Preceding:t.Following},D.prototype.isSameNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupPrefix=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isDefaultNamespace=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.lookupNamespaceURI=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.isEqualNode=function(w){var _,P,b;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(_=P=0,b=this.children.length-1;0<=b?P<=b:P>=b;_=0<=b?++P:--P)if(!this.children[_].isEqualNode(w.children[_]))return!1;return!0},D.prototype.getFeature=function(w,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,_,P){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.getUserData=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.contains=function(w){return w?w===this||this.isDescendant(w):!1},D.prototype.isDescendant=function(w){var _,P,b,k,R;for(R=this.children,b=0,k=R.length;b<k;b++)if(_=R[b],w===_||(P=_.isDescendant(w),P))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_<P},D.prototype.isFollowing=function(w){var _,P;return _=this.treePosition(w),P=this.treePosition(this),_===-1||P===-1?!1:_>P},D.prototype.treePosition=function(w){var _,P;return P=0,_=!1,this.foreachTreeNode(this.document(),function(b){if(P++,!_&&b===w)return _=!0}),_?P:-1},D.prototype.foreachTreeNode=function(w,_){var P,b,k,R,I;for(w||(w=this.document()),R=w.children,b=0,k=R.length;b<k;b++){if(P=R[b],I=_(P))return I;if(I=this.foreachTreeNode(P,_),I)return I}},D})()}).call(hN)});var lE=v((pN,mN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;mN.exports=t=(function(){function n(i){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var s,o,a;i||(i={}),this.options=i,this.options.version||(this.options.version="1.0"),o=i.stringify||{};for(s in o)r.call(o,s)&&(a=o[s],this[s]=a)}return n.prototype.name=function(i){return this.options.noValidation?i:this.assertLegalName(""+i||"")},n.prototype.text=function(i){return this.options.noValidation?i:this.assertLegalChar(this.textEscape(""+i||""))},n.prototype.cdata=function(i){return this.options.noValidation?i:(i=""+i||"",i=i.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(i))},n.prototype.comment=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+i);return this.assertLegalChar(i)},n.prototype.raw=function(i){return this.options.noValidation?i:""+i||""},n.prototype.attValue=function(i){return this.options.noValidation?i:this.assertLegalChar(this.attEscape(i=""+i||""))},n.prototype.insTarget=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.insValue=function(i){if(this.options.noValidation)return i;if(i=""+i||"",i.match(/\?>/))throw new Error("Invalid processing instruction value: "+i);return this.assertLegalChar(i)},n.prototype.xmlVersion=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+i);return i},n.prototype.xmlEncoding=function(i){if(this.options.noValidation)return i;if(i=""+i||"",!i.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+i);return this.assertLegalChar(i)},n.prototype.xmlStandalone=function(i){return this.options.noValidation?i:i?"yes":"no"},n.prototype.dtdPubID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdSysID=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdElementValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttType=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdAttDefault=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdEntityValue=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.dtdNData=function(i){return this.options.noValidation?i:this.assertLegalChar(""+i||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(i){var s,o;if(this.options.noValidation)return i;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s))throw new Error("Invalid character in string: "+i+" at index "+o.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=i.match(s)))throw new Error("Invalid character in string: "+i+" at index "+o.index);return i},n.prototype.assertLegalName=function(i){var s;if(this.options.noValidation)return i;if(this.assertLegalChar(i),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!i.match(s))throw new Error("Invalid character in name");return i},n.prototype.textEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n})()}).call(pN)});var Fc=v((gN,yN)=>{(function(){yN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(gN)});var fE=v((DN,wN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,S={}.hasOwnProperty;E=Pn().assign,t=_t(),u=Nd(),c=Md(),r=Rd(),n=kd(),h=Pd(),f=qd(),m=Ud(),d=Hd(),l=cE(),i=$d(),s=jd(),o=Ld(),a=Bd(),e=Fc(),wN.exports=y=(function(){function A(p){var D,w,_;p||(p={}),this.options=p,w=p.writer||{};for(D in w)S.call(w,D)&&(_=w[D],this["_"+D]=this[D],this[D]=_)}return A.prototype.filterOptions=function(p){var D,w,_,P,b,k,R,I;return p||(p={}),p=E({},this.options,p),D={writer:this},D.pretty=p.pretty||!1,D.allowEmpty=p.allowEmpty||!1,D.indent=(w=p.indent)!=null?w:" ",D.newline=(_=p.newline)!=null?_:`
185
+ `,D.offset=(P=p.offset)!=null?P:0,D.dontPrettyTextNodes=(b=(k=p.dontPrettyTextNodes)!=null?k:p.dontprettytextnodes)!=null?b:0,D.spaceBeforeSlash=(R=(I=p.spaceBeforeSlash)!=null?I:p.spacebeforeslash)!=null?R:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(p,D,w){var _;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(_=(w||0)+D.offset+1,_>0)?new Array(_).join(D.indent):""},A.prototype.endline=function(p,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(p,D,w){var _;return this.openAttribute(p,D,w),_=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),_},A.prototype.cdata=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.comment=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.declaration=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,_+=' version="'+p.version+'"',p.encoding!=null&&(_+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(_+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.docType=function(p,D,w){var _,P,b,k,R;if(w||(w=0),this.openNode(p,D,w),D.state=e.OpenTag,k=this.indent(p,D,w),k+="<!DOCTYPE "+p.root().name,p.pubID&&p.sysID?k+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(k+=' SYSTEM "'+p.sysID+'"'),p.children.length>0){for(k+=" [",k+=this.endline(p,D,w),D.state=e.InsideTag,R=p.children,P=0,b=R.length;P<b;P++)_=R[P],k+=this.writeChildNode(_,D,w+1);D.state=e.CloseTag,k+="]"}return D.state=e.CloseTag,k+=D.spaceBeforeSlash+">",k+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),k},A.prototype.element=function(p,D,w){var _,P,b,k,R,I,j,U,K,L,C,T,F,$;w||(w=0),L=!1,C="",this.openNode(p,D,w),D.state=e.OpenTag,C+=this.indent(p,D,w)+"<"+p.name,T=p.attribs;for(K in T)S.call(T,K)&&(_=T[K],C+=this.attribute(_,D,w));if(b=p.children.length,k=b===0?null:p.children[0],b===0||p.children.every(function(M){return(M.type===t.Text||M.type===t.Raw)&&M.value===""}))D.allowEmpty?(C+=">",D.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,D,w)):(D.state=e.CloseTag,C+=D.spaceBeforeSlash+"/>"+this.endline(p,D,w));else if(D.pretty&&b===1&&(k.type===t.Text||k.type===t.Raw)&&k.value!=null)C+=">",D.state=e.InsideTag,D.suppressPrettyCount++,L=!0,C+=this.writeChildNode(k,D,w+1),D.suppressPrettyCount--,L=!1,D.state=e.CloseTag,C+="</"+p.name+">"+this.endline(p,D,w);else{if(D.dontPrettyTextNodes){for(F=p.children,R=0,j=F.length;R<j;R++)if(P=F[R],(P.type===t.Text||P.type===t.Raw)&&P.value!=null){D.suppressPrettyCount++,L=!0;break}}for(C+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,I=0,U=$.length;I<U;I++)P=$[I],C+=this.writeChildNode(P,D,w+1);D.state=e.CloseTag,C+=this.indent(p,D,w)+"</"+p.name+">",L&&D.suppressPrettyCount--,C+=this.endline(p,D,w),D.state=e.None}return this.closeNode(p,D,w),C},A.prototype.writeChildNode=function(p,D,w){switch(p.type){case t.CData:return this.cdata(p,D,w);case t.Comment:return this.comment(p,D,w);case t.Element:return this.element(p,D,w);case t.Raw:return this.raw(p,D,w);case t.Text:return this.text(p,D,w);case t.ProcessingInstruction:return this.processingInstruction(p,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(p,D,w);case t.DocType:return this.docType(p,D,w);case t.AttributeDeclaration:return this.dtdAttList(p,D,w);case t.ElementDeclaration:return this.dtdElement(p,D,w);case t.EntityDeclaration:return this.dtdEntity(p,D,w);case t.NotationDeclaration:return this.dtdNotation(p,D,w);default:throw new Error("Unknown XML node type: "+p.constructor.name)}},A.prototype.processingInstruction=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<?",D.state=e.InsideTag,_+=p.target,p.value&&(_+=" "+p.value),D.state=e.CloseTag,_+=D.spaceBeforeSlash+"?>",_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.raw=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.text=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w),D.state=e.InsideTag,_+=p.value,D.state=e.CloseTag,_+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdAttList=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,_+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(_+=" "+p.defaultValueType),p.defaultValue&&(_+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdElement=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,_+=" "+p.name+" "+p.value,D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdEntity=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(_+=" %"),_+=" "+p.name,p.value?_+=' "'+p.value+'"':(p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),p.nData&&(_+=" NDATA "+p.nData)),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.dtdNotation=function(p,D,w){var _;return this.openNode(p,D,w),D.state=e.OpenTag,_=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,_+=" "+p.name,p.pubID&&p.sysID?_+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?_+=' PUBLIC "'+p.pubID+'"':p.sysID&&(_+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,_+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),_},A.prototype.openNode=function(p,D,w){},A.prototype.closeNode=function(p,D,w){},A.prototype.openAttribute=function(p,D,w){},A.prototype.closeAttribute=function(p,D,w){},A})()}).call(DN)});var Vd=v((EN,bN)=>{(function(){var t,e,r=function(i,s){for(var o in s)n.call(s,o)&&(i[o]=s[o]);function a(){this.constructor=i}return a.prototype=s.prototype,i.prototype=new a,i.__super__=s.prototype,i},n={}.hasOwnProperty;e=fE(),bN.exports=t=(function(i){r(s,i);function s(o){s.__super__.constructor.call(this,o)}return s.prototype.document=function(o,a){var u,c,l,h,d;for(a=this.filterOptions(a),h="",d=o.children,c=0,l=d.length;c<l;c++)u=d[c],h+=this.writeChildNode(u,a,0);return a.pretty&&h.slice(-a.newline.length)===a.newline&&(h=h.slice(0,-a.newline.length)),h},s})(e)}).call(EN)});var hE=v((vN,_N)=>{(function(){var t,e,r,n,i,s,o,a,u=function(l,h){for(var d in h)c.call(h,d)&&(l[d]=h[d]);function f(){this.constructor=l}return f.prototype=h.prototype,l.prototype=new f,l.__super__=h.prototype,l},c={}.hasOwnProperty;a=Pn().isPlainObject,r=aE(),e=Sk(),i=Pr(),t=_t(),o=lE(),s=Vd(),_N.exports=n=(function(l){u(h,l);function h(d){h.__super__.constructor.call(this,null),this.name="#document",this.type=t.Document,this.documentURI=null,this.domConfig=new e,d||(d={}),d.writer||(d.writer=new s),this.options=d,this.stringify=new o(d)}return Object.defineProperty(h.prototype,"implementation",{value:new r}),Object.defineProperty(h.prototype,"doctype",{get:function(){var d,f,m,y;for(y=this.children,f=0,m=y.length;f<m;f++)if(d=y[f],d.type===t.DocType)return d;return null}}),Object.defineProperty(h.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(h.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(h.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(h.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].encoding:null}}),Object.defineProperty(h.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(h.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===t.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(h.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(h.prototype,"origin",{get:function(){return null}}),Object.defineProperty(h.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(h.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(h.prototype,"contentType",{get:function(){return null}}),h.prototype.end=function(d){var f;return f={},d?a(d)&&(f=d,d=this.options.writer):d=this.options.writer,d.document(this,d.filterOptions(f))},h.prototype.toString=function(d){return this.options.writer.document(this,this.options.writer.filterOptions(d))},h.prototype.createElement=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTextNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createComment=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createCDATASection=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createProcessingInstruction=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttribute=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEntityReference=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.importNode=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createElementNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createAttributeNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByTagNameNS=function(d,f){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementById=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.adoptNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.renameNode=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createEvent=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createNodeIterator=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,m){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call(vN)});var AN=v((CN,SN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,E,S,A,p,D,w,_,P,b={}.hasOwnProperty;P=Pn(),w=P.isObject,D=P.isFunction,_=P.isPlainObject,p=P.getValue,t=_t(),h=hE(),f=Pd(),n=Rd(),i=kd(),y=qd(),A=Ud(),m=Hd(),c=Nd(),l=Md(),s=$d(),a=Ld(),o=jd(),u=Bd(),r=uE(),S=lE(),E=Vd(),e=Fc(),SN.exports=d=(function(){function k(R,I,j){var U;this.name="?xml",this.type=t.Document,R||(R={}),U={},R.writer?_(R.writer)&&(U=R.writer,R.writer=new E):R.writer=new E,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new S(R),this.onDataCallback=I||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(R){var I,j,U,K,L,C,T,F;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:U={},T=R.attribs;for(j in T)b.call(T,j)&&(I=T[j],U[j]=I.value);this.node(R.name,U);break;case t.Dummy:this.dummy();break;case t.Raw:this.raw(R.value);break;case t.Text:this.text(R.value);break;case t.ProcessingInstruction:this.instruction(R.target,R.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+R.constructor.name)}for(F=R.children,L=0,C=F.length;L<C;L++)K=F[L],this.createChildNode(K),K.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,j){var U;if(R==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(R));return this.openCurrent(),R=p(R),I==null&&(I={}),I=p(I),w(I)||(U=[I,j],j=U[0],I=U[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},k.prototype.element=function(R,I,j){var U,K,L,C,T,F;if(this.currentNode&&this.currentNode.type===t.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(R)||w(R)||D(R))for(C=this.options.noValidation,this.options.noValidation=!0,F=new h(this.options).element("TEMP_ROOT"),F.element(R),this.options.noValidation=C,T=F.children,K=0,L=T.length;K<L;K++)U=T[K],this.createChildNode(U),U.type===t.Element&&this.up();else this.node(R,I,j);return this},k.prototype.attribute=function(R,I){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(R));if(R!=null&&(R=p(R)),w(R))for(j in R)b.call(R,j)&&(U=R[j],this.attribute(j,U));else D(I)&&(I=I.apply()),this.options.keepNullAttributes&&I==null?this.currentNode.attribs[R]=new r(this,R,""):I!=null&&(this.currentNode.attribs[R]=new r(this,R,I));return this},k.prototype.text=function(R){var I;return this.openCurrent(),I=new A(this,R),this.onData(this.writer.text(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(R){var I;return this.openCurrent(),I=new n(this,R),this.onData(this.writer.cdata(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(R){var I;return this.openCurrent(),I=new i(this,R),this.onData(this.writer.comment(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(R){var I;return this.openCurrent(),I=new y(this,R),this.onData(this.writer.raw(I,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(R,I){var j,U,K,L,C;if(this.openCurrent(),R!=null&&(R=p(R)),I!=null&&(I=p(I)),Array.isArray(R))for(j=0,L=R.length;j<L;j++)U=R[j],this.instruction(U);else if(w(R))for(U in R)b.call(R,U)&&(K=R[U],this.instruction(U,K));else D(I)&&(I=I.apply()),C=new m(this,R,I),this.onData(this.writer.processingInstruction(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(R,I,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new c(this,R,I,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,j){if(this.openCurrent(),R==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new l(this,I,j),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var j;return this.openCurrent(),j=new o(this,R,I),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,j,U,K){var L;return this.openCurrent(),L=new s(this,R,I,j,U,K),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var j;return this.openCurrent(),j=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var j;return this.openCurrent(),j=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var j;return this.openCurrent(),j=new u(this,R,I),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(R){var I,j,U,K;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),j="",R.type===t.Element){this.writerOptions.state=e.OpenTag,j=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,K=R.attribs;for(U in K)b.call(K,U)&&(I=K[U],j+=this.writer.attribute(I,this.writerOptions,this.currentLevel));j+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,j=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?j+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(j+=' SYSTEM "'+R.sysID+'"'),R.children?(j+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,j+=">"),j+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),R.isOpen=!0}},k.prototype.closeNode=function(R){var I;if(!R.isClosed)return I="",this.writerOptions.state=e.CloseTag,R.type===t.Element?I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"</"+R.name+">"+this.writer.endline(R,this.writerOptions,this.currentLevel):I=this.writer.indent(R,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.None,this.onData(I,this.currentLevel),R.isClosed=!0},k.prototype.onData=function(R,I){return this.documentStarted=!0,this.onDataCallback(R,I+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(R){return R==null?"":"node: <"+R+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(R,I,j){return this.node(R,I,j)},k.prototype.txt=function(R){return this.text(R)},k.prototype.dat=function(R){return this.cdata(R)},k.prototype.com=function(R){return this.comment(R)},k.prototype.ins=function(R,I){return this.instruction(R,I)},k.prototype.dec=function(R,I,j){return this.declaration(R,I,j)},k.prototype.dtd=function(R,I,j){return this.doctype(R,I,j)},k.prototype.e=function(R,I,j){return this.element(R,I,j)},k.prototype.n=function(R,I,j){return this.node(R,I,j)},k.prototype.t=function(R){return this.text(R)},k.prototype.d=function(R){return this.cdata(R)},k.prototype.c=function(R){return this.comment(R)},k.prototype.r=function(R){return this.raw(R)},k.prototype.i=function(R,I){return this.instruction(R,I)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===t.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(R,I){return this.entity(R,I)},k.prototype.pent=function(R,I){return this.pEntity(R,I)},k.prototype.not=function(R,I){return this.notation(R,I)},k})()}).call(CN)});var TN=v((ON,xN)=>{(function(){var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;t=_t(),n=fE(),e=Fc(),xN.exports=r=(function(o){i(a,o);function a(u,c){this.stream=u,a.__super__.constructor.call(this,c)}return a.prototype.endline=function(u,c,l){return u.isLastRootNode&&c.state===e.CloseTag?"":a.__super__.endline.call(this,u,c,l)},a.prototype.document=function(u,c){var l,h,d,f,m,y,E,S,A;for(E=u.children,h=d=0,m=E.length;d<m;h=++d)l=E[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),S=u.children,A=[],f=0,y=S.length;f<y;f++)l=S[f],A.push(this.writeChildNode(l,c,0));return A},a.prototype.attribute=function(u,c,l){return this.stream.write(a.__super__.attribute.call(this,u,c,l))},a.prototype.cdata=function(u,c,l){return this.stream.write(a.__super__.cdata.call(this,u,c,l))},a.prototype.comment=function(u,c,l){return this.stream.write(a.__super__.comment.call(this,u,c,l))},a.prototype.declaration=function(u,c,l){return this.stream.write(a.__super__.declaration.call(this,u,c,l))},a.prototype.docType=function(u,c,l){var h,d,f,m;if(l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)),this.stream.write("<!DOCTYPE "+u.root().name),u.pubID&&u.sysID?this.stream.write(' PUBLIC "'+u.pubID+'" "'+u.sysID+'"'):u.sysID&&this.stream.write(' SYSTEM "'+u.sysID+'"'),u.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(u,c,l)),c.state=e.InsideTag,m=u.children,d=0,f=m.length;d<f;d++)h=m[d],this.writeChildNode(h,c,l+1);c.state=e.CloseTag,this.stream.write("]")}return c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.element=function(u,c,l){var h,d,f,m,y,E,S,A,p,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),p=u.attribs;for(S in p)s.call(p,S)&&(h=p[S],this.attribute(h,c,l));if(f=u.children.length,m=f===0?null:u.children[0],f===0||u.children.every(function(w){return(w.type===t.Text||w.type===t.Raw)&&w.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=e.CloseTag,this.stream.write("</"+u.name+">")):(c.state=e.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&f===1&&(m.type===t.Text||m.type===t.Raw)&&m.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(m,c,l+1),c.suppressPrettyCount--,A=!1,c.state=e.CloseTag,this.stream.write("</"+u.name+">");else{for(this.stream.write(">"+this.endline(u,c,l)),c.state=e.InsideTag,D=u.children,y=0,E=D.length;y<E;y++)d=D[y],this.writeChildNode(d,c,l+1);c.state=e.CloseTag,this.stream.write(this.indent(u,c,l)+"</"+u.name+">")}return this.stream.write(this.endline(u,c,l)),c.state=e.None,this.closeNode(u,c,l)},a.prototype.processingInstruction=function(u,c,l){return this.stream.write(a.__super__.processingInstruction.call(this,u,c,l))},a.prototype.raw=function(u,c,l){return this.stream.write(a.__super__.raw.call(this,u,c,l))},a.prototype.text=function(u,c,l){return this.stream.write(a.__super__.text.call(this,u,c,l))},a.prototype.dtdAttList=function(u,c,l){return this.stream.write(a.__super__.dtdAttList.call(this,u,c,l))},a.prototype.dtdElement=function(u,c,l){return this.stream.write(a.__super__.dtdElement.call(this,u,c,l))},a.prototype.dtdEntity=function(u,c,l){return this.stream.write(a.__super__.dtdEntity.call(this,u,c,l))},a.prototype.dtdNotation=function(u,c,l){return this.stream.write(a.__super__.dtdNotation.call(this,u,c,l))},a})(n)}).call(ON)});var FN=v((IN,zi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Pn(),a=c.assign,u=c.isFunction,r=aE(),n=hE(),i=AN(),o=Vd(),s=TN(),t=_t(),e=Fc(),zi.exports.create=function(l,h,d,f){var m,y;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),m=new n(f),y=m.element(l),f.headless||(m.declaration(f),(f.pubID!=null||f.sysID!=null)&&m.dtd(f)),y},zi.exports.begin=function(l,h,d){var f;return u(l)&&(f=[l,h],h=f[0],d=f[1],l={}),h?new i(l,h,d):new n(l)},zi.exports.stringWriter=function(l){return new o(l)},zi.exports.streamWriter=function(l,h){return new s(l,h)},zi.exports.implementation=new r,zi.exports.nodeType=t,zi.exports.writerState=e}).call(IN)});var PN=v(dE=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=FN(),e=Id().defaults,n=function(o){return typeof o=="string"&&(o.indexOf("&")>=0||o.indexOf(">")>=0||o.indexOf("<")>=0)},i=function(o){return"<![CDATA["+r(o)+"]]>"},r=function(o){return o.replace("]]>","]]]]><![CDATA[>")},dE.Builder=(function(){function o(a){var u,c,l;this.options={},c=e["0.2"];for(u in c)s.call(c,u)&&(l=c[u],this.options[u]=l);for(u in a)s.call(a,u)&&(l=a[u],this.options[u]=l)}return o.prototype.buildObject=function(a){var u,c,l,h,d;return u=this.options.attrkey,c=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===e["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,l=(function(f){return function(m,y){var E,S,A,p,D,w;if(typeof y!="object")f.options.cdata&&n(y)?m.raw(i(y)):m.txt(y);else if(Array.isArray(y)){for(p in y)if(s.call(y,p)){S=y[p];for(D in S)A=S[D],m=l(m.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(S=y[D],D===u){if(typeof S=="object")for(E in S)w=S[E],m=m.att(E,w)}else if(D===c)f.options.cdata&&n(S)?m=m.raw(i(S)):m=m.txt(S);else if(Array.isArray(S))for(p in S)s.call(S,p)&&(A=S[p],typeof A=="string"?f.options.cdata&&n(A)?m=m.ele(D).raw(i(A)).up():m=m.ele(D,A).up():m=l(m.ele(D),A).up());else typeof S=="object"?m=l(m.ele(D),S).up():typeof S=="string"&&f.options.cdata&&n(S)?m=m.ele(D).raw(i(S)).up():(S==null&&(S=""),m=m.ele(D,S.toString()).up());return m}})(this),h=t.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(h,a).end(this.options.renderOpts)},o})()}).call(dE)});var RN=v(zd=>{(function(t){t.parser=function(x,O){return new r(x,O)},t.SAXParser=r,t.SAXStream=c,t.createStream=u,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function r(x,O){if(!(this instanceof r))return new r(x,O);var H=this;i(H),H.q=H.c="",H.bufferCheckPosition=t.MAX_BUFFER_LENGTH,H.opt=O||{},H.opt.lowercase=H.opt.lowercase||H.opt.lowercasetags,H.looseCase=H.opt.lowercase?"toLowerCase":"toUpperCase",H.tags=[],H.closed=H.closedRoot=H.sawRoot=!1,H.tag=H.error=null,H.strict=!!x,H.noscript=!!(x||H.opt.noscript),H.state=b.BEGIN,H.strictEntities=H.opt.strictEntities,H.ENTITIES=H.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),H.attribList=[],H.opt.xmlns&&(H.ns=Object.create(m)),H.opt.unquotedAttributeValues===void 0&&(H.opt.unquotedAttributeValues=!x),H.trackPosition=H.opt.position!==!1,H.trackPosition&&(H.position=H.line=H.column=0),R(H,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var H=new O;return H}),Object.keys||(Object.keys=function(x){var O=[];for(var H in x)x.hasOwnProperty(H)&&O.push(H);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),H=0,N=0,ne=e.length;N<ne;N++){var z=x[e[N]].length;if(z>O)switch(e[N]){case"textNode":j(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:K(x,"Max buffer length exceeded: "+e[N])}H=Math.max(H,z)}var ie=t.MAX_BUFFER_LENGTH-H;x.bufferCheckPosition=ie+x.position}function i(x){for(var O=0,H=e.length;O<H;O++)x[e[O]]=""}function s(x){j(x),x.cdata!==""&&(I(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(I(x,"onscript",x.script),x.script="")}r.prototype={end:function(){L(this)},write:ae,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var o;try{o=require("stream").Stream}catch{o=function(){}}o||(o=function(){});var a=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function u(x,O){return new c(x,O)}function c(x,O){if(!(this instanceof c))return new c(x,O);o.apply(this),this._parser=new r(x,O),this.writable=!0,this.readable=!0;var H=this;this._parser.onend=function(){H.emit("end")},this._parser.onerror=function(N){H.emit("error",N),H._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(H,"on"+N,{get:function(){return H._parser["on"+N]},set:function(ne){if(!ne)return H.removeAllListeners(N),H._parser["on"+N]=ne,ne;H.on(N,ne)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(o.prototype,{constructor:{value:c}}),c.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var O=require("string_decoder").StringDecoder;this._decoder=new O("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},c.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},c.prototype.on=function(x,O){var H=this;return!H._parser["on"+x]&&a.indexOf(x)!==-1&&(H._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),H.emit.apply(H,N)}),o.prototype.on.call(H,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",m={xml:d,xmlns:f},y=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,E=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,A=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function p(x){return x===" "||x===`
186
186
  `||x==="\r"||x===" "}function D(x){return x==='"'||x==="'"}function w(x){return x===">"||p(x)}function _(x,O){return x.test(O)}function P(x,O){return!_(x,O)}var b=0;t.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(x){var O=t.ENTITIES[x],H=typeof O=="number"?String.fromCharCode(O):O;t.ENTITIES[x]=H});for(var k in t.STATE)t.STATE[t.STATE[k]]=k;b=t.STATE;function R(x,O,H){x[O]&&x[O](H)}function I(x,O,H){x.textNode&&j(x),R(x,O,H)}function j(x){x.textNode=U(x.opt,x.textNode),x.textNode&&R(x,"ontext",x.textNode),x.textNode=""}function U(x,O){return x.trim&&(O=O.trim()),x.normalize&&(O=O.replace(/\s+/g," ")),O}function K(x,O){return j(x),x.trackPosition&&(O+=`
187
187
  Line: `+x.line+`
188
188
  Column: `+x.column+`
189
- Char: `+x.c),O=new Error(O),x.error=O,R(x,"onerror",O),x}function L(x){return x.sawRoot&&!x.closedRoot&&S(x,"Unclosed root tag"),x.state!==b.BEGIN&&x.state!==b.BEGIN_WHITESPACE&&x.state!==b.TEXT&&K(x,"Unexpected end"),j(x),x.c="",x.closed=!0,R(x,"onend"),r.call(x,x.strict,x.opt),x}function S(x,O){if(typeof x!="object"||!(x instanceof r))throw new Error("bad call to strictFail");x.strict&&K(x,O)}function T(x){x.strict||(x.tagName=x.tagName[x.looseCase]());var O=x.tags[x.tags.length-1]||x,H=x.tag={name:x.tagName,attributes:{}};x.opt.xmlns&&(H.ns=O.ns),x.attribList.length=0,I(x,"onopentagstart",H)}function F(x,O){var H=x.indexOf(":"),N=H<0?["",x]:x.split(":"),ne=N[0],z=N[1];return O&&x==="xmlns"&&(ne="xmlns",z=""),{prefix:ne,local:z}}function $(x){if(x.strict||(x.attribName=x.attribName[x.looseCase]()),x.attribList.indexOf(x.attribName)!==-1||x.tag.attributes.hasOwnProperty(x.attribName)){x.attribName=x.attribValue="";return}if(x.opt.xmlns){var O=F(x.attribName,!0),H=O.prefix,N=O.local;if(H==="xmlns")if(N==="xml"&&x.attribValue!==d)S(x,"xml: prefix must be bound to "+d+`
190
- Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)S(x,"xmlns: prefix must be bound to "+f+`
191
- Actual: `+x.attribValue);else{var ne=x.tag,z=x.tags[x.tags.length-1]||x;ne.ns===z.ns&&(ne.ns=Object.create(z.ns)),ne.ns[N]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,I(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function M(x,O){if(x.opt.xmlns){var H=x.tag,N=F(x.tagName);H.prefix=N.prefix,H.local=N.local,H.uri=H.ns[N.prefix]||"",H.prefix&&!H.uri&&(S(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),H.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;H.ns&&ne.ns!==H.ns&&Object.keys(H.ns).forEach(function(Rv){I(x,"onopennamespace",{prefix:Rv,uri:H.ns[Rv]})});for(var z=0,ie=x.attribList.length;z<ie;z++){var we=x.attribList[z],xe=we[0],qe=we[1],Et=F(xe,!0),pr=Et.prefix,Nq=Et.local,Pv=pr===""?"":H.ns[pr]||"",lm={name:xe,value:qe,prefix:pr,local:Nq,uri:Pv};pr&&pr!=="xmlns"&&!Pv&&(S(x,"Unbound namespace prefix: "+JSON.stringify(pr)),lm.uri=pr),x.tag.attributes[xe]=lm,I(x,"onattribute",lm)}x.attribList.length=0}x.tag.isSelfClosing=!!O,x.sawRoot=!0,x.tags.push(x.tag),I(x,"onopentag",x.tag),O||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=b.SCRIPT:x.state=b.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function B(x){if(!x.tagName){S(x,"Weird empty close tag."),x.textNode+="</>",x.state=b.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=b.SCRIPT;return}I(x,"onscript",x.script),x.script=""}var O=x.tags.length,H=x.tagName;x.strict||(H=H[x.looseCase]());for(var N=H;O--;){var ne=x.tags[O];if(ne.name!==N)S(x,"Unexpected close tag");else break}if(O<0){S(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=b.TEXT;return}x.tagName=H;for(var z=x.tags.length;z-- >O;){var ie=x.tag=x.tags.pop();x.tagName=x.tag.name,I(x,"onclosetag",x.tagName);var we={};for(var xe in ie.ns)we[xe]=ie.ns[xe];var qe=x.tags[x.tags.length-1]||x;x.opt.xmlns&&ie.ns!==qe.ns&&Object.keys(ie.ns).forEach(function(Et){var pr=ie.ns[Et];I(x,"onclosenamespace",{prefix:Et,uri:pr})})}O===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=b.TEXT}function G(x){var O=x.entity,H=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[H]?x.ENTITIES[H]:(O=H,O.charAt(0)==="#"&&(O.charAt(1)==="x"?(O=O.slice(2),N=parseInt(O,16),ne=N.toString(16)):(O=O.slice(1),N=parseInt(O,10),ne=N.toString(10))),O=O.replace(/^0+/,""),isNaN(N)||ne.toLowerCase()!==O||N<0||N>1114111?(S(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(N))}function q(x,O){O==="<"?(x.state=b.OPEN_WAKA,x.startTagPosition=x.position):p(O)||(S(x,"Non-whitespace before first tag."),x.textNode=O,x.state=b.TEXT)}function V(x,O){var H="";return O<x.length&&(H=x.charAt(O)),H}function ae(x){var O=this;if(this.error)throw this.error;if(O.closed)return K(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var H=0,N="";N=V(x,H++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
189
+ Char: `+x.c),O=new Error(O),x.error=O,R(x,"onerror",O),x}function L(x){return x.sawRoot&&!x.closedRoot&&C(x,"Unclosed root tag"),x.state!==b.BEGIN&&x.state!==b.BEGIN_WHITESPACE&&x.state!==b.TEXT&&K(x,"Unexpected end"),j(x),x.c="",x.closed=!0,R(x,"onend"),r.call(x,x.strict,x.opt),x}function C(x,O){if(typeof x!="object"||!(x instanceof r))throw new Error("bad call to strictFail");x.strict&&K(x,O)}function T(x){x.strict||(x.tagName=x.tagName[x.looseCase]());var O=x.tags[x.tags.length-1]||x,H=x.tag={name:x.tagName,attributes:{}};x.opt.xmlns&&(H.ns=O.ns),x.attribList.length=0,I(x,"onopentagstart",H)}function F(x,O){var H=x.indexOf(":"),N=H<0?["",x]:x.split(":"),ne=N[0],z=N[1];return O&&x==="xmlns"&&(ne="xmlns",z=""),{prefix:ne,local:z}}function $(x){if(x.strict||(x.attribName=x.attribName[x.looseCase]()),x.attribList.indexOf(x.attribName)!==-1||x.tag.attributes.hasOwnProperty(x.attribName)){x.attribName=x.attribValue="";return}if(x.opt.xmlns){var O=F(x.attribName,!0),H=O.prefix,N=O.local;if(H==="xmlns")if(N==="xml"&&x.attribValue!==d)C(x,"xml: prefix must be bound to "+d+`
190
+ Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)C(x,"xmlns: prefix must be bound to "+f+`
191
+ Actual: `+x.attribValue);else{var ne=x.tag,z=x.tags[x.tags.length-1]||x;ne.ns===z.ns&&(ne.ns=Object.create(z.ns)),ne.ns[N]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,I(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function M(x,O){if(x.opt.xmlns){var H=x.tag,N=F(x.tagName);H.prefix=N.prefix,H.local=N.local,H.uri=H.ns[N.prefix]||"",H.prefix&&!H.uri&&(C(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),H.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;H.ns&&ne.ns!==H.ns&&Object.keys(H.ns).forEach(function(Rv){I(x,"onopennamespace",{prefix:Rv,uri:H.ns[Rv]})});for(var z=0,ie=x.attribList.length;z<ie;z++){var we=x.attribList[z],xe=we[0],qe=we[1],Et=F(xe,!0),pr=Et.prefix,Nq=Et.local,Pv=pr===""?"":H.ns[pr]||"",lm={name:xe,value:qe,prefix:pr,local:Nq,uri:Pv};pr&&pr!=="xmlns"&&!Pv&&(C(x,"Unbound namespace prefix: "+JSON.stringify(pr)),lm.uri=pr),x.tag.attributes[xe]=lm,I(x,"onattribute",lm)}x.attribList.length=0}x.tag.isSelfClosing=!!O,x.sawRoot=!0,x.tags.push(x.tag),I(x,"onopentag",x.tag),O||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=b.SCRIPT:x.state=b.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function B(x){if(!x.tagName){C(x,"Weird empty close tag."),x.textNode+="</>",x.state=b.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=b.SCRIPT;return}I(x,"onscript",x.script),x.script=""}var O=x.tags.length,H=x.tagName;x.strict||(H=H[x.looseCase]());for(var N=H;O--;){var ne=x.tags[O];if(ne.name!==N)C(x,"Unexpected close tag");else break}if(O<0){C(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=b.TEXT;return}x.tagName=H;for(var z=x.tags.length;z-- >O;){var ie=x.tag=x.tags.pop();x.tagName=x.tag.name,I(x,"onclosetag",x.tagName);var we={};for(var xe in ie.ns)we[xe]=ie.ns[xe];var qe=x.tags[x.tags.length-1]||x;x.opt.xmlns&&ie.ns!==qe.ns&&Object.keys(ie.ns).forEach(function(Et){var pr=ie.ns[Et];I(x,"onclosenamespace",{prefix:Et,uri:pr})})}O===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=b.TEXT}function G(x){var O=x.entity,H=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[H]?x.ENTITIES[H]:(O=H,O.charAt(0)==="#"&&(O.charAt(1)==="x"?(O=O.slice(2),N=parseInt(O,16),ne=N.toString(16)):(O=O.slice(1),N=parseInt(O,10),ne=N.toString(10))),O=O.replace(/^0+/,""),isNaN(N)||ne.toLowerCase()!==O||N<0||N>1114111?(C(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(N))}function q(x,O){O==="<"?(x.state=b.OPEN_WAKA,x.startTagPosition=x.position):p(O)||(C(x,"Non-whitespace before first tag."),x.textNode=O,x.state=b.TEXT)}function V(x,O){var H="";return O<x.length&&(H=x.charAt(O)),H}function ae(x){var O=this;if(this.error)throw this.error;if(O.closed)return K(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var H=0,N="";N=V(x,H++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
192
192
  `?(O.line++,O.column=0):O.column++),O.state){case b.BEGIN:if(O.state=b.BEGIN_WHITESPACE,N==="\uFEFF")continue;q(O,N);continue;case b.BEGIN_WHITESPACE:q(O,N);continue;case b.TEXT:if(O.sawRoot&&!O.closedRoot){for(var z=H-1;N&&N!=="<"&&N!=="&";)N=V(x,H++),N&&O.trackPosition&&(O.position++,N===`
193
- `?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(z,H-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):(!p(N)&&(!O.sawRoot||O.closedRoot)&&S(O,"Text data outside of root node."),N==="&"?O.state=b.TEXT_ENTITY:O.textNode+=N);continue;case b.SCRIPT:N==="<"?O.state=b.SCRIPT_ENDING:O.script+=N;continue;case b.SCRIPT_ENDING:N==="/"?O.state=b.CLOSE_TAG:(O.script+="<"+N,O.state=b.SCRIPT);continue;case b.OPEN_WAKA:if(N==="!")O.state=b.SGML_DECL,O.sgmlDecl="";else if(!p(N))if(_(y,N))O.state=b.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=b.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=b.PROC_INST,O.procInstName=O.procInstBody="";else{if(S(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=b.TEXT}continue;case b.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=b.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=b.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(I(O,"onopencdata"),O.state=b.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=b.DOCTYPE,(O.doctype||O.sawRoot)&&S(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(I(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=b.TEXT):(D(N)&&(O.state=b.SGML_DECL_QUOTED),O.sgmlDecl+=N);continue;case b.SGML_DECL_QUOTED:N===O.q&&(O.state=b.SGML_DECL,O.q=""),O.sgmlDecl+=N;continue;case b.DOCTYPE:N===">"?(O.state=b.TEXT,I(O,"ondoctype",O.doctype),O.doctype=!0):(O.doctype+=N,N==="["?O.state=b.DOCTYPE_DTD:D(N)&&(O.state=b.DOCTYPE_QUOTED,O.q=N));continue;case b.DOCTYPE_QUOTED:O.doctype+=N,N===O.q&&(O.q="",O.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:N==="]"?(O.doctype+=N,O.state=b.DOCTYPE):N==="<"?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):D(N)?(O.doctype+=N,O.state=b.DOCTYPE_DTD_QUOTED,O.q=N):O.doctype+=N;continue;case b.DOCTYPE_DTD_QUOTED:O.doctype+=N,N===O.q&&(O.state=b.DOCTYPE_DTD,O.q="");continue;case b.COMMENT:N==="-"?O.state=b.COMMENT_ENDING:O.comment+=N;continue;case b.COMMENT_ENDING:N==="-"?(O.state=b.COMMENT_ENDED,O.comment=U(O.opt,O.comment),O.comment&&I(O,"oncomment",O.comment),O.comment=""):(O.comment+="-"+N,O.state=b.COMMENT);continue;case b.COMMENT_ENDED:N!==">"?(S(O,"Malformed comment"),O.comment+="--"+N,O.state=b.COMMENT):O.doctype&&O.doctype!==!0?O.state=b.DOCTYPE_DTD:O.state=b.TEXT;continue;case b.CDATA:for(var z=H-1;N&&N!=="]";)N=V(x,H++),N&&O.trackPosition&&(O.position++,N===`
194
- `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(z,H-1),N==="]"&&(O.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:N==="]"?O.state=b.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=b.CDATA);continue;case b.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=b.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=b.CDATA);continue;case b.PROC_INST:N==="?"?O.state=b.PROC_INST_ENDING:p(N)?O.state=b.PROC_INST_BODY:O.procInstName+=N;continue;case b.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=b.PROC_INST_ENDING:O.procInstBody+=N;continue;case b.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=b.TEXT):(O.procInstBody+="?"+N,O.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:_(E,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:(p(N)||S(O,"Invalid character in tag name"),O.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:N===">"?(M(O,!0),B(O)):(S(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(p(N))continue;N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:_(y,N)?(O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME:N==="="?O.state=b.ATTRIB_VALUE:N===">"?(S(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:_(E,N)?O.attribName+=N:S(O,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=b.ATTRIB_VALUE;else{if(p(N))continue;S(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):_(y,N)?(O.attribName=N,O.state=b.ATTRIB_NAME):(S(O,"Invalid attribute name"),O.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(p(N))continue;D(N)?(O.q=N,O.state=b.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||K(O,"Unquoted attribute value"),O.state=b.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case b.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:p(N)?O.state=b.ATTRIB:N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:_(y,N)?(S(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):S(O,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?M(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?B(O):_(E,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=b.SCRIPT):(p(N)||S(O,"Invalid tagname in closing tag"),O.state=b.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;P(y,N)?O.script?(O.script+="</"+N,O.state=b.SCRIPT):S(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case b.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?B(O):S(O,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var ie,we;switch(O.state){case b.TEXT_ENTITY:ie=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:ie=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:ie=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var xe=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(xe)?(O.entity="",O.state=ie,O.write(xe)):(O[we]+=xe,O.entity="",O.state=ie)}else _(O.entity.length?A:C,N)?O.entity+=N:(S(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=ie);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,H=function(){var N=16384,ne=[],z,ie,we=-1,xe=arguments.length;if(!xe)return"";for(var qe="";++we<xe;){var Et=Number(arguments[we]);if(!isFinite(Et)||Et<0||Et>1114111||O(Et)!==Et)throw RangeError("Invalid code point: "+Et);Et<=65535?ne.push(Et):(Et-=65536,z=(Et>>10)+55296,ie=Et%1024+56320,ne.push(z,ie)),(we+1===xe||ne.length>N)&&(qe+=x.apply(null,ne),ne.length=0)}return qe};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof zd>"u"?zd.sax={}:zd)});var kN=v(pE=>{(function(){"use strict";pE.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(pE)});var mE=v(Ys=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Ys.normalize=function(e){return e.toLowerCase()},Ys.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Ys.stripPrefix=function(e){return e.replace(t,"")},Ys.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Ys.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Ys)});var NN=v(ui=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function y(){this.constructor=d}return y.prototype=f.prototype,d.prototype=new y,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=RN(),n=require("events"),t=kN(),o=mE(),u=require("timers").setImmediate,e=Id().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var y,E,C;for(y=0,E=d.length;y<E;y++)C=d[y],f=C(f,m);return f},r=function(d,f,m){var y;return y=Object.create(null),y.value=m,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(d,f,y)},ui.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,E,C;if(!(this instanceof ui.Parser))return new ui.Parser(m);this.options={},E=e["0.2"];for(y in E)h.call(E,y)&&(C=E[y],this.options[y]=C);for(y in m)h.call(m,y)&&(C=m[y],this.options[y]=C);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,y;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(E){if(y=E,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(m,y,E){return y in m?(m[y]instanceof Array||r(m,y,[m[y]]),m[y].push(E)):this.options.explicitArray?r(m,y,[E]):r(m,y,E)},f.prototype.reset=function(){var m,y,E,C;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,C=[],m=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,_,P,b;if(_={},_[y]="",!A.options.ignoreAttrs){b=p.attributes;for(D in b)h.call(b,D)&&(!(m in _)&&!A.options.mergeAttrs&&(_[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],P=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(_,P,w):r(_[m],P,w))}return _["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(_[A.options.xmlnskey]={uri:p.uri,local:p.local}),C.push(_)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,_,P,b,k,R,I,j;if(b=C.pop(),P=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(p=b.cdata,delete b.cdata),I=C[C.length-1],b[y].match(/^\s*$/)&&!p?(D=b[y],delete b[y]):(A.options.trim&&(b[y]=b[y].trim()),A.options.normalize&&(b[y]=b[y].replace(/\s{2,}/g," ").trim()),b[y]=A.options.valueProcessors?s(A.options.valueProcessors,b[y],P):b[y],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])),i(b)&&(typeof A.options.emptyTag=="function"?b=A.options.emptyTag():b=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(j="/"+(function(){var U,K,L;for(L=[],U=0,K=C.length;U<K;U++)_=C[U],L.push(_["#name"]);return L})().concat(P).join("/"),(function(){var U;try{return b=A.options.validator(j,I&&I[P],b)}catch(K){return U=K,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)_={},A.options.attrkey in b&&(_[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(_[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(_[A.options.childkey]=b),b=_;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in b)h.call(b,w)&&r(k,w,b[w]);I[A.options.childkey].push(k),delete b["#name"],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])}}return C.length>0?A.assignOrPush(I,P,b):(A.options.explicitRoot&&(R=b,b={},r(b,P,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),E=(function(A){return function(p){var D,w;if(w=C[C.length-1],w)return w[y]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[y]=p,A.options.normalize&&(D[y]=D[y].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=E,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=E(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,y){var E;y!=null&&typeof y=="function"&&(this.on("end",function(C){return this.reset(),y(null,C)}),this.on("error",function(C){return this.reset(),y(C)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(C){if(E=C,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw E}else return this.emit("error",E),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(y){return function(E,C){return y.parseString(m,function(A,p){return A?C(A):E(p)})}})(this))},f})(n),ui.parseString=function(d,f,m){var y,E,C;return m!=null?(typeof m=="function"&&(y=m),typeof f=="object"&&(E=f)):(typeof f=="function"&&(y=f),E={}),C=new ui.Parser(E),C.parseString(d,y)},ui.parseStringPromise=function(d,f){var m,y;return typeof f=="object"&&(m=f),y=new ui.Parser(m),y.parseStringPromise(d)}}).call(ui)});var $N=v(ci=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Id(),t=PN(),r=NN(),n=mE(),ci.defaults=e.defaults,ci.processors=n,ci.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),ci.Builder=t.Builder,ci.Parser=r.Parser,ci.parseString=r.parseString,ci.parseStringPromise=r.parseStringPromise}).call(ci)});var LN=v(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.buildXmlElement=Rn.writeXML=Rn.parseXML=Rn.readXML=void 0;var Bre=(fe(),ue(le)),Mre=Ea(),Pc=Bre.__importDefault($N());async function qre(t){var e;try{let r=await(0,Mre.readFile)(t,{encoding:"utf-8"});try{return await Pc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Rn.readXML=qre;function Ure(t,e){let r=e!==void 0?new Pc.default.Parser({...e}):new Pc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Rn.parseXML=Ure;async function Hre(t){return new Promise(e=>{let n=new Pc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Rn.writeXML=Hre;function Vre(t,e){return new Pc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Rn.buildXmlElement=Vre});var UN=v(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getAllElements=Le.getFilePath=Le.getAssets=Le.getJSModules=Le.getPluginType=Le.getPlatformElement=Le.getPluginPlatform=Le.printPlugins=Le.fixName=Le.getDependencies=Le.resolvePlugin=Le.getPlugins=Le.getIncludedPluginPackages=void 0;var zre=(fe(),ue(le)),Kre=Ea(),gE=require("path"),Ra=zre.__importDefault(ba()),Gre=id(),Wre=Dc(),jN=Td(),Xre=LN();function BN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}Le.getIncludedPluginPackages=BN;async function Yre(t,e){var r;let n=(r=BN(t,e))!==null&&r!==void 0?r:qN(t);return(await Promise.all(n.map(async s=>MN(t,s)))).filter(s=>!!s)}Le.getPlugins=Yre;async function MN(t,e){try{let r=(0,jN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Gre.fatal)(`Unable to find ${Ra.default.strong(`node_modules/${e}`)}.
195
- Are you sure ${Ra.default.strong(e)} is installed?`);let n=(0,gE.dirname)(r),i=await(0,Kre.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:yE(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,gE.join)(n,"plugin.xml"),o=await(0,Xre.readXML)(s);return{id:e,name:yE(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}Le.resolvePlugin=MN;function qN(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:{})]}Le.getDependencies=qN;function yE(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Le.fixName=yE;function Jre(t,e,r="capacitor"){if(t.length===0)return;let n,i=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${i} for ${Ra.default.strong(e)}:
193
+ `?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(z,H-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):(!p(N)&&(!O.sawRoot||O.closedRoot)&&C(O,"Text data outside of root node."),N==="&"?O.state=b.TEXT_ENTITY:O.textNode+=N);continue;case b.SCRIPT:N==="<"?O.state=b.SCRIPT_ENDING:O.script+=N;continue;case b.SCRIPT_ENDING:N==="/"?O.state=b.CLOSE_TAG:(O.script+="<"+N,O.state=b.SCRIPT);continue;case b.OPEN_WAKA:if(N==="!")O.state=b.SGML_DECL,O.sgmlDecl="";else if(!p(N))if(_(y,N))O.state=b.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=b.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=b.PROC_INST,O.procInstName=O.procInstBody="";else{if(C(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=b.TEXT}continue;case b.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=b.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=b.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(I(O,"onopencdata"),O.state=b.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=b.DOCTYPE,(O.doctype||O.sawRoot)&&C(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(I(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=b.TEXT):(D(N)&&(O.state=b.SGML_DECL_QUOTED),O.sgmlDecl+=N);continue;case b.SGML_DECL_QUOTED:N===O.q&&(O.state=b.SGML_DECL,O.q=""),O.sgmlDecl+=N;continue;case b.DOCTYPE:N===">"?(O.state=b.TEXT,I(O,"ondoctype",O.doctype),O.doctype=!0):(O.doctype+=N,N==="["?O.state=b.DOCTYPE_DTD:D(N)&&(O.state=b.DOCTYPE_QUOTED,O.q=N));continue;case b.DOCTYPE_QUOTED:O.doctype+=N,N===O.q&&(O.q="",O.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:N==="]"?(O.doctype+=N,O.state=b.DOCTYPE):N==="<"?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):D(N)?(O.doctype+=N,O.state=b.DOCTYPE_DTD_QUOTED,O.q=N):O.doctype+=N;continue;case b.DOCTYPE_DTD_QUOTED:O.doctype+=N,N===O.q&&(O.state=b.DOCTYPE_DTD,O.q="");continue;case b.COMMENT:N==="-"?O.state=b.COMMENT_ENDING:O.comment+=N;continue;case b.COMMENT_ENDING:N==="-"?(O.state=b.COMMENT_ENDED,O.comment=U(O.opt,O.comment),O.comment&&I(O,"oncomment",O.comment),O.comment=""):(O.comment+="-"+N,O.state=b.COMMENT);continue;case b.COMMENT_ENDED:N!==">"?(C(O,"Malformed comment"),O.comment+="--"+N,O.state=b.COMMENT):O.doctype&&O.doctype!==!0?O.state=b.DOCTYPE_DTD:O.state=b.TEXT;continue;case b.CDATA:for(var z=H-1;N&&N!=="]";)N=V(x,H++),N&&O.trackPosition&&(O.position++,N===`
194
+ `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(z,H-1),N==="]"&&(O.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:N==="]"?O.state=b.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=b.CDATA);continue;case b.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=b.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=b.CDATA);continue;case b.PROC_INST:N==="?"?O.state=b.PROC_INST_ENDING:p(N)?O.state=b.PROC_INST_BODY:O.procInstName+=N;continue;case b.PROC_INST_BODY:if(!O.procInstBody&&p(N))continue;N==="?"?O.state=b.PROC_INST_ENDING:O.procInstBody+=N;continue;case b.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=b.TEXT):(O.procInstBody+="?"+N,O.state=b.PROC_INST_BODY);continue;case b.OPEN_TAG:_(E,N)?O.tagName+=N:(T(O),N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:(p(N)||C(O,"Invalid character in tag name"),O.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:N===">"?(M(O,!0),B(O)):(C(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(p(N))continue;N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:_(y,N)?(O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case b.ATTRIB_NAME:N==="="?O.state=b.ATTRIB_VALUE:N===">"?(C(O,"Attribute without value"),O.attribValue=O.attribName,$(O),M(O)):p(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:_(E,N)?O.attribName+=N:C(O,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=b.ATTRIB_VALUE;else{if(p(N))continue;C(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?M(O):_(y,N)?(O.attribName=N,O.state=b.ATTRIB_NAME):(C(O,"Invalid attribute name"),O.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(p(N))continue;D(N)?(O.q=N,O.state=b.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||K(O,"Unquoted attribute value"),O.state=b.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case b.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:p(N)?O.state=b.ATTRIB:N===">"?M(O):N==="/"?O.state=b.OPEN_TAG_SLASH:_(y,N)?(C(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=b.ATTRIB_NAME):C(O,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=b.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?M(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?B(O):_(E,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=b.SCRIPT):(p(N)||C(O,"Invalid tagname in closing tag"),O.state=b.CLOSE_TAG_SAW_WHITE);else{if(p(N))continue;P(y,N)?O.script?(O.script+="</"+N,O.state=b.SCRIPT):C(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case b.CLOSE_TAG_SAW_WHITE:if(p(N))continue;N===">"?B(O):C(O,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var ie,we;switch(O.state){case b.TEXT_ENTITY:ie=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:ie=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:ie=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var xe=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(xe)?(O.entity="",O.state=ie,O.write(xe)):(O[we]+=xe,O.entity="",O.state=ie)}else _(O.entity.length?A:S,N)?O.entity+=N:(C(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=ie);continue;default:throw new Error(O,"Unknown state: "+O.state)}return O.position>=O.bufferCheckPosition&&n(O),O}String.fromCodePoint||(function(){var x=String.fromCharCode,O=Math.floor,H=function(){var N=16384,ne=[],z,ie,we=-1,xe=arguments.length;if(!xe)return"";for(var qe="";++we<xe;){var Et=Number(arguments[we]);if(!isFinite(Et)||Et<0||Et>1114111||O(Et)!==Et)throw RangeError("Invalid code point: "+Et);Et<=65535?ne.push(Et):(Et-=65536,z=(Et>>10)+55296,ie=Et%1024+56320,ne.push(z,ie)),(we+1===xe||ne.length>N)&&(qe+=x.apply(null,ne),ne.length=0)}return qe};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:H,configurable:!0,writable:!0}):String.fromCodePoint=H})()})(typeof zd>"u"?zd.sax={}:zd)});var kN=v(pE=>{(function(){"use strict";pE.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(pE)});var mE=v(Ys=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),Ys.normalize=function(e){return e.toLowerCase()},Ys.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},Ys.stripPrefix=function(e){return e.replace(t,"")},Ys.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},Ys.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(Ys)});var NN=v(ui=>{(function(){"use strict";var t,e,r,n,i,s,o,a,u,c=function(d,f){return function(){return d.apply(f,arguments)}},l=function(d,f){for(var m in f)h.call(f,m)&&(d[m]=f[m]);function y(){this.constructor=d}return y.prototype=f.prototype,d.prototype=new y,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=RN(),n=require("events"),t=kN(),o=mE(),u=require("timers").setImmediate,e=Id().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var y,E,S;for(y=0,E=d.length;y<E;y++)S=d[y],f=S(f,m);return f},r=function(d,f,m){var y;return y=Object.create(null),y.value=m,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(d,f,y)},ui.Parser=(function(d){l(f,d);function f(m){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,E,S;if(!(this instanceof ui.Parser))return new ui.Parser(m);this.options={},E=e["0.2"];for(y in E)h.call(E,y)&&(S=E[y],this.options[y]=S);for(y in m)h.call(m,y)&&(S=m[y],this.options[y]=S);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return f.prototype.processAsync=function(){var m,y;try{return this.remaining.length<=this.options.chunkSize?(m=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(m),this.saxParser.close()):(m=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(m),u(this.processAsync))}catch(E){if(y=E,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(m,y,E){return y in m?(m[y]instanceof Array||r(m,y,[m[y]]),m[y].push(E)):this.options.explicitArray?r(m,y,[E]):r(m,y,E)},f.prototype.reset=function(){var m,y,E,S;return this.removeAllListeners(),this.saxParser=a.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(function(A){return function(p){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",p)}})(this),this.saxParser.onend=(function(A){return function(){if(!A.saxParser.ended)return A.saxParser.ended=!0,A.emit("end",A.resultObject)}})(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,S=[],m=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,_,P,b;if(_={},_[y]="",!A.options.ignoreAttrs){b=p.attributes;for(D in b)h.call(b,D)&&(!(m in _)&&!A.options.mergeAttrs&&(_[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],P=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(_,P,w):r(_[m],P,w))}return _["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(_[A.options.xmlnskey]={uri:p.uri,local:p.local}),S.push(_)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,_,P,b,k,R,I,j;if(b=S.pop(),P=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(p=b.cdata,delete b.cdata),I=S[S.length-1],b[y].match(/^\s*$/)&&!p?(D=b[y],delete b[y]):(A.options.trim&&(b[y]=b[y].trim()),A.options.normalize&&(b[y]=b[y].replace(/\s{2,}/g," ").trim()),b[y]=A.options.valueProcessors?s(A.options.valueProcessors,b[y],P):b[y],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])),i(b)&&(typeof A.options.emptyTag=="function"?b=A.options.emptyTag():b=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(j="/"+(function(){var U,K,L;for(L=[],U=0,K=S.length;U<K;U++)_=S[U],L.push(_["#name"]);return L})().concat(P).join("/"),(function(){var U;try{return b=A.options.validator(j,I&&I[P],b)}catch(K){return U=K,A.emit("error",U)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)_={},A.options.attrkey in b&&(_[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(_[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(_[A.options.childkey]=b),b=_;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in b)h.call(b,w)&&r(k,w,b[w]);I[A.options.childkey].push(k),delete b["#name"],Object.keys(b).length===1&&y in b&&!A.EXPLICIT_CHARKEY&&(b=b[y])}}return S.length>0?A.assignOrPush(I,P,b):(A.options.explicitRoot&&(R=b,b={},r(b,P,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),E=(function(A){return function(p){var D,w;if(w=S[S.length-1],w)return w[y]+=p,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||p.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[y]=p,A.options.normalize&&(D[y]=D[y].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=E,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=E(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,y){var E;y!=null&&typeof y=="function"&&(this.on("end",function(S){return this.reset(),y(null,S)}),this.on("error",function(S){return this.reset(),y(S)}));try{return m=m.toString(),m.trim()===""?(this.emit("end",null),!0):(m=t.stripBOM(m),this.options.async?(this.remaining=m,u(this.processAsync),this.saxParser):this.saxParser.write(m).close())}catch(S){if(E=S,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw E}else return this.emit("error",E),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(y){return function(E,S){return y.parseString(m,function(A,p){return A?S(A):E(p)})}})(this))},f})(n),ui.parseString=function(d,f,m){var y,E,S;return m!=null?(typeof m=="function"&&(y=m),typeof f=="object"&&(E=f)):(typeof f=="function"&&(y=f),E={}),S=new ui.Parser(E),S.parseString(d,y)},ui.parseStringPromise=function(d,f){var m,y;return typeof f=="object"&&(m=f),y=new ui.Parser(m),y.parseStringPromise(d)}}).call(ui)});var $N=v(ci=>{(function(){"use strict";var t,e,r,n,i=function(o,a){for(var u in a)s.call(a,u)&&(o[u]=a[u]);function c(){this.constructor=o}return c.prototype=a.prototype,o.prototype=new c,o.__super__=a.prototype,o},s={}.hasOwnProperty;e=Id(),t=PN(),r=NN(),n=mE(),ci.defaults=e.defaults,ci.processors=n,ci.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),ci.Builder=t.Builder,ci.Parser=r.Parser,ci.parseString=r.parseString,ci.parseStringPromise=r.parseStringPromise}).call(ci)});var LN=v(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.buildXmlElement=Rn.writeXML=Rn.parseXML=Rn.readXML=void 0;var Bre=(fe(),ue(le)),Mre=Ea(),Pc=Bre.__importDefault($N());async function qre(t){var e;try{let r=await(0,Mre.readFile)(t,{encoding:"utf-8"});try{return await Pc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Rn.readXML=qre;function Ure(t,e){let r=e!==void 0?new Pc.default.Parser({...e}):new Pc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Rn.parseXML=Ure;async function Hre(t){return new Promise(e=>{let n=new Pc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Rn.writeXML=Hre;function Vre(t,e){return new Pc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Rn.buildXmlElement=Vre});var UN=v(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.getAllElements=je.getFilePath=je.getAssets=je.getJSModules=je.getPluginType=je.getPlatformElement=je.getPluginPlatform=je.printPlugins=je.fixName=je.getDependencies=je.resolvePlugin=je.getPlugins=je.getIncludedPluginPackages=void 0;var zre=(fe(),ue(le)),Kre=Ea(),gE=require("path"),Ra=zre.__importDefault(ba()),Gre=id(),Wre=Dc(),jN=Td(),Xre=LN();function BN(t,e){var r,n,i,s;let{extConfig:o}=t.app;switch(e){case"android":return(n=(r=o.android)===null||r===void 0?void 0:r.includePlugins)!==null&&n!==void 0?n:o.includePlugins;case"ios":return(s=(i=o.ios)===null||i===void 0?void 0:i.includePlugins)!==null&&s!==void 0?s:o.includePlugins}}je.getIncludedPluginPackages=BN;async function Yre(t,e){var r;let n=(r=BN(t,e))!==null&&r!==void 0?r:qN(t);return(await Promise.all(n.map(async s=>MN(t,s)))).filter(s=>!!s)}je.getPlugins=Yre;async function MN(t,e){try{let r=(0,jN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Gre.fatal)(`Unable to find ${Ra.default.strong(`node_modules/${e}`)}.
195
+ Are you sure ${Ra.default.strong(e)} is installed?`);let n=(0,gE.dirname)(r),i=await(0,Kre.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:yE(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,gE.join)(n,"plugin.xml"),o=await(0,Xre.readXML)(s);return{id:e,name:yE(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}je.resolvePlugin=MN;function qN(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:{})]}je.getDependencies=qN;function yE(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}je.fixName=yE;function Jre(t,e,r="capacitor"){if(t.length===0)return;let n,i=t.length===1?"":"s";switch(r){case"cordova":n=`Found ${t.length} Cordova plugin${i} for ${Ra.default.strong(e)}:
196
196
  `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${Ra.default.strong(e)}, skipped install:
197
197
  `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${Ra.default.strong(e)}:
198
198
  `;break}n+=t.map(s=>`${s.id}${Ra.default.weak(`@${s.version}`)}`).join(`
199
- `),Wre.logger.info(n)}Le.printPlugins=Jre;function DE(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Le.getPluginPlatform=DE;function Zre(t,e,r){let n=DE(t,e);if(n){let i=n[r];if(i)return i}return[]}Le.getPlatformElement=Zre;function Qre(t,e){var r,n,i,s;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(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Le.getPluginType=Qre;function ene(t,e){return wE(t,e,"js-module")}Le.getJSModules=ene;function tne(t,e){return wE(t,e,"asset")}Le.getAssets=tne;function rne(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 i=(0,jN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,gE.join)(e.rootPath,r)}Le.getFilePath=rne;function wE(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=DE(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Le.getAllElements=wE});var HN=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function nne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=nne;async function ine(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=ine;async function sne(t,e){return EE(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=sne;async function one(t,e){return EE(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=one;async function EE(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=EE;function Kd(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=Kd;function ane(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:Kd(Kd(t,e,1),r,0,n)}jt.move=ane;function une(t,e,r){return e<0||e>t.length?[...t]:Kd(t,e,1,r)}jt.replace=une});var Rc=v(Ki=>{"use strict";var VN=Ie().fromCallback,ur=yt(),cne=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Ki[t]=ur[t])});cne.forEach(t=>{Ki[t]=VN(ur[t])});Ki.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Ki.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Ki.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Ki.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Ki.realpath.native=VN(ur.realpath.native))});var bE=v((sEe,zN)=>{zN.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var YN=v((oEe,vE)=>{"use strict";var ka=Rc(),li=require("path"),lne=bE(),KN=lne("10.12.0"),GN=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(li.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},WN=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},XN=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};vE.exports.makeDir=async(t,e)=>{if(GN(t),e=WN(e),KN){let n=li.resolve(t);return ka.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await ka.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(li.dirname(n)===n)throw XN(n);if(i.message.includes("null bytes"))throw i;return await r(li.dirname(n)),r(n)}try{if(!(await ka.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(li.resolve(t))};vE.exports.makeDirSync=(t,e)=>{if(GN(t),e=WN(e),KN){let n=li.resolve(t);return ka.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{ka.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(li.dirname(n)===n)throw XN(n);if(i.message.includes("null bytes"))throw i;return r(li.dirname(n)),r(n)}try{if(!ka.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(li.resolve(t))}});var fn=v((aEe,JN)=>{"use strict";var fne=Ie().fromPromise,{makeDir:hne,makeDirSync:_E}=YN(),CE=fne(hne);JN.exports={mkdirs:CE,mkdirsSync:_E,mkdirp:CE,mkdirpSync:_E,ensureDir:CE,ensureDirSync:_E}});var SE=v((uEe,ZN)=>{"use strict";var Na=yt();function dne(t,e,r,n){Na.open(t,"r+",(i,s)=>{if(i)return n(i);Na.futimes(s,e,r,o=>{Na.close(s,a=>{n&&n(o||a)})})})}function pne(t,e,r){let n=Na.openSync(t,"r+");return Na.futimesSync(n,e,r),Na.closeSync(n)}ZN.exports={utimesMillis:dne,utimesMillisSync:pne}});var kc=v((cEe,r$)=>{"use strict";var $a=Rc(),Sr=require("path"),mne=require("util"),gne=bE(),Gd=gne("10.5.0"),QN=t=>Gd?$a.stat(t,{bigint:!0}):$a.stat(t),AE=t=>Gd?$a.statSync(t,{bigint:!0}):$a.statSync(t);function yne(t,e){return Promise.all([QN(t),QN(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function Dne(t,e){let r,n=AE(t);try{r=AE(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function wne(t,e,r,n){mne.callbackify(yne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&Wd(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&OE(t,e)?n(new Error(Xd(t,e,r))):n(null,{srcStat:o,destStat:a})})}function Ene(t,e,r){let{srcStat:n,destStat:i}=Dne(t,e);if(i&&Wd(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&OE(t,e))throw new Error(Xd(t,e,r));return{srcStat:n,destStat:i}}function e$(t,e,r,n,i){let s=Sr.resolve(Sr.dirname(t)),o=Sr.resolve(Sr.dirname(r));if(o===s||o===Sr.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):Wd(e,c)?i(new Error(Xd(t,r,n))):e$(t,e,o,n,i);Gd?$a.stat(o,{bigint:!0},a):$a.stat(o,a)}function t$(t,e,r,n){let i=Sr.resolve(Sr.dirname(t)),s=Sr.resolve(Sr.dirname(r));if(s===i||s===Sr.parse(s).root)return;let o;try{o=AE(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(Wd(e,o))throw new Error(Xd(t,r,n));return t$(t,e,s,n)}function Wd(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(Gd||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function OE(t,e){let r=Sr.resolve(t).split(Sr.sep).filter(i=>i),n=Sr.resolve(e).split(Sr.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function Xd(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}r$.exports={checkPaths:wne,checkPathsSync:Ene,checkParentPaths:e$,checkParentPathsSync:t$,isSrcSubdir:OE}});var a$=v((lEe,o$)=>{"use strict";var Wt=yt(),Nc=require("path"),bne=fn().mkdirsSync,vne=SE().utimesMillisSync,$c=kc();function _ne(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"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
199
+ `),Wre.logger.info(n)}je.printPlugins=Jre;function DE(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}je.getPluginPlatform=DE;function Zre(t,e,r){let n=DE(t,e);if(n){let i=n[r];if(i)return i}return[]}je.getPlatformElement=Zre;function Qre(t,e){var r,n,i,s;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(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}je.getPluginType=Qre;function ene(t,e){return wE(t,e,"js-module")}je.getJSModules=ene;function tne(t,e){return wE(t,e,"asset")}je.getAssets=tne;function rne(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 i=(0,jN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,gE.join)(e.rootPath,r)}je.getFilePath=rne;function wE(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=DE(t,e);return i?.[r]&&(n=n.concat(i[r])),n}je.getAllElements=wE});var HN=v(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function nne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=nne;async function ine(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=ine;async function sne(t,e){return EE(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=sne;async function one(t,e){return EE(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=one;async function EE(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=EE;function Kd(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=Kd;function ane(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:Kd(Kd(t,e,1),r,0,n)}jt.move=ane;function une(t,e,r){return e<0||e>t.length?[...t]:Kd(t,e,1,r)}jt.replace=une});var Rc=v(Ki=>{"use strict";var VN=Ie().fromCallback,ur=yt(),cne=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Ki[t]=ur[t])});cne.forEach(t=>{Ki[t]=VN(ur[t])});Ki.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Ki.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Ki.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Ki.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Ki.realpath.native=VN(ur.realpath.native))});var bE=v((sEe,zN)=>{zN.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var YN=v((oEe,vE)=>{"use strict";var ka=Rc(),li=require("path"),lne=bE(),KN=lne("10.12.0"),GN=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(li.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},WN=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},XN=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};vE.exports.makeDir=async(t,e)=>{if(GN(t),e=WN(e),KN){let n=li.resolve(t);return ka.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await ka.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(li.dirname(n)===n)throw XN(n);if(i.message.includes("null bytes"))throw i;return await r(li.dirname(n)),r(n)}try{if(!(await ka.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(li.resolve(t))};vE.exports.makeDirSync=(t,e)=>{if(GN(t),e=WN(e),KN){let n=li.resolve(t);return ka.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{ka.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(li.dirname(n)===n)throw XN(n);if(i.message.includes("null bytes"))throw i;return r(li.dirname(n)),r(n)}try{if(!ka.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(li.resolve(t))}});var fn=v((aEe,JN)=>{"use strict";var fne=Ie().fromPromise,{makeDir:hne,makeDirSync:_E}=YN(),CE=fne(hne);JN.exports={mkdirs:CE,mkdirsSync:_E,mkdirp:CE,mkdirpSync:_E,ensureDir:CE,ensureDirSync:_E}});var SE=v((uEe,ZN)=>{"use strict";var Na=yt();function dne(t,e,r,n){Na.open(t,"r+",(i,s)=>{if(i)return n(i);Na.futimes(s,e,r,o=>{Na.close(s,a=>{n&&n(o||a)})})})}function pne(t,e,r){let n=Na.openSync(t,"r+");return Na.futimesSync(n,e,r),Na.closeSync(n)}ZN.exports={utimesMillis:dne,utimesMillisSync:pne}});var kc=v((cEe,r$)=>{"use strict";var $a=Rc(),Sr=require("path"),mne=require("util"),gne=bE(),Gd=gne("10.5.0"),QN=t=>Gd?$a.stat(t,{bigint:!0}):$a.stat(t),AE=t=>Gd?$a.statSync(t,{bigint:!0}):$a.statSync(t);function yne(t,e){return Promise.all([QN(t),QN(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function Dne(t,e){let r,n=AE(t);try{r=AE(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function wne(t,e,r,n){mne.callbackify(yne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&Wd(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&OE(t,e)?n(new Error(Xd(t,e,r))):n(null,{srcStat:o,destStat:a})})}function Ene(t,e,r){let{srcStat:n,destStat:i}=Dne(t,e);if(i&&Wd(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&OE(t,e))throw new Error(Xd(t,e,r));return{srcStat:n,destStat:i}}function e$(t,e,r,n,i){let s=Sr.resolve(Sr.dirname(t)),o=Sr.resolve(Sr.dirname(r));if(o===s||o===Sr.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):Wd(e,c)?i(new Error(Xd(t,r,n))):e$(t,e,o,n,i);Gd?$a.stat(o,{bigint:!0},a):$a.stat(o,a)}function t$(t,e,r,n){let i=Sr.resolve(Sr.dirname(t)),s=Sr.resolve(Sr.dirname(r));if(s===i||s===Sr.parse(s).root)return;let o;try{o=AE(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(Wd(e,o))throw new Error(Xd(t,r,n));return t$(t,e,s,n)}function Wd(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(Gd||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function OE(t,e){let r=Sr.resolve(t).split(Sr.sep).filter(i=>i),n=Sr.resolve(e).split(Sr.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function Xd(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}r$.exports={checkPaths:wne,checkPathsSync:Ene,checkParentPaths:e$,checkParentPathsSync:t$,isSrcSubdir:OE}});var a$=v((lEe,o$)=>{"use strict";var Wt=yt(),Nc=require("path"),bne=fn().mkdirsSync,vne=SE().utimesMillisSync,$c=kc();function _ne(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"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
200
200
 
201
201
  see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=$c.checkPathsSync(t,e,"copy");return $c.checkParentPathsSync(t,n,e,"copy"),Cne(i,t,e,r)}function Cne(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=Nc.dirname(r);return Wt.existsSync(i)||bne(i),n$(t,e,r,n)}function n$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return Sne(t,e,r,n)}function Sne(t,e,r,n){let s=(n.dereference?Wt.statSync:Wt.lstatSync)(e);if(s.isDirectory())return Pne(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return Ane(s,t,e,r,n);if(s.isSymbolicLink())return Nne(t,e,r,n)}function Ane(t,e,r,n,i){return e?One(t,r,n,i):i$(t,r,n,i)}function One(t,e,r,n){if(n.overwrite)return Wt.unlinkSync(r),i$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function i$(t,e,r,n){return Wt.copyFileSync(e,r),n.preserveTimestamps&&xne(t.mode,e,r),xE(r,t.mode)}function xne(t,e,r){return Tne(t)&&Ine(r,t),Fne(e,r)}function Tne(t){return(t&128)===0}function Ine(t,e){return xE(t,e|128)}function xE(t,e){return Wt.chmodSync(t,e)}function Fne(t,e){let r=Wt.statSync(t);return vne(e,r.atime,r.mtime)}function Pne(t,e,r,n,i){if(!e)return Rne(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return s$(r,n,i)}function Rne(t,e,r,n){return Wt.mkdirSync(r),s$(e,r,n),xE(r,t)}function s$(t,e,r){Wt.readdirSync(t).forEach(n=>kne(n,t,e,r))}function kne(t,e,r,n){let i=Nc.join(e,t),s=Nc.join(r,t),{destStat:o}=$c.checkPathsSync(i,s,"copy");return n$(o,i,s,n)}function Nne(t,e,r,n){let i=Wt.readlinkSync(e);if(n.dereference&&(i=Nc.resolve(process.cwd(),i)),t){let s;try{s=Wt.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Wt.symlinkSync(i,r);throw o}if(n.dereference&&(s=Nc.resolve(process.cwd(),s)),$c.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Wt.statSync(r).isDirectory()&&$c.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return $ne(i,r)}else return Wt.symlinkSync(i,r)}function $ne(t,e){return Wt.unlinkSync(e),Wt.symlinkSync(t,e)}o$.exports=_ne});var TE=v((fEe,u$)=>{"use strict";u$.exports={copySync:a$()}});var Gi=v((hEe,l$)=>{"use strict";var Lne=Ie().fromPromise,c$=Rc();function jne(t){return c$.access(t).then(()=>!0).catch(()=>!1)}l$.exports={pathExists:Lne(jne),pathExistsSync:c$.existsSync}});var w$=v((dEe,D$)=>{"use strict";var Ar=yt(),Lc=require("path"),Bne=fn().mkdirs,Mne=Gi().pathExists,qne=SE().utimesMillis,jc=kc();function Une(t,e,r,n){typeof r=="function"&&!n?(n=r,r={}):typeof r=="function"&&(r={filter:r}),n=n||function(){},r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
202
202
 
203
- see https://github.com/jprichardson/node-fs-extra/issues/269`),jc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;jc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?p$(f$,a,t,e,r,n):f$(a,t,e,r,n))})}function f$(t,e,r,n,i){let s=Lc.dirname(r);Mne(s,(o,a)=>{if(o)return i(o);if(a)return IE(t,e,r,n,i);Bne(s,u=>u?i(u):IE(t,e,r,n,i))})}function p$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function IE(t,e,r,n,i){return n.filter?p$(h$,t,e,r,n,i):h$(t,e,r,n,i)}function h$(t,e,r,n,i){(n.dereference?Ar.stat:Ar.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Xne(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Hne(a,t,e,r,n,i);if(a.isSymbolicLink())return Zne(t,e,r,n,i)})}function Hne(t,e,r,n,i,s){return e?Vne(t,r,n,i,s):m$(t,r,n,i,s)}function Vne(t,e,r,n,i){if(n.overwrite)Ar.unlink(r,s=>s?i(s):m$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function m$(t,e,r,n,i){Ar.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?zne(t.mode,e,r,i):Yd(r,t.mode,i))}function zne(t,e,r,n){return Kne(t)?Gne(r,t,i=>i?n(i):d$(t,e,r,n)):d$(t,e,r,n)}function Kne(t){return(t&128)===0}function Gne(t,e,r){return Yd(t,e|128,r)}function d$(t,e,r,n){Wne(e,r,i=>i?n(i):Yd(r,t,n))}function Yd(t,e,r){return Ar.chmod(t,e,r)}function Wne(t,e,r){Ar.stat(t,(n,i)=>n?r(n):qne(e,i.atime,i.mtime,r))}function Xne(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):g$(r,n,i,s):Yne(t.mode,r,n,i,s)}function Yne(t,e,r,n,i){Ar.mkdir(r,s=>{if(s)return i(s);g$(e,r,n,o=>o?i(o):Yd(r,t,i))})}function g$(t,e,r,n){Ar.readdir(t,(i,s)=>i?n(i):y$(s,t,e,r,n))}function y$(t,e,r,n,i){let s=t.pop();return s?Jne(t,s,e,r,n,i):i()}function Jne(t,e,r,n,i,s){let o=Lc.join(r,e),a=Lc.join(n,e);jc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;IE(l,o,a,i,h=>h?s(h):y$(t,r,n,i,s))})}function Zne(t,e,r,n,i){Ar.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Lc.resolve(process.cwd(),o)),t)Ar.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Ar.symlink(o,r,i):i(a):(n.dereference&&(u=Lc.resolve(process.cwd(),u)),jc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&jc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Qne(o,r,i)));else return Ar.symlink(o,r,i)})}function Qne(t,e,r){Ar.unlink(e,n=>n?r(n):Ar.symlink(t,e,r))}D$.exports=Une});var FE=v((pEe,E$)=>{"use strict";var eie=Ie().fromCallback;E$.exports={copy:eie(w$())}});var T$=v((mEe,x$)=>{"use strict";var b$=yt(),S$=require("path"),Be=require("assert"),Bc=process.platform==="win32";function A$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||b$[r],r=r+"Sync",t[r]=t[r]||b$[r]}),t.maxBusyTries=t.maxBusyTries||3}function PE(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be.strictEqual(typeof r,"function","rimraf: callback function required"),Be(e,"rimraf: invalid options argument provided"),Be.strictEqual(typeof e,"object","rimraf: options should be object"),A$(e),v$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>v$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function v$(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Bc)return _$(t,e,n,r);if(i&&i.isDirectory())return Jd(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Bc?_$(t,e,s,r):Jd(t,e,s,r);if(s.code==="EISDIR")return Jd(t,e,s,r)}return r(s)})})}function _$(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?Jd(t,e,r,n):e.unlink(t,n)})})}function C$(t,e,r){let n;Be(t),Be(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Zd(t,e,r):e.unlinkSync(t)}function Jd(t,e,r,n){Be(t),Be(e),Be(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?tie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function tie(t,e,r){Be(t),Be(e),Be(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{PE(S$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function O$(t,e){let r;e=e||{},A$(e),Be(t,"rimraf: missing path"),Be.strictEqual(typeof t,"string","rimraf: path should be a string"),Be(e,"rimraf: missing options"),Be.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Bc&&C$(t,e,n)}try{r&&r.isDirectory()?Zd(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Bc?C$(t,e,n):Zd(t,e,n);if(n.code!=="EISDIR")throw n;Zd(t,e,n)}}function Zd(t,e,r){Be(t),Be(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")rie(t,e);else if(n.code!=="ENOENT")throw n}}function rie(t,e){if(Be(t),Be(e),e.readdirSync(t).forEach(r=>O$(S$.join(t,r),e)),Bc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}x$.exports=PE;PE.sync=O$});var Mc=v((gEe,F$)=>{"use strict";var nie=Ie().fromCallback,I$=T$();F$.exports={remove:nie(I$),removeSync:I$.sync}});var B$=v((yEe,j$)=>{"use strict";var iie=Ie().fromCallback,k$=yt(),N$=require("path"),$$=fn(),L$=Mc(),P$=iie(function(e,r){r=r||function(){},k$.readdir(e,(n,i)=>{if(n)return $$.mkdirs(e,r);i=i.map(o=>N$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();L$.remove(o,a=>{if(a)return r(a);s()})}})});function R$(t){let e;try{e=k$.readdirSync(t)}catch{return $$.mkdirsSync(t)}e.forEach(r=>{r=N$.join(t,r),L$.removeSync(r)})}j$.exports={emptyDirSync:R$,emptydirSync:R$,emptyDir:P$,emptydir:P$}});var H$=v((DEe,U$)=>{"use strict";var sie=Ie().fromCallback,M$=require("path"),Wi=yt(),q$=fn();function oie(t,e){function r(){Wi.writeFile(t,"",n=>{if(n)return e(n);e()})}Wi.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=M$.dirname(t);Wi.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?q$.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():Wi.readdir(s,u=>{if(u)return e(u)})})})}function aie(t){let e;try{e=Wi.statSync(t)}catch{}if(e&&e.isFile())return;let r=M$.dirname(t);try{Wi.statSync(r).isDirectory()||Wi.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")q$.mkdirsSync(r);else throw n}Wi.writeFileSync(t,"")}U$.exports={createFile:sie(oie),createFileSync:aie}});var W$=v((wEe,G$)=>{"use strict";var uie=Ie().fromCallback,z$=require("path"),Js=yt(),K$=fn(),V$=Gi().pathExists;function cie(t,e,r){function n(i,s){Js.link(i,s,o=>{if(o)return r(o);r(null)})}V$(e,(i,s)=>{if(i)return r(i);if(s)return r(null);Js.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=z$.dirname(e);V$(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);K$.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function lie(t,e){if(Js.existsSync(e))return;try{Js.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=z$.dirname(e);return Js.existsSync(n)||K$.mkdirsSync(n),Js.linkSync(t,e)}G$.exports={createLink:uie(cie),createLinkSync:lie}});var Y$=v((EEe,X$)=>{"use strict";var Xi=require("path"),qc=yt(),fie=Gi().pathExists;function hie(t,e,r){if(Xi.isAbsolute(t))return qc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=Xi.dirname(e),i=Xi.join(n,t);return fie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):qc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:Xi.relative(n,t)})))}}function die(t,e){let r;if(Xi.isAbsolute(t)){if(r=qc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=Xi.dirname(e),i=Xi.join(n,t);if(r=qc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=qc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Xi.relative(n,t)}}}X$.exports={symlinkPaths:hie,symlinkPathsSync:die}});var Q$=v((bEe,Z$)=>{"use strict";var J$=yt();function pie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);J$.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function mie(t,e){let r;if(e)return e;try{r=J$.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Z$.exports={symlinkType:pie,symlinkTypeSync:mie}});var oL=v((vEe,sL)=>{"use strict";var gie=Ie().fromCallback,tL=require("path"),La=yt(),rL=fn(),yie=rL.mkdirs,Die=rL.mkdirsSync,nL=Y$(),wie=nL.symlinkPaths,Eie=nL.symlinkPathsSync,iL=Q$(),bie=iL.symlinkType,vie=iL.symlinkTypeSync,eL=Gi().pathExists;function _ie(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,eL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);wie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,bie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=tL.dirname(e);eL(l,(h,d)=>{if(h)return n(h);if(d)return La.symlink(t,e,c,n);yie(l,f=>{if(f)return n(f);La.symlink(t,e,c,n)})})})})})}function Cie(t,e,r){if(La.existsSync(e))return;let i=Eie(t,e);t=i.toDst,r=vie(i.toCwd,r);let s=tL.dirname(e);return La.existsSync(s)||Die(s),La.symlinkSync(t,e,r)}sL.exports={createSymlink:gie(_ie),createSymlinkSync:Cie}});var uL=v((_Ee,aL)=>{"use strict";var Qd=H$(),ep=W$(),tp=oL();aL.exports={createFile:Qd.createFile,createFileSync:Qd.createFileSync,ensureFile:Qd.createFile,ensureFileSync:Qd.createFileSync,createLink:ep.createLink,createLinkSync:ep.createLinkSync,ensureLink:ep.createLink,ensureLinkSync:ep.createLinkSync,createSymlink:tp.createSymlink,createSymlinkSync:tp.createSymlinkSync,ensureSymlink:tp.createSymlink,ensureSymlinkSync:tp.createSymlinkSync}});var lL=v((CEe,cL)=>{"use strict";var rp=b0();cL.exports={readJson:rp.readFile,readJsonSync:rp.readFileSync,writeJson:rp.writeFile,writeJsonSync:rp.writeFileSync}});var np=v((SEe,dL)=>{"use strict";var Sie=Ie().fromCallback,Uc=yt(),fL=require("path"),hL=fn(),Aie=Gi().pathExists;function Oie(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=fL.dirname(t);Aie(i,(s,o)=>{if(s)return n(s);if(o)return Uc.writeFile(t,e,r,n);hL.mkdirs(i,a=>{if(a)return n(a);Uc.writeFile(t,e,r,n)})})}function xie(t,...e){let r=fL.dirname(t);if(Uc.existsSync(r))return Uc.writeFileSync(t,...e);hL.mkdirsSync(r),Uc.writeFileSync(t,...e)}dL.exports={outputFile:Sie(Oie),outputFileSync:xie}});var mL=v((AEe,pL)=>{"use strict";var{stringify:Tie}=Da(),{outputFile:Iie}=np();async function Fie(t,e,r={}){let n=Tie(e,r);await Iie(t,n,r)}pL.exports=Fie});var yL=v((OEe,gL)=>{"use strict";var{stringify:Pie}=Da(),{outputFileSync:Rie}=np();function kie(t,e,r){let n=Pie(e,r);Rie(t,n,r)}gL.exports=kie});var wL=v((xEe,DL)=>{"use strict";var Nie=Ie().fromPromise,cr=lL();cr.outputJson=Nie(mL());cr.outputJsonSync=yL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;DL.exports=cr});var SL=v((TEe,CL)=>{"use strict";var vL=yt(),$ie=require("path"),Lie=TE().copySync,_L=Mc().removeSync,jie=fn().mkdirpSync,EL=kc();function Bie(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=EL.checkPathsSync(t,e,"move");return EL.checkParentPathsSync(t,i,e,"move"),jie($ie.dirname(e)),Mie(t,e,n)}function Mie(t,e,r){if(r)return _L(e),bL(t,e,r);if(vL.existsSync(e))throw new Error("dest already exists.");return bL(t,e,r)}function bL(t,e,r){try{vL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return qie(t,e,r)}}function qie(t,e,r){return Lie(t,e,{overwrite:r,errorOnExist:!0}),_L(t)}CL.exports=Bie});var OL=v((IEe,AL)=>{"use strict";AL.exports={moveSync:SL()}});var PL=v((FEe,FL)=>{"use strict";var Uie=yt(),Hie=require("path"),Vie=FE().copy,IL=Mc().remove,zie=fn().mkdirp,Kie=Gi().pathExists,xL=kc();function Gie(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;xL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;xL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);zie(Hie.dirname(e),c=>c?n(c):Wie(t,e,i,n))})})}function Wie(t,e,r,n){if(r)return IL(e,i=>i?n(i):TL(t,e,r,n));Kie(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):TL(t,e,r,n))}function TL(t,e,r,n){Uie.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Xie(t,e,r,n):n())}function Xie(t,e,r,n){Vie(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):IL(t,n))}FL.exports=Gie});var kL=v((PEe,RL)=>{"use strict";var Yie=Ie().fromCallback;RL.exports={move:Yie(PL())}});var ip=v((REe,RE)=>{"use strict";RE.exports={...Rc(),...TE(),...FE(),...B$(),...uL(),...wL(),...fn(),...OL(),...kL(),...np(),...Gi(),...Mc()};var NL=require("fs");Object.getOwnPropertyDescriptor(NL,"promises")&&Object.defineProperty(RE.exports,"promises",{get(){return NL.promises}})});var kE=v(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.readdir=ja.stat=void 0;var $L=ip();async function Jie(t){try{return await $L.stat(t)}catch{}}ja.stat=Jie;async function Zie(t){try{return await $L.readdir(t)}catch{return[]}}ja.readdir=Zie});var UL=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Qie=(fe(),ue(le)),Gr=ip(),ese=require("os"),fi=require("path"),LL=require("stream"),jL=kE();Qie.__exportStar(ip(),me);var BL=kE();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return BL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return BL.readdir}});async function tse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=$E(t,n);e&&(a=a.pipe(new LL.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=tse;async function rse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=fi.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=fi.resolve(t),$E(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=rse;async function nse(t){try{return await Gr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=nse;async function NE(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Gr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=NE;async function ise(t){return Promise.all([NE(t),(async()=>{try{return(await Gr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=ise;async function sse(t,e){let r=await NE(t);await Gr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=sse;function ose(t,e){return new Promise((r,n)=>{let i=Gr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=ose;async function Hc(t,e){try{await Gr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Hc;async function ase(t){return Hc(t,Gr.constants.F_OK)}me.pathExists=ase;async function use(t){return Hc(t,Gr.constants.R_OK)}me.pathReadable=use;async function cse(t){return Hc(t,Gr.constants.W_OK)}me.pathWritable=cse;async function ML(t){return Hc(t,Gr.constants.X_OK)}me.pathExecutable=ML;async function lse(t){let[e,r]=await Promise.all([jL.stat(t),ML(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=lse;async function fse(t,e){if(!(!t||!e)){for(let r of qL(t))if((await jL.readdir(r)).includes(e))return r}}me.findBaseDirectory=fse;function hse(t){let e=Math.random().toString(16).substring(2,8);return fi.resolve(ese.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=hse;function qL(t){if(t=fi.normalize(t),!fi.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=fi.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(fi.sep).map((r,n,i)=>e.root+fi.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=qL;var sp=class extends LL.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Gr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Gr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>fi.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=sp;function $E(t,e={}){return new sp(t,e)}me.walk=$E});var HL=v(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.AliasedMap=hi.CaseInsensitiveProxyHandler=hi.createCaseInsensitiveObject=void 0;function dse(){return new Proxy({},hi.CaseInsensitiveProxyHandler)}hi.createCaseInsensitiveObject=dse;hi.CaseInsensitiveProxyHandler={has:(t,e)=>op(e)in t,get:(t,e)=>t[op(e)],set:(t,e,r)=>(t[op(e)]=r,!0),deleteProperty:(t,e)=>delete t[op(e)]};var op=t=>typeof t=="string"?t.toLowerCase():t,LE=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};hi.AliasedMap=LE});var XL=v((LEe,WL)=>{"use strict";var GL=require("child_process"),VL=GL.spawn,pse=GL.exec;WL.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":pse("taskkill /pid "+t+" /T /F",r);break;case"darwin":jE(t,n,i,function(s){return VL("pgrep",["-P",s])},function(){zL(n,e,r)});break;default:jE(t,n,i,function(s){return VL("ps",["-o","pid","--no-headers","--ppid",s])},function(){zL(n,e,r)});break}};function zL(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(KL(s,e),n[s]=1)}),n[i]||(KL(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function KL(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function jE(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,jE(c,e,r,n,i)})};s.on("close",a)}});var ZL=v(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.processExit=Qe.offBeforeExit=Qe.onBeforeExit=Qe.onExit=Qe.sleepForever=Qe.sleepUntil=Qe.sleep=Qe.getPathParts=Qe.createProcessEnv=Qe.killProcessTree=Qe.ERROR_TIMEOUT_REACHED=void 0;var BE=(fe(),ue(le)),mse=HL(),gse=ji(),yse=Uh(),Dse=BE.__importStar(require("path")),wse=BE.__importDefault(Ph()),Ese=BE.__importDefault(XL()),Zs=(0,yse.debug)("ionic:utils-process");Qe.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function bse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Ese.default)(t,e,i=>{if(i)return Zs("error while killing process tree for %d: %O",t,i),n(i);r()})})}Qe.killProcessTree=bse;function vse(...t){return Object.assign(gse.TERMINAL_INFO.windows?(0,mse.createCaseInsensitiveObject)():{},...t)}Qe.createProcessEnv=vse;function _se(t=process.env.PATH||""){return t.split(Dse.delimiter)}Qe.getPathParts=_se;async function YL(t){return new Promise(e=>{setTimeout(e,t)})}Qe.sleep=YL;async function Cse(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await YL(e),n+=e,n>r)throw Qe.ERROR_TIMEOUT_REACHED}Qe.sleepUntil=Cse;async function Sse(){return new Promise(()=>{setInterval(()=>{},1e3)})}Qe.sleepForever=Sse;function Ase(t){(0,wse.default)(()=>{Zs("onExit: process.exit/normal shutdown"),t()})}Qe.onExit=Ase;var ap=new Set;function Ose(t){ap.add(t)}Qe.onBeforeExit=Ose;function xse(t){ap.delete(t)}Qe.offBeforeExit=xse;var Tse=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Vc=t=>Tse(async()=>{Zs("onBeforeExit handler: %O received",t),Zs("onBeforeExit handler: running %O functions",ap.size),await Promise.all([...ap.values()].map(async e=>{try{await e()}catch(r){Zs("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(Zs("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,JL[t]),process.kill(process.pid,t))}),JL={SIGINT:Vc("SIGINT"),SIGTERM:Vc("SIGTERM"),SIGHUP:Vc("SIGHUP"),SIGBREAK:Vc("SIGBREAK")};for(let[t,e]of Object.entries(JL))process.on(t,e);var Ise=Vc("process.exit");async function Fse(t=0){process.exitCode=t,await Ise(),Zs("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}Qe.processExit=Fse});var t3=v(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.growBufferForAppendedData=kn.WritableStreamBuffer=kn.ReadableStreamBuffer=kn.NullStream=void 0;var HE=require("stream"),Pse=4,QL=32,e3=16,ME=class extends HE.Writable{_write(e,r,n){n()}};kn.NullStream=ME;var qE=class extends HE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:QL),this.chunkSize=e&&e.chunkSize?e.chunkSize:Pse,this.growSize=e&&e.growSize?e.growSize:e3}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=VE(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};kn.ReadableStreamBuffer=qE;var UE=class extends HE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:QL),this.growSize=e&&e.growSize?e.growSize:e3}get size(){return this._size}_write(e,r,n){this.buffer=VE(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};kn.WritableStreamBuffer=UE;function VE(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}kn.growBufferForAppendedData=VE});var o3=v((MEe,s3)=>{s3.exports=i3;i3.sync=kse;var r3=require("fs");function Rse(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function n3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Rse(e,r)}function i3(t,e,r){r3.stat(t,function(n,i){r(n,n?!1:n3(i,t,e))})}function kse(t,e){return n3(r3.statSync(t),t,e)}});var f3=v((qEe,l3)=>{l3.exports=u3;u3.sync=Nse;var a3=require("fs");function u3(t,e,r){a3.stat(t,function(n,i){r(n,n?!1:c3(i,e))})}function Nse(t,e){return c3(a3.statSync(t),e)}function c3(t,e){return t.isFile()&&$se(t,e)}function $se(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var d3=v((HEe,h3)=>{var UEe=require("fs"),up;process.platform==="win32"||global.TESTING_WINDOWS?up=o3():up=f3();h3.exports=zE;zE.sync=Lse;function zE(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){zE(t,e||{},function(s,o){s?i(s):n(o)})})}up(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Lse(t,e){try{return up.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var E3=v((VEe,w3)=>{var Ba=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",p3=require("path"),jse=Ba?";":":",m3=d3(),g3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),y3=(t,e)=>{let r=e.colon||jse,n=t.match(/\//)||Ba&&t.match(/\\/)?[""]:[...Ba?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ba?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ba?i.split(r):[""];return Ba&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},D3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=y3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(g3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=p3.join(f,t),y=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(y,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];m3(c+m,{pathExt:s},(y,E)=>{if(!y&&E)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},Bse=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=y3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=p3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(m3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw g3(t)};w3.exports=D3;D3.sync=Bse});var v3=v((zEe,KE)=>{"use strict";var b3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};KE.exports=b3;KE.exports.default=b3});var A3=v((KEe,S3)=>{"use strict";var _3=require("path"),Mse=E3(),qse=v3();function C3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=Mse.sync(t.command,{path:r[qse({env:r})],pathExt:e?_3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=_3.resolve(i?t.options.cwd:"",o)),o}function Use(t){return C3(t)||C3(t,!0)}S3.exports=Use});var O3=v((GEe,WE)=>{"use strict";var GE=/([()\][%!^"`<>&|;, *?])/g;function Hse(t){return t=t.replace(GE,"^$1"),t}function Vse(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(GE,"^$1"),e&&(t=t.replace(GE,"^$1")),t}WE.exports.command=Hse;WE.exports.argument=Vse});var T3=v((WEe,x3)=>{"use strict";x3.exports=/^#!(.*)/});var F3=v((XEe,I3)=>{"use strict";var zse=T3();I3.exports=(t="")=>{let e=t.match(zse);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var R3=v((YEe,P3)=>{"use strict";var XE=require("fs"),Kse=F3();function Gse(t){let r=Buffer.alloc(150),n;try{n=XE.openSync(t,"r"),XE.readSync(n,r,0,150,0),XE.closeSync(n)}catch{}return Kse(r.toString())}P3.exports=Gse});var L3=v((JEe,$3)=>{"use strict";var Wse=require("path"),k3=A3(),N3=O3(),Xse=R3(),Yse=process.platform==="win32",Jse=/\.(?:com|exe)$/i,Zse=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Qse(t){t.file=k3(t);let e=t.file&&Xse(t.file);return e?(t.args.unshift(t.file),t.command=e,k3(t)):t.file}function eoe(t){if(!Yse)return t;let e=Qse(t),r=!Jse.test(e);if(t.options.forceShell||r){let n=Zse.test(e);t.command=Wse.normalize(t.command),t.command=N3.command(t.command),t.args=t.args.map(s=>N3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function toe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:eoe(n)}$3.exports=toe});var M3=v((ZEe,B3)=>{"use strict";var YE=process.platform==="win32";function JE(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function roe(t,e){if(!YE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=j3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function j3(t,e){return YE&&t===1&&!e.file?JE(e.original,"spawn"):null}function noe(t,e){return YE&&t===1&&!e.file?JE(e.original,"spawnSync"):null}B3.exports={hookChildProcess:roe,verifyENOENT:j3,verifyENOENTSync:noe,notFoundError:JE}});var H3=v((QEe,Ma)=>{"use strict";var q3=require("child_process"),ZE=L3(),QE=M3();function U3(t,e,r){let n=ZE(t,e,r),i=q3.spawn(n.command,n.args,n.options);return QE.hookChildProcess(i,n),i}function ioe(t,e,r){let n=ZE(t,e,r),i=q3.spawnSync(n.command,n.args,n.options);return i.error=i.error||QE.verifyENOENTSync(i.status,n),i}Ma.exports=U3;Ma.exports.spawn=U3;Ma.exports.sync=ioe;Ma.exports._parse=ZE;Ma.exports._enoent=QE});var Y3=v(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.findExecutables=Fe.which=Fe.fork=Fe.spawn=Fe.Subprocess=Fe.SubprocessError=Fe.convertPATH=Fe.expandTildePath=Fe.TILDE_PATH_REGEX=Fe.ERROR_SIGNAL_EXIT=Fe.ERROR_NON_ZERO_EXIT=Fe.ERROR_COMMAND_NOT_FOUND=void 0;var rb=(fe(),ue(le)),V3=HN(),soe=UL(),eb=ZL(),cp=t3(),z3=ji(),ooe=require("child_process"),aoe=rb.__importDefault(H3()),uoe=rb.__importStar(require("os")),eo=rb.__importStar(require("path"));Fe.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Fe.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Fe.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Fe.TILDE_PATH_REGEX=/^~($|\/|\\)/;function K3(t){let e=uoe.homedir();return t.replace(Fe.TILDE_PATH_REGEX,`${e}$1`)}Fe.expandTildePath=K3;function G3(t=process.env.PATH||""){return t.split(eo.delimiter).map(K3).join(eo.delimiter)}Fe.convertPATH=G3;var Qs=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Fe.SubprocessError=Qs;var tb=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,eb.createProcessEnv)(e.env||{},{PATH:G3(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new cp.WritableStreamBuffer,n=new cp.WritableStreamBuffer,i=new cp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new cp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new Qs("Command not found.",{cause:s}),o.code=Fe.ERROR_COMMAND_NOT_FOUND):o=new Qs("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new Qs("Signal exit from subprocess."),a.code=Fe.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new Qs("Non-zero exit from subprocess."),a.code=Fe.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return W3(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(eo.sep);return r>=0?e.substring(r+1):e}};Fe.Subprocess=tb;function W3(t,e=[],r){return(0,aoe.default)(t,[...e],r)}Fe.spawn=W3;function coe(t,e=[],r={}){return(0,ooe.fork)(t,[...e],r)}Fe.fork=coe;var nb=z3.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function loe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){if(t.includes(eo.sep))return t;let n=await X3(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Fe.which=loe;async function foe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){return t.includes(eo.sep)?[t]:X3(t,{PATH:e})}Fe.findExecutables=foe;async function X3(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){let n=(0,eb.getPathParts)(e),i;if(z3.TERMINAL_INFO.windows){let s=(0,eb.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(eo.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,V3.map)(i,async s=>(0,V3.concurrentFilter)(n.map(o=>eo.join(o,s)),async o=>(0,soe.isExecutableFile)(o))))}});var lp=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.isInstalled=Yi.getCommandOutput=Yi.runCommand=void 0;var ib=Y3();async function J3(t,e,r={}){let n=new ib.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof ib.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}Yi.runCommand=J3;async function hoe(t,e,r={}){try{return(await J3(t,e,r)).trim()}catch{return null}}Yi.getCommandOutput=hoe;async function doe(t){try{await(0,ib.which)(t)}catch{return!1}return!0}Yi.isInstalled=doe});var zc=v((rbe,Z3)=>{"use strict";var poe="2.0.0",moe=Number.MAX_SAFE_INTEGER||9007199254740991,goe=16,yoe=250,Doe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Z3.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:goe,MAX_SAFE_BUILD_LENGTH:yoe,MAX_SAFE_INTEGER:moe,RELEASE_TYPES:Doe,SEMVER_SPEC_VERSION:poe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Kc=v((nbe,Q3)=>{"use strict";var woe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Q3.exports=woe});var qa=v((Nn,ej)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:sb,MAX_SAFE_BUILD_LENGTH:Eoe,MAX_LENGTH:boe}=zc(),voe=Kc();Nn=ej.exports={};var _oe=Nn.re=[],Coe=Nn.safeRe=[],J=Nn.src=[],Soe=Nn.safeSrc=[],Z=Nn.t={},Aoe=0,ob="[a-zA-Z0-9-]",Ooe=[["\\s",1],["\\d",boe],[ob,Eoe]],xoe=t=>{for(let[e,r]of Ooe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=xoe(e),i=Aoe++;voe(t,i,e),Z[t]=i,J[i]=e,Soe[i]=n,_oe[i]=new RegExp(e,r?"g":void 0),Coe[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ob}*`);ge("MAINVERSION",`(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${J[Z.PRERELEASEIDENTIFIER]}(?:\\.${J[Z.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${J[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${J[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${ob}+`);ge("BUILD",`(?:\\+(${J[Z.BUILDIDENTIFIER]}(?:\\.${J[Z.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${J[Z.MAINVERSION]}${J[Z.PRERELEASE]}?${J[Z.BUILD]}?`);ge("FULL",`^${J[Z.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${J[Z.MAINVERSIONLOOSE]}${J[Z.PRERELEASELOOSE]}?${J[Z.BUILD]}?`);ge("LOOSE",`^${J[Z.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${J[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${J[Z.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:${J[Z.PRERELEASE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:${J[Z.PRERELEASELOOSE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${sb}})(?:\\.(\\d{1,${sb}}))?(?:\\.(\\d{1,${sb}}))?`);ge("COERCE",`${J[Z.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",J[Z.COERCEPLAIN]+`(?:${J[Z.PRERELEASE]})?(?:${J[Z.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",J[Z.COERCE],!0);ge("COERCERTLFULL",J[Z.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${J[Z.LONETILDE]}\\s+`,!0);Nn.tildeTrimReplace="$1~";ge("TILDE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${J[Z.LONECARET]}\\s+`,!0);Nn.caretTrimReplace="$1^";ge("CARET",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${J[Z.GTLT]}\\s*(${J[Z.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]}|${J[Z.XRANGEPLAIN]})`,!0);Nn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${J[Z.XRANGEPLAIN]})\\s+-\\s+(${J[Z.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${J[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${J[Z.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var fp=v((ibe,tj)=>{"use strict";var Toe=Object.freeze({loose:!0}),Ioe=Object.freeze({}),Foe=t=>t?typeof t!="object"?Toe:t:Ioe;tj.exports=Foe});var ab=v((sbe,ij)=>{"use strict";var rj=/^[0-9]+$/,nj=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=rj.test(t),n=rj.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Poe=(t,e)=>nj(e,t);ij.exports={compareIdentifiers:nj,rcompareIdentifiers:Poe}});var Xt=v((obe,oj)=>{"use strict";var hp=Kc(),{MAX_LENGTH:sj,MAX_SAFE_INTEGER:dp}=zc(),{safeRe:pp,t:mp}=qa(),Roe=fp(),{compareIdentifiers:ub}=ab(),cb=class t{constructor(e,r){if(r=Roe(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>sj)throw new TypeError(`version is longer than ${sj} characters`);hp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?pp[mp.LOOSE]:pp[mp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>dp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dp||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<dp)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(hp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(hp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ub(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(hp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ub(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?pp[mp.PRERELEASELOOSE]:pp[mp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),ub(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};oj.exports=cb});var to=v((abe,uj)=>{"use strict";var aj=Xt(),koe=(t,e,r=!1)=>{if(t instanceof aj)return t;try{return new aj(t,e)}catch(n){if(!r)return null;throw n}};uj.exports=koe});var lj=v((ube,cj)=>{"use strict";var Noe=to(),$oe=(t,e)=>{let r=Noe(t,e);return r?r.version:null};cj.exports=$oe});var hj=v((cbe,fj)=>{"use strict";var Loe=to(),joe=(t,e)=>{let r=Loe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};fj.exports=joe});var mj=v((lbe,pj)=>{"use strict";var dj=Xt(),Boe=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new dj(t instanceof dj?t.version:t,r).inc(e,n,i).version}catch{return null}};pj.exports=Boe});var Dj=v((fbe,yj)=>{"use strict";var gj=to(),Moe=(t,e)=>{let r=gj(t,null,!0),n=gj(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};yj.exports=Moe});var Ej=v((hbe,wj)=>{"use strict";var qoe=Xt(),Uoe=(t,e)=>new qoe(t,e).major;wj.exports=Uoe});var vj=v((dbe,bj)=>{"use strict";var Hoe=Xt(),Voe=(t,e)=>new Hoe(t,e).minor;bj.exports=Voe});var Cj=v((pbe,_j)=>{"use strict";var zoe=Xt(),Koe=(t,e)=>new zoe(t,e).patch;_j.exports=Koe});var Aj=v((mbe,Sj)=>{"use strict";var Goe=to(),Woe=(t,e)=>{let r=Goe(t,e);return r&&r.prerelease.length?r.prerelease:null};Sj.exports=Woe});var Wr=v((gbe,xj)=>{"use strict";var Oj=Xt(),Xoe=(t,e,r)=>new Oj(t,r).compare(new Oj(e,r));xj.exports=Xoe});var Ij=v((ybe,Tj)=>{"use strict";var Yoe=Wr(),Joe=(t,e,r)=>Yoe(e,t,r);Tj.exports=Joe});var Pj=v((Dbe,Fj)=>{"use strict";var Zoe=Wr(),Qoe=(t,e)=>Zoe(t,e,!0);Fj.exports=Qoe});var gp=v((wbe,kj)=>{"use strict";var Rj=Xt(),eae=(t,e,r)=>{let n=new Rj(t,r),i=new Rj(e,r);return n.compare(i)||n.compareBuild(i)};kj.exports=eae});var $j=v((Ebe,Nj)=>{"use strict";var tae=gp(),rae=(t,e)=>t.sort((r,n)=>tae(r,n,e));Nj.exports=rae});var jj=v((bbe,Lj)=>{"use strict";var nae=gp(),iae=(t,e)=>t.sort((r,n)=>nae(n,r,e));Lj.exports=iae});var Gc=v((vbe,Bj)=>{"use strict";var sae=Wr(),oae=(t,e,r)=>sae(t,e,r)>0;Bj.exports=oae});var yp=v((_be,Mj)=>{"use strict";var aae=Wr(),uae=(t,e,r)=>aae(t,e,r)<0;Mj.exports=uae});var lb=v((Cbe,qj)=>{"use strict";var cae=Wr(),lae=(t,e,r)=>cae(t,e,r)===0;qj.exports=lae});var fb=v((Sbe,Uj)=>{"use strict";var fae=Wr(),hae=(t,e,r)=>fae(t,e,r)!==0;Uj.exports=hae});var Dp=v((Abe,Hj)=>{"use strict";var dae=Wr(),pae=(t,e,r)=>dae(t,e,r)>=0;Hj.exports=pae});var wp=v((Obe,Vj)=>{"use strict";var mae=Wr(),gae=(t,e,r)=>mae(t,e,r)<=0;Vj.exports=gae});var hb=v((xbe,zj)=>{"use strict";var yae=lb(),Dae=fb(),wae=Gc(),Eae=Dp(),bae=yp(),vae=wp(),_ae=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return yae(t,r,n);case"!=":return Dae(t,r,n);case">":return wae(t,r,n);case">=":return Eae(t,r,n);case"<":return bae(t,r,n);case"<=":return vae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};zj.exports=_ae});var Gj=v((Tbe,Kj)=>{"use strict";var Cae=Xt(),Sae=to(),{safeRe:Ep,t:bp}=qa(),Aae=(t,e)=>{if(t instanceof Cae)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Ep[bp.COERCEFULL]:Ep[bp.COERCE]);else{let u=e.includePrerelease?Ep[bp.COERCERTLFULL]:Ep[bp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Sae(`${n}.${i}.${s}${o}${a}`,e)};Kj.exports=Aae});var Xj=v((Ibe,Wj)=>{"use strict";var db=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Wj.exports=db});var Xr=v((Fbe,Qj)=>{"use strict";var Oae=/\s+/g,pb=class t{constructor(e,r){if(r=Tae(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof mb)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Oae," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!Jj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&$ae(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&kae)|(this.options.loose&&Nae))+":"+e,i=Yj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,Kae(this.options.includePrerelease)),et("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],Fae),et("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],Pae),et("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],Rae),et("caret trim",e);let a=e.split(" ").map(h=>Lae(h,this.options)).join(" ").split(/\s+/).map(h=>zae(h,this.options));s&&(a=a.filter(h=>(et("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),et("range list",a);let u=new Map,c=a.map(h=>new mb(h,this.options));for(let h of c){if(Jj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return Yj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Zj(n,r)&&e.set.some(i=>Zj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Iae(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Gae(this.set[r],e,this.options))return!0;return!1}};Qj.exports=pb;var xae=Xj(),Yj=new xae,Tae=fp(),mb=Wc(),et=Kc(),Iae=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:Fae,tildeTrimReplace:Pae,caretTrimReplace:Rae}=qa(),{FLAG_INCLUDE_PRERELEASE:kae,FLAG_LOOSE:Nae}=zc(),Jj=t=>t.value==="<0.0.0-0",$ae=t=>t.value==="",Zj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},Lae=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),et("comp",t,e),t=Mae(t,e),et("caret",t),t=jae(t,e),et("tildes",t),t=Uae(t,e),et("xrange",t),t=Vae(t,e),et("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",jae=(t,e)=>t.trim().split(/\s+/).map(r=>Bae(r,e)).join(" "),Bae=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{et("tilde",t,n,i,s,o,a);let u;return fr(i)?u="":fr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:fr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(et("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,et("tilde return",u),u})},Mae=(t,e)=>t.trim().split(/\s+/).map(r=>qae(r,e)).join(" "),qae=(t,e)=>{et("caret",t,e);let r=e.loose?lr[Yt.CARETLOOSE]:lr[Yt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{et("caret",t,i,s,o,a,u);let c;return fr(s)?c="":fr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:fr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(et("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(et("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),et("caret return",c),c})},Uae=(t,e)=>(et("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hae(r,e)).join(" ")),Hae=(t,e)=>{t=t.trim();let r=e.loose?lr[Yt.XRANGELOOSE]:lr[Yt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{et("xRange",t,n,i,s,o,a,u);let c=fr(s),l=c||fr(o),h=l||fr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),et("xRange return",n),n})},Vae=(t,e)=>(et("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),zae=(t,e)=>(et("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),Kae=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(fr(n)?r="":fr(i)?r=`>=${n}.0.0${t?"-0":""}`:fr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,fr(c)?u="":fr(l)?u=`<${+c+1}.0.0-0`:fr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Gae=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(et(t[n].semver),t[n].semver!==mb.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Wc=v((Pbe,sB)=>{"use strict";var Xc=Symbol("SemVer ANY"),Db=class t{static get ANY(){return Xc}constructor(e,r){if(r=eB(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),yb("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Xc?this.value="":this.value=this.operator+this.semver.version,yb("comp",this)}parse(e){let r=this.options.loose?tB[rB.COMPARATORLOOSE]:tB[rB.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new nB(n[2],this.options.loose):this.semver=Xc}toString(){return this.value}test(e){if(yb("Comparator.test",e,this.options.loose),this.semver===Xc||e===Xc)return!0;if(typeof e=="string")try{e=new nB(e,this.options)}catch{return!1}return gb(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new iB(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new iB(this.value,r).test(e.semver):(r=eB(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||gb(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||gb(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};sB.exports=Db;var eB=fp(),{safeRe:tB,t:rB}=qa(),gb=hb(),yb=Kc(),nB=Xt(),iB=Xr()});var Yc=v((Rbe,oB)=>{"use strict";var Wae=Xr(),Xae=(t,e,r)=>{try{e=new Wae(e,r)}catch{return!1}return e.test(t)};oB.exports=Xae});var uB=v((kbe,aB)=>{"use strict";var Yae=Xr(),Jae=(t,e)=>new Yae(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));aB.exports=Jae});var lB=v((Nbe,cB)=>{"use strict";var Zae=Xt(),Qae=Xr(),eue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Qae(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Zae(n,r))}),n};cB.exports=eue});var hB=v(($be,fB)=>{"use strict";var tue=Xt(),rue=Xr(),nue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new rue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new tue(n,r))}),n};fB.exports=nue});var mB=v((Lbe,pB)=>{"use strict";var wb=Xt(),iue=Xr(),dB=Gc(),sue=(t,e)=>{t=new iue(t,e);let r=new wb("0.0.0");if(t.test(r)||(r=new wb("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new wb(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||dB(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||dB(r,s))&&(r=s)}return r&&t.test(r)?r:null};pB.exports=sue});var yB=v((jbe,gB)=>{"use strict";var oue=Xr(),aue=(t,e)=>{try{return new oue(t,e).range||"*"}catch{return null}};gB.exports=aue});var vp=v((Bbe,bB)=>{"use strict";var uue=Xt(),EB=Wc(),{ANY:cue}=EB,lue=Xr(),fue=Yc(),DB=Gc(),wB=yp(),hue=wp(),due=Dp(),pue=(t,e,r,n)=>{t=new uue(t,n),e=new lue(e,n);let i,s,o,a,u;switch(r){case">":i=DB,s=hue,o=wB,a=">",u=">=";break;case"<":i=wB,s=due,o=DB,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(fue(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===cue&&(f=new EB(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};bB.exports=pue});var _B=v((Mbe,vB)=>{"use strict";var mue=vp(),gue=(t,e,r)=>mue(t,e,">",r);vB.exports=gue});var SB=v((qbe,CB)=>{"use strict";var yue=vp(),Due=(t,e,r)=>yue(t,e,"<",r);CB.exports=Due});var xB=v((Ube,OB)=>{"use strict";var AB=Xr(),wue=(t,e,r)=>(t=new AB(t,r),e=new AB(e,r),t.intersects(e,r));OB.exports=wue});var IB=v((Hbe,TB)=>{"use strict";var Eue=Yc(),bue=Wr();TB.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>bue(l,h,r));for(let l of o)Eue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var $B=v((Vbe,NB)=>{"use strict";var FB=Xr(),bb=Wc(),{ANY:Eb}=bb,Jc=Yc(),vb=Wr(),vue=(t,e,r={})=>{if(t===e)return!0;t=new FB(t,r),e=new FB(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=Cue(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},_ue=[new bb(">=0.0.0-0")],PB=[new bb(">=0.0.0")],Cue=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Eb){if(e.length===1&&e[0].semver===Eb)return!0;r.includePrerelease?t=_ue:t=PB}if(e.length===1&&e[0].semver===Eb){if(r.includePrerelease)return!0;e=PB}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=RB(i,f,r):f.operator==="<"||f.operator==="<="?s=kB(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=vb(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!Jc(f,String(i),r)||s&&!Jc(f,String(s),r))return null;for(let m of e)if(!Jc(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=RB(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!Jc(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=kB(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!Jc(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},RB=(t,e,r)=>{if(!t)return e;let n=vb(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},kB=(t,e,r)=>{if(!t)return e;let n=vb(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};NB.exports=vue});var MB=v((zbe,BB)=>{"use strict";var _b=qa(),LB=zc(),Sue=Xt(),jB=ab(),Aue=to(),Oue=lj(),xue=hj(),Tue=mj(),Iue=Dj(),Fue=Ej(),Pue=vj(),Rue=Cj(),kue=Aj(),Nue=Wr(),$ue=Ij(),Lue=Pj(),jue=gp(),Bue=$j(),Mue=jj(),que=Gc(),Uue=yp(),Hue=lb(),Vue=fb(),zue=Dp(),Kue=wp(),Gue=hb(),Wue=Gj(),Xue=Wc(),Yue=Xr(),Jue=Yc(),Zue=uB(),Que=lB(),ece=hB(),tce=mB(),rce=yB(),nce=vp(),ice=_B(),sce=SB(),oce=xB(),ace=IB(),uce=$B();BB.exports={parse:Aue,valid:Oue,clean:xue,inc:Tue,diff:Iue,major:Fue,minor:Pue,patch:Rue,prerelease:kue,compare:Nue,rcompare:$ue,compareLoose:Lue,compareBuild:jue,sort:Bue,rsort:Mue,gt:que,lt:Uue,eq:Hue,neq:Vue,gte:zue,lte:Kue,cmp:Gue,coerce:Wue,Comparator:Xue,Range:Yue,satisfies:Jue,toComparators:Zue,maxSatisfying:Que,minSatisfying:ece,minVersion:tce,validRange:rce,outside:nce,gtr:ice,ltr:sce,intersects:oce,simplifyRange:ace,subset:uce,SemVer:Sue,re:_b.re,src:_b.src,tokens:_b.t,SEMVER_SPEC_VERSION:LB.SEMVER_SPEC_VERSION,RELEASE_TYPES:LB.RELEASE_TYPES,compareIdentifiers:jB.compareIdentifiers,rcompareIdentifiers:jB.rcompareIdentifiers}});var ZB=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.parseApkNameFromFlavor=Q.checkJDKMajorVersion=Q.resolvePlatform=Q.checkPlatformVersions=Q.getAddedPlatforms=Q.getPlatformTargetName=Q.promptForPlatformTarget=Q.promptForPlatform=Q.isValidEnterprisePlatform=Q.getKnownEnterprisePlatforms=Q.isValidCommunityPlatform=Q.getKnownCommunityPlatforms=Q.isValidPlatform=Q.getKnownPlatforms=Q.selectPlatforms=Q.getProjectPlatformDirectory=Q.getCLIVersion=Q.getCoreVersion=Q.getCapacitorPackageVersion=Q.requireCapacitorPackage=Q.getCapacitorPackage=Q.runTask=Q.runPlatformHook=Q.runHooks=Q.wait=Q.checkAppName=Q.checkAppId=Q.checkAppDir=Q.checkAppConfig=Q.checkCapacitorPlatform=Q.checkPackage=Q.checkWebDir=Q.check=void 0;var Qc=(fe(),ue(le)),qB=ji(),Ji=Ea(),ro=require("path"),je=Qc.__importDefault(ba()),Ua=id(),HB=Dc(),cce=UN(),UB=xl(),Zc=Td(),lce=lp();async function fce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
204
- `)}Q.check=fce;async function hce(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,Ji.pathExists)(t.app.webDirAbs)?await(0,Ji.pathExists)((0,ro.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${je.default.strong((0,qB.prettyPath)(t.app.webDirAbs))}) must contain an ${je.default.strong("index.html")} file.
205
- It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${je.default.strong((0,qB.prettyPath)(t.app.webDirAbs))}.
206
- Please create it and make sure it has an ${je.default.strong("index.html")} file. You can change the path of this directory in ${je.default.strong(t.app.extConfigName)} (${je.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${je.default.input("npm run build")}). More info: ${je.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Q.checkWebDir=hce;async function dce(){return await(0,Ji.pathExists)("package.json")||await(0,Ji.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
203
+ see https://github.com/jprichardson/node-fs-extra/issues/269`),jc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;jc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?p$(f$,a,t,e,r,n):f$(a,t,e,r,n))})}function f$(t,e,r,n,i){let s=Lc.dirname(r);Mne(s,(o,a)=>{if(o)return i(o);if(a)return IE(t,e,r,n,i);Bne(s,u=>u?i(u):IE(t,e,r,n,i))})}function p$(t,e,r,n,i,s){Promise.resolve(i.filter(r,n)).then(o=>o?t(e,r,n,i,s):s(),o=>s(o))}function IE(t,e,r,n,i){return n.filter?p$(h$,t,e,r,n,i):h$(t,e,r,n,i)}function h$(t,e,r,n,i){(n.dereference?Ar.stat:Ar.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Xne(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Hne(a,t,e,r,n,i);if(a.isSymbolicLink())return Zne(t,e,r,n,i)})}function Hne(t,e,r,n,i,s){return e?Vne(t,r,n,i,s):m$(t,r,n,i,s)}function Vne(t,e,r,n,i){if(n.overwrite)Ar.unlink(r,s=>s?i(s):m$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function m$(t,e,r,n,i){Ar.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?zne(t.mode,e,r,i):Yd(r,t.mode,i))}function zne(t,e,r,n){return Kne(t)?Gne(r,t,i=>i?n(i):d$(t,e,r,n)):d$(t,e,r,n)}function Kne(t){return(t&128)===0}function Gne(t,e,r){return Yd(t,e|128,r)}function d$(t,e,r,n){Wne(e,r,i=>i?n(i):Yd(r,t,n))}function Yd(t,e,r){return Ar.chmod(t,e,r)}function Wne(t,e,r){Ar.stat(t,(n,i)=>n?r(n):qne(e,i.atime,i.mtime,r))}function Xne(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):g$(r,n,i,s):Yne(t.mode,r,n,i,s)}function Yne(t,e,r,n,i){Ar.mkdir(r,s=>{if(s)return i(s);g$(e,r,n,o=>o?i(o):Yd(r,t,i))})}function g$(t,e,r,n){Ar.readdir(t,(i,s)=>i?n(i):y$(s,t,e,r,n))}function y$(t,e,r,n,i){let s=t.pop();return s?Jne(t,s,e,r,n,i):i()}function Jne(t,e,r,n,i,s){let o=Lc.join(r,e),a=Lc.join(n,e);jc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;IE(l,o,a,i,h=>h?s(h):y$(t,r,n,i,s))})}function Zne(t,e,r,n,i){Ar.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Lc.resolve(process.cwd(),o)),t)Ar.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Ar.symlink(o,r,i):i(a):(n.dereference&&(u=Lc.resolve(process.cwd(),u)),jc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&jc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Qne(o,r,i)));else return Ar.symlink(o,r,i)})}function Qne(t,e,r){Ar.unlink(e,n=>n?r(n):Ar.symlink(t,e,r))}D$.exports=Une});var FE=v((pEe,E$)=>{"use strict";var eie=Ie().fromCallback;E$.exports={copy:eie(w$())}});var T$=v((mEe,x$)=>{"use strict";var b$=yt(),S$=require("path"),Me=require("assert"),Bc=process.platform==="win32";function A$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||b$[r],r=r+"Sync",t[r]=t[r]||b$[r]}),t.maxBusyTries=t.maxBusyTries||3}function PE(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),Me(t,"rimraf: missing path"),Me.strictEqual(typeof t,"string","rimraf: path should be a string"),Me.strictEqual(typeof r,"function","rimraf: callback function required"),Me(e,"rimraf: invalid options argument provided"),Me.strictEqual(typeof e,"object","rimraf: options should be object"),A$(e),v$(t,e,function i(s){if(s){if((s.code==="EBUSY"||s.code==="ENOTEMPTY"||s.code==="EPERM")&&n<e.maxBusyTries){n++;let o=n*100;return setTimeout(()=>v$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function v$(t,e,r){Me(t),Me(e),Me(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Bc)return _$(t,e,n,r);if(i&&i.isDirectory())return Jd(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Bc?_$(t,e,s,r):Jd(t,e,s,r);if(s.code==="EISDIR")return Jd(t,e,s,r)}return r(s)})})}function _$(t,e,r,n){Me(t),Me(e),Me(typeof n=="function"),e.chmod(t,438,i=>{i?n(i.code==="ENOENT"?null:r):e.stat(t,(s,o)=>{s?n(s.code==="ENOENT"?null:r):o.isDirectory()?Jd(t,e,r,n):e.unlink(t,n)})})}function C$(t,e,r){let n;Me(t),Me(e);try{e.chmodSync(t,438)}catch(i){if(i.code==="ENOENT")return;throw r}try{n=e.statSync(t)}catch(i){if(i.code==="ENOENT")return;throw r}n.isDirectory()?Zd(t,e,r):e.unlinkSync(t)}function Jd(t,e,r,n){Me(t),Me(e),Me(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?tie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function tie(t,e,r){Me(t),Me(e),Me(typeof r=="function"),e.readdir(t,(n,i)=>{if(n)return r(n);let s=i.length,o;if(s===0)return e.rmdir(t,r);i.forEach(a=>{PE(S$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function O$(t,e){let r;e=e||{},A$(e),Me(t,"rimraf: missing path"),Me.strictEqual(typeof t,"string","rimraf: path should be a string"),Me(e,"rimraf: missing options"),Me.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Bc&&C$(t,e,n)}try{r&&r.isDirectory()?Zd(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Bc?C$(t,e,n):Zd(t,e,n);if(n.code!=="EISDIR")throw n;Zd(t,e,n)}}function Zd(t,e,r){Me(t),Me(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")rie(t,e);else if(n.code!=="ENOENT")throw n}}function rie(t,e){if(Me(t),Me(e),e.readdirSync(t).forEach(r=>O$(S$.join(t,r),e)),Bc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}x$.exports=PE;PE.sync=O$});var Mc=v((gEe,F$)=>{"use strict";var nie=Ie().fromCallback,I$=T$();F$.exports={remove:nie(I$),removeSync:I$.sync}});var B$=v((yEe,j$)=>{"use strict";var iie=Ie().fromCallback,k$=yt(),N$=require("path"),$$=fn(),L$=Mc(),P$=iie(function(e,r){r=r||function(){},k$.readdir(e,(n,i)=>{if(n)return $$.mkdirs(e,r);i=i.map(o=>N$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();L$.remove(o,a=>{if(a)return r(a);s()})}})});function R$(t){let e;try{e=k$.readdirSync(t)}catch{return $$.mkdirsSync(t)}e.forEach(r=>{r=N$.join(t,r),L$.removeSync(r)})}j$.exports={emptyDirSync:R$,emptydirSync:R$,emptyDir:P$,emptydir:P$}});var H$=v((DEe,U$)=>{"use strict";var sie=Ie().fromCallback,M$=require("path"),Wi=yt(),q$=fn();function oie(t,e){function r(){Wi.writeFile(t,"",n=>{if(n)return e(n);e()})}Wi.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=M$.dirname(t);Wi.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?q$.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():Wi.readdir(s,u=>{if(u)return e(u)})})})}function aie(t){let e;try{e=Wi.statSync(t)}catch{}if(e&&e.isFile())return;let r=M$.dirname(t);try{Wi.statSync(r).isDirectory()||Wi.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")q$.mkdirsSync(r);else throw n}Wi.writeFileSync(t,"")}U$.exports={createFile:sie(oie),createFileSync:aie}});var W$=v((wEe,G$)=>{"use strict";var uie=Ie().fromCallback,z$=require("path"),Js=yt(),K$=fn(),V$=Gi().pathExists;function cie(t,e,r){function n(i,s){Js.link(i,s,o=>{if(o)return r(o);r(null)})}V$(e,(i,s)=>{if(i)return r(i);if(s)return r(null);Js.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=z$.dirname(e);V$(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);K$.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function lie(t,e){if(Js.existsSync(e))return;try{Js.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=z$.dirname(e);return Js.existsSync(n)||K$.mkdirsSync(n),Js.linkSync(t,e)}G$.exports={createLink:uie(cie),createLinkSync:lie}});var Y$=v((EEe,X$)=>{"use strict";var Xi=require("path"),qc=yt(),fie=Gi().pathExists;function hie(t,e,r){if(Xi.isAbsolute(t))return qc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=Xi.dirname(e),i=Xi.join(n,t);return fie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):qc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:Xi.relative(n,t)})))}}function die(t,e){let r;if(Xi.isAbsolute(t)){if(r=qc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=Xi.dirname(e),i=Xi.join(n,t);if(r=qc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=qc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Xi.relative(n,t)}}}X$.exports={symlinkPaths:hie,symlinkPathsSync:die}});var Q$=v((bEe,Z$)=>{"use strict";var J$=yt();function pie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);J$.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function mie(t,e){let r;if(e)return e;try{r=J$.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}Z$.exports={symlinkType:pie,symlinkTypeSync:mie}});var oL=v((vEe,sL)=>{"use strict";var gie=Ie().fromCallback,tL=require("path"),La=yt(),rL=fn(),yie=rL.mkdirs,Die=rL.mkdirsSync,nL=Y$(),wie=nL.symlinkPaths,Eie=nL.symlinkPathsSync,iL=Q$(),bie=iL.symlinkType,vie=iL.symlinkTypeSync,eL=Gi().pathExists;function _ie(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,eL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);wie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,bie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=tL.dirname(e);eL(l,(h,d)=>{if(h)return n(h);if(d)return La.symlink(t,e,c,n);yie(l,f=>{if(f)return n(f);La.symlink(t,e,c,n)})})})})})}function Cie(t,e,r){if(La.existsSync(e))return;let i=Eie(t,e);t=i.toDst,r=vie(i.toCwd,r);let s=tL.dirname(e);return La.existsSync(s)||Die(s),La.symlinkSync(t,e,r)}sL.exports={createSymlink:gie(_ie),createSymlinkSync:Cie}});var uL=v((_Ee,aL)=>{"use strict";var Qd=H$(),ep=W$(),tp=oL();aL.exports={createFile:Qd.createFile,createFileSync:Qd.createFileSync,ensureFile:Qd.createFile,ensureFileSync:Qd.createFileSync,createLink:ep.createLink,createLinkSync:ep.createLinkSync,ensureLink:ep.createLink,ensureLinkSync:ep.createLinkSync,createSymlink:tp.createSymlink,createSymlinkSync:tp.createSymlinkSync,ensureSymlink:tp.createSymlink,ensureSymlinkSync:tp.createSymlinkSync}});var lL=v((CEe,cL)=>{"use strict";var rp=b0();cL.exports={readJson:rp.readFile,readJsonSync:rp.readFileSync,writeJson:rp.writeFile,writeJsonSync:rp.writeFileSync}});var np=v((SEe,dL)=>{"use strict";var Sie=Ie().fromCallback,Uc=yt(),fL=require("path"),hL=fn(),Aie=Gi().pathExists;function Oie(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=fL.dirname(t);Aie(i,(s,o)=>{if(s)return n(s);if(o)return Uc.writeFile(t,e,r,n);hL.mkdirs(i,a=>{if(a)return n(a);Uc.writeFile(t,e,r,n)})})}function xie(t,...e){let r=fL.dirname(t);if(Uc.existsSync(r))return Uc.writeFileSync(t,...e);hL.mkdirsSync(r),Uc.writeFileSync(t,...e)}dL.exports={outputFile:Sie(Oie),outputFileSync:xie}});var mL=v((AEe,pL)=>{"use strict";var{stringify:Tie}=Da(),{outputFile:Iie}=np();async function Fie(t,e,r={}){let n=Tie(e,r);await Iie(t,n,r)}pL.exports=Fie});var yL=v((OEe,gL)=>{"use strict";var{stringify:Pie}=Da(),{outputFileSync:Rie}=np();function kie(t,e,r){let n=Pie(e,r);Rie(t,n,r)}gL.exports=kie});var wL=v((xEe,DL)=>{"use strict";var Nie=Ie().fromPromise,cr=lL();cr.outputJson=Nie(mL());cr.outputJsonSync=yL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;DL.exports=cr});var SL=v((TEe,CL)=>{"use strict";var vL=yt(),$ie=require("path"),Lie=TE().copySync,_L=Mc().removeSync,jie=fn().mkdirpSync,EL=kc();function Bie(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=EL.checkPathsSync(t,e,"move");return EL.checkParentPathsSync(t,i,e,"move"),jie($ie.dirname(e)),Mie(t,e,n)}function Mie(t,e,r){if(r)return _L(e),bL(t,e,r);if(vL.existsSync(e))throw new Error("dest already exists.");return bL(t,e,r)}function bL(t,e,r){try{vL.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return qie(t,e,r)}}function qie(t,e,r){return Lie(t,e,{overwrite:r,errorOnExist:!0}),_L(t)}CL.exports=Bie});var OL=v((IEe,AL)=>{"use strict";AL.exports={moveSync:SL()}});var PL=v((FEe,FL)=>{"use strict";var Uie=yt(),Hie=require("path"),Vie=FE().copy,IL=Mc().remove,zie=fn().mkdirp,Kie=Gi().pathExists,xL=kc();function Gie(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;xL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;xL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);zie(Hie.dirname(e),c=>c?n(c):Wie(t,e,i,n))})})}function Wie(t,e,r,n){if(r)return IL(e,i=>i?n(i):TL(t,e,r,n));Kie(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):TL(t,e,r,n))}function TL(t,e,r,n){Uie.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Xie(t,e,r,n):n())}function Xie(t,e,r,n){Vie(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):IL(t,n))}FL.exports=Gie});var kL=v((PEe,RL)=>{"use strict";var Yie=Ie().fromCallback;RL.exports={move:Yie(PL())}});var ip=v((REe,RE)=>{"use strict";RE.exports={...Rc(),...TE(),...FE(),...B$(),...uL(),...wL(),...fn(),...OL(),...kL(),...np(),...Gi(),...Mc()};var NL=require("fs");Object.getOwnPropertyDescriptor(NL,"promises")&&Object.defineProperty(RE.exports,"promises",{get(){return NL.promises}})});var kE=v(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});ja.readdir=ja.stat=void 0;var $L=ip();async function Jie(t){try{return await $L.stat(t)}catch{}}ja.stat=Jie;async function Zie(t){try{return await $L.readdir(t)}catch{return[]}}ja.readdir=Zie});var UL=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.walk=me.Walker=me.compilePaths=me.tmpfilepath=me.findBaseDirectory=me.isExecutableFile=me.pathExecutable=me.pathWritable=me.pathReadable=me.pathExists=me.pathAccessible=me.writeStreamToFile=me.cacheFileChecksum=me.getFileChecksums=me.getFileChecksum=me.fileToString=me.getFileTree=me.readdirp=me.readdirSafe=me.statSafe=void 0;var Qie=(fe(),ue(le)),Wr=ip(),ese=require("os"),fi=require("path"),LL=require("stream"),jL=kE();Qie.__exportStar(ip(),me);var BL=kE();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return BL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return BL.readdir}});async function tse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=$E(t,n);e&&(a=a.pipe(new LL.Transform({objectMode:!0,transform(u,c,l){(!e||e(u))&&this.push(u),l()}}))),a.on("error",u=>r?r(u):s(u)).on("data",u=>o.push(u.path)).on("end",()=>i(o))})}me.readdirp=tse;async function rse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=fi.dirname(u.path),l=s.get(c);return l&&l.type==="directory"?l:n({path:c,type:"directory",children:[]})},a=(u,c)=>{let l={path:u.path,parent:c};return u.stats.isDirectory()?n({...l,type:"directory",children:[]}):r({...l,type:"file"})};return new Promise((u,c)=>{t=fi.resolve(t),$E(t,i).on("error",h=>e?e(h):c(h)).on("data",h=>{let d=o(h),f=a(h,d);d.children.push(f),s.set(h.path,f),s.set(d.path,d)}).on("end",()=>{let h=s.get(t);if(!h)return c(new Error("No root node found after walking directory structure."));delete h.parent,u(h)})})}me.getFileTree=rse;async function nse(t){try{return await Wr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=nse;async function NE(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Wr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=NE;async function ise(t){return Promise.all([NE(t),(async()=>{try{return(await Wr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=ise;async function sse(t,e){let r=await NE(t);await Wr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=sse;function ose(t,e){return new Promise((r,n)=>{let i=Wr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=ose;async function Hc(t,e){try{await Wr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Hc;async function ase(t){return Hc(t,Wr.constants.F_OK)}me.pathExists=ase;async function use(t){return Hc(t,Wr.constants.R_OK)}me.pathReadable=use;async function cse(t){return Hc(t,Wr.constants.W_OK)}me.pathWritable=cse;async function ML(t){return Hc(t,Wr.constants.X_OK)}me.pathExecutable=ML;async function lse(t){let[e,r]=await Promise.all([jL.stat(t),ML(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=lse;async function fse(t,e){if(!(!t||!e)){for(let r of qL(t))if((await jL.readdir(r)).includes(e))return r}}me.findBaseDirectory=fse;function hse(t){let e=Math.random().toString(16).substring(2,8);return fi.resolve(ese.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=hse;function qL(t){if(t=fi.normalize(t),!fi.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=fi.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(fi.sep).map((r,n,i)=>e.root+fi.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=qL;var sp=class extends LL.Readable{constructor(e,r={}){super({objectMode:!0}),this.p=e,this.options=r,this.paths=[this.p]}_read(){let e=this.paths.shift(),{pathFilter:r}=this.options;if(!e){this.push(null);return}Wr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Wr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>fi.join(e,c));r&&(u=u.filter(c=>r(c.substring(this.p.length+1)))),this.paths.push(...u),this.push(s)}):this.push(s)})}};me.Walker=sp;function $E(t,e={}){return new sp(t,e)}me.walk=$E});var HL=v(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.AliasedMap=hi.CaseInsensitiveProxyHandler=hi.createCaseInsensitiveObject=void 0;function dse(){return new Proxy({},hi.CaseInsensitiveProxyHandler)}hi.createCaseInsensitiveObject=dse;hi.CaseInsensitiveProxyHandler={has:(t,e)=>op(e)in t,get:(t,e)=>t[op(e)],set:(t,e,r)=>(t[op(e)]=r,!0),deleteProperty:(t,e)=>delete t[op(e)]};var op=t=>typeof t=="string"?t.toLowerCase():t,LE=class extends Map{getAliases(){let e=new Map;return[...this.entries()].filter(([,n])=>typeof n=="string"||typeof n=="symbol").forEach(([n,i])=>{let s=e.get(i)||[];s.push(n),e.set(i,s)}),e}resolveAlias(e){let r=this.get(e);return typeof r!="string"&&typeof r!="symbol"?r:this.resolveAlias(r)}keysWithoutAliases(){return[...this.entries()].filter(e=>typeof e[1]!="string"&&typeof e[1]!="symbol").map(([e,r])=>e)}};hi.AliasedMap=LE});var XL=v((LEe,WL)=>{"use strict";var GL=require("child_process"),VL=GL.spawn,pse=GL.exec;WL.exports=function(t,e,r){if(typeof e=="function"&&r===void 0&&(r=e,e=void 0),t=parseInt(t),Number.isNaN(t)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[t]=[],i[t]=1,process.platform){case"win32":pse("taskkill /pid "+t+" /T /F",r);break;case"darwin":jE(t,n,i,function(s){return VL("pgrep",["-P",s])},function(){zL(n,e,r)});break;default:jE(t,n,i,function(s){return VL("ps",["-o","pid","--no-headers","--ppid",s])},function(){zL(n,e,r)});break}};function zL(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(KL(s,e),n[s]=1)}),n[i]||(KL(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function KL(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function jE(t,e,r,n,i){var s=n(t),o="";s.stdout.on("data",function(c){var c=c.toString("ascii");o+=c});var a=function(u){if(delete r[t],u!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(c){c=parseInt(c,10),e[t].push(c),e[c]=[],r[c]=1,jE(c,e,r,n,i)})};s.on("close",a)}});var ZL=v(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.processExit=Qe.offBeforeExit=Qe.onBeforeExit=Qe.onExit=Qe.sleepForever=Qe.sleepUntil=Qe.sleep=Qe.getPathParts=Qe.createProcessEnv=Qe.killProcessTree=Qe.ERROR_TIMEOUT_REACHED=void 0;var BE=(fe(),ue(le)),mse=HL(),gse=ji(),yse=Uh(),Dse=BE.__importStar(require("path")),wse=BE.__importDefault(Ph()),Ese=BE.__importDefault(XL()),Zs=(0,yse.debug)("ionic:utils-process");Qe.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function bse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Ese.default)(t,e,i=>{if(i)return Zs("error while killing process tree for %d: %O",t,i),n(i);r()})})}Qe.killProcessTree=bse;function vse(...t){return Object.assign(gse.TERMINAL_INFO.windows?(0,mse.createCaseInsensitiveObject)():{},...t)}Qe.createProcessEnv=vse;function _se(t=process.env.PATH||""){return t.split(Dse.delimiter)}Qe.getPathParts=_se;async function YL(t){return new Promise(e=>{setTimeout(e,t)})}Qe.sleep=YL;async function Cse(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await YL(e),n+=e,n>r)throw Qe.ERROR_TIMEOUT_REACHED}Qe.sleepUntil=Cse;async function Sse(){return new Promise(()=>{setInterval(()=>{},1e3)})}Qe.sleepForever=Sse;function Ase(t){(0,wse.default)(()=>{Zs("onExit: process.exit/normal shutdown"),t()})}Qe.onExit=Ase;var ap=new Set;function Ose(t){ap.add(t)}Qe.onBeforeExit=Ose;function xse(t){ap.delete(t)}Qe.offBeforeExit=xse;var Tse=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Vc=t=>Tse(async()=>{Zs("onBeforeExit handler: %O received",t),Zs("onBeforeExit handler: running %O functions",ap.size),await Promise.all([...ap.values()].map(async e=>{try{await e()}catch(r){Zs("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(Zs("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,JL[t]),process.kill(process.pid,t))}),JL={SIGINT:Vc("SIGINT"),SIGTERM:Vc("SIGTERM"),SIGHUP:Vc("SIGHUP"),SIGBREAK:Vc("SIGBREAK")};for(let[t,e]of Object.entries(JL))process.on(t,e);var Ise=Vc("process.exit");async function Fse(t=0){process.exitCode=t,await Ise(),Zs("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}Qe.processExit=Fse});var t3=v(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.growBufferForAppendedData=kn.WritableStreamBuffer=kn.ReadableStreamBuffer=kn.NullStream=void 0;var HE=require("stream"),Pse=4,QL=32,e3=16,ME=class extends HE.Writable{_write(e,r,n){n()}};kn.NullStream=ME;var qE=class extends HE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:QL),this.chunkSize=e&&e.chunkSize?e.chunkSize:Pse,this.growSize=e&&e.growSize?e.growSize:e3}get size(){return this._size}get stopped(){return this._stopped}_read(){this._send()}feed(e,r="utf8"){if(this._stopped)throw new Error("ReadableStreamBuffer is stopped. Can no longer feed.");let n=typeof e=="string"?Buffer.byteLength(e):e.length;this.buffer=VE(this.buffer,this._size,Math.ceil(n/this.growSize)*this.growSize),typeof e=="string"?this.buffer.write(e,this._size,n,r):this.buffer.copy(e,this._size,0),this._size+=n}stop(){this._stopped||(this._stopped=!0,this._size===0&&this.push(null))}_send(){let e=Math.min(this.chunkSize,this._size),r=!1;if(e>0){let n=Buffer.alloc(e);this.buffer.copy(n,0,0,e),r=!this.push(n),this.buffer.copy(this.buffer,0,e,this._size),this._size-=e}this._size===0&&this._stopped&&this.push(null),r||setTimeout(()=>this._send(),1)}};kn.ReadableStreamBuffer=qE;var UE=class extends HE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:QL),this.growSize=e&&e.growSize?e.growSize:e3}get size(){return this._size}_write(e,r,n){this.buffer=VE(this.buffer,this._size,Math.ceil(e.length/this.growSize)*this.growSize),e.copy(this.buffer,this._size,0),this._size+=e.length,n()}consume(e){e=typeof e=="number"?e:this._size;let r=Buffer.alloc(e);return this.buffer.copy(r,0,0,r.length),this.buffer.copy(this.buffer,0,r.length),this._size-=r.length,r}};kn.WritableStreamBuffer=UE;function VE(t,e,r){if(t.length-e>=r)return t;let n=Buffer.alloc(t.length+r);return t.copy(n,0,0,e),n}kn.growBufferForAppendedData=VE});var o3=v((MEe,s3)=>{s3.exports=i3;i3.sync=kse;var r3=require("fs");function Rse(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var i=r[n].toLowerCase();if(i&&t.substr(-i.length).toLowerCase()===i)return!0}return!1}function n3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Rse(e,r)}function i3(t,e,r){r3.stat(t,function(n,i){r(n,n?!1:n3(i,t,e))})}function kse(t,e){return n3(r3.statSync(t),t,e)}});var f3=v((qEe,l3)=>{l3.exports=u3;u3.sync=Nse;var a3=require("fs");function u3(t,e,r){a3.stat(t,function(n,i){r(n,n?!1:c3(i,e))})}function Nse(t,e){return c3(a3.statSync(t),e)}function c3(t,e){return t.isFile()&&$se(t,e)}function $se(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,h=r&c||r&u&&i===o||r&a&&n===s||r&l&&s===0;return h}});var d3=v((HEe,h3)=>{var UEe=require("fs"),up;process.platform==="win32"||global.TESTING_WINDOWS?up=o3():up=f3();h3.exports=zE;zE.sync=Lse;function zE(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){zE(t,e||{},function(s,o){s?i(s):n(o)})})}up(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function Lse(t,e){try{return up.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var E3=v((VEe,w3)=>{var Ba=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",p3=require("path"),jse=Ba?";":":",m3=d3(),g3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),y3=(t,e)=>{let r=e.colon||jse,n=t.match(/\//)||Ba&&t.match(/\\/)?[""]:[...Ba?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ba?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ba?i.split(r):[""];return Ba&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},D3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=y3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(g3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=p3.join(f,t),y=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(u(y,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let m=i[h];m3(c+m,{pathExt:s},(y,E)=>{if(!y&&E)if(e.all)o.push(c+m);else return d(c+m);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},Bse=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=y3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=p3.join(u,t),l=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let h=0;h<n.length;h++){let d=l+n[h];try{if(m3.sync(d,{pathExt:i}))if(e.all)s.push(d);else return d}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw g3(t)};w3.exports=D3;D3.sync=Bse});var v3=v((zEe,KE)=>{"use strict";var b3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};KE.exports=b3;KE.exports.default=b3});var A3=v((KEe,S3)=>{"use strict";var _3=require("path"),Mse=E3(),qse=v3();function C3(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=Mse.sync(t.command,{path:r[qse({env:r})],pathExt:e?_3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=_3.resolve(i?t.options.cwd:"",o)),o}function Use(t){return C3(t)||C3(t,!0)}S3.exports=Use});var O3=v((GEe,WE)=>{"use strict";var GE=/([()\][%!^"`<>&|;, *?])/g;function Hse(t){return t=t.replace(GE,"^$1"),t}function Vse(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(GE,"^$1"),e&&(t=t.replace(GE,"^$1")),t}WE.exports.command=Hse;WE.exports.argument=Vse});var T3=v((WEe,x3)=>{"use strict";x3.exports=/^#!(.*)/});var F3=v((XEe,I3)=>{"use strict";var zse=T3();I3.exports=(t="")=>{let e=t.match(zse);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var R3=v((YEe,P3)=>{"use strict";var XE=require("fs"),Kse=F3();function Gse(t){let r=Buffer.alloc(150),n;try{n=XE.openSync(t,"r"),XE.readSync(n,r,0,150,0),XE.closeSync(n)}catch{}return Kse(r.toString())}P3.exports=Gse});var L3=v((JEe,$3)=>{"use strict";var Wse=require("path"),k3=A3(),N3=O3(),Xse=R3(),Yse=process.platform==="win32",Jse=/\.(?:com|exe)$/i,Zse=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Qse(t){t.file=k3(t);let e=t.file&&Xse(t.file);return e?(t.args.unshift(t.file),t.command=e,k3(t)):t.file}function eoe(t){if(!Yse)return t;let e=Qse(t),r=!Jse.test(e);if(t.options.forceShell||r){let n=Zse.test(e);t.command=Wse.normalize(t.command),t.command=N3.command(t.command),t.args=t.args.map(s=>N3.argument(s,n));let i=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${i}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function toe(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:eoe(n)}$3.exports=toe});var M3=v((ZEe,B3)=>{"use strict";var YE=process.platform==="win32";function JE(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function roe(t,e){if(!YE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=j3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function j3(t,e){return YE&&t===1&&!e.file?JE(e.original,"spawn"):null}function noe(t,e){return YE&&t===1&&!e.file?JE(e.original,"spawnSync"):null}B3.exports={hookChildProcess:roe,verifyENOENT:j3,verifyENOENTSync:noe,notFoundError:JE}});var H3=v((QEe,Ma)=>{"use strict";var q3=require("child_process"),ZE=L3(),QE=M3();function U3(t,e,r){let n=ZE(t,e,r),i=q3.spawn(n.command,n.args,n.options);return QE.hookChildProcess(i,n),i}function ioe(t,e,r){let n=ZE(t,e,r),i=q3.spawnSync(n.command,n.args,n.options);return i.error=i.error||QE.verifyENOENTSync(i.status,n),i}Ma.exports=U3;Ma.exports.spawn=U3;Ma.exports.sync=ioe;Ma.exports._parse=ZE;Ma.exports._enoent=QE});var Y3=v(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.findExecutables=Fe.which=Fe.fork=Fe.spawn=Fe.Subprocess=Fe.SubprocessError=Fe.convertPATH=Fe.expandTildePath=Fe.TILDE_PATH_REGEX=Fe.ERROR_SIGNAL_EXIT=Fe.ERROR_NON_ZERO_EXIT=Fe.ERROR_COMMAND_NOT_FOUND=void 0;var rb=(fe(),ue(le)),V3=HN(),soe=UL(),eb=ZL(),cp=t3(),z3=ji(),ooe=require("child_process"),aoe=rb.__importDefault(H3()),uoe=rb.__importStar(require("os")),eo=rb.__importStar(require("path"));Fe.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";Fe.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";Fe.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";Fe.TILDE_PATH_REGEX=/^~($|\/|\\)/;function K3(t){let e=uoe.homedir();return t.replace(Fe.TILDE_PATH_REGEX,`${e}$1`)}Fe.expandTildePath=K3;function G3(t=process.env.PATH||""){return t.split(eo.delimiter).map(K3).join(eo.delimiter)}Fe.convertPATH=G3;var Qs=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};Fe.SubprocessError=Qs;var tb=class{constructor(e,r,n={}){this.name=e,this.args=r;let i=this.maskArg(e);i!==e&&(this.name=i,this.path=e),this._options=n}get options(){let e=this._options;e.env||(e.env=process.env);let r=(0,eb.createProcessEnv)(e.env||{},{PATH:G3(typeof e.env.PATH=="string"?e.env.PATH:process.env.PATH)});return{...e,env:r}}async output(){this._options.stdio="pipe";let e=this.run(),r=new cp.WritableStreamBuffer,n=new cp.WritableStreamBuffer,i=new cp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stdout?.pipe(i),e.p.stderr?.pipe(n),e.p.stderr?.pipe(i);try{await e}catch(s){throw r.end(),n.end(),s.output=i.consume().toString(),s}return n.end(),i.end(),r.consume().toString()}async combinedOutput(){this._options.stdio="pipe";let e=this.run(),r=new cp.WritableStreamBuffer;e.p.stdout?.pipe(r),e.p.stderr?.pipe(r);try{await e}catch(n){throw n.output=r.consume().toString(),n}return r.consume().toString()}run(){let e=this.spawn(),r=new Promise((n,i)=>{e.on("error",s=>{let o;s.code==="ENOENT"?(o=new Qs("Command not found.",{cause:s}),o.code=Fe.ERROR_COMMAND_NOT_FOUND):o=new Qs("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new Qs("Signal exit from subprocess."),a.code=Fe.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new Qs("Non-zero exit from subprocess."),a.code=Fe.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return W3(this.path?this.path:this.name,this.args,this.options)}bashify({maskArgv0:e=!0,maskArgv1:r=!1,shiftArgv0:n=!1}={}){let i=[this.path?this.path:this.name,...this.args];return n&&i.shift(),i[0]&&e&&(i[0]=this.maskArg(i[0])),i[1]&&r&&(i[1]=this.maskArg(i[1])),i.length>0?i.map(s=>this.bashifyArg(s)).join(" "):""}bashifyArg(e){return e.includes(" ")?`"${e.replace(/\"/g,'\\"')}"`:e}maskArg(e){let r=e.lastIndexOf(eo.sep);return r>=0?e.substring(r+1):e}};Fe.Subprocess=tb;function W3(t,e=[],r){return(0,aoe.default)(t,[...e],r)}Fe.spawn=W3;function coe(t,e=[],r={}){return(0,ooe.fork)(t,[...e],r)}Fe.fork=coe;var nb=z3.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function loe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){if(t.includes(eo.sep))return t;let n=await X3(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}Fe.which=loe;async function foe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){return t.includes(eo.sep)?[t]:X3(t,{PATH:e})}Fe.findExecutables=foe;async function X3(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||nb}={}){let n=(0,eb.getPathParts)(e),i;if(z3.TERMINAL_INFO.windows){let s=(0,eb.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(eo.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,V3.map)(i,async s=>(0,V3.concurrentFilter)(n.map(o=>eo.join(o,s)),async o=>(0,soe.isExecutableFile)(o))))}});var lp=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.isInstalled=Yi.getCommandOutput=Yi.runCommand=void 0;var ib=Y3();async function J3(t,e,r={}){let n=new ib.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof ib.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}Yi.runCommand=J3;async function hoe(t,e,r={}){try{return(await J3(t,e,r)).trim()}catch{return null}}Yi.getCommandOutput=hoe;async function doe(t){try{await(0,ib.which)(t)}catch{return!1}return!0}Yi.isInstalled=doe});var zc=v((rbe,Z3)=>{"use strict";var poe="2.0.0",moe=Number.MAX_SAFE_INTEGER||9007199254740991,goe=16,yoe=250,Doe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Z3.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:goe,MAX_SAFE_BUILD_LENGTH:yoe,MAX_SAFE_INTEGER:moe,RELEASE_TYPES:Doe,SEMVER_SPEC_VERSION:poe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Kc=v((nbe,Q3)=>{"use strict";var woe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Q3.exports=woe});var qa=v((Nn,ej)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:sb,MAX_SAFE_BUILD_LENGTH:Eoe,MAX_LENGTH:boe}=zc(),voe=Kc();Nn=ej.exports={};var _oe=Nn.re=[],Coe=Nn.safeRe=[],J=Nn.src=[],Soe=Nn.safeSrc=[],Z=Nn.t={},Aoe=0,ob="[a-zA-Z0-9-]",Ooe=[["\\s",1],["\\d",boe],[ob,Eoe]],xoe=t=>{for(let[e,r]of Ooe)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=xoe(e),i=Aoe++;voe(t,i,e),Z[t]=i,J[i]=e,Soe[i]=n,_oe[i]=new RegExp(e,r?"g":void 0),Coe[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ob}*`);ge("MAINVERSION",`(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})\\.(${J[Z.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})\\.(${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${J[Z.NONNUMERICIDENTIFIER]}|${J[Z.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${J[Z.PRERELEASEIDENTIFIER]}(?:\\.${J[Z.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${J[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${J[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${ob}+`);ge("BUILD",`(?:\\+(${J[Z.BUILDIDENTIFIER]}(?:\\.${J[Z.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${J[Z.MAINVERSION]}${J[Z.PRERELEASE]}?${J[Z.BUILD]}?`);ge("FULL",`^${J[Z.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${J[Z.MAINVERSIONLOOSE]}${J[Z.PRERELEASELOOSE]}?${J[Z.BUILD]}?`);ge("LOOSE",`^${J[Z.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${J[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${J[Z.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:\\.(${J[Z.XRANGEIDENTIFIER]})(?:${J[Z.PRERELEASE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${J[Z.XRANGEIDENTIFIERLOOSE]})(?:${J[Z.PRERELEASELOOSE]})?${J[Z.BUILD]}?)?)?`);ge("XRANGE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${J[Z.GTLT]}\\s*${J[Z.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${sb}})(?:\\.(\\d{1,${sb}}))?(?:\\.(\\d{1,${sb}}))?`);ge("COERCE",`${J[Z.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",J[Z.COERCEPLAIN]+`(?:${J[Z.PRERELEASE]})?(?:${J[Z.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",J[Z.COERCE],!0);ge("COERCERTLFULL",J[Z.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${J[Z.LONETILDE]}\\s+`,!0);Nn.tildeTrimReplace="$1~";ge("TILDE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${J[Z.LONETILDE]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${J[Z.LONECARET]}\\s+`,!0);Nn.caretTrimReplace="$1^";ge("CARET",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${J[Z.LONECARET]}${J[Z.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${J[Z.GTLT]}\\s*(${J[Z.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${J[Z.GTLT]}\\s*(${J[Z.LOOSEPLAIN]}|${J[Z.XRANGEPLAIN]})`,!0);Nn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${J[Z.XRANGEPLAIN]})\\s+-\\s+(${J[Z.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${J[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${J[Z.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var fp=v((ibe,tj)=>{"use strict";var Toe=Object.freeze({loose:!0}),Ioe=Object.freeze({}),Foe=t=>t?typeof t!="object"?Toe:t:Ioe;tj.exports=Foe});var ab=v((sbe,ij)=>{"use strict";var rj=/^[0-9]+$/,nj=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=rj.test(t),n=rj.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Poe=(t,e)=>nj(e,t);ij.exports={compareIdentifiers:nj,rcompareIdentifiers:Poe}});var Xt=v((obe,oj)=>{"use strict";var hp=Kc(),{MAX_LENGTH:sj,MAX_SAFE_INTEGER:dp}=zc(),{safeRe:pp,t:mp}=qa(),Roe=fp(),{compareIdentifiers:ub}=ab(),cb=class t{constructor(e,r){if(r=Roe(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>sj)throw new TypeError(`version is longer than ${sj} characters`);hp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?pp[mp.LOOSE]:pp[mp.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>dp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>dp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>dp||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let s=+i;if(s>=0&&s<dp)return s}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(hp("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(hp("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ub(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(hp("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ub(n,i)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let i=`-${r}`.match(this.options.loose?pp[mp.PRERELEASELOOSE]:pp[mp.PRERELEASE]);if(!i||i[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),ub(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};oj.exports=cb});var to=v((abe,uj)=>{"use strict";var aj=Xt(),koe=(t,e,r=!1)=>{if(t instanceof aj)return t;try{return new aj(t,e)}catch(n){if(!r)return null;throw n}};uj.exports=koe});var lj=v((ube,cj)=>{"use strict";var Noe=to(),$oe=(t,e)=>{let r=Noe(t,e);return r?r.version:null};cj.exports=$oe});var hj=v((cbe,fj)=>{"use strict";var Loe=to(),joe=(t,e)=>{let r=Loe(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};fj.exports=joe});var mj=v((lbe,pj)=>{"use strict";var dj=Xt(),Boe=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new dj(t instanceof dj?t.version:t,r).inc(e,n,i).version}catch{return null}};pj.exports=Boe});var Dj=v((fbe,yj)=>{"use strict";var gj=to(),Moe=(t,e)=>{let r=gj(t,null,!0),n=gj(e,null,!0),i=r.compare(n);if(i===0)return null;let s=i>0,o=s?r:n,a=s?n:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};yj.exports=Moe});var Ej=v((hbe,wj)=>{"use strict";var qoe=Xt(),Uoe=(t,e)=>new qoe(t,e).major;wj.exports=Uoe});var vj=v((dbe,bj)=>{"use strict";var Hoe=Xt(),Voe=(t,e)=>new Hoe(t,e).minor;bj.exports=Voe});var Cj=v((pbe,_j)=>{"use strict";var zoe=Xt(),Koe=(t,e)=>new zoe(t,e).patch;_j.exports=Koe});var Aj=v((mbe,Sj)=>{"use strict";var Goe=to(),Woe=(t,e)=>{let r=Goe(t,e);return r&&r.prerelease.length?r.prerelease:null};Sj.exports=Woe});var Xr=v((gbe,xj)=>{"use strict";var Oj=Xt(),Xoe=(t,e,r)=>new Oj(t,r).compare(new Oj(e,r));xj.exports=Xoe});var Ij=v((ybe,Tj)=>{"use strict";var Yoe=Xr(),Joe=(t,e,r)=>Yoe(e,t,r);Tj.exports=Joe});var Pj=v((Dbe,Fj)=>{"use strict";var Zoe=Xr(),Qoe=(t,e)=>Zoe(t,e,!0);Fj.exports=Qoe});var gp=v((wbe,kj)=>{"use strict";var Rj=Xt(),eae=(t,e,r)=>{let n=new Rj(t,r),i=new Rj(e,r);return n.compare(i)||n.compareBuild(i)};kj.exports=eae});var $j=v((Ebe,Nj)=>{"use strict";var tae=gp(),rae=(t,e)=>t.sort((r,n)=>tae(r,n,e));Nj.exports=rae});var jj=v((bbe,Lj)=>{"use strict";var nae=gp(),iae=(t,e)=>t.sort((r,n)=>nae(n,r,e));Lj.exports=iae});var Gc=v((vbe,Bj)=>{"use strict";var sae=Xr(),oae=(t,e,r)=>sae(t,e,r)>0;Bj.exports=oae});var yp=v((_be,Mj)=>{"use strict";var aae=Xr(),uae=(t,e,r)=>aae(t,e,r)<0;Mj.exports=uae});var lb=v((Cbe,qj)=>{"use strict";var cae=Xr(),lae=(t,e,r)=>cae(t,e,r)===0;qj.exports=lae});var fb=v((Sbe,Uj)=>{"use strict";var fae=Xr(),hae=(t,e,r)=>fae(t,e,r)!==0;Uj.exports=hae});var Dp=v((Abe,Hj)=>{"use strict";var dae=Xr(),pae=(t,e,r)=>dae(t,e,r)>=0;Hj.exports=pae});var wp=v((Obe,Vj)=>{"use strict";var mae=Xr(),gae=(t,e,r)=>mae(t,e,r)<=0;Vj.exports=gae});var hb=v((xbe,zj)=>{"use strict";var yae=lb(),Dae=fb(),wae=Gc(),Eae=Dp(),bae=yp(),vae=wp(),_ae=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return yae(t,r,n);case"!=":return Dae(t,r,n);case">":return wae(t,r,n);case">=":return Eae(t,r,n);case"<":return bae(t,r,n);case"<=":return vae(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};zj.exports=_ae});var Gj=v((Tbe,Kj)=>{"use strict";var Cae=Xt(),Sae=to(),{safeRe:Ep,t:bp}=qa(),Aae=(t,e)=>{if(t instanceof Cae)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Ep[bp.COERCEFULL]:Ep[bp.COERCE]);else{let u=e.includePrerelease?Ep[bp.COERCERTLFULL]:Ep[bp.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",s=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Sae(`${n}.${i}.${s}${o}${a}`,e)};Kj.exports=Aae});var Xj=v((Ibe,Wj)=>{"use strict";var db=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};Wj.exports=db});var Yr=v((Fbe,Qj)=>{"use strict";var Oae=/\s+/g,pb=class t{constructor(e,r){if(r=Tae(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof mb)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Oae," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!Jj(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&$ae(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&kae)|(this.options.loose&&Nae))+":"+e,i=Yj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,Kae(this.options.includePrerelease)),et("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],Fae),et("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],Pae),et("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],Rae),et("caret trim",e);let a=e.split(" ").map(h=>Lae(h,this.options)).join(" ").split(/\s+/).map(h=>zae(h,this.options));s&&(a=a.filter(h=>(et("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),et("range list",a);let u=new Map,c=a.map(h=>new mb(h,this.options));for(let h of c){if(Jj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return Yj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Zj(n,r)&&e.set.some(i=>Zj(i,r)&&n.every(s=>i.every(o=>s.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Iae(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Gae(this.set[r],e,this.options))return!0;return!1}};Qj.exports=pb;var xae=Xj(),Yj=new xae,Tae=fp(),mb=Wc(),et=Kc(),Iae=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:Fae,tildeTrimReplace:Pae,caretTrimReplace:Rae}=qa(),{FLAG_INCLUDE_PRERELEASE:kae,FLAG_LOOSE:Nae}=zc(),Jj=t=>t.value==="<0.0.0-0",$ae=t=>t.value==="",Zj=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(s=>i.intersects(s,e)),i=n.pop();return r},Lae=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),et("comp",t,e),t=Mae(t,e),et("caret",t),t=jae(t,e),et("tildes",t),t=Uae(t,e),et("xrange",t),t=Vae(t,e),et("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",jae=(t,e)=>t.trim().split(/\s+/).map(r=>Bae(r,e)).join(" "),Bae=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{et("tilde",t,n,i,s,o,a);let u;return fr(i)?u="":fr(s)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:fr(o)?u=`>=${i}.${s}.0 <${i}.${+s+1}.0-0`:a?(et("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,et("tilde return",u),u})},Mae=(t,e)=>t.trim().split(/\s+/).map(r=>qae(r,e)).join(" "),qae=(t,e)=>{et("caret",t,e);let r=e.loose?lr[Yt.CARETLOOSE]:lr[Yt.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,s,o,a,u)=>{et("caret",t,i,s,o,a,u);let c;return fr(s)?c="":fr(o)?c=`>=${s}.0.0${n} <${+s+1}.0.0-0`:fr(a)?s==="0"?c=`>=${s}.${o}.0${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${n} <${+s+1}.0.0-0`:u?(et("replaceCaret pr",u),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${u} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${u} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${u} <${+s+1}.0.0-0`):(et("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${n} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${n} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),et("caret return",c),c})},Uae=(t,e)=>(et("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hae(r,e)).join(" ")),Hae=(t,e)=>{t=t.trim();let r=e.loose?lr[Yt.XRANGELOOSE]:lr[Yt.XRANGE];return t.replace(r,(n,i,s,o,a,u)=>{et("xRange",t,n,i,s,o,a,u);let c=fr(s),l=c||fr(o),h=l||fr(a),d=h;return i==="="&&d&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&d?(l&&(o=0),a=0,i===">"?(i=">=",l?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):i==="<="&&(i="<",l?s=+s+1:o=+o+1),i==="<"&&(u="-0"),n=`${i+s}.${o}.${a}${u}`):l?n=`>=${s}.0.0${u} <${+s+1}.0.0-0`:h&&(n=`>=${s}.${o}.0${u} <${s}.${+o+1}.0-0`),et("xRange return",n),n})},Vae=(t,e)=>(et("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),zae=(t,e)=>(et("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),Kae=t=>(e,r,n,i,s,o,a,u,c,l,h,d)=>(fr(n)?r="":fr(i)?r=`>=${n}.0.0${t?"-0":""}`:fr(s)?r=`>=${n}.${i}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,fr(c)?u="":fr(l)?u=`<${+c+1}.0.0-0`:fr(h)?u=`<${c}.${+l+1}.0-0`:d?u=`<=${c}.${l}.${h}-${d}`:t?u=`<${c}.${l}.${+h+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Gae=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(et(t[n].semver),t[n].semver!==mb.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Wc=v((Pbe,sB)=>{"use strict";var Xc=Symbol("SemVer ANY"),Db=class t{static get ANY(){return Xc}constructor(e,r){if(r=eB(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),yb("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Xc?this.value="":this.value=this.operator+this.semver.version,yb("comp",this)}parse(e){let r=this.options.loose?tB[rB.COMPARATORLOOSE]:tB[rB.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new nB(n[2],this.options.loose):this.semver=Xc}toString(){return this.value}test(e){if(yb("Comparator.test",e,this.options.loose),this.semver===Xc||e===Xc)return!0;if(typeof e=="string")try{e=new nB(e,this.options)}catch{return!1}return gb(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new iB(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new iB(this.value,r).test(e.semver):(r=eB(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||gb(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||gb(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};sB.exports=Db;var eB=fp(),{safeRe:tB,t:rB}=qa(),gb=hb(),yb=Kc(),nB=Xt(),iB=Yr()});var Yc=v((Rbe,oB)=>{"use strict";var Wae=Yr(),Xae=(t,e,r)=>{try{e=new Wae(e,r)}catch{return!1}return e.test(t)};oB.exports=Xae});var uB=v((kbe,aB)=>{"use strict";var Yae=Yr(),Jae=(t,e)=>new Yae(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));aB.exports=Jae});var lB=v((Nbe,cB)=>{"use strict";var Zae=Xt(),Qae=Yr(),eue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Qae(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Zae(n,r))}),n};cB.exports=eue});var hB=v(($be,fB)=>{"use strict";var tue=Xt(),rue=Yr(),nue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new rue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new tue(n,r))}),n};fB.exports=nue});var mB=v((Lbe,pB)=>{"use strict";var wb=Xt(),iue=Yr(),dB=Gc(),sue=(t,e)=>{t=new iue(t,e);let r=new wb("0.0.0");if(t.test(r)||(r=new wb("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],s=null;i.forEach(o=>{let a=new wb(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||dB(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||dB(r,s))&&(r=s)}return r&&t.test(r)?r:null};pB.exports=sue});var yB=v((jbe,gB)=>{"use strict";var oue=Yr(),aue=(t,e)=>{try{return new oue(t,e).range||"*"}catch{return null}};gB.exports=aue});var vp=v((Bbe,bB)=>{"use strict";var uue=Xt(),EB=Wc(),{ANY:cue}=EB,lue=Yr(),fue=Yc(),DB=Gc(),wB=yp(),hue=wp(),due=Dp(),pue=(t,e,r,n)=>{t=new uue(t,n),e=new lue(e,n);let i,s,o,a,u;switch(r){case">":i=DB,s=hue,o=wB,a=">",u=">=";break;case"<":i=wB,s=due,o=DB,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(fue(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],h=null,d=null;if(l.forEach(f=>{f.semver===cue&&(f=new EB(">=0.0.0")),h=h||f,d=d||f,i(f.semver,h.semver,n)?h=f:o(f.semver,d.semver,n)&&(d=f)}),h.operator===a||h.operator===u||(!d.operator||d.operator===a)&&s(t,d.semver))return!1;if(d.operator===u&&o(t,d.semver))return!1}return!0};bB.exports=pue});var _B=v((Mbe,vB)=>{"use strict";var mue=vp(),gue=(t,e,r)=>mue(t,e,">",r);vB.exports=gue});var SB=v((qbe,CB)=>{"use strict";var yue=vp(),Due=(t,e,r)=>yue(t,e,"<",r);CB.exports=Due});var xB=v((Ube,OB)=>{"use strict";var AB=Yr(),wue=(t,e,r)=>(t=new AB(t,r),e=new AB(e,r),t.intersects(e,r));OB.exports=wue});var IB=v((Hbe,TB)=>{"use strict";var Eue=Yc(),bue=Xr();TB.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>bue(l,h,r));for(let l of o)Eue(l,e,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,h]of n)l===h?a.push(l):!h&&l===o[0]?a.push("*"):h?l===o[0]?a.push(`<=${h}`):a.push(`${l} - ${h}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var $B=v((Vbe,NB)=>{"use strict";var FB=Yr(),bb=Wc(),{ANY:Eb}=bb,Jc=Yc(),vb=Xr(),vue=(t,e,r={})=>{if(t===e)return!0;t=new FB(t,r),e=new FB(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=Cue(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},_ue=[new bb(">=0.0.0-0")],PB=[new bb(">=0.0.0")],Cue=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Eb){if(e.length===1&&e[0].semver===Eb)return!0;r.includePrerelease?t=_ue:t=PB}if(e.length===1&&e[0].semver===Eb){if(r.includePrerelease)return!0;e=PB}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=RB(i,f,r):f.operator==="<"||f.operator==="<="?s=kB(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=vb(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(let f of n){if(i&&!Jc(f,String(i),r)||s&&!Jc(f,String(s),r))return null;for(let m of e)if(!Jc(f,String(m),r))return!1;return!0}let a,u,c,l,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(let f of e){if(l=l||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator===">"||f.operator===">="){if(a=RB(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!Jc(i.semver,String(f),r))return!1}if(s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator==="<"||f.operator==="<="){if(u=kB(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!Jc(s.semver,String(f),r))return!1}if(!f.operator&&(s||i)&&o!==0)return!1}return!(i&&c&&!s&&o!==0||s&&l&&!i&&o!==0||d||h)},RB=(t,e,r)=>{if(!t)return e;let n=vb(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},kB=(t,e,r)=>{if(!t)return e;let n=vb(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};NB.exports=vue});var MB=v((zbe,BB)=>{"use strict";var _b=qa(),LB=zc(),Sue=Xt(),jB=ab(),Aue=to(),Oue=lj(),xue=hj(),Tue=mj(),Iue=Dj(),Fue=Ej(),Pue=vj(),Rue=Cj(),kue=Aj(),Nue=Xr(),$ue=Ij(),Lue=Pj(),jue=gp(),Bue=$j(),Mue=jj(),que=Gc(),Uue=yp(),Hue=lb(),Vue=fb(),zue=Dp(),Kue=wp(),Gue=hb(),Wue=Gj(),Xue=Wc(),Yue=Yr(),Jue=Yc(),Zue=uB(),Que=lB(),ece=hB(),tce=mB(),rce=yB(),nce=vp(),ice=_B(),sce=SB(),oce=xB(),ace=IB(),uce=$B();BB.exports={parse:Aue,valid:Oue,clean:xue,inc:Tue,diff:Iue,major:Fue,minor:Pue,patch:Rue,prerelease:kue,compare:Nue,rcompare:$ue,compareLoose:Lue,compareBuild:jue,sort:Bue,rsort:Mue,gt:que,lt:Uue,eq:Hue,neq:Vue,gte:zue,lte:Kue,cmp:Gue,coerce:Wue,Comparator:Xue,Range:Yue,satisfies:Jue,toComparators:Zue,maxSatisfying:Que,minSatisfying:ece,minVersion:tce,validRange:rce,outside:nce,gtr:ice,ltr:sce,intersects:oce,simplifyRange:ace,subset:uce,SemVer:Sue,re:_b.re,src:_b.src,tokens:_b.t,SEMVER_SPEC_VERSION:LB.SEMVER_SPEC_VERSION,RELEASE_TYPES:LB.RELEASE_TYPES,compareIdentifiers:jB.compareIdentifiers,rcompareIdentifiers:jB.rcompareIdentifiers}});var ZB=v(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.parseApkNameFromFlavor=Q.checkJDKMajorVersion=Q.resolvePlatform=Q.checkPlatformVersions=Q.getAddedPlatforms=Q.getPlatformTargetName=Q.promptForPlatformTarget=Q.promptForPlatform=Q.isValidEnterprisePlatform=Q.getKnownEnterprisePlatforms=Q.isValidCommunityPlatform=Q.getKnownCommunityPlatforms=Q.isValidPlatform=Q.getKnownPlatforms=Q.selectPlatforms=Q.getProjectPlatformDirectory=Q.getCLIVersion=Q.getCoreVersion=Q.getCapacitorPackageVersion=Q.requireCapacitorPackage=Q.getCapacitorPackage=Q.runTask=Q.runPlatformHook=Q.runHooks=Q.wait=Q.checkAppName=Q.checkAppId=Q.checkAppDir=Q.checkAppConfig=Q.checkCapacitorPlatform=Q.checkPackage=Q.checkWebDir=Q.check=void 0;var Qc=(fe(),ue(le)),qB=ji(),Ji=Ea(),ro=require("path"),Be=Qc.__importDefault(ba()),Ua=id(),HB=Dc(),cce=UN(),UB=xl(),Zc=Td(),lce=lp();async function fce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
204
+ `)}Q.check=fce;async function hce(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,Ji.pathExists)(t.app.webDirAbs)?await(0,Ji.pathExists)((0,ro.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Be.default.strong((0,qB.prettyPath)(t.app.webDirAbs))}) must contain an ${Be.default.strong("index.html")} file.
205
+ It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Be.default.strong((0,qB.prettyPath)(t.app.webDirAbs))}.
206
+ Please create it and make sure it has an ${Be.default.strong("index.html")} file. You can change the path of this directory in ${Be.default.strong(t.app.extConfigName)} (${Be.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Be.default.input("npm run build")}). More info: ${Be.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}Q.checkWebDir=hce;async function dce(){return await(0,Ji.pathExists)("package.json")||await(0,Ji.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
207
207
  Make sure you have a package.json or project.json file in the directory where you run the Capacitor CLI.
208
- More info: ${je.default.strong("https://docs.npmjs.com/cli/init")}`}Q.checkPackage=dce;async function pce(t,e){return await Sb(t,e)?null:`Could not find the ${je.default.input(e)} platform.
209
- You must install it in your project first, e.g. w/ ${je.default.input(`npm install @capacitor/${e}`)}`}Q.checkCapacitorPlatform=pce;async function mce(t){if(!t.app.appId)return`Missing ${je.default.input("appId")} for new platform.
210
- Please add it in ${t.app.extConfigName} or run ${je.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${je.default.input("appName")} for new platform.
211
- Please add it in ${t.app.extConfigName} or run ${je.default.input("npx cap init")}.`;let e=await VB(t,t.app.appId);if(e)return e;let r=await zB(t,t.app.appName);return r||null}Q.checkAppConfig=mce;async function gce(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Q.checkAppDir=gce;async function VB(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
208
+ More info: ${Be.default.strong("https://docs.npmjs.com/cli/init")}`}Q.checkPackage=dce;async function pce(t,e){return await Sb(t,e)?null:`Could not find the ${Be.default.input(e)} platform.
209
+ You must install it in your project first, e.g. w/ ${Be.default.input(`npm install @capacitor/${e}`)}`}Q.checkCapacitorPlatform=pce;async function mce(t){if(!t.app.appId)return`Missing ${Be.default.input("appId")} for new platform.
210
+ Please add it in ${t.app.extConfigName} or run ${Be.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Be.default.input("appName")} for new platform.
211
+ Please add it in ${t.app.extConfigName} or run ${Be.default.input("npx cap init")}.`;let e=await VB(t,t.app.appId);if(e)return e;let r=await zB(t,t.app.appName);return r||null}Q.checkAppConfig=mce;async function gce(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}Q.checkAppDir=gce;async function VB(t,e){return e?/^[a-zA-Z][\w]*(?:\.[a-zA-Z][\w]*)+$/.test(e.toLowerCase())?null:`
212
212
  Invalid App ID "${e}". Your App ID must meet the following requirements to be valid on both iOS and Android:
213
213
  - Must be in Java package form with no dashes (ex: com.example.app)
214
214
  - It must have at least two segments (one or more dots).
@@ -217,25 +217,25 @@ Please add it in ${t.app.extConfigName} or run ${je.default.input("npx cap init"
217
217
 
218
218
  If you would like to skip validation, run "cap init" with the "--skip-appid-validation" flag.
219
219
  `:"Invalid App ID. App ID is required and cannot be blank."}Q.checkAppId=VB;async function zB(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}Q.checkAppName=zB;async function yce(t){return new Promise(e=>setTimeout(e,t))}Q.wait=yce;async function Dce(t,e,r,n){await Cb(t,e,r,n);let i=await(0,cce.getPlugins)(t,e);for(let s of i)await Cb(t,e,s.rootPath,n)}Q.runHooks=Dce;async function Cb(t,e,r,n){var i;let{spawn:s}=await Promise.resolve().then(()=>Qc.__importStar(require("child_process"))),o;(0,UB.isNXMonorepo)(r)?o=await(0,Ji.readJSON)((0,ro.join)((0,UB.findNXMonorepoRoot)(r),"package.json")):o=await(0,Ji.readJSON)((0,ro.join)(r,"package.json"));let a=(i=o.scripts)===null||i===void 0?void 0:i[n];if(a)return new Promise((u,c)=>{let l=s(a,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",h=>{h===0?u():c(new Error(`${n} hook on ${e} failed with error code: ${h} while running command: ${a}`))}),l.on("error",h=>{c(h)})})}Q.runPlatformHook=Cb;async function wce(t,e){let r=HB.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}Q.runTask=wce;async function Sb(t,e){let r=(0,Zc.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,Ji.readJSON)(r):null}Q.getCapacitorPackage=Sb;async function KB(t,e){let r=await Sb(t,e);return r||(0,Ua.fatal)(`Unable to find node_modules/@capacitor/${e}.
220
- Are you sure ${je.default.strong(`@capacitor/${e}`)} is installed?`),r}Q.requireCapacitorPackage=KB;async function Cp(t,e){return(await KB(t,e)).version}Q.getCapacitorPackageVersion=Cp;async function GB(t){return Cp(t,"core")}Q.getCoreVersion=GB;async function Ece(t){return Cp(t,"cli")}Q.getCLIVersion=Ece;function bce(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 _p(t,e){let r=bce(t,e);return r&&await(0,Ji.pathExists)(r)?r:null}Q.getProjectPlatformDirectory=_p;async function vce(t,e){if(e){let r=e.toLowerCase().trim();return await Ob(r)?await _p(t,r)||(r==="web"&&(0,Ua.fatal)(`Could not find the web platform directory.
221
- Make sure ${je.default.strong(t.app.webDir)} exists.`),(0,Ua.fatal)(`${je.default.strong(r)} platform has not been added yet.
222
- See the docs for adding the ${je.default.strong(r)} platform: ${je.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ua.fatal)(`Invalid platform: ${je.default.input(r)}`),[r]}return JB(t)}Q.selectPlatforms=vce;async function Ab(){return["web","android","ios"]}Q.getKnownPlatforms=Ab;async function Ob(t){return(await Ab()).includes(t)}Q.isValidPlatform=Ob;async function WB(){return["electron"]}Q.getKnownCommunityPlatforms=WB;async function _ce(t){return(await WB()).includes(t)}Q.isValidCommunityPlatform=_ce;async function XB(){return["windows"]}Q.getKnownEnterprisePlatforms=XB;async function Cce(t){return(await XB()).includes(t)}Q.isValidEnterprisePlatform=Cce;async function Sce(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Qc.__importStar(xd()));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(o=>({title:o,value:o}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let i=r.toLowerCase().trim();if(!await Ob(i)){let s=await Ab();(0,Ua.fatal)(`Invalid platform: ${je.default.input(i)}.
223
- Valid platforms include: ${s.join(", ")}`)}return i}Q.promptForPlatform=Sce;async function Ace(t,e){let{prompt:r}=await Promise.resolve().then(()=>Qc.__importStar(xd())),n=t.filter(o=>o.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(a=>({title:`${YB(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let i=e.trim(),s=t.find(o=>o.id===i);return s||(0,Ua.fatal)(`Invalid target ID: ${je.default.input(i)}.
224
- Valid targets are: ${t.map(o=>o.id).join(", ")}`),s}Q.promptForPlatformTarget=Ace;function YB(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"})`:""}`}Q.getPlatformTargetName=YB;async function JB(t){let e=[];return await _p(t,t.android.name)&&e.push(t.android.name),await _p(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Q.getAddedPlatforms=JB;async function Oce(t,e){let r=await Promise.resolve().then(()=>Qc.__importStar(MB())),n=await GB(t),i=await Cp(t,e);(r.diff(n,i)==="minor"||r.diff(n,i)==="major")&&HB.logger.warn(`${je.default.strong("@capacitor/core")}${je.default.weak(`@${n}`)} version doesn't match ${je.default.strong(`@capacitor/${e}`)}${je.default.weak(`@${i}`)} version.
225
- Consider updating to a matching version, e.g. w/ ${je.default.input(`npm install @capacitor/core@${i}`)}`)}Q.checkPlatformVersions=Oce;function xce(t,e){if(e[0]!=="@"){let n=(0,Zc.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ro.dirname)(n);let i=(0,Zc.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,ro.dirname)(i);let s=(0,Zc.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(s)return(0,ro.dirname)(s)}let r=(0,Zc.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ro.dirname)(r):null}Q.resolvePlatform=xce;async function Tce(){try{let t=await(0,lce.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),i=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof i=="number"&&n==1&&i<9?i:-1}catch{return-1}}Q.checkJDKMajorVersion=Tce;function Ice(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Q.parseApkNameFromFlavor=Ice});var QB=v(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.tryFn=void 0;var Fce=async(t,...e)=>{try{return await t(...e)}catch{}return null};Sp.tryFn=Fce});var eM=v(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.formatJSObject=void 0;var Pce=(fe(),ue(le)),Rce=Pce.__importDefault(require("util"));function kce(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return Rce.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Ap.formatJSObject=kce});var tM=v(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.lazy=Zi.LazyPromise=Zi.allSerial=void 0;function Nce(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}Zi.allSerial=Nce;var Op=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)}};Zi.LazyPromise=Op;function $ce(t){return new Op(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Zi.lazy=$ce});var sM=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.writeConfig=Bt.loadConfig=Bt.CONFIG_FILE_NAME_JSON=Bt.CONFIG_FILE_NAME_JS=Bt.CONFIG_FILE_NAME_TS=void 0;var Tb=(fe(),ue(le)),Lce=Tb.__importDefault(Uh()),Or=Ea(),ye=require("path"),no=Tb.__importDefault(ba()),jce=ZB(),xp=id(),Bce=Dc(),xb=QB(),Mce=eM(),rM=xl(),nM=Td(),Ha=tM(),qce=lp(),iM=(0,Lce.default)("capacitor:config");Bt.CONFIG_FILE_NAME_TS="capacitor.config.ts";Bt.CONFIG_FILE_NAME_JS="capacitor.config.js";Bt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function Uce(){var t,e,r,n;let i=process.cwd(),s=(0,ye.dirname)(__dirname),o=await Kce(i),a=await(async()=>{var f,m;if((0,rM.isNXMonorepo)(i)){let y=(0,rM.findNXMonorepoRoot)(i),E=await(0,xb.tryFn)(Or.readJSON,(0,ye.resolve)(y,"package.json")),C=(f=E?.devDependencies)!==null&&f!==void 0?f:{},A=(m=E?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:C,dependencies:A}}return{}})(),u=(t=o.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=o.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=o.extConfig.webDir)!==null&&r!==void 0?r:"www",h=await Gce(s),d={android:await Wce(i,o.extConfig,h),ios:await Xce(i,o.extConfig),web:await Yce(i,l),cli:h,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ye.resolve)(i,l),package:(n=await(0,xb.tryFn)(Or.readJSON,(0,ye.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...o}};return iM("config: %O",d),d}Bt.loadConfig=Uce;async function Hce(t,e){switch((0,ye.extname)(e)){case".json":{await(0,Or.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Or.writeFile)(e,rle(t));break}}}Bt.writeConfig=Hce;async function Vce(t,e,r){var n;try{let i=(0,nM.resolveNode)(t,"typescript");i||(0,xp.fatal)(`Could not find installation of TypeScript.
220
+ Are you sure ${Be.default.strong(`@capacitor/${e}`)} is installed?`),r}Q.requireCapacitorPackage=KB;async function Cp(t,e){return(await KB(t,e)).version}Q.getCapacitorPackageVersion=Cp;async function GB(t){return Cp(t,"core")}Q.getCoreVersion=GB;async function Ece(t){return Cp(t,"cli")}Q.getCLIVersion=Ece;function bce(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 _p(t,e){let r=bce(t,e);return r&&await(0,Ji.pathExists)(r)?r:null}Q.getProjectPlatformDirectory=_p;async function vce(t,e){if(e){let r=e.toLowerCase().trim();return await Ob(r)?await _p(t,r)||(r==="web"&&(0,Ua.fatal)(`Could not find the web platform directory.
221
+ Make sure ${Be.default.strong(t.app.webDir)} exists.`),(0,Ua.fatal)(`${Be.default.strong(r)} platform has not been added yet.
222
+ See the docs for adding the ${Be.default.strong(r)} platform: ${Be.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ua.fatal)(`Invalid platform: ${Be.default.input(r)}`),[r]}return JB(t)}Q.selectPlatforms=vce;async function Ab(){return["web","android","ios"]}Q.getKnownPlatforms=Ab;async function Ob(t){return(await Ab()).includes(t)}Q.isValidPlatform=Ob;async function WB(){return["electron"]}Q.getKnownCommunityPlatforms=WB;async function _ce(t){return(await WB()).includes(t)}Q.isValidCommunityPlatform=_ce;async function XB(){return["windows"]}Q.getKnownEnterprisePlatforms=XB;async function Cce(t){return(await XB()).includes(t)}Q.isValidEnterprisePlatform=Cce;async function Sce(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>Qc.__importStar(xd()));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(o=>({title:o,value:o}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let i=r.toLowerCase().trim();if(!await Ob(i)){let s=await Ab();(0,Ua.fatal)(`Invalid platform: ${Be.default.input(i)}.
223
+ Valid platforms include: ${s.join(", ")}`)}return i}Q.promptForPlatform=Sce;async function Ace(t,e){let{prompt:r}=await Promise.resolve().then(()=>Qc.__importStar(xd())),n=t.filter(o=>o.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(a=>({title:`${YB(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let i=e.trim(),s=t.find(o=>o.id===i);return s||(0,Ua.fatal)(`Invalid target ID: ${Be.default.input(i)}.
224
+ Valid targets are: ${t.map(o=>o.id).join(", ")}`),s}Q.promptForPlatformTarget=Ace;function YB(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"})`:""}`}Q.getPlatformTargetName=YB;async function JB(t){let e=[];return await _p(t,t.android.name)&&e.push(t.android.name),await _p(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}Q.getAddedPlatforms=JB;async function Oce(t,e){let r=await Promise.resolve().then(()=>Qc.__importStar(MB())),n=await GB(t),i=await Cp(t,e);(r.diff(n,i)==="minor"||r.diff(n,i)==="major")&&HB.logger.warn(`${Be.default.strong("@capacitor/core")}${Be.default.weak(`@${n}`)} version doesn't match ${Be.default.strong(`@capacitor/${e}`)}${Be.default.weak(`@${i}`)} version.
225
+ Consider updating to a matching version, e.g. w/ ${Be.default.input(`npm install @capacitor/core@${i}`)}`)}Q.checkPlatformVersions=Oce;function xce(t,e){if(e[0]!=="@"){let n=(0,Zc.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ro.dirname)(n);let i=(0,Zc.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,ro.dirname)(i);let s=(0,Zc.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(s)return(0,ro.dirname)(s)}let r=(0,Zc.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ro.dirname)(r):null}Q.resolvePlatform=xce;async function Tce(){try{let t=await(0,lce.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),i=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof i=="number"&&n==1&&i<9?i:-1}catch{return-1}}Q.checkJDKMajorVersion=Tce;function Ice(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}Q.parseApkNameFromFlavor=Ice});var QB=v(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});Sp.tryFn=void 0;var Fce=async(t,...e)=>{try{return await t(...e)}catch{}return null};Sp.tryFn=Fce});var eM=v(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});Ap.formatJSObject=void 0;var Pce=(fe(),ue(le)),Rce=Pce.__importDefault(require("util"));function kce(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return Rce.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Ap.formatJSObject=kce});var tM=v(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.lazy=Zi.LazyPromise=Zi.allSerial=void 0;function Nce(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}Zi.allSerial=Nce;var Op=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)}};Zi.LazyPromise=Op;function $ce(t){return new Op(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}Zi.lazy=$ce});var sM=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.writeConfig=Bt.loadConfig=Bt.CONFIG_FILE_NAME_JSON=Bt.CONFIG_FILE_NAME_JS=Bt.CONFIG_FILE_NAME_TS=void 0;var Tb=(fe(),ue(le)),Lce=Tb.__importDefault(Uh()),Or=Ea(),ye=require("path"),no=Tb.__importDefault(ba()),jce=ZB(),xp=id(),Bce=Dc(),xb=QB(),Mce=eM(),rM=xl(),nM=Td(),Ha=tM(),qce=lp(),iM=(0,Lce.default)("capacitor:config");Bt.CONFIG_FILE_NAME_TS="capacitor.config.ts";Bt.CONFIG_FILE_NAME_JS="capacitor.config.js";Bt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function Uce(){var t,e,r,n;let i=process.cwd(),s=(0,ye.dirname)(__dirname),o=await Kce(i),a=await(async()=>{var f,m;if((0,rM.isNXMonorepo)(i)){let y=(0,rM.findNXMonorepoRoot)(i),E=await(0,xb.tryFn)(Or.readJSON,(0,ye.resolve)(y,"package.json")),S=(f=E?.devDependencies)!==null&&f!==void 0?f:{},A=(m=E?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:S,dependencies:A}}return{}})(),u=(t=o.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=o.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=o.extConfig.webDir)!==null&&r!==void 0?r:"www",h=await Gce(s),d={android:await Wce(i,o.extConfig,h),ios:await Xce(i,o.extConfig),web:await Yce(i,l),cli:h,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ye.resolve)(i,l),package:(n=await(0,xb.tryFn)(Or.readJSON,(0,ye.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...o}};return iM("config: %O",d),d}Bt.loadConfig=Uce;async function Hce(t,e){switch((0,ye.extname)(e)){case".json":{await(0,Or.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Or.writeFile)(e,rle(t));break}}}Bt.writeConfig=Hce;async function Vce(t,e,r){var n;try{let i=(0,nM.resolveNode)(t,"typescript");i||(0,xp.fatal)(`Could not find installation of TypeScript.
226
226
  To use ${no.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${no.default.input("npm install -D typescript")}`);let s=require(i),o=(0,nM.requireTS)(s,r),a=o.default?await o.default:o;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:a}}catch(i){throw(0,xp.isFatal)(i)||(0,xp.fatal)(`Parsing ${no.default.strong(e)} failed.
227
227
 
228
228
  ${(n=i.stack)!==null&&n!==void 0?n:i}`),i}}async function zce(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(i){(0,xp.fatal)(`Parsing ${no.default.strong(e)} failed.
229
229
 
230
- ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Kce(t){var e;let r=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_TS);if(await(0,Or.pathExists)(r))return Vce(t,Bt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_JS);if(await(0,Or.pathExists)(n))return zce(t,Bt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:Bt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,xb.tryFn)(Or.readJSON,i))!==null&&e!==void 0?e:{}}}async function Gce(t){let e="assets",r=(0,ye.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",s="android-template.tar.gz",o="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ye.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,i)},android:{platformTemplateArchive:s,platformTemplateArchiveAbs:(0,ye.resolve)(r,s),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,o)}},package:await(0,Or.readJSON)((0,ye.resolve)(t,"package.json")),os:Jce(process.platform)}}async function Wce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,y,E,C,A,p;let D="android",w=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",_=(0,ye.resolve)(t,w),P="app",b=`${P}/src`,k=`${b}/main`,R=`${k}/assets`,I=`${R}/public`,j=`${k}/res`,U=`${P}/build/outputs/apk/`,K=((s=e.android)===null||s===void 0?void 0:s.flavor)||"";!((o=e.android)===null||o===void 0)&&o.flavor&&(U=`${U}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let L=(0,jce.parseApkNameFromFlavor)(K),S=`${U}/debug`,T="capacitor-cordova-android-plugins",F=(0,Ha.lazy)(()=>ele(r.os)),$={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(h=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.keystorePassword,keystoreAlias:(f=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.keystoreAlias,keystoreAliasPassword:(y=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(C=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||C===void 0?void 0:C.signingType,releaseType:(p=(A=e.android)===null||A===void 0?void 0:A.buildOptions)===null||p===void 0?void 0:p.releaseType};return{name:D,minVersion:"23",studioPath:F,platformDir:w,platformDirAbs:_,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(_,T),appDir:P,appDirAbs:(0,ye.resolve)(_,P),srcDir:b,srcDirAbs:(0,ye.resolve)(_,b),srcMainDir:k,srcMainDirAbs:(0,ye.resolve)(_,k),assetsDir:R,assetsDirAbs:(0,ye.resolve)(_,R),webDir:I,webDirAbs:(0,ye.resolve)(_,I),resDir:j,resDirAbs:(0,ye.resolve)(_,j),apkName:L,buildOutputDir:S,buildOutputDirAbs:(0,ye.resolve)(_,S),flavor:K,buildOptions:$}}async function Xce(t,e){var r,n,i,s,o,a,u,c,l,h,d,f;let y=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",E=(0,ye.resolve)(t,y),C=(s=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&s!==void 0?s:"App",A="App",p=(0,ye.resolve)(E,A),D=`${A}/App`,w=(0,ye.resolve)(E,D),_=`${A}/App.xcodeproj`,P=(0,ye.resolve)(E,_),b=(0,Ha.lazy)(()=>Zce(p)),k=(0,Ha.lazy)(()=>tle(t,E,p)),R=(0,Ha.lazy)(()=>Qce(p,w,P)),I="capacitor-cordova-ios-plugins",j={exportMethod:(a=(o=e.ios)===null||o===void 0?void 0:o.buildOptions)===null||a===void 0?void 0:a.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(h=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.signingCertificate,provisioningProfile:(f=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:y,platformDirAbs:E,scheme:C,cordovaPluginsDir:I,cordovaPluginsDirAbs:(0,ye.resolve)(E,I),nativeProjectDir:A,nativeProjectDirAbs:p,nativeTargetDir:D,nativeTargetDirAbs:w,nativeXcodeProjDir:_,nativeXcodeProjDirAbs:P,nativeXcodeWorkspaceDir:(0,Ha.lazy)(async()=>(0,ye.relative)(E,await b)),nativeXcodeWorkspaceDirAbs:b,webDir:(0,Ha.lazy)(async()=>(0,ye.relative)(E,await R)),webDirAbs:R,podPath:k,buildOptions:j}}async function Yce(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Jce(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function Zce(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Qce(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,i=(0,ye.resolve)(r,"project.pbxproj");try{let o=(await(0,Or.readFile)(i,{encoding:"utf8"})).match(n);if(o&&o[1]==="SOURCE_ROOT")return Bce.logger.warn(`Using the iOS project root for the ${no.default.strong("public")} directory is deprecated.
230
+ ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Kce(t){var e;let r=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_TS);if(await(0,Or.pathExists)(r))return Vce(t,Bt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_JS);if(await(0,Or.pathExists)(n))return zce(t,Bt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,Bt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:Bt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,xb.tryFn)(Or.readJSON,i))!==null&&e!==void 0?e:{}}}async function Gce(t){let e="assets",r=(0,ye.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",s="android-template.tar.gz",o="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ye.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,i)},android:{platformTemplateArchive:s,platformTemplateArchiveAbs:(0,ye.resolve)(r,s),cordovaPluginsTemplateArchive:o,cordovaPluginsTemplateArchiveAbs:(0,ye.resolve)(r,o)}},package:await(0,Or.readJSON)((0,ye.resolve)(t,"package.json")),os:Jce(process.platform)}}async function Wce(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,y,E,S,A,p;let D="android",w=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",_=(0,ye.resolve)(t,w),P="app",b=`${P}/src`,k=`${b}/main`,R=`${k}/assets`,I=`${R}/public`,j=`${k}/res`,U=`${P}/build/outputs/apk/`,K=((s=e.android)===null||s===void 0?void 0:s.flavor)||"";!((o=e.android)===null||o===void 0)&&o.flavor&&(U=`${U}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let L=(0,jce.parseApkNameFromFlavor)(K),C=`${U}/debug`,T="capacitor-cordova-android-plugins",F=(0,Ha.lazy)(()=>ele(r.os)),$={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(h=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.keystorePassword,keystoreAlias:(f=(d=e.android)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.keystoreAlias,keystoreAliasPassword:(y=(m=e.android)===null||m===void 0?void 0:m.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(S=(E=e.android)===null||E===void 0?void 0:E.buildOptions)===null||S===void 0?void 0:S.signingType,releaseType:(p=(A=e.android)===null||A===void 0?void 0:A.buildOptions)===null||p===void 0?void 0:p.releaseType};return{name:D,minVersion:"23",studioPath:F,platformDir:w,platformDirAbs:_,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(_,T),appDir:P,appDirAbs:(0,ye.resolve)(_,P),srcDir:b,srcDirAbs:(0,ye.resolve)(_,b),srcMainDir:k,srcMainDirAbs:(0,ye.resolve)(_,k),assetsDir:R,assetsDirAbs:(0,ye.resolve)(_,R),webDir:I,webDirAbs:(0,ye.resolve)(_,I),resDir:j,resDirAbs:(0,ye.resolve)(_,j),apkName:L,buildOutputDir:C,buildOutputDirAbs:(0,ye.resolve)(_,C),flavor:K,buildOptions:$}}async function Xce(t,e){var r,n,i,s,o,a,u,c,l,h,d,f;let y=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",E=(0,ye.resolve)(t,y),S=(s=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&s!==void 0?s:"App",A="App",p=(0,ye.resolve)(E,A),D=`${A}/App`,w=(0,ye.resolve)(E,D),_=`${A}/App.xcodeproj`,P=(0,ye.resolve)(E,_),b=(0,Ha.lazy)(()=>Zce(p)),k=(0,Ha.lazy)(()=>tle(t,E,p)),R=(0,Ha.lazy)(()=>Qce(p,w,P)),I="capacitor-cordova-ios-plugins",j={exportMethod:(a=(o=e.ios)===null||o===void 0?void 0:o.buildOptions)===null||a===void 0?void 0:a.exportMethod,xcodeSigningStyle:(c=(u=e.ios)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.signingStyle,signingCertificate:(h=(l=e.ios)===null||l===void 0?void 0:l.buildOptions)===null||h===void 0?void 0:h.signingCertificate,provisioningProfile:(f=(d=e.ios)===null||d===void 0?void 0:d.buildOptions)===null||f===void 0?void 0:f.provisioningProfile};return{name:"ios",minVersion:"14.0",platformDir:y,platformDirAbs:E,scheme:S,cordovaPluginsDir:I,cordovaPluginsDirAbs:(0,ye.resolve)(E,I),nativeProjectDir:A,nativeProjectDirAbs:p,nativeTargetDir:D,nativeTargetDirAbs:w,nativeXcodeProjDir:_,nativeXcodeProjDirAbs:P,nativeXcodeWorkspaceDir:(0,Ha.lazy)(async()=>(0,ye.relative)(E,await b)),nativeXcodeWorkspaceDirAbs:b,webDir:(0,Ha.lazy)(async()=>(0,ye.relative)(E,await R)),webDirAbs:R,podPath:k,buildOptions:j}}async function Yce(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Jce(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function Zce(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Qce(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,i=(0,ye.resolve)(r,"project.pbxproj");try{let o=(await(0,Or.readFile)(i,{encoding:"utf8"})).match(n);if(o&&o[1]==="SOURCE_ROOT")return Bce.logger.warn(`Using the iOS project root for the ${no.default.strong("public")} directory is deprecated.
231
231
  Please follow the Upgrade Guide to move ${no.default.strong("public")} inside the iOS target directory: ${no.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ye.resolve)(t,"public")}catch{}return(0,ye.resolve)(e,"public")}async function ele(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(()=>Tb.__importStar(lp())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Or.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 i=n.indexOf("REG_SZ");i>0&&(r=n.substring(i+6).trim()+"\\bin\\studio64.exe")}}catch(n){iM("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function tle(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Or.pathExists)((0,ye.resolve)(t,"Gemfile"))?n=(0,ye.resolve)(t,"Gemfile"):await(0,Or.pathExists)((0,ye.resolve)(e,"Gemfile"))?n=(0,ye.resolve)(e,"Gemfile"):await(0,Or.pathExists)((0,ye.resolve)(r,"Gemfile"))&&(n=(0,ye.resolve)(r,"Gemfile")),!(n!=""))try{let s=await(0,qce.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});s!=null&&(n=(0,ye.resolve)(s,"Gemfile"))}catch{}try{let s=(await(0,Or.readFile)(n)).toString();return s&&new RegExp(/gem\s+['"]cocoapods/).test(s)?"bundle exec pod":"pod"}catch{return"pod"}}function rle(t){return`import type { CapacitorConfig } from '@capacitor/cli';
232
232
 
233
233
  const config: CapacitorConfig = ${(0,Mce.formatJSObject)(t)};
234
234
 
235
235
  export default config;
236
- `}});function nle(){try{return Pb.default.statSync("/.dockerenv"),!0}catch{return!1}}function ile(){try{return Pb.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Rb(){return Fb===void 0&&(Fb=nle()||ile()),Fb}var Pb,Fb,aM=Nr(()=>{Pb=Oe(require("node:fs"),1)});function za(){return kb===void 0&&(kb=sle()||Rb()),kb}var uM,kb,sle,Nb=Nr(()=>{uM=Oe(require("node:fs"),1);aM();sle=()=>{try{return uM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var $b,lM,fM,cM,Qi,Lb=Nr(()=>{$b=Oe(require("node:process"),1),lM=Oe(require("node:os"),1),fM=Oe(require("node:fs"),1);Nb();cM=()=>{if($b.default.platform!=="linux")return!1;if(lM.default.release().toLowerCase().includes("microsoft"))return!za();try{return fM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!za():!1}catch{return!1}},Qi=$b.default.env.__IS_WSL_TEST__?cM:cM()});var jb,tl,ole,ale,Bb,hM=Nr(()=>{jb=Oe(require("node:process"),1),tl=Oe(require("node:fs/promises"),1);Lb();Lb();ole=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await tl.default.access(r,tl.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await tl.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),ale=async()=>`${await ole()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Bb=async()=>Qi?ale():`${jb.default.env.SYSTEMROOT||jb.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function es(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var dM=Nr(()=>{});async function Mb(){if(mM.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await ule("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var pM,mM,gM,ule,yM=Nr(()=>{pM=require("node:util"),mM=Oe(require("node:process"),1),gM=require("node:child_process"),ule=(0,pM.promisify)(gM.execFile)});async function EM(t,{humanReadableOutput:e=!0,signal:r}={}){if(DM.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await cle("osascript",["-e",t,n],i);return s.trim()}var DM,wM,qb,cle,bM=Nr(()=>{DM=Oe(require("node:process"),1),wM=require("node:util"),qb=require("node:child_process"),cle=(0,wM.promisify)(qb.execFile)});async function Ub(t){return EM(`tell application "Finder" to set app_path to application file id "${t}" as string
237
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var vM=Nr(()=>{bM()});async function Hb(t=lle){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 Tp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=fle[n];if(!i)throw new Tp(`Unknown browser ID: ${n}`);return i}var _M,CM,lle,fle,Tp,SM=Nr(()=>{_M=require("node:util"),CM=require("node:child_process"),lle=(0,_M.promisify)(CM.execFile),fle={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},Tp=class extends Error{}});async function Vb(){if(Ip.default.platform==="darwin"){let t=await Mb();return{name:await Ub(t),id:t}}if(Ip.default.platform==="linux"){let{stdout:t}=await hle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:dle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Ip.default.platform==="win32")return Hb();throw new Error("Only macOS, Linux, and Windows are supported")}var AM,Ip,OM,hle,dle,xM=Nr(()=>{AM=require("node:util"),Ip=Oe(require("node:process"),1),OM=require("node:child_process");yM();vM();SM();hle=(0,AM.promisify)(OM.execFile),dle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Yb={};fm(Yb,{apps:()=>ts,default:()=>Dle,openApp:()=>yle});async function mle(){let t=await Bb(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Gb.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await ple(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=n.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[i]?{id:s[i]}:{}}function PM(t){if(typeof t=="string"||Array.isArray(t))return t;let{[IM]:e}=t;if(!e)throw new Error(`${IM} is not supported`);return e}function Pp({[Ka]:t},{wsl:e}){if(e&&Qi)return PM(e);if(!t)throw new Error(`${Ka} is not supported`);return PM(t)}var Kb,Gb,Wb,RM,kM,Xb,Fp,wle,ple,zb,TM,Ka,IM,FM,rl,gle,yle,ts,Dle,Jb=Nr(()=>{Kb=Oe(require("node:process"),1),Gb=require("node:buffer"),Wb=Oe(require("node:path"),1),RM=require("node:url"),kM=require("node:util"),Xb=Oe(require("node:child_process"),1),Fp=Oe(require("node:fs/promises"),1);hM();dM();xM();Nb();wle={},ple=(0,kM.promisify)(Xb.default.execFile),zb=Wb.default.dirname((0,RM.fileURLToPath)(wle.url)),TM=Wb.default.join(zb,"xdg-open"),{platform:Ka,arch:IM}=Kb.default;FM=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},rl=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return FM(t.app,a=>rl({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return FM(e,a=>rl({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Qi?await mle():await Vb();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),rl({...t,app:{name:ts[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if(Ka==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Ka==="win32"||Qi&&!za()&&!e){n=await Bb(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Qi||(s.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),a.push("-ArgumentList",r.join(","))),t.target=Gb.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!zb||zb==="/",u=!1;try{await Fp.default.access(TM,Fp.constants.X_OK),u=!0}catch{}n=Kb.default.versions.electron??(Ka==="android"||a||!u)?"xdg-open":TM}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}Ka==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=Xb.default.spawn(n,i,s);return t.wait?new Promise((a,u)=>{o.once("error",u),o.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},gle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return rl({...e,target:t})},yle=(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 rl({...e,app:{name:t,arguments:r}})};ts={};es(ts,"chrome",()=>Pp({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));es(ts,"brave",()=>Pp({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"]}}));es(ts,"firefox",()=>Pp({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));es(ts,"edge",()=>Pp({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));es(ts,"browser",()=>"browser");es(ts,"browserPrivate",()=>"browserPrivate");Dle=gle});var tm=v(Zr=>{"use strict";Zr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Zr.find=(t,e)=>t.nodes.find(r=>r.type===e);Zr.exceedsLimit=(t,e,r=1,n)=>n===!1||!Zr.isInteger(t)||!Zr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Zr.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)};Zr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Zr.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;Zr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Zr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Zr.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var rm=v((fCe,J8)=>{"use strict";var Y8=tm();J8.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&Y8.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&Y8.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var Q8=v((hCe,Z8)=>{"use strict";Z8.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var u6=v((dCe,a6)=>{"use strict";var e6=Q8(),ho=(t,e,r)=>{if(e6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(e6(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 i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(ho.cache.hasOwnProperty(u))return ho.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let h=o6(t)||o6(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;m=t6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=t6(c,l,d,n)),d.negatives=m,d.positives=f,d.result=ofe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),ho.cache[u]=d,d.result};function ofe(t,e,r){let n=mv(t,e,"-",!1,r)||[],i=mv(e,t,"",!1,r)||[],s=mv(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function afe(t,e){let r=1,n=1,i=n6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=n6(t,r);for(i=i6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=i6(e+1,n)-1;return s=[...s],s.sort(lfe),s}function ufe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=cfe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=ffe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function t6(t,e,r,n){let i=afe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=ufe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+s6(a.count),o=c+1;continue}r.isPadded&&(h=hfe(c,r,n)),l.string=h+l.pattern+s6(l.count),s.push(l),o=c+1,a=l}return s}function mv(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!r6(e,"string",a)&&s.push(r+a),n&&r6(e,"string",a)&&s.push(r+a)}return s}function cfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function lfe(t,e){return t>e?1:e>t?-1:0}function r6(t,e,r){return t.some(n=>n[e]===r)}function n6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function i6(t,e){return t-t%Math.pow(10,e)}function s6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function ffe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function o6(t){return/^-?(0+)\d/.test(t)}function hfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}ho.cache={};ho.clearCache=()=>ho.cache={};a6.exports=ho});var Dv=v((pCe,m6)=>{"use strict";var dfe=require("util"),l6=u6(),c6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),pfe=t=>e=>t===!0?Number(e):String(e),gv=t=>typeof t=="number"||typeof t=="string"&&t!=="",hl=t=>Number.isInteger(+t),yv=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},mfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,gfe=(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},im=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},yfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>im(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>im(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},f6=(t,e,r,n)=>{if(r)return l6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},h6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return l6(t,e,r)},d6=(...t)=>new RangeError("Invalid range arguments: "+dfe.inspect(...t)),p6=(t,e,r)=>{if(r.strictRanges===!0)throw d6([t,e]);return[]},Dfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},wfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw d6([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=yv(a)||yv(u)||yv(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&mfe(t,e,n)===!1,f=n.transform||pfe(d);if(n.toRegex&&r===1)return f6(im(t,h),im(e,h),!0,n);let m={negatives:[],positives:[]},y=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),E=[],C=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):E.push(gfe(f(i,C),h,d)),i=o?i-r:i+r,C++;return n.toRegex===!0?r>1?yfe(m,n,h):h6(E,null,{wrap:!1,...n}):E},Efe=(t,e,r=1,n={})=>{if(!hl(t)&&t.length>1||!hl(e)&&e.length>1)return p6(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return f6(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?h6(l,null,{wrap:!1,options:n}):l},nm=(t,e,r,n={})=>{if(e==null&&gv(t))return[t];if(!gv(t)||!gv(e))return p6(t,e,n);if(typeof r=="function")return nm(t,e,1,{transform:r});if(c6(r))return nm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,hl(r)?hl(t)&&hl(e)?wfe(t,e,r,i):Efe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!c6(r)?Dfe(r,i):nm(t,e,1,r)};m6.exports=nm});var D6=v((mCe,y6)=>{"use strict";var bfe=Dv(),g6=tm(),vfe=(t,e={})=>{let r=(n,i={})=>{let s=g6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!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 a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=g6.reduce(n.nodes),h=bfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};y6.exports=vfe});var b6=v((gCe,E6)=>{"use strict";var _fe=Dv(),w6=rm(),su=tm(),po=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?su.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(po(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?po(i,s,r):i+s);return su.flatten(n)},Cfe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(po(a.pop(),w6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(po(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=su.reduce(i.nodes);if(su.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=_fe(...h,e);d.length===0&&(d=w6(i,e)),a.push(po(a.pop(),d)),i.nodes=[];return}let u=su.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(po(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(po(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return su.flatten(n(t))};E6.exports=Cfe});var _6=v((yCe,v6)=>{"use strict";v6.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:`
238
- `,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 x6=v((DCe,O6)=>{"use strict";var Sfe=rm(),{MAX_LENGTH:C6,CHAR_BACKSLASH:wv,CHAR_BACKTICK:Afe,CHAR_COMMA:Ofe,CHAR_DOT:xfe,CHAR_LEFT_PARENTHESES:Tfe,CHAR_RIGHT_PARENTHESES:Ife,CHAR_LEFT_CURLY_BRACE:Ffe,CHAR_RIGHT_CURLY_BRACE:Pfe,CHAR_LEFT_SQUARE_BRACKET:S6,CHAR_RIGHT_SQUARE_BRACKET:A6,CHAR_DOUBLE_QUOTE:Rfe,CHAR_SINGLE_QUOTE:kfe,CHAR_NO_BREAK_SPACE:Nfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:$fe}=_6(),Lfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(C6,r.maxLength):C6;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===$fe||d===Nfe)){if(d===wv){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===A6){m({type:"text",value:"\\"+d});continue}if(d===S6){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===S6){u++;continue}if(y===wv){d+=f();continue}if(y===A6&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===Tfe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===Ife){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===Rfe||d===kfe||d===Afe){let y=d,E;for(e.keepQuotes!==!0&&(d="");l<c&&(E=f());){if(E===wv){d+=E+f();continue}if(E===y){e.keepQuotes===!0&&(d+=E);break}d+=E}m({type:"text",value:d});continue}if(d===Ffe){h++;let E={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(E),s.push(o),m({type:"open",value:d});continue}if(d===Pfe){if(o.type!=="brace"){m({type:"text",value:d});continue}let y="close";o=s.pop(),o.close=!0,m({type:y,value:d}),h--,o=s[s.length-1];continue}if(d===Ofe&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:Sfe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===xfe&&h>0&&o.commas===0){let y=o.nodes;if(h===0||y.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let E=y[y.length-1];E.value+=a.value+d,a=E,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let y=s[s.length-1],E=y.nodes.indexOf(o);y.nodes.splice(E,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};O6.exports=Lfe});var F6=v((wCe,I6)=>{"use strict";var T6=rm(),jfe=D6(),Bfe=b6(),Mfe=x6(),Rr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Rr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Rr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Rr.parse=(t,e={})=>Mfe(t,e);Rr.stringify=(t,e={})=>T6(typeof t=="string"?Rr.parse(t,e):t,e);Rr.compile=(t,e={})=>(typeof t=="string"&&(t=Rr.parse(t,e)),jfe(t,e));Rr.expand=(t,e={})=>{typeof t=="string"&&(t=Rr.parse(t,e));let r=Bfe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Rr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Rr.compile(t,e):Rr.expand(t,e);I6.exports=Rr});var dl=v((ECe,$6)=>{"use strict";var qfe=require("path"),Mn="\\\\/",P6=`[^${Mn}]`,Di="\\.",Ufe="\\+",Hfe="\\?",sm="\\/",Vfe="(?=.)",R6="[^/]",Ev=`(?:${sm}|$)`,k6=`(?:^|${sm})`,bv=`${Di}{1,2}${Ev}`,zfe=`(?!${Di})`,Kfe=`(?!${k6}${bv})`,Gfe=`(?!${Di}{0,1}${Ev})`,Wfe=`(?!${bv})`,Xfe=`[^.${sm}]`,Yfe=`${R6}*?`,N6={DOT_LITERAL:Di,PLUS_LITERAL:Ufe,QMARK_LITERAL:Hfe,SLASH_LITERAL:sm,ONE_CHAR:Vfe,QMARK:R6,END_ANCHOR:Ev,DOTS_SLASH:bv,NO_DOT:zfe,NO_DOTS:Kfe,NO_DOT_SLASH:Gfe,NO_DOTS_SLASH:Wfe,QMARK_NO_DOT:Xfe,STAR:Yfe,START_ANCHOR:k6},Jfe={...N6,SLASH_LITERAL:`[${Mn}]`,QMARK:P6,STAR:`${P6}*?`,DOTS_SLASH:`${Di}{1,2}(?:[${Mn}]|$)`,NO_DOT:`(?!${Di})`,NO_DOTS:`(?!(?:^|[${Mn}])${Di}{1,2}(?:[${Mn}]|$))`,NO_DOT_SLASH:`(?!${Di}{0,1}(?:[${Mn}]|$))`,NO_DOTS_SLASH:`(?!${Di}{1,2}(?:[${Mn}]|$))`,QMARK_NO_DOT:`[^.${Mn}]`,START_ANCHOR:`(?:^|[${Mn}])`,END_ANCHOR:`(?:[${Mn}]|$)`},Zfe={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"};$6.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Zfe,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:qfe.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?Jfe:N6}}});var pl=v(xr=>{"use strict";var Qfe=require("path"),ehe=process.platform==="win32",{REGEX_BACKSLASH:the,REGEX_REMOVE_BACKSLASH:rhe,REGEX_SPECIAL_CHARS:nhe,REGEX_SPECIAL_CHARS_GLOBAL:ihe}=dl();xr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);xr.hasRegexChars=t=>nhe.test(t);xr.isRegexChar=t=>t.length===1&&xr.hasRegexChars(t);xr.escapeRegex=t=>t.replace(ihe,"\\$1");xr.toPosixSlashes=t=>t.replace(the,"/");xr.removeBackslashes=t=>t.replace(rhe,e=>e==="\\"?"":e);xr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};xr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:ehe===!0||Qfe.sep==="\\";xr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?xr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};xr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};xr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var V6=v((vCe,H6)=>{"use strict";var L6=pl(),{CHAR_ASTERISK:vv,CHAR_AT:she,CHAR_BACKWARD_SLASH:ml,CHAR_COMMA:ohe,CHAR_DOT:_v,CHAR_EXCLAMATION_MARK:Cv,CHAR_FORWARD_SLASH:U6,CHAR_LEFT_CURLY_BRACE:Sv,CHAR_LEFT_PARENTHESES:Av,CHAR_LEFT_SQUARE_BRACKET:ahe,CHAR_PLUS:uhe,CHAR_QUESTION_MARK:j6,CHAR_RIGHT_CURLY_BRACE:che,CHAR_RIGHT_PARENTHESES:B6,CHAR_RIGHT_SQUARE_BRACKET:lhe}=dl(),M6=t=>t===U6||t===ml,q6=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},fhe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,y=!1,E=!1,C=!1,A=!1,p=!1,D=!1,w=!1,_=0,P,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),j=()=>(P=b,u.charCodeAt(++c));for(;c<n;){b=j();let T;if(b===ml){A=k.backslashes=!0,b=j(),b===Sv&&(C=!0);continue}if(C===!0||b===Sv){for(_++;R()!==!0&&(b=j());){if(b===ml){A=k.backslashes=!0,j();continue}if(b===Sv){_++;continue}if(C!==!0&&b===_v&&(b=j())===_v){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(C!==!0&&b===ohe){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===che&&(_--,_===0)){C=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===U6){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(P===_v&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===uhe||b===she||b===vv||b===j6||b===Cv)===!0&&I()===Av){if(m=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===Cv&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=j());){if(b===ml){A=k.backslashes=!0,b=j();continue}if(b===B6){m=k.isGlob=!0,w=!0;break}}continue}break}if(b===vv){if(P===vv&&(E=k.isGlobstar=!0),m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===j6){if(m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===ahe){for(;R()!==!0&&(T=j());){if(T===ml){A=k.backslashes=!0,j();continue}if(T===lhe){f=k.isBracket=!0,m=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===Cv&&c===l){p=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Av){if(m=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=j());){if(b===Av){A=k.backslashes=!0,b=j();continue}if(b===B6){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let U=u,K="",L="";l>0&&(K=u.slice(0,l),u=u.slice(l),h-=l),U&&m===!0&&h>0?(U=u.slice(0,h),L=u.slice(h)):m===!0?(U="",L=u):U=u,U&&U!==""&&U!=="/"&&U!==u&&M6(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=L6.removeBackslashes(L)),U&&A===!0&&(U=L6.removeBackslashes(U)));let S={prefix:K,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:y,isGlobstar:E,negated:p,negatedExtglob:D};if(r.tokens===!0&&(S.maxDepth=0,M6(b)||o.push(k),S.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let F=0;F<s.length;F++){let $=T?T+1:l,M=s[F],B=t.slice($,M);r.tokens&&(F===0&&l!==0?(o[F].isPrefix=!0,o[F].value=K):o[F].value=B,q6(o[F]),S.maxDepth+=o[F].depth),(F!==0||B!=="")&&a.push(B),T=M}if(T&&T+1<t.length){let F=t.slice(T+1);a.push(F),r.tokens&&(o[o.length-1].value=F,q6(o[o.length-1]),S.maxDepth+=o[o.length-1].depth)}S.slashes=s,S.parts=a}return S};H6.exports=fhe});var G6=v((_Ce,K6)=>{"use strict";var om=dl(),kr=pl(),{MAX_LENGTH:am,POSIX_REGEX_SOURCE:hhe,REGEX_NON_SPECIAL_CHARS:dhe,REGEX_SPECIAL_CHARS_BACKREF:phe,REPLACEMENTS:z6}=om,mhe=(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(i=>kr.escapeRegex(i)).join("..")}return r},ou=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ov=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=z6[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(am,r.maxLength):am,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=kr.isWindows(e),c=om.globChars(u),l=om.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:C,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:_}=c,P=N=>`(${a}(?:(?!${_}${N.dot?y:h}).)*?)`,b=r.dot?"":E,k=r.dot?p:D,R=r.bash===!0?P(r):w;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let I={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:o};t=kr.removePrefix(t,I),i=t.length;let j=[],U=[],K=[],L=s,S,T=()=>I.index===i-1,F=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",M=()=>t.slice(I.index+1),B=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,B(N.value)},q=()=>{let N=1;for(;F()==="!"&&(F(2)!=="("||F(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},V=N=>{I[N]++,K.push(N)},ae=N=>{I[N]--,K.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||j.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(j.length&&N.type!=="paren"&&(j[j.length-1].inner+=N.value),(N.value||N.output)&&G(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=I.parens,z.output=I.output;let ie=(r.capture?"(":"")+z.open;V("parens"),x({type:N,value:ne,output:I.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),j.push(z)},H=N=>{let ne=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=P(r)),(ie!==R||T()||/^\)+$/.test(M()))&&(ne=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=Ov(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:S,output:ne}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(phe,(z,ie,we,xe,qe,Et)=>xe==="\\"?(N=!0,z):xe==="?"?ie?ie+xe+(qe?p.repeat(qe.length):""):Et===0?k+(qe?p.repeat(qe.length):""):p.repeat(we.length):xe==="."?h.repeat(we.length):xe==="*"?ie?ie+xe+(qe?R:""):R:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=kr.wrapOutput(ne,I,e),I)}for(;!T();){if(S=$(),S==="\0")continue;if(S==="\\"){let z=F();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){S+="\\",x({type:"text",value:S});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,I.index+=we,we%2!==0&&(S+="\\")),r.unescape===!0?S=$():S+=$(),I.brackets===0){x({type:"text",value:S});continue}}if(I.brackets>0&&(S!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&S===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let ie=L.value.lastIndexOf("["),we=L.value.slice(0,ie),xe=L.value.slice(ie+2),qe=hhe[xe];if(qe){L.value=we+qe,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(S==="["&&F()!==":"||S==="-"&&F()==="]")&&(S=`\\${S}`),S==="]"&&(L.value==="["||L.value==="[^")&&(S=`\\${S}`),r.posix===!0&&S==="!"&&L.value==="["&&(S="^"),L.value+=S,G({value:S});continue}if(I.quotes===1&&S!=='"'){S=kr.escapeRegex(S),L.value+=S,G({value:S});continue}if(S==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:S});continue}if(S==="("){V("parens"),x({type:"paren",value:S});continue}if(S===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ou("opening","("));let z=j[j.length-1];if(z&&I.parens===z.parens+1){H(j.pop());continue}x({type:"paren",value:S,output:I.parens?")":"\\)"}),ae("parens");continue}if(S==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ou("closing","]"));S=`\\${S}`}else V("brackets");x({type:"bracket",value:S});continue}if(S==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:S,output:`\\${S}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ou("opening","["));x({type:"text",value:S,output:`\\${S}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(S=`/${S}`),L.value+=S,G({value:S}),r.literalBrackets===!1||kr.hasRegexChars(z))continue;let ie=kr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=ie,L.value=ie;continue}L.value=`(${a}${ie}|${L.value})`,I.output+=L.value;continue}if(S==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:S,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};U.push(z),x(z);continue}if(S==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:S,output:S});continue}let ie=")";if(z.dots===!0){let we=o.slice(),xe=[];for(let qe=we.length-1;qe>=0&&(o.pop(),we[qe].type!=="brace");qe--)we[qe].type!=="dots"&&xe.unshift(we[qe].value);ie=mhe(xe,r),I.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=I.output.slice(0,z.outputIndex),xe=I.tokens.slice(z.tokensIndex);z.value=z.output="\\{",S=ie="\\}",I.output=we;for(let qe of xe)I.output+=qe.output||qe.value}x({type:"brace",value:S,output:ie}),ae("braces"),U.pop();continue}if(S==="|"){j.length>0&&j[j.length-1].conditions++,x({type:"text",value:S});continue}if(S===","){let z=S,ie=U[U.length-1];ie&&K[K.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:S,output:z});continue}if(S==="/"){if(L.type==="dot"&&I.index===I.start+1){I.start=I.index+1,I.consumed="",I.output="",o.pop(),L=s;continue}x({type:"slash",value:S,output:f});continue}if(S==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=S,L.value+=S,z.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:S,output:h});continue}x({type:"dot",value:S,output:h});continue}if(S==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&F()==="("&&F(2)!=="?"){O("qmark",S);continue}if(L&&L.type==="paren"){let ie=F(),we=S;if(ie==="<"&&!kr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${S}`),x({type:"text",value:S,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:S,output:D});continue}x({type:"qmark",value:S,output:p});continue}if(S==="!"){if(r.noextglob!==!0&&F()==="("&&(F(2)!=="?"||!/[!=<:]/.test(F(3)))){O("negate",S);continue}if(r.nonegate!==!0&&I.index===0){q();continue}}if(S==="+"){if(r.noextglob!==!0&&F()==="("&&F(2)!=="?"){O("plus",S);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:S,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:S});continue}x({type:"plus",value:d});continue}if(S==="@"){if(r.noextglob!==!0&&F()==="("&&F(2)!=="?"){x({type:"at",extglob:!0,value:S,output:""});continue}x({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let z=dhe.exec(M());z&&(S+=z[0],I.index+=z[0].length),x({type:"text",value:S});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=S,L.output=R,I.backtrack=!0,I.globstar=!0,B(S);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",S);continue}if(L.type==="star"){if(r.noglobstar===!0){B(S);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",xe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:S,output:""});continue}let qe=I.braces>0&&(z.type==="comma"||z.type==="brace"),Et=j.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!qe&&!Et){x({type:"star",value:S,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),B("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=S,L.output=P(r),I.output=L.output,I.globstar=!0,B(S);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!xe&&T()){I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=P(r)+(r.strictSlashes?")":"|$)"),L.value+=S,I.globstar=!0,I.output+=z.output+L.output,B(S);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${P(r)}${f}|${f}${pr})`,L.value+=S,I.output+=z.output+L.output,I.globstar=!0,B(S+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=S,L.output=`(?:^|${f}|${P(r)}${f})`,I.output=L.output,I.globstar=!0,B(S+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=P(r),L.value+=S,I.output+=L.output,I.globstar=!0,B(S);continue}let ne={type:"star",value:S,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=b+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=S,x(ne);continue}(I.index===I.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(I.output+=C,L.output+=C):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),F()!=="*"&&(I.output+=m,L.output+=m)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing","]"));I.output=kr.escapeLast(I.output,"["),ae("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing",")"));I.output=kr.escapeLast(I.output,"("),ae("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing","}"));I.output=kr.escapeLast(I.output,"{"),ae("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),I.backtrack===!0){I.output="";for(let N of I.tokens)I.output+=N.output!=null?N.output:N.value,N.suffix&&(I.output+=N.suffix)}return I};Ov.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(am,r.maxLength):am,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=z6[t]||t;let s=kr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=om.globChars(s),y=r.dot?h:l,E=r.dot?d:l,C=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=b=>b.noglobstar===!0?p:`(${C}(?:(?!${m}${b.dot?c:o}).)*?)`,w=b=>{switch(b){case"*":return`${y}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${y}${p}${o}${u}${p}`;case"*/*":return`${y}${p}${a}${u}${E}${p}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${E}${u}${p}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${E}${p}${o}${u}${p}`;case"**/.*":return`(?:${y}${D(r)}${a})?${o}${u}${p}`;default:{let k=/^(.*?)\.(\w+)$/.exec(b);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},_=kr.removePrefix(t,A),P=w(_);return P&&r.strictSlashes!==!0&&(P+=`${a}?`),P};K6.exports=Ov});var X6=v((CCe,W6)=>{"use strict";var ghe=require("path"),yhe=V6(),xv=G6(),Tv=pl(),Dhe=dl(),whe=t=>t&&typeof t=="object"&&!Array.isArray(t),Ct=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ct(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=whe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=Tv.isWindows(e),o=n?Ct.compileRe(t,e):Ct.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ct(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=Ct.test(l,o,e,{glob:t,posix:s}),y={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(y),d===!1?(y.isMatch=!1,h?y:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(y),y.isMatch=!1,h?y:!1):(typeof i.onMatch=="function"&&i.onMatch(y),h?y:!0)};return r&&(c.state=a),c};Ct.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?Tv.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Ct.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ct.matchBase=(t,e,r,n=Tv.isWindows(r))=>(e instanceof RegExp?e:Ct.makeRe(e,r)).test(ghe.basename(t));Ct.isMatch=(t,e,r)=>Ct(e,r)(t);Ct.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ct.parse(r,e)):xv(t,{...e,fastpaths:!1});Ct.scan=(t,e)=>yhe(t,e);Ct.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=Ct.toRegex(a,e);return n===!0&&(u.state=t),u};Ct.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=xv.fastpaths(t,e)),i.output||(i=xv(t,e)),Ct.compileRe(i,e,r,n)};Ct.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/$^/}};Ct.constants=Dhe;W6.exports=Ct});var J6=v((SCe,Y6)=>{"use strict";Y6.exports=X6()});var nq=v((ACe,rq)=>{"use strict";var Q6=require("util"),eq=F6(),qn=J6(),Iv=pl(),Z6=t=>t===""||t==="./",tq=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},tt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=qn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};tt.match=tt;tt.matcher=(t,e)=>qn(t,e);tt.isMatch=(t,e,r)=>qn(e,r)(t);tt.any=tt.isMatch;tt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(tt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};tt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Q6.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>tt.contains(t,n,r));if(typeof e=="string"){if(Z6(t)||Z6(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return tt.isMatch(t,e,{...r,contains:!0})};tt.matchKeys=(t,e,r)=>{if(!Iv.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=tt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};tt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=qn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};tt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=qn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};tt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Q6.inspect(t)}"`);return[].concat(e).every(n=>qn(n,r)(t))};tt.capture=(t,e,r)=>{let n=Iv.isWindows(r),s=qn.makeRe(String(t),{...r,capture:!0}).exec(n?Iv.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};tt.makeRe=(...t)=>qn.makeRe(...t);tt.scan=(...t)=>qn.scan(...t);tt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of eq(String(n),e))r.push(qn.parse(i,e));return r};tt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!tq(t)?[t]:eq(t,e)};tt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return tt.braces(t,{...e,expand:!0})};tt.hasBraces=tq;rq.exports=tt});var lde={};fm(lde,{CapgoSDK:()=>rt,addApp:()=>ide,addChannel:()=>ode,addOrganization:()=>tde,checkBundleCompatibility:()=>Vhe,createSupabaseClient:()=>pe,decryptBundle:()=>Khe,deleteLegacyEncryptionKey:()=>Yhe,deleteOrganization:()=>nde,doctor:()=>Hhe,encryptBundle:()=>zhe,generateEncryptionKeys:()=>Whe,getAccountId:()=>Qhe,getCapacitorConfig:()=>cde,getCurrentBundle:()=>Jhe,getStats:()=>ude,listBundles:()=>sde,listOrganizations:()=>ede,login:()=>Uhe,requestBuild:()=>ade,saveEncryptionKey:()=>Xhe,updateAppSetting:()=>Zhe,updateOrganization:()=>rde,uploadBundle:()=>qhe,zipBundle:()=>Ghe});module.exports=ue(lde);var Ht=Oe(Je(),1),Do=require("node:process"),wi=Oe(require("node:readline"),1),ym=Oe(require("node:readline"),1),zv=require("node:stream"),Kv=Oe(pm(),1);function Kq({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 Gq=Kq();function Gv(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Gq,"")}function Wv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xv={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(Xv);var Wq=Xv.exports,Xq=Wv(Wq),Yq=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},Jq=Wv(Yq);function uu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Gv(t),t.length===0))return 0;t=t.replace(Jq()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Xq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var mm=10,jv=(t=0)=>e=>`\x1B[${e+t}m`,Bv=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Mv=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,nt={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(nt.modifier);var Zq=Object.keys(nt.color),Qq=Object.keys(nt.bgColor);[...Zq,...Qq];function eU(){let t=new Map;for(let[e,r]of Object.entries(nt)){for(let[n,i]of Object.entries(r))nt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=nt[n],t.set(i[0],i[1]);Object.defineProperty(nt,e,{value:r,enumerable:!1})}return Object.defineProperty(nt,"codes",{value:t,enumerable:!1}),nt.color.close="\x1B[39m",nt.bgColor.close="\x1B[49m",nt.color.ansi=jv(),nt.color.ansi256=Bv(),nt.color.ansi16m=Mv(),nt.bgColor.ansi=jv(mm),nt.bgColor.ansi256=Bv(mm),nt.bgColor.ansi16m=Mv(mm),Object.defineProperties(nt,{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(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>nt.rgbToAnsi256(...nt.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>nt.ansi256ToAnsi(nt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>nt.ansi256ToAnsi(nt.hexToAnsi256(e)),enumerable:!1}}),nt}var tU=eU(),Sl=new Set(["\x1B","\x9B"]),rU=39,wm="\x07",Yv="[",nU="]",Jv="m",Em=`${nU}8;;`,qv=t=>`${Sl.values().next().value}${Yv}${t}${Jv}`,Uv=t=>`${Sl.values().next().value}${Em}${t}${wm}`,iU=t=>t.split(" ").map(e=>uu(e)),gm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=uu(Gv(t[t.length-1]));for(let[a,u]of n.entries()){let c=uu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Sl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Em)),i){s?u===wm&&(i=!1,s=!1):u===Jv&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},sU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(uu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},oU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=iU(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=uu(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),gm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){gm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){gm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>sU(c)));let u=[...a.join(`
236
+ `}});function nle(){try{return Pb.default.statSync("/.dockerenv"),!0}catch{return!1}}function ile(){try{return Pb.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Rb(){return Fb===void 0&&(Fb=nle()||ile()),Fb}var Pb,Fb,aM=$r(()=>{Pb=Oe(require("node:fs"),1)});function za(){return kb===void 0&&(kb=sle()||Rb()),kb}var uM,kb,sle,Nb=$r(()=>{uM=Oe(require("node:fs"),1);aM();sle=()=>{try{return uM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var $b,lM,fM,cM,Qi,Lb=$r(()=>{$b=Oe(require("node:process"),1),lM=Oe(require("node:os"),1),fM=Oe(require("node:fs"),1);Nb();cM=()=>{if($b.default.platform!=="linux")return!1;if(lM.default.release().toLowerCase().includes("microsoft"))return!za();try{return fM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!za():!1}catch{return!1}},Qi=$b.default.env.__IS_WSL_TEST__?cM:cM()});var jb,tl,ole,ale,Bb,hM=$r(()=>{jb=Oe(require("node:process"),1),tl=Oe(require("node:fs/promises"),1);Lb();Lb();ole=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await tl.default.access(r,tl.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await tl.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),ale=async()=>`${await ole()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Bb=async()=>Qi?ale():`${jb.default.env.SYSTEMROOT||jb.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`});function es(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var dM=$r(()=>{});async function Mb(){if(mM.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await ule("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var pM,mM,gM,ule,yM=$r(()=>{pM=require("node:util"),mM=Oe(require("node:process"),1),gM=require("node:child_process"),ule=(0,pM.promisify)(gM.execFile)});async function EM(t,{humanReadableOutput:e=!0,signal:r}={}){if(DM.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await cle("osascript",["-e",t,n],i);return s.trim()}var DM,wM,qb,cle,bM=$r(()=>{DM=Oe(require("node:process"),1),wM=require("node:util"),qb=require("node:child_process"),cle=(0,wM.promisify)(qb.execFile)});async function Ub(t){return EM(`tell application "Finder" to set app_path to application file id "${t}" as string
237
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var vM=$r(()=>{bM()});async function Hb(t=lle){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 Tp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=fle[n];if(!i)throw new Tp(`Unknown browser ID: ${n}`);return i}var _M,CM,lle,fle,Tp,SM=$r(()=>{_M=require("node:util"),CM=require("node:child_process"),lle=(0,_M.promisify)(CM.execFile),fle={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},Tp=class extends Error{}});async function Vb(){if(Ip.default.platform==="darwin"){let t=await Mb();return{name:await Ub(t),id:t}}if(Ip.default.platform==="linux"){let{stdout:t}=await hle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:dle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Ip.default.platform==="win32")return Hb();throw new Error("Only macOS, Linux, and Windows are supported")}var AM,Ip,OM,hle,dle,xM=$r(()=>{AM=require("node:util"),Ip=Oe(require("node:process"),1),OM=require("node:child_process");yM();vM();SM();hle=(0,AM.promisify)(OM.execFile),dle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Yb={};fm(Yb,{apps:()=>ts,default:()=>Dle,openApp:()=>yle});async function mle(){let t=await Bb(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,r=Gb.Buffer.from(e,"utf16le").toString("base64"),{stdout:n}=await ple(t,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",r],{encoding:"utf8"}),i=n.trim(),s={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return s[i]?{id:s[i]}:{}}function PM(t){if(typeof t=="string"||Array.isArray(t))return t;let{[IM]:e}=t;if(!e)throw new Error(`${IM} is not supported`);return e}function Pp({[Ka]:t},{wsl:e}){if(e&&Qi)return PM(e);if(!t)throw new Error(`${Ka} is not supported`);return PM(t)}var Kb,Gb,Wb,RM,kM,Xb,Fp,wle,ple,zb,TM,Ka,IM,FM,rl,gle,yle,ts,Dle,Jb=$r(()=>{Kb=Oe(require("node:process"),1),Gb=require("node:buffer"),Wb=Oe(require("node:path"),1),RM=require("node:url"),kM=require("node:util"),Xb=Oe(require("node:child_process"),1),Fp=Oe(require("node:fs/promises"),1);hM();dM();xM();Nb();wle={},ple=(0,kM.promisify)(Xb.default.execFile),zb=Wb.default.dirname((0,RM.fileURLToPath)(wle.url)),TM=Wb.default.join(zb,"xdg-open"),{platform:Ka,arch:IM}=Kb.default;FM=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},rl=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return FM(t.app,a=>rl({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return FM(e,a=>rl({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=Qi?await mle():await Vb();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),rl({...t,app:{name:ts[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],s={};if(Ka==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Ka==="win32"||Qi&&!za()&&!e){n=await Bb(),i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Qi||(s.windowsVerbatimArguments=!0);let a=["Start"];t.wait&&a.push("-Wait"),e?(a.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&a.push(`"${t.target}"`),r.length>0&&(r=r.map(u=>`"\`"${u}\`""`),a.push("-ArgumentList",r.join(","))),t.target=Gb.Buffer.from(a.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!zb||zb==="/",u=!1;try{await Fp.default.access(TM,Fp.constants.X_OK),u=!0}catch{}n=Kb.default.versions.electron??(Ka==="android"||a||!u)?"xdg-open":TM}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}Ka==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let o=Xb.default.spawn(n,i,s);return t.wait?new Promise((a,u)=>{o.once("error",u),o.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(o)})}):(o.unref(),o)},gle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return rl({...e,target:t})},yle=(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 rl({...e,app:{name:t,arguments:r}})};ts={};es(ts,"chrome",()=>Pp({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));es(ts,"brave",()=>Pp({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"]}}));es(ts,"firefox",()=>Pp({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));es(ts,"edge",()=>Pp({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));es(ts,"browser",()=>"browser");es(ts,"browserPrivate",()=>"browserPrivate");Dle=gle});var tm=v(Qr=>{"use strict";Qr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Qr.find=(t,e)=>t.nodes.find(r=>r.type===e);Qr.exceedsLimit=(t,e,r=1,n)=>n===!1||!Qr.isInteger(t)||!Qr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Qr.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)};Qr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Qr.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;Qr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Qr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Qr.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var rm=v((fCe,J8)=>{"use strict";var Y8=tm();J8.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&Y8.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&Y8.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)a+=r(u);return a};return r(t)}});var Q8=v((hCe,Z8)=>{"use strict";Z8.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var u6=v((dCe,a6)=>{"use strict";var e6=Q8(),ho=(t,e,r)=>{if(e6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(e6(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 i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),u=t+":"+e+"="+i+s+o+a;if(ho.cache.hasOwnProperty(u))return ho.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let y=t+"|"+e;return n.capture?`(${y})`:n.wrap===!1?y:`(?:${y})`}let h=o6(t)||o6(e),d={min:t,max:e,a:c,b:l},f=[],m=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;m=t6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=t6(c,l,d,n)),d.negatives=m,d.positives=f,d.result=ofe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),ho.cache[u]=d,d.result};function ofe(t,e,r){let n=mv(t,e,"-",!1,r)||[],i=mv(e,t,"",!1,r)||[],s=mv(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function afe(t,e){let r=1,n=1,i=n6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=n6(t,r);for(i=i6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=i6(e+1,n)-1;return s=[...s],s.sort(lfe),s}function ufe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=cfe(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[u,c]=n[a];u===c?s+=u:u!=="0"||c!=="9"?s+=ffe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function t6(t,e,r,n){let i=afe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=ufe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+s6(a.count),o=c+1;continue}r.isPadded&&(h=hfe(c,r,n)),l.string=h+l.pattern+s6(l.count),s.push(l),o=c+1,a=l}return s}function mv(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!r6(e,"string",a)&&s.push(r+a),n&&r6(e,"string",a)&&s.push(r+a)}return s}function cfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function lfe(t,e){return t>e?1:e>t?-1:0}function r6(t,e,r){return t.some(n=>n[e]===r)}function n6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function i6(t,e){return t-t%Math.pow(10,e)}function s6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function ffe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function o6(t){return/^-?(0+)\d/.test(t)}function hfe(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}ho.cache={};ho.clearCache=()=>ho.cache={};a6.exports=ho});var Dv=v((pCe,m6)=>{"use strict";var dfe=require("util"),l6=u6(),c6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),pfe=t=>e=>t===!0?Number(e):String(e),gv=t=>typeof t=="number"||typeof t=="string"&&t!=="",hl=t=>Number.isInteger(+t),yv=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},mfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,gfe=(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},im=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},yfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>im(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>im(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},f6=(t,e,r,n)=>{if(r)return l6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},h6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return l6(t,e,r)},d6=(...t)=>new RangeError("Invalid range arguments: "+dfe.inspect(...t)),p6=(t,e,r)=>{if(r.strictRanges===!0)throw d6([t,e]);return[]},Dfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},wfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw d6([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=yv(a)||yv(u)||yv(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&mfe(t,e,n)===!1,f=n.transform||pfe(d);if(n.toRegex&&r===1)return f6(im(t,h),im(e,h),!0,n);let m={negatives:[],positives:[]},y=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),E=[],S=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):E.push(gfe(f(i,S),h,d)),i=o?i-r:i+r,S++;return n.toRegex===!0?r>1?yfe(m,n,h):h6(E,null,{wrap:!1,...n}):E},Efe=(t,e,r=1,n={})=>{if(!hl(t)&&t.length>1||!hl(e)&&e.length>1)return p6(t,e,n);let i=n.transform||(d=>String.fromCharCode(d)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,u=Math.min(s,o),c=Math.max(s,o);if(n.toRegex&&r===1)return f6(u,c,!1,n);let l=[],h=0;for(;a?s>=o:s<=o;)l.push(i(s,h)),s=a?s-r:s+r,h++;return n.toRegex===!0?h6(l,null,{wrap:!1,options:n}):l},nm=(t,e,r,n={})=>{if(e==null&&gv(t))return[t];if(!gv(t)||!gv(e))return p6(t,e,n);if(typeof r=="function")return nm(t,e,1,{transform:r});if(c6(r))return nm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,hl(r)?hl(t)&&hl(e)?wfe(t,e,r,i):Efe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!c6(r)?Dfe(r,i):nm(t,e,1,r)};m6.exports=nm});var D6=v((mCe,y6)=>{"use strict";var bfe=Dv(),g6=tm(),vfe=(t,e={})=>{let r=(n,i={})=>{let s=g6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!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 a?u+n.value:"(";if(n.type==="close")return a?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=g6.reduce(n.nodes),h=bfe(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(h.length!==0)return l.length>1&&h.length>1?`(${h})`:h}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};y6.exports=vfe});var b6=v((gCe,E6)=>{"use strict";var _fe=Dv(),w6=rm(),su=tm(),po=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?su.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(po(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?po(i,s,r):i+s);return su.flatten(n)},Cfe=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(po(a.pop(),w6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(po(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=su.reduce(i.nodes);if(su.exceedsLimit(...h,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=_fe(...h,e);d.length===0&&(d=w6(i,e)),a.push(po(a.pop(),d)),i.nodes=[];return}let u=su.encloseBrace(i),c=i.queue,l=i;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let h=0;h<i.nodes.length;h++){let d=i.nodes[h];if(d.type==="comma"&&i.type==="brace"){h===1&&c.push(""),c.push("");continue}if(d.type==="close"){a.push(po(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(po(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return su.flatten(n(t))};E6.exports=Cfe});var _6=v((yCe,v6)=>{"use strict";v6.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:`
238
+ `,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 x6=v((DCe,O6)=>{"use strict";var Sfe=rm(),{MAX_LENGTH:C6,CHAR_BACKSLASH:wv,CHAR_BACKTICK:Afe,CHAR_COMMA:Ofe,CHAR_DOT:xfe,CHAR_LEFT_PARENTHESES:Tfe,CHAR_RIGHT_PARENTHESES:Ife,CHAR_LEFT_CURLY_BRACE:Ffe,CHAR_RIGHT_CURLY_BRACE:Pfe,CHAR_LEFT_SQUARE_BRACKET:S6,CHAR_RIGHT_SQUARE_BRACKET:A6,CHAR_DOUBLE_QUOTE:Rfe,CHAR_SINGLE_QUOTE:kfe,CHAR_NO_BREAK_SPACE:Nfe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:$fe}=_6(),Lfe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(C6,r.maxLength):C6;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,u=0,c=t.length,l=0,h=0,d,f=()=>t[l++],m=y=>{if(y.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&y.type==="text"){a.value+=y.value;return}return o.nodes.push(y),y.parent=o,y.prev=a,a=y,y};for(m({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===$fe||d===Nfe)){if(d===wv){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===A6){m({type:"text",value:"\\"+d});continue}if(d===S6){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===S6){u++;continue}if(y===wv){d+=f();continue}if(y===A6&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===Tfe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===Ife){if(o.type!=="paren"){m({type:"text",value:d});continue}o=s.pop(),m({type:"text",value:d}),o=s[s.length-1];continue}if(d===Rfe||d===kfe||d===Afe){let y=d,E;for(e.keepQuotes!==!0&&(d="");l<c&&(E=f());){if(E===wv){d+=E+f();continue}if(E===y){e.keepQuotes===!0&&(d+=E);break}d+=E}m({type:"text",value:d});continue}if(d===Ffe){h++;let E={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=m(E),s.push(o),m({type:"open",value:d});continue}if(d===Pfe){if(o.type!=="brace"){m({type:"text",value:d});continue}let y="close";o=s.pop(),o.close=!0,m({type:y,value:d}),h--,o=s[s.length-1];continue}if(d===Ofe&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:Sfe(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===xfe&&h>0&&o.commas===0){let y=o.nodes;if(h===0||y.length===0){m({type:"text",value:d});continue}if(a.type==="dot"){if(o.range=[],a.value+=d,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){y.pop();let E=y[y.length-1];E.value+=a.value+d,a=E,o.ranges--;continue}m({type:"dot",value:d});continue}m({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(S=>{S.nodes||(S.type==="open"&&(S.isOpen=!0),S.type==="close"&&(S.isClose=!0),S.nodes||(S.type="text"),S.invalid=!0)});let y=s[s.length-1],E=y.nodes.indexOf(o);y.nodes.splice(E,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};O6.exports=Lfe});var F6=v((wCe,I6)=>{"use strict";var T6=rm(),jfe=D6(),Bfe=b6(),Mfe=x6(),kr=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=kr.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(kr.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};kr.parse=(t,e={})=>Mfe(t,e);kr.stringify=(t,e={})=>T6(typeof t=="string"?kr.parse(t,e):t,e);kr.compile=(t,e={})=>(typeof t=="string"&&(t=kr.parse(t,e)),jfe(t,e));kr.expand=(t,e={})=>{typeof t=="string"&&(t=kr.parse(t,e));let r=Bfe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};kr.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?kr.compile(t,e):kr.expand(t,e);I6.exports=kr});var dl=v((ECe,$6)=>{"use strict";var qfe=require("path"),Mn="\\\\/",P6=`[^${Mn}]`,Di="\\.",Ufe="\\+",Hfe="\\?",sm="\\/",Vfe="(?=.)",R6="[^/]",Ev=`(?:${sm}|$)`,k6=`(?:^|${sm})`,bv=`${Di}{1,2}${Ev}`,zfe=`(?!${Di})`,Kfe=`(?!${k6}${bv})`,Gfe=`(?!${Di}{0,1}${Ev})`,Wfe=`(?!${bv})`,Xfe=`[^.${sm}]`,Yfe=`${R6}*?`,N6={DOT_LITERAL:Di,PLUS_LITERAL:Ufe,QMARK_LITERAL:Hfe,SLASH_LITERAL:sm,ONE_CHAR:Vfe,QMARK:R6,END_ANCHOR:Ev,DOTS_SLASH:bv,NO_DOT:zfe,NO_DOTS:Kfe,NO_DOT_SLASH:Gfe,NO_DOTS_SLASH:Wfe,QMARK_NO_DOT:Xfe,STAR:Yfe,START_ANCHOR:k6},Jfe={...N6,SLASH_LITERAL:`[${Mn}]`,QMARK:P6,STAR:`${P6}*?`,DOTS_SLASH:`${Di}{1,2}(?:[${Mn}]|$)`,NO_DOT:`(?!${Di})`,NO_DOTS:`(?!(?:^|[${Mn}])${Di}{1,2}(?:[${Mn}]|$))`,NO_DOT_SLASH:`(?!${Di}{0,1}(?:[${Mn}]|$))`,NO_DOTS_SLASH:`(?!${Di}{1,2}(?:[${Mn}]|$))`,QMARK_NO_DOT:`[^.${Mn}]`,START_ANCHOR:`(?:^|[${Mn}])`,END_ANCHOR:`(?:[${Mn}]|$)`},Zfe={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"};$6.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Zfe,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:qfe.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?Jfe:N6}}});var pl=v(xr=>{"use strict";var Qfe=require("path"),ehe=process.platform==="win32",{REGEX_BACKSLASH:the,REGEX_REMOVE_BACKSLASH:rhe,REGEX_SPECIAL_CHARS:nhe,REGEX_SPECIAL_CHARS_GLOBAL:ihe}=dl();xr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);xr.hasRegexChars=t=>nhe.test(t);xr.isRegexChar=t=>t.length===1&&xr.hasRegexChars(t);xr.escapeRegex=t=>t.replace(ihe,"\\$1");xr.toPosixSlashes=t=>t.replace(the,"/");xr.removeBackslashes=t=>t.replace(rhe,e=>e==="\\"?"":e);xr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};xr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:ehe===!0||Qfe.sep==="\\";xr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?xr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};xr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};xr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var V6=v((vCe,H6)=>{"use strict";var L6=pl(),{CHAR_ASTERISK:vv,CHAR_AT:she,CHAR_BACKWARD_SLASH:ml,CHAR_COMMA:ohe,CHAR_DOT:_v,CHAR_EXCLAMATION_MARK:Cv,CHAR_FORWARD_SLASH:U6,CHAR_LEFT_CURLY_BRACE:Sv,CHAR_LEFT_PARENTHESES:Av,CHAR_LEFT_SQUARE_BRACKET:ahe,CHAR_PLUS:uhe,CHAR_QUESTION_MARK:j6,CHAR_RIGHT_CURLY_BRACE:che,CHAR_RIGHT_PARENTHESES:B6,CHAR_RIGHT_SQUARE_BRACKET:lhe}=dl(),M6=t=>t===U6||t===ml,q6=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},fhe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],u=t,c=-1,l=0,h=0,d=!1,f=!1,m=!1,y=!1,E=!1,S=!1,A=!1,p=!1,D=!1,w=!1,_=0,P,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),j=()=>(P=b,u.charCodeAt(++c));for(;c<n;){b=j();let T;if(b===ml){A=k.backslashes=!0,b=j(),b===Sv&&(S=!0);continue}if(S===!0||b===Sv){for(_++;R()!==!0&&(b=j());){if(b===ml){A=k.backslashes=!0,j();continue}if(b===Sv){_++;continue}if(S!==!0&&b===_v&&(b=j())===_v){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(S!==!0&&b===ohe){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===che&&(_--,_===0)){S=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===U6){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(P===_v&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===uhe||b===she||b===vv||b===j6||b===Cv)===!0&&I()===Av){if(m=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===Cv&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=j());){if(b===ml){A=k.backslashes=!0,b=j();continue}if(b===B6){m=k.isGlob=!0,w=!0;break}}continue}break}if(b===vv){if(P===vv&&(E=k.isGlobstar=!0),m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===j6){if(m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===ahe){for(;R()!==!0&&(T=j());){if(T===ml){A=k.backslashes=!0,j();continue}if(T===lhe){f=k.isBracket=!0,m=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===Cv&&c===l){p=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Av){if(m=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=j());){if(b===Av){A=k.backslashes=!0,b=j();continue}if(b===B6){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let U=u,K="",L="";l>0&&(K=u.slice(0,l),u=u.slice(l),h-=l),U&&m===!0&&h>0?(U=u.slice(0,h),L=u.slice(h)):m===!0?(U="",L=u):U=u,U&&U!==""&&U!=="/"&&U!==u&&M6(U.charCodeAt(U.length-1))&&(U=U.slice(0,-1)),r.unescape===!0&&(L&&(L=L6.removeBackslashes(L)),U&&A===!0&&(U=L6.removeBackslashes(U)));let C={prefix:K,input:t,start:l,base:U,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:y,isGlobstar:E,negated:p,negatedExtglob:D};if(r.tokens===!0&&(C.maxDepth=0,M6(b)||o.push(k),C.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let F=0;F<s.length;F++){let $=T?T+1:l,M=s[F],B=t.slice($,M);r.tokens&&(F===0&&l!==0?(o[F].isPrefix=!0,o[F].value=K):o[F].value=B,q6(o[F]),C.maxDepth+=o[F].depth),(F!==0||B!=="")&&a.push(B),T=M}if(T&&T+1<t.length){let F=t.slice(T+1);a.push(F),r.tokens&&(o[o.length-1].value=F,q6(o[o.length-1]),C.maxDepth+=o[o.length-1].depth)}C.slashes=s,C.parts=a}return C};H6.exports=fhe});var G6=v((_Ce,K6)=>{"use strict";var om=dl(),Nr=pl(),{MAX_LENGTH:am,POSIX_REGEX_SOURCE:hhe,REGEX_NON_SPECIAL_CHARS:dhe,REGEX_SPECIAL_CHARS_BACKREF:phe,REPLACEMENTS:z6}=om,mhe=(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(i=>Nr.escapeRegex(i)).join("..")}return r},ou=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Ov=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=z6[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(am,r.maxLength):am,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",u=Nr.isWindows(e),c=om.globChars(u),l=om.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:E,NO_DOT_SLASH:S,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:_}=c,P=N=>`(${a}(?:(?!${_}${N.dot?y:h}).)*?)`,b=r.dot?"":E,k=r.dot?p:D,R=r.bash===!0?P(r):w;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let I={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:o};t=Nr.removePrefix(t,I),i=t.length;let j=[],U=[],K=[],L=s,C,T=()=>I.index===i-1,F=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",M=()=>t.slice(I.index+1),B=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,B(N.value)},q=()=>{let N=1;for(;F()==="!"&&(F(2)!=="("||F(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},V=N=>{I[N]++,K.push(N)},ae=N=>{I[N]--,K.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||j.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(j.length&&N.type!=="paren"&&(j[j.length-1].inner+=N.value),(N.value||N.output)&&G(N),L&&L.type==="text"&&N.type==="text"){L.value+=N.value,L.output=(L.output||"")+N.value;return}N.prev=L,o.push(N),L=N},O=(N,ne)=>{let z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=I.parens,z.output=I.output;let ie=(r.capture?"(":"")+z.open;V("parens"),x({type:N,value:ne,output:I.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:ie}),j.push(z)},H=N=>{let ne=N.close+(r.capture?")":""),z;if(N.type==="negate"){let ie=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(ie=P(r)),(ie!==R||T()||/^\)+$/.test(M()))&&(ne=N.close=`)$))${ie}`),N.inner.includes("*")&&(z=M())&&/^\.[^\\/.]+$/.test(z)){let we=Ov(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${ie})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:C,output:ne}),ae("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(phe,(z,ie,we,xe,qe,Et)=>xe==="\\"?(N=!0,z):xe==="?"?ie?ie+xe+(qe?p.repeat(qe.length):""):Et===0?k+(qe?p.repeat(qe.length):""):p.repeat(we.length):xe==="."?h.repeat(we.length):xe==="*"?ie?ie+xe+(qe?R:""):R:ie?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=Nr.wrapOutput(ne,I,e),I)}for(;!T();){if(C=$(),C==="\0")continue;if(C==="\\"){let z=F();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){C+="\\",x({type:"text",value:C});continue}let ie=/^\\+/.exec(M()),we=0;if(ie&&ie[0].length>2&&(we=ie[0].length,I.index+=we,we%2!==0&&(C+="\\")),r.unescape===!0?C=$():C+=$(),I.brackets===0){x({type:"text",value:C});continue}}if(I.brackets>0&&(C!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&C===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let ie=L.value.lastIndexOf("["),we=L.value.slice(0,ie),xe=L.value.slice(ie+2),qe=hhe[xe];if(qe){L.value=we+qe,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(C==="["&&F()!==":"||C==="-"&&F()==="]")&&(C=`\\${C}`),C==="]"&&(L.value==="["||L.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&L.value==="["&&(C="^"),L.value+=C,G({value:C});continue}if(I.quotes===1&&C!=='"'){C=Nr.escapeRegex(C),L.value+=C,G({value:C});continue}if(C==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:C});continue}if(C==="("){V("parens"),x({type:"paren",value:C});continue}if(C===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ou("opening","("));let z=j[j.length-1];if(z&&I.parens===z.parens+1){H(j.pop());continue}x({type:"paren",value:C,output:I.parens?")":"\\)"}),ae("parens");continue}if(C==="["){if(r.nobracket===!0||!M().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ou("closing","]"));C=`\\${C}`}else V("brackets");x({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:C,output:`\\${C}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ou("opening","["));x({type:"text",value:C,output:`\\${C}`});continue}ae("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(C=`/${C}`),L.value+=C,G({value:C}),r.literalBrackets===!1||Nr.hasRegexChars(z))continue;let ie=Nr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=ie,L.value=ie;continue}L.value=`(${a}${ie}|${L.value})`,I.output+=L.value;continue}if(C==="{"&&r.nobrace!==!0){V("braces");let z={type:"brace",value:C,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};U.push(z),x(z);continue}if(C==="}"){let z=U[U.length-1];if(r.nobrace===!0||!z){x({type:"text",value:C,output:C});continue}let ie=")";if(z.dots===!0){let we=o.slice(),xe=[];for(let qe=we.length-1;qe>=0&&(o.pop(),we[qe].type!=="brace");qe--)we[qe].type!=="dots"&&xe.unshift(we[qe].value);ie=mhe(xe,r),I.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=I.output.slice(0,z.outputIndex),xe=I.tokens.slice(z.tokensIndex);z.value=z.output="\\{",C=ie="\\}",I.output=we;for(let qe of xe)I.output+=qe.output||qe.value}x({type:"brace",value:C,output:ie}),ae("braces"),U.pop();continue}if(C==="|"){j.length>0&&j[j.length-1].conditions++,x({type:"text",value:C});continue}if(C===","){let z=C,ie=U[U.length-1];ie&&K[K.length-1]==="braces"&&(ie.comma=!0,z="|"),x({type:"comma",value:C,output:z});continue}if(C==="/"){if(L.type==="dot"&&I.index===I.start+1){I.start=I.index+1,I.consumed="",I.output="",o.pop(),L=s;continue}x({type:"slash",value:C,output:f});continue}if(C==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=U[U.length-1];L.type="dots",L.output+=C,L.value+=C,z.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:C,output:h});continue}x({type:"dot",value:C,output:h});continue}if(C==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&F()==="("&&F(2)!=="?"){O("qmark",C);continue}if(L&&L.type==="paren"){let ie=F(),we=C;if(ie==="<"&&!Nr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(ie)||ie==="<"&&!/<([!=]|\w+>)/.test(M()))&&(we=`\\${C}`),x({type:"text",value:C,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:C,output:D});continue}x({type:"qmark",value:C,output:p});continue}if(C==="!"){if(r.noextglob!==!0&&F()==="("&&(F(2)!=="?"||!/[!=<:]/.test(F(3)))){O("negate",C);continue}if(r.nonegate!==!0&&I.index===0){q();continue}}if(C==="+"){if(r.noextglob!==!0&&F()==="("&&F(2)!=="?"){O("plus",C);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:C,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:C});continue}x({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&F()==="("&&F(2)!=="?"){x({type:"at",extglob:!0,value:C,output:""});continue}x({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let z=dhe.exec(M());z&&(C+=z[0],I.index+=z[0].length),x({type:"text",value:C});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=C,L.output=R,I.backtrack=!0,I.globstar=!0,B(C);continue}let N=M();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",C);continue}if(L.type==="star"){if(r.noglobstar===!0){B(C);continue}let z=L.prev,ie=z.prev,we=z.type==="slash"||z.type==="bos",xe=ie&&(ie.type==="star"||ie.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:C,output:""});continue}let qe=I.braces>0&&(z.type==="comma"||z.type==="brace"),Et=j.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!qe&&!Et){x({type:"star",value:C,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),B("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=C,L.output=P(r),I.output=L.output,I.globstar=!0,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!xe&&T()){I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=P(r)+(r.strictSlashes?")":"|$)"),L.value+=C,I.globstar=!0,I.output+=z.output+L.output,B(C);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${P(r)}${f}|${f}${pr})`,L.value+=C,I.output+=z.output+L.output,I.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=C,L.output=`(?:^|${f}|${P(r)}${f})`,I.output=L.output,I.globstar=!0,B(C+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=P(r),L.value+=C,I.output+=L.output,I.globstar=!0,B(C);continue}let ne={type:"star",value:C,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=b+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=C,x(ne);continue}(I.index===I.start||L.type==="slash"||L.type==="dot")&&(L.type==="dot"?(I.output+=S,L.output+=S):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),F()!=="*"&&(I.output+=m,L.output+=m)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing","]"));I.output=Nr.escapeLast(I.output,"["),ae("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing",")"));I.output=Nr.escapeLast(I.output,"("),ae("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ou("closing","}"));I.output=Nr.escapeLast(I.output,"{"),ae("braces")}if(r.strictSlashes!==!0&&(L.type==="star"||L.type==="bracket")&&x({type:"maybe_slash",value:"",output:`${f}?`}),I.backtrack===!0){I.output="";for(let N of I.tokens)I.output+=N.output!=null?N.output:N.value,N.suffix&&(I.output+=N.suffix)}return I};Ov.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(am,r.maxLength):am,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=z6[t]||t;let s=Nr.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:h,NO_DOTS_SLASH:d,STAR:f,START_ANCHOR:m}=om.globChars(s),y=r.dot?h:l,E=r.dot?d:l,S=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=b=>b.noglobstar===!0?p:`(${S}(?:(?!${m}${b.dot?c:o}).)*?)`,w=b=>{switch(b){case"*":return`${y}${u}${p}`;case".*":return`${o}${u}${p}`;case"*.*":return`${y}${p}${o}${u}${p}`;case"*/*":return`${y}${p}${a}${u}${E}${p}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${E}${u}${p}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${E}${p}${o}${u}${p}`;case"**/.*":return`(?:${y}${D(r)}${a})?${o}${u}${p}`;default:{let k=/^(.*?)\.(\w+)$/.exec(b);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},_=Nr.removePrefix(t,A),P=w(_);return P&&r.strictSlashes!==!0&&(P+=`${a}?`),P};K6.exports=Ov});var X6=v((CCe,W6)=>{"use strict";var ghe=require("path"),yhe=V6(),xv=G6(),Tv=pl(),Dhe=dl(),whe=t=>t&&typeof t=="object"&&!Array.isArray(t),Ct=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ct(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=whe(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=Tv.isWindows(e),o=n?Ct.compileRe(t,e):Ct.makeRe(t,e,!1,!0),a=o.state;delete o.state;let u=()=>!1;if(i.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=Ct(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=Ct.test(l,o,e,{glob:t,posix:s}),y={glob:t,state:a,regex:o,posix:s,input:l,output:m,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(y),d===!1?(y.isMatch=!1,h?y:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(y),y.isMatch=!1,h?y:!1):(typeof i.onMatch=="function"&&i.onMatch(y),h?y:!0)};return r&&(c.state=a),c};Ct.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?Tv.toPosixSlashes:null),a=t===n,u=a&&o?o(t):t;return a===!1&&(u=o?o(t):t,a=u===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Ct.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ct.matchBase=(t,e,r,n=Tv.isWindows(r))=>(e instanceof RegExp?e:Ct.makeRe(e,r)).test(ghe.basename(t));Ct.isMatch=(t,e,r)=>Ct(e,r)(t);Ct.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ct.parse(r,e)):xv(t,{...e,fastpaths:!1});Ct.scan=(t,e)=>yhe(t,e);Ct.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let u=Ct.toRegex(a,e);return n===!0&&(u.state=t),u};Ct.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=xv.fastpaths(t,e)),i.output||(i=xv(t,e)),Ct.compileRe(i,e,r,n)};Ct.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/$^/}};Ct.constants=Dhe;W6.exports=Ct});var J6=v((SCe,Y6)=>{"use strict";Y6.exports=X6()});var nq=v((ACe,rq)=>{"use strict";var Q6=require("util"),eq=F6(),qn=J6(),Iv=pl(),Z6=t=>t===""||t==="./",tq=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},tt=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=l=>{s.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let h=qn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let m=h(f,!0);(d?!m.isMatch:m.isMatch)&&(d?n.add(m.output):(n.delete(m.output),i.add(m.output)))}}let c=(o===e.length?[...s]:[...i]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};tt.match=tt;tt.matcher=(t,e)=>qn(t,e);tt.isMatch=(t,e,r)=>qn(e,r)(t);tt.any=tt.isMatch;tt.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(tt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};tt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Q6.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>tt.contains(t,n,r));if(typeof e=="string"){if(Z6(t)||Z6(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return tt.isMatch(t,e,{...r,contains:!0})};tt.matchKeys=(t,e,r)=>{if(!Iv.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=tt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};tt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=qn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};tt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=qn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};tt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Q6.inspect(t)}"`);return[].concat(e).every(n=>qn(n,r)(t))};tt.capture=(t,e,r)=>{let n=Iv.isWindows(r),s=qn.makeRe(String(t),{...r,capture:!0}).exec(n?Iv.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};tt.makeRe=(...t)=>qn.makeRe(...t);tt.scan=(...t)=>qn.scan(...t);tt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of eq(String(n),e))r.push(qn.parse(i,e));return r};tt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!tq(t)?[t]:eq(t,e)};tt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return tt.braces(t,{...e,expand:!0})};tt.hasBraces=tq;rq.exports=tt});var lde={};fm(lde,{CapgoSDK:()=>rt,addApp:()=>ide,addChannel:()=>ode,addOrganization:()=>tde,checkBundleCompatibility:()=>Vhe,createSupabaseClient:()=>pe,decryptBundle:()=>Khe,deleteLegacyEncryptionKey:()=>Yhe,deleteOrganization:()=>nde,doctor:()=>Hhe,encryptBundle:()=>zhe,generateEncryptionKeys:()=>Whe,getAccountId:()=>Qhe,getCapacitorConfig:()=>cde,getCurrentBundle:()=>Jhe,getStats:()=>ude,listBundles:()=>sde,listOrganizations:()=>ede,login:()=>Uhe,requestBuild:()=>ade,saveEncryptionKey:()=>Xhe,updateAppSetting:()=>Zhe,updateOrganization:()=>rde,uploadBundle:()=>qhe,zipBundle:()=>Ghe});module.exports=ue(lde);var Ht=Oe(Je(),1),Do=require("node:process"),wi=Oe(require("node:readline"),1),ym=Oe(require("node:readline"),1),zv=require("node:stream"),Kv=Oe(pm(),1);function Kq({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 Gq=Kq();function Gv(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Gq,"")}function Wv(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xv={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),s=n.length==2?n.charCodeAt(1):0,o=i;return 55296<=i&&i<=56319&&56320<=s&&s<=57343&&(i&=1023,s&=1023,o=i<<10|s,o+=65536),o==12288||65281<=o&&o<=65376||65504<=o&&o<=65510?"F":o==8361||65377<=o&&o<=65470||65474<=o&&o<=65479||65482<=o&&o<=65487||65490<=o&&o<=65495||65498<=o&&o<=65500||65512<=o&&o<=65518?"H":4352<=o&&o<=4447||4515<=o&&o<=4519||4602<=o&&o<=4607||9001<=o&&o<=9002||11904<=o&&o<=11929||11931<=o&&o<=12019||12032<=o&&o<=12245||12272<=o&&o<=12283||12289<=o&&o<=12350||12353<=o&&o<=12438||12441<=o&&o<=12543||12549<=o&&o<=12589||12593<=o&&o<=12686||12688<=o&&o<=12730||12736<=o&&o<=12771||12784<=o&&o<=12830||12832<=o&&o<=12871||12880<=o&&o<=13054||13056<=o&&o<=19903||19968<=o&&o<=42124||42128<=o&&o<=42182||43360<=o&&o<=43388||44032<=o&&o<=55203||55216<=o&&o<=55238||55243<=o&&o<=55291||63744<=o&&o<=64255||65040<=o&&o<=65049||65072<=o&&o<=65106||65108<=o&&o<=65126||65128<=o&&o<=65131||110592<=o&&o<=110593||127488<=o&&o<=127490||127504<=o&&o<=127546||127552<=o&&o<=127560||127568<=o&&o<=127569||131072<=o&&o<=194367||177984<=o&&o<=196605||196608<=o&&o<=262141?"W":32<=o&&o<=126||162<=o&&o<=163||165<=o&&o<=166||o==172||o==175||10214<=o&&o<=10221||10629<=o&&o<=10630?"Na":o==161||o==164||167<=o&&o<=168||o==170||173<=o&&o<=174||176<=o&&o<=180||182<=o&&o<=186||188<=o&&o<=191||o==198||o==208||215<=o&&o<=216||222<=o&&o<=225||o==230||232<=o&&o<=234||236<=o&&o<=237||o==240||242<=o&&o<=243||247<=o&&o<=250||o==252||o==254||o==257||o==273||o==275||o==283||294<=o&&o<=295||o==299||305<=o&&o<=307||o==312||319<=o&&o<=322||o==324||328<=o&&o<=331||o==333||338<=o&&o<=339||358<=o&&o<=359||o==363||o==462||o==464||o==466||o==468||o==470||o==472||o==474||o==476||o==593||o==609||o==708||o==711||713<=o&&o<=715||o==717||o==720||728<=o&&o<=731||o==733||o==735||768<=o&&o<=879||913<=o&&o<=929||931<=o&&o<=937||945<=o&&o<=961||963<=o&&o<=969||o==1025||1040<=o&&o<=1103||o==1105||o==8208||8211<=o&&o<=8214||8216<=o&&o<=8217||8220<=o&&o<=8221||8224<=o&&o<=8226||8228<=o&&o<=8231||o==8240||8242<=o&&o<=8243||o==8245||o==8251||o==8254||o==8308||o==8319||8321<=o&&o<=8324||o==8364||o==8451||o==8453||o==8457||o==8467||o==8470||8481<=o&&o<=8482||o==8486||o==8491||8531<=o&&o<=8532||8539<=o&&o<=8542||8544<=o&&o<=8555||8560<=o&&o<=8569||o==8585||8592<=o&&o<=8601||8632<=o&&o<=8633||o==8658||o==8660||o==8679||o==8704||8706<=o&&o<=8707||8711<=o&&o<=8712||o==8715||o==8719||o==8721||o==8725||o==8730||8733<=o&&o<=8736||o==8739||o==8741||8743<=o&&o<=8748||o==8750||8756<=o&&o<=8759||8764<=o&&o<=8765||o==8776||o==8780||o==8786||8800<=o&&o<=8801||8804<=o&&o<=8807||8810<=o&&o<=8811||8814<=o&&o<=8815||8834<=o&&o<=8835||8838<=o&&o<=8839||o==8853||o==8857||o==8869||o==8895||o==8978||9312<=o&&o<=9449||9451<=o&&o<=9547||9552<=o&&o<=9587||9600<=o&&o<=9615||9618<=o&&o<=9621||9632<=o&&o<=9633||9635<=o&&o<=9641||9650<=o&&o<=9651||9654<=o&&o<=9655||9660<=o&&o<=9661||9664<=o&&o<=9665||9670<=o&&o<=9672||o==9675||9678<=o&&o<=9681||9698<=o&&o<=9701||o==9711||9733<=o&&o<=9734||o==9737||9742<=o&&o<=9743||9748<=o&&o<=9749||o==9756||o==9758||o==9792||o==9794||9824<=o&&o<=9825||9827<=o&&o<=9829||9831<=o&&o<=9834||9836<=o&&o<=9837||o==9839||9886<=o&&o<=9887||9918<=o&&o<=9919||9924<=o&&o<=9933||9935<=o&&o<=9953||o==9955||9960<=o&&o<=9983||o==10045||o==10071||10102<=o&&o<=10111||11093<=o&&o<=11097||12872<=o&&o<=12879||57344<=o&&o<=63743||65024<=o&&o<=65039||o==65533||127232<=o&&o<=127242||127248<=o&&o<=127277||127280<=o&&o<=127337||127344<=o&&o<=127386||917760<=o&&o<=917999||983040<=o&&o<=1048573||1048576<=o&&o<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),s=0,o=0;o<i.length;o++)s=s+this.characterLength(i[o]);return s},e.slice=function(n,i,s){textLen=e.length(n),i=i||0,s=s||1,i<0&&(i=textLen+i),s<0&&(s=textLen+s);for(var o="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],h=e.length(l);if(a>=i-(h==2?1:0))if(a+h<=s)o+=l;else break;a+=h}return o}})(Xv);var Wq=Xv.exports,Xq=Wv(Wq),Yq=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},Jq=Wv(Yq);function uu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=Gv(t),t.length===0))return 0;t=t.replace(Jq()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let s=i.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(Xq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var mm=10,jv=(t=0)=>e=>`\x1B[${e+t}m`,Bv=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Mv=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,nt={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(nt.modifier);var Zq=Object.keys(nt.color),Qq=Object.keys(nt.bgColor);[...Zq,...Qq];function eU(){let t=new Map;for(let[e,r]of Object.entries(nt)){for(let[n,i]of Object.entries(r))nt[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=nt[n],t.set(i[0],i[1]);Object.defineProperty(nt,e,{value:r,enumerable:!1})}return Object.defineProperty(nt,"codes",{value:t,enumerable:!1}),nt.color.close="\x1B[39m",nt.bgColor.close="\x1B[49m",nt.color.ansi=jv(),nt.color.ansi256=Bv(),nt.color.ansi16m=Mv(),nt.bgColor.ansi=jv(mm),nt.bgColor.ansi256=Bv(mm),nt.bgColor.ansi16m=Mv(mm),Object.defineProperties(nt,{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(s=>s+s).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>nt.rgbToAnsi256(...nt.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let s=Math.max(r,n,i)*2;if(s===0)return 30;let o=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return s===2&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>nt.ansi256ToAnsi(nt.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>nt.ansi256ToAnsi(nt.hexToAnsi256(e)),enumerable:!1}}),nt}var tU=eU(),Sl=new Set(["\x1B","\x9B"]),rU=39,wm="\x07",Yv="[",nU="]",Jv="m",Em=`${nU}8;;`,qv=t=>`${Sl.values().next().value}${Yv}${t}${Jv}`,Uv=t=>`${Sl.values().next().value}${Em}${t}${wm}`,iU=t=>t.split(" ").map(e=>uu(e)),gm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=uu(Gv(t[t.length-1]));for(let[a,u]of n.entries()){let c=uu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Sl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Em)),i){s?u===wm&&(i=!1,s=!1):u===Jv&&(i=!1);continue}o+=c,o===r&&a<n.length-1&&(t.push(""),o=0)}!o&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},sU=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(uu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},oU=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=iU(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=uu(a[a.length-1]);if(c!==0&&(h>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),h=0),(h>0||r.trim===!1)&&(a[a.length-1]+=" ",h++)),r.hard&&o[c]>e){let d=e-h,f=1+Math.floor((o[c]-d-1)/e);Math.floor((o[c]-1)/e)<f&&a.push(""),gm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){gm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){gm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>sU(c)));let u=[...a.join(`
239
239
  `)];for(let[c,l]of u.entries()){if(n+=l,Sl.has(l)){let{groups:d}=new RegExp(`(?:\\${Yv}(?<code>\\d+)m|\\${Em}(?<uri>.*)${wm})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===rU?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=tU.codes.get(Number(i));u[c+1]===`
240
240
  `?(s&&(n+=Uv("")),i&&h&&(n+=qv(h))):l===`
241
241
  `&&(i&&h&&(n+=qv(i)),s&&(n+=Uv(s)))}return n};function Hv(t,e,r){return String(t).normalize().replace(/\r\n/g,`
@@ -248,7 +248,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
248
248
  `).length-1;this.output.write(Ht.cursor.move(-999,e*-1))}render(){let e=Hv(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Ht.cursor.hide);else{let r=uU(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Ht.cursor.move(0,n)),this.output.write(Ht.erase.lines(1));let i=e.split(`
249
249
  `);this.output.write(i[n]),this._prevFrame=e,this.output.write(Ht.cursor.move(0,i.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Ht.cursor.move(0,n)),this.output.write(Ht.erase.down());let i=e.split(`
250
250
  `).slice(n);this.output.write(i.join(`
251
- `)),this._prevFrame=e;return}this.output.write(Ht.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},vl=class extends cu{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(Ht.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var hU;hU=new WeakMap;var dU=Object.defineProperty,pU=(t,e,r)=>e in t?dU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vv=(t,e,r)=>(pU(t,typeof e!="symbol"?e+"":e,r),r),_l=class extends cu{constructor(e){super(e,!1),Vv(this,"options"),Vv(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 Cl=class extends cu{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}${Kv.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var $r=Oe(require("node:process"),1),Y=Oe(pm(),1),Al=Oe(Je(),1);function mU(){return $r.default.platform!=="win32"?$r.default.env.TERM!=="linux":!!$r.default.env.CI||!!$r.default.env.WT_SESSION||!!$r.default.env.TERMINUS_SUBLIME||$r.default.env.ConEmuTask==="{cmd::Cmder}"||$r.default.env.TERM_PROGRAM==="Terminus-Sublime"||$r.default.env.TERM_PROGRAM==="vscode"||$r.default.env.TERM==="xterm-256color"||$r.default.env.TERM==="alacritty"||$r.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vm=mU(),bt=(t,e)=>vm?t:e,gU=bt("\u25C6","*"),Qv=bt("\u25A0","x"),e_=bt("\u25B2","x"),Sm=bt("\u25C7","o"),yU=bt("\u250C","T"),at=bt("\u2502","|"),lu=bt("\u2514","\u2014"),_m=bt("\u25CF",">"),Cm=bt("\u25CB"," "),bde=bt("\u25FB","[\u2022]"),vde=bt("\u25FC","[+]"),_de=bt("\u25FB","[ ]"),Cde=bt("\u25AA","\u2022"),Sde=bt("\u2500","-"),Ade=bt("\u256E","+"),Ode=bt("\u251C","+"),xde=bt("\u256F","+"),DU=bt("\u25CF","\u2022"),wU=bt("\u25C6","*"),EU=bt("\u25B2","!"),bU=bt("\u25A0","x"),Am=t=>{switch(t){case"initial":case"active":return Y.default.cyan(gU);case"cancel":return Y.default.red(Qv);case"error":return Y.default.yellow(e_);case"submit":return Y.default.green(Sm)}},vU=t=>{let{cursor:e,options:r,style:n}=t,i=t.maxItems??Number.POSITIVE_INFINITY,s=Math.max(process.stdout.rows-4,0),o=Math.min(s,Math.max(i,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,r.length-o),0):e<a+2&&(a=Math.max(e-2,0));let u=o<r.length&&a>0,c=o<r.length&&a+o<r.length;return r.slice(a,a+o).map((l,h,d)=>{let f=h===0&&u,m=h===d.length-1&&c;return f||m?Y.default.dim("..."):n(l,h+a===e)})},wo=t=>new Cl({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${Y.default.gray(at)}
251
+ `)),this._prevFrame=e;return}this.output.write(Ht.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},vl=class extends cu{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(Ht.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var hU;hU=new WeakMap;var dU=Object.defineProperty,pU=(t,e,r)=>e in t?dU(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vv=(t,e,r)=>(pU(t,typeof e!="symbol"?e+"":e,r),r),_l=class extends cu{constructor(e){super(e,!1),Vv(this,"options"),Vv(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 Cl=class extends cu{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}${Kv.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Lr=Oe(require("node:process"),1),Y=Oe(pm(),1),Al=Oe(Je(),1);function mU(){return Lr.default.platform!=="win32"?Lr.default.env.TERM!=="linux":!!Lr.default.env.CI||!!Lr.default.env.WT_SESSION||!!Lr.default.env.TERMINUS_SUBLIME||Lr.default.env.ConEmuTask==="{cmd::Cmder}"||Lr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Lr.default.env.TERM_PROGRAM==="vscode"||Lr.default.env.TERM==="xterm-256color"||Lr.default.env.TERM==="alacritty"||Lr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var vm=mU(),bt=(t,e)=>vm?t:e,gU=bt("\u25C6","*"),Qv=bt("\u25A0","x"),e_=bt("\u25B2","x"),Sm=bt("\u25C7","o"),yU=bt("\u250C","T"),at=bt("\u2502","|"),lu=bt("\u2514","\u2014"),_m=bt("\u25CF",">"),Cm=bt("\u25CB"," "),bde=bt("\u25FB","[\u2022]"),vde=bt("\u25FC","[+]"),_de=bt("\u25FB","[ ]"),Cde=bt("\u25AA","\u2022"),Sde=bt("\u2500","-"),Ade=bt("\u256E","+"),Ode=bt("\u251C","+"),xde=bt("\u256F","+"),DU=bt("\u25CF","\u2022"),wU=bt("\u25C6","*"),EU=bt("\u25B2","!"),bU=bt("\u25A0","x"),Am=t=>{switch(t){case"initial":case"active":return Y.default.cyan(gU);case"cancel":return Y.default.red(Qv);case"error":return Y.default.yellow(e_);case"submit":return Y.default.green(Sm)}},vU=t=>{let{cursor:e,options:r,style:n}=t,i=t.maxItems??Number.POSITIVE_INFINITY,s=Math.max(process.stdout.rows-4,0),o=Math.min(s,Math.max(i,5)),a=0;e>=a+o-3?a=Math.max(Math.min(e-o+3,r.length-o),0):e<a+2&&(a=Math.max(e-2,0));let u=o<r.length&&a>0,c=o<r.length&&a+o<r.length;return r.slice(a,a+o).map((l,h,d)=>{let f=h===0&&u,m=h===d.length-1&&c;return f||m?Y.default.dim("..."):n(l,h+a===e)})},wo=t=>new Cl({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${Y.default.gray(at)}
252
252
  ${Am(this.state)} ${t.message}
253
253
  `,r=t.placeholder?Y.default.inverse(t.placeholder[0])+Y.default.dim(t.placeholder.slice(1)):Y.default.inverse(Y.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
254
254
  ${Y.default.yellow(at)} ${n}
@@ -256,7 +256,7 @@ ${Y.default.yellow(lu)} ${Y.default.yellow(this.error)}
256
256
  `;case"submit":return`${e}${Y.default.gray(at)} ${Y.default.dim(this.value||t.placeholder)}`;case"cancel":return`${e}${Y.default.gray(at)} ${Y.default.strikethrough(Y.default.dim(this.value??""))}${this.value?.trim()?`
257
257
  ${Y.default.gray(at)}`:""}`;default:return`${e}${Y.default.cyan(at)} ${n}
258
258
  ${Y.default.cyan(lu)}
259
- `}}}).prompt();var Lr=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new vl({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${Y.default.gray(at)}
259
+ `}}}).prompt();var jr=t=>{let e=t.active??"Yes",r=t.inactive??"No";return new vl({active:e,inactive:r,initialValue:t.initialValue??!0,render(){let n=`${Y.default.gray(at)}
260
260
  ${Am(this.state)} ${t.message}
261
261
  `,i=this.value?e:r;switch(this.state){case"submit":return`${n}${Y.default.gray(at)} ${Y.default.dim(i)}`;case"cancel":return`${n}${Y.default.gray(at)} ${Y.default.strikethrough(Y.default.dim(i))}
262
262
  ${Y.default.gray(at)}`;default:return`${n}${Y.default.cyan(at)} ${this.value?`${Y.default.green(_m)} ${e}`:`${Y.default.dim(Cm)} ${Y.default.dim(e)}`} ${Y.default.dim("/")} ${this.value?`${Y.default.dim(Cm)} ${Y.default.dim(r)}`:`${Y.default.green(_m)} ${r}`}
@@ -276,13 +276,13 @@ ${Y.default.gray(lu)} ${t}
276
276
  `)}
277
277
  `)},info:t=>{g.message(t,{symbol:Y.default.blue(DU)})},success:t=>{g.message(t,{symbol:Y.default.green(wU)})},step:t=>{g.message(t,{symbol:Y.default.green(Sm)})},warn:t=>{g.message(t,{symbol:Y.default.yellow(EU)})},warning:t=>{g.warn(t)},error:t=>{g.message(t,{symbol:Y.default.red(bU)})}},Tde=`${Y.default.gray(at)} `;var Ft=({indicator:t="dots"}={})=>{let e=vm?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=vm?80:120,n=process.env.CI==="true",i,s,o=!1,a="",u,c=performance.now(),l=D=>{let w=D>1?"Something went wrong":"Canceled";o&&p(w,D)},h=()=>l(2),d=()=>l(1),f=()=>{process.on("uncaughtExceptionMonitor",h),process.on("unhandledRejection",h),process.on("SIGINT",d),process.on("SIGTERM",d),process.on("exit",l)},m=()=>{process.removeListener("uncaughtExceptionMonitor",h),process.removeListener("unhandledRejection",h),process.removeListener("SIGINT",d),process.removeListener("SIGTERM",d),process.removeListener("exit",l)},y=()=>{if(u===void 0)return;n&&process.stdout.write(`
278
278
  `);let D=u.split(`
279
- `);process.stdout.write(Al.cursor.move(-999,D.length-1)),process.stdout.write(Al.erase.down(D.length))},E=D=>D.replace(/\.+$/,""),C=D=>{let w=(performance.now()-D)/1e3,_=Math.floor(w/60),P=Math.floor(w%60);return _>0?`[${_}m ${P}s]`:`[${P}s]`},A=(D="")=>{o=!0,i=Zv(),a=E(D),c=performance.now(),process.stdout.write(`${Y.default.gray(at)}
280
- `);let w=0,_=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let P=Y.default.magenta(e[w]);if(n)process.stdout.write(`${P} ${a}...`);else if(t==="timer")process.stdout.write(`${P} ${a} ${C(c)}`);else{let b=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(`${P} ${a}${b}`)}w=w+1<e.length?w+1:0,_=_<e.length?_+.125:0},r)},p=(D="",w=0)=>{o=!1,clearInterval(s),y();let _=w===0?Y.default.green(Sm):w===1?Y.default.red(Qv):Y.default.red(e_);a=E(D??a),t==="timer"?process.stdout.write(`${_} ${a} ${C(c)}
279
+ `);process.stdout.write(Al.cursor.move(-999,D.length-1)),process.stdout.write(Al.erase.down(D.length))},E=D=>D.replace(/\.+$/,""),S=D=>{let w=(performance.now()-D)/1e3,_=Math.floor(w/60),P=Math.floor(w%60);return _>0?`[${_}m ${P}s]`:`[${P}s]`},A=(D="")=>{o=!0,i=Zv(),a=E(D),c=performance.now(),process.stdout.write(`${Y.default.gray(at)}
280
+ `);let w=0,_=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let P=Y.default.magenta(e[w]);if(n)process.stdout.write(`${P} ${a}...`);else if(t==="timer")process.stdout.write(`${P} ${a} ${S(c)}`);else{let b=".".repeat(Math.floor(_)).slice(0,3);process.stdout.write(`${P} ${a}${b}`)}w=w+1<e.length?w+1:0,_=_<e.length?_+.125:0},r)},p=(D="",w=0)=>{o=!1,clearInterval(s),y();let _=w===0?Y.default.green(Sm):w===1?Y.default.red(Qv):Y.default.red(e_);a=E(D??a),t==="timer"?process.stdout.write(`${_} ${a} ${S(c)}
281
281
  `):process.stdout.write(`${_} ${a}
282
282
  `),m(),i()};return{start:A,stop:p,message:(D="")=>{a=E(D??a)}}};function t_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var Vt=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 i=0;i<r.length;i++){let s=this.cast(n[i]).length;s>r[i]&&(r[i]=s)}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 i=this.cast(e),s=n?t_("bold",i):i,o=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(o)+s;case"string":return s+a.repeat(o);case"boolean":case"object":return a.repeat(Math.ceil(o/2))+t_("italic",i)+a.repeat(Math.floor(o/2));default:return a.repeat(o)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((s,o)=>this.renderCell(s,i[o],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(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
283
- `)}};var qM=require("node:child_process"),Ye=require("node:fs"),kp=require("node:os"),Xe=Oe(require("node:path")),$n=require("node:process"),rs=Oe(xl());var Zt=require("fs"),hu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},Tl=(t=hu(),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"}},r_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Il(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function s_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Im(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var bo="0|[1-9]\\d*",AU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",OU=`(?<major>${bo})\\.(?<minor>${bo})\\.(?<patch>${bo})`,n_=`(?:${bo}|${AU})`,o_=`(?:-(?<prerelease>${n_}(?:\\.${n_})*))`,i_="[0-9A-Za-z-]+",a_=`(?:\\+(?<buildmetadata>${i_}(?:\\.${i_})*))`,u_=`v?${OU}${o_}?${a_}?`,c_=new RegExp(`^${u_}$`),l_="(?:<|>)?=?",xU="x|X|\\*",Tm=`${bo}|${xU}`,Fl=`[v=\\s]*(?<major>${Tm})(?:\\.(?<minor>${Tm})(?:\\.(?<patch>${Tm})${o_}?${a_}?)?)?`,f_=new RegExp(`^(?<operator>~>?|\\^|${l_})\\s*${Fl}$`),h_=new RegExp(`^(?<operator>${l_})\\s*(${u_})$|^$`);function Fm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Pm=256;var TU=new RegExp(`^${bo}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(TU.test(e)){let r=Number(e);if(Fm(r))return r}return e})}function Qr(t){return t.split(".").filter(Boolean)}function bi(t,e){let r=Number(t);if(!Fm(r))throw new TypeError(e);return r}function Un(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 er(t,e){return t===e?0:Il(t.major,e.major)||Il(t.minor,e.minor)||Il(t.patch,e.patch)||s_(t.prerelease,e.prerelease)||Im(t.prerelease,e.prerelease)}function Rm(t){return t.toFixed(0)}function vi(t){let e=Rm(t.major),r=Rm(t.minor),n=Rm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function IU(t,e){if(Un(e))return!0;let r=er(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 Pl(t,e){for(let r of e)if(!IU(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Un(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function du(t,e){return e.some(r=>Pl(t,r))}function FU(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 pu(t=[],e){let r=FU(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function d_(t,e,r={}){let n=r.build!==void 0?Qr(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:pu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:pu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:pu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:pu(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 s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:pu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Rl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},vo={operator:void 0,...Rl};function km(t,e){return er(t,e)>0}function Nm(t,e){return er(t,e)<0}function PU(t){let r=t.match(h_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:bi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:bi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:bi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?Qr(s):[]}:Rl;return{operator:n||void 0,...o}}function Ue(t){return!t||t.toLowerCase()==="x"||t==="*"}function RU(t){if(!Ue(t.major))return Ue(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Ue(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?Qt(t.prerelease):[],build:[]}}function kU(t){if(!Ue(t.major))return Ue(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Ue(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:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function NU(t){let e=t.match(new RegExp(`^${Fl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Fl}\\s*$`))?.groups;if(!a)return null;let u=RU(r),c=kU(a);return[u,c].filter(Boolean)}function $U(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function LU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function jU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=Qr(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function BU(t){let e=Ue(t.minor),r=Ue(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=Qr(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function MU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=Qr(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function qU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=Qr(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function UU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=Qr(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function HU(t){let e=t.match(f_)?.groups;if(!e)return PU(t);switch(e.operator){case"^":return $U(e);case"~":case"~>":return LU(e);case"<":return jU(e);case"<=":return BU(e);case">":return MU(e);case">=":return qU(e);case"=":case"":return UU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function VU(t){return t.split(/\s+/).flatMap(HU)}function kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>NU(r)||VU(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function St(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Pm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Pm}`);t=t.trim();let e=t.match(c_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=bi(e.major,`Cannot parse version ${t}: invalid major version`),n=bi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=bi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?Qr(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function p_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Un(t)?!0:du(t,[[e]]);if(n===void 0)return Un(e)?!0:du(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function zU(t){return t.every(e=>e.some(r=>KU(r)))}function KU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!p_(r,n))return!1}return!0}function m_(t,e){return zU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>p_(i,s)))))}function g_(t){try{return St(t),!0}catch{return!1}}function _i(t,e){return er(t,e)>=0}var Wa=Oe(dS()),Qb=Oe(KS()),UM=Oe(_A()),Np=Oe(u0());var Ri={name:"@capgo/cli",version:"7.31.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Lh(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 Ke(){let t=await Lh("@capgo/cli")??"",e=t?.split(".")[0];t!==Ri.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Ri.version} it's not the latest version.
284
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function NT(t,e,r,n,i,s="\u2705"){await Ae(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var c0=require("node:buffer"),$T=require("node:crypto"),tY=(()=>{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 rY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=tY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Jn(t,e="sha256"){let r=c0.Buffer.isBuffer(t)?t:c0.Buffer.from(t);if(e==="crc32")return rY(r);let n=(0,$T.createHash)(e);return n.update(r),n.digest("hex")}var el=Oe(sM());async function oM(){let t=await(0,el.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Ib(t,e,r=!1){let n=await(0,el.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,el.writeConfig)(i,n.app.extConfigFilePath))}async function Va(t,e=!1){await Ib("CapacitorUpdater",t,e)}var Xa=".capgo_key",Pr=".capgo_key_v2",$p=`${Xa}.pub`,di=`${Pr}.pub`,NM="https://capgo.app",$M="https://files.capgo.app",LM="https://api.capgo.app",jM="https://console.capgo.app",ev=12e4,Ele=1024*1024*20,ble=1024*1024*1024,vle=1024*1024*99,Lp="package.json",Ya=/^(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,W=t=>t?`
285
- ${UM.default.render(t)}`:"";function Rp(t){return new Promise(e=>{setTimeout(e,t)})}function Yr(t){return(0,rs.isMonorepo)(t)?(0,rs.findMonorepoRoot)(t):(0,rs.isNXMonorepo)(t)?(0,rs.findNXMonorepoRoot)(t):t}function _le(t=Yr((0,$n.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Ye.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Ye.readFileSync)(r??(0,Xe.join)(t,Lp));return JSON.parse(n)}function ns(t=Yr((0,$n.cwd)()),e=void 0){return _le(t,e).version??""}function BM(t){let e=t.replace("^","").replace("~","");if(g_(e))try{let r=St(e);return vi(r)}catch{return e}return e}async function io(t,e=(0,$n.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let o=(await il(e,r)).get(t);if(o)return o}catch{}let n=null,i=(0,Xe.join)(e,"ios","App","Podfile");if((0,Ye.existsSync)(i))try{let o=(0,Ye.readFileSync)(i,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);o?.[1]&&(n=(0,Xe.resolve)((0,Xe.join)(e,"ios","App",o[1])))}catch{}if(!n){let s=(0,Xe.join)(e,"android","capacitor.settings.gradle");if((0,Ye.existsSync)(s))try{let a=(0,Ye.readFileSync)(s,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);a?.[1]&&(n=(0,Xe.resolve)((0,Xe.join)(e,"android",a[1])).replace(/\/android$/,""))}catch{}}if(n){let s=(0,Xe.join)(n,Lp);if((0,Ye.existsSync)(s))try{let o=JSON.parse((0,Ye.readFileSync)(s,"utf-8"));if(o.version)return o.version}catch{}}try{let o=(await il(e)).get(t);if(o)return o}catch{}return null}async function il(t=Yr((0,$n.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Xe.join)(t,Lp)],r){for(let i of r)if(!(0,Ye.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw g.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Ye.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,BM(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,BM(o.devDependencies[a]))}return n}async function de(){try{let t=await oM();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function Cle(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Ib(t,r)),r}async function HM(t){return Cle("CapacitorUpdater",t)}async function En(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||NM,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||jM,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||$M,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||LM};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.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:NM,hostWeb:jM,hostFilesApi:$M,hostApi:LM}}}var Sle=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function jp(){let t=await En();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 g.info(`Local config ${W(t)}`),t}}async function VM(){let t=await En();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:ble,maxChunkSize:vle,alertUploadSize:Ele}}}async function pe(t,e,r){let n=await jp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Wa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Ale(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function zM(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function KM(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Ole(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function xle(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(hr||{}),Ja=(t,e)=>t>=e;async function GM(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function WM(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
283
+ `)}};var qM=require("node:child_process"),Ye=require("node:fs"),kp=require("node:os"),Xe=Oe(require("node:path")),$n=require("node:process"),rs=Oe(xl());var Zt=require("fs"),hu=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bun":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm":(0,Zt.existsSync)(o)?"yarn":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npm":e},Tl=(t=hu(),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"}},r_=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/bun.lock`,i=`${t}/pnpm-lock.yaml`,s=`${t}/shrinkwrap.yaml`,o=`${t}/yarn.lock`,a=`${t}/package-lock.json`,u=`${t}/npm-shrinkwrap.json`;return(0,Zt.existsSync)(r)||(0,Zt.existsSync)(n)?"bunx":(0,Zt.existsSync)(i)||(0,Zt.existsSync)(s)?"pnpm exec":(0,Zt.existsSync)(o)?"yarn dlx":(0,Zt.existsSync)(a)||(0,Zt.existsSync)(u)?"npx":e};function Il(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function s_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Im(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],s=e[n];if(i===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof s=="number")return 1;if(typeof i=="number"&&typeof s=="string"||i<s)return-1;if(i>s)return 1}return 0}var bo="0|[1-9]\\d*",AU="\\d*[a-zA-Z-][a-zA-Z0-9-]*",OU=`(?<major>${bo})\\.(?<minor>${bo})\\.(?<patch>${bo})`,n_=`(?:${bo}|${AU})`,o_=`(?:-(?<prerelease>${n_}(?:\\.${n_})*))`,i_="[0-9A-Za-z-]+",a_=`(?:\\+(?<buildmetadata>${i_}(?:\\.${i_})*))`,u_=`v?${OU}${o_}?${a_}?`,c_=new RegExp(`^${u_}$`),l_="(?:<|>)?=?",xU="x|X|\\*",Tm=`${bo}|${xU}`,Fl=`[v=\\s]*(?<major>${Tm})(?:\\.(?<minor>${Tm})(?:\\.(?<patch>${Tm})${o_}?${a_}?)?)?`,f_=new RegExp(`^(?<operator>~>?|\\^|${l_})\\s*${Fl}$`),h_=new RegExp(`^(?<operator>${l_})\\s*(${u_})$|^$`);function Fm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Pm=256;var TU=new RegExp(`^${bo}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(TU.test(e)){let r=Number(e);if(Fm(r))return r}return e})}function en(t){return t.split(".").filter(Boolean)}function bi(t,e){let r=Number(t);if(!Fm(r))throw new TypeError(e);return r}function Un(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 er(t,e){return t===e?0:Il(t.major,e.major)||Il(t.minor,e.minor)||Il(t.patch,e.patch)||s_(t.prerelease,e.prerelease)||Im(t.prerelease,e.prerelease)}function Rm(t){return t.toFixed(0)}function vi(t){let e=Rm(t.major),r=Rm(t.minor),n=Rm(t.patch),i=t.prerelease?.join(".")??"",s=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),s].filter(u=>u).join("+")}function IU(t,e){if(Un(e))return!0;let r=er(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 Pl(t,e){for(let r of e)if(!IU(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Un(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function du(t,e){return e.some(r=>Pl(t,r))}function FU(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 pu(t=[],e){let r=FU(t);if(!e)return r;let n=Qt(e);if(n.every(i=>typeof i=="string")){if(n.every((i,s)=>i===r[s])&&typeof r[n.length]=="number")return r;n=[...n,0]}return n}function d_(t,e,r={}){let n=r.build!==void 0?en(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:pu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:pu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:pu(t.prerelease,r.prerelease),build:n};case"prerelease":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:pu(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 s=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:s,patch:0,prerelease:[],build:n}}case"patch":{let s=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:s,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:pu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Rl={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},vo={operator:void 0,...Rl};function km(t,e){return er(t,e)>0}function Nm(t,e){return er(t,e)<0}function PU(t){let r=t.match(h_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:bi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:bi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:bi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?en(s):[]}:Rl;return{operator:n||void 0,...o}}function Ue(t){return!t||t.toLowerCase()==="x"||t==="*"}function RU(t){if(!Ue(t.major))return Ue(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:Ue(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?Qt(t.prerelease):[],build:[]}}function kU(t){if(!Ue(t.major))return Ue(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:Ue(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:Qt(t.prerelease),build:[]}:{operator:"<=",major:+t.major,minor:+t.minor,patch:+t.patch,prerelease:[],build:[]}}function NU(t){let e=t.match(new RegExp(`^${Fl}`)),r=e?.groups;if(!r)return null;let n=e[0].length,i=t.slice(n).match(/^\s+-\s+/);if(!i)return null;let s=i[0].length,a=t.slice(n+s).match(new RegExp(`^${Fl}\\s*$`))?.groups;if(!a)return null;let u=RU(r),c=kU(a);return[u,c].filter(Boolean)}function $U(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return i===0?[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];let a=Qt(t.prerelease??"");return i===0?s===0?[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s,patch:o+1}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]:[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i+1,minor:0,patch:0}]}function LU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a},{operator:"<",major:i,minor:s+1,patch:0}]}function jU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return n?[{operator:"<",major:i,minor:0,patch:0}]:[{operator:"<",major:i,minor:0,patch:0}];if(n)return[{operator:"<",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=en(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function BU(t){let e=Ue(t.minor),r=Ue(t.patch),n=+t.major,i=+t.minor,s=+t.patch;if(e)return r?[{operator:"<",major:n+1,minor:0,patch:0}]:[{operator:"<",major:n,minor:i+1,patch:0}];if(r)return[{operator:"<",major:n,minor:i+1,patch:0}];let o=Qt(t.prerelease??""),a=en(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function MU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[{operator:"<",major:0,minor:0,patch:0}];if(r)return[{operator:">=",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=en(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function qU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return n?[{operator:">=",major:i,minor:0,patch:0}]:[{operator:">=",major:i,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0}];let a=Qt(t.prerelease??""),u=en(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function UU(t){let e=Ue(t.major),r=Ue(t.minor),n=Ue(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[vo];if(r)return[{operator:">=",major:i,minor:0,patch:0},{operator:"<",major:i+1,minor:0,patch:0}];if(n)return[{operator:">=",major:i,minor:s,patch:0},{operator:"<",major:i,minor:s+1,patch:0}];let a=Qt(t.prerelease??""),u=en(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function HU(t){let e=t.match(f_)?.groups;if(!e)return PU(t);switch(e.operator){case"^":return $U(e);case"~":case"~>":return LU(e);case"<":return jU(e);case"<=":return BU(e);case">":return MU(e);case">=":return qU(e);case"=":case"":return UU(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function VU(t){return t.split(/\s+/).flatMap(HU)}function kl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>NU(r)||VU(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function St(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Pm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Pm}`);t=t.trim();let e=t.match(c_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=bi(e.major,`Cannot parse version ${t}: invalid major version`),n=bi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=bi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?en(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function p_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Un(t)?!0:du(t,[[e]]);if(n===void 0)return Un(e)?!0:du(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function zU(t){return t.every(e=>e.some(r=>KU(r)))}function KU(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!p_(r,n))return!1}return!0}function m_(t,e){return zU([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>p_(i,s)))))}function g_(t){try{return St(t),!0}catch{return!1}}function _i(t,e){return er(t,e)>=0}var Wa=Oe(dS()),Qb=Oe(KS()),UM=Oe(_A()),Np=Oe(u0());var Ri={name:"@capgo/cli",version:"7.33.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.25.11",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^10.1.2",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Lh(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 Ke(){let t=await Lh("@capgo/cli")??"",e=t?.split(".")[0];t!==Ri.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Ri.version} it's not the latest version.
284
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function NT(t,e,r,n,i,s="\u2705"){await ve(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var c0=require("node:buffer"),$T=require("node:crypto"),tY=(()=>{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 rY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=tY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function Jn(t,e="sha256"){let r=c0.Buffer.isBuffer(t)?t:c0.Buffer.from(t);if(e==="crc32")return rY(r);let n=(0,$T.createHash)(e);return n.update(r),n.digest("hex")}var el=Oe(sM());async function oM(){let t=await(0,el.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function Ib(t,e,r=!1){let n=await(0,el.loadConfig)(),{extConfig:i}=n.app;i&&(i.plugins||(i.plugins={extConfig:{},[t]:{}}),i.plugins[t]||(i.plugins[t]={}),r?i=e.config:i.plugins[t]=e.config.plugins?.[t],(0,el.writeConfig)(i,n.app.extConfigFilePath))}async function Va(t,e=!1){await Ib("CapacitorUpdater",t,e)}var Xa=".capgo_key",Rr=".capgo_key_v2",$p=`${Xa}.pub`,di=`${Rr}.pub`,NM="https://capgo.app",$M="https://files.capgo.app",LM="https://api.capgo.app",jM="https://console.capgo.app",ev=12e4,Ele=1024*1024*20,ble=1024*1024*1024,vle=1024*1024*99,Lp="package.json",Ya=/^(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,W=t=>t?`
285
+ ${UM.default.render(t)}`:"";function Rp(t){return new Promise(e=>{setTimeout(e,t)})}function Jr(t){return(0,rs.isMonorepo)(t)?(0,rs.findMonorepoRoot)(t):(0,rs.isNXMonorepo)(t)?(0,rs.findNXMonorepoRoot)(t):t}function _le(t=Jr((0,$n.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Ye.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Ye.readFileSync)(r??(0,Xe.join)(t,Lp));return JSON.parse(n)}function ns(t=Jr((0,$n.cwd)()),e=void 0){return _le(t,e).version??""}function BM(t){let e=t.replace("^","").replace("~","");if(g_(e))try{let r=St(e);return vi(r)}catch{return e}return e}async function io(t,e=(0,$n.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;if(r)try{let o=(await il(e,r)).get(t);if(o)return o}catch{}let n=null,i=(0,Xe.join)(e,"ios","App","Podfile");if((0,Ye.existsSync)(i))try{let o=(0,Ye.readFileSync)(i,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);o?.[1]&&(n=(0,Xe.resolve)((0,Xe.join)(e,"ios","App",o[1])))}catch{}if(!n){let s=(0,Xe.join)(e,"android","capacitor.settings.gradle");if((0,Ye.existsSync)(s))try{let a=(0,Ye.readFileSync)(s,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);a?.[1]&&(n=(0,Xe.resolve)((0,Xe.join)(e,"android",a[1])).replace(/\/android$/,""))}catch{}}if(n){let s=(0,Xe.join)(n,Lp);if((0,Ye.existsSync)(s))try{let o=JSON.parse((0,Ye.readFileSync)(s,"utf-8"));if(o.version)return o.version}catch{}}try{let o=(await il(e)).get(t);if(o)return o}catch{}return null}async function il(t=Jr((0,$n.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,Xe.join)(t,Lp)],r){for(let i of r)if(!(0,Ye.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw g.error(s),new Error(s)}}let n=new Map;for(let i of r){let s=(0,Ye.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,BM(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,BM(o.devDependencies[a]))}return n}async function de(){try{let t=await oM();if(!t){let e="No capacitor config file found, run `cap init` first";throw g.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw g.error(e),new Error(e)}}async function Cle(t,e){let r=await de();return r?.config&&(r.config.plugins??={},r.config.plugins.extConfig??={},r.config.plugins[t]??={},r.config.plugins[t]={...r.config.plugins[t],...e},await Ib(t,r)),r}async function HM(t){return Cle("CapacitorUpdater",t)}async function En(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||NM,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||jM,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||$M,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||LM};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(g.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:NM,hostWeb:jM,hostFilesApi:$M,hostApi:LM}}}var Sle=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function jp(){let t=await En();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 g.info(`Local config ${W(t)}`),t}}async function VM(){let t=await En();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:ble,maxChunkSize:vle,alertUploadSize:Ele}}}async function pe(t,e,r){let n=await jp();if(e&&r&&(g.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw g.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Wa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Ale(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){g.error("Invalid API key or insufficient permissions.");let s=`Your key should be: ${r.map((o,a)=>r.length===1?`"${o}"`:a===r.length-1?`or "${o}"`:`"${o}", `).join("")} mode.`;throw g.error(s),new Error("Invalid API key or insufficient permissions.")}}async function zM(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function KM(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Ole(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function xle(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var hr=(o=>(o[o.none=0]="none",o[o.read=1]="read",o[o.upload=2]="upload",o[o.write=3]="write",o[o.admin=4]="admin",o[o.super_admin=5]="super_admin",o))(hr||{}),Ja=(t,e)=>t>=e;async function GM(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i)throw g.error("Cannot get permissions for organization!"),console.error(i),new Error("Cannot get permissions for organization");if(n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:throw n.includes("invite")?(g.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(g.error(`Invalid output when fetching organization permission. Response: ${n}`),new Error(`Invalid output when fetching organization permission. Response: ${n}`))}return{okay:!0,data:a}}let o=null;switch(n){case"INVALID_APIKEY":{o="INVALID_APIKEY";break}case"NO_APP":{o="NO_APP";break}case"NO_ORG":{o="NO_ORG";break}default:throw g.error(`Invalid error when fetching organization permission. Response: ${n}`),new Error(`Invalid error when fetching organization permission. Response: ${n}`)}return{okay:!1,error:o}}async function WM(t,e,r){let{data:n,error:i}=await t.rpc("get_organization_cli_warnings",{orgid:e,cli_version:r});if(i){g.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){g.warn(`Found ${n.length} cli warnings for your organization.`);let s=null;for(let o of n){if(typeof o!="object"||typeof o.message!="string"||typeof o.fatal!="boolean"){g.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(g.error(`${a.message.replaceAll("\\n",`
286
286
  `)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
287
287
  `)}`)}if(s)throw g.error("Please fix the warnings and try again."),s;g.info("End of cli warnings.")}}async function XM(t,e,r,n,i=!0){let s=await jp();if(!await(n?xle(t,n,r):Ole(t,e)))throw g.error(`You need to upgrade your plan to continue to use capgo.
288
288
  Upgrade here: ${s.hostWeb}/dashboard/settings/plans
@@ -292,12 +292,12 @@ Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
292
292
  Upgrade here: ${s.hostWeb}/dashboard/settings/plans
293
293
  `),Rp(100),Promise.resolve().then(()=>(Jb(),Yb)).then(c=>{c.default(`${s.hostWeb}/dashboard/settings/plans`)}),Rp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([KM(t,e),zM(t,e)]);a>0&&i&&!u&&g.warn(`WARNING !!
294
294
  Trial expires in ${a} days, upgrade here: ${s.hostWeb}/dashboard/settings/plans
295
- `)}function te(t=!1){let e=$n.env.CAPGO_TOKEN?.trim();if(e)return t||g.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,kp.homedir)(),n,i=`${r}/.capgo`;if((0,Ye.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Ye.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Ye.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Ye.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${Ln().runner} @capacitor/cli login`;throw g.error(s),new Error(s)}return n}function Za(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 tv(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 JM(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Wa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){g.error(`Cannot get upload url ${W(i)}`)}return""}async function*ZM(t){let e=(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Xe.join)(t,r.name);r.isDirectory()?yield*ZM(n):yield n}}async function QM(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 ZM(t)){if(r.some(a=>n.includes(a))){g.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Ye.readFileSync)(n);if(i.length===0){g.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await Jn(i,"sha256"),o=(0,Xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Bp(t){return(0,kp.platform)()==="win32"?Ile(t):Tle(t)}function Tle(t){let e=new Qb.default;return e.addLocalFolder(t),e.toBuffer()}async function Ile(t){g.info("Zipping file windows mode");let e=new Qb.default,r=(n,i)=>{let s=(0,Ye.readdirSync)(n);for(let o of s){let a=(0,Xe.join)(n,o),u=(0,Ye.statSync)(a);if(u.isFile()){let c=(0,Ye.readFileSync)(a);e.addFile((0,Xe.join)(i,o).split(Xe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,Xe.join)(i,o))}};return r(t,""),e.toBuffer()}async function e8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{Ae(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Np.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(g.error(`Error uploading bundle: ${h.message}`),h instanceof Np.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await Ae(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function t8(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Wa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Wa.FunctionsHttpError){let s=await i.context.json();g.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else g.error(`Cannot delete failed version: ${W(i)}`)}}async function Mp(t,e){if(!e.app_id||!e.name||!e.created_by)return g.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 Ae(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await jp();r&&g.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&g.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(g.error("Failed to send Stats event details:"),g.error(W(n)))}}async function qp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw g.error("Cannot get the list of organizations - exiting"),g.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw g.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw g.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 s=i.length>1?await Eo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(Tt(s))throw g.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return g.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await Ale(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw g.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function on(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw g.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Qa(t){return new Date(t||"").toLocaleString()}var MM=!1,Ga="npm",nl="install",Zb="npx";function Ln(){if(MM)return{pm:Ga,command:nl,installCommand:`${Ga} ${nl}`,runner:Zb};let t=Yr((0,$n.cwd)());return Ga=hu(t,"npm"),nl=Tl(Ga),MM=!0,Zb=r_(t),{pm:Ga,command:nl,installCommand:`${Ga} ${nl}`,runner:Zb}}function r8(t){return(0,Ye.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,Xe.join)(t,n.name);return n.isDirectory()?r8(i):i.split(`node_modules${Xe.sep}`)[1]||i})}async function rv(t,e){let r=e?e.split(","):[],n;try{n=await il("",t)}catch(l){throw g.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?Xe.default.resolve(i).replace(Lp,""):Yr((0,$n.cwd)());if(!n)throw g.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw g.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,Xe.join)((0,$n.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Ye.existsSync)(l))){let l=hu(s,"npm"),h=Tl(l);throw g.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1;for(let m of o){let y=(0,Xe.join)(m,l);if((0,Ye.existsSync)(y)){d=!0;try{if(r8(y).some(C=>Sle.test(C))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=hu(s,"npm"),y=Tl(m);return g.error(`Missing dependency ${l}, please run ${m} ${y}`),{name:l,version:h}}return{name:l,version:h,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw g.error("Missing dependencies or invalid dependencies"),g.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 Fle(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function Ple(t){if(!t)throw g.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 g.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw g.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw g.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function n8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
295
+ `)}function te(t=!1){let e=$n.env.CAPGO_TOKEN?.trim();if(e)return t||g.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,kp.homedir)(),n,i=`${r}/.capgo`;if((0,Ye.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Ye.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Ye.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Ye.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${Ln().runner} @capacitor/cli login`;throw g.error(s),new Error(s)}return n}function Za(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 tv(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 JM(t,e,r){let n={app_id:e,name:r,version:0};try{let s=await t.functions.invoke("files/upload_link",{body:JSON.stringify(n)});if(s.error){if(s.error instanceof Wa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){g.error(`Cannot get upload url ${W(i)}`)}return""}async function*ZM(t){let e=(0,Ye.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Xe.join)(t,r.name);r.isDirectory()?yield*ZM(n):yield n}}async function QM(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 ZM(t)){if(r.some(a=>n.includes(a))){g.info(`Ignoring file ${n}, please ensure you have only required files in your dist folder`);continue}let i=(0,Ye.readFileSync)(n);if(i.length===0){g.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await Jn(i,"sha256"),o=(0,Xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Bp(t){return(0,kp.platform)()==="win32"?Ile(t):Tle(t)}function Tle(t){let e=new Qb.default;return e.addLocalFolder(t),e.toBuffer()}async function Ile(t){g.info("Zipping file windows mode");let e=new Qb.default,r=(n,i)=>{let s=(0,Ye.readdirSync)(n);for(let o of s){let a=(0,Xe.join)(n,o),u=(0,Ye.statSync)(a);if(u.isFile()){let c=(0,Ye.readFileSync)(a);e.addFile((0,Xe.join)(i,o).split(Xe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,Xe.join)(i,o))}};return r(t,""),e.toBuffer()}async function e8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{ve(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Np.Upload(e,{endpoint:`${o.hostFilesApi}/files/upload/attachments/`,chunkSize:a,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(h){if(g.error(`Error uploading bundle: ${h.message}`),h instanceof Np.DetailedError){let d=h.originalResponse?.getBody(),f=JSON.parse(d||'{"error": "unknown error"}');c(f.status||f.error||f.message||"unknown error")}else c(h.message||h.toString()||"unknown error")},onProgress(h,d){let f=(h/d*100).toFixed(2);s.message(`Uploaded ${f}%`)},async onSuccess(){await ve(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function t8(t,e,r){let n={app_id:e,name:r};try{let s=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(s.error){if(s.error instanceof Wa.FunctionsHttpError){let o=await s.error.context.json();g.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else g.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Wa.FunctionsHttpError){let s=await i.context.json();g.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else g.error(`Cannot delete failed version: ${W(i)}`)}}async function Mp(t,e){if(!e.app_id||!e.name||!e.created_by)return g.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 ve(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await jp();r&&g.info(`Sending LogSnag event: ${JSON.stringify(e)}`);let i=new AbortController,s=setTimeout(()=>i.abort(),1e4);try{let o=await fetch(`${n.hostApi}/private/events`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",capgkey:t},signal:i.signal});if(clearTimeout(s),!o.ok)throw new Error(`HTTP error! status: ${o.status}`);let a=await o.json();a.error&&g.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(g.error("Failed to send Stats event details:"),g.error(W(n)))}}async function qp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw g.error("Cannot get the list of organizations - exiting"),g.error(`Error ${JSON.stringify(r)}`),new Error("Cannot get the list of organizations");let i=n.filter(u=>!!e.find(c=>c===u.role));if(n.length===0)throw g.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw g.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 s=i.length>1?await Eo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;if(Tt(s))throw g.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return g.info(`Using the organization "${a.name}" as the app owner`),a}async function De(t,e,r=["all"]){await Ale(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),s=(n||"").toString();if(!s||i)throw g.error("Cannot auth user with apikey"),new Error("Cannot authenticate user with provided API key");return s}async function Fr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();if(!r||n)throw g.error(`Cannot get organization id for app id ${e}`),W(n),new Error(`Cannot get organization id for app id ${e}`);return r.owner_org}function Qa(t){return new Date(t||"").toLocaleString()}var MM=!1,Ga="npm",nl="install",Zb="npx";function Ln(){if(MM)return{pm:Ga,command:nl,installCommand:`${Ga} ${nl}`,runner:Zb};let t=Jr((0,$n.cwd)());return Ga=hu(t,"npm"),nl=Tl(Ga),MM=!0,Zb=r_(t),{pm:Ga,command:nl,installCommand:`${Ga} ${nl}`,runner:Zb}}function r8(t){return(0,Ye.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,Xe.join)(t,n.name);return n.isDirectory()?r8(i):i.split(`node_modules${Xe.sep}`)[1]||i})}async function rv(t,e){let r=e?e.split(","):[],n;try{n=await il("",t)}catch(l){throw g.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),l instanceof Error?l:new Error("Invalid package.json")}let i=t?.split(",")[0],s=i?Xe.default.resolve(i).replace(Lp,""):Jr((0,$n.cwd)());if(!n)throw g.error("Missing dependencies section in package.json"),new Error("Missing dependencies section in package.json");for(let[l,h]of Object.entries(n))if(typeof h!="string")throw g.error(`Invalid dependency ${l}: ${h}, expected string, got ${typeof h}`),new Error(`Invalid dependency ${l}: expected string version`);let o=r.length===0?[(0,Xe.join)((0,$n.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Ye.existsSync)(l))){let l=hu(s,"npm"),h=Tl(l);throw g.error(`Missing node_modules folder at ${o.join(", ")}, please run ${l} ${h}`),new Error("Missing node_modules folder")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,h])=>{let d=!1,f=!1;for(let m of o){let y=(0,Xe.join)(m,l);if((0,Ye.existsSync)(y)){d=!0;try{if(r8(y).some(S=>Sle.test(S))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${m}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let m=hu(s,"npm"),y=Tl(m);return g.error(`Missing dependency ${l}, please run ${m} ${y}`),{name:l,version:h}}return{name:l,version:h,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw g.error("Missing dependencies or invalid dependencies"),g.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 Fle(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),s=n;return i||s===null||!s.version||!s.version.checksum?null:s.version.checksum}function Ple(t){if(!t)throw g.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 g.error(`Invalid remote native package data: ${r}, expected object, got ${typeof r}`),new Error("Invalid remote native package data");let{name:n,version:i}=r;if(!n||typeof n!="string")throw g.error(`Invalid remote native package name: ${n}, expected string, got ${typeof n}`),new Error("Invalid remote native package name");if(!i||typeof i!="string")throw g.error(`Invalid remote native package version: ${i}, expected string, got ${typeof i}`),new Error("Invalid remote native package version")}return new Map(t.map(r=>[r.name,r]))}async function n8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
296
296
  native_packages
297
297
  )`).eq("name",r).eq("app_id",e).single();if(i)throw g.error(`Error fetching native packages: ${i.message}`),new Error(`Error fetching native packages: ${i.message}`);return Ple(n.version.native_packages??[])}async function i8(t,e,r,n){let i=Ft();i.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await Fle(t,e,r);if(!s){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(s&&s===n)throw g.error(`Cannot upload the same bundle content.
298
298
  Current bundle checksum matches remote bundle for channel ${r}
299
299
  Did you build your app before uploading?
300
- PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function Re(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function so(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=kl(t.localVersion),r=kl(t.remoteVersion);return m_(e,r)}catch{return!1}}async function Up(t,e,r,n,i){let s=await rv(n,i),o=await n8(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function nv(t,e,r,n){let i=await n8(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function s8(t,e,r){let n=await Lr({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(Tt(n))throw t&&e&&r&&await NT("onboarding-v2",e,r,"canceled","\u{1F937}"),g.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let i=Ln(),s=Ft();s.start("Running the command...");try{await new Promise((o,a)=>{let u=(0,qM.spawn)(i.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?o():a(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{a(c)})}),s.stop("Capacitor sync completed \u2705")}catch(o){s.stop("Error"),g.error(`Failed to run Capacitor sync: ${o}`),g.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=Ln();g.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),g.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function o8(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,{data:o,error:a}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(a)throw i||g.error(`Cannot check Version ${e}@${r.name}: ${W(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${W(a)}`);if(!o?.length)return;if(i)throw new Error(`Version ${e}@${r.name} is used in ${o.length} channel(s)`);oe(`\u274C Version ${e}@${r.name} is used in ${o.length} channel${o.length>1?"s":""}`);let u=s;if(s||(u=await Lr({message:"unlink it?"})===!0),!u)throw g.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of o){let l=Ft();l.start(`Unlinking channel ${c.name}`);let h=await iv(t,e,{silent:i});if(!h)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:h.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${W(d)}`),new Error(`Cannot update channel ${c.name}: ${W(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}ce(`Version unlinked from ${o.length} channel${o.length>1?"s":""}`)}async function iv(t,e,r={}){let{silent:n=!1}=r,i=[3e3,7e3],s;for(let o=0;o<=2;o++){let{data:a,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return a;s=u,o<2&&await new Promise(c=>setTimeout(c,i[o]))}throw n||g.error(`Cannot call findUnknownVersion as it returned an error.
300
+ PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");i.stop(`Checksum compatible with ${r} channel`)}function Re(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function so(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=kl(t.localVersion),r=kl(t.remoteVersion);return m_(e,r)}catch{return!1}}async function Up(t,e,r,n,i){let s=await rv(n,i),o=await n8(t,e,r),a=s.filter(c=>!!c.native).map(c=>{let l=o.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...o].filter(([c])=>s.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:s}}async function nv(t,e,r,n){let i=await n8(t,e,r),s=n.map(a=>{let u=i.get(a.name);return u?{name:a.name,localVersion:a.version,remoteVersion:u.version}:{name:a.name,localVersion:a.version,remoteVersion:void 0}}),o=[...i].filter(([a])=>n.find(u=>u.name===a)===void 0).map(([a,u])=>({name:a,localVersion:void 0,remoteVersion:u.version}));return s.push(...o),{finalCompatibility:s,localDependencies:n}}async function s8(t,e,r){let n=await jr({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(Tt(n))throw t&&e&&r&&await NT("onboarding-v2",e,r,"canceled","\u{1F937}"),g.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let i=Ln(),s=Ft();s.start("Running the command...");try{await new Promise((o,a)=>{let u=(0,qM.spawn)(i.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?o():a(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{a(c)})}),s.stop("Capacitor sync completed \u2705")}catch(o){s.stop("Error"),g.error(`Failed to run Capacitor sync: ${o}`),g.warn(`Please run "${i.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let i=Ln();g.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),g.info(`Remember to run "${i.runner} cap sync" before uploading encrypted bundles`)}}async function o8(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,{data:o,error:a}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(a)throw i||g.error(`Cannot check Version ${e}@${r.name}: ${W(a)}`),new Error(`Cannot check version ${e}@${r.name}: ${W(a)}`);if(!o?.length)return;if(i)throw new Error(`Version ${e}@${r.name} is used in ${o.length} channel(s)`);oe(`\u274C Version ${e}@${r.name} is used in ${o.length} channel${o.length>1?"s":""}`);let u=s;if(s||(u=await jr({message:"unlink it?"})===!0),!u)throw g.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of o){let l=Ft();l.start(`Unlinking channel ${c.name}`);let h=await iv(t,e,{silent:i});if(!h)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:d}=await t.from("channels").update({version:h.id}).eq("id",c.id);if(d)throw l.stop(`Cannot update channel ${c.name} ${W(d)}`),new Error(`Cannot update channel ${c.name}: ${W(d)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}ce(`Version unlinked from ${o.length} channel${o.length>1?"s":""}`)}async function iv(t,e,r={}){let{silent:n=!1}=r,i=[3e3,7e3],s;for(let o=0;o<=2;o++){let{data:a,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return a;s=u,o<2&&await new Promise(c=>setTimeout(c,i[o]))}throw n||g.error(`Cannot call findUnknownVersion as it returned an error.
301
301
  ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}function a8(t,e){return t.from("channels").insert(e).select().single()}function u8(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function c8(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function l8(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function f8(t,e,r){return t.from("channels").select(`
302
302
  id,
303
303
  version (id, name)
@@ -316,11 +316,11 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
316
316
  created_by,
317
317
  app_id,
318
318
  version (id, name)
319
- `).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||g.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function sv(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||g.error(o),new Error(`${o}: ${W(s)}`)}}async function Hp(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Rle(t,e,r,{silent:i});await o8(t,e,o,{silent:i,autoUnlink:s}),await sv(t,e,r,{silent:i})}function p8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new Vt;r.theme=Vt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Qa(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function Vp(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function m8(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function Rle(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||g.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var eu=require("node:fs");async function g8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Dt(t,e,r,n,i=!1){let s=Ln(),o=await GM(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||g.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||g.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||g.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${hr[o.data]}, required for this action: ${hr[n]}.`;throw i||g.error(c),new Error(c)}return o.data}var Jr="assets/icon.png";var kle=/^[a-z0-9]+(\.[\w-]+)+$/i;function Nle(t,e,r){if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||g.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!kle.test(t))throw r||(g.error(`Invalid app ID format: "${t}"`),g.info("App ID must be in reverse domain notation (e.g., com.example.app)"),g.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),g.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function $le(t,e,r){if(await g8(t,e))throw e==="io.ionic.starter"?(r||g.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||g.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function y8(t,e,r,n=!1){n||oe("Adding"),await Ke(),e.apikey=e.apikey||te();let i=await de(),s=Re(t,i?.config);Nle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await $le(o,s,n),r||(r=await qp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||g.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||g.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,eu.existsSync)(l)?(h=(0,eu.readFileSync)(l),d=Za(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,eu.existsSync)(Jr)?(h=(0,eu.readFileSync)(Jr),d=Za(Jr)||"image/png",n||g.warn(`Found app icon ${Jr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Jr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:E}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(E)throw n||console.error(E),n||g.error(`Could not add app ${W(E)}`),new Error(`Could not add app ${W(E)}`);let{data:C}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=C?.publicUrl||m}let{error:y}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(y)throw n||g.error(`Could not add app ${W(y)}`),new Error(`Could not add app ${W(y)}`);return n||(g.success(`App ${s} added to Capgo. You can upload a bundle now`),ce("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function D8(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||te();let i=await de(),s=Re(t,i?.config);if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Dt(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{g.warn("Deleting the app is not recommended for users that are not the organization owner"),g.warn("You are invited as a super_admin but your are not the owner"),g.warn("It's strongly recommended that you do not continue!");let y=await Eo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Tt(y)||y==="no")throw g.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&g.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&g.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&g.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||g.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await on(o,s);return await Ae(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(g.success("App deleted in Capgo"),ce("Done \u2705")),!0}var zp=require("node:os"),E8=require("node:process");async function w8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Lh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function Lle(){let t=await il(),e={"@capgo/cli":Ri.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function b8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=ns("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Re("",r?.config),a=r?.config?.webDir||"";e||(g.info(` App Name: ${s}`),g.info(` App ID: ${o}`),g.info(` App Version: ${i}`),g.info(` Web Dir: ${a}`),g.info(` OS: ${(0,zp.platform)()} ${(0,zp.version)()}`),g.info(` Node: ${E8.version}`),g.info(" Installed Dependencies:"));let u=await Lle();if(Object.keys(u).length===0)throw e||g.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))g.info(` ${l}: ${u[l]}`);let c={};if(e)c=await w8(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await w8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))g.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||g.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||g.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function jle(t){let e=new Vt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Qa(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function Ble(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||g.error("Apps not found"),new Error("Apps not found");return r??[]}async function v8(t,e=!1){e||oe("List apps in Capgo"),await Ke(),t.apikey=t.apikey||te();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||g.info("Getting active bundle in Capgo");let n=await Ble(r,e);if(!n.length)throw e||g.error("No apps found"),new Error("No apps found");return e||(g.info(`Active app in Capgo: ${n.length}`),jle(n),ce("Done \u2705")),n}var _8=require("node:crypto"),tu=require("node:fs");async function C8(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||te();let n=await de();if(t=Re(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await qp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await Dt(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||g.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||g.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||g.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,d,f=`icon_${(0,_8.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,tu.existsSync)(c)?(h=(0,tu.readFileSync)(c),d=Za(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,tu.existsSync)(Jr)?(h=(0,tu.readFileSync)(Jr),d=Za(Jr)||"image/png",r||g.warn(`Found app icon ${Jr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Jr}`),h&&d){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:C}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(f);m=C?.publicUrl||m}let{error:y}=await i.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",a);if(y)throw r||g.error(`Could not set app ${W(y)}`),new Error(`Could not set app: ${W(y)}`);return r||ce("Done \u2705"),!0}async function S8(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||g.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||g.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||g.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||g.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Va(n,!0),r||g.success(`Set "${t}" to "${o}"`)}catch(n){throw r||g.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||ce("Done \u2705")}var x8=require("node:child_process"),is=require("node:fs/promises"),T8=require("node:os"),oo=require("node:path"),I8=Oe(require("node:process"));var Kp=require("node:fs/promises"),A8=require("node:os"),ov=require("node:path"),Me=require("node:process"),Mle=(0,ov.join)((0,A8.homedir)(),".capgo-credentials"),qle=(0,ov.join)(Mle,"credentials.json");async function Ule(){try{let t=await(0,Kp.readFile)(qle,"utf-8");return JSON.parse(t)}catch{return{}}}async function Hle(t){let e=await Ule();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}function Vle(){let t={};return Me.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Me.env.BUILD_CERTIFICATE_BASE64),Me.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Me.env.BUILD_PROVISION_PROFILE_BASE64),Me.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Me.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Me.env.P12_PASSWORD&&(t.P12_PASSWORD=Me.env.P12_PASSWORD),Me.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Me.env.APPLE_KEY_ID),Me.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Me.env.APPLE_ISSUER_ID),Me.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Me.env.APPLE_KEY_CONTENT),Me.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Me.env.APP_STORE_CONNECT_TEAM_ID),Me.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Me.env.ANDROID_KEYSTORE_FILE),Me.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Me.env.KEYSTORE_KEY_ALIAS),Me.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Me.env.KEYSTORE_KEY_PASSWORD),Me.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Me.env.KEYSTORE_STORE_PASSWORD),Me.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Me.env.PLAY_CONFIG_JSON),t}async function O8(t,e,r){let n=await Hle(t),i=Vle(),s={...n?.[e]||{}};if(Object.assign(s,i),r&&Object.assign(s,r),e==="android"){let o=!!s.KEYSTORE_KEY_PASSWORD,a=!!s.KEYSTORE_STORE_PASSWORD;o&&!a?s.KEYSTORE_STORE_PASSWORD=s.KEYSTORE_KEY_PASSWORD:!o&&a&&(s.KEYSTORE_KEY_PASSWORD=s.KEYSTORE_STORE_PASSWORD)}return Object.keys(s).length>0?s:void 0}async function zle(t,e,r,n,i){if(!i)try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok){g.warn("Could not stream logs, continuing...");return}let o=s.body?.getReader();if(!o)return;let a=new TextDecoder;for(;;){let{done:u,value:c}=await o.read();if(u)break;let h=a.decode(c,{stream:!0}).split(`
320
- `);for(let d of h)if(d.startsWith("data: ")){let f=d.slice(6);f.trim()&&g.error(f)}}}catch(s){i||g.warn(`Log streaming interrupted${s instanceof Error?`: ${s.message}`:""}`)}}async function Kle(t,e,r,n,i,s){let a=0;for(;a<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:i}});if(!u.ok){s||g.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),a++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),a++}catch(u){s||g.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||g.warn("Build status polling timed out"),"timeout"}async function Gle(t,e){return new Promise((r,n)=>{let s=(0,x8.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});s.on("error",o=>{o.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(o)}),s.on("close",o=>{o===0?r():n(new Error(`zip process exited with code ${o}`))})})}async function F8(t,e,r=!1){try{e.apikey=e.apikey||te(r);let n=await de();if(t=t||n?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let i=(0,oo.resolve)(e.path||I8.default.cwd()),s=await pe(e.apikey,e.supaHost,e.supaAnon);await De(s,e.apikey,["write","all"]),r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${i}`),g.info(`
319
+ `).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||g.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function sv(t,e,r,n={}){let{silent:i=!1}=n,{error:s}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(s){let o=`App version ${e}@${r} not found in database`;throw i||g.error(o),new Error(`${o}: ${W(s)}`)}}async function Hp(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await Rle(t,e,r,{silent:i});await o8(t,e,o,{silent:i,autoUnlink:s}),await sv(t,e,r,{silent:i})}function p8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new Vt;r.theme=Vt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,Qa(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function Vp(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return i??[]}async function m8(t,e,r={}){let{silent:n=!1}=r,{data:i,error:s}=await t.from("channels").select("version").eq("app_id",e);if(s){let o=`App ${e} not found in database`;throw n||g.error(o),new Error(`${o}: ${W(s)}`)}return(i??[]).map(o=>o.version)}async function Rle(t,e,r,n={}){let{silent:i=!1}=n,{data:s,error:o}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!s||o){let a=`App version ${e}@${r} doesn't exist`;throw i||g.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var eu=require("node:fs");async function g8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Dt(t,e,r,n,i=!1){let s=Ln(),o=await GM(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw i||g.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${s.runner} @capgo/cli app add ${r}\` to create it`;throw i||g.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||g.error(c),new Error(c)}}let a=o.data;if(n>a){let c=`Insuficcent permissions for app ${r}. Current permission: ${hr[o.data]}, required for this action: ${hr[n]}.`;throw i||g.error(c),new Error(c)}return o.data}var Zr="assets/icon.png";var kle=/^[a-z0-9]+(\.[\w-]+)+$/i;function Nle(t,e,r){if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||g.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!kle.test(t))throw r||(g.error(`Invalid app ID format: "${t}"`),g.info("App ID must be in reverse domain notation (e.g., com.example.app)"),g.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),g.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function $le(t,e,r){if(await g8(t,e))throw e==="io.ionic.starter"?(r||g.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||g.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function y8(t,e,r,n=!1){n||oe("Adding"),await Ke(),e.apikey=e.apikey||te();let i=await de(),s=Re(t,i?.config);Nle(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await $le(o,s,n),r||(r=await qp(o,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||i.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||g.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||g.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,eu.existsSync)(l)?(h=(0,eu.readFileSync)(l),d=Za(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,eu.existsSync)(Zr)?(h=(0,eu.readFileSync)(Zr),d=Za(Zr)||"image/png",n||g.warn(`Found app icon ${Zr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Zr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:E}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(E)throw n||console.error(E),n||g.error(`Could not add app ${W(E)}`),new Error(`Could not add app ${W(E)}`);let{data:S}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:y}=await o.from("apps").insert({icon_url:m,owner_org:u,user_id:a,name:c,app_id:s});if(y)throw n||g.error(`Could not add app ${W(y)}`),new Error(`Could not add app ${W(y)}`);return n||(g.success(`App ${s} added to Capgo. You can upload a bundle now`),ce("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function D8(t,e,r=!1,n=!1){r||oe("Deleting"),e.apikey=e.apikey||te();let i=await de(),s=Re(t,i?.config);if(!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await Dt(o,e.apikey,s,5,r);let{data:u,error:c}=await o.from("apps").select("owner_org ( created_by, id )").eq("app_id",s).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==a){if(r)throw new Error("Cannot delete app: you are not the organization owner");{g.warn("Deleting the app is not recommended for users that are not the organization owner"),g.warn("You are invited as a super_admin but your are not the owner"),g.warn("It's strongly recommended that you do not continue!");let y=await Eo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Tt(y)||y==="no")throw g.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&g.warn(`Cannot get the app owner ${W(c)}`);let{error:h}=await o.storage.from("images").remove([`org/${l?.owner_org.id}/${s}/icon`]);h&&!r&&g.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&g.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||g.error("Could not delete app"),new Error(`Could not delete app: ${W(f)}`);let m=await Fr(o,s);return await ve(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(g.success("App deleted in Capgo"),ce("Done \u2705")),!0}var zp=require("node:os"),E8=require("node:process");async function w8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Lh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function Lle(){let t=await il(),e={"@capgo/cli":Ri.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function b8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=ns("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Re("",r?.config),a=r?.config?.webDir||"";e||(g.info(` App Name: ${s}`),g.info(` App ID: ${o}`),g.info(` App Version: ${i}`),g.info(` Web Dir: ${a}`),g.info(` OS: ${(0,zp.platform)()} ${(0,zp.version)()}`),g.info(` Node: ${E8.version}`),g.info(" Installed Dependencies:"));let u=await Lle();if(Object.keys(u).length===0)throw e||g.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))g.info(` ${l}: ${u[l]}`);let c={};if(e)c=await w8(u);else{let l=Ft();l.start("Running: Loading latest dependencies"),c=await w8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))g.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||g.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||g.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:s,appId:o,appVersion:i,webDir:a,installedDependencies:u,latestDependencies:c}}function jle(t){let e=new Vt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,Qa(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function Ble(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||g.error("Apps not found"),new Error("Apps not found");return r??[]}async function v8(t,e=!1){e||oe("List apps in Capgo"),await Ke(),t.apikey=t.apikey||te();let r=await pe(t.apikey,t.supaHost,t.supaAnon);await De(r,t.apikey,["write","all","read","upload"]),e||g.info("Getting active bundle in Capgo");let n=await Ble(r,e);if(!n.length)throw e||g.error("No apps found"),new Error("No apps found");return e||(g.info(`Active app in Capgo: ${n.length}`),jle(n),ce("Done \u2705")),n}var _8=require("node:crypto"),tu=require("node:fs");async function C8(t,e,r=!1){r||oe("Set app"),e.apikey=e.apikey||te();let n=await de();if(t=Re(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),o=(await qp(i,["admin","super_admin"])).gid,a=await De(i,e.apikey,["write","all"]);await Dt(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||g.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||g.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||g.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,d,f=`icon_${(0,_8.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,tu.existsSync)(c)?(h=(0,tu.readFileSync)(c),d=Za(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,tu.existsSync)(Zr)?(h=(0,tu.readFileSync)(Zr),d=Za(Zr)||"image/png",r||g.warn(`Found app icon ${Zr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Zr}`),h&&d){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(f,h,{contentType:d});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:S}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(f);m=S?.publicUrl||m}let{error:y}=await i.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",a);if(y)throw r||g.error(`Could not set app ${W(y)}`),new Error(`Could not set app: ${W(y)}`);return r||ce("Done \u2705"),!0}async function S8(t,e,r=!1){if(r||oe("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||g.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||g.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||g.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await de(),i=n.config,s=t.split(".");if(s.length===0)throw r||g.error("Invalid path"),new Error("Invalid config path");for(let a of s.slice(0,-1))Object.prototype.hasOwnProperty.call(i,a)||(i[a]={}),i=i[a];let o=e.bool?e.bool==="true":e.string;i[s.at(-1)]=o,await Va(n,!0),r||g.success(`Set "${t}" to "${o}"`)}catch(n){throw r||g.error(`Cannot set config in capacitor settings ${W(n)}`),new Error(`Cannot set capacitor config: ${W(n)}`)}r||ce("Done \u2705")}var x8=require("node:child_process"),is=require("node:fs/promises"),T8=require("node:os"),oo=require("node:path"),I8=Oe(require("node:process"));var Kp=require("node:fs/promises"),A8=require("node:os"),ov=require("node:path"),$e=require("node:process"),Mle=(0,ov.join)((0,A8.homedir)(),".capgo-credentials"),qle=(0,ov.join)(Mle,"credentials.json");async function Ule(){try{let t=await(0,Kp.readFile)(qle,"utf-8");return JSON.parse(t)}catch{return{}}}async function Hle(t){let e=await Ule();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}function Vle(){let t={};return $e.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=$e.env.BUILD_CERTIFICATE_BASE64),$e.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=$e.env.BUILD_PROVISION_PROFILE_BASE64),$e.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=$e.env.BUILD_PROVISION_PROFILE_BASE64_PROD),$e.env.P12_PASSWORD&&(t.P12_PASSWORD=$e.env.P12_PASSWORD),$e.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=$e.env.APPLE_KEY_ID),$e.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=$e.env.APPLE_ISSUER_ID),$e.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=$e.env.APPLE_KEY_CONTENT),$e.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=$e.env.APPLE_PROFILE_NAME),$e.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=$e.env.APP_STORE_CONNECT_TEAM_ID),$e.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=$e.env.ANDROID_KEYSTORE_FILE),$e.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=$e.env.KEYSTORE_KEY_ALIAS),$e.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=$e.env.KEYSTORE_KEY_PASSWORD),$e.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=$e.env.KEYSTORE_STORE_PASSWORD),$e.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=$e.env.PLAY_CONFIG_JSON),t}async function O8(t,e,r){let n=await Hle(t),i=Vle(),s={...n?.[e]||{}};if(Object.assign(s,i),r&&Object.assign(s,r),e==="android"){let o=!!s.KEYSTORE_KEY_PASSWORD,a=!!s.KEYSTORE_STORE_PASSWORD;o&&!a?s.KEYSTORE_STORE_PASSWORD=s.KEYSTORE_KEY_PASSWORD:!o&&a&&(s.KEYSTORE_KEY_PASSWORD=s.KEYSTORE_STORE_PASSWORD)}return Object.keys(s).length>0?s:void 0}async function zle(t,e,r,n,i){if(!i)try{let s=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!s.ok){g.warn("Could not stream logs, continuing...");return}let o=s.body?.getReader();if(!o)return;let a=new TextDecoder;for(;;){let{done:u,value:c}=await o.read();if(u)break;let h=a.decode(c,{stream:!0}).split(`
320
+ `);for(let d of h)if(d.startsWith("data: ")){let f=d.slice(6);f.trim()&&g.error(f)}}}catch(s){i||g.warn(`Log streaming interrupted${s instanceof Error?`: ${s.message}`:""}`)}}async function Kle(t,e,r,n,i,s){let a=0;for(;a<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:i}});if(!u.ok){s||g.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),a++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),a++}catch(u){s||g.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||g.warn("Build status polling timed out"),"timeout"}async function Gle(t,e){return new Promise((r,n)=>{let s=(0,x8.spawn)("zip",["-rq",e,"."],{cwd:t,stdio:"inherit"});s.on("error",o=>{o.code==="ENOENT"?n(new Error("zip command not found. Please install zip utility.")):n(o)}),s.on("close",o=>{o===0?r():n(new Error(`zip process exited with code ${o}`))})})}async function F8(t,e,r=!1){let n=Date.now();try{e.apikey=e.apikey||te(r);let i=await de();if(t=t||i?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");let s=(0,oo.resolve)(e.path||I8.default.cwd()),o=await pe(e.apikey,e.supaHost,e.supaAnon);await De(o,e.apikey,["write","all"]);let a=await Fr(o,t);r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${s}`),g.info(`
321
321
  \u{1F512} Security: Credentials are never stored on Capgo servers`),g.info(" They are used only during build and deleted after (max 24h)"),g.info(` Builds sent directly to app stores - Capgo keeps nothing
322
- `));let o={};e.buildCertificateBase64&&(o.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(o.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(o.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(o.P12_PASSWORD=e.p12Password),e.appleKeyId&&(o.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(o.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(o.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(o.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(o.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(o.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let a=!!e.keystoreKeyPassword,u=!!e.keystoreStorePassword;a&&!u?(o.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!a&&u?(o.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):a&&u&&(o.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(o.PLAY_CONFIG_JSON=e.playConfigJson);let c=await O8(t,e.platform,Object.keys(o).length>0?o:void 0),l={app_id:t,platform:e.platform};if(!c)throw r||(g.error("\u274C No credentials found for this app and platform"),g.error(""),g.error("You must provide credentials via:"),g.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),g.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),g.error(" 3. Saved credentials file:"),g.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),g.error(""),g.error("Documentation:"),g.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let h=[];if(e.platform==="ios"?(c.BUILD_CERTIFICATE_BASE64||h.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),c.P12_PASSWORD||h.push("P12_PASSWORD (or --p12-password)"),c.BUILD_PROVISION_PROFILE_BASE64||h.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),c.APPLE_KEY_ID||h.push("APPLE_KEY_ID (or --apple-key-id)"),c.APPLE_ISSUER_ID||h.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),c.APPLE_KEY_CONTENT||h.push("APPLE_KEY_CONTENT (or --apple-key-content)"),c.APP_STORE_CONNECT_TEAM_ID||h.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(c.ANDROID_KEYSTORE_FILE||h.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),c.KEYSTORE_KEY_ALIAS||h.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!c.KEYSTORE_KEY_PASSWORD&&!c.KEYSTORE_STORE_PASSWORD&&h.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!c.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),h.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let C of h)g.error(` \u2022 ${C}`);g.error(""),g.error("Provide credentials via:"),g.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),g.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),g.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),g.error(""),g.error("Documentation:"),g.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${h.join(", ")}`)}l.credentials=c,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||g.info("Requesting build from Capgo...");let d=e.supaHost||"https://api.capgo.app",f=await fetch(`${d}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(l)});if(!f.ok){let C=await f.text();throw new Error(`Failed to request build: ${f.status} - ${C}`)}let m=await f.json();r||(g.success(`Build job created: ${m.job_id}`),g.info(`Status: ${m.status}`));let y=(0,oo.join)((0,T8.tmpdir)(),`capgo-build-${Date.now()}`);await(0,is.mkdir)(y,{recursive:!0});let E=(0,oo.join)(y,`${(0,oo.basename)(i)}.zip`);try{r||g.info(`Zipping project from ${i}...`),await Gle(i,E);let C=await(0,is.stat)(E),A=(C.size/1024/1024).toFixed(2);r||g.success(`Created zip: ${E} (${A} MB)`),r||g.info("Uploading to builder...");let p=await(0,is.readFile)(E),D=await fetch(m.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(C.size)},body:p});if(!D.ok){let b=await D.text();throw new Error(`Upload failed: ${D.status} - ${b}`)}r||g.success("Upload complete!"),r||g.info("Starting build job...");let w=await fetch(`${d}/build/start/${m.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!w.ok){let b=await w.text();throw new Error(`Failed to start build: ${w.status} - ${b}`)}let _=await w.json();r||(g.success("Build started successfully!"),g.info(`Job ID: ${m.job_id}`),g.info(`Streaming build logs...
323
- `)),await zle(d,m.job_id,t,e.apikey,r);let P=await Kle(d,m.job_id,t,e.platform,e.apikey,r);return r||(P==="succeeded"?g.success("Build completed successfully!"):P==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${P}`)),{success:P==="succeeded",jobId:m.job_id,uploadUrl:m.upload_url,status:P||_.status||m.status}}finally{await(0,is.rm)(y,{recursive:!0,force:!0})}}catch(n){let i=n instanceof Error?n.message:String(n);return r||g.error(i),{success:!1,error:i}}}async function Wle(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${Qa(i.created_at)}`),await Hp(e,r,i.name)}function Xle(t,e,r){let n=[];for(let i of t??[]){let s=St(i.name);km(s,e)&&Nm(s,r)&&n.push(i)}return n}async function P8(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await Ke(),e.apikey=e.apikey||te();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Re(t,a?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await Dt(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await Vp(u,t),l=await m8(u,t);if(r||g.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||g.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=St(n),m=d_(f,"major");r||g.info(`Querying available versions in Capgo between ${vi(f)} and ${vi(m)}`),c=Xle(c,f,m),r||g.info(`Active versions in Capgo between ${vi(f)} and ${vi(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(y=>y===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||g.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||p8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await Lr({message:"Do you want to continue removing the versions specified?"});if(Tt(f)||!f)throw g.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||g.success("You have confirmed removal, removing versions now"),await Wle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function R8(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||te()},i=await de(),s=Re(t,i?.config),o=n.channel;if(!o)throw r||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await Dt(a,n.apikey,s,1,r);let u=await Up(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new Vt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=Vt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:y}=d,E=so(d)?l:h;c.rows.push([f,m,y,E])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var mi=require("node:fs");var ss=require("node:buffer"),Ut=require("node:crypto"),k8="aes-128-cbc",pi="base64",Gp=Ut.constants.RSA_PKCS1_PADDING;function Wp(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(pi),i=(0,Ut.privateEncrypt)({key:t,padding:Gp},r).toString(pi);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function ru(t,e,r){let[n]=r.split(":"),i=ss.Buffer.from(n,pi),s=(0,Ut.createCipheriv)(k8,e,i);return s.setAutoPadding(!0),ss.Buffer.concat([s.update(t),s.final()])}function N8(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:Gp},ss.Buffer.from(i,pi)),o=ss.Buffer.from(n,pi),a=(0,Ut.createDecipheriv)(k8,s,o);return a.setAutoPadding(!0),ss.Buffer.concat([a.update(t),a.final()])}function nu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:Gp},ss.Buffer.from(t,pi)).toString(pi)}function $8(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,Ut.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function L8(t,e){return(0,Ut.publicDecrypt)({key:e,padding:Gp},ss.Buffer.from(t,pi)).toString(pi)}function Yle(t,e){let r=t.key||di,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,mi.existsSync)(r)?n=(0,mi.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function j8(t,e,r,n=!1){n||oe("Decrypt zip file");try{if(await Ke(),!(0,mi.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||g.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,mi.existsSync)(di)&&!i.config.plugins?.CapacitorUpdater?.privateKey){let h=`Private Key not found at the path ${di} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Yle(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||g.error(h),new Error(h)}let a=(0,mi.readFileSync)(t),u=N8(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,mi.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Jn(u,"sha256"),d=L8(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||g.error(f),new Error(f)}n||g.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||g.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function B8(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await Dt(s,r.apikey,e,3,n),n||(g.info(`Deleting bundle ${e}@${t} from Capgo`),g.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Hp(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var gi=require("node:fs");function sl(t){console.error(W(t))}async function M8(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(oe("Encryption"),await Ke());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&g.warning("There is still a privateKey in the config"),!(0,gi.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(i?sl({error:"zip_not_found"}):g.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(i?sl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Pr,l=r.keyData||"";if(!(0,gi.existsSync)(c)&&!l)throw n||(i?sl({error:"missing_key"}):(g.warning(`Cannot find a private key at ${c} or as a keyData option`),g.error("Error: Missing key"))),new Error("Missing private key");if((0,gi.existsSync)(c)&&(l=(0,gi.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?sl({error:"invalid_private_key"}):g.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,gi.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=Wp(l),m=ru(h,d,f),y=nu(e,l),E=`${t}_encrypted.zip`;return(0,gi.writeFileSync)(E,m),n||(i?console.log(JSON.stringify({checksum:y,filename:E,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${E}`),ce("Done \u2705"))),{checksum:y,filename:E,ivSessionKey:f}}catch(o){throw n||(r.json?sl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var dq=require("node:crypto"),go=require("node:fs"),Fv=require("node:process");var Xp=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function os(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var jn=class extends Error{};var Jt=class extends jn{},ol=class extends jn{},Yp=class extends jn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Bn=class extends jn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},as=class extends jn{constructor(){super("accessKey is required")}},iu=class extends jn{constructor(){super("secretKey is required")}},al=class extends jn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},yi=class extends jn{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function q8(t){try{let r=os(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",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new yi(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new yi(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function U8(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function H8(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 us(t){return!(!Jle(t)||t.length===0)}function Jle(t){return!(typeof t!="string"||t.length>1024)}function ul(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function ao(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function uv(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 cv(t){return uo(t).slice(0,8)}function lv(t,e){return`${cv(e)}/${t}/s3/aws4_request`}async function Jp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),ul(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Zle=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Zp=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let y=a++;try{if(y==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:ao(A.headers.get("etag")??void 0),versionId:uv(A.headers)};return}y===1&&(u=(await Qle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let E={"Content-Length":String(d.length)};for(let A of Zle){let p=s[A];p&&(E[A]=p)}let C=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(E),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:p}),A});h.push(C.catch(A=>{l||(l=A)}))}catch(E){throw E}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await efe({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Qle(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=os(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function efe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
322
+ `));let u={};e.buildCertificateBase64&&(u.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(u.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(u.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(u.P12_PASSWORD=e.p12Password),e.appleKeyId&&(u.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(u.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(u.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(u.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(u.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(u.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(u.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let c=!!e.keystoreKeyPassword,l=!!e.keystoreStorePassword;c&&!l?(u.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,u.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!c&&l?(u.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,u.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):c&&l&&(u.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,u.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(u.PLAY_CONFIG_JSON=e.playConfigJson);let h=await O8(t,e.platform,Object.keys(u).length>0?u:void 0),d={app_id:t,platform:e.platform};if(!h)throw r||(g.error("\u274C No credentials found for this app and platform"),g.error(""),g.error("You must provide credentials via:"),g.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),g.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),g.error(" 3. Saved credentials file:"),g.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),g.error(""),g.error("Documentation:"),g.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let f=[];if(e.platform==="ios"?(h.BUILD_CERTIFICATE_BASE64||f.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),h.P12_PASSWORD||f.push("P12_PASSWORD (or --p12-password)"),h.BUILD_PROVISION_PROFILE_BASE64||f.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),h.APPLE_KEY_ID||f.push("APPLE_KEY_ID (or --apple-key-id)"),h.APPLE_ISSUER_ID||f.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),h.APPLE_KEY_CONTENT||f.push("APPLE_KEY_CONTENT (or --apple-key-content)"),h.APP_STORE_CONNECT_TEAM_ID||f.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(h.ANDROID_KEYSTORE_FILE||f.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),h.KEYSTORE_KEY_ALIAS||f.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!h.KEYSTORE_KEY_PASSWORD&&!h.KEYSTORE_STORE_PASSWORD&&f.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!h.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),f.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let p of f)g.error(` \u2022 ${p}`);g.error(""),g.error("Provide credentials via:"),g.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),g.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),g.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),g.error(""),g.error("Documentation:"),g.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${f.join(", ")}`)}d.credentials=h,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||g.info("Requesting build from Capgo...");let m=e.supaHost||"https://api.capgo.app",y=await fetch(`${m}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(d)});if(!y.ok){let p=await y.text();throw new Error(`Failed to request build: ${y.status} - ${p}`)}let E=await y.json();r||(g.success(`Build job created: ${E.job_id}`),g.info(`Status: ${E.status}`)),await ve(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:a,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let S=(0,oo.join)((0,T8.tmpdir)(),`capgo-build-${Date.now()}`);await(0,is.mkdir)(S,{recursive:!0});let A=(0,oo.join)(S,`${(0,oo.basename)(s)}.zip`);try{r||g.info(`Zipping project from ${s}...`),await Gle(s,A);let p=await(0,is.stat)(A),D=(p.size/1024/1024).toFixed(2);r||g.success(`Created zip: ${A} (${D} MB)`),r||g.info("Uploading to builder...");let w=await(0,is.readFile)(A),_=await fetch(E.upload_url,{method:"PUT",headers:{"Content-Type":"application/zip","Content-Length":String(p.size)},body:w});if(!_.ok){let I=await _.text();throw new Error(`Upload failed: ${_.status} - ${I}`)}r||g.success("Upload complete!"),r||g.info("Starting build job...");let P=await fetch(`${m}/build/start/${E.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!P.ok){let I=await P.text();throw new Error(`Failed to start build: ${P.status} - ${I}`)}let b=await P.json();r||(g.success("Build started successfully!"),g.info(`Job ID: ${E.job_id}`),g.info(`Streaming build logs...
323
+ `)),await zle(m,E.job_id,t,e.apikey,r);let k=await Kle(m,E.job_id,t,e.platform,e.apikey,r);r||(k==="succeeded"?g.success("Build completed successfully!"):k==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${k}`));let R=((Date.now()-n)/1e3).toFixed(2);return await ve(e.apikey,{channel:"native-builder",event:k==="succeeded"?"Build succeeded":"Build failed",icon:k==="succeeded"?"\u2705":"\u274C",user_id:a,tags:{"app-id":t,platform:e.platform,status:k||"unknown",time:R},notify:!1}).catch(),{success:k==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:k||b.status||E.status}}finally{await(0,is.rm)(S,{recursive:!0,force:!0})}}catch(i){let s=i instanceof Error?i.message:String(i);return r||g.error(s),{success:!1,error:s}}}async function Wle(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${Qa(i.created_at)}`),await Hp(e,r,i.name)}function Xle(t,e,r){let n=[];for(let i of t??[]){let s=St(i.name);km(s,e)&&Nm(s,r)&&n.push(i)}return n}async function P8(t,e,r=!1){r||oe("Cleanup versions in Capgo"),await Ke(),e.apikey=e.apikey||te();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Re(t,a?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]),await Dt(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await Vp(u,t),l=await m8(u,t);if(r||g.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||g.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=St(n),m=d_(f,"major");r||g.info(`Querying available versions in Capgo between ${vi(f)} and ${vi(m)}`),c=Xle(c,f,m),r||g.info(`Active versions in Capgo between ${vi(f)} and ${vi(m)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let m=l.find(y=>y===f.id);d<i||m&&!o?(f.keep=m?"\u2705 (Linked to channel)":"\u2705",d+=1):(f.keep="\u274C",h.push(f))}if(!h.length)return r||g.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:d};if(r||p8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await jr({message:"Do you want to continue removing the versions specified?"});if(Tt(f)||!f)throw g.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||g.success("You have confirmed removal, removing versions now"),await Wle(h,u,t,r),r||ce("Done \u2705"),{removed:h.length,kept:d}}async function R8(t,e,r=!1){r||oe("Check compatibility");let n={...e,apikey:e.apikey||te()},i=await de(),s=Re(t,i?.config),o=n.channel;if(!o)throw r||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||g.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let a=await pe(n.apikey,n.supaHost,n.supaAnon);await De(a,n.apikey,["write","all","read","upload"]),await Dt(a,n.apikey,s,1,r);let u=await Up(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new Vt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=Vt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:m,remoteVersion:y}=d,E=so(d)?l:h;c.rows.push([f,m,y,E])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var mi=require("node:fs");var ss=require("node:buffer"),Ut=require("node:crypto"),k8="aes-128-cbc",pi="base64",Gp=Ut.constants.RSA_PKCS1_PADDING;function Wp(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(pi),i=(0,Ut.privateEncrypt)({key:t,padding:Gp},r).toString(pi);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function ru(t,e,r){let[n]=r.split(":"),i=ss.Buffer.from(n,pi),s=(0,Ut.createCipheriv)(k8,e,i);return s.setAutoPadding(!0),ss.Buffer.concat([s.update(t),s.final()])}function N8(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:Gp},ss.Buffer.from(i,pi)),o=ss.Buffer.from(n,pi),a=(0,Ut.createDecipheriv)(k8,s,o);return a.setAutoPadding(!0),ss.Buffer.concat([a.update(t),a.final()])}function nu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:Gp},ss.Buffer.from(t,pi)).toString(pi)}function $8(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,Ut.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function L8(t,e){return(0,Ut.publicDecrypt)({key:e,padding:Gp},ss.Buffer.from(t,pi)).toString(pi)}function Yle(t,e){let r=t.key||di,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,mi.existsSync)(r)?n=(0,mi.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function j8(t,e,r,n=!1){n||oe("Decrypt zip file");try{if(await Ke(),!(0,mi.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||g.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,mi.existsSync)(di)&&!i.config.plugins?.CapacitorUpdater?.privateKey){let h=`Private Key not found at the path ${di} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Yle(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||g.error(h),new Error(h)}let a=(0,mi.readFileSync)(t),u=N8(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,mi.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await Jn(u,"sha256"),d=L8(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||g.error(f),new Error(f)}n||g.info("Checksum matches")}return n||ce("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||g.error(`Error decrypting zip file ${W(i)}`),i instanceof Error?i:new Error(String(i))}}async function B8(t,e,r,n=!1){n||oe("Delete bundle"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);return await De(s,r.apikey,["write","all"]),await Dt(s,r.apikey,e,3,n),n||(g.info(`Deleting bundle ${e}@${t} from Capgo`),g.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Hp(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),ce("Done")),!0}var gi=require("node:fs");function sl(t){console.error(W(t))}async function M8(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(oe("Encryption"),await Ke());try{let o=await de(),a=!!o.config.plugins?.CapacitorUpdater?.privateKey,u=!!o.config.plugins?.CapacitorUpdater?.publicKey;if(a&&s&&g.warning("There is still a privateKey in the config"),!(0,gi.existsSync)(t)){let S=`Zip not found at the path ${t}`;throw n||(i?sl({error:"zip_not_found"}):g.error(`Error: ${S}`)),new Error(S)}if(!u)throw n||(i?sl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Rr,l=r.keyData||"";if(!(0,gi.existsSync)(c)&&!l)throw n||(i?sl({error:"missing_key"}):(g.warning(`Cannot find a private key at ${c} or as a keyData option`),g.error("Error: Missing key"))),new Error("Missing private key");if((0,gi.existsSync)(c)&&(l=(0,gi.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?sl({error:"invalid_private_key"}):g.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,gi.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=Wp(l),m=ru(h,d,f),y=nu(e,l),E=`${t}_encrypted.zip`;return(0,gi.writeFileSync)(E,m),n||(i?console.log(JSON.stringify({checksum:y,filename:E,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${E}`),ce("Done \u2705"))),{checksum:y,filename:E,ivSessionKey:f}}catch(o){throw n||(r.json?sl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var dq=require("node:crypto"),go=require("node:fs"),Fv=require("node:process");var Xp=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(i,s){let o=0;for(;o<i.length;){let a=e-n,u=Math.min(a,i.length-o);r.set(i.subarray(o,o+u),n),o+=u,n+=u,n===e&&(s.enqueue(r),r=new Uint8Array(e),n=0)}},flush(i){n>0&&i.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function os(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(c()||l("?>"));){let f=s();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function n(){let h=u(/^<([\w-:.]+)\s*/);if(!h)return;let d={name:h[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=s();if(!m)return d;d.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=i();let f;for(;f=n();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function i(){let h=u(/^([^<]*)/);return h?a(h[1]):""}function s(){let h=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(h)return{name:h[1],value:a(o(h[2]))}}function o(h){return h.replace(/^['"]|['"]$/g,"")}function a(h){return h.replaceAll("&lt;","<").replaceAll("&gt;",">").replaceAll("&amp;","&")}function u(h){let d=t.match(h);if(d)return t=t.slice(d[0].length),d}function c(){return t.length===0}function l(h){return t.startsWith(h)}}var jn=class extends Error{};var Jt=class extends jn{},ol=class extends jn{},Yp=class extends jn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Bn=class extends jn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},as=class extends jn{constructor(){super("accessKey is required")}},iu=class extends jn{constructor(){super("secretKey is required")}},al=class extends jn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},yi=class extends jn{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,i={}){super(n),this.statusCode=e,this.code=r,this.key=i.key,this.bucketName=i.bucketName,this.resource=i.resource,this.region=i.region}};async function q8(t){try{let r=os(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",i=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",s=r.children.find(c=>c.name==="Key")?.content,o=r.children.find(c=>c.name==="BucketName")?.content,a=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new yi(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new yi(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function U8(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function H8(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 us(t){return!(!Jle(t)||t.length===0)}function Jle(t){return!(typeof t!="string"||t.length>1024)}function ul(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function ao(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function uv(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 cv(t){return uo(t).slice(0,8)}function lv(t,e){return`${cv(e)}/${t}/s3/aws4_request`}async function Jp(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),ul(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Zle=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],Zp=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:i,metadata:s}){let o,a=1,u,c=[],l,h=[];super({start(){},async write(d,f){let y=a++;try{if(y==1&&d.length<i){let A=await e.makeRequest({method:"PUT",headers:new Headers({...s,"Content-Length":String(d.length)}),bucketName:r,objectName:n,payload:d});o={etag:ao(A.headers.get("etag")??void 0),versionId:uv(A.headers)};return}y===1&&(u=(await Qle({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let E={"Content-Length":String(d.length)};for(let A of Zle){let p=s[A];p&&(E[A]=p)}let S=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(E),bucketName:r,objectName:n,payload:d}).then(A=>{let p=A.headers.get("etag")??"";return p&&(p=p.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:p}),A});h.push(S.catch(A=>{l||(l=A)}))}catch(E){throw E}},async close(){if(!o)if(u){if(await Promise.all(h),l)throw l;c.sort((d,f)=>d.part>f.part?1:-1),o=await efe({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(o===void 0)throw new Error("Result is not ready. await the stream first.");return o}}};async function Qle(t){let e="POST",r=new Headers(t.metadata),s=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),o=os(s).root;if(!o||o.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let a=o.children.find(u=>u.name==="UploadId")?.content;if(!a)throw new Error(`Unable to get UploadId from response: ${s}`);return{uploadId:a}}async function efe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
324
324
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
325
325
  ${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
326
326
  `)}
@@ -329,22 +329,22 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
329
329
  `)+`
330
330
  `,n.join(";").toLowerCase(),i].join(`
331
331
  `)}async function W8(t,e,r){let n=await Jp(t),i=lv(r,e);return[cl,uo(e),i,n].join(`
332
- `)}async function hv(t,e,r){let n=cv(t),i=await lo("AWS4"+r,n),s=await lo(i,e),o=await lo(s,"s3");return await lo(o,"aws4_request")}function dv(t,e,r){return`${t}/${lv(e,r)}`}async function lo(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function X8(t){if(!t.accessKey)throw new as;if(!t.secretKey)throw new iu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new al;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=dv(t.accessKey,t.region,t.date),n=uo(t.date),i={"X-Amz-Algorithm":cl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":cl},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await hv(t.date,t.region,t.secretKey),h=ul(await lo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var rfe=["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"],nfe=5*1024*1024,ife=5*1024*1024*1024,pv=5*1024*1024*1024*1024,ll=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Jt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new ol(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ol(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!U8(n))throw new Jt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Jt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Jt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Jt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Jt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Jt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!H8(r))throw new Yp(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,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)),s.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Jp(r??new Uint8Array);s.set("x-amz-date",uo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await V8({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await q8(d):d.status===301?new yi(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new yi(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!us(e))throw new Bn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof yi&&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,...i}){let s=this.getBucketName(i);if(!us(e))throw new Bn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new as;if(!us(r))throw new Bn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return z8({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}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="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Jt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===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(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=os(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:ao(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let y=f.type==="Object"?f.key:f.prefix,E=m.type==="Object"?m.key:m.prefix;return y>E?1:y<E?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!us(e))throw new Bn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Jt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Jt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Jt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<nfe)throw new Jt("Part size should be greater than 5MB");if(a>ife)throw new Jt("Part size should be less than 6MB");let u=new Xp(a),c=new Zp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=pv),e>pv)throw new TypeError(`size should not be more than ${pv}`);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(!us(e))throw new Bn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of rfe)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:ao(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!us(r))throw new Bn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=os(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:ao(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof yi&&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(!us(e))throw new Bn(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 i=r.requestDate||new Date,s=r.expirySeconds??3600;return X8({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};var fo=require("node:fs"),Qp=require("node:path");function sfe(t,e){return(0,fo.readFileSync)(t,"utf8").includes(e)}function fl(t,e){let r=(0,fo.readdirSync)(t);for(let n of r){let i=(0,Qp.join)(t,n),s=(0,fo.statSync)(i);if(s.isDirectory()){if(fl(i,e))return!0}else if(s.isFile()&&(0,Qp.extname)(i)===".js"&&sfe(i,e))return!0}return!1}function em(t){return(0,fo.readdirSync)(t).indexOf("index.html")>-1}var au=require("node:fs"),iq=require("node:os"),mo=require("node:path"),sq=require("node:process"),um=require("node:stream/consumers"),oq=require("node:zlib");var aq=Oe(nq()),uq=Oe(u0());async function Ehe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var bhe=8192,cq="6.25.0",lq="7.0.35";async function vhe(t){let e=Yr((0,sq.cwd)()),r=await io("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?St(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=n.major===6&&_i(n,St(cq)),s=n.major>=7&&_i(n,St(lq)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function _he(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:aq.isMatch(t,r)}async function Che(t,e,r){let i=(0,au.statSync)(t).size,s=await(0,um.buffer)((0,au.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(_he(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<bhe)return{buffer:s,useBrotli:!1};try{let o=await(0,um.buffer)((0,au.createReadStream)(t).pipe((0,oq.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return g.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function fq(t,e,r,n,i,s){let o=Ft();o.start(i!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let a=await QM(t);if(i==="v2")for(let u of a)u.hash=nu(u.hash,s);return o.stop("Manifest generated successfully"),await Ae(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),a}function She(t){return(0,iq.platform)()!=="win32"?t:mo.win32.normalize(t).split(mo.win32.sep).join(mo.posix.sep)}function Ahe(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&g.warn(`File "${t}" contains spaces in its name.`),e}async function hq(t,e,r,n,i,s,o){let a=Ft();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await En(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await vhe(o);if(d)o.disableBrotli?g.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&g.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${cq} (v6) or ${lq} (v7) or higher.`);let f=e.filter(C=>C.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,E=0;try{a.message(`Uploading ${y} files using TUS protocol`);let C=async _=>{let P=(0,mo.join)(r,_.file),b=She(_.file),k,R=!1;if(o.disableBrotli)k=await(0,um.buffer)((0,au.createReadStream)(P)),R=!1;else{let L=await Che(P,b,o);k=L.buffer,R=L.useBrotli}let I=k;s&&(I=ru(k,s.sessionKey,s.ivSessionKey));let j=b;R&&(j=`${b}.br`,E++);let U=Ahe(j),K=`orgs/${i}/apps/${n}/delta/${_.hash}_${U}`;return await Ehe(c,K)?(m++,Promise.resolve({file_name:U,s3_path:K,file_hash:_.hash})):new Promise((L,S)=>{a.message(`Prepare upload partial file: ${b}`),new uq.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:K},headers:{Authorization:t},onError:F=>{let $=F.toString(),M;try{let G=$.match(/response text: (\{.*?\})/);G&&G[1]&&(M=JSON.parse(G[1]).moreInfo?.requestId)}catch{}let B=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${$}${B}`),S(F)},onProgress(){let F=(m/y*100).toFixed(2);a.message(`Uploading partial update: ${F}%`)},onSuccess(){m++,L({file_name:U,s3_path:K,file_hash:_.hash})}}).start()})},A=500,p=[];for(let _=0;_<e.length;_+=A){let P=e.slice(_,_+A),b=Math.floor(_/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${P.length} files)`);let R=await Promise.all(P.map(I=>C(I)));p.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),E>0&&g.info(`${E} of ${y} files were compressed with brotli and use .br extension`),await Ae(t,{channel:"app",event:`App Partial TUS done${E>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await Ae(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(C){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw g.error(`Error uploading partial update: ${C}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return g.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function wt(t){throw g.error(t),new Error(t)}async function Ohe(t,e){let r=ns("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,dq.randomUUID)().split("-")[0]}`;return Ya.test(n)||wt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function xhe(t){let e=t.apikey||te();return e||wt("Missing API key, you need to provide an API key to upload your bundle"),e}function The(t,e,r){let n=Re(t,r),i=e.path||r?.webDir;return n||wt("Missing argument, you need to provide a appid or be in a capacitor project"),i||wt("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,go.existsSync)(i)||wt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function Ihe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(fl(e,"notifyAppReady")||wt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
333
- If you are sure your app has this code, you can use the --no-code-check option`),em(e)||wt(`index.html is missing in the root folder of ${e}`))}async function Fhe(t,e,r,n,i,s){let o=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),h=!!c&&c.disable_auto_update==="version_number",d,f;if(!l&&c&&c.version&&c.version.native_packages&&!o){let E=Ft();E.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:A}=await Up(t,i,n,r.packageJson,r.nodeModules);if(f=C,d=A,f.find(p=>!so(p)))E.stop(`Bundle NOT compatible with ${n} channel`),g.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,g.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!Ya.test(p))&&wt("Invalid remote min update version, skipping auto setting compatibility"),u=p,E.stop(`Auto set min-update-version to ${u}`)}catch{wt(`Cannot auto set compatibility, invalid data ${c}`)}else E.stop(`Bundle compatible with ${n} channel`)}else o||(g.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await rv(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&wt("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Ya.test(u)||wt(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(E=>!!E.native&&E.native!==void 0).map(E=>[E.name,E])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([E,C])=>({name:E,version:C.version})):void 0,minUpdateVersion:u}}async function Phe(t,e,r,n=!1){let{data:i,error:s}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||s){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),ce("Bundle version already exists - exiting gracefully \u{1F389}"),!0;wt(`Version ${r} already exists ${W(s)}`)}return!1}async function Rhe(t,e,r,n,i,s,o){let a,u,c="",l=null,h="none",d="",f=e.keyV2,m=e.key===!1,y=Ft();y.start(`Zipping bundle from ${t}`),l=await Bp(t),y.message("Calculating checksum");let E=Yr((0,Fv.cwd)()),C=await io("@capgo/capacitor-updater",E,e.packageJson),A=!1,p;try{p=C?St(C):void 0}catch{p=void 0}if(C?p?A=_i(p,St("6.25.0")):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),A=!0):wt("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(f||e.keyDataV2||(0,go.existsSync)(Pr))&&!m||A?c=await Jn(l,"sha256"):c=await Jn(l,"crc32"),y.stop(`Checksum ${A?"SHA256":"CRC32"}: ${c}`),m)g.info("Encryption ignored");else if((f||(0,go.existsSync)(Pr)||e.keyDataV2)&&!e.oldEncryption){let _=typeof f=="string"?f:Pr,P=e.keyDataV2||"";!P&&!(0,go.existsSync)(_)&&wt(`Cannot find private key ${_}`),await Ae(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),P||(P=(0,go.readFileSync)(_).toString()),g.info("Encrypting your bundle with V2");let{sessionKey:b,ivSessionKey:k}=Wp(P),R=ru(l,b,k);c=nu(c,P),a=k,u=b,h="v2",d=P,e.displayIvSession&&g.info(`Your Iv Session key is ${a},
332
+ `)}async function hv(t,e,r){let n=cv(t),i=await lo("AWS4"+r,n),s=await lo(i,e),o=await lo(s,"s3");return await lo(o,"aws4_request")}function dv(t,e,r){return`${t}/${lv(e,r)}`}async function lo(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}async function X8(t){if(!t.accessKey)throw new as;if(!t.secretKey)throw new iu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new al;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=dv(t.accessKey,t.region,t.date),n=uo(t.date),i={"X-Amz-Algorithm":cl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":cl},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:m});let o={expiration:e.toISOString(),conditions:s},a=new TextEncoder().encode(JSON.stringify(o)),u=btoa(String.fromCharCode(...a));i.policy=u;let c=u,l=await hv(t.date,t.region,t.secretKey),h=ul(await lo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var rfe=["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"],nfe=5*1024*1024,ife=5*1024*1024*1024,pv=5*1024*1024*1024*1024,ll=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:i,...s}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||i!==void 0)throw new Jt("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let a=new URL(e);e=a.hostname,r=a.protocol==="https:",n=a.port?parseInt(a.port,10):r?443:80,a.pathname&&a.pathname!=="/"&&(i=a.pathname.endsWith("/")?a.pathname.slice(0,-1):a.pathname)}catch{throw new ol(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ol(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!U8(n))throw new Jt(`Invalid port: ${n}`);if(s.accessKey&&!s.secretKey)throw new Jt("If specifying access key, secret key must also be provided.");if(s.accessKey&&s.accessKey.startsWith("ASIA")&&!s.sessionToken)throw new Jt("If specifying temporary access key, session token must also be provided.");let o=r?443:80;if(this.port=n??o,this.host=e.toLowerCase()+(this.port!==o?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=s.accessKey,this.#e=s.secretKey??"",this.sessionToken=s.sessionToken,this.pathStyle=s.pathStyle??!0,this.pathPrefix=i??"",this.defaultBucket=s.bucket,this.region=s.region,this.pathPrefix){if(!this.pathStyle)throw new Jt("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Jt("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Jt("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!H8(r))throw new Yp(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let s=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,o=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,a=s?`?${s}`:"",u=o+a,c=o.split("/").map(l=>encodeURIComponent(l)).join("/")+a;return{headers:i,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:s,host:o,path:a,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)),s.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await Jp(r??new Uint8Array);s.set("x-amz-date",uo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await V8({headers:s,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let h=`${this.protocol}//${o}${u}`,d=await fetch(h,{method:e,headers:s,body:r});if(d.status!==c)throw d.status>=400?await q8(d):d.status===301?new yi(d.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new yi(d.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${d.status} ${d.statusText}).`);return n.returnBody||await d.body?.getReader().read(),d}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!us(e))throw new Bn(e);let i=r.versionId?{versionId:r.versionId}:{},s=new Headers;r.governanceBypass&&s.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:s,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof yi&&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,...i}){let s=this.getBucketName(i);if(!us(e))throw new Bn(e);let o=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),o.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:s,objectName:e,headers:o,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new as;if(!us(r))throw new Bn(r);let{headers:i,path:s}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),o=n.requestDate??new Date,a=n.expirySeconds??1440*60*7;return z8({protocol:this.protocol,headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:o,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...s}=r,o={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:o,...s})}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="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Jt("pageSize must be between 1 and 1,000.");let s=0;for(;;){let o=e.maxResults?Math.min(i,e.maxResults-s):i;if(o===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(o),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=os(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),h=[];for(let f of l)h.push({type:"CommonPrefix",prefix:f.content??""}),s++;for(let f of c.children.filter(m=>m.name==="Contents"))h.push({type:"Object",key:f.children.find(m=>m.name==="Key")?.content??"",etag:ao(f.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(f.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(m=>m.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,m)=>{let y=f.type==="Object"?f.key:f.prefix,E=m.type==="Object"?m.key:m.prefix;return y>E?1:y<E?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=f}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!us(e))throw new Bn(e);let s,o;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?o=ReadableStream.from([l]):o=new ReadableStream({start(h){h.enqueue(l),h.close()}}),s=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?o=ReadableStream.from([r]):o=new ReadableStream({start(l){l.enqueue(r),l.close()}}),s=r.byteLength;else if(r instanceof ReadableStream)o=r;else throw new Jt("Invalid stream/data type provided.");if(n?.size!==void 0){if(s!==void 0&&n?.size!==s)throw new Jt(`size was specified (${n.size}) but doesn't match auto-detected size (${s}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Jt(`invalid size specified: ${n.size}`);s=n.size}let a=n?.partSize??this.calculatePartSize(s);if(a<nfe)throw new Jt("Part size should be greater than 5MB");if(a>ife)throw new Jt("Part size should be less than 6MB");let u=new Xp(a),c=new Zp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await o.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=pv),e>pv)throw new TypeError(`size should not be more than ${pv}`);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(!us(e))throw new Bn(e);let i={};r?.versionId&&(i.versionId=r.versionId);let s=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i,headers:new Headers(r?.headers)}),o={};for(let a of rfe)s.headers.has(a)&&(o[a]=s.headers.get(a));return s.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(o[u]=s.headers.get(u))}),{type:"Object",key:e,size:parseInt(s.headers.get("content-length")??"",10),metadata:o,lastModified:new Date(s.headers.get("Last-Modified")??"error: missing last modified"),versionId:s.headers.get("x-amz-version-id")||null,etag:ao(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!us(r))throw new Bn(r);let o=`${s}/${e.sourceKey}`;e.sourceVersionId&&(o+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",o);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=os(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let h=l.children.find(f=>f.name==="ETag")?.content??"",d=l.children.find(f=>f.name==="LastModified")?.content;if(d===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:ao(h),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof yi&&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(!us(e))throw new Bn(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 i=r.requestDate||new Date,s=r.expirySeconds??3600;return X8({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:i,expirySeconds:s,conditions:r.conditions,fields:r.fields})}};var fo=require("node:fs"),Qp=require("node:path");function sfe(t,e){return(0,fo.readFileSync)(t,"utf8").includes(e)}function fl(t,e){let r=(0,fo.readdirSync)(t);for(let n of r){let i=(0,Qp.join)(t,n),s=(0,fo.statSync)(i);if(s.isDirectory()){if(fl(i,e))return!0}else if(s.isFile()&&(0,Qp.extname)(i)===".js"&&sfe(i,e))return!0}return!1}function em(t){return(0,fo.readdirSync)(t).indexOf("index.html")>-1}var au=require("node:fs"),iq=require("node:os"),mo=require("node:path"),sq=require("node:process"),um=require("node:stream/consumers"),oq=require("node:zlib");var aq=Oe(nq()),uq=Oe(u0());async function Ehe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var bhe=8192,cq="6.25.0",lq="7.0.35";async function vhe(t){let e=Jr((0,sq.cwd)()),r=await io("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?St(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=n.major===6&&_i(n,St(cq)),s=n.major>=7&&_i(n,St(lq)),o=i||s;return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function _he(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:aq.isMatch(t,r)}async function Che(t,e,r){let i=(0,au.statSync)(t).size,s=await(0,um.buffer)((0,au.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(_he(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<bhe)return{buffer:s,useBrotli:!1};try{let o=await(0,um.buffer)((0,au.createReadStream)(t).pipe((0,oq.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return g.warn(`Brotli compression failed for ${t}: ${o}, using original file`),{buffer:s,useBrotli:!1}}}async function fq(t,e,r,n,i,s){let o=Ft();o.start(i!=="v2"?"Generating the update manifest":"Generating the update manifest with v2 encryption");let a=await QM(t);if(i==="v2")for(let u of a)u.hash=nu(u.hash,s);return o.stop("Manifest generated successfully"),await ve(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),a}function She(t){return(0,iq.platform)()!=="win32"?t:mo.win32.normalize(t).split(mo.win32.sep).join(mo.posix.sep)}function Ahe(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&g.warn(`File "${t}" contains spaces in its name.`),e}async function hq(t,e,r,n,i,s,o){let a=Ft();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await En(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await vhe(o);if(d)o.disableBrotli?g.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&g.info(`Files matching patterns (${o.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${h||"unknown"}). To use Delta updates, please upgrade to version ${cq} (v6) or ${lq} (v7) or higher.`);let f=e.filter(S=>S.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(S=>S.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,E=0;try{a.message(`Uploading ${y} files using TUS protocol`);let S=async _=>{let P=(0,mo.join)(r,_.file),b=She(_.file),k,R=!1;if(o.disableBrotli)k=await(0,um.buffer)((0,au.createReadStream)(P)),R=!1;else{let L=await Che(P,b,o);k=L.buffer,R=L.useBrotli}let I=k;s&&(I=ru(k,s.sessionKey,s.ivSessionKey));let j=b;R&&(j=`${b}.br`,E++);let U=Ahe(j),K=`orgs/${i}/apps/${n}/delta/${_.hash}_${U}`;return await Ehe(c,K)?(m++,Promise.resolve({file_name:U,s3_path:K,file_hash:_.hash})):new Promise((L,C)=>{a.message(`Prepare upload partial file: ${b}`),new uq.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:K},headers:{Authorization:t},onError:F=>{let $=F.toString(),M;try{let G=$.match(/response text: (\{.*?\})/);G&&G[1]&&(M=JSON.parse(G[1]).moreInfo?.requestId)}catch{}let B=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${$}${B}`),C(F)},onProgress(){let F=(m/y*100).toFixed(2);a.message(`Uploading partial update: ${F}%`)},onSuccess(){m++,L({file_name:U,s3_path:K,file_hash:_.hash})}}).start()})},A=500,p=[];for(let _=0;_<e.length;_+=A){let P=e.slice(_,_+A),b=Math.floor(_/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${P.length} files)`);let R=await Promise.all(P.map(I=>S(I)));p.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),E>0&&g.info(`${E} of ${y} files were compressed with brotli and use .br extension`),await ve(t,{channel:"app",event:`App Partial TUS done${E>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await ve(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(S){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${p} seconds)`),l)throw g.error(`Error uploading partial update: ${S}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),S;return g.info(`Error uploading partial update: ${S}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function wt(t){throw g.error(t),new Error(t)}async function Ohe(t,e){let r=ns("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,dq.randomUUID)().split("-")[0]}`;return Ya.test(n)||wt(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function xhe(t){let e=t.apikey||te();return e||wt("Missing API key, you need to provide an API key to upload your bundle"),e}function The(t,e,r){let n=Re(t,r),i=e.path||r?.webDir;return n||wt("Missing argument, you need to provide a appid or be in a capacitor project"),i||wt("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,go.existsSync)(i)||wt(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function Ihe(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(fl(e,"notifyAppReady")||wt(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
333
+ If you are sure your app has this code, you can use the --no-code-check option`),em(e)||wt(`index.html is missing in the root folder of ${e}`))}async function Fhe(t,e,r,n,i,s){let o=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),h=!!c&&c.disable_auto_update==="version_number",d,f;if(!l&&c&&c.version&&c.version.native_packages&&!o){let E=Ft();E.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:S,localDependencies:A}=await Up(t,i,n,r.packageJson,r.nodeModules);if(f=S,d=A,f.find(p=>!so(p)))E.stop(`Bundle NOT compatible with ${n} channel`),g.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,g.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:p}=c.version;(!p||!Ya.test(p))&&wt("Invalid remote min update version, skipping auto setting compatibility"),u=p,E.stop(`Auto set min-update-version to ${u}`)}catch{wt(`Cannot auto set compatibility, invalid data ${c}`)}else E.stop(`Bundle compatible with ${n} channel`)}else o||(g.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await rv(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&wt("You need to provide a min-update-version to upload a bundle to this channel"),u&&(Ya.test(u)||wt(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(E=>!!E.native&&E.native!==void 0).map(E=>[E.name,E])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([E,S])=>({name:E,version:S.version})):void 0,minUpdateVersion:u}}async function Phe(t,e,r,n=!1){let{data:i,error:s}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(i||s){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),ce("Bundle version already exists - exiting gracefully \u{1F389}"),!0;wt(`Version ${r} already exists ${W(s)}`)}return!1}async function Rhe(t,e,r,n,i,s,o){let a,u,c="",l=null,h="none",d="",f=e.keyV2,m=e.key===!1,y=Ft();y.start(`Zipping bundle from ${t}`),l=await Bp(t),y.message("Calculating checksum");let E=Jr((0,Fv.cwd)()),S=await io("@capgo/capacitor-updater",E,e.packageJson),A=!1,p;try{p=S?St(S):void 0}catch{p=void 0}if(S?p?A=_i(p,St("6.25.0")):(S==="link:@capgo/capacitor-updater"||S==="file:.."||S==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),A=!0):wt("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(f||e.keyDataV2||(0,go.existsSync)(Rr))&&!m||A?c=await Jn(l,"sha256"):c=await Jn(l,"crc32"),y.stop(`Checksum ${A?"SHA256":"CRC32"}: ${c}`),m)g.info("Encryption ignored");else if((f||(0,go.existsSync)(Rr)||e.keyDataV2)&&!e.oldEncryption){let _=typeof f=="string"?f:Rr,P=e.keyDataV2||"";!P&&!(0,go.existsSync)(_)&&wt(`Cannot find private key ${_}`),await ve(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),P||(P=(0,go.readFileSync)(_).toString()),g.info("Encrypting your bundle with V2");let{sessionKey:b,ivSessionKey:k}=Wp(P),R=ru(l,b,k);c=nu(c,P),a=k,u=b,h="v2",d=P,e.displayIvSession&&g.info(`Your Iv Session key is ${a},
334
334
  keep it safe, you will need it to decrypt your bundle.
335
335
  It will be also visible in your dashboard
336
336
  `),l=R}let D=Math.floor((l?.byteLength??0)/1024/1024),w=Math.floor(s/1024/1024);return l?.byteLength>s?wt(`The bundle size is ${D} Mb, this is greater than the maximum upload length ${w} Mb, please reduce the size of your bundle`):l?.byteLength>o?(g.warn(`WARNING !!
337
337
  The bundle size is ${D} Mb, this may take a while to download for users
338
338
  `),g.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
339
- `),e.verbose&&(g.info("[Verbose] Bundle size details:"),g.info(` - Actual size: ${D} MB (${l?.byteLength} bytes)`),g.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),g.info(` - Maximum allowed: ${w} MB`),g.info("[Verbose] Sending 'App Too Large' event to analytics...")),await Ae(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),e.verbose&&g.info("[Verbose] Event sent successfully")):e.verbose&&g.info(`[Verbose] Bundle size OK: ${D} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&g.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:a,sessionKey:u,checksum:c,encryptionMethod:h,finalKeyData:d}}async function khe(t,e,r,n,i,s,o,a){let u=Ft();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(g.info("[Verbose] uploadBundleToCapgoCloud called:"),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info(` - App ID: ${r}`),g.info(` - Bundle version: ${n}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
340
- Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await En();if(o.verbose&&g.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?g.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):g.info("Uploading bundle with TUS protocol"),o.verbose&&(g.info("[Verbose] Starting TUS resumable upload..."),g.info(` - Host: ${f.hostWeb}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await e8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&g.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return g.error(`Cannot finish TUS upload ${W(y)}`),o.verbose&&g.info(`[Verbose] Database update failed: ${W(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&g.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&g.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await JM(e,r,n);if(!m)return g.error("Cannot get upload url"),o.verbose&&g.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(g.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),g.info(` - Timeout: ${o.timeout||ev}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,E=setTimeout(()=>y.abort(),o.timeout||ev);try{let C=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(E)}o.verbose&&g.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),o.verbose&&(g.info(`[Verbose] Upload failed after ${y} seconds`),g.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let E=f.message.match(/status: (\d+)/),C=E?E[1]:"unknown";g.error(`Upload failed with status ${C}: ${f.message}`)}catch{g.error(`Upload failed: ${f.message}`)}else o.verbose&&g.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?g.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):g.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&g.info("[Verbose] Cleaning up failed version from database..."),await t8(e,r,n),o.verbose&&g.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(g.info("[Verbose] Upload successful:"),g.info(` - Upload time: ${d} seconds`),g.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info("[Verbose] Sending performance event...")),await Ae(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&g.info("[Verbose] Performance event sent successfully")}async function Nhe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){g.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){g.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){g.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){g.error(`Cannot delete linked bundle on upload ${W(o)}`);return}g.info("Linked bundle deleted")}async function $he(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||wt("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Mp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&wt(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${f.id}`;f?.public?g.info("Your update is now available in your public channel \u{1F389}"):f?.id&&g.info(`Link device to this bundle to try it: ${m}`),r&&g.info(`Bundle url: ${m}`)}else g.warn("The upload key is not allowed to set the version in the channel")}async function Lhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(g.warn("Cannot find default upload channel"),g.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function pq(t,e,r=!1){r||oe(`Uploading with CLI version ${Ri.version}`);let n,i=Ln();await Ke();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(g.info("[Verbose] Starting upload process with options:"),g.info(` - API key: ${e.apikey?"provided":"from saved key"}`),g.info(` - Path: ${e.path||"from capacitor config"}`),g.info(` - Channel: ${e.channel||"from default upload channel"}`),g.info(` - Bundle: ${e.bundle||"auto-detected"}`),g.info(` - External: ${e.external||"false"}`),g.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),g.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),g.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=xhe(e);e.verbose&&g.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&g.info("[Verbose] Capacitor config loaded successfully");let m=await VM();e.verbose&&(g.info("[Verbose] Remote file config retrieved:"),g.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),g.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),g.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),g.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),g.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),g.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:E}=The(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${E}`);let C=await Ohe(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${C}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await HM({version:C}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),Ihe(e,E),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${C} started from path "${E}" to Capgo cloud`);let D=await En();e.verbose&&g.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(g.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&g.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&g.info("[Verbose] Supabase client created successfully");let _=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${_}`);let P=e.channel||await Lhe(y,w,D.hostWeb)||"dev";e.verbose&&g.info(`[Verbose] Target channel: ${P}`);let b=await on(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await WM(w,b,Ri.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await YM(w,b,d,y,!0),e.verbose&&g.info("[Verbose] Plan validation passed"),e.verbose&&g.info("[Verbose] Trial check completed"),e.verbose&&g.info(`[Verbose] Checking compatibility with channel ${P}...`);let{nativePackages:k,minUpdateVersion:R}=await Fhe(w,i,e,P,y,C);e.verbose&&(g.info("[Verbose] Compatibility check completed:"),g.info(` - Native packages: ${k?k.length:0}`),g.info(` - Min update version: ${R||"none"}`)),e.verbose&&g.info(`[Verbose] Checking if version ${C} already exists...`);let I=await Phe(w,y,C,e.versionExistsOk);if(e.verbose&&g.info(`[Verbose] Version exists check: ${I?"yes (skipping)":"no (continuing)"}`),I)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:p,storageProvider:A};e.external&&!e.external.startsWith("https://")&&wt(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(g.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),g.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:C,app_id:y,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:b,user_id:_,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,K="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await Ae(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:b,tags:{"app-id":y},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(g.info("[Verbose] External bundle configured:"),g.info(` - URL: ${e.external}`),g.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),g.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&g.info(`[Verbose] Preparing bundle file from path: ${E}`);let{zipped:$,ivSessionKey:M,checksum:B,sessionKey:G,encryptionMethod:q,finalKeyData:V}=await Rhe(E,e,d,b,y,m.maxUploadLength,m.alertUploadSize);j.session_key=M,j.checksum=B,n=G,U=$,p=q,K=V,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${B}`),g.info(` - Encryption: ${q}`),g.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await i8(w,y,P,B),e.verbose&&g.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&g.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&g.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&g.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&wt("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&p==="v2"&&!e.encryptPartial){let $=Yr((0,Fv.cwd)()),M=await io("@capgo/capacitor-updater",$,e.packageJson),B;try{B=M?St(M):void 0}catch{B=void 0}M&&B&&_i(B,St("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${B} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await fq(E,d,b,y,e.encryptPartial?p:"none",K):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:S}=await tv(w,j);if(S&&wt(`Cannot add bundle ${W(S)}`),e.verbose&&g.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(g.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&&g.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),U&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&wt("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),g.info("Uploading to S3"),e.verbose&&(g.info("[Verbose] S3 configuration:"),g.info(` - Endpoint: ${c}`),g.info(` - Region: ${s}`),g.info(` - Bucket: ${u}`),g.info(` - Port: ${l}`),g.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new ll({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),B=`${y}-${C}`,G=encodeURIComponent(B);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${B}`),await M.putObject(B,Uint8Array.from(U)),j.external_url=`${$}/${G}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await khe(d,w,y,C,b,U,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let B=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(g.info("[Verbose] Starting delta/partial file upload..."),g.info(` - Manifest entries: ${L.length}`),g.info(` - Encryption: ${B?"enabled":"disabled"}`)),$=e.delta?await hq(d,L,E,y,b,B,e):null,e.verbose&&$&&g.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(B){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw B;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(B)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&g.info(`[Verbose] Delta upload error details: ${W(B)}`)}j.storage_provider="r2",j.manifest=$,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await tv(w,j);M&&wt(`Cannot update bundle ${W(M)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let T=await Dt(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${Ja(T,2)?"yes":"no"}`),g.info(` - Write: ${Ja(T,3)?"yes":"no"}`),g.info(` - Admin: ${Ja(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Ja(T,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${P}...`),await Nhe(w,y,P)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),Ja(T,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${C} to channel ${P}...`),await $he(w,d,!!e.bundleUrl,C,P,_,b,y,D,e.selfAssign),e.verbose&&g.info("[Verbose] Channel updated successfully")):g.warn("Cannot set channel as a upload organization member"),e.verbose&&g.info("[Verbose] Sending upload event..."),await Ae(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let F={success:!0,bundle:C,checksum:j.checksum??null,encryptionMethod:p,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&&(g.info("[Verbose] Upload completed successfully:"),g.info(` - Bundle: ${F.bundle}`),g.info(` - Checksum: ${F.checksum}`),g.info(` - Encryption: ${F.encryptionMethod}`),g.info(` - Storage: ${F.storageProvider}`)),r&&!F.skipped&&ce("Time to share your update to the world \u{1F30D}"),F}var mq=require("node:crypto"),cm=require("node:fs"),gq=require("node:process");var jhe=20;function Bhe(t){console.log(JSON.stringify(t,null,2))}function gl(t){console.error(W(t))}async function yq(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Ke();let a=await de(),u=Re(t,a?.config),c=(0,mq.randomUUID)().split("-")[0],l=ns("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Ya.test(i)){let _=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?gl({error:"invalid_semver"}):g.error(_)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let _="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?gl({error:"missing_argument"}):g.error(_)),new Error(_)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!fl(s,"notifyAppReady"))throw r||(n?gl({error:"notifyAppReady_not_in_source_code"}):g.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(!em(s))throw r||(n?gl({error:"index_html_not_found"}):g.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Bp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Yr((0,gq.cwd)()),y=await io("@capgo/capacitor-updater",m,e.packageJson);if(!y){let _="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(_),new Error(_)}let E=!1,C;try{C=y?St(y):void 0}catch{C=void 0}if(C){let _=C.major===6&&_i(C,St("6.25.0")),P=C.major>=7;E=_||P}else y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),E=!0);let A=await Jn(d,e.keyV2||(0,cm.existsSync)(Pr)||E?"sha256":"crc32");f&&f.stop(`Checksum ${E?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>jhe&&o&&(g.warn(`WARNING !!
339
+ `),e.verbose&&(g.info("[Verbose] Bundle size details:"),g.info(` - Actual size: ${D} MB (${l?.byteLength} bytes)`),g.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),g.info(` - Maximum allowed: ${w} MB`),g.info("[Verbose] Sending 'App Too Large' event to analytics...")),await ve(r,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),e.verbose&&g.info("[Verbose] Event sent successfully")):e.verbose&&g.info(`[Verbose] Bundle size OK: ${D} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&g.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:l,ivSessionKey:a,sessionKey:u,checksum:c,encryptionMethod:h,finalKeyData:d}}async function khe(t,e,r,n,i,s,o,a){let u=Ft();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(g.info("[Verbose] uploadBundleToCapgoCloud called:"),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info(` - App ID: ${r}`),g.info(` - Bundle version: ${n}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
340
+ Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await En();if(o.verbose&&g.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?g.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):g.info("Uploading bundle with TUS protocol"),o.verbose&&(g.info("[Verbose] Starting TUS resumable upload..."),g.info(` - Host: ${f.hostWeb}`),g.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await e8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&g.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${i}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(y)return g.error(`Cannot finish TUS upload ${W(y)}`),o.verbose&&g.info(`[Verbose] Database update failed: ${W(y)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&g.info(`[Verbose] Database updated with R2 path: ${m}`)}else{o.verbose&&g.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await JM(e,r,n);if(!m)return g.error("Cannot get upload url"),o.verbose&&g.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(g.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),g.info(` - Timeout: ${o.timeout||ev}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,E=setTimeout(()=>y.abort(),o.timeout||ev);try{let S=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!S.ok)throw new Error(`HTTP error! status: ${S.status}`)}finally{clearTimeout(E)}o.verbose&&g.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let y=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${y} seconds)`),o.verbose&&(g.info(`[Verbose] Upload failed after ${y} seconds`),g.info(`[Verbose] Error type: ${f instanceof Error?"Error":typeof f}`)),f instanceof Error&&f.message.includes("HTTP error"))try{let E=f.message.match(/status: (\d+)/),S=E?E[1]:"unknown";g.error(`Upload failed with status ${S}: ${f.message}`)}catch{g.error(`Upload failed: ${f.message}`)}else o.verbose&&g.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?g.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):g.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&g.info("[Verbose] Cleaning up failed version from database..."),await t8(e,r,n),o.verbose&&g.info("[Verbose] Failed version cleaned up"),f instanceof Error?f:new Error(String(f))}let d=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${d} seconds)`),o.verbose&&(g.info("[Verbose] Upload successful:"),g.info(` - Upload time: ${d} seconds`),g.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),g.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),g.info("[Verbose] Sending performance event...")),await ve(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:d},notify:!1},o.verbose),o.verbose&&g.info("[Verbose] Performance event sent successfully")}async function Nhe(t,e,r){let{data:n,error:i}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(i){g.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){g.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){g.warn("The linked bundle is already deleted");return}let{error:o}=await t.from("app_versions").update({deleted:!0}).eq("id",s.id);if(o){g.error(`Cannot delete linked bundle on upload ${W(o)}`);return}g.info("Linked bundle deleted")}async function $he(t,e,r,n,i,s,o,a,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();l||wt("Cannot get version id, cannot set channel");let{data:h}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(h){let{error:d,data:f}=await Mp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&wt(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/p/${a}/channel/${f.id}`;f?.public?g.info("Your update is now available in your public channel \u{1F389}"):f?.id&&g.info(`Link device to this bundle to try it: ${m}`),r&&g.info(`Bundle url: ${m}`)}else g.warn("The upload key is not allowed to set the version in the channel")}async function Lhe(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(g.warn("Cannot find default upload channel"),g.info(`You can set it here: ${r}/app/p/${t}/settings`),null):i.default_upload_channel}async function pq(t,e,r=!1){r||oe(`Uploading with CLI version ${Ri.version}`);let n,i=Ln();await Ke();let{s3Region:s,s3Apikey:o,s3Apisecret:a,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:h}=e;e.verbose&&(g.info("[Verbose] Starting upload process with options:"),g.info(` - API key: ${e.apikey?"provided":"from saved key"}`),g.info(` - Path: ${e.path||"from capacitor config"}`),g.info(` - Channel: ${e.channel||"from default upload channel"}`),g.info(` - Bundle: ${e.bundle||"auto-detected"}`),g.info(` - External: ${e.external||"false"}`),g.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),g.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),g.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=xhe(e);e.verbose&&g.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&g.info("[Verbose] Capacitor config loaded successfully");let m=await VM();e.verbose&&(g.info("[Verbose] Remote file config retrieved:"),g.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),g.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),g.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),g.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),g.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),g.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:y,path:E}=The(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${E}`);let S=await Ohe(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${S}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await HM({version:S}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),Ihe(e,E),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${S} started from path "${E}" to Capgo cloud`);let D=await En();e.verbose&&g.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(g.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&g.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&g.info("[Verbose] Supabase client created successfully");let _=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${_}`);let P=e.channel||await Lhe(y,w,D.hostWeb)||"dev";e.verbose&&g.info(`[Verbose] Target channel: ${P}`);let b=await Fr(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await WM(w,b,Ri.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await YM(w,b,d,y,!0),e.verbose&&g.info("[Verbose] Plan validation passed"),e.verbose&&g.info("[Verbose] Trial check completed"),e.verbose&&g.info(`[Verbose] Checking compatibility with channel ${P}...`);let{nativePackages:k,minUpdateVersion:R}=await Fhe(w,i,e,P,y,S);e.verbose&&(g.info("[Verbose] Compatibility check completed:"),g.info(` - Native packages: ${k?k.length:0}`),g.info(` - Min update version: ${R||"none"}`)),e.verbose&&g.info(`[Verbose] Checking if version ${S} already exists...`);let I=await Phe(w,y,S,e.versionExistsOk);if(e.verbose&&g.info(`[Verbose] Version exists check: ${I?"yes (skipping)":"no (continuing)"}`),I)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:S,checksum:null,encryptionMethod:p,storageProvider:A};e.external&&!e.external.startsWith("https://")&&wt(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(g.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),g.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:S,app_id:y,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:b,user_id:_,checksum:void 0,link:e.link||null,comment:e.comment||null},U=null,K="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await ve(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:b,tags:{"app-id":y},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(g.info("[Verbose] External bundle configured:"),g.info(` - URL: ${e.external}`),g.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),g.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&g.info(`[Verbose] Preparing bundle file from path: ${E}`);let{zipped:$,ivSessionKey:M,checksum:B,sessionKey:G,encryptionMethod:q,finalKeyData:V}=await Rhe(E,e,d,b,y,m.maxUploadLength,m.alertUploadSize);j.session_key=M,j.checksum=B,n=G,U=$,p=q,K=V,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor(($?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${B}`),g.info(` - Encryption: ${q}`),g.info(` - IV Session Key: ${M?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await i8(w,y,P,B),e.verbose&&g.info("[Verbose] Checksum is unique"))}if(e.zip?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&g.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&g.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&g.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&p==="v1"&&wt("You cannot encrypt the partial update if you are not using the v2 encryption method"),e.delta&&p==="v2"&&!e.encryptPartial){let $=Jr((0,Fv.cwd)()),M=await io("@capgo/capacitor-updater",$,e.packageJson),B;try{B=M?St(M):void 0}catch{B=void 0}M&&B&&_i(B,St("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${B} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let L=e.delta?await fq(E,d,b,y,e.encryptPartial?p:"none",K):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${L.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:C}=await tv(w,j);if(C&&wt(`Cannot add bundle ${W(C)}`),e.verbose&&g.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(g.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&&g.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),U&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&wt("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),g.info("Uploading to S3"),e.verbose&&(g.info("[Verbose] S3 configuration:"),g.info(` - Endpoint: ${c}`),g.info(` - Region: ${s}`),g.info(` - Bucket: ${u}`),g.info(` - Port: ${l}`),g.info(` - SSL: ${h?"enabled":"disabled"}`));let $=h?`https://${c}`:`http://${c}`,M=new ll({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),B=`${y}-${S}`,G=encodeURIComponent(B);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${B}`),await M.putObject(B,Uint8Array.from(U)),j.external_url=`${$}/${G}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(U){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await khe(d,w,y,S,b,U,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let $=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let B=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(g.info("[Verbose] Starting delta/partial file upload..."),g.info(` - Manifest entries: ${L.length}`),g.info(` - Encryption: ${B?"enabled":"disabled"}`)),$=e.delta?await hq(d,L,E,y,b,B,e):null,e.verbose&&$&&g.info(`[Verbose] Delta upload complete with ${$.length} files`)}catch(B){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw B;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(B)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&g.info(`[Verbose] Delta upload error details: ${W(B)}`)}j.storage_provider="r2",j.manifest=$,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:M}=await tv(w,j);M&&wt(`Cannot update bundle ${W(M)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let T=await Dt(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${Ja(T,2)?"yes":"no"}`),g.info(` - Write: ${Ja(T,3)?"yes":"no"}`),g.info(` - Admin: ${Ja(T,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&Ja(T,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${P}...`),await Nhe(w,y,P)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),Ja(T,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${S} to channel ${P}...`),await $he(w,d,!!e.bundleUrl,S,P,_,b,y,D,e.selfAssign),e.verbose&&g.info("[Verbose] Channel updated successfully")):g.warn("Cannot set channel as a upload organization member"),e.verbose&&g.info("[Verbose] Sending upload event..."),await ve(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let F={success:!0,bundle:S,checksum:j.checksum??null,encryptionMethod:p,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&&(g.info("[Verbose] Upload completed successfully:"),g.info(` - Bundle: ${F.bundle}`),g.info(` - Checksum: ${F.checksum}`),g.info(` - Encryption: ${F.encryptionMethod}`),g.info(` - Storage: ${F.storageProvider}`)),r&&!F.skipped&&ce("Time to share your update to the world \u{1F30D}"),F}var mq=require("node:crypto"),cm=require("node:fs"),gq=require("node:process");var jhe=20;function Bhe(t){console.log(JSON.stringify(t,null,2))}function gl(t){console.error(W(t))}async function yq(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Ke();let a=await de(),u=Re(t,a?.config),c=(0,mq.randomUUID)().split("-")[0],l=ns("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&oe(`Zipping ${u}@${i}`),i&&!Ya.test(i)){let _=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?gl({error:"invalid_semver"}):g.error(_)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let _="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?gl({error:"missing_argument"}):g.error(_)),new Error(_)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!fl(s,"notifyAppReady"))throw r||(n?gl({error:"notifyAppReady_not_in_source_code"}):g.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(!em(s))throw r||(n?gl({error:"index_html_not_found"}):g.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Bp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ft():null;f&&f.start("Calculating checksum");let m=Jr((0,gq.cwd)()),y=await io("@capgo/capacitor-updater",m,e.packageJson);if(!y){let _="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(_),new Error(_)}let E=!1,S;try{S=y?St(y):void 0}catch{S=void 0}if(S){let _=S.major===6&&_i(S,St("6.25.0")),P=S.major>=7;E=_||P}else y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),E=!0);let A=await Jn(d,e.keyV2||(0,cm.existsSync)(Rr)||E?"sha256":"crc32");f&&f.stop(`Checksum ${E?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>jhe&&o&&(g.warn(`WARNING !!
341
341
  The bundle size is ${p} Mb, this may take a while to download for users
342
342
  `),g.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
343
- `));let D=o?Ft():null,w=e.name||`${u}_${i}.zip`;return D&&D.start(`Saving to ${w}`),(0,cm.writeFileSync)(w,d),D&&D.stop(`Saved to ${w}`),o&&ce("Done \u2705"),!r&&n&&Bhe({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?gl(a):g.error(W(a))),a instanceof Error?a:new Error(String(a))}}async function Dq(t,e,r,n=!1){n||oe("Create channel"),r.apikey=r.apikey||te();let i=await de().catch(()=>{});if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);await De(s,r.apikey,["write","all"]),await Dt(s,r.apikey,e,4,n),n||g.info(`Creating channel ${e}#${t} to Capgo`);let o=await iv(s,e);if(!o)throw n||g.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let a=await on(s,e),u=await De(s,r.apikey,["write","all"]),c=await a8(s,{name:t,app_id:e,version:o.id,created_by:u,owner_org:a,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||g.error(`Cannot create Channel \u{1F640}
344
- ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await Ae(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function wq(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||te(i);let s=await de();if(e=Re(e,s?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await Dt(o,r.apikey,e,1,n),!t)throw n||g.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||g.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}=a[0];if(!c)throw n||g.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||(i?g.info(c.name):g.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function Eq(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await Dt(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await f8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await sv(s,e,d.name)}let{data:a,error:u}=await c8(s,e,t);if(u||!a){if(n||g.error(`Channel ${t} not found`),r.successIfNotFound)return n||g.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await l8(s,e,a.id);if(c)throw n||g.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||g.info(`Deleting channel ${e}#${t} from Capgo`);let l=await u8(s,t,e,o);if(l.error)throw n||g.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await on(s,e);return await Ae(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel deleted"),ce("Done \u2705")),!0}async function bq(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||te();let n=await de();if(t=Re(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await Dt(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await d8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),h8(o)),await Ae(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||ce("Done \u2705"),o}var vq=["major","minor","metadata","patch","none"];async function _q(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await Dt(s,r.apikey,e,4,n);let a=await on(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:y,disableAutoUpdate:E,dev:C,emulator:A}=r;if(h&&u)throw n||g.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||g.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||g.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&&h==null&&d==null&&l==null&&f==null&&m==null&&y==null&&C==null&&A==null&&E==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await XM(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:D}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(D)throw n||g.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||ns("",r.packageJson):u;if(w!=null){let{data:P,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(b||!P)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await nv(s,e,t,P.native_packages??[]),I=Ln();if(R.length>0&&k.some(j=>!so(j)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${I.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(R.length===0&&k.length>0?g.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):g.info(`Bundle is compatible with ${t} channel`))}n||g.info(`Set ${e} channel: ${t} to @${w}`),p.version=P.id}if(d){let{data:P,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(b||!P)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await nv(s,e,t,P.native_packages??[]),R=Ln();if(k.some(I=>!so(I)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||g.info(`Set ${e} channel: ${t} to @${P.name}`),p.version=P.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||g.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||g.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||g.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||g.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||g.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),y!=null&&(n||g.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!y),C!=null&&(n||g.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),p.allow_dev=!!C),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),E!=null){let P=E.toLowerCase();if(!vq.includes(P))throw n||g.error(`Channel strategy ${P} is not known. The possible values are: ${vq.join(", ")}.`),new Error(`Unknown channel strategy ${P}`);P==="metadata"&&(P="version_number"),p.disable_auto_update=P,n||g.info(`Set ${e} channel: ${t} to ${P} disable update strategy to this channel`)}let{error:_}=await Mp(s,p);if(_)throw n||g.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 Ae(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||ce("Done \u2705"),!0}var dr=require("node:fs");function Cq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function Sq(t,e=!1){e||oe("Save keys \u{1F511}");let r=await de(),n=t.key||di,i=t.keyData||"";if(!(0,dr.existsSync)(n)&&!i)throw e||g.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,dr.existsSync)(n)&&(i=(0,dr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||g.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=Cq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Lr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Va(r)}return e||(g.success(`Public key saved into ${r.path} file in local directory`),g.success("Your app will decode the zip archive with this key")),!0}async function Aq(t,e=!1){e||oe("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Va(r),(0,dr.existsSync)(Xa))try{(0,dr.unlinkSync)(Xa),e||g.success(`Old private key file deleted: ${Xa}`)}catch(i){e||g.error(`Failed to delete old private key file: ${Xa} (${String(i)})`)}if((0,dr.existsSync)($p))try{(0,dr.unlinkSync)($p),e||g.success(`Old public key file deleted: ${$p}`)}catch(i){e||g.error(`Failed to delete old public key file: ${di} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function Oq(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=$8();if((0,dr.existsSync)(di)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(di,r),(0,dr.existsSync)(Pr)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)(Pr,n);let i=await de();if(i){let s=Cq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Lr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Va(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${Pr}`),g.success("This key will be used to encrypt your bundle before sending it to Capgo"),g.success("Keep it safe"),g.success("Then make it unreadable by Capgo and unmodifiable by anyone"),g.success(`Public key saved in ${i.path}`),g.success("Your app will be the only one having it"),g.success("Only your users can decrypt your update"),g.success("Only you can send them an update");try{await s8(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var yo=require("node:fs"),xq=require("node:os");async function Tq(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ke();let{local:n}=e;if(n){if(!(0,yo.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,yo.writeFileSync)(".capgo",`${t}
343
+ `));let D=o?Ft():null,w=e.name||`${u}_${i}.zip`;return D&&D.start(`Saving to ${w}`),(0,cm.writeFileSync)(w,d),D&&D.stop(`Saved to ${w}`),o&&ce("Done \u2705"),!r&&n&&Bhe({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?gl(a):g.error(W(a))),a instanceof Error?a:new Error(String(a))}}async function Dq(t,e,r,n=!1){n||oe("Create channel"),r.apikey=r.apikey||te();let i=await de().catch(()=>{});if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon);await De(s,r.apikey,["write","all"]),await Dt(s,r.apikey,e,4,n),n||g.info(`Creating channel ${e}#${t} to Capgo`);let o=await iv(s,e);if(!o)throw n||g.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let a=await Fr(s,e),u=await De(s,r.apikey,["write","all"]),c=await a8(s,{name:t,app_id:e,version:o.id,created_by:u,owner_org:a,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||g.error(`Cannot create Channel \u{1F640}
344
+ ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await ve(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:a,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel created \u2705"),ce("Done \u2705")),c.data??!0}async function wq(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&oe("List current bundle"),r.apikey=r.apikey||te(i);let s=await de();if(e=Re(e,s?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await pe(r.apikey,r.supaHost,r.supaAnon);if(await De(o,r.apikey,["write","all","read"]),await Dt(o,r.apikey,e,1,n),!t)throw n||g.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:a,error:u}=await o.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!a?.length)throw n||g.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}=a[0];if(!c)throw n||g.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||(i?g.info(c.name):g.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function Eq(t,e,r,n=!1){n||oe("Delete channel"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["all"]);if(await Dt(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await f8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await sv(s,e,d.name)}let{data:a,error:u}=await c8(s,e,t);if(u||!a){if(n||g.error(`Channel ${t} not found`),r.successIfNotFound)return n||g.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await l8(s,e,a.id);if(c)throw n||g.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||g.info(`Deleting channel ${e}#${t} from Capgo`);let l=await u8(s,t,e,o);if(l.error)throw n||g.error(`Cannot delete Channel \u{1F640} ${W(l.error)}`),new Error(`Cannot delete channel: ${W(l.error)}`);let h=await Fr(s,e);return await ve(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:h,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(g.success("Channel deleted"),ce("Done \u2705")),!0}async function bq(t,e,r=!1){r||oe("List channels"),e.apikey=e.apikey||te();let n=await de();if(t=Re(t,n?.config),!e.apikey)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await pe(e.apikey,e.supaHost,e.supaAnon),s=await De(i,e.apikey,["write","all","read","upload"]);await Dt(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await d8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),h8(o)),await ve(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||ce("Done \u2705"),o}var vq=["major","minor","metadata","patch","none"];async function _q(t,e,r,n=!1){n||oe("Set channel"),r.apikey=r.apikey||te();let i=await de();if(e=Re(e,i?.config),!r.apikey)throw n||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||g.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||g.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let s=await pe(r.apikey,r.supaHost,r.supaAnon),o=await De(s,r.apikey,["write","all"]);await Dt(s,r.apikey,e,4,n);let a=await Fr(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:y,disableAutoUpdate:E,dev:S,emulator:A}=r;if(h&&u)throw n||g.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||g.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(d&&h)throw n||g.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&&h==null&&d==null&&l==null&&f==null&&m==null&&y==null&&S==null&&A==null&&E==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await XM(s,a,r.apikey,e);let p={created_by:o,app_id:e,name:t,owner_org:a,version:void 0},{error:D}=await s.from("channels").select().eq("app_id",e).eq("name",t).single();if(D)throw n||g.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||ns("",r.packageJson):u;if(w!=null){let{data:P,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(b||!P)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await nv(s,e,t,P.native_packages??[]),I=Ln();if(R.length>0&&k.some(j=>!so(j)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${I.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(R.length===0&&k.length>0?g.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):g.info(`Bundle is compatible with ${t} channel`))}n||g.info(`Set ${e} channel: ${t} to @${w}`),p.version=P.id}if(d){let{data:P,error:b}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(b||!P)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await nv(s,e,t,P.native_packages??[]),R=Ln();if(k.some(I=>!so(I)))throw n||(g.warn(`Bundle NOT compatible with ${t} channel`),g.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||g.info(`Set ${e} channel: ${t} to @${P.name}`),p.version=P.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||g.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||g.info(`Set ${e} channel: ${t} to ${c}`),p.public=c==="default"}if(l!=null&&(n||g.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),p.disable_auto_update_under_native=!l),f!=null&&(n||g.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),p.ios=!!f),m!=null&&(n||g.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),p.android=!!m),y!=null&&(n||g.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),p.allow_device_self_set=!!y),S!=null&&(n||g.info(`Set ${e} channel: ${t} to ${S?"allow":"disallow"} dev devices`),p.allow_dev=!!S),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),E!=null){let P=E.toLowerCase();if(!vq.includes(P))throw n||g.error(`Channel strategy ${P} is not known. The possible values are: ${vq.join(", ")}.`),new Error(`Unknown channel strategy ${P}`);P==="metadata"&&(P="version_number"),p.disable_auto_update=P,n||g.info(`Set ${e} channel: ${t} to ${P} disable update strategy to this channel`)}let{error:_}=await Mp(s,p);if(_)throw n||g.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 ve(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||ce("Done \u2705"),!0}var dr=require("node:fs");function Cq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function Sq(t,e=!1){e||oe("Save keys \u{1F511}");let r=await de(),n=t.key||di,i=t.keyData||"";if(!(0,dr.existsSync)(n)&&!i)throw e||g.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,dr.existsSync)(n)&&(i=(0,dr.readFileSync)(n,"utf8")),!i.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||g.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let s=Cq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await jr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=i,await Va(r)}return e||(g.success(`Public key saved into ${r.path} file in local directory`),g.success("Your app will decode the zip archive with this key")),!0}async function Aq(t,e=!1){e||oe("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Va(r),(0,dr.existsSync)(Xa))try{(0,dr.unlinkSync)(Xa),e||g.success(`Old private key file deleted: ${Xa}`)}catch(i){e||g.error(`Failed to delete old private key file: ${Xa} (${String(i)})`)}if((0,dr.existsSync)($p))try{(0,dr.unlinkSync)($p),e||g.success(`Old public key file deleted: ${$p}`)}catch(i){e||g.error(`Failed to delete old public key file: ${di} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),ce("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function Oq(t,e=!1){e||oe("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=$8();if((0,dr.existsSync)(di)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(di,r),(0,dr.existsSync)(Rr)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)(Rr,n);let i=await de();if(i){let s=Cq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await jr({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(s.defaultChannel="encryption_v2")),s.publicKey=r,await Va(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${Rr}`),g.success("This key will be used to encrypt your bundle before sending it to Capgo"),g.success("Keep it safe"),g.success("Then make it unreadable by Capgo and unmodifiable by anyone"),g.success(`Public key saved in ${i.path}`),g.success("Your app will be the only one having it"),g.success("Only your users can decrypt your update"),g.success("Only you can send them an update");try{await s8(),ce("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var yo=require("node:fs"),xq=require("node:os");async function Tq(t,e,r=!1){if(r||oe("Login to Capgo"),!t)throw r||g.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await Ke();let{local:n}=e;if(n){if(!(0,yo.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,yo.writeFileSync)(".capgo",`${t}
345
345
  `),(0,yo.appendFileSync)(".gitignore",`.capgo
346
346
  `)}else{let o=(0,xq.homedir)();(0,yo.writeFileSync)(`${o}/.capgo`,`${t}
347
- `)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await Ae(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),r||(g.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function Iq(t,e=!1){e||oe("Adding organization"),await Ke();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["write","all"]),{name:s,email:o}=r;if(!e&&!s){let c=await wo({message:"Organization name:",placeholder:"My Organization"});if(Tt(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await wo({message:"Management email:",placeholder:"admin@example.com"});if(Tt(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||g.info(`Adding organization "${s}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:s,management_email:o,created_by:i}).select().single();if(u)throw e||g.error(`Could not add organization ${W(u)}`),new Error(`Could not add organization: ${W(u)}`);return await Ae(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":s},notify:!1}).catch(()=>{}),e||(g.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function Fq(t,e,r=!1){r||oe("Deleting organization"),await Ke();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon),s=await De(i,n.apikey,["write","all"]),{data:o,error:a}=await i.from("orgs").select("created_by, name").eq("id",t).single();if(a||!o)throw r||g.error(`Cannot get organization details ${W(a)}`),new Error(`Cannot get organization details: ${W(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");g.warn("Deleting an organization is restricted to the organization owner"),g.warn("You are not the owner of this organization"),g.warn("It's strongly recommended that you do not continue!");let c=await Eo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Tt(c)||c==="no")throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await Lr({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(Tt(c)||!c)throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||g.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||g.error(`Could not delete organization ${W(u)}`),new Error(`Could not delete organization: ${W(u)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":o.name},notify:!1}).catch(()=>{}),r||(g.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function Mhe(t,e){if(e)return;if(!t.length){g.error("No organizations found");return}let r=new Vt;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"]);g.success("Organizations"),g.success(r.toString())}async function Pq(t,e=!1){e||oe("List organizations"),await Ke();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon);await De(n,r.apikey,["read","write","all"]),e||g.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||g.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(g.info(`Organizations found: ${o.length}`),Mhe(o,e),ce("Done \u2705")),o}async function Rq(t,e,r=!1){r||oe("Updating organization"),await Ke();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon);await De(i,n.apikey,["write","all"]);let{data:s,error:o}=await i.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(o||!s)throw r||g.error(`Cannot get organization details ${W(o)}`),new Error(`Cannot get organization details: ${W(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await wo({message:"New organization name:",placeholder:s.name||"My Organization"});if(Tt(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await wo({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(Tt(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||g.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||g.error(`Could not update organization ${W(c)}`),new Error(`Could not update organization: ${W(c)}`);return await Ae(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(g.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function kq(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.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 pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["read","all","write"]);return e||ce(`Done \u2705: ${i}`),i}catch(n){throw e||g.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var rt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await Tq(e.apikey,{local:e.local??!1,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async doctor(e){try{return{success:!0,data:await b8({packageJson:e?.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await y8(e.appId,r,void 0,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await C8(e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteApp(e,r=!1){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await D8(e,n,!1,r),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async listApps(){try{let e={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await v8(e,!1)).map(i=>({appId:i.app_id,name:i.name||"Unknown",iconUrl:i.icon_url||void 0,createdAt:new Date(i.created_at||"")}))}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}async getAccountId(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await kq(r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async checkBundleCompatibility(e){try{let r={apikey:e.apikey||this.apikey||te(!0),channel:e.channel,text:e.textOutput??!1,packageJson:e.packageJson,nodeModules:e.nodeModules,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon};return{success:!0,data:(await R8(e.appId,r,!0)).finalCompatibility}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async encryptBundle(e){try{return{success:!0,data:await M8(e.zipPath,e.checksum,{key:e.keyPath,keyData:e.keyData,json:e.json},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async decryptBundle(e){try{return{success:!0,data:await j8(e.zipPath,e.ivSessionKey,{key:e.keyPath,keyData:e.keyData,checksum:e.checksum},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async zipBundle(e){try{return{success:!0,data:await yq(e.appId,{apikey:this.apikey||te(!0),path:e.path,bundle:e.bundle,name:e.name,codeCheck:e.codeCheck,json:e.json,keyV2:e.keyV2,packageJson:e.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async uploadBundle(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,bundle:e.bundle,channel:e.channel,external:e.external,key:e.encrypt!==!1,keyV2:e.encryptionKey,timeout:e.timeout,tus:e.useTus,comment:e.comment,minUpdateVersion:e.minUpdateVersion,autoMinUpdateVersion:e.autoMinUpdateVersion,selfAssign:e.selfAssign,packageJson:e.packageJsonPaths,ignoreMetadataCheck:e.ignoreCompatibilityCheck,codeCheck:!e.disableCodeCheck,zip:e.useZip},n=await pq(e.appId,r,!0);return{success:n.success,bundleId:n.bundle,checksum:n.checksum??null,encryptionMethod:n.encryptionMethod,sessionKey:n.sessionKey,ivSessionKey:n.ivSessionKey,storageProvider:n.storageProvider,skipped:n.skipped,reason:n.reason}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listBundles(e){try{let r=this.apikey||te(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await Vp(n,e)).map(o=>({id:o.id.toString(),version:o.name,uploadedAt:new Date(o.created_at||""),size:0,encrypted:o.session_key!==null}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteBundle(e,r){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await B8(r,e,n,!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async cleanupBundles(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle||"",version:"",keep:e.keep||4,force:e.force||!1,ignoreChannel:e.ignoreChannel||!1};return{success:!0,data:await P8(e.appId,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async requestBuild(e){try{let r=e.credentials,n={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,platform:e.platform,userId:e.userId,buildCertificateBase64:r?.BUILD_CERTIFICATE_BASE64,buildProvisionProfileBase64:r?.BUILD_PROVISION_PROFILE_BASE64,buildProvisionProfileBase64Prod:r?.BUILD_PROVISION_PROFILE_BASE64_PROD,p12Password:r?.P12_PASSWORD,appleKeyId:r?.APPLE_KEY_ID,appleIssuerId:r?.APPLE_ISSUER_ID,appleKeyContent:r?.APPLE_KEY_CONTENT,appStoreConnectTeamId:r?.APP_STORE_CONNECT_TEAM_ID,androidKeystoreFile:r?.ANDROID_KEYSTORE_FILE,keystoreKeyAlias:r?.KEYSTORE_KEY_ALIAS,keystoreKeyPassword:r?.KEYSTORE_KEY_PASSWORD,keystoreStorePassword:r?.KEYSTORE_STORE_PASSWORD,playConfigJson:r?.PLAY_CONFIG_JSON},i=await F8(e.appId,n,!0);return i.success&&i.jobId?{success:!0,data:{jobId:i.jobId,uploadUrl:i.uploadUrl||"",status:i.status||"unknown"}}:{success:!1,error:i.error||"Unknown error during build request"}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async getCurrentBundle(e,r,n){try{let i={apikey:n?.apikey||this.apikey||te(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await wq(r,e,i,!0)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async addChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await Dq(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle??void 0,state:e.state,downgrade:e.downgrade,ios:e.ios,android:e.android,selfAssign:e.selfAssign,disableAutoUpdate:e.disableAutoUpdate??void 0,dev:e.dev,emulator:e.emulator,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await _q(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteChannel(e,r,n=!1){try{let i={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await Eq(e,r,i,!0),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async listChannels(e){try{let r={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await bq(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await Oq({force:e?.force,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async saveEncryptionKey(e){try{return await Sq({key:e?.keyPath,keyData:e?.keyData,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteLegacyEncryptionKey(e){try{return{success:!0,data:{deleted:await Aq({force:e?.force,setupChannel:e?.setupChannel},!0)}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listOrganizations(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await Pq(r,!0)).map(s=>({id:String(s.id??s.gid??""),name:s.name??"Unknown",role:s.role??void 0,appCount:typeof s.app_count=="number"?s.app_count:void 0,email:s.management_email??void 0,createdAt:s.created_at?new Date(s.created_at):void 0}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Iq(r,!0);return{success:!0,data:{id:String(n.id??n.gid??""),name:n.name??e.name,role:"owner",appCount:0,email:n.management_email??e.email,createdAt:n.created_at?new Date(n.created_at):void 0}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Rq(e.orgId,r,!0);return{success:!0,data:{id:n.orgId,name:n.name,email:n.email}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteOrganization(e,r){try{let n={apikey:r?.apikey||this.apikey||te(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await Fq(e,n,!0)}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async getStats(e){try{let r=e.apikey||this.apikey||te(!0),n=await En(),i={appId:e.appId,devicesId:e.deviceIds,search:e.search,order:e.order,rangeStart:e.after||e.rangeStart,rangeEnd:e.rangeEnd,limit:e.limit},s=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:r},body:JSON.stringify(i)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return{success:!0,data:(await s.json()).map(u=>({appId:u.app_id,deviceId:u.device_id,action:u.action,versionId:u.version_id,version:u.version,createdAt:u.created_at}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async setAppSetting(e,r){try{return await S8(e,{apikey:r.apikey||this.apikey||te(!0),bool:r.bool,string:r.string},!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}};async function qhe(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Uhe(t){return new rt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Hhe(t){return new rt().doctor(t)}async function Vhe(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function zhe(t){return new rt().encryptBundle(t)}async function Khe(t){return new rt().decryptBundle(t)}async function Ghe(t){return new rt().zipBundle(t)}async function Whe(t){return new rt().generateEncryptionKeys(t)}async function Xhe(t){return new rt().saveEncryptionKey(t)}async function Yhe(t){return new rt().deleteLegacyEncryptionKey(t)}async function Jhe(t,e,r){return new rt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Zhe(t,e){return new rt({apikey:e.apikey}).setAppSetting(t,e)}async function Qhe(t){return new rt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function ede(t){return new rt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function tde(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function rde(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function nde(t,e){return new rt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function ide(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function sde(t,e){return new rt(e).listBundles(t)}async function ode(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function ade(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function ude(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function cde(){try{return await de()}catch{return null}}0&&(module.exports={CapgoSDK,addApp,addChannel,addOrganization,checkBundleCompatibility,createSupabaseClient,decryptBundle,deleteLegacyEncryptionKey,deleteOrganization,doctor,encryptBundle,generateEncryptionKeys,getAccountId,getCapacitorConfig,getCurrentBundle,getStats,listBundles,listOrganizations,login,requestBuild,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
347
+ `)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await ve(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),r||(g.success(`login saved into .capgo file in ${n?"local":"home"} directory`),ce("Done \u2705"))}async function Iq(t,e=!1){e||oe("Adding organization"),await Ke();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to add an organization"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["write","all"]),{name:s,email:o}=r;if(!e&&!s){let c=await wo({message:"Organization name:",placeholder:"My Organization"});if(Tt(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await wo({message:"Management email:",placeholder:"admin@example.com"});if(Tt(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||g.info(`Adding organization "${s}" to Capgo`);let{data:a,error:u}=await n.from("orgs").insert({name:s,management_email:o,created_by:i}).select().single();if(u)throw e||g.error(`Could not add organization ${W(u)}`),new Error(`Could not add organization: ${W(u)}`);return await ve(r.apikey,{channel:"organization",event:"Organization Created",icon:"\u{1F3E2}",user_id:a.id,tags:{"org-name":s},notify:!1}).catch(()=>{}),e||(g.success(`Organization "${s}" added to Capgo`),ce("Done \u2705")),a}async function Fq(t,e,r=!1){r||oe("Deleting organization"),await Ke();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon),s=await De(i,n.apikey,["write","all"]),{data:o,error:a}=await i.from("orgs").select("created_by, name").eq("id",t).single();if(a||!o)throw r||g.error(`Cannot get organization details ${W(a)}`),new Error(`Cannot get organization details: ${W(a)}`);if(o.created_by!==s){if(r)throw new Error("Deleting an organization is restricted to the organization owner");g.warn("Deleting an organization is restricted to the organization owner"),g.warn("You are not the owner of this organization"),g.warn("It's strongly recommended that you do not continue!");let c=await Eo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(Tt(c)||c==="no")throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await jr({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(Tt(c)||!c)throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||g.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||g.error(`Could not delete organization ${W(u)}`),new Error(`Could not delete organization: ${W(u)}`);return await ve(n.apikey,{channel:"organization",event:"Organization Deleted",icon:"\u{1F5D1}\uFE0F",user_id:t,tags:{"org-name":o.name},notify:!1}).catch(()=>{}),r||(g.success(`Organization "${o.name}" deleted from Capgo`),ce("Done \u2705")),!0}function Mhe(t,e){if(e)return;if(!t.length){g.error("No organizations found");return}let r=new Vt;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"]);g.success("Organizations"),g.success(r.toString())}async function Pq(t,e=!1){e||oe("List organizations"),await Ke();let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.error("Missing API key, you need to provide an API key to list organizations"),new Error("Missing API key");let n=await pe(r.apikey,r.supaHost,r.supaAnon);await De(n,r.apikey,["read","write","all"]),e||g.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||g.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(g.info(`Organizations found: ${o.length}`),Mhe(o,e),ce("Done \u2705")),o}async function Rq(t,e,r=!1){r||oe("Updating organization"),await Ke();let n={...e,apikey:e.apikey||te()};if(!n.apikey)throw r||g.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||g.error("Missing argument, you need to provide an organization ID"),new Error("Missing organization id");let i=await pe(n.apikey,n.supaHost,n.supaAnon);await De(i,n.apikey,["write","all"]);let{data:s,error:o}=await i.from("orgs").select("name, management_email, created_by").eq("id",t).single();if(o||!s)throw r||g.error(`Cannot get organization details ${W(o)}`),new Error(`Cannot get organization details: ${W(o)}`);let{name:a,email:u}=n;if(!r&&!a){let l=await wo({message:"New organization name:",placeholder:s.name||"My Organization"});if(Tt(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await wo({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(Tt(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||g.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||g.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||g.error(`Could not update organization ${W(c)}`),new Error(`Could not update organization: ${W(c)}`);return await ve(n.apikey,{channel:"organization",event:"Organization Updated",icon:"\u270F\uFE0F",user_id:t,tags:{"org-name":a},notify:!1}).catch(()=>{}),r||(g.success("Organization updated"),ce("Done \u2705")),{orgId:t,name:a,email:u}}async function kq(t,e=!1){e||oe("Getting user id");let r={...t,apikey:t.apikey||te()};if(!r.apikey)throw e||g.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 pe(r.apikey,r.supaHost,r.supaAnon),i=await De(n,r.apikey,["read","all","write"]);return e||ce(`Done \u2705: ${i}`),i}catch(n){throw e||g.error(`Error getting user id ${W(n)}`),n instanceof Error?n:new Error(String(n))}}var rt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await Tq(e.apikey,{local:e.local??!1,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async doctor(e){try{return{success:!0,data:await b8({packageJson:e?.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await y8(e.appId,r,void 0,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateApp(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await C8(e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteApp(e,r=!1){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await D8(e,n,!1,r),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async listApps(){try{let e={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await v8(e,!1)).map(i=>({appId:i.app_id,name:i.name||"Unknown",iconUrl:i.icon_url||void 0,createdAt:new Date(i.created_at||"")}))}}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}async getAccountId(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await kq(r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async checkBundleCompatibility(e){try{let r={apikey:e.apikey||this.apikey||te(!0),channel:e.channel,text:e.textOutput??!1,packageJson:e.packageJson,nodeModules:e.nodeModules,supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon};return{success:!0,data:(await R8(e.appId,r,!0)).finalCompatibility}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async encryptBundle(e){try{return{success:!0,data:await M8(e.zipPath,e.checksum,{key:e.keyPath,keyData:e.keyData,json:e.json},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async decryptBundle(e){try{return{success:!0,data:await j8(e.zipPath,e.ivSessionKey,{key:e.keyPath,keyData:e.keyData,checksum:e.checksum},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async zipBundle(e){try{return{success:!0,data:await yq(e.appId,{apikey:this.apikey||te(!0),path:e.path,bundle:e.bundle,name:e.name,codeCheck:e.codeCheck,json:e.json,keyV2:e.keyV2,packageJson:e.packageJson},!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async uploadBundle(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,bundle:e.bundle,channel:e.channel,external:e.external,key:e.encrypt!==!1,keyV2:e.encryptionKey,timeout:e.timeout,tus:e.useTus,comment:e.comment,minUpdateVersion:e.minUpdateVersion,autoMinUpdateVersion:e.autoMinUpdateVersion,selfAssign:e.selfAssign,packageJson:e.packageJsonPaths,ignoreMetadataCheck:e.ignoreCompatibilityCheck,codeCheck:!e.disableCodeCheck,zip:e.useZip},n=await pq(e.appId,r,!0);return{success:n.success,bundleId:n.bundle,checksum:n.checksum??null,encryptionMethod:n.encryptionMethod,sessionKey:n.sessionKey,ivSessionKey:n.ivSessionKey,storageProvider:n.storageProvider,skipped:n.skipped,reason:n.reason}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listBundles(e){try{let r=this.apikey||te(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await Vp(n,e)).map(o=>({id:o.id.toString(),version:o.name,uploadedAt:new Date(o.created_at||""),size:0,encrypted:o.session_key!==null}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteBundle(e,r){try{let n={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await B8(r,e,n,!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async cleanupBundles(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle||"",version:"",keep:e.keep||4,force:e.force||!1,ignoreChannel:e.ignoreChannel||!1};return{success:!0,data:await P8(e.appId,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async requestBuild(e){try{let r=e.credentials,n={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,path:e.path,platform:e.platform,userId:e.userId,buildCertificateBase64:r?.BUILD_CERTIFICATE_BASE64,buildProvisionProfileBase64:r?.BUILD_PROVISION_PROFILE_BASE64,buildProvisionProfileBase64Prod:r?.BUILD_PROVISION_PROFILE_BASE64_PROD,p12Password:r?.P12_PASSWORD,appleKeyId:r?.APPLE_KEY_ID,appleIssuerId:r?.APPLE_ISSUER_ID,appleKeyContent:r?.APPLE_KEY_CONTENT,appStoreConnectTeamId:r?.APP_STORE_CONNECT_TEAM_ID,androidKeystoreFile:r?.ANDROID_KEYSTORE_FILE,keystoreKeyAlias:r?.KEYSTORE_KEY_ALIAS,keystoreKeyPassword:r?.KEYSTORE_KEY_PASSWORD,keystoreStorePassword:r?.KEYSTORE_STORE_PASSWORD,playConfigJson:r?.PLAY_CONFIG_JSON},i=await F8(e.appId,n,!0);return i.success&&i.jobId?{success:!0,data:{jobId:i.jobId,uploadUrl:i.uploadUrl||"",status:i.status||"unknown"}}:{success:!1,error:i.error||"Unknown error during build request"}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async getCurrentBundle(e,r,n){try{let i={apikey:n?.apikey||this.apikey||te(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await wq(r,e,i,!0)}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async addChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await Dq(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateChannel(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,bundle:e.bundle??void 0,state:e.state,downgrade:e.downgrade,ios:e.ios,android:e.android,selfAssign:e.selfAssign,disableAutoUpdate:e.disableAutoUpdate??void 0,dev:e.dev,emulator:e.emulator,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await _q(e.channelId,e.appId,r,!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteChannel(e,r,n=!1){try{let i={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await Eq(e,r,i,!0),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}}async listChannels(e){try{let r={apikey:this.apikey||te(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await bq(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await Oq({force:e?.force,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async saveEncryptionKey(e){try{return await Sq({key:e?.keyPath,keyData:e?.keyData,setupChannel:e?.setupChannel},!0),{success:!0}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteLegacyEncryptionKey(e){try{return{success:!0,data:{deleted:await Aq({force:e?.force,setupChannel:e?.setupChannel},!0)}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async listOrganizations(e){try{let r={apikey:e?.apikey||this.apikey||te(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await Pq(r,!0)).map(s=>({id:String(s.id??s.gid??""),name:s.name??"Unknown",role:s.role??void 0,appCount:typeof s.app_count=="number"?s.app_count:void 0,email:s.management_email??void 0,createdAt:s.created_at?new Date(s.created_at):void 0}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async addOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Iq(r,!0);return{success:!0,data:{id:String(n.id??n.gid??""),name:n.name??e.name,role:"owner",appCount:0,email:n.management_email??e.email,createdAt:n.created_at?new Date(n.created_at):void 0}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async updateOrganization(e){try{let r={apikey:e.apikey||this.apikey||te(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await Rq(e.orgId,r,!0);return{success:!0,data:{id:n.orgId,name:n.name,email:n.email}}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async deleteOrganization(e,r){try{let n={apikey:r?.apikey||this.apikey||te(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await Fq(e,n,!0)}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}async getStats(e){try{let r=e.apikey||this.apikey||te(!0),n=await En(),i={appId:e.appId,devicesId:e.deviceIds,search:e.search,order:e.order,rangeStart:e.after||e.rangeStart,rangeEnd:e.rangeEnd,limit:e.limit},s=await fetch(`${n.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:r},body:JSON.stringify(i)});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return{success:!0,data:(await s.json()).map(u=>({appId:u.app_id,deviceId:u.device_id,action:u.action,versionId:u.version_id,version:u.version,createdAt:u.created_at}))}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async setAppSetting(e,r){try{return await S8(e,{apikey:r.apikey||this.apikey||te(!0),bool:r.bool,string:r.string},!0),{success:!0}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}};async function qhe(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Uhe(t){return new rt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function Hhe(t){return new rt().doctor(t)}async function Vhe(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function zhe(t){return new rt().encryptBundle(t)}async function Khe(t){return new rt().decryptBundle(t)}async function Ghe(t){return new rt().zipBundle(t)}async function Whe(t){return new rt().generateEncryptionKeys(t)}async function Xhe(t){return new rt().saveEncryptionKey(t)}async function Yhe(t){return new rt().deleteLegacyEncryptionKey(t)}async function Jhe(t,e,r){return new rt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Zhe(t,e){return new rt({apikey:e.apikey}).setAppSetting(t,e)}async function Qhe(t){return new rt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function ede(t){return new rt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function tde(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function rde(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function nde(t,e){return new rt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function ide(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function sde(t,e){return new rt(e).listBundles(t)}async function ode(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function ade(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function ude(t){return new rt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function cde(){try{return await de()}catch{return null}}0&&(module.exports={CapgoSDK,addApp,addChannel,addOrganization,checkBundleCompatibility,createSupabaseClient,decryptBundle,deleteLegacyEncryptionKey,deleteOrganization,doctor,encryptBundle,generateEncryptionKeys,getAccountId,getCapacitorConfig,getCurrentBundle,getStats,listBundles,listOrganizations,login,requestBuild,saveEncryptionKey,updateAppSetting,updateOrganization,uploadBundle,zipBundle});
348
348
  /*! Bundled license information:
349
349
 
350
350
  tus-js-client/lib.es5/upload.js: