@capgo/cli 7.56.0 → 7.56.1

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,11 +1,11 @@
1
- "use strict";var pq=Object.create;var Al=Object.defineProperty;var mq=Object.getOwnPropertyDescriptor;var gq=Object.getOwnPropertyNames;var yq=Object.getPrototypeOf,Dq=Object.prototype.hasOwnProperty;var mr=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Am=(t,e)=>{for(var r in e)Al(t,r,{get:e[r],enumerable:!0})},Xb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gq(e))!Dq.call(t,i)&&i!==r&&Al(t,i,{get:()=>e[i],enumerable:!(n=mq(e,i))||n.enumerable});return t};var Ee=(t,e,r)=>(r=t!=null?pq(yq(t)):{},Xb(e||!t||!t.__esModule?Al(r,"default",{value:t,enumerable:!0}):r,t)),ce=t=>Xb(Al({},"__esModule",{value:!0}),t);var Ze=_((Kde,Yb)=>{"use strict";var Om={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"},wq={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},vq={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?Om.up():"");return t&&(e+=Om.left),e}};Yb.exports={cursor:Om,scroll:wq,erase:vq,beep:"\x07"}});var Tm=_((Gde,xm)=>{var xl=process||{},Jb=xl.argv||[],Ol=xl.env||{},Eq=!(Ol.NO_COLOR||Jb.includes("--no-color"))&&(!!Ol.FORCE_COLOR||Jb.includes("--color")||xl.platform==="win32"||(xl.stdout||{}).isTTY&&Ol.TERM!=="dumb"||!!Ol.CI),bq=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+_q(i,e,r,s)+e:t+i+e},_q=(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)},Zb=(t=Eq)=>{let e=t?bq:()=>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")}};xm.exports=Zb();xm.exports.createColors=Zb});var Ll=_(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.isNXMonorepo=gr.isMonorepo=gr.findPackageRelativePathInMonorepo=gr.findPackagePath=gr.findNXMonorepoRoot=gr.findMonorepoRoot=void 0;var yu=require("node:fs"),Ii=require("node:path");function $l(t){let e=(0,Ii.join)(t,"package.json"),r=(0,Ii.join)(t,"pnpm-workspace.yaml");if((0,yu.existsSync)(r)||(0,yu.existsSync)(e)&&JSON.parse((0,yu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ii.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return $l(n)}gr.findMonorepoRoot=$l;function qm(t){let e=(0,Ii.join)(t,"nx.json");if((0,yu.existsSync)(e))return t;let r=(0,Ii.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return qm(r)}gr.findNXMonorepoRoot=qm;function Hm(t,e,r){let n=(0,Ii.join)(e,"node_modules",t);if((0,yu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ii.dirname)(e);return Hm(t,i,r)}gr.findPackagePath=Hm;function t4(t,e){let r=$l(e),n=Hm(t,e,r);return n?(0,Ii.relative)(e,n):null}gr.findPackageRelativePathInMonorepo=t4;function r4(t){try{return $l(t),!0}catch{return!1}}gr.isMonorepo=r4;function n4(t){try{return qm(t),!0}catch{return!1}}gr.isNXMonorepo=n4});var fe={};Am(fe,{__addDisposableResource:()=>rC,__assign:()=>Vl,__asyncDelegator:()=>W_,__asyncGenerator:()=>G_,__asyncValues:()=>X_,__await:()=>Oo,__awaiter:()=>U_,__classPrivateFieldGet:()=>Q_,__classPrivateFieldIn:()=>tC,__classPrivateFieldSet:()=>eC,__createBinding:()=>Kl,__decorate:()=>k_,__disposeResources:()=>nC,__esDecorate:()=>$_,__exportStar:()=>H_,__extends:()=>F_,__generator:()=>q_,__importDefault:()=>Z_,__importStar:()=>J_,__makeTemplateObject:()=>Y_,__metadata:()=>M_,__param:()=>N_,__propKey:()=>B_,__read:()=>Zm,__rest:()=>R_,__rewriteRelativeImportExtension:()=>iC,__runInitializers:()=>L_,__setFunctionName:()=>j_,__spread:()=>V_,__spreadArray:()=>K_,__spreadArrays:()=>z_,__values:()=>zl,default:()=>O4});function F_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ym(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function R_(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 k_(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 N_(t,e){return function(r,n){e(r,n,t)}}function $_(t,e,r,n,i,s){function o(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}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(E){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(E||null))};var v=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],m);if(a==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(h=o(v.get))&&(l.get=h),(h=o(v.set))&&(l.set=h),(h=o(v.init))&&i.unshift(h)}else(h=o(v))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function L_(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 B_(t){return typeof t=="symbol"?t:"".concat(t)}function j_(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 M_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function U_(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 q_(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 H_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kl(e,t,r)}function zl(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 Zm(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 V_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Zm(arguments[e]));return t}function z_(){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 K_(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 Oo(t){return this instanceof Oo?(this.v=t,this):new Oo(t)}function G_(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(v,E){s.push([f,y,v,E])>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 Oo?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 W_(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:Oo(t[i](o)),done:!1}:s?s(o):o}:s}}function X_(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 zl=="function"?zl(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 Y_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function J_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Jm(t),n=0;n<r.length;n++)r[n]!=="default"&&Kl(e,t,r[n]);return S4(e,t),e}function Z_(t){return t&&t.__esModule?t:{default:t}}function Q_(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 eC(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 tC(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 rC(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 nC(t){function e(s){t.error=t.hasError?new A4(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 iC(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 Ym,Vl,Kl,S4,Jm,A4,O4,he=mr(()=>{Ym=function(t,e){return Ym=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])},Ym(t,e)};Vl=function(){return Vl=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},Vl.apply(this,arguments)};Kl=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]});S4=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Jm=function(t){return Jm=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Jm(t)};A4=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};O4={__extends:F_,__assign:Vl,__rest:R_,__decorate:k_,__param:N_,__esDecorate:$_,__runInitializers:L_,__propKey:B_,__setFunctionName:j_,__metadata:M_,__awaiter:U_,__generator:q_,__createBinding:Kl,__exportStar:H_,__values:zl,__read:Zm,__spread:V_,__spreadArrays:z_,__spreadArray:K_,__await:Oo,__asyncGenerator:G_,__asyncDelegator:W_,__asyncValues:X_,__makeTemplateObject:Y_,__importStar:J_,__importDefault:Z_,__classPrivateFieldGet:Q_,__classPrivateFieldSet:eC,__classPrivateFieldIn:tC,__addDisposableResource:rC,__disposeResources:nC,__rewriteRelativeImportExtension:iC}});var sC=_(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.resolveFetch=void 0;var x4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Gl.resolveFetch=x4});var rg=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.FunctionRegion=Ur.FunctionsHttpError=Ur.FunctionsRelayError=Ur.FunctionsFetchError=Ur.FunctionsError=void 0;var xo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Ur.FunctionsError=xo;var Qm=class extends xo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Ur.FunctionsFetchError=Qm;var eg=class extends xo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Ur.FunctionsRelayError=eg;var tg=class extends xo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Ur.FunctionsHttpError=tg;var oC;(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"})(oC||(Ur.FunctionRegion=oC={}))});var aC=_(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.FunctionsClient=void 0;var T4=(he(),ce(fe)),I4=sC(),To=rg(),ng=class{constructor(e,{headers:r={},customFetch:n,region:i=To.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,I4.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return T4.__awaiter(this,arguments,void 0,function*(r,n={}){var i;let s,o;try{let{headers:a,method:u,body:c,signal:l,timeout:h}=n,d={},{region:f}=n;f||(f=this.region);let m=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,m.searchParams.set("forceFunctionRegion",f));let y;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):y=c;let v=l;h&&(o=new AbortController,s=setTimeout(()=>o.abort(),h),l?(v=o.signal,l.addEventListener("abort",()=>o.abort())):v=o.signal);let E=yield this.fetch(m.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:v}).catch(w=>{throw new To.FunctionsFetchError(w)}),A=E.headers.get("x-relay-error");if(A&&A==="true")throw new To.FunctionsRelayError(E);if(!E.ok)throw new To.FunctionsHttpError(E);let p=((i=E.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),D;return p==="application/json"?D=yield E.json():p==="application/octet-stream"||p==="application/pdf"?D=yield E.blob():p==="text/event-stream"?D=E:p==="multipart/form-data"?D=yield E.formData():D=yield E.text(),{data:D,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof To.FunctionsHttpError||a instanceof To.FunctionsRelayError?a.context:void 0}}finally{s&&clearTimeout(s)}})}};Wl.FunctionsClient=ng});var ig=_(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.FunctionRegion=yr.FunctionsRelayError=yr.FunctionsHttpError=yr.FunctionsFetchError=yr.FunctionsError=yr.FunctionsClient=void 0;var P4=aC();Object.defineProperty(yr,"FunctionsClient",{enumerable:!0,get:function(){return P4.FunctionsClient}});var bu=rg();Object.defineProperty(yr,"FunctionsError",{enumerable:!0,get:function(){return bu.FunctionsError}});Object.defineProperty(yr,"FunctionsFetchError",{enumerable:!0,get:function(){return bu.FunctionsFetchError}});Object.defineProperty(yr,"FunctionsHttpError",{enumerable:!0,get:function(){return bu.FunctionsHttpError}});Object.defineProperty(yr,"FunctionsRelayError",{enumerable:!0,get:function(){return bu.FunctionsRelayError}});Object.defineProperty(yr,"FunctionRegion",{enumerable:!0,get:function(){return bu.FunctionRegion}})});var ag=_(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var sg=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};og.default=sg});var lg=_(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});var F4=(he(),ce(fe)),R4=F4.__importDefault(ag()),ug=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 v=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),E=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");v&&E&&E.length>1&&(d=parseInt(E[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 v=await s.text();try{l=JSON.parse(v),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,m="OK")}catch{s.status===404&&v===""?(f=204,m="No Content"):l={message:v}}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 R4.default(l)}return{error:l,data:h,count:d,status:f,statusText:m}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u,c,l,h;let d="",f=s?.cause;if(f){let m=(o=f?.message)!==null&&o!==void 0?o:"",y=(a=f?.code)!==null&&a!==void 0?a:"";d=`${(u=s?.name)!==null&&u!==void 0?u:"FetchError"}: ${s?.message}`,d+=`
1
+ "use strict";var pq=Object.create;var Al=Object.defineProperty;var mq=Object.getOwnPropertyDescriptor;var gq=Object.getOwnPropertyNames;var yq=Object.getPrototypeOf,Dq=Object.prototype.hasOwnProperty;var mr=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Am=(t,e)=>{for(var r in e)Al(t,r,{get:e[r],enumerable:!0})},Xb=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gq(e))!Dq.call(t,i)&&i!==r&&Al(t,i,{get:()=>e[i],enumerable:!(n=mq(e,i))||n.enumerable});return t};var Ee=(t,e,r)=>(r=t!=null?pq(yq(t)):{},Xb(e||!t||!t.__esModule?Al(r,"default",{value:t,enumerable:!0}):r,t)),ce=t=>Xb(Al({},"__esModule",{value:!0}),t);var Ze=_((Kde,Yb)=>{"use strict";var Om={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"},wq={up:(t=1)=>"\x1B[S".repeat(t),down:(t=1)=>"\x1B[T".repeat(t)},vq={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?Om.up():"");return t&&(e+=Om.left),e}};Yb.exports={cursor:Om,scroll:wq,erase:vq,beep:"\x07"}});var Tm=_((Gde,xm)=>{var xl=process||{},Jb=xl.argv||[],Ol=xl.env||{},Eq=!(Ol.NO_COLOR||Jb.includes("--no-color"))&&(!!Ol.FORCE_COLOR||Jb.includes("--color")||xl.platform==="win32"||(xl.stdout||{}).isTTY&&Ol.TERM!=="dumb"||!!Ol.CI),bq=(t,e,r=t)=>n=>{let i=""+n,s=i.indexOf(e,t.length);return~s?t+_q(i,e,r,s)+e:t+i+e},_q=(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)},Zb=(t=Eq)=>{let e=t?bq:()=>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")}};xm.exports=Zb();xm.exports.createColors=Zb});var Ll=_(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.isNXMonorepo=gr.isMonorepo=gr.findPackageRelativePathInMonorepo=gr.findPackagePath=gr.findNXMonorepoRoot=gr.findMonorepoRoot=void 0;var yu=require("node:fs"),Ii=require("node:path");function $l(t){let e=(0,Ii.join)(t,"package.json"),r=(0,Ii.join)(t,"pnpm-workspace.yaml");if((0,yu.existsSync)(r)||(0,yu.existsSync)(e)&&JSON.parse((0,yu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ii.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return $l(n)}gr.findMonorepoRoot=$l;function qm(t){let e=(0,Ii.join)(t,"nx.json");if((0,yu.existsSync)(e))return t;let r=(0,Ii.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return qm(r)}gr.findNXMonorepoRoot=qm;function Hm(t,e,r){let n=(0,Ii.join)(e,"node_modules",t);if((0,yu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ii.dirname)(e);return Hm(t,i,r)}gr.findPackagePath=Hm;function t4(t,e){let r=$l(e),n=Hm(t,e,r);return n?(0,Ii.relative)(e,n):null}gr.findPackageRelativePathInMonorepo=t4;function r4(t){try{return $l(t),!0}catch{return!1}}gr.isMonorepo=r4;function n4(t){try{return qm(t),!0}catch{return!1}}gr.isNXMonorepo=n4});var fe={};Am(fe,{__addDisposableResource:()=>rC,__assign:()=>Vl,__asyncDelegator:()=>W_,__asyncGenerator:()=>G_,__asyncValues:()=>X_,__await:()=>Oo,__awaiter:()=>U_,__classPrivateFieldGet:()=>Q_,__classPrivateFieldIn:()=>tC,__classPrivateFieldSet:()=>eC,__createBinding:()=>Kl,__decorate:()=>k_,__disposeResources:()=>nC,__esDecorate:()=>$_,__exportStar:()=>H_,__extends:()=>F_,__generator:()=>q_,__importDefault:()=>Z_,__importStar:()=>J_,__makeTemplateObject:()=>Y_,__metadata:()=>M_,__param:()=>N_,__propKey:()=>B_,__read:()=>Zm,__rest:()=>R_,__rewriteRelativeImportExtension:()=>iC,__runInitializers:()=>L_,__setFunctionName:()=>j_,__spread:()=>V_,__spreadArray:()=>K_,__spreadArrays:()=>z_,__values:()=>zl,default:()=>O4});function F_(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ym(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function R_(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 k_(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 N_(t,e){return function(r,n){e(r,n,t)}}function $_(t,e,r,n,i,s){function o(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}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 p={};for(var y in n)p[y]=y==="access"?{}:n[y];for(var y in n.access)p.access[y]=n.access[y];p.addInitializer=function(E){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(E||null))};var v=(0,r[f])(a==="accessor"?{get:l.get,set:l.set}:l[u],p);if(a==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(h=o(v.get))&&(l.get=h),(h=o(v.set))&&(l.set=h),(h=o(v.init))&&i.unshift(h)}else(h=o(v))&&(a==="field"?i.unshift(h):l[u]=h)}c&&Object.defineProperty(c,n.name,l),d=!0}function L_(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 B_(t){return typeof t=="symbol"?t:"".concat(t)}function j_(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 M_(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function U_(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 q_(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 H_(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Kl(e,t,r)}function zl(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 Zm(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 V_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Zm(arguments[e]));return t}function z_(){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 K_(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 Oo(t){return this instanceof Oo?(this.v=t,this):new Oo(t)}function G_(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(p){return Promise.resolve(p).then(f,h)}}function a(f,p){n[f]&&(i[f]=function(y){return new Promise(function(v,E){s.push([f,y,v,E])>1||u(f,y)})},p&&(i[f]=p(i[f])))}function u(f,p){try{c(n[f](p))}catch(y){d(s[0][3],y)}}function c(f){f.value instanceof Oo?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,p){f(p),s.shift(),s.length&&u(s[0][0],s[0][1])}}function W_(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:Oo(t[i](o)),done:!1}:s?s(o):o}:s}}function X_(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 zl=="function"?zl(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 Y_(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function J_(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=Jm(t),n=0;n<r.length;n++)r[n]!=="default"&&Kl(e,t,r[n]);return S4(e,t),e}function Z_(t){return t&&t.__esModule?t:{default:t}}function Q_(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 eC(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 tC(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 rC(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 nC(t){function e(s){t.error=t.hasError?new A4(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 iC(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 Ym,Vl,Kl,S4,Jm,A4,O4,he=mr(()=>{Ym=function(t,e){return Ym=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])},Ym(t,e)};Vl=function(){return Vl=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},Vl.apply(this,arguments)};Kl=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]});S4=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},Jm=function(t){return Jm=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Jm(t)};A4=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};O4={__extends:F_,__assign:Vl,__rest:R_,__decorate:k_,__param:N_,__esDecorate:$_,__runInitializers:L_,__propKey:B_,__setFunctionName:j_,__metadata:M_,__awaiter:U_,__generator:q_,__createBinding:Kl,__exportStar:H_,__values:zl,__read:Zm,__spread:V_,__spreadArrays:z_,__spreadArray:K_,__await:Oo,__asyncGenerator:G_,__asyncDelegator:W_,__asyncValues:X_,__makeTemplateObject:Y_,__importStar:J_,__importDefault:Z_,__classPrivateFieldGet:Q_,__classPrivateFieldSet:eC,__classPrivateFieldIn:tC,__addDisposableResource:rC,__disposeResources:nC,__rewriteRelativeImportExtension:iC}});var sC=_(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.resolveFetch=void 0;var x4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Gl.resolveFetch=x4});var rg=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.FunctionRegion=Ur.FunctionsHttpError=Ur.FunctionsRelayError=Ur.FunctionsFetchError=Ur.FunctionsError=void 0;var xo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Ur.FunctionsError=xo;var Qm=class extends xo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Ur.FunctionsFetchError=Qm;var eg=class extends xo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Ur.FunctionsRelayError=eg;var tg=class extends xo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Ur.FunctionsHttpError=tg;var oC;(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"})(oC||(Ur.FunctionRegion=oC={}))});var aC=_(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});Wl.FunctionsClient=void 0;var T4=(he(),ce(fe)),I4=sC(),To=rg(),ng=class{constructor(e,{headers:r={},customFetch:n,region:i=To.FunctionRegion.Any}={}){this.url=e,this.headers=r,this.region=i,this.fetch=(0,I4.resolveFetch)(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return T4.__awaiter(this,arguments,void 0,function*(r,n={}){var i;let s,o;try{let{headers:a,method:u,body:c,signal:l,timeout:h}=n,d={},{region:f}=n;f||(f=this.region);let p=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let y;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):y=c;let v=l;h&&(o=new AbortController,s=setTimeout(()=>o.abort(),h),l?(v=o.signal,l.addEventListener("abort",()=>o.abort())):v=o.signal);let E=yield this.fetch(p.toString(),{method:u||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:v}).catch(w=>{throw new To.FunctionsFetchError(w)}),A=E.headers.get("x-relay-error");if(A&&A==="true")throw new To.FunctionsRelayError(E);if(!E.ok)throw new To.FunctionsHttpError(E);let m=((i=E.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),D;return m==="application/json"?D=yield E.json():m==="application/octet-stream"||m==="application/pdf"?D=yield E.blob():m==="text/event-stream"?D=E:m==="multipart/form-data"?D=yield E.formData():D=yield E.text(),{data:D,error:null,response:E}}catch(a){return{data:null,error:a,response:a instanceof To.FunctionsHttpError||a instanceof To.FunctionsRelayError?a.context:void 0}}finally{s&&clearTimeout(s)}})}};Wl.FunctionsClient=ng});var ig=_(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.FunctionRegion=yr.FunctionsRelayError=yr.FunctionsHttpError=yr.FunctionsFetchError=yr.FunctionsError=yr.FunctionsClient=void 0;var P4=aC();Object.defineProperty(yr,"FunctionsClient",{enumerable:!0,get:function(){return P4.FunctionsClient}});var bu=rg();Object.defineProperty(yr,"FunctionsError",{enumerable:!0,get:function(){return bu.FunctionsError}});Object.defineProperty(yr,"FunctionsFetchError",{enumerable:!0,get:function(){return bu.FunctionsFetchError}});Object.defineProperty(yr,"FunctionsHttpError",{enumerable:!0,get:function(){return bu.FunctionsHttpError}});Object.defineProperty(yr,"FunctionsRelayError",{enumerable:!0,get:function(){return bu.FunctionsRelayError}});Object.defineProperty(yr,"FunctionRegion",{enumerable:!0,get:function(){return bu.FunctionRegion}})});var ag=_(og=>{"use strict";Object.defineProperty(og,"__esModule",{value:!0});var sg=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};og.default=sg});var lg=_(cg=>{"use strict";Object.defineProperty(cg,"__esModule",{value:!0});var F4=(he(),ce(fe)),R4=F4.__importDefault(ag()),ug=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,p=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 v=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),E=(u=s.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");v&&E&&E.length>1&&(d=parseInt(E[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,p="Not Acceptable"):h.length===1?h=h[0]:h=null)}else{let v=await s.text();try{l=JSON.parse(v),Array.isArray(l)&&s.status===404&&(h=[],l=null,f=200,p="OK")}catch{s.status===404&&v===""?(f=204,p="No Content"):l={message:v}}if(l&&this.isMaybeSingle&&(!((c=l?.details)===null||c===void 0)&&c.includes("0 rows"))&&(l=null,f=200,p="OK"),l&&this.shouldThrowOnError)throw new R4.default(l)}return{error:l,data:h,count:d,status:f,statusText:p}});return this.shouldThrowOnError||(i=i.catch(s=>{var o,a,u,c,l,h;let d="",f=s?.cause;if(f){let p=(o=f?.message)!==null&&o!==void 0?o:"",y=(a=f?.code)!==null&&a!==void 0?a:"";d=`${(u=s?.name)!==null&&u!==void 0?u:"FetchError"}: ${s?.message}`,d+=`
2
2
 
3
- Caused by: ${(c=f?.name)!==null&&c!==void 0?c:"Error"}: ${m}`,y&&(d+=` (${y})`),f?.stack&&(d+=`
3
+ Caused by: ${(c=f?.name)!==null&&c!==void 0?c:"Error"}: ${p}`,y&&(d+=` (${y})`),f?.stack&&(d+=`
4
4
  ${f.stack}`)}else d=(l=s?.stack)!==null&&l!==void 0?l:"";return{error:{message:`${(h=s?.name)!==null&&h!==void 0?h:"FetchError"}: ${s?.message}`,details:d,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(e,r)}returns(){return this}overrideTypes(){return this}};cg.default=ug});var dg=_(hg=>{"use strict";Object.defineProperty(hg,"__esModule",{value:!0});var k4=(he(),ce(fe)),N4=k4.__importDefault(lg()),fg=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}};hg.default=fg});var Xl=_(mg=>{"use strict";Object.defineProperty(mg,"__esModule",{value:!0});var $4=(he(),ce(fe)),L4=$4.__importDefault(dg()),B4=new RegExp("[,()]"),pg=class extends L4.default{eq(e,r){return this.url.searchParams.append(e,`eq.${r}`),this}neq(e,r){return this.url.searchParams.append(e,`neq.${r}`),this}gt(e,r){return this.url.searchParams.append(e,`gt.${r}`),this}gte(e,r){return this.url.searchParams.append(e,`gte.${r}`),this}lt(e,r){return this.url.searchParams.append(e,`lt.${r}`),this}lte(e,r){return this.url.searchParams.append(e,`lte.${r}`),this}like(e,r){return this.url.searchParams.append(e,`like.${r}`),this}likeAllOf(e,r){return this.url.searchParams.append(e,`like(all).{${r.join(",")}}`),this}likeAnyOf(e,r){return this.url.searchParams.append(e,`like(any).{${r.join(",")}}`),this}ilike(e,r){return this.url.searchParams.append(e,`ilike.${r}`),this}ilikeAllOf(e,r){return this.url.searchParams.append(e,`ilike(all).{${r.join(",")}}`),this}ilikeAnyOf(e,r){return this.url.searchParams.append(e,`ilike(any).{${r.join(",")}}`),this}regexMatch(e,r){return this.url.searchParams.append(e,`match.${r}`),this}regexIMatch(e,r){return this.url.searchParams.append(e,`imatch.${r}`),this}is(e,r){return this.url.searchParams.append(e,`is.${r}`),this}isDistinct(e,r){return this.url.searchParams.append(e,`isdistinct.${r}`),this}in(e,r){let n=Array.from(new Set(r)).map(i=>typeof i=="string"&&B4.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}};mg.default=pg});var Dg=_(yg=>{"use strict";Object.defineProperty(yg,"__esModule",{value:!0});var j4=(he(),ce(fe)),_u=j4.__importDefault(Xl()),gg=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 _u.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 _u.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 _u.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 _u.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 _u.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};yg.default=gg});var cC=_(vg=>{"use strict";Object.defineProperty(vg,"__esModule",{value:!0});var uC=(he(),ce(fe)),M4=uC.__importDefault(Dg()),U4=uC.__importDefault(Xl()),wg=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){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");let r=new URL(`${this.url}/${e}`);return new M4.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 U4.default({method:a,url:u,headers:l,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};vg.default=wg});var Eg=_(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.PostgrestError=tr.PostgrestBuilder=tr.PostgrestTransformBuilder=tr.PostgrestFilterBuilder=tr.PostgrestQueryBuilder=tr.PostgrestClient=void 0;var Io=(he(),ce(fe)),lC=Io.__importDefault(cC());tr.PostgrestClient=lC.default;var fC=Io.__importDefault(Dg());tr.PostgrestQueryBuilder=fC.default;var hC=Io.__importDefault(Xl());tr.PostgrestFilterBuilder=hC.default;var dC=Io.__importDefault(dg());tr.PostgrestTransformBuilder=dC.default;var pC=Io.__importDefault(lg());tr.PostgrestBuilder=pC.default;var mC=Io.__importDefault(ag());tr.PostgrestError=mC.default;tr.default={PostgrestClient:lC.default,PostgrestQueryBuilder:fC.default,PostgrestFilterBuilder:hC.default,PostgrestTransformBuilder:dC.default,PostgrestBuilder:pC.default,PostgrestError:mC.default}});var bg=_(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});Cu.WebSocketFactory=void 0;var Yl=class{constructor(){}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:
5
5
  import ws from "ws"
6
6
  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+=`
7
7
 
8
- 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}}};Cu.WebSocketFactory=Yl;Cu.default=Yl});var gC=_(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.version=void 0;Jl.version="2.84.0"});var Zl=_(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.CONNECTION_STATE=Ne.TRANSPORTS=Ne.CHANNEL_EVENTS=Ne.CHANNEL_STATES=Ne.SOCKET_STATES=Ne.MAX_PUSH_BUFFER_SIZE=Ne.WS_CLOSE_NORMAL=Ne.DEFAULT_TIMEOUT=Ne.VERSION=Ne.DEFAULT_VSN=Ne.VSN_2_0_0=Ne.VSN_1_0_0=Ne.DEFAULT_VERSION=void 0;var bC=gC();Ne.DEFAULT_VERSION=`realtime-js/${bC.version}`;Ne.VSN_1_0_0="1.0.0";Ne.VSN_2_0_0="2.0.0";Ne.DEFAULT_VSN=Ne.VSN_1_0_0;Ne.VERSION=bC.version;Ne.DEFAULT_TIMEOUT=1e4;Ne.WS_CLOSE_NORMAL=1e3;Ne.MAX_PUSH_BUFFER_SIZE=100;var yC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(yC||(Ne.SOCKET_STATES=yC={}));var DC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(DC||(Ne.CHANNEL_STATES=DC={}));var wC;(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"})(wC||(Ne.CHANNEL_EVENTS=wC={}));var vC;(function(t){t.websocket="websocket"})(vC||(Ne.TRANSPORTS=vC={}));var EC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(EC||(Ne.CONNECTION_STATE=EC={}))});var _C=_(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});var _g=class{constructor(){this.HEADER_LENGTH=1,this.META_LENGTH=4,this.USER_BROADCAST_PUSH_META_LENGTH=5,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast"}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:new ArrayBuffer(0),h=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,d=new ArrayBuffer(this.HEADER_LENGTH+h),f=new DataView(d),m=0;f.setUint8(m++,this.KINDS.userBroadcastPush),f.setUint8(m++,u.length),f.setUint8(m++,a.length),f.setUint8(m++,o.length),f.setUint8(m++,c.length),f.setUint8(m++,this.BINARY_ENCODING),Array.from(u,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(a,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(o,v=>f.setUint8(m++,v.charCodeAt(0))),Array.from(c,v=>f.setUint8(m++,v.charCodeAt(0)));var y=new Uint8Array(d.byteLength+l.byteLength);return y.set(new Uint8Array(d),0),y.set(new Uint8Array(l),d.byteLength),y.buffer}_encodeJsonUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:{},d=new TextEncoder().encode(JSON.stringify(l)).buffer,f=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,m=new ArrayBuffer(this.HEADER_LENGTH+f),y=new DataView(m),v=0;y.setUint8(v++,this.KINDS.userBroadcastPush),y.setUint8(v++,u.length),y.setUint8(v++,a.length),y.setUint8(v++,o.length),y.setUint8(v++,c.length),y.setUint8(v++,this.JSON_ENCODING),Array.from(u,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(a,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(o,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(c,A=>y.setUint8(v++,A.charCodeAt(0)));var E=new Uint8Array(m.byteLength+d.byteLength);return E.set(new Uint8Array(m),0),E.set(new Uint8Array(d),m.byteLength),E.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){let n=JSON.parse(e),[i,s,o,a,u]=n;return r({join_ref:i,ref:s,topic:o,event:a,payload:u})}return r({})}_binaryDecode(e){let r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4),u=this.HEADER_LENGTH+4,c=n.decode(e.slice(u,u+i));u=u+i;let l=n.decode(e.slice(u,u+s));u=u+s;let h=n.decode(e.slice(u,u+o));u=u+o;let d=e.slice(u,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,m={type:this.BROADCAST_EVENT,event:l,payload:f};return o>0&&(m.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:m}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}};Cg.default=_g});var Og=_(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});var Sg=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))}};Ag.default=Sg});var Ql=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.httpEndpointURL=Fe.toTimestampString=Fe.toArray=Fe.toJson=Fe.toNumber=Fe.toBoolean=Fe.convertCell=Fe.convertColumn=Fe.convertChangeData=Fe.PostgresTypes=void 0;var Ke;(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"})(Ke||(Fe.PostgresTypes=Ke={}));var q4=(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,Fe.convertColumn)(o,t,e,i),s),{}):{}};Fe.convertChangeData=q4;var H4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Fe.convertCell)(s,o):xg(o)};Fe.convertColumn=H4;var V4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Fe.toArray)(e,r)}switch(t){case Ke.bool:return(0,Fe.toBoolean)(e);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return(0,Fe.toNumber)(e);case Ke.json:case Ke.jsonb:return(0,Fe.toJson)(e);case Ke.timestamp:return(0,Fe.toTimestampString)(e);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return xg(e);default:return xg(e)}};Fe.convertCell=V4;var xg=t=>t,z4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Fe.toBoolean=z4;var K4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Fe.toNumber=K4;var G4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Fe.toJson=G4;var W4=(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,Fe.convertCell)(e,a))}return t};Fe.toArray=W4;var X4=t=>typeof t=="string"?t.replace(" ","T"):t;Fe.toTimestampString=X4;var Y4=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};Fe.httpEndpointURL=Y4});var CC=_(Ig=>{"use strict";Object.defineProperty(Ig,"__esModule",{value:!0});var J4=Zl(),Tg=class{constructor(e,r,n={},i=J4.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}};Ig.default=Tg});var Fg=_(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var SC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(SC||(Su.REALTIME_PRESENCE_LISTEN_EVENTS=SC={}));var Pg=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(v=>v.presence_ref),f=h.map(v=>v.presence_ref),m=l.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.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()}};Su.default=Pg});var Ng=_(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.REALTIME_CHANNEL_STATES=on.REALTIME_SUBSCRIBE_STATES=on.REALTIME_LISTEN_TYPES=on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var ef=(he(),ce(fe)),Ge=Zl(),Rg=ef.__importDefault(CC()),Z4=ef.__importDefault(Og()),Q4=ef.__importDefault(Fg()),AC=ef.__importStar(Ql()),e5=Ql(),OC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(OC||(on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=OC={}));var Au;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Au||(on.REALTIME_LISTEN_TYPES=Au={}));var Yn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Yn||(on.REALTIME_SUBSCRIBE_STATES=Yn={}));on.REALTIME_CHANNEL_STATES=Ge.CHANNEL_STATES;var kg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ge.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 Rg.default(this,Ge.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new Z4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ge.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=Ge.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ge.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=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ge.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new Q4.default(this),this.broadcastEndpointURL=(0,e5.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==Ge.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[Au.PRESENCE]&&this.bindings[Au.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?.(Yn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Yn.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?.(Yn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,v=(m=y?.length)!==null&&m!==void 0?m:0,E=[];for(let A=0;A<v;A++){let p=y[A],{filter:{event:D,schema:w,table:C,filter:F}}=p,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===C&&b.filter===F)E.push(Object.assign(Object.assign({},p),{id:b.id}));else{this.unsubscribe(),this.state=Ge.CHANNEL_STATES.errored,e?.(Yn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(Yn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ge.CHANNEL_STATES.errored,e?.(Yn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Yn.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===Ge.CHANNEL_STATES.joined&&e===Au.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=Ge.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ge.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Rg.default(this,Ge.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=Ge.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 Rg.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>Ge.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}=Ge.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,v;return((m=f.filter)===null||m===void 0?void 0:m.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var m,y,v,E,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()===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{let D=(A=(E=f?.filter)===null||E===void 0?void 0:E.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:v,commit_timestamp:E,type:A,errors:p}=m;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:E,eventType:A,new:{},old:{},errors:p}),this._getPayloadRecords(m))}f.callback(d,n)})}_isClosed(){return this.state===Ge.CHANNEL_STATES.closed}_isJoined(){return this.state===Ge.CHANNEL_STATES.joined}_isJoining(){return this.state===Ge.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ge.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(Ge.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ge.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=Ge.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=AC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=AC.convertChangeData(e.columns,e.old_record)),r}};on.default=kg});var xC=_(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});var rf=(he(),ce(fe)),t5=rf.__importDefault(bg()),St=Zl(),r5=rf.__importDefault(_C()),n5=rf.__importDefault(Og()),i5=Ql(),s5=rf.__importDefault(Ng()),$g=()=>{},tf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},o5=[1e3,2e3,5e3,1e4],a5=1e4,u5=`
8
+ 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}}};Cu.WebSocketFactory=Yl;Cu.default=Yl});var gC=_(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});Jl.version=void 0;Jl.version="2.84.0"});var Zl=_(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.CONNECTION_STATE=Ne.TRANSPORTS=Ne.CHANNEL_EVENTS=Ne.CHANNEL_STATES=Ne.SOCKET_STATES=Ne.MAX_PUSH_BUFFER_SIZE=Ne.WS_CLOSE_NORMAL=Ne.DEFAULT_TIMEOUT=Ne.VERSION=Ne.DEFAULT_VSN=Ne.VSN_2_0_0=Ne.VSN_1_0_0=Ne.DEFAULT_VERSION=void 0;var bC=gC();Ne.DEFAULT_VERSION=`realtime-js/${bC.version}`;Ne.VSN_1_0_0="1.0.0";Ne.VSN_2_0_0="2.0.0";Ne.DEFAULT_VSN=Ne.VSN_1_0_0;Ne.VERSION=bC.version;Ne.DEFAULT_TIMEOUT=1e4;Ne.WS_CLOSE_NORMAL=1e3;Ne.MAX_PUSH_BUFFER_SIZE=100;var yC;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(yC||(Ne.SOCKET_STATES=yC={}));var DC;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(DC||(Ne.CHANNEL_STATES=DC={}));var wC;(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"})(wC||(Ne.CHANNEL_EVENTS=wC={}));var vC;(function(t){t.websocket="websocket"})(vC||(Ne.TRANSPORTS=vC={}));var EC;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(EC||(Ne.CONNECTION_STATE=EC={}))});var _C=_(Cg=>{"use strict";Object.defineProperty(Cg,"__esModule",{value:!0});var _g=class{constructor(){this.HEADER_LENGTH=1,this.META_LENGTH=4,this.USER_BROADCAST_PUSH_META_LENGTH=5,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast"}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:new ArrayBuffer(0),h=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,d=new ArrayBuffer(this.HEADER_LENGTH+h),f=new DataView(d),p=0;f.setUint8(p++,this.KINDS.userBroadcastPush),f.setUint8(p++,u.length),f.setUint8(p++,a.length),f.setUint8(p++,o.length),f.setUint8(p++,c.length),f.setUint8(p++,this.BINARY_ENCODING),Array.from(u,v=>f.setUint8(p++,v.charCodeAt(0))),Array.from(a,v=>f.setUint8(p++,v.charCodeAt(0))),Array.from(o,v=>f.setUint8(p++,v.charCodeAt(0))),Array.from(c,v=>f.setUint8(p++,v.charCodeAt(0)));var y=new Uint8Array(d.byteLength+l.byteLength);return y.set(new Uint8Array(d),0),y.set(new Uint8Array(l),d.byteLength),y.buffer}_encodeJsonUserBroadcastPush(e){var r,n,i,s;let o=e.topic,a=(r=e.ref)!==null&&r!==void 0?r:"",u=(n=e.join_ref)!==null&&n!==void 0?n:"",c=e.payload.event,l=(s=(i=e.payload)===null||i===void 0?void 0:i.payload)!==null&&s!==void 0?s:{},d=new TextEncoder().encode(JSON.stringify(l)).buffer,f=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+a.length+o.length+c.length,p=new ArrayBuffer(this.HEADER_LENGTH+f),y=new DataView(p),v=0;y.setUint8(v++,this.KINDS.userBroadcastPush),y.setUint8(v++,u.length),y.setUint8(v++,a.length),y.setUint8(v++,o.length),y.setUint8(v++,c.length),y.setUint8(v++,this.JSON_ENCODING),Array.from(u,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(a,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(o,A=>y.setUint8(v++,A.charCodeAt(0))),Array.from(c,A=>y.setUint8(v++,A.charCodeAt(0)));var E=new Uint8Array(p.byteLength+d.byteLength);return E.set(new Uint8Array(p),0),E.set(new Uint8Array(d),p.byteLength),E.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){let n=JSON.parse(e),[i,s,o,a,u]=n;return r({join_ref:i,ref:s,topic:o,event:a,payload:u})}return r({})}_binaryDecode(e){let r=new DataView(e),n=r.getUint8(0),i=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,i)}}_decodeUserBroadcast(e,r,n){let i=r.getUint8(1),s=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4),u=this.HEADER_LENGTH+4,c=n.decode(e.slice(u,u+i));u=u+i;let l=n.decode(e.slice(u,u+s));u=u+s;let h=n.decode(e.slice(u,u+o));u=u+o;let d=e.slice(u,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,p={type:this.BROADCAST_EVENT,event:l,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}};Cg.default=_g});var Og=_(Ag=>{"use strict";Object.defineProperty(Ag,"__esModule",{value:!0});var Sg=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))}};Ag.default=Sg});var Ql=_(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.httpEndpointURL=Fe.toTimestampString=Fe.toArray=Fe.toJson=Fe.toNumber=Fe.toBoolean=Fe.convertCell=Fe.convertColumn=Fe.convertChangeData=Fe.PostgresTypes=void 0;var Ke;(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"})(Ke||(Fe.PostgresTypes=Ke={}));var q4=(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,Fe.convertColumn)(o,t,e,i),s),{}):{}};Fe.convertChangeData=q4;var H4=(t,e,r,n)=>{let i=e.find(a=>a.name===t),s=i?.type,o=r[t];return s&&!n.includes(s)?(0,Fe.convertCell)(s,o):xg(o)};Fe.convertColumn=H4;var V4=(t,e)=>{if(t.charAt(0)==="_"){let r=t.slice(1,t.length);return(0,Fe.toArray)(e,r)}switch(t){case Ke.bool:return(0,Fe.toBoolean)(e);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return(0,Fe.toNumber)(e);case Ke.json:case Ke.jsonb:return(0,Fe.toJson)(e);case Ke.timestamp:return(0,Fe.toTimestampString)(e);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return xg(e);default:return xg(e)}};Fe.convertCell=V4;var xg=t=>t,z4=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}};Fe.toBoolean=z4;var K4=t=>{if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return e}return t};Fe.toNumber=K4;var G4=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t};Fe.toJson=G4;var W4=(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,Fe.convertCell)(e,a))}return t};Fe.toArray=W4;var X4=t=>typeof t=="string"?t.replace(" ","T"):t;Fe.toTimestampString=X4;var Y4=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};Fe.httpEndpointURL=Y4});var CC=_(Ig=>{"use strict";Object.defineProperty(Ig,"__esModule",{value:!0});var J4=Zl(),Tg=class{constructor(e,r,n={},i=J4.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}};Ig.default=Tg});var Fg=_(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.REALTIME_PRESENCE_LISTEN_EVENTS=void 0;var SC;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(SC||(Su.REALTIME_PRESENCE_LISTEN_EVENTS=SC={}));var Pg=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(v=>v.presence_ref),f=h.map(v=>v.presence_ref),p=l.filter(v=>f.indexOf(v.presence_ref)<0),y=h.filter(v=>d.indexOf(v.presence_ref)<0);p.length>0&&(a[c]=p),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()}};Su.default=Pg});var Ng=_(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.REALTIME_CHANNEL_STATES=on.REALTIME_SUBSCRIBE_STATES=on.REALTIME_LISTEN_TYPES=on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=void 0;var ef=(he(),ce(fe)),Ge=Zl(),Rg=ef.__importDefault(CC()),Z4=ef.__importDefault(Og()),Q4=ef.__importDefault(Fg()),AC=ef.__importStar(Ql()),e5=Ql(),OC;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(OC||(on.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=OC={}));var Au;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Au||(on.REALTIME_LISTEN_TYPES=Au={}));var Yn;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Yn||(on.REALTIME_SUBSCRIBE_STATES=Yn={}));on.REALTIME_CHANNEL_STATES=Ge.CHANNEL_STATES;var kg=class t{constructor(e,r={config:{}},n){var i,s;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.state=Ge.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 Rg.default(this,Ge.CHANNEL_EVENTS.join,this.params,this.timeout),this.rejoinTimer=new Z4.default(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ge.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=Ge.CHANNEL_STATES.closed,this.socket._remove(this)}),this._onError(o=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,o),this.state=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ge.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=Ge.CHANNEL_STATES.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Ge.CHANNEL_EVENTS.reply,{},(o,a)=>{this._trigger(this._replyEventName(a),o)}),this.presence=new Q4.default(this),this.broadcastEndpointURL=(0,e5.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==Ge.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[Au.PRESENCE]&&this.bindings[Au.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?.(Yn.CHANNEL_ERROR,f)),this._onClose(()=>e?.(Yn.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:f})=>{var p;if(this.socket.setAuth(),f===void 0){e?.(Yn.SUBSCRIBED);return}else{let y=this.bindings.postgres_changes,v=(p=y?.length)!==null&&p!==void 0?p:0,E=[];for(let A=0;A<v;A++){let m=y[A],{filter:{event:D,schema:w,table:C,filter:F}}=m,b=f&&f[A];if(b&&b.event===D&&b.schema===w&&b.table===C&&b.filter===F)E.push(Object.assign(Object.assign({},m),{id:b.id}));else{this.unsubscribe(),this.state=Ge.CHANNEL_STATES.errored,e?.(Yn.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=E,e&&e(Yn.SUBSCRIBED);return}}).receive("error",f=>{this.state=Ge.CHANNEL_STATES.errored,e?.(Yn.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(f).join(", ")||"error")))}).receive("timeout",()=>{e?.(Yn.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===Ge.CHANNEL_STATES.joined&&e===Au.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=Ge.CHANNEL_STATES.leaving;let r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Ge.CHANNEL_EVENTS.close,"leave",this._joinRef())};this.joinPush.destroy();let n=null;return new Promise(i=>{n=new Rg.default(this,Ge.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=Ge.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 Rg.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>Ge.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}=Ge.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 p,y,v;return((p=f.filter)===null||p===void 0?void 0:p.event)==="*"||((v=(y=f.filter)===null||y===void 0?void 0:y.event)===null||v===void 0?void 0:v.toLocaleLowerCase())===o}).map(f=>f.callback(d,n)):(s=this.bindings[o])===null||s===void 0||s.filter(f=>{var p,y,v,E,A,m;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in f){let D=f.id,w=(p=f.filter)===null||p===void 0?void 0:p.event;return D&&((y=r.ids)===null||y===void 0?void 0:y.includes(D))&&(w==="*"||w?.toLocaleLowerCase()===((v=r.data)===null||v===void 0?void 0:v.type.toLocaleLowerCase()))}else{let D=(A=(E=f?.filter)===null||E===void 0?void 0:E.event)===null||A===void 0?void 0:A.toLocaleLowerCase();return D==="*"||D===((m=r?.event)===null||m===void 0?void 0:m.toLocaleLowerCase())}else return f.type.toLocaleLowerCase()===o}).map(f=>{if(typeof d=="object"&&"ids"in d){let p=d.data,{schema:y,table:v,commit_timestamp:E,type:A,errors:m}=p;d=Object.assign(Object.assign({},{schema:y,table:v,commit_timestamp:E,eventType:A,new:{},old:{},errors:m}),this._getPayloadRecords(p))}f.callback(d,n)})}_isClosed(){return this.state===Ge.CHANNEL_STATES.closed}_isJoined(){return this.state===Ge.CHANNEL_STATES.joined}_isJoining(){return this.state===Ge.CHANNEL_STATES.joining}_isLeaving(){return this.state===Ge.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(Ge.CHANNEL_EVENTS.close,{},e)}_onError(e){this._on(Ge.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=Ge.CHANNEL_STATES.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=AC.convertChangeData(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=AC.convertChangeData(e.columns,e.old_record)),r}};on.default=kg});var xC=_(Bg=>{"use strict";Object.defineProperty(Bg,"__esModule",{value:!0});var rf=(he(),ce(fe)),t5=rf.__importDefault(bg()),St=Zl(),r5=rf.__importDefault(_C()),n5=rf.__importDefault(Og()),i5=Ql(),s5=rf.__importDefault(Ng()),$g=()=>{},tf={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},o5=[1e3,2e3,5e3,1e4],a5=1e4,u5=`
9
9
  addEventListener("message", (e) => {
10
10
  if (e.data.event === "start") {
11
11
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
@@ -23,10 +23,10 @@ Option 2: Install and provide the "ws" package:
23
23
  const client = new RealtimeClient(url, {
24
24
  ...options,
25
25
  transport: ws
26
- })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.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")},typeof this.conn.close=="function"&&(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 St.SOCKET_STATES.connecting:return St.CONNECTION_STATE.Connecting;case St.SOCKET_STATES.open:return St.CONNECTION_STATE.Open;case St.SOCKET_STATES.closing:return St.CONNECTION_STATE.Closing;default:return St.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===St.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 s5.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(St.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},tf.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(){if(this.conn){if(this.conn.readyState===St.SOCKET_STATES.open||this.conn.readyState===St.SOCKET_STATES.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}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._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),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(St.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([u5],{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:St.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(St.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 n5.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},tf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l,h,d,f;switch(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:St.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:tf.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:$g,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:St.DEFAULT_VSN,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=(c=e?.reconnectAfterMs)!==null&&c!==void 0?c:(m=>o5[m-1]||a5),this.vsn){case St.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((m,y)=>y(JSON.stringify(m))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((m,y)=>y(JSON.parse(m)));break;case St.VSN_2_0_0:this.encode=(d=e?.encode)!==null&&d!==void 0?d:this.serializer.encode.bind(this.serializer),this.decode=(f=e?.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Bg.default=Lg});var jg=_(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.WebSocketFactory=Tt.REALTIME_CHANNEL_STATES=Tt.REALTIME_SUBSCRIBE_STATES=Tt.REALTIME_PRESENCE_LISTEN_EVENTS=Tt.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Tt.REALTIME_LISTEN_TYPES=Tt.RealtimeClient=Tt.RealtimeChannel=Tt.RealtimePresence=void 0;var nf=(he(),ce(fe)),c5=nf.__importDefault(xC());Tt.RealtimeClient=c5.default;var Ou=nf.__importStar(Ng());Tt.RealtimeChannel=Ou.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Ou.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Ou.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_CHANNEL_STATES}});var TC=nf.__importStar(Fg());Tt.RealtimePresence=TC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return TC.REALTIME_PRESENCE_LISTEN_EVENTS}});var l5=nf.__importDefault(bg());Tt.WebSocketFactory=l5.default});var Fi=_(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.StorageUnknownError=Jn.StorageApiError=Jn.StorageError=void 0;Jn.isStorageError=f5;var xu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Jn.StorageError=xu;function f5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Mg=class extends xu{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}}};Jn.StorageApiError=Mg;var Ug=class extends xu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Jn.StorageUnknownError=Ug});var Tu=_(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isPlainObject=qr.recursiveToCamel=qr.resolveResponse=qr.resolveFetch=void 0;var h5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);qr.resolveFetch=h5;var d5=()=>Response;qr.resolveResponse=d5;var p5=t=>{if(Array.isArray(t))return t.map(r=>(0,qr.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,qr.recursiveToCamel)(n)}),e};qr.recursiveToCamel=p5;var m5=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=m5});var sf=_(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.get=D5;gs.post=w5;gs.put=v5;gs.head=E5;gs.remove=b5;var ms=(he(),ce(fe)),qg=Fi(),IC=Tu(),Hg=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)},g5=(t,e,r)=>ms.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,IC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new qg.StorageApiError(Hg(i),s,o))}).catch(i=>{e(new qg.StorageUnknownError(Hg(i),i))}):e(new qg.StorageUnknownError(Hg(t),t))}),y5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,IC.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 Iu(t,e,r,n,i,s){return ms.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,y5(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>g5(u,a,n))})})}function D5(t,e,r,n){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function w5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,i,r)})}function v5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,i,r)})}function E5(t,e,r,n){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function b5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,i,r)})}});var PC=_(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});var _5=(he(),ce(fe)),C5=Fi(),Vg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return _5.__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,C5.isStorageError)(e))return{data:null,error:e};throw e}})}};zg.default=Vg});var kC=_(Gg=>{"use strict";var FC;Object.defineProperty(Gg,"__esModule",{value:!0});var RC=(he(),ce(fe)),S5=Fi(),A5=RC.__importDefault(PC()),Kg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[FC]="BlobDownloadBuilder",this.promise=null}asStream(){return new A5.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 RC.__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,S5.isStorageError)(e))return{data:null,error:e};throw e}})}};FC=Symbol.toStringTag;Gg.default=Kg});var LC=_(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Fi(),wr=sf(),NC=Tu(),O5=rr.__importDefault(kC()),x5={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},$C={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Wg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,NC.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({},$C),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"?wr.put:wr.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,Dr.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:$C.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,wr.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,Dr.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,wr.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 Dr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new O5.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,wr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,NC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.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,wr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n)&&n instanceof Dr.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,wr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Dr.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({},x5),r),{prefix:e||""});return{data:yield(0,wr.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,Dr.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,wr.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,Dr.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("&")}};Xg.default=Wg});var Yg=_(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.version=void 0;of.version="2.84.0"});var Jg=_(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var T5=Yg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${T5.version}`}});var BC=_(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});var Po=(he(),ce(fe)),I5=Jg(),Fo=Fi(),Ro=sf(),P5=Tu(),Zg=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({},I5.DEFAULT_HEADERS),r),this.fetch=(0,P5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Po.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Po.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Ro.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,Fo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.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,Fo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.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():""}};Qg.default=Zg});var sy=_(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var ey=(he(),ce(fe)),F5=Jg(),ty=Fi(),ry=sf(),R5=Tu(),ny=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},F5.DEFAULT_HEADERS),r),this.fetch=(0,R5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return ey.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ry.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return ey.__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,ry.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ey.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ry.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}};iy.default=ny});var cf=_(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.DEFAULT_HEADERS=void 0;var k5=Yg();uf.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${k5.version}`,"Content-Type":"application/json"}});var ko=_(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.StorageVectorsErrorCode=an.StorageVectorsUnknownError=an.StorageVectorsApiError=an.StorageVectorsError=void 0;an.isStorageVectorsError=N5;var Pu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};an.StorageVectorsError=Pu;function N5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var oy=class extends Pu{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}}};an.StorageVectorsApiError=oy;var ay=class extends Pu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};an.StorageVectorsUnknownError=ay;var jC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(jC||(an.StorageVectorsErrorCode=jC={}))});var No=_(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.validateVectorDimension=Hr.normalizeToFloat32=Hr.isPlainObject=Hr.resolveResponse=Hr.resolveFetch=void 0;var $5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Hr.resolveFetch=$5;var L5=()=>Response;Hr.resolveResponse=L5;var B5=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)};Hr.isPlainObject=B5;var j5=t=>Array.from(new Float32Array(t));Hr.normalizeToFloat32=j5;var M5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};Hr.validateVectorDimension=M5});var hf=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.get=V5;Lo.post=z5;Lo.put=K5;Lo.remove=G5;var $o=(he(),ce(fe)),lf=ko(),U5=No(),MC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),q5=(t,e,r)=>$o.__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 lf.StorageVectorsApiError(MC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))}}else e(new lf.StorageVectorsUnknownError(MC(t),t))}),H5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,U5.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 ff(t,e,r,n,i,s){return $o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,H5(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=>q5(u,a,n))})})}function V5(t,e,r,n){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"GET",e,r,n)})}function z5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"POST",e,n,i,r)})}function K5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"PUT",e,n,i,r)})}function G5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"DELETE",e,n,i,r)})}});var ly=_(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});var df=(he(),ce(fe)),W5=cf(),pf=ko(),mf=hf(),X5=No(),uy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},W5.DEFAULT_HEADERS),r),this.fetch=(0,X5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};cy.default=uy});var dy=_(hy=>{"use strict";Object.defineProperty(hy,"__esModule",{value:!0});var Fu=(he(),ce(fe)),Y5=cf(),Ru=ko(),ku=hf(),J5=No(),fy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Y5.DEFAULT_HEADERS),r),this.fetch=(0,J5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};hy.default=fy});var gy=_(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});var gf=(he(),ce(fe)),Z5=cf(),yf=ko(),Df=hf(),Q5=No(),py=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Z5.DEFAULT_HEADERS),r),this.fetch=(0,Q5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return gf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};my.default=py});var UC=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.VectorIndexScope=Ri.VectorBucketScope=Ri.StorageVectorsClient=void 0;var Vr=(he(),ce(fe)),e9=Vr.__importDefault(ly()),t9=Vr.__importDefault(dy()),r9=Vr.__importDefault(gy()),yy=class extends r9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new wf(this.url,this.headers,e,this.fetch)}};Ri.StorageVectorsClient=yy;var wf=class extends e9.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 Vr.__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 Vr.__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 Vr.__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 Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new vf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Ri.VectorBucketScope=wf;var vf=class extends t9.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 Vr.__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 Vr.__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 Vr.__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 Vr.__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 Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Ri.VectorIndexScope=vf});var vy=_(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var Dy=(he(),ce(fe)),wy=UC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return wy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return wy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return wy.VectorIndexScope}});var n9=gy();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return Dy.__importDefault(n9).default}});var i9=ly();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return Dy.__importDefault(i9).default}});var s9=dy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return Dy.__importDefault(s9).default}});var Nu=ko();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Nu.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Nu.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Nu.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Nu.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Nu.isStorageVectorsError}});var $u=No();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return $u.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return $u.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return $u.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return $u.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return $u.validateVectorDimension}})});var qC=_(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.StorageClient=void 0;var by=(he(),ce(fe)),o9=by.__importDefault(LC()),a9=by.__importDefault(BC()),u9=by.__importDefault(sy()),c9=vy(),Ey=class extends a9.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new o9.default(this.url,this.headers,e,this.fetch)}get vectors(){return new c9.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new u9.default(this.url+"/iceberg",this.headers,this.fetch)}};Ef.StorageClient=Ey});var VC=_(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0})});var zC=_(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.StorageAnalyticsClient=Zn.StorageClient=void 0;var bf=(he(),ce(fe)),l9=qC();Object.defineProperty(Zn,"StorageClient",{enumerable:!0,get:function(){return l9.StorageClient}});var f9=sy();Object.defineProperty(Zn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return bf.__importDefault(f9).default}});bf.__exportStar(VC(),Zn);bf.__exportStar(Fi(),Zn);bf.__exportStar(vy(),Zn)});var KC=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var GC=_(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DEFAULT_REALTIME_OPTIONS=Fr.DEFAULT_AUTH_OPTIONS=Fr.DEFAULT_DB_OPTIONS=Fr.DEFAULT_GLOBAL_OPTIONS=Fr.DEFAULT_HEADERS=void 0;var h9=KC(),Lu="";typeof Deno<"u"?Lu="deno":typeof document<"u"?Lu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Lu="react-native":Lu="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Lu}/${h9.version}`};Fr.DEFAULT_GLOBAL_OPTIONS={headers:Fr.DEFAULT_HEADERS};Fr.DEFAULT_DB_OPTIONS={schema:"public"};Fr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Fr.DEFAULT_REALTIME_OPTIONS={}});var WC=_(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.fetchWithAuth=yn.resolveHeadersConstructor=yn.resolveFetch=void 0;var d9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);yn.resolveFetch=d9;var p9=()=>Headers;yn.resolveHeadersConstructor=p9;var m9=(t,e,r)=>{let n=(0,yn.resolveFetch)(r),i=(0,yn.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}))}};yn.fetchWithAuth=m9});var YC=_(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.isBrowser=void 0;ki.uuid=g9;ki.ensureTrailingSlash=XC;ki.applySettingDefaults=D9;ki.validateSupabaseUrl=w9;function g9(){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 XC(t){return t.endsWith("/")?t:t+"/"}var y9=()=>typeof window<"u";ki.isBrowser=y9;function D9(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 w9(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(XC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var _y=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.version=void 0;Cf.version="2.84.0"});var Sf=_(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.JWKS_TTL=Me.BASE64URL_REGEX=Me.API_VERSIONS=Me.API_VERSION_HEADER_NAME=Me.NETWORK_FAILURE=Me.DEFAULT_HEADERS=Me.AUDIENCE=Me.STORAGE_KEY=Me.GOTRUE_URL=Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD=Me.AUTO_REFRESH_TICK_DURATION_MS=void 0;var v9=_y();Me.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;Me.AUTO_REFRESH_TICK_THRESHOLD=3;Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD*Me.AUTO_REFRESH_TICK_DURATION_MS;Me.GOTRUE_URL="http://localhost:9999";Me.STORAGE_KEY="supabase.auth.token";Me.AUDIENCE="";Me.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${v9.version}`};Me.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};Me.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";Me.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};Me.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;Me.JWKS_TTL=600*1e3});var ys=_(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.AuthInvalidJwtError=Ae.AuthWeakPasswordError=Ae.AuthRetryableFetchError=Ae.AuthPKCEGrantCodeExchangeError=Ae.AuthImplicitGrantRedirectError=Ae.AuthInvalidCredentialsError=Ae.AuthInvalidTokenResponseError=Ae.AuthSessionMissingError=Ae.CustomAuthError=Ae.AuthUnknownError=Ae.AuthApiError=Ae.AuthError=void 0;Ae.isAuthError=jo;Ae.isAuthApiError=E9;Ae.isAuthSessionMissingError=b9;Ae.isAuthImplicitGrantRedirectError=_9;Ae.isAuthRetryableFetchError=C9;Ae.isAuthWeakPasswordError=S9;var Bo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Bo;function jo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var Cy=class extends Bo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=Cy;function E9(t){return jo(t)&&t.name==="AuthApiError"}var Sy=class extends Bo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Sy;var un=class extends Bo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=un;var Ay=class extends un{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Ay;function b9(t){return jo(t)&&t.name==="AuthSessionMissingError"}var Oy=class extends un{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Oy;var xy=class extends un{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=xy;var Ty=class extends un{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}}};Ae.AuthImplicitGrantRedirectError=Ty;function _9(t){return jo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Iy=class extends un{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}}};Ae.AuthPKCEGrantCodeExchangeError=Iy;var Py=class extends un{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Py;function C9(t){return jo(t)&&t.name==="AuthRetryableFetchError"}var Fy=class extends un{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Fy;function S9(t){return jo(t)&&t.name==="AuthWeakPasswordError"}var Ry=class extends un{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Ry});var Of=_(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Bu;zr.byteFromBase64URL=ky;zr.stringToBase64URL=O9;zr.stringFromBase64URL=x9;zr.codepointToUTF8=ZC;zr.stringToUTF8=Ny;zr.stringFromUTF8=QC;zr.base64UrlToUint8Array=T9;zr.stringToUint8Array=I9;zr.bytesToBase64URL=P9;var Af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),JC=`
27
- \r=`.split(""),A9=(()=>{let t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<JC.length;e+=1)t[JC[e].charCodeAt(0)]=-2;for(let e=0;e<Af.length;e+=1)t[Af[e].charCodeAt(0)]=e;return t})();function Bu(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(Af[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(Af[n]),e.queuedBits-=6}}function ky(t,e,r){let n=A9[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 O9(t){let e=[],r=i=>{e.push(i)},n={queue:0,queuedBits:0};return Ny(t,i=>{Bu(i,n,r)}),Bu(null,n,r),e.join("")}function x9(t){let e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=o=>{QC(o,n,r)};for(let o=0;o<t.length;o+=1)ky(t.charCodeAt(o),i,s);return e.join("")}function ZC(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 Ny(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}ZC(n,e)}}function QC(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 T9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)ky(t.charCodeAt(i),r,n);return new Uint8Array(e)}function I9(t){let e=[];return Ny(t,r=>e.push(r)),new Uint8Array(e)}function P9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>Bu(i,r,n)),Bu(null,r,n),e.join("")}});var Mo=_(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=F9;be.generateCallbackId=R9;be.parseParametersFromURL=$9;be.decodeJWT=q9;be.sleep=H9;be.retryable=V9;be.generatePKCEVerifier=rS;be.generatePKCEChallenge=nS;be.getCodeChallengeAndMethod=G9;be.parseResponseAPIVersion=X9;be.validateExp=Y9;be.getAlgorithm=J9;be.validateUUID=Q9;be.userNotAvailableProxy=eH;be.insecureUserWarningProxy=tH;be.deepClone=rH;var tS=Sf(),eS=ys(),$y=Of();function F9(t){return Math.round(Date.now()/1e3)+t}function R9(){return Symbol("auth-callback")}var k9=()=>typeof window<"u"&&typeof document<"u";be.isBrowser=k9;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 $9(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 L9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);be.resolveFetch=L9;var B9=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function";be.looksLikeFetchResponse=B9;var j9=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))};be.setItemAsync=j9;var M9=async(t,e)=>{let r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}};be.getItemAsync=M9;var U9=async(t,e)=>{await t.removeItem(e)};be.removeItemAsync=U9;var xf=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=xf;xf.promiseConstructor=Promise;function q9(t){let e=t.split(".");if(e.length!==3)throw new eS.AuthInvalidJwtError("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!tS.BASE64URL_REGEX.test(e[n]))throw new eS.AuthInvalidJwtError("JWT not in base64url format");return{header:JSON.parse((0,$y.stringFromBase64URL)(e[0])),payload:JSON.parse((0,$y.stringFromBase64URL)(e[1])),signature:(0,$y.base64UrlToUint8Array)(e[2]),raw:{header:e[0],payload:e[1]}}}async function H9(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function V9(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 z9(t){return("0"+t.toString(16)).substr(-2)}function rS(){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,z9).join("")}async function K9(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 nS(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 K9(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function G9(t,e,r=!1){let n=rS(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await(0,be.setItemAsync)(t,`${e}-code-verifier`,i);let s=await nS(n);return[s,n===s?"plain":"s256"]}var W9=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function X9(t){let e=t.headers.get(tS.API_VERSION_HEADER_NAME);if(!e||!e.match(W9))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Y9(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 J9(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 Z9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Q9(t){if(!Z9.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function eH(){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 tH(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 rH(t){return JSON.parse(JSON.stringify(t))}});var jy=_(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.handleError=By;Dn._request=oH;Dn._sessionResponse=iS;Dn._sessionResponsePassword=uH;Dn._userResponse=cH;Dn._ssoResponse=lH;Dn._generateLinkResponse=fH;Dn._noResolveJsonResponse=hH;var nH=(he(),ce(fe)),Tf=Sf(),Ly=Mo(),Ni=ys(),ws=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),iH=[502,503,504];async function By(t){var e;if(!(0,Ly.looksLikeFetchResponse)(t))throw new Ni.AuthRetryableFetchError(ws(t),0);if(iH.includes(t.status))throw new Ni.AuthRetryableFetchError(ws(t),t.status);let r;try{r=await t.json()}catch(s){throw new Ni.AuthUnknownError(ws(s),s)}let n,i=(0,Ly.parseResponseAPIVersion)(t);if(i&&i.getTime()>=Tf.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 Ni.AuthWeakPasswordError(ws(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ni.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 Ni.AuthWeakPasswordError(ws(r),t.status,r.weak_password.reasons);throw new Ni.AuthApiError(ws(r),t.status||500,n)}var sH=(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 oH(t,e,r,n){var i;let s=Object.assign({},n?.headers);s[Tf.API_VERSION_HEADER_NAME]||(s[Tf.API_VERSION_HEADER_NAME]=Tf.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 aH(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 aH(t,e,r,n,i,s){let o=sH(e,n,i,s),a;try{a=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new Ni.AuthRetryableFetchError(ws(u),0)}if(a.ok||await By(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await By(u)}}function iS(t){var e;let r=null;dH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,Ly.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function uH(t){let e=iS(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 cH(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function lH(t){return{data:t,error:null}}function fH(t){let{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=t,o=nH.__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 hH(t){return t}function dH(t){return t.access_token&&t.refresh_token&&t.expires_in}});var My=_(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.SIGN_OUT_SCOPES=void 0;If.SIGN_OUT_SCOPES=["global","local","others"]});var Pf=_(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});var pH=(he(),ce(fe)),ot=jy(),vs=Mo(),Uy=My(),Kt=ys(),qy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,vs.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=Uy.SIGN_OUT_SCOPES[0]){if(Uy.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Uy.SIGN_OUT_SCOPES.join(", ")}`);try{return await(0,ot._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,ot._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ot._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=pH.__rest(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n?.newEmail,delete i.newEmail),await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:ot._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,ot._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ot._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,ot._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:ot._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)),v=JSON.parse(m.split(";")[1].split("=")[1]);c[`${v}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,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ot._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){(0,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){(0,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){(0,vs.validateUUID)(e.userId);try{let{data:r,error:n}=await(0,ot._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,vs.validateUUID)(e.userId),(0,vs.validateUUID)(e.id);try{return{data:await(0,ot._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,ot._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:ot._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)),v=JSON.parse(m.split(";")[1].split("=")[1]);c[`${v}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,ot._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,ot._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,ot._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,ot._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,ot._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}}};Hy.default=qy});var sS=_(Vy=>{"use strict";Object.defineProperty(Vy,"__esModule",{value:!0});Vy.memoryLocalStorageAdapter=mH;function mH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var zy=_(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.ProcessLockAcquireTimeoutError=Rt.NavigatorLockAcquireTimeoutError=Rt.LockAcquireTimeoutError=Rt.internals=void 0;Rt.navigatorLock=yH;Rt.processLock=DH;var gH=Mo();Rt.internals={debug:!!(globalThis&&(0,gH.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var ju=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Rt.LockAcquireTimeoutError=ju;var Ff=class extends ju{};Rt.NavigatorLockAcquireTimeoutError=Ff;var Rf=class extends ju{};Rt.ProcessLockAcquireTimeoutError=Rf;async function yH(t,e,r){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Rt.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){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ff(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Rt.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 oS={};async function DH(t,e,r){var n;let i=(n=oS[t])!==null&&n!==void 0?n:Promise.resolve(),s=Promise.race([i.catch(()=>null),e>=0?new Promise((o,a)=>{setTimeout(()=>{a(new Rf(`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 oS[t]=s.catch(async o=>{if(o&&o.isAcquireTimeout)return await i,null;throw o}),await s}});var aS=_(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.polyfillGlobalThis=wH;function wH(){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 cS=_(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.getAddress=uS;Uo.fromHex=vH;Uo.toHex=EH;Uo.createSiweMessage=bH;function uS(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function vH(t){return parseInt(t,16)}function EH(t){let e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function bH(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(`
28
- `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}let f=uS(t.address),m=l?`${l}://${n}`:n,y=t.statement?`${t.statement}
29
- `:"",v=`${m} wants you to sign in with your Ethereum account:
26
+ })`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.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")},typeof this.conn.close=="function"&&(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 St.SOCKET_STATES.connecting:return St.CONNECTION_STATE.Connecting;case St.SOCKET_STATES.open:return St.CONNECTION_STATE.Open;case St.SOCKET_STATES.closing:return St.CONNECTION_STATE.Closing;default:return St.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===St.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 s5.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(St.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},tf.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(){if(this.conn){if(this.conn.readyState===St.SOCKET_STATES.open||this.conn.readyState===St.SOCKET_STATES.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}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._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),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(St.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([u5],{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:St.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(St.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 n5.default(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},tf.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var r,n,i,s,o,a,u,c,l,h,d,f;switch(this.transport=(r=e?.transport)!==null&&r!==void 0?r:null,this.timeout=(n=e?.timeout)!==null&&n!==void 0?n:St.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:tf.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:$g,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:St.DEFAULT_VSN,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=(c=e?.reconnectAfterMs)!==null&&c!==void 0?c:(p=>o5[p-1]||a5),this.vsn){case St.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((p,y)=>y(JSON.stringify(p))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((p,y)=>y(JSON.parse(p)));break;case St.VSN_2_0_0:this.encode=(d=e?.encode)!==null&&d!==void 0?d:this.serializer.encode.bind(this.serializer),this.decode=(f=e?.decode)!==null&&f!==void 0?f:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e?.workerUrl}}};Bg.default=Lg});var jg=_(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.WebSocketFactory=Tt.REALTIME_CHANNEL_STATES=Tt.REALTIME_SUBSCRIBE_STATES=Tt.REALTIME_PRESENCE_LISTEN_EVENTS=Tt.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Tt.REALTIME_LISTEN_TYPES=Tt.RealtimeClient=Tt.RealtimeChannel=Tt.RealtimePresence=void 0;var nf=(he(),ce(fe)),c5=nf.__importDefault(xC());Tt.RealtimeClient=c5.default;var Ou=nf.__importStar(Ng());Tt.RealtimeChannel=Ou.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Ou.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Ou.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Ou.REALTIME_CHANNEL_STATES}});var TC=nf.__importStar(Fg());Tt.RealtimePresence=TC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return TC.REALTIME_PRESENCE_LISTEN_EVENTS}});var l5=nf.__importDefault(bg());Tt.WebSocketFactory=l5.default});var Fi=_(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.StorageUnknownError=Jn.StorageApiError=Jn.StorageError=void 0;Jn.isStorageError=f5;var xu=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Jn.StorageError=xu;function f5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var Mg=class extends xu{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}}};Jn.StorageApiError=Mg;var Ug=class extends xu{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Jn.StorageUnknownError=Ug});var Tu=_(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.isPlainObject=qr.recursiveToCamel=qr.resolveResponse=qr.resolveFetch=void 0;var h5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);qr.resolveFetch=h5;var d5=()=>Response;qr.resolveResponse=d5;var p5=t=>{if(Array.isArray(t))return t.map(r=>(0,qr.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,qr.recursiveToCamel)(n)}),e};qr.recursiveToCamel=p5;var m5=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=m5});var sf=_(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.get=D5;gs.post=w5;gs.put=v5;gs.head=E5;gs.remove=b5;var ms=(he(),ce(fe)),qg=Fi(),IC=Tu(),Hg=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)},g5=(t,e,r)=>ms.__awaiter(void 0,void 0,void 0,function*(){let n=yield(0,IC.resolveResponse)();t instanceof n&&!r?.noResolveJson?t.json().then(i=>{let s=t.status||500,o=i?.statusCode||s+"";e(new qg.StorageApiError(Hg(i),s,o))}).catch(i=>{e(new qg.StorageUnknownError(Hg(i),i))}):e(new qg.StorageUnknownError(Hg(t),t))}),y5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,IC.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 Iu(t,e,r,n,i,s){return ms.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,y5(e,n,i,s)).then(u=>{if(!u.ok)throw u;return n?.noResolveJson?u:u.json()}).then(u=>o(u)).catch(u=>g5(u,a,n))})})}function D5(t,e,r,n){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"GET",e,r,n)})}function w5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"POST",e,n,i,r)})}function v5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"PUT",e,n,i,r)})}function E5(t,e,r,n){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function b5(t,e,r,n,i){return ms.__awaiter(this,void 0,void 0,function*(){return Iu(t,"DELETE",e,n,i,r)})}});var PC=_(zg=>{"use strict";Object.defineProperty(zg,"__esModule",{value:!0});var _5=(he(),ce(fe)),C5=Fi(),Vg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r}then(e,r){return this.execute().then(e,r)}execute(){return _5.__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,C5.isStorageError)(e))return{data:null,error:e};throw e}})}};zg.default=Vg});var kC=_(Gg=>{"use strict";var FC;Object.defineProperty(Gg,"__esModule",{value:!0});var RC=(he(),ce(fe)),S5=Fi(),A5=RC.__importDefault(PC()),Kg=class{constructor(e,r){this.downloadFn=e,this.shouldThrowOnError=r,this[FC]="BlobDownloadBuilder",this.promise=null}asStream(){return new A5.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 RC.__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,S5.isStorageError)(e))return{data:null,error:e};throw e}})}};FC=Symbol.toStringTag;Gg.default=Kg});var LC=_(Xg=>{"use strict";Object.defineProperty(Xg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Fi(),wr=sf(),NC=Tu(),O5=rr.__importDefault(kC()),x5={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},$C={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},Wg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1,this.url=e,this.headers=r,this.bucketId=n,this.fetch=(0,NC.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({},$C),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"?wr.put:wr.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,Dr.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:$C.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,wr.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,Dr.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,wr.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 Dr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.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,Dr.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,wr.get)(this.fetch,`${this.url}/${i}/${a}${o}`,{headers:this.headers,noResolveJson:!0});return new O5.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,wr.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,NC.recursiveToCamel)(n),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.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,wr.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,Dr.isStorageError)(n)&&n instanceof Dr.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,wr.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Dr.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({},x5),r),{prefix:e||""});return{data:yield(0,wr.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,Dr.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,wr.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,Dr.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("&")}};Xg.default=Wg});var Yg=_(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.version=void 0;of.version="2.84.0"});var Jg=_(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var T5=Yg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${T5.version}`}});var BC=_(Qg=>{"use strict";Object.defineProperty(Qg,"__esModule",{value:!0});var Po=(he(),ce(fe)),I5=Jg(),Fo=Fi(),Ro=sf(),P5=Tu(),Zg=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({},I5.DEFAULT_HEADERS),r),this.fetch=(0,P5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Po.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Po.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Ro.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,Fo.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.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,Fo.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Po.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ro.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fo.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():""}};Qg.default=Zg});var sy=_(iy=>{"use strict";Object.defineProperty(iy,"__esModule",{value:!0});var ey=(he(),ce(fe)),F5=Jg(),ty=Fi(),ry=sf(),R5=Tu(),ny=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},F5.DEFAULT_HEADERS),r),this.fetch=(0,R5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return ey.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ry.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return ey.__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,ry.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return ey.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ry.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ty.isStorageError)(r))return{data:null,error:r};throw r}})}};iy.default=ny});var cf=_(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.DEFAULT_HEADERS=void 0;var k5=Yg();uf.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${k5.version}`,"Content-Type":"application/json"}});var ko=_(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.StorageVectorsErrorCode=an.StorageVectorsUnknownError=an.StorageVectorsApiError=an.StorageVectorsError=void 0;an.isStorageVectorsError=N5;var Pu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};an.StorageVectorsError=Pu;function N5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var oy=class extends Pu{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}}};an.StorageVectorsApiError=oy;var ay=class extends Pu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};an.StorageVectorsUnknownError=ay;var jC;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(jC||(an.StorageVectorsErrorCode=jC={}))});var No=_(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.validateVectorDimension=Hr.normalizeToFloat32=Hr.isPlainObject=Hr.resolveResponse=Hr.resolveFetch=void 0;var $5=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Hr.resolveFetch=$5;var L5=()=>Response;Hr.resolveResponse=L5;var B5=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)};Hr.isPlainObject=B5;var j5=t=>Array.from(new Float32Array(t));Hr.normalizeToFloat32=j5;var M5=(t,e)=>{if(e!==void 0&&t.float32.length!==e)throw new Error(`Vector dimension mismatch: expected ${e}, got ${t.float32.length}`)};Hr.validateVectorDimension=M5});var hf=_(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.get=V5;Lo.post=z5;Lo.put=K5;Lo.remove=G5;var $o=(he(),ce(fe)),lf=ko(),U5=No(),MC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),q5=(t,e,r)=>$o.__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 lf.StorageVectorsApiError(MC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new lf.StorageVectorsApiError(a,i,o))}}else e(new lf.StorageVectorsUnknownError(MC(t),t))}),H5=(t,e,r,n)=>{let i={method:t,headers:e?.headers||{}};return t==="GET"||!n?i:((0,U5.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 ff(t,e,r,n,i,s){return $o.__awaiter(this,void 0,void 0,function*(){return new Promise((o,a)=>{t(r,H5(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=>q5(u,a,n))})})}function V5(t,e,r,n){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"GET",e,r,n)})}function z5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"POST",e,n,i,r)})}function K5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"PUT",e,n,i,r)})}function G5(t,e,r,n,i){return $o.__awaiter(this,void 0,void 0,function*(){return ff(t,"DELETE",e,n,i,r)})}});var ly=_(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});var df=(he(),ce(fe)),W5=cf(),pf=ko(),mf=hf(),X5=No(),uy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},W5.DEFAULT_HEADERS),r),this.fetch=(0,X5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,mf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,pf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return df.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,mf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,pf.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};cy.default=uy});var dy=_(hy=>{"use strict";Object.defineProperty(hy,"__esModule",{value:!0});var Fu=(he(),ce(fe)),Y5=cf(),Ru=ko(),ku=hf(),J5=No(),fy=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Y5.DEFAULT_HEADERS),r),this.fetch=(0,J5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Fu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ku.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Fu.__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,ku.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Ru.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};hy.default=fy});var gy=_(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});var gf=(he(),ce(fe)),Z5=cf(),yf=ko(),Df=hf(),Q5=No(),py=class{constructor(e,r={},n){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Z5.DEFAULT_HEADERS),r),this.fetch=(0,Q5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return gf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,Df.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return gf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,Df.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,yf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};my.default=py});var UC=_(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.VectorIndexScope=Ri.VectorBucketScope=Ri.StorageVectorsClient=void 0;var Vr=(he(),ce(fe)),e9=Vr.__importDefault(ly()),t9=Vr.__importDefault(dy()),r9=Vr.__importDefault(gy()),yy=class extends r9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new wf(this.url,this.headers,e,this.fetch)}};Ri.StorageVectorsClient=yy;var wf=class extends e9.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 Vr.__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 Vr.__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 Vr.__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 Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new vf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Ri.VectorBucketScope=wf;var vf=class extends t9.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 Vr.__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 Vr.__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 Vr.__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 Vr.__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 Vr.__awaiter(this,void 0,void 0,function*(){return r.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}};Ri.VectorIndexScope=vf});var vy=_(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.validateVectorDimension=Ce.normalizeToFloat32=Ce.isPlainObject=Ce.resolveResponse=Ce.resolveFetch=Ce.isStorageVectorsError=Ce.StorageVectorsErrorCode=Ce.StorageVectorsUnknownError=Ce.StorageVectorsApiError=Ce.StorageVectorsError=Ce.VectorDataApi=Ce.VectorIndexApi=Ce.VectorBucketApi=Ce.VectorIndexScope=Ce.VectorBucketScope=Ce.StorageVectorsClient=void 0;var Dy=(he(),ce(fe)),wy=UC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return wy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return wy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return wy.VectorIndexScope}});var n9=gy();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return Dy.__importDefault(n9).default}});var i9=ly();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return Dy.__importDefault(i9).default}});var s9=dy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return Dy.__importDefault(s9).default}});var Nu=ko();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return Nu.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return Nu.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return Nu.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return Nu.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return Nu.isStorageVectorsError}});var $u=No();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return $u.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return $u.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return $u.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return $u.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return $u.validateVectorDimension}})});var qC=_(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});Ef.StorageClient=void 0;var by=(he(),ce(fe)),o9=by.__importDefault(LC()),a9=by.__importDefault(BC()),u9=by.__importDefault(sy()),c9=vy(),Ey=class extends a9.default{constructor(e,r={},n,i){super(e,r,n,i)}from(e){return new o9.default(this.url,this.headers,e,this.fetch)}get vectors(){return new c9.StorageVectorsClient(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new u9.default(this.url+"/iceberg",this.headers,this.fetch)}};Ef.StorageClient=Ey});var VC=_(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0})});var zC=_(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.StorageAnalyticsClient=Zn.StorageClient=void 0;var bf=(he(),ce(fe)),l9=qC();Object.defineProperty(Zn,"StorageClient",{enumerable:!0,get:function(){return l9.StorageClient}});var f9=sy();Object.defineProperty(Zn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return bf.__importDefault(f9).default}});bf.__exportStar(VC(),Zn);bf.__exportStar(Fi(),Zn);bf.__exportStar(vy(),Zn)});var KC=_(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var GC=_(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.DEFAULT_REALTIME_OPTIONS=Fr.DEFAULT_AUTH_OPTIONS=Fr.DEFAULT_DB_OPTIONS=Fr.DEFAULT_GLOBAL_OPTIONS=Fr.DEFAULT_HEADERS=void 0;var h9=KC(),Lu="";typeof Deno<"u"?Lu="deno":typeof document<"u"?Lu="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Lu="react-native":Lu="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${Lu}/${h9.version}`};Fr.DEFAULT_GLOBAL_OPTIONS={headers:Fr.DEFAULT_HEADERS};Fr.DEFAULT_DB_OPTIONS={schema:"public"};Fr.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Fr.DEFAULT_REALTIME_OPTIONS={}});var WC=_(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.fetchWithAuth=yn.resolveHeadersConstructor=yn.resolveFetch=void 0;var d9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);yn.resolveFetch=d9;var p9=()=>Headers;yn.resolveHeadersConstructor=p9;var m9=(t,e,r)=>{let n=(0,yn.resolveFetch)(r),i=(0,yn.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}))}};yn.fetchWithAuth=m9});var YC=_(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.isBrowser=void 0;ki.uuid=g9;ki.ensureTrailingSlash=XC;ki.applySettingDefaults=D9;ki.validateSupabaseUrl=w9;function g9(){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 XC(t){return t.endsWith("/")?t:t+"/"}var y9=()=>typeof window<"u";ki.isBrowser=y9;function D9(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 w9(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(XC(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}});var _y=_(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});Cf.version=void 0;Cf.version="2.84.0"});var Sf=_(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.JWKS_TTL=Me.BASE64URL_REGEX=Me.API_VERSIONS=Me.API_VERSION_HEADER_NAME=Me.NETWORK_FAILURE=Me.DEFAULT_HEADERS=Me.AUDIENCE=Me.STORAGE_KEY=Me.GOTRUE_URL=Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD=Me.AUTO_REFRESH_TICK_DURATION_MS=void 0;var v9=_y();Me.AUTO_REFRESH_TICK_DURATION_MS=30*1e3;Me.AUTO_REFRESH_TICK_THRESHOLD=3;Me.EXPIRY_MARGIN_MS=Me.AUTO_REFRESH_TICK_THRESHOLD*Me.AUTO_REFRESH_TICK_DURATION_MS;Me.GOTRUE_URL="http://localhost:9999";Me.STORAGE_KEY="supabase.auth.token";Me.AUDIENCE="";Me.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${v9.version}`};Me.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};Me.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";Me.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};Me.BASE64URL_REGEX=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;Me.JWKS_TTL=600*1e3});var ys=_(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.AuthInvalidJwtError=Ae.AuthWeakPasswordError=Ae.AuthRetryableFetchError=Ae.AuthPKCEGrantCodeExchangeError=Ae.AuthImplicitGrantRedirectError=Ae.AuthInvalidCredentialsError=Ae.AuthInvalidTokenResponseError=Ae.AuthSessionMissingError=Ae.CustomAuthError=Ae.AuthUnknownError=Ae.AuthApiError=Ae.AuthError=void 0;Ae.isAuthError=jo;Ae.isAuthApiError=E9;Ae.isAuthSessionMissingError=b9;Ae.isAuthImplicitGrantRedirectError=_9;Ae.isAuthRetryableFetchError=C9;Ae.isAuthWeakPasswordError=S9;var Bo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Bo;function jo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var Cy=class extends Bo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=Cy;function E9(t){return jo(t)&&t.name==="AuthApiError"}var Sy=class extends Bo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Sy;var un=class extends Bo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=un;var Ay=class extends un{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Ay;function b9(t){return jo(t)&&t.name==="AuthSessionMissingError"}var Oy=class extends un{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Oy;var xy=class extends un{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=xy;var Ty=class extends un{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}}};Ae.AuthImplicitGrantRedirectError=Ty;function _9(t){return jo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Iy=class extends un{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}}};Ae.AuthPKCEGrantCodeExchangeError=Iy;var Py=class extends un{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Py;function C9(t){return jo(t)&&t.name==="AuthRetryableFetchError"}var Fy=class extends un{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Fy;function S9(t){return jo(t)&&t.name==="AuthWeakPasswordError"}var Ry=class extends un{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Ry});var Of=_(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Bu;zr.byteFromBase64URL=ky;zr.stringToBase64URL=O9;zr.stringFromBase64URL=x9;zr.codepointToUTF8=ZC;zr.stringToUTF8=Ny;zr.stringFromUTF8=QC;zr.base64UrlToUint8Array=T9;zr.stringToUint8Array=I9;zr.bytesToBase64URL=P9;var Af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),JC=`
27
+ \r=`.split(""),A9=(()=>{let t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<JC.length;e+=1)t[JC[e].charCodeAt(0)]=-2;for(let e=0;e<Af.length;e+=1)t[Af[e].charCodeAt(0)]=e;return t})();function Bu(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(Af[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(Af[n]),e.queuedBits-=6}}function ky(t,e,r){let n=A9[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 O9(t){let e=[],r=i=>{e.push(i)},n={queue:0,queuedBits:0};return Ny(t,i=>{Bu(i,n,r)}),Bu(null,n,r),e.join("")}function x9(t){let e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=o=>{QC(o,n,r)};for(let o=0;o<t.length;o+=1)ky(t.charCodeAt(o),i,s);return e.join("")}function ZC(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 Ny(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}ZC(n,e)}}function QC(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 T9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)ky(t.charCodeAt(i),r,n);return new Uint8Array(e)}function I9(t){let e=[];return Ny(t,r=>e.push(r)),new Uint8Array(e)}function P9(t){let e=[],r={queue:0,queuedBits:0},n=i=>{e.push(i)};return t.forEach(i=>Bu(i,r,n)),Bu(null,r,n),e.join("")}});var Mo=_(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=F9;be.generateCallbackId=R9;be.parseParametersFromURL=$9;be.decodeJWT=q9;be.sleep=H9;be.retryable=V9;be.generatePKCEVerifier=rS;be.generatePKCEChallenge=nS;be.getCodeChallengeAndMethod=G9;be.parseResponseAPIVersion=X9;be.validateExp=Y9;be.getAlgorithm=J9;be.validateUUID=Q9;be.userNotAvailableProxy=eH;be.insecureUserWarningProxy=tH;be.deepClone=rH;var tS=Sf(),eS=ys(),$y=Of();function F9(t){return Math.round(Date.now()/1e3)+t}function R9(){return Symbol("auth-callback")}var k9=()=>typeof window<"u"&&typeof document<"u";be.isBrowser=k9;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 $9(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 L9=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);be.resolveFetch=L9;var B9=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function";be.looksLikeFetchResponse=B9;var j9=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))};be.setItemAsync=j9;var M9=async(t,e)=>{let r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return r}};be.getItemAsync=M9;var U9=async(t,e)=>{await t.removeItem(e)};be.removeItemAsync=U9;var xf=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=xf;xf.promiseConstructor=Promise;function q9(t){let e=t.split(".");if(e.length!==3)throw new eS.AuthInvalidJwtError("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!tS.BASE64URL_REGEX.test(e[n]))throw new eS.AuthInvalidJwtError("JWT not in base64url format");return{header:JSON.parse((0,$y.stringFromBase64URL)(e[0])),payload:JSON.parse((0,$y.stringFromBase64URL)(e[1])),signature:(0,$y.base64UrlToUint8Array)(e[2]),raw:{header:e[0],payload:e[1]}}}async function H9(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function V9(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 z9(t){return("0"+t.toString(16)).substr(-2)}function rS(){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,z9).join("")}async function K9(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 nS(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 K9(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function G9(t,e,r=!1){let n=rS(),i=n;r&&(i+="/PASSWORD_RECOVERY"),await(0,be.setItemAsync)(t,`${e}-code-verifier`,i);let s=await nS(n);return[s,n===s?"plain":"s256"]}var W9=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function X9(t){let e=t.headers.get(tS.API_VERSION_HEADER_NAME);if(!e||!e.match(W9))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Y9(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 J9(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 Z9=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Q9(t){if(!Z9.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function eH(){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 tH(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 rH(t){return JSON.parse(JSON.stringify(t))}});var jy=_(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.handleError=By;Dn._request=oH;Dn._sessionResponse=iS;Dn._sessionResponsePassword=uH;Dn._userResponse=cH;Dn._ssoResponse=lH;Dn._generateLinkResponse=fH;Dn._noResolveJsonResponse=hH;var nH=(he(),ce(fe)),Tf=Sf(),Ly=Mo(),Ni=ys(),ws=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),iH=[502,503,504];async function By(t){var e;if(!(0,Ly.looksLikeFetchResponse)(t))throw new Ni.AuthRetryableFetchError(ws(t),0);if(iH.includes(t.status))throw new Ni.AuthRetryableFetchError(ws(t),t.status);let r;try{r=await t.json()}catch(s){throw new Ni.AuthUnknownError(ws(s),s)}let n,i=(0,Ly.parseResponseAPIVersion)(t);if(i&&i.getTime()>=Tf.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 Ni.AuthWeakPasswordError(ws(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Ni.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 Ni.AuthWeakPasswordError(ws(r),t.status,r.weak_password.reasons);throw new Ni.AuthApiError(ws(r),t.status||500,n)}var sH=(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 oH(t,e,r,n){var i;let s=Object.assign({},n?.headers);s[Tf.API_VERSION_HEADER_NAME]||(s[Tf.API_VERSION_HEADER_NAME]=Tf.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 aH(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 aH(t,e,r,n,i,s){let o=sH(e,n,i,s),a;try{a=await t(r,Object.assign({},o))}catch(u){throw console.error(u),new Ni.AuthRetryableFetchError(ws(u),0)}if(a.ok||await By(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await By(u)}}function iS(t){var e;let r=null;dH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,Ly.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function uH(t){let e=iS(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 cH(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function lH(t){return{data:t,error:null}}function fH(t){let{action_link:e,email_otp:r,hashed_token:n,redirect_to:i,verification_type:s}=t,o=nH.__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 hH(t){return t}function dH(t){return t.access_token&&t.refresh_token&&t.expires_in}});var My=_(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});If.SIGN_OUT_SCOPES=void 0;If.SIGN_OUT_SCOPES=["global","local","others"]});var Pf=_(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});var pH=(he(),ce(fe)),ot=jy(),vs=Mo(),Uy=My(),Kt=ys(),qy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,vs.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=Uy.SIGN_OUT_SCOPES[0]){if(Uy.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Uy.SIGN_OUT_SCOPES.join(", ")}`);try{return await(0,ot._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,ot._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ot._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=pH.__rest(e,["options"]),i=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(i.new_email=n?.newEmail,delete i.newEmail),await(0,ot._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:ot._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,ot._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ot._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,ot._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:ot._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(p=>{let y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}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,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ot._userResponse})}catch(r){if((0,Kt.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){(0,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){(0,vs.validateUUID)(e);try{return await(0,ot._request)(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ot._userResponse})}catch(n){if((0,Kt.isAuthError)(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){(0,vs.validateUUID)(e.userId);try{let{data:r,error:n}=await(0,ot._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,vs.validateUUID)(e.userId),(0,vs.validateUUID)(e.id);try{return{data:await(0,ot._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,ot._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:ot._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(p=>{let y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}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,ot._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,ot._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,ot._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,ot._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,ot._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}}};Hy.default=qy});var sS=_(Vy=>{"use strict";Object.defineProperty(Vy,"__esModule",{value:!0});Vy.memoryLocalStorageAdapter=mH;function mH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var zy=_(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.ProcessLockAcquireTimeoutError=Rt.NavigatorLockAcquireTimeoutError=Rt.LockAcquireTimeoutError=Rt.internals=void 0;Rt.navigatorLock=yH;Rt.processLock=DH;var gH=Mo();Rt.internals={debug:!!(globalThis&&(0,gH.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var ju=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Rt.LockAcquireTimeoutError=ju;var Ff=class extends ju{};Rt.NavigatorLockAcquireTimeoutError=Ff;var Rf=class extends ju{};Rt.ProcessLockAcquireTimeoutError=Rf;async function yH(t,e,r){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);let n=new globalThis.AbortController;return e>0&&setTimeout(()=>{n.abort(),Rt.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){Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw Rt.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Ff(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(Rt.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 oS={};async function DH(t,e,r){var n;let i=(n=oS[t])!==null&&n!==void 0?n:Promise.resolve(),s=Promise.race([i.catch(()=>null),e>=0?new Promise((o,a)=>{setTimeout(()=>{a(new Rf(`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 oS[t]=s.catch(async o=>{if(o&&o.isAcquireTimeout)return await i,null;throw o}),await s}});var aS=_(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.polyfillGlobalThis=wH;function wH(){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 cS=_(Uo=>{"use strict";Object.defineProperty(Uo,"__esModule",{value:!0});Uo.getAddress=uS;Uo.fromHex=vH;Uo.toHex=EH;Uo.createSiweMessage=bH;function uS(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function vH(t){return parseInt(t,16)}function EH(t){let e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function bH(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(`
28
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}let f=uS(t.address),p=l?`${l}://${n}`:n,y=t.statement?`${t.statement}
29
+ `:"",v=`${p} wants you to sign in with your Ethereum account:
30
30
  ${f}
31
31
 
32
32
  ${y}`,E=`URI: ${h}
@@ -37,27 +37,27 @@ Issued At: ${s.toISOString()}`;if(i&&(E+=`
37
37
  Expiration Time: ${i.toISOString()}`),a&&(E+=`
38
38
  Not Before: ${a.toISOString()}`),u&&(E+=`
39
39
  Request ID: ${u}`),c){let A=`
40
- 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+=`
41
- - ${p}`}E+=A}return`${v}
42
- ${E}`}});var fS=_(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.WebAuthnUnknownError=Qn.WebAuthnError=void 0;Qn.isWebAuthnError=_H;Qn.identifyRegistrationError=CH;Qn.identifyAuthenticationError=SH;var lS=Wy(),ft=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}};Qn.WebAuthnError=ft;var Gy=class extends ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Qn.WebAuthnUnknownError=Gy;function _H(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function CH({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 ft({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 ft({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 ft({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 ft({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 ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ft({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 ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ft({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,lS.isValidDomain)(o)){if(s.rp.id!==o)return new ft({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({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 ft({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 ft({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 ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function SH({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 ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,lS.isValidDomain)(n)){if(r.rpId!==n)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ft({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 ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var Wy=_(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.WebAuthnApi=Oe.DEFAULT_REQUEST_OPTIONS=Oe.DEFAULT_CREATION_OPTIONS=Oe.webAuthnAbortService=Oe.WebAuthnAbortService=Oe.identifyAuthenticationError=Oe.identifyRegistrationError=Oe.isWebAuthnError=Oe.WebAuthnError=void 0;Oe.deserializeCredentialCreationOptions=OH;Oe.deserializeCredentialRequestOptions=xH;Oe.serializeCredentialCreationResponse=TH;Oe.serializeCredentialRequestResponse=IH;Oe.isValidDomain=PH;Oe.createCredential=pS;Oe.getCredential=mS;Oe.mergeCredentialCreationOptions=gS;Oe.mergeCredentialRequestOptions=yS;var dS=(he(),ce(fe)),cn=Of(),wn=ys(),AH=Mo(),vn=fS();Object.defineProperty(Oe,"identifyAuthenticationError",{enumerable:!0,get:function(){return vn.identifyAuthenticationError}});Object.defineProperty(Oe,"identifyRegistrationError",{enumerable:!0,get:function(){return vn.identifyRegistrationError}});Object.defineProperty(Oe,"isWebAuthnError",{enumerable:!0,get:function(){return vn.isWebAuthnError}});Object.defineProperty(Oe,"WebAuthnError",{enumerable:!0,get:function(){return vn.WebAuthnError}});var kf=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}}};Oe.WebAuthnAbortService=kf;Oe.webAuthnAbortService=new kf;function OH(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=dS.__rest(t,["challenge","user","excludeCredentials"]),s=(0,cn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,cn.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,cn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function xH(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=dS.__rest(t,["challenge","allowCredentials"]),i=(0,cn.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,cn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function TH(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,cn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IH(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,cn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,cn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,cn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function PH(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function hS(){var t,e;return!!((0,AH.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 pS(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyRegistrationError)({error:e,options:t})}}}async function mS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyAuthenticationError)({error:e,options:t})}}}Oe.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"};Oe.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Nf(...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]=Nf(a,o):n[s]=Nf(o)}else n[s]=o}return n}function gS(t,e){return Nf(Oe.DEFAULT_CREATION_OPTIONS,t,e||{})}function yS(t,e){return Nf(Oe.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Xy=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??Oe.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=gS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await pS({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=yS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await mS(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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.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 wn.AuthError("rpId is required for WebAuthn authentication")};try{if(!hS())return{data:null,error:new wn.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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName: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 wn.AuthError("rpId is required for WebAuthn registration")};try{if(!hS())return{data:null,error:new wn.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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in register",o)}}}};Oe.WebAuthnApi=Xy});var Jy=_(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});var FH=(he(),ce(fe)),RH=FH.__importDefault(Pf()),vr=Sf(),X=ys(),ue=jy(),se=Mo(),DS=sS(),wS=zy(),kH=aS(),NH=_y(),vS=Of(),$f=cS(),Mu=Wy();(0,kH.polyfillGlobalThis)();var $H={url:vr.GOTRUE_URL,storageKey:vr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function ES(t,e,r){return await r()}var qo={},Lf=class t{get jwks(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;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;let s=Object.assign(Object.assign({},$H),e);if(this.storageKey=s.storageKey,this.instanceID=(r=t.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,t.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&(0,se.isBrowser)()){let o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new RH.default({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=(0,se.resolveFetch)(s.fetch),this.lock=s.lock||ES,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:(0,se.isBrowser)()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=wS.navigatorLock:this.lock=ES,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 Mu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,DS.memoryLocalStorageAdapter)(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=(0,DS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${NH.version}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...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,X.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,X.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new X.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,ue._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:ue._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,X.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,ue._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:ue._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,ue._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:ue._sessionResponse})}else throw new X.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,X.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,ue._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:ue._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,ue._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:ue._sessionResponsePassword})}else throw new X.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 X.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,X.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:v,statement:E,options:A}=e,p;if((0,se.isBrowser)())if(typeof v=="object")p=v;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 v!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");p=v}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 C=(0,$f.getAddress)(w[0]),F=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!F){let k=await p.request({method:"eth_chainId"});F=(0,$f.fromHex)(k)}let b={domain:D.host,address:C,statement:E,uri:D.href,version:"1",chainId:F,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,$f.createSiweMessage)(b),m=await p.request({method:"personal_sign",params:[(0,$f.toHex)(f),C]})}try{let{data:y,error:v}=await(0,ue._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:ue._sessionResponse});if(v)throw v;if(!y||!y.session||!y.user){let E=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:E})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:v})}catch(y){if((0,X.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:v,wallet:E,statement:A,options:p}=e,D;if((0,se.isBrowser)())if(typeof E=="object")D=E;else{let C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))D=C.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 E!="object"||!p?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}let w=new URL((r=p?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let C=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)),F;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")F=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)F=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in F&&"signature"in F&&(typeof F.signedMessage=="string"||F.signedMessage instanceof Uint8Array)&&F.signature instanceof Uint8Array)m=typeof F.signedMessage=="string"?F.signedMessage:new TextDecoder().decode(F.signedMessage),y=F.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(F=>`- ${F}`)]:[]].join(`
43
- `);let C=await D.signMessage(new TextEncoder().encode(m),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=C}}try{let{data:v,error:E}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:m,signature:(0,vS.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:ue._sessionResponse});if(E)throw E;if(!v||!v.session||!v.user){let A=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:E})}catch(v){if((0,X.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}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,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ue._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new X.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,X.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,ue._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:ue._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 X.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,X.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,ue._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,ue._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 X.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,X.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,ue._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:ue._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,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,s,o;try{let a=null,u=null;this.flowType==="pkce"&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let c=await(0,ue._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:a,code_challenge_method:u}),headers:this.headers,xform:ue._ssoResponse});return!((s=c.data)===null||s===void 0)&&s.url&&(0,se.isBrowser)()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:null,error:a});throw a}}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 X.AuthSessionMissingError;let{error:i}=await(0,ue._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,X.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,ue._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,ue._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 X.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,X.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()<vr.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,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ue._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 X.AuthSessionMissingError}:await(0,ue._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:ue._userResponse})})}catch(r){if((0,X.isAuthError)(r))return(0,X.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 X.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,ue._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:ue._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,X.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 X.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,X.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 X.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,X.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 X.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new X.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 X.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new X.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 X.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 X.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<=vr.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:v}=await this._getUser(s);if(v)throw v;let E={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:E,redirectType:e.type},error:null})}catch(n){if((0,X.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,X.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.generateCallbackId)(),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,ue._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,X.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,X.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,ue._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,X.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,ue._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:ue._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 X.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,X.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,ue._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,X.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,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ue._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,X.isAuthRetryableFetchError)(s)&&Date.now()+o-n<vr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,X.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()<vr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${vr.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,X.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 X.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 X.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,X.isAuthError)(s)){let o={data:null,error:s};return(0,X.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(),vr.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)/vr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${vr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${vr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=vr.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 wS.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,ue._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,X.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,ue._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,X.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,Mu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Mu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,ue._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,X.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,ue._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,Mu.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,Mu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,X.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,ue._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 X.AuthSessionMissingError})})}catch(r){if((0,X.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 X.AuthSessionMissingError});let o=await(0,ue._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,X.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 X.AuthSessionMissingError});let o=await(0,ue._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,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await(0,ue._request)(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(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,ue._request)(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},xform:()=>({data:{},error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}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+vr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,ue._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,vS.stringToUint8Array)(`${a}.${u}`)))throw new X.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Lf.nextInstanceID={};Yy.default=Lf});var bS=_(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var LH=(he(),ce(fe)),BH=LH.__importDefault(Pf()),jH=BH.default;Zy.default=jH});var _S=_(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});var MH=(he(),ce(fe)),UH=MH.__importDefault(Jy()),qH=UH.default;Qy.default=qH});var eD=_(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.processLock=It.lockInternals=It.NavigatorLockAcquireTimeoutError=It.navigatorLock=It.AuthClient=It.AuthAdminApi=It.GoTrueClient=It.GoTrueAdminApi=void 0;var Ho=(he(),ce(fe)),HH=Ho.__importDefault(Pf());It.GoTrueAdminApi=HH.default;var VH=Ho.__importDefault(Jy());It.GoTrueClient=VH.default;var zH=Ho.__importDefault(bS());It.AuthAdminApi=zH.default;var KH=Ho.__importDefault(_S());It.AuthClient=KH.default;Ho.__exportStar(My(),It);Ho.__exportStar(ys(),It);var Bf=zy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Bf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Bf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Bf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Bf.processLock}})});var CS=_(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.SupabaseAuthClient=void 0;var GH=eD(),tD=class extends GH.AuthClient{constructor(e){super(e)}};jf.SupabaseAuthClient=tD});var iD=_(nD=>{"use strict";Object.defineProperty(nD,"__esModule",{value:!0});var WH=ig(),XH=Eg(),YH=jg(),JH=zC(),Mf=GC(),ZH=WC(),SS=YC(),QH=CS(),rD=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,SS.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:Mf.DEFAULT_DB_OPTIONS,realtime:Mf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Mf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Mf.DEFAULT_GLOBAL_OPTIONS},l=(0,SS.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,ZH.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(h=>this.realtime.setAuth(h)).catch(h=>console.warn("Failed to set initial Realtime auth token:",h)),this.rest=new XH.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new JH.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new WH.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 QH.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 YH.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)}};nD.default=rD});var xS=_(We=>{"use strict";var e7=We&&We.__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]})),AS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e7(e,t,r)},OS=We&&We.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(We,"__esModule",{value:!0});We.createClient=We.SupabaseClient=We.FunctionRegion=We.FunctionsError=We.FunctionsRelayError=We.FunctionsFetchError=We.FunctionsHttpError=We.PostgrestError=void 0;var t7=OS(iD());AS(eD(),We);var r7=Eg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return r7.PostgrestError}});var Uu=ig();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Uu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Uu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Uu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Uu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Uu.FunctionRegion}});AS(jg(),We);var n7=iD();Object.defineProperty(We,"SupabaseClient",{enumerable:!0,get:function(){return OS(n7).default}});var i7=(t,e,r)=>new t7.default(t,e,r);We.createClient=i7;function s7(){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}s7()&&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 sD=_((wye,TS)=>{TS.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 Uf=_(PS=>{var IS={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 o7(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(IS))PS[t]=o7(IS[t])});var $S=_((Eye,NS)=>{var a7=require("fs"),Ft=require("path"),FS=sD(),u7=Uf(),c7=typeof process=="object"&&process.platform==="win32",RS=t=>typeof t=="object"&&t!==null,kS=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 yt(t){this.sep=Ft.sep,this.fs=a7,RS(t)&&RS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}NS.exports=yt;yt.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 u7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};yt.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=Ft.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};yt.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=Ft.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)})})})})})};yt.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=Ft.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Ft.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};yt.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=Ft.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Ft.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))})})})};yt.prototype.getAttributes=function(){};yt.prototype.setAttributes=function(){};yt.crc32update=function(t,e){return kS[(t^e)&255]^t>>>8};yt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=yt.crc32update(r,t[n++]);return~r>>>0};yt.methodToString=function(t){switch(t){case FS.STORED:return"STORED ("+t+")";case FS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};yt.canonical=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.join(".",e)};yt.zipnamefix=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.posix.join(".",e)};yt.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]};yt.sanitize=function(t,e){t=Ft.resolve(Ft.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Ft.normalize(Ft.join(t,r.slice(n,i).join(Ft.sep)));if(s.indexOf(t)===0)return s}return Ft.normalize(Ft.join(t,Ft.basename(e)))};yt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};yt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};yt.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)};yt.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};yt.isWin=c7;yt.crcTable=kS});var BS=_((bye,LS)=>{var l7=require("path");LS.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=l7.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 MS=_((_ye,jS)=>{jS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var zo=_((Cye,Vo)=>{Vo.exports=$S();Vo.exports.Constants=sD();Vo.exports.Errors=Uf();Vo.exports.FileAttr=BS();Vo.exports.decoder=MS()});var qS=_((Sye,US)=>{var $i=zo(),Y=$i.Constants;US.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|=$i.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},v=p=>Math.max(0,p)>>>0,E=p=>Math.max(0,p)&65535,A=p=>Math.max(0,p)&255;return i=$i.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&Y.FLG_EFS)>0},set flags_efs(p){p?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(p){p?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(p){switch(p){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=p},get time(){return $i.fromDOS2Date(this.timeval)},set time(p){this.timeval=$i.fromDate2DOS(p)},get timeval(){return i},set timeval(p){i=v(p)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(p){s=v(p)},get compressedSize(){return o},set compressedSize(p){o=v(p)},get size(){return a},set size(p){a=v(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=v(p)},get inAttr(){return d},set inAttr(p){d=v(p)},get attr(){return f},set attr(p){f=v(p)},get fileAttr(){return(f||0)>>16&4095},get offset(){return m},set offset(p){m=v(p)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return m+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(p){var D=p.slice(m,m+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw $i.Errors.INVALID_LOC();y.version=D.readUInt16LE(Y.LOCVER),y.flags=D.readUInt16LE(Y.LOCFLG),y.method=D.readUInt16LE(Y.LOCHOW),y.time=D.readUInt32LE(Y.LOCTIM),y.crc=D.readUInt32LE(Y.LOCCRC),y.compressedSize=D.readUInt32LE(Y.LOCSIZ),y.size=D.readUInt32LE(Y.LOCLEN),y.fnameLen=D.readUInt16LE(Y.LOCNAM),y.extraLen=D.readUInt16LE(Y.LOCEXT);let w=m+Y.LOCHDR+y.fnameLen,C=w+y.extraLen;return p.slice(w,C)},loadFromBinary:function(p){if(p.length!==Y.CENHDR||p.readUInt32LE(0)!==Y.CENSIG)throw $i.Errors.INVALID_CEN();t=p.readUInt16LE(Y.CENVEM),e=p.readUInt16LE(Y.CENVER),r=p.readUInt16LE(Y.CENFLG),n=p.readUInt16LE(Y.CENHOW),i=p.readUInt32LE(Y.CENTIM),s=p.readUInt32LE(Y.CENCRC),o=p.readUInt32LE(Y.CENSIZ),a=p.readUInt32LE(Y.CENLEN),u=p.readUInt16LE(Y.CENNAM),c=p.readUInt16LE(Y.CENEXT),l=p.readUInt16LE(Y.CENCOM),h=p.readUInt16LE(Y.CENDSK),d=p.readUInt16LE(Y.CENATT),f=p.readUInt32LE(Y.CENATX),m=p.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var p=Buffer.alloc(Y.LOCHDR);return p.writeUInt32LE(Y.LOCSIG,0),p.writeUInt16LE(e,Y.LOCVER),p.writeUInt16LE(r,Y.LOCFLG),p.writeUInt16LE(n,Y.LOCHOW),p.writeUInt32LE(i,Y.LOCTIM),p.writeUInt32LE(s,Y.LOCCRC),p.writeUInt32LE(o,Y.LOCSIZ),p.writeUInt32LE(a,Y.LOCLEN),p.writeUInt16LE(u,Y.LOCNAM),p.writeUInt16LE(y.extraLen,Y.LOCEXT),p},centralHeaderToBinary:function(){var p=Buffer.alloc(Y.CENHDR+u+c+l);return p.writeUInt32LE(Y.CENSIG,0),p.writeUInt16LE(t,Y.CENVEM),p.writeUInt16LE(e,Y.CENVER),p.writeUInt16LE(r,Y.CENFLG),p.writeUInt16LE(n,Y.CENHOW),p.writeUInt32LE(i,Y.CENTIM),p.writeUInt32LE(s,Y.CENCRC),p.writeUInt32LE(o,Y.CENSIZ),p.writeUInt32LE(a,Y.CENLEN),p.writeUInt16LE(u,Y.CENNAM),p.writeUInt16LE(c,Y.CENEXT),p.writeUInt16LE(l,Y.CENCOM),p.writeUInt16LE(h,Y.CENDSK),p.writeUInt16LE(d,Y.CENATT),p.writeUInt32LE(f,Y.CENATX),p.writeUInt32LE(m,Y.CENOFF),p},toJSON:function(){let p=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:$i.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(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var VS=_((Aye,HS)=>{var Ko=zo(),ht=Ko.Constants;HS.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 ht.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ht.ENDHDR||s.readUInt32LE(0)!==ht.ENDSIG)&&(s.length<ht.ZIP64HDR||s.readUInt32LE(0)!==ht.ZIP64SIG))throw Ko.Errors.INVALID_END();s.readUInt32LE(0)===ht.ENDSIG?(t=s.readUInt16LE(ht.ENDSUB),e=s.readUInt16LE(ht.ENDTOT),r=s.readUInt32LE(ht.ENDSIZ),n=s.readUInt32LE(ht.ENDOFF),i=s.readUInt16LE(ht.ENDCOM)):(t=Ko.readBigUInt64LE(s,ht.ZIP64SUB),e=Ko.readBigUInt64LE(s,ht.ZIP64TOT),r=Ko.readBigUInt64LE(s,ht.ZIP64SIZE),n=Ko.readBigUInt64LE(s,ht.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ht.ENDHDR+i);return s.writeUInt32LE(ht.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ht.ENDSUB),s.writeUInt16LE(e,ht.ENDTOT),s.writeUInt32LE(r,ht.ENDSIZ),s.writeUInt32LE(n,ht.ENDOFF),s.writeUInt16LE(i,ht.ENDCOM),s.fill(" ",ht.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 aD=_(oD=>{oD.EntryHeader=qS();oD.MainHeader=VS()});var KS=_((xye,zS)=>{zS.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 WS=_((Tye,GS)=>{var f7=+(process.versions?process.versions.node:"").split(".")[0]||0;GS.exports=function(t,e){var r=require("zlib");let n=f7>=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 QS=_((Iye,ZS)=>{"use strict";var{randomFillSync:XS}=require("crypto"),h7=Uf(),d7=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}),JS=(t,e)=>Math.imul(t,e)>>>0,YS=(t,e)=>d7[(t^e)&255]^t>>>8,qu=()=>typeof XS=="function"?XS(Buffer.alloc(12)):qu.node();qu.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 qf={genSalt:qu};function Hf(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])}Hf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=YS(e[0],t),e[1]+=e[0]&255,e[1]=JS(e[1],134775813)+1,e[2]=YS(e[2],e[1]>>>24),t};Hf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return JS(t,t^1)>>8&255};function p7(t){let e=new Hf(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 m7(t){let e=new Hf(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 g7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=p7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw h7.WRONG_PASSWORD();return n(t.slice(12))}function y7(t){Buffer.isBuffer(t)&&t.length>=12?qf.genSalt=function(){return t.slice(0,12)}:t==="node"?qf.genSalt=qu.node:qf.genSalt=qu}function D7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=m7(r),s=qf.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)}ZS.exports={decrypt:g7,encrypt:D7,_salter:y7}});var eA=_(Vf=>{Vf.Deflater=KS();Vf.Inflater=WS();Vf.ZipCrypto=QS()});var cD=_((Fye,tA)=>{var $e=zo(),w7=aD(),Dt=$e.Constants,uD=eA();tA.exports=function(t,e){var r=new w7.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:$e.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)==Dt.LOCSIG||e.readUInt32LE(w)==Dt.CENSIG)throw $e.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==Dt.EXTSIG)D.crc=e.readUInt32LE(w+Dt.EXTCRC),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ),D.size=e.readUInt32LE(w+Dt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+Dt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ-4),D.size=e.readUInt32LE(w+Dt.EXTLEN-4);else throw $e.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw $e.Errors.DESCRIPTOR_FAULTY();if($e.crc32(p)!==D.crc)return!1}else if($e.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),$e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return p&&D&&D(C),C;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw $e.Errors.INVALID_PASS_PARAM();C=uD.ZipCrypto.decrypt(C,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case $e.Constants.STORED:if(C.copy(F),f(F))return p&&D&&D(F),F;throw p&&D&&D(F,$e.Errors.BAD_CRC()),$e.Errors.BAD_CRC();case $e.Constants.DEFLATED:var b=new uD.Inflater(C,r.size);if(p)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,$e.Errors.BAD_CRC()))});else{if(b.inflate(F).copy(F,0),!f(F))throw $e.Errors.BAD_CRC(`"${h.decode(n)}"`);return F}break;default:throw p&&D&&D(Buffer.alloc(0),$e.Errors.UNKNOWN_METHOD()),$e.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 $e.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),p&&D&&D(w),w;default:case $e.Constants.DEFLATED:var C=new uD.Deflater(o);if(p)C.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var F=C.deflate();return r.compressedSize=F.length,F}C=null;break}}else if(p&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function v(p,D){return(p.readUInt32LE(D+4)<<4)+p.readUInt32LE(D)}function E(p){try{for(var D=0,w,C,F;D+4<p.length;)w=p.readUInt16LE(D),D+=2,C=p.readUInt16LE(D),D+=2,F=p.slice(D,D+C),D+=C,Dt.ID_ZIP64===w&&A(F)}catch{throw $e.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(p){var D,w,C,F;p.length>=Dt.EF_ZIP64_SCOMP&&(D=v(p,Dt.EF_ZIP64_SUNCOMP),r.size===Dt.EF_ZIP64_OR_32&&(r.size=D)),p.length>=Dt.EF_ZIP64_RHO&&(w=v(p,Dt.EF_ZIP64_SCOMP),r.compressedSize===Dt.EF_ZIP64_OR_32&&(r.compressedSize=w)),p.length>=Dt.EF_ZIP64_DSN&&(C=v(p,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=C)),p.length>=Dt.EF_ZIP64_DSN+4&&(F=p.readUInt32LE(Dt.EF_ZIP64_DSN),r.diskNumStart===Dt.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(p){n=$e.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,E(p)},get comment(){return h.decode(i)},set comment(p){if(i=$e.toBuffer(p,h.encode),r.commentLength=i.length,i.length>65535)throw $e.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=$e.toBuffer(p,$e.decoder.encode),!s&&o.length?(r.size=o.length,r.method=$e.Constants.DEFLATED,r.crc=$e.crc32(p),r.changed=!0):r.method=$e.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=$e.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 iA=_((Rye,nA)=>{var rA=cD(),v7=aD(),qt=zo();nA.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new v7.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 v=new Set;for(let E of Object.keys(n)){let A=E.split("/");if(A.pop(),!!A.length)for(let p=0;p<A.length;p++){let D=A.slice(0,p+1).join("/")+"/";v.add(D)}}for(let E of v)if(!(E in n)){let A=new rA(c);A.entryName=E,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)/qt.Constants.CENHDR)throw qt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var v=s.offset,E=0;E<r.length;E++){var A=v,p=new rA(c,t);p.header=t.slice(A,A+=qt.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)),v+=p.header.centralHeaderSize,r[E]=p,n[p.entryName]=p}u.clear(),d()}function m(v){var E=t.length-qt.Constants.ENDHDR,A=Math.max(0,E-65535),p=A,D=t.length,w=-1,C=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(A=0),E;E>=p;E--)if(t[E]===80){if(t.readUInt32LE(E)===qt.Constants.ENDSIG){w=E,C=E,D=E+qt.Constants.ENDHDR,p=E-qt.Constants.END64HDR;continue}if(t.readUInt32LE(E)===qt.Constants.END64SIG){p=A;continue}if(t.readUInt32LE(E)===qt.Constants.ZIP64SIG){w=E,D=E+qt.readBigUInt64LE(t,E+qt.Constants.ZIP64SIZE)+qt.Constants.ZIP64LEAD;break}}if(w==-1)throw qt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(C+qt.Constants.ENDHDR)),v&&f()}function y(){r.length>1&&!l&&r.sort((v,E)=>v.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=qt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,E=!0){o||f();let A=n[v];this.getEntryChildren(A,E).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let E=n[v],A=r.indexOf(E);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,E=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&E){let A=[],p=v.entryName;for(let D of r)D.entryName.startsWith(p)&&A.push(D);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let E=this.getEntryChildren(v);return E.includes(v)?E.length-1:E.length}return 0},compressToBuffer:function(){o||f(),y();let v=[],E=[],A=0,p=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let b=F.getCompressedData();F.header.offset=p;let k=F.packLocalHeader(),R=k.length+b.length;p+=R,v.push(k),v.push(b);let I=F.packCentralHeader();E.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 F of v)F.copy(w,p),p+=F.length;for(let F of E)F.copy(w,p),p+=F.length;let C=s.toBinary();return i&&i.copy(C,qt.Constants.ENDHDR),C.copy(w,p),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,p){try{o||f(),y();let D=[],w=[],C=0,F=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),B=I.entryName+I.extra.toString();A&&A(B),I.getCompressedDataAsync(function(j){p&&p(B),I.header.offset=F;let z=I.packLocalHeader(),L=z.length+j.length;F+=L,D.push(z),D.push(j);let S=I.packCentralHeader();w.push(S),s.size+=S.length,C+=L+S.length,b++,k(R)})}else{C+=s.mainHeaderSize,s.offset=F,s.totalEntries=b,F=0;let I=Buffer.alloc(C);D.forEach(function(j){j.copy(I,F),F+=j.length}),w.forEach(function(j){j.copy(I,F),F+=j.length});let B=s.toBinary();i&&i.copy(B,qt.Constants.ENDHDR),B.copy(I,F),t=I,o=!1,v(I)}};k(Array.from(this.entries))}catch(D){E(D)}}}}});var lD=_((kye,oA)=>{var dt=zo(),wt=require("path"),E7=cD(),b7=iA(),Es=(...t)=>dt.findLast(t,e=>typeof e=="boolean"),sA=(...t)=>dt.findLast(t,e=>typeof e=="string"),_7=(...t)=>dt.findLast(t,e=>typeof e=="function"),C7={noSort:!1,readEntries:!1,method:dt.Constants.NONE,fs:null};oA.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),C7);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=dt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new dt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=dt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=dt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw dt.Errors.INVALID_FILENAME();let s=new b7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=dt;function c(f){if(f&&s){var m;if(typeof f=="string"&&(m=s.getEntry(wt.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:v}=wt.posix;return m(".",y(v+f.split("\\").join(v)+v))}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:"",wt.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 v=y.getData();if(v&&v.length)return v.toString(m||"utf8")}return""},readAsTextAsync:function(f,m,y){var v=c(f);v?v.getDataAsync(function(E,A){if(A){m(E,A);return}E&&E.length?m(E.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,v){if(i.fs.existsSync(f)){m=m?l(m):"";let E=wt.win32.basename(wt.win32.normalize(f));m+=y||E;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,v,A)}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,m){f=typeof f=="object"?f:{localPath:f};let y=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,p=this;i.fs.stat(y,function(D,w){if(D)return m(D,!1);E=E?l(E):"";let C=wt.win32.basename(wt.win32.normalize(y));if(E+=A||C,w.isFile())i.fs.readFile(y,function(F,b){return F?m(F,!1):(p.addFile(E,b,v,w),setImmediate(m,void 0,!0))});else if(w.isDirectory())return E+=i.sep,p.addFile(E,Buffer.alloc(0),v,w),setImmediate(m,void 0,!0)})},addLocalFolder:function(f,m,y){if(y=h(y),m=m?l(m):"",f=wt.normalize(f),i.fs.existsSync(f)){let v=i.findFiles(f),E=this;if(v.length)for(let A of v){let p=wt.join(m,d(f,A));y(p)&&E.addLocalFile(A,wt.dirname(p))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,m,y,v){v=h(v),y=y?l(y):"",f=wt.normalize(f);var E=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")m(void 0,dt.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 C=p[D],F=d(f,C).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(C,function(b,k){b&&m(void 0,b),k.isFile()?i.fs.readFile(C,function(R,I){R?m(void 0,R):(E.addFile(y+F,I,"",k),w())}):(E.addFile(y+F+"/",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=wt.resolve(l(f.localPath));let{zipPath:v,filter:E,namefix:A}=f;E instanceof RegExp?E=(function(w){return function(C){return w.test(C)}})(E):typeof E!="function"&&(E=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let p=w=>wt.join(v,A(d(localPath,w))),D=w=>wt.win32.basename(wt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?m(void 0,dt.Errors.FILE_NOT_FOUND(localPath)):w?m(void 0,w):i.findFilesAsync(localPath,function(C,F){if(C)return m(C);F=F.filter(b=>E(p(b))),F.length||m(void 0,!1),setImmediate(F.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:wt.dirname(p(k)),zipName:D(k)},b)}},m))})})},addLocalFolderPromise:function(f,m){return new Promise((y,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},m),(E,A)=>{E&&v(E),A&&y(this)})})},addFile:function(f,m,y,v){f=u(f);let E=c(f),A=E!=null;A||(E=new E7(n),E.entryName=f),E.comment=y||"";let p=typeof v=="object"&&v instanceof i.fs.Stats;p&&(E.header.time=v.mtime);var D=E.isDirectory?16:0;let w=E.isDirectory?16384:32768;return p?w|=4095&v.mode:typeof v=="number"?w|=4095&v:w|=E.isDirectory?493:420,D=(D|w<<16)>>>0,E.attr=D,E.setData(m),A||s.setEntry(E),E},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,v,E,A){v=Es(!1,v),E=Es(!1,E),y=Es(!0,y),A=sA(E,A);var p=c(f);if(!p)throw dt.Errors.NO_ENTRY();var D=o(p.entryName),w=a(m,A&&!p.isDirectory?A:y?D:wt.basename(D));if(p.isDirectory){var C=s.getEntryChildren(p);return C.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw dt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),B=a(m,y?I:wt.basename(I));let j=E?k.header.fileAttr:void 0;i.writeFileTo(B,R,v,j)}),!0}var F=p.getData(s.password);if(!F)throw dt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!v)throw dt.Errors.CANT_OVERRIDE();let b=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,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,v){if(y=Es(!1,y),v=sA(y,v),m=Es(!1,m),!s)throw dt.Errors.NO_ZIP();s.entries.forEach(function(E){var A=a(f,o(E.entryName));if(E.isDirectory){i.makeDir(A);return}var p=E.getData(v);if(!p)throw dt.Errors.CANT_EXTRACT_FILE();let D=y?E.header.fileAttr:void 0;i.writeFileTo(A,p,m,D);try{i.fs.utimesSync(A,E.header.time,E.header.time)}catch{throw dt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,m,y,v){if(v=_7(m,y,v),y=Es(!1,y),m=Es(!1,m),!v)return new Promise((w,C)=>{this.extractAllToAsync(f,m,y,function(F){F?C(F):w(this)})});if(!s){v(dt.Errors.NO_ZIP());return}f=wt.resolve(f);let E=w=>a(f,wt.normalize(o(w.entryName))),A=(w,C)=>new Error(w+': "'+C+'"'),p=[],D=[];s.entries.forEach(w=>{w.isDirectory?p.push(w):D.push(w)});for(let w of p){let C=E(w),F=y?w.header.fileAttr:void 0;try{i.makeDir(C),F&&i.fs.chmodSync(C,F),i.fs.utimesSync(C,w.header.time,w.header.time)}catch{v(A("Unable to create folder",C))}}D.reverse().reduce(function(w,C){return function(F){if(F)w(F);else{let b=wt.normalize(o(C.entryName)),k=a(f,b);C.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=y?C.header.fileAttr:void 0;i.writeFileToAsync(k,R,m,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,C.header.time,C.header.time,function(z){z?w(A("Unable to set times",k)):w()})})}})}}},v)()},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 v=i.writeFileTo(f,y,!0);typeof m=="function"&&m(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,m){let{overwrite:y,perm:v}=Object.assign({overwrite:!0},m);return new Promise((E,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(p=>{let D=w=>w?E(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,p,y,v,D)},A)})},toBufferPromise:function(){return new Promise((f,m)=>{s.toAsyncBuffer(f,m)})},toBuffer:function(f,m,y,v){return typeof f=="function"?(s.toAsyncBuffer(f,m,y,v),null):s.compressToBuffer()}}}});var lA=_((Nye,cA)=>{var uA={};cA.exports=uA;var aA={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(aA).forEach(function(t){var e=aA[t],r=uA[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var hA=_(($ye,fA)=>{"use strict";fA.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 pA=_((Lye,dA)=>{"use strict";var S7=require("os"),ln=hA(),nr=process.env,Go=void 0;ln("no-color")||ln("no-colors")||ln("color=false")?Go=!1:(ln("color")||ln("colors")||ln("color=true")||ln("color=always"))&&(Go=!0);"FORCE_COLOR"in nr&&(Go=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function A7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function O7(t){if(Go===!1)return 0;if(ln("color=16m")||ln("color=full")||ln("color=truecolor"))return 3;if(ln("color=256"))return 2;if(t&&!t.isTTY&&Go!==!0)return 0;var e=Go?1:0;if(process.platform==="win32"){var r=S7.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 fD(t){var e=O7(t);return A7(e)}dA.exports={supportsColor:fD,stdout:fD(process.stdout),stderr:fD(process.stderr)}});var gA=_((Bye,mA)=>{mA.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 DA=_((jye,yA)=>{yA.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],v=0;v<=h[y];v++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var vA=_((Mye,wA)=>{wA.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 bA=_((Uye,EA)=>{EA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var CA=_((qye,_A)=>{_A.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 AA=_((Hye,SA)=>{SA.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 FA=_((zye,PA)=>{var ve={};PA.exports=ve;ve.themes={};var x7=require("util"),bs=ve.styles=lA(),xA=Object.defineProperties,T7=new RegExp(/[\r\n]+/g);ve.supportsColor=pA().supportsColor;typeof ve.enabled>"u"&&(ve.enabled=ve.supportsColor()!==!1);ve.enable=function(){ve.enabled=!0};ve.disable=function(){ve.enabled=!1};ve.stripColors=ve.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var Vye=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=bs[r];return!n&&r in ve?ve[r](e):n.open+e+n.close},I7=/[|\\{}()[\]^$+*?.]/g,P7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(I7,"\\$&")};function TA(t){var e=function r(){return R7.apply(r,arguments)};return e._styles=t,e.__proto__=F7,e}var IA=(function(){var t={};return bs.grey=bs.gray,Object.keys(bs).forEach(function(e){bs[e].closeRe=new RegExp(P7(bs[e].close),"g"),t[e]={get:function(){return TA(this._styles.concat(e))}}}),t})(),F7=xA(function(){},IA);function R7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:x7.inspect(o)}).join(" ");if(!ve.enabled||!e)return e;for(var r=e.indexOf(`
40
+ Resources:`;for(let m of c){if(!m||typeof m!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${m}`);A+=`
41
+ - ${m}`}E+=A}return`${v}
42
+ ${E}`}});var fS=_(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.WebAuthnUnknownError=Qn.WebAuthnError=void 0;Qn.isWebAuthnError=_H;Qn.identifyRegistrationError=CH;Qn.identifyAuthenticationError=SH;var lS=Wy(),ft=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}};Qn.WebAuthnError=ft;var Gy=class extends ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Qn.WebAuthnUnknownError=Gy;function _H(t){return typeof t=="object"&&t!==null&&"__isWebAuthnError"in t}function CH({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 ft({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 ft({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 ft({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 ft({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 ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new ft({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 ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new ft({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,lS.isValidDomain)(o)){if(s.rp.id!==o)return new ft({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({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 ft({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 ft({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 ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function SH({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 ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new ft({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){let n=window.location.hostname;if((0,lS.isValidDomain)(n)){if(r.rpId!==n)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new ft({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 ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}});var Wy=_(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.WebAuthnApi=Oe.DEFAULT_REQUEST_OPTIONS=Oe.DEFAULT_CREATION_OPTIONS=Oe.webAuthnAbortService=Oe.WebAuthnAbortService=Oe.identifyAuthenticationError=Oe.identifyRegistrationError=Oe.isWebAuthnError=Oe.WebAuthnError=void 0;Oe.deserializeCredentialCreationOptions=OH;Oe.deserializeCredentialRequestOptions=xH;Oe.serializeCredentialCreationResponse=TH;Oe.serializeCredentialRequestResponse=IH;Oe.isValidDomain=PH;Oe.createCredential=pS;Oe.getCredential=mS;Oe.mergeCredentialCreationOptions=gS;Oe.mergeCredentialRequestOptions=yS;var dS=(he(),ce(fe)),cn=Of(),wn=ys(),AH=Mo(),vn=fS();Object.defineProperty(Oe,"identifyAuthenticationError",{enumerable:!0,get:function(){return vn.identifyAuthenticationError}});Object.defineProperty(Oe,"identifyRegistrationError",{enumerable:!0,get:function(){return vn.identifyRegistrationError}});Object.defineProperty(Oe,"isWebAuthnError",{enumerable:!0,get:function(){return vn.isWebAuthnError}});Object.defineProperty(Oe,"WebAuthnError",{enumerable:!0,get:function(){return vn.WebAuthnError}});var kf=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}}};Oe.WebAuthnAbortService=kf;Oe.webAuthnAbortService=new kf;function OH(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=dS.__rest(t,["challenge","user","excludeCredentials"]),s=(0,cn.base64UrlToUint8Array)(e).buffer,o=Object.assign(Object.assign({},r),{id:(0,cn.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,cn.base64UrlToUint8Array)(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function xH(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=dS.__rest(t,["challenge","allowCredentials"]),i=(0,cn.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,cn.base64UrlToUint8Array)(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return s}function TH(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,cn.bytesToBase64URL)(new Uint8Array(t.response.attestationObject)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function IH(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,cn.bytesToBase64URL)(new Uint8Array(i.authenticatorData)),clientDataJSON:(0,cn.bytesToBase64URL)(new Uint8Array(i.clientDataJSON)),signature:(0,cn.bytesToBase64URL)(new Uint8Array(i.signature)),userHandle:i.userHandle?(0,cn.bytesToBase64URL)(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function PH(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function hS(){var t,e;return!!((0,AH.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 pS(t){try{let e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyRegistrationError)({error:e,options:t})}}}async function mS(t){try{let e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new vn.WebAuthnUnknownError("Browser returned unexpected credential type",e)}:{data:null,error:new vn.WebAuthnUnknownError("Empty credential response",e)}}catch(e){return{data:null,error:(0,vn.identifyAuthenticationError)({error:e,options:t})}}}Oe.DEFAULT_CREATION_OPTIONS={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"};Oe.DEFAULT_REQUEST_OPTIONS={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Nf(...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]=Nf(a,o):n[s]=Nf(o)}else n[s]=o}return n}function gS(t,e){return Nf(Oe.DEFAULT_CREATION_OPTIONS,t,e||{})}function yS(t,e){return Nf(Oe.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Xy=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??Oe.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=gS(o.webauthn.credential_options.publicKey,s?.create),{data:l,error:h}=await pS({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=yS(o.webauthn.credential_options.publicKey,s?.request),{data:l,error:h}=await mS(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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.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 wn.AuthError("rpId is required for WebAuthn authentication")};try{if(!hS())return{data:null,error:new wn.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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in authenticate",o)}}}async _register({friendlyName: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 wn.AuthError("rpId is required for WebAuthn registration")};try{if(!hS())return{data:null,error:new wn.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,wn.isAuthError)(o)?{data:null,error:o}:{data:null,error:new wn.AuthUnknownError("Unexpected error in register",o)}}}};Oe.WebAuthnApi=Xy});var Jy=_(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});var FH=(he(),ce(fe)),RH=FH.__importDefault(Pf()),vr=Sf(),X=ys(),ue=jy(),se=Mo(),DS=sS(),wS=zy(),kH=aS(),NH=_y(),vS=Of(),$f=cS(),Mu=Wy();(0,kH.polyfillGlobalThis)();var $H={url:vr.GOTRUE_URL,storageKey:vr.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vr.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function ES(t,e,r){return await r()}var qo={},Lf=class t{get jwks(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=qo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){qo[this.storageKey]=Object.assign(Object.assign({},qo[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,i;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;let s=Object.assign(Object.assign({},$H),e);if(this.storageKey=s.storageKey,this.instanceID=(r=t.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,t.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&(0,se.isBrowser)()){let o=`${this._logPrefix()} 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.`;console.warn(o),this.logDebugMessages&&console.trace(o)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new RH.default({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=(0,se.resolveFetch)(s.fetch),this.lock=s.lock||ES,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:(0,se.isBrowser)()&&(!((n=globalThis?.navigator)===null||n===void 0)&&n.locks)?this.lock=wS.navigatorLock:this.lock=ES,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 Mu.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:(0,se.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,DS.memoryLocalStorageAdapter)(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=(0,DS.memoryLocalStorageAdapter)(this.memoryStorage)),(0,se.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(o){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",o)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async o=>{this._debug("received broadcast notification from other tab or client",o),await this._notifyAllSubscribers(o.data.event,o.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${NH.version}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...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,X.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,X.isAuthError)(r)?this._returnResult({error:r}):this._returnResult({error:new X.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,ue._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:ue._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,X.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,p=null;this.flowType==="pkce"&&([f,p]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey)),s=await(0,ue._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:p},xform:ue._sessionResponse})}else if("phone"in e){let{phone:l,password:h,options:d}=e;s=await(0,ue._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:ue._sessionResponse})}else throw new X.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,X.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,ue._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:ue._sessionResponsePassword})}else if("phone"in e){let{phone:s,password:o,options:a}=e;r=await(0,ue._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:ue._sessionResponsePassword})}else throw new X.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 X.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,X.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,p;if("message"in e)f=e.message,p=e.signature;else{let{chain:y,wallet:v,statement:E,options:A}=e,m;if((0,se.isBrowser)())if(typeof v=="object")m=v;else{let k=window;if("ethereum"in k&&typeof k.ethereum=="object"&&"request"in k.ethereum&&typeof k.ethereum.request=="function")m=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 v!="object"||!A?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");m=v}let D=new URL((r=A?.url)!==null&&r!==void 0?r:window.location.href),w=await m.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 C=(0,$f.getAddress)(w[0]),F=(n=A?.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!F){let k=await m.request({method:"eth_chainId"});F=(0,$f.fromHex)(k)}let b={domain:D.host,address:C,statement:E,uri:D.href,version:"1",chainId:F,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,$f.createSiweMessage)(b),p=await m.request({method:"personal_sign",params:[(0,$f.toHex)(f),C]})}try{let{data:y,error:v}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((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:ue._sessionResponse});if(v)throw v;if(!y||!y.session||!y.user){let E=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:E})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:v})}catch(y){if((0,X.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 p,y;if("message"in e)p=e.message,y=e.signature;else{let{chain:v,wallet:E,statement:A,options:m}=e,D;if((0,se.isBrowser)())if(typeof E=="object")D=E;else{let C=window;if("solana"in C&&typeof C.solana=="object"&&("signIn"in C.solana&&typeof C.solana.signIn=="function"||"signMessage"in C.solana&&typeof C.solana.signMessage=="function"))D=C.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 E!="object"||!m?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}let w=new URL((r=m?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in D&&D.signIn){let C=await D.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},m?.signInWithSolana),{version:"1",domain:w.host,uri:w.href}),A?{statement:A}:null)),F;if(Array.isArray(C)&&C[0]&&typeof C[0]=="object")F=C[0];else if(C&&typeof C=="object"&&"signedMessage"in C&&"signature"in C)F=C;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in F&&"signature"in F&&(typeof F.signedMessage=="string"||F.signedMessage instanceof Uint8Array)&&F.signature instanceof Uint8Array)p=typeof F.signedMessage=="string"?F.signedMessage:new TextDecoder().decode(F.signedMessage),y=F.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");p=[`${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=m?.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=m?.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${m.signInWithSolana.notBefore}`]:[],...!((o=m?.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${m.signInWithSolana.expirationTime}`]:[],...!((a=m?.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${m.signInWithSolana.chainId}`]:[],...!((u=m?.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${m.signInWithSolana.nonce}`]:[],...!((c=m?.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${m.signInWithSolana.requestId}`]:[],...!((h=(l=m?.signInWithSolana)===null||l===void 0?void 0:l.resources)===null||h===void 0)&&h.length?["Resources",...m.signInWithSolana.resources.map(F=>`- ${F}`)]:[]].join(`
43
+ `);let C=await D.signMessage(new TextEncoder().encode(p),"utf8");if(!C||!(C instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=C}}try{let{data:v,error:E}=await(0,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:(0,vS.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:ue._sessionResponse});if(E)throw E;if(!v||!v.session||!v.user){let A=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:A})}return v.session&&(await this._saveSession(v.session),await this._notifyAllSubscribers("SIGNED_IN",v.session)),this._returnResult({data:Object.assign({},v),error:E})}catch(v){if((0,X.isAuthError)(v))return this._returnResult({data:{user:null,session:null},error:v});throw v}}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,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:ue._sessionResponse});if(await(0,se.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!s||!s.session||!s.user){let a=new X.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,X.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,ue._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:ue._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 X.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,X.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,ue._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,ue._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 X.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(a){if((0,X.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,ue._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:ue._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,X.isAuthError)(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var r,n,i,s,o;try{let a=null,u=null;this.flowType==="pkce"&&([a,u]=await(0,se.getCodeChallengeAndMethod)(this.storage,this.storageKey));let c=await(0,ue._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:a,code_challenge_method:u}),headers:this.headers,xform:ue._ssoResponse});return!((s=c.data)===null||s===void 0)&&s.url&&(0,se.isBrowser)()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if((0,X.isAuthError)(a))return this._returnResult({data:null,error:a});throw a}}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 X.AuthSessionMissingError;let{error:i}=await(0,ue._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,X.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,ue._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,ue._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 X.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,X.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()<vr.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,ue._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ue._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 X.AuthSessionMissingError}:await(0,ue._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:ue._userResponse})})}catch(r){if((0,X.isAuthError)(r))return(0,X.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 X.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,ue._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:ue._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,X.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 X.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,X.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 X.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,X.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 X.AuthImplicitGrantRedirectError("No browser detected.");if(e.error||e.error_description||e.error_code)throw new X.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 X.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new X.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 X.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:A,error:m}=await this._exchangeCodeForSession(e.code);if(m)throw m;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 X.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<=vr.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 p=d-h;l-p>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",p,d,l):l-p<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",p,d,l);let{data:y,error:v}=await this._getUser(s);if(v)throw v;let E={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:E,redirectType:e.type},error:null})}catch(n){if((0,X.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,X.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.generateCallbackId)(),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,ue._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,X.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,X.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,ue._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,X.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,ue._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:ue._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 X.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,X.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,ue._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,X.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,ue._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:ue._sessionResponse})),(i,s)=>{let o=200*Math.pow(2,i);return s&&(0,X.isAuthRetryableFetchError)(s)&&Date.now()+o-n<vr.AUTO_REFRESH_TICK_DURATION_MS})}catch(n){if(this._debug(r,"error",n),(0,X.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()<vr.EXPIRY_MARGIN_MS;if(this._debug(n,`session has${s?"":" not"} expired with margin of ${vr.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,X.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 X.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 X.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,X.isAuthError)(s)){let o={data:null,error:s};return(0,X.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(),vr.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)/vr.AUTO_REFRESH_TICK_DURATION_MS);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${vr.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${vr.AUTO_REFRESH_TICK_THRESHOLD} ticks`),i<=vr.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 wS.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,ue._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,X.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,ue._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,X.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,Mu.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,Mu.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:u}=await(0,ue._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,X.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,ue._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,Mu.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,Mu.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if((0,X.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,ue._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 X.AuthSessionMissingError})})}catch(r){if((0,X.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 X.AuthSessionMissingError});let o=await(0,ue._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,X.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 X.AuthSessionMissingError});let o=await(0,ue._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,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{let{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await(0,ue._request)(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(e){if((0,X.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(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,ue._request)(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},xform:()=>({data:{},error:null})}):this._returnResult({data:null,error:new X.AuthSessionMissingError})})}catch(r){if((0,X.isAuthError)(r))return this._returnResult({data:null,error:r});throw r}}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+vr.JWKS_TTL>i)return n;let{data:s,error:o}=await(0,ue._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:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});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,vS.stringToUint8Array)(`${a}.${u}`)))throw new X.AuthInvalidJwtError("Invalid JWT signature");return{data:{claims:s,header:i,signature:o},error:null}}catch(n){if((0,X.isAuthError)(n))return this._returnResult({data:null,error:n});throw n}}};Lf.nextInstanceID={};Yy.default=Lf});var bS=_(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var LH=(he(),ce(fe)),BH=LH.__importDefault(Pf()),jH=BH.default;Zy.default=jH});var _S=_(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});var MH=(he(),ce(fe)),UH=MH.__importDefault(Jy()),qH=UH.default;Qy.default=qH});var eD=_(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.processLock=It.lockInternals=It.NavigatorLockAcquireTimeoutError=It.navigatorLock=It.AuthClient=It.AuthAdminApi=It.GoTrueClient=It.GoTrueAdminApi=void 0;var Ho=(he(),ce(fe)),HH=Ho.__importDefault(Pf());It.GoTrueAdminApi=HH.default;var VH=Ho.__importDefault(Jy());It.GoTrueClient=VH.default;var zH=Ho.__importDefault(bS());It.AuthAdminApi=zH.default;var KH=Ho.__importDefault(_S());It.AuthClient=KH.default;Ho.__exportStar(My(),It);Ho.__exportStar(ys(),It);var Bf=zy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Bf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Bf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Bf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Bf.processLock}})});var CS=_(jf=>{"use strict";Object.defineProperty(jf,"__esModule",{value:!0});jf.SupabaseAuthClient=void 0;var GH=eD(),tD=class extends GH.AuthClient{constructor(e){super(e)}};jf.SupabaseAuthClient=tD});var iD=_(nD=>{"use strict";Object.defineProperty(nD,"__esModule",{value:!0});var WH=ig(),XH=Eg(),YH=jg(),JH=zC(),Mf=GC(),ZH=WC(),SS=YC(),QH=CS(),rD=class{constructor(e,r,n){var i,s,o;this.supabaseUrl=e,this.supabaseKey=r;let a=(0,SS.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:Mf.DEFAULT_DB_OPTIONS,realtime:Mf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},Mf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:Mf.DEFAULT_GLOBAL_OPTIONS},l=(0,SS.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,ZH.fetchWithAuth)(r,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(h=>this.realtime.setAuth(h)).catch(h=>console.warn("Failed to set initial Realtime auth token:",h)),this.rest=new XH.PostgrestClient(new URL("rest/v1",a).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new JH.StorageClient(this.storageUrl.href,this.headers,this.fetch,n?.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new WH.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 QH.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(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new YH.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)}};nD.default=rD});var xS=_(We=>{"use strict";var e7=We&&We.__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]})),AS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&e7(e,t,r)},OS=We&&We.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(We,"__esModule",{value:!0});We.createClient=We.SupabaseClient=We.FunctionRegion=We.FunctionsError=We.FunctionsRelayError=We.FunctionsFetchError=We.FunctionsHttpError=We.PostgrestError=void 0;var t7=OS(iD());AS(eD(),We);var r7=Eg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return r7.PostgrestError}});var Uu=ig();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Uu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Uu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Uu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Uu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Uu.FunctionRegion}});AS(jg(),We);var n7=iD();Object.defineProperty(We,"SupabaseClient",{enumerable:!0,get:function(){return OS(n7).default}});var i7=(t,e,r)=>new t7.default(t,e,r);We.createClient=i7;function s7(){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}s7()&&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 sD=_((wye,TS)=>{TS.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 Uf=_(PS=>{var IS={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 o7(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(IS))PS[t]=o7(IS[t])});var $S=_((Eye,NS)=>{var a7=require("fs"),Ft=require("path"),FS=sD(),u7=Uf(),c7=typeof process=="object"&&process.platform==="win32",RS=t=>typeof t=="object"&&t!==null,kS=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 yt(t){this.sep=Ft.sep,this.fs=a7,RS(t)&&RS(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}NS.exports=yt;yt.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 u7.FILE_IN_THE_WAY(`"${i}"`)}})}r(t)};yt.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=Ft.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};yt.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=Ft.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,p){s.fs.write(p,e,0,e.length,0,function(){s.fs.close(p,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)})})})})})};yt.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=Ft.join(n,a),c=e.fs.statSync(u);(!i||i.test(u))&&o.push(Ft.normalize(u)+(c.isDirectory()?e.sep:"")),c.isDirectory()&&s&&(o=o.concat(r(u,i,s)))}),o}return r(t,void 0,!0)};yt.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=Ft.join(t,a),r.fs.stat(a,function(u,c){if(u)return e(u);c&&(n.push(Ft.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))})})})};yt.prototype.getAttributes=function(){};yt.prototype.setAttributes=function(){};yt.crc32update=function(t,e){return kS[(t^e)&255]^t>>>8};yt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8"));let e=t.length,r=-1;for(let n=0;n<e;)r=yt.crc32update(r,t[n++]);return~r>>>0};yt.methodToString=function(t){switch(t){case FS.STORED:return"STORED ("+t+")";case FS.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};yt.canonical=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.join(".",e)};yt.zipnamefix=function(t){if(!t)return"";let e=Ft.posix.normalize("/"+t.split("\\").join("/"));return Ft.posix.join(".",e)};yt.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]};yt.sanitize=function(t,e){t=Ft.resolve(Ft.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n<i;n++){var s=Ft.normalize(Ft.join(t,r.slice(n,i).join(Ft.sep)));if(s.indexOf(t)===0)return s}return Ft.normalize(Ft.join(t,Ft.basename(e)))};yt.toBuffer=function(e,r){return Buffer.isBuffer(e)?e:e instanceof Uint8Array?Buffer.from(e):typeof e=="string"?r(e):Buffer.alloc(0)};yt.readBigUInt64LE=function(t,e){var r=Buffer.from(t.slice(e,e+8));return r.swap64(),parseInt(`0x${r.toString("hex")}`)};yt.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)};yt.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};yt.isWin=c7;yt.crcTable=kS});var BS=_((bye,LS)=>{var l7=require("path");LS.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=l7.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 MS=_((_ye,jS)=>{jS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var zo=_((Cye,Vo)=>{Vo.exports=$S();Vo.exports.Constants=sD();Vo.exports.Errors=Uf();Vo.exports.FileAttr=BS();Vo.exports.decoder=MS()});var qS=_((Sye,US)=>{var $i=zo(),Y=$i.Constants;US.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,p=0;t|=$i.isWin?2560:768,r|=Y.FLG_EFS;let y={extraLen:0},v=m=>Math.max(0,m)>>>0,E=m=>Math.max(0,m)&65535,A=m=>Math.max(0,m)&255;return i=$i.fromDate2DOS(new Date),{get made(){return t},set made(m){t=m},get version(){return e},set version(m){e=m},get flags(){return r},set flags(m){r=m},get flags_efs(){return(r&Y.FLG_EFS)>0},set flags_efs(m){m?r|=Y.FLG_EFS:r&=~Y.FLG_EFS},get flags_desc(){return(r&Y.FLG_DESC)>0},set flags_desc(m){m?r|=Y.FLG_DESC:r&=~Y.FLG_DESC},get method(){return n},set method(m){switch(m){case Y.STORED:this.version=10;case Y.DEFLATED:default:this.version=20}n=m},get time(){return $i.fromDOS2Date(this.timeval)},set time(m){this.timeval=$i.fromDate2DOS(m)},get timeval(){return i},set timeval(m){i=v(m)},get timeHighByte(){return A(i>>>8)},get crc(){return s},set crc(m){s=v(m)},get compressedSize(){return o},set compressedSize(m){o=v(m)},get size(){return a},set size(m){a=v(m)},get fileNameLength(){return u},set fileNameLength(m){u=m},get extraLength(){return c},set extraLength(m){c=m},get extraLocalLength(){return y.extraLen},set extraLocalLength(m){y.extraLen=m},get commentLength(){return l},set commentLength(m){l=m},get diskNumStart(){return h},set diskNumStart(m){h=v(m)},get inAttr(){return d},set inAttr(m){d=v(m)},get attr(){return f},set attr(m){f=v(m)},get fileAttr(){return(f||0)>>16&4095},get offset(){return p},set offset(m){p=v(m)},get encrypted(){return(r&Y.FLG_ENC)===Y.FLG_ENC},get centralHeaderSize(){return Y.CENHDR+u+c+l},get realDataOffset(){return p+Y.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(m){var D=m.slice(p,p+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw $i.Errors.INVALID_LOC();y.version=D.readUInt16LE(Y.LOCVER),y.flags=D.readUInt16LE(Y.LOCFLG),y.method=D.readUInt16LE(Y.LOCHOW),y.time=D.readUInt32LE(Y.LOCTIM),y.crc=D.readUInt32LE(Y.LOCCRC),y.compressedSize=D.readUInt32LE(Y.LOCSIZ),y.size=D.readUInt32LE(Y.LOCLEN),y.fnameLen=D.readUInt16LE(Y.LOCNAM),y.extraLen=D.readUInt16LE(Y.LOCEXT);let w=p+Y.LOCHDR+y.fnameLen,C=w+y.extraLen;return m.slice(w,C)},loadFromBinary:function(m){if(m.length!==Y.CENHDR||m.readUInt32LE(0)!==Y.CENSIG)throw $i.Errors.INVALID_CEN();t=m.readUInt16LE(Y.CENVEM),e=m.readUInt16LE(Y.CENVER),r=m.readUInt16LE(Y.CENFLG),n=m.readUInt16LE(Y.CENHOW),i=m.readUInt32LE(Y.CENTIM),s=m.readUInt32LE(Y.CENCRC),o=m.readUInt32LE(Y.CENSIZ),a=m.readUInt32LE(Y.CENLEN),u=m.readUInt16LE(Y.CENNAM),c=m.readUInt16LE(Y.CENEXT),l=m.readUInt16LE(Y.CENCOM),h=m.readUInt16LE(Y.CENDSK),d=m.readUInt16LE(Y.CENATT),f=m.readUInt32LE(Y.CENATX),p=m.readUInt32LE(Y.CENOFF)},localHeaderToBinary:function(){var m=Buffer.alloc(Y.LOCHDR);return m.writeUInt32LE(Y.LOCSIG,0),m.writeUInt16LE(e,Y.LOCVER),m.writeUInt16LE(r,Y.LOCFLG),m.writeUInt16LE(n,Y.LOCHOW),m.writeUInt32LE(i,Y.LOCTIM),m.writeUInt32LE(s,Y.LOCCRC),m.writeUInt32LE(o,Y.LOCSIZ),m.writeUInt32LE(a,Y.LOCLEN),m.writeUInt16LE(u,Y.LOCNAM),m.writeUInt16LE(y.extraLen,Y.LOCEXT),m},centralHeaderToBinary:function(){var m=Buffer.alloc(Y.CENHDR+u+c+l);return m.writeUInt32LE(Y.CENSIG,0),m.writeUInt16LE(t,Y.CENVEM),m.writeUInt16LE(e,Y.CENVER),m.writeUInt16LE(r,Y.CENFLG),m.writeUInt16LE(n,Y.CENHOW),m.writeUInt32LE(i,Y.CENTIM),m.writeUInt32LE(s,Y.CENCRC),m.writeUInt32LE(o,Y.CENSIZ),m.writeUInt32LE(a,Y.CENLEN),m.writeUInt16LE(u,Y.CENNAM),m.writeUInt16LE(c,Y.CENEXT),m.writeUInt16LE(l,Y.CENCOM),m.writeUInt16LE(h,Y.CENDSK),m.writeUInt16LE(d,Y.CENATT),m.writeUInt32LE(f,Y.CENATX),m.writeUInt32LE(p,Y.CENOFF),m},toJSON:function(){let m=function(D){return D+" bytes"};return{made:t,version:e,flags:r,method:$i.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:m(o),size:m(a),fileNameLength:m(u),extraLength:m(c),commentLength:m(l),diskNumStart:h,inAttr:d,attr:f,offset:p,centralHeaderSize:m(Y.CENHDR+u+c+l)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var VS=_((Aye,HS)=>{var Ko=zo(),ht=Ko.Constants;HS.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 ht.ENDHDR+i},loadFromBinary:function(s){if((s.length!==ht.ENDHDR||s.readUInt32LE(0)!==ht.ENDSIG)&&(s.length<ht.ZIP64HDR||s.readUInt32LE(0)!==ht.ZIP64SIG))throw Ko.Errors.INVALID_END();s.readUInt32LE(0)===ht.ENDSIG?(t=s.readUInt16LE(ht.ENDSUB),e=s.readUInt16LE(ht.ENDTOT),r=s.readUInt32LE(ht.ENDSIZ),n=s.readUInt32LE(ht.ENDOFF),i=s.readUInt16LE(ht.ENDCOM)):(t=Ko.readBigUInt64LE(s,ht.ZIP64SUB),e=Ko.readBigUInt64LE(s,ht.ZIP64TOT),r=Ko.readBigUInt64LE(s,ht.ZIP64SIZE),n=Ko.readBigUInt64LE(s,ht.ZIP64OFF),i=0)},toBinary:function(){var s=Buffer.alloc(ht.ENDHDR+i);return s.writeUInt32LE(ht.ENDSIG,0),s.writeUInt32LE(0,4),s.writeUInt16LE(t,ht.ENDSUB),s.writeUInt16LE(e,ht.ENDTOT),s.writeUInt32LE(r,ht.ENDSIZ),s.writeUInt32LE(n,ht.ENDOFF),s.writeUInt16LE(i,ht.ENDCOM),s.fill(" ",ht.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 aD=_(oD=>{oD.EntryHeader=qS();oD.MainHeader=VS()});var KS=_((xye,zS)=>{zS.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 WS=_((Tye,GS)=>{var f7=+(process.versions?process.versions.node:"").split(".")[0]||0;GS.exports=function(t,e){var r=require("zlib");let n=f7>=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 QS=_((Iye,ZS)=>{"use strict";var{randomFillSync:XS}=require("crypto"),h7=Uf(),d7=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}),JS=(t,e)=>Math.imul(t,e)>>>0,YS=(t,e)=>d7[(t^e)&255]^t>>>8,qu=()=>typeof XS=="function"?XS(Buffer.alloc(12)):qu.node();qu.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 qf={genSalt:qu};function Hf(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])}Hf.prototype.updateKeys=function(t){let e=this.keys;return e[0]=YS(e[0],t),e[1]+=e[0]&255,e[1]=JS(e[1],134775813)+1,e[2]=YS(e[2],e[1]>>>24),t};Hf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return JS(t,t^1)>>8&255};function p7(t){let e=new Hf(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 m7(t){let e=new Hf(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 g7(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=p7(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw h7.WRONG_PASSWORD();return n(t.slice(12))}function y7(t){Buffer.isBuffer(t)&&t.length>=12?qf.genSalt=function(){return t.slice(0,12)}:t==="node"?qf.genSalt=qu.node:qf.genSalt=qu}function D7(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=m7(r),s=qf.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)}ZS.exports={decrypt:g7,encrypt:D7,_salter:y7}});var eA=_(Vf=>{Vf.Deflater=KS();Vf.Inflater=WS();Vf.ZipCrypto=QS()});var cD=_((Fye,tA)=>{var $e=zo(),w7=aD(),Dt=$e.Constants,uD=eA();tA.exports=function(t,e){var r=new w7.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:$e.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(m){if(r.flags_desc){let D={},w=r.realDataOffset+r.compressedSize;if(e.readUInt32LE(w)==Dt.LOCSIG||e.readUInt32LE(w)==Dt.CENSIG)throw $e.Errors.DESCRIPTOR_NOT_EXIST();if(e.readUInt32LE(w)==Dt.EXTSIG)D.crc=e.readUInt32LE(w+Dt.EXTCRC),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ),D.size=e.readUInt32LE(w+Dt.EXTLEN);else if(e.readUInt16LE(w+12)===19280)D.crc=e.readUInt32LE(w+Dt.EXTCRC-4),D.compressedSize=e.readUInt32LE(w+Dt.EXTSIZ-4),D.size=e.readUInt32LE(w+Dt.EXTLEN-4);else throw $e.Errors.DESCRIPTOR_UNKNOWN();if(D.compressedSize!==r.compressedSize||D.size!==r.size||D.crc!==r.crc)throw $e.Errors.DESCRIPTOR_FAULTY();if($e.crc32(m)!==D.crc)return!1}else if($e.crc32(m)!==r.localHeader.crc)return!1;return!0}function p(m,D,w){if(typeof D>"u"&&typeof m=="string"&&(w=m,m=void 0),s)return m&&D&&D(Buffer.alloc(0),$e.Errors.DIRECTORY_CONTENT_ERROR()),Buffer.alloc(0);var C=d();if(C.length===0)return m&&D&&D(C),C;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw $e.Errors.INVALID_PASS_PARAM();C=uD.ZipCrypto.decrypt(C,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case $e.Constants.STORED:if(C.copy(F),f(F))return m&&D&&D(F),F;throw m&&D&&D(F,$e.Errors.BAD_CRC()),$e.Errors.BAD_CRC();case $e.Constants.DEFLATED:var b=new uD.Inflater(C,r.size);if(m)b.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,$e.Errors.BAD_CRC()))});else{if(b.inflate(F).copy(F,0),!f(F))throw $e.Errors.BAD_CRC(`"${h.decode(n)}"`);return F}break;default:throw m&&D&&D(Buffer.alloc(0),$e.Errors.UNKNOWN_METHOD()),$e.Errors.UNKNOWN_METHOD()}}function y(m,D){if((!o||!o.length)&&Buffer.isBuffer(e))return m&&D&&D(d()),d();if(o.length&&!s){var w;switch(r.method){case $e.Constants.STORED:return r.compressedSize=r.size,w=Buffer.alloc(o.length),o.copy(w),m&&D&&D(w),w;default:case $e.Constants.DEFLATED:var C=new uD.Deflater(o);if(m)C.deflateAsync(function(b){w=Buffer.alloc(b.length),r.compressedSize=b.length,b.copy(w),D&&D(w)});else{var F=C.deflate();return r.compressedSize=F.length,F}C=null;break}}else if(m&&D)D(Buffer.alloc(0));else return Buffer.alloc(0)}function v(m,D){return(m.readUInt32LE(D+4)<<4)+m.readUInt32LE(D)}function E(m){try{for(var D=0,w,C,F;D+4<m.length;)w=m.readUInt16LE(D),D+=2,C=m.readUInt16LE(D),D+=2,F=m.slice(D,D+C),D+=C,Dt.ID_ZIP64===w&&A(F)}catch{throw $e.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(m){var D,w,C,F;m.length>=Dt.EF_ZIP64_SCOMP&&(D=v(m,Dt.EF_ZIP64_SUNCOMP),r.size===Dt.EF_ZIP64_OR_32&&(r.size=D)),m.length>=Dt.EF_ZIP64_RHO&&(w=v(m,Dt.EF_ZIP64_SCOMP),r.compressedSize===Dt.EF_ZIP64_OR_32&&(r.compressedSize=w)),m.length>=Dt.EF_ZIP64_DSN&&(C=v(m,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=C)),m.length>=Dt.EF_ZIP64_DSN+4&&(F=m.readUInt32LE(Dt.EF_ZIP64_DSN),r.diskNumStart===Dt.EF_ZIP64_OR_16&&(r.diskNumStart=F))}return{get entryName(){return h.decode(n)},get rawEntryName(){return n},set entryName(m){n=$e.toBuffer(m,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(m){a=m,r.extraLength=m.length,E(m)},get comment(){return h.decode(i)},set comment(m){if(i=$e.toBuffer(m,h.encode),r.commentLength=i.length,i.length>65535)throw $e.Errors.COMMENT_TOO_LONG()},get name(){var m=h.decode(n);return s?m.substr(m.length-1).split("/").pop():m.split("/").pop()},get isDirectory(){return s},getCompressedData:function(){return y(!1,null)},getCompressedDataAsync:function(m){y(!0,m)},setData:function(m){o=$e.toBuffer(m,$e.decoder.encode),!s&&o.length?(r.size=o.length,r.method=$e.Constants.DEFLATED,r.crc=$e.crc32(m),r.changed=!0):r.method=$e.Constants.STORED},getData:function(m){return r.changed?o:p(!1,null,m)},getDataAsync:function(m,D){r.changed?m(o):p(!0,m,D)},set attr(m){r.attr=m},get attr(){return r.attr},set header(m){r.loadFromBinary(m)},get header(){return r},packCentralHeader:function(){r.flags_efs=this.efs,r.extraLength=a.length;var m=r.centralHeaderToBinary(),D=$e.Constants.CENHDR;return n.copy(m,D),D+=n.length,a.copy(m,D),D+=r.extraLength,i.copy(m,D),m},packLocalHeader:function(){let m=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,m),m+=D.length,n.copy(w,m),m+=n.length,u.copy(w,m),m+=u.length,w},toJSON:function(){let m=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:m(e),data:m(o)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var iA=_((Rye,nA)=>{var rA=cD(),v7=aD(),qt=zo();nA.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new v7.MainHeader,o=!1,a=null;let u=new Set,c=e,{noSort:l,decoder:h}=c;t?p(c.readEntries):o=!0;function d(){let v=new Set;for(let E of Object.keys(n)){let A=E.split("/");if(A.pop(),!!A.length)for(let m=0;m<A.length;m++){let D=A.slice(0,m+1).join("/")+"/";v.add(D)}}for(let E of v)if(!(E in n)){let A=new rA(c);A.entryName=E,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)/qt.Constants.CENHDR)throw qt.Errors.DISK_ENTRY_TOO_LARGE();r=new Array(s.diskEntries);for(var v=s.offset,E=0;E<r.length;E++){var A=v,m=new rA(c,t);m.header=t.slice(A,A+=qt.Constants.CENHDR),m.entryName=t.slice(A,A+=m.header.fileNameLength),m.header.extraLength&&(m.extra=t.slice(A,A+=m.header.extraLength)),m.header.commentLength&&(m.comment=t.slice(A,A+m.header.commentLength)),v+=m.header.centralHeaderSize,r[E]=m,n[m.entryName]=m}u.clear(),d()}function p(v){var E=t.length-qt.Constants.ENDHDR,A=Math.max(0,E-65535),m=A,D=t.length,w=-1,C=0;for(typeof c.trailingSpace=="boolean"&&c.trailingSpace&&(A=0),E;E>=m;E--)if(t[E]===80){if(t.readUInt32LE(E)===qt.Constants.ENDSIG){w=E,C=E,D=E+qt.Constants.ENDHDR,m=E-qt.Constants.END64HDR;continue}if(t.readUInt32LE(E)===qt.Constants.END64SIG){m=A;continue}if(t.readUInt32LE(E)===qt.Constants.ZIP64SIG){w=E,D=E+qt.readBigUInt64LE(t,E+qt.Constants.ZIP64SIZE)+qt.Constants.ZIP64LEAD;break}}if(w==-1)throw qt.Errors.INVALID_FORMAT();s.loadFromBinary(t.slice(w,D)),s.commentLength&&(i=t.slice(C+qt.Constants.ENDHDR)),v&&f()}function y(){r.length>1&&!l&&r.sort((v,E)=>v.entryName.toLowerCase().localeCompare(E.entryName.toLowerCase()))}return{get entries(){return o||f(),r.filter(v=>!u.has(v))},get comment(){return h.decode(i)},set comment(v){i=qt.toBuffer(v,h.encode),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(v){this.entries.forEach(v)},getEntry:function(v){return o||f(),n[v]||null},setEntry:function(v){o||f(),r.push(v),n[v.entryName]=v,s.totalEntries=r.length},deleteFile:function(v,E=!0){o||f();let A=n[v];this.getEntryChildren(A,E).map(D=>D.entryName).forEach(this.deleteEntry)},deleteEntry:function(v){o||f();let E=n[v],A=r.indexOf(E);A>=0&&(r.splice(A,1),delete n[v],s.totalEntries=r.length)},getEntryChildren:function(v,E=!0){if(o||f(),typeof v=="object")if(v.isDirectory&&E){let A=[],m=v.entryName;for(let D of r)D.entryName.startsWith(m)&&A.push(D);return A}else return[v];return[]},getChildCount:function(v){if(v&&v.isDirectory){let E=this.getEntryChildren(v);return E.includes(v)?E.length-1:E.length}return 0},compressToBuffer:function(){o||f(),y();let v=[],E=[],A=0,m=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let b=F.getCompressedData();F.header.offset=m;let k=F.packLocalHeader(),R=k.length+b.length;m+=R,v.push(k),v.push(b);let I=F.packCentralHeader();E.push(I),s.size+=I.length,A+=R+I.length,D++}A+=s.mainHeaderSize,s.offset=m,s.totalEntries=D,m=0;let w=Buffer.alloc(A);for(let F of v)F.copy(w,m),m+=F.length;for(let F of E)F.copy(w,m),m+=F.length;let C=s.toBinary();return i&&i.copy(C,qt.Constants.ENDHDR),C.copy(w,m),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,m){try{o||f(),y();let D=[],w=[],C=0,F=0,b=0;s.size=0,s.offset=0;let k=function(R){if(R.length>0){let I=R.shift(),B=I.entryName+I.extra.toString();A&&A(B),I.getCompressedDataAsync(function(j){m&&m(B),I.header.offset=F;let z=I.packLocalHeader(),L=z.length+j.length;F+=L,D.push(z),D.push(j);let S=I.packCentralHeader();w.push(S),s.size+=S.length,C+=L+S.length,b++,k(R)})}else{C+=s.mainHeaderSize,s.offset=F,s.totalEntries=b,F=0;let I=Buffer.alloc(C);D.forEach(function(j){j.copy(I,F),F+=j.length}),w.forEach(function(j){j.copy(I,F),F+=j.length});let B=s.toBinary();i&&i.copy(B,qt.Constants.ENDHDR),B.copy(I,F),t=I,o=!1,v(I)}};k(Array.from(this.entries))}catch(D){E(D)}}}}});var lD=_((kye,oA)=>{var dt=zo(),wt=require("path"),E7=cD(),b7=iA(),Es=(...t)=>dt.findLast(t,e=>typeof e=="boolean"),sA=(...t)=>dt.findLast(t,e=>typeof e=="string"),_7=(...t)=>dt.findLast(t,e=>typeof e=="function"),C7={noSort:!1,readEntries:!1,method:dt.Constants.NONE,fs:null};oA.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),C7);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=dt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new dt(n);if((typeof n.decoder!="object"||typeof n.decoder.encode!="function"||typeof n.decoder.decode!="function")&&(n.decoder=dt.decoder),t&&typeof t=="string")if(i.fs.existsSync(t))n.method=dt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw dt.Errors.INVALID_FILENAME();let s=new b7(r,n),{canonical:o,sanitize:a,zipnamefix:u}=dt;function c(f){if(f&&s){var p;if(typeof f=="string"&&(p=s.getEntry(wt.posix.normalize(f))),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(p=s.getEntry(f.entryName)),p)return p}return null}function l(f){let{join:p,normalize:y,sep:v}=wt.posix;return p(".",y(v+f.split("\\").join(v)+v))}function h(f){return f instanceof RegExp?(function(p){return function(y){return p.test(y)}})(f):typeof f!="function"?()=>!0:f}let d=(f,p)=>{let y=p.slice(-1);return y=y===i.sep?i.sep:"",wt.relative(f,p)+y};return{readFile:function(f,p){var y=c(f);return y&&y.getData(p)||null},childCount:function(f){let p=c(f);if(p)return s.getChildCount(p)},readFileAsync:function(f,p){var y=c(f);y?y.getDataAsync(p):p(null,"getEntry failed for:"+f)},readAsText:function(f,p){var y=c(f);if(y){var v=y.getData();if(v&&v.length)return v.toString(p||"utf8")}return""},readAsTextAsync:function(f,p,y){var v=c(f);v?v.getDataAsync(function(E,A){if(A){p(E,A);return}E&&E.length?p(E.toString(y||"utf8")):p("")}):p("")},deleteFile:function(f,p=!0){var y=c(f);y&&s.deleteFile(y.entryName,p)},deleteEntry:function(f){var p=c(f);p&&s.deleteEntry(p.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,p){var y=c(f);y&&(y.comment=p)},getZipEntryComment:function(f){var p=c(f);return p&&p.comment||""},updateFile:function(f,p){var y=c(f);y&&y.setData(p)},addLocalFile:function(f,p,y,v){if(i.fs.existsSync(f)){p=p?l(p):"";let E=wt.win32.basename(wt.win32.normalize(f));p+=y||E;let A=i.fs.statSync(f),m=A.isFile()?i.fs.readFileSync(f):Buffer.alloc(0);A.isDirectory()&&(p+=i.sep),this.addFile(p,m,v,A)}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFileAsync:function(f,p){f=typeof f=="object"?f:{localPath:f};let y=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,m=this;i.fs.stat(y,function(D,w){if(D)return p(D,!1);E=E?l(E):"";let C=wt.win32.basename(wt.win32.normalize(y));if(E+=A||C,w.isFile())i.fs.readFile(y,function(F,b){return F?p(F,!1):(m.addFile(E,b,v,w),setImmediate(p,void 0,!0))});else if(w.isDirectory())return E+=i.sep,m.addFile(E,Buffer.alloc(0),v,w),setImmediate(p,void 0,!0)})},addLocalFolder:function(f,p,y){if(y=h(y),p=p?l(p):"",f=wt.normalize(f),i.fs.existsSync(f)){let v=i.findFiles(f),E=this;if(v.length)for(let A of v){let m=wt.join(p,d(f,A));y(m)&&E.addLocalFile(A,wt.dirname(m))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,p,y,v){v=h(v),y=y?l(y):"",f=wt.normalize(f);var E=this;i.fs.open(f,"r",function(A){if(A&&A.code==="ENOENT")p(void 0,dt.Errors.FILE_NOT_FOUND(f));else if(A)p(void 0,A);else{var m=i.findFiles(f),D=-1,w=function(){if(D+=1,D<m.length){var C=m[D],F=d(f,C).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(C,function(b,k){b&&p(void 0,b),k.isFile()?i.fs.readFile(C,function(R,I){R?p(void 0,R):(E.addFile(y+F,I,"",k),w())}):(E.addFile(y+F+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else p(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,p){let y=this;f=typeof f=="object"?f:{localPath:f},localPath=wt.resolve(l(f.localPath));let{zipPath:v,filter:E,namefix:A}=f;E instanceof RegExp?E=(function(w){return function(C){return w.test(C)}})(E):typeof E!="function"&&(E=function(){return!0}),v=v?l(v):"",A=="latin1"&&(A=w=>w.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,"")),typeof A!="function"&&(A=w=>w);let m=w=>wt.join(v,A(d(localPath,w))),D=w=>wt.win32.basename(wt.win32.normalize(A(w)));i.fs.open(localPath,"r",function(w){w&&w.code==="ENOENT"?p(void 0,dt.Errors.FILE_NOT_FOUND(localPath)):w?p(void 0,w):i.findFilesAsync(localPath,function(C,F){if(C)return p(C);F=F.filter(b=>E(m(b))),F.length||p(void 0,!1),setImmediate(F.reverse().reduce(function(b,k){return function(R,I){if(R||I===!1)return setImmediate(b,R,!1);y.addLocalFileAsync({localPath:k,zipPath:wt.dirname(m(k)),zipName:D(k)},b)}},p))})})},addLocalFolderPromise:function(f,p){return new Promise((y,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},p),(E,A)=>{E&&v(E),A&&y(this)})})},addFile:function(f,p,y,v){f=u(f);let E=c(f),A=E!=null;A||(E=new E7(n),E.entryName=f),E.comment=y||"";let m=typeof v=="object"&&v instanceof i.fs.Stats;m&&(E.header.time=v.mtime);var D=E.isDirectory?16:0;let w=E.isDirectory?16384:32768;return m?w|=4095&v.mode:typeof v=="number"?w|=4095&v:w|=E.isDirectory?493:420,D=(D|w<<16)>>>0,E.attr=D,E.setData(p),A||s.setEntry(E),E},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,p,y,v,E,A){v=Es(!1,v),E=Es(!1,E),y=Es(!0,y),A=sA(E,A);var m=c(f);if(!m)throw dt.Errors.NO_ENTRY();var D=o(m.entryName),w=a(p,A&&!m.isDirectory?A:y?D:wt.basename(D));if(m.isDirectory){var C=s.getEntryChildren(m);return C.forEach(function(k){if(k.isDirectory)return;var R=k.getData();if(!R)throw dt.Errors.CANT_EXTRACT_FILE();var I=o(k.entryName),B=a(p,y?I:wt.basename(I));let j=E?k.header.fileAttr:void 0;i.writeFileTo(B,R,v,j)}),!0}var F=m.getData(s.password);if(!F)throw dt.Errors.CANT_EXTRACT_FILE();if(i.fs.existsSync(w)&&!v)throw dt.Errors.CANT_OVERRIDE();let b=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,b),!0},test:function(f){if(!s)return!1;for(var p in s.entries)try{if(p.isDirectory)continue;var y=s.entries[p].getData(f);if(!y)return!1}catch{return!1}return!0},extractAllTo:function(f,p,y,v){if(y=Es(!1,y),v=sA(y,v),p=Es(!1,p),!s)throw dt.Errors.NO_ZIP();s.entries.forEach(function(E){var A=a(f,o(E.entryName));if(E.isDirectory){i.makeDir(A);return}var m=E.getData(v);if(!m)throw dt.Errors.CANT_EXTRACT_FILE();let D=y?E.header.fileAttr:void 0;i.writeFileTo(A,m,p,D);try{i.fs.utimesSync(A,E.header.time,E.header.time)}catch{throw dt.Errors.CANT_EXTRACT_FILE()}})},extractAllToAsync:function(f,p,y,v){if(v=_7(p,y,v),y=Es(!1,y),p=Es(!1,p),!v)return new Promise((w,C)=>{this.extractAllToAsync(f,p,y,function(F){F?C(F):w(this)})});if(!s){v(dt.Errors.NO_ZIP());return}f=wt.resolve(f);let E=w=>a(f,wt.normalize(o(w.entryName))),A=(w,C)=>new Error(w+': "'+C+'"'),m=[],D=[];s.entries.forEach(w=>{w.isDirectory?m.push(w):D.push(w)});for(let w of m){let C=E(w),F=y?w.header.fileAttr:void 0;try{i.makeDir(C),F&&i.fs.chmodSync(C,F),i.fs.utimesSync(C,w.header.time,w.header.time)}catch{v(A("Unable to create folder",C))}}D.reverse().reduce(function(w,C){return function(F){if(F)w(F);else{let b=wt.normalize(o(C.entryName)),k=a(f,b);C.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=y?C.header.fileAttr:void 0;i.writeFileToAsync(k,R,p,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,C.header.time,C.header.time,function(z){z?w(A("Unable to set times",k)):w()})})}})}}},v)()},writeZip:function(f,p){if(arguments.length===1&&typeof f=="function"&&(p=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var y=s.compressToBuffer();if(y){var v=i.writeFileTo(f,y,!0);typeof p=="function"&&p(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,p){let{overwrite:y,perm:v}=Object.assign({overwrite:!0},p);return new Promise((E,A)=>{!f&&n.filename&&(f=n.filename),f||A("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(m=>{let D=w=>w?E(w):A("ADM-ZIP: Wasn't able to write zip file");i.writeFileToAsync(f,m,y,v,D)},A)})},toBufferPromise:function(){return new Promise((f,p)=>{s.toAsyncBuffer(f,p)})},toBuffer:function(f,p,y,v){return typeof f=="function"?(s.toAsyncBuffer(f,p,y,v),null):s.compressToBuffer()}}}});var lA=_((Nye,cA)=>{var uA={};cA.exports=uA;var aA={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(aA).forEach(function(t){var e=aA[t],r=uA[t]=[];r.open="\x1B["+e[0]+"m",r.close="\x1B["+e[1]+"m"})});var hA=_(($ye,fA)=>{"use strict";fA.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 pA=_((Lye,dA)=>{"use strict";var S7=require("os"),ln=hA(),nr=process.env,Go=void 0;ln("no-color")||ln("no-colors")||ln("color=false")?Go=!1:(ln("color")||ln("colors")||ln("color=true")||ln("color=always"))&&(Go=!0);"FORCE_COLOR"in nr&&(Go=nr.FORCE_COLOR.length===0||parseInt(nr.FORCE_COLOR,10)!==0);function A7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function O7(t){if(Go===!1)return 0;if(ln("color=16m")||ln("color=full")||ln("color=truecolor"))return 3;if(ln("color=256"))return 2;if(t&&!t.isTTY&&Go!==!0)return 0;var e=Go?1:0;if(process.platform==="win32"){var r=S7.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 fD(t){var e=O7(t);return A7(e)}dA.exports={supportsColor:fD,stdout:fD(process.stdout),stderr:fD(process.stderr)}});var gA=_((Bye,mA)=>{mA.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 DA=_((jye,yA)=>{yA.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 p in f)for(var y=f[p],v=0;v<=h[y];v++)c[y]&&(l=l+n[y][s(n[y].length)])}return l}return a(e,r)}});var vA=_((Mye,wA)=>{wA.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 bA=_((Uye,EA)=>{EA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var CA=_((qye,_A)=>{_A.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 AA=_((Hye,SA)=>{SA.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 FA=_((zye,PA)=>{var ve={};PA.exports=ve;ve.themes={};var x7=require("util"),bs=ve.styles=lA(),xA=Object.defineProperties,T7=new RegExp(/[\r\n]+/g);ve.supportsColor=pA().supportsColor;typeof ve.enabled>"u"&&(ve.enabled=ve.supportsColor()!==!1);ve.enable=function(){ve.enabled=!0};ve.disable=function(){ve.enabled=!1};ve.stripColors=ve.strip=function(t){return(""+t).replace(/\x1B\[\d+m/g,"")};var Vye=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=bs[r];return!n&&r in ve?ve[r](e):n.open+e+n.close},I7=/[|\\{}()[\]^$+*?.]/g,P7=function(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(I7,"\\$&")};function TA(t){var e=function r(){return R7.apply(r,arguments)};return e._styles=t,e.__proto__=F7,e}var IA=(function(){var t={};return bs.grey=bs.gray,Object.keys(bs).forEach(function(e){bs[e].closeRe=new RegExp(P7(bs[e].close),"g"),t[e]={get:function(){return TA(this._styles.concat(e))}}}),t})(),F7=xA(function(){},IA);function R7(){var t=Array.prototype.slice.call(arguments),e=t.map(function(o){return o!=null&&o.constructor===String?o:x7.inspect(o)}).join(" ");if(!ve.enabled||!e)return e;for(var r=e.indexOf(`
44
44
  `)!=-1,n=this._styles,i=n.length;i--;){var s=bs[n[i]];e=s.open+e.replace(s.closeRe,s.open)+s.close,r&&(e=e.replace(T7,function(o){return s.close+o+s.open}))}return e}ve.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){ve[r]=function(n){if(typeof t[r]=="object"){var i=n;for(var s in t[r])i=ve[t[r][s]](i);return i}return ve[t[r]](n)}})(e)};function k7(){var t={};return Object.keys(IA).forEach(function(e){t[e]={get:function(){return TA([e])}}}),t}var N7=function(e,r){var n=r.split("");return n=n.map(e),n.join("")};ve.trap=gA();ve.zalgo=DA();ve.maps={};ve.maps.america=vA()(ve);ve.maps.zebra=bA()(ve);ve.maps.rainbow=CA()(ve);ve.maps.random=AA()(ve);for(OA in ve.maps)(function(t){ve[t]=function(e){return N7(ve.maps[t],e)}})(OA);var OA;xA(ve,k7())});var kA=_((Kye,RA)=>{var $7=FA();RA.exports=$7});var NA=_(hD=>{"use strict";hD.indent=function(e){return new Array(e+1).join(" ")};hD.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 $A=_((Wye,L7)=>{L7.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 LA=_(Hu=>{"use strict";var En=kA(),Li=NA(),B7=/[^\w\s\n\r\v\t\.,]/i;Hu.version=$A().version;var dD=function(t,e){return t!==void 0||e.renderUndefined},zf=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(`
45
45
  `)===-1||r.inlineArrays&&!e&&Array.isArray(t)&&zf(t[0],!0,r))},j7=function(t,e){if(e.noColor)return t;if(typeof t=="string")return e.stringColor?En[e.stringColor](t):t;var r=t+"";return t===!0?En.green(r):t===!1?En.red(r):t==null?En.grey(r):typeof t=="number"?t>=0?En[e.positiveNumberColor](r):En[e.negativeNumberColor](r):typeof t=="function"?"function() {}":Array.isArray(t)?t.join(", "):r},pD=function(t,e){return t.multilineStringColor===null||t.noColor?e:En[t.multilineStringColor](e)},M7=function(t,e,r){var n=t.split(`
46
46
  `);return n=n.map(function(i){return Li.indent(e)+pD(r,i)}),n.join(`
47
47
  `)},Wo=function(t,e,r){if(typeof t=="string"&&t.match(B7)&&e.escape&&(t=JSON.stringify(t)),!dD(t,e))return[];if(zf(t,!1,e))return[Li.indent(r)+j7(t,e)];if(typeof t=="string")return[Li.indent(r)+pD(e,'"""'),M7(t,r+e.defaultIndentation,e),Li.indent(r)+pD(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[Li.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(dD(a,e)){var u="- ";e.noColor||(u=En[e.dashColor](u)),u=Li.indent(r)+u,zf(a,!1,e)?(u+=Wo(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Wo(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Wo({message:t.message,stack:t.stack.split(`
48
48
  `)},e,r);var i=e.noAlign?0:Li.getMaxIndexLength(t),s,o=[];return Object.getOwnPropertyNames(t).forEach(function(a){if(dD(t[a],e))if(s=a+": ",e.noColor||(s=En[e.keysColor](s)),s=Li.indent(r)+s,zf(t[a],!1,e)){var u=e.noAlign?0:i-a.length;s+=Wo(t[a],e,u)[0],o.push(s)}else o.push(s),o.push.apply(o,Wo(t[a],e,r+e.defaultIndentation))}),o};Hu.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,Wo(e,r,n).join(`
49
49
  `)};Hu.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)+`
50
- `,e=e.substr(o)}try{s=JSON.parse(e)}catch{return En.red("Error:")+" Not valid JSON!"}return i+=Hu.render(s,r,n),i}});var yD=_(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;function Xo(t){"@babel/helpers - typeof";return Xo=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},Xo(t)}function BA(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,q7(n.key),n)}}function U7(t,e,r){return e&&BA(t.prototype,e),r&&BA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function q7(t){var e=H7(t,"string");return Xo(e)=="symbol"?e:e+""}function H7(t,e){if(Xo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V7(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z7(t,e,r){return e=zu(e),K7(t,gD()?Reflect.construct(e,r||[],zu(t).constructor):e.apply(t,r))}function K7(t,e){if(e&&(Xo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return G7(t)}function G7(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function W7(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&&Vu(t,e)}function mD(t){var e=typeof Map=="function"?new Map:void 0;return mD=function(n){if(n===null||!Y7(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 X7(n,arguments,zu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Vu(i,n)},mD(t)}function X7(t,e,r){if(gD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Vu(i,r.prototype),i}function gD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gD=function(){return!!t})()}function Y7(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Vu(t,e){return Vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vu(t,e)}function zu(t){return zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zu(t)}var J7=(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(V7(this,e),n=z7(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 W7(e,t),U7(e)})(mD(Error)),Yye=Kf.default=J7});var DD=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.enableDebugLog=Z7;Gf.log=Q7;var jA=!1;function Z7(){jA=!0}function Q7(t){jA&&console.log(t)}});var UA=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.default=void 0;function Ku(t){"@babel/helpers - typeof";return Ku=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},Ku(t)}function eV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MA(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,rV(n.key),n)}}function tV(t,e,r){return e&&MA(t.prototype,e),r&&MA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rV(t){var e=nV(t,"string");return Ku(e)=="symbol"?e:e+""}function nV(t,e){if(Ku(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ku(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qye=Wf.default=(function(){function t(){eV(this,t)}return tV(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 qA=_((wD,vD)=>{(function(t,e){typeof wD=="object"&&typeof vD<"u"?vD.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:wD,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(U){var H={};return U.forEach(function(te,x){return H[te]=x}),H})(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(U){return new Uint8Array(Array.prototype.slice.call(U,0))},h=function(U){return U.replace(/=/g,"").replace(/[+\/]/g,function(H){return H=="+"?"-":"_"})},d=function(U){return U.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(U){for(var H,te,x,O,V="",N=U.length%3,ne=0;ne<U.length;){if((te=U.charCodeAt(ne++))>255||(x=U.charCodeAt(ne++))>255||(O=U.charCodeAt(ne++))>255)throw new TypeError("invalid character found");H=te<<16|x<<8|O,V+=o[H>>18&63]+o[H>>12&63]+o[H>>6&63]+o[H&63]}return N?V.slice(0,N-3)+"===".substring(N):V},m=typeof btoa=="function"?function(U){return btoa(U)}:r?function(U){return Buffer.from(U,"binary").toString("base64")}:f,y=r?function(U){return Buffer.from(U).toString("base64")}:function(U){for(var H=4096,te=[],x=0,O=U.length;x<O;x+=H)te.push(c.apply(null,U.subarray(x,x+H)));return m(te.join(""))},v=function(U,H){return H===void 0&&(H=!1),H?h(y(U)):y(U)},E=function(U){if(U.length<2){var H=U.charCodeAt(0);return H<128?U:H<2048?c(192|H>>>6)+c(128|H&63):c(224|H>>>12&15)+c(128|H>>>6&63)+c(128|H&63)}else{var H=65536+(U.charCodeAt(0)-55296)*1024+(U.charCodeAt(1)-56320);return c(240|H>>>18&7)+c(128|H>>>12&63)+c(128|H>>>6&63)+c(128|H&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,p=function(U){return U.replace(A,E)},D=r?function(U){return Buffer.from(U,"utf8").toString("base64")}:i?function(U){return y(i.encode(U))}:function(U){return m(p(U))},w=function(U,H){return H===void 0&&(H=!1),H?h(D(U)):D(U)},C=function(U){return w(U,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,b=function(U){switch(U.length){case 4:var H=(7&U.charCodeAt(0))<<18|(63&U.charCodeAt(1))<<12|(63&U.charCodeAt(2))<<6|63&U.charCodeAt(3),te=H-65536;return c((te>>>10)+55296)+c((te&1023)+56320);case 3:return c((15&U.charCodeAt(0))<<12|(63&U.charCodeAt(1))<<6|63&U.charCodeAt(2));default:return c((31&U.charCodeAt(0))<<6|63&U.charCodeAt(1))}},k=function(U){return U.replace(F,b)},R=function(U){if(U=U.replace(/\s+/g,""),!u.test(U))throw new TypeError("malformed base64.");U+="==".slice(2-(U.length&3));for(var H,te,x,O=[],V=0;V<U.length;)H=a[U.charAt(V++)]<<18|a[U.charAt(V++)]<<12|(te=a[U.charAt(V++)])<<6|(x=a[U.charAt(V++)]),te===64?O.push(c(H>>16&255)):x===64?O.push(c(H>>16&255,H>>8&255)):O.push(c(H>>16&255,H>>8&255,H&255));return O.join("")},I=typeof atob=="function"?function(U){return atob(d(U))}:r?function(U){return Buffer.from(U,"base64").toString("binary")}:R,B=r?function(U){return l(Buffer.from(U,"base64"))}:function(U){return l(I(U).split("").map(function(H){return H.charCodeAt(0)}))},j=function(U){return B(L(U))},z=r?function(U){return Buffer.from(U,"base64").toString("utf8")}:n?function(U){return n.decode(B(U))}:function(U){return k(I(U))},L=function(U){return d(U.replace(/[-_]/g,function(H){return H=="-"?"+":"/"}))},S=function(U){return z(L(U))},T=function(U){if(typeof U!="string")return!1;var H=U.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(H)||!/[^\s0-9a-zA-Z\-_]/.test(H)},P=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},$=function(){var U=function(H,te){return Object.defineProperty(String.prototype,H,P(te))};U("fromBase64",function(){return S(this)}),U("toBase64",function(H){return w(this,H)}),U("toBase64URI",function(){return w(this,!0)}),U("toBase64URL",function(){return w(this,!0)}),U("toUint8Array",function(){return j(this)})},q=function(){var U=function(H,te){return Object.defineProperty(Uint8Array.prototype,H,P(te))};U("toBase64",function(H){return v(this,H)}),U("toBase64URI",function(){return v(this,!0)}),U("toBase64URL",function(){return v(this,!0)})},M=function(){$(),q()},G={version:t,VERSION:e,atob:I,atobPolyfill:R,btoa:m,btoaPolyfill:f,fromBase64:S,toBase64:w,encode:w,encodeURI:C,encodeURL:C,utob:p,btou:k,decode:S,isValid:T,fromUint8Array:v,toUint8Array:j,extendString:$,extendUint8Array:q,extendBuiltins:M};return G.Base64={},Object.keys(G).forEach(function(U){return G.Base64[U]=G[U]}),G})});var VA=_((tDe,HA)=>{"use strict";HA.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 GA=_(ED=>{"use strict";var iV=Object.prototype.hasOwnProperty,sV;function zA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function KA(t){try{return encodeURIComponent(t)}catch{return null}}function oV(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=zA(n[1]),s=zA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function aV(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(iV.call(t,i)){if(n=t[i],!n&&(n===null||n===sV||isNaN(n))&&(n=""),i=KA(i),n=KA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}ED.stringify=aV;ED.parse=oV});var tO=_((nDe,eO)=>{"use strict";var XA=VA(),Xf=GA(),uV=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,YA=/[\n\r\t]/g,cV=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,JA=/:\d+$/,lV=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,fV=/^[a-zA-Z]:/;function _D(t){return(t||"").toString().replace(uV,"")}var bD=[["#","hash"],["?","query"],function(e,r){return bn(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]],WA={hash:1,query:1};function ZA(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 _n(unescape(t.pathname),{});else if(i==="string"){n=new _n(t,{});for(s in WA)delete n[s]}else if(i==="object"){for(s in t)s in WA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=cV.test(t.href))}return n}function bn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function QA(t,e){t=_D(t),t=t.replace(YA,""),e=e||{};var r=lV.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)):bn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&bn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||bn(n),slashesCount:o,rest:a}}function hV(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 _n(t,e,r){if(t=_D(t),t=t.replace(YA,""),!(this instanceof _n))return new _n(t,e,r);var n,i,s,o,a,u,c=bD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Xf.parse),e=ZA(e),i=QA(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||fV.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!bn(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=hV(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&bn(h.protocol)&&(h.pathname="/"+h.pathname),XA(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:"&&bn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function dV(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Xf.parse)(e)),n[t]=e;break;case"port":n[t]=e,XA(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,JA.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<bD.length;o++){var a=bD[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:"&&bn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function pV(t){(!t||typeof t!="function")&&(t=Xf.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||bn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&bn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||JA.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}_n.prototype={set:dV,toString:pV};_n.extractProtocol=QA;_n.location=ZA;_n.trimLeft=_D;_n.qs=Xf;eO.exports=_n});var rO=_(CD=>{"use strict";Object.defineProperty(CD,"__esModule",{value:!0});CD.default=mV;function mV(){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 yO=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.default=void 0;var gV=qA(),yV=OD(tO()),Yf=OD(yD()),_s=DD(),DV=OD(rO());function OD(t){return t&&t.__esModule?t:{default:t}}function SD(){"use strict";SD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",v={};function E(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=p.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Cs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===m)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=m;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Cs(S)+" is not iterable")}return A.prototype=p,i(F,"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(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function nO(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 wV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){nO(s,n,i,o,a,"next",u)}function a(u){nO(s,n,i,o,a,"throw",u)}o(void 0)})}}function hO(t,e){return bV(t)||EV(t,e)||dO(t,e)||vV()}function vV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
50
+ `,e=e.substr(o)}try{s=JSON.parse(e)}catch{return En.red("Error:")+" Not valid JSON!"}return i+=Hu.render(s,r,n),i}});var yD=_(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.default=void 0;function Xo(t){"@babel/helpers - typeof";return Xo=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},Xo(t)}function BA(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,q7(n.key),n)}}function U7(t,e,r){return e&&BA(t.prototype,e),r&&BA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function q7(t){var e=H7(t,"string");return Xo(e)=="symbol"?e:e+""}function H7(t,e){if(Xo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function V7(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z7(t,e,r){return e=zu(e),K7(t,gD()?Reflect.construct(e,r||[],zu(t).constructor):e.apply(t,r))}function K7(t,e){if(e&&(Xo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return G7(t)}function G7(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function W7(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&&Vu(t,e)}function mD(t){var e=typeof Map=="function"?new Map:void 0;return mD=function(n){if(n===null||!Y7(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 X7(n,arguments,zu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Vu(i,n)},mD(t)}function X7(t,e,r){if(gD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Vu(i,r.prototype),i}function gD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gD=function(){return!!t})()}function Y7(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Vu(t,e){return Vu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Vu(t,e)}function zu(t){return zu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zu(t)}var J7=(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(V7(this,e),n=z7(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 W7(e,t),U7(e)})(mD(Error)),Yye=Kf.default=J7});var DD=_(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.enableDebugLog=Z7;Gf.log=Q7;var jA=!1;function Z7(){jA=!0}function Q7(t){jA&&console.log(t)}});var UA=_(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});Wf.default=void 0;function Ku(t){"@babel/helpers - typeof";return Ku=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},Ku(t)}function eV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function MA(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,rV(n.key),n)}}function tV(t,e,r){return e&&MA(t.prototype,e),r&&MA(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rV(t){var e=nV(t,"string");return Ku(e)=="symbol"?e:e+""}function nV(t,e){if(Ku(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ku(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Qye=Wf.default=(function(){function t(){eV(this,t)}return tV(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 qA=_((wD,vD)=>{(function(t,e){typeof wD=="object"&&typeof vD<"u"?vD.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:wD,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(U){var H={};return U.forEach(function(te,x){return H[te]=x}),H})(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(U){return new Uint8Array(Array.prototype.slice.call(U,0))},h=function(U){return U.replace(/=/g,"").replace(/[+\/]/g,function(H){return H=="+"?"-":"_"})},d=function(U){return U.replace(/[^A-Za-z0-9\+\/]/g,"")},f=function(U){for(var H,te,x,O,V="",N=U.length%3,ne=0;ne<U.length;){if((te=U.charCodeAt(ne++))>255||(x=U.charCodeAt(ne++))>255||(O=U.charCodeAt(ne++))>255)throw new TypeError("invalid character found");H=te<<16|x<<8|O,V+=o[H>>18&63]+o[H>>12&63]+o[H>>6&63]+o[H&63]}return N?V.slice(0,N-3)+"===".substring(N):V},p=typeof btoa=="function"?function(U){return btoa(U)}:r?function(U){return Buffer.from(U,"binary").toString("base64")}:f,y=r?function(U){return Buffer.from(U).toString("base64")}:function(U){for(var H=4096,te=[],x=0,O=U.length;x<O;x+=H)te.push(c.apply(null,U.subarray(x,x+H)));return p(te.join(""))},v=function(U,H){return H===void 0&&(H=!1),H?h(y(U)):y(U)},E=function(U){if(U.length<2){var H=U.charCodeAt(0);return H<128?U:H<2048?c(192|H>>>6)+c(128|H&63):c(224|H>>>12&15)+c(128|H>>>6&63)+c(128|H&63)}else{var H=65536+(U.charCodeAt(0)-55296)*1024+(U.charCodeAt(1)-56320);return c(240|H>>>18&7)+c(128|H>>>12&63)+c(128|H>>>6&63)+c(128|H&63)}},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,m=function(U){return U.replace(A,E)},D=r?function(U){return Buffer.from(U,"utf8").toString("base64")}:i?function(U){return y(i.encode(U))}:function(U){return p(m(U))},w=function(U,H){return H===void 0&&(H=!1),H?h(D(U)):D(U)},C=function(U){return w(U,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,b=function(U){switch(U.length){case 4:var H=(7&U.charCodeAt(0))<<18|(63&U.charCodeAt(1))<<12|(63&U.charCodeAt(2))<<6|63&U.charCodeAt(3),te=H-65536;return c((te>>>10)+55296)+c((te&1023)+56320);case 3:return c((15&U.charCodeAt(0))<<12|(63&U.charCodeAt(1))<<6|63&U.charCodeAt(2));default:return c((31&U.charCodeAt(0))<<6|63&U.charCodeAt(1))}},k=function(U){return U.replace(F,b)},R=function(U){if(U=U.replace(/\s+/g,""),!u.test(U))throw new TypeError("malformed base64.");U+="==".slice(2-(U.length&3));for(var H,te,x,O=[],V=0;V<U.length;)H=a[U.charAt(V++)]<<18|a[U.charAt(V++)]<<12|(te=a[U.charAt(V++)])<<6|(x=a[U.charAt(V++)]),te===64?O.push(c(H>>16&255)):x===64?O.push(c(H>>16&255,H>>8&255)):O.push(c(H>>16&255,H>>8&255,H&255));return O.join("")},I=typeof atob=="function"?function(U){return atob(d(U))}:r?function(U){return Buffer.from(U,"base64").toString("binary")}:R,B=r?function(U){return l(Buffer.from(U,"base64"))}:function(U){return l(I(U).split("").map(function(H){return H.charCodeAt(0)}))},j=function(U){return B(L(U))},z=r?function(U){return Buffer.from(U,"base64").toString("utf8")}:n?function(U){return n.decode(B(U))}:function(U){return k(I(U))},L=function(U){return d(U.replace(/[-_]/g,function(H){return H=="-"?"+":"/"}))},S=function(U){return z(L(U))},T=function(U){if(typeof U!="string")return!1;var H=U.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(H)||!/[^\s0-9a-zA-Z\-_]/.test(H)},P=function(U){return{value:U,enumerable:!1,writable:!0,configurable:!0}},$=function(){var U=function(H,te){return Object.defineProperty(String.prototype,H,P(te))};U("fromBase64",function(){return S(this)}),U("toBase64",function(H){return w(this,H)}),U("toBase64URI",function(){return w(this,!0)}),U("toBase64URL",function(){return w(this,!0)}),U("toUint8Array",function(){return j(this)})},q=function(){var U=function(H,te){return Object.defineProperty(Uint8Array.prototype,H,P(te))};U("toBase64",function(H){return v(this,H)}),U("toBase64URI",function(){return v(this,!0)}),U("toBase64URL",function(){return v(this,!0)})},M=function(){$(),q()},G={version:t,VERSION:e,atob:I,atobPolyfill:R,btoa:p,btoaPolyfill:f,fromBase64:S,toBase64:w,encode:w,encodeURI:C,encodeURL:C,utob:m,btou:k,decode:S,isValid:T,fromUint8Array:v,toUint8Array:j,extendString:$,extendUint8Array:q,extendBuiltins:M};return G.Base64={},Object.keys(G).forEach(function(U){return G.Base64[U]=G[U]}),G})});var VA=_((tDe,HA)=>{"use strict";HA.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 GA=_(ED=>{"use strict";var iV=Object.prototype.hasOwnProperty,sV;function zA(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return null}}function KA(t){try{return encodeURIComponent(t)}catch{return null}}function oV(t){for(var e=/([^=?#&]+)=?([^&]*)/g,r={},n;n=e.exec(t);){var i=zA(n[1]),s=zA(n[2]);i===null||s===null||i in r||(r[i]=s)}return r}function aV(t,e){e=e||"";var r=[],n,i;typeof e!="string"&&(e="?");for(i in t)if(iV.call(t,i)){if(n=t[i],!n&&(n===null||n===sV||isNaN(n))&&(n=""),i=KA(i),n=KA(n),i===null||n===null)continue;r.push(i+"="+n)}return r.length?e+r.join("&"):""}ED.stringify=aV;ED.parse=oV});var tO=_((nDe,eO)=>{"use strict";var XA=VA(),Xf=GA(),uV=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,YA=/[\n\r\t]/g,cV=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,JA=/:\d+$/,lV=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,fV=/^[a-zA-Z]:/;function _D(t){return(t||"").toString().replace(uV,"")}var bD=[["#","hash"],["?","query"],function(e,r){return bn(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]],WA={hash:1,query:1};function ZA(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 _n(unescape(t.pathname),{});else if(i==="string"){n=new _n(t,{});for(s in WA)delete n[s]}else if(i==="object"){for(s in t)s in WA||(n[s]=t[s]);n.slashes===void 0&&(n.slashes=cV.test(t.href))}return n}function bn(t){return t==="file:"||t==="ftp:"||t==="http:"||t==="https:"||t==="ws:"||t==="wss:"}function QA(t,e){t=_D(t),t=t.replace(YA,""),e=e||{};var r=lV.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)):bn(n)?a=r[4]:n?i&&(a=a.slice(2)):o>=2&&bn(e.protocol)&&(a=r[4]),{protocol:n,slashes:i||bn(n),slashesCount:o,rest:a}}function hV(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 _n(t,e,r){if(t=_D(t),t=t.replace(YA,""),!(this instanceof _n))return new _n(t,e,r);var n,i,s,o,a,u,c=bD.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Xf.parse),e=ZA(e),i=QA(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||fV.test(t))||!i.slashes&&(i.protocol||i.slashesCount<2||!bn(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=hV(h.pathname,e.pathname)),h.pathname.charAt(0)!=="/"&&bn(h.protocol)&&(h.pathname="/"+h.pathname),XA(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:"&&bn(h.protocol)&&h.host?h.protocol+"//"+h.host:"null",h.href=h.toString()}function dV(t,e,r){var n=this;switch(t){case"query":typeof e=="string"&&e.length&&(e=(r||Xf.parse)(e)),n[t]=e;break;case"port":n[t]=e,XA(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,JA.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<bD.length;o++){var a=bD[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:"&&bn(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function pV(t){(!t||typeof t!="function")&&(t=Xf.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||bn(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&bn(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||JA.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}_n.prototype={set:dV,toString:pV};_n.extractProtocol=QA;_n.location=ZA;_n.trimLeft=_D;_n.qs=Xf;eO.exports=_n});var rO=_(CD=>{"use strict";Object.defineProperty(CD,"__esModule",{value:!0});CD.default=mV;function mV(){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 yO=_(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.default=void 0;var gV=qA(),yV=OD(tO()),Yf=OD(yD()),_s=DD(),DV=OD(rO());function OD(t){return t&&t.__esModule?t:{default:t}}function SD(){"use strict";SD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",y="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=m.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Cs(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Cs(S)+" is not iterable")}return A.prototype=m,i(F,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:A,configurable:!0}),A.displayName=c(m,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,m):(S.__proto__=m,c(S,u,"GeneratorFunction")),S.prototype=Object.create(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function nO(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 wV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){nO(s,n,i,o,a,"next",u)}function a(u){nO(s,n,i,o,a,"throw",u)}o(void 0)})}}function hO(t,e){return bV(t)||EV(t,e)||dO(t,e)||vV()}function vV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
51
51
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function EV(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 bV(t){if(Array.isArray(t))return t}function Cs(t){"@babel/helpers - typeof";return Cs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cs(t)}function _V(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=dO(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.
52
- 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 dO(t,e){if(t){if(typeof t=="string")return iO(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 iO(t,e)}}function iO(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 sO(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 Yo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sO(Object(r),!0).forEach(function(n){CV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function CV(t,e,r){return e=pO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SV(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,pO(n.key),n)}}function AV(t,e,r){return e&&oO(t.prototype,e),r&&oO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pO(t){var e=OV(t,"string");return Cs(e)=="symbol"?e:e+""}function OV(t,e){if(Cs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Jf="tus-v1",Zf="ietf-draft-03",Gu="ietf-draft-05",xV={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:gO,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:Jf},mO=(function(){function t(e,r){SV(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 AV(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(![Jf,Zf,Gu].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,_s.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,_s.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:IV(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,v){var E=Yo(Yo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Yo(Yo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:v,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,E);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=aO(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Jo(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=fO(n.options.endpoint,h),(0,_s.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,_s.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,_s.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,_s.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=_V(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 Yf.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),lO(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=aO(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===Zf||this.options.protocol===Gu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Jo(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=fO(r.options.endpoint,a),(0,_s.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(!Jo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Jo(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===Jf){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(!Jo(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===Jf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Gu&&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===Zf||n.options.protocol===Gu)&&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=uO(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 cO(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=uO("DELETE",r,n);return cO(i,null,n).then(function(s){if(s.getStatus()!==204)throw new Yf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Yf.default||(s=new Yf.default("tus: failed to terminate upload",s,i,null)),!lO(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Yo(Yo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function aO(t){return Object.entries(t).map(function(e){var r=hO(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(gV.Base64.encode(String(i)))}).join(",")}function Jo(t,e){return t>=e&&t<e+100}function uO(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Zf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Gu?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=hO(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,DV.default)();n.setHeader("X-Request-ID",l)}return n}function cO(t,e,r){return AD.apply(this,arguments)}function AD(){return AD=wV(SD().mark(function t(e,r,n){var i;return SD().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)})),AD.apply(this,arguments)}function TV(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function lO(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):gO(t)}function gO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Jo(e,400)||e===409||e===423)&&TV()}function fO(t,e){return new yV.default(e,t).toString()}function IV(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}mO.defaultOptions=xV;var sDe=Qf.default=mO});var wO=_((aDe,DO)=>{"use strict";var Cn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Cn.writable=t=>Cn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Cn.readable=t=>Cn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Cn.duplex=t=>Cn.writable(t)&&Cn.readable(t);Cn.transform=t=>Cn.duplex(t)&&typeof t._transform=="function";DO.exports=Cn});var EO=_(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.default=void 0;function Wu(t){"@babel/helpers - typeof";return Wu=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},Wu(t)}function PV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vO(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,RV(n.key),n)}}function FV(t,e,r){return e&&vO(t.prototype,e),r&&vO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RV(t){var e=kV(t,"string");return Wu(e)=="symbol"?e:e+""}function kV(t,e){if(Wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uDe=eh.default=(function(){function t(e){PV(this,t),this._buffer=e,this.size=e.length}return FV(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 SO=_(ID=>{"use strict";Object.defineProperty(ID,"__esModule",{value:!0});ID.default=MV;var CO=require("fs");function Ss(t){"@babel/helpers - typeof";return Ss=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},Ss(t)}function xD(){"use strict";xD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",v={};function E(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=p.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Ss(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===m)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=m;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Ss(S)+" is not iterable")}return A.prototype=p,i(F,"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(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function NV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,LV(n.key),n)}}function $V(t,e,r){return e&&bO(t.prototype,e),r&&bO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LV(t){var e=BV(t,"string");return Ss(e)=="symbol"?e:e+""}function BV(t,e){if(Ss(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ss(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _O(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 jV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){_O(s,n,i,o,a,"next",u)}function a(u){_O(s,n,i,o,a,"throw",u)}o(void 0)})}}function MV(t){return TD.apply(this,arguments)}function TD(){return TD=jV(xD().mark(function t(e){var r,n,i,s,o,a,u;return xD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,CO.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 UV(e,n,u));case 9:case"end":return l.stop()}},t)})),TD.apply(this,arguments)}var UV=(function(){function t(e,r,n){NV(this,t),this._stream=e,this._path=r,this.size=n}return $V(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,CO.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 FD=_(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.default=void 0;function As(t){"@babel/helpers - typeof";return As=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},As(t)}function Xu(){"use strict";Xu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",m="executing",y="completed",v={};function E(){}function A(){}function p(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=p.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&As(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===m)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=m;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(As(S)+" is not iterable")}return A.prototype=p,i(F,"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(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function qV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AO(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 HV(t,e,r){return e&&AO(t.prototype,e),r&&AO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function VV(t){var e=zV(t,"string");return As(e)=="symbol"?e:e+""}function zV(t,e){if(As(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(As(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OO(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 xO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){OO(s,n,i,o,a,"next",u)}function a(u){OO(s,n,i,o,a,"throw",u)}o(void 0)})}}function KV(t,e){return PD.apply(this,arguments)}function PD(){return PD=xO(Xu().mark(function t(e,r){return Xu().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)})),PD.apply(this,arguments)}var fDe=th.default=(function(){function t(e){var r=this;qV(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 HV(t,[{key:"slice",value:(function(){var e=xO(Xu().mark(function n(i,s){var o,a,u,c,l;return Xu().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,KV(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 IO=_(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.default=void 0;var GV=require("fs"),WV=rh(wO()),XV=rh(EO()),YV=rh(SO()),JV=rh(FD());function rh(t){return t&&t.__esModule?t:{default:t}}function Yu(t){"@babel/helpers - typeof";return Yu=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},Yu(t)}function ZV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TO(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,ez(n.key),n)}}function QV(t,e,r){return e&&TO(t.prototype,e),r&&TO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ez(t){var e=tz(t,"string");return Yu(e)=="symbol"?e:e+""}function tz(t,e){if(Yu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dDe=nh.default=(function(){function t(){ZV(this,t)}return QV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new XV.default(r)):r instanceof GV.ReadStream&&r.path!=null?(0,YV.default)(r):WV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new JV.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 kO=_(RD=>{"use strict";Object.defineProperty(RD,"__esModule",{value:!0});RD.default=iz;var rz=require("crypto"),PO=RO(require("fs")),nz=RO(require("path"));function FO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(FO=function(n){return n?r:e})(t)}function RO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=FO(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 iz(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,rz.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof PO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=nz.resolve(t.path);PO.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 jO=_((gDe,BO)=>{var LO="Expected a function",NO=NaN,sz="[object Symbol]",oz=/^\s+|\s+$/g,az=/^[-+]0x[0-9a-f]+$/i,uz=/^0b[01]+$/i,cz=/^0o[0-7]+$/i,lz=parseInt,fz=typeof global=="object"&&global&&global.Object===Object&&global,hz=typeof self=="object"&&self&&self.Object===Object&&self,dz=fz||hz||Function("return this")(),pz=Object.prototype,mz=pz.toString,gz=Math.max,yz=Math.min,kD=function(){return dz.Date.now()};function Dz(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(LO);e=$O(e)||0,ih(r)&&(l=!!r.leading,h="maxWait"in r,s=h?gz($O(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(C){var F=n,b=i;return n=i=void 0,c=C,o=t.apply(b,F),o}function m(C){return c=C,a=setTimeout(E,e),l?f(C):o}function y(C){var F=C-u,b=C-c,k=e-F;return h?yz(k,s-b):k}function v(C){var F=C-u,b=C-c;return u===void 0||F>=e||F<0||h&&b>=s}function E(){var C=kD();if(v(C))return A(C);a=setTimeout(E,y(C))}function A(C){return a=void 0,d&&n?f(C):(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(kD())}function w(){var C=kD(),F=v(C);if(n=arguments,i=this,u=C,F){if(a===void 0)return m(u);if(h)return a=setTimeout(E,e),f(u)}return a===void 0&&(a=setTimeout(E,e)),o}return w.cancel=p,w.flush=D,w}function wz(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(LO);return ih(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Dz(t,e,{leading:n,maxWait:e,trailing:i})}function ih(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function vz(t){return!!t&&typeof t=="object"}function Ez(t){return typeof t=="symbol"||vz(t)&&mz.call(t)==sz}function $O(t){if(typeof t=="number")return t;if(Ez(t))return NO;if(ih(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ih(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(oz,"");var r=uz.test(t);return r||cz.test(t)?lz(t.slice(2),r?2:8):az.test(t)?NO:+t}BO.exports=wz});var WO=_(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.default=void 0;var bz=zO(require("http")),_z=zO(require("https")),qO=require("stream"),Cz=require("url"),HO=Sz(jO());function Sz(t){return t&&t.__esModule?t:{default:t}}function VO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(VO=function(n){return n?r:e})(t)}function zO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=VO(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 Az(t,e,r){return e=sh(e),Oz(t,KO()?Reflect.construct(e,r||[],sh(t).constructor):e.apply(t,r))}function Oz(t,e){if(e&&(Zo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xz(t)}function xz(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KO=function(){return!!t})()}function sh(t){return sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sh(t)}function Tz(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&&ND(t,e)}function ND(t,e){return ND=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ND(t,e)}function MO(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 Ju(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?MO(Object(r),!0).forEach(function(n){Iz(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):MO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Iz(t,e,r){return e=GO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zo(t){"@babel/helpers - typeof";return Zo=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},Zo(t)}function oh(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,GO(n.key),n)}}function ah(t,e,r){return e&&UO(t.prototype,e),r&&UO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function GO(t){var e=Pz(t,"string");return Zo(e)=="symbol"?e:e+""}function Pz(t,e){if(Zo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yDe=uh.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oh(this,t),this._requestOptions=e}return ah(t,[{key:"createRequest",value:function(r,n){return new Fz(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),Fz=(function(){function t(e,r,n){oh(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return ah(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=Ju(Ju(Ju({},(0,Cz.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Ju(Ju({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?_z:bz;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 Rz(c,h))})}),u.on("error",function(c){s(c)}),n instanceof qO.Readable?n.pipe(new kz(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}}])})(),Rz=(function(){function t(e,r){oh(this,t),this._response=e,this._body=r}return ah(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}}])})(),kz=(function(t){function e(r){var n;return oh(this,e),n=Az(this,e),n._onprogress=(0,HO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return Tz(e,t),ah(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(qO.Transform),Nz=function(e,r,n){n=(0,HO.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 XO=_($D=>{"use strict";$D.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};$D.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(`
52
+ 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 dO(t,e){if(t){if(typeof t=="string")return iO(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 iO(t,e)}}function iO(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 sO(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 Yo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sO(Object(r),!0).forEach(function(n){CV(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function CV(t,e,r){return e=pO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function SV(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,pO(n.key),n)}}function AV(t,e,r){return e&&oO(t.prototype,e),r&&oO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function pO(t){var e=OV(t,"string");return Cs(e)=="symbol"?e:e+""}function OV(t,e){if(Cs(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Cs(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Jf="tus-v1",Zf="ietf-draft-03",Gu="ietf-draft-05",xV={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:gO,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:Jf},mO=(function(){function t(e,r){SV(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 AV(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(![Jf,Zf,Gu].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,_s.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,_s.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:IV(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 p=f.value;return new Promise(function(y,v){var E=Yo(Yo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Yo(Yo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:y,onError:v,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(p,E);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=aO(n.options.metadata);return l!==""&&c.setHeader("Upload-Metadata",l),n._sendRequest(c,null)}).then(function(l){if(!Jo(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=fO(n.options.endpoint,h),(0,_s.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,_s.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,_s.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,_s.log)("Creating a new upload"),this._createUpload()}},{key:"abort",value:function(r){var n=this;if(this._parallelUploads!=null){var i=_V(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 Yf.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),lO(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=aO(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===Zf||this.options.protocol===Gu)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Jo(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=fO(r.options.endpoint,a),(0,_s.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(!Jo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Jo(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===Jf){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(!Jo(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===Jf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Gu&&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===Zf||n.options.protocol===Gu)&&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=uO(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 cO(r,n,this.options)}}],[{key:"terminate",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=uO("DELETE",r,n);return cO(i,null,n).then(function(s){if(s.getStatus()!==204)throw new Yf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Yf.default||(s=new Yf.default("tus: failed to terminate upload",s,i,null)),!lO(s,0,n))throw s;var o=n.retryDelays[0],a=n.retryDelays.slice(1),u=Yo(Yo({},n),{},{retryDelays:a});return new Promise(function(c){return setTimeout(c,o)}).then(function(){return t.terminate(r,u)})})}}])})();function aO(t){return Object.entries(t).map(function(e){var r=hO(e,2),n=r[0],i=r[1];return"".concat(n," ").concat(gV.Base64.encode(String(i)))}).join(",")}function Jo(t,e){return t>=e&&t<e+100}function uO(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Zf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Gu?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=hO(o[s],2),u=a[0],c=a[1];n.setHeader(u,c)}if(r.addRequestId){var l=(0,DV.default)();n.setHeader("X-Request-ID",l)}return n}function cO(t,e,r){return AD.apply(this,arguments)}function AD(){return AD=wV(SD().mark(function t(e,r,n){var i;return SD().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)})),AD.apply(this,arguments)}function TV(){var t=!0;return typeof navigator<"u"&&navigator.onLine===!1&&(t=!1),t}function lO(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):gO(t)}function gO(t){var e=t.originalResponse?t.originalResponse.getStatus():0;return(!Jo(e,400)||e===409||e===423)&&TV()}function fO(t,e){return new yV.default(e,t).toString()}function IV(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}mO.defaultOptions=xV;var sDe=Qf.default=mO});var wO=_((aDe,DO)=>{"use strict";var Cn=t=>t!==null&&typeof t=="object"&&typeof t.pipe=="function";Cn.writable=t=>Cn(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object";Cn.readable=t=>Cn(t)&&t.readable!==!1&&typeof t._read=="function"&&typeof t._readableState=="object";Cn.duplex=t=>Cn.writable(t)&&Cn.readable(t);Cn.transform=t=>Cn.duplex(t)&&typeof t._transform=="function";DO.exports=Cn});var EO=_(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.default=void 0;function Wu(t){"@babel/helpers - typeof";return Wu=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},Wu(t)}function PV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vO(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,RV(n.key),n)}}function FV(t,e,r){return e&&vO(t.prototype,e),r&&vO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function RV(t){var e=kV(t,"string");return Wu(e)=="symbol"?e:e+""}function kV(t,e){if(Wu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var uDe=eh.default=(function(){function t(e){PV(this,t),this._buffer=e,this.size=e.length}return FV(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 SO=_(ID=>{"use strict";Object.defineProperty(ID,"__esModule",{value:!0});ID.default=MV;var CO=require("fs");function Ss(t){"@babel/helpers - typeof";return Ss=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},Ss(t)}function xD(){"use strict";xD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",y="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=m.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&Ss(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Ss(S)+" is not iterable")}return A.prototype=m,i(F,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:A,configurable:!0}),A.displayName=c(m,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,m):(S.__proto__=m,c(S,u,"GeneratorFunction")),S.prototype=Object.create(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function NV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bO(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,LV(n.key),n)}}function $V(t,e,r){return e&&bO(t.prototype,e),r&&bO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function LV(t){var e=BV(t,"string");return Ss(e)=="symbol"?e:e+""}function BV(t,e){if(Ss(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ss(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _O(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 jV(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){_O(s,n,i,o,a,"next",u)}function a(u){_O(s,n,i,o,a,"throw",u)}o(void 0)})}}function MV(t){return TD.apply(this,arguments)}function TD(){return TD=jV(xD().mark(function t(e){var r,n,i,s,o,a,u;return xD().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return n=e.path.toString(),l.next=3,CO.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 UV(e,n,u));case 9:case"end":return l.stop()}},t)})),TD.apply(this,arguments)}var UV=(function(){function t(e,r,n){NV(this,t),this._stream=e,this._path=r,this.size=n}return $V(t,[{key:"slice",value:function(r,n){var i,s=(i=this._stream.start)!==null&&i!==void 0?i:0,o=(0,CO.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 FD=_(th=>{"use strict";Object.defineProperty(th,"__esModule",{value:!0});th.default=void 0;function As(t){"@babel/helpers - typeof";return As=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},As(t)}function Xu(){"use strict";Xu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(S,T,P){S[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(S,T,P){return Object.defineProperty(S,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),S[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(S,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new z($||[]);return i(M,"_invoke",{value:R(S,P,G)}),M}function h(S,T,P){try{return{type:"normal",arg:S.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",y="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,C=w&&w(w(L([])));C&&C!==r&&n.call(C,o)&&(D=C);var F=m.prototype=E.prototype=Object.create(D);function b(S){["next","throw","return"].forEach(function(T){c(S,T,function(P){return this._invoke(T,P)})})}function k(S,T){function P(q,M,G,U){var H=h(S[q],S,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&As(x)=="object"&&n.call(x,"__await")?T.resolve(x.__await).then(function(O){P("next",O,G,U)},function(O){P("throw",O,G,U)}):T.resolve(x).then(function(O){te.value=O,G(te)},function(O){return P("throw",O,G,U)})}U(H.arg)}var $;i(this,"_invoke",{value:function(M,G){function U(){return new T(function(H,te){P(M,G,H,te)})}return $=$?$.then(U,U):U()}})}function R(S,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===y){if(q==="throw")throw M;return{value:t,done:!0}}for(P.method=q,P.arg=M;;){var G=P.delegate;if(G){var U=I(G,P);if(U){if(U===v)continue;return U}}if(P.method==="next")P.sent=P._sent=P.arg;else if(P.method==="throw"){if($===d)throw $=y,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(S,T,P);if(H.type==="normal"){if($=P.done?y:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=y,P.method="throw",P.arg=H.arg)}}}function I(S,T){var P=T.method,$=S.iterator[P];if($===t)return T.delegate=null,P==="throw"&&S.iterator.return&&(T.method="return",T.arg=t,I(S,T),T.method==="throw")||P!=="return"&&(T.method="throw",T.arg=new TypeError("The iterator does not provide a '"+P+"' method")),v;var q=h($,S.iterator,T.arg);if(q.type==="throw")return T.method="throw",T.arg=q.arg,T.delegate=null,v;var M=q.arg;return M?M.done?(T[S.resultName]=M.value,T.next=S.nextLoc,T.method!=="return"&&(T.method="next",T.arg=t),T.delegate=null,v):M:(T.method="throw",T.arg=new TypeError("iterator result is not an object"),T.delegate=null,v)}function B(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 j(S){var T=S.completion||{};T.type="normal",delete T.arg,S.completion=T}function z(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(B,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 P=-1,$=function q(){for(;++P<S.length;)if(n.call(S,P))return q.value=S[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(As(S)+" is not iterable")}return A.prototype=m,i(F,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:A,configurable:!0}),A.displayName=c(m,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,m):(S.__proto__=m,c(S,u,"GeneratorFunction")),S.prototype=Object.create(F),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,P,$,q){q===void 0&&(q=Promise);var M=new k(l(S,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},b(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(S){var T=Object(S),P=[];for(var $ in T)P.push($);return P.reverse(),function q(){for(;P.length;){var M=P.pop();if(M in T)return q.value=M,q.done=!1,q}return q.done=!0,q}},e.values=L,z.prototype={constructor:z,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(j),!T)for(var P in this)P.charAt(0)==="t"&&n.call(this,P)&&!isNaN(+P.slice(1))&&(this[P]=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 P=this;function $(te,x){return G.type="throw",G.arg=T,P.next=te,x&&(P.method="next",P.arg=t),!!x}for(var q=this.tryEntries.length-1;q>=0;--q){var M=this.tryEntries[q],G=M.completion;if(M.tryLoc==="root")return $("end");if(M.tryLoc<=this.prev){var U=n.call(M,"catchLoc"),H=n.call(M,"finallyLoc");if(U&&H){if(this.prev<M.catchLoc)return $(M.catchLoc,!0);if(this.prev<M.finallyLoc)return $(M.finallyLoc)}else if(U){if(this.prev<M.catchLoc)return $(M.catchLoc,!0)}else{if(!H)throw Error("try statement without catch or finally");if(this.prev<M.finallyLoc)return $(M.finallyLoc)}}}},abrupt:function(T,P){for(var $=this.tryEntries.length-1;$>=0;--$){var q=this.tryEntries[$];if(q.tryLoc<=this.prev&&n.call(q,"finallyLoc")&&this.prev<q.finallyLoc){var M=q;break}}M&&(T==="break"||T==="continue")&&M.tryLoc<=P&&P<=M.finallyLoc&&(M=null);var G=M?M.completion:{};return G.type=T,G.arg=P,M?(this.method="next",this.next=M.finallyLoc,v):this.complete(G)},complete:function(T,P){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"&&P&&(this.next=P),v},finish:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.finallyLoc===T)return this.complete($.completion,$.afterLoc),j($),v}},catch:function(T){for(var P=this.tryEntries.length-1;P>=0;--P){var $=this.tryEntries[P];if($.tryLoc===T){var q=$.completion;if(q.type==="throw"){var M=q.arg;j($)}return M}}throw Error("illegal catch attempt")},delegateYield:function(T,P,$){return this.delegate={iterator:L(T),resultName:P,nextLoc:$},this.method==="next"&&(this.arg=t),v}},e}function qV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AO(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 HV(t,e,r){return e&&AO(t.prototype,e),r&&AO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function VV(t){var e=zV(t,"string");return As(e)=="symbol"?e:e+""}function zV(t,e){if(As(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(As(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function OO(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 xO(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){OO(s,n,i,o,a,"next",u)}function a(u){OO(s,n,i,o,a,"throw",u)}o(void 0)})}}function KV(t,e){return PD.apply(this,arguments)}function PD(){return PD=xO(Xu().mark(function t(e,r){return Xu().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)})),PD.apply(this,arguments)}var fDe=th.default=(function(){function t(e){var r=this;qV(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 HV(t,[{key:"slice",value:(function(){var e=xO(Xu().mark(function n(i,s){var o,a,u,c,l;return Xu().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,KV(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 IO=_(nh=>{"use strict";Object.defineProperty(nh,"__esModule",{value:!0});nh.default=void 0;var GV=require("fs"),WV=rh(wO()),XV=rh(EO()),YV=rh(SO()),JV=rh(FD());function rh(t){return t&&t.__esModule?t:{default:t}}function Yu(t){"@babel/helpers - typeof";return Yu=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},Yu(t)}function ZV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TO(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,ez(n.key),n)}}function QV(t,e,r){return e&&TO(t.prototype,e),r&&TO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ez(t){var e=tz(t,"string");return Yu(e)=="symbol"?e:e+""}function tz(t,e){if(Yu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Yu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var dDe=nh.default=(function(){function t(){ZV(this,t)}return QV(t,[{key:"openFile",value:function(r,n){return Buffer.isBuffer(r)?Promise.resolve(new XV.default(r)):r instanceof GV.ReadStream&&r.path!=null?(0,YV.default)(r):WV.default.readable(r)?(n=Number(n),Number.isFinite(n)?Promise.resolve(new JV.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 kO=_(RD=>{"use strict";Object.defineProperty(RD,"__esModule",{value:!0});RD.default=iz;var rz=require("crypto"),PO=RO(require("fs")),nz=RO(require("path"));function FO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(FO=function(n){return n?r:e})(t)}function RO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=FO(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 iz(t,e){if(Buffer.isBuffer(t)){var r=65536,n=t.slice(0,Math.min(r,t.length)),i=(0,rz.createHash)("md5").update(n).digest("hex"),s=["node-buffer",i,t.length,e.endpoint].join("-");return Promise.resolve(s)}return t instanceof PO.ReadStream&&t.path!=null?new Promise(function(o,a){var u=nz.resolve(t.path);PO.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 jO=_((gDe,BO)=>{var LO="Expected a function",NO=NaN,sz="[object Symbol]",oz=/^\s+|\s+$/g,az=/^[-+]0x[0-9a-f]+$/i,uz=/^0b[01]+$/i,cz=/^0o[0-7]+$/i,lz=parseInt,fz=typeof global=="object"&&global&&global.Object===Object&&global,hz=typeof self=="object"&&self&&self.Object===Object&&self,dz=fz||hz||Function("return this")(),pz=Object.prototype,mz=pz.toString,gz=Math.max,yz=Math.min,kD=function(){return dz.Date.now()};function Dz(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(LO);e=$O(e)||0,ih(r)&&(l=!!r.leading,h="maxWait"in r,s=h?gz($O(r.maxWait)||0,e):s,d="trailing"in r?!!r.trailing:d);function f(C){var F=n,b=i;return n=i=void 0,c=C,o=t.apply(b,F),o}function p(C){return c=C,a=setTimeout(E,e),l?f(C):o}function y(C){var F=C-u,b=C-c,k=e-F;return h?yz(k,s-b):k}function v(C){var F=C-u,b=C-c;return u===void 0||F>=e||F<0||h&&b>=s}function E(){var C=kD();if(v(C))return A(C);a=setTimeout(E,y(C))}function A(C){return a=void 0,d&&n?f(C):(n=i=void 0,o)}function m(){a!==void 0&&clearTimeout(a),c=0,n=u=i=a=void 0}function D(){return a===void 0?o:A(kD())}function w(){var C=kD(),F=v(C);if(n=arguments,i=this,u=C,F){if(a===void 0)return p(u);if(h)return a=setTimeout(E,e),f(u)}return a===void 0&&(a=setTimeout(E,e)),o}return w.cancel=m,w.flush=D,w}function wz(t,e,r){var n=!0,i=!0;if(typeof t!="function")throw new TypeError(LO);return ih(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Dz(t,e,{leading:n,maxWait:e,trailing:i})}function ih(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function vz(t){return!!t&&typeof t=="object"}function Ez(t){return typeof t=="symbol"||vz(t)&&mz.call(t)==sz}function $O(t){if(typeof t=="number")return t;if(Ez(t))return NO;if(ih(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=ih(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(oz,"");var r=uz.test(t);return r||cz.test(t)?lz(t.slice(2),r?2:8):az.test(t)?NO:+t}BO.exports=wz});var WO=_(uh=>{"use strict";Object.defineProperty(uh,"__esModule",{value:!0});uh.default=void 0;var bz=zO(require("http")),_z=zO(require("https")),qO=require("stream"),Cz=require("url"),HO=Sz(jO());function Sz(t){return t&&t.__esModule?t:{default:t}}function VO(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(VO=function(n){return n?r:e})(t)}function zO(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=VO(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 Az(t,e,r){return e=sh(e),Oz(t,KO()?Reflect.construct(e,r||[],sh(t).constructor):e.apply(t,r))}function Oz(t,e){if(e&&(Zo(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xz(t)}function xz(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function KO(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(KO=function(){return!!t})()}function sh(t){return sh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},sh(t)}function Tz(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&&ND(t,e)}function ND(t,e){return ND=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ND(t,e)}function MO(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 Ju(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?MO(Object(r),!0).forEach(function(n){Iz(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):MO(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Iz(t,e,r){return e=GO(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zo(t){"@babel/helpers - typeof";return Zo=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},Zo(t)}function oh(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,GO(n.key),n)}}function ah(t,e,r){return e&&UO(t.prototype,e),r&&UO(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function GO(t){var e=Pz(t,"string");return Zo(e)=="symbol"?e:e+""}function Pz(t,e){if(Zo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Zo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yDe=uh.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};oh(this,t),this._requestOptions=e}return ah(t,[{key:"createRequest",value:function(r,n){return new Fz(r,n,this._requestOptions)}},{key:"getName",value:function(){return"NodeHttpStack"}}])})(),Fz=(function(){function t(e,r,n){oh(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return ah(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=Ju(Ju(Ju({},(0,Cz.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Ju(Ju({},r._requestOptions.headers||{}),r._headers)});n!=null&&n.size&&(o.headers["Content-Length"]=n.size);var a=o.protocol==="https:"?_z:bz;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 Rz(c,h))})}),u.on("error",function(c){s(c)}),n instanceof qO.Readable?n.pipe(new kz(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}}])})(),Rz=(function(){function t(e,r){oh(this,t),this._response=e,this._body=r}return ah(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}}])})(),kz=(function(t){function e(r){var n;return oh(this,e),n=Az(this,e),n._onprogress=(0,HO.default)(r,100,{leading:!0,trailing:!1}),n._position=0,n}return Tz(e,t),ah(e,[{key:"_transform",value:function(n,i,s){this._position+=n.length,this._onprogress(this._position),s(null,n)}}])})(qO.Transform),Nz=function(e,r,n){n=(0,HO.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 XO=_($D=>{"use strict";$D.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};$D.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(`
53
53
  `)}(!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(`
54
54
  `),u.splice(0,3),u.unshift(""),Error.stackTraceLimit=a,this.stack=u.join(`
55
- `),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 ZO=_((vDe,JO)=>{"use strict";JO.exports=Os;Os.factory=XO();var jD=Os("CustomError");jD.order=Os(jD,{message:"Arguments out of order.",code:"EOARG"});function Os(t,e,r,n){var i,s;return e=ch(arguments,1,Error,YO,[LD,lh]),r=ch(arguments,2,{},LD,[lh]),n=ch(arguments,3,BD,lh,[]),t=ch(arguments,0,e===Error?"Error":e.prototype.CustomError.name,$z,[YO,LD,lh]),s=e===Error,s&&n===BD&&(n=Os.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(Os.factory).forEach(function(m){l[m]=function(y,v){Os.factory[m].call(u,y,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==BD&&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 ch(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 jD.order;return o!==-1?t[o]:r}function lh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function $z(t){return typeof t=="string"}function YO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function LD(t){return t&&typeof t=="object"}function BD(){}});var ex=_((EDe,QO)=>{QO.exports=ZO()});var sx=_((xs,Qo)=>{var Lz=1/0,Bz="[object Symbol]",Zu={function:!0,object:!0},jz=Zu[typeof xs]&&xs&&!xs.nodeType?xs:void 0,Mz=Zu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,Uz=fh(jz&&Mz&&typeof global=="object"&&global),qz=fh(Zu[typeof self]&&self),tx=fh(Zu[typeof window]&&window),MD=fh(Zu[typeof xs]&&xs),Hz=Uz||tx!==(MD&&MD.window)&&tx||qz||MD||Function("return this")();function fh(t){return t&&t.Object===Object?t:null}var Vz=Object.prototype,zz=Vz.toString,rx=Hz.Symbol,nx=rx?rx.prototype:void 0,ix=nx?nx.toString:void 0;function Kz(t){if(typeof t=="string")return t;if(Wz(t))return ix?ix.call(t):"";var e=t+"";return e=="0"&&1/t==-Lz?"-0":e}function Gz(t){return!!t&&typeof t=="object"}function Wz(t){return typeof t=="symbol"||Gz(t)&&zz.call(t)==Bz}Qo.exports=Kz});var hx=_((Ts,ea)=>{var Xz=sx(),Yz="Expected a function",ax="__lodash_hash_undefined__",Jz="[object Function]",Zz="[object GeneratorFunction]",Qz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,eK=/[\\^$.*+?()[\]{}|]/g,tK=/\\(\\)?/g,rK=/^\[object .+?Constructor\]$/,ec={function:!0,object:!0},nK=ec[typeof Ts]&&Ts&&!Ts.nodeType?Ts:void 0,iK=ec[typeof ea]&&ea&&!ea.nodeType?ea:void 0,sK=hh(nK&&iK&&typeof global=="object"&&global),oK=hh(ec[typeof self]&&self),ox=hh(ec[typeof window]&&window),UD=hh(ec[typeof Ts]&&Ts),aK=sK||ox!==(UD&&UD.window)&&ox||oK||UD||Function("return this")();function hh(t){return t&&t.Object===Object?t:null}function uK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var cK=Array.prototype,ux=Object.prototype,cx=Function.prototype.toString,qD=ux.hasOwnProperty,lK=ux.toString,fK=RegExp("^"+cx.call(qD).replace(eK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hK=cK.splice,dK=lx(aK,"Map"),Qu=lx(Object,"create");function Is(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 pK(){this.__data__=Qu?Qu(null):{}}function mK(t){return this.has(t)&&delete this.__data__[t]}function gK(t){var e=this.__data__;if(Qu){var r=e[t];return r===ax?void 0:r}return qD.call(e,t)?e[t]:void 0}function yK(t){var e=this.__data__;return Qu?e[t]!==void 0:qD.call(e,t)}function DK(t,e){var r=this.__data__;return r[t]=Qu&&e===void 0?ax:e,this}Is.prototype.clear=pK;Is.prototype.delete=mK;Is.prototype.get=gK;Is.prototype.has=yK;Is.prototype.set=DK;function ta(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 vK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hK.call(e,r,1),!0}function EK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function bK(t){return dh(this.__data__,t)>-1}function _K(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ta.prototype.clear=wK;ta.prototype.delete=vK;ta.prototype.get=EK;ta.prototype.has=bK;ta.prototype.set=_K;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 CK(){this.__data__={hash:new Is,map:new(dK||ta),string:new Is}}function SK(t){return ph(this,t).delete(t)}function AK(t){return ph(this,t).get(t)}function OK(t){return ph(this,t).has(t)}function xK(t,e){return ph(this,t).set(t,e),this}Ps.prototype.clear=CK;Ps.prototype.delete=SK;Ps.prototype.get=AK;Ps.prototype.has=OK;Ps.prototype.set=xK;function dh(t,e){for(var r=t.length;r--;)if(FK(t[r][0],e))return r;return-1}function ph(t,e){var r=t.__data__;return TK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function lx(t,e){var r=t[e];return kK(r)?r:void 0}function TK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var IK=HD(function(t){var e=[];return NK(t).replace(Qz,function(r,n,i,s){e.push(i?s.replace(tK,"$1"):n||r)}),e});function PK(t){if(t!=null){try{return cx.call(t)}catch{}try{return t+""}catch{}}return""}function HD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Yz);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(HD.Cache||Ps),r}HD.Cache=Ps;function FK(t,e){return t===e||t!==t&&e!==e}function RK(t){var e=fx(t)?lK.call(t):"";return e==Jz||e==Zz}function fx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kK(t){if(!fx(t))return!1;var e=RK(t)||uK(t)?fK:rK;return e.test(PK(t))}function NK(t){return t==null?"":Xz(t)}ea.exports=IK});var qx=_((Fs,na)=>{var $K=hx(),LK=200,e0="__lodash_hash_undefined__",wh=1,ia=2,BK=1/0,Dx=9007199254740991,mh="[object Arguments]",KD="[object Array]",wx="[object Boolean]",vx="[object Date]",Ex="[object Error]",bx="[object Function]",jK="[object GeneratorFunction]",tc="[object Map]",_x="[object Number]",ra="[object Object]",dx="[object Promise]",Cx="[object RegExp]",rc="[object Set]",t0="[object String]",Sx="[object Symbol]",GD="[object WeakMap]",Ax="[object ArrayBuffer]",gh="[object DataView]",MK="[object Float32Array]",UK="[object Float64Array]",qK="[object Int8Array]",HK="[object Int16Array]",VK="[object Int32Array]",zK="[object Uint8Array]",KK="[object Uint8ClampedArray]",GK="[object Uint16Array]",WK="[object Uint32Array]",XK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,YK=/^\w*$/,JK=/[\\^$.*+?()[\]{}|]/g,ZK=/^\[object .+?Constructor\]$/,QK=/^(?:0|[1-9]\d*)$/,Qe={};Qe[MK]=Qe[UK]=Qe[qK]=Qe[HK]=Qe[VK]=Qe[zK]=Qe[KK]=Qe[GK]=Qe[WK]=!0;Qe[mh]=Qe[KD]=Qe[Ax]=Qe[wx]=Qe[gh]=Qe[vx]=Qe[Ex]=Qe[bx]=Qe[tc]=Qe[_x]=Qe[ra]=Qe[Cx]=Qe[rc]=Qe[t0]=Qe[GD]=!1;var ic={function:!0,object:!0},eG=ic[typeof Fs]&&Fs&&!Fs.nodeType?Fs:void 0,tG=ic[typeof na]&&na&&!na.nodeType?na:void 0,rG=vh(eG&&tG&&typeof global=="object"&&global),nG=vh(ic[typeof self]&&self),px=vh(ic[typeof window]&&window),VD=vh(ic[typeof Fs]&&Fs),Ns=rG||px!==(VD&&VD.window)&&px||nG||VD||Function("return this")();function iG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function sG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function oG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function aG(t,e){return iG(e,function(r){return[r,t[r]]})}function vh(t){return t&&t.Object===Object?t:null}function WD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Ox(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function uG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function cG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var lG=Array.prototype,Eh=Object.prototype,xx=Function.prototype.toString,Rs=Eh.hasOwnProperty,$s=Eh.toString,fG=RegExp("^"+xx.call(Rs).replace(JK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mx=Ns.Symbol,gx=Ns.Uint8Array,hG=Eh.propertyIsEnumerable,dG=lG.splice,pG=Object.getPrototypeOf,mG=Object.keys,XD=sa(Ns,"DataView"),yh=sa(Ns,"Map"),YD=sa(Ns,"Promise"),JD=sa(Ns,"Set"),ZD=sa(Ns,"WeakMap"),nc=sa(Object,"create"),gG=Bs(XD),yG=Bs(yh),DG=Bs(YD),wG=Bs(JD),vG=Bs(ZD),yx=mx?mx.prototype:void 0,zD=yx?yx.valueOf:void 0;function ks(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 EG(){this.__data__=nc?nc(null):{}}function bG(t){return this.has(t)&&delete this.__data__[t]}function _G(t){var e=this.__data__;if(nc){var r=e[t];return r===e0?void 0:r}return Rs.call(e,t)?e[t]:void 0}function CG(t){var e=this.__data__;return nc?e[t]!==void 0:Rs.call(e,t)}function SG(t,e){var r=this.__data__;return r[t]=nc&&e===void 0?e0:e,this}ks.prototype.clear=EG;ks.prototype.delete=bG;ks.prototype.get=_G;ks.prototype.has=CG;ks.prototype.set=SG;function ri(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 AG(){this.__data__=[]}function OG(t){var e=this.__data__,r=bh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():dG.call(e,r,1),!0}function xG(t){var e=this.__data__,r=bh(e,t);return r<0?void 0:e[r][1]}function TG(t){return bh(this.__data__,t)>-1}function IG(t,e){var r=this.__data__,n=bh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ri.prototype.clear=AG;ri.prototype.delete=OG;ri.prototype.get=xG;ri.prototype.has=TG;ri.prototype.set=IG;function Ls(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 PG(){this.__data__={hash:new ks,map:new(yh||ri),string:new ks}}function FG(t){return _h(this,t).delete(t)}function RG(t){return _h(this,t).get(t)}function kG(t){return _h(this,t).has(t)}function NG(t,e){return _h(this,t).set(t,e),this}Ls.prototype.clear=PG;Ls.prototype.delete=FG;Ls.prototype.get=RG;Ls.prototype.has=kG;Ls.prototype.set=NG;function Dh(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ls;++e<r;)this.add(t[e])}function $G(t){return this.__data__.set(t,e0),this}function LG(t){return this.__data__.has(t)}Dh.prototype.add=Dh.prototype.push=$G;Dh.prototype.has=LG;function ti(t){this.__data__=new ri(t)}function BG(){this.__data__=new ri}function jG(t){return this.__data__.delete(t)}function MG(t){return this.__data__.get(t)}function UG(t){return this.__data__.has(t)}function qG(t,e){var r=this.__data__;return r instanceof ri&&r.__data__.length==LK&&(r=this.__data__=new Ls(r.__data__)),r.set(t,e),this}ti.prototype.clear=BG;ti.prototype.delete=jG;ti.prototype.get=MG;ti.prototype.has=UG;ti.prototype.set=qG;function bh(t,e){for(var r=t.length;r--;)if(aW(t[r][0],e))return r;return-1}function Tx(t,e){e=Ch(e,t)?[e]:Fx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Sh(e[r++])];return r&&r==n?t:void 0}function Ix(t,e){return Rs.call(t,e)||typeof t=="object"&&e in t&&rW(t)===null}function HG(t,e){return e in Object(t)}function r0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Oh(t)&&!sc(e)?t!==t&&e!==e:VG(t,e,r0,r,n,i)}function VG(t,e,r,n,i,s){var o=Bi(t),a=Bi(e),u=KD,c=KD;o||(u=ei(t),u=u==mh?ra:u),a||(c=ei(e),c=c==mh?ra:c);var l=u==ra&&!WD(t),h=c==ra&&!WD(e),d=u==c;if(d&&!l)return s||(s=new ti),o||lW(t)?Rx(t,e,r,n,i,s):ZG(t,e,u,r,n,i,s);if(!(i&ia)){var f=l&&Rs.call(t,"__wrapped__"),m=h&&Rs.call(e,"__wrapped__");if(f||m){var y=f?t.value():t,v=m?e.value():e;return s||(s=new ti),r(y,v,n,i,s)}}return d?(s||(s=new ti),QG(t,e,r,n,i,s)):!1}function zG(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 ti;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?r0(l,c,n,wh|ia,h):d))return!1}}return!0}function KG(t){return typeof t=="function"?t:t==null?pW:typeof t=="object"?Bi(t)?XG(t[0],t[1]):WG(t):mW(t)}function GG(t){return mG(Object(t))}function WG(t){var e=tW(t);return e.length==1&&e[0][2]?$x(e[0][0],e[0][1]):function(r){return r===t||zG(r,t,e)}}function XG(t,e){return Ch(t)&&Nx(e)?$x(Sh(t),e):function(r){var n=fW(r,t);return n===void 0&&n===e?hW(r,t):r0(e,n,void 0,wh|ia)}}function Px(t){return function(e){return e?.[t]}}function YG(t){return function(e){return Tx(e,t)}}function Fx(t){return Bi(t)?t:$K(t)}function JG(t){return function(e){var r=ei(e);return r==tc?Ox(e):r==rc?cG(e):aG(e,t(e))}}function Rx(t,e,r,n,i,s){var o=i&ia,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&wh?new Dh: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(!sG(e,function(v,E){if(!d.has(E)&&(f===v||r(f,v,n,i,s)))return d.add(E)})){h=!1;break}}else if(!(f===m||r(f,m,n,i,s))){h=!1;break}}return s.delete(t),h}function ZG(t,e,r,n,i,s,o){switch(r){case gh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ax:return!(t.byteLength!=e.byteLength||!n(new gx(t),new gx(e)));case wx:case vx:return+t==+e;case Ex:return t.name==e.name&&t.message==e.message;case _x:return t!=+t?e!=+e:t==+e;case Cx:case t0:return t==e+"";case tc:var a=Ox;case rc:var u=s&ia;if(a||(a=uG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=wh,o.set(t,e),Rx(a(t),a(e),n,i,s,o));case Sx:if(zD)return zD.call(t)==zD.call(e)}return!1}function QG(t,e,r,n,i,s){var o=i&ia,a=QD(t),u=a.length,c=QD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:Ix(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 v=t[d],E=e[d];if(n)var A=o?n(E,v,d,e,t,s):n(v,E,d,t,e,s);if(!(A===void 0?v===E||r(v,E,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 eW=Px("length");function _h(t,e){var r=t.__data__;return sW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function tW(t){for(var e=dW(t),r=e.length;r--;)e[r][2]=Nx(e[r][1]);return e}function sa(t,e){var r=t[e];return cW(r)?r:void 0}function rW(t){return pG(Object(t))}function ei(t){return $s.call(t)}(XD&&ei(new XD(new ArrayBuffer(1)))!=gh||yh&&ei(new yh)!=tc||YD&&ei(YD.resolve())!=dx||JD&&ei(new JD)!=rc||ZD&&ei(new ZD)!=GD)&&(ei=function(t){var e=$s.call(t),r=e==ra?t.constructor:void 0,n=r?Bs(r):void 0;if(n)switch(n){case gG:return gh;case yG:return tc;case DG:return dx;case wG:return rc;case vG:return GD}return e});function nW(t,e,r){e=Ch(e,t)?[e]:Fx(e);for(var n,i=-1,o=e.length;++i<o;){var s=Sh(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&&Ah(o)&&kx(s,o)&&(Bi(t)||Mx(t)||Lx(t))}function iW(t){var e=t?t.length:void 0;return Ah(e)&&(Bi(t)||Mx(t)||Lx(t))?oG(e,String):null}function kx(t,e){return e=e??Dx,!!e&&(typeof t=="number"||QK.test(t))&&t>-1&&t%1==0&&t<e}function Ch(t,e){if(Bi(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ux(t)?!0:YK.test(t)||!XK.test(t)||e!=null&&t in Object(e)}function sW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function oW(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Eh;return t===r}function Nx(t){return t===t&&!Oh(t)}function $x(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Sh(t){if(typeof t=="string"||Ux(t))return t;var e=t+"";return e=="0"&&1/t==-BK?"-0":e}function Bs(t){if(t!=null){try{return xx.call(t)}catch{}try{return t+""}catch{}}return""}function aW(t,e){return t===e||t!==t&&e!==e}function Lx(t){return uW(t)&&Rs.call(t,"callee")&&(!hG.call(t,"callee")||$s.call(t)==mh)}var Bi=Array.isArray;function Bx(t){return t!=null&&Ah(eW(t))&&!jx(t)}function uW(t){return sc(t)&&Bx(t)}function jx(t){var e=Oh(t)?$s.call(t):"";return e==bx||e==jK}function Ah(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Dx}function Oh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sc(t){return!!t&&typeof t=="object"}function cW(t){if(!Oh(t))return!1;var e=jx(t)||WD(t)?fG:ZK;return e.test(Bs(t))}function Mx(t){return typeof t=="string"||!Bi(t)&&sc(t)&&$s.call(t)==t0}function Ux(t){return typeof t=="symbol"||sc(t)&&$s.call(t)==Sx}function lW(t){return sc(t)&&Ah(t.length)&&!!Qe[$s.call(t)]}function fW(t,e,r){var n=t==null?void 0:Tx(t,e);return n===void 0?r:n}function hW(t,e){return t!=null&&nW(t,e,HG)}function QD(t){var e=oW(t);if(!(e||Bx(t)))return GG(t);var r=iW(t),n=!!r,i=r||[],s=i.length;for(var o in t)Ix(t,o)&&!(n&&(o=="length"||kx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var dW=JG(QD);function pW(t){return t}function mW(t){return Ch(t)?Px(Sh(t)):YG(t)}na.exports=KG});var Gx=_((js,oa)=>{var gW=1/0,yW="[object Function]",DW="[object GeneratorFunction]",wW=/[\\^$.*+?()[\]{}|]/g,vW=/^\[object .+?Constructor\]$/,oc={function:!0,object:!0},EW=oc[typeof js]&&js&&!js.nodeType?js:void 0,bW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,_W=xh(EW&&bW&&typeof global=="object"&&global),CW=xh(oc[typeof self]&&self),Hx=xh(oc[typeof window]&&window),n0=xh(oc[typeof js]&&js),SW=_W||Hx!==(n0&&n0.window)&&Hx||CW||n0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}function AW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function OW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Vx=Object.prototype,zx=Function.prototype.toString,xW=Vx.hasOwnProperty,TW=Vx.toString,IW=RegExp("^"+zx.call(xW).replace(wW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),i0=FW(SW,"Set"),PW=i0&&1/OW(new i0([,-0]))[1]==gW?function(t){return new i0(t)}:$W;function FW(t,e){var r=t[e];return NW(r)?r:void 0}function RW(t){if(t!=null){try{return zx.call(t)}catch{}try{return t+""}catch{}}return""}function kW(t){var e=Kx(t)?TW.call(t):"";return e==yW||e==DW}function Kx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function NW(t){if(!Kx(t))return!1;var e=kW(t)||AW(t)?IW:vW;return e.test(RW(t))}function $W(){}oa.exports=PW});var Xx=_((Ms,aa)=>{var ac={function:!0,object:!0},LW=ac[typeof Ms]&&Ms&&!Ms.nodeType?Ms:void 0,BW=ac[typeof aa]&&aa&&!aa.nodeType?aa:void 0,jW=Th(LW&&BW&&typeof global=="object"&&global),MW=Th(ac[typeof self]&&self),Wx=Th(ac[typeof window]&&window),s0=Th(ac[typeof Ms]&&Ms),UW=jW||Wx!==(s0&&s0.window)&&Wx||MW||s0||Function("return this")();function Th(t){return t&&t.Object===Object?t:null}aa.exports=UW});var tT=_((bDe,eT)=>{var qW=Gx(),HW=Xx(),VW=200,o0="__lodash_hash_undefined__",zW="[object Function]",KW="[object GeneratorFunction]",GW=/[\\^$.*+?()[\]{}|]/g,WW=/^\[object .+?Constructor\]$/;function XW(t,e){return!!t.length&&JW(t,e,0)>-1}function YW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function JW(t,e,r){if(e!==e)return QW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function ZW(t,e){return t.has(e)}function QW(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 eX(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function tX(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var rX=Array.prototype,Yx=Object.prototype,Jx=Function.prototype.toString,a0=Yx.hasOwnProperty,nX=Yx.toString,iX=RegExp("^"+Jx.call(a0).replace(GW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sX=rX.splice,oX=Zx(HW,"Map"),uc=Zx(Object,"create");function Us(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 aX(){this.__data__=uc?uc(null):{}}function uX(t){return this.has(t)&&delete this.__data__[t]}function cX(t){var e=this.__data__;if(uc){var r=e[t];return r===o0?void 0:r}return a0.call(e,t)?e[t]:void 0}function lX(t){var e=this.__data__;return uc?e[t]!==void 0:a0.call(e,t)}function fX(t,e){var r=this.__data__;return r[t]=uc&&e===void 0?o0:e,this}Us.prototype.clear=aX;Us.prototype.delete=uX;Us.prototype.get=cX;Us.prototype.has=lX;Us.prototype.set=fX;function ua(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 hX(){this.__data__=[]}function dX(t){var e=this.__data__,r=Ph(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():sX.call(e,r,1),!0}function pX(t){var e=this.__data__,r=Ph(e,t);return r<0?void 0:e[r][1]}function mX(t){return Ph(this.__data__,t)>-1}function gX(t,e){var r=this.__data__,n=Ph(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ua.prototype.clear=hX;ua.prototype.delete=dX;ua.prototype.get=pX;ua.prototype.has=mX;ua.prototype.set=gX;function ca(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 yX(){this.__data__={hash:new Us,map:new(oX||ua),string:new Us}}function DX(t){return Fh(this,t).delete(t)}function wX(t){return Fh(this,t).get(t)}function vX(t){return Fh(this,t).has(t)}function EX(t,e){return Fh(this,t).set(t,e),this}ca.prototype.clear=yX;ca.prototype.delete=DX;ca.prototype.get=wX;ca.prototype.has=vX;ca.prototype.set=EX;function Ih(t){var e=-1,r=t?t.length:0;for(this.__data__=new ca;++e<r;)this.add(t[e])}function bX(t){return this.__data__.set(t,o0),this}function _X(t){return this.__data__.has(t)}Ih.prototype.add=Ih.prototype.push=bX;Ih.prototype.has=_X;function Ph(t,e){for(var r=t.length;r--;)if(OX(t[r][0],e))return r;return-1}function CX(t,e,r){var n=-1,i=XW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=YW;else if(s>=VW){var c=e?null:qW(t);if(c)return tX(c);o=!1,i=ZW,u=new Ih}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 Fh(t,e){var r=t.__data__;return SX(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Zx(t,e){var r=t[e];return TX(r)?r:void 0}function SX(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function AX(t){if(t!=null){try{return Jx.call(t)}catch{}try{return t+""}catch{}}return""}function OX(t,e){return t===e||t!==t&&e!==e}function xX(t){var e=Qx(t)?nX.call(t):"";return e==zW||e==KW}function Qx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function TX(t){if(!Qx(t))return!1;var e=xX(t)||eX(t)?iX:WW;return e.test(AX(t))}eT.exports=CX});var nT=_((_De,rT)=>{var IX=qx(),PX=tT();function FX(t,e){return t&&t.length?PX(t,IX(e)):[]}rT.exports=FX});var sT=_((CDe,iT)=>{"use strict";var RX=ex(),kX=nT(),NX=RX("MultiError");iT.exports=u0;function u0(t){if(!(this instanceof u0))return new u0(t);if(t=Array.isArray(t)?t:[t],t=kX(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(`
55
+ `),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 ZO=_((vDe,JO)=>{"use strict";JO.exports=Os;Os.factory=XO();var jD=Os("CustomError");jD.order=Os(jD,{message:"Arguments out of order.",code:"EOARG"});function Os(t,e,r,n){var i,s;return e=ch(arguments,1,Error,YO,[LD,lh]),r=ch(arguments,2,{},LD,[lh]),n=ch(arguments,3,BD,lh,[]),t=ch(arguments,0,e===Error?"Error":e.prototype.CustomError.name,$z,[YO,LD,lh]),s=e===Error,s&&n===BD&&(n=Os.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(p){return p.properties}),c.push(o),c.unshift({}),f=Object.assign.apply(Object,c),u=this,l={},Object.keys(Os.factory).forEach(function(p){l[p]=function(y,v){Os.factory[p].call(u,y,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==BD&&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 ch(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 jD.order;return o!==-1?t[o]:r}function lh(t){return typeof t=="function"&&t!==Error&&!t.prototype.CustomError}function $z(t){return typeof t=="string"}function YO(t){return typeof t=="function"&&(t===Error||t.prototype.CustomError)}function LD(t){return t&&typeof t=="object"}function BD(){}});var ex=_((EDe,QO)=>{QO.exports=ZO()});var sx=_((xs,Qo)=>{var Lz=1/0,Bz="[object Symbol]",Zu={function:!0,object:!0},jz=Zu[typeof xs]&&xs&&!xs.nodeType?xs:void 0,Mz=Zu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,Uz=fh(jz&&Mz&&typeof global=="object"&&global),qz=fh(Zu[typeof self]&&self),tx=fh(Zu[typeof window]&&window),MD=fh(Zu[typeof xs]&&xs),Hz=Uz||tx!==(MD&&MD.window)&&tx||qz||MD||Function("return this")();function fh(t){return t&&t.Object===Object?t:null}var Vz=Object.prototype,zz=Vz.toString,rx=Hz.Symbol,nx=rx?rx.prototype:void 0,ix=nx?nx.toString:void 0;function Kz(t){if(typeof t=="string")return t;if(Wz(t))return ix?ix.call(t):"";var e=t+"";return e=="0"&&1/t==-Lz?"-0":e}function Gz(t){return!!t&&typeof t=="object"}function Wz(t){return typeof t=="symbol"||Gz(t)&&zz.call(t)==Bz}Qo.exports=Kz});var hx=_((Ts,ea)=>{var Xz=sx(),Yz="Expected a function",ax="__lodash_hash_undefined__",Jz="[object Function]",Zz="[object GeneratorFunction]",Qz=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g,eK=/[\\^$.*+?()[\]{}|]/g,tK=/\\(\\)?/g,rK=/^\[object .+?Constructor\]$/,ec={function:!0,object:!0},nK=ec[typeof Ts]&&Ts&&!Ts.nodeType?Ts:void 0,iK=ec[typeof ea]&&ea&&!ea.nodeType?ea:void 0,sK=hh(nK&&iK&&typeof global=="object"&&global),oK=hh(ec[typeof self]&&self),ox=hh(ec[typeof window]&&window),UD=hh(ec[typeof Ts]&&Ts),aK=sK||ox!==(UD&&UD.window)&&ox||oK||UD||Function("return this")();function hh(t){return t&&t.Object===Object?t:null}function uK(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}var cK=Array.prototype,ux=Object.prototype,cx=Function.prototype.toString,qD=ux.hasOwnProperty,lK=ux.toString,fK=RegExp("^"+cx.call(qD).replace(eK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hK=cK.splice,dK=lx(aK,"Map"),Qu=lx(Object,"create");function Is(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 pK(){this.__data__=Qu?Qu(null):{}}function mK(t){return this.has(t)&&delete this.__data__[t]}function gK(t){var e=this.__data__;if(Qu){var r=e[t];return r===ax?void 0:r}return qD.call(e,t)?e[t]:void 0}function yK(t){var e=this.__data__;return Qu?e[t]!==void 0:qD.call(e,t)}function DK(t,e){var r=this.__data__;return r[t]=Qu&&e===void 0?ax:e,this}Is.prototype.clear=pK;Is.prototype.delete=mK;Is.prototype.get=gK;Is.prototype.has=yK;Is.prototype.set=DK;function ta(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 vK(t){var e=this.__data__,r=dh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():hK.call(e,r,1),!0}function EK(t){var e=this.__data__,r=dh(e,t);return r<0?void 0:e[r][1]}function bK(t){return dh(this.__data__,t)>-1}function _K(t,e){var r=this.__data__,n=dh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ta.prototype.clear=wK;ta.prototype.delete=vK;ta.prototype.get=EK;ta.prototype.has=bK;ta.prototype.set=_K;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 CK(){this.__data__={hash:new Is,map:new(dK||ta),string:new Is}}function SK(t){return ph(this,t).delete(t)}function AK(t){return ph(this,t).get(t)}function OK(t){return ph(this,t).has(t)}function xK(t,e){return ph(this,t).set(t,e),this}Ps.prototype.clear=CK;Ps.prototype.delete=SK;Ps.prototype.get=AK;Ps.prototype.has=OK;Ps.prototype.set=xK;function dh(t,e){for(var r=t.length;r--;)if(FK(t[r][0],e))return r;return-1}function ph(t,e){var r=t.__data__;return TK(e)?r[typeof e=="string"?"string":"hash"]:r.map}function lx(t,e){var r=t[e];return kK(r)?r:void 0}function TK(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var IK=HD(function(t){var e=[];return NK(t).replace(Qz,function(r,n,i,s){e.push(i?s.replace(tK,"$1"):n||r)}),e});function PK(t){if(t!=null){try{return cx.call(t)}catch{}try{return t+""}catch{}}return""}function HD(t,e){if(typeof t!="function"||e&&typeof e!="function")throw new TypeError(Yz);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(HD.Cache||Ps),r}HD.Cache=Ps;function FK(t,e){return t===e||t!==t&&e!==e}function RK(t){var e=fx(t)?lK.call(t):"";return e==Jz||e==Zz}function fx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function kK(t){if(!fx(t))return!1;var e=RK(t)||uK(t)?fK:rK;return e.test(PK(t))}function NK(t){return t==null?"":Xz(t)}ea.exports=IK});var qx=_((Fs,na)=>{var $K=hx(),LK=200,e0="__lodash_hash_undefined__",wh=1,ia=2,BK=1/0,Dx=9007199254740991,mh="[object Arguments]",KD="[object Array]",wx="[object Boolean]",vx="[object Date]",Ex="[object Error]",bx="[object Function]",jK="[object GeneratorFunction]",tc="[object Map]",_x="[object Number]",ra="[object Object]",dx="[object Promise]",Cx="[object RegExp]",rc="[object Set]",t0="[object String]",Sx="[object Symbol]",GD="[object WeakMap]",Ax="[object ArrayBuffer]",gh="[object DataView]",MK="[object Float32Array]",UK="[object Float64Array]",qK="[object Int8Array]",HK="[object Int16Array]",VK="[object Int32Array]",zK="[object Uint8Array]",KK="[object Uint8ClampedArray]",GK="[object Uint16Array]",WK="[object Uint32Array]",XK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,YK=/^\w*$/,JK=/[\\^$.*+?()[\]{}|]/g,ZK=/^\[object .+?Constructor\]$/,QK=/^(?:0|[1-9]\d*)$/,Qe={};Qe[MK]=Qe[UK]=Qe[qK]=Qe[HK]=Qe[VK]=Qe[zK]=Qe[KK]=Qe[GK]=Qe[WK]=!0;Qe[mh]=Qe[KD]=Qe[Ax]=Qe[wx]=Qe[gh]=Qe[vx]=Qe[Ex]=Qe[bx]=Qe[tc]=Qe[_x]=Qe[ra]=Qe[Cx]=Qe[rc]=Qe[t0]=Qe[GD]=!1;var ic={function:!0,object:!0},eG=ic[typeof Fs]&&Fs&&!Fs.nodeType?Fs:void 0,tG=ic[typeof na]&&na&&!na.nodeType?na:void 0,rG=vh(eG&&tG&&typeof global=="object"&&global),nG=vh(ic[typeof self]&&self),px=vh(ic[typeof window]&&window),VD=vh(ic[typeof Fs]&&Fs),Ns=rG||px!==(VD&&VD.window)&&px||nG||VD||Function("return this")();function iG(t,e){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function sG(t,e){for(var r=-1,n=t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function oG(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function aG(t,e){return iG(e,function(r){return[r,t[r]]})}function vh(t){return t&&t.Object===Object?t:null}function WD(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function Ox(t){var e=-1,r=Array(t.size);return t.forEach(function(n,i){r[++e]=[i,n]}),r}function uG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}function cG(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=[n,n]}),r}var lG=Array.prototype,Eh=Object.prototype,xx=Function.prototype.toString,Rs=Eh.hasOwnProperty,$s=Eh.toString,fG=RegExp("^"+xx.call(Rs).replace(JK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mx=Ns.Symbol,gx=Ns.Uint8Array,hG=Eh.propertyIsEnumerable,dG=lG.splice,pG=Object.getPrototypeOf,mG=Object.keys,XD=sa(Ns,"DataView"),yh=sa(Ns,"Map"),YD=sa(Ns,"Promise"),JD=sa(Ns,"Set"),ZD=sa(Ns,"WeakMap"),nc=sa(Object,"create"),gG=Bs(XD),yG=Bs(yh),DG=Bs(YD),wG=Bs(JD),vG=Bs(ZD),yx=mx?mx.prototype:void 0,zD=yx?yx.valueOf:void 0;function ks(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 EG(){this.__data__=nc?nc(null):{}}function bG(t){return this.has(t)&&delete this.__data__[t]}function _G(t){var e=this.__data__;if(nc){var r=e[t];return r===e0?void 0:r}return Rs.call(e,t)?e[t]:void 0}function CG(t){var e=this.__data__;return nc?e[t]!==void 0:Rs.call(e,t)}function SG(t,e){var r=this.__data__;return r[t]=nc&&e===void 0?e0:e,this}ks.prototype.clear=EG;ks.prototype.delete=bG;ks.prototype.get=_G;ks.prototype.has=CG;ks.prototype.set=SG;function ri(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 AG(){this.__data__=[]}function OG(t){var e=this.__data__,r=bh(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():dG.call(e,r,1),!0}function xG(t){var e=this.__data__,r=bh(e,t);return r<0?void 0:e[r][1]}function TG(t){return bh(this.__data__,t)>-1}function IG(t,e){var r=this.__data__,n=bh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ri.prototype.clear=AG;ri.prototype.delete=OG;ri.prototype.get=xG;ri.prototype.has=TG;ri.prototype.set=IG;function Ls(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 PG(){this.__data__={hash:new ks,map:new(yh||ri),string:new ks}}function FG(t){return _h(this,t).delete(t)}function RG(t){return _h(this,t).get(t)}function kG(t){return _h(this,t).has(t)}function NG(t,e){return _h(this,t).set(t,e),this}Ls.prototype.clear=PG;Ls.prototype.delete=FG;Ls.prototype.get=RG;Ls.prototype.has=kG;Ls.prototype.set=NG;function Dh(t){var e=-1,r=t?t.length:0;for(this.__data__=new Ls;++e<r;)this.add(t[e])}function $G(t){return this.__data__.set(t,e0),this}function LG(t){return this.__data__.has(t)}Dh.prototype.add=Dh.prototype.push=$G;Dh.prototype.has=LG;function ti(t){this.__data__=new ri(t)}function BG(){this.__data__=new ri}function jG(t){return this.__data__.delete(t)}function MG(t){return this.__data__.get(t)}function UG(t){return this.__data__.has(t)}function qG(t,e){var r=this.__data__;return r instanceof ri&&r.__data__.length==LK&&(r=this.__data__=new Ls(r.__data__)),r.set(t,e),this}ti.prototype.clear=BG;ti.prototype.delete=jG;ti.prototype.get=MG;ti.prototype.has=UG;ti.prototype.set=qG;function bh(t,e){for(var r=t.length;r--;)if(aW(t[r][0],e))return r;return-1}function Tx(t,e){e=Ch(e,t)?[e]:Fx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Sh(e[r++])];return r&&r==n?t:void 0}function Ix(t,e){return Rs.call(t,e)||typeof t=="object"&&e in t&&rW(t)===null}function HG(t,e){return e in Object(t)}function r0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Oh(t)&&!sc(e)?t!==t&&e!==e:VG(t,e,r0,r,n,i)}function VG(t,e,r,n,i,s){var o=Bi(t),a=Bi(e),u=KD,c=KD;o||(u=ei(t),u=u==mh?ra:u),a||(c=ei(e),c=c==mh?ra:c);var l=u==ra&&!WD(t),h=c==ra&&!WD(e),d=u==c;if(d&&!l)return s||(s=new ti),o||lW(t)?Rx(t,e,r,n,i,s):ZG(t,e,u,r,n,i,s);if(!(i&ia)){var f=l&&Rs.call(t,"__wrapped__"),p=h&&Rs.call(e,"__wrapped__");if(f||p){var y=f?t.value():t,v=p?e.value():e;return s||(s=new ti),r(y,v,n,i,s)}}return d?(s||(s=new ti),QG(t,e,r,n,i,s)):!1}function zG(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 ti;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?r0(l,c,n,wh|ia,h):d))return!1}}return!0}function KG(t){return typeof t=="function"?t:t==null?pW:typeof t=="object"?Bi(t)?XG(t[0],t[1]):WG(t):mW(t)}function GG(t){return mG(Object(t))}function WG(t){var e=tW(t);return e.length==1&&e[0][2]?$x(e[0][0],e[0][1]):function(r){return r===t||zG(r,t,e)}}function XG(t,e){return Ch(t)&&Nx(e)?$x(Sh(t),e):function(r){var n=fW(r,t);return n===void 0&&n===e?hW(r,t):r0(e,n,void 0,wh|ia)}}function Px(t){return function(e){return e?.[t]}}function YG(t){return function(e){return Tx(e,t)}}function Fx(t){return Bi(t)?t:$K(t)}function JG(t){return function(e){var r=ei(e);return r==tc?Ox(e):r==rc?cG(e):aG(e,t(e))}}function Rx(t,e,r,n,i,s){var o=i&ia,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&wh?new Dh:void 0;for(s.set(t,e);++l<a;){var f=t[l],p=e[l];if(n)var y=o?n(p,f,l,e,t,s):n(f,p,l,t,e,s);if(y!==void 0){if(y)continue;h=!1;break}if(d){if(!sG(e,function(v,E){if(!d.has(E)&&(f===v||r(f,v,n,i,s)))return d.add(E)})){h=!1;break}}else if(!(f===p||r(f,p,n,i,s))){h=!1;break}}return s.delete(t),h}function ZG(t,e,r,n,i,s,o){switch(r){case gh:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case Ax:return!(t.byteLength!=e.byteLength||!n(new gx(t),new gx(e)));case wx:case vx:return+t==+e;case Ex:return t.name==e.name&&t.message==e.message;case _x:return t!=+t?e!=+e:t==+e;case Cx:case t0:return t==e+"";case tc:var a=Ox;case rc:var u=s&ia;if(a||(a=uG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=wh,o.set(t,e),Rx(a(t),a(e),n,i,s,o));case Sx:if(zD)return zD.call(t)==zD.call(e)}return!1}function QG(t,e,r,n,i,s){var o=i&ia,a=QD(t),u=a.length,c=QD(e),l=c.length;if(u!=l&&!o)return!1;for(var h=u;h--;){var d=a[h];if(!(o?d in e:Ix(e,d)))return!1}var f=s.get(t);if(f)return f==e;var p=!0;s.set(t,e);for(var y=o;++h<u;){d=a[h];var v=t[d],E=e[d];if(n)var A=o?n(E,v,d,e,t,s):n(v,E,d,t,e,s);if(!(A===void 0?v===E||r(v,E,n,i,s):A)){p=!1;break}y||(y=d=="constructor")}if(p&&!y){var m=t.constructor,D=e.constructor;m!=D&&"constructor"in t&&"constructor"in e&&!(typeof m=="function"&&m instanceof m&&typeof D=="function"&&D instanceof D)&&(p=!1)}return s.delete(t),p}var eW=Px("length");function _h(t,e){var r=t.__data__;return sW(e)?r[typeof e=="string"?"string":"hash"]:r.map}function tW(t){for(var e=dW(t),r=e.length;r--;)e[r][2]=Nx(e[r][1]);return e}function sa(t,e){var r=t[e];return cW(r)?r:void 0}function rW(t){return pG(Object(t))}function ei(t){return $s.call(t)}(XD&&ei(new XD(new ArrayBuffer(1)))!=gh||yh&&ei(new yh)!=tc||YD&&ei(YD.resolve())!=dx||JD&&ei(new JD)!=rc||ZD&&ei(new ZD)!=GD)&&(ei=function(t){var e=$s.call(t),r=e==ra?t.constructor:void 0,n=r?Bs(r):void 0;if(n)switch(n){case gG:return gh;case yG:return tc;case DG:return dx;case wG:return rc;case vG:return GD}return e});function nW(t,e,r){e=Ch(e,t)?[e]:Fx(e);for(var n,i=-1,o=e.length;++i<o;){var s=Sh(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&&Ah(o)&&kx(s,o)&&(Bi(t)||Mx(t)||Lx(t))}function iW(t){var e=t?t.length:void 0;return Ah(e)&&(Bi(t)||Mx(t)||Lx(t))?oG(e,String):null}function kx(t,e){return e=e??Dx,!!e&&(typeof t=="number"||QK.test(t))&&t>-1&&t%1==0&&t<e}function Ch(t,e){if(Bi(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ux(t)?!0:YK.test(t)||!XK.test(t)||e!=null&&t in Object(e)}function sW(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function oW(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Eh;return t===r}function Nx(t){return t===t&&!Oh(t)}function $x(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Sh(t){if(typeof t=="string"||Ux(t))return t;var e=t+"";return e=="0"&&1/t==-BK?"-0":e}function Bs(t){if(t!=null){try{return xx.call(t)}catch{}try{return t+""}catch{}}return""}function aW(t,e){return t===e||t!==t&&e!==e}function Lx(t){return uW(t)&&Rs.call(t,"callee")&&(!hG.call(t,"callee")||$s.call(t)==mh)}var Bi=Array.isArray;function Bx(t){return t!=null&&Ah(eW(t))&&!jx(t)}function uW(t){return sc(t)&&Bx(t)}function jx(t){var e=Oh(t)?$s.call(t):"";return e==bx||e==jK}function Ah(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Dx}function Oh(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function sc(t){return!!t&&typeof t=="object"}function cW(t){if(!Oh(t))return!1;var e=jx(t)||WD(t)?fG:ZK;return e.test(Bs(t))}function Mx(t){return typeof t=="string"||!Bi(t)&&sc(t)&&$s.call(t)==t0}function Ux(t){return typeof t=="symbol"||sc(t)&&$s.call(t)==Sx}function lW(t){return sc(t)&&Ah(t.length)&&!!Qe[$s.call(t)]}function fW(t,e,r){var n=t==null?void 0:Tx(t,e);return n===void 0?r:n}function hW(t,e){return t!=null&&nW(t,e,HG)}function QD(t){var e=oW(t);if(!(e||Bx(t)))return GG(t);var r=iW(t),n=!!r,i=r||[],s=i.length;for(var o in t)Ix(t,o)&&!(n&&(o=="length"||kx(o,s)))&&!(e&&o=="constructor")&&i.push(o);return i}var dW=JG(QD);function pW(t){return t}function mW(t){return Ch(t)?Px(Sh(t)):YG(t)}na.exports=KG});var Gx=_((js,oa)=>{var gW=1/0,yW="[object Function]",DW="[object GeneratorFunction]",wW=/[\\^$.*+?()[\]{}|]/g,vW=/^\[object .+?Constructor\]$/,oc={function:!0,object:!0},EW=oc[typeof js]&&js&&!js.nodeType?js:void 0,bW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,_W=xh(EW&&bW&&typeof global=="object"&&global),CW=xh(oc[typeof self]&&self),Hx=xh(oc[typeof window]&&window),n0=xh(oc[typeof js]&&js),SW=_W||Hx!==(n0&&n0.window)&&Hx||CW||n0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}function AW(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function OW(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Vx=Object.prototype,zx=Function.prototype.toString,xW=Vx.hasOwnProperty,TW=Vx.toString,IW=RegExp("^"+zx.call(xW).replace(wW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),i0=FW(SW,"Set"),PW=i0&&1/OW(new i0([,-0]))[1]==gW?function(t){return new i0(t)}:$W;function FW(t,e){var r=t[e];return NW(r)?r:void 0}function RW(t){if(t!=null){try{return zx.call(t)}catch{}try{return t+""}catch{}}return""}function kW(t){var e=Kx(t)?TW.call(t):"";return e==yW||e==DW}function Kx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function NW(t){if(!Kx(t))return!1;var e=kW(t)||AW(t)?IW:vW;return e.test(RW(t))}function $W(){}oa.exports=PW});var Xx=_((Ms,aa)=>{var ac={function:!0,object:!0},LW=ac[typeof Ms]&&Ms&&!Ms.nodeType?Ms:void 0,BW=ac[typeof aa]&&aa&&!aa.nodeType?aa:void 0,jW=Th(LW&&BW&&typeof global=="object"&&global),MW=Th(ac[typeof self]&&self),Wx=Th(ac[typeof window]&&window),s0=Th(ac[typeof Ms]&&Ms),UW=jW||Wx!==(s0&&s0.window)&&Wx||MW||s0||Function("return this")();function Th(t){return t&&t.Object===Object?t:null}aa.exports=UW});var tT=_((bDe,eT)=>{var qW=Gx(),HW=Xx(),VW=200,o0="__lodash_hash_undefined__",zW="[object Function]",KW="[object GeneratorFunction]",GW=/[\\^$.*+?()[\]{}|]/g,WW=/^\[object .+?Constructor\]$/;function XW(t,e){return!!t.length&&JW(t,e,0)>-1}function YW(t,e,r){for(var n=-1,i=t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function JW(t,e,r){if(e!==e)return QW(t,r);for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}function ZW(t,e){return t.has(e)}function QW(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 eX(t){var e=!1;if(t!=null&&typeof t.toString!="function")try{e=!!(t+"")}catch{}return e}function tX(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var rX=Array.prototype,Yx=Object.prototype,Jx=Function.prototype.toString,a0=Yx.hasOwnProperty,nX=Yx.toString,iX=RegExp("^"+Jx.call(a0).replace(GW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sX=rX.splice,oX=Zx(HW,"Map"),uc=Zx(Object,"create");function Us(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 aX(){this.__data__=uc?uc(null):{}}function uX(t){return this.has(t)&&delete this.__data__[t]}function cX(t){var e=this.__data__;if(uc){var r=e[t];return r===o0?void 0:r}return a0.call(e,t)?e[t]:void 0}function lX(t){var e=this.__data__;return uc?e[t]!==void 0:a0.call(e,t)}function fX(t,e){var r=this.__data__;return r[t]=uc&&e===void 0?o0:e,this}Us.prototype.clear=aX;Us.prototype.delete=uX;Us.prototype.get=cX;Us.prototype.has=lX;Us.prototype.set=fX;function ua(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 hX(){this.__data__=[]}function dX(t){var e=this.__data__,r=Ph(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():sX.call(e,r,1),!0}function pX(t){var e=this.__data__,r=Ph(e,t);return r<0?void 0:e[r][1]}function mX(t){return Ph(this.__data__,t)>-1}function gX(t,e){var r=this.__data__,n=Ph(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ua.prototype.clear=hX;ua.prototype.delete=dX;ua.prototype.get=pX;ua.prototype.has=mX;ua.prototype.set=gX;function ca(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 yX(){this.__data__={hash:new Us,map:new(oX||ua),string:new Us}}function DX(t){return Fh(this,t).delete(t)}function wX(t){return Fh(this,t).get(t)}function vX(t){return Fh(this,t).has(t)}function EX(t,e){return Fh(this,t).set(t,e),this}ca.prototype.clear=yX;ca.prototype.delete=DX;ca.prototype.get=wX;ca.prototype.has=vX;ca.prototype.set=EX;function Ih(t){var e=-1,r=t?t.length:0;for(this.__data__=new ca;++e<r;)this.add(t[e])}function bX(t){return this.__data__.set(t,o0),this}function _X(t){return this.__data__.has(t)}Ih.prototype.add=Ih.prototype.push=bX;Ih.prototype.has=_X;function Ph(t,e){for(var r=t.length;r--;)if(OX(t[r][0],e))return r;return-1}function CX(t,e,r){var n=-1,i=XW,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=YW;else if(s>=VW){var c=e?null:qW(t);if(c)return tX(c);o=!1,i=ZW,u=new Ih}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 Fh(t,e){var r=t.__data__;return SX(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Zx(t,e){var r=t[e];return TX(r)?r:void 0}function SX(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function AX(t){if(t!=null){try{return Jx.call(t)}catch{}try{return t+""}catch{}}return""}function OX(t,e){return t===e||t!==t&&e!==e}function xX(t){var e=Qx(t)?nX.call(t):"";return e==zW||e==KW}function Qx(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function TX(t){if(!Qx(t))return!1;var e=xX(t)||eX(t)?iX:WW;return e.test(AX(t))}eT.exports=CX});var nT=_((_De,rT)=>{var IX=qx(),PX=tT();function FX(t,e){return t&&t.length?PX(t,IX(e)):[]}rT.exports=FX});var sT=_((CDe,iT)=>{"use strict";var RX=ex(),kX=nT(),NX=RX("MultiError");iT.exports=u0;function u0(t){if(!(this instanceof u0))return new u0(t);if(t=Array.isArray(t)?t:[t],t=kX(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(`
56
56
 
57
57
  `)}),e.__defineSetter__("stack",function(r){return[r].concat(e.stack).join(`
58
58
 
59
- `)}),e}});var aT=_((SDe,oT)=>{var ji=require("constants"),$X=process.cwd,Rh=null,LX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Rh||(Rh=$X.call(process)),Rh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(c0=process.chdir,process.chdir=function(t){Rh=null,c0.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,c0));var c0;oT.exports=BX;function BX(t){ji.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(){}),LX==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,m){var y=Date.now(),v=0;l(d,f,function E(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,E):m(A)})},v),v<100&&(v+=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,v,E){var A;if(E&&typeof E=="function"){var p=0;A=function(D,w,C){if(D&&D.code==="EAGAIN"&&p<10)return p++,l.call(t,d,f,m,y,v,A);E.apply(this,arguments)}}return l.call(t,d,f,m,y,v,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 v=0;;)try{return l.call(t,h,d,f,m,y)}catch(E){if(E.code==="EAGAIN"&&v<10){v++;continue}throw E}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,ji.O_WRONLY|ji.O_SYMLINK,d,function(m,y){if(m){f&&f(m);return}l.fchmod(y,d,function(v){l.close(y,function(E){f&&f(v||E)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,ji.O_WRONLY|ji.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){ji.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,m){l.open(h,ji.O_SYMLINK,function(y,v){if(y){m&&m(y);return}l.futimes(v,d,f,function(E){l.close(v,function(A){m&&m(E||A)})})})},l.lutimesSync=function(h,d,f){var m=l.openSync(h,ji.O_SYMLINK),y,v=!0;try{y=l.futimesSync(m,d,f),v=!1}finally{if(v)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,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.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 lT=_((ADe,cT)=>{var uT=require("stream").Stream;cT.exports=jX;function jX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);uT.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);uT.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 hT=_((ODe,fT)=>{"use strict";fT.exports=UX;var MX=Object.getPrototypeOf||function(t){return t.__proto__};function UX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:MX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var vt=_((xDe,h0)=>{var pt=require("fs"),qX=aT(),HX=lT(),VX=hT(),kh=require("util"),Ht,$h;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ht=Symbol.for("graceful-fs.queue"),$h=Symbol.for("graceful-fs.previous")):(Ht="___graceful-fs.queue",$h="___graceful-fs.previous");function zX(){}function mT(t,e){Object.defineProperty(t,Ht,{get:function(){return e}})}var qs=zX;kh.debuglog?qs=kh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(qs=function(){var t=kh.format.apply(kh,arguments);t="GFS4: "+t.split(/\n/).join(`
60
- GFS4: `),console.error(t)});pt[Ht]||(dT=global[Ht]||[],mT(pt,dT),pt.close=(function(t){function e(r,n){return t.call(pt,r,function(i){i||pT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,$h,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),pT()}return Object.defineProperty(e,$h,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){qs(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var dT;global[Ht]||mT(global,pt[Ht]);h0.exports=l0(VX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(h0.exports=l0(pt),pt.__patched=!0);function l0(t){qX(t),t.gracefulify=l0,t.createReadStream=w,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),B(k,R,I);function B(j,z,L,S){return e(j,z,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?la([B,[j,z,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,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return n(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return s(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,B){return typeof I=="function"&&(B=I,I=0),j(k,R,I,B);function j(z,L,S,T,P){return a(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||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 B=l.test(process.version)?function(L,S,T,P){return c(L,j(L,S,T,P))}:function(L,S,T,P){return c(L,S,j(L,S,T,P))};return B(k,R,I);function j(z,L,S,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?la([B,[z,L,S],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof S=="function"&&S.call(this,P,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=HX(t);E=d.ReadStream,p=d.WriteStream}var f=t.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.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 E},set:function(k){E=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return p},set:function(k){p=k},enumerable:!0,configurable:!0});var y=E;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var v=p;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(k){v=k},enumerable:!0,configurable:!0});function E(k,R){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.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 C(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=b;function b(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return F(z,L,S,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function la(t){qs("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),f0()}var Nh;function pT(){for(var t=Date.now(),e=0;e<pt[Ht].length;++e)pt[Ht][e].length>2&&(pt[Ht][e][3]=t,pt[Ht][e][4]=t);f0()}function f0(){if(clearTimeout(Nh),Nh=void 0,pt[Ht].length!==0){var t=pt[Ht].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)qs("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){qs("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?(qs("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}Nh===void 0&&(Nh=setTimeout(f0,0))}}});var yT=_((TDe,gT)=>{function Kr(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))}gT.exports=Kr;Kr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Kr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Kr.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};Kr.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)};Kr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Kr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Kr.prototype.start=Kr.prototype.try;Kr.prototype.errors=function(){return this._errors};Kr.prototype.attempts=function(){return this._attempts};Kr.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 DT=_(Hs=>{var KX=yT();Hs.operation=function(t){var e=Hs.timeouts(t);return new KX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Hs.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};Hs.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};Hs.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=Hs.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 vT=_((PDe,wT)=>{wT.exports=DT()});var ET=_((FDe,Lh)=>{Lh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Lh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Lh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Uh=_((RDe,da)=>{var at=global.process,Vs=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"};Vs(at)?(bT=require("assert"),fa=ET(),_T=/^win/i.test(at.platform),cc=require("events"),typeof cc!="function"&&(cc=cc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new cc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),da.exports=function(t,e){if(!Vs(global.process))return function(){};bT.equal(typeof t,"function","a callback must be provided for exit handler"),ha===!1&&d0();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Bh()};return kt.on(r,t),n},Bh=function(){!ha||!Vs(global.process)||(ha=!1,fa.forEach(function(e){try{at.removeListener(e,jh[e])}catch{}}),at.emit=Mh,at.reallyExit=p0,kt.count-=1)},da.exports.unload=Bh,zs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},jh={},fa.forEach(function(t){jh[t]=function(){if(Vs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Bh(),zs("exit",null,t),zs("afterexit",null,t),_T&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),da.exports.signals=function(){return fa},ha=!1,d0=function(){ha||!Vs(global.process)||(ha=!0,kt.count+=1,fa=fa.filter(function(e){try{return at.on(e,jh[e]),!0}catch{return!1}}),at.emit=ST,at.reallyExit=CT)},da.exports.load=d0,p0=at.reallyExit,CT=function(e){Vs(global.process)&&(at.exitCode=e||0,zs("exit",at.exitCode,null),zs("afterexit",at.exitCode,null),p0.call(at,at.exitCode))},Mh=at.emit,ST=function(e,r){if(e==="exit"&&Vs(global.process)){r!==void 0&&(at.exitCode=r);var n=Mh.apply(this,arguments);return zs("exit",at.exitCode,null),zs("afterexit",at.exitCode,null),n}else return Mh.apply(this,arguments)}):da.exports=function(){return function(){}};var bT,fa,_T,cc,kt,Bh,zs,jh,ha,d0,p0,CT,Mh,ST});var OT=_((kDe,m0)=>{"use strict";var AT=Symbol();function GX(t,e,r){let n=e[AT];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,AT,{value:u}),r(null,a.mtime,u)})})}function WX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}m0.exports.probe=GX;m0.exports.getMtime=WX});var FT=_((NDe,fc)=>{"use strict";var XX=require("path"),D0=vt(),YX=vT(),JX=Uh(),xT=OT(),ni={};function lc(t,e){return e.lockfilePath||`${t}.lock`}function w0(t,e,r){if(!e.realpath)return r(null,XX.resolve(t));e.fs.realpath(t,r)}function y0(t,e,r){let n=lc(t,e);e.fs.mkdir(n,i=>{if(!i)return xT.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"?y0(t,{...e,stale:0},r):r(s);if(!TT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));IT(t,e,a=>{if(a)return r(a);y0(t,{...e,stale:0},r)})})})}function TT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function IT(t,e,r){e.fs.rmdir(lc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function qh(t,e){let r=ni[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?g0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return g0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=xT.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?g0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,qh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function g0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ni[t]===e&&delete ni[t],e.options.onCompromised(r)}function ZX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:D0,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),w0(t,e,(n,i)=>{if(n)return r(n);let s=YX.operation(e.retries);s.attempt(()=>{y0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ni[i]={lockfilePath:lc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};qh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));PT(i,{...e,realpath:!1},l)})})})})}function PT(t,e,r){e={fs:D0,realpath:!0,...e},w0(t,e,(n,i)=>{if(n)return r(n);let s=ni[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 ni[i],IT(i,e,r)})}function QX(t,e,r){e={stale:1e4,realpath:!0,fs:D0,...e},e.stale=Math.max(e.stale||0,2e3),w0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(lc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!TT(o,e)))})}function eY(){return ni}JX(()=>{for(let t in ni){let e=ni[t].options;try{e.fs.rmdirSync(lc(t,e))}catch{}}});fc.exports.lock=ZX;fc.exports.unlock=PT;fc.exports.check=QX;fc.exports.getLocks=eY});var kT=_(($De,RT)=>{"use strict";var tY=vt();function rY(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 nY(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function iY(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function sY(t){if(t={...t},t.fs=rY(t.fs||tY),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}RT.exports={toPromise:nY,toSync:iY,toSyncOptions:sY}});var $T=_((LDe,Mi)=>{"use strict";var pa=FT(),{toPromise:Hh,toSync:Vh,toSyncOptions:v0}=kT();async function NT(t,e){let r=await Hh(pa.lock)(t,e);return Hh(r)}function oY(t,e){let r=Vh(pa.lock)(t,v0(e));return Vh(r)}function aY(t,e){return Hh(pa.unlock)(t,e)}function uY(t,e){return Vh(pa.unlock)(t,v0(e))}function cY(t,e){return Hh(pa.check)(t,e)}function lY(t,e){return Vh(pa.check)(t,v0(e))}Mi.exports=NT;Mi.exports.lock=NT;Mi.exports.unlock=aY;Mi.exports.lockSync=oY;Mi.exports.unlockSync=uY;Mi.exports.check=cY;Mi.exports.checkSync=lY});var UT=_(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.canStoreURLs=ma.FileUrlStorage=void 0;var LT=require("fs"),fY=dY(sT()),BT=hY($T());function MT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(MT=function(n){return n?r:e})(t)}function hY(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=MT(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 dY(t){return t&&t.__esModule?t:{default:t}}function hc(t){"@babel/helpers - typeof";return hc=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},hc(t)}function pY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jT(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,gY(n.key),n)}}function mY(t,e,r){return e&&jT(t.prototype,e),r&&jT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gY(t){var e=yY(t,"string");return hc(e)=="symbol"?e:e+""}function yY(t,e){if(hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var BDe=ma.canStoreURLs=!0,jDe=ma.FileUrlStorage=(function(){function t(e){pY(this,t),this.path=e}return mY(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;BT.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;BT.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,fY.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,LT.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,LT.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 Kh=_(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return zT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return DY.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return KT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return _Y.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return KT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return wY.enableDebugLog}});Er.isSupported=void 0;var DY=Ks(yD()),wY=DD(),vY=Ks(UA()),E0=Ks(yO()),EY=Ks(IO()),bY=Ks(kO()),zT=Ks(WO()),_Y=Ks(FD()),KT=UT();function Ks(t){return t&&t.__esModule?t:{default:t}}function ya(t){"@babel/helpers - typeof";return ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ya(t)}function CY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qT(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,WT(n.key),n)}}function SY(t,e,r){return e&&qT(t.prototype,e),r&&qT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function AY(t,e,r){return e=zh(e),OY(t,GT()?Reflect.construct(e,r||[],zh(t).constructor):e.apply(t,r))}function OY(t,e){if(e&&(ya(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xY(t)}function xY(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function GT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GT=function(){return!!t})()}function zh(t){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zh(t)}function TY(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&&b0(t,e)}function b0(t,e){return b0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},b0(t,e)}function HT(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 ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HT(Object(r),!0).forEach(function(n){IY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function IY(t,e,r){return e=WT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WT(t){var e=PY(t,"string");return ya(e)=="symbol"?e:e+""}function PY(t,e){if(ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var VT=Er.defaultOptions=ga(ga({},E0.default.defaultOptions),{},{httpStack:new zT.default,fileReader:new EY.default,urlStorage:new vY.default,fingerprint:bY.default}),UDe=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 CY(this,e),n=ga(ga({},VT),n),AY(this,e,[r,n])}return TY(e,t),SY(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ga(ga({},VT),i),E0.default.terminate(n,i)}}])})(E0.default),qDe=Er.isSupported=!0});var ZT=_((r0e,JT)=>{var Da=1e3,wa=Da*60,va=wa*60,Gs=va*24,NY=Gs*7,$Y=Gs*365.25;JT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return LY(t);if(r==="number"&&isFinite(t))return e.long?jY(t):BY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function LY(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*$Y;case"weeks":case"week":case"w":return r*NY;case"days":case"day":case"d":return r*Gs;case"hours":case"hour":case"hrs":case"hr":case"h":return r*va;case"minutes":case"minute":case"mins":case"min":case"m":return r*wa;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 BY(t){var e=Math.abs(t);return e>=Gs?Math.round(t/Gs)+"d":e>=va?Math.round(t/va)+"h":e>=wa?Math.round(t/wa)+"m":e>=Da?Math.round(t/Da)+"s":t+"ms"}function jY(t){var e=Math.abs(t);return e>=Gs?Wh(t,e,Gs,"day"):e>=va?Wh(t,e,va,"hour"):e>=wa?Wh(t,e,wa,"minute"):e>=Da?Wh(t,e,Da,"second"):t+" ms"}function Wh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var C0=_((n0e,QT)=>{function MY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=ZT(),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(...v){if(!y.enabled)return;let E=y,A=Number(new Date),p=A-(h||A);E.diff=p,E.prev=h,E.curr=A,h=A,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let D=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,F)=>{if(C==="%%")return"%";D++;let b=r.formatters[F];if(typeof b=="function"){let k=v[D];C=b.call(E,k),v.splice(D,1),D--}return C}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}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:v=>{d=v}}),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}QT.exports=MY});var e1=_((br,Xh)=>{br.formatArgs=qY;br.save=HY;br.load=VY;br.useColors=UY;br.storage=zY();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 UY(){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 qY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Xh.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 HY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function VY(){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 zY(){try{return localStorage}catch{}}Xh.exports=C0()(br);var{formatters:KY}=Xh.exports;KY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var r1=_((i0e,t1)=>{"use strict";t1.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 s1=_((s0e,i1)=>{"use strict";var GY=require("os"),n1=require("tty"),Gr=r1(),{env:Nt}=process,qi;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?qi=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(qi=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?qi=1:Nt.FORCE_COLOR==="false"?qi=0:qi=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function S0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function A0(t,e){if(qi===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&qi===void 0)return 0;let r=qi||0;if(Nt.TERM==="dumb")return r;if(process.platform==="win32"){let n=GY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Nt)||Nt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Nt){let n=parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:r}function WY(t){let e=A0(t,t&&t.isTTY);return S0(e)}i1.exports={supportsColor:WY,stdout:S0(A0(!0,n1.isatty(1))),stderr:S0(A0(!0,n1.isatty(2)))}});var a1=_(($t,Jh)=>{var XY=require("tty"),Yh=require("util");$t.init=rJ;$t.log=QY;$t.formatArgs=JY;$t.save=eJ;$t.load=tJ;$t.useColors=YY;$t.destroy=Yh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$t.colors=[6,2,3,4,5,1];try{let t=s1();t&&(t.stderr||t).level>=2&&($t.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{}$t.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 YY(){return"colors"in $t.inspectOpts?!!$t.inspectOpts.colors:XY.isatty(process.stderr.fd)}function JY(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(`
59
+ `)}),e}});var aT=_((SDe,oT)=>{var ji=require("constants"),$X=process.cwd,Rh=null,LX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Rh||(Rh=$X.call(process)),Rh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(c0=process.chdir,process.chdir=function(t){Rh=null,c0.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,c0));var c0;oT.exports=BX;function BX(t){ji.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(){}),LX==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function h(d,f,p){var y=Date.now(),v=0;l(d,f,function E(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-y<6e4){setTimeout(function(){t.stat(f,function(m,D){m&&m.code==="ENOENT"?l(d,f,E):p(A)})},v),v<100&&(v+=10);return}p&&p(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,p,y,v,E){var A;if(E&&typeof E=="function"){var m=0;A=function(D,w,C){if(D&&D.code==="EAGAIN"&&m<10)return m++,l.call(t,d,f,p,y,v,A);E.apply(this,arguments)}}return l.call(t,d,f,p,y,v,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,p,y){for(var v=0;;)try{return l.call(t,h,d,f,p,y)}catch(E){if(E.code==="EAGAIN"&&v<10){v++;continue}throw E}}})(t.readSync);function e(l){l.lchmod=function(h,d,f){l.open(h,ji.O_WRONLY|ji.O_SYMLINK,d,function(p,y){if(p){f&&f(p);return}l.fchmod(y,d,function(v){l.close(y,function(E){f&&f(v||E)})})})},l.lchmodSync=function(h,d){var f=l.openSync(h,ji.O_WRONLY|ji.O_SYMLINK,d),p=!0,y;try{y=l.fchmodSync(f,d),p=!1}finally{if(p)try{l.closeSync(f)}catch{}else l.closeSync(f)}return y}}function r(l){ji.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,p){l.open(h,ji.O_SYMLINK,function(y,v){if(y){p&&p(y);return}l.futimes(v,d,f,function(E){l.close(v,function(A){p&&p(E||A)})})})},l.lutimesSync=function(h,d,f){var p=l.openSync(h,ji.O_SYMLINK),y,v=!0;try{y=l.futimesSync(p,d,f),v=!1}finally{if(v)try{l.closeSync(p)}catch{}else l.closeSync(p)}return y}):l.futimes&&(l.lutimes=function(h,d,f,p){p&&process.nextTick(p)},l.lutimesSync=function(){})}function n(l){return l&&function(h,d,f){return l.call(t,h,d,function(p){c(p)&&(p=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,p){return l.call(t,h,d,f,function(y){c(y)&&(y=null),p&&p.apply(this,arguments)})}}function o(l){return l&&function(h,d,f){try{return l.call(t,h,d,f)}catch(p){if(!c(p))throw p}}}function a(l){return l&&function(h,d,f){typeof d=="function"&&(f=d,d=null);function p(y,v){v&&(v.uid<0&&(v.uid+=4294967296),v.gid<0&&(v.gid+=4294967296)),f&&f.apply(this,arguments)}return d?l.call(t,h,d,p):l.call(t,h,p)}}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 lT=_((ADe,cT)=>{var uT=require("stream").Stream;cT.exports=jX;function jX(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);uT.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);uT.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 hT=_((ODe,fT)=>{"use strict";fT.exports=UX;var MX=Object.getPrototypeOf||function(t){return t.__proto__};function UX(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:MX(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var vt=_((xDe,h0)=>{var pt=require("fs"),qX=aT(),HX=lT(),VX=hT(),kh=require("util"),Ht,$h;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ht=Symbol.for("graceful-fs.queue"),$h=Symbol.for("graceful-fs.previous")):(Ht="___graceful-fs.queue",$h="___graceful-fs.previous");function zX(){}function mT(t,e){Object.defineProperty(t,Ht,{get:function(){return e}})}var qs=zX;kh.debuglog?qs=kh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(qs=function(){var t=kh.format.apply(kh,arguments);t="GFS4: "+t.split(/\n/).join(`
60
+ GFS4: `),console.error(t)});pt[Ht]||(dT=global[Ht]||[],mT(pt,dT),pt.close=(function(t){function e(r,n){return t.call(pt,r,function(i){i||pT(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,$h,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),pT()}return Object.defineProperty(e,$h,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){qs(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var dT;global[Ht]||mT(global,pt[Ht]);h0.exports=l0(VX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(h0.exports=l0(pt),pt.__patched=!0);function l0(t){qX(t),t.gracefulify=l0,t.createReadStream=w,t.createWriteStream=C;var e=t.readFile;t.readFile=r;function r(k,R,I){return typeof R=="function"&&(I=R,R=null),B(k,R,I);function B(j,z,L,S){return e(j,z,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?la([B,[j,z,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,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return n(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return s(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(k,R,I,B){return typeof I=="function"&&(B=I,I=0),j(k,R,I,B);function j(z,L,S,T,P){return a(z,L,S,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||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 B=l.test(process.version)?function(L,S,T,P){return c(L,j(L,S,T,P))}:function(L,S,T,P){return c(L,S,j(L,S,T,P))};return B(k,R,I);function j(z,L,S,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?la([B,[z,L,S],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof S=="function"&&S.call(this,P,$))}}}if(process.version.substr(0,4)==="v0.8"){var d=HX(t);E=d.ReadStream,m=d.WriteStream}var f=t.ReadStream;f&&(E.prototype=Object.create(f.prototype),E.prototype.open=A);var p=t.WriteStream;p&&(m.prototype=Object.create(p.prototype),m.prototype.open=D),Object.defineProperty(t,"ReadStream",{get:function(){return E},set:function(k){E=k},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return m},set:function(k){m=k},enumerable:!0,configurable:!0});var y=E;Object.defineProperty(t,"FileReadStream",{get:function(){return y},set:function(k){y=k},enumerable:!0,configurable:!0});var v=m;Object.defineProperty(t,"FileWriteStream",{get:function(){return v},set:function(k){v=k},enumerable:!0,configurable:!0});function E(k,R){return this instanceof E?(f.apply(this,arguments),this):E.apply(Object.create(E.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 m(k,R){return this instanceof m?(p.apply(this,arguments),this):m.apply(Object.create(m.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 C(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=b;function b(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(z,L,S,T,P){return F(z,L,S,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?la([j,[z,L,S,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function la(t){qs("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),f0()}var Nh;function pT(){for(var t=Date.now(),e=0;e<pt[Ht].length;++e)pt[Ht][e].length>2&&(pt[Ht][e][3]=t,pt[Ht][e][4]=t);f0()}function f0(){if(clearTimeout(Nh),Nh=void 0,pt[Ht].length!==0){var t=pt[Ht].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)qs("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){qs("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?(qs("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}Nh===void 0&&(Nh=setTimeout(f0,0))}}});var yT=_((TDe,gT)=>{function Kr(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))}gT.exports=Kr;Kr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};Kr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};Kr.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};Kr.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)};Kr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};Kr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};Kr.prototype.start=Kr.prototype.try;Kr.prototype.errors=function(){return this._errors};Kr.prototype.attempts=function(){return this._attempts};Kr.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 DT=_(Hs=>{var KX=yT();Hs.operation=function(t){var e=Hs.timeouts(t);return new KX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};Hs.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};Hs.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};Hs.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=Hs.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 vT=_((PDe,wT)=>{wT.exports=DT()});var ET=_((FDe,Lh)=>{Lh.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Lh.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Lh.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Uh=_((RDe,da)=>{var at=global.process,Vs=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"};Vs(at)?(bT=require("assert"),fa=ET(),_T=/^win/i.test(at.platform),cc=require("events"),typeof cc!="function"&&(cc=cc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new cc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),da.exports=function(t,e){if(!Vs(global.process))return function(){};bT.equal(typeof t,"function","a callback must be provided for exit handler"),ha===!1&&d0();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){kt.removeListener(r,t),kt.listeners("exit").length===0&&kt.listeners("afterexit").length===0&&Bh()};return kt.on(r,t),n},Bh=function(){!ha||!Vs(global.process)||(ha=!1,fa.forEach(function(e){try{at.removeListener(e,jh[e])}catch{}}),at.emit=Mh,at.reallyExit=p0,kt.count-=1)},da.exports.unload=Bh,zs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},jh={},fa.forEach(function(t){jh[t]=function(){if(Vs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Bh(),zs("exit",null,t),zs("afterexit",null,t),_T&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),da.exports.signals=function(){return fa},ha=!1,d0=function(){ha||!Vs(global.process)||(ha=!0,kt.count+=1,fa=fa.filter(function(e){try{return at.on(e,jh[e]),!0}catch{return!1}}),at.emit=ST,at.reallyExit=CT)},da.exports.load=d0,p0=at.reallyExit,CT=function(e){Vs(global.process)&&(at.exitCode=e||0,zs("exit",at.exitCode,null),zs("afterexit",at.exitCode,null),p0.call(at,at.exitCode))},Mh=at.emit,ST=function(e,r){if(e==="exit"&&Vs(global.process)){r!==void 0&&(at.exitCode=r);var n=Mh.apply(this,arguments);return zs("exit",at.exitCode,null),zs("afterexit",at.exitCode,null),n}else return Mh.apply(this,arguments)}):da.exports=function(){return function(){}};var bT,fa,_T,cc,kt,Bh,zs,jh,ha,d0,p0,CT,Mh,ST});var OT=_((kDe,m0)=>{"use strict";var AT=Symbol();function GX(t,e,r){let n=e[AT];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,AT,{value:u}),r(null,a.mtime,u)})})}function WX(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}m0.exports.probe=GX;m0.exports.getMtime=WX});var FT=_((NDe,fc)=>{"use strict";var XX=require("path"),D0=vt(),YX=vT(),JX=Uh(),xT=OT(),ni={};function lc(t,e){return e.lockfilePath||`${t}.lock`}function w0(t,e,r){if(!e.realpath)return r(null,XX.resolve(t));e.fs.realpath(t,r)}function y0(t,e,r){let n=lc(t,e);e.fs.mkdir(n,i=>{if(!i)return xT.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"?y0(t,{...e,stale:0},r):r(s);if(!TT(o,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));IT(t,e,a=>{if(a)return r(a);y0(t,{...e,stale:0},r)})})})}function TT(t,e){return t.mtime.getTime()<Date.now()-e.stale}function IT(t,e,r){e.fs.rmdir(lc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function qh(t,e){let r=ni[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?g0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return g0(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=xT.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?g0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,qh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,qh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function g0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ni[t]===e&&delete ni[t],e.options.onCompromised(r)}function ZX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:D0,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),w0(t,e,(n,i)=>{if(n)return r(n);let s=YX.operation(e.retries);s.attempt(()=>{y0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ni[i]={lockfilePath:lc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};qh(i,e),r(null,l=>{if(c.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));PT(i,{...e,realpath:!1},l)})})})})}function PT(t,e,r){e={fs:D0,realpath:!0,...e},w0(t,e,(n,i)=>{if(n)return r(n);let s=ni[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 ni[i],IT(i,e,r)})}function QX(t,e,r){e={stale:1e4,realpath:!0,fs:D0,...e},e.stale=Math.max(e.stale||0,2e3),w0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(lc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!TT(o,e)))})}function eY(){return ni}JX(()=>{for(let t in ni){let e=ni[t].options;try{e.fs.rmdirSync(lc(t,e))}catch{}}});fc.exports.lock=ZX;fc.exports.unlock=PT;fc.exports.check=QX;fc.exports.getLocks=eY});var kT=_(($De,RT)=>{"use strict";var tY=vt();function rY(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 nY(t){return(...e)=>new Promise((r,n)=>{e.push((i,s)=>{i?n(i):r(s)}),t(...e)})}function iY(t){return(...e)=>{let r,n;if(e.push((i,s)=>{r=i,n=s}),t(...e),r)throw r;return n}}function sY(t){if(t={...t},t.fs=rY(t.fs||tY),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}RT.exports={toPromise:nY,toSync:iY,toSyncOptions:sY}});var $T=_((LDe,Mi)=>{"use strict";var pa=FT(),{toPromise:Hh,toSync:Vh,toSyncOptions:v0}=kT();async function NT(t,e){let r=await Hh(pa.lock)(t,e);return Hh(r)}function oY(t,e){let r=Vh(pa.lock)(t,v0(e));return Vh(r)}function aY(t,e){return Hh(pa.unlock)(t,e)}function uY(t,e){return Vh(pa.unlock)(t,v0(e))}function cY(t,e){return Hh(pa.check)(t,e)}function lY(t,e){return Vh(pa.check)(t,v0(e))}Mi.exports=NT;Mi.exports.lock=NT;Mi.exports.unlock=aY;Mi.exports.lockSync=oY;Mi.exports.unlockSync=uY;Mi.exports.check=cY;Mi.exports.checkSync=lY});var UT=_(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});ma.canStoreURLs=ma.FileUrlStorage=void 0;var LT=require("fs"),fY=dY(sT()),BT=hY($T());function MT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(MT=function(n){return n?r:e})(t)}function hY(t,e){if(!e&&t&&t.__esModule)return t;if(t===null||typeof t!="object"&&typeof t!="function")return{default:t};var r=MT(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 dY(t){return t&&t.__esModule?t:{default:t}}function hc(t){"@babel/helpers - typeof";return hc=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},hc(t)}function pY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jT(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,gY(n.key),n)}}function mY(t,e,r){return e&&jT(t.prototype,e),r&&jT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function gY(t){var e=yY(t,"string");return hc(e)=="symbol"?e:e+""}function yY(t,e){if(hc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(hc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var BDe=ma.canStoreURLs=!0,jDe=ma.FileUrlStorage=(function(){function t(e){pY(this,t),this.path=e}return mY(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;BT.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;BT.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,fY.default)([i,s]))});return}r().then(n).catch(n)}}},{key:"_writeData",value:function(r,n){var i={encoding:"utf8",mode:432,flag:"w"};(0,LT.writeFile)(this.path,JSON.stringify(r),i,function(s){return n(s)})}},{key:"_getData",value:function(r){(0,LT.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 Kh=_(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Object.defineProperty(Er,"DefaultHttpStack",{enumerable:!0,get:function(){return zT.default}});Object.defineProperty(Er,"DetailedError",{enumerable:!0,get:function(){return DY.default}});Object.defineProperty(Er,"FileUrlStorage",{enumerable:!0,get:function(){return KT.FileUrlStorage}});Object.defineProperty(Er,"StreamSource",{enumerable:!0,get:function(){return _Y.default}});Er.Upload=void 0;Object.defineProperty(Er,"canStoreURLs",{enumerable:!0,get:function(){return KT.canStoreURLs}});Er.defaultOptions=void 0;Object.defineProperty(Er,"enableDebugLog",{enumerable:!0,get:function(){return wY.enableDebugLog}});Er.isSupported=void 0;var DY=Ks(yD()),wY=DD(),vY=Ks(UA()),E0=Ks(yO()),EY=Ks(IO()),bY=Ks(kO()),zT=Ks(WO()),_Y=Ks(FD()),KT=UT();function Ks(t){return t&&t.__esModule?t:{default:t}}function ya(t){"@babel/helpers - typeof";return ya=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ya(t)}function CY(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qT(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,WT(n.key),n)}}function SY(t,e,r){return e&&qT(t.prototype,e),r&&qT(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function AY(t,e,r){return e=zh(e),OY(t,GT()?Reflect.construct(e,r||[],zh(t).constructor):e.apply(t,r))}function OY(t,e){if(e&&(ya(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xY(t)}function xY(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function GT(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GT=function(){return!!t})()}function zh(t){return zh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},zh(t)}function TY(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&&b0(t,e)}function b0(t,e){return b0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},b0(t,e)}function HT(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 ga(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?HT(Object(r),!0).forEach(function(n){IY(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):HT(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function IY(t,e,r){return e=WT(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function WT(t){var e=PY(t,"string");return ya(e)=="symbol"?e:e+""}function PY(t,e){if(ya(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ya(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var VT=Er.defaultOptions=ga(ga({},E0.default.defaultOptions),{},{httpStack:new zT.default,fileReader:new EY.default,urlStorage:new vY.default,fingerprint:bY.default}),UDe=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 CY(this,e),n=ga(ga({},VT),n),AY(this,e,[r,n])}return TY(e,t),SY(e,null,[{key:"terminate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=ga(ga({},VT),i),E0.default.terminate(n,i)}}])})(E0.default),qDe=Er.isSupported=!0});var ZT=_((r0e,JT)=>{var Da=1e3,wa=Da*60,va=wa*60,Gs=va*24,NY=Gs*7,$Y=Gs*365.25;JT.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return LY(t);if(r==="number"&&isFinite(t))return e.long?jY(t):BY(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function LY(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*$Y;case"weeks":case"week":case"w":return r*NY;case"days":case"day":case"d":return r*Gs;case"hours":case"hour":case"hrs":case"hr":case"h":return r*va;case"minutes":case"minute":case"mins":case"min":case"m":return r*wa;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 BY(t){var e=Math.abs(t);return e>=Gs?Math.round(t/Gs)+"d":e>=va?Math.round(t/va)+"h":e>=wa?Math.round(t/wa)+"m":e>=Da?Math.round(t/Da)+"s":t+"ms"}function jY(t){var e=Math.abs(t);return e>=Gs?Wh(t,e,Gs,"day"):e>=va?Wh(t,e,va,"hour"):e>=wa?Wh(t,e,wa,"minute"):e>=Da?Wh(t,e,Da,"second"):t+" ms"}function Wh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var C0=_((n0e,QT)=>{function MY(t){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=i,r.enabled=a,r.humanize=ZT(),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,p;function y(...v){if(!y.enabled)return;let E=y,A=Number(new Date),m=A-(h||A);E.diff=m,E.prev=h,E.curr=A,h=A,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let D=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(C,F)=>{if(C==="%%")return"%";D++;let b=r.formatters[F];if(typeof b=="function"){let k=v[D];C=b.call(E,k),v.splice(D,1),D--}return C}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}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,p=r.enabled(l)),p),set:v=>{d=v}}),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,p=-1,y=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(p=f,y=d,f++):(d++,f++);else if(p!==-1)f=p+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}QT.exports=MY});var e1=_((br,Xh)=>{br.formatArgs=qY;br.save=HY;br.load=VY;br.useColors=UY;br.storage=zY();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 UY(){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 qY(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Xh.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 HY(t){try{t?br.storage.setItem("debug",t):br.storage.removeItem("debug")}catch{}}function VY(){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 zY(){try{return localStorage}catch{}}Xh.exports=C0()(br);var{formatters:KY}=Xh.exports;KY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var r1=_((i0e,t1)=>{"use strict";t1.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 s1=_((s0e,i1)=>{"use strict";var GY=require("os"),n1=require("tty"),Gr=r1(),{env:Nt}=process,qi;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?qi=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(qi=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?qi=1:Nt.FORCE_COLOR==="false"?qi=0:qi=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function S0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function A0(t,e){if(qi===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&qi===void 0)return 0;let r=qi||0;if(Nt.TERM==="dumb")return r;if(process.platform==="win32"){let n=GY.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Nt)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Nt)||Nt.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Nt)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Nt.TEAMCITY_VERSION)?1:0;if(Nt.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Nt){let n=parseInt((Nt.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Nt.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Nt.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Nt.TERM)||"COLORTERM"in Nt?1:r}function WY(t){let e=A0(t,t&&t.isTTY);return S0(e)}i1.exports={supportsColor:WY,stdout:S0(A0(!0,n1.isatty(1))),stderr:S0(A0(!0,n1.isatty(2)))}});var a1=_(($t,Jh)=>{var XY=require("tty"),Yh=require("util");$t.init=rJ;$t.log=QY;$t.formatArgs=JY;$t.save=eJ;$t.load=tJ;$t.useColors=YY;$t.destroy=Yh.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");$t.colors=[6,2,3,4,5,1];try{let t=s1();t&&(t.stderr||t).level>=2&&($t.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{}$t.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 YY(){return"colors"in $t.inspectOpts?!!$t.inspectOpts.colors:XY.isatty(process.stderr.fd)}function JY(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(`
61
61
  `).join(`
62
62
  `+s),t.push(i+"m+"+Jh.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=ZY()+e+" "+t[0]}function ZY(){return $t.inspectOpts.hideDate?"":new Date().toISOString()+" "}function QY(...t){return process.stderr.write(Yh.formatWithOptions($t.inspectOpts,...t)+`
63
63
  `)}function eJ(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function tJ(){return process.env.DEBUG}function rJ(t){t.inspectOpts={};let e=Object.keys($t.inspectOpts);for(let r=0;r<e.length;r++)t.inspectOpts[e[r]]=$t.inspectOpts[e[r]]}Jh.exports=C0()($t);var{formatters:o1}=Jh.exports;o1.o=function(t){return this.inspectOpts.colors=this.useColors,Yh.inspect(t,this.inspectOpts).split(`
@@ -74,13 +74,13 @@ GFS4: `),console.error(t)});pt[Ht]||(dT=global[Ht]||[],mT(pt,dT),pt.close=(funct
74
74
  `).map(n=>_Q(n,e,r)).join(`
75
75
  `)});var LP=_((twe,$P)=>{"use strict";var CQ=require("os"),NP=CQ.homedir();$P.exports=t=>{if(typeof t!="string")throw new TypeError(`Expected a string, got ${typeof t}`);return NP?t.replace(/^~(?=$|\/|\\)/,NP):t}});var HP=_(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.columnar=mt.generateFillSpaceStringList=mt.expandPath=mt.prettyPath=mt.wordWrap=mt.indent=mt.TTY_WIDTH=mt.stripAnsi=mt.stringWidth=mt.sliceAnsi=void 0;var BP=(he(),ce(fe)),SQ=BP.__importStar(require("os")),ai=BP.__importStar(require("path")),jP=bP();mt.sliceAnsi=jP;var fd=W0();mt.stringWidth=fd;var AQ=cd();mt.stripAnsi=AQ;var OQ=kP(),xQ=LP(),TQ=80,IQ=120;mt.TTY_WIDTH=process.stdout.columns?Math.max(TQ,Math.min(process.stdout.columns,IQ)):1/0;function MP(t=4){return" ".repeat(t)}mt.indent=MP;function PQ(t,{width:e=mt.TTY_WIDTH,indentation:r=0,append:n=""}){return OQ(t,e-r-n.length,{trim:!0}).split(`
76
76
  `).join(`${n}
77
- ${MP(r)}`)}mt.wordWrap=PQ;function FQ(t){t=UP(t);let e=process.cwd(),r=ai.dirname(t),n=SQ.homedir(),i=Math.abs(r.split(ai.sep).length-e.split(ai.sep).length);if(e===r)return"."+ai.sep+ai.basename(t);if(r.startsWith(e))return"."+ai.sep+t.substring(e.length+1);if(i<=2){let s=ai.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+ai.sep+t.substring(n.length+1)}return t}mt.prettyPath=FQ;function UP(t){return ai.resolve(xQ(t))}mt.expandPath=UP;function qP(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>fd(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>jP(s,0,i-fd(o)))}mt.generateFillSpaceStringList=qP;function RQ(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(`
78
- `);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=qP(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,fd(m)),m}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
77
+ ${MP(r)}`)}mt.wordWrap=PQ;function FQ(t){t=UP(t);let e=process.cwd(),r=ai.dirname(t),n=SQ.homedir(),i=Math.abs(r.split(ai.sep).length-e.split(ai.sep).length);if(e===r)return"."+ai.sep+ai.basename(t);if(r.startsWith(e))return"."+ai.sep+t.substring(e.length+1);if(i<=2){let s=ai.relative(e,t);return s||"."}else{if(t===n)return"~";if(t.indexOf(n)===0)return"~"+ai.sep+t.substring(n.length+1)}return t}mt.prettyPath=FQ;function UP(t){return ai.resolve(xQ(t))}mt.expandPath=UP;function qP(t,e=1,r=" "){e<2&&(e=2);let n=Math.max(...t.map(o=>fd(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>jP(s,0,i-fd(o)))}mt.generateFillSpaceStringList=qP;function RQ(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 p=f.split(`
78
+ `);return h=Math.max(h,p.length),p});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=qP(l);return l.map((f,p)=>`${f}${d[p]}${r===""?"":`${r} `}`)}else return l}),u=0,c=a.reduce((l,h)=>l.map((d,f)=>{let p=l[f]+h[f];return u=Math.max(u,fd(p)),p}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
79
79
  `)}mt.columnar=RQ});var VP=_(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.TERMINAL_INFO=Wr.CI_ENVIRONMENT_VARIABLES_DETECTED=Wr.CI_ENVIRONMENT_VARIABLES=void 0;var kQ=(he(),ce(fe)),NQ=Zh(),$Q=kQ.__importStar(require("os")),LQ=(0,NQ.debug)("ionic:utils-terminal:info");Wr.CI_ENVIRONMENT_VARIABLES=["CI","BUILD_ID","BUILD_NUMBER","BITBUCKET_COMMIT","CODEBUILD_BUILD_ARN","GITHUB_ACTIONS"];Wr.CI_ENVIRONMENT_VARIABLES_DETECTED=Wr.CI_ENVIRONMENT_VARIABLES.filter(t=>!!process.env[t]);function BQ(){let{shell:t}=$Q.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")}Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0&&LQ(`Environment variables for CI detected: ${Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.join(", ")}`);Wr.TERMINAL_INFO=Object.freeze({ci:Wr.CI_ENVIRONMENT_VARIABLES_DETECTED.length>0,shell:BQ(),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 Ki=_(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var hd=(he(),ce(fe));hd.__exportStar(M0(),Pa);hd.__exportStar(eP(),Pa);hd.__exportStar(HP(),Pa);hd.__exportStar(VP(),Pa)});var pd=_(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.isFatal=xn.fatal=xn.FatalException=xn.BaseException=void 0;var dd=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};xn.BaseException=dd;var bc=class extends dd{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};xn.FatalException=bc;function jQ(t){throw new bc(t)}xn.fatal=jQ;function MQ(t){return t&&t instanceof bc}xn.isFatal=MQ});var md=_(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.formatHrTime=Tn.dropWhile=Tn.enforceLF=Tn.identity=void 0;function UQ(t){return t}Tn.identity=UQ;function qQ(t){return t.match(/[\r\n]$/)?t:t+`
80
80
  `}Tn.enforceLF=qQ;function HQ(t,e=r=>!!r){let r=!1;return t.filter(n=>r?!0:e(n)?!1:(r=!0,!0))}Tn.dropWhile=HQ;var zP=["s","ms","\u03BCs"];function VQ(t){let e=t[0]+t[1]/1e9,r=0;for(;r<zP.length-1&&!(e>=1);r++,e*=1e3);return e.toFixed(2)+zP[r]}Tn.formatHrTime=VQ});var _c=_(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});gd.NO_COLORS=void 0;var In=md();gd.NO_COLORS=Object.freeze({strong:In.identity,weak:In.identity,input:In.identity,success:In.identity,failure:In.identity,ancillary:In.identity,log:Object.freeze({DEBUG:In.identity,INFO:In.identity,WARN:In.identity,ERROR:In.identity})})});var tw=_(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.createPrefixedFormatter=Se.createTaggedFormatter=Se.Logger=Se.DEFAULT_LOGGER_HANDLERS=Se.StreamHandler=Se.getLoggerLevelColor=Se.getLoggerLevelName=Se.LOGGER_LEVEL_NAMES=Se.LOGGER_LEVELS=void 0;var zQ=(he(),ce(fe)),KP=Ki(),KQ=require("stream"),GQ=zQ.__importStar(require("util")),WQ=_c(),GP=md();Se.LOGGER_LEVELS=Object.freeze({DEBUG:10,INFO:20,WARN:30,ERROR:40});Se.LOGGER_LEVEL_NAMES=new Map([[Se.LOGGER_LEVELS.DEBUG,"DEBUG"],[Se.LOGGER_LEVELS.INFO,"INFO"],[Se.LOGGER_LEVELS.WARN,"WARN"],[Se.LOGGER_LEVELS.ERROR,"ERROR"]]);function ew(t){if(t){let e=Se.LOGGER_LEVEL_NAMES.get(t);if(e)return e}}Se.getLoggerLevelName=ew;function Z0(t,e){let r=ew(e);if(r)return t.log[r]}Se.getLoggerLevelColor=Z0;var Cc=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,GP.enforceLF)(r))}};Se.StreamHandler=Cc;var XQ=t=>!t.level||t.level===Se.LOGGER_LEVELS.INFO,YQ=t=>!!t.level&&t.level!==Se.LOGGER_LEVELS.INFO;Se.DEFAULT_LOGGER_HANDLERS=new Set([new Cc({stream:process.stdout,filter:XQ}),new Cc({stream:process.stderr,filter:YQ})]);var Q0=class t{constructor({level:e=Se.LOGGER_LEVELS.INFO,handlers:r}={}){this.level=e,this.handlers=r||t.cloneHandlers(Se.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,Se.LOGGER_LEVELS.DEBUG))}info(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.INFO))}warn(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.WARN))}error(e){this.log(this.createRecord(e,Se.LOGGER_LEVELS.ERROR))}createRecord(e,r,n){return{msg:GQ.format(e),level:r,logger:this,format:n}}nl(e=1,r){this.log({...this.createRecord(`
81
81
  `.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 KQ.Writable{_write(i,s,o){n.log(n.createRecord(i.toString(),e,r)),o()}}}};Se.Logger=Q0;function JQ({colors:t=WQ.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=ew(u);if(!c)return"";let l=Z0(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(`
82
- `),f=Z0(t,c),m=(typeof e=="function"?e():e)+a(c),y=n&&d.length>0?`${s(f?f(h):h)}
83
- `:h,v=m?(0,KP.stringWidth)(m)+1:0,E=n?(0,GP.dropWhile)(d,A=>A===""):d;return(m?`${m} `:"")+(i?(0,KP.wordWrap)([y,...E].join(`
82
+ `),f=Z0(t,c),p=(typeof e=="function"?e():e)+a(c),y=n&&d.length>0?`${s(f?f(h):h)}
83
+ `:h,v=p?(0,KP.stringWidth)(p)+1:0,E=n?(0,GP.dropWhile)(d,A=>A===""):d;return(p?`${p} `:"")+(i?(0,KP.wordWrap)([y,...E].join(`
84
84
  `),{indentation:v,...typeof i=="object"?i:{}}):[y,...E.map(A=>A?" ".repeat(v)+A:"")].join(`
85
85
  `))}}Se.createTaggedFormatter=JQ;function ZQ(t){return({msg:e,format:r})=>r===!1?e:`${typeof t=="function"?t():t} ${e}`}Se.createPrefixedFormatter=ZQ});var sw=_(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.TaskChain=Xr.Task=Xr.Spinner=Xr.ICON_FAILURE=Xr.ICON_SUCCESS=void 0;var WP=require("events"),iw=process.platform==="win32";Xr.ICON_SUCCESS=iw?"\u221A":"\u2714";Xr.ICON_FAILURE=iw?"\xD7":"\u2716";var QQ=iw?["-","\\","|","/"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],rw=class{constructor(e=QQ){this.frames=e,this.i=0}frame(){return this.frames[this.i=++this.i%this.frames.length]}};Xr.Spinner=rw;var yd=class extends WP.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}};Xr.Task=yd;var nw=class extends WP.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 yd(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}};Xr.TaskChain=nw});var aw=_(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.TTYOutputRedrawer=Gi.TTYOutputStrategy=Gi.StreamOutputStrategy=void 0;var Dd=Ki(),XP=_c(),Xs=sw(),YP=md(),wd=class{constructor({stream:e=process.stdout,colors:r=XP.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 Xs.TaskChain;return i.on("next",s=>{s.on("end",o=>{o.success?this.write(`${r(Xs.ICON_SUCCESS)} ${s.msg} ${n(`in ${(0,YP.formatHrTime)(o.elapsedTime)}`)}
86
86
  `):this.write(`${e(Xs.ICON_FAILURE)} ${s.msg} ${e(n("- failed!"))}
@@ -136,7 +136,7 @@ Filtered results for: ${this.inputValue?this.inputValue:fi.gray("Enter something
136
136
  `}renderOption(e,r,n){let i;return r.disabled?i=e===n?fi.gray().underline(r.title):fi.strikethrough().gray(r.title):i=e===n?fi.cyan().underline(r.title):r.title,(r.selected?fi.green(ka.radioOn):ka.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[fi.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(fi.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(xte.hide),super.render();let e=[IR.symbol(this.done,this.aborted),fi.bold(this.msg),IR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=fi.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=TR(e,this.out.columns)}};PR.exports=Bw});var jR=_((Hwe,BR)=>{"use strict";var RR=gt(),Ite=ui(),$R=dn(),kR=$R.style,Pte=$R.clear,LR=Ze(),Fte=LR.erase,NR=LR.cursor,Mw=class extends Ite{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(`
137
137
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
138
138
  `),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(NR.hide):this.out.write(Pte(this.outputText,this.out.columns)),super.render(),this.outputText=[kR.symbol(this.done,this.aborted),RR.bold(this.msg),kR.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:RR.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Fte.line+NR.to(0)+this.outputText))}};BR.exports=Mw});var UR=_((Vwe,MR)=>{"use strict";MR.exports={TextPrompt:AF(),SelectPrompt:IF(),TogglePrompt:$F(),DatePrompt:fR(),NumberPrompt:DR(),MultiselectPrompt:kw(),AutocompletePrompt:xR(),AutocompleteMultiselectPrompt:FR(),ConfirmPrompt:jR()}});var HR=_(qR=>{"use strict";var _r=qR,Rte=UR(),Id=t=>t;function Rn(t,e,r={}){return new Promise((n,i)=>{let s=new Rte[t](e),o=r.onAbort||Id,a=r.onSubmit||Id,u=r.onExit||Id;s.on("state",e.onState||Id),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}_r.text=t=>Rn("TextPrompt",t);_r.password=t=>(t.style="password",_r.text(t));_r.invisible=t=>(t.style="invisible",_r.text(t));_r.number=t=>Rn("NumberPrompt",t);_r.date=t=>Rn("DatePrompt",t);_r.confirm=t=>Rn("ConfirmPrompt",t);_r.list=t=>{let e=t.separator||",";return Rn("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};_r.toggle=t=>Rn("TogglePrompt",t);_r.select=t=>Rn("SelectPrompt",t);_r.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return Rn("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 Rn("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var kte=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));_r.autocomplete=t=>(t.suggest=t.suggest||kte,t.choices=[].concat(t.choices||[]),Rn("AutocompletePrompt",t))});var JR=_((Kwe,YR)=>{"use strict";function VR(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 zR(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?VR(Object(r),!0).forEach(function(n){Nte(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):VR(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 $te(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Lte(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.
139
- 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 Lte(t,e){if(t){if(typeof t=="string")return KR(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 KR(t,e)}}function KR(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 GR(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 WR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){GR(s,n,i,o,a,"next",u)}function a(u){GR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Uw=HR(),Bte=["suggest","format","onState","validate","onRender","type"],XR=()=>{};function Xi(){return qw.apply(this,arguments)}function qw(){return qw=WR(function*(t=[],{onSubmit:e=XR,onCancel:r=XR}={}){let n={},i=Xi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var v=WR(function*(E,A,p=!1){if(!(!p&&E.validate&&E.validate(A)!==!0))return E.format?yield E.format(A,n):A});return function(A,p){return v.apply(this,arguments)}})();var d=$te(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,zR({},n),o),o.type=c),!!c){for(let v in o){if(Bte.includes(v))continue;let E=o[v];o[v]=typeof E=="function"?yield E(s,zR({},n),l):E}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var y=o;if(u=y.name,c=y.type,Uw[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=Xi._injected?jte(Xi._injected,o.initial):yield Uw[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(v){d.e(v)}finally{d.f()}return n}),qw.apply(this,arguments)}function jte(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function Mte(t){Xi._injected=(Xi._injected||[]).concat(t)}function Ute(t){Xi._override=Object.assign({},t)}YR.exports=Object.assign(Xi,{prompt:Xi,prompts:Uw,inject:Mte,override:Ute})});var QR=_((Gwe,ZR)=>{"use strict";ZR.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 Pd=_((Wwe,e2)=>{"use strict";e2.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 n2=_((Xwe,r2)=>{"use strict";var qte=Pd(),{erase:t2,cursor:Hte}=Ze(),Vte=t=>[...qte(t)].length;r2.exports=function(t,e){if(!e)return t2.line+Hte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(Vte(i)-1,0)/e);return t2.lines(r)}});var Hw=_((Ywe,i2)=>{"use strict";var Rc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},zte={arrowUp:Rc.arrowUp,arrowDown:Rc.arrowDown,arrowLeft:Rc.arrowLeft,arrowRight:Rc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Kte=process.platform==="win32"?zte:Rc;i2.exports=Kte});var o2=_((Jwe,s2)=>{"use strict";var Na=gt(),Zs=Hw(),Vw=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}`}}),Gte=t=>Vw[t]||Vw.default,kc=Object.freeze({aborted:Na.red(Zs.cross),done:Na.green(Zs.tick),exited:Na.yellow(Zs.cross),default:Na.cyan("?")}),Wte=(t,e,r)=>e?kc.aborted:r?kc.exited:t?kc.done:kc.default,Xte=t=>Na.gray(t?Zs.ellipsis:Zs.pointerSmall),Yte=(t,e)=>Na.gray(t?e?Zs.pointerSmall:"+":Zs.line);s2.exports={styles:Vw,render:Gte,symbols:kc,symbol:Wte,delimiter:Xte,item:Yte}});var u2=_((Zwe,a2)=>{"use strict";var Jte=Pd();a2.exports=function(t,e){let r=String(Jte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var l2=_((Qwe,c2)=>{"use strict";c2.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(`
139
+ 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 Lte(t,e){if(t){if(typeof t=="string")return KR(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 KR(t,e)}}function KR(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 GR(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 WR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){GR(s,n,i,o,a,"next",u)}function a(u){GR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Uw=HR(),Bte=["suggest","format","onState","validate","onRender","type"],XR=()=>{};function Xi(){return qw.apply(this,arguments)}function qw(){return qw=WR(function*(t=[],{onSubmit:e=XR,onCancel:r=XR}={}){let n={},i=Xi._override||{};t=[].concat(t);let s,o,a,u,c,l,h=(function(){var v=WR(function*(E,A,m=!1){if(!(!m&&E.validate&&E.validate(A)!==!0))return E.format?yield E.format(A,n):A});return function(A,m){return v.apply(this,arguments)}})();var d=$te(t),f;try{for(d.s();!(f=d.n()).done;){o=f.value;var p=o;if(u=p.name,c=p.type,typeof c=="function"&&(c=yield c(s,zR({},n),o),o.type=c),!!c){for(let v in o){if(Bte.includes(v))continue;let E=o[v];o[v]=typeof E=="function"?yield E(s,zR({},n),l):E}if(l=o,typeof o.message!="string")throw new Error("prompt message is required");var y=o;if(u=y.name,c=y.type,Uw[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=Xi._injected?jte(Xi._injected,o.initial):yield Uw[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(v){d.e(v)}finally{d.f()}return n}),qw.apply(this,arguments)}function jte(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function Mte(t){Xi._injected=(Xi._injected||[]).concat(t)}function Ute(t){Xi._override=Object.assign({},t)}YR.exports=Object.assign(Xi,{prompt:Xi,prompts:Uw,inject:Mte,override:Ute})});var QR=_((Gwe,ZR)=>{"use strict";ZR.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 Pd=_((Wwe,e2)=>{"use strict";e2.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 n2=_((Xwe,r2)=>{"use strict";var qte=Pd(),{erase:t2,cursor:Hte}=Ze(),Vte=t=>[...qte(t)].length;r2.exports=function(t,e){if(!e)return t2.line+Hte.to(0);let r=0,n=t.split(/\r?\n/);for(let i of n)r+=1+Math.floor(Math.max(Vte(i)-1,0)/e);return t2.lines(r)}});var Hw=_((Ywe,i2)=>{"use strict";var Rc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},zte={arrowUp:Rc.arrowUp,arrowDown:Rc.arrowDown,arrowLeft:Rc.arrowLeft,arrowRight:Rc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Kte=process.platform==="win32"?zte:Rc;i2.exports=Kte});var o2=_((Jwe,s2)=>{"use strict";var Na=gt(),Zs=Hw(),Vw=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}`}}),Gte=t=>Vw[t]||Vw.default,kc=Object.freeze({aborted:Na.red(Zs.cross),done:Na.green(Zs.tick),exited:Na.yellow(Zs.cross),default:Na.cyan("?")}),Wte=(t,e,r)=>e?kc.aborted:r?kc.exited:t?kc.done:kc.default,Xte=t=>Na.gray(t?Zs.ellipsis:Zs.pointerSmall),Yte=(t,e)=>Na.gray(t?e?Zs.pointerSmall:"+":Zs.line);s2.exports={styles:Vw,render:Gte,symbols:kc,symbol:Wte,delimiter:Xte,item:Yte}});var u2=_((Zwe,a2)=>{"use strict";var Jte=Pd();a2.exports=function(t,e){let r=String(Jte(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var l2=_((Qwe,c2)=>{"use strict";c2.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(`
140
140
  `)).join(`
141
141
  `)}});var h2=_((eve,f2)=>{"use strict";f2.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 pn=_((tve,d2)=>{"use strict";d2.exports={action:QR(),clear:n2(),style:o2(),strip:Pd(),figures:Hw(),lines:u2(),wrap:l2(),entriesToDisplay:h2()}});var hi=_((rve,m2)=>{"use strict";var p2=require("readline"),{action:Zte}=pn(),Qte=require("events"),{beep:ere,cursor:tre}=Ze(),rre=gt(),zw=class extends Qte{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=p2.createInterface({input:this.in,escapeCodeTimeout:50});p2.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=Zte(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(tre.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(ere)}render(){this.onRender(rre),this.firstRender&&(this.firstRender=!1)}};m2.exports=zw});var y2=_((nve,g2)=>{var Fd=gt(),nre=hi(),{erase:ire,cursor:Nc}=Ze(),{style:Kw,clear:Gw,lines:sre,figures:ore}=pn(),Ww=class extends nre{constructor(e={}){super(e),this.transform=Kw.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=Gw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Fd.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(`
142
142
  `),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(`
@@ -183,18 +183,18 @@ Instructions:
183
183
  Filtered results for: ${this.inputValue?this.inputValue:pi.gray("Enter something to filter")}
184
184
  `}renderOption(e,r,n){let i;return r.disabled?i=e===n?pi.gray().underline(r.title):pi.strikethrough().gray(r.title):i=e===n?pi.cyan().underline(r.title):r.title,(r.selected?pi.green($a.radioOn):$a.radioOff)+" "+i}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[pi.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&e.push(pi.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Jre.hide),super.render();let e=[fk.symbol(this.done,this.aborted),pi.bold(this.msg),fk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=pi.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=lk(e,this.out.columns)}};hk.exports=gv});var Dk=_((Eve,yk)=>{var pk=gt(),Qre=hi(),{style:mk,clear:ene}=pn(),{erase:tne,cursor:gk}=Ze(),yv=class extends Qre{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(`
185
185
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
186
- `),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(gk.hide):this.out.write(ene(this.outputText,this.out.columns)),super.render(),this.outputText=[mk.symbol(this.done,this.aborted),pk.bold(this.msg),mk.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:pk.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(tne.line+gk.to(0)+this.outputText))}};yk.exports=yv});var vk=_((bve,wk)=>{"use strict";wk.exports={TextPrompt:y2(),SelectPrompt:E2(),TogglePrompt:S2(),DatePrompt:J2(),NumberPrompt:tk(),MultiselectPrompt:hv(),AutocompletePrompt:ck(),AutocompleteMultiselectPrompt:dk(),ConfirmPrompt:Dk()}});var bk=_(Ek=>{"use strict";var Cr=Ek,rne=vk(),Ld=t=>t;function $n(t,e,r={}){return new Promise((n,i)=>{let s=new rne[t](e),o=r.onAbort||Ld,a=r.onSubmit||Ld,u=r.onExit||Ld;s.on("state",e.onState||Ld),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}Cr.text=t=>$n("TextPrompt",t);Cr.password=t=>(t.style="password",Cr.text(t));Cr.invisible=t=>(t.style="invisible",Cr.text(t));Cr.number=t=>$n("NumberPrompt",t);Cr.date=t=>$n("DatePrompt",t);Cr.confirm=t=>$n("ConfirmPrompt",t);Cr.list=t=>{let e=t.separator||",";return $n("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};Cr.toggle=t=>$n("TogglePrompt",t);Cr.select=t=>$n("SelectPrompt",t);Cr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};Cr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var nne=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));Cr.autocomplete=t=>(t.suggest=t.suggest||nne,t.choices=[].concat(t.choices||[]),$n("AutocompletePrompt",t))});var Sk=_((Cve,Ck)=>{"use strict";var Dv=bk(),ine=["suggest","format","onState","validate","onRender","type"],_k=()=>{};async function Ji(t=[],{onSubmit:e=_k,onCancel:r=_k}={}){let n={},i=Ji._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(ine.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,Dv[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=Ji._injected?sne(Ji._injected,o.initial):await Dv[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 sne(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function one(t){Ji._injected=(Ji._injected||[]).concat(t)}function ane(t){Ji._override=Object.assign({},t)}Ck.exports=Object.assign(Ji,{prompt:Ji,prompts:Dv,inject:one,override:ane})});var Bd=_((Sve,Ak)=>{function une(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}Ak.exports=une("8.6.0")?JR():Sk()});var Sc=_(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.logSuccess=Sr.logPrompt=Sr.logger=Sr.output=void 0;var wv=(he(),ce(fe)),Qs=cw(),eo=wv.__importDefault(Aa()),cne=ZP(),Ok={colors:eo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Sr.output=(0,cne.isInteractive)()?new Qs.TTYOutputStrategy(Ok):new Qs.StreamOutputStrategy(Ok);Sr.logger=(0,Qs.createDefaultLogger)({output:Sr.output,formatterOptions:{titleize:!1,tags:new Map([[Qs.LOGGER_LEVELS.DEBUG,eo.default.log.DEBUG("[debug]")],[Qs.LOGGER_LEVELS.INFO,eo.default.log.INFO("[info]")],[Qs.LOGGER_LEVELS.WARN,eo.default.log.WARN("[warn]")],[Qs.LOGGER_LEVELS.ERROR,eo.default.log.ERROR("[error]")]])}});async function lne(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>wv.__importStar(cw())),{prompt:n}=await Promise.resolve().then(()=>wv.__importStar(Bd()));return Sr.logger.log({msg:`${eo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Sr.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Sr.logPrompt=lne;function fne(t){Sr.logger.msg(`${eo.default.success("[success]")} ${t}`)}Sr.logSuccess=fne});var jd=_(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.resolveNode=La.requireTS=void 0;var hne=require("fs"),dne=Sa(),pne=require("path"),mne=(t,e)=>{let r=(0,pne.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,dne.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};La.requireTS=mne;function gne(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,hne.existsSync)(n)?n:null}}La.resolveNode=gne});var Md=_(vv=>{(function(){vv.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:`
187
- `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(vv)});var Ln=_((xk,Zi)=>{(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},Zi.exports.assign=t,Zi.exports.isFunction=i,Zi.exports.isObject=s,Zi.exports.isArray=r,Zi.exports.isEmpty=n,Zi.exports.isPlainObject=o,Zi.exports.getValue=e}).call(xk)});var Ev=_((Tk,Ik)=>{(function(){var t;Ik.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(Tk)});var Rk=_((Pk,Fk)=>{(function(){var t;Fk.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(Pk)});var $k=_((kk,Nk)=>{(function(){var t;Nk.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(kk)});var jk=_((Lk,Bk)=>{(function(){var t,e,r;e=Rk(),r=$k(),Bk.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(Lk)});var Ot=_((Mk,Uk)=>{(function(){Uk.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(Mk)});var bv=_((qk,Hk)=>{(function(){var t,e,r;t=Ot(),r=kr(),Hk.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(qk)});var Ud=_((Vk,zk)=>{(function(){var t;zk.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(Vk)});var qd=_((Kk,Gk)=>{(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=Ln(),a=u.isObject,o=u.isFunction,s=u.getValue,i=kr(),t=Ot(),e=bv(),n=Ud(),Gk.exports=r=(function(h){c(d,h);function d(f,m,y){var v,E,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,E=0,A=p.length;E<A;E++)if(v=p[E],v.type===t.DocType){v.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,v;y=Object.create(this),y.isRoot&&(y.documentObject=null),y.attribs={},v=this.attribs;for(m in v)l.call(v,m)&&(f=v[m],y.attribs[m]=f.clone());return y.children=[],this.children.forEach(function(E){var A;return A=E.clone(),A.parent=y,y.children.push(A)}),y},d.prototype.attribute=function(f,m){var y,v;if(f!=null&&(f=s(f)),a(f))for(y in f)l.call(f,y)&&(v=f[y],this.attribute(y,v));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,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(y=0,v=f.length;y<v;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,v;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,v=this.attribs.length-1;0<=v?y<=v:y>=v;m=0<=v?++y:--y)if(!this.attribs[m].isEqualNode(f.attribs[m]))return!1;return!0},d})(i)}).call(Kk)});var Lc=_((Wk,Xk)=>{(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=kr(),Xk.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(Wk)});var Hd=_((Yk,Jk)=>{(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=Ot(),r=Lc(),Jk.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(Yk)});var Vd=_((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=Ot(),e=Lc(),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 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(Zk)});var zd=_((eN,tN)=>{(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=Ln().isObject,r=kr(),t=Ot(),tN.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(eN)});var Kd=_((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;r=kr(),t=Ot(),nN.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(rN)});var Gd=_((iN,sN)=>{(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=Ln().isObject,r=kr(),t=Ot(),sN.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(iN)});var Wd=_((oN,aN)=>{(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=kr(),t=Ot(),aN.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(oN)});var Xd=_((uN,cN)=>{(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=kr(),t=Ot(),cN.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(uN)});var Yd=_((lN,fN)=>{(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=Ln().isObject,a=kr(),t=Ot(),e=Kd(),n=Gd(),r=Wd(),i=Xd(),o=Ud(),fN.exports=s=(function(h){c(d,h);function d(f,m,y){var v,E,A,p,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(p=f.children,E=0,A=p.length;E<A;E++)if(v=p[E],v.type===t.Element){this.name=v.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,v,E;for(v={},E=this.children,m=0,y=E.length;m<y;m++)f=E[m],f.type===t.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,m,y,v,E;for(v={},E=this.children,m=0,y=E.length;m<y;m++)f=E[m],f.type===t.NotationDeclaration&&(v[f.name]=f);return new o(v)}}),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,v,E){var A;return A=new e(this,f,m,y,v,E),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,v,E){return this.attList(f,m,y,v,E)},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(lN)});var Jd=_((hN,dN)=>{(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=Ot(),e=kr(),dN.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(hN)});var Zd=_((pN,mN)=>{(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=Ot(),e=Lc(),mN.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(pN)});var Qd=_((gN,yN)=>{(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=Ot(),e=Lc(),yN.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(gN)});var _v=_((DN,wN)=>{(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=kr(),t=Ot(),wN.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(DN)});var bN=_((vN,EN)=>{(function(){var t;EN.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(vN)});var SN=_((_N,CN)=>{(function(){CN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(_N)});var kr=_((AN,ON)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p={}.hasOwnProperty;A=Ln(),E=A.isObject,v=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,ON.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=qd(),r=Hd(),n=Vd(),i=zd(),s=Yd(),d=Jd(),f=Zd(),h=Qd(),o=_v(),e=Ot(),l=bN(),u=Ud(),t=SN())}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,C,F,b,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",b=this.children,C=0,F=b.length;C<F;C++)w=b[C],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 C,F,b,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],F=0,b=k.length;F<b;F++)C=k[F],R.push(C.setParent(this));return R},D.prototype.element=function(w,C,F){var b,k,R,I,B,j,z,L,S,T,P;if(j=null,C===null&&F==null&&(S=[{},null],C=S[0],F=S[1]),C==null&&(C={}),C=m(C),E(C)||(T=[C,F],F=T[0],C=T[1]),w!=null&&(w=m(w)),Array.isArray(w))for(R=0,z=w.length;R<z;R++)k=w[R],j=this.element(k);else if(v(w))j=this.element(w.apply());else if(E(w)){for(B in w)if(p.call(w,B))if(P=w[B],v(P)&&(P=P.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)j=this.attribute(B.substr(this.stringify.convertAttKey.length),P);else if(!this.options.separateArrayItems&&Array.isArray(P)&&y(P))j=this.dummy();else if(E(P)&&y(P))j=this.element(B);else if(!this.options.keepNullNodes&&P==null)j=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(P))for(I=0,L=P.length;I<L;I++)k=P[I],b={},b[B]=k,j=this.element(b);else E(P)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?j=this.element(P):(j=this.element(B),j.element(P)):j=this.element(B,P)}else!this.options.keepNullNodes&&F===null?j=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?j=this.text(F):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?j=this.cdata(F):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?j=this.comment(F):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?j=this.raw(F):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?j=this.instruction(w.substr(this.stringify.convertPIKey.length),F):j=this.node(w,C,F);if(j==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return j},D.prototype.insertBefore=function(w,C,F){var b,k,R,I,B;if(w?.type)return R=w,I=C,R.setParent(this),I?(k=children.indexOf(I),B=children.splice(k),children.push(R),Array.prototype.push.apply(children,B)):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),B=this.parent.children.splice(k),b=this.parent.element(w,C,F),Array.prototype.push.apply(this.parent.children,B),b},D.prototype.insertAfter=function(w,C,F){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,C,F),Array.prototype.push.apply(this.parent.children,R),b},D.prototype.remove=function(){var w,C;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(C=[])),this.parent},D.prototype.node=function(w,C,F){var b,k;return w!=null&&(w=m(w)),C||(C={}),C=m(C),E(C)||(k=[C,F],F=k[0],C=k[1]),b=new a(this,w,C),F!=null&&b.text(F),this.children.push(b),b},D.prototype.text=function(w){var C;return E(w)&&this.element(w),C=new f(this,w),this.children.push(C),this},D.prototype.cdata=function(w){var C;return C=new r(this,w),this.children.push(C),this},D.prototype.comment=function(w){var C;return C=new n(this,w),this.children.push(C),this},D.prototype.commentBefore=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.commentAfter=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F+1),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.raw=function(w){var C;return C=new d(this,w),this.children.push(C),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,C){var F,b,k,R,I;if(w!=null&&(w=m(w)),C!=null&&(C=m(C)),Array.isArray(w))for(R=0,I=w.length;R<I;R++)F=w[R],this.instruction(F);else if(E(w))for(F in w)p.call(w,F)&&(b=w[F],this.instruction(F,b));else v(C)&&(C=C.apply()),k=new h(this,w,C),this.children.push(k);return this},D.prototype.instructionBefore=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b+1),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,C,F){var b,k;return b=this.document(),k=new i(b,w,C,F),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,C){var F,b,k,R,I,B,j,z,L,S;for(b=this.document(),k=new s(b,w,C),L=b.children,R=I=0,j=L.length;I<j;R=++I)if(F=L[R],F.type===e.DocType)return b.children[R]=k,k;for(S=b.children,R=B=0,z=S.length;B<z;R=++B)if(F=S[R],F.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 C;return C=w.root().clone(),C.parent=this,C.isRoot=!1,this.children.push(C),this},D.prototype.debugInfo=function(w){var C,F;return w=w||this.name,w==null&&!((C=this.parent)!=null&&C.name)?"":w==null?"parent: <"+this.parent.name+">":(F=this.parent)!=null&&F.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,C,F){return this.element(w,C,F)},D.prototype.nod=function(w,C,F){return this.node(w,C,F)},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,C){return this.instruction(w,C)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,C,F){return this.declaration(w,C,F)},D.prototype.e=function(w,C,F){return this.element(w,C,F)},D.prototype.n=function(w,C,F){return this.node(w,C,F)},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,C){return this.instruction(w,C)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,C){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,C){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var C,F;return C=this,C===w?0:this.document()!==w.document()?(F=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?F|=t.Preceding:F|=t.Following,F):C.isAncestor(w)?t.Contains|t.Preceding:C.isDescendant(w)?t.Contains|t.Following:C.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 C,F,b;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(C=F=0,b=this.children.length-1;0<=b?F<=b:F>=b;C=0<=b?++F:--F)if(!this.children[C].isEqualNode(w.children[C]))return!1;return!0},D.prototype.getFeature=function(w,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,C,F){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 C,F,b,k,R;for(R=this.children,b=0,k=R.length;b<k;b++)if(C=R[b],w===C||(F=C.isDescendant(w),F))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C<F},D.prototype.isFollowing=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C>F},D.prototype.treePosition=function(w){var C,F;return F=0,C=!1,this.foreachTreeNode(this.document(),function(b){if(F++,!C&&b===w)return C=!0}),C?F:-1},D.prototype.foreachTreeNode=function(w,C){var F,b,k,R,I;for(w||(w=this.document()),R=w.children,b=0,k=R.length;b<k;b++){if(F=R[b],I=C(F))return I;if(I=this.foreachTreeNode(F,C),I)return I}},D})()}).call(AN)});var Cv=_((xN,TN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;TN.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(xN)});var Bc=_((IN,PN)=>{(function(){PN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(IN)});var Sv=_((FN,RN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E={}.hasOwnProperty;v=Ln().assign,t=Ot(),u=zd(),c=Yd(),r=Hd(),n=Vd(),h=qd(),f=Jd(),m=Zd(),d=Qd(),l=_v(),i=Kd(),s=Wd(),o=Gd(),a=Xd(),e=Bc(),RN.exports=y=(function(){function A(p){var D,w,C;p||(p={}),this.options=p,w=p.writer||{};for(D in w)E.call(w,D)&&(C=w[D],this["_"+D]=this[D],this[D]=C)}return A.prototype.filterOptions=function(p){var D,w,C,F,b,k,R,I;return p||(p={}),p=v({},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=(C=p.newline)!=null?C:`
188
- `,D.offset=(F=p.offset)!=null?F: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 C;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(C=(w||0)+D.offset+1,C>0)?new Array(C).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 C;return this.openAttribute(p,D,w),C=" "+p.name+'="'+p.value+'"',this.closeAttribute(p,D,w),C},A.prototype.cdata=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<![CDATA[",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+="]]>"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.comment=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!-- ",D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=" -->"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.declaration=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?xml",D.state=e.InsideTag,C+=' version="'+p.version+'"',p.encoding!=null&&(C+=' encoding="'+p.encoding+'"'),p.standalone!=null&&(C+=' standalone="'+p.standalone+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.docType=function(p,D,w){var C,F,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,F=0,b=R.length;F<b;F++)C=R[F],k+=this.writeChildNode(C,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 C,F,b,k,R,I,B,j,z,L,S,T,P,$;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(z in T)E.call(T,z)&&(C=T[z],S+=this.attribute(C,D,w));if(b=p.children.length,k=b===0?null:p.children[0],b===0||p.children.every(function(q){return(q.type===t.Text||q.type===t.Raw)&&q.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(P=p.children,R=0,B=P.length;R<B;R++)if(F=P[R],(F.type===t.Text||F.type===t.Raw)&&F.value!=null){D.suppressPrettyCount++,L=!0;break}}for(S+=">"+this.endline(p,D,w),D.state=e.InsideTag,$=p.children,I=0,j=$.length;I<j;I++)F=$[I],S+=this.writeChildNode(F,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 C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<?",D.state=e.InsideTag,C+=p.target,p.value&&(C+=" "+p.value),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.raw=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.text=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w),D.state=e.InsideTag,C+=p.value,D.state=e.CloseTag,C+=this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdAttList=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ATTLIST",D.state=e.InsideTag,C+=" "+p.elementName+" "+p.attributeName+" "+p.attributeType,p.defaultValueType!=="#DEFAULT"&&(C+=" "+p.defaultValueType),p.defaultValue&&(C+=' "'+p.defaultValue+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdElement=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ELEMENT",D.state=e.InsideTag,C+=" "+p.name+" "+p.value,D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdEntity=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!ENTITY",D.state=e.InsideTag,p.pe&&(C+=" %"),C+=" "+p.name,p.value?C+=' "'+p.value+'"':(p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),p.nData&&(C+=" NDATA "+p.nData)),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},A.prototype.dtdNotation=function(p,D,w){var C;return this.openNode(p,D,w),D.state=e.OpenTag,C=this.indent(p,D,w)+"<!NOTATION",D.state=e.InsideTag,C+=" "+p.name,p.pubID&&p.sysID?C+=' PUBLIC "'+p.pubID+'" "'+p.sysID+'"':p.pubID?C+=' PUBLIC "'+p.pubID+'"':p.sysID&&(C+=' SYSTEM "'+p.sysID+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(p,D,w),D.state=e.None,this.closeNode(p,D,w),C},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(FN)});var ep=_((kN,NN)=>{(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=Sv(),NN.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(kN)});var Av=_(($N,LN)=>{(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=Ln().isPlainObject,r=Ev(),e=jk(),i=kr(),t=Ot(),o=Cv(),s=ep(),LN.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($N)});var MN=_((BN,jN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p,D,w,C,F,b={}.hasOwnProperty;F=Ln(),w=F.isObject,D=F.isFunction,C=F.isPlainObject,p=F.getValue,t=Ot(),h=Av(),f=qd(),n=Hd(),i=Vd(),y=Jd(),A=Zd(),m=Qd(),c=zd(),l=Yd(),s=Kd(),a=Gd(),o=Wd(),u=Xd(),r=bv(),E=Cv(),v=ep(),e=Bc(),jN.exports=d=(function(){function k(R,I,B){var j;this.name="?xml",this.type=t.Document,R||(R={}),j={},R.writer?C(R.writer)&&(j=R.writer,R.writer=new v):R.writer=new v,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(j),this.stringify=new E(R),this.onDataCallback=I||function(){},this.onEndCallback=B||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,B,j,z,L,S,T,P;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:j={},T=R.attribs;for(B in T)b.call(T,B)&&(I=T[B],j[B]=I.value);this.node(R.name,j);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(P=R.children,L=0,S=P.length;L<S;L++)z=P[L],this.createChildNode(z),z.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,B){var j;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)||(j=[I,B],B=j[0],I=j[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,B!=null&&this.text(B),this},k.prototype.element=function(R,I,B){var j,z,L,S,T,P;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,P=new h(this.options).element("TEMP_ROOT"),P.element(R),this.options.noValidation=S,T=P.children,z=0,L=T.length;z<L;z++)j=T[z],this.createChildNode(j),j.type===t.Element&&this.up();else this.node(R,I,B);return this},k.prototype.attribute=function(R,I){var B,j;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(B in R)b.call(R,B)&&(j=R[B],this.attribute(B,j));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 B,j,z,L,S;if(this.openCurrent(),R!=null&&(R=p(R)),I!=null&&(I=p(I)),Array.isArray(R))for(B=0,L=R.length;B<L;B++)j=R[B],this.instruction(j);else if(w(R))for(j in R)b.call(R,j)&&(z=R[j],this.instruction(j,z));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,B){var j;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return j=new c(this,R,I,B),this.onData(this.writer.declaration(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,B){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,B),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var B;return this.openCurrent(),B=new o(this,R,I),this.onData(this.writer.dtdElement(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,B,j,z){var L;return this.openCurrent(),L=new s(this,R,I,B,j,z),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var B;return this.openCurrent(),B=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var B;return this.openCurrent(),B=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var B;return this.openCurrent(),B=new u(this,R,I),this.onData(this.writer.dtdNotation(B,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,B,j,z;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),B="",R.type===t.Element){this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,z=R.attribs;for(j in z)b.call(z,j)&&(I=z[j],B+=this.writer.attribute(I,this.writerOptions,this.currentLevel));B+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?B+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(B+=' SYSTEM "'+R.sysID+'"'),R.children?(B+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,B+=">"),B+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(B,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,B){return this.node(R,I,B)},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,B){return this.declaration(R,I,B)},k.prototype.dtd=function(R,I,B){return this.doctype(R,I,B)},k.prototype.e=function(R,I,B){return this.element(R,I,B)},k.prototype.n=function(R,I,B){return this.node(R,I,B)},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(BN)});var HN=_((UN,qN)=>{(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=Ot(),n=Sv(),e=Bc(),qN.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,v,E,A;for(v=u.children,h=d=0,m=v.length;d<m;h=++d)l=v[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),E=u.children,A=[],f=0,y=E.length;f<y;f++)l=E[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,v,E,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(E in p)s.call(p,E)&&(h=p[E],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,v=D.length;y<v;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(UN)});var zN=_((VN,Qi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Ln(),a=c.assign,u=c.isFunction,r=Ev(),n=Av(),i=MN(),o=ep(),s=HN(),t=Ot(),e=Bc(),Qi.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},Qi.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)},Qi.exports.stringWriter=function(l){return new o(l)},Qi.exports.streamWriter=function(l,h){return new s(l,h)},Qi.exports.implementation=new r,Qi.exports.nodeType=t,Qi.exports.writerState=e}).call(VN)});var KN=_(Ov=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=zN(),e=Md().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[>")},Ov.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 v,E,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)){E=y[p];for(D in E)A=E[D],m=l(m.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(E=y[D],D===u){if(typeof E=="object")for(v in E)w=E[v],m=m.att(v,w)}else if(D===c)f.options.cdata&&n(E)?m=m.raw(i(E)):m=m.txt(E);else if(Array.isArray(E))for(p in E)s.call(E,p)&&(A=E[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 E=="object"?m=l(m.ele(D),E).up():typeof E=="string"&&f.options.cdata&&n(E)?m=m.ele(D).raw(i(E)).up():(E==null&&(E=""),m=m.ele(D,E.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(Ov)});var GN=_(tp=>{(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 V=this;i(V),V.q=V.c="",V.bufferCheckPosition=t.MAX_BUFFER_LENGTH,V.opt=O||{},V.opt.lowercase=V.opt.lowercase||V.opt.lowercasetags,V.looseCase=V.opt.lowercase?"toLowerCase":"toUpperCase",V.tags=[],V.closed=V.closedRoot=V.sawRoot=!1,V.tag=V.error=null,V.strict=!!x,V.noscript=!!(x||V.opt.noscript),V.state=b.BEGIN,V.strictEntities=V.opt.strictEntities,V.ENTITIES=V.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),V.attribList=[],V.opt.xmlns&&(V.ns=Object.create(m)),V.opt.unquotedAttributeValues===void 0&&(V.opt.unquotedAttributeValues=!x),V.trackPosition=V.opt.position!==!1,V.trackPosition&&(V.position=V.line=V.column=0),R(V,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var V=new O;return V}),Object.keys||(Object.keys=function(x){var O=[];for(var V in x)x.hasOwnProperty(V)&&O.push(V);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),V=0,N=0,ne=e.length;N<ne;N++){var K=x[e[N]].length;if(K>O)switch(e[N]){case"textNode":B(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:z(x,"Max buffer length exceeded: "+e[N])}V=Math.max(V,K)}var oe=t.MAX_BUFFER_LENGTH-V;x.bufferCheckPosition=oe+x.position}function i(x){for(var O=0,V=e.length;O<V;O++)x[e[O]]=""}function s(x){B(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:te,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 V=this;this._parser.onend=function(){V.emit("end")},this._parser.onerror=function(N){V.emit("error",N),V._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(V,"on"+N,{get:function(){return V._parser["on"+N]},set:function(ne){if(!ne)return V.removeAllListeners(N),V._parser["on"+N]=ne,ne;V.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 V=this;return!V._parser["on"+x]&&a.indexOf(x)!==-1&&(V._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),V.emit.apply(V,N)}),o.prototype.on.call(V,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]/,v=/[:_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-]/,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]/,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===`
189
- `||x==="\r"||x===" "}function D(x){return x==='"'||x==="'"}function w(x){return x===">"||p(x)}function C(x,O){return x.test(O)}function F(x,O){return!C(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],V=typeof O=="number"?String.fromCharCode(O):O;t.ENTITIES[x]=V});for(var k in t.STATE)t.STATE[t.STATE[k]]=k;b=t.STATE;function R(x,O,V){x[O]&&x[O](V)}function I(x,O,V){x.textNode&&B(x),R(x,O,V)}function B(x){x.textNode=j(x.opt,x.textNode),x.textNode&&R(x,"ontext",x.textNode),x.textNode=""}function j(x,O){return x.trim&&(O=O.trim()),x.normalize&&(O=O.replace(/\s+/g," ")),O}function z(x,O){return B(x),x.trackPosition&&(O+=`
186
+ `),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(gk.hide):this.out.write(ene(this.outputText,this.out.columns)),super.render(),this.outputText=[mk.symbol(this.done,this.aborted),pk.bold(this.msg),mk.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:pk.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(tne.line+gk.to(0)+this.outputText))}};yk.exports=yv});var vk=_((bve,wk)=>{"use strict";wk.exports={TextPrompt:y2(),SelectPrompt:E2(),TogglePrompt:S2(),DatePrompt:J2(),NumberPrompt:tk(),MultiselectPrompt:hv(),AutocompletePrompt:ck(),AutocompleteMultiselectPrompt:dk(),ConfirmPrompt:Dk()}});var bk=_(Ek=>{"use strict";var Cr=Ek,rne=vk(),Ld=t=>t;function $n(t,e,r={}){return new Promise((n,i)=>{let s=new rne[t](e),o=r.onAbort||Ld,a=r.onSubmit||Ld,u=r.onExit||Ld;s.on("state",e.onState||Ld),s.on("submit",c=>n(a(c))),s.on("exit",c=>n(u(c))),s.on("abort",c=>i(o(c)))})}Cr.text=t=>$n("TextPrompt",t);Cr.password=t=>(t.style="password",Cr.text(t));Cr.invisible=t=>(t.style="invisible",Cr.text(t));Cr.number=t=>$n("NumberPrompt",t);Cr.date=t=>$n("DatePrompt",t);Cr.confirm=t=>$n("ConfirmPrompt",t);Cr.list=t=>{let e=t.separator||",";return $n("TextPrompt",t,{onSubmit:r=>r.split(e).map(n=>n.trim())})};Cr.toggle=t=>$n("TogglePrompt",t);Cr.select=t=>$n("SelectPrompt",t);Cr.multiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("MultiselectPrompt",t,{onAbort:e,onSubmit:e})};Cr.autocompleteMultiselect=t=>{t.choices=[].concat(t.choices||[]);let e=r=>r.filter(n=>n.selected).map(n=>n.value);return $n("AutocompleteMultiselectPrompt",t,{onAbort:e,onSubmit:e})};var nne=(t,e)=>Promise.resolve(e.filter(r=>r.title.slice(0,t.length).toLowerCase()===t.toLowerCase()));Cr.autocomplete=t=>(t.suggest=t.suggest||nne,t.choices=[].concat(t.choices||[]),$n("AutocompletePrompt",t))});var Sk=_((Cve,Ck)=>{"use strict";var Dv=bk(),ine=["suggest","format","onState","validate","onRender","type"],_k=()=>{};async function Ji(t=[],{onSubmit:e=_k,onCancel:r=_k}={}){let n={},i=Ji._override||{};t=[].concat(t);let s,o,a,u,c,l,h=async(d,f,p=!1)=>{if(!(!p&&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(ine.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,Dv[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=Ji._injected?sne(Ji._injected,o.initial):await Dv[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 sne(t,e){let r=t.shift();if(r instanceof Error)throw r;return r===void 0?e:r}function one(t){Ji._injected=(Ji._injected||[]).concat(t)}function ane(t){Ji._override=Object.assign({},t)}Ck.exports=Object.assign(Ji,{prompt:Ji,prompts:Dv,inject:one,override:ane})});var Bd=_((Sve,Ak)=>{function une(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}Ak.exports=une("8.6.0")?JR():Sk()});var Sc=_(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.logSuccess=Sr.logPrompt=Sr.logger=Sr.output=void 0;var wv=(he(),ce(fe)),Qs=cw(),eo=wv.__importDefault(Aa()),cne=ZP(),Ok={colors:eo.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Sr.output=(0,cne.isInteractive)()?new Qs.TTYOutputStrategy(Ok):new Qs.StreamOutputStrategy(Ok);Sr.logger=(0,Qs.createDefaultLogger)({output:Sr.output,formatterOptions:{titleize:!1,tags:new Map([[Qs.LOGGER_LEVELS.DEBUG,eo.default.log.DEBUG("[debug]")],[Qs.LOGGER_LEVELS.INFO,eo.default.log.INFO("[info]")],[Qs.LOGGER_LEVELS.WARN,eo.default.log.WARN("[warn]")],[Qs.LOGGER_LEVELS.ERROR,eo.default.log.ERROR("[error]")]])}});async function lne(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>wv.__importStar(cw())),{prompt:n}=await Promise.resolve().then(()=>wv.__importStar(Bd()));return Sr.logger.log({msg:`${eo.default.input("[?]")} ${r(t,{indentation:4})}`,logger:Sr.logger,format:!1}),n(e,{onCancel:()=>process.exit(1)})}Sr.logPrompt=lne;function fne(t){Sr.logger.msg(`${eo.default.success("[success]")} ${t}`)}Sr.logSuccess=fne});var jd=_(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});La.resolveNode=La.requireTS=void 0;var hne=require("fs"),dne=Sa(),pne=require("path"),mne=(t,e)=>{let r=(0,pne.resolve)(e);delete require.cache[r],require.extensions[".ts"]=(i,s)=>{var o;let a=(0,dne.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};La.requireTS=mne;function gne(t,...e){try{return require.resolve(e.join("/"),{paths:[t]})}catch{let n=[t,"node_modules",...e].join("/");return(0,hne.existsSync)(n)?n:null}}La.resolveNode=gne});var Md=_(vv=>{(function(){vv.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:`
187
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(vv)});var Ln=_((xk,Zi)=>{(function(){var t,e,r,n,i,s,o,a=[].slice,u={}.hasOwnProperty;t=function(){var c,l,h,d,f,p;if(p=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)&&(p[l]=d[l]);return p},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},Zi.exports.assign=t,Zi.exports.isFunction=i,Zi.exports.isObject=s,Zi.exports.isArray=r,Zi.exports.isEmpty=n,Zi.exports.isPlainObject=o,Zi.exports.getValue=e}).call(xk)});var Ev=_((Tk,Ik)=>{(function(){var t;Ik.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(Tk)});var Rk=_((Pk,Fk)=>{(function(){var t;Fk.exports=t=(function(){function e(){}return e.prototype.handleError=function(r){throw new Error(r)},e})()}).call(Pk)});var $k=_((kk,Nk)=>{(function(){var t;Nk.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(kk)});var jk=_((Lk,Bk)=>{(function(){var t,e,r;e=Rk(),r=$k(),Bk.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(Lk)});var Ot=_((Mk,Uk)=>{(function(){Uk.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(Mk)});var bv=_((qk,Hk)=>{(function(){var t,e,r;t=Ot(),r=kr(),Hk.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(qk)});var Ud=_((Vk,zk)=>{(function(){var t;zk.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(Vk)});var qd=_((Kk,Gk)=>{(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 p(){this.constructor=h}return p.prototype=d.prototype,h.prototype=new p,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Ln(),a=u.isObject,o=u.isFunction,s=u.getValue,i=kr(),t=Ot(),e=bv(),n=Ud(),Gk.exports=r=(function(h){c(d,h);function d(f,p,y){var v,E,A,m;if(d.__super__.constructor.call(this,f),p==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(p),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(m=f.children,E=0,A=m.length;E<A;E++)if(v=m[E],v.type===t.DocType){v.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,p,y,v;y=Object.create(this),y.isRoot&&(y.documentObject=null),y.attribs={},v=this.attribs;for(p in v)l.call(v,p)&&(f=v[p],y.attribs[p]=f.clone());return y.children=[],this.children.forEach(function(E){var A;return A=E.clone(),A.parent=y,y.children.push(A)}),y},d.prototype.attribute=function(f,p){var y,v;if(f!=null&&(f=s(f)),a(f))for(y in f)l.call(f,y)&&(v=f[y],this.attribute(y,v));else o(p)&&(p=p.apply()),this.options.keepNullAttributes&&p==null?this.attribs[f]=new e(this,f,""):p!=null&&(this.attribs[f]=new e(this,f,p));return this},d.prototype.removeAttribute=function(f){var p,y,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(y=0,v=f.length;y<v;y++)p=f[y],delete this.attribs[p];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,p){return this.attribute(f,p)},d.prototype.a=function(f,p){return this.attribute(f,p)},d.prototype.getAttribute=function(f){return this.attribs.hasOwnProperty(f)?this.attribs[f].value:null},d.prototype.setAttribute=function(f,p){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,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setAttributeNS=function(f,p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.removeAttributeNS=function(f,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getAttributeNodeNS=function(f,p){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,p){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,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttribute=function(f,p){return this.attribs.hasOwnProperty(f)?this.attribs[f].isId:p},d.prototype.setIdAttributeNS=function(f,p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.setIdAttributeNode=function(f,p){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,p){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 p,y,v;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(p=y=0,v=this.attribs.length-1;0<=v?y<=v:y>=v;p=0<=v?++y:--y)if(!this.attribs[p].isEqualNode(f.attribs[p]))return!1;return!0},d})(i)}).call(Kk)});var Lc=_((Wk,Xk)=>{(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=kr(),Xk.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(Wk)});var Hd=_((Yk,Jk)=>{(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=Ot(),r=Lc(),Jk.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(Yk)});var Vd=_((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=Ot(),e=Lc(),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 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(Zk)});var zd=_((eN,tN)=>{(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=Ln().isObject,r=kr(),t=Ot(),tN.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(eN)});var Kd=_((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;r=kr(),t=Ot(),nN.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(rN)});var Gd=_((iN,sN)=>{(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=Ln().isObject,r=kr(),t=Ot(),sN.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(iN)});var Wd=_((oN,aN)=>{(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=kr(),t=Ot(),aN.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(oN)});var Xd=_((uN,cN)=>{(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=kr(),t=Ot(),cN.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(uN)});var Yd=_((lN,fN)=>{(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 p(){this.constructor=h}return p.prototype=d.prototype,h.prototype=new p,h.__super__=d.prototype,h},l={}.hasOwnProperty;u=Ln().isObject,a=kr(),t=Ot(),e=Kd(),n=Gd(),r=Wd(),i=Xd(),o=Ud(),fN.exports=s=(function(h){c(d,h);function d(f,p,y){var v,E,A,m,D,w;if(d.__super__.constructor.call(this,f),this.type=t.DocType,f.children){for(m=f.children,E=0,A=m.length;E<A;E++)if(v=m[E],v.type===t.Element){this.name=v.name;break}}this.documentObject=f,u(p)&&(D=p,p=D.pubID,y=D.sysID),y==null&&(w=[p,y],y=w[0],p=w[1]),p!=null&&(this.pubID=this.stringify.dtdPubID(p)),y!=null&&(this.sysID=this.stringify.dtdSysID(y))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,p,y,v,E;for(v={},E=this.children,p=0,y=E.length;p<y;p++)f=E[p],f.type===t.EntityDeclaration&&!f.pe&&(v[f.name]=f);return new o(v)}}),Object.defineProperty(d.prototype,"notations",{get:function(){var f,p,y,v,E;for(v={},E=this.children,p=0,y=E.length;p<y;p++)f=E[p],f.type===t.NotationDeclaration&&(v[f.name]=f);return new o(v)}}),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,p){var y;return y=new r(this,f,p),this.children.push(y),this},d.prototype.attList=function(f,p,y,v,E){var A;return A=new e(this,f,p,y,v,E),this.children.push(A),this},d.prototype.entity=function(f,p){var y;return y=new n(this,!1,f,p),this.children.push(y),this},d.prototype.pEntity=function(f,p){var y;return y=new n(this,!0,f,p),this.children.push(y),this},d.prototype.notation=function(f,p){var y;return y=new i(this,f,p),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,p){return this.element(f,p)},d.prototype.att=function(f,p,y,v,E){return this.attList(f,p,y,v,E)},d.prototype.ent=function(f,p){return this.entity(f,p)},d.prototype.pent=function(f,p){return this.pEntity(f,p)},d.prototype.not=function(f,p){return this.notation(f,p)},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(lN)});var Jd=_((hN,dN)=>{(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=Ot(),e=kr(),dN.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(hN)});var Zd=_((pN,mN)=>{(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=Ot(),e=Lc(),mN.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(pN)});var Qd=_((gN,yN)=>{(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=Ot(),e=Lc(),yN.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(gN)});var _v=_((DN,wN)=>{(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=kr(),t=Ot(),wN.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(DN)});var bN=_((vN,EN)=>{(function(){var t;EN.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(vN)});var SN=_((_N,CN)=>{(function(){CN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(_N)});var kr=_((AN,ON)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,p,y,v,E,A,m={}.hasOwnProperty;A=Ln(),E=A.isObject,v=A.isFunction,y=A.isEmpty,p=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,ON.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=qd(),r=Hd(),n=Vd(),i=zd(),s=Yd(),d=Jd(),f=Zd(),h=Qd(),o=_v(),e=Ot(),l=bN(),u=Ud(),t=SN())}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,C,F,b,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",b=this.children,C=0,F=b.length;C<F;C++)w=b[C],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 C,F,b,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],F=0,b=k.length;F<b;F++)C=k[F],R.push(C.setParent(this));return R},D.prototype.element=function(w,C,F){var b,k,R,I,B,j,z,L,S,T,P;if(j=null,C===null&&F==null&&(S=[{},null],C=S[0],F=S[1]),C==null&&(C={}),C=p(C),E(C)||(T=[C,F],F=T[0],C=T[1]),w!=null&&(w=p(w)),Array.isArray(w))for(R=0,z=w.length;R<z;R++)k=w[R],j=this.element(k);else if(v(w))j=this.element(w.apply());else if(E(w)){for(B in w)if(m.call(w,B))if(P=w[B],v(P)&&(P=P.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)j=this.attribute(B.substr(this.stringify.convertAttKey.length),P);else if(!this.options.separateArrayItems&&Array.isArray(P)&&y(P))j=this.dummy();else if(E(P)&&y(P))j=this.element(B);else if(!this.options.keepNullNodes&&P==null)j=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(P))for(I=0,L=P.length;I<L;I++)k=P[I],b={},b[B]=k,j=this.element(b);else E(P)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?j=this.element(P):(j=this.element(B),j.element(P)):j=this.element(B,P)}else!this.options.keepNullNodes&&F===null?j=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&w.indexOf(this.stringify.convertTextKey)===0?j=this.text(F):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&w.indexOf(this.stringify.convertCDataKey)===0?j=this.cdata(F):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&w.indexOf(this.stringify.convertCommentKey)===0?j=this.comment(F):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&w.indexOf(this.stringify.convertRawKey)===0?j=this.raw(F):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&w.indexOf(this.stringify.convertPIKey)===0?j=this.instruction(w.substr(this.stringify.convertPIKey.length),F):j=this.node(w,C,F);if(j==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return j},D.prototype.insertBefore=function(w,C,F){var b,k,R,I,B;if(w?.type)return R=w,I=C,R.setParent(this),I?(k=children.indexOf(I),B=children.splice(k),children.push(R),Array.prototype.push.apply(children,B)):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),B=this.parent.children.splice(k),b=this.parent.element(w,C,F),Array.prototype.push.apply(this.parent.children,B),b},D.prototype.insertAfter=function(w,C,F){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,C,F),Array.prototype.push.apply(this.parent.children,R),b},D.prototype.remove=function(){var w,C;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(C=[])),this.parent},D.prototype.node=function(w,C,F){var b,k;return w!=null&&(w=p(w)),C||(C={}),C=p(C),E(C)||(k=[C,F],F=k[0],C=k[1]),b=new a(this,w,C),F!=null&&b.text(F),this.children.push(b),b},D.prototype.text=function(w){var C;return E(w)&&this.element(w),C=new f(this,w),this.children.push(C),this},D.prototype.cdata=function(w){var C;return C=new r(this,w),this.children.push(C),this},D.prototype.comment=function(w){var C;return C=new n(this,w),this.children.push(C),this},D.prototype.commentBefore=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.commentAfter=function(w){var C,F,b;return F=this.parent.children.indexOf(this),b=this.parent.children.splice(F+1),C=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,b),this},D.prototype.raw=function(w){var C;return C=new d(this,w),this.children.push(C),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,C){var F,b,k,R,I;if(w!=null&&(w=p(w)),C!=null&&(C=p(C)),Array.isArray(w))for(R=0,I=w.length;R<I;R++)F=w[R],this.instruction(F);else if(E(w))for(F in w)m.call(w,F)&&(b=w[F],this.instruction(F,b));else v(C)&&(C=C.apply()),k=new h(this,w,C),this.children.push(k);return this},D.prototype.instructionBefore=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,C){var F,b,k;return b=this.parent.children.indexOf(this),k=this.parent.children.splice(b+1),F=this.parent.instruction(w,C),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,C,F){var b,k;return b=this.document(),k=new i(b,w,C,F),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,C){var F,b,k,R,I,B,j,z,L,S;for(b=this.document(),k=new s(b,w,C),L=b.children,R=I=0,j=L.length;I<j;R=++I)if(F=L[R],F.type===e.DocType)return b.children[R]=k,k;for(S=b.children,R=B=0,z=S.length;B<z;R=++B)if(F=S[R],F.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 C;return C=w.root().clone(),C.parent=this,C.isRoot=!1,this.children.push(C),this},D.prototype.debugInfo=function(w){var C,F;return w=w||this.name,w==null&&!((C=this.parent)!=null&&C.name)?"":w==null?"parent: <"+this.parent.name+">":(F=this.parent)!=null&&F.name?"node: <"+w+">, parent: <"+this.parent.name+">":"node: <"+w+">"},D.prototype.ele=function(w,C,F){return this.element(w,C,F)},D.prototype.nod=function(w,C,F){return this.node(w,C,F)},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,C){return this.instruction(w,C)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,C,F){return this.declaration(w,C,F)},D.prototype.e=function(w,C,F){return this.element(w,C,F)},D.prototype.n=function(w,C,F){return this.node(w,C,F)},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,C){return this.instruction(w,C)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,C){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,C){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var C,F;return C=this,C===w?0:this.document()!==w.document()?(F=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?F|=t.Preceding:F|=t.Following,F):C.isAncestor(w)?t.Contains|t.Preceding:C.isDescendant(w)?t.Contains|t.Following:C.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 C,F,b;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(C=F=0,b=this.children.length-1;0<=b?F<=b:F>=b;C=0<=b?++F:--F)if(!this.children[C].isEqualNode(w.children[C]))return!1;return!0},D.prototype.getFeature=function(w,C){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,C,F){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 C,F,b,k,R;for(R=this.children,b=0,k=R.length;b<k;b++)if(C=R[b],w===C||(F=C.isDescendant(w),F))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C<F},D.prototype.isFollowing=function(w){var C,F;return C=this.treePosition(w),F=this.treePosition(this),C===-1||F===-1?!1:C>F},D.prototype.treePosition=function(w){var C,F;return F=0,C=!1,this.foreachTreeNode(this.document(),function(b){if(F++,!C&&b===w)return C=!0}),C?F:-1},D.prototype.foreachTreeNode=function(w,C){var F,b,k,R,I;for(w||(w=this.document()),R=w.children,b=0,k=R.length;b<k;b++){if(F=R[b],I=C(F))return I;if(I=this.foreachTreeNode(F,C),I)return I}},D})()}).call(AN)});var Cv=_((xN,TN)=>{(function(){var t,e=function(n,i){return function(){return n.apply(i,arguments)}},r={}.hasOwnProperty;TN.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(xN)});var Bc=_((IN,PN)=>{(function(){PN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(IN)});var Sv=_((FN,RN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,p,y,v,E={}.hasOwnProperty;v=Ln().assign,t=Ot(),u=zd(),c=Yd(),r=Hd(),n=Vd(),h=qd(),f=Jd(),p=Zd(),d=Qd(),l=_v(),i=Kd(),s=Wd(),o=Gd(),a=Xd(),e=Bc(),RN.exports=y=(function(){function A(m){var D,w,C;m||(m={}),this.options=m,w=m.writer||{};for(D in w)E.call(w,D)&&(C=w[D],this["_"+D]=this[D],this[D]=C)}return A.prototype.filterOptions=function(m){var D,w,C,F,b,k,R,I;return m||(m={}),m=v({},this.options,m),D={writer:this},D.pretty=m.pretty||!1,D.allowEmpty=m.allowEmpty||!1,D.indent=(w=m.indent)!=null?w:" ",D.newline=(C=m.newline)!=null?C:`
188
+ `,D.offset=(F=m.offset)!=null?F:0,D.dontPrettyTextNodes=(b=(k=m.dontPrettyTextNodes)!=null?k:m.dontprettytextnodes)!=null?b:0,D.spaceBeforeSlash=(R=(I=m.spaceBeforeSlash)!=null?I:m.spacebeforeslash)!=null?R:"",D.spaceBeforeSlash===!0&&(D.spaceBeforeSlash=" "),D.suppressPrettyCount=0,D.user={},D.state=e.None,D},A.prototype.indent=function(m,D,w){var C;return!D.pretty||D.suppressPrettyCount?"":D.pretty&&(C=(w||0)+D.offset+1,C>0)?new Array(C).join(D.indent):""},A.prototype.endline=function(m,D,w){return!D.pretty||D.suppressPrettyCount?"":D.newline},A.prototype.attribute=function(m,D,w){var C;return this.openAttribute(m,D,w),C=" "+m.name+'="'+m.value+'"',this.closeAttribute(m,D,w),C},A.prototype.cdata=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<![CDATA[",D.state=e.InsideTag,C+=m.value,D.state=e.CloseTag,C+="]]>"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.comment=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<!-- ",D.state=e.InsideTag,C+=m.value,D.state=e.CloseTag,C+=" -->"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.declaration=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<?xml",D.state=e.InsideTag,C+=' version="'+m.version+'"',m.encoding!=null&&(C+=' encoding="'+m.encoding+'"'),m.standalone!=null&&(C+=' standalone="'+m.standalone+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.docType=function(m,D,w){var C,F,b,k,R;if(w||(w=0),this.openNode(m,D,w),D.state=e.OpenTag,k=this.indent(m,D,w),k+="<!DOCTYPE "+m.root().name,m.pubID&&m.sysID?k+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.sysID&&(k+=' SYSTEM "'+m.sysID+'"'),m.children.length>0){for(k+=" [",k+=this.endline(m,D,w),D.state=e.InsideTag,R=m.children,F=0,b=R.length;F<b;F++)C=R[F],k+=this.writeChildNode(C,D,w+1);D.state=e.CloseTag,k+="]"}return D.state=e.CloseTag,k+=D.spaceBeforeSlash+">",k+=this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),k},A.prototype.element=function(m,D,w){var C,F,b,k,R,I,B,j,z,L,S,T,P,$;w||(w=0),L=!1,S="",this.openNode(m,D,w),D.state=e.OpenTag,S+=this.indent(m,D,w)+"<"+m.name,T=m.attribs;for(z in T)E.call(T,z)&&(C=T[z],S+=this.attribute(C,D,w));if(b=m.children.length,k=b===0?null:m.children[0],b===0||m.children.every(function(q){return(q.type===t.Text||q.type===t.Raw)&&q.value===""}))D.allowEmpty?(S+=">",D.state=e.CloseTag,S+="</"+m.name+">"+this.endline(m,D,w)):(D.state=e.CloseTag,S+=D.spaceBeforeSlash+"/>"+this.endline(m,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+="</"+m.name+">"+this.endline(m,D,w);else{if(D.dontPrettyTextNodes){for(P=m.children,R=0,B=P.length;R<B;R++)if(F=P[R],(F.type===t.Text||F.type===t.Raw)&&F.value!=null){D.suppressPrettyCount++,L=!0;break}}for(S+=">"+this.endline(m,D,w),D.state=e.InsideTag,$=m.children,I=0,j=$.length;I<j;I++)F=$[I],S+=this.writeChildNode(F,D,w+1);D.state=e.CloseTag,S+=this.indent(m,D,w)+"</"+m.name+">",L&&D.suppressPrettyCount--,S+=this.endline(m,D,w),D.state=e.None}return this.closeNode(m,D,w),S},A.prototype.writeChildNode=function(m,D,w){switch(m.type){case t.CData:return this.cdata(m,D,w);case t.Comment:return this.comment(m,D,w);case t.Element:return this.element(m,D,w);case t.Raw:return this.raw(m,D,w);case t.Text:return this.text(m,D,w);case t.ProcessingInstruction:return this.processingInstruction(m,D,w);case t.Dummy:return"";case t.Declaration:return this.declaration(m,D,w);case t.DocType:return this.docType(m,D,w);case t.AttributeDeclaration:return this.dtdAttList(m,D,w);case t.ElementDeclaration:return this.dtdElement(m,D,w);case t.EntityDeclaration:return this.dtdEntity(m,D,w);case t.NotationDeclaration:return this.dtdNotation(m,D,w);default:throw new Error("Unknown XML node type: "+m.constructor.name)}},A.prototype.processingInstruction=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<?",D.state=e.InsideTag,C+=m.target,m.value&&(C+=" "+m.value),D.state=e.CloseTag,C+=D.spaceBeforeSlash+"?>",C+=this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.raw=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w),D.state=e.InsideTag,C+=m.value,D.state=e.CloseTag,C+=this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.text=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w),D.state=e.InsideTag,C+=m.value,D.state=e.CloseTag,C+=this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.dtdAttList=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<!ATTLIST",D.state=e.InsideTag,C+=" "+m.elementName+" "+m.attributeName+" "+m.attributeType,m.defaultValueType!=="#DEFAULT"&&(C+=" "+m.defaultValueType),m.defaultValue&&(C+=' "'+m.defaultValue+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.dtdElement=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<!ELEMENT",D.state=e.InsideTag,C+=" "+m.name+" "+m.value,D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.dtdEntity=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<!ENTITY",D.state=e.InsideTag,m.pe&&(C+=" %"),C+=" "+m.name,m.value?C+=' "'+m.value+'"':(m.pubID&&m.sysID?C+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.sysID&&(C+=' SYSTEM "'+m.sysID+'"'),m.nData&&(C+=" NDATA "+m.nData)),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.dtdNotation=function(m,D,w){var C;return this.openNode(m,D,w),D.state=e.OpenTag,C=this.indent(m,D,w)+"<!NOTATION",D.state=e.InsideTag,C+=" "+m.name,m.pubID&&m.sysID?C+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.pubID?C+=' PUBLIC "'+m.pubID+'"':m.sysID&&(C+=' SYSTEM "'+m.sysID+'"'),D.state=e.CloseTag,C+=D.spaceBeforeSlash+">"+this.endline(m,D,w),D.state=e.None,this.closeNode(m,D,w),C},A.prototype.openNode=function(m,D,w){},A.prototype.closeNode=function(m,D,w){},A.prototype.openAttribute=function(m,D,w){},A.prototype.closeAttribute=function(m,D,w){},A})()}).call(FN)});var ep=_((kN,NN)=>{(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=Sv(),NN.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(kN)});var Av=_(($N,LN)=>{(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=Ln().isPlainObject,r=Ev(),e=jk(),i=kr(),t=Ot(),o=Cv(),s=ep(),LN.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,p,y;for(y=this.children,f=0,p=y.length;f<p;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,p){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,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},h.prototype.createTreeWalker=function(d,f,p){throw new Error("This DOM method is not implemented."+this.debugInfo())},h})(i)}).call($N)});var MN=_((BN,jN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,p,y,v,E,A,m,D,w,C,F,b={}.hasOwnProperty;F=Ln(),w=F.isObject,D=F.isFunction,C=F.isPlainObject,m=F.getValue,t=Ot(),h=Av(),f=qd(),n=Hd(),i=Vd(),y=Jd(),A=Zd(),p=Qd(),c=zd(),l=Yd(),s=Kd(),a=Gd(),o=Wd(),u=Xd(),r=bv(),E=Cv(),v=ep(),e=Bc(),jN.exports=d=(function(){function k(R,I,B){var j;this.name="?xml",this.type=t.Document,R||(R={}),j={},R.writer?C(R.writer)&&(j=R.writer,R.writer=new v):R.writer=new v,this.options=R,this.writer=R.writer,this.writerOptions=this.writer.filterOptions(j),this.stringify=new E(R),this.onDataCallback=I||function(){},this.onEndCallback=B||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,B,j,z,L,S,T,P;switch(R.type){case t.CData:this.cdata(R.value);break;case t.Comment:this.comment(R.value);break;case t.Element:j={},T=R.attribs;for(B in T)b.call(T,B)&&(I=T[B],j[B]=I.value);this.node(R.name,j);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(P=R.children,L=0,S=P.length;L<S;L++)z=P[L],this.createChildNode(z),z.type===t.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(R,I,B){var j;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=m(R),I==null&&(I={}),I=m(I),w(I)||(j=[I,B],B=j[0],I=j[1]),this.currentNode=new f(this,R,I),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,B!=null&&this.text(B),this},k.prototype.element=function(R,I,B){var j,z,L,S,T,P;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,P=new h(this.options).element("TEMP_ROOT"),P.element(R),this.options.noValidation=S,T=P.children,z=0,L=T.length;z<L;z++)j=T[z],this.createChildNode(j),j.type===t.Element&&this.up();else this.node(R,I,B);return this},k.prototype.attribute=function(R,I){var B,j;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=m(R)),w(R))for(B in R)b.call(R,B)&&(j=R[B],this.attribute(B,j));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 B,j,z,L,S;if(this.openCurrent(),R!=null&&(R=m(R)),I!=null&&(I=m(I)),Array.isArray(R))for(B=0,L=R.length;B<L;B++)j=R[B],this.instruction(j);else if(w(R))for(j in R)b.call(R,j)&&(z=R[j],this.instruction(j,z));else D(I)&&(I=I.apply()),S=new p(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,B){var j;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return j=new c(this,R,I,B),this.onData(this.writer.declaration(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(R,I,B){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,B),this.currentNode.rootNodeName=R,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(R,I){var B;return this.openCurrent(),B=new o(this,R,I),this.onData(this.writer.dtdElement(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(R,I,B,j,z){var L;return this.openCurrent(),L=new s(this,R,I,B,j,z),this.onData(this.writer.dtdAttList(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(R,I){var B;return this.openCurrent(),B=new a(this,!1,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(R,I){var B;return this.openCurrent(),B=new a(this,!0,R,I),this.onData(this.writer.dtdEntity(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(R,I){var B;return this.openCurrent(),B=new u(this,R,I),this.onData(this.writer.dtdNotation(B,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,B,j,z;if(!R.isOpen){if(!this.root&&this.currentLevel===0&&R.type===t.Element&&(this.root=R),B="",R.type===t.Element){this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<"+R.name,z=R.attribs;for(j in z)b.call(z,j)&&(I=z[j],B+=this.writer.attribute(I,this.writerOptions,this.currentLevel));B+=(R.children?">":"/>")+this.writer.endline(R,this.writerOptions,this.currentLevel),this.writerOptions.state=e.InsideTag}else this.writerOptions.state=e.OpenTag,B=this.writer.indent(R,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+R.rootNodeName,R.pubID&&R.sysID?B+=' PUBLIC "'+R.pubID+'" "'+R.sysID+'"':R.sysID&&(B+=' SYSTEM "'+R.sysID+'"'),R.children?(B+=" [",this.writerOptions.state=e.InsideTag):(this.writerOptions.state=e.CloseTag,B+=">"),B+=this.writer.endline(R,this.writerOptions,this.currentLevel);return this.onData(B,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,B){return this.node(R,I,B)},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,B){return this.declaration(R,I,B)},k.prototype.dtd=function(R,I,B){return this.doctype(R,I,B)},k.prototype.e=function(R,I,B){return this.element(R,I,B)},k.prototype.n=function(R,I,B){return this.node(R,I,B)},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(BN)});var HN=_((UN,qN)=>{(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=Ot(),n=Sv(),e=Bc(),qN.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,p,y,v,E,A;for(v=u.children,h=d=0,p=v.length;d<p;h=++d)l=v[h],l.isLastRootNode=h===u.children.length-1;for(c=this.filterOptions(c),E=u.children,A=[],f=0,y=E.length;f<y;f++)l=E[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,p;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,p=u.children,d=0,f=p.length;d<f;d++)h=p[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,p,y,v,E,A,m,D;l||(l=0),this.openNode(u,c,l),c.state=e.OpenTag,this.stream.write(this.indent(u,c,l)+"<"+u.name),m=u.attribs;for(E in m)s.call(m,E)&&(h=m[E],this.attribute(h,c,l));if(f=u.children.length,p=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&&(p.type===t.Text||p.type===t.Raw)&&p.value!=null)this.stream.write(">"),c.state=e.InsideTag,c.suppressPrettyCount++,A=!0,this.writeChildNode(p,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,v=D.length;y<v;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(UN)});var zN=_((VN,Qi)=>{(function(){var t,e,r,n,i,s,o,a,u,c;c=Ln(),a=c.assign,u=c.isFunction,r=Ev(),n=Av(),i=MN(),o=ep(),s=HN(),t=Ot(),e=Bc(),Qi.exports.create=function(l,h,d,f){var p,y;if(l==null)throw new Error("Root element needs a name.");return f=a({},h,d,f),p=new n(f),y=p.element(l),f.headless||(p.declaration(f),(f.pubID!=null||f.sysID!=null)&&p.dtd(f)),y},Qi.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)},Qi.exports.stringWriter=function(l){return new o(l)},Qi.exports.streamWriter=function(l,h){return new s(l,h)},Qi.exports.implementation=new r,Qi.exports.nodeType=t,Qi.exports.writerState=e}).call(VN)});var KN=_(Ov=>{(function(){"use strict";var t,e,r,n,i,s={}.hasOwnProperty;t=zN(),e=Md().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[>")},Ov.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(p,y){var v,E,A,m,D,w;if(typeof y!="object")f.options.cdata&&n(y)?p.raw(i(y)):p.txt(y);else if(Array.isArray(y)){for(m in y)if(s.call(y,m)){E=y[m];for(D in E)A=E[D],p=l(p.ele(D),A).up()}}else for(D in y)if(s.call(y,D))if(E=y[D],D===u){if(typeof E=="object")for(v in E)w=E[v],p=p.att(v,w)}else if(D===c)f.options.cdata&&n(E)?p=p.raw(i(E)):p=p.txt(E);else if(Array.isArray(E))for(m in E)s.call(E,m)&&(A=E[m],typeof A=="string"?f.options.cdata&&n(A)?p=p.ele(D).raw(i(A)).up():p=p.ele(D,A).up():p=l(p.ele(D),A).up());else typeof E=="object"?p=l(p.ele(D),E).up():typeof E=="string"&&f.options.cdata&&n(E)?p=p.ele(D).raw(i(E)).up():(E==null&&(E=""),p=p.ele(D,E.toString()).up());return p}})(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(Ov)});var GN=_(tp=>{(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 V=this;i(V),V.q=V.c="",V.bufferCheckPosition=t.MAX_BUFFER_LENGTH,V.opt=O||{},V.opt.lowercase=V.opt.lowercase||V.opt.lowercasetags,V.looseCase=V.opt.lowercase?"toLowerCase":"toUpperCase",V.tags=[],V.closed=V.closedRoot=V.sawRoot=!1,V.tag=V.error=null,V.strict=!!x,V.noscript=!!(x||V.opt.noscript),V.state=b.BEGIN,V.strictEntities=V.opt.strictEntities,V.ENTITIES=V.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),V.attribList=[],V.opt.xmlns&&(V.ns=Object.create(p)),V.opt.unquotedAttributeValues===void 0&&(V.opt.unquotedAttributeValues=!x),V.trackPosition=V.opt.position!==!1,V.trackPosition&&(V.position=V.line=V.column=0),R(V,"onready")}Object.create||(Object.create=function(x){function O(){}O.prototype=x;var V=new O;return V}),Object.keys||(Object.keys=function(x){var O=[];for(var V in x)x.hasOwnProperty(V)&&O.push(V);return O});function n(x){for(var O=Math.max(t.MAX_BUFFER_LENGTH,10),V=0,N=0,ne=e.length;N<ne;N++){var K=x[e[N]].length;if(K>O)switch(e[N]){case"textNode":B(x);break;case"cdata":I(x,"oncdata",x.cdata),x.cdata="";break;case"script":I(x,"onscript",x.script),x.script="";break;default:z(x,"Max buffer length exceeded: "+e[N])}V=Math.max(V,K)}var oe=t.MAX_BUFFER_LENGTH-V;x.bufferCheckPosition=oe+x.position}function i(x){for(var O=0,V=e.length;O<V;O++)x[e[O]]=""}function s(x){B(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:te,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 V=this;this._parser.onend=function(){V.emit("end")},this._parser.onerror=function(N){V.emit("error",N),V._parser.error=null},this._decoder=null,a.forEach(function(N){Object.defineProperty(V,"on"+N,{get:function(){return V._parser["on"+N]},set:function(ne){if(!ne)return V.removeAllListeners(N),V._parser["on"+N]=ne,ne;V.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 V=this;return!V._parser["on"+x]&&a.indexOf(x)!==-1&&(V._parser["on"+x]=function(){var N=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);N.splice(0,0,x),V.emit.apply(V,N)}),o.prototype.on.call(V,x,O)};var l="[CDATA[",h="DOCTYPE",d="http://www.w3.org/XML/1998/namespace",f="http://www.w3.org/2000/xmlns/",p={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]/,v=/[:_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-]/,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]/,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 m(x){return x===" "||x===`
189
+ `||x==="\r"||x===" "}function D(x){return x==='"'||x==="'"}function w(x){return x===">"||m(x)}function C(x,O){return x.test(O)}function F(x,O){return!C(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],V=typeof O=="number"?String.fromCharCode(O):O;t.ENTITIES[x]=V});for(var k in t.STATE)t.STATE[t.STATE[k]]=k;b=t.STATE;function R(x,O,V){x[O]&&x[O](V)}function I(x,O,V){x.textNode&&B(x),R(x,O,V)}function B(x){x.textNode=j(x.opt,x.textNode),x.textNode&&R(x,"ontext",x.textNode),x.textNode=""}function j(x,O){return x.trim&&(O=O.trim()),x.normalize&&(O=O.replace(/\s+/g," ")),O}function z(x,O){return B(x),x.trackPosition&&(O+=`
190
190
  Line: `+x.line+`
191
191
  Column: `+x.column+`
192
192
  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&&z(x,"Unexpected end"),B(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&&z(x,O)}function T(x){x.strict||(x.tagName=x.tagName[x.looseCase]());var O=x.tags[x.tags.length-1]||x,V=x.tag={name:x.tagName,attributes:{}};x.opt.xmlns&&(V.ns=O.ns),x.attribList.length=0,I(x,"onopentagstart",V)}function P(x,O){var V=x.indexOf(":"),N=V<0?["",x]:x.split(":"),ne=N[0],K=N[1];return O&&x==="xmlns"&&(ne="xmlns",K=""),{prefix:ne,local:K}}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=P(x.attribName,!0),V=O.prefix,N=O.local;if(V==="xmlns")if(N==="xml"&&x.attribValue!==d)S(x,"xml: prefix must be bound to "+d+`
193
193
  Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)S(x,"xmlns: prefix must be bound to "+f+`
194
- Actual: `+x.attribValue);else{var ne=x.tag,K=x.tags[x.tags.length-1]||x;ne.ns===K.ns&&(ne.ns=Object.create(K.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 q(x,O){if(x.opt.xmlns){var V=x.tag,N=P(x.tagName);V.prefix=N.prefix,V.local=N.local,V.uri=V.ns[N.prefix]||"",V.prefix&&!V.uri&&(S(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),V.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;V.ns&&ne.ns!==V.ns&&Object.keys(V.ns).forEach(function(Wb){I(x,"onopennamespace",{prefix:Wb,uri:V.ns[Wb]})});for(var K=0,oe=x.attribList.length;K<oe;K++){var we=x.attribList[K],Pe=we[0],Ve=we[1],bt=P(Pe,!0),pr=bt.prefix,dq=bt.local,Gb=pr===""?"":V.ns[pr]||"",Sm={name:Pe,value:Ve,prefix:pr,local:dq,uri:Gb};pr&&pr!=="xmlns"&&!Gb&&(S(x,"Unbound namespace prefix: "+JSON.stringify(pr)),Sm.uri=pr),x.tag.attributes[Pe]=Sm,I(x,"onattribute",Sm)}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 M(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,V=x.tagName;x.strict||(V=V[x.looseCase]());for(var N=V;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=V;for(var K=x.tags.length;K-- >O;){var oe=x.tag=x.tags.pop();x.tagName=x.tag.name,I(x,"onclosetag",x.tagName);var we={};for(var Pe in oe.ns)we[Pe]=oe.ns[Pe];var Ve=x.tags[x.tags.length-1]||x;x.opt.xmlns&&oe.ns!==Ve.ns&&Object.keys(oe.ns).forEach(function(bt){var pr=oe.ns[bt];I(x,"onclosenamespace",{prefix:bt,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,V=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[V]?x.ENTITIES[V]:(O=V,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 U(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 H(x,O){var V="";return O<x.length&&(V=x.charAt(O)),V}function te(x){var O=this;if(this.error)throw this.error;if(O.closed)return z(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var V=0,N="";N=H(x,V++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
194
+ Actual: `+x.attribValue);else{var ne=x.tag,K=x.tags[x.tags.length-1]||x;ne.ns===K.ns&&(ne.ns=Object.create(K.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 q(x,O){if(x.opt.xmlns){var V=x.tag,N=P(x.tagName);V.prefix=N.prefix,V.local=N.local,V.uri=V.ns[N.prefix]||"",V.prefix&&!V.uri&&(S(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),V.uri=N.prefix);var ne=x.tags[x.tags.length-1]||x;V.ns&&ne.ns!==V.ns&&Object.keys(V.ns).forEach(function(Wb){I(x,"onopennamespace",{prefix:Wb,uri:V.ns[Wb]})});for(var K=0,oe=x.attribList.length;K<oe;K++){var we=x.attribList[K],Pe=we[0],Ve=we[1],bt=P(Pe,!0),pr=bt.prefix,dq=bt.local,Gb=pr===""?"":V.ns[pr]||"",Sm={name:Pe,value:Ve,prefix:pr,local:dq,uri:Gb};pr&&pr!=="xmlns"&&!Gb&&(S(x,"Unbound namespace prefix: "+JSON.stringify(pr)),Sm.uri=pr),x.tag.attributes[Pe]=Sm,I(x,"onattribute",Sm)}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 M(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,V=x.tagName;x.strict||(V=V[x.looseCase]());for(var N=V;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=V;for(var K=x.tags.length;K-- >O;){var oe=x.tag=x.tags.pop();x.tagName=x.tag.name,I(x,"onclosetag",x.tagName);var we={};for(var Pe in oe.ns)we[Pe]=oe.ns[Pe];var Ve=x.tags[x.tags.length-1]||x;x.opt.xmlns&&oe.ns!==Ve.ns&&Object.keys(oe.ns).forEach(function(bt){var pr=oe.ns[bt];I(x,"onclosenamespace",{prefix:bt,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,V=O.toLowerCase(),N,ne="";return x.ENTITIES[O]?x.ENTITIES[O]:x.ENTITIES[V]?x.ENTITIES[V]:(O=V,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 U(x,O){O==="<"?(x.state=b.OPEN_WAKA,x.startTagPosition=x.position):m(O)||(S(x,"Non-whitespace before first tag."),x.textNode=O,x.state=b.TEXT)}function H(x,O){var V="";return O<x.length&&(V=x.charAt(O)),V}function te(x){var O=this;if(this.error)throw this.error;if(O.closed)return z(O,"Cannot write after close. Assign an onready handler.");if(x===null)return L(O);typeof x=="object"&&(x=x.toString());for(var V=0,N="";N=H(x,V++),O.c=N,!!N;)switch(O.trackPosition&&(O.position++,N===`
195
195
  `?(O.line++,O.column=0):O.column++),O.state){case b.BEGIN:if(O.state=b.BEGIN_WHITESPACE,N==="\uFEFF")continue;U(O,N);continue;case b.BEGIN_WHITESPACE:U(O,N);continue;case b.TEXT:if(O.sawRoot&&!O.closedRoot){for(var K=V-1;N&&N!=="<"&&N!=="&";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
196
- `?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(K,V-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(C(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=j(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 K=V-1;N&&N!=="]";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
197
- `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(K,V-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:C(v,N)?O.tagName+=N:(T(O),N===">"?q(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===">"?(q(O,!0),M(O)):(S(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(p(N))continue;N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(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),q(O)):p(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:C(v,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===">"?q(O):C(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||z(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===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(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===">"?q(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?M(O):C(v,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;F(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===">"?M(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 oe,we;switch(O.state){case b.TEXT_ENTITY:oe=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:oe=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:oe=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var Pe=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Pe)?(O.entity="",O.state=oe,O.write(Pe)):(O[we]+=Pe,O.entity="",O.state=oe)}else C(O.entity.length?A:E,N)?O.entity+=N:(S(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=oe);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,V=function(){var N=16384,ne=[],K,oe,we=-1,Pe=arguments.length;if(!Pe)return"";for(var Ve="";++we<Pe;){var bt=Number(arguments[we]);if(!isFinite(bt)||bt<0||bt>1114111||O(bt)!==bt)throw RangeError("Invalid code point: "+bt);bt<=65535?ne.push(bt):(bt-=65536,K=(bt>>10)+55296,oe=bt%1024+56320,ne.push(K,oe)),(we+1===Pe||ne.length>N)&&(Ve+=x.apply(null,ne),ne.length=0)}return Ve};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:V,configurable:!0,writable:!0}):String.fromCodePoint=V})()})(typeof tp>"u"?tp.sax={}:tp)});var WN=_(xv=>{(function(){"use strict";xv.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(xv)});var Tv=_(to=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),to.normalize=function(e){return e.toLowerCase()},to.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},to.stripPrefix=function(e){return e.replace(t,"")},to.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},to.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(to)});var XN=_(mi=>{(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=GN(),n=require("events"),t=WN(),o=Tv(),u=require("timers").setImmediate,e=Md().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,m){var y,v,E;for(y=0,v=d.length;y<v;y++)E=d[y],f=E(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)},mi.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,v,E;if(!(this instanceof mi.Parser))return new mi.Parser(m);this.options={},v=e["0.2"];for(y in v)h.call(v,y)&&(E=v[y],this.options[y]=E);for(y in m)h.call(m,y)&&(E=m[y],this.options[y]=E);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(v){if(y=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(m,y,v){return y in m?(m[y]instanceof Array||r(m,y,[m[y]]),m[y].push(v)):this.options.explicitArray?r(m,y,[v]):r(m,y,v)},f.prototype.reset=function(){var m,y,v,E;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,E=[],m=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(p){var D,w,C,F,b;if(C={},C[y]="",!A.options.ignoreAttrs){b=p.attributes;for(D in b)h.call(b,D)&&(!(m in C)&&!A.options.mergeAttrs&&(C[m]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,p.attributes[D],D):p.attributes[D],F=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(C,F,w):r(C[m],F,w))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,p.name):p.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:p.uri,local:p.local}),E.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var p,D,w,C,F,b,k,R,I,B;if(b=E.pop(),F=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(p=b.cdata,delete b.cdata),I=E[E.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],F):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&&(B="/"+(function(){var j,z,L;for(L=[],j=0,z=E.length;j<z;j++)C=E[j],L.push(C["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return b=A.options.validator(B,I&&I[F],b)}catch(z){return j=z,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in b&&(C[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(C[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(C[A.options.childkey]=b),b=C;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 E.length>0?A.assignOrPush(I,F,b):(A.options.explicitRoot&&(R=b,b={},r(b,F,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(p){var D,w;if(w=E[E.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=v,this.saxParser.oncdata=(function(A){return function(p){var D;if(D=v(p),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(m,y){var v;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));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(E){if(v=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(m){return new Promise((function(y){return function(v,E){return y.parseString(m,function(A,p){return A?E(A):v(p)})}})(this))},f})(n),mi.parseString=function(d,f,m){var y,v,E;return m!=null?(typeof m=="function"&&(y=m),typeof f=="object"&&(v=f)):(typeof f=="function"&&(y=f),v={}),E=new mi.Parser(v),E.parseString(d,y)},mi.parseStringPromise=function(d,f){var m,y;return typeof f=="object"&&(m=f),y=new mi.Parser(m),y.parseStringPromise(d)}}).call(mi)});var YN=_(gi=>{(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=Md(),t=KN(),r=XN(),n=Tv(),gi.defaults=e.defaults,gi.processors=n,gi.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),gi.Builder=t.Builder,gi.Parser=r.Parser,gi.parseString=r.parseString,gi.parseStringPromise=r.parseStringPromise}).call(gi)});var JN=_(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.buildXmlElement=Bn.writeXML=Bn.parseXML=Bn.readXML=void 0;var yne=(he(),ce(fe)),Dne=Sa(),jc=yne.__importDefault(YN());async function wne(t){var e;try{let r=await(0,Dne.readFile)(t,{encoding:"utf-8"});try{return await jc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Bn.readXML=wne;function vne(t,e){let r=e!==void 0?new jc.default.Parser({...e}):new jc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Bn.parseXML=vne;async function Ene(t){return new Promise(e=>{let n=new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Bn.writeXML=Ene;function bne(t,e){return new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=bne});var r$=_(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getAllElements=Ue.getFilePath=Ue.getAssets=Ue.getJSModules=Ue.getPluginType=Ue.getPlatformElement=Ue.getPluginPlatform=Ue.printPlugins=Ue.fixName=Ue.getDependencies=Ue.resolvePlugin=Ue.getPlugins=Ue.getIncludedPluginPackages=void 0;var _ne=(he(),ce(fe)),Cne=Sa(),Iv=require("path"),Ba=_ne.__importDefault(Aa()),Sne=pd(),Ane=Sc(),ZN=jd(),One=JN();function QN(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}}Ue.getIncludedPluginPackages=QN;async function xne(t,e){var r;let n=(r=QN(t,e))!==null&&r!==void 0?r:t$(t);return(await Promise.all(n.map(async s=>e$(t,s)))).filter(s=>!!s)}Ue.getPlugins=xne;async function e$(t,e){try{let r=(0,ZN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Sne.fatal)(`Unable to find ${Ba.default.strong(`node_modules/${e}`)}.
196
+ `?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(K,V-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=b.OPEN_WAKA,O.startTagPosition=O.position):(!m(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(!m(N))if(C(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=j(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 K=V-1;N&&N!=="]";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
197
+ `?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(K,V-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:m(N)?O.state=b.PROC_INST_BODY:O.procInstName+=N;continue;case b.PROC_INST_BODY:if(!O.procInstBody&&m(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:C(v,N)?O.tagName+=N:(T(O),N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:(m(N)||S(O,"Invalid character in tag name"),O.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:N===">"?(q(O,!0),M(O)):(S(O,"Forward-slash in opening tag not followed by >"),O.state=b.ATTRIB);continue;case b.ATTRIB:if(m(N))continue;N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(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),q(O)):m(N)?O.state=b.ATTRIB_NAME_SAW_WHITE:C(v,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(m(N))continue;S(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?q(O):C(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(m(N))continue;D(N)?(O.q=N,O.state=b.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||z(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:m(N)?O.state=b.ATTRIB:N===">"?q(O):N==="/"?O.state=b.OPEN_TAG_SLASH:C(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===">"?q(O):O.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(O.tagName)N===">"?M(O):C(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=b.SCRIPT):(m(N)||S(O,"Invalid tagname in closing tag"),O.state=b.CLOSE_TAG_SAW_WHITE);else{if(m(N))continue;F(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(m(N))continue;N===">"?M(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 oe,we;switch(O.state){case b.TEXT_ENTITY:oe=b.TEXT,we="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:oe=b.ATTRIB_VALUE_QUOTED,we="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:oe=b.ATTRIB_VALUE_UNQUOTED,we="attribValue";break}if(N===";"){var Pe=G(O);O.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(Pe)?(O.entity="",O.state=oe,O.write(Pe)):(O[we]+=Pe,O.entity="",O.state=oe)}else C(O.entity.length?A:E,N)?O.entity+=N:(S(O,"Invalid character in entity name"),O[we]+="&"+O.entity+N,O.entity="",O.state=oe);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,V=function(){var N=16384,ne=[],K,oe,we=-1,Pe=arguments.length;if(!Pe)return"";for(var Ve="";++we<Pe;){var bt=Number(arguments[we]);if(!isFinite(bt)||bt<0||bt>1114111||O(bt)!==bt)throw RangeError("Invalid code point: "+bt);bt<=65535?ne.push(bt):(bt-=65536,K=(bt>>10)+55296,oe=bt%1024+56320,ne.push(K,oe)),(we+1===Pe||ne.length>N)&&(Ve+=x.apply(null,ne),ne.length=0)}return Ve};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:V,configurable:!0,writable:!0}):String.fromCodePoint=V})()})(typeof tp>"u"?tp.sax={}:tp)});var WN=_(xv=>{(function(){"use strict";xv.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(xv)});var Tv=_(to=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),to.normalize=function(e){return e.toLowerCase()},to.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},to.stripPrefix=function(e){return e.replace(t,"")},to.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},to.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(to)});var XN=_(mi=>{(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 p in f)h.call(f,p)&&(d[p]=f[p]);function y(){this.constructor=d}return y.prototype=f.prototype,d.prototype=new y,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=GN(),n=require("events"),t=WN(),o=Tv(),u=require("timers").setImmediate,e=Md().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,p){var y,v,E;for(y=0,v=d.length;y<v;y++)E=d[y],f=E(f,p);return f},r=function(d,f,p){var y;return y=Object.create(null),y.value=p,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(d,f,y)},mi.Parser=(function(d){l(f,d);function f(p){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,v,E;if(!(this instanceof mi.Parser))return new mi.Parser(p);this.options={},v=e["0.2"];for(y in v)h.call(v,y)&&(E=v[y],this.options[y]=E);for(y in p)h.call(p,y)&&(E=p[y],this.options[y]=E);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 p,y;try{return this.remaining.length<=this.options.chunkSize?(p=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(p),this.saxParser.close()):(p=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(p),u(this.processAsync))}catch(v){if(y=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},f.prototype.assignOrPush=function(p,y,v){return y in p?(p[y]instanceof Array||r(p,y,[p[y]]),p[y].push(v)):this.options.explicitArray?r(p,y,[v]):r(p,y,v)},f.prototype.reset=function(){var p,y,v,E;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(m){if(A.saxParser.resume(),!A.saxParser.errThrown)return A.saxParser.errThrown=!0,A.emit("error",m)}})(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,E=[],p=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=(function(A){return function(m){var D,w,C,F,b;if(C={},C[y]="",!A.options.ignoreAttrs){b=m.attributes;for(D in b)h.call(b,D)&&(!(p in C)&&!A.options.mergeAttrs&&(C[p]={}),w=A.options.attrValueProcessors?s(A.options.attrValueProcessors,m.attributes[D],D):m.attributes[D],F=A.options.attrNameProcessors?s(A.options.attrNameProcessors,D):D,A.options.mergeAttrs?A.assignOrPush(C,F,w):r(C[p],F,w))}return C["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,m.name):m.name,A.options.xmlns&&(C[A.options.xmlnskey]={uri:m.uri,local:m.local}),E.push(C)}})(this),this.saxParser.onclosetag=(function(A){return function(){var m,D,w,C,F,b,k,R,I,B;if(b=E.pop(),F=b["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete b["#name"],b.cdata===!0&&(m=b.cdata,delete b.cdata),I=E[E.length-1],b[y].match(/^\s*$/)&&!m?(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],F):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&&(B="/"+(function(){var j,z,L;for(L=[],j=0,z=E.length;j<z;j++)C=E[j],L.push(C["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return b=A.options.validator(B,I&&I[F],b)}catch(z){return j=z,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof b=="object"){if(!A.options.preserveChildrenOrder)C={},A.options.attrkey in b&&(C[A.options.attrkey]=b[A.options.attrkey],delete b[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in b&&(C[A.options.charkey]=b[A.options.charkey],delete b[A.options.charkey]),Object.getOwnPropertyNames(b).length>0&&(C[A.options.childkey]=b),b=C;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 E.length>0?A.assignOrPush(I,F,b):(A.options.explicitRoot&&(R=b,b={},r(b,F,R)),A.resultObject=b,A.saxParser.ended=!0,A.emit("end",A.resultObject))}})(this),v=(function(A){return function(m){var D,w;if(w=E[E.length-1],w)return w[y]+=m,A.options.explicitChildren&&A.options.preserveChildrenOrder&&A.options.charsAsChildren&&(A.options.includeWhiteChars||m.replace(/\\n/g,"").trim()!=="")&&(w[A.options.childkey]=w[A.options.childkey]||[],D={"#name":"__text__"},D[y]=m,A.options.normalize&&(D[y]=D[y].replace(/\s{2,}/g," ").trim()),w[A.options.childkey].push(D)),w}})(this),this.saxParser.ontext=v,this.saxParser.oncdata=(function(A){return function(m){var D;if(D=v(m),D)return D.cdata=!0}})(this)},f.prototype.parseString=function(p,y){var v;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return p=p.toString(),p.trim()===""?(this.emit("end",null),!0):(p=t.stripBOM(p),this.options.async?(this.remaining=p,u(this.processAsync),this.saxParser):this.saxParser.write(p).close())}catch(E){if(v=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw v}else return this.emit("error",v),this.saxParser.errThrown=!0}},f.prototype.parseStringPromise=function(p){return new Promise((function(y){return function(v,E){return y.parseString(p,function(A,m){return A?E(A):v(m)})}})(this))},f})(n),mi.parseString=function(d,f,p){var y,v,E;return p!=null?(typeof p=="function"&&(y=p),typeof f=="object"&&(v=f)):(typeof f=="function"&&(y=f),v={}),E=new mi.Parser(v),E.parseString(d,y)},mi.parseStringPromise=function(d,f){var p,y;return typeof f=="object"&&(p=f),y=new mi.Parser(p),y.parseStringPromise(d)}}).call(mi)});var YN=_(gi=>{(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=Md(),t=KN(),r=XN(),n=Tv(),gi.defaults=e.defaults,gi.processors=n,gi.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),gi.Builder=t.Builder,gi.Parser=r.Parser,gi.parseString=r.parseString,gi.parseStringPromise=r.parseStringPromise}).call(gi)});var JN=_(Bn=>{"use strict";Object.defineProperty(Bn,"__esModule",{value:!0});Bn.buildXmlElement=Bn.writeXML=Bn.parseXML=Bn.readXML=void 0;var yne=(he(),ce(fe)),Dne=Sa(),jc=yne.__importDefault(YN());async function wne(t){var e;try{let r=await(0,Dne.readFile)(t,{encoding:"utf-8"});try{return await jc.default.parseStringPromise(r)}catch(n){throw`Error parsing: ${t}, ${(e=n.stack)!==null&&e!==void 0?e:n}`}}catch{throw`Unable to read: ${t}`}}Bn.readXML=wne;function vne(t,e){let r=e!==void 0?new jc.default.Parser({...e}):new jc.default.Parser,n;return r.parseString(t,(i,s)=>{i||(n=s)}),n}Bn.parseXML=vne;async function Ene(t){return new Promise(e=>{let n=new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:"deleteme"}).buildObject(t);n=n.replace("<deleteme>","").replace("</deleteme>",""),e(n)})}Bn.writeXML=Ene;function bne(t,e){return new jc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=bne});var r$=_(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.getAllElements=Ue.getFilePath=Ue.getAssets=Ue.getJSModules=Ue.getPluginType=Ue.getPlatformElement=Ue.getPluginPlatform=Ue.printPlugins=Ue.fixName=Ue.getDependencies=Ue.resolvePlugin=Ue.getPlugins=Ue.getIncludedPluginPackages=void 0;var _ne=(he(),ce(fe)),Cne=Sa(),Iv=require("path"),Ba=_ne.__importDefault(Aa()),Sne=pd(),Ane=Sc(),ZN=jd(),One=JN();function QN(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}}Ue.getIncludedPluginPackages=QN;async function xne(t,e){var r;let n=(r=QN(t,e))!==null&&r!==void 0?r:t$(t);return(await Promise.all(n.map(async s=>e$(t,s)))).filter(s=>!!s)}Ue.getPlugins=xne;async function e$(t,e){try{let r=(0,ZN.resolveNode)(t.app.rootDir,e,"package.json");r||(0,Sne.fatal)(`Unable to find ${Ba.default.strong(`node_modules/${e}`)}.
198
198
  Are you sure ${Ba.default.strong(e)} is installed?`);let n=(0,Iv.dirname)(r),i=await(0,Cne.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:Pv(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,Iv.join)(n,"plugin.xml"),o=await(0,One.readXML)(s);return{id:e,name:Pv(e),version:i.version,rootPath:n,repository:i.repository,xml:o.plugin}}catch{}return null}Ue.resolvePlugin=e$;function t$(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:{})]}Ue.getDependencies=t$;function Pv(t){return t=t.replace(/\//g,"_").replace(/-/g,"_").replace(/@/g,"").replace(/_\w/g,e=>e[1].toUpperCase()),t.charAt(0).toUpperCase()+t.slice(1)}Ue.fixName=Pv;function Tne(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 ${Ba.default.strong(e)}:
199
199
  `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${Ba.default.strong(e)}, skipped install:
200
200
  `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${Ba.default.strong(e)}:
@@ -203,7 +203,7 @@ Are you sure ${Ba.default.strong(e)} is installed?`);let n=(0,Iv.dirname)(r),i=a
203
203
 
204
204
  see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=Hc.checkPathsSync(t,e,"copy");return Hc.checkParentPathsSync(t,n,e,"copy"),rie(i,t,e,r)}function rie(t,e,r,n){if(n.filter&&!n.filter(e,r))return;let i=qc.dirname(r);return Wt.existsSync(i)||Qne(i),y$(t,e,r,n)}function y$(t,e,r,n){if(!(n.filter&&!n.filter(e,r)))return nie(t,e,r,n)}function nie(t,e,r,n){let s=(n.dereference?Wt.statSync:Wt.lstatSync)(e);if(s.isDirectory())return lie(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return iie(s,t,e,r,n);if(s.isSymbolicLink())return die(t,e,r,n)}function iie(t,e,r,n,i){return e?sie(t,r,n,i):D$(t,r,n,i)}function sie(t,e,r,n){if(n.overwrite)return Wt.unlinkSync(r),D$(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function D$(t,e,r,n){return Wt.copyFileSync(e,r),n.preserveTimestamps&&oie(t.mode,e,r),qv(r,t.mode)}function oie(t,e,r){return aie(t)&&uie(r,t),cie(e,r)}function aie(t){return(t&128)===0}function uie(t,e){return qv(t,e|128)}function qv(t,e){return Wt.chmodSync(t,e)}function cie(t,e){let r=Wt.statSync(t);return eie(e,r.atime,r.mtime)}function lie(t,e,r,n,i){if(!e)return fie(t.mode,r,n,i);if(e&&!e.isDirectory())throw new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`);return w$(r,n,i)}function fie(t,e,r,n){return Wt.mkdirSync(r),w$(e,r,n),qv(r,t)}function w$(t,e,r){Wt.readdirSync(t).forEach(n=>hie(n,t,e,r))}function hie(t,e,r,n){let i=qc.join(e,t),s=qc.join(r,t),{destStat:o}=Hc.checkPathsSync(i,s,"copy");return y$(o,i,s,n)}function die(t,e,r,n){let i=Wt.readlinkSync(e);if(n.dereference&&(i=qc.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=qc.resolve(process.cwd(),s)),Hc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Wt.statSync(r).isDirectory()&&Hc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return pie(i,r)}else return Wt.symlinkSync(i,r)}function pie(t,e){return Wt.unlinkSync(e),Wt.symlinkSync(t,e)}v$.exports=tie});var Hv=_((zve,b$)=>{"use strict";b$.exports={copySync:E$()}});var ts=_((Kve,C$)=>{"use strict";var mie=Re().fromPromise,_$=Mc();function gie(t){return _$.access(t).then(()=>!0).catch(()=>!1)}C$.exports={pathExists:mie(gie),pathExistsSync:_$.existsSync}});var R$=_((Gve,F$)=>{"use strict";var Or=vt(),Vc=require("path"),yie=mn().mkdirs,Die=ts().pathExists,wie=jv().utimesMillis,zc=Uc();function vie(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;
205
205
 
206
- see https://github.com/jprichardson/node-fs-extra/issues/269`),zc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;zc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?x$(S$,a,t,e,r,n):S$(a,t,e,r,n))})}function S$(t,e,r,n,i){let s=Vc.dirname(r);Die(s,(o,a)=>{if(o)return i(o);if(a)return Vv(t,e,r,n,i);yie(s,u=>u?i(u):Vv(t,e,r,n,i))})}function x$(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 Vv(t,e,r,n,i){return n.filter?x$(A$,t,e,r,n,i):A$(t,e,r,n,i)}function A$(t,e,r,n,i){(n.dereference?Or.stat:Or.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Oie(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Eie(a,t,e,r,n,i);if(a.isSymbolicLink())return Iie(t,e,r,n,i)})}function Eie(t,e,r,n,i,s){return e?bie(t,r,n,i,s):T$(t,r,n,i,s)}function bie(t,e,r,n,i){if(n.overwrite)Or.unlink(r,s=>s?i(s):T$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function T$(t,e,r,n,i){Or.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?_ie(t.mode,e,r,i):op(r,t.mode,i))}function _ie(t,e,r,n){return Cie(t)?Sie(r,t,i=>i?n(i):O$(t,e,r,n)):O$(t,e,r,n)}function Cie(t){return(t&128)===0}function Sie(t,e,r){return op(t,e|128,r)}function O$(t,e,r,n){Aie(e,r,i=>i?n(i):op(r,t,n))}function op(t,e,r){return Or.chmod(t,e,r)}function Aie(t,e,r){Or.stat(t,(n,i)=>n?r(n):wie(e,i.atime,i.mtime,r))}function Oie(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):I$(r,n,i,s):xie(t.mode,r,n,i,s)}function xie(t,e,r,n,i){Or.mkdir(r,s=>{if(s)return i(s);I$(e,r,n,o=>o?i(o):op(r,t,i))})}function I$(t,e,r,n){Or.readdir(t,(i,s)=>i?n(i):P$(s,t,e,r,n))}function P$(t,e,r,n,i){let s=t.pop();return s?Tie(t,s,e,r,n,i):i()}function Tie(t,e,r,n,i,s){let o=Vc.join(r,e),a=Vc.join(n,e);zc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Vv(l,o,a,i,h=>h?s(h):P$(t,r,n,i,s))})}function Iie(t,e,r,n,i){Or.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Vc.resolve(process.cwd(),o)),t)Or.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Or.symlink(o,r,i):i(a):(n.dereference&&(u=Vc.resolve(process.cwd(),u)),zc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&zc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Pie(o,r,i)));else return Or.symlink(o,r,i)})}function Pie(t,e,r){Or.unlink(e,n=>n?r(n):Or.symlink(t,e,r))}F$.exports=vie});var zv=_((Wve,k$)=>{"use strict";var Fie=Re().fromCallback;k$.exports={copy:Fie(R$())}});var H$=_((Xve,q$)=>{"use strict";var N$=vt(),j$=require("path"),He=require("assert"),Kc=process.platform==="win32";function M$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||N$[r],r=r+"Sync",t[r]=t[r]||N$[r]}),t.maxBusyTries=t.maxBusyTries||3}function Kv(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He.strictEqual(typeof r,"function","rimraf: callback function required"),He(e,"rimraf: invalid options argument provided"),He.strictEqual(typeof e,"object","rimraf: options should be object"),M$(e),$$(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(()=>$$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function $$(t,e,r){He(t),He(e),He(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Kc)return L$(t,e,n,r);if(i&&i.isDirectory())return ap(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Kc?L$(t,e,s,r):ap(t,e,s,r);if(s.code==="EISDIR")return ap(t,e,s,r)}return r(s)})})}function L$(t,e,r,n){He(t),He(e),He(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()?ap(t,e,r,n):e.unlink(t,n)})})}function B$(t,e,r){let n;He(t),He(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()?up(t,e,r):e.unlinkSync(t)}function ap(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Rie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function Rie(t,e,r){He(t),He(e),He(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=>{Kv(j$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function U$(t,e){let r;e=e||{},M$(e),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He(e,"rimraf: missing options"),He.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Kc&&B$(t,e,n)}try{r&&r.isDirectory()?up(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Kc?B$(t,e,n):up(t,e,n);if(n.code!=="EISDIR")throw n;up(t,e,n)}}function up(t,e,r){He(t),He(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")kie(t,e);else if(n.code!=="ENOENT")throw n}}function kie(t,e){if(He(t),He(e),e.readdirSync(t).forEach(r=>U$(j$.join(t,r),e)),Kc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}q$.exports=Kv;Kv.sync=U$});var Gc=_((Yve,z$)=>{"use strict";var Nie=Re().fromCallback,V$=H$();z$.exports={remove:Nie(V$),removeSync:V$.sync}});var Q$=_((Jve,Z$)=>{"use strict";var $ie=Re().fromCallback,W$=vt(),X$=require("path"),Y$=mn(),J$=Gc(),K$=$ie(function(e,r){r=r||function(){},W$.readdir(e,(n,i)=>{if(n)return Y$.mkdirs(e,r);i=i.map(o=>X$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();J$.remove(o,a=>{if(a)return r(a);s()})}})});function G$(t){let e;try{e=W$.readdirSync(t)}catch{return Y$.mkdirsSync(t)}e.forEach(r=>{r=X$.join(t,r),J$.removeSync(r)})}Z$.exports={emptyDirSync:G$,emptydirSync:G$,emptyDir:K$,emptydir:K$}});var nL=_((Zve,rL)=>{"use strict";var Lie=Re().fromCallback,eL=require("path"),rs=vt(),tL=mn();function Bie(t,e){function r(){rs.writeFile(t,"",n=>{if(n)return e(n);e()})}rs.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=eL.dirname(t);rs.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?tL.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():rs.readdir(s,u=>{if(u)return e(u)})})})}function jie(t){let e;try{e=rs.statSync(t)}catch{}if(e&&e.isFile())return;let r=eL.dirname(t);try{rs.statSync(r).isDirectory()||rs.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")tL.mkdirsSync(r);else throw n}rs.writeFileSync(t,"")}rL.exports={createFile:Lie(Bie),createFileSync:jie}});var uL=_((Qve,aL)=>{"use strict";var Mie=Re().fromCallback,sL=require("path"),ro=vt(),oL=mn(),iL=ts().pathExists;function Uie(t,e,r){function n(i,s){ro.link(i,s,o=>{if(o)return r(o);r(null)})}iL(e,(i,s)=>{if(i)return r(i);if(s)return r(null);ro.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=sL.dirname(e);iL(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);oL.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function qie(t,e){if(ro.existsSync(e))return;try{ro.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=sL.dirname(e);return ro.existsSync(n)||oL.mkdirsSync(n),ro.linkSync(t,e)}aL.exports={createLink:Mie(Uie),createLinkSync:qie}});var lL=_((eEe,cL)=>{"use strict";var ns=require("path"),Wc=vt(),Hie=ts().pathExists;function Vie(t,e,r){if(ns.isAbsolute(t))return Wc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=ns.dirname(e),i=ns.join(n,t);return Hie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Wc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:ns.relative(n,t)})))}}function zie(t,e){let r;if(ns.isAbsolute(t)){if(r=Wc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=ns.dirname(e),i=ns.join(n,t);if(r=Wc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Wc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:ns.relative(n,t)}}}cL.exports={symlinkPaths:Vie,symlinkPathsSync:zie}});var dL=_((tEe,hL)=>{"use strict";var fL=vt();function Kie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);fL.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function Gie(t,e){let r;if(e)return e;try{r=fL.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}hL.exports={symlinkType:Kie,symlinkTypeSync:Gie}});var vL=_((rEe,wL)=>{"use strict";var Wie=Re().fromCallback,mL=require("path"),qa=vt(),gL=mn(),Xie=gL.mkdirs,Yie=gL.mkdirsSync,yL=lL(),Jie=yL.symlinkPaths,Zie=yL.symlinkPathsSync,DL=dL(),Qie=DL.symlinkType,ese=DL.symlinkTypeSync,pL=ts().pathExists;function tse(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,pL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Jie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,Qie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=mL.dirname(e);pL(l,(h,d)=>{if(h)return n(h);if(d)return qa.symlink(t,e,c,n);Xie(l,f=>{if(f)return n(f);qa.symlink(t,e,c,n)})})})})})}function rse(t,e,r){if(qa.existsSync(e))return;let i=Zie(t,e);t=i.toDst,r=ese(i.toCwd,r);let s=mL.dirname(e);return qa.existsSync(s)||Yie(s),qa.symlinkSync(t,e,r)}wL.exports={createSymlink:Wie(tse),createSymlinkSync:rse}});var bL=_((nEe,EL)=>{"use strict";var cp=nL(),lp=uL(),fp=vL();EL.exports={createFile:cp.createFile,createFileSync:cp.createFileSync,ensureFile:cp.createFile,ensureFileSync:cp.createFileSync,createLink:lp.createLink,createLinkSync:lp.createLinkSync,ensureLink:lp.createLink,ensureLinkSync:lp.createLinkSync,createSymlink:fp.createSymlink,createSymlinkSync:fp.createSymlinkSync,ensureSymlink:fp.createSymlink,ensureSymlinkSync:fp.createSymlinkSync}});var CL=_((iEe,_L)=>{"use strict";var hp=N0();_L.exports={readJson:hp.readFile,readJsonSync:hp.readFileSync,writeJson:hp.writeFile,writeJsonSync:hp.writeFileSync}});var dp=_((sEe,OL)=>{"use strict";var nse=Re().fromCallback,Xc=vt(),SL=require("path"),AL=mn(),ise=ts().pathExists;function sse(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=SL.dirname(t);ise(i,(s,o)=>{if(s)return n(s);if(o)return Xc.writeFile(t,e,r,n);AL.mkdirs(i,a=>{if(a)return n(a);Xc.writeFile(t,e,r,n)})})}function ose(t,...e){let r=SL.dirname(t);if(Xc.existsSync(r))return Xc.writeFileSync(t,...e);AL.mkdirsSync(r),Xc.writeFileSync(t,...e)}OL.exports={outputFile:nse(sse),outputFileSync:ose}});var TL=_((oEe,xL)=>{"use strict";var{stringify:ase}=_a(),{outputFile:use}=dp();async function cse(t,e,r={}){let n=ase(e,r);await use(t,n,r)}xL.exports=cse});var PL=_((aEe,IL)=>{"use strict";var{stringify:lse}=_a(),{outputFileSync:fse}=dp();function hse(t,e,r){let n=lse(e,r);fse(t,n,r)}IL.exports=hse});var RL=_((uEe,FL)=>{"use strict";var dse=Re().fromPromise,cr=CL();cr.outputJson=dse(TL());cr.outputJsonSync=PL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;FL.exports=cr});var jL=_((cEe,BL)=>{"use strict";var $L=vt(),pse=require("path"),mse=Hv().copySync,LL=Gc().removeSync,gse=mn().mkdirpSync,kL=Uc();function yse(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=kL.checkPathsSync(t,e,"move");return kL.checkParentPathsSync(t,i,e,"move"),gse(pse.dirname(e)),Dse(t,e,n)}function Dse(t,e,r){if(r)return LL(e),NL(t,e,r);if($L.existsSync(e))throw new Error("dest already exists.");return NL(t,e,r)}function NL(t,e,r){try{$L.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return wse(t,e,r)}}function wse(t,e,r){return mse(t,e,{overwrite:r,errorOnExist:!0}),LL(t)}BL.exports=yse});var UL=_((lEe,ML)=>{"use strict";ML.exports={moveSync:jL()}});var KL=_((fEe,zL)=>{"use strict";var vse=vt(),Ese=require("path"),bse=zv().copy,VL=Gc().remove,_se=mn().mkdirp,Cse=ts().pathExists,qL=Uc();function Sse(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;qL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;qL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);_se(Ese.dirname(e),c=>c?n(c):Ase(t,e,i,n))})})}function Ase(t,e,r,n){if(r)return VL(e,i=>i?n(i):HL(t,e,r,n));Cse(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):HL(t,e,r,n))}function HL(t,e,r,n){vse.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Ose(t,e,r,n):n())}function Ose(t,e,r,n){bse(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):VL(t,n))}zL.exports=Sse});var WL=_((hEe,GL)=>{"use strict";var xse=Re().fromCallback;GL.exports={move:xse(KL())}});var pp=_((dEe,Gv)=>{"use strict";Gv.exports={...Mc(),...Hv(),...zv(),...Q$(),...bL(),...RL(),...mn(),...UL(),...WL(),...dp(),...ts(),...Gc()};var XL=require("fs");Object.getOwnPropertyDescriptor(XL,"promises")&&Object.defineProperty(Gv.exports,"promises",{get(){return XL.promises}})});var Wv=_(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.readdir=Ha.stat=void 0;var YL=pp();async function Tse(t){try{return await YL.stat(t)}catch{}}Ha.stat=Tse;async function Ise(t){try{return await YL.readdir(t)}catch{return[]}}Ha.readdir=Ise});var r3=_(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 Pse=(he(),ce(fe)),Yr=pp(),Fse=require("os"),Di=require("path"),JL=require("stream"),ZL=Wv();Pse.__exportStar(pp(),me);var QL=Wv();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return QL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return QL.readdir}});async function Rse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Yv(t,n);e&&(a=a.pipe(new JL.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=Rse;async function kse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=Di.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=Di.resolve(t),Yv(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=kse;async function Nse(t){try{return await Yr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=Nse;async function Xv(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Yr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Xv;async function $se(t){return Promise.all([Xv(t),(async()=>{try{return(await Yr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=$se;async function Lse(t,e){let r=await Xv(t);await Yr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=Lse;function Bse(t,e){return new Promise((r,n)=>{let i=Yr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=Bse;async function Yc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Yc;async function jse(t){return Yc(t,Yr.constants.F_OK)}me.pathExists=jse;async function Mse(t){return Yc(t,Yr.constants.R_OK)}me.pathReadable=Mse;async function Use(t){return Yc(t,Yr.constants.W_OK)}me.pathWritable=Use;async function e3(t){return Yc(t,Yr.constants.X_OK)}me.pathExecutable=e3;async function qse(t){let[e,r]=await Promise.all([ZL.stat(t),e3(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=qse;async function Hse(t,e){if(!(!t||!e)){for(let r of t3(t))if((await ZL.readdir(r)).includes(e))return r}}me.findBaseDirectory=Hse;function Vse(t){let e=Math.random().toString(16).substring(2,8);return Di.resolve(Fse.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=Vse;function t3(t){if(t=Di.normalize(t),!Di.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=Di.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(Di.sep).map((r,n,i)=>e.root+Di.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=t3;var mp=class extends JL.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}Yr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Yr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>Di.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=mp;function Yv(t,e={}){return new mp(t,e)}me.walk=Yv});var n3=_(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.AliasedMap=wi.CaseInsensitiveProxyHandler=wi.createCaseInsensitiveObject=void 0;function zse(){return new Proxy({},wi.CaseInsensitiveProxyHandler)}wi.createCaseInsensitiveObject=zse;wi.CaseInsensitiveProxyHandler={has:(t,e)=>gp(e)in t,get:(t,e)=>t[gp(e)],set:(t,e,r)=>(t[gp(e)]=r,!0),deleteProperty:(t,e)=>delete t[gp(e)]};var gp=t=>typeof t=="string"?t.toLowerCase():t,Jv=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)}};wi.AliasedMap=Jv});var c3=_((yEe,u3)=>{"use strict";var a3=require("child_process"),i3=a3.spawn,Kse=a3.exec;u3.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":Kse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Zv(t,n,i,function(s){return i3("pgrep",["-P",s])},function(){s3(n,e,r)});break;default:Zv(t,n,i,function(s){return i3("ps",["-o","pid","--no-headers","--ppid",s])},function(){s3(n,e,r)});break}};function s3(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(o3(s,e),n[s]=1)}),n[i]||(o3(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function o3(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Zv(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,Zv(c,e,r,n,i)})};s.on("close",a)}});var h3=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.processExit=et.offBeforeExit=et.onBeforeExit=et.onExit=et.sleepForever=et.sleepUntil=et.sleep=et.getPathParts=et.createProcessEnv=et.killProcessTree=et.ERROR_TIMEOUT_REACHED=void 0;var Qv=(he(),ce(fe)),Gse=n3(),Wse=Ki(),Xse=Zh(),Yse=Qv.__importStar(require("path")),Jse=Qv.__importDefault(Uh()),Zse=Qv.__importDefault(c3()),no=(0,Xse.debug)("ionic:utils-process");et.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function Qse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Zse.default)(t,e,i=>{if(i)return no("error while killing process tree for %d: %O",t,i),n(i);r()})})}et.killProcessTree=Qse;function eoe(...t){return Object.assign(Wse.TERMINAL_INFO.windows?(0,Gse.createCaseInsensitiveObject)():{},...t)}et.createProcessEnv=eoe;function toe(t=process.env.PATH||""){return t.split(Yse.delimiter)}et.getPathParts=toe;async function l3(t){return new Promise(e=>{setTimeout(e,t)})}et.sleep=l3;async function roe(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await l3(e),n+=e,n>r)throw et.ERROR_TIMEOUT_REACHED}et.sleepUntil=roe;async function noe(){return new Promise(()=>{setInterval(()=>{},1e3)})}et.sleepForever=noe;function ioe(t){(0,Jse.default)(()=>{no("onExit: process.exit/normal shutdown"),t()})}et.onExit=ioe;var yp=new Set;function soe(t){yp.add(t)}et.onBeforeExit=soe;function ooe(t){yp.delete(t)}et.offBeforeExit=ooe;var aoe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Jc=t=>aoe(async()=>{no("onBeforeExit handler: %O received",t),no("onBeforeExit handler: running %O functions",yp.size),await Promise.all([...yp.values()].map(async e=>{try{await e()}catch(r){no("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(no("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,f3[t]),process.kill(process.pid,t))}),f3={SIGINT:Jc("SIGINT"),SIGTERM:Jc("SIGTERM"),SIGHUP:Jc("SIGHUP"),SIGBREAK:Jc("SIGBREAK")};for(let[t,e]of Object.entries(f3))process.on(t,e);var uoe=Jc("process.exit");async function coe(t=0){process.exitCode=t,await uoe(),no("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=coe});var m3=_(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var nE=require("stream"),loe=4,d3=32,p3=16,eE=class extends nE.Writable{_write(e,r,n){n()}};jn.NullStream=eE;var tE=class extends nE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:d3),this.chunkSize=e&&e.chunkSize?e.chunkSize:loe,this.growSize=e&&e.growSize?e.growSize:p3}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=iE(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)}};jn.ReadableStreamBuffer=tE;var rE=class extends nE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:d3),this.growSize=e&&e.growSize?e.growSize:p3}get size(){return this._size}_write(e,r,n){this.buffer=iE(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}};jn.WritableStreamBuffer=rE;function iE(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}jn.growBufferForAppendedData=iE});var v3=_((vEe,w3)=>{w3.exports=D3;D3.sync=hoe;var g3=require("fs");function foe(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 y3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:foe(e,r)}function D3(t,e,r){g3.stat(t,function(n,i){r(n,n?!1:y3(i,t,e))})}function hoe(t,e){return y3(g3.statSync(t),t,e)}});var S3=_((EEe,C3)=>{C3.exports=b3;b3.sync=doe;var E3=require("fs");function b3(t,e,r){E3.stat(t,function(n,i){r(n,n?!1:_3(i,e))})}function doe(t,e){return _3(E3.statSync(t),e)}function _3(t,e){return t.isFile()&&poe(t,e)}function poe(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 O3=_((_Ee,A3)=>{var bEe=require("fs"),Dp;process.platform==="win32"||global.TESTING_WINDOWS?Dp=v3():Dp=S3();A3.exports=sE;sE.sync=moe;function sE(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){sE(t,e||{},function(s,o){s?i(s):n(o)})})}Dp(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function moe(t,e){try{return Dp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var k3=_((CEe,R3)=>{var Va=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x3=require("path"),goe=Va?";":":",T3=O3(),I3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),P3=(t,e)=>{let r=e.colon||goe,n=t.match(/\//)||Va&&t.match(/\\/)?[""]:[...Va?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Va?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Va?i.split(r):[""];return Va&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},F3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=P3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(I3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,m=x3.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];T3(c+m,{pathExt:s},(y,v)=>{if(!y&&v)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)},yoe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=P3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=x3.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(T3.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 I3(t)};R3.exports=F3;F3.sync=yoe});var $3=_((SEe,oE)=>{"use strict";var N3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};oE.exports=N3;oE.exports.default=N3});var M3=_((AEe,j3)=>{"use strict";var L3=require("path"),Doe=k3(),woe=$3();function B3(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=Doe.sync(t.command,{path:r[woe({env:r})],pathExt:e?L3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=L3.resolve(i?t.options.cwd:"",o)),o}function voe(t){return B3(t)||B3(t,!0)}j3.exports=voe});var U3=_((OEe,uE)=>{"use strict";var aE=/([()\][%!^"`<>&|;, *?])/g;function Eoe(t){return t=t.replace(aE,"^$1"),t}function boe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(aE,"^$1"),e&&(t=t.replace(aE,"^$1")),t}uE.exports.command=Eoe;uE.exports.argument=boe});var H3=_((xEe,q3)=>{"use strict";q3.exports=/^#!(.*)/});var z3=_((TEe,V3)=>{"use strict";var _oe=H3();V3.exports=(t="")=>{let e=t.match(_oe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var G3=_((IEe,K3)=>{"use strict";var cE=require("fs"),Coe=z3();function Soe(t){let r=Buffer.alloc(150),n;try{n=cE.openSync(t,"r"),cE.readSync(n,r,0,150,0),cE.closeSync(n)}catch{}return Coe(r.toString())}K3.exports=Soe});var J3=_((PEe,Y3)=>{"use strict";var Aoe=require("path"),W3=M3(),X3=U3(),Ooe=G3(),xoe=process.platform==="win32",Toe=/\.(?:com|exe)$/i,Ioe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Poe(t){t.file=W3(t);let e=t.file&&Ooe(t.file);return e?(t.args.unshift(t.file),t.command=e,W3(t)):t.file}function Foe(t){if(!xoe)return t;let e=Poe(t),r=!Toe.test(e);if(t.options.forceShell||r){let n=Ioe.test(e);t.command=Aoe.normalize(t.command),t.command=X3.command(t.command),t.args=t.args.map(s=>X3.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 Roe(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:Foe(n)}Y3.exports=Roe});var eB=_((FEe,Q3)=>{"use strict";var lE=process.platform==="win32";function fE(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 koe(t,e){if(!lE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=Z3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Z3(t,e){return lE&&t===1&&!e.file?fE(e.original,"spawn"):null}function Noe(t,e){return lE&&t===1&&!e.file?fE(e.original,"spawnSync"):null}Q3.exports={hookChildProcess:koe,verifyENOENT:Z3,verifyENOENTSync:Noe,notFoundError:fE}});var nB=_((REe,za)=>{"use strict";var tB=require("child_process"),hE=J3(),dE=eB();function rB(t,e,r){let n=hE(t,e,r),i=tB.spawn(n.command,n.args,n.options);return dE.hookChildProcess(i,n),i}function $oe(t,e,r){let n=hE(t,e,r),i=tB.spawnSync(n.command,n.args,n.options);return i.error=i.error||dE.verifyENOENTSync(i.status,n),i}za.exports=rB;za.exports.spawn=rB;za.exports.sync=$oe;za.exports._parse=hE;za.exports._enoent=dE});var lB=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.findExecutables=ke.which=ke.fork=ke.spawn=ke.Subprocess=ke.SubprocessError=ke.convertPATH=ke.expandTildePath=ke.TILDE_PATH_REGEX=ke.ERROR_SIGNAL_EXIT=ke.ERROR_NON_ZERO_EXIT=ke.ERROR_COMMAND_NOT_FOUND=void 0;var gE=(he(),ce(fe)),iB=n$(),Loe=r3(),pE=h3(),wp=m3(),sB=Ki(),Boe=require("child_process"),joe=gE.__importDefault(nB()),Moe=gE.__importStar(require("os")),so=gE.__importStar(require("path"));ke.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";ke.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";ke.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";ke.TILDE_PATH_REGEX=/^~($|\/|\\)/;function oB(t){let e=Moe.homedir();return t.replace(ke.TILDE_PATH_REGEX,`${e}$1`)}ke.expandTildePath=oB;function aB(t=process.env.PATH||""){return t.split(so.delimiter).map(oB).join(so.delimiter)}ke.convertPATH=aB;var io=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};ke.SubprocessError=io;var mE=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,pE.createProcessEnv)(e.env||{},{PATH:aB(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 wp.WritableStreamBuffer,n=new wp.WritableStreamBuffer,i=new wp.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 wp.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 io("Command not found.",{cause:s}),o.code=ke.ERROR_COMMAND_NOT_FOUND):o=new io("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new io("Signal exit from subprocess."),a.code=ke.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new io("Non-zero exit from subprocess."),a.code=ke.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return uB(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(so.sep);return r>=0?e.substring(r+1):e}};ke.Subprocess=mE;function uB(t,e=[],r){return(0,joe.default)(t,[...e],r)}ke.spawn=uB;function Uoe(t,e=[],r={}){return(0,Boe.fork)(t,[...e],r)}ke.fork=Uoe;var yE=sB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){if(t.includes(so.sep))return t;let n=await cB(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}ke.which=qoe;async function Hoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){return t.includes(so.sep)?[t]:cB(t,{PATH:e})}ke.findExecutables=Hoe;async function cB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){let n=(0,pE.getPathParts)(e),i;if(sB.TERMINAL_INFO.windows){let s=(0,pE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(so.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,iB.map)(i,async s=>(0,iB.concurrentFilter)(n.map(o=>so.join(o,s)),async o=>(0,Loe.isExecutableFile)(o))))}});var vp=_(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isInstalled=is.getCommandOutput=is.runCommand=void 0;var DE=lB();async function fB(t,e,r={}){let n=new DE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof DE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}is.runCommand=fB;async function Voe(t,e,r={}){try{return(await fB(t,e,r)).trim()}catch{return null}}is.getCommandOutput=Voe;async function zoe(t){try{await(0,DE.which)(t)}catch{return!1}return!0}is.isInstalled=zoe});var Zc=_(($Ee,hB)=>{"use strict";var Koe="2.0.0",Goe=Number.MAX_SAFE_INTEGER||9007199254740991,Woe=16,Xoe=250,Yoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];hB.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Woe,MAX_SAFE_BUILD_LENGTH:Xoe,MAX_SAFE_INTEGER:Goe,RELEASE_TYPES:Yoe,SEMVER_SPEC_VERSION:Koe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qc=_((LEe,dB)=>{"use strict";var Joe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};dB.exports=Joe});var Ka=_((Mn,pB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:wE,MAX_SAFE_BUILD_LENGTH:Zoe,MAX_LENGTH:Qoe}=Zc(),eae=Qc();Mn=pB.exports={};var tae=Mn.re=[],rae=Mn.safeRe=[],Z=Mn.src=[],nae=Mn.safeSrc=[],Q=Mn.t={},iae=0,vE="[a-zA-Z0-9-]",sae=[["\\s",1],["\\d",Qoe],[vE,Zoe]],oae=t=>{for(let[e,r]of sae)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=oae(e),i=iae++;eae(t,i,e),Q[t]=i,Z[i]=e,nae[i]=n,tae[i]=new RegExp(e,r?"g":void 0),rae[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${vE}*`);ge("MAINVERSION",`(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${Z[Q.PRERELEASEIDENTIFIER]}(?:\\.${Z[Q.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${Z[Q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[Q.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${vE}+`);ge("BUILD",`(?:\\+(${Z[Q.BUILDIDENTIFIER]}(?:\\.${Z[Q.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${Z[Q.MAINVERSION]}${Z[Q.PRERELEASE]}?${Z[Q.BUILD]}?`);ge("FULL",`^${Z[Q.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${Z[Q.MAINVERSIONLOOSE]}${Z[Q.PRERELEASELOOSE]}?${Z[Q.BUILD]}?`);ge("LOOSE",`^${Z[Q.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${Z[Q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${Z[Q.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:${Z[Q.PRERELEASE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:${Z[Q.PRERELEASELOOSE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${wE}})(?:\\.(\\d{1,${wE}}))?(?:\\.(\\d{1,${wE}}))?`);ge("COERCE",`${Z[Q.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",Z[Q.COERCEPLAIN]+`(?:${Z[Q.PRERELEASE]})?(?:${Z[Q.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",Z[Q.COERCE],!0);ge("COERCERTLFULL",Z[Q.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${Z[Q.LONETILDE]}\\s+`,!0);Mn.tildeTrimReplace="$1~";ge("TILDE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${Z[Q.LONECARET]}\\s+`,!0);Mn.caretTrimReplace="$1^";ge("CARET",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${Z[Q.GTLT]}\\s*(${Z[Q.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]}|${Z[Q.XRANGEPLAIN]})`,!0);Mn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${Z[Q.XRANGEPLAIN]})\\s+-\\s+(${Z[Q.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${Z[Q.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[Q.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ep=_((BEe,mB)=>{"use strict";var aae=Object.freeze({loose:!0}),uae=Object.freeze({}),cae=t=>t?typeof t!="object"?aae:t:uae;mB.exports=cae});var EE=_((jEe,DB)=>{"use strict";var gB=/^[0-9]+$/,yB=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=gB.test(t),n=gB.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},lae=(t,e)=>yB(e,t);DB.exports={compareIdentifiers:yB,rcompareIdentifiers:lae}});var Xt=_((MEe,vB)=>{"use strict";var bp=Qc(),{MAX_LENGTH:wB,MAX_SAFE_INTEGER:_p}=Zc(),{safeRe:Cp,t:Sp}=Ka(),fae=Ep(),{compareIdentifiers:bE}=EE(),_E=class t{constructor(e,r){if(r=fae(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>wB)throw new TypeError(`version is longer than ${wB} characters`);bp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cp[Sp.LOOSE]:Cp[Sp.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>_p||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_p||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_p||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<_p)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(bp("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(bp("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 bE(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(bp("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 bE(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?Cp[Sp.PRERELEASELOOSE]:Cp[Sp.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]),bE(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}};vB.exports=_E});var oo=_((UEe,bB)=>{"use strict";var EB=Xt(),hae=(t,e,r=!1)=>{if(t instanceof EB)return t;try{return new EB(t,e)}catch(n){if(!r)return null;throw n}};bB.exports=hae});var CB=_((qEe,_B)=>{"use strict";var dae=oo(),pae=(t,e)=>{let r=dae(t,e);return r?r.version:null};_B.exports=pae});var AB=_((HEe,SB)=>{"use strict";var mae=oo(),gae=(t,e)=>{let r=mae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};SB.exports=gae});var TB=_((VEe,xB)=>{"use strict";var OB=Xt(),yae=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new OB(t instanceof OB?t.version:t,r).inc(e,n,i).version}catch{return null}};xB.exports=yae});var FB=_((zEe,PB)=>{"use strict";var IB=oo(),Dae=(t,e)=>{let r=IB(t,null,!0),n=IB(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"};PB.exports=Dae});var kB=_((KEe,RB)=>{"use strict";var wae=Xt(),vae=(t,e)=>new wae(t,e).major;RB.exports=vae});var $B=_((GEe,NB)=>{"use strict";var Eae=Xt(),bae=(t,e)=>new Eae(t,e).minor;NB.exports=bae});var BB=_((WEe,LB)=>{"use strict";var _ae=Xt(),Cae=(t,e)=>new _ae(t,e).patch;LB.exports=Cae});var MB=_((XEe,jB)=>{"use strict";var Sae=oo(),Aae=(t,e)=>{let r=Sae(t,e);return r&&r.prerelease.length?r.prerelease:null};jB.exports=Aae});var Jr=_((YEe,qB)=>{"use strict";var UB=Xt(),Oae=(t,e,r)=>new UB(t,r).compare(new UB(e,r));qB.exports=Oae});var VB=_((JEe,HB)=>{"use strict";var xae=Jr(),Tae=(t,e,r)=>xae(e,t,r);HB.exports=Tae});var KB=_((ZEe,zB)=>{"use strict";var Iae=Jr(),Pae=(t,e)=>Iae(t,e,!0);zB.exports=Pae});var Ap=_((QEe,WB)=>{"use strict";var GB=Xt(),Fae=(t,e,r)=>{let n=new GB(t,r),i=new GB(e,r);return n.compare(i)||n.compareBuild(i)};WB.exports=Fae});var YB=_((ebe,XB)=>{"use strict";var Rae=Ap(),kae=(t,e)=>t.sort((r,n)=>Rae(r,n,e));XB.exports=kae});var ZB=_((tbe,JB)=>{"use strict";var Nae=Ap(),$ae=(t,e)=>t.sort((r,n)=>Nae(n,r,e));JB.exports=$ae});var el=_((rbe,QB)=>{"use strict";var Lae=Jr(),Bae=(t,e,r)=>Lae(t,e,r)>0;QB.exports=Bae});var Op=_((nbe,ej)=>{"use strict";var jae=Jr(),Mae=(t,e,r)=>jae(t,e,r)<0;ej.exports=Mae});var CE=_((ibe,tj)=>{"use strict";var Uae=Jr(),qae=(t,e,r)=>Uae(t,e,r)===0;tj.exports=qae});var SE=_((sbe,rj)=>{"use strict";var Hae=Jr(),Vae=(t,e,r)=>Hae(t,e,r)!==0;rj.exports=Vae});var xp=_((obe,nj)=>{"use strict";var zae=Jr(),Kae=(t,e,r)=>zae(t,e,r)>=0;nj.exports=Kae});var Tp=_((abe,ij)=>{"use strict";var Gae=Jr(),Wae=(t,e,r)=>Gae(t,e,r)<=0;ij.exports=Wae});var AE=_((ube,sj)=>{"use strict";var Xae=CE(),Yae=SE(),Jae=el(),Zae=xp(),Qae=Op(),eue=Tp(),tue=(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 Xae(t,r,n);case"!=":return Yae(t,r,n);case">":return Jae(t,r,n);case">=":return Zae(t,r,n);case"<":return Qae(t,r,n);case"<=":return eue(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};sj.exports=tue});var aj=_((cbe,oj)=>{"use strict";var rue=Xt(),nue=oo(),{safeRe:Ip,t:Pp}=Ka(),iue=(t,e)=>{if(t instanceof rue)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?Ip[Pp.COERCEFULL]:Ip[Pp.COERCE]);else{let u=e.includePrerelease?Ip[Pp.COERCERTLFULL]:Ip[Pp.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 nue(`${n}.${i}.${s}${o}${a}`,e)};oj.exports=iue});var cj=_((lbe,uj)=>{"use strict";var OE=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}};uj.exports=OE});var Zr=_((fbe,dj)=>{"use strict";var sue=/\s+/g,xE=class t{constructor(e,r){if(r=aue(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof TE)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(sue," "),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=>!fj(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&&pue(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&&hue)|(this.options.loose&&due))+":"+e,i=lj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,Cue(this.options.includePrerelease)),tt("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],cue),tt("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],lue),tt("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],fue),tt("caret trim",e);let a=e.split(" ").map(h=>mue(h,this.options)).join(" ").split(/\s+/).map(h=>_ue(h,this.options));s&&(a=a.filter(h=>(tt("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),tt("range list",a);let u=new Map,c=a.map(h=>new TE(h,this.options));for(let h of c){if(fj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return lj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>hj(n,r)&&e.set.some(i=>hj(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 uue(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Sue(this.set[r],e,this.options))return!0;return!1}};dj.exports=xE;var oue=cj(),lj=new oue,aue=Ep(),TE=tl(),tt=Qc(),uue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:cue,tildeTrimReplace:lue,caretTrimReplace:fue}=Ka(),{FLAG_INCLUDE_PRERELEASE:hue,FLAG_LOOSE:due}=Zc(),fj=t=>t.value==="<0.0.0-0",pue=t=>t.value==="",hj=(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},mue=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),tt("comp",t,e),t=Due(t,e),tt("caret",t),t=gue(t,e),tt("tildes",t),t=vue(t,e),tt("xrange",t),t=bue(t,e),tt("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",gue=(t,e)=>t.trim().split(/\s+/).map(r=>yue(r,e)).join(" "),yue=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{tt("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?(tt("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,tt("tilde return",u),u})},Due=(t,e)=>t.trim().split(/\s+/).map(r=>wue(r,e)).join(" "),wue=(t,e)=>{tt("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)=>{tt("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?(tt("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`):(tt("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`),tt("caret return",c),c})},vue=(t,e)=>(tt("replaceXRanges",t,e),t.split(/\s+/).map(r=>Eue(r,e)).join(" ")),Eue=(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)=>{tt("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`),tt("xRange return",n),n})},bue=(t,e)=>(tt("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),_ue=(t,e)=>(tt("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),Cue=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()),Sue=(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(tt(t[n].semver),t[n].semver!==TE.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 tl=_((hbe,wj)=>{"use strict";var rl=Symbol("SemVer ANY"),FE=class t{static get ANY(){return rl}constructor(e,r){if(r=pj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),PE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===rl?this.value="":this.value=this.operator+this.semver.version,PE("comp",this)}parse(e){let r=this.options.loose?mj[gj.COMPARATORLOOSE]:mj[gj.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 yj(n[2],this.options.loose):this.semver=rl}toString(){return this.value}test(e){if(PE("Comparator.test",e,this.options.loose),this.semver===rl||e===rl)return!0;if(typeof e=="string")try{e=new yj(e,this.options)}catch{return!1}return IE(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 Dj(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Dj(this.value,r).test(e.semver):(r=pj(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("=")||IE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||IE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};wj.exports=FE;var pj=Ep(),{safeRe:mj,t:gj}=Ka(),IE=AE(),PE=Qc(),yj=Xt(),Dj=Zr()});var nl=_((dbe,vj)=>{"use strict";var Aue=Zr(),Oue=(t,e,r)=>{try{e=new Aue(e,r)}catch{return!1}return e.test(t)};vj.exports=Oue});var bj=_((pbe,Ej)=>{"use strict";var xue=Zr(),Tue=(t,e)=>new xue(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Ej.exports=Tue});var Cj=_((mbe,_j)=>{"use strict";var Iue=Xt(),Pue=Zr(),Fue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Pue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Iue(n,r))}),n};_j.exports=Fue});var Aj=_((gbe,Sj)=>{"use strict";var Rue=Xt(),kue=Zr(),Nue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new kue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Rue(n,r))}),n};Sj.exports=Nue});var Tj=_((ybe,xj)=>{"use strict";var RE=Xt(),$ue=Zr(),Oj=el(),Lue=(t,e)=>{t=new $ue(t,e);let r=new RE("0.0.0");if(t.test(r)||(r=new RE("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 RE(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Oj(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Oj(r,s))&&(r=s)}return r&&t.test(r)?r:null};xj.exports=Lue});var Pj=_((Dbe,Ij)=>{"use strict";var Bue=Zr(),jue=(t,e)=>{try{return new Bue(t,e).range||"*"}catch{return null}};Ij.exports=jue});var Fp=_((wbe,Nj)=>{"use strict";var Mue=Xt(),kj=tl(),{ANY:Uue}=kj,que=Zr(),Hue=nl(),Fj=el(),Rj=Op(),Vue=Tp(),zue=xp(),Kue=(t,e,r,n)=>{t=new Mue(t,n),e=new que(e,n);let i,s,o,a,u;switch(r){case">":i=Fj,s=Vue,o=Rj,a=">",u=">=";break;case"<":i=Rj,s=zue,o=Fj,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Hue(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===Uue&&(f=new kj(">=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};Nj.exports=Kue});var Lj=_((vbe,$j)=>{"use strict";var Gue=Fp(),Wue=(t,e,r)=>Gue(t,e,">",r);$j.exports=Wue});var jj=_((Ebe,Bj)=>{"use strict";var Xue=Fp(),Yue=(t,e,r)=>Xue(t,e,"<",r);Bj.exports=Yue});var qj=_((bbe,Uj)=>{"use strict";var Mj=Zr(),Jue=(t,e,r)=>(t=new Mj(t,r),e=new Mj(e,r),t.intersects(e,r));Uj.exports=Jue});var Vj=_((_be,Hj)=>{"use strict";var Zue=nl(),Que=Jr();Hj.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>Que(l,h,r));for(let l of o)Zue(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 Yj=_((Cbe,Xj)=>{"use strict";var zj=Zr(),NE=tl(),{ANY:kE}=NE,il=nl(),$E=Jr(),ece=(t,e,r={})=>{if(t===e)return!0;t=new zj(t,r),e=new zj(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=rce(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},tce=[new NE(">=0.0.0-0")],Kj=[new NE(">=0.0.0")],rce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===kE){if(e.length===1&&e[0].semver===kE)return!0;r.includePrerelease?t=tce:t=Kj}if(e.length===1&&e[0].semver===kE){if(r.includePrerelease)return!0;e=Kj}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=Gj(i,f,r):f.operator==="<"||f.operator==="<="?s=Wj(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=$E(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&&!il(f,String(i),r)||s&&!il(f,String(s),r))return null;for(let m of e)if(!il(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=Gj(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!il(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=Wj(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!il(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)},Gj=(t,e,r)=>{if(!t)return e;let n=$E(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Wj=(t,e,r)=>{if(!t)return e;let n=$E(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Xj.exports=ece});var eM=_((Sbe,Qj)=>{"use strict";var LE=Ka(),Jj=Zc(),nce=Xt(),Zj=EE(),ice=oo(),sce=CB(),oce=AB(),ace=TB(),uce=FB(),cce=kB(),lce=$B(),fce=BB(),hce=MB(),dce=Jr(),pce=VB(),mce=KB(),gce=Ap(),yce=YB(),Dce=ZB(),wce=el(),vce=Op(),Ece=CE(),bce=SE(),_ce=xp(),Cce=Tp(),Sce=AE(),Ace=aj(),Oce=tl(),xce=Zr(),Tce=nl(),Ice=bj(),Pce=Cj(),Fce=Aj(),Rce=Tj(),kce=Pj(),Nce=Fp(),$ce=Lj(),Lce=jj(),Bce=qj(),jce=Vj(),Mce=Yj();Qj.exports={parse:ice,valid:sce,clean:oce,inc:ace,diff:uce,major:cce,minor:lce,patch:fce,prerelease:hce,compare:dce,rcompare:pce,compareLoose:mce,compareBuild:gce,sort:yce,rsort:Dce,gt:wce,lt:vce,eq:Ece,neq:bce,gte:_ce,lte:Cce,cmp:Sce,coerce:Ace,Comparator:Oce,Range:xce,satisfies:Tce,toComparators:Ice,maxSatisfying:Pce,minSatisfying:Fce,minVersion:Rce,validRange:kce,outside:Nce,gtr:$ce,ltr:Lce,intersects:Bce,simplifyRange:jce,subset:Mce,SemVer:nce,re:LE.re,src:LE.src,tokens:LE.t,SEMVER_SPEC_VERSION:Jj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Jj.RELEASE_TYPES,compareIdentifiers:Zj.compareIdentifiers,rcompareIdentifiers:Zj.rcompareIdentifiers}});var hM=_(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.parseApkNameFromFlavor=ee.checkJDKMajorVersion=ee.resolvePlatform=ee.checkPlatformVersions=ee.getAddedPlatforms=ee.getPlatformTargetName=ee.promptForPlatformTarget=ee.promptForPlatform=ee.isValidEnterprisePlatform=ee.getKnownEnterprisePlatforms=ee.isValidCommunityPlatform=ee.getKnownCommunityPlatforms=ee.isValidPlatform=ee.getKnownPlatforms=ee.selectPlatforms=ee.getProjectPlatformDirectory=ee.getCLIVersion=ee.getCoreVersion=ee.getCapacitorPackageVersion=ee.requireCapacitorPackage=ee.getCapacitorPackage=ee.runTask=ee.runPlatformHook=ee.runHooks=ee.wait=ee.checkAppName=ee.checkAppId=ee.checkAppDir=ee.checkAppConfig=ee.checkCapacitorPlatform=ee.checkPackage=ee.checkWebDir=ee.check=void 0;var ol=(he(),ce(fe)),tM=Ki(),ss=Sa(),ao=require("path"),qe=ol.__importDefault(Aa()),Ga=pd(),nM=Sc(),Uce=r$(),rM=Ll(),sl=jd(),qce=vp();async function Hce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
206
+ see https://github.com/jprichardson/node-fs-extra/issues/269`),zc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;zc.checkParentPaths(t,o,e,"copy",u=>u?n(u):r.filter?x$(S$,a,t,e,r,n):S$(a,t,e,r,n))})}function S$(t,e,r,n,i){let s=Vc.dirname(r);Die(s,(o,a)=>{if(o)return i(o);if(a)return Vv(t,e,r,n,i);yie(s,u=>u?i(u):Vv(t,e,r,n,i))})}function x$(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 Vv(t,e,r,n,i){return n.filter?x$(A$,t,e,r,n,i):A$(t,e,r,n,i)}function A$(t,e,r,n,i){(n.dereference?Or.stat:Or.lstat)(e,(o,a)=>{if(o)return i(o);if(a.isDirectory())return Oie(a,t,e,r,n,i);if(a.isFile()||a.isCharacterDevice()||a.isBlockDevice())return Eie(a,t,e,r,n,i);if(a.isSymbolicLink())return Iie(t,e,r,n,i)})}function Eie(t,e,r,n,i,s){return e?bie(t,r,n,i,s):T$(t,r,n,i,s)}function bie(t,e,r,n,i){if(n.overwrite)Or.unlink(r,s=>s?i(s):T$(t,e,r,n,i));else return n.errorOnExist?i(new Error(`'${r}' already exists`)):i()}function T$(t,e,r,n,i){Or.copyFile(e,r,s=>s?i(s):n.preserveTimestamps?_ie(t.mode,e,r,i):op(r,t.mode,i))}function _ie(t,e,r,n){return Cie(t)?Sie(r,t,i=>i?n(i):O$(t,e,r,n)):O$(t,e,r,n)}function Cie(t){return(t&128)===0}function Sie(t,e,r){return op(t,e|128,r)}function O$(t,e,r,n){Aie(e,r,i=>i?n(i):op(r,t,n))}function op(t,e,r){return Or.chmod(t,e,r)}function Aie(t,e,r){Or.stat(t,(n,i)=>n?r(n):wie(e,i.atime,i.mtime,r))}function Oie(t,e,r,n,i,s){return e?e&&!e.isDirectory()?s(new Error(`Cannot overwrite non-directory '${n}' with directory '${r}'.`)):I$(r,n,i,s):xie(t.mode,r,n,i,s)}function xie(t,e,r,n,i){Or.mkdir(r,s=>{if(s)return i(s);I$(e,r,n,o=>o?i(o):op(r,t,i))})}function I$(t,e,r,n){Or.readdir(t,(i,s)=>i?n(i):P$(s,t,e,r,n))}function P$(t,e,r,n,i){let s=t.pop();return s?Tie(t,s,e,r,n,i):i()}function Tie(t,e,r,n,i,s){let o=Vc.join(r,e),a=Vc.join(n,e);zc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Vv(l,o,a,i,h=>h?s(h):P$(t,r,n,i,s))})}function Iie(t,e,r,n,i){Or.readlink(e,(s,o)=>{if(s)return i(s);if(n.dereference&&(o=Vc.resolve(process.cwd(),o)),t)Or.readlink(r,(a,u)=>a?a.code==="EINVAL"||a.code==="UNKNOWN"?Or.symlink(o,r,i):i(a):(n.dereference&&(u=Vc.resolve(process.cwd(),u)),zc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&zc.isSrcSubdir(u,o)?i(new Error(`Cannot overwrite '${u}' with '${o}'.`)):Pie(o,r,i)));else return Or.symlink(o,r,i)})}function Pie(t,e,r){Or.unlink(e,n=>n?r(n):Or.symlink(t,e,r))}F$.exports=vie});var zv=_((Wve,k$)=>{"use strict";var Fie=Re().fromCallback;k$.exports={copy:Fie(R$())}});var H$=_((Xve,q$)=>{"use strict";var N$=vt(),j$=require("path"),He=require("assert"),Kc=process.platform==="win32";function M$(t){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(r=>{t[r]=t[r]||N$[r],r=r+"Sync",t[r]=t[r]||N$[r]}),t.maxBusyTries=t.maxBusyTries||3}function Kv(t,e,r){let n=0;typeof e=="function"&&(r=e,e={}),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He.strictEqual(typeof r,"function","rimraf: callback function required"),He(e,"rimraf: invalid options argument provided"),He.strictEqual(typeof e,"object","rimraf: options should be object"),M$(e),$$(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(()=>$$(t,e,i),o)}s.code==="ENOENT"&&(s=null)}r(s)})}function $$(t,e,r){He(t),He(e),He(typeof r=="function"),e.lstat(t,(n,i)=>{if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Kc)return L$(t,e,n,r);if(i&&i.isDirectory())return ap(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return Kc?L$(t,e,s,r):ap(t,e,s,r);if(s.code==="EISDIR")return ap(t,e,s,r)}return r(s)})})}function L$(t,e,r,n){He(t),He(e),He(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()?ap(t,e,r,n):e.unlink(t,n)})})}function B$(t,e,r){let n;He(t),He(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()?up(t,e,r):e.unlinkSync(t)}function ap(t,e,r,n){He(t),He(e),He(typeof n=="function"),e.rmdir(t,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Rie(t,e,n):i&&i.code==="ENOTDIR"?n(r):n(i)})}function Rie(t,e,r){He(t),He(e),He(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=>{Kv(j$.join(t,a),e,u=>{if(!o){if(u)return r(o=u);--s===0&&e.rmdir(t,r)}})})})}function U$(t,e){let r;e=e||{},M$(e),He(t,"rimraf: missing path"),He.strictEqual(typeof t,"string","rimraf: path should be a string"),He(e,"rimraf: missing options"),He.strictEqual(typeof e,"object","rimraf: options should be object");try{r=e.lstatSync(t)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&Kc&&B$(t,e,n)}try{r&&r.isDirectory()?up(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return Kc?B$(t,e,n):up(t,e,n);if(n.code!=="EISDIR")throw n;up(t,e,n)}}function up(t,e,r){He(t),He(e);try{e.rmdirSync(t)}catch(n){if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")kie(t,e);else if(n.code!=="ENOENT")throw n}}function kie(t,e){if(He(t),He(e),e.readdirSync(t).forEach(r=>U$(j$.join(t,r),e)),Kc){let r=Date.now();do try{return e.rmdirSync(t,e)}catch{}while(Date.now()-r<500)}else return e.rmdirSync(t,e)}q$.exports=Kv;Kv.sync=U$});var Gc=_((Yve,z$)=>{"use strict";var Nie=Re().fromCallback,V$=H$();z$.exports={remove:Nie(V$),removeSync:V$.sync}});var Q$=_((Jve,Z$)=>{"use strict";var $ie=Re().fromCallback,W$=vt(),X$=require("path"),Y$=mn(),J$=Gc(),K$=$ie(function(e,r){r=r||function(){},W$.readdir(e,(n,i)=>{if(n)return Y$.mkdirs(e,r);i=i.map(o=>X$.join(e,o)),s();function s(){let o=i.pop();if(!o)return r();J$.remove(o,a=>{if(a)return r(a);s()})}})});function G$(t){let e;try{e=W$.readdirSync(t)}catch{return Y$.mkdirsSync(t)}e.forEach(r=>{r=X$.join(t,r),J$.removeSync(r)})}Z$.exports={emptyDirSync:G$,emptydirSync:G$,emptyDir:K$,emptydir:K$}});var nL=_((Zve,rL)=>{"use strict";var Lie=Re().fromCallback,eL=require("path"),rs=vt(),tL=mn();function Bie(t,e){function r(){rs.writeFile(t,"",n=>{if(n)return e(n);e()})}rs.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=eL.dirname(t);rs.stat(s,(o,a)=>{if(o)return o.code==="ENOENT"?tL.mkdirs(s,u=>{if(u)return e(u);r()}):e(o);a.isDirectory()?r():rs.readdir(s,u=>{if(u)return e(u)})})})}function jie(t){let e;try{e=rs.statSync(t)}catch{}if(e&&e.isFile())return;let r=eL.dirname(t);try{rs.statSync(r).isDirectory()||rs.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")tL.mkdirsSync(r);else throw n}rs.writeFileSync(t,"")}rL.exports={createFile:Lie(Bie),createFileSync:jie}});var uL=_((Qve,aL)=>{"use strict";var Mie=Re().fromCallback,sL=require("path"),ro=vt(),oL=mn(),iL=ts().pathExists;function Uie(t,e,r){function n(i,s){ro.link(i,s,o=>{if(o)return r(o);r(null)})}iL(e,(i,s)=>{if(i)return r(i);if(s)return r(null);ro.lstat(t,o=>{if(o)return o.message=o.message.replace("lstat","ensureLink"),r(o);let a=sL.dirname(e);iL(a,(u,c)=>{if(u)return r(u);if(c)return n(t,e);oL.mkdirs(a,l=>{if(l)return r(l);n(t,e)})})})})}function qie(t,e){if(ro.existsSync(e))return;try{ro.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=sL.dirname(e);return ro.existsSync(n)||oL.mkdirsSync(n),ro.linkSync(t,e)}aL.exports={createLink:Mie(Uie),createLinkSync:qie}});var lL=_((eEe,cL)=>{"use strict";var ns=require("path"),Wc=vt(),Hie=ts().pathExists;function Vie(t,e,r){if(ns.isAbsolute(t))return Wc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=ns.dirname(e),i=ns.join(n,t);return Hie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Wc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:ns.relative(n,t)})))}}function zie(t,e){let r;if(ns.isAbsolute(t)){if(r=Wc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=ns.dirname(e),i=ns.join(n,t);if(r=Wc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Wc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:ns.relative(n,t)}}}cL.exports={symlinkPaths:Vie,symlinkPathsSync:zie}});var dL=_((tEe,hL)=>{"use strict";var fL=vt();function Kie(t,e,r){if(r=typeof e=="function"?e:r,e=typeof e=="function"?!1:e,e)return r(null,e);fL.lstat(t,(n,i)=>{if(n)return r(null,"file");e=i&&i.isDirectory()?"dir":"file",r(null,e)})}function Gie(t,e){let r;if(e)return e;try{r=fL.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}hL.exports={symlinkType:Kie,symlinkTypeSync:Gie}});var vL=_((rEe,wL)=>{"use strict";var Wie=Re().fromCallback,mL=require("path"),qa=vt(),gL=mn(),Xie=gL.mkdirs,Yie=gL.mkdirsSync,yL=lL(),Jie=yL.symlinkPaths,Zie=yL.symlinkPathsSync,DL=dL(),Qie=DL.symlinkType,ese=DL.symlinkTypeSync,pL=ts().pathExists;function tse(t,e,r,n){n=typeof r=="function"?r:n,r=typeof r=="function"?!1:r,pL(e,(i,s)=>{if(i)return n(i);if(s)return n(null);Jie(t,e,(o,a)=>{if(o)return n(o);t=a.toDst,Qie(a.toCwd,r,(u,c)=>{if(u)return n(u);let l=mL.dirname(e);pL(l,(h,d)=>{if(h)return n(h);if(d)return qa.symlink(t,e,c,n);Xie(l,f=>{if(f)return n(f);qa.symlink(t,e,c,n)})})})})})}function rse(t,e,r){if(qa.existsSync(e))return;let i=Zie(t,e);t=i.toDst,r=ese(i.toCwd,r);let s=mL.dirname(e);return qa.existsSync(s)||Yie(s),qa.symlinkSync(t,e,r)}wL.exports={createSymlink:Wie(tse),createSymlinkSync:rse}});var bL=_((nEe,EL)=>{"use strict";var cp=nL(),lp=uL(),fp=vL();EL.exports={createFile:cp.createFile,createFileSync:cp.createFileSync,ensureFile:cp.createFile,ensureFileSync:cp.createFileSync,createLink:lp.createLink,createLinkSync:lp.createLinkSync,ensureLink:lp.createLink,ensureLinkSync:lp.createLinkSync,createSymlink:fp.createSymlink,createSymlinkSync:fp.createSymlinkSync,ensureSymlink:fp.createSymlink,ensureSymlinkSync:fp.createSymlinkSync}});var CL=_((iEe,_L)=>{"use strict";var hp=N0();_L.exports={readJson:hp.readFile,readJsonSync:hp.readFileSync,writeJson:hp.writeFile,writeJsonSync:hp.writeFileSync}});var dp=_((sEe,OL)=>{"use strict";var nse=Re().fromCallback,Xc=vt(),SL=require("path"),AL=mn(),ise=ts().pathExists;function sse(t,e,r,n){typeof r=="function"&&(n=r,r="utf8");let i=SL.dirname(t);ise(i,(s,o)=>{if(s)return n(s);if(o)return Xc.writeFile(t,e,r,n);AL.mkdirs(i,a=>{if(a)return n(a);Xc.writeFile(t,e,r,n)})})}function ose(t,...e){let r=SL.dirname(t);if(Xc.existsSync(r))return Xc.writeFileSync(t,...e);AL.mkdirsSync(r),Xc.writeFileSync(t,...e)}OL.exports={outputFile:nse(sse),outputFileSync:ose}});var TL=_((oEe,xL)=>{"use strict";var{stringify:ase}=_a(),{outputFile:use}=dp();async function cse(t,e,r={}){let n=ase(e,r);await use(t,n,r)}xL.exports=cse});var PL=_((aEe,IL)=>{"use strict";var{stringify:lse}=_a(),{outputFileSync:fse}=dp();function hse(t,e,r){let n=lse(e,r);fse(t,n,r)}IL.exports=hse});var RL=_((uEe,FL)=>{"use strict";var dse=Re().fromPromise,cr=CL();cr.outputJson=dse(TL());cr.outputJsonSync=PL();cr.outputJSON=cr.outputJson;cr.outputJSONSync=cr.outputJsonSync;cr.writeJSON=cr.writeJson;cr.writeJSONSync=cr.writeJsonSync;cr.readJSON=cr.readJson;cr.readJSONSync=cr.readJsonSync;FL.exports=cr});var jL=_((cEe,BL)=>{"use strict";var $L=vt(),pse=require("path"),mse=Hv().copySync,LL=Gc().removeSync,gse=mn().mkdirpSync,kL=Uc();function yse(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i}=kL.checkPathsSync(t,e,"move");return kL.checkParentPathsSync(t,i,e,"move"),gse(pse.dirname(e)),Dse(t,e,n)}function Dse(t,e,r){if(r)return LL(e),NL(t,e,r);if($L.existsSync(e))throw new Error("dest already exists.");return NL(t,e,r)}function NL(t,e,r){try{$L.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return wse(t,e,r)}}function wse(t,e,r){return mse(t,e,{overwrite:r,errorOnExist:!0}),LL(t)}BL.exports=yse});var UL=_((lEe,ML)=>{"use strict";ML.exports={moveSync:jL()}});var KL=_((fEe,zL)=>{"use strict";var vse=vt(),Ese=require("path"),bse=zv().copy,VL=Gc().remove,_se=mn().mkdirp,Cse=ts().pathExists,qL=Uc();function Sse(t,e,r,n){typeof r=="function"&&(n=r,r={});let i=r.overwrite||r.clobber||!1;qL.checkPaths(t,e,"move",(s,o)=>{if(s)return n(s);let{srcStat:a}=o;qL.checkParentPaths(t,a,e,"move",u=>{if(u)return n(u);_se(Ese.dirname(e),c=>c?n(c):Ase(t,e,i,n))})})}function Ase(t,e,r,n){if(r)return VL(e,i=>i?n(i):HL(t,e,r,n));Cse(e,(i,s)=>i?n(i):s?n(new Error("dest already exists.")):HL(t,e,r,n))}function HL(t,e,r,n){vse.rename(t,e,i=>i?i.code!=="EXDEV"?n(i):Ose(t,e,r,n):n())}function Ose(t,e,r,n){bse(t,e,{overwrite:r,errorOnExist:!0},s=>s?n(s):VL(t,n))}zL.exports=Sse});var WL=_((hEe,GL)=>{"use strict";var xse=Re().fromCallback;GL.exports={move:xse(KL())}});var pp=_((dEe,Gv)=>{"use strict";Gv.exports={...Mc(),...Hv(),...zv(),...Q$(),...bL(),...RL(),...mn(),...UL(),...WL(),...dp(),...ts(),...Gc()};var XL=require("fs");Object.getOwnPropertyDescriptor(XL,"promises")&&Object.defineProperty(Gv.exports,"promises",{get(){return XL.promises}})});var Wv=_(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.readdir=Ha.stat=void 0;var YL=pp();async function Tse(t){try{return await YL.stat(t)}catch{}}Ha.stat=Tse;async function Ise(t){try{return await YL.readdir(t)}catch{return[]}}Ha.readdir=Ise});var r3=_(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 Pse=(he(),ce(fe)),Yr=pp(),Fse=require("os"),Di=require("path"),JL=require("stream"),ZL=Wv();Pse.__exportStar(pp(),me);var QL=Wv();Object.defineProperty(me,"statSafe",{enumerable:!0,get:function(){return QL.stat}});Object.defineProperty(me,"readdirSafe",{enumerable:!0,get:function(){return QL.readdir}});async function Rse(t,{filter:e,onError:r,walkerOptions:n}={}){return new Promise((i,s)=>{let o=[],a=Yv(t,n);e&&(a=a.pipe(new JL.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=Rse;async function kse(t,{onError:e,onFileNode:r=s=>s,onDirectoryNode:n=s=>s,walkerOptions:i}={}){let s=new Map([]),o=u=>{let c=Di.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=Di.resolve(t),Yv(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=kse;async function Nse(t){try{return await Yr.readFile(t,{encoding:"utf8"})}catch(e){if(e.code==="ENOENT"||e.code==="ENOTDIR")return"";throw e}}me.fileToString=Nse;async function Xv(t){let e=await Promise.resolve().then(()=>require("crypto"));return new Promise((r,n)=>{let i=e.createHash("md5"),s=Yr.createReadStream(t);s.on("error",o=>{n(o)}),i.once("readable",()=>{let o=i.read().toString("hex");r(o)}),s.pipe(i)})}me.getFileChecksum=Xv;async function $se(t){return Promise.all([Xv(t),(async()=>{try{return(await Yr.readFile(`${t}.md5`,{encoding:"utf8"})).trim()}catch(e){if(e.code!=="ENOENT")throw e}})()])}me.getFileChecksums=$se;async function Lse(t,e){let r=await Xv(t);await Yr.writeFile(`${t}.md5`,r,{encoding:"utf8"})}me.cacheFileChecksum=Lse;function Bse(t,e){return new Promise((r,n)=>{let i=Yr.createWriteStream(e);t.pipe(i),i.on("error",n),i.on("finish",r)})}me.writeStreamToFile=Bse;async function Yc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Yc;async function jse(t){return Yc(t,Yr.constants.F_OK)}me.pathExists=jse;async function Mse(t){return Yc(t,Yr.constants.R_OK)}me.pathReadable=Mse;async function Use(t){return Yc(t,Yr.constants.W_OK)}me.pathWritable=Use;async function e3(t){return Yc(t,Yr.constants.X_OK)}me.pathExecutable=e3;async function qse(t){let[e,r]=await Promise.all([ZL.stat(t),e3(t)]);return!!e&&(e.isFile()||e.isSymbolicLink())&&r}me.isExecutableFile=qse;async function Hse(t,e){if(!(!t||!e)){for(let r of t3(t))if((await ZL.readdir(r)).includes(e))return r}}me.findBaseDirectory=Hse;function Vse(t){let e=Math.random().toString(16).substring(2,8);return Di.resolve(Fse.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=Vse;function t3(t){if(t=Di.normalize(t),!Di.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=Di.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(Di.sep).map((r,n,i)=>e.root+Di.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=t3;var mp=class extends JL.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}Yr.lstat(e,(n,i)=>{if(n){this.emit("error",n);return}let s={path:e,stats:i};i.isDirectory()?Yr.readdir(e,(o,a)=>{if(o){this.emit("error",o);return}let u=a.map(c=>Di.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=mp;function Yv(t,e={}){return new mp(t,e)}me.walk=Yv});var n3=_(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.AliasedMap=wi.CaseInsensitiveProxyHandler=wi.createCaseInsensitiveObject=void 0;function zse(){return new Proxy({},wi.CaseInsensitiveProxyHandler)}wi.createCaseInsensitiveObject=zse;wi.CaseInsensitiveProxyHandler={has:(t,e)=>gp(e)in t,get:(t,e)=>t[gp(e)],set:(t,e,r)=>(t[gp(e)]=r,!0),deleteProperty:(t,e)=>delete t[gp(e)]};var gp=t=>typeof t=="string"?t.toLowerCase():t,Jv=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)}};wi.AliasedMap=Jv});var c3=_((yEe,u3)=>{"use strict";var a3=require("child_process"),i3=a3.spawn,Kse=a3.exec;u3.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":Kse("taskkill /pid "+t+" /T /F",r);break;case"darwin":Zv(t,n,i,function(s){return i3("pgrep",["-P",s])},function(){s3(n,e,r)});break;default:Zv(t,n,i,function(s){return i3("ps",["-o","pid","--no-headers","--ppid",s])},function(){s3(n,e,r)});break}};function s3(t,e,r){var n={};try{Object.keys(t).forEach(function(i){t[i].forEach(function(s){n[s]||(o3(s,e),n[s]=1)}),n[i]||(o3(i,e),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}function o3(t,e){try{process.kill(parseInt(t,10),e)}catch(r){if(r.code!=="ESRCH")throw r}}function Zv(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,Zv(c,e,r,n,i)})};s.on("close",a)}});var h3=_(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.processExit=et.offBeforeExit=et.onBeforeExit=et.onExit=et.sleepForever=et.sleepUntil=et.sleep=et.getPathParts=et.createProcessEnv=et.killProcessTree=et.ERROR_TIMEOUT_REACHED=void 0;var Qv=(he(),ce(fe)),Gse=n3(),Wse=Ki(),Xse=Zh(),Yse=Qv.__importStar(require("path")),Jse=Qv.__importDefault(Uh()),Zse=Qv.__importDefault(c3()),no=(0,Xse.debug)("ionic:utils-process");et.ERROR_TIMEOUT_REACHED=new Error("TIMEOUT_REACHED");function Qse(t,e="SIGTERM"){return new Promise((r,n)=>{(0,Zse.default)(t,e,i=>{if(i)return no("error while killing process tree for %d: %O",t,i),n(i);r()})})}et.killProcessTree=Qse;function eoe(...t){return Object.assign(Wse.TERMINAL_INFO.windows?(0,Gse.createCaseInsensitiveObject)():{},...t)}et.createProcessEnv=eoe;function toe(t=process.env.PATH||""){return t.split(Yse.delimiter)}et.getPathParts=toe;async function l3(t){return new Promise(e=>{setTimeout(e,t)})}et.sleep=l3;async function roe(t,{interval:e=30,timeout:r=1/0}){let n=0;for(;!t();)if(await l3(e),n+=e,n>r)throw et.ERROR_TIMEOUT_REACHED}et.sleepUntil=roe;async function noe(){return new Promise(()=>{setInterval(()=>{},1e3)})}et.sleepForever=noe;function ioe(t){(0,Jse.default)(()=>{no("onExit: process.exit/normal shutdown"),t()})}et.onExit=ioe;var yp=new Set;function soe(t){yp.add(t)}et.onBeforeExit=soe;function ooe(t){yp.delete(t)}et.offBeforeExit=ooe;var aoe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Jc=t=>aoe(async()=>{no("onBeforeExit handler: %O received",t),no("onBeforeExit handler: running %O functions",yp.size),await Promise.all([...yp.values()].map(async e=>{try{await e()}catch(r){no("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(no("onBeforeExit handler: killing self (exit code %O, signal %O)",process.exitCode?process.exitCode:0,t),process.removeListener(t,f3[t]),process.kill(process.pid,t))}),f3={SIGINT:Jc("SIGINT"),SIGTERM:Jc("SIGTERM"),SIGHUP:Jc("SIGHUP"),SIGBREAK:Jc("SIGBREAK")};for(let[t,e]of Object.entries(f3))process.on(t,e);var uoe=Jc("process.exit");async function coe(t=0){process.exitCode=t,await uoe(),no("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=coe});var m3=_(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var nE=require("stream"),loe=4,d3=32,p3=16,eE=class extends nE.Writable{_write(e,r,n){n()}};jn.NullStream=eE;var tE=class extends nE.Readable{constructor(e){super(e),this._size=0,this._stopped=!1,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:d3),this.chunkSize=e&&e.chunkSize?e.chunkSize:loe,this.growSize=e&&e.growSize?e.growSize:p3}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=iE(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)}};jn.ReadableStreamBuffer=tE;var rE=class extends nE.Writable{constructor(e){super(e),this._size=0,this.buffer=Buffer.alloc(e&&e.allocSize?e.allocSize:d3),this.growSize=e&&e.growSize?e.growSize:p3}get size(){return this._size}_write(e,r,n){this.buffer=iE(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}};jn.WritableStreamBuffer=rE;function iE(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}jn.growBufferForAppendedData=iE});var v3=_((vEe,w3)=>{w3.exports=D3;D3.sync=hoe;var g3=require("fs");function foe(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 y3(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:foe(e,r)}function D3(t,e,r){g3.stat(t,function(n,i){r(n,n?!1:y3(i,t,e))})}function hoe(t,e){return y3(g3.statSync(t),t,e)}});var S3=_((EEe,C3)=>{C3.exports=b3;b3.sync=doe;var E3=require("fs");function b3(t,e,r){E3.stat(t,function(n,i){r(n,n?!1:_3(i,e))})}function doe(t,e){return _3(E3.statSync(t),e)}function _3(t,e){return t.isFile()&&poe(t,e)}function poe(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 O3=_((_Ee,A3)=>{var bEe=require("fs"),Dp;process.platform==="win32"||global.TESTING_WINDOWS?Dp=v3():Dp=S3();A3.exports=sE;sE.sync=moe;function sE(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){sE(t,e||{},function(s,o){s?i(s):n(o)})})}Dp(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function moe(t,e){try{return Dp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var k3=_((CEe,R3)=>{var Va=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x3=require("path"),goe=Va?";":":",T3=O3(),I3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),P3=(t,e)=>{let r=e.colon||goe,n=t.match(/\//)||Va&&t.match(/\\/)?[""]:[...Va?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Va?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Va?i.split(r):[""];return Va&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},F3=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=P3(t,e),o=[],a=c=>new Promise((l,h)=>{if(c===n.length)return e.all&&o.length?l(o):h(I3(t));let d=n[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,p=x3.join(f,t),y=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;l(u(y,c,0))}),u=(c,l,h)=>new Promise((d,f)=>{if(h===i.length)return d(a(l+1));let p=i[h];T3(c+p,{pathExt:s},(y,v)=>{if(!y&&v)if(e.all)o.push(c+p);else return d(c+p);return d(u(c,l,h+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},yoe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=P3(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=x3.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(T3.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 I3(t)};R3.exports=F3;F3.sync=yoe});var $3=_((SEe,oE)=>{"use strict";var N3=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};oE.exports=N3;oE.exports.default=N3});var M3=_((AEe,j3)=>{"use strict";var L3=require("path"),Doe=k3(),woe=$3();function B3(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=Doe.sync(t.command,{path:r[woe({env:r})],pathExt:e?L3.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=L3.resolve(i?t.options.cwd:"",o)),o}function voe(t){return B3(t)||B3(t,!0)}j3.exports=voe});var U3=_((OEe,uE)=>{"use strict";var aE=/([()\][%!^"`<>&|;, *?])/g;function Eoe(t){return t=t.replace(aE,"^$1"),t}function boe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(aE,"^$1"),e&&(t=t.replace(aE,"^$1")),t}uE.exports.command=Eoe;uE.exports.argument=boe});var H3=_((xEe,q3)=>{"use strict";q3.exports=/^#!(.*)/});var z3=_((TEe,V3)=>{"use strict";var _oe=H3();V3.exports=(t="")=>{let e=t.match(_oe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var G3=_((IEe,K3)=>{"use strict";var cE=require("fs"),Coe=z3();function Soe(t){let r=Buffer.alloc(150),n;try{n=cE.openSync(t,"r"),cE.readSync(n,r,0,150,0),cE.closeSync(n)}catch{}return Coe(r.toString())}K3.exports=Soe});var J3=_((PEe,Y3)=>{"use strict";var Aoe=require("path"),W3=M3(),X3=U3(),Ooe=G3(),xoe=process.platform==="win32",Toe=/\.(?:com|exe)$/i,Ioe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Poe(t){t.file=W3(t);let e=t.file&&Ooe(t.file);return e?(t.args.unshift(t.file),t.command=e,W3(t)):t.file}function Foe(t){if(!xoe)return t;let e=Poe(t),r=!Toe.test(e);if(t.options.forceShell||r){let n=Ioe.test(e);t.command=Aoe.normalize(t.command),t.command=X3.command(t.command),t.args=t.args.map(s=>X3.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 Roe(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:Foe(n)}Y3.exports=Roe});var eB=_((FEe,Q3)=>{"use strict";var lE=process.platform==="win32";function fE(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 koe(t,e){if(!lE)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=Z3(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Z3(t,e){return lE&&t===1&&!e.file?fE(e.original,"spawn"):null}function Noe(t,e){return lE&&t===1&&!e.file?fE(e.original,"spawnSync"):null}Q3.exports={hookChildProcess:koe,verifyENOENT:Z3,verifyENOENTSync:Noe,notFoundError:fE}});var nB=_((REe,za)=>{"use strict";var tB=require("child_process"),hE=J3(),dE=eB();function rB(t,e,r){let n=hE(t,e,r),i=tB.spawn(n.command,n.args,n.options);return dE.hookChildProcess(i,n),i}function $oe(t,e,r){let n=hE(t,e,r),i=tB.spawnSync(n.command,n.args,n.options);return i.error=i.error||dE.verifyENOENTSync(i.status,n),i}za.exports=rB;za.exports.spawn=rB;za.exports.sync=$oe;za.exports._parse=hE;za.exports._enoent=dE});var lB=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.findExecutables=ke.which=ke.fork=ke.spawn=ke.Subprocess=ke.SubprocessError=ke.convertPATH=ke.expandTildePath=ke.TILDE_PATH_REGEX=ke.ERROR_SIGNAL_EXIT=ke.ERROR_NON_ZERO_EXIT=ke.ERROR_COMMAND_NOT_FOUND=void 0;var gE=(he(),ce(fe)),iB=n$(),Loe=r3(),pE=h3(),wp=m3(),sB=Ki(),Boe=require("child_process"),joe=gE.__importDefault(nB()),Moe=gE.__importStar(require("os")),so=gE.__importStar(require("path"));ke.ERROR_COMMAND_NOT_FOUND="ERR_SUBPROCESS_COMMAND_NOT_FOUND";ke.ERROR_NON_ZERO_EXIT="ERR_SUBPROCESS_NON_ZERO_EXIT";ke.ERROR_SIGNAL_EXIT="ERR_SUBPROCESS_SIGNAL_EXIT";ke.TILDE_PATH_REGEX=/^~($|\/|\\)/;function oB(t){let e=Moe.homedir();return t.replace(ke.TILDE_PATH_REGEX,`${e}$1`)}ke.expandTildePath=oB;function aB(t=process.env.PATH||""){return t.split(so.delimiter).map(oB).join(so.delimiter)}ke.convertPATH=aB;var io=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};ke.SubprocessError=io;var mE=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,pE.createProcessEnv)(e.env||{},{PATH:aB(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 wp.WritableStreamBuffer,n=new wp.WritableStreamBuffer,i=new wp.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 wp.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 io("Command not found.",{cause:s}),o.code=ke.ERROR_COMMAND_NOT_FOUND):o=new io("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new io("Signal exit from subprocess."),a.code=ke.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new io("Non-zero exit from subprocess."),a.code=ke.ERROR_NON_ZERO_EXIT,a.exitCode=s;else return n();i(a)})});return Object.defineProperties(r,{p:{value:e}}),r}spawn(){return uB(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(so.sep);return r>=0?e.substring(r+1):e}};ke.Subprocess=mE;function uB(t,e=[],r){return(0,joe.default)(t,[...e],r)}ke.spawn=uB;function Uoe(t,e=[],r={}){return(0,Boe.fork)(t,[...e],r)}ke.fork=Uoe;var yE=sB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){if(t.includes(so.sep))return t;let n=await cB(t,{PATH:e});if(!n.length){let i=new Error(`${t} cannot be found within PATH`);throw i.code="ENOENT",i}return n[0]}ke.which=qoe;async function Hoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){return t.includes(so.sep)?[t]:cB(t,{PATH:e})}ke.findExecutables=Hoe;async function cB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||yE}={}){let n=(0,pE.getPathParts)(e),i;if(sB.TERMINAL_INFO.windows){let s=(0,pE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(so.extname(t).toLowerCase())?[t]:s.map(o=>t+o)}else i=[t];return[].concat(...await(0,iB.map)(i,async s=>(0,iB.concurrentFilter)(n.map(o=>so.join(o,s)),async o=>(0,Loe.isExecutableFile)(o))))}});var vp=_(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});is.isInstalled=is.getCommandOutput=is.runCommand=void 0;var DE=lB();async function fB(t,e,r={}){let n=new DE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof DE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}is.runCommand=fB;async function Voe(t,e,r={}){try{return(await fB(t,e,r)).trim()}catch{return null}}is.getCommandOutput=Voe;async function zoe(t){try{await(0,DE.which)(t)}catch{return!1}return!0}is.isInstalled=zoe});var Zc=_(($Ee,hB)=>{"use strict";var Koe="2.0.0",Goe=Number.MAX_SAFE_INTEGER||9007199254740991,Woe=16,Xoe=250,Yoe=["major","premajor","minor","preminor","patch","prepatch","prerelease"];hB.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Woe,MAX_SAFE_BUILD_LENGTH:Xoe,MAX_SAFE_INTEGER:Goe,RELEASE_TYPES:Yoe,SEMVER_SPEC_VERSION:Koe,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qc=_((LEe,dB)=>{"use strict";var Joe=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};dB.exports=Joe});var Ka=_((Mn,pB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:wE,MAX_SAFE_BUILD_LENGTH:Zoe,MAX_LENGTH:Qoe}=Zc(),eae=Qc();Mn=pB.exports={};var tae=Mn.re=[],rae=Mn.safeRe=[],Z=Mn.src=[],nae=Mn.safeSrc=[],Q=Mn.t={},iae=0,vE="[a-zA-Z0-9-]",sae=[["\\s",1],["\\d",Qoe],[vE,Zoe]],oae=t=>{for(let[e,r]of sae)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ge=(t,e,r)=>{let n=oae(e),i=iae++;eae(t,i,e),Q[t]=i,Z[i]=e,nae[i]=n,tae[i]=new RegExp(e,r?"g":void 0),rae[i]=new RegExp(n,r?"g":void 0)};ge("NUMERICIDENTIFIER","0|[1-9]\\d*");ge("NUMERICIDENTIFIERLOOSE","\\d+");ge("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${vE}*`);ge("MAINVERSION",`(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})`);ge("MAINVERSIONLOOSE",`(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASEIDENTIFIER",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIER]})`);ge("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIERLOOSE]})`);ge("PRERELEASE",`(?:-(${Z[Q.PRERELEASEIDENTIFIER]}(?:\\.${Z[Q.PRERELEASEIDENTIFIER]})*))`);ge("PRERELEASELOOSE",`(?:-?(${Z[Q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[Q.PRERELEASEIDENTIFIERLOOSE]})*))`);ge("BUILDIDENTIFIER",`${vE}+`);ge("BUILD",`(?:\\+(${Z[Q.BUILDIDENTIFIER]}(?:\\.${Z[Q.BUILDIDENTIFIER]})*))`);ge("FULLPLAIN",`v?${Z[Q.MAINVERSION]}${Z[Q.PRERELEASE]}?${Z[Q.BUILD]}?`);ge("FULL",`^${Z[Q.FULLPLAIN]}$`);ge("LOOSEPLAIN",`[v=\\s]*${Z[Q.MAINVERSIONLOOSE]}${Z[Q.PRERELEASELOOSE]}?${Z[Q.BUILD]}?`);ge("LOOSE",`^${Z[Q.LOOSEPLAIN]}$`);ge("GTLT","((?:<|>)?=?)");ge("XRANGEIDENTIFIERLOOSE",`${Z[Q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ge("XRANGEIDENTIFIER",`${Z[Q.NUMERICIDENTIFIER]}|x|X|\\*`);ge("XRANGEPLAIN",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:${Z[Q.PRERELEASE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:${Z[Q.PRERELEASELOOSE]})?${Z[Q.BUILD]}?)?)?`);ge("XRANGE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAIN]}$`);ge("XRANGELOOSE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COERCEPLAIN",`(^|[^\\d])(\\d{1,${wE}})(?:\\.(\\d{1,${wE}}))?(?:\\.(\\d{1,${wE}}))?`);ge("COERCE",`${Z[Q.COERCEPLAIN]}(?:$|[^\\d])`);ge("COERCEFULL",Z[Q.COERCEPLAIN]+`(?:${Z[Q.PRERELEASE]})?(?:${Z[Q.BUILD]})?(?:$|[^\\d])`);ge("COERCERTL",Z[Q.COERCE],!0);ge("COERCERTLFULL",Z[Q.COERCEFULL],!0);ge("LONETILDE","(?:~>?)");ge("TILDETRIM",`(\\s*)${Z[Q.LONETILDE]}\\s+`,!0);Mn.tildeTrimReplace="$1~";ge("TILDE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAIN]}$`);ge("TILDELOOSE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("LONECARET","(?:\\^)");ge("CARETTRIM",`(\\s*)${Z[Q.LONECARET]}\\s+`,!0);Mn.caretTrimReplace="$1^";ge("CARET",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAIN]}$`);ge("CARETLOOSE",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAINLOOSE]}$`);ge("COMPARATORLOOSE",`^${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]})$|^$`);ge("COMPARATOR",`^${Z[Q.GTLT]}\\s*(${Z[Q.FULLPLAIN]})$|^$`);ge("COMPARATORTRIM",`(\\s*)${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]}|${Z[Q.XRANGEPLAIN]})`,!0);Mn.comparatorTrimReplace="$1$2$3";ge("HYPHENRANGE",`^\\s*(${Z[Q.XRANGEPLAIN]})\\s+-\\s+(${Z[Q.XRANGEPLAIN]})\\s*$`);ge("HYPHENRANGELOOSE",`^\\s*(${Z[Q.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[Q.XRANGEPLAINLOOSE]})\\s*$`);ge("STAR","(<|>)?=?\\s*\\*");ge("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ge("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ep=_((BEe,mB)=>{"use strict";var aae=Object.freeze({loose:!0}),uae=Object.freeze({}),cae=t=>t?typeof t!="object"?aae:t:uae;mB.exports=cae});var EE=_((jEe,DB)=>{"use strict";var gB=/^[0-9]+$/,yB=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=gB.test(t),n=gB.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},lae=(t,e)=>yB(e,t);DB.exports={compareIdentifiers:yB,rcompareIdentifiers:lae}});var Xt=_((MEe,vB)=>{"use strict";var bp=Qc(),{MAX_LENGTH:wB,MAX_SAFE_INTEGER:_p}=Zc(),{safeRe:Cp,t:Sp}=Ka(),fae=Ep(),{compareIdentifiers:bE}=EE(),_E=class t{constructor(e,r){if(r=fae(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>wB)throw new TypeError(`version is longer than ${wB} characters`);bp("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cp[Sp.LOOSE]:Cp[Sp.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>_p||this.major<0)throw new TypeError("Invalid major version");if(this.minor>_p||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>_p||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<_p)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(bp("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(bp("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 bE(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(bp("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 bE(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?Cp[Sp.PRERELEASELOOSE]:Cp[Sp.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]),bE(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}};vB.exports=_E});var oo=_((UEe,bB)=>{"use strict";var EB=Xt(),hae=(t,e,r=!1)=>{if(t instanceof EB)return t;try{return new EB(t,e)}catch(n){if(!r)return null;throw n}};bB.exports=hae});var CB=_((qEe,_B)=>{"use strict";var dae=oo(),pae=(t,e)=>{let r=dae(t,e);return r?r.version:null};_B.exports=pae});var AB=_((HEe,SB)=>{"use strict";var mae=oo(),gae=(t,e)=>{let r=mae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};SB.exports=gae});var TB=_((VEe,xB)=>{"use strict";var OB=Xt(),yae=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new OB(t instanceof OB?t.version:t,r).inc(e,n,i).version}catch{return null}};xB.exports=yae});var FB=_((zEe,PB)=>{"use strict";var IB=oo(),Dae=(t,e)=>{let r=IB(t,null,!0),n=IB(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"};PB.exports=Dae});var kB=_((KEe,RB)=>{"use strict";var wae=Xt(),vae=(t,e)=>new wae(t,e).major;RB.exports=vae});var $B=_((GEe,NB)=>{"use strict";var Eae=Xt(),bae=(t,e)=>new Eae(t,e).minor;NB.exports=bae});var BB=_((WEe,LB)=>{"use strict";var _ae=Xt(),Cae=(t,e)=>new _ae(t,e).patch;LB.exports=Cae});var MB=_((XEe,jB)=>{"use strict";var Sae=oo(),Aae=(t,e)=>{let r=Sae(t,e);return r&&r.prerelease.length?r.prerelease:null};jB.exports=Aae});var Jr=_((YEe,qB)=>{"use strict";var UB=Xt(),Oae=(t,e,r)=>new UB(t,r).compare(new UB(e,r));qB.exports=Oae});var VB=_((JEe,HB)=>{"use strict";var xae=Jr(),Tae=(t,e,r)=>xae(e,t,r);HB.exports=Tae});var KB=_((ZEe,zB)=>{"use strict";var Iae=Jr(),Pae=(t,e)=>Iae(t,e,!0);zB.exports=Pae});var Ap=_((QEe,WB)=>{"use strict";var GB=Xt(),Fae=(t,e,r)=>{let n=new GB(t,r),i=new GB(e,r);return n.compare(i)||n.compareBuild(i)};WB.exports=Fae});var YB=_((ebe,XB)=>{"use strict";var Rae=Ap(),kae=(t,e)=>t.sort((r,n)=>Rae(r,n,e));XB.exports=kae});var ZB=_((tbe,JB)=>{"use strict";var Nae=Ap(),$ae=(t,e)=>t.sort((r,n)=>Nae(n,r,e));JB.exports=$ae});var el=_((rbe,QB)=>{"use strict";var Lae=Jr(),Bae=(t,e,r)=>Lae(t,e,r)>0;QB.exports=Bae});var Op=_((nbe,ej)=>{"use strict";var jae=Jr(),Mae=(t,e,r)=>jae(t,e,r)<0;ej.exports=Mae});var CE=_((ibe,tj)=>{"use strict";var Uae=Jr(),qae=(t,e,r)=>Uae(t,e,r)===0;tj.exports=qae});var SE=_((sbe,rj)=>{"use strict";var Hae=Jr(),Vae=(t,e,r)=>Hae(t,e,r)!==0;rj.exports=Vae});var xp=_((obe,nj)=>{"use strict";var zae=Jr(),Kae=(t,e,r)=>zae(t,e,r)>=0;nj.exports=Kae});var Tp=_((abe,ij)=>{"use strict";var Gae=Jr(),Wae=(t,e,r)=>Gae(t,e,r)<=0;ij.exports=Wae});var AE=_((ube,sj)=>{"use strict";var Xae=CE(),Yae=SE(),Jae=el(),Zae=xp(),Qae=Op(),eue=Tp(),tue=(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 Xae(t,r,n);case"!=":return Yae(t,r,n);case">":return Jae(t,r,n);case">=":return Zae(t,r,n);case"<":return Qae(t,r,n);case"<=":return eue(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};sj.exports=tue});var aj=_((cbe,oj)=>{"use strict";var rue=Xt(),nue=oo(),{safeRe:Ip,t:Pp}=Ka(),iue=(t,e)=>{if(t instanceof rue)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?Ip[Pp.COERCEFULL]:Ip[Pp.COERCE]);else{let u=e.includePrerelease?Ip[Pp.COERCERTLFULL]:Ip[Pp.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 nue(`${n}.${i}.${s}${o}${a}`,e)};oj.exports=iue});var cj=_((lbe,uj)=>{"use strict";var OE=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}};uj.exports=OE});var Zr=_((fbe,dj)=>{"use strict";var sue=/\s+/g,xE=class t{constructor(e,r){if(r=aue(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof TE)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(sue," "),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=>!fj(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&&pue(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&&hue)|(this.options.loose&&due))+":"+e,i=lj.get(n);if(i)return i;let s=this.options.loose,o=s?lr[Yt.HYPHENRANGELOOSE]:lr[Yt.HYPHENRANGE];e=e.replace(o,Cue(this.options.includePrerelease)),tt("hyphen replace",e),e=e.replace(lr[Yt.COMPARATORTRIM],cue),tt("comparator trim",e),e=e.replace(lr[Yt.TILDETRIM],lue),tt("tilde trim",e),e=e.replace(lr[Yt.CARETTRIM],fue),tt("caret trim",e);let a=e.split(" ").map(h=>mue(h,this.options)).join(" ").split(/\s+/).map(h=>_ue(h,this.options));s&&(a=a.filter(h=>(tt("loose invalid filter",h,this.options),!!h.match(lr[Yt.COMPARATORLOOSE])))),tt("range list",a);let u=new Map,c=a.map(h=>new TE(h,this.options));for(let h of c){if(fj(h))return[h];u.set(h.value,h)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return lj.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>hj(n,r)&&e.set.some(i=>hj(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 uue(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Sue(this.set[r],e,this.options))return!0;return!1}};dj.exports=xE;var oue=cj(),lj=new oue,aue=Ep(),TE=tl(),tt=Qc(),uue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:cue,tildeTrimReplace:lue,caretTrimReplace:fue}=Ka(),{FLAG_INCLUDE_PRERELEASE:hue,FLAG_LOOSE:due}=Zc(),fj=t=>t.value==="<0.0.0-0",pue=t=>t.value==="",hj=(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},mue=(t,e)=>(t=t.replace(lr[Yt.BUILD],""),tt("comp",t,e),t=Due(t,e),tt("caret",t),t=gue(t,e),tt("tildes",t),t=vue(t,e),tt("xrange",t),t=bue(t,e),tt("stars",t),t),fr=t=>!t||t.toLowerCase()==="x"||t==="*",gue=(t,e)=>t.trim().split(/\s+/).map(r=>yue(r,e)).join(" "),yue=(t,e)=>{let r=e.loose?lr[Yt.TILDELOOSE]:lr[Yt.TILDE];return t.replace(r,(n,i,s,o,a)=>{tt("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?(tt("replaceTilde pr",a),u=`>=${i}.${s}.${o}-${a} <${i}.${+s+1}.0-0`):u=`>=${i}.${s}.${o} <${i}.${+s+1}.0-0`,tt("tilde return",u),u})},Due=(t,e)=>t.trim().split(/\s+/).map(r=>wue(r,e)).join(" "),wue=(t,e)=>{tt("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)=>{tt("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?(tt("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`):(tt("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`),tt("caret return",c),c})},vue=(t,e)=>(tt("replaceXRanges",t,e),t.split(/\s+/).map(r=>Eue(r,e)).join(" ")),Eue=(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)=>{tt("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`),tt("xRange return",n),n})},bue=(t,e)=>(tt("replaceStars",t,e),t.trim().replace(lr[Yt.STAR],"")),_ue=(t,e)=>(tt("replaceGTE0",t,e),t.trim().replace(lr[e.includePrerelease?Yt.GTE0PRE:Yt.GTE0],"")),Cue=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()),Sue=(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(tt(t[n].semver),t[n].semver!==TE.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 tl=_((hbe,wj)=>{"use strict";var rl=Symbol("SemVer ANY"),FE=class t{static get ANY(){return rl}constructor(e,r){if(r=pj(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),PE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===rl?this.value="":this.value=this.operator+this.semver.version,PE("comp",this)}parse(e){let r=this.options.loose?mj[gj.COMPARATORLOOSE]:mj[gj.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 yj(n[2],this.options.loose):this.semver=rl}toString(){return this.value}test(e){if(PE("Comparator.test",e,this.options.loose),this.semver===rl||e===rl)return!0;if(typeof e=="string")try{e=new yj(e,this.options)}catch{return!1}return IE(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 Dj(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Dj(this.value,r).test(e.semver):(r=pj(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("=")||IE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||IE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};wj.exports=FE;var pj=Ep(),{safeRe:mj,t:gj}=Ka(),IE=AE(),PE=Qc(),yj=Xt(),Dj=Zr()});var nl=_((dbe,vj)=>{"use strict";var Aue=Zr(),Oue=(t,e,r)=>{try{e=new Aue(e,r)}catch{return!1}return e.test(t)};vj.exports=Oue});var bj=_((pbe,Ej)=>{"use strict";var xue=Zr(),Tue=(t,e)=>new xue(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Ej.exports=Tue});var Cj=_((mbe,_j)=>{"use strict";var Iue=Xt(),Pue=Zr(),Fue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Pue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new Iue(n,r))}),n};_j.exports=Fue});var Aj=_((gbe,Sj)=>{"use strict";var Rue=Xt(),kue=Zr(),Nue=(t,e,r)=>{let n=null,i=null,s=null;try{s=new kue(e,r)}catch{return null}return t.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new Rue(n,r))}),n};Sj.exports=Nue});var Tj=_((ybe,xj)=>{"use strict";var RE=Xt(),$ue=Zr(),Oj=el(),Lue=(t,e)=>{t=new $ue(t,e);let r=new RE("0.0.0");if(t.test(r)||(r=new RE("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 RE(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Oj(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Oj(r,s))&&(r=s)}return r&&t.test(r)?r:null};xj.exports=Lue});var Pj=_((Dbe,Ij)=>{"use strict";var Bue=Zr(),jue=(t,e)=>{try{return new Bue(t,e).range||"*"}catch{return null}};Ij.exports=jue});var Fp=_((wbe,Nj)=>{"use strict";var Mue=Xt(),kj=tl(),{ANY:Uue}=kj,que=Zr(),Hue=nl(),Fj=el(),Rj=Op(),Vue=Tp(),zue=xp(),Kue=(t,e,r,n)=>{t=new Mue(t,n),e=new que(e,n);let i,s,o,a,u;switch(r){case">":i=Fj,s=Vue,o=Rj,a=">",u=">=";break;case"<":i=Rj,s=zue,o=Fj,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Hue(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===Uue&&(f=new kj(">=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};Nj.exports=Kue});var Lj=_((vbe,$j)=>{"use strict";var Gue=Fp(),Wue=(t,e,r)=>Gue(t,e,">",r);$j.exports=Wue});var jj=_((Ebe,Bj)=>{"use strict";var Xue=Fp(),Yue=(t,e,r)=>Xue(t,e,"<",r);Bj.exports=Yue});var qj=_((bbe,Uj)=>{"use strict";var Mj=Zr(),Jue=(t,e,r)=>(t=new Mj(t,r),e=new Mj(e,r),t.intersects(e,r));Uj.exports=Jue});var Vj=_((_be,Hj)=>{"use strict";var Zue=nl(),Que=Jr();Hj.exports=(t,e,r)=>{let n=[],i=null,s=null,o=t.sort((l,h)=>Que(l,h,r));for(let l of o)Zue(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 Yj=_((Cbe,Xj)=>{"use strict";var zj=Zr(),NE=tl(),{ANY:kE}=NE,il=nl(),$E=Jr(),ece=(t,e,r={})=>{if(t===e)return!0;t=new zj(t,r),e=new zj(e,r);let n=!1;e:for(let i of t.set){for(let s of e.set){let o=rce(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},tce=[new NE(">=0.0.0-0")],Kj=[new NE(">=0.0.0")],rce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===kE){if(e.length===1&&e[0].semver===kE)return!0;r.includePrerelease?t=tce:t=Kj}if(e.length===1&&e[0].semver===kE){if(r.includePrerelease)return!0;e=Kj}let n=new Set,i,s;for(let f of t)f.operator===">"||f.operator===">="?i=Gj(i,f,r):f.operator==="<"||f.operator==="<="?s=Wj(s,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(i&&s){if(o=$E(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&&!il(f,String(i),r)||s&&!il(f,String(s),r))return null;for(let p of e)if(!il(f,String(p),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=Gj(i,f,r),a===f&&a!==i)return!1}else if(i.operator===">="&&!il(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=Wj(s,f,r),u===f&&u!==s)return!1}else if(s.operator==="<="&&!il(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)},Gj=(t,e,r)=>{if(!t)return e;let n=$E(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Wj=(t,e,r)=>{if(!t)return e;let n=$E(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Xj.exports=ece});var eM=_((Sbe,Qj)=>{"use strict";var LE=Ka(),Jj=Zc(),nce=Xt(),Zj=EE(),ice=oo(),sce=CB(),oce=AB(),ace=TB(),uce=FB(),cce=kB(),lce=$B(),fce=BB(),hce=MB(),dce=Jr(),pce=VB(),mce=KB(),gce=Ap(),yce=YB(),Dce=ZB(),wce=el(),vce=Op(),Ece=CE(),bce=SE(),_ce=xp(),Cce=Tp(),Sce=AE(),Ace=aj(),Oce=tl(),xce=Zr(),Tce=nl(),Ice=bj(),Pce=Cj(),Fce=Aj(),Rce=Tj(),kce=Pj(),Nce=Fp(),$ce=Lj(),Lce=jj(),Bce=qj(),jce=Vj(),Mce=Yj();Qj.exports={parse:ice,valid:sce,clean:oce,inc:ace,diff:uce,major:cce,minor:lce,patch:fce,prerelease:hce,compare:dce,rcompare:pce,compareLoose:mce,compareBuild:gce,sort:yce,rsort:Dce,gt:wce,lt:vce,eq:Ece,neq:bce,gte:_ce,lte:Cce,cmp:Sce,coerce:Ace,Comparator:Oce,Range:xce,satisfies:Tce,toComparators:Ice,maxSatisfying:Pce,minSatisfying:Fce,minVersion:Rce,validRange:kce,outside:Nce,gtr:$ce,ltr:Lce,intersects:Bce,simplifyRange:jce,subset:Mce,SemVer:nce,re:LE.re,src:LE.src,tokens:LE.t,SEMVER_SPEC_VERSION:Jj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Jj.RELEASE_TYPES,compareIdentifiers:Zj.compareIdentifiers,rcompareIdentifiers:Zj.rcompareIdentifiers}});var hM=_(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.parseApkNameFromFlavor=ee.checkJDKMajorVersion=ee.resolvePlatform=ee.checkPlatformVersions=ee.getAddedPlatforms=ee.getPlatformTargetName=ee.promptForPlatformTarget=ee.promptForPlatform=ee.isValidEnterprisePlatform=ee.getKnownEnterprisePlatforms=ee.isValidCommunityPlatform=ee.getKnownCommunityPlatforms=ee.isValidPlatform=ee.getKnownPlatforms=ee.selectPlatforms=ee.getProjectPlatformDirectory=ee.getCLIVersion=ee.getCoreVersion=ee.getCapacitorPackageVersion=ee.requireCapacitorPackage=ee.getCapacitorPackage=ee.runTask=ee.runPlatformHook=ee.runHooks=ee.wait=ee.checkAppName=ee.checkAppId=ee.checkAppDir=ee.checkAppConfig=ee.checkCapacitorPlatform=ee.checkPackage=ee.checkWebDir=ee.check=void 0;var ol=(he(),ce(fe)),tM=Ki(),ss=Sa(),ao=require("path"),qe=ol.__importDefault(Aa()),Ga=pd(),nM=Sc(),Uce=r$(),rM=Ll(),sl=jd(),qce=vp();async function Hce(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
207
207
  `)}ee.check=Hce;async function Vce(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,ss.pathExists)(t.app.webDirAbs)?await(0,ss.pathExists)((0,ao.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${qe.default.strong((0,tM.prettyPath)(t.app.webDirAbs))}) must contain an ${qe.default.strong("index.html")} file.
208
208
  It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${qe.default.strong((0,tM.prettyPath)(t.app.webDirAbs))}.
209
209
  Please create it and make sure it has an ${qe.default.strong("index.html")} file. You can change the path of this directory in ${qe.default.strong(t.app.extConfigName)} (${qe.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${qe.default.input("npm run build")}). More info: ${qe.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}ee.checkWebDir=Vce;async function zce(){return await(0,ss.pathExists)("package.json")||await(0,ss.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
@@ -225,20 +225,20 @@ Make sure ${qe.default.strong(t.app.webDir)} exists.`),(0,Ga.fatal)(`${qe.defaul
225
225
  See the docs for adding the ${qe.default.strong(r)} platform: ${qe.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,Ga.fatal)(`Invalid platform: ${qe.default.input(r)}`),[r]}return fM(t)}ee.selectPlatforms=ele;async function ME(){return["web","android","ios"]}ee.getKnownPlatforms=ME;async function UE(t){return(await ME()).includes(t)}ee.isValidPlatform=UE;async function uM(){return["electron"]}ee.getKnownCommunityPlatforms=uM;async function tle(t){return(await uM()).includes(t)}ee.isValidCommunityPlatform=tle;async function cM(){return["windows"]}ee.getKnownEnterprisePlatforms=cM;async function rle(t){return(await cM()).includes(t)}ee.isValidEnterprisePlatform=rle;async function nle(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>ol.__importStar(Bd()));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 UE(i)){let s=await ME();(0,Ga.fatal)(`Invalid platform: ${qe.default.input(i)}.
226
226
  Valid platforms include: ${s.join(", ")}`)}return i}ee.promptForPlatform=nle;async function ile(t,e){let{prompt:r}=await Promise.resolve().then(()=>ol.__importStar(Bd())),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:`${lM(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let i=e.trim(),s=t.find(o=>o.id===i);return s||(0,Ga.fatal)(`Invalid target ID: ${qe.default.input(i)}.
227
227
  Valid targets are: ${t.map(o=>o.id).join(", ")}`),s}ee.promptForPlatformTarget=ile;function lM(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"})`:""}`}ee.getPlatformTargetName=lM;async function fM(t){let e=[];return await Rp(t,t.android.name)&&e.push(t.android.name),await Rp(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}ee.getAddedPlatforms=fM;async function sle(t,e){let r=await Promise.resolve().then(()=>ol.__importStar(eM())),n=await aM(t),i=await kp(t,e);(r.diff(n,i)==="minor"||r.diff(n,i)==="major")&&nM.logger.warn(`${qe.default.strong("@capacitor/core")}${qe.default.weak(`@${n}`)} version doesn't match ${qe.default.strong(`@capacitor/${e}`)}${qe.default.weak(`@${i}`)} version.
228
- Consider updating to a matching version, e.g. w/ ${qe.default.input(`npm install @capacitor/core@${i}`)}`)}ee.checkPlatformVersions=sle;function ole(t,e){if(e[0]!=="@"){let n=(0,sl.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ao.dirname)(n);let i=(0,sl.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,ao.dirname)(i);let s=(0,sl.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(s)return(0,ao.dirname)(s)}let r=(0,sl.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ao.dirname)(r):null}ee.resolvePlatform=ole;async function ale(){try{let t=await(0,qce.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}}ee.checkJDKMajorVersion=ale;function ule(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}ee.parseApkNameFromFlavor=ule});var dM=_(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.tryFn=void 0;var cle=async(t,...e)=>{try{return await t(...e)}catch{}return null};Np.tryFn=cle});var pM=_($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.formatJSObject=void 0;var lle=(he(),ce(fe)),fle=lle.__importDefault(require("util"));function hle(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return fle.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}$p.formatJSObject=hle});var mM=_(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.lazy=os.LazyPromise=os.allSerial=void 0;function dle(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}os.allSerial=dle;var Lp=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)}};os.LazyPromise=Lp;function ple(t){return new Lp(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}os.lazy=ple});var wM=_(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.writeConfig=Mt.loadConfig=Mt.CONFIG_FILE_NAME_JSON=Mt.CONFIG_FILE_NAME_JS=Mt.CONFIG_FILE_NAME_TS=void 0;var HE=(he(),ce(fe)),mle=HE.__importDefault(Zh()),xr=Sa(),ye=require("path"),uo=HE.__importDefault(Aa()),gle=hM(),Bp=pd(),yle=Sc(),qE=dM(),Dle=pM(),gM=Ll(),yM=jd(),Wa=mM(),wle=vp(),DM=(0,mle.default)("capacitor:config");Mt.CONFIG_FILE_NAME_TS="capacitor.config.ts";Mt.CONFIG_FILE_NAME_JS="capacitor.config.js";Mt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function vle(){var t,e,r,n;let i=process.cwd(),s=(0,ye.dirname)(__dirname),o=await Cle(i),a=await(async()=>{var f,m;if((0,gM.isNXMonorepo)(i)){let y=(0,gM.findNXMonorepoRoot)(i),v=await(0,qE.tryFn)(xr.readJSON,(0,ye.resolve)(y,"package.json")),E=(f=v?.devDependencies)!==null&&f!==void 0?f:{},A=(m=v?.dependencies)!==null&&m!==void 0?m:{};return{devDependencies:E,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 Sle(s),d={android:await Ale(i,o.extConfig,h),ios:await Ole(i,o.extConfig),web:await xle(i,l),cli:h,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ye.resolve)(i,l),package:(n=await(0,qE.tryFn)(xr.readJSON,(0,ye.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...o}};return DM("config: %O",d),d}Mt.loadConfig=vle;async function Ele(t,e){switch((0,ye.extname)(e)){case".json":{await(0,xr.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,xr.writeFile)(e,kle(t));break}}}Mt.writeConfig=Ele;async function ble(t,e,r){var n;try{let i=(0,yM.resolveNode)(t,"typescript");i||(0,Bp.fatal)(`Could not find installation of TypeScript.
228
+ Consider updating to a matching version, e.g. w/ ${qe.default.input(`npm install @capacitor/core@${i}`)}`)}ee.checkPlatformVersions=sle;function ole(t,e){if(e[0]!=="@"){let n=(0,sl.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,ao.dirname)(n);let i=(0,sl.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,ao.dirname)(i);let s=(0,sl.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(s)return(0,ao.dirname)(s)}let r=(0,sl.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,ao.dirname)(r):null}ee.resolvePlatform=ole;async function ale(){try{let t=await(0,qce.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}}ee.checkJDKMajorVersion=ale;function ule(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}ee.parseApkNameFromFlavor=ule});var dM=_(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});Np.tryFn=void 0;var cle=async(t,...e)=>{try{return await t(...e)}catch{}return null};Np.tryFn=cle});var pM=_($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});$p.formatJSObject=void 0;var lle=(he(),ce(fe)),fle=lle.__importDefault(require("util"));function hle(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return fle.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}$p.formatJSObject=hle});var mM=_(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.lazy=os.LazyPromise=os.allSerial=void 0;function dle(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}os.allSerial=dle;var Lp=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)}};os.LazyPromise=Lp;function ple(t){return new Lp(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}os.lazy=ple});var wM=_(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.writeConfig=Mt.loadConfig=Mt.CONFIG_FILE_NAME_JSON=Mt.CONFIG_FILE_NAME_JS=Mt.CONFIG_FILE_NAME_TS=void 0;var HE=(he(),ce(fe)),mle=HE.__importDefault(Zh()),xr=Sa(),ye=require("path"),uo=HE.__importDefault(Aa()),gle=hM(),Bp=pd(),yle=Sc(),qE=dM(),Dle=pM(),gM=Ll(),yM=jd(),Wa=mM(),wle=vp(),DM=(0,mle.default)("capacitor:config");Mt.CONFIG_FILE_NAME_TS="capacitor.config.ts";Mt.CONFIG_FILE_NAME_JS="capacitor.config.js";Mt.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function vle(){var t,e,r,n;let i=process.cwd(),s=(0,ye.dirname)(__dirname),o=await Cle(i),a=await(async()=>{var f,p;if((0,gM.isNXMonorepo)(i)){let y=(0,gM.findNXMonorepoRoot)(i),v=await(0,qE.tryFn)(xr.readJSON,(0,ye.resolve)(y,"package.json")),E=(f=v?.devDependencies)!==null&&f!==void 0?f:{},A=(p=v?.dependencies)!==null&&p!==void 0?p:{};return{devDependencies:E,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 Sle(s),d={android:await Ale(i,o.extConfig,h),ios:await Ole(i,o.extConfig),web:await xle(i,l),cli:h,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ye.resolve)(i,l),package:(n=await(0,qE.tryFn)(xr.readJSON,(0,ye.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...o}};return DM("config: %O",d),d}Mt.loadConfig=vle;async function Ele(t,e){switch((0,ye.extname)(e)){case".json":{await(0,xr.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,xr.writeFile)(e,kle(t));break}}}Mt.writeConfig=Ele;async function ble(t,e,r){var n;try{let i=(0,yM.resolveNode)(t,"typescript");i||(0,Bp.fatal)(`Could not find installation of TypeScript.
229
229
  To use ${uo.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${uo.default.input("npm install -D typescript")}`);let s=require(i),o=(0,yM.requireTS)(s,r),a=o.default?await o.default:o;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:a}}catch(i){throw(0,Bp.isFatal)(i)||(0,Bp.fatal)(`Parsing ${uo.default.strong(e)} failed.
230
230
 
231
231
  ${(n=i.stack)!==null&&n!==void 0?n:i}`),i}}async function _le(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(i){(0,Bp.fatal)(`Parsing ${uo.default.strong(e)} failed.
232
232
 
233
- ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Cle(t){var e;let r=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_TS);if(await(0,xr.pathExists)(r))return ble(t,Mt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_JS);if(await(0,xr.pathExists)(n))return _le(t,Mt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:Mt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,qE.tryFn)(xr.readJSON,i))!==null&&e!==void 0?e:{}}}async function Sle(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,xr.readJSON)((0,ye.resolve)(t,"package.json")),os:Tle(process.platform)}}async function Ale(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,m,y,v,E,A,p;let D="android",w=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",C=(0,ye.resolve)(t,w),F="app",b=`${F}/src`,k=`${b}/main`,R=`${k}/assets`,I=`${R}/public`,B=`${k}/res`,j=`${F}/build/outputs/apk/`,z=((s=e.android)===null||s===void 0?void 0:s.flavor)||"";!((o=e.android)===null||o===void 0)&&o.flavor&&(j=`${j}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let L=(0,gle.parseApkNameFromFlavor)(z),S=`${j}/debug`,T="capacitor-cordova-android-plugins",P=(0,Wa.lazy)(()=>Fle(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:(E=(v=e.android)===null||v===void 0?void 0:v.buildOptions)===null||E===void 0?void 0:E.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:P,platformDir:w,platformDirAbs:C,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(C,T),appDir:F,appDirAbs:(0,ye.resolve)(C,F),srcDir:b,srcDirAbs:(0,ye.resolve)(C,b),srcMainDir:k,srcMainDirAbs:(0,ye.resolve)(C,k),assetsDir:R,assetsDirAbs:(0,ye.resolve)(C,R),webDir:I,webDirAbs:(0,ye.resolve)(C,I),resDir:B,resDirAbs:(0,ye.resolve)(C,B),apkName:L,buildOutputDir:S,buildOutputDirAbs:(0,ye.resolve)(C,S),flavor:z,buildOptions:$}}async function Ole(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",v=(0,ye.resolve)(t,y),E=(s=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&s!==void 0?s:"App",A="App",p=(0,ye.resolve)(v,A),D=`${A}/App`,w=(0,ye.resolve)(v,D),C=`${A}/App.xcodeproj`,F=(0,ye.resolve)(v,C),b=(0,Wa.lazy)(()=>Ile(p)),k=(0,Wa.lazy)(()=>Rle(t,v,p)),R=(0,Wa.lazy)(()=>Ple(p,w,F)),I="capacitor-cordova-ios-plugins",B={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:v,scheme:E,cordovaPluginsDir:I,cordovaPluginsDirAbs:(0,ye.resolve)(v,I),nativeProjectDir:A,nativeProjectDirAbs:p,nativeTargetDir:D,nativeTargetDirAbs:w,nativeXcodeProjDir:C,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Wa.lazy)(async()=>(0,ye.relative)(v,await b)),nativeXcodeWorkspaceDirAbs:b,webDir:(0,Wa.lazy)(async()=>(0,ye.relative)(v,await R)),webDirAbs:R,podPath:k,buildOptions:B}}async function xle(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Tle(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function Ile(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Ple(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,xr.readFile)(i,{encoding:"utf8"})).match(n);if(o&&o[1]==="SOURCE_ROOT")return yle.logger.warn(`Using the iOS project root for the ${uo.default.strong("public")} directory is deprecated.
233
+ ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Cle(t){var e;let r=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_TS);if(await(0,xr.pathExists)(r))return ble(t,Mt.CONFIG_FILE_NAME_TS,r);let n=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_JS);if(await(0,xr.pathExists)(n))return _le(t,Mt.CONFIG_FILE_NAME_JS,n);let i=(0,ye.resolve)(t,Mt.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:Mt.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,qE.tryFn)(xr.readJSON,i))!==null&&e!==void 0?e:{}}}async function Sle(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,xr.readJSON)((0,ye.resolve)(t,"package.json")),os:Tle(process.platform)}}async function Ale(t,e,r){var n,i,s,o,a,u,c,l,h,d,f,p,y,v,E,A,m;let D="android",w=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",C=(0,ye.resolve)(t,w),F="app",b=`${F}/src`,k=`${b}/main`,R=`${k}/assets`,I=`${R}/public`,B=`${k}/res`,j=`${F}/build/outputs/apk/`,z=((s=e.android)===null||s===void 0?void 0:s.flavor)||"";!((o=e.android)===null||o===void 0)&&o.flavor&&(j=`${j}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let L=(0,gle.parseApkNameFromFlavor)(z),S=`${j}/debug`,T="capacitor-cordova-android-plugins",P=(0,Wa.lazy)(()=>Fle(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=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||y===void 0?void 0:y.keystoreAliasPassword,signingType:(E=(v=e.android)===null||v===void 0?void 0:v.buildOptions)===null||E===void 0?void 0:E.signingType,releaseType:(m=(A=e.android)===null||A===void 0?void 0:A.buildOptions)===null||m===void 0?void 0:m.releaseType};return{name:D,minVersion:"23",studioPath:P,platformDir:w,platformDirAbs:C,cordovaPluginsDir:T,cordovaPluginsDirAbs:(0,ye.resolve)(C,T),appDir:F,appDirAbs:(0,ye.resolve)(C,F),srcDir:b,srcDirAbs:(0,ye.resolve)(C,b),srcMainDir:k,srcMainDirAbs:(0,ye.resolve)(C,k),assetsDir:R,assetsDirAbs:(0,ye.resolve)(C,R),webDir:I,webDirAbs:(0,ye.resolve)(C,I),resDir:B,resDirAbs:(0,ye.resolve)(C,B),apkName:L,buildOutputDir:S,buildOutputDirAbs:(0,ye.resolve)(C,S),flavor:z,buildOptions:$}}async function Ole(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",v=(0,ye.resolve)(t,y),E=(s=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&s!==void 0?s:"App",A="App",m=(0,ye.resolve)(v,A),D=`${A}/App`,w=(0,ye.resolve)(v,D),C=`${A}/App.xcodeproj`,F=(0,ye.resolve)(v,C),b=(0,Wa.lazy)(()=>Ile(m)),k=(0,Wa.lazy)(()=>Rle(t,v,m)),R=(0,Wa.lazy)(()=>Ple(m,w,F)),I="capacitor-cordova-ios-plugins",B={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:v,scheme:E,cordovaPluginsDir:I,cordovaPluginsDirAbs:(0,ye.resolve)(v,I),nativeProjectDir:A,nativeProjectDirAbs:m,nativeTargetDir:D,nativeTargetDirAbs:w,nativeXcodeProjDir:C,nativeXcodeProjDirAbs:F,nativeXcodeWorkspaceDir:(0,Wa.lazy)(async()=>(0,ye.relative)(v,await b)),nativeXcodeWorkspaceDirAbs:b,webDir:(0,Wa.lazy)(async()=>(0,ye.relative)(v,await R)),webDirAbs:R,podPath:k,buildOptions:B}}async function xle(t,e){let r=e,n=(0,ye.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function Tle(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function Ile(t){return(0,ye.resolve)(t,"App.xcworkspace")}async function Ple(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,xr.readFile)(i,{encoding:"utf8"})).match(n);if(o&&o[1]==="SOURCE_ROOT")return yle.logger.warn(`Using the iOS project root for the ${uo.default.strong("public")} directory is deprecated.
234
234
  Please follow the Upgrade Guide to move ${uo.default.strong("public")} inside the iOS target directory: ${uo.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 Fle(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(()=>HE.__importStar(vp())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,xr.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){DM("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 Rle(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,xr.pathExists)((0,ye.resolve)(t,"Gemfile"))?n=(0,ye.resolve)(t,"Gemfile"):await(0,xr.pathExists)((0,ye.resolve)(e,"Gemfile"))?n=(0,ye.resolve)(e,"Gemfile"):await(0,xr.pathExists)((0,ye.resolve)(r,"Gemfile"))&&(n=(0,ye.resolve)(r,"Gemfile")),!(n!=""))try{let s=await(0,wle.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});s!=null&&(n=(0,ye.resolve)(s,"Gemfile"))}catch{}try{let s=(await(0,xr.readFile)(n)).toString();return s&&new RegExp(/gem\s+['"]cocoapods/).test(s)?"bundle exec pod":"pod"}catch{return"pod"}}function kle(t){return`import type { CapacitorConfig } from '@capacitor/cli';
235
235
 
236
236
  const config: CapacitorConfig = ${(0,Dle.formatJSObject)(t)};
237
237
 
238
238
  export default config;
239
239
  `}});function Nle(){try{return KE.default.statSync("/.dockerenv"),!0}catch{return!1}}function $le(){try{return KE.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function GE(){return zE===void 0&&(zE=Nle()||$le()),zE}var KE,zE,EM=mr(()=>{KE=Ee(require("node:fs"),1)});function Ya(){return WE===void 0&&(WE=Lle()||GE()),WE}var bM,WE,Lle,XE=mr(()=>{bM=Ee(require("node:fs"),1);EM();Lle=()=>{try{return bM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var YE,CM,SM,_M,vi,JE=mr(()=>{YE=Ee(require("node:process"),1),CM=Ee(require("node:os"),1),SM=Ee(require("node:fs"),1);XE();_M=()=>{if(YE.default.platform!=="linux")return!1;if(CM.default.release().toLowerCase().includes("microsoft"))return!Ya();try{return SM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Ya():!1}catch{return!1}},vi=YE.default.env.__IS_WSL_TEST__?_M:_M()});var ZE,AM,OM,xM,Ble,QE,Nr,eb=mr(()=>{ZE=Ee(require("node:process"),1),AM=require("node:buffer"),OM=require("node:util"),xM=Ee(require("node:child_process"),1),Ble=(0,OM.promisify)(xM.default.execFile),QE=()=>`${ZE.default.env.SYSTEMROOT||ZE.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Nr=async(t,e={})=>{let{powerShellPath:r,...n}=e,i=Nr.encodeCommand(t);return Ble(r??QE(),[...Nr.argumentsPrefix,i],{encoding:"utf8",...n})};Nr.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Nr.encodeCommand=t=>AM.Buffer.from(t,"utf16le").toString("base64");Nr.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var IM,PM,co,jle,Mle,Ule,jp,TM,FM,RM,kM,NM=mr(()=>{IM=require("node:util"),PM=Ee(require("node:child_process"),1),co=Ee(require("node:fs/promises"),1);JE();eb();JE();jle=(0,IM.promisify)(PM.default.execFile),Mle=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await co.default.access(r,co.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await co.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}})(),Ule=async()=>`${await Mle()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,jp=vi?Ule:QE,FM=async()=>(TM??=(async()=>{try{let t=await jp();return await co.default.access(t,co.constants.X_OK),!0}catch{return!1}})(),TM),RM=async()=>{let t=await jp(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await Nr(e,{powerShellPath:t});return r.trim()},kM=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await jle("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function lo(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 $M=mr(()=>{});async function tb(){if(BM.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await qle("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var LM,BM,jM,qle,MM=mr(()=>{LM=require("node:util"),BM=Ee(require("node:process"),1),jM=require("node:child_process"),qle=(0,LM.promisify)(jM.execFile)});async function HM(t,{humanReadableOutput:e=!0,signal:r}={}){if(UM.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],i={};r&&(i.signal=r);let{stdout:s}=await Hle("osascript",["-e",t,n],i);return s.trim()}var UM,qM,rb,Hle,VM=mr(()=>{UM=Ee(require("node:process"),1),qM=require("node:util"),rb=require("node:child_process"),Hle=(0,qM.promisify)(rb.execFile)});async function nb(t){return HM(`tell application "Finder" to set app_path to application file id "${t}" as string
240
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var zM=mr(()=>{VM()});async function sb(t=Vle){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 Mp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=WM[n];if(!i)throw new Mp(`Unknown browser ID: ${n}`);return i}var KM,GM,Vle,WM,ib,Mp,ob=mr(()=>{KM=require("node:util"),GM=require("node:child_process"),Vle=(0,KM.promisify)(GM.execFile),WM={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},ib=new Map(Object.entries(WM)),Mp=class extends Error{}});async function ab(){if(Up.default.platform==="darwin"){let t=await tb();return{name:await nb(t),id:t}}if(Up.default.platform==="linux"){let{stdout:t}=await zle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:Kle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Up.default.platform==="win32")return sb();throw new Error("Only macOS, Linux, and Windows are supported")}var XM,Up,YM,zle,Kle,JM=mr(()=>{XM=require("node:util"),Up=Ee(require("node:process"),1),YM=require("node:child_process");MM();zM();ob();ob();zle=(0,XM.promisify)(YM.execFile),Kle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var qp,Gle,ZM,QM=mr(()=>{qp=Ee(require("node:process"),1),Gle=!!(qp.default.env.SSH_CONNECTION||qp.default.env.SSH_CLIENT||qp.default.env.SSH_TTY),ZM=Gle});var fb={};Am(fb,{apps:()=>fo,default:()=>Yle,openApp:()=>Xle});function n8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[t8]:e}=t;if(!e)throw new Error(`${t8} is not supported`);return e}function cl({[Ja]:t},{wsl:e}={}){if(e&&vi)return n8(e);if(!t)throw new Error(`${Ja} is not supported`);return n8(t)}var cb,lb,s8,o8,Vp,i8,Hp,ub,e8,Ja,t8,r8,ul,Wle,Xle,fo,Yle,hb=mr(()=>{cb=Ee(require("node:process"),1),lb=Ee(require("node:path"),1),s8=require("node:url"),o8=Ee(require("node:child_process"),1),Vp=Ee(require("node:fs/promises"),1);NM();eb();$M();JM();XE();QM();i8={},Hp=Symbol("fallbackAttempt"),ub=i8.url?lb.default.dirname((0,s8.fileURLToPath)(i8.url)):"",e8=lb.default.join(ub,"xdg-open"),{platform:Ja,arch:t8}=cb.default,r8=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(i){r.push(i)}throw new AggregateError(r,"Failed to open in all supported apps")},ul=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Hp]===!0;if(delete t[Hp],Array.isArray(t.app))return r8(t.app,c=>ul({...t,app:c,[Hp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return r8(r,c=>ul({...t,app:{name:c,arguments:n},[Hp]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},h;if(vi){let d=await RM();h=ib.get(d)??{}}else h=await ab();if(h.id in c){let d=c[h.id.toLowerCase()];if(r==="browserPrivate"){if(d==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[d])}return ul({...t,app:{name:fo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(vi&&!Ya()&&!ZM&&!r&&(a=await FM()),Ja==="darwin")i="open",t.wait&&s.push("--wait-apps"),t.background&&s.push("--background"),t.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(Ja==="win32"||a){i=await jp(),s.push(...Nr.argumentsPrefix),vi||(o.windowsVerbatimArguments=!0),vi&&t.target&&(t.target=await kM(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Nr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Nr.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Nr.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Nr.encodeCommand(c.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)i=r;else{let c=!ub||ub==="/",l=!1;try{await Vp.default.access(e8,Vp.constants.X_OK),l=!0}catch{}i=cb.default.versions.electron??(Ja==="android"||c||!l)?"xdg-open":e8}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ja==="darwin"&&n.length>0&&s.push("--args",...n),t.target&&s.push(t.target);let u=o8.default.spawn(i,s,o);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",h=>{if(!t.allowNonzeroExitCode&&h!==0){l(new Error(`Exited with code ${h}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",h=>{if(u.off("error",l),h!==0){l(new Error(`Exited with code ${h}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},Wle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return ul({...e,target:t})},Xle=(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 ul({...e,app:{name:t,arguments:r}})};fo={browser:"browser",browserPrivate:"browserPrivate"};lo(fo,"chrome",()=>cl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));lo(fo,"brave",()=>cl({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"]}}));lo(fo,"firefox",()=>cl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));lo(fo,"edge",()=>cl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));lo(fo,"safari",()=>cl({darwin:"Safari"}));Yle=Wle});var mm=_(rn=>{"use strict";rn.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;rn.find=(t,e)=>t.nodes.find(r=>r.type===e);rn.exceedsLimit=(t,e,r=1,n)=>n===!1||!rn.isInteger(t)||!rn.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;rn.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)};rn.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;rn.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;rn.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;rn.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);rn.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 gm=_((eSe,I6)=>{"use strict";var T6=mm();I6.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&T6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&T6.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 F6=_((tSe,P6)=>{"use strict";P6.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=_((rSe,M6)=>{"use strict";var R6=F6(),wo=(t,e,r)=>{if(R6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(R6(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(wo.cache.hasOwnProperty(u))return wo.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=j6(t)||j6(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=k6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=k6(c,l,d,n)),d.negatives=m,d.positives=f,d.result=Mfe(m,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+m.length>1&&(d.result=`(?:${d.result})`),wo.cache[u]=d,d.result};function Mfe(t,e,r){let n=Ib(t,e,"-",!1,r)||[],i=Ib(e,t,"",!1,r)||[],s=Ib(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function Ufe(t,e){let r=1,n=1,i=$6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=$6(t,r);for(i=L6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=L6(e+1,n)-1;return s=[...s],s.sort(Vfe),s}function qfe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=Hfe(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+=zfe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function k6(t,e,r,n){let i=Ufe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=qfe(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+B6(a.count),o=c+1;continue}r.isPadded&&(h=Kfe(c,r,n)),l.string=h+l.pattern+B6(l.count),s.push(l),o=c+1,a=l}return s}function Ib(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!N6(e,"string",a)&&s.push(r+a),n&&N6(e,"string",a)&&s.push(r+a)}return s}function Hfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function Vfe(t,e){return t>e?1:e>t?-1:0}function N6(t,e,r){return t.some(n=>n[e]===r)}function $6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function L6(t,e){return t-t%Math.pow(10,e)}function B6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function zfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function j6(t){return/^-?(0+)\d/.test(t)}function Kfe(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}}`}}wo.cache={};wo.clearCache=()=>wo.cache={};M6.exports=wo});var Rb=_((nSe,W6)=>{"use strict";var Gfe=require("util"),H6=U6(),q6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Wfe=t=>e=>t===!0?Number(e):String(e),Pb=t=>typeof t=="number"||typeof t=="string"&&t!=="",El=t=>Number.isInteger(+t),Fb=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},Xfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Yfe=(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},Dm=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Jfe=(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=>Dm(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>Dm(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},V6=(t,e,r,n)=>{if(r)return H6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},z6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return H6(t,e,r)},K6=(...t)=>new RangeError("Invalid range arguments: "+Gfe.inspect(...t)),G6=(t,e,r)=>{if(r.strictRanges===!0)throw K6([t,e]);return[]},Zfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Qfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw K6([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=Fb(a)||Fb(u)||Fb(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&Xfe(t,e,n)===!1,f=n.transform||Wfe(d);if(n.toRegex&&r===1)return V6(Dm(t,h),Dm(e,h),!0,n);let m={negatives:[],positives:[]},y=A=>m[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):v.push(Yfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Jfe(m,n,h):z6(v,null,{wrap:!1,...n}):v},ehe=(t,e,r=1,n={})=>{if(!El(t)&&t.length>1||!El(e)&&e.length>1)return G6(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 V6(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?z6(l,null,{wrap:!1,options:n}):l},ym=(t,e,r,n={})=>{if(e==null&&Pb(t))return[t];if(!Pb(t)||!Pb(e))return G6(t,e,n);if(typeof r=="function")return ym(t,e,1,{transform:r});if(q6(r))return ym(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,El(r)?El(t)&&El(e)?Qfe(t,e,r,i):ehe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!q6(r)?Zfe(r,i):ym(t,e,1,r)};W6.exports=ym});var J6=_((iSe,Y6)=>{"use strict";var the=Rb(),X6=mm(),rhe=(t,e={})=>{let r=(n,i={})=>{let s=X6.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=X6.reduce(n.nodes),h=the(...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=rhe});var eU=_((sSe,Q6)=>{"use strict";var nhe=Rb(),Z6=gm(),fu=mm(),vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?fu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(vo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?vo(i,s,r):i+s);return fu.flatten(n)},ihe=(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(vo(a.pop(),Z6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(vo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=fu.reduce(i.nodes);if(fu.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=nhe(...h,e);d.length===0&&(d=Z6(i,e)),a.push(vo(a.pop(),d)),i.nodes=[];return}let u=fu.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(vo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(vo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return fu.flatten(n(t))};Q6.exports=ihe});var rU=_((oSe,tU)=>{"use strict";tU.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:`
241
- `,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 aU=_((aSe,oU)=>{"use strict";var she=gm(),{MAX_LENGTH:nU,CHAR_BACKSLASH:kb,CHAR_BACKTICK:ohe,CHAR_COMMA:ahe,CHAR_DOT:uhe,CHAR_LEFT_PARENTHESES:che,CHAR_RIGHT_PARENTHESES:lhe,CHAR_LEFT_CURLY_BRACE:fhe,CHAR_RIGHT_CURLY_BRACE:hhe,CHAR_LEFT_SQUARE_BRACKET:iU,CHAR_RIGHT_SQUARE_BRACKET:sU,CHAR_DOUBLE_QUOTE:dhe,CHAR_SINGLE_QUOTE:phe,CHAR_NO_BREAK_SPACE:mhe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ghe}=rU(),yhe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(nU,r.maxLength):nU;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===ghe||d===mhe)){if(d===kb){m({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===sU){m({type:"text",value:"\\"+d});continue}if(d===iU){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===iU){u++;continue}if(y===kb){d+=f();continue}if(y===sU&&(u--,u===0))break}m({type:"text",value:d});continue}if(d===che){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:d});continue}if(d===lhe){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===dhe||d===phe||d===ohe){let y=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===kb){d+=v+f();continue}if(v===y){e.keepQuotes===!0&&(d+=v);break}d+=v}m({type:"text",value:d});continue}if(d===fhe){h++;let v={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(v),s.push(o),m({type:"open",value:d});continue}if(d===hhe){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===ahe&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:she(o)}]}m({type:"comma",value:d}),o.commas++;continue}if(d===uhe&&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 v=y[y.length-1];v.value+=a.value+d,a=v,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(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let y=s[s.length-1],v=y.nodes.indexOf(o);y.nodes.splice(v,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),i};oU.exports=yhe});var lU=_((uSe,cU)=>{"use strict";var uU=gm(),Dhe=J6(),whe=eU(),vhe=aU(),Br=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Br.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Br.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Br.parse=(t,e={})=>vhe(t,e);Br.stringify=(t,e={})=>uU(typeof t=="string"?Br.parse(t,e):t,e);Br.compile=(t,e={})=>(typeof t=="string"&&(t=Br.parse(t,e)),Dhe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=whe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Br.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Br.compile(t,e):Br.expand(t,e);cU.exports=Br});var bl=_((cSe,mU)=>{"use strict";var Ehe=require("path"),Gn="\\\\/",fU=`[^${Gn}]`,Oi="\\.",bhe="\\+",_he="\\?",wm="\\/",Che="(?=.)",hU="[^/]",Nb=`(?:${wm}|$)`,dU=`(?:^|${wm})`,$b=`${Oi}{1,2}${Nb}`,She=`(?!${Oi})`,Ahe=`(?!${dU}${$b})`,Ohe=`(?!${Oi}{0,1}${Nb})`,xhe=`(?!${$b})`,The=`[^.${wm}]`,Ihe=`${hU}*?`,pU={DOT_LITERAL:Oi,PLUS_LITERAL:bhe,QMARK_LITERAL:_he,SLASH_LITERAL:wm,ONE_CHAR:Che,QMARK:hU,END_ANCHOR:Nb,DOTS_SLASH:$b,NO_DOT:She,NO_DOTS:Ahe,NO_DOT_SLASH:Ohe,NO_DOTS_SLASH:xhe,QMARK_NO_DOT:The,STAR:Ihe,START_ANCHOR:dU},Phe={...pU,SLASH_LITERAL:`[${Gn}]`,QMARK:fU,STAR:`${fU}*?`,DOTS_SLASH:`${Oi}{1,2}(?:[${Gn}]|$)`,NO_DOT:`(?!${Oi})`,NO_DOTS:`(?!(?:^|[${Gn}])${Oi}{1,2}(?:[${Gn}]|$))`,NO_DOT_SLASH:`(?!${Oi}{0,1}(?:[${Gn}]|$))`,NO_DOTS_SLASH:`(?!${Oi}{1,2}(?:[${Gn}]|$))`,QMARK_NO_DOT:`[^.${Gn}]`,START_ANCHOR:`(?:^|[${Gn}])`,END_ANCHOR:`(?:[${Gn}]|$)`},Fhe={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"};mU.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Fhe,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:Ehe.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?Phe:pU}}});var _l=_(Tr=>{"use strict";var Rhe=require("path"),khe=process.platform==="win32",{REGEX_BACKSLASH:Nhe,REGEX_REMOVE_BACKSLASH:$he,REGEX_SPECIAL_CHARS:Lhe,REGEX_SPECIAL_CHARS_GLOBAL:Bhe}=bl();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>Lhe.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace(Bhe,"\\$1");Tr.toPosixSlashes=t=>t.replace(Nhe,"/");Tr.removeBackslashes=t=>t.replace($he,e=>e==="\\"?"":e);Tr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Tr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:khe===!0||Rhe.sep==="\\";Tr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Tr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Tr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Tr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var _U=_((fSe,bU)=>{"use strict";var gU=_l(),{CHAR_ASTERISK:Lb,CHAR_AT:jhe,CHAR_BACKWARD_SLASH:Cl,CHAR_COMMA:Mhe,CHAR_DOT:Bb,CHAR_EXCLAMATION_MARK:jb,CHAR_FORWARD_SLASH:EU,CHAR_LEFT_CURLY_BRACE:Mb,CHAR_LEFT_PARENTHESES:Ub,CHAR_LEFT_SQUARE_BRACKET:Uhe,CHAR_PLUS:qhe,CHAR_QUESTION_MARK:yU,CHAR_RIGHT_CURLY_BRACE:Hhe,CHAR_RIGHT_PARENTHESES:DU,CHAR_RIGHT_SQUARE_BRACKET:Vhe}=bl(),wU=t=>t===EU||t===Cl,vU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},zhe=(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,v=!1,E=!1,A=!1,p=!1,D=!1,w=!1,C=0,F,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=b,u.charCodeAt(++c));for(;c<n;){b=B();let T;if(b===Cl){A=k.backslashes=!0,b=B(),b===Mb&&(E=!0);continue}if(E===!0||b===Mb){for(C++;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,B();continue}if(b===Mb){C++;continue}if(E!==!0&&b===Bb&&(b=B())===Bb){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&b===Mhe){if(d=k.isBrace=!0,m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Hhe&&(C--,C===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===EU){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(F===Bb&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===qhe||b===jhe||b===Lb||b===yU||b===jb)===!0&&I()===Ub){if(m=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===jb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,b=B();continue}if(b===DU){m=k.isGlob=!0,w=!0;break}}continue}break}if(b===Lb){if(F===Lb&&(v=k.isGlobstar=!0),m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===yU){if(m=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Uhe){for(;R()!==!0&&(T=B());){if(T===Cl){A=k.backslashes=!0,B();continue}if(T===Vhe){f=k.isBracket=!0,m=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===jb&&c===l){p=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Ub){if(m=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=B());){if(b===Ub){A=k.backslashes=!0,b=B();continue}if(b===DU){w=!0;break}}continue}break}if(m===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,m=!1);let j=u,z="",L="";l>0&&(z=u.slice(0,l),u=u.slice(l),h-=l),j&&m===!0&&h>0?(j=u.slice(0,h),L=u.slice(h)):m===!0?(j="",L=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&wU(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(L&&(L=gU.removeBackslashes(L)),j&&A===!0&&(j=gU.removeBackslashes(j)));let S={prefix:z,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:m,isExtglob:y,isGlobstar:v,negated:p,negatedExtglob:D};if(r.tokens===!0&&(S.maxDepth=0,wU(b)||o.push(k),S.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let P=0;P<s.length;P++){let $=T?T+1:l,q=s[P],M=t.slice($,q);r.tokens&&(P===0&&l!==0?(o[P].isPrefix=!0,o[P].value=z):o[P].value=M,vU(o[P]),S.maxDepth+=o[P].depth),(P!==0||M!=="")&&a.push(M),T=q}if(T&&T+1<t.length){let P=t.slice(T+1);a.push(P),r.tokens&&(o[o.length-1].value=P,vU(o[o.length-1]),S.maxDepth+=o[o.length-1].depth)}S.slashes=s,S.parts=a}return S};bU.exports=zhe});var AU=_((hSe,SU)=>{"use strict";var vm=bl(),jr=_l(),{MAX_LENGTH:Em,POSIX_REGEX_SOURCE:Khe,REGEX_NON_SPECIAL_CHARS:Ghe,REGEX_SPECIAL_CHARS_BACKREF:Whe,REPLACEMENTS:CU}=vm,Xhe=(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=>jr.escapeRegex(i)).join("..")}return r},hu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,qb=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=CU[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Em,r.maxLength):Em,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=jr.isWindows(e),c=vm.globChars(u),l=vm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:m,DOTS_SLASH:y,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:p,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:C}=c,F=N=>`(${a}(?:(?!${C}${N.dot?y:h}).)*?)`,b=r.dot?"":v,k=r.dot?p:D,R=r.bash===!0?F(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=jr.removePrefix(t,I),i=t.length;let B=[],j=[],z=[],L=s,S,T=()=>I.index===i-1,P=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",q=()=>t.slice(I.index+1),M=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,M(N.value)},U=()=>{let N=1;for(;P()==="!"&&(P(2)!=="("||P(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},H=N=>{I[N]++,z.push(N)},te=N=>{I[N]--,z.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),K=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!K&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(B.length&&N.type!=="paren"&&(B[B.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 K={...l[ne],conditions:1,inner:""};K.prev=L,K.parens=I.parens,K.output=I.output;let oe=(r.capture?"(":"")+K.open;H("parens"),x({type:N,value:ne,output:I.output?"":m}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(K)},V=N=>{let ne=N.close+(r.capture?")":""),K;if(N.type==="negate"){let oe=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(oe=F(r)),(oe!==R||T()||/^\)+$/.test(q()))&&(ne=N.close=`)$))${oe}`),N.inner.includes("*")&&(K=q())&&/^\.[^\\/.]+$/.test(K)){let we=qb(K,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:S,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Whe,(K,oe,we,Pe,Ve,bt)=>Pe==="\\"?(N=!0,K):Pe==="?"?oe?oe+Pe+(Ve?p.repeat(Ve.length):""):bt===0?k+(Ve?p.repeat(Ve.length):""):p.repeat(we.length):Pe==="."?h.repeat(we.length):Pe==="*"?oe?oe+Pe+(Ve?R:""):R:oe?K:`\\${K}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,K=>K.length%2===0?"\\\\":K?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(S=$(),S==="\0")continue;if(S==="\\"){let K=P();if(K==="/"&&r.bash!==!0||K==="."||K===";")continue;if(!K){S+="\\",x({type:"text",value:S});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[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 K=L.value.slice(1);if(K.includes("[")&&(L.posix=!0,K.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Pe=L.value.slice(oe+2),Ve=Khe[Pe];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=m);continue}}}(S==="["&&P()!==":"||S==="-"&&P()==="]")&&(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=jr.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==="("){H("parens"),x({type:"paren",value:S});continue}if(S===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(hu("opening","("));let K=B[B.length-1];if(K&&I.parens===K.parens+1){V(B.pop());continue}x({type:"paren",value:S,output:I.parens?")":"\\)"}),te("parens");continue}if(S==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));S=`\\${S}`}else H("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(hu("opening","["));x({type:"text",value:S,output:`\\${S}`});continue}te("brackets");let K=L.value.slice(1);if(L.posix!==!0&&K[0]==="^"&&!K.includes("/")&&(S=`/${S}`),L.value+=S,G({value:S}),r.literalBrackets===!1||jr.hasRegexChars(K))continue;let oe=jr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=oe,L.value=oe;continue}L.value=`(${a}${oe}|${L.value})`,I.output+=L.value;continue}if(S==="{"&&r.nobrace!==!0){H("braces");let K={type:"brace",value:S,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(K),x(K);continue}if(S==="}"){let K=j[j.length-1];if(r.nobrace===!0||!K){x({type:"text",value:S,output:S});continue}let oe=")";if(K.dots===!0){let we=o.slice(),Pe=[];for(let Ve=we.length-1;Ve>=0&&(o.pop(),we[Ve].type!=="brace");Ve--)we[Ve].type!=="dots"&&Pe.unshift(we[Ve].value);oe=Xhe(Pe,r),I.backtrack=!0}if(K.comma!==!0&&K.dots!==!0){let we=I.output.slice(0,K.outputIndex),Pe=I.tokens.slice(K.tokensIndex);K.value=K.output="\\{",S=oe="\\}",I.output=we;for(let Ve of Pe)I.output+=Ve.output||Ve.value}x({type:"brace",value:S,output:oe}),te("braces"),j.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:S});continue}if(S===","){let K=S,oe=j[j.length-1];oe&&z[z.length-1]==="braces"&&(oe.comma=!0,K="|"),x({type:"comma",value:S,output:K});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 K=j[j.length-1];L.type="dots",L.output+=S,L.value+=S,K.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&&P()==="("&&P(2)!=="?"){O("qmark",S);continue}if(L&&L.type==="paren"){let oe=P(),we=S;if(oe==="<"&&!jr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(oe)||oe==="<"&&!/<([!=]|\w+>)/.test(q()))&&(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&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",S);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(S==="+"){if(r.noextglob!==!0&&P()==="("&&P(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&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:S,output:""});continue}x({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let K=Ghe.exec(q());K&&(S+=K[0],I.index+=K[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,M(S);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",S);continue}if(L.type==="star"){if(r.noglobstar===!0){M(S);continue}let K=L.prev,oe=K.prev,we=K.type==="slash"||K.type==="bos",Pe=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:S,output:""});continue}let Ve=I.braces>0&&(K.type==="comma"||K.type==="brace"),bt=B.length&&(K.type==="pipe"||K.type==="paren");if(!we&&K.type!=="paren"&&!Ve&&!bt){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),M("/**",3)}if(K.type==="bos"&&T()){L.type="globstar",L.value+=S,L.output=F(r),I.output=L.output,I.globstar=!0,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&!Pe&&T()){I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=S,I.globstar=!0,I.output+=K.output+L.output,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=S,I.output+=K.output+L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}if(K.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=S,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=S,I.output+=L.output,I.globstar=!0,M(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+=E,L.output+=E):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),P()!=="*"&&(I.output+=m,L.output+=m)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","}"));I.output=jr.escapeLast(I.output,"{"),te("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};qb.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Em,r.maxLength):Em,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=CU[t]||t;let s=jr.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}=vm.globChars(s),y=r.dot?h:l,v=r.dot?d:l,E=r.capture?"":"?:",A={negated:!1,prefix:""},p=r.bash===!0?".*?":f;r.capture&&(p=`(${p})`);let D=b=>b.noglobstar===!0?p:`(${E}(?:(?!${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}${v}${p}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${v}${u}${p}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${v}${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}}},C=jr.removePrefix(t,A),F=w(C);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};SU.exports=qb});var xU=_((dSe,OU)=>{"use strict";var Yhe=require("path"),Jhe=_U(),Hb=AU(),Vb=_l(),Zhe=bl(),Qhe=t=>t&&typeof t=="object"&&!Array.isArray(t),xt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>xt(d,e,r));return d=>{for(let f of l){let m=f(d);if(m)return m}return!1}}let n=Qhe(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=Vb.isWindows(e),o=n?xt.compileRe(t,e):xt.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=xt(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:m}=xt.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};xt.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?Vb.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=xt.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};xt.matchBase=(t,e,r,n=Vb.isWindows(r))=>(e instanceof RegExp?e:xt.makeRe(e,r)).test(Yhe.basename(t));xt.isMatch=(t,e,r)=>xt(e,r)(t);xt.parse=(t,e)=>Array.isArray(t)?t.map(r=>xt.parse(r,e)):Hb(t,{...e,fastpaths:!1});xt.scan=(t,e)=>Jhe(t,e);xt.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=xt.toRegex(a,e);return n===!0&&(u.state=t),u};xt.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=Hb.fastpaths(t,e)),i.output||(i=Hb(t,e)),xt.compileRe(i,e,r,n)};xt.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/$^/}};xt.constants=Zhe;OU.exports=xt});var IU=_((pSe,TU)=>{"use strict";TU.exports=xU()});var $U=_((mSe,NU)=>{"use strict";var FU=require("util"),RU=lU(),Wn=IU(),zb=_l(),PU=t=>t===""||t==="./",kU=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},rt=(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=Wn(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};rt.match=rt;rt.matcher=(t,e)=>Wn(t,e);rt.isMatch=(t,e,r)=>Wn(e,r)(t);rt.any=rt.isMatch;rt.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(rt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};rt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${FU.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>rt.contains(t,n,r));if(typeof e=="string"){if(PU(t)||PU(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return rt.isMatch(t,e,{...r,contains:!0})};rt.matchKeys=(t,e,r)=>{if(!zb.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=rt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};rt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Wn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};rt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Wn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};rt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${FU.inspect(t)}"`);return[].concat(e).every(n=>Wn(n,r)(t))};rt.capture=(t,e,r)=>{let n=zb.isWindows(r),s=Wn.makeRe(String(t),{...r,capture:!0}).exec(n?zb.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};rt.makeRe=(...t)=>Wn.makeRe(...t);rt.scan=(...t)=>Wn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of RU(String(n),e))r.push(Wn.parse(i,e));return r};rt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!kU(t)?[t]:RU(t,e)};rt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return rt.braces(t,{...e,expand:!0})};rt.hasBraces=kU;NU.exports=rt});var Vde={};Am(Vde,{CapgoSDK:()=>nt,addApp:()=>Bde,addChannel:()=>Mde,addOrganization:()=>Nde,checkBundleCompatibility:()=>Cde,createSupabaseClient:()=>pe,decryptBundle:()=>Ade,deleteLegacyEncryptionKey:()=>Ide,deleteOrganization:()=>Lde,doctor:()=>_de,encryptBundle:()=>Sde,generateEncryptionKeys:()=>xde,getAccountId:()=>Rde,getCapacitorConfig:()=>Hde,getCurrentBundle:()=>Pde,getStats:()=>qde,listBundles:()=>jde,listOrganizations:()=>kde,login:()=>bde,requestBuild:()=>Ude,saveEncryptionKey:()=>Tde,updateAppSetting:()=>Fde,updateOrganization:()=>$de,uploadBundle:()=>Ede,zipBundle:()=>Ode});module.exports=ce(Vde);var Vt=Ee(Ze(),1),Co=require("node:process"),xi=Ee(require("node:readline"),1),Fm=Ee(require("node:readline"),1),o_=require("node:stream"),a_=Ee(Tm(),1);function Cq({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 Sq=Cq();function u_(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Sq,"")}function c_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l_={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}})(l_);var Aq=l_.exports,Oq=c_(Aq),xq=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},Tq=c_(xq);function pu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=u_(t),t.length===0))return 0;t=t.replace(Tq()," ");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(Oq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Im=10,Qb=(t=0)=>e=>`\x1B[${e+t}m`,e_=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,t_=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,it={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(it.modifier);var Iq=Object.keys(it.color),Pq=Object.keys(it.bgColor);[...Iq,...Pq];function Fq(){let t=new Map;for(let[e,r]of Object.entries(it)){for(let[n,i]of Object.entries(r))it[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=it[n],t.set(i[0],i[1]);Object.defineProperty(it,e,{value:r,enumerable:!1})}return Object.defineProperty(it,"codes",{value:t,enumerable:!1}),it.color.close="\x1B[39m",it.bgColor.close="\x1B[49m",it.color.ansi=Qb(),it.color.ansi256=e_(),it.color.ansi16m=t_(),it.bgColor.ansi=Qb(Im),it.bgColor.ansi256=e_(Im),it.bgColor.ansi16m=t_(Im),Object.defineProperties(it,{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=>it.rgbToAnsi256(...it.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)=>it.ansi256ToAnsi(it.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>it.ansi256ToAnsi(it.hexToAnsi256(e)),enumerable:!1}}),it}var Rq=Fq(),kl=new Set(["\x1B","\x9B"]),kq=39,km="\x07",f_="[",Nq="]",h_="m",Nm=`${Nq}8;;`,r_=t=>`${kl.values().next().value}${f_}${t}${h_}`,n_=t=>`${kl.values().next().value}${Nm}${t}${km}`,$q=t=>t.split(" ").map(e=>pu(e)),Pm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=pu(u_(t[t.length-1]));for(let[a,u]of n.entries()){let c=pu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),kl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Nm)),i){s?u===km&&(i=!1,s=!1):u===h_&&(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())},Lq=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(pu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Bq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=$q(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=pu(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(""),Pm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Pm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Pm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Lq(c)));let u=[...a.join(`
240
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var zM=mr(()=>{VM()});async function sb(t=Vle){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 Mp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=WM[n];if(!i)throw new Mp(`Unknown browser ID: ${n}`);return i}var KM,GM,Vle,WM,ib,Mp,ob=mr(()=>{KM=require("node:util"),GM=require("node:child_process"),Vle=(0,KM.promisify)(GM.execFile),WM={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},ib=new Map(Object.entries(WM)),Mp=class extends Error{}});async function ab(){if(Up.default.platform==="darwin"){let t=await tb();return{name:await nb(t),id:t}}if(Up.default.platform==="linux"){let{stdout:t}=await zle("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:Kle(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Up.default.platform==="win32")return sb();throw new Error("Only macOS, Linux, and Windows are supported")}var XM,Up,YM,zle,Kle,JM=mr(()=>{XM=require("node:util"),Up=Ee(require("node:process"),1),YM=require("node:child_process");MM();zM();ob();ob();zle=(0,XM.promisify)(YM.execFile),Kle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var qp,Gle,ZM,QM=mr(()=>{qp=Ee(require("node:process"),1),Gle=!!(qp.default.env.SSH_CONNECTION||qp.default.env.SSH_CLIENT||qp.default.env.SSH_TTY),ZM=Gle});var fb={};Am(fb,{apps:()=>fo,default:()=>Yle,openApp:()=>Xle});function n8(t){if(typeof t=="string"||Array.isArray(t))return t;let{[t8]:e}=t;if(!e)throw new Error(`${t8} is not supported`);return e}function cl({[Ja]:t},{wsl:e}={}){if(e&&vi)return n8(e);if(!t)throw new Error(`${Ja} is not supported`);return n8(t)}var cb,lb,s8,o8,Vp,i8,Hp,ub,e8,Ja,t8,r8,ul,Wle,Xle,fo,Yle,hb=mr(()=>{cb=Ee(require("node:process"),1),lb=Ee(require("node:path"),1),s8=require("node:url"),o8=Ee(require("node:child_process"),1),Vp=Ee(require("node:fs/promises"),1);NM();eb();$M();JM();XE();QM();i8={},Hp=Symbol("fallbackAttempt"),ub=i8.url?lb.default.dirname((0,s8.fileURLToPath)(i8.url)):"",e8=lb.default.join(ub,"xdg-open"),{platform:Ja,arch:t8}=cb.default,r8=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(i){r.push(i)}throw new AggregateError(r,"Failed to open in all supported apps")},ul=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Hp]===!0;if(delete t[Hp],Array.isArray(t.app))return r8(t.app,c=>ul({...t,app:c,[Hp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return r8(r,c=>ul({...t,app:{name:c,arguments:n},[Hp]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},h;if(vi){let d=await RM();h=ib.get(d)??{}}else h=await ab();if(h.id in c){let d=c[h.id.toLowerCase()];if(r==="browserPrivate"){if(d==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[d])}return ul({...t,app:{name:fo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(vi&&!Ya()&&!ZM&&!r&&(a=await FM()),Ja==="darwin")i="open",t.wait&&s.push("--wait-apps"),t.background&&s.push("--background"),t.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(Ja==="win32"||a){i=await jp(),s.push(...Nr.argumentsPrefix),vi||(o.windowsVerbatimArguments=!0),vi&&t.target&&(t.target=await kM(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Nr.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Nr.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Nr.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Nr.encodeCommand(c.join(" ")),t.wait||(o.stdio="ignore")}else{if(r)i=r;else{let c=!ub||ub==="/",l=!1;try{await Vp.default.access(e8,Vp.constants.X_OK),l=!0}catch{}i=cb.default.versions.electron??(Ja==="android"||c||!l)?"xdg-open":e8}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ja==="darwin"&&n.length>0&&s.push("--args",...n),t.target&&s.push(t.target);let u=o8.default.spawn(i,s,o);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",h=>{if(!t.allowNonzeroExitCode&&h!==0){l(new Error(`Exited with code ${h}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",h=>{if(u.off("error",l),h!==0){l(new Error(`Exited with code ${h}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},Wle=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return ul({...e,target:t})},Xle=(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 ul({...e,app:{name:t,arguments:r}})};fo={browser:"browser",browserPrivate:"browserPrivate"};lo(fo,"chrome",()=>cl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));lo(fo,"brave",()=>cl({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"]}}));lo(fo,"firefox",()=>cl({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));lo(fo,"edge",()=>cl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));lo(fo,"safari",()=>cl({darwin:"Safari"}));Yle=Wle});var mm=_(rn=>{"use strict";rn.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;rn.find=(t,e)=>t.nodes.find(r=>r.type===e);rn.exceedsLimit=(t,e,r=1,n)=>n===!1||!rn.isInteger(t)||!rn.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;rn.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)};rn.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;rn.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;rn.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;rn.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);rn.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 gm=_((eSe,I6)=>{"use strict";var T6=mm();I6.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&T6.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&T6.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 F6=_((tSe,P6)=>{"use strict";P6.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=_((rSe,M6)=>{"use strict";var R6=F6(),wo=(t,e,r)=>{if(R6(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(R6(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(wo.cache.hasOwnProperty(u))return wo.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=j6(t)||j6(e),d={min:t,max:e,a:c,b:l},f=[],p=[];if(h&&(d.isPadded=h,d.maxLen=String(d.max).length),c<0){let y=l<0?Math.abs(l):1;p=k6(y,Math.abs(c),d,n),c=d.a=0}return l>=0&&(f=k6(c,l,d,n)),d.negatives=p,d.positives=f,d.result=Mfe(p,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+p.length>1&&(d.result=`(?:${d.result})`),wo.cache[u]=d,d.result};function Mfe(t,e,r){let n=Ib(t,e,"-",!1,r)||[],i=Ib(e,t,"",!1,r)||[],s=Ib(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function Ufe(t,e){let r=1,n=1,i=$6(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=$6(t,r);for(i=L6(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=L6(e+1,n)-1;return s=[...s],s.sort(Vfe),s}function qfe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=Hfe(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+=zfe(u,c,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function k6(t,e,r,n){let i=Ufe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=qfe(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+B6(a.count),o=c+1;continue}r.isPadded&&(h=Kfe(c,r,n)),l.string=h+l.pattern+B6(l.count),s.push(l),o=c+1,a=l}return s}function Ib(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!N6(e,"string",a)&&s.push(r+a),n&&N6(e,"string",a)&&s.push(r+a)}return s}function Hfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function Vfe(t,e){return t>e?1:e>t?-1:0}function N6(t,e,r){return t.some(n=>n[e]===r)}function $6(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function L6(t,e){return t-t%Math.pow(10,e)}function B6(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function zfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function j6(t){return/^-?(0+)\d/.test(t)}function Kfe(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}}`}}wo.cache={};wo.clearCache=()=>wo.cache={};M6.exports=wo});var Rb=_((nSe,W6)=>{"use strict";var Gfe=require("util"),H6=U6(),q6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Wfe=t=>e=>t===!0?Number(e):String(e),Pb=t=>typeof t=="number"||typeof t=="string"&&t!=="",El=t=>Number.isInteger(+t),Fb=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},Xfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Yfe=(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},Dm=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Jfe=(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=>Dm(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>Dm(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},V6=(t,e,r,n)=>{if(r)return H6(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},z6=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return H6(t,e,r)},K6=(...t)=>new RangeError("Invalid range arguments: "+Gfe.inspect(...t)),G6=(t,e,r)=>{if(r.strictRanges===!0)throw K6([t,e]);return[]},Zfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Qfe=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw K6([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=Fb(a)||Fb(u)||Fb(c),h=l?Math.max(a.length,u.length,c.length):0,d=l===!1&&Xfe(t,e,n)===!1,f=n.transform||Wfe(d);if(n.toRegex&&r===1)return V6(Dm(t,h),Dm(e,h),!0,n);let p={negatives:[],positives:[]},y=A=>p[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?y(i):v.push(Yfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Jfe(p,n,h):z6(v,null,{wrap:!1,...n}):v},ehe=(t,e,r=1,n={})=>{if(!El(t)&&t.length>1||!El(e)&&e.length>1)return G6(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 V6(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?z6(l,null,{wrap:!1,options:n}):l},ym=(t,e,r,n={})=>{if(e==null&&Pb(t))return[t];if(!Pb(t)||!Pb(e))return G6(t,e,n);if(typeof r=="function")return ym(t,e,1,{transform:r});if(q6(r))return ym(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,El(r)?El(t)&&El(e)?Qfe(t,e,r,i):ehe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!q6(r)?Zfe(r,i):ym(t,e,1,r)};W6.exports=ym});var J6=_((iSe,Y6)=>{"use strict";var the=Rb(),X6=mm(),rhe=(t,e={})=>{let r=(n,i={})=>{let s=X6.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=X6.reduce(n.nodes),h=the(...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=rhe});var eU=_((sSe,Q6)=>{"use strict";var nhe=Rb(),Z6=gm(),fu=mm(),vo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?fu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(vo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?vo(i,s,r):i+s);return fu.flatten(n)},ihe=(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(vo(a.pop(),Z6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(vo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=fu.reduce(i.nodes);if(fu.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=nhe(...h,e);d.length===0&&(d=Z6(i,e)),a.push(vo(a.pop(),d)),i.nodes=[];return}let u=fu.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(vo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(vo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return fu.flatten(n(t))};Q6.exports=ihe});var rU=_((oSe,tU)=>{"use strict";tU.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:`
241
+ `,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 aU=_((aSe,oU)=>{"use strict";var she=gm(),{MAX_LENGTH:nU,CHAR_BACKSLASH:kb,CHAR_BACKTICK:ohe,CHAR_COMMA:ahe,CHAR_DOT:uhe,CHAR_LEFT_PARENTHESES:che,CHAR_RIGHT_PARENTHESES:lhe,CHAR_LEFT_CURLY_BRACE:fhe,CHAR_RIGHT_CURLY_BRACE:hhe,CHAR_LEFT_SQUARE_BRACKET:iU,CHAR_RIGHT_SQUARE_BRACKET:sU,CHAR_DOUBLE_QUOTE:dhe,CHAR_SINGLE_QUOTE:phe,CHAR_NO_BREAK_SPACE:mhe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ghe}=rU(),yhe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(nU,r.maxLength):nU;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++],p=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(p({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===ghe||d===mhe)){if(d===kb){p({type:"text",value:(e.keepEscaping?d:"")+f()});continue}if(d===sU){p({type:"text",value:"\\"+d});continue}if(d===iU){u++;let y;for(;l<c&&(y=f());){if(d+=y,y===iU){u++;continue}if(y===kb){d+=f();continue}if(y===sU&&(u--,u===0))break}p({type:"text",value:d});continue}if(d===che){o=p({type:"paren",nodes:[]}),s.push(o),p({type:"text",value:d});continue}if(d===lhe){if(o.type!=="paren"){p({type:"text",value:d});continue}o=s.pop(),p({type:"text",value:d}),o=s[s.length-1];continue}if(d===dhe||d===phe||d===ohe){let y=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===kb){d+=v+f();continue}if(v===y){e.keepQuotes===!0&&(d+=v);break}d+=v}p({type:"text",value:d});continue}if(d===fhe){h++;let v={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:h,commas:0,ranges:0,nodes:[]};o=p(v),s.push(o),p({type:"open",value:d});continue}if(d===hhe){if(o.type!=="brace"){p({type:"text",value:d});continue}let y="close";o=s.pop(),o.close=!0,p({type:y,value:d}),h--,o=s[s.length-1];continue}if(d===ahe&&h>0){if(o.ranges>0){o.ranges=0;let y=o.nodes.shift();o.nodes=[y,{type:"text",value:she(o)}]}p({type:"comma",value:d}),o.commas++;continue}if(d===uhe&&h>0&&o.commas===0){let y=o.nodes;if(h===0||y.length===0){p({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 v=y[y.length-1];v.value+=a.value+d,a=v,o.ranges--;continue}p({type:"dot",value:d});continue}p({type:"text",value:d})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(E=>{E.nodes||(E.type==="open"&&(E.isOpen=!0),E.type==="close"&&(E.isClose=!0),E.nodes||(E.type="text"),E.invalid=!0)});let y=s[s.length-1],v=y.nodes.indexOf(o);y.nodes.splice(v,1,...o.nodes)}while(s.length>0);return p({type:"eos"}),i};oU.exports=yhe});var lU=_((uSe,cU)=>{"use strict";var uU=gm(),Dhe=J6(),whe=eU(),vhe=aU(),Br=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Br.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Br.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Br.parse=(t,e={})=>vhe(t,e);Br.stringify=(t,e={})=>uU(typeof t=="string"?Br.parse(t,e):t,e);Br.compile=(t,e={})=>(typeof t=="string"&&(t=Br.parse(t,e)),Dhe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=whe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Br.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Br.compile(t,e):Br.expand(t,e);cU.exports=Br});var bl=_((cSe,mU)=>{"use strict";var Ehe=require("path"),Gn="\\\\/",fU=`[^${Gn}]`,Oi="\\.",bhe="\\+",_he="\\?",wm="\\/",Che="(?=.)",hU="[^/]",Nb=`(?:${wm}|$)`,dU=`(?:^|${wm})`,$b=`${Oi}{1,2}${Nb}`,She=`(?!${Oi})`,Ahe=`(?!${dU}${$b})`,Ohe=`(?!${Oi}{0,1}${Nb})`,xhe=`(?!${$b})`,The=`[^.${wm}]`,Ihe=`${hU}*?`,pU={DOT_LITERAL:Oi,PLUS_LITERAL:bhe,QMARK_LITERAL:_he,SLASH_LITERAL:wm,ONE_CHAR:Che,QMARK:hU,END_ANCHOR:Nb,DOTS_SLASH:$b,NO_DOT:She,NO_DOTS:Ahe,NO_DOT_SLASH:Ohe,NO_DOTS_SLASH:xhe,QMARK_NO_DOT:The,STAR:Ihe,START_ANCHOR:dU},Phe={...pU,SLASH_LITERAL:`[${Gn}]`,QMARK:fU,STAR:`${fU}*?`,DOTS_SLASH:`${Oi}{1,2}(?:[${Gn}]|$)`,NO_DOT:`(?!${Oi})`,NO_DOTS:`(?!(?:^|[${Gn}])${Oi}{1,2}(?:[${Gn}]|$))`,NO_DOT_SLASH:`(?!${Oi}{0,1}(?:[${Gn}]|$))`,NO_DOTS_SLASH:`(?!${Oi}{1,2}(?:[${Gn}]|$))`,QMARK_NO_DOT:`[^.${Gn}]`,START_ANCHOR:`(?:^|[${Gn}])`,END_ANCHOR:`(?:[${Gn}]|$)`},Fhe={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"};mU.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Fhe,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:Ehe.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?Phe:pU}}});var _l=_(Tr=>{"use strict";var Rhe=require("path"),khe=process.platform==="win32",{REGEX_BACKSLASH:Nhe,REGEX_REMOVE_BACKSLASH:$he,REGEX_SPECIAL_CHARS:Lhe,REGEX_SPECIAL_CHARS_GLOBAL:Bhe}=bl();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>Lhe.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace(Bhe,"\\$1");Tr.toPosixSlashes=t=>t.replace(Nhe,"/");Tr.removeBackslashes=t=>t.replace($he,e=>e==="\\"?"":e);Tr.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Tr.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:khe===!0||Rhe.sep==="\\";Tr.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Tr.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Tr.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Tr.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var _U=_((fSe,bU)=>{"use strict";var gU=_l(),{CHAR_ASTERISK:Lb,CHAR_AT:jhe,CHAR_BACKWARD_SLASH:Cl,CHAR_COMMA:Mhe,CHAR_DOT:Bb,CHAR_EXCLAMATION_MARK:jb,CHAR_FORWARD_SLASH:EU,CHAR_LEFT_CURLY_BRACE:Mb,CHAR_LEFT_PARENTHESES:Ub,CHAR_LEFT_SQUARE_BRACKET:Uhe,CHAR_PLUS:qhe,CHAR_QUESTION_MARK:yU,CHAR_RIGHT_CURLY_BRACE:Hhe,CHAR_RIGHT_PARENTHESES:DU,CHAR_RIGHT_SQUARE_BRACKET:Vhe}=bl(),wU=t=>t===EU||t===Cl,vU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},zhe=(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,p=!1,y=!1,v=!1,E=!1,A=!1,m=!1,D=!1,w=!1,C=0,F,b,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=b,u.charCodeAt(++c));for(;c<n;){b=B();let T;if(b===Cl){A=k.backslashes=!0,b=B(),b===Mb&&(E=!0);continue}if(E===!0||b===Mb){for(C++;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,B();continue}if(b===Mb){C++;continue}if(E!==!0&&b===Bb&&(b=B())===Bb){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&b===Mhe){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Hhe&&(C--,C===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(b===EU){if(s.push(c),o.push(k),k={value:"",depth:0,isGlob:!1},w===!0)continue;if(F===Bb&&c===l+1){l+=2;continue}h=c+1;continue}if(r.noext!==!0&&(b===qhe||b===jhe||b===Lb||b===yU||b===jb)===!0&&I()===Ub){if(p=k.isGlob=!0,y=k.isExtglob=!0,w=!0,b===jb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(b=B());){if(b===Cl){A=k.backslashes=!0,b=B();continue}if(b===DU){p=k.isGlob=!0,w=!0;break}}continue}break}if(b===Lb){if(F===Lb&&(v=k.isGlobstar=!0),p=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===yU){if(p=k.isGlob=!0,w=!0,i===!0)continue;break}if(b===Uhe){for(;R()!==!0&&(T=B());){if(T===Cl){A=k.backslashes=!0,B();continue}if(T===Vhe){f=k.isBracket=!0,p=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&b===jb&&c===l){m=k.negated=!0,l++;continue}if(r.noparen!==!0&&b===Ub){if(p=k.isGlob=!0,i===!0){for(;R()!==!0&&(b=B());){if(b===Ub){A=k.backslashes=!0,b=B();continue}if(b===DU){w=!0;break}}continue}break}if(p===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(y=!1,p=!1);let j=u,z="",L="";l>0&&(z=u.slice(0,l),u=u.slice(l),h-=l),j&&p===!0&&h>0?(j=u.slice(0,h),L=u.slice(h)):p===!0?(j="",L=u):j=u,j&&j!==""&&j!=="/"&&j!==u&&wU(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),r.unescape===!0&&(L&&(L=gU.removeBackslashes(L)),j&&A===!0&&(j=gU.removeBackslashes(j)));let S={prefix:z,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:p,isExtglob:y,isGlobstar:v,negated:m,negatedExtglob:D};if(r.tokens===!0&&(S.maxDepth=0,wU(b)||o.push(k),S.tokens=o),r.parts===!0||r.tokens===!0){let T;for(let P=0;P<s.length;P++){let $=T?T+1:l,q=s[P],M=t.slice($,q);r.tokens&&(P===0&&l!==0?(o[P].isPrefix=!0,o[P].value=z):o[P].value=M,vU(o[P]),S.maxDepth+=o[P].depth),(P!==0||M!=="")&&a.push(M),T=q}if(T&&T+1<t.length){let P=t.slice(T+1);a.push(P),r.tokens&&(o[o.length-1].value=P,vU(o[o.length-1]),S.maxDepth+=o[o.length-1].depth)}S.slashes=s,S.parts=a}return S};bU.exports=zhe});var AU=_((hSe,SU)=>{"use strict";var vm=bl(),jr=_l(),{MAX_LENGTH:Em,POSIX_REGEX_SOURCE:Khe,REGEX_NON_SPECIAL_CHARS:Ghe,REGEX_SPECIAL_CHARS_BACKREF:Whe,REPLACEMENTS:CU}=vm,Xhe=(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=>jr.escapeRegex(i)).join("..")}return r},hu=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,qb=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=CU[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Em,r.maxLength):Em,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=jr.isWindows(e),c=vm.globChars(u),l=vm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:y,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:m,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:C}=c,F=N=>`(${a}(?:(?!${C}${N.dot?y:h}).)*?)`,b=r.dot?"":v,k=r.dot?m:D,R=r.bash===!0?F(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=jr.removePrefix(t,I),i=t.length;let B=[],j=[],z=[],L=s,S,T=()=>I.index===i-1,P=I.peek=(N=1)=>t[I.index+N],$=I.advance=()=>t[++I.index]||"",q=()=>t.slice(I.index+1),M=(N="",ne=0)=>{I.consumed+=N,I.index+=ne},G=N=>{I.output+=N.output!=null?N.output:N.value,M(N.value)},U=()=>{let N=1;for(;P()==="!"&&(P(2)!=="("||P(3)==="?");)$(),I.start++,N++;return N%2===0?!1:(I.negated=!0,I.start++,!0)},H=N=>{I[N]++,z.push(N)},te=N=>{I[N]--,z.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),K=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!K&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(B.length&&N.type!=="paren"&&(B[B.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 K={...l[ne],conditions:1,inner:""};K.prev=L,K.parens=I.parens,K.output=I.output;let oe=(r.capture?"(":"")+K.open;H("parens"),x({type:N,value:ne,output:I.output?"":p}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(K)},V=N=>{let ne=N.close+(r.capture?")":""),K;if(N.type==="negate"){let oe=R;if(N.inner&&N.inner.length>1&&N.inner.includes("/")&&(oe=F(r)),(oe!==R||T()||/^\)+$/.test(q()))&&(ne=N.close=`)$))${oe}`),N.inner.includes("*")&&(K=q())&&/^\.[^\\/.]+$/.test(K)){let we=qb(K,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:S,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Whe,(K,oe,we,Pe,Ve,bt)=>Pe==="\\"?(N=!0,K):Pe==="?"?oe?oe+Pe+(Ve?m.repeat(Ve.length):""):bt===0?k+(Ve?m.repeat(Ve.length):""):m.repeat(we.length):Pe==="."?h.repeat(we.length):Pe==="*"?oe?oe+Pe+(Ve?R:""):R:oe?K:`\\${K}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,K=>K.length%2===0?"\\\\":K?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(S=$(),S==="\0")continue;if(S==="\\"){let K=P();if(K==="/"&&r.bash!==!0||K==="."||K===";")continue;if(!K){S+="\\",x({type:"text",value:S});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[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 K=L.value.slice(1);if(K.includes("[")&&(L.posix=!0,K.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Pe=L.value.slice(oe+2),Ve=Khe[Pe];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=p);continue}}}(S==="["&&P()!==":"||S==="-"&&P()==="]")&&(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=jr.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==="("){H("parens"),x({type:"paren",value:S});continue}if(S===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(hu("opening","("));let K=B[B.length-1];if(K&&I.parens===K.parens+1){V(B.pop());continue}x({type:"paren",value:S,output:I.parens?")":"\\)"}),te("parens");continue}if(S==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));S=`\\${S}`}else H("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(hu("opening","["));x({type:"text",value:S,output:`\\${S}`});continue}te("brackets");let K=L.value.slice(1);if(L.posix!==!0&&K[0]==="^"&&!K.includes("/")&&(S=`/${S}`),L.value+=S,G({value:S}),r.literalBrackets===!1||jr.hasRegexChars(K))continue;let oe=jr.escapeRegex(L.value);if(I.output=I.output.slice(0,-L.value.length),r.literalBrackets===!0){I.output+=oe,L.value=oe;continue}L.value=`(${a}${oe}|${L.value})`,I.output+=L.value;continue}if(S==="{"&&r.nobrace!==!0){H("braces");let K={type:"brace",value:S,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(K),x(K);continue}if(S==="}"){let K=j[j.length-1];if(r.nobrace===!0||!K){x({type:"text",value:S,output:S});continue}let oe=")";if(K.dots===!0){let we=o.slice(),Pe=[];for(let Ve=we.length-1;Ve>=0&&(o.pop(),we[Ve].type!=="brace");Ve--)we[Ve].type!=="dots"&&Pe.unshift(we[Ve].value);oe=Xhe(Pe,r),I.backtrack=!0}if(K.comma!==!0&&K.dots!==!0){let we=I.output.slice(0,K.outputIndex),Pe=I.tokens.slice(K.tokensIndex);K.value=K.output="\\{",S=oe="\\}",I.output=we;for(let Ve of Pe)I.output+=Ve.output||Ve.value}x({type:"brace",value:S,output:oe}),te("braces"),j.pop();continue}if(S==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:S});continue}if(S===","){let K=S,oe=j[j.length-1];oe&&z[z.length-1]==="braces"&&(oe.comma=!0,K="|"),x({type:"comma",value:S,output:K});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 K=j[j.length-1];L.type="dots",L.output+=S,L.value+=S,K.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&&P()==="("&&P(2)!=="?"){O("qmark",S);continue}if(L&&L.type==="paren"){let oe=P(),we=S;if(oe==="<"&&!jr.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(L.value==="("&&!/[!=<:]/.test(oe)||oe==="<"&&!/<([!=]|\w+>)/.test(q()))&&(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:m});continue}if(S==="!"){if(r.noextglob!==!0&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",S);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(S==="+"){if(r.noextglob!==!0&&P()==="("&&P(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&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:S,output:""});continue}x({type:"text",value:S});continue}if(S!=="*"){(S==="$"||S==="^")&&(S=`\\${S}`);let K=Ghe.exec(q());K&&(S+=K[0],I.index+=K[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,M(S);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",S);continue}if(L.type==="star"){if(r.noglobstar===!0){M(S);continue}let K=L.prev,oe=K.prev,we=K.type==="slash"||K.type==="bos",Pe=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:S,output:""});continue}let Ve=I.braces>0&&(K.type==="comma"||K.type==="brace"),bt=B.length&&(K.type==="pipe"||K.type==="paren");if(!we&&K.type!=="paren"&&!Ve&&!bt){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),M("/**",3)}if(K.type==="bos"&&T()){L.type="globstar",L.value+=S,L.output=F(r),I.output=L.output,I.globstar=!0,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&!Pe&&T()){I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=S,I.globstar=!0,I.output+=K.output+L.output,M(S);continue}if(K.type==="slash"&&K.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(K.output+L.output).length),K.output=`(?:${K.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=S,I.output+=K.output+L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}if(K.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=S,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(S+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=S,I.output+=L.output,I.globstar=!0,M(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+=E,L.output+=E):r.dot===!0?(I.output+=A,L.output+=A):(I.output+=b,L.output+=b),P()!=="*"&&(I.output+=p,L.output+=p)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(hu("closing","}"));I.output=jr.escapeLast(I.output,"{"),te("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};qb.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Em,r.maxLength):Em,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=CU[t]||t;let s=jr.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:p}=vm.globChars(s),y=r.dot?h:l,v=r.dot?d:l,E=r.capture?"":"?:",A={negated:!1,prefix:""},m=r.bash===!0?".*?":f;r.capture&&(m=`(${m})`);let D=b=>b.noglobstar===!0?m:`(${E}(?:(?!${p}${b.dot?c:o}).)*?)`,w=b=>{switch(b){case"*":return`${y}${u}${m}`;case".*":return`${o}${u}${m}`;case"*.*":return`${y}${m}${o}${u}${m}`;case"*/*":return`${y}${m}${a}${u}${v}${m}`;case"**":return y+D(r);case"**/*":return`(?:${y}${D(r)}${a})?${v}${u}${m}`;case"**/*.*":return`(?:${y}${D(r)}${a})?${v}${m}${o}${u}${m}`;case"**/.*":return`(?:${y}${D(r)}${a})?${o}${u}${m}`;default:{let k=/^(.*?)\.(\w+)$/.exec(b);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},C=jr.removePrefix(t,A),F=w(C);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};SU.exports=qb});var xU=_((dSe,OU)=>{"use strict";var Yhe=require("path"),Jhe=_U(),Hb=AU(),Vb=_l(),Zhe=bl(),Qhe=t=>t&&typeof t=="object"&&!Array.isArray(t),xt=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>xt(d,e,r));return d=>{for(let f of l){let p=f(d);if(p)return p}return!1}}let n=Qhe(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=Vb.isWindows(e),o=n?xt.compileRe(t,e):xt.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=xt(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:p}=xt.test(l,o,e,{glob:t,posix:s}),y={glob:t,state:a,regex:o,posix:s,input:l,output:p,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};xt.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?Vb.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=xt.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};xt.matchBase=(t,e,r,n=Vb.isWindows(r))=>(e instanceof RegExp?e:xt.makeRe(e,r)).test(Yhe.basename(t));xt.isMatch=(t,e,r)=>xt(e,r)(t);xt.parse=(t,e)=>Array.isArray(t)?t.map(r=>xt.parse(r,e)):Hb(t,{...e,fastpaths:!1});xt.scan=(t,e)=>Jhe(t,e);xt.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=xt.toRegex(a,e);return n===!0&&(u.state=t),u};xt.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=Hb.fastpaths(t,e)),i.output||(i=Hb(t,e)),xt.compileRe(i,e,r,n)};xt.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/$^/}};xt.constants=Zhe;OU.exports=xt});var IU=_((pSe,TU)=>{"use strict";TU.exports=xU()});var $U=_((mSe,NU)=>{"use strict";var FU=require("util"),RU=lU(),Wn=IU(),zb=_l(),PU=t=>t===""||t==="./",kU=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},rt=(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=Wn(String(e[l]),{...r,onResult:a},!0),d=h.state.negated||h.state.negatedExtglob;d&&o++;for(let f of t){let p=h(f,!0);(d?!p.isMatch:p.isMatch)&&(d?n.add(p.output):(n.delete(p.output),i.add(p.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};rt.match=rt;rt.matcher=(t,e)=>Wn(t,e);rt.isMatch=(t,e,r)=>Wn(e,r)(t);rt.any=rt.isMatch;rt.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(rt(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};rt.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${FU.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>rt.contains(t,n,r));if(typeof e=="string"){if(PU(t)||PU(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return rt.isMatch(t,e,{...r,contains:!0})};rt.matchKeys=(t,e,r)=>{if(!zb.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=rt(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};rt.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Wn(String(i),r);if(n.some(o=>s(o)))return!0}return!1};rt.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Wn(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};rt.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${FU.inspect(t)}"`);return[].concat(e).every(n=>Wn(n,r)(t))};rt.capture=(t,e,r)=>{let n=zb.isWindows(r),s=Wn.makeRe(String(t),{...r,capture:!0}).exec(n?zb.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};rt.makeRe=(...t)=>Wn.makeRe(...t);rt.scan=(...t)=>Wn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of RU(String(n),e))r.push(Wn.parse(i,e));return r};rt.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!kU(t)?[t]:RU(t,e)};rt.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return rt.braces(t,{...e,expand:!0})};rt.hasBraces=kU;NU.exports=rt});var Vde={};Am(Vde,{CapgoSDK:()=>nt,addApp:()=>Bde,addChannel:()=>Mde,addOrganization:()=>Nde,checkBundleCompatibility:()=>Cde,createSupabaseClient:()=>pe,decryptBundle:()=>Ade,deleteLegacyEncryptionKey:()=>Ide,deleteOrganization:()=>Lde,doctor:()=>_de,encryptBundle:()=>Sde,generateEncryptionKeys:()=>xde,getAccountId:()=>Rde,getCapacitorConfig:()=>Hde,getCurrentBundle:()=>Pde,getStats:()=>qde,listBundles:()=>jde,listOrganizations:()=>kde,login:()=>bde,requestBuild:()=>Ude,saveEncryptionKey:()=>Tde,updateAppSetting:()=>Fde,updateOrganization:()=>$de,uploadBundle:()=>Ede,zipBundle:()=>Ode});module.exports=ce(Vde);var Vt=Ee(Ze(),1),Co=require("node:process"),xi=Ee(require("node:readline"),1),Fm=Ee(require("node:readline"),1),o_=require("node:stream"),a_=Ee(Tm(),1);function Cq({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 Sq=Cq();function u_(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Sq,"")}function c_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l_={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}})(l_);var Aq=l_.exports,Oq=c_(Aq),xq=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},Tq=c_(xq);function pu(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=u_(t),t.length===0))return 0;t=t.replace(Tq()," ");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(Oq.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Im=10,Qb=(t=0)=>e=>`\x1B[${e+t}m`,e_=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,t_=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,it={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(it.modifier);var Iq=Object.keys(it.color),Pq=Object.keys(it.bgColor);[...Iq,...Pq];function Fq(){let t=new Map;for(let[e,r]of Object.entries(it)){for(let[n,i]of Object.entries(r))it[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=it[n],t.set(i[0],i[1]);Object.defineProperty(it,e,{value:r,enumerable:!1})}return Object.defineProperty(it,"codes",{value:t,enumerable:!1}),it.color.close="\x1B[39m",it.bgColor.close="\x1B[49m",it.color.ansi=Qb(),it.color.ansi256=e_(),it.color.ansi16m=t_(),it.bgColor.ansi=Qb(Im),it.bgColor.ansi256=e_(Im),it.bgColor.ansi16m=t_(Im),Object.defineProperties(it,{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=>it.rgbToAnsi256(...it.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)=>it.ansi256ToAnsi(it.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>it.ansi256ToAnsi(it.hexToAnsi256(e)),enumerable:!1}}),it}var Rq=Fq(),kl=new Set(["\x1B","\x9B"]),kq=39,km="\x07",f_="[",Nq="]",h_="m",Nm=`${Nq}8;;`,r_=t=>`${kl.values().next().value}${f_}${t}${h_}`,n_=t=>`${kl.values().next().value}${Nm}${t}${km}`,$q=t=>t.split(" ").map(e=>pu(e)),Pm=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=pu(u_(t[t.length-1]));for(let[a,u]of n.entries()){let c=pu(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),kl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Nm)),i){s?u===km&&(i=!1,s=!1):u===h_&&(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())},Lq=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(pu(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},Bq=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=$q(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=pu(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(""),Pm(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Pm(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Pm(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Lq(c)));let u=[...a.join(`
242
242
  `)];for(let[c,l]of u.entries()){if(n+=l,kl.has(l)){let{groups:d}=new RegExp(`(?:\\${f_}(?<code>\\d+)m|\\${Nm}(?<uri>.*)${km})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===kq?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=Rq.codes.get(Number(i));u[c+1]===`
243
243
  `?(s&&(n+=n_("")),i&&h&&(n+=r_(h))):l===`
244
244
  `&&(i&&h&&(n+=r_(i)),s&&(n+=n_(s)))}return n};function i_(t,e,r){return String(t).normalize().replace(/\r\n/g,`
@@ -251,7 +251,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
251
251
  `).length-1;this.output.write(Vt.cursor.move(-999,e*-1))}render(){let e=i_(this._render(this)??"",process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Vt.cursor.hide);else{let r=Mq(this._prevFrame,e);if(this.restoreCursor(),r&&r?.length===1){let n=r[0];this.output.write(Vt.cursor.move(0,n)),this.output.write(Vt.erase.lines(1));let i=e.split(`
252
252
  `);this.output.write(i[n]),this._prevFrame=e,this.output.write(Vt.cursor.move(0,i.length-n-1));return}if(r&&r?.length>1){let n=r[0];this.output.write(Vt.cursor.move(0,n)),this.output.write(Vt.erase.down());let i=e.split(`
253
253
  `).slice(n);this.output.write(i.join(`
254
- `)),this._prevFrame=e;return}this.output.write(Vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Pl=class extends mu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Vt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Vq;Vq=new WeakMap;var zq=Object.defineProperty,Kq=(t,e,r)=>e in t?zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s_=(t,e,r)=>(Kq(t,typeof e!="symbol"?e+"":e,r),r),Fl=class extends mu{constructor(e){super(e,!1),s_(this,"options"),s_(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 Rl=class extends mu{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}${a_.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Mr=Ee(require("node:process"),1),J=Ee(Tm(),1),Nl=Ee(Ze(),1);function Gq(){return Mr.default.platform!=="win32"?Mr.default.env.TERM!=="linux":!!Mr.default.env.CI||!!Mr.default.env.WT_SESSION||!!Mr.default.env.TERMINUS_SUBLIME||Mr.default.env.ConEmuTask==="{cmd::Cmder}"||Mr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Mr.default.env.TERM_PROGRAM==="vscode"||Mr.default.env.TERM==="xterm-256color"||Mr.default.env.TERM==="alacritty"||Mr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Lm=Gq(),_t=(t,e)=>Lm?t:e,Wq=_t("\u25C6","*"),p_=_t("\u25A0","x"),m_=_t("\u25B2","x"),Mm=_t("\u25C7","o"),Xq=_t("\u250C","T"),ct=_t("\u2502","|"),gu=_t("\u2514","\u2014"),Bm=_t("\u25CF",">"),jm=_t("\u25CB"," "),tpe=_t("\u25FB","[\u2022]"),rpe=_t("\u25FC","[+]"),npe=_t("\u25FB","[ ]"),ipe=_t("\u25AA","\u2022"),spe=_t("\u2500","-"),ope=_t("\u256E","+"),ape=_t("\u251C","+"),upe=_t("\u256F","+"),Yq=_t("\u25CF","\u2022"),Jq=_t("\u25C6","*"),Zq=_t("\u25B2","!"),Qq=_t("\u25A0","x"),Um=t=>{switch(t){case"initial":case"active":return J.default.cyan(Wq);case"cancel":return J.default.red(p_);case"error":return J.default.yellow(m_);case"submit":return J.default.green(Mm)}},e4=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?J.default.dim("..."):n(l,h+a===e)})},Ti=t=>new Rl({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${J.default.gray(ct)}
254
+ `)),this._prevFrame=e;return}this.output.write(Vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Pl=class extends mu{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",r=>{this.output.write(Vt.cursor.move(0,-1)),this.value=r,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};var Vq;Vq=new WeakMap;var zq=Object.defineProperty,Kq=(t,e,r)=>e in t?zq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s_=(t,e,r)=>(Kq(t,typeof e!="symbol"?e+"":e,r),r),Fl=class extends mu{constructor(e){super(e,!1),s_(this,"options"),s_(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 Rl=class extends mu{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}${a_.default.inverse(r)}${n.join("")}`}get cursor(){return this._cursor}constructor(e){super(e),this.on("finalize",()=>{this.value||(this.value=e.defaultValue)})}};var Mr=Ee(require("node:process"),1),J=Ee(Tm(),1),Nl=Ee(Ze(),1);function Gq(){return Mr.default.platform!=="win32"?Mr.default.env.TERM!=="linux":!!Mr.default.env.CI||!!Mr.default.env.WT_SESSION||!!Mr.default.env.TERMINUS_SUBLIME||Mr.default.env.ConEmuTask==="{cmd::Cmder}"||Mr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Mr.default.env.TERM_PROGRAM==="vscode"||Mr.default.env.TERM==="xterm-256color"||Mr.default.env.TERM==="alacritty"||Mr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Lm=Gq(),_t=(t,e)=>Lm?t:e,Wq=_t("\u25C6","*"),p_=_t("\u25A0","x"),m_=_t("\u25B2","x"),Mm=_t("\u25C7","o"),Xq=_t("\u250C","T"),ct=_t("\u2502","|"),gu=_t("\u2514","\u2014"),Bm=_t("\u25CF",">"),jm=_t("\u25CB"," "),tpe=_t("\u25FB","[\u2022]"),rpe=_t("\u25FC","[+]"),npe=_t("\u25FB","[ ]"),ipe=_t("\u25AA","\u2022"),spe=_t("\u2500","-"),ope=_t("\u256E","+"),ape=_t("\u251C","+"),upe=_t("\u256F","+"),Yq=_t("\u25CF","\u2022"),Jq=_t("\u25C6","*"),Zq=_t("\u25B2","!"),Qq=_t("\u25A0","x"),Um=t=>{switch(t){case"initial":case"active":return J.default.cyan(Wq);case"cancel":return J.default.red(p_);case"error":return J.default.yellow(m_);case"submit":return J.default.green(Mm)}},e4=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,p=h===d.length-1&&c;return f||p?J.default.dim("..."):n(l,h+a===e)})},Ti=t=>new Rl({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${J.default.gray(ct)}
255
255
  ${Um(this.state)} ${t.message}
256
256
  `,r=t.placeholder?J.default.inverse(t.placeholder[0])+J.default.dim(t.placeholder.slice(1)):J.default.inverse(J.default.hidden("_")),n=this.value?this.valueWithCursor:r;switch(this.state){case"error":return`${e.trim()}
257
257
  ${J.default.yellow(ct)} ${n}
@@ -277,13 +277,13 @@ ${J.default.gray(gu)} ${t}
277
277
  `)},g={message:(t="",{symbol:e=J.default.gray(ct)}={})=>{let r=[`${J.default.gray(ct)}`];if(t){let[n,...i]=t.split(`
278
278
  `);r.push(`${e} ${n}`,...i.map(s=>`${J.default.gray(ct)} ${s}`))}process.stdout.write(`${r.join(`
279
279
  `)}
280
- `)},info:t=>{g.message(t,{symbol:J.default.blue(Yq)})},success:t=>{g.message(t,{symbol:J.default.green(Jq)})},step:t=>{g.message(t,{symbol:J.default.green(Mm)})},warn:t=>{g.message(t,{symbol:J.default.yellow(Zq)})},warning:t=>{g.warn(t)},error:t=>{g.message(t,{symbol:J.default.red(Qq)})}},cpe=`${J.default.gray(ct)} `;var Ct=({indicator:t="dots"}={})=>{let e=Lm?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Lm?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(`
280
+ `)},info:t=>{g.message(t,{symbol:J.default.blue(Yq)})},success:t=>{g.message(t,{symbol:J.default.green(Jq)})},step:t=>{g.message(t,{symbol:J.default.green(Mm)})},warn:t=>{g.message(t,{symbol:J.default.yellow(Zq)})},warning:t=>{g.warn(t)},error:t=>{g.message(t,{symbol:J.default.red(Qq)})}},cpe=`${J.default.gray(ct)} `;var Ct=({indicator:t="dots"}={})=>{let e=Lm?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],r=Lm?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&&m(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)},p=()=>{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(`
281
281
  `);let D=u.split(`
282
282
  `);process.stdout.write(Nl.cursor.move(-999,D.length-1)),process.stdout.write(Nl.erase.down(D.length))},v=D=>D.replace(/\.+$/,""),E=D=>{let w=(performance.now()-D)/1e3,C=Math.floor(w/60),F=Math.floor(w%60);return C>0?`[${C}m ${F}s]`:`[${F}s]`},A=(D="")=>{o=!0,i=d_(),a=v(D),c=performance.now(),process.stdout.write(`${J.default.gray(ct)}
283
- `);let w=0,C=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let F=J.default.magenta(e[w]);if(n)process.stdout.write(`${F} ${a}...`);else if(t==="timer")process.stdout.write(`${F} ${a} ${E(c)}`);else{let b=".".repeat(Math.floor(C)).slice(0,3);process.stdout.write(`${F} ${a}${b}`)}w=w+1<e.length?w+1:0,C=C<e.length?C+.125:0},r)},p=(D="",w=0)=>{o=!1,clearInterval(s),y();let C=w===0?J.default.green(Mm):w===1?J.default.red(p_):J.default.red(m_);a=v(D??a),t==="timer"?process.stdout.write(`${C} ${a} ${E(c)}
283
+ `);let w=0,C=0;f(),s=setInterval(()=>{if(n&&a===u)return;y(),u=a;let F=J.default.magenta(e[w]);if(n)process.stdout.write(`${F} ${a}...`);else if(t==="timer")process.stdout.write(`${F} ${a} ${E(c)}`);else{let b=".".repeat(Math.floor(C)).slice(0,3);process.stdout.write(`${F} ${a}${b}`)}w=w+1<e.length?w+1:0,C=C<e.length?C+.125:0},r)},m=(D="",w=0)=>{o=!1,clearInterval(s),y();let C=w===0?J.default.green(Mm):w===1?J.default.red(p_):J.default.red(m_);a=v(D??a),t==="timer"?process.stdout.write(`${C} ${a} ${E(c)}
284
284
  `):process.stdout.write(`${C} ${a}
285
- `),m(),i()};return{start:A,stop:p,message:(D="")=>{a=v(D??a)}}};function g_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var zt=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?g_("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))+g_("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(`
286
- `)}};var d8=require("node:child_process"),Te=require("node:fs"),Kp=require("node:os"),xe=Ee(require("node:path")),Un=require("node:process"),as=Ee(Ll());var Zt=require("fs"),Du=(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},Bl=(t=Du(),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"}},y_=(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 jl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function v_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function zm(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 So="0|[1-9]\\d*",i4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",s4=`(?<major>${So})\\.(?<minor>${So})\\.(?<patch>${So})`,D_=`(?:${So}|${i4})`,E_=`(?:-(?<prerelease>${D_}(?:\\.${D_})*))`,w_="[0-9A-Za-z-]+",b_=`(?:\\+(?<buildmetadata>${w_}(?:\\.${w_})*))`,__=`v?${s4}${E_}?${b_}?`,C_=new RegExp(`^${__}$`),S_="(?:<|>)?=?",o4="x|X|\\*",Vm=`${So}|${o4}`,Ml=`[v=\\s]*(?<major>${Vm})(?:\\.(?<minor>${Vm})(?:\\.(?<patch>${Vm})${E_}?${b_}?)?)?`,A_=new RegExp(`^(?<operator>~>?|\\^|${S_})\\s*${Ml}$`),O_=new RegExp(`^(?<operator>${S_})\\s*(${__})$|^$`);function Km(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Gm=256;var a4=new RegExp(`^${So}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(a4.test(e)){let r=Number(e);if(Km(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Pi(t,e){let r=Number(t);if(!Km(r))throw new TypeError(e);return r}function Xn(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:jl(t.major,e.major)||jl(t.minor,e.minor)||jl(t.patch,e.patch)||v_(t.prerelease,e.prerelease)||zm(t.prerelease,e.prerelease)}function Wm(t){return t.toFixed(0)}function sn(t){let e=Wm(t.major),r=Wm(t.minor),n=Wm(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 u4(t,e){if(Xn(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 Ul(t,e){for(let r of e)if(!u4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Xn(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 wu(t,e){return e.some(r=>Ul(t,r))}function c4(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 vu(t=[],e){let r=c4(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 Eu(t,e,r={}){let n=r.build!==void 0?nn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(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:vu(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:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var ql={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ao={operator:void 0,...ql};function Xm(t,e){return er(t,e)>0}function ps(t,e){return er(t,e)<0}function l4(t){let r=t.match(O_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Pi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Pi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Pi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:ql;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function f4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(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 h4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(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 d4(t){let e=t.match(new RegExp(`^${Ml}`)),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(`^${Ml}\\s*$`))?.groups;if(!a)return null;let u=f4(r),c=h4(a);return[u,c].filter(Boolean)}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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 m4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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 g4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=nn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function y4(t){let e=ze(t.minor),r=ze(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=nn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function D4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=nn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function w4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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=nn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function v4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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=nn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function E4(t){let e=t.match(A_)?.groups;if(!e)return l4(t);switch(e.operator){case"^":return p4(e);case"~":case"~>":return m4(e);case"<":return g4(e);case"<=":return y4(e);case">":return D4(e);case">=":return w4(e);case"=":case"":return v4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function b4(t){return t.split(/\s+/).flatMap(E4)}function Hl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>d4(r)||b4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Gm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Gm}`);t=t.trim();let e=t.match(C_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Pi(e.major,`Cannot parse version ${t}: invalid major version`),n=Pi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Pi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?nn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function x_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Xn(t)?!0:wu(t,[[e]]);if(n===void 0)return Xn(e)?!0:wu(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 _4(t){return t.every(e=>e.some(r=>C4(r)))}function C4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!x_(r,n))return!1}return!0}function T_(t,e){return _4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>x_(i,s)))))}function I_(t){try{return lt(t),!0}catch{return!1}}function P_(t,e){return er(t,e)>=0}var Qa=Ee(xS()),pb=Ee(lD()),p8=Ee(LA()),Gp=Ee(Kh());var Ui={name:"@capgo/cli",version:"7.56.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Gh(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 Xe(){let t=await Gh("@capgo/cli")??"",e=t?.split(".")[0];t!==Ui.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Ui.version} it's not the latest version.
285
+ `),p(),i()};return{start:A,stop:m,message:(D="")=>{a=v(D??a)}}};function g_(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var zt=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?g_("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))+g_("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(`
286
+ `)}};var d8=require("node:child_process"),Te=require("node:fs"),Kp=require("node:os"),xe=Ee(require("node:path")),Un=require("node:process"),as=Ee(Ll());var Zt=require("fs"),Du=(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},Bl=(t=Du(),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"}},y_=(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 jl(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function v_(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function zm(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 So="0|[1-9]\\d*",i4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",s4=`(?<major>${So})\\.(?<minor>${So})\\.(?<patch>${So})`,D_=`(?:${So}|${i4})`,E_=`(?:-(?<prerelease>${D_}(?:\\.${D_})*))`,w_="[0-9A-Za-z-]+",b_=`(?:\\+(?<buildmetadata>${w_}(?:\\.${w_})*))`,__=`v?${s4}${E_}?${b_}?`,C_=new RegExp(`^${__}$`),S_="(?:<|>)?=?",o4="x|X|\\*",Vm=`${So}|${o4}`,Ml=`[v=\\s]*(?<major>${Vm})(?:\\.(?<minor>${Vm})(?:\\.(?<patch>${Vm})${E_}?${b_}?)?)?`,A_=new RegExp(`^(?<operator>~>?|\\^|${S_})\\s*${Ml}$`),O_=new RegExp(`^(?<operator>${S_})\\s*(${__})$|^$`);function Km(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Gm=256;var a4=new RegExp(`^${So}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(a4.test(e)){let r=Number(e);if(Km(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Pi(t,e){let r=Number(t);if(!Km(r))throw new TypeError(e);return r}function Xn(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:jl(t.major,e.major)||jl(t.minor,e.minor)||jl(t.patch,e.patch)||v_(t.prerelease,e.prerelease)||zm(t.prerelease,e.prerelease)}function Wm(t){return t.toFixed(0)}function sn(t){let e=Wm(t.major),r=Wm(t.minor),n=Wm(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 u4(t,e){if(Xn(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 Ul(t,e){for(let r of e)if(!u4(t,r))return!1;if(t.prerelease&&t.prerelease.length>0){for(let r of e){if(Xn(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 wu(t,e){return e.some(r=>Ul(t,r))}function c4(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 vu(t=[],e){let r=c4(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 Eu(t,e,r={}){let n=r.build!==void 0?nn(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:vu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:vu(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:vu(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:vu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var ql={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},Ao={operator:void 0,...ql};function Xm(t,e){return er(t,e)>0}function ps(t,e){return er(t,e)<0}function l4(t){let r=t.match(O_)?.groups;if(!r)return null;let{operator:n,prerelease:i,buildmetadata:s}=r,o=r.major?{major:Pi(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Pi(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Pi(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:ql;return{operator:n||void 0,...o}}function ze(t){return!t||t.toLowerCase()==="x"||t==="*"}function f4(t){if(!ze(t.major))return ze(t.minor)?{operator:">=",major:+t.major,minor:0,patch:0,prerelease:[],build:[]}:ze(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 h4(t){if(!ze(t.major))return ze(t.minor)?{operator:"<",major:+t.major+1,minor:0,patch:0,prerelease:[],build:[]}:ze(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 d4(t){let e=t.match(new RegExp(`^${Ml}`)),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(`^${Ml}\\s*$`))?.groups;if(!a)return null;let u=f4(r),c=h4(a);return[u,c].filter(Boolean)}function p4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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 m4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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 g4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=nn(t.build??"");return[{operator:"<",major:i,minor:s,patch:o,prerelease:a,build:u}]}function y4(t){let e=ze(t.minor),r=ze(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=nn(t.build??"");return[{operator:"<=",major:n,minor:i,patch:s,prerelease:o,build:a}]}function D4(t){let e=ze(t.major),r=ze(t.minor),n=ze(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=nn(t.build??"");return[{operator:">",major:i,minor:s,patch:o,prerelease:a,build:u}]}function w4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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=nn(t.build??"");return[{operator:">=",major:i,minor:s,patch:o,prerelease:a,build:u}]}function v4(t){let e=ze(t.major),r=ze(t.minor),n=ze(t.patch),i=+t.major,s=+t.minor,o=+t.patch;if(e)return[Ao];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=nn(t.build??"");return[{operator:void 0,major:i,minor:s,patch:o,prerelease:a,build:u}]}function E4(t){let e=t.match(A_)?.groups;if(!e)return l4(t);switch(e.operator){case"^":return p4(e);case"~":case"~>":return m4(e);case"<":return g4(e);case"<=":return y4(e);case">":return D4(e);case">=":return w4(e);case"=":case"":return v4(e);default:throw new Error(`Cannot parse version range: '${e.operator}' is not a valid operator`)}}function b4(t){return t.split(/\s+/).flatMap(E4)}function Hl(t){let e=t.replaceAll(/(?<=<|>|=|~|\^)(\s+)/g,"").split(/\s*\|\|\s*/).map(r=>d4(r)||b4(r));if(e.some(r=>r.includes(null)))throw new TypeError(`Cannot parse version range: range "${t}" is invalid`);return e}function lt(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Gm)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Gm}`);t=t.trim();let e=t.match(C_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Pi(e.major,`Cannot parse version ${t}: invalid major version`),n=Pi(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Pi(e.patch,`Cannot parse version ${t}: invalid patch version`),s=e.prerelease?Qt(e.prerelease):[],o=e.buildmetadata?nn(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:s,build:o}}function x_(t,e){let r=t.operator,n=e.operator;if(r===void 0)return Xn(t)?!0:wu(t,[[e]]);if(n===void 0)return Xn(e)?!0:wu(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 _4(t){return t.every(e=>e.some(r=>C4(r)))}function C4(t){for(let e=0;e<t.length-1;e++){let r=t[e];for(let n of t.slice(e+1))if(!x_(r,n))return!1}return!0}function T_(t,e){return _4([t,e])&&t.some(r=>e.some(n=>r.every(i=>n.every(s=>x_(i,s)))))}function I_(t){try{return lt(t),!0}catch{return!1}}function P_(t,e){return er(t,e)>=0}var Qa=Ee(xS()),pb=Ee(lD()),p8=Ee(LA()),Gp=Ee(Kh());var Ui={name:"@capgo/cli",version:"7.56.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:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};async function Gh(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 Xe(){let t=await Gh("@capgo/cli")??"",e=t?.split(".")[0];t!==Ui.version&&g.warning(`\u{1F6A8} You are using @capgo/cli@${Ui.version} it's not the latest version.
287
287
  Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function XT(t,e,r,n,i,s="\u2705"){await _e(r,{channel:t,event:n,icon:s,user_id:e,...i?{tags:{"app-id":i}}:{},notify:!1})}var _0=require("node:buffer"),YT=require("node:crypto"),RY=(()=>{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 kY(t){let e=4294967295;for(let r=0;r<t.length;r++){let n=t[r];e=RY[(e^n)&255]^e>>>8}return e=e^4294967295,(e>>>0).toString(16).padStart(8,"0")}async function ii(t,e="sha256"){let r=_0.Buffer.isBuffer(t)?t:_0.Buffer.from(t);if(e==="crc32")return kY(r);let n=(0,YT.createHash)(e);return n.update(r),n.digest("hex")}var al=Ee(wM());async function vM(){let t=await(0,al.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function VE(t,e,r=!1){let n=await(0,al.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,al.writeConfig)(i,n.app.extConfigFilePath))}async function Xa(t,e=!1){await VE("CapacitorUpdater",t,e)}var tu=".capgo_key",$r=".capgo_key_v2",Wp=`${tu}.pub`,Ei=`${$r}.pub`,a8="https://capgo.app",u8="https://files.capgo.app",c8="https://api.capgo.app",l8="https://console.capgo.app",mb=12e4,Jle=1024*1024*20,Zle=1024*1024*1024,Qle=1024*1024*99,eu="package.json",ru=/^(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?`
288
288
  ${p8.default.render(t)}`:"";function zp(t){return new Promise(e=>{setTimeout(e,t)})}function Lr(t){return(0,as.isMonorepo)(t)?(0,as.findMonorepoRoot)(t):(0,as.isNXMonorepo)(t)?(0,as.findNXMonorepoRoot)(t):t}function efe(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",")[0];if(r&&!(0,Te.existsSync)(r)){let i=`Package.json at ${r} does not exist`;throw g.error(i),new Error(i)}let n=(0,Te.readFileSync)(r??(0,xe.join)(t,eu));return JSON.parse(n)}function us(t=Lr((0,Un.cwd)()),e=void 0){return efe(t,e).version??""}function f8(t){let e=t.replace("^","").replace("~","");if(I_(e))try{let r=lt(e);return sn(r)}catch{return e}return e}async function cs(t,e=(0,Un.cwd)(),r){if(t!=="@capgo/capacitor-updater")return null;let n=r?(0,xe.dirname)(r):e;try{let u=`${t}/package.json`,{createRequire:c}=await import("node:module"),h=c((0,xe.join)(n,"package.json")).resolve(u),d=JSON.parse((0,Te.readFileSync)(h,"utf-8"));if(d.version)return d.version}catch{}let i=n,s=xe.default.parse(i).root;for(;i!==s;){let u=(0,xe.join)(i,"node_modules",t,eu);if((0,Te.existsSync)(u))try{let l=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(l.version)return l.version}catch{}let c=(0,xe.dirname)(i);if(c===i)break;i=c}let o=null,a=(0,xe.join)(e,"ios","App","Podfile");if((0,Te.existsSync)(a))try{let c=(0,Te.readFileSync)(a,"utf-8").match(/pod\s+['"]CapgoCapacitorUpdater['"],\s*:path\s*=>\s*['"]([^'"]+)['"]/);c?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"ios","App",c[1])))}catch{}if(!o){let u=(0,xe.join)(e,"android","capacitor.settings.gradle");if((0,Te.existsSync)(u))try{let l=(0,Te.readFileSync)(u,"utf-8").match(/project\(':capgo-capacitor-updater'\)\.projectDir\s*=\s*new\s+File\(['"]([^'"]+)['"]/);l?.[1]&&(o=(0,xe.resolve)((0,xe.join)(e,"android",l[1])).replace(/\/android$/,""))}catch{}}if(o){let u=(0,xe.join)(o,eu);if((0,Te.existsSync)(u))try{let c=JSON.parse((0,Te.readFileSync)(u,"utf-8"));if(c.version)return c.version}catch{}}try{let c=(await Xp(e)).get(t);if(c)return c}catch{}return null}async function Xp(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,xe.join)(t,eu)],r){for(let i of r)if(!(0,Te.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,Te.readFileSync)(i),o=JSON.parse(s);for(let a in o.dependencies)n.set(a,f8(o.dependencies[a]));for(let a in o.devDependencies)n.set(a,f8(o.devDependencies[a]))}return n}async function de(){try{let t=await vM();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 tfe(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 VE(t,r)),r}async function m8(t){return tfe("CapacitorUpdater",t)}async function Sn(){try{let t=await de(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||a8,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||l8,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||u8,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||c8};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:a8,hostWeb:l8,hostFilesApi:u8,hostApi:c8}}}var rfe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Yp(){let t=await Sn();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 g8(){let t=await Sn();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:Zle,maxChunkSize:Qle,alertUploadSize:Jle}}}async function pe(t,e,r){let n=await Yp();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,Qa.createClient)(n.supaHost,n.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function nfe(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 y8(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function D8(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function ife(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function sfe(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||{}),nu=(t,e)=>t>=e;async function w8(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 v8(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",`
289
289
  `)}`),s=new Error(a.message)):g.warn(`${a.message.replaceAll("\\n",`
@@ -295,7 +295,7 @@ Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/pla
295
295
  Upgrade here: ${s.hostWeb}/settings/organization/plans
296
296
  `),zp(100),Promise.resolve().then(()=>(hb(),fb)).then(c=>{c.default(`${s.hostWeb}/settings/organization/plans`)}),zp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([D8(t,e),y8(t,e)]);a>0&&i&&!u&&g.warn(`WARNING !!
297
297
  Trial expires in ${a} days, upgrade here: ${s.hostWeb}/settings/organization/plans
298
- `)}function re(t=!1){let e=Un.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,Te.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${qn().runner} @capgo/cli login`;throw g.error(s),new Error(s)}return n}function iu(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 gb(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 _8(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 Qa.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*C8(t){let e=(0,Te.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,xe.join)(t,r.name);r.isDirectory()?yield*C8(n):yield n}}var S8="5.10.0",A8="6.25.0",fl="7.0.30";function ls(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ps(t,lt(e))||t.major===6&&ps(t,lt(r))||t.major===7&&ps(t,lt(n)))}async function O8(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 C8(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,Te.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 ii(i,"sha256"),o=(0,xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Jp(t){return(0,Kp.platform)()==="win32"?afe(t):ofe(t)}function ofe(t){let e=new pb.default;return e.addLocalFolder(t),e.toBuffer()}async function afe(t){g.info("Zipping file windows mode");let e=new pb.default,r=(n,i)=>{let s=(0,Te.readdirSync)(n);for(let o of s){let a=(0,xe.join)(n,o),u=(0,Te.statSync)(a);if(u.isFile()){let c=(0,Te.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 x8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{_e(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Gp.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 Gp.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 _e(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 Qa.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 Qa.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 Zp(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 _e(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await Yp();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 gn({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(st(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 nfe(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 Rr(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 su(t){return new Date(t||"").toLocaleString()}var h8=!1,Za="npm",ll="install",db="npx";function qn(){if(h8)return{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:db};let t=Lr((0,Un.cwd)());return Za=Du(t,"npm"),ll=Bl(Za),h8=!0,db=y_(t),{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:db}}function I8(t){return(0,Te.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,xe.join)(t,n.name);return n.isDirectory()?I8(i):i.split(`node_modules${xe.sep}`)[1]||i})}async function yb(t,e){let r=e?e.split(","):[],n;try{n=await Xp("",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(eu,""):Lr((0,Un.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,Un.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Te.existsSync)(l))){let l=Du(s,"npm"),h=Bl(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,m=h;for(let y of o){let v=(0,xe.join)(y,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,eu);if((0,Te.existsSync)(E)){let A=JSON.parse((0,Te.readFileSync)(E,"utf-8"));A.version&&(m=A.version)}}catch{}try{if(I8(v).some(A=>rfe.test(A))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${y}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let y=Du(s,"npm"),v=Bl(y);return g.error(`Missing dependency ${l}, please run ${y} ${v}`),{name:l,version:h}}return{name:l,version:m,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 ufe(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 cfe(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 P8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
298
+ `)}function re(t=!1){let e=Un.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,Te.existsSync)(i)&&(t||g.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||g.info(`Use local API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),!n){let s=`Cannot find API key in local folder or global, please login first with ${qn().runner} @capgo/cli login`;throw g.error(s),new Error(s)}return n}function iu(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 gb(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 _8(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 Qa.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*C8(t){let e=(0,Te.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,xe.join)(t,r.name);r.isDirectory()?yield*C8(n):yield n}}var S8="5.10.0",A8="6.25.0",fl="7.0.30";function ls(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ps(t,lt(e))||t.major===6&&ps(t,lt(r))||t.major===7&&ps(t,lt(n)))}async function O8(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 C8(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,Te.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 ii(i,"sha256"),o=(0,xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Jp(t){return(0,Kp.platform)()==="win32"?afe(t):ofe(t)}function ofe(t){let e=new pb.default;return e.addLocalFolder(t),e.toBuffer()}async function afe(t){g.info("Zipping file windows mode");let e=new pb.default,r=(n,i)=>{let s=(0,Te.readdirSync)(n);for(let o of s){let a=(0,xe.join)(n,o),u=(0,Te.statSync)(a);if(u.isFile()){let c=(0,Te.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 x8(t,e,r,n,i,s,o,a){return new Promise((u,c)=>{_e(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Gp.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 Gp.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 _e(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 Qa.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 Qa.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 Zp(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 _e(t,e,r){try{r&&g.info(`Get remove config: for ${e.event}`);let n=await Yp();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 gn({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(st(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 nfe(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 Rr(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 su(t){return new Date(t||"").toLocaleString()}var h8=!1,Za="npm",ll="install",db="npx";function qn(){if(h8)return{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:db};let t=Lr((0,Un.cwd)());return Za=Du(t,"npm"),ll=Bl(Za),h8=!0,db=y_(t),{pm:Za,command:ll,installCommand:`${Za} ${ll}`,runner:db}}function I8(t){return(0,Te.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,xe.join)(t,n.name);return n.isDirectory()?I8(i):i.split(`node_modules${xe.sep}`)[1]||i})}async function yb(t,e){let r=e?e.split(","):[],n;try{n=await Xp("",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(eu,""):Lr((0,Un.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,Un.cwd)(),"node_modules")]:r;if(!o.some(l=>(0,Te.existsSync)(l))){let l=Du(s,"npm"),h=Bl(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,p=h;for(let y of o){let v=(0,xe.join)(y,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,eu);if((0,Te.existsSync)(E)){let A=JSON.parse((0,Te.readFileSync)(E,"utf-8"));A.version&&(p=A.version)}}catch{}try{if(I8(v).some(A=>rfe.test(A))){f=!0;break}}catch(E){throw g.error(`Error reading node_modules files for ${l} package in ${y}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let y=Du(s,"npm"),v=Bl(y);return g.error(`Missing dependency ${l}, please run ${y} ${v}`),{name:l,version:h}}return{name:l,version:p,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 ufe(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 cfe(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 P8(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
299
299
  native_packages
300
300
  )`).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 cfe(n.version.native_packages??[])}async function F8(t,e,r,n){let i=Ct();i.start(`Checking bundle checksum compatibility with channel ${r}`);let s=await ufe(t,e,r);if(!s){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(s&&s===n)throw i.stop("Checksum check failed"),g.error(`Cannot upload the same bundle content.
301
301
  Current bundle checksum matches remote bundle for channel ${r}
@@ -319,34 +319,34 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
319
319
  created_by,
320
320
  app_id,
321
321
  version (id, name)
322
- `).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 vb(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 tm(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await lfe(t,e,r,{silent:i});await k8(t,e,o,{silent:i,autoUnlink:s}),await vb(t,e,r,{silent:i})}function q8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new zt;r.theme=zt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,su(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function rm(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 H8(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 lfe(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 ou=require("node:fs");async function V8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Et(t,e,r,n,i=!1){let s=qn(),o=await w8(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 Qr="assets/icon.png";var ffe=/^[a-z0-9]+(\.[\w-]+)+$/i;function hfe(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(!ffe.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 dfe(t,e,r){if(await V8(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 z8(t,e,r,n=!1){n||ae("Adding"),await Xe(),e.apikey=e.apikey||re();let i=await de(),s=Le(t,i?.config);hfe(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await dfe(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,ou.existsSync)(l)?(h=(0,ou.readFileSync)(l),d=iu(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,ou.existsSync)(Qr)?(h=(0,ou.readFileSync)(Qr),d=iu(Qr)||"image/png",n||g.warn(`Found app icon ${Qr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Qr}`);let f="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||g.error(`Could not add app ${W(v)}`),new Error(`Could not add app ${W(v)}`);let{data:E}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);m=E?.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`),le("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:m}}async function K8(t,e,r=!1,n=!1){r||ae("Deleting"),e.apikey=e.apikey||re();let i=await de(),s=Le(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 Et(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 gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(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 Rr(o,s);return await _e(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"),le("Done \u2705")),!0}var nm=require("node:os"),W8=require("node:process");async function G8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Gh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function pfe(){let t=await Xp(),e={"@capgo/cli":Ui.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function X8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=us("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Le("",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,nm.platform)()} ${(0,nm.version)()}`),g.info(` Node: ${W8.version}`),g.info(" Installed Dependencies:"));let u=await pfe();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 G8(u);else{let l=Ct();l.start("Running: Loading latest dependencies"),c=await G8(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 mfe(t){let e=new zt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,su(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function gfe(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 Y8(t,e=!1){e||ae("List apps in Capgo"),await Xe(),t.apikey=t.apikey||re();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 gfe(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}`),mfe(n),le("Done \u2705")),n}var J8=require("node:crypto"),au=require("node:fs");async function Z8(t,e,r=!1){r||ae("Set app"),e.apikey=e.apikey||re();let n=await de();if(t=Le(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 Et(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l,exposeMetadata:h}=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 d,f,m=`icon_${(0,J8.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,au.existsSync)(c)?(d=(0,au.readFileSync)(c),f=iu(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,au.existsSync)(Qr)?(d=(0,au.readFileSync)(Qr),f=iu(Qr)||"image/png",r||g.warn(`Found app icon ${Qr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Qr}`),d&&f){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(m,d,{contentType:f});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:A}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(m);y=A?.publicUrl||y}let{error:v}=await i.from("apps").update({icon_url:y,name:u,retention:l?l*24*60*60:void 0,expose_metadata:h}).eq("app_id",t).eq("user_id",a);if(v)throw r||g.error(`Could not set app ${W(v)}`),new Error(`Could not set app: ${W(v)}`);return r||le("Done \u2705"),!0}async function Q8(t,e,r=!1){if(r||ae("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 Xa(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||le("Done \u2705")}var Hn=require("node:fs"),en=require("node:fs/promises"),n6=require("node:os"),tn=require("node:path"),Vn=require("node:process");var i6=Ee(lD()),om=Ee(Kh());var im=require("node:fs/promises"),e6=require("node:os"),sm=require("node:path"),Ie=require("node:process"),yfe=(0,sm.join)((0,e6.homedir)(),".capgo-credentials"),Dfe=(0,sm.join)(yfe,"credentials.json"),wfe=".capgo-credentials.json";function vfe(t){return t?(0,sm.join)((0,Ie.cwd)(),wfe):Dfe}async function Eb(t){try{let e=vfe(t),r=await(0,im.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Efe(t,e){if(e!==void 0){let i=await Eb(e);if(!t){let s=Object.keys(i);return s.length===0?null:i[s[0]]||null}return i[t]||null}let r=await Eb(!0),n=await Eb(!1);if(!t){let i=Object.keys(r);if(i.length>0)return r[i[0]]||null;let s=Object.keys(n);return s.length===0?null:n[s[0]]||null}return r[t]||n[t]||null}function bfe(){let t={};return Ie.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Ie.env.BUILD_CERTIFICATE_BASE64),Ie.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Ie.env.BUILD_PROVISION_PROFILE_BASE64),Ie.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Ie.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Ie.env.P12_PASSWORD&&(t.P12_PASSWORD=Ie.env.P12_PASSWORD),Ie.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Ie.env.APPLE_KEY_ID),Ie.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Ie.env.APPLE_ISSUER_ID),Ie.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Ie.env.APPLE_KEY_CONTENT),Ie.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Ie.env.APPLE_PROFILE_NAME),Ie.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Ie.env.APP_STORE_CONNECT_TEAM_ID),Ie.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Ie.env.ANDROID_KEYSTORE_FILE),Ie.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Ie.env.KEYSTORE_KEY_ALIAS),Ie.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Ie.env.KEYSTORE_KEY_PASSWORD),Ie.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Ie.env.KEYSTORE_STORE_PASSWORD),Ie.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Ie.env.PLAY_CONFIG_JSON),t}async function t6(t,e,r){let n=await Efe(t),i=bfe(),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 _fe(t,e,r,n,i){try{i||g.warn(`
323
- \u26A0\uFE0F Cancelling build...`);let s=await fetch(`${t}/build/cancel/${e}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:n},body:JSON.stringify({app_id:r})});if(!s.ok){let a=await s.text();i||g.warn(`Could not cancel build: ${a}`);return}let o=await s.json();i||g.info(`Build cancelled (status: ${o.status})`)}catch(s){i||g.warn(`Failed to cancel build: ${s instanceof Error?s.message:String(s)}`)}}async function Cfe(t,e,r,n,i){if(i)return null;let s=Ct(),o=null;try{let a=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!a.ok)return g.warn("Could not stream logs, continuing..."),null;let u=a.body?.getReader();if(!u)return null;s.start("Waiting for build logs...");let c=new TextDecoder,l="",h=d=>{if(!d.trim())return;let f=d.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(f){o=f[1].toLowerCase();return}o||(s.stop(d,0),s.start("Building..."))};for(;;){let{done:d,value:f}=await u.read();if(d)break;l+=c.decode(f,{stream:!0});let m=l.split(`
324
- `);l=m.pop()||"";for(let y of m)if(y.startsWith("data: ")){let v=y.slice(6);h(v)}}if(l.startsWith("data: ")){let d=l.slice(6);h(d)}return s.stop(),o}catch(a){return s.stop("Log streaming ended"),i||g.warn(`Log streaming interrupted${a instanceof Error?`: ${a.message}`:""}`),null}}async function Sfe(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 Afe(t,e){let r=new Set,n=!1;if(e==="ios"){let i=(0,tn.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Hn.existsSync)(i)){n=!0;let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let a of o)r.add(a[1])}else{let s=(0,tn.join)(t,"ios/App/Podfile");if((0,Hn.existsSync)(s)){let a=(await(0,en.readFile)(s,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of a)r.add(u[1])}}}else if(e==="android"){let i=(0,tn.join)(t,"android/capacitor.settings.gradle");if((0,Hn.existsSync)(i)){let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of o){let c=a[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function r6(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let i of r.packages){let s=`node_modules/${i}/`;if(e==="android"){if(n.startsWith(`${s}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${s}ios/`))return!0;if(r.usesSPM){if(n===`${s}Package.swift`)return!0}else if(n.startsWith(s)&&n.endsWith(".podspec"))return!0}}return!1}function hl(t,e,r,n,i){let s=(0,Hn.readdirSync)(e);for(let o of s){let a=(0,tn.join)(e,o),u=r?`${r}/${o}`:o,c=(0,Hn.statSync)(a);if(c.isDirectory()){if(o===".git"||o==="dist"||o==="build"||o===".angular"||o===".vite")continue;if(o===n){hl(t,a,u,n,i);continue}if(o==="node_modules"){hl(t,a,u,n,i);continue}if(o==="resources"){hl(t,a,u,n,i);continue}let l=u.replace(/\\/g,"/");(r6(u,n,i)||Array.from(i.packages).some(d=>`node_modules/${d}/`.startsWith(`${l}/`)||l.startsWith(`node_modules/${d}`)))&&hl(t,a,u,n,i)}else if(c.isFile()){if(o===".DS_Store"||o.endsWith(".log"))continue;r6(u,n,i)&&t.addLocalFile(a,r||void 0)}}}async function Ofe(t,e,r){let n=await Afe(t,r),i=new i6.default;hl(i,t,"",r,n),await(0,en.writeFile)(e,i.toBuffer())}async function s6(t,e,r=!1){let n=Date.now(),i=e.verbose??!1;try{e.apikey=e.apikey||re(r);let s=await de();if(t=t||s?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let o=(0,tn.resolve)(e.path||(0,Vn.cwd)()),a=e.supaHost||"https://api.capgo.app",u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]);let c=await Rr(u,t);r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${o}`),g.info(`
322
+ `).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 vb(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 tm(t,e,r,n={}){let{silent:i=!1,autoUnlink:s=!1}=n,o=await lfe(t,e,r,{silent:i});await k8(t,e,o,{silent:i,autoUnlink:s}),await vb(t,e,r,{silent:i})}function q8(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new zt;r.theme=zt.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,su(n.created_at),n.keep??""]);g.success("Bundles"),g.success(r.toString())}async function rm(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 H8(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 lfe(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 ou=require("node:fs");async function V8(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Et(t,e,r,n,i=!1){let s=qn(),o=await w8(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 Qr="assets/icon.png";var ffe=/^[a-z0-9]+(\.[\w-]+)+$/i;function hfe(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(!ffe.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 dfe(t,e,r){if(await V8(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 z8(t,e,r,n=!1){n||ae("Adding"),await Xe(),e.apikey=e.apikey||re();let i=await de(),s=Le(t,i?.config);hfe(s,e,n);let o=await pe(e.apikey,e.supaHost,e.supaAnon),a=await De(o,e.apikey,["write","all"]);await dfe(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,ou.existsSync)(l)?(h=(0,ou.readFileSync)(l),d=iu(l)||"image/png",n||g.warn(`Found app icon ${l}`)):(0,ou.existsSync)(Qr)?(h=(0,ou.readFileSync)(Qr),d=iu(Qr)||"image/png",n||g.warn(`Found app icon ${Qr}`)):n||g.warn(`Cannot find app icon in any of the following locations: ${l}, ${Qr}`);let f="icon",p="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(h&&d){let{error:v}=await o.storage.from(`images/org/${u}/${s}`).upload(f,h,{contentType:d});if(v)throw n||console.error(v),n||g.error(`Could not add app ${W(v)}`),new Error(`Could not add app ${W(v)}`);let{data:E}=await o.storage.from(`images/org/${u}/${s}`).getPublicUrl(f);p=E?.publicUrl||p}let{error:y}=await o.from("apps").insert({icon_url:p,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`),le("Done \u2705")),{appId:s,organizationUid:u,userId:a,name:c,signedURL:p}}async function K8(t,e,r=!1,n=!1){r||ae("Deleting"),e.apikey=e.apikey||re();let i=await de(),s=Le(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 Et(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 gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(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 p=await Rr(o,s);return await _e(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:p,tags:{"app-id":s},notify:!1}).catch(()=>{}),r||(g.success("App deleted in Capgo"),le("Done \u2705")),!0}var nm=require("node:os"),W8=require("node:process");async function G8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Gh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function pfe(){let t=await Xp(),e={"@capgo/cli":Ui.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function X8(t,e=!1){e||g.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=us("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Le("",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,nm.platform)()} ${(0,nm.version)()}`),g.info(` Node: ${W8.version}`),g.info(" Installed Dependencies:"));let u=await pfe();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 G8(u);else{let l=Ct();l.start("Running: Loading latest dependencies"),c=await G8(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 mfe(t){let e=new zt;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,su(r.created_at)]);g.success("Apps"),g.success(e.toString())}async function gfe(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 Y8(t,e=!1){e||ae("List apps in Capgo"),await Xe(),t.apikey=t.apikey||re();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 gfe(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}`),mfe(n),le("Done \u2705")),n}var J8=require("node:crypto"),au=require("node:fs");async function Z8(t,e,r=!1){r||ae("Set app"),e.apikey=e.apikey||re();let n=await de();if(t=Le(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 Et(i,e.apikey,t,4,r);let{name:u,icon:c,retention:l,exposeMetadata:h}=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 d,f,p=`icon_${(0,J8.randomUUID)()}`,y="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,au.existsSync)(c)?(d=(0,au.readFileSync)(c),f=iu(c)||"image/png",r||g.warn(`Found app icon ${c}`)):(0,au.existsSync)(Qr)?(d=(0,au.readFileSync)(Qr),f=iu(Qr)||"image/png",r||g.warn(`Found app icon ${Qr}`)):r||g.warn(`Cannot find app icon in any of the following locations: ${c}, ${Qr}`),d&&f){let{error:E}=await i.storage.from(`images/org/${o}/${t}`).upload(p,d,{contentType:f});if(E)throw r||g.error(`Could not set app ${W(E)}`),new Error(`Could not set app: ${W(E)}`);let{data:A}=await i.storage.from(`images/org/${o}/${t}`).getPublicUrl(p);y=A?.publicUrl||y}let{error:v}=await i.from("apps").update({icon_url:y,name:u,retention:l?l*24*60*60:void 0,expose_metadata:h}).eq("app_id",t).eq("user_id",a);if(v)throw r||g.error(`Could not set app ${W(v)}`),new Error(`Could not set app: ${W(v)}`);return r||le("Done \u2705"),!0}async function Q8(t,e,r=!1){if(r||ae("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 Xa(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||le("Done \u2705")}var Hn=require("node:fs"),en=require("node:fs/promises"),n6=require("node:os"),tn=require("node:path"),Vn=require("node:process");var i6=Ee(lD()),om=Ee(Kh());var im=require("node:fs/promises"),e6=require("node:os"),sm=require("node:path"),Ie=require("node:process"),yfe=(0,sm.join)((0,e6.homedir)(),".capgo-credentials"),Dfe=(0,sm.join)(yfe,"credentials.json"),wfe=".capgo-credentials.json";function vfe(t){return t?(0,sm.join)((0,Ie.cwd)(),wfe):Dfe}async function Eb(t){try{let e=vfe(t),r=await(0,im.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Efe(t,e){if(e!==void 0){let i=await Eb(e);if(!t){let s=Object.keys(i);return s.length===0?null:i[s[0]]||null}return i[t]||null}let r=await Eb(!0),n=await Eb(!1);if(!t){let i=Object.keys(r);if(i.length>0)return r[i[0]]||null;let s=Object.keys(n);return s.length===0?null:n[s[0]]||null}return r[t]||n[t]||null}function bfe(){let t={};return Ie.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Ie.env.BUILD_CERTIFICATE_BASE64),Ie.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Ie.env.BUILD_PROVISION_PROFILE_BASE64),Ie.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Ie.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Ie.env.P12_PASSWORD&&(t.P12_PASSWORD=Ie.env.P12_PASSWORD),Ie.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Ie.env.APPLE_KEY_ID),Ie.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Ie.env.APPLE_ISSUER_ID),Ie.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Ie.env.APPLE_KEY_CONTENT),Ie.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Ie.env.APPLE_PROFILE_NAME),Ie.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Ie.env.APP_STORE_CONNECT_TEAM_ID),Ie.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Ie.env.ANDROID_KEYSTORE_FILE),Ie.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Ie.env.KEYSTORE_KEY_ALIAS),Ie.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Ie.env.KEYSTORE_KEY_PASSWORD),Ie.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Ie.env.KEYSTORE_STORE_PASSWORD),Ie.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Ie.env.PLAY_CONFIG_JSON),t}async function t6(t,e,r){let n=await Efe(t),i=bfe(),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 _fe(t,e,r,n,i){try{i||g.warn(`
323
+ \u26A0\uFE0F Cancelling build...`);let s=await fetch(`${t}/build/cancel/${e}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:n},body:JSON.stringify({app_id:r})});if(!s.ok){let a=await s.text();i||g.warn(`Could not cancel build: ${a}`);return}let o=await s.json();i||g.info(`Build cancelled (status: ${o.status})`)}catch(s){i||g.warn(`Failed to cancel build: ${s instanceof Error?s.message:String(s)}`)}}async function Cfe(t,e,r,n,i){if(i)return null;let s=Ct(),o=null,a=!1;try{let u=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!u.ok)return g.warn("Could not stream logs, continuing..."),null;let c=u.body?.getReader();if(!c)return null;s.start("Waiting for build logs..."),a=!0;let l=new TextDecoder,h="",d=f=>{if(!f.trim())return;let p=f.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(p){o=p[1].toLowerCase();return}o||(a&&(s.stop("Building..."),a=!1),g.info(f))};for(;;){let{done:f,value:p}=await c.read();if(f)break;h+=l.decode(p,{stream:!0});let y=h.split(`
324
+ `);h=y.pop()||"";for(let v of y)if(v.startsWith("data: ")){let E=v.slice(6);d(E)}}if(h.startsWith("data: ")){let f=h.slice(6);d(f)}return a&&s.stop(),o}catch(u){return a&&s.stop("Log streaming ended"),i||g.warn(`Log streaming interrupted${u instanceof Error?`: ${u.message}`:""}`),null}}async function Sfe(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 Afe(t,e){let r=new Set,n=!1;if(e==="ios"){let i=(0,tn.join)(t,"ios/App/CapApp-SPM/Package.swift");if((0,Hn.existsSync)(i)){n=!0;let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let a of o)r.add(a[1])}else{let s=(0,tn.join)(t,"ios/App/Podfile");if((0,Hn.existsSync)(s)){let a=(await(0,en.readFile)(s,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let u of a)r.add(u[1])}}}else if(e==="android"){let i=(0,tn.join)(t,"android/capacitor.settings.gradle");if((0,Hn.existsSync)(i)){let o=(await(0,en.readFile)(i,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of o){let c=a[1].replace(/\/android$/,"");r.add(c)}}}return{packages:r,usesSPM:n}}function r6(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let i of r.packages){let s=`node_modules/${i}/`;if(e==="android"){if(n.startsWith(`${s}android/`))return!0}else if(e==="ios"){if(n.startsWith(`${s}ios/`))return!0;if(r.usesSPM){if(n===`${s}Package.swift`)return!0}else if(n.startsWith(s)&&n.endsWith(".podspec"))return!0}}return!1}function hl(t,e,r,n,i){let s=(0,Hn.readdirSync)(e);for(let o of s){let a=(0,tn.join)(e,o),u=r?`${r}/${o}`:o,c=(0,Hn.statSync)(a);if(c.isDirectory()){if(o===".git"||o==="dist"||o==="build"||o===".angular"||o===".vite"||o===".gradle"||o===".idea"||o===".swiftpm")continue;if(o===n){hl(t,a,u,n,i);continue}if(o==="node_modules"){hl(t,a,u,n,i);continue}if(o==="resources"){hl(t,a,u,n,i);continue}let l=u.replace(/\\/g,"/");(r6(u,n,i)||Array.from(i.packages).some(d=>`node_modules/${d}/`.startsWith(`${l}/`)||l.startsWith(`node_modules/${d}`)))&&hl(t,a,u,n,i)}else if(c.isFile()){if(o===".DS_Store"||o.endsWith(".log"))continue;r6(u,n,i)&&t.addLocalFile(a,r||void 0)}}}async function Ofe(t,e,r){let n=await Afe(t,r),i=new i6.default;hl(i,t,"",r,n),await(0,en.writeFile)(e,i.toBuffer())}async function s6(t,e,r=!1){let n=Date.now(),i=e.verbose??!1;try{e.apikey=e.apikey||re(r);let s=await de();if(t=t||s?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let o=(0,tn.resolve)(e.path||(0,Vn.cwd)()),a=e.supaHost||"https://api.capgo.app",u=await pe(e.apikey,e.supaHost,e.supaAnon);await De(u,e.apikey,["write","all"]);let c=await Rr(u,t);r||(g.info(`Requesting native build for ${t}`),g.info(`Platform: ${e.platform}`),g.info(`Project: ${o}`),g.info(`
325
325
  \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
326
- `)),i&&g.info(`API host: ${a}`);let l={};e.buildCertificateBase64&&(l.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(l.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(l.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(l.P12_PASSWORD=e.p12Password),e.appleKeyId&&(l.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(l.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(l.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(l.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(l.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(l.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(l.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let h=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;h&&!d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!h&&d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):h&&d&&(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(l.PLAY_CONFIG_JSON=e.playConfigJson);let f=await t6(t,e.platform,Object.keys(l).length>0?l:void 0),m={app_id:t,platform:e.platform};if(!f)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 y=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(g.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),g.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let D of y)g.error(` \u2022 ${D}`);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}: ${y.join(", ")}`)}if(m.credentials=f,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);g.info(`Credentials provided: ${D.join(", ")}`)}r||g.info("Requesting build from Capgo...");let v=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(m)});if(!v.ok){let D=await v.text();throw new Error(`Failed to request build: ${v.status} - ${D}`)}let E=await v.json();r||(g.success(`Build job created: ${E.job_id}`),g.info(`Status: ${E.status}`)),i&&(g.info(`Upload URL: ${E.upload_url}`),g.info(`Upload expires: ${E.upload_expires_at}`)),await _e(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let A=(0,tn.join)((0,n6.tmpdir)(),`capgo-build-${Date.now()}`);await(0,en.mkdir)(A,{recursive:!0});let p=(0,tn.join)(A,`${(0,tn.basename)(o)}.zip`);try{r||g.info(`Zipping ${e.platform} project from ${o}...`),await Ofe(o,p,e.platform);let w=((await(0,en.stat)(p)).size/1024/1024).toFixed(2);r||g.success(`Created zip: ${p} (${w} MB)`),r||g.info("Uploading to builder..."),i&&(g.info(`Upload endpoint: ${E.upload_url}`),g.info(`File size: ${w} MB`),g.info(`Job ID: ${E.job_id}`));let C=(0,Hn.readFileSync)(p),F=Ct();r||F.start("Uploading bundle"),await new Promise((z,L)=>{let S=new om.Upload(C,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,tn.basename)(p),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(T){if(i){g.info(`[TUS] ${T.getMethod()} ${T.getURL()}`);let P=T.getHeader("authorization");g.info(`[TUS] Authorization header present: ${!!P}`)}},onAfterResponse(T,P){if(i){g.info(`[TUS] Response status: ${P.getStatus()}`);let $=P.getHeader("upload-offset"),q=P.getHeader("tus-resumable");g.info(`[TUS] Upload-Offset: ${$}, Tus-Resumable: ${q}`)}},onError(T){if(r||(F.stop("Upload failed"),g.error(`Upload error: ${T.message}`)),T instanceof om.DetailedError){let P=T.originalResponse?.getBody(),$=T.originalResponse?.getStatus(),q=T.originalRequest?.getURL();i&&(g.error(`[TUS] Request URL: ${q}`),g.error(`[TUS] Response status: ${$}`),g.error(`[TUS] Response body: ${P}`));let M="Unknown error";try{let G=JSON.parse(P||'{"error": "unknown error"}');M=G.status||G.error||G.message||"unknown error"}catch{M=P||T.message}L(new Error(`TUS upload failed: ${M}`))}else L(new Error(`TUS upload failed: ${T.message||T.toString()}`))},onProgress(T,P){let $=(T/P*100).toFixed(2);r||F.message(`Uploading ${$}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&g.success("TUS upload completed successfully"),z()}});i&&g.info("[TUS] Starting upload..."),S.start()}),r||g.info("Starting build job...");let b=await fetch(`${a}/build/start/${E.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!b.ok){let z=await b.text();throw new Error(`Failed to start build: ${b.status} - ${z}`)}let k=await b.json();r||(g.success("Build started!"),g.info(`Streaming build logs...
326
+ `)),i&&g.info(`API host: ${a}`);let l={};e.buildCertificateBase64&&(l.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(l.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(l.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(l.P12_PASSWORD=e.p12Password),e.appleKeyId&&(l.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(l.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(l.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(l.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(l.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(l.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(l.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let h=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;h&&!d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!h&&d?(l.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):h&&d&&(l.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,l.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(l.PLAY_CONFIG_JSON=e.playConfigJson);let f=await t6(t,e.platform,Object.keys(l).length>0?l:void 0),p={app_id:t,platform:e.platform};if(!f)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 y=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||y.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(g.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),g.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||y.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||y.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||y.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||y.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||y.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||y.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||y.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&y.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&g.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),y.length>0){if(!r){g.error(`\u274C Missing required credentials for ${e.platform}:`),g.error("");for(let D of y)g.error(` \u2022 ${D}`);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}: ${y.join(", ")}`)}if(p.credentials=f,r||g.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);g.info(`Credentials provided: ${D.join(", ")}`)}r||g.info("Requesting build from Capgo...");let v=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(p)});if(!v.ok){let D=await v.text();throw new Error(`Failed to request build: ${v.status} - ${D}`)}let E=await v.json();r||(g.success(`Build job created: ${E.job_id}`),g.info(`Status: ${E.status}`)),i&&(g.info(`Upload URL: ${E.upload_url}`),g.info(`Upload expires: ${E.upload_expires_at}`)),await _e(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:c,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let A=(0,tn.join)((0,n6.tmpdir)(),`capgo-build-${Date.now()}`);await(0,en.mkdir)(A,{recursive:!0});let m=(0,tn.join)(A,`${(0,tn.basename)(o)}.zip`);try{r||g.info(`Zipping ${e.platform} project from ${o}...`),await Ofe(o,m,e.platform);let w=((await(0,en.stat)(m)).size/1024/1024).toFixed(2);r||g.success(`Created zip: ${m} (${w} MB)`),r||g.info("Uploading to builder..."),i&&(g.info(`Upload endpoint: ${E.upload_url}`),g.info(`File size: ${w} MB`),g.info(`Job ID: ${E.job_id}`));let C=(0,Hn.readFileSync)(m),F=Ct();r||F.start("Uploading bundle"),await new Promise((z,L)=>{let S=new om.Upload(C,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,tn.basename)(m),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(T){if(i){g.info(`[TUS] ${T.getMethod()} ${T.getURL()}`);let P=T.getHeader("authorization");g.info(`[TUS] Authorization header present: ${!!P}`)}},onAfterResponse(T,P){if(i){g.info(`[TUS] Response status: ${P.getStatus()}`);let $=P.getHeader("upload-offset"),q=P.getHeader("tus-resumable");g.info(`[TUS] Upload-Offset: ${$}, Tus-Resumable: ${q}`)}},onError(T){if(r||(F.stop("Upload failed"),g.error(`Upload error: ${T.message}`)),T instanceof om.DetailedError){let P=T.originalResponse?.getBody(),$=T.originalResponse?.getStatus(),q=T.originalRequest?.getURL();i&&(g.error(`[TUS] Request URL: ${q}`),g.error(`[TUS] Response status: ${$}`),g.error(`[TUS] Response body: ${P}`));let M="Unknown error";try{let G=JSON.parse(P||'{"error": "unknown error"}');M=G.status||G.error||G.message||"unknown error"}catch{M=P||T.message}L(new Error(`TUS upload failed: ${M}`))}else L(new Error(`TUS upload failed: ${T.message||T.toString()}`))},onProgress(T,P){let $=(T/P*100).toFixed(2);r||F.message(`Uploading ${$}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&g.success("TUS upload completed successfully"),z()}});i&&g.info("[TUS] Starting upload..."),S.start()}),r||g.info("Starting build job...");let b=await fetch(`${a}/build/start/${E.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!b.ok){let z=await b.text();throw new Error(`Failed to start build: ${b.status} - ${z}`)}let k=await b.json();r||(g.success("Build started!"),g.info(`Streaming build logs...
327
327
  `),g.info(`Press Ctrl+C to cancel the build
328
- `));let R=!1,I=async()=>{R||(R=!0,await _fe(a,E.job_id,t,e.apikey,r),(0,Vn.exit)(130))};(0,Vn.on)("SIGINT",I),(0,Vn.on)("SIGTERM",I);let B;try{let z=await Cfe(a,E.job_id,t,e.apikey,r);z?B=z:B=await Sfe(a,E.job_id,t,e.platform,e.apikey,r)}finally{(0,Vn.off)("SIGINT",I),(0,Vn.off)("SIGTERM",I)}r||(B==="succeeded"?g.success("Build completed successfully!"):B==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${B}`));let j=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:B==="succeeded"?"Build succeeded":"Build failed",icon:B==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:B||"unknown",time:j},notify:!1}).catch(),{success:B==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:B||k.status||E.status}}finally{await(0,en.rm)(A,{recursive:!0,force:!0})}}catch(s){let o=s instanceof Error?s.message:String(s);return r||g.error(o),{success:!1,error:o}}}async function xfe(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${su(i.created_at)}`),await tm(e,r,i.name)}function Tfe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Xm(s,e)&&ps(s,r)&&n.push(i)}return n}async function o6(t,e,r=!1){r||ae("Cleanup versions in Capgo"),await Xe(),e.apikey=e.apikey||re();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Le(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 Et(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await rm(u,t),l=await H8(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=lt(n),m=Eu(f,"major");r||g.info(`Querying available versions in Capgo between ${sn(f)} and ${sn(m)}`),c=Tfe(c,f,m),r||g.info(`Active versions in Capgo between ${sn(f)} and ${sn(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||q8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await Pr({message:"Do you want to continue removing the versions specified?"});if(st(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 xfe(h,u,t,r),r||le("Done \u2705"),{removed:h.length,kept:d}}async function a6(t,e,r=!1){r||ae("Check compatibility");let n={...e,apikey:e.apikey||re()},i=await de(),s=Le(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 Et(a,n.apikey,s,1,r);let u=await em(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new zt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=zt.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,v=ho(d)?l:h;c.rows.push([f,m,y,v])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var Ci=require("node:fs");var bi=require("node:buffer"),Ut=require("node:crypto"),c6="aes-128-cbc",_i="base64",u6="hex",dl=Ut.constants.RSA_PKCS1_PADDING;function am(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(_i),i=(0,Ut.privateEncrypt)({key:t,padding:dl},r).toString(_i);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function uu(t,e,r){let[n]=r.split(":"),i=bi.Buffer.from(n,_i),s=(0,Ut.createCipheriv)(c6,e,i);return s.setAutoPadding(!0),bi.Buffer.concat([s.update(t),s.final()])}function l6(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:dl},bi.Buffer.from(i,_i)),o=bi.Buffer.from(n,_i),a=(0,Ut.createDecipheriv)(c6,s,o);return a.setAutoPadding(!0),bi.Buffer.concat([a.update(t),a.final()])}function cu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},bi.Buffer.from(t,_i)).toString(_i)}function um(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},bi.Buffer.from(t,u6)).toString(u6)}function f6(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 h6(t,e){return(0,Ut.publicDecrypt)({key:e,padding:dl},bi.Buffer.from(t,_i)).toString(_i)}function d6(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function Ife(t,e){let r=t.key||Ei,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,Ci.existsSync)(r)?n=(0,Ci.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function p6(t,e,r,n=!1){n||ae("Decrypt zip file");try{if(await Xe(),!(0,Ci.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,Ci.existsSync)(Ei)&&!i.config.plugins?.CapacitorUpdater?.publicKey){let h=`Public Key not found at the path ${Ei} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Ife(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,Ci.readFileSync)(t),u=l6(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,Ci.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await ii(u,"sha256"),d=h6(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||le("\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 m6(t,e,r,n=!1){n||ae("Delete bundle"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(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 tm(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Si=require("node:fs");function pl(t){console.error(W(t))}async function g6(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(ae("Encryption"),await Xe());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,Si.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(i?pl({error:"zip_not_found"}):g.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?pl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||$r,l=r.keyData||"";if(!(0,Si.existsSync)(c)&&!l)throw n||(i?pl({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,Si.existsSync)(c)&&(l=(0,Si.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?pl({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,Si.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=am(l),m=uu(h,d,f),y=cu(e,l),v=`${t}_encrypted.zip`;return(0,Si.writeFileSync)(v,m),n||(i?console.log(JSON.stringify({checksum:y,filename:v,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:y,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?pl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var KU=require("node:crypto"),bo=require("node:fs"),_m=require("node:process");var cm=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 fs(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 zn=class extends Error{};var Jt=class extends zn{},ml=class extends zn{},lm=class extends zn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Kn=class extends zn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},hs=class extends zn{constructor(){super("accessKey is required")}},lu=class extends zn{constructor(){super("secretKey is required")}},gl=class extends zn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Ai=class extends zn{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 y6(t){try{let r=fs(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 Ai(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new Ai(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function D6(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function w6(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 ds(t){return!(!Pfe(t)||t.length===0)}function Pfe(t){return!(typeof t!="string"||t.length>1024)}function yl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function po(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function _b(t){return t.get("x-amz-version-id")??null}function mo(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function Cb(t){return mo(t).slice(0,8)}function Sb(t,e){return`${Cb(e)}/${t}/s3/aws4_request`}async function fm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),yl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ffe=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],hm=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:po(A.headers.get("etag")??void 0),versionId:_b(A.headers)};return}y===1&&(u=(await Rfe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ffe){let p=s[A];p&&(v[A]=p)}let E=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(v),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(E.catch(A=>{l||(l=A)}))}catch(v){throw v}},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 kfe({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 Rfe(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=fs(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 kfe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
328
+ `));let R=!1,I=async()=>{R||(R=!0,await _fe(a,E.job_id,t,e.apikey,r),(0,Vn.exit)(130))};(0,Vn.on)("SIGINT",I),(0,Vn.on)("SIGTERM",I);let B;try{let z=await Cfe(a,E.job_id,t,e.apikey,r);z?B=z:B=await Sfe(a,E.job_id,t,e.platform,e.apikey,r)}finally{(0,Vn.off)("SIGINT",I),(0,Vn.off)("SIGTERM",I)}r||(B==="succeeded"?g.success("Build completed successfully!"):B==="failed"?g.error("Build failed"):g.warn(`Build finished with status: ${B}`));let j=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:B==="succeeded"?"Build succeeded":"Build failed",icon:B==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:B||"unknown",time:j},notify:!1}).catch(),{success:B==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:B||k.status||E.status}}finally{await(0,en.rm)(A,{recursive:!0,force:!0})}}catch(s){let o=s instanceof Error?s.message:String(s);return r||g.error(o),{success:!1,error:o}}}async function xfe(t,e,r,n){for await(let i of t)n||g.warn(`Removing ${i.name} created on ${su(i.created_at)}`),await tm(e,r,i.name)}function Tfe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Xm(s,e)&&ps(s,r)&&n.push(i)}return n}async function o6(t,e,r=!1){r||ae("Cleanup versions in Capgo"),await Xe(),e.apikey=e.apikey||re();let{bundle:n,keep:i=4}=e,s=e.force||!1,o=e.ignoreChannel||!1,a=await de();if(t=Le(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 Et(u,e.apikey,t,3,r),r||g.info("Querying all available versions in Capgo");let c=await rm(u,t),l=await H8(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=lt(n),p=Eu(f,"major");r||g.info(`Querying available versions in Capgo between ${sn(f)} and ${sn(p)}`),c=Tfe(c,f,p),r||g.info(`Active versions in Capgo between ${sn(f)} and ${sn(p)}: ${c?.length??0}`)}let h=[],d=0;for(let f of c){let p=l.find(y=>y===f.id);d<i||p&&!o?(f.keep=p?"\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||q8(c),!s){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let f=await Pr({message:"Do you want to continue removing the versions specified?"});if(st(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 xfe(h,u,t,r),r||le("Done \u2705"),{removed:h.length,kept:d}}async function a6(t,e,r=!1){r||ae("Check compatibility");let n={...e,apikey:e.apikey||re()},i=await de(),s=Le(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 Et(a,n.apikey,s,1,r);let u=await em(a,s,o,n.packageJson,n.nodeModules);if(!r){let c=new zt;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=zt.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",h=n.text?"No":"\u274C";for(let d of u.finalCompatibility){let{name:f,localVersion:p,remoteVersion:y}=d,v=ho(d)?l:h;c.rows.push([f,p,y,v])}g.success("Compatibility"),g.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var Ci=require("node:fs");var bi=require("node:buffer"),Ut=require("node:crypto"),c6="aes-128-cbc",_i="base64",u6="hex",dl=Ut.constants.RSA_PKCS1_PADDING;function am(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(_i),i=(0,Ut.privateEncrypt)({key:t,padding:dl},r).toString(_i);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function uu(t,e,r){let[n]=r.split(":"),i=bi.Buffer.from(n,_i),s=(0,Ut.createCipheriv)(c6,e,i);return s.setAutoPadding(!0),bi.Buffer.concat([s.update(t),s.final()])}function l6(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:dl},bi.Buffer.from(i,_i)),o=bi.Buffer.from(n,_i),a=(0,Ut.createDecipheriv)(c6,s,o);return a.setAutoPadding(!0),bi.Buffer.concat([a.update(t),a.final()])}function cu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},bi.Buffer.from(t,_i)).toString(_i)}function um(t,e){return(0,Ut.privateEncrypt)({key:e,padding:dl},bi.Buffer.from(t,u6)).toString(u6)}function f6(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 h6(t,e){return(0,Ut.publicDecrypt)({key:e,padding:dl},bi.Buffer.from(t,_i)).toString(_i)}function d6(t){return t?t.replace(/-----BEGIN RSA PUBLIC KEY-----/g,"").replace(/-----END RSA PUBLIC KEY-----/g,"").replace(/\n/g,"").replace(/\r/g,"").replace(/ /g,"").substring(0,4):""}function Ife(t,e){let r=t.key||Ei,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,Ci.existsSync)(r)?n=(0,Ci.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function p6(t,e,r,n=!1){n||ae("Decrypt zip file");try{if(await Xe(),!(0,Ci.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,Ci.existsSync)(Ei)&&!i.config.plugins?.CapacitorUpdater?.publicKey){let h=`Public Key not found at the path ${Ei} or in ${i.path}`;throw n||g.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Ife(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,Ci.readFileSync)(t),u=l6(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,Ci.writeFileSync)(c,u),n||g.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await ii(u,"sha256"),d=h6(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||le("\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 m6(t,e,r,n=!1){n||ae("Delete bundle"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(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 tm(s,e,t),n||(g.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Si=require("node:fs");function pl(t){console.error(W(t))}async function g6(t,e,r,n=!1){let{json:i}=r,s=!i&&!n;s&&(ae("Encryption"),await Xe());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,Si.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(i?pl({error:"zip_not_found"}):g.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?pl({error:"missing_public_key"}):g.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||$r,l=r.keyData||"";if(!(0,Si.existsSync)(c)&&!l)throw n||(i?pl({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,Si.existsSync)(c)&&(l=(0,Si.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?pl({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,Si.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=am(l),p=uu(h,d,f),y=cu(e,l),v=`${t}_encrypted.zip`;return(0,Si.writeFileSync)(v,p),n||(i?console.log(JSON.stringify({checksum:y,filename:v,ivSessionKey:f},null,2)):(g.success(`Encoded Checksum: ${y}`),g.success(`ivSessionKey: ${f}`),g.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:y,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?pl(o):g.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var KU=require("node:crypto"),bo=require("node:fs"),_m=require("node:process");var cm=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 fs(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 p=s();if(!p)return d;d.attributes[p.name]=p.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 zn=class extends Error{};var Jt=class extends zn{},ml=class extends zn{},lm=class extends zn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Kn=class extends zn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},hs=class extends zn{constructor(){super("accessKey is required")}},lu=class extends zn{constructor(){super("secretKey is required")}},gl=class extends zn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Ai=class extends zn{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 y6(t){try{let r=fs(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 Ai(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new Ai(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function D6(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function w6(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 ds(t){return!(!Pfe(t)||t.length===0)}function Pfe(t){return!(typeof t!="string"||t.length>1024)}function yl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function po(t=""){let e={'"':"","&quot;":"","&#34;":"","&QUOT;":"","&#x00022":""};return t.replace(/^("|&quot;|&#34;)|("|&quot;|&#34;)$/g,r=>e[r])}function _b(t){return t.get("x-amz-version-id")??null}function mo(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function Cb(t){return mo(t).slice(0,8)}function Sb(t,e){return`${Cb(e)}/${t}/s3/aws4_request`}async function fm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),yl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Ffe=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],hm=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:po(A.headers.get("etag")??void 0),versionId:_b(A.headers)};return}y===1&&(u=(await Rfe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Ffe){let m=s[A];m&&(v[A]=m)}let E=e.makeRequest({method:"PUT",query:{partNumber:y.toString(),uploadId:u},headers:new Headers(v),bucketName:r,objectName:n,payload:d}).then(A=>{let m=A.headers.get("etag")??"";return m&&(m=m.replace(/^"/,"").replace(/"$/,"")),c.push({part:y,etag:m}),A});h.push(E.catch(A=>{l||(l=A)}))}catch(v){throw v}},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 kfe({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 Rfe(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=fs(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 kfe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
329
329
  <CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
330
330
  ${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
331
331
  `)}
332
332
  </CompleteMultipartUpload>
333
- `,o=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(s),returnBody:!0}),a=await o.text(),u=fs(a).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let c=u.children.find(h=>h.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${a}`);let l=_b(o.headers);return{etag:po(c),versionId:l}}var Dl="AWS4-HMAC-SHA256";async function v6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=b6(t.headers),n=_6(t.method,t.path,t.headers,r,e),i=await C6(n,t.date,t.region),s=await Ob(t.date,t.region,t.secretKey),o=xb(t.accessKey,t.region,t.date),a=yl(await yo(s,i)).toLowerCase();return`${Dl} Credential=${o}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${a}`}async function E6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=mo(t.date),i=b6(t.headers),s=xb(t.accessKey,t.region,t.date),o="UNSIGNED-PAYLOAD",a=new URLSearchParams(r);a.set("X-Amz-Algorithm",Dl),a.set("X-Amz-Credential",s),a.set("X-Amz-Date",n),a.set("X-Amz-Expires",t.expirySeconds.toString()),a.set("X-Amz-SignedHeaders",i.join(";").toLowerCase()),t.sessionToken&&a.set("X-Amz-Security-Token",t.sessionToken);let u=a.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(v=>encodeURIComponent(v)).join("/"),h=_6(t.method,c,t.headers,i,o),d=await C6(h,t.date,t.region),f=await Ob(t.date,t.region,t.secretKey),m=yl(await yo(f,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function b6(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var go={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},Nfe="-._~".split("").map(t=>t.charCodeAt(0));function Ab(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let i of r)i>=go.A&&i<=go.Z||i>=go.a&&i<=go.z||i>=go[0]&&i<=go[9]||Nfe.includes(i)||i==go["/"]&&e?n+=String.fromCharCode(i):n+="%"+i.toString(16).padStart(2,"0").toUpperCase();return n}function _6(t,e,r,n,i){let s=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),o=e.split("?")[0],a=e.split("?")[1];return a?a=a.split("&").map(u=>{let[c,l]=u.split("=",2);return Ab(decodeURIComponent(c))+"="+Ab(decodeURIComponent(l||""))}).sort().join("&"):a="",[t.toUpperCase(),Ab(o,!0),a,s.join(`
333
+ `,o=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(s),returnBody:!0}),a=await o.text(),u=fs(a).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let c=u.children.find(h=>h.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${a}`);let l=_b(o.headers);return{etag:po(c),versionId:l}}var Dl="AWS4-HMAC-SHA256";async function v6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=b6(t.headers),n=_6(t.method,t.path,t.headers,r,e),i=await C6(n,t.date,t.region),s=await Ob(t.date,t.region,t.secretKey),o=xb(t.accessKey,t.region,t.date),a=yl(await yo(s,i)).toLowerCase();return`${Dl} Credential=${o}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${a}`}async function E6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=mo(t.date),i=b6(t.headers),s=xb(t.accessKey,t.region,t.date),o="UNSIGNED-PAYLOAD",a=new URLSearchParams(r);a.set("X-Amz-Algorithm",Dl),a.set("X-Amz-Credential",s),a.set("X-Amz-Date",n),a.set("X-Amz-Expires",t.expirySeconds.toString()),a.set("X-Amz-SignedHeaders",i.join(";").toLowerCase()),t.sessionToken&&a.set("X-Amz-Security-Token",t.sessionToken);let u=a.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(v=>encodeURIComponent(v)).join("/"),h=_6(t.method,c,t.headers,i,o),d=await C6(h,t.date,t.region),f=await Ob(t.date,t.region,t.secretKey),p=yl(await yo(f,d)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${p}`}function b6(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var go={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},Nfe="-._~".split("").map(t=>t.charCodeAt(0));function Ab(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let i of r)i>=go.A&&i<=go.Z||i>=go.a&&i<=go.z||i>=go[0]&&i<=go[9]||Nfe.includes(i)||i==go["/"]&&e?n+=String.fromCharCode(i):n+="%"+i.toString(16).padStart(2,"0").toUpperCase();return n}function _6(t,e,r,n,i){let s=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),o=e.split("?")[0],a=e.split("?")[1];return a?a=a.split("&").map(u=>{let[c,l]=u.split("=",2);return Ab(decodeURIComponent(c))+"="+Ab(decodeURIComponent(l||""))}).sort().join("&"):a="",[t.toUpperCase(),Ab(o,!0),a,s.join(`
334
334
  `)+`
335
335
  `,n.join(";").toLowerCase(),i].join(`
336
336
  `)}async function C6(t,e,r){let n=await fm(t),i=Sb(r,e);return[Dl,mo(e),i,n].join(`
337
- `)}async function Ob(t,e,r){let n=Cb(t),i=await yo("AWS4"+r,n),s=await yo(i,e),o=await yo(s,"s3");return await yo(o,"aws4_request")}function xb(t,e,r){return`${t}/${Sb(e,r)}`}async function yo(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 S6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=xb(t.accessKey,t.region,t.date),n=mo(t.date),i={"X-Amz-Algorithm":Dl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Dl},{"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 Ob(t.date,t.region,t.secretKey),h=yl(await yo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var $fe=["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"],Lfe=5*1024*1024,Bfe=5*1024*1024*1024,Tb=5*1024*1024*1024*1024,wl=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 ml(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ml(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!D6(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||!w6(r))throw new lm(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 fm(r??new Uint8Array);s.set("x-amz-date",mo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await v6({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 y6(d):d.status===301?new Ai(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 Ai(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(!ds(e))throw new Kn(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 Ai&&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(!ds(e))throw new Kn(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 hs;if(!ds(r))throw new Kn(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 E6({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=fs(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:po(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,v=m.type==="Object"?m.key:m.prefix;return y>v?1:y<v?-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(!ds(e))throw new Kn(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<Lfe)throw new Jt("Part size should be greater than 5MB");if(a>Bfe)throw new Jt("Part size should be less than 6MB");let u=new cm(a),c=new hm({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=Tb),e>Tb)throw new TypeError(`size should not be more than ${Tb}`);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(!ds(e))throw new Kn(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 $fe)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:po(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!ds(r))throw new Kn(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=fs(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:po(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 Ai&&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(!ds(e))throw new Kn(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 S6({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})}};function A6(t){try{let e=lt(t);return sn(Eu(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,i]=e;return`${r}.${n}.${Number.parseInt(i)+1}`}return"1.0.1"}}async function O6(t,e){let r=A6(t),n=e?` for ${e}`:"",i=await gn({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(st(i))return null;if(i==="auto")return g.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let s=await Ti({message:`Current version is ${t}. Enter new version:`,validate:o=>{if(!o)return"Version is required";if(!o.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return st(s)?null:s}function x6(t){let e=A6(t);try{let r=lt(t);return[e,sn(Eu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Do=require("node:fs"),dm=require("node:path");function jfe(t,e){return(0,Do.readFileSync)(t,"utf8").includes(e)}function vl(t,e){let r=(0,Do.readdirSync)(t);for(let n of r){let i=(0,dm.join)(t,n),s=(0,Do.statSync)(i);if(s.isDirectory()){if(vl(i,e))return!0}else if(s.isFile()&&(0,dm.extname)(i)===".js"&&jfe(i,e))return!0}return!1}function pm(t){return(0,Do.readdirSync)(t).indexOf("index.html")>-1}var LU=require("node:buffer"),BU=require("node:crypto"),du=require("node:fs"),jU=require("node:os"),Eo=require("node:path"),MU=require("node:process"),bm=require("node:stream/consumers"),UU=require("node:zlib");var qU=Ee($U()),HU=Ee(Kh());async function ede(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var tde=8192;async function rde(t){let e=Lr((0,MU.cwd)()),r=await cs("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?lt(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=!ls(n,void 0,void 0,fl);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function nde(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:qU.isMatch(t,r)}async function ide(t,e,r){let i=(0,du.statSync)(t).size,s=await(0,bm.buffer)((0,du.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(nde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<tde)return{buffer:s,useBrotli:!1};try{let o=await(0,bm.buffer)((0,du.createReadStream)(t).pipe((0,UU.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 VU(t,e,r,n,i,s,o=!1){let a=Ct();a.start(i!=="v2"?"Generating the update manifest":`Generating the update manifest with ${o?"V3":"V2"} encryption`);let u=await O8(t);if(i==="v2")for(let c of u)c.hash=o?um(c.hash,s):cu(c.hash,s);return a.stop("Manifest generated successfully"),await _e(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function sde(t){return(0,jU.platform)()!=="win32"?t:Eo.win32.normalize(t).split(Eo.win32.sep).join(Eo.posix.sep)}function ode(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 zU(t,e,r,n,i,s,o){let a=Ct();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Sn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await rde(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 ${S8} (v5), ${A8} (v6) or ${fl} (v7) or higher.`);let f=e.filter(E=>E.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(E=>E.file).join(", ")}). Please rename the files.`);let m=0,y=e.length,v=0;try{a.message(`Uploading ${y} files using TUS protocol`);let E=async C=>{let F=(0,Eo.join)(r,C.file),b=sde(C.file),k,R=!1;if(o.disableBrotli)k=await(0,bm.buffer)((0,du.createReadStream)(F)),R=!1;else{let S=await ide(F,b,o);k=S.buffer,R=S.useBrotli}let I=k;s&&(I=uu(k,s.sessionKey,s.ivSessionKey));let B=b;R&&(B=`${b}.br`,v++);let j=ode(B),z=(0,BU.createHash)("sha256").update(C.hash).digest("hex"),L;if(s){let S=LU.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${S}/${z}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${z}_${j}`;return!s&&await ede(c,L)?(m++,Promise.resolve({file_name:j,s3_path:L,file_hash:C.hash})):new Promise((S,T)=>{a.message(`Prepare upload partial file: ${b}`),new HU.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:L},headers:{Authorization:t},onError:$=>{let q=$.toString(),M;try{let U=q.match(/response text: (\{.*?\})/);U&&U[1]&&(M=JSON.parse(U[1]).moreInfo?.requestId)}catch{}let G=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${q}${G}`),T($)},onProgress(){let $=(m/y*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){m++,S({file_name:j,s3_path:L,file_hash:C.hash})}}).start()})},A=500,p=[];for(let C=0;C<e.length;C+=A){let F=e.slice(C,C+A),b=Math.floor(C/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${F.length} files)`);let R=await Promise.all(F.map(I=>E(I)));p.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),v>0&&g.info(`${v} of ${y} files were compressed with brotli and use .br extension`),await _e(t,{channel:"app",event:`App Partial TUS done${v>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await _e(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),p}catch(E){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: ${E}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return g.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ut(t){throw g.error(t),new Error(t)}async function ade(t,e){let r=us("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,KU.randomUUID)().split("-")[0]}`;return ru.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ude(t){let e=t.apikey||re();return e||ut("Missing API key, you need to provide an API key to upload your bundle"),e}function cde(t,e,r){let n=Le(t,r),i=e.path||r?.webDir;return n||ut("Missing argument, you need to provide a appid or be in a capacitor project"),i||ut("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,bo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function lde(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(vl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
338
- If you are sure your app has this code, you can use the --no-code-check option`),pm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function fde(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 v=Ct();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await em(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(p=>!ho(p)))v.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||!ru.test(p))&&ut("Invalid remote min update version, skipping auto setting compatibility"),u=p,v.stop(`Auto set min-update-version to ${u}`)}catch{ut(`Cannot auto set compatibility, invalid data ${c}`)}else v.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 yb(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&ut("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ru.test(u)||ut(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=d?new Map(d.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([v,E])=>({name:v,version:E.version})):void 0,minUpdateVersion:u}}async function hde(t,e,r,n=!1,i=!1){let{data:s,error:o}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(s||o){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){g.error(`\u274C Version ${r} already exists`);let a=x6(r);g.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{g.info(` ${h+1}. ${l}`)});let u=await gn({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${a[0]}`},{value:"suggest2",label:`Use ${a[1]}`},{value:"suggest3",label:`Use ${a[2]}`},{value:"suggest4",label:`Use ${a[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(st(u)||u==="cancel")&&ut("Upload cancelled by user");let c;if(u==="custom"){let l=await O6(r,"upload");l||ut("Upload cancelled by user"),c=l}else{let l=Number.parseInt(u.replace("suggest",""))-1;c=a[l]}return g.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function dde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",m="",y=e.keyV2,v=e.key===!1,E=Ct();E.start(`Zipping bundle from ${t}`),h=await Jp(t),E.message("Calculating checksum");let A=Lr((0,_m.cwd)()),p=await cs("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=p?lt(p):void 0}catch{w=void 0}if(p?w?D=!ls(w,fl):(p==="link:@capgo/capacitor-updater"||p==="file:.."||p==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),D=!0):ut("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,bo.existsSync)($r))&&!v||D?l=await ii(h,"sha256"):l=await ii(h,"crc32"),E.stop(`Checksum ${D?"SHA256":"CRC32"}: ${l}`),v)g.info("Encryption ignored");else if((y||(0,bo.existsSync)($r)||e.keyDataV2)&&!e.oldEncryption){let b=typeof y=="string"?y:$r,k=e.keyDataV2||"";!k&&!(0,bo.existsSync)(b)&&ut(`Cannot find private key ${b}`),await _e(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),k||(k=(0,bo.readFileSync)(b).toString());let R=w&&!ls(w,"5.30.0","6.30.0","7.30.0");g.info(`Encrypting your bundle with ${R?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:B}=am(k),j=uu(h,I,B);l=R?um(l,k):cu(l,k),u=B,c=I,d="v2",f=k,a&&(m=d6(a),e.verbose&&g.info(`[Verbose] Encryption key_id: ${m}`)),e.displayIvSession&&g.info(`Your Iv Session key is ${u},
337
+ `)}async function Ob(t,e,r){let n=Cb(t),i=await yo("AWS4"+r,n),s=await yo(i,e),o=await yo(s,"s3");return await yo(o,"aws4_request")}function xb(t,e,r){return`${t}/${Sb(e,r)}`}async function yo(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 S6(t){if(!t.accessKey)throw new hs;if(!t.secretKey)throw new lu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new gl;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=xb(t.accessKey,t.region,t.date),n=mo(t.date),i={"X-Amz-Algorithm":Dl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Dl},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&s.push(...t.conditions);for(let[f,p]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(f)||s.push({[f]:p});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 Ob(t.date,t.region,t.secretKey),h=yl(await yo(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var $fe=["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"],Lfe=5*1024*1024,Bfe=5*1024*1024*1024,Tb=5*1024*1024*1024*1024,wl=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 ml(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new ml(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!D6(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||!w6(r))throw new lm(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 fm(r??new Uint8Array);s.set("x-amz-date",mo(i)),s.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&s.set("x-amz-security-token",this.sessionToken),s.set("authorization",await v6({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 y6(d):d.status===301?new Ai(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 Ai(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(!ds(e))throw new Kn(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 Ai&&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(!ds(e))throw new Kn(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 hs;if(!ds(r))throw new Kn(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 E6({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=fs(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(p=>p.name==="Contents"))h.push({type:"Object",key:f.children.find(p=>p.name==="Key")?.content??"",etag:po(f.children.find(p=>p.name==="ETag")?.content??""),size:parseInt(f.children.find(p=>p.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(p=>p.name==="LastModified")?.content??"invalid")}),s++;h.sort((f,p)=>{let y=f.type==="Object"?f.key:f.prefix,v=p.type==="Object"?p.key:p.prefix;return y>v?1:y<v?-1:0});for(let f of h)yield f;if(c.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=c.children.find(p=>p.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(!ds(e))throw new Kn(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<Lfe)throw new Jt("Part size should be greater than 5MB");if(a>Bfe)throw new Jt("Part size should be less than 6MB");let u=new cm(a),c=new hm({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=Tb),e>Tb)throw new TypeError(`size should not be more than ${Tb}`);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(!ds(e))throw new Kn(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 $fe)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:po(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!ds(r))throw new Kn(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=fs(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:po(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 Ai&&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(!ds(e))throw new Kn(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 S6({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})}};function A6(t){try{let e=lt(t);return sn(Eu(e,"patch"))}catch{let e=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(e){let[,r,n,i]=e;return`${r}.${n}.${Number.parseInt(i)+1}`}return"1.0.1"}}async function O6(t,e){let r=A6(t),n=e?` for ${e}`:"",i=await gn({message:`How do you want to handle the version${n}?`,options:[{value:"auto",label:`Auto: Bump patch version (${t} \u2192 ${r})`},{value:"manual",label:"Manual: I'll provide the version number"}]});if(st(i))return null;if(i==="auto")return g.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let s=await Ti({message:`Current version is ${t}. Enter new version:`,validate:o=>{if(!o)return"Version is required";if(!o.match(/^\d+\.\d+\.\d+/))return"Please enter a valid version (x.y.z)"}});return st(s)?null:s}function x6(t){let e=A6(t);try{let r=lt(t);return[e,sn(Eu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var Do=require("node:fs"),dm=require("node:path");function jfe(t,e){return(0,Do.readFileSync)(t,"utf8").includes(e)}function vl(t,e){let r=(0,Do.readdirSync)(t);for(let n of r){let i=(0,dm.join)(t,n),s=(0,Do.statSync)(i);if(s.isDirectory()){if(vl(i,e))return!0}else if(s.isFile()&&(0,dm.extname)(i)===".js"&&jfe(i,e))return!0}return!1}function pm(t){return(0,Do.readdirSync)(t).indexOf("index.html")>-1}var LU=require("node:buffer"),BU=require("node:crypto"),du=require("node:fs"),jU=require("node:os"),Eo=require("node:path"),MU=require("node:process"),bm=require("node:stream/consumers"),UU=require("node:zlib");var qU=Ee($U()),HU=Ee(Kh());async function ede(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var tde=8192;async function rde(t){let e=Lr((0,MU.cwd)()),r=await cs("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?lt(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let i=!ls(n,void 0,void 0,fl);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function nde(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:qU.isMatch(t,r)}async function ide(t,e,r){let i=(0,du.statSync)(t).size,s=await(0,bm.buffer)((0,du.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(nde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<tde)return{buffer:s,useBrotli:!1};try{let o=await(0,bm.buffer)((0,du.createReadStream)(t).pipe((0,UU.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 VU(t,e,r,n,i,s,o=!1){let a=Ct();a.start(i!=="v2"?"Generating the update manifest":`Generating the update manifest with ${o?"V3":"V2"} encryption`);let u=await O8(t);if(i==="v2")for(let c of u)c.hash=o?um(c.hash,s):cu(c.hash,s);return a.stop("Manifest generated successfully"),await _e(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function sde(t){return(0,jU.platform)()!=="win32"?t:Eo.win32.normalize(t).split(Eo.win32.sep).join(Eo.posix.sep)}function ode(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 zU(t,e,r,n,i,s,o){let a=Ct();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Sn(),l=!!(o.partial||o.delta||o.partialOnly||o.deltaOnly),{version:h,supportsBrotliV2:d}=await rde(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 ${S8} (v5), ${A8} (v6) or ${fl} (v7) or higher.`);let f=e.filter(E=>E.file.includes(" "));if(f.length>0)throw new Error(`Files with spaces in their names (${f.map(E=>E.file).join(", ")}). Please rename the files.`);let p=0,y=e.length,v=0;try{a.message(`Uploading ${y} files using TUS protocol`);let E=async C=>{let F=(0,Eo.join)(r,C.file),b=sde(C.file),k,R=!1;if(o.disableBrotli)k=await(0,bm.buffer)((0,du.createReadStream)(F)),R=!1;else{let S=await ide(F,b,o);k=S.buffer,R=S.useBrotli}let I=k;s&&(I=uu(k,s.sessionKey,s.ivSessionKey));let B=b;R&&(B=`${b}.br`,v++);let j=ode(B),z=(0,BU.createHash)("sha256").update(C.hash).digest("hex"),L;if(s){let S=LU.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${S}/${z}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${z}_${j}`;return!s&&await ede(c,L)?(p++,Promise.resolve({file_name:j,s3_path:L,file_hash:C.hash})):new Promise((S,T)=>{a.message(`Prepare upload partial file: ${b}`),new HU.Upload(I,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:o.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:L},headers:{Authorization:t},onError:$=>{let q=$.toString(),M;try{let U=q.match(/response text: (\{.*?\})/);U&&U[1]&&(M=JSON.parse(U[1]).moreInfo?.requestId)}catch{}let G=M?` [requestId: ${M}]`:"";g.error(`Failed to upload ${b}: ${q}${G}`),T($)},onProgress(){let $=(p/y*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){p++,S({file_name:j,s3_path:L,file_hash:C.hash})}}).start()})},A=500,m=[];for(let C=0;C<e.length;C+=A){let F=e.slice(C,C+A),b=Math.floor(C/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${b}/${k} (${F.length} files)`);let R=await Promise.all(F.map(I=>E(I)));m.push(...R)}let w=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${w} seconds)`),v>0&&g.info(`${v} of ${y} files were compressed with brotli and use .br extension`),await _e(t,{channel:"app",event:`App Partial TUS done${v>0?" with .br extension":""}`,icon:"\u23EB",user_id:i,tags:{"app-id":n},notify:!1}),await _e(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":n,time:w},notify:!1}),m}catch(E){let m=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload Partial bundle (after ${m} seconds)`),l)throw g.error(`Error uploading partial update: ${E}`),g.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return g.info(`Error uploading partial update: ${E}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function ut(t){throw g.error(t),new Error(t)}async function ade(t,e){let r=us("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,KU.randomUUID)().split("-")[0]}`;return ru.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ude(t){let e=t.apikey||re();return e||ut("Missing API key, you need to provide an API key to upload your bundle"),e}function cde(t,e,r){let n=Le(t,r),i=e.path||r?.webDir;return n||ut("Missing argument, you need to provide a appid or be in a capacitor project"),i||ut("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,bo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function lde(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(vl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
338
+ If you are sure your app has this code, you can use the --no-code-check option`),pm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function fde(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 v=Ct();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await em(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(m=>!ho(m)))v.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:m}=c.version;(!m||!ru.test(m))&&ut("Invalid remote min update version, skipping auto setting compatibility"),u=m,v.stop(`Auto set min-update-version to ${u}`)}catch{ut(`Cannot auto set compatibility, invalid data ${c}`)}else v.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 yb(r.packageJson,r.nodeModules),a&&(u=s,g.info(`Auto set min-update-version to ${u}`)));h&&!u&&!o&&ut("You need to provide a min-update-version to upload a bundle to this channel"),u&&(ru.test(u)||ut(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let p=d?new Map(d.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:p.size>0||!r.ignoreMetadataCheck?Array.from(p,([v,E])=>({name:v,version:E.version})):void 0,minUpdateVersion:u}}async function hde(t,e,r,n=!1,i=!1){let{data:s,error:o}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(s||o){if(n)return g.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){g.error(`\u274C Version ${r} already exists`);let a=x6(r);g.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{g.info(` ${h+1}. ${l}`)});let u=await gn({message:"What would you like to do?",options:[{value:"suggest1",label:`Use ${a[0]}`},{value:"suggest2",label:`Use ${a[1]}`},{value:"suggest3",label:`Use ${a[2]}`},{value:"suggest4",label:`Use ${a[3]}`},{value:"custom",label:"Enter a custom version"},{value:"cancel",label:"Cancel upload"}]});(st(u)||u==="cancel")&&ut("Upload cancelled by user");let c;if(u==="custom"){let l=await O6(r,"upload");l||ut("Upload cancelled by user"),c=l}else{let l=Number.parseInt(u.replace("suggest",""))-1;c=a[l]}return g.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function dde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",p="",y=e.keyV2,v=e.key===!1,E=Ct();E.start(`Zipping bundle from ${t}`),h=await Jp(t),E.message("Calculating checksum");let A=Lr((0,_m.cwd)()),m=await cs("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=m?lt(m):void 0}catch{w=void 0}if(m?w?D=!ls(w,fl):(m==="link:@capgo/capacitor-updater"||m==="file:.."||m==="file:../")&&(g.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),D=!0):ut("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(y||e.keyDataV2||(0,bo.existsSync)($r))&&!v||D?l=await ii(h,"sha256"):l=await ii(h,"crc32"),E.stop(`Checksum ${D?"SHA256":"CRC32"}: ${l}`),v)g.info("Encryption ignored");else if((y||(0,bo.existsSync)($r)||e.keyDataV2)&&!e.oldEncryption){let b=typeof y=="string"?y:$r,k=e.keyDataV2||"";!k&&!(0,bo.existsSync)(b)&&ut(`Cannot find private key ${b}`),await _e(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":i},notify:!1},e.verbose),k||(k=(0,bo.readFileSync)(b).toString());let R=w&&!ls(w,"5.30.0","6.30.0","7.30.0");g.info(`Encrypting your bundle with ${R?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:B}=am(k),j=uu(h,I,B);l=R?um(l,k):cu(l,k),u=B,c=I,d="v2",f=k,a&&(p=d6(a),e.verbose&&g.info(`[Verbose] Encryption key_id: ${p}`)),e.displayIvSession&&g.info(`Your Iv Session key is ${u},
339
339
  keep it safe, you will need it to decrypt your bundle.
340
340
  It will be also visible in your dashboard
341
341
  `),h=j}let C=Math.floor((h?.byteLength??0)/1024/1024),F=Math.floor(s/1024/1024);return h?.byteLength>s?ut(`The bundle size is ${C} Mb, this is greater than the maximum upload length ${F} Mb, please reduce the size of your bundle`):h?.byteLength>o?(g.warn(`WARNING !!
342
342
  The bundle size is ${C} Mb, this may take a while to download for users
343
343
  `),g.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
344
- `),e.verbose&&(g.info("[Verbose] Bundle size details:"),g.info(` - Actual size: ${C} MB (${h?.byteLength} bytes)`),g.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),g.info(` - Maximum allowed: ${F} MB`),g.info("[Verbose] Sending 'App Too Large' event to analytics...")),await _e(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: ${C} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&g.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:h,ivSessionKey:u,sessionKey:c,checksum:l,encryptionMethod:d,finalKeyData:f,keyId:m}}async function pde(t,e,r,n,i,s,o,a){let u=Ct();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
345
- Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();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 x8(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 _8(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||mb}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,v=setTimeout(()=>y.abort(),o.timeout||mb);try{let E=await fetch(m,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}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 v=f.message.match(/status: (\d+)/),E=v?v[1]:"unknown";g.error(`Upload failed with status ${E}: ${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 _e(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 mde(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 gde(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||ut("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 Zp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&ut(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let m=`${u.hostWeb}/app/${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 yde(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/${t}/info`),null):i.default_upload_channel}async function Kb(t,e,r=!1){r||ae(`Uploading with CLI version ${Ui.version}`);let n,i=qn();await Xe();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=ude(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 g8();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:v}=cde(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${v}`);let E=await ade(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",p="none";e.autoSetBundle&&(await m8({version:E}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),lde(e,v),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();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 C=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${C}`);let F=e.channel||await yde(y,w,D.hostWeb)||"production";e.verbose&&g.info(`[Verbose] Target channel: ${F}`);let b=await Rr(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await v8(w,b,Ui.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await b8(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 ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await fde(w,i,e,F,y,E);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 ${E} already exists...`);let I=!r,B=await hde(w,y,E,e.versionExistsOk,I);if(e.verbose&&g.info(`[Verbose] Version exists check: ${B?typeof B=="string"?`retry with ${B}`:"yes (skipping)":"no (continuing)"}`),B===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:p,storageProvider:A};if(typeof B=="string")return g.info(`Retrying upload with new version: ${B}`),Kb(t,{...e,bundle:B},r);e.external&&!e.external.startsWith("https://")&&ut(`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:E,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:C,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},z=null,L="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await _e(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: ${v}`);let H=f.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:te,ivSessionKey:x,checksum:O,sessionKey:V,encryptionMethod:N,finalKeyData:ne,keyId:K}=await dde(v,e,d,b,y,m.maxUploadLength,m.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=K||void 0,n=V,z=te,p=N,L=ne,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${O}`),g.info(` - Encryption: ${N}`),g.info(` - IV Session Key: ${x?"present":"none"}`),g.info(` - Key ID: ${K||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await F8(w,y,F,O),e.verbose&&g.info("[Verbose] Checksum is unique"))}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"&&ut("You cannot encrypt the partial update if you are not using the v2 encryption method");let S="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&p==="v2"&&!e.encryptPartial){let H=Lr((0,_m.cwd)()),te=await cs("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&P_(x,lt("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||p==="v2")){let H=Lr((0,_m.cwd)()),te=await cs("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!ls(x,S,T,P),e.verbose&&$&&g.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await VU(v,d,b,y,e.encryptPartial?p:"none",L,$):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:M}=await gb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),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`),z&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&ut("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=h?`https://${c}`:`http://${c}`,te=new wl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${y}-${E}`,O=encodeURIComponent(x);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(z)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await pde(d,w,y,E,b,z,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let x=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: ${q.length}`),g.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await zU(d,q,v,y,b,x,e):null,e.verbose&&H&&g.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(x)}. 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(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await gb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let G=await Et(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${nu(G,2)?"yes":"no"}`),g.info(` - Write: ${nu(G,3)?"yes":"no"}`),g.info(` - Admin: ${nu(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&nu(G,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await mde(w,y,F)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),nu(G,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await gde(w,d,!!e.bundleUrl,E,F,C,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 _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let U={success:!0,bundle:E,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: ${U.bundle}`),g.info(` - Checksum: ${U.checksum}`),g.info(` - Encryption: ${U.encryptionMethod}`),g.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var GU=require("node:crypto"),Cm=require("node:fs"),WU=require("node:process");var Dde=20;function wde(t){console.log(JSON.stringify(t,null,2))}function Sl(t){console.error(W(t))}async function XU(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Xe();let a=await de(),u=Le(t,a?.config),c=(0,GU.randomUUID)().split("-")[0],l=us("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!ru.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Sl({error:"invalid_semver"}):g.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Sl({error:"missing_argument"}):g.error(C)),new Error(C)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!vl(s,"notifyAppReady"))throw r||(n?Sl({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(!pm(s))throw r||(n?Sl({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 Jp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ct():null;f&&f.start("Calculating checksum");let m=Lr((0,WU.cwd)()),y=await cs("@capgo/capacitor-updater",m,e.packageJson);if(!y){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(C),new Error(C)}let v=!1,E;try{E=y?lt(y):void 0}catch{E=void 0}E?v=!ls(E,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ii(d,e.keyV2||(0,Cm.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let p=Math.floor(d.byteLength/1024/1024);p>Dde&&o&&(g.warn(`WARNING !!
346
- The bundle size is ${p} Mb, this may take a while to download for users
344
+ `),e.verbose&&(g.info("[Verbose] Bundle size details:"),g.info(` - Actual size: ${C} MB (${h?.byteLength} bytes)`),g.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),g.info(` - Maximum allowed: ${F} MB`),g.info("[Verbose] Sending 'App Too Large' event to analytics...")),await _e(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: ${C} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&g.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:h,ivSessionKey:u,sessionKey:c,checksum:l,encryptionMethod:d,finalKeyData:f,keyId:p}}async function pde(t,e,r,n,i,s,o,a){let u=Ct();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
345
+ Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&g.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();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 x8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&g.info("[Verbose] TUS upload completed, updating database with R2 path...");let p=`orgs/${i}/apps/${r}/${n}.zip`,{error:y}=await e.from("app_versions").update({r2_path:p}).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: ${p}`)}else{o.verbose&&g.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let p=await _8(e,r,n);if(!p)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||mb}ms`),g.info(" - Retry attempts: 5"),g.info(" - Content-Type: application/zip"));let y=new AbortController,v=setTimeout(()=>y.abort(),o.timeout||mb);try{let E=await fetch(p,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:y.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}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 v=f.message.match(/status: (\d+)/),E=v?v[1]:"unknown";g.error(`Upload failed with status ${E}: ${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 _e(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 mde(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 gde(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||ut("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 Zp(t,{name:i,app_id:a,created_by:s,version:l,owner_org:o,...c?{allow_device_self_set:!0}:{}});d&&ut(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${W(d)}`);let p=`${u.hostWeb}/app/${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: ${p}`),r&&g.info(`Bundle url: ${p}`)}else g.warn("The upload key is not allowed to set the version in the channel")}async function yde(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/${t}/info`),null):i.default_upload_channel}async function Kb(t,e,r=!1){r||ae(`Uploading with CLI version ${Ui.version}`);let n,i=qn();await Xe();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=ude(e);e.verbose&&g.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&g.info("[Verbose] Capacitor config loaded successfully");let p=await g8();e.verbose&&(g.info("[Verbose] Remote file config retrieved:"),g.info(` - Max upload length: ${Math.floor(p.maxUploadLength/1024/1024)} MB`),g.info(` - Alert upload size: ${Math.floor(p.alertUploadSize/1024/1024)} MB`),g.info(` - TUS upload: ${p.TUSUpload?"enabled":"disabled"}`),g.info(` - TUS upload forced: ${p.TUSUploadForced?"yes":"no"}`),g.info(` - Partial upload: ${p.partialUpload?"enabled":"disabled"}`),g.info(` - Max chunk size: ${Math.floor(p.maxChunkSize/1024/1024)} MB`));let{appid:y,path:v}=cde(t,e,f.config);e.verbose&&g.info(`[Verbose] App ID: ${y}, Build path: ${v}`);let E=await ade(f.config,e);e.verbose&&g.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",m="none";e.autoSetBundle&&(await m8({version:E}),e.verbose&&g.info("[Verbose] Auto-set bundle version in capacitor.config.json")),lde(e,v),e.verbose&&g.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),g.info(`Upload ${y}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();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 C=await De(w,d,["write","all","upload"]);e.verbose&&g.info(`[Verbose] User verified successfully, user_id: ${C}`);let F=e.channel||await yde(y,w,D.hostWeb)||"production";e.verbose&&g.info(`[Verbose] Target channel: ${F}`);let b=await Rr(w,y);e.verbose&&g.info(`[Verbose] Organization ID: ${b}`),await v8(w,b,Ui.version),e.verbose&&g.info("[Verbose] Remote CLI messages checked"),await b8(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 ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await fde(w,i,e,F,y,E);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 ${E} already exists...`);let I=!r,B=await hde(w,y,E,e.versionExistsOk,I);if(e.verbose&&g.info(`[Verbose] Version exists check: ${B?typeof B=="string"?`retry with ${B}`:"yes (skipping)":"no (continuing)"}`),B===!0)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:E,checksum:null,encryptionMethod:m,storageProvider:A};if(typeof B=="string")return g.info(`Retrying upload with new version: ${B}`),Kb(t,{...e,bundle:B},r);e.external&&!e.external.startsWith("https://")&&ut(`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:E,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:C,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},z=null,L="";if(e.external)e.verbose&&g.info(`[Verbose] Using external URL: ${e.external}`),await _e(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: ${v}`);let H=f.config?.plugins?.CapacitorUpdater?.publicKey,{zipped:te,ivSessionKey:x,checksum:O,sessionKey:V,encryptionMethod:N,finalKeyData:ne,keyId:K}=await dde(v,e,d,b,y,p.maxUploadLength,p.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=K||void 0,n=V,z=te,m=N,L=ne,e.verbose&&(g.info("[Verbose] Bundle prepared:"),g.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),g.info(` - Checksum: ${O}`),g.info(` - Encryption: ${N}`),g.info(` - IV Session Key: ${x?"present":"none"}`),g.info(` - Key ID: ${K||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&g.info("[Verbose] Checking for duplicate checksum..."),await F8(w,y,F,O),e.verbose&&g.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!p.TUSUpload||e.external?(e.tus=!1,e.verbose&&g.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||p.TUSUploadForced,e.verbose&&g.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!p.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||p.partialUploadForced,e.verbose&&g.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&m==="v1"&&ut("You cannot encrypt the partial update if you are not using the v2 encryption method");let S="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&m==="v2"&&!e.encryptPartial){let H=Lr((0,_m.cwd)()),te=await cs("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&P_(x,lt("6.14.4"))&&(g.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&g.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||m==="v2")){let H=Lr((0,_m.cwd)()),te=await cs("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!ls(x,S,T,P),e.verbose&&$&&g.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&g.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await VU(v,d,b,y,e.encryptPartial?m:"none",L,$):[];e.verbose&&e.delta&&g.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&g.info("[Verbose] Creating version record in database...");let{error:M}=await gb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),e.verbose&&g.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>p.maxChunkSize?(g.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${p.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=p.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=p.maxChunkSize),e.verbose&&g.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),z&&(u||c||s||o||a||l||h)){(!u||!c||!s||!o||!a||!l)&&ut("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=h?`https://${c}`:`http://${c}`,te=new wl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${y}-${E}`,O=encodeURIComponent(x);e.verbose&&g.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(z)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&g.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(z){!e.partialOnly&&!e.deltaOnly?(e.verbose&&g.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await pde(d,w,y,E,b,z,e,e.tusChunkSize)):e.verbose&&g.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&g.info("[Verbose] Dry upload mode: skipping delta upload"));let x=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: ${q.length}`),g.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await zU(d,q,v,y,b,x,e):null,e.verbose&&H&&g.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;g.info(`Failed to upload partial files to capgo cloud. Error: ${W(x)}. 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(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&g.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await gb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&g.info("[Verbose] Version record updated successfully")}e.verbose&&g.info("[Verbose] Checking app permissions...");let G=await Et(w,d,y,2);e.verbose&&(g.info("[Verbose] Permissions:"),g.info(` - Upload: ${nu(G,2)?"yes":"no"}`),g.info(` - Write: ${nu(G,3)?"yes":"no"}`),g.info(` - Admin: ${nu(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&nu(G,3)?(e.verbose&&g.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await mde(w,y,F)):e.deleteLinkedBundleOnUpload&&g.warn("Cannot delete linked bundle on upload as a upload organization member"),nu(G,3)?(e.verbose&&g.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await gde(w,d,!!e.bundleUrl,E,F,C,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 _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:b,tags:{"app-id":y},notify:!1},e.verbose);let U={success:!0,bundle:E,checksum:j.checksum??null,encryptionMethod:m,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: ${U.bundle}`),g.info(` - Checksum: ${U.checksum}`),g.info(` - Encryption: ${U.encryptionMethod}`),g.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var GU=require("node:crypto"),Cm=require("node:fs"),WU=require("node:process");var Dde=20;function wde(t){console.log(JSON.stringify(t,null,2))}function Sl(t){console.error(W(t))}async function XU(t,e,r=!1){let{json:n}=e,{bundle:i,path:s}=e,o=!n&&!r;try{o&&await Xe();let a=await de(),u=Le(t,a?.config),c=(0,GU.randomUUID)().split("-")[0],l=us("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!ru.test(i)){let C=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Sl({error:"invalid_semver"}):g.error(C)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let C="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Sl({error:"missing_argument"}):g.error(C)),new Error(C)}if(o&&g.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!vl(s,"notifyAppReady"))throw r||(n?Sl({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(!pm(s))throw r||(n?Sl({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 Jp(s);o&&g.info(`Zipped ${d.byteLength} bytes`);let f=o?Ct():null;f&&f.start("Calculating checksum");let p=Lr((0,WU.cwd)()),y=await cs("@capgo/capacitor-updater",p,e.packageJson);if(!y){let C="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||g.warn(C),new Error(C)}let v=!1,E;try{E=y?lt(y):void 0}catch{E=void 0}E?v=!ls(E,void 0,void 0,"7.0.0"):y==="link:@capgo/capacitor-updater"&&(r||g.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ii(d,e.keyV2||(0,Cm.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let m=Math.floor(d.byteLength/1024/1024);m>Dde&&o&&(g.warn(`WARNING !!
346
+ The bundle size is ${m} Mb, this may take a while to download for users
347
347
  `),g.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
348
348
  `));let D=o?Ct():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&&le("Done \u2705"),!r&&n&&wde({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?Sl(a):g.error(W(a))),a instanceof Error?a:new Error(String(a))}}async function YU(t,e,r,n=!1){n||ae("Create channel"),r.apikey=r.apikey||re();let i=await de().catch(()=>{});if(e=Le(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 Et(s,r.apikey,e,4,n),n||g.info(`Creating channel ${e}#${t} to Capgo`);let o=await wb(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 Rr(s,e),u=await De(s,r.apikey,["write","all"]),c=await N8(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}
349
- ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await _e(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"),le("Done \u2705")),c.data??!0}async function JU(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&ae("List current bundle"),r.apikey=r.apikey||re(i);let s=await de();if(e=Le(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 Et(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 ZU(t,e,r,n=!1){n||ae("Delete channel"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await j8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await vb(s,e,d.name)}let{data:a,error:u}=await L8(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 B8(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 $8(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 Rr(s,e);return await _e(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"),le("Done \u2705")),!0}async function QU(t,e,r=!1){r||ae("List channels"),e.apikey=e.apikey||re();let n=await de();if(t=Le(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 Et(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await U8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),M8(o)),await _e(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||le("Done \u2705"),o}var eq=["major","minor","metadata","patch","none"];async function tq(t,e,r,n=!1){n||ae("Set channel"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(s,r.apikey,e,4,n);let a=await Rr(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:m,selfAssign:y,disableAutoUpdate:v,dev:E,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&&E==null&&A==null&&v==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await E8(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||us("",r.packageJson):u;if(w!=null){let{data:F,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||!F)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await Db(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!ho(B)))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=F.id}if(d){let{data:F,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||!F)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await Db(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!ho(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 @${F.name}`),p.version=F.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),E!=null&&(n||g.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),p.allow_dev=!!E),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),p.allow_emulator=!!A),v!=null){let F=v.toLowerCase();if(!eq.includes(F))throw n||g.error(`Channel strategy ${F} is not known. The possible values are: ${eq.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),p.disable_auto_update=F,n||g.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:C}=await Zp(s,p);if(C)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 _e(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||le("Done \u2705"),!0}var dr=require("node:fs");function rq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function nq(t,e=!1){e||ae("Save keys \u{1F511}");let r=await de(),n=t.key||Ei,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=rq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({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 Xa(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 iq(t,e=!1){e||ae("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xa(r),(0,dr.existsSync)(tu))try{(0,dr.unlinkSync)(tu),e||g.success(`Old private key file deleted: ${tu}`)}catch(i){e||g.error(`Failed to delete old private key file: ${tu} (${String(i)})`)}if((0,dr.existsSync)(Wp))try{(0,dr.unlinkSync)(Wp),e||g.success(`Old public key file deleted: ${Wp}`)}catch(i){e||g.error(`Failed to delete old public key file: ${Ei} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function sq(t,e=!1){e||ae("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=f6();if((0,dr.existsSync)(Ei)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(Ei,r),(0,dr.existsSync)($r)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)($r,n);let i=await de();if(i){let s=rq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({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 Xa(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${$r}`),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 R8(),le("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var _o=require("node:fs"),oq=require("node:os");async function aq(t,e,r=!1){if(r||ae("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 Xe();let{local:n}=e;if(n){if(!(0,_o.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,_o.writeFileSync)(".capgo",`${t}
349
+ ${W(c.error)}`),new Error(`Cannot create channel: ${W(c.error)}`);return await _e(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"),le("Done \u2705")),c.data??!0}async function JU(t,e,r,n=!1){let{quiet:i}=r;!i&&!n&&ae("List current bundle"),r.apikey=r.apikey||re(i);let s=await de();if(e=Le(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 Et(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 ZU(t,e,r,n=!1){n||ae("Delete channel"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(s,r.apikey,e,4,n),r.deleteBundle&&!n&&g.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await j8(s,e,t);d?.name&&!n&&g.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await vb(s,e,d.name)}let{data:a,error:u}=await L8(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 B8(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 $8(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 Rr(s,e);return await _e(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"),le("Done \u2705")),!0}async function QU(t,e,r=!1){r||ae("List channels"),e.apikey=e.apikey||re();let n=await de();if(t=Le(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 Et(i,e.apikey,t,1,r),r||g.info("Querying available channels in Capgo");let o=await U8(i,t);return r||(g.info(`Active channels in Capgo: ${o?.length??0}`),M8(o)),await _e(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:s,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||le("Done \u2705"),o}var eq=["major","minor","metadata","patch","none"];async function tq(t,e,r,n=!1){n||ae("Set channel"),r.apikey=r.apikey||re();let i=await de();if(e=Le(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 Et(s,r.apikey,e,4,n);let a=await Rr(s,e),{bundle:u,state:c,downgrade:l,latest:h,latestRemote:d,ios:f,android:p,selfAssign:y,disableAutoUpdate:v,dev:E,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&&p==null&&y==null&&E==null&&A==null&&v==null)throw n||g.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await E8(s,a,r.apikey,e);let m={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||us("",r.packageJson):u;if(w!=null){let{data:F,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||!F)throw n||g.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await Db(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!ho(B)))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}`),m.version=F.id}if(d){let{data:F,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||!F)throw n||g.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await Db(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!ho(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 @${F.name}`),m.version=F.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}`),m.public=c==="default"}if(l!=null&&(n||g.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),m.disable_auto_update_under_native=!l),f!=null&&(n||g.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),m.ios=!!f),p!=null&&(n||g.info(`Set ${e} channel: ${t} to ${p?"allow":"disallow"} android update`),m.android=!!p),y!=null&&(n||g.info(`Set ${e} channel: ${t} to ${y?"allow":"disallow"} self assign to this channel`),m.allow_device_self_set=!!y),E!=null&&(n||g.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),m.allow_dev=!!E),A!=null&&(n||g.info(`Set ${e} channel: ${t} to ${A?"allow":"disallow"} emulator devices`),m.allow_emulator=!!A),v!=null){let F=v.toLowerCase();if(!eq.includes(F))throw n||g.error(`Channel strategy ${F} is not known. The possible values are: ${eq.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),m.disable_auto_update=F,n||g.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:C}=await Zp(s,m);if(C)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 _e(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||le("Done \u2705"),!0}var dr=require("node:fs");function rq(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function nq(t,e=!1){e||ae("Save keys \u{1F511}");let r=await de(),n=t.key||Ei,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=rq(r.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({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 Xa(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 iq(t,e=!1){e||ae("Deleting old private key \u{1F5D1}\uFE0F");let r=await de(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xa(r),(0,dr.existsSync)(tu))try{(0,dr.unlinkSync)(tu),e||g.success(`Old private key file deleted: ${tu}`)}catch(i){e||g.error(`Failed to delete old private key file: ${tu} (${String(i)})`)}if((0,dr.existsSync)(Wp))try{(0,dr.unlinkSync)(Wp),e||g.success(`Old public key file deleted: ${Wp}`)}catch(i){e||g.error(`Failed to delete old public key file: ${Ei} (${String(i)})`)}return e||(g.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||g.info("No old private key found in config file"),!1}async function sq(t,e=!1){e||ae("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=f6();if((0,dr.existsSync)(Ei)&&!t.force)throw e||g.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(Ei,r),(0,dr.existsSync)($r)&&!t.force)throw e||g.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,dr.writeFileSync)($r,n);let i=await de();if(i){let s=rq(i.config);s.privateKey&&(delete s.privateKey,e||g.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await Pr({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 Xa(i)}if(!e){g.success("Your RSA key has been generated"),g.success(`Private key saved in ${$r}`),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 R8(),le("Done \u2705")}catch(s){if(s instanceof Error&&s.message==="Capacitor sync cancelled")return!0;throw s}}return!0}var _o=require("node:fs"),oq=require("node:os");async function aq(t,e,r=!1){if(r||ae("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 Xe();let{local:n}=e;if(n){if(!(0,_o.existsSync)(".git"))throw r||g.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,_o.writeFileSync)(".capgo",`${t}
350
350
  `),(0,_o.appendFileSync)(".gitignore",`.capgo
351
351
  `)}else{let o=(0,oq.homedir)();(0,_o.writeFileSync)(`${o}/.capgo`,`${t}
352
352
  `)}let i=await pe(t,e.supaHost,e.supaAnon),s=await De(i,t,["write","all","upload"]);await _e(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`),le("Done \u2705"))}async function uq(t,e=!1){e||ae("Adding organization"),await Xe();let r={...t,apikey:t.apikey||re()};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 Ti({message:"Organization name:",placeholder:"My Organization"});if(st(c))throw g.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await Ti({message:"Management email:",placeholder:"admin@example.com"});if(st(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 _e(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`),le("Done \u2705")),a}async function cq(t,e,r=!1){r||ae("Deleting organization"),await Xe();let n={...e,apikey:e.apikey||re()};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 gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(c)||c==="no")throw g.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}if(!r&&!n.autoConfirm){let c=await Pr({message:`Are you sure you want to delete organization "${o.name}"? This action cannot be undone.`});if(st(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 _e(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`),le("Done \u2705")),!0}function vde(t,e){if(e)return;if(!t.length){g.error("No organizations found");return}let r=new zt;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 lq(t,e=!1){e||ae("List organizations"),await Xe();let r={...t,apikey:t.apikey||re()};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}`),vde(o,e),le("Done \u2705")),o}async function fq(t,e,r=!1){r||ae("Updating organization"),await Xe();let n={...e,apikey:e.apikey||re()};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 Ti({message:"New organization name:",placeholder:s.name||"My Organization"});if(st(l))throw g.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await Ti({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(st(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 _e(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"),le("Done \u2705")),{orgId:t,name:a,email:u}}async function hq(t,e=!1){e||ae("Getting user id");let r={...t,apikey:t.apikey||re()};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||le(`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 nt=class{apikey;supaHost;supaAnon;constructor(e){this.apikey=e?.apikey,this.supaHost=e?.supaHost,this.supaAnon=e?.supaAnon}async login(e){try{return await aq(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 X8({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||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon};return await z8(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||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,icon:e.icon,retention:e.retention};return await Z8(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||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await K8(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||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await Y8(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||re(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:await hq(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||re(!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 a6(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 g6(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 p6(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 XU(e.appId,{apikey:this.apikey||re(!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||re(!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 Kb(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||re(!0),n=await pe(r,this.supaHost,this.supaAnon);return{success:!0,data:(await rm(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||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:r};return await m6(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||re(!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 o6(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||re(!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 s6(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||re(!0),quiet:!0,supaHost:n?.supaHost||this.supaHost,supaAnon:n?.supaAnon||this.supaAnon};return{success:!0,data:await JU(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||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,default:e.default,selfAssign:e.selfAssign};return await YU(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||re(!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 tq(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||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:n,successIfNotFound:!1};return await ZU(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||re(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await QU(e,r,!0)}}catch(r){return{success:!1,error:r instanceof Error?r.message:String(r)}}}async generateEncryptionKeys(e){try{return await sq({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 nq({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 iq({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||re(!0),supaHost:e?.supaHost||this.supaHost,supaAnon:e?.supaAnon||this.supaAnon};return{success:!0,data:(await lq(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||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await uq(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||re(!0),supaHost:e.supaHost||this.supaHost,supaAnon:e.supaAnon||this.supaAnon,name:e.name,email:e.email},n=await fq(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||re(!0),supaHost:r?.supaHost||this.supaHost,supaAnon:r?.supaAnon||this.supaAnon,autoConfirm:r?.autoConfirm??!0};return{success:!0,data:{deleted:await cq(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||re(!0),n=await Sn(),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 Q8(e,{apikey:r.apikey||this.apikey||re(!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 Ede(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function bde(t){return new nt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function _de(t){return new nt().doctor(t)}async function Cde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Sde(t){return new nt().encryptBundle(t)}async function Ade(t){return new nt().decryptBundle(t)}async function Ode(t){return new nt().zipBundle(t)}async function xde(t){return new nt().generateEncryptionKeys(t)}async function Tde(t){return new nt().saveEncryptionKey(t)}async function Ide(t){return new nt().deleteLegacyEncryptionKey(t)}async function Pde(t,e,r){return new nt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Fde(t,e){return new nt({apikey:e.apikey}).setAppSetting(t,e)}async function Rde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function kde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function Nde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function $de(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function Lde(t,e){return new nt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function Bde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function jde(t,e){return new nt(e).listBundles(t)}async function Mde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function Ude(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function qde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function Hde(){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});