@capgo/cli 7.56.3 → 7.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +22 -22
- package/dist/package.json +1 -1
- package/dist/src/api/channels.d.ts +6 -0
- package/dist/src/api/channels.d.ts.map +1 -1
- package/dist/src/api/versions.d.ts +2 -0
- package/dist/src/api/versions.d.ts.map +1 -1
- package/dist/src/bundle/list.d.ts +1 -0
- package/dist/src/bundle/list.d.ts.map +1 -1
- package/dist/src/bundle/upload.d.ts.map +1 -1
- package/dist/src/channel/add.d.ts.map +1 -1
- package/dist/src/sdk.js +60 -60
- package/dist/src/types/supabase.types.d.ts +3 -0
- package/dist/src/types/supabase.types.d.ts.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/src/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var pq=Object.create;var Sl=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 C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sm=(t,e)=>{for(var r in e)Sl(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&&Sl(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?Sl(r,"default",{value:t,enumerable:!0}):r,t)),ce=t=>Xb(Sl({},"__esModule",{value:!0}),t);var Ze=C((zde,Yb)=>{"use strict";var Am={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?Am.up():"");return t&&(e+=Am.left),e}};Yb.exports={cursor:Am,scroll:wq,erase:vq,beep:"\x07"}});var xm=C((Kde,Om)=>{var Ol=process||{},Jb=Ol.argv||[],Al=Ol.env||{},Eq=!(Al.NO_COLOR||Jb.includes("--no-color"))&&(!!Al.FORCE_COLOR||Jb.includes("--color")||Ol.platform==="win32"||(Ol.stdout||{}).isTTY&&Al.TERM!=="dumb"||!!Al.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")}};Om.exports=Zb();Om.exports.createColors=Zb});var $l=C(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.isNXMonorepo=gr.isMonorepo=gr.findPackageRelativePathInMonorepo=gr.findPackagePath=gr.findNXMonorepoRoot=gr.findMonorepoRoot=void 0;var gu=require("node:fs"),Ti=require("node:path");function Nl(t){let e=(0,Ti.join)(t,"package.json"),r=(0,Ti.join)(t,"pnpm-workspace.yaml");if((0,gu.existsSync)(r)||(0,gu.existsSync)(e)&&JSON.parse((0,gu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ti.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Nl(n)}gr.findMonorepoRoot=Nl;function Um(t){let e=(0,Ti.join)(t,"nx.json");if((0,gu.existsSync)(e))return t;let r=(0,Ti.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Um(r)}gr.findNXMonorepoRoot=Um;function qm(t,e,r){let n=(0,Ti.join)(e,"node_modules",t);if((0,gu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ti.dirname)(e);return qm(t,i,r)}gr.findPackagePath=qm;function t4(t,e){let r=Nl(e),n=qm(t,e,r);return n?(0,Ti.relative)(e,n):null}gr.findPackageRelativePathInMonorepo=t4;function r4(t){try{return Nl(t),!0}catch{return!1}}gr.isMonorepo=r4;function n4(t){try{return Um(t),!0}catch{return!1}}gr.isNXMonorepo=n4});var fe={};Sm(fe,{__addDisposableResource:()=>rC,__assign:()=>Hl,__asyncDelegator:()=>W_,__asyncGenerator:()=>G_,__asyncValues:()=>X_,__await:()=>Ao,__awaiter:()=>U_,__classPrivateFieldGet:()=>Q_,__classPrivateFieldIn:()=>tC,__classPrivateFieldSet:()=>eC,__createBinding:()=>zl,__decorate:()=>k_,__disposeResources:()=>nC,__esDecorate:()=>$_,__exportStar:()=>H_,__extends:()=>F_,__generator:()=>q_,__importDefault:()=>Z_,__importStar:()=>J_,__makeTemplateObject:()=>Y_,__metadata:()=>M_,__param:()=>N_,__propKey:()=>B_,__read:()=>Jm,__rest:()=>R_,__rewriteRelativeImportExtension:()=>iC,__runInitializers:()=>L_,__setFunctionName:()=>j_,__spread:()=>V_,__spreadArray:()=>K_,__spreadArrays:()=>z_,__values:()=>Vl,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");Xm(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 g in n)p[g]=g==="access"?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];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)&&zl(e,t,r)}function Vl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function V_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Jm(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 Ao(t){return this instanceof Ao?(this.v=t,this):new Ao(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(g){return new Promise(function(v,E){s.push([f,g,v,E])>1||u(f,g)})},p&&(i[f]=p(i[f])))}function u(f,p){try{c(n[f](p))}catch(g){d(s[0][3],g)}}function c(f){f.value instanceof Ao?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:Ao(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 Vl=="function"?Vl(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=Ym(t),n=0;n<r.length;n++)r[n]!=="default"&&zl(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 Xm,Hl,zl,S4,Ym,A4,O4,he=mr(()=>{Xm=function(t,e){return Xm=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])},Xm(t,e)};Hl=function(){return Hl=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},Hl.apply(this,arguments)};zl=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},Ym=function(t){return Ym=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Ym(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:Hl,__rest:R_,__decorate:k_,__param:N_,__esDecorate:$_,__runInitializers:L_,__propKey:B_,__setFunctionName:j_,__metadata:M_,__awaiter:U_,__generator:q_,__createBinding:zl,__exportStar:H_,__values:Vl,__read:Jm,__spread:V_,__spreadArrays:z_,__spreadArray:K_,__await:Ao,__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=C(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.resolveFetch=void 0;var x4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Kl.resolveFetch=x4});var tg=C(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.FunctionRegion=Ur.FunctionsHttpError=Ur.FunctionsRelayError=Ur.FunctionsFetchError=Ur.FunctionsError=void 0;var Oo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Ur.FunctionsError=Oo;var Zm=class extends Oo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Ur.FunctionsFetchError=Zm;var Qm=class extends Oo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Ur.FunctionsRelayError=Qm;var eg=class extends Oo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Ur.FunctionsHttpError=eg;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=C(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.FunctionsClient=void 0;var T4=(he(),ce(fe)),I4=sC(),xo=tg(),rg=class{constructor(e,{headers:r={},customFetch:n,region:i=xo.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 g;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",g=c):typeof c=="string"?(d["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(d["Content-Type"]="application/json",g=JSON.stringify(c)):g=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:g,signal:v}).catch(w=>{throw new xo.FunctionsFetchError(w)}),A=E.headers.get("x-relay-error");if(A&&A==="true")throw new xo.FunctionsRelayError(E);if(!E.ok)throw new xo.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 xo.FunctionsHttpError||a instanceof xo.FunctionsRelayError?a.context:void 0}}finally{s&&clearTimeout(s)}})}};Gl.FunctionsClient=rg});var ng=C(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 Eu=tg();Object.defineProperty(yr,"FunctionsError",{enumerable:!0,get:function(){return Eu.FunctionsError}});Object.defineProperty(yr,"FunctionsFetchError",{enumerable:!0,get:function(){return Eu.FunctionsFetchError}});Object.defineProperty(yr,"FunctionsHttpError",{enumerable:!0,get:function(){return Eu.FunctionsHttpError}});Object.defineProperty(yr,"FunctionsRelayError",{enumerable:!0,get:function(){return Eu.FunctionsRelayError}});Object.defineProperty(yr,"FunctionRegion",{enumerable:!0,get:function(){return Eu.FunctionRegion}})});var og=C(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var ig=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};sg.default=ig});var cg=C(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});var F4=(he(),ce(fe)),R4=F4.__importDefault(og()),ag=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:"",g=(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 Sl=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 C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Sm=(t,e)=>{for(var r in e)Sl(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&&Sl(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?Sl(r,"default",{value:t,enumerable:!0}):r,t)),ce=t=>Xb(Sl({},"__esModule",{value:!0}),t);var Ze=C((zde,Yb)=>{"use strict";var Am={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?Am.up():"");return t&&(e+=Am.left),e}};Yb.exports={cursor:Am,scroll:wq,erase:vq,beep:"\x07"}});var xm=C((Kde,Om)=>{var Ol=process||{},Jb=Ol.argv||[],Al=Ol.env||{},Eq=!(Al.NO_COLOR||Jb.includes("--no-color"))&&(!!Al.FORCE_COLOR||Jb.includes("--color")||Ol.platform==="win32"||(Ol.stdout||{}).isTTY&&Al.TERM!=="dumb"||!!Al.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")}};Om.exports=Zb();Om.exports.createColors=Zb});var $l=C(gr=>{"use strict";Object.defineProperty(gr,"__esModule",{value:!0});gr.isNXMonorepo=gr.isMonorepo=gr.findPackageRelativePathInMonorepo=gr.findPackagePath=gr.findNXMonorepoRoot=gr.findMonorepoRoot=void 0;var gu=require("node:fs"),Ii=require("node:path");function Nl(t){let e=(0,Ii.join)(t,"package.json"),r=(0,Ii.join)(t,"pnpm-workspace.yaml");if((0,gu.existsSync)(r)||(0,gu.existsSync)(e)&&JSON.parse((0,gu.readFileSync)(e,"utf-8")).workspaces)return t;let n=(0,Ii.dirname)(t);if(n===t)throw new Error("Monorepo root not found");return Nl(n)}gr.findMonorepoRoot=Nl;function Um(t){let e=(0,Ii.join)(t,"nx.json");if((0,gu.existsSync)(e))return t;let r=(0,Ii.dirname)(t);if(r===t)throw new Error("Monorepo root not found");return Um(r)}gr.findNXMonorepoRoot=Um;function qm(t,e,r){let n=(0,Ii.join)(e,"node_modules",t);if((0,gu.existsSync)(n))return n;if(e===r)return null;let i=(0,Ii.dirname)(e);return qm(t,i,r)}gr.findPackagePath=qm;function t4(t,e){let r=Nl(e),n=qm(t,e,r);return n?(0,Ii.relative)(e,n):null}gr.findPackageRelativePathInMonorepo=t4;function r4(t){try{return Nl(t),!0}catch{return!1}}gr.isMonorepo=r4;function n4(t){try{return Um(t),!0}catch{return!1}}gr.isNXMonorepo=n4});var fe={};Sm(fe,{__addDisposableResource:()=>rC,__assign:()=>Hl,__asyncDelegator:()=>W_,__asyncGenerator:()=>G_,__asyncValues:()=>X_,__await:()=>Ao,__awaiter:()=>U_,__classPrivateFieldGet:()=>Q_,__classPrivateFieldIn:()=>tC,__classPrivateFieldSet:()=>eC,__createBinding:()=>zl,__decorate:()=>k_,__disposeResources:()=>nC,__esDecorate:()=>$_,__exportStar:()=>H_,__extends:()=>F_,__generator:()=>q_,__importDefault:()=>Z_,__importStar:()=>J_,__makeTemplateObject:()=>Y_,__metadata:()=>M_,__param:()=>N_,__propKey:()=>B_,__read:()=>Jm,__rest:()=>R_,__rewriteRelativeImportExtension:()=>iC,__runInitializers:()=>L_,__setFunctionName:()=>j_,__spread:()=>V_,__spreadArray:()=>K_,__spreadArrays:()=>z_,__values:()=>Vl,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");Xm(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 g in n)p[g]=g==="access"?{}:n[g];for(var g in n.access)p.access[g]=n.access[g];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)&&zl(e,t,r)}function Vl(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Jm(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return s}function V_(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Jm(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 Ao(t){return this instanceof Ao?(this.v=t,this):new Ao(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(g){return new Promise(function(v,E){s.push([f,g,v,E])>1||u(f,g)})},p&&(i[f]=p(i[f])))}function u(f,p){try{c(n[f](p))}catch(g){d(s[0][3],g)}}function c(f){f.value instanceof Ao?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:Ao(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 Vl=="function"?Vl(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=Ym(t),n=0;n<r.length;n++)r[n]!=="default"&&zl(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 Xm,Hl,zl,S4,Ym,A4,O4,he=mr(()=>{Xm=function(t,e){return Xm=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])},Xm(t,e)};Hl=function(){return Hl=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},Hl.apply(this,arguments)};zl=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},Ym=function(t){return Ym=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},Ym(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:Hl,__rest:R_,__decorate:k_,__param:N_,__esDecorate:$_,__runInitializers:L_,__propKey:B_,__setFunctionName:j_,__metadata:M_,__awaiter:U_,__generator:q_,__createBinding:zl,__exportStar:H_,__values:Vl,__read:Jm,__spread:V_,__spreadArrays:z_,__spreadArray:K_,__await:Ao,__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=C(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});Kl.resolveFetch=void 0;var x4=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);Kl.resolveFetch=x4});var tg=C(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});Ur.FunctionRegion=Ur.FunctionsHttpError=Ur.FunctionsRelayError=Ur.FunctionsFetchError=Ur.FunctionsError=void 0;var Oo=class extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}};Ur.FunctionsError=Oo;var Zm=class extends Oo{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}};Ur.FunctionsFetchError=Zm;var Qm=class extends Oo{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}};Ur.FunctionsRelayError=Qm;var eg=class extends Oo{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}};Ur.FunctionsHttpError=eg;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=C(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});Gl.FunctionsClient=void 0;var T4=(he(),ce(fe)),I4=sC(),xo=tg(),rg=class{constructor(e,{headers:r={},customFetch:n,region:i=xo.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 g;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",g=c):typeof c=="string"?(d["Content-Type"]="text/plain",g=c):typeof FormData<"u"&&c instanceof FormData?g=c:(d["Content-Type"]="application/json",g=JSON.stringify(c)):g=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:g,signal:v}).catch(w=>{throw new xo.FunctionsFetchError(w)}),A=E.headers.get("x-relay-error");if(A&&A==="true")throw new xo.FunctionsRelayError(E);if(!E.ok)throw new xo.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 xo.FunctionsHttpError||a instanceof xo.FunctionsRelayError?a.context:void 0}}finally{s&&clearTimeout(s)}})}};Gl.FunctionsClient=rg});var ng=C(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 Eu=tg();Object.defineProperty(yr,"FunctionsError",{enumerable:!0,get:function(){return Eu.FunctionsError}});Object.defineProperty(yr,"FunctionsFetchError",{enumerable:!0,get:function(){return Eu.FunctionsFetchError}});Object.defineProperty(yr,"FunctionsHttpError",{enumerable:!0,get:function(){return Eu.FunctionsHttpError}});Object.defineProperty(yr,"FunctionsRelayError",{enumerable:!0,get:function(){return Eu.FunctionsRelayError}});Object.defineProperty(yr,"FunctionRegion",{enumerable:!0,get:function(){return Eu.FunctionRegion}})});var og=C(sg=>{"use strict";Object.defineProperty(sg,"__esModule",{value:!0});var ig=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};sg.default=ig});var cg=C(ug=>{"use strict";Object.defineProperty(ug,"__esModule",{value:!0});var F4=(he(),ce(fe)),R4=F4.__importDefault(og()),ag=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:"",g=(a=f?.code)!==null&&a!==void 0?a:"";d=`${(u=s?.name)!==null&&u!==void 0?u:"FetchError"}: ${s?.message}`,d+=`
|
|
2
2
|
|
|
3
3
|
Caused by: ${(c=f?.name)!==null&&c!==void 0?c:"Error"}: ${p}`,g&&(d+=` (${g})`),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}};ug.default=ag});var hg=C(fg=>{"use strict";Object.defineProperty(fg,"__esModule",{value:!0});var k4=(he(),ce(fe)),N4=k4.__importDefault(cg()),lg=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}};fg.default=lg});var Wl=C(pg=>{"use strict";Object.defineProperty(pg,"__esModule",{value:!0});var $4=(he(),ce(fe)),L4=$4.__importDefault(hg()),B4=new RegExp("[,()]"),dg=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}};pg.default=dg});var yg=C(gg=>{"use strict";Object.defineProperty(gg,"__esModule",{value:!0});var j4=(he(),ce(fe)),bu=j4.__importDefault(Wl()),mg=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 bu.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 bu.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 bu.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 bu.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 bu.default({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}};gg.default=mg});var cC=C(wg=>{"use strict";Object.defineProperty(wg,"__esModule",{value:!0});var uC=(he(),ce(fe)),M4=uC.__importDefault(yg()),U4=uC.__importDefault(Wl()),Dg=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})}};wg.default=Dg});var vg=C(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.PostgrestError=tr.PostgrestBuilder=tr.PostgrestTransformBuilder=tr.PostgrestFilterBuilder=tr.PostgrestQueryBuilder=tr.PostgrestClient=void 0;var To=(he(),ce(fe)),lC=To.__importDefault(cC());tr.PostgrestClient=lC.default;var fC=To.__importDefault(yg());tr.PostgrestQueryBuilder=fC.default;var hC=To.__importDefault(Wl());tr.PostgrestFilterBuilder=hC.default;var dC=To.__importDefault(hg());tr.PostgrestTransformBuilder=dC.default;var pC=To.__importDefault(cg());tr.PostgrestBuilder=pC.default;var mC=To.__importDefault(og());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 Eg=C(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});_u.WebSocketFactory=void 0;var Xl=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:
|
|
@@ -23,8 +23,8 @@ 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 Ct.SOCKET_STATES.connecting:return Ct.CONNECTION_STATE.Connecting;case Ct.SOCKET_STATES.open:return Ct.CONNECTION_STATE.Open;case Ct.SOCKET_STATES.closing:return Ct.CONNECTION_STATE.Closing;default:return Ct.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Ct.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(Ct.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},ef.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===Ct.SOCKET_STATES.open||this.conn.readyState===Ct.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(Ct.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:Ct.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(Ct.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()},ef.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:Ct.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:ef.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:Ng,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:Ct.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 Ct.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((p,g)=>g(JSON.stringify(p))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((p,g)=>g(JSON.parse(p)));break;case Ct.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}}};Lg.default=$g});var Bg=C(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 rf=(he(),ce(fe)),c5=rf.__importDefault(xC());Tt.RealtimeClient=c5.default;var Au=rf.__importStar(kg());Tt.RealtimeChannel=Au.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Au.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Au.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Au.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Au.REALTIME_CHANNEL_STATES}});var TC=rf.__importStar(Pg());Tt.RealtimePresence=TC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return TC.REALTIME_PRESENCE_LISTEN_EVENTS}});var l5=rf.__importDefault(Eg());Tt.WebSocketFactory=l5.default});var Pi=C(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.StorageUnknownError=Yn.StorageApiError=Yn.StorageError=void 0;Yn.isStorageError=f5;var Ou=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Yn.StorageError=Ou;function f5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var jg=class extends Ou{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}}};Yn.StorageApiError=jg;var Mg=class extends Ou{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Yn.StorageUnknownError=Mg});var xu=C(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 nf=C(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.get=D5;ms.post=w5;ms.put=v5;ms.head=E5;ms.remove=b5;var ps=(he(),ce(fe)),Ug=Pi(),IC=xu(),qg=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)=>ps.__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 Ug.StorageApiError(qg(i),s,o))}).catch(i=>{e(new Ug.StorageUnknownError(qg(i),i))}):e(new Ug.StorageUnknownError(qg(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 Tu(t,e,r,n,i,s){return ps.__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 ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"GET",e,r,n)})}function w5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"POST",e,n,i,r)})}function v5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"PUT",e,n,i,r)})}function E5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function b5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"DELETE",e,n,i,r)})}});var PC=C(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var _5=(he(),ce(fe)),C5=Pi(),Hg=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}})}};Vg.default=Hg});var kC=C(Kg=>{"use strict";var FC;Object.defineProperty(Kg,"__esModule",{value:!0});var RC=(he(),ce(fe)),S5=Pi(),A5=RC.__importDefault(PC()),zg=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;Kg.default=zg});var LC=C(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Pi(),wr=nf(),NC=xu(),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},Gg=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("&")}};Wg.default=Gg});var Xg=C(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.version=void 0;sf.version="2.84.0"});var Yg=C(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.DEFAULT_HEADERS=void 0;var T5=Xg();of.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${T5.version}`}});var BC=C(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Io=(he(),ce(fe)),I5=Yg(),Po=Pi(),Fo=nf(),P5=xu(),Jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},I5.DEFAULT_HEADERS),r),this.fetch=(0,P5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Io.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Fo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Io.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Fo.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,Po.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.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,Po.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.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():""}};Zg.default=Jg});var iy=C(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});var Qg=(he(),ce(fe)),F5=Yg(),ey=Pi(),ty=nf(),R5=xu(),ry=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 Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Qg.__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,ty.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}};ny.default=ry});var uf=C(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var k5=Xg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${k5.version}`,"Content-Type":"application/json"}});var Ro=C(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.StorageVectorsErrorCode=an.StorageVectorsUnknownError=an.StorageVectorsApiError=an.StorageVectorsError=void 0;an.isStorageVectorsError=N5;var Iu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};an.StorageVectorsError=Iu;function N5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var sy=class extends Iu{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=sy;var oy=class extends Iu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};an.StorageVectorsUnknownError=oy;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 ko=C(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 ff=C($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.get=V5;$o.post=z5;$o.put=K5;$o.remove=G5;var No=(he(),ce(fe)),cf=Ro(),U5=ko(),MC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),q5=(t,e,r)=>No.__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 cf.StorageVectorsApiError(MC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new cf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new cf.StorageVectorsApiError(a,i,o))}}else e(new cf.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 lf(t,e,r,n,i,s){return No.__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 No.__awaiter(this,void 0,void 0,function*(){return lf(t,"GET",e,r,n)})}function z5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"POST",e,n,i,r)})}function K5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"PUT",e,n,i,r)})}function G5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"DELETE",e,n,i,r)})}});var cy=C(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var hf=(he(),ce(fe)),W5=uf(),df=Ro(),pf=ff(),X5=ko(),ay=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 hf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,pf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,df.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,pf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,df.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,pf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,df.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,pf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,df.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};uy.default=ay});var hy=C(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});var Pu=(he(),ce(fe)),Y5=uf(),Fu=Ro(),Ru=ff(),J5=ko(),ly=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 Pu.__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,Ru.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Pu.__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,Ru.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Pu.__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,Ru.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};fy.default=ly});var my=C(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var mf=(he(),ce(fe)),Z5=uf(),gf=Ro(),yf=ff(),Q5=ko(),dy=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 mf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,yf.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return mf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,yf.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return mf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,yf.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return mf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,yf.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};py.default=dy});var UC=C(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.VectorIndexScope=Fi.VectorBucketScope=Fi.StorageVectorsClient=void 0;var Vr=(he(),ce(fe)),e9=Vr.__importDefault(cy()),t9=Vr.__importDefault(hy()),r9=Vr.__importDefault(my()),gy=class extends r9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Df(this.url,this.headers,e,this.fetch)}};Fi.StorageVectorsClient=gy;var Df=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 wf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Fi.VectorBucketScope=Df;var wf=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}))})}};Fi.VectorIndexScope=wf});var wy=C(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 yy=(he(),ce(fe)),Dy=UC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Dy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Dy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Dy.VectorIndexScope}});var n9=my();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return yy.__importDefault(n9).default}});var i9=cy();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return yy.__importDefault(i9).default}});var s9=hy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return yy.__importDefault(s9).default}});var ku=Ro();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return ku.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return ku.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return ku.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return ku.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return ku.isStorageVectorsError}});var Nu=ko();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return Nu.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return Nu.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return Nu.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return Nu.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return Nu.validateVectorDimension}})});var qC=C(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.StorageClient=void 0;var Ey=(he(),ce(fe)),o9=Ey.__importDefault(LC()),a9=Ey.__importDefault(BC()),u9=Ey.__importDefault(iy()),c9=wy(),vy=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)}};vf.StorageClient=vy});var VC=C(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0})});var zC=C(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.StorageAnalyticsClient=Jn.StorageClient=void 0;var Ef=(he(),ce(fe)),l9=qC();Object.defineProperty(Jn,"StorageClient",{enumerable:!0,get:function(){return l9.StorageClient}});var f9=iy();Object.defineProperty(Jn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Ef.__importDefault(f9).default}});Ef.__exportStar(VC(),Jn);Ef.__exportStar(Pi(),Jn);Ef.__exportStar(wy(),Jn)});var KC=C(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.version=void 0;bf.version="2.84.0"});var GC=C(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(),$u="";typeof Deno<"u"?$u="deno":typeof document<"u"?$u="web":typeof navigator<"u"&&navigator.product==="ReactNative"?$u="react-native":$u="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${$u}/${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=C(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=C(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});Ri.isBrowser=void 0;Ri.uuid=g9;Ri.ensureTrailingSlash=XC;Ri.applySettingDefaults=D9;Ri.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";Ri.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 by=C(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var Cf=C(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=by();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 gs=C(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=Bo;Ae.isAuthApiError=E9;Ae.isAuthSessionMissingError=b9;Ae.isAuthImplicitGrantRedirectError=_9;Ae.isAuthRetryableFetchError=C9;Ae.isAuthWeakPasswordError=S9;var Lo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Lo;function Bo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var _y=class extends Lo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=_y;function E9(t){return Bo(t)&&t.name==="AuthApiError"}var Cy=class extends Lo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Cy;var un=class extends Lo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=un;var Sy=class extends un{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Sy;function b9(t){return Bo(t)&&t.name==="AuthSessionMissingError"}var Ay=class extends un{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Ay;var Oy=class extends un{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=Oy;var xy=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=xy;function _9(t){return Bo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Ty=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=Ty;var Iy=class extends un{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Iy;function C9(t){return Bo(t)&&t.name==="AuthRetryableFetchError"}var Py=class extends un{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Py;function S9(t){return Bo(t)&&t.name==="AuthWeakPasswordError"}var Fy=class extends un{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Fy});var Af=C(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Lu;zr.byteFromBase64URL=Ry;zr.stringToBase64URL=O9;zr.stringFromBase64URL=x9;zr.codepointToUTF8=ZC;zr.stringToUTF8=ky;zr.stringFromUTF8=QC;zr.base64UrlToUint8Array=T9;zr.stringToUint8Array=I9;zr.bytesToBase64URL=P9;var Sf="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<Sf.length;e+=1)t[Sf[e].charCodeAt(0)]=e;return t})();function Lu(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(Sf[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(Sf[n]),e.queuedBits-=6}}function Ry(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 ky(t,i=>{Lu(i,n,r)}),Lu(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)Ry(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 ky(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)Ry(t.charCodeAt(i),r,n);return new Uint8Array(e)}function I9(t){let e=[];return ky(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=>Lu(i,r,n)),Lu(null,r,n),e.join("")}});var jo=C(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=Cf(),eS=gs(),Ny=Af();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 ys={tested:!1,writable:!1},N9=()=>{if(!(0,be.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ys.tested)return ys.writable;let t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ys.tested=!0,ys.writable=!0}catch{ys.tested=!0,ys.writable=!1}return ys.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 Of=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=Of;Of.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,Ny.stringFromBase64URL)(e[0])),payload:JSON.parse((0,Ny.stringFromBase64URL)(e[1])),signature:(0,Ny.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 By=C(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.handleError=Ly;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)),xf=Cf(),$y=jo(),ki=gs(),Ds=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),iH=[502,503,504];async function Ly(t){var e;if(!(0,$y.looksLikeFetchResponse)(t))throw new ki.AuthRetryableFetchError(Ds(t),0);if(iH.includes(t.status))throw new ki.AuthRetryableFetchError(Ds(t),t.status);let r;try{r=await t.json()}catch(s){throw new ki.AuthUnknownError(Ds(s),s)}let n,i=(0,$y.parseResponseAPIVersion)(t);if(i&&i.getTime()>=xf.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 ki.AuthWeakPasswordError(Ds(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new ki.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 ki.AuthWeakPasswordError(Ds(r),t.status,r.weak_password.reasons);throw new ki.AuthApiError(Ds(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[xf.API_VERSION_HEADER_NAME]||(s[xf.API_VERSION_HEADER_NAME]=xf.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 ki.AuthRetryableFetchError(Ds(u),0)}if(a.ok||await Ly(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await Ly(u)}}function iS(t){var e;let r=null;dH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,$y.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function 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 jy=C(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.SIGN_OUT_SCOPES=void 0;Tf.SIGN_OUT_SCOPES=["global","local","others"]});var If=C(qy=>{"use strict";Object.defineProperty(qy,"__esModule",{value:!0});var pH=(he(),ce(fe)),ot=By(),ws=jo(),My=jy(),Kt=gs(),Uy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,ws.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=My.SIGN_OUT_SCOPES[0]){if(My.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${My.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 g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),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,ws.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,ws.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,ws.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,ws.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,ws.validateUUID)(e.userId),(0,ws.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 g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),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}}};qy.default=Uy});var sS=C(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.memoryLocalStorageAdapter=mH;function mH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var Vy=C(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=jo();Rt.internals={debug:!!(globalThis&&(0,gH.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var Bu=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Rt.LockAcquireTimeoutError=Bu;var Pf=class extends Bu{};Rt.NavigatorLockAcquireTimeoutError=Pf;var Ff=class extends Bu{};Rt.ProcessLockAcquireTimeoutError=Ff;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 Pf(`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 Ff(`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=C(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0});zy.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=C(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.getAddress=uS;Mo.fromHex=vH;Mo.toHex=EH;Mo.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(`
|
|
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 Ct.SOCKET_STATES.connecting:return Ct.CONNECTION_STATE.Connecting;case Ct.SOCKET_STATES.open:return Ct.CONNECTION_STATE.Open;case Ct.SOCKET_STATES.closing:return Ct.CONNECTION_STATE.Closing;default:return Ct.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Ct.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(Ct.WS_CLOSE_NORMAL,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},ef.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===Ct.SOCKET_STATES.open||this.conn.readyState===Ct.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(Ct.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:Ct.DEFAULT_VERSION};r&&n.updateJoinPayload(i),n.joinedOnce&&n._isJoined()&&n._push(Ct.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()},ef.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:Ct.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=(i=e?.heartbeatIntervalMs)!==null&&i!==void 0?i:ef.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:Ng,this.vsn=(u=e?.vsn)!==null&&u!==void 0?u:Ct.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 Ct.VSN_1_0_0:this.encode=(l=e?.encode)!==null&&l!==void 0?l:((p,g)=>g(JSON.stringify(p))),this.decode=(h=e?.decode)!==null&&h!==void 0?h:((p,g)=>g(JSON.parse(p)));break;case Ct.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}}};Lg.default=$g});var Bg=C(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 rf=(he(),ce(fe)),c5=rf.__importDefault(xC());Tt.RealtimeClient=c5.default;var Au=rf.__importStar(kg());Tt.RealtimeChannel=Au.default;Object.defineProperty(Tt,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return Au.REALTIME_LISTEN_TYPES}});Object.defineProperty(Tt,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return Au.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Tt,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return Au.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Tt,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return Au.REALTIME_CHANNEL_STATES}});var TC=rf.__importStar(Pg());Tt.RealtimePresence=TC.default;Object.defineProperty(Tt,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return TC.REALTIME_PRESENCE_LISTEN_EVENTS}});var l5=rf.__importDefault(Eg());Tt.WebSocketFactory=l5.default});var Fi=C(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});Yn.StorageUnknownError=Yn.StorageApiError=Yn.StorageError=void 0;Yn.isStorageError=f5;var Ou=class extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}};Yn.StorageError=Ou;function f5(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var jg=class extends Ou{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}}};Yn.StorageApiError=jg;var Mg=class extends Ou{constructor(e,r){super(e),this.name="StorageUnknownError",this.originalError=r}};Yn.StorageUnknownError=Mg});var xu=C(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 nf=C(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.get=D5;ms.post=w5;ms.put=v5;ms.head=E5;ms.remove=b5;var ps=(he(),ce(fe)),Ug=Fi(),IC=xu(),qg=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)=>ps.__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 Ug.StorageApiError(qg(i),s,o))}).catch(i=>{e(new Ug.StorageUnknownError(qg(i),i))}):e(new Ug.StorageUnknownError(qg(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 Tu(t,e,r,n,i,s){return ps.__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 ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"GET",e,r,n)})}function w5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"POST",e,n,i,r)})}function v5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"PUT",e,n,i,r)})}function E5(t,e,r,n){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"HEAD",e,Object.assign(Object.assign({},r),{noResolveJson:!0}),n)})}function b5(t,e,r,n,i){return ps.__awaiter(this,void 0,void 0,function*(){return Tu(t,"DELETE",e,n,i,r)})}});var PC=C(Vg=>{"use strict";Object.defineProperty(Vg,"__esModule",{value:!0});var _5=(he(),ce(fe)),C5=Fi(),Hg=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}})}};Vg.default=Hg});var kC=C(Kg=>{"use strict";var FC;Object.defineProperty(Kg,"__esModule",{value:!0});var RC=(he(),ce(fe)),S5=Fi(),A5=RC.__importDefault(PC()),zg=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;Kg.default=zg});var LC=C(Wg=>{"use strict";Object.defineProperty(Wg,"__esModule",{value:!0});var rr=(he(),ce(fe)),Dr=Fi(),wr=nf(),NC=xu(),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},Gg=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("&")}};Wg.default=Gg});var Xg=C(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.version=void 0;sf.version="2.84.0"});var Yg=C(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.DEFAULT_HEADERS=void 0;var T5=Xg();of.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${T5.version}`}});var BC=C(Zg=>{"use strict";Object.defineProperty(Zg,"__esModule",{value:!0});var Io=(he(),ce(fe)),I5=Yg(),Po=Fi(),Fo=nf(),P5=xu(),Jg=class{constructor(e,r={},n,i){this.shouldThrowOnError=!1;let s=new URL(e);i?.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase.")),this.url=s.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},I5.DEFAULT_HEADERS),r),this.fetch=(0,P5.resolveFetch)(n)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Io.__awaiter(this,void 0,void 0,function*(){try{let r=this.listBucketOptionsToQueryString(e);return{data:yield(0,Fo.get)(this.fetch,`${this.url}/bucket${r}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}getBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.get)(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(e){return Io.__awaiter(this,arguments,void 0,function*(r,n={public:!1}){try{return{data:yield(0,Fo.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,Po.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(e,r){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.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,Po.isStorageError)(n))return{data:null,error:n};throw n}})}emptyBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.post)(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Io.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Fo.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Po.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():""}};Zg.default=Jg});var iy=C(ny=>{"use strict";Object.defineProperty(ny,"__esModule",{value:!0});var Qg=(he(),ce(fe)),F5=Yg(),ey=Fi(),ty=nf(),R5=xu(),ry=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 Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.post)(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}listBuckets(e){return Qg.__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,ty.get)(this.fetch,i,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return Qg.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,ty.remove)(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,ey.isStorageError)(r))return{data:null,error:r};throw r}})}};ny.default=ry});var uf=C(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.DEFAULT_HEADERS=void 0;var k5=Xg();af.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${k5.version}`,"Content-Type":"application/json"}});var Ro=C(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.StorageVectorsErrorCode=an.StorageVectorsUnknownError=an.StorageVectorsApiError=an.StorageVectorsError=void 0;an.isStorageVectorsError=N5;var Iu=class extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};an.StorageVectorsError=Iu;function N5(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var sy=class extends Iu{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=sy;var oy=class extends Iu{constructor(e,r){super(e),this.name="StorageVectorsUnknownError",this.originalError=r}};an.StorageVectorsUnknownError=oy;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 ko=C(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 ff=C($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.get=V5;$o.post=z5;$o.put=K5;$o.remove=G5;var No=(he(),ce(fe)),cf=Ro(),U5=ko(),MC=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),q5=(t,e,r)=>No.__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 cf.StorageVectorsApiError(MC(o),i,a))}).catch(()=>{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new cf.StorageVectorsApiError(a,i,o))});else{let o=i+"",a=s.statusText||`HTTP ${i} error`;e(new cf.StorageVectorsApiError(a,i,o))}}else e(new cf.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 lf(t,e,r,n,i,s){return No.__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 No.__awaiter(this,void 0,void 0,function*(){return lf(t,"GET",e,r,n)})}function z5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"POST",e,n,i,r)})}function K5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"PUT",e,n,i,r)})}function G5(t,e,r,n,i){return No.__awaiter(this,void 0,void 0,function*(){return lf(t,"DELETE",e,n,i,r)})}});var cy=C(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var hf=(he(),ce(fe)),W5=uf(),df=Ro(),pf=ff(),X5=ko(),ay=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 hf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,pf.post)(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,df.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getIndex(e,r){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,pf.post)(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,df.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}listIndexes(e){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,pf.post)(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,df.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteIndex(e,r){return hf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,pf.post)(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:r},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if((0,df.isStorageVectorsError)(n))return{data:null,error:n};throw n}})}};uy.default=ay});var hy=C(fy=>{"use strict";Object.defineProperty(fy,"__esModule",{value:!0});var Pu=(he(),ce(fe)),Y5=uf(),Fu=Ro(),Ru=ff(),J5=ko(),ly=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 Pu.__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,Ru.post)(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getVectors(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listVectors(e){return Pu.__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,Ru.post)(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}queryVectors(e){return Pu.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,Ru.post)(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteVectors(e){return Pu.__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,Ru.post)(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,Fu.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};fy.default=ly});var my=C(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});var mf=(he(),ce(fe)),Z5=uf(),gf=Ro(),yf=ff(),Q5=ko(),dy=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 mf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,yf.post)(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}getBucket(e){return mf.__awaiter(this,void 0,void 0,function*(){try{return{data:yield(0,yf.post)(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}listBuckets(){return mf.__awaiter(this,arguments,void 0,function*(e={}){try{return{data:yield(0,yf.post)(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}deleteBucket(e){return mf.__awaiter(this,void 0,void 0,function*(){try{return{data:(yield(0,yf.post)(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(r){if(this.shouldThrowOnError)throw r;if((0,gf.isStorageVectorsError)(r))return{data:null,error:r};throw r}})}};py.default=dy});var UC=C(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(cy()),t9=Vr.__importDefault(hy()),r9=Vr.__importDefault(my()),gy=class extends r9.default{constructor(e,r={}){super(e,r.headers||{},r.fetch)}from(e){return new Df(this.url,this.headers,e,this.fetch)}};Ri.StorageVectorsClient=gy;var Df=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 wf(this.url,this.headers,this.vectorBucketName,e,this.fetch)}};Ri.VectorBucketScope=Df;var wf=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=wf});var wy=C(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 yy=(he(),ce(fe)),Dy=UC();Object.defineProperty(Ce,"StorageVectorsClient",{enumerable:!0,get:function(){return Dy.StorageVectorsClient}});Object.defineProperty(Ce,"VectorBucketScope",{enumerable:!0,get:function(){return Dy.VectorBucketScope}});Object.defineProperty(Ce,"VectorIndexScope",{enumerable:!0,get:function(){return Dy.VectorIndexScope}});var n9=my();Object.defineProperty(Ce,"VectorBucketApi",{enumerable:!0,get:function(){return yy.__importDefault(n9).default}});var i9=cy();Object.defineProperty(Ce,"VectorIndexApi",{enumerable:!0,get:function(){return yy.__importDefault(i9).default}});var s9=hy();Object.defineProperty(Ce,"VectorDataApi",{enumerable:!0,get:function(){return yy.__importDefault(s9).default}});var ku=Ro();Object.defineProperty(Ce,"StorageVectorsError",{enumerable:!0,get:function(){return ku.StorageVectorsError}});Object.defineProperty(Ce,"StorageVectorsApiError",{enumerable:!0,get:function(){return ku.StorageVectorsApiError}});Object.defineProperty(Ce,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return ku.StorageVectorsUnknownError}});Object.defineProperty(Ce,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return ku.StorageVectorsErrorCode}});Object.defineProperty(Ce,"isStorageVectorsError",{enumerable:!0,get:function(){return ku.isStorageVectorsError}});var Nu=ko();Object.defineProperty(Ce,"resolveFetch",{enumerable:!0,get:function(){return Nu.resolveFetch}});Object.defineProperty(Ce,"resolveResponse",{enumerable:!0,get:function(){return Nu.resolveResponse}});Object.defineProperty(Ce,"isPlainObject",{enumerable:!0,get:function(){return Nu.isPlainObject}});Object.defineProperty(Ce,"normalizeToFloat32",{enumerable:!0,get:function(){return Nu.normalizeToFloat32}});Object.defineProperty(Ce,"validateVectorDimension",{enumerable:!0,get:function(){return Nu.validateVectorDimension}})});var qC=C(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});vf.StorageClient=void 0;var Ey=(he(),ce(fe)),o9=Ey.__importDefault(LC()),a9=Ey.__importDefault(BC()),u9=Ey.__importDefault(iy()),c9=wy(),vy=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)}};vf.StorageClient=vy});var VC=C(HC=>{"use strict";Object.defineProperty(HC,"__esModule",{value:!0})});var zC=C(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});Jn.StorageAnalyticsClient=Jn.StorageClient=void 0;var Ef=(he(),ce(fe)),l9=qC();Object.defineProperty(Jn,"StorageClient",{enumerable:!0,get:function(){return l9.StorageClient}});var f9=iy();Object.defineProperty(Jn,"StorageAnalyticsClient",{enumerable:!0,get:function(){return Ef.__importDefault(f9).default}});Ef.__exportStar(VC(),Jn);Ef.__exportStar(Fi(),Jn);Ef.__exportStar(wy(),Jn)});var KC=C(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});bf.version=void 0;bf.version="2.84.0"});var GC=C(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(),$u="";typeof Deno<"u"?$u="deno":typeof document<"u"?$u="web":typeof navigator<"u"&&navigator.product==="ReactNative"?$u="react-native":$u="node";Fr.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${$u}/${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=C(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=C(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 by=C(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});_f.version=void 0;_f.version="2.84.0"});var Cf=C(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=by();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 gs=C(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=Bo;Ae.isAuthApiError=E9;Ae.isAuthSessionMissingError=b9;Ae.isAuthImplicitGrantRedirectError=_9;Ae.isAuthRetryableFetchError=C9;Ae.isAuthWeakPasswordError=S9;var Lo=class extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}};Ae.AuthError=Lo;function Bo(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}var _y=class extends Lo{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}};Ae.AuthApiError=_y;function E9(t){return Bo(t)&&t.name==="AuthApiError"}var Cy=class extends Lo{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}};Ae.AuthUnknownError=Cy;var un=class extends Lo{constructor(e,r,n,i){super(e,n,i),this.name=r,this.status=n}};Ae.CustomAuthError=un;var Sy=class extends un{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Ae.AuthSessionMissingError=Sy;function b9(t){return Bo(t)&&t.name==="AuthSessionMissingError"}var Ay=class extends un{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Ae.AuthInvalidTokenResponseError=Ay;var Oy=class extends un{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}};Ae.AuthInvalidCredentialsError=Oy;var xy=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=xy;function _9(t){return Bo(t)&&t.name==="AuthImplicitGrantRedirectError"}var Ty=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=Ty;var Iy=class extends un{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}};Ae.AuthRetryableFetchError=Iy;function C9(t){return Bo(t)&&t.name==="AuthRetryableFetchError"}var Py=class extends un{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}};Ae.AuthWeakPasswordError=Py;function S9(t){return Bo(t)&&t.name==="AuthWeakPasswordError"}var Fy=class extends un{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}};Ae.AuthInvalidJwtError=Fy});var Af=C(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.byteToBase64URL=Lu;zr.byteFromBase64URL=Ry;zr.stringToBase64URL=O9;zr.stringFromBase64URL=x9;zr.codepointToUTF8=ZC;zr.stringToUTF8=ky;zr.stringFromUTF8=QC;zr.base64UrlToUint8Array=T9;zr.stringToUint8Array=I9;zr.bytesToBase64URL=P9;var Sf="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<Sf.length;e+=1)t[Sf[e].charCodeAt(0)]=e;return t})();function Lu(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(Sf[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(Sf[n]),e.queuedBits-=6}}function Ry(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 ky(t,i=>{Lu(i,n,r)}),Lu(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)Ry(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 ky(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)Ry(t.charCodeAt(i),r,n);return new Uint8Array(e)}function I9(t){let e=[];return ky(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=>Lu(i,r,n)),Lu(null,r,n),e.join("")}});var jo=C(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=Cf(),eS=gs(),Ny=Af();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 ys={tested:!1,writable:!1},N9=()=>{if(!(0,be.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(ys.tested)return ys.writable;let t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),ys.tested=!0,ys.writable=!0}catch{ys.tested=!0,ys.writable=!1}return ys.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 Of=class t{constructor(){this.promise=new t.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}};be.Deferred=Of;Of.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,Ny.stringFromBase64URL)(e[0])),payload:JSON.parse((0,Ny.stringFromBase64URL)(e[1])),signature:(0,Ny.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 By=C(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.handleError=Ly;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)),xf=Cf(),$y=jo(),Ni=gs(),Ds=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),iH=[502,503,504];async function Ly(t){var e;if(!(0,$y.looksLikeFetchResponse)(t))throw new Ni.AuthRetryableFetchError(Ds(t),0);if(iH.includes(t.status))throw new Ni.AuthRetryableFetchError(Ds(t),t.status);let r;try{r=await t.json()}catch(s){throw new Ni.AuthUnknownError(Ds(s),s)}let n,i=(0,$y.parseResponseAPIVersion)(t);if(i&&i.getTime()>=xf.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(Ds(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(Ds(r),t.status,r.weak_password.reasons);throw new Ni.AuthApiError(Ds(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[xf.API_VERSION_HEADER_NAME]||(s[xf.API_VERSION_HEADER_NAME]=xf.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(Ds(u),0)}if(a.ok||await Ly(a),n?.noResolveJson)return a;try{return await a.json()}catch(u){await Ly(u)}}function iS(t){var e;let r=null;dH(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=(0,$y.expiresAt)(t.expires_in)));let n=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:r,user:n},error:null}}function 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 jy=C(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});Tf.SIGN_OUT_SCOPES=void 0;Tf.SIGN_OUT_SCOPES=["global","local","others"]});var If=C(qy=>{"use strict";Object.defineProperty(qy,"__esModule",{value:!0});var pH=(he(),ce(fe)),ot=By(),ws=jo(),My=jy(),Kt=gs(),Uy=class{constructor({url:e="",headers:r={},fetch:n}){this.url=e,this.headers=r,this.fetch=(0,ws.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=My.SIGN_OUT_SCOPES[0]){if(My.SIGN_OUT_SCOPES.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${My.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 g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),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,ws.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,ws.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,ws.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,ws.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,ws.validateUUID)(e.userId),(0,ws.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 g=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(p.split(";")[1].split("=")[1]);c[`${v}Page`]=g}),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}}};qy.default=Uy});var sS=C(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.memoryLocalStorageAdapter=mH;function mH(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}});var Vy=C(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=jo();Rt.internals={debug:!!(globalThis&&(0,gH.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var Bu=class extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}};Rt.LockAcquireTimeoutError=Bu;var Pf=class extends Bu{};Rt.NavigatorLockAcquireTimeoutError=Pf;var Ff=class extends Bu{};Rt.ProcessLockAcquireTimeoutError=Ff;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 Pf(`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 Ff(`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=C(zy=>{"use strict";Object.defineProperty(zy,"__esModule",{value:!0});zy.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=C(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.getAddress=uS;Mo.fromHex=vH;Mo.toHex=EH;Mo.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
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,g=t.statement?`${t.statement}
|
|
29
29
|
`:"",v=`${p} wants you to sign in with your Ethereum account:
|
|
30
30
|
${f}
|
|
@@ -40,41 +40,41 @@ Request ID: ${u}`),c){let A=`
|
|
|
40
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
41
|
- ${m}`}E+=A}return`${v}
|
|
42
42
|
${E}`}});var fS=C(Zn=>{"use strict";Object.defineProperty(Zn,"__esModule",{value:!0});Zn.WebAuthnUnknownError=Zn.WebAuthnError=void 0;Zn.isWebAuthnError=_H;Zn.identifyRegistrationError=CH;Zn.identifyAuthenticationError=SH;var lS=Gy(),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}};Zn.WebAuthnError=ft;var Ky=class extends ft{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}};Zn.WebAuthnUnknownError=Ky;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 Gy=C(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=Af(),wn=gs(),AH=jo(),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 Rf=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=Rf;Oe.webAuthnAbortService=new Rf;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 kf(...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]=kf(a,o):n[s]=kf(o)}else n[s]=o}return n}function gS(t,e){return kf(Oe.DEFAULT_CREATION_OPTIONS,t,e||{})}function yS(t,e){return kf(Oe.DEFAULT_REQUEST_OPTIONS,t,e||{})}var Wy=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=Wy});var Yy=C(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});var FH=(he(),ce(fe)),RH=FH.__importDefault(If()),vr=Cf(),X=gs(),ue=By(),se=jo(),DS=sS(),wS=Vy(),kH=aS(),NH=by(),vS=Af(),Nf=cS(),ju=Gy();(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 Uo={},$f=class t{get jwks(){var e,r;return(r=(e=Uo[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Uo[this.storageKey]=Object.assign(Object.assign({},Uo[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Uo[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Uo[this.storageKey]=Object.assign(Object.assign({},Uo[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 ju.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:g,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 S=(0,Nf.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,Nf.fromHex)(k)}let _={domain:D.host,address:S,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,Nf.createSiweMessage)(_),p=await m.request({method:"personal_sign",params:[(0,Nf.toHex)(f),S]})}try{let{data:g,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(!g||!g.session||!g.user){let E=new X.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:E})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:Object.assign({},g),error:v})}catch(g){if((0,X.isAuthError)(g))return this._returnResult({data:{user:null,session:null},error:g});throw g}}async signInWithSolana(e){var r,n,i,s,o,a,u,c,l,h,d,f;let p,g;if("message"in e)p=e.message,g=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 S=window;if("solana"in S&&typeof S.solana=="object"&&("signIn"in S.solana&&typeof S.solana.signIn=="function"||"signMessage"in S.solana&&typeof S.solana.signMessage=="function"))D=S.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 S=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(S)&&S[0]&&typeof S[0]=="object")F=S[0];else if(S&&typeof S=="object"&&"signedMessage"in S&&"signature"in S)F=S;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),g=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 S=await D.signMessage(new TextEncoder().encode(p),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=S}}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)(g)},!((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:g,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:g.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,ju.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,ju.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,ju.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,ju.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}}};$f.nextInstanceID={};Xy.default=$f});var bS=C(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var LH=(he(),ce(fe)),BH=LH.__importDefault(If()),jH=BH.default;Jy.default=jH});var _S=C(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var MH=(he(),ce(fe)),UH=MH.__importDefault(Yy()),qH=UH.default;Zy.default=qH});var Qy=C(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 qo=(he(),ce(fe)),HH=qo.__importDefault(If());It.GoTrueAdminApi=HH.default;var VH=qo.__importDefault(Yy());It.GoTrueClient=VH.default;var zH=qo.__importDefault(bS());It.AuthAdminApi=zH.default;var KH=qo.__importDefault(_S());It.AuthClient=KH.default;qo.__exportStar(jy(),It);qo.__exportStar(gs(),It);var Lf=Vy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Lf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Lf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Lf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Lf.processLock}})});var CS=C(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.SupabaseAuthClient=void 0;var GH=Qy(),eD=class extends GH.AuthClient{constructor(e){super(e)}};Bf.SupabaseAuthClient=eD});var nD=C(rD=>{"use strict";Object.defineProperty(rD,"__esModule",{value:!0});var WH=ng(),XH=vg(),YH=Bg(),JH=zC(),jf=GC(),ZH=WC(),SS=YC(),QH=CS(),tD=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:jf.DEFAULT_DB_OPTIONS,realtime:jf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},jf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:jf.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)}};rD.default=tD});var xS=C(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(nD());AS(Qy(),We);var r7=vg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return r7.PostgrestError}});var Mu=ng();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Mu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Mu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Mu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Mu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Mu.FunctionRegion}});AS(Bg(),We);var n7=nD();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 iD=C((Dye,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 Mf=C(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=C((vye,NS)=>{var a7=require("fs"),Ft=require("path"),FS=iD(),u7=Mf(),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=C((Eye,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=C((bye,jS)=>{jS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Vo=C((_ye,Ho)=>{Ho.exports=$S();Ho.exports.Constants=iD();Ho.exports.Errors=Mf();Ho.exports.FileAttr=BS();Ho.exports.decoder=MS()});var qS=C((Cye,US)=>{var Ni=Vo(),Y=Ni.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|=Ni.isWin?2560:768,r|=Y.FLG_EFS;let g={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=Ni.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 Ni.fromDOS2Date(this.timeval)},set time(m){this.timeval=Ni.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 g.extraLen},set extraLocalLength(m){g.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+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(m){var D=m.slice(p,p+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw Ni.Errors.INVALID_LOC();g.version=D.readUInt16LE(Y.LOCVER),g.flags=D.readUInt16LE(Y.LOCFLG),g.method=D.readUInt16LE(Y.LOCHOW),g.time=D.readUInt32LE(Y.LOCTIM),g.crc=D.readUInt32LE(Y.LOCCRC),g.compressedSize=D.readUInt32LE(Y.LOCSIZ),g.size=D.readUInt32LE(Y.LOCLEN),g.fnameLen=D.readUInt16LE(Y.LOCNAM),g.extraLen=D.readUInt16LE(Y.LOCEXT);let w=p+Y.LOCHDR+g.fnameLen,S=w+g.extraLen;return m.slice(w,S)},loadFromBinary:function(m){if(m.length!==Y.CENHDR||m.readUInt32LE(0)!==Y.CENSIG)throw Ni.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(g.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:Ni.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=C((Sye,HS)=>{var zo=Vo(),ht=zo.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 zo.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=zo.readBigUInt64LE(s,ht.ZIP64SUB),e=zo.readBigUInt64LE(s,ht.ZIP64TOT),r=zo.readBigUInt64LE(s,ht.ZIP64SIZE),n=zo.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 oD=C(sD=>{sD.EntryHeader=qS();sD.MainHeader=VS()});var KS=C((Oye,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=C((xye,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=C((Tye,ZS)=>{"use strict";var{randomFillSync:XS}=require("crypto"),h7=Mf(),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,Uu=()=>typeof XS=="function"?XS(Buffer.alloc(12)):Uu.node();Uu.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 Uf={genSalt:Uu};function qf(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])}qf.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};qf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return JS(t,t^1)>>8&255};function p7(t){let e=new qf(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 qf(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?Uf.genSalt=function(){return t.slice(0,12)}:t==="node"?Uf.genSalt=Uu.node:Uf.genSalt=Uu}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=Uf.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=C(Hf=>{Hf.Deflater=KS();Hf.Inflater=WS();Hf.ZipCrypto=QS()});var uD=C((Pye,tA)=>{var $e=Vo(),w7=oD(),Dt=$e.Constants,aD=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 S=d();if(S.length===0)return m&&D&&D(S),S;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw $e.Errors.INVALID_PASS_PARAM();S=aD.ZipCrypto.decrypt(S,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case $e.Constants.STORED:if(S.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 _=new aD.Inflater(S,r.size);if(m)_.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,$e.Errors.BAD_CRC()))});else{if(_.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 g(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 S=new aD.Deflater(o);if(m)S.deflateAsync(function(_){w=Buffer.alloc(_.length),r.compressedSize=_.length,_.copy(w),D&&D(w)});else{var F=S.deflate();return r.compressedSize=F.length,F}S=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,S,F;D+4<m.length;)w=m.readUInt16LE(D),D+=2,S=m.readUInt16LE(D),D+=2,F=m.slice(D,D+S),D+=S,Dt.ID_ZIP64===w&&A(F)}catch{throw $e.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(m){var D,w,S,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&&(S=v(m,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=S)),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 g(!1,null)},getCompressedDataAsync:function(m){g(!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=C((Fye,nA)=>{var rA=uD(),v7=oD(),qt=Vo();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,S=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,S=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(S+qt.Constants.ENDHDR)),v&&f()}function g(){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(),g();let v=[],E=[],A=0,m=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let _=F.getCompressedData();F.header.offset=m;let k=F.packLocalHeader(),R=k.length+_.length;m+=R,v.push(k),v.push(_);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 S=s.toBinary();return i&&i.copy(S,qt.Constants.ENDHDR),S.copy(w,m),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,m){try{o||f(),g();let D=[],w=[],S=0,F=0,_=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 K=I.packLocalHeader(),L=K.length+j.length;F+=L,D.push(K),D.push(j);let b=I.packCentralHeader();w.push(b),s.size+=b.length,S+=L+b.length,_++,k(R)})}else{S+=s.mainHeaderSize,s.offset=F,s.totalEntries=_,F=0;let I=Buffer.alloc(S);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 cD=C((Rye,oA)=>{var dt=Vo(),wt=require("path"),E7=uD(),b7=iA(),vs=(...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:g,sep:v}=wt.posix;return p(".",g(v+f.split("\\").join(v)+v))}function h(f){return f instanceof RegExp?(function(p){return function(g){return p.test(g)}})(f):typeof f!="function"?()=>!0:f}let d=(f,p)=>{let g=p.slice(-1);return g=g===i.sep?i.sep:"",wt.relative(f,p)+g};return{readFile:function(f,p){var g=c(f);return g&&g.getData(p)||null},childCount:function(f){let p=c(f);if(p)return s.getChildCount(p)},readFileAsync:function(f,p){var g=c(f);g?g.getDataAsync(p):p(null,"getEntry failed for:"+f)},readAsText:function(f,p){var g=c(f);if(g){var v=g.getData();if(v&&v.length)return v.toString(p||"utf8")}return""},readAsTextAsync:function(f,p,g){var v=c(f);v?v.getDataAsync(function(E,A){if(A){p(E,A);return}E&&E.length?p(E.toString(g||"utf8")):p("")}):p("")},deleteFile:function(f,p=!0){var g=c(f);g&&s.deleteFile(g.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 g=c(f);g&&(g.comment=p)},getZipEntryComment:function(f){var p=c(f);return p&&p.comment||""},updateFile:function(f,p){var g=c(f);g&&g.setData(p)},addLocalFile:function(f,p,g,v){if(i.fs.existsSync(f)){p=p?l(p):"";let E=wt.win32.basename(wt.win32.normalize(f));p+=g||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 g=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,m=this;i.fs.stat(g,function(D,w){if(D)return p(D,!1);E=E?l(E):"";let S=wt.win32.basename(wt.win32.normalize(g));if(E+=A||S,w.isFile())i.fs.readFile(g,function(F,_){return F?p(F,!1):(m.addFile(E,_,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,g){if(g=h(g),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));g(m)&&E.addLocalFile(A,wt.dirname(m))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,p,g,v){v=h(v),g=g?l(g):"",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 S=m[D],F=d(f,S).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(S,function(_,k){_&&p(void 0,_),k.isFile()?i.fs.readFile(S,function(R,I){R?p(void 0,R):(E.addFile(g+F,I,"",k),w())}):(E.addFile(g+F+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else p(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,p){let g=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(S){return w.test(S)}})(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(S,F){if(S)return p(S);F=F.filter(_=>E(m(_))),F.length||p(void 0,!1),setImmediate(F.reverse().reduce(function(_,k){return function(R,I){if(R||I===!1)return setImmediate(_,R,!1);g.addLocalFileAsync({localPath:k,zipPath:wt.dirname(m(k)),zipName:D(k)},_)}},p))})})},addLocalFolderPromise:function(f,p){return new Promise((g,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},p),(E,A)=>{E&&v(E),A&&g(this)})})},addFile:function(f,p,g,v){f=u(f);let E=c(f),A=E!=null;A||(E=new E7(n),E.entryName=f),E.comment=g||"";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,g,v,E,A){v=vs(!1,v),E=vs(!1,E),g=vs(!0,g),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:g?D:wt.basename(D));if(m.isDirectory){var S=s.getEntryChildren(m);return S.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,g?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 _=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,_),!0},test:function(f){if(!s)return!1;for(var p in s.entries)try{if(p.isDirectory)continue;var g=s.entries[p].getData(f);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(f,p,g,v){if(g=vs(!1,g),v=sA(g,v),p=vs(!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=g?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,g,v){if(v=_7(p,g,v),g=vs(!1,g),p=vs(!1,p),!v)return new Promise((w,S)=>{this.extractAllToAsync(f,p,g,function(F){F?S(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,S)=>new Error(w+': "'+S+'"'),m=[],D=[];s.entries.forEach(w=>{w.isDirectory?m.push(w):D.push(w)});for(let w of m){let S=E(w),F=g?w.header.fileAttr:void 0;try{i.makeDir(S),F&&i.fs.chmodSync(S,F),i.fs.utimesSync(S,w.header.time,w.header.time)}catch{v(A("Unable to create folder",S))}}D.reverse().reduce(function(w,S){return function(F){if(F)w(F);else{let _=wt.normalize(o(S.entryName)),k=a(f,_);S.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=g?S.header.fileAttr:void 0;i.writeFileToAsync(k,R,p,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,S.header.time,S.header.time,function(K){K?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 g=s.compressToBuffer();if(g){var v=i.writeFileTo(f,g,!0);typeof p=="function"&&p(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,p){let{overwrite:g,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,g,v,D)},A)})},toBufferPromise:function(){return new Promise((f,p)=>{s.toAsyncBuffer(f,p)})},toBuffer:function(f,p,g,v){return typeof f=="function"?(s.toAsyncBuffer(f,p,g,v),null):s.compressToBuffer()}}}});var lA=C((kye,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=C((Nye,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=C(($ye,dA)=>{"use strict";var S7=require("os"),ln=hA(),nr=process.env,Ko=void 0;ln("no-color")||ln("no-colors")||ln("color=false")?Ko=!1:(ln("color")||ln("colors")||ln("color=true")||ln("color=always"))&&(Ko=!0);"FORCE_COLOR"in nr&&(Ko=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(Ko===!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&&Ko!==!0)return 0;var e=Ko?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 lD(t){var e=O7(t);return A7(e)}dA.exports={supportsColor:lD,stdout:lD(process.stdout),stderr:lD(process.stderr)}});var gA=C((Lye,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=C((Bye,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 g=f[p],v=0;v<=h[g];v++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var vA=C((jye,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=C((Mye,EA)=>{EA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var CA=C((Uye,_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=C((qye,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=C((Vye,PA)=>{var ve={};PA.exports=ve;ve.themes={};var x7=require("util"),Es=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 Hye=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=Es[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 Es.grey=Es.gray,Object.keys(Es).forEach(function(e){Es[e].closeRe=new RegExp(P7(Es[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
|
-
`)!=-1,n=this._styles,i=n.length;i--;){var s=Es[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=C((zye,RA)=>{var $7=FA();RA.exports=$7});var NA=C(fD=>{"use strict";fD.indent=function(e){return new Array(e+1).join(" ")};fD.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=C((Gye,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=C(qu=>{"use strict";var En=kA()
|
|
43
|
+
`);let S=await D.signMessage(new TextEncoder().encode(p),"utf8");if(!S||!(S instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");g=S}}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)(g)},!((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:g,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:g.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,ju.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,ju.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,ju.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,ju.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}}};$f.nextInstanceID={};Xy.default=$f});var bS=C(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var LH=(he(),ce(fe)),BH=LH.__importDefault(If()),jH=BH.default;Jy.default=jH});var _S=C(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var MH=(he(),ce(fe)),UH=MH.__importDefault(Yy()),qH=UH.default;Zy.default=qH});var Qy=C(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 qo=(he(),ce(fe)),HH=qo.__importDefault(If());It.GoTrueAdminApi=HH.default;var VH=qo.__importDefault(Yy());It.GoTrueClient=VH.default;var zH=qo.__importDefault(bS());It.AuthAdminApi=zH.default;var KH=qo.__importDefault(_S());It.AuthClient=KH.default;qo.__exportStar(jy(),It);qo.__exportStar(gs(),It);var Lf=Vy();Object.defineProperty(It,"navigatorLock",{enumerable:!0,get:function(){return Lf.navigatorLock}});Object.defineProperty(It,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return Lf.NavigatorLockAcquireTimeoutError}});Object.defineProperty(It,"lockInternals",{enumerable:!0,get:function(){return Lf.internals}});Object.defineProperty(It,"processLock",{enumerable:!0,get:function(){return Lf.processLock}})});var CS=C(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.SupabaseAuthClient=void 0;var GH=Qy(),eD=class extends GH.AuthClient{constructor(e){super(e)}};Bf.SupabaseAuthClient=eD});var nD=C(rD=>{"use strict";Object.defineProperty(rD,"__esModule",{value:!0});var WH=ng(),XH=vg(),YH=Bg(),JH=zC(),jf=GC(),ZH=WC(),SS=YC(),QH=CS(),tD=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:jf.DEFAULT_DB_OPTIONS,realtime:jf.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},jf.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:jf.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)}};rD.default=tD});var xS=C(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(nD());AS(Qy(),We);var r7=vg();Object.defineProperty(We,"PostgrestError",{enumerable:!0,get:function(){return r7.PostgrestError}});var Mu=ng();Object.defineProperty(We,"FunctionsHttpError",{enumerable:!0,get:function(){return Mu.FunctionsHttpError}});Object.defineProperty(We,"FunctionsFetchError",{enumerable:!0,get:function(){return Mu.FunctionsFetchError}});Object.defineProperty(We,"FunctionsRelayError",{enumerable:!0,get:function(){return Mu.FunctionsRelayError}});Object.defineProperty(We,"FunctionsError",{enumerable:!0,get:function(){return Mu.FunctionsError}});Object.defineProperty(We,"FunctionRegion",{enumerable:!0,get:function(){return Mu.FunctionRegion}});AS(Bg(),We);var n7=nD();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 iD=C((Dye,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 Mf=C(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=C((vye,NS)=>{var a7=require("fs"),Ft=require("path"),FS=iD(),u7=Mf(),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=C((Eye,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=C((bye,jS)=>{jS.exports={efs:!0,encode:t=>Buffer.from(t,"utf8"),decode:t=>t.toString("utf8")}});var Vo=C((_ye,Ho)=>{Ho.exports=$S();Ho.exports.Constants=iD();Ho.exports.Errors=Mf();Ho.exports.FileAttr=BS();Ho.exports.decoder=MS()});var qS=C((Cye,US)=>{var $i=Vo(),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 g={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 g.extraLen},set extraLocalLength(m){g.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+g.fnameLen+g.extraLen},get localHeader(){return g},loadLocalHeaderFromBinary:function(m){var D=m.slice(p,p+Y.LOCHDR);if(D.readUInt32LE(0)!==Y.LOCSIG)throw $i.Errors.INVALID_LOC();g.version=D.readUInt16LE(Y.LOCVER),g.flags=D.readUInt16LE(Y.LOCFLG),g.method=D.readUInt16LE(Y.LOCHOW),g.time=D.readUInt32LE(Y.LOCTIM),g.crc=D.readUInt32LE(Y.LOCCRC),g.compressedSize=D.readUInt32LE(Y.LOCSIZ),g.size=D.readUInt32LE(Y.LOCLEN),g.fnameLen=D.readUInt16LE(Y.LOCNAM),g.extraLen=D.readUInt16LE(Y.LOCEXT);let w=p+Y.LOCHDR+g.fnameLen,S=w+g.extraLen;return m.slice(w,S)},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(g.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=C((Sye,HS)=>{var zo=Vo(),ht=zo.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 zo.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=zo.readBigUInt64LE(s,ht.ZIP64SUB),e=zo.readBigUInt64LE(s,ht.ZIP64TOT),r=zo.readBigUInt64LE(s,ht.ZIP64SIZE),n=zo.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 oD=C(sD=>{sD.EntryHeader=qS();sD.MainHeader=VS()});var KS=C((Oye,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=C((xye,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=C((Tye,ZS)=>{"use strict";var{randomFillSync:XS}=require("crypto"),h7=Mf(),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,Uu=()=>typeof XS=="function"?XS(Buffer.alloc(12)):Uu.node();Uu.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 Uf={genSalt:Uu};function qf(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])}qf.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};qf.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return JS(t,t^1)>>8&255};function p7(t){let e=new qf(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 qf(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?Uf.genSalt=function(){return t.slice(0,12)}:t==="node"?Uf.genSalt=Uu.node:Uf.genSalt=Uu}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=Uf.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=C(Hf=>{Hf.Deflater=KS();Hf.Inflater=WS();Hf.ZipCrypto=QS()});var uD=C((Pye,tA)=>{var $e=Vo(),w7=oD(),Dt=$e.Constants,aD=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 S=d();if(S.length===0)return m&&D&&D(S),S;if(r.encrypted){if(typeof w!="string"&&!Buffer.isBuffer(w))throw $e.Errors.INVALID_PASS_PARAM();S=aD.ZipCrypto.decrypt(S,r,w)}var F=Buffer.alloc(r.size);switch(r.method){case $e.Constants.STORED:if(S.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 _=new aD.Inflater(S,r.size);if(m)_.inflateAsync(function(k){k.copy(k,0),D&&(f(k)?D(k):D(k,$e.Errors.BAD_CRC()))});else{if(_.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 g(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 S=new aD.Deflater(o);if(m)S.deflateAsync(function(_){w=Buffer.alloc(_.length),r.compressedSize=_.length,_.copy(w),D&&D(w)});else{var F=S.deflate();return r.compressedSize=F.length,F}S=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,S,F;D+4<m.length;)w=m.readUInt16LE(D),D+=2,S=m.readUInt16LE(D),D+=2,F=m.slice(D,D+S),D+=S,Dt.ID_ZIP64===w&&A(F)}catch{throw $e.Errors.EXTRA_FIELD_PARSE_ERROR()}}function A(m){var D,w,S,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&&(S=v(m,Dt.EF_ZIP64_RHO),r.offset===Dt.EF_ZIP64_OR_32&&(r.offset=S)),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 g(!1,null)},getCompressedDataAsync:function(m){g(!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=C((Fye,nA)=>{var rA=uD(),v7=oD(),qt=Vo();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,S=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,S=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(S+qt.Constants.ENDHDR)),v&&f()}function g(){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(),g();let v=[],E=[],A=0,m=0;s.size=0,s.offset=0;let D=0;for(let F of this.entries){let _=F.getCompressedData();F.header.offset=m;let k=F.packLocalHeader(),R=k.length+_.length;m+=R,v.push(k),v.push(_);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 S=s.toBinary();return i&&i.copy(S,qt.Constants.ENDHDR),S.copy(w,m),t=w,o=!1,w},toAsyncBuffer:function(v,E,A,m){try{o||f(),g();let D=[],w=[],S=0,F=0,_=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 K=I.packLocalHeader(),L=K.length+j.length;F+=L,D.push(K),D.push(j);let b=I.packCentralHeader();w.push(b),s.size+=b.length,S+=L+b.length,_++,k(R)})}else{S+=s.mainHeaderSize,s.offset=F,s.totalEntries=_,F=0;let I=Buffer.alloc(S);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 cD=C((Rye,oA)=>{var dt=Vo(),wt=require("path"),E7=uD(),b7=iA(),vs=(...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:g,sep:v}=wt.posix;return p(".",g(v+f.split("\\").join(v)+v))}function h(f){return f instanceof RegExp?(function(p){return function(g){return p.test(g)}})(f):typeof f!="function"?()=>!0:f}let d=(f,p)=>{let g=p.slice(-1);return g=g===i.sep?i.sep:"",wt.relative(f,p)+g};return{readFile:function(f,p){var g=c(f);return g&&g.getData(p)||null},childCount:function(f){let p=c(f);if(p)return s.getChildCount(p)},readFileAsync:function(f,p){var g=c(f);g?g.getDataAsync(p):p(null,"getEntry failed for:"+f)},readAsText:function(f,p){var g=c(f);if(g){var v=g.getData();if(v&&v.length)return v.toString(p||"utf8")}return""},readAsTextAsync:function(f,p,g){var v=c(f);v?v.getDataAsync(function(E,A){if(A){p(E,A);return}E&&E.length?p(E.toString(g||"utf8")):p("")}):p("")},deleteFile:function(f,p=!0){var g=c(f);g&&s.deleteFile(g.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 g=c(f);g&&(g.comment=p)},getZipEntryComment:function(f){var p=c(f);return p&&p.comment||""},updateFile:function(f,p){var g=c(f);g&&g.setData(p)},addLocalFile:function(f,p,g,v){if(i.fs.existsSync(f)){p=p?l(p):"";let E=wt.win32.basename(wt.win32.normalize(f));p+=g||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 g=wt.resolve(f.localPath),{comment:v}=f,{zipPath:E,zipName:A}=f,m=this;i.fs.stat(g,function(D,w){if(D)return p(D,!1);E=E?l(E):"";let S=wt.win32.basename(wt.win32.normalize(g));if(E+=A||S,w.isFile())i.fs.readFile(g,function(F,_){return F?p(F,!1):(m.addFile(E,_,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,g){if(g=h(g),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));g(m)&&E.addLocalFile(A,wt.dirname(m))}}else throw dt.Errors.FILE_NOT_FOUND(f)},addLocalFolderAsync:function(f,p,g,v){v=h(v),g=g?l(g):"",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 S=m[D],F=d(f,S).split("\\").join("/");F=F.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^\x20-\x7E]/g,""),v(F)?i.fs.stat(S,function(_,k){_&&p(void 0,_),k.isFile()?i.fs.readFile(S,function(R,I){R?p(void 0,R):(E.addFile(g+F,I,"",k),w())}):(E.addFile(g+F+"/",Buffer.alloc(0),"",k),w())}):process.nextTick(()=>{w()})}else p(!0,void 0)};w()}})},addLocalFolderAsync2:function(f,p){let g=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(S){return w.test(S)}})(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(S,F){if(S)return p(S);F=F.filter(_=>E(m(_))),F.length||p(void 0,!1),setImmediate(F.reverse().reduce(function(_,k){return function(R,I){if(R||I===!1)return setImmediate(_,R,!1);g.addLocalFileAsync({localPath:k,zipPath:wt.dirname(m(k)),zipName:D(k)},_)}},p))})})},addLocalFolderPromise:function(f,p){return new Promise((g,v)=>{this.addLocalFolderAsync2(Object.assign({localPath:f},p),(E,A)=>{E&&v(E),A&&g(this)})})},addFile:function(f,p,g,v){f=u(f);let E=c(f),A=E!=null;A||(E=new E7(n),E.entryName=f),E.comment=g||"";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,g,v,E,A){v=vs(!1,v),E=vs(!1,E),g=vs(!0,g),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:g?D:wt.basename(D));if(m.isDirectory){var S=s.getEntryChildren(m);return S.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,g?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 _=E?f.header.fileAttr:void 0;return i.writeFileTo(w,F,v,_),!0},test:function(f){if(!s)return!1;for(var p in s.entries)try{if(p.isDirectory)continue;var g=s.entries[p].getData(f);if(!g)return!1}catch{return!1}return!0},extractAllTo:function(f,p,g,v){if(g=vs(!1,g),v=sA(g,v),p=vs(!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=g?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,g,v){if(v=_7(p,g,v),g=vs(!1,g),p=vs(!1,p),!v)return new Promise((w,S)=>{this.extractAllToAsync(f,p,g,function(F){F?S(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,S)=>new Error(w+': "'+S+'"'),m=[],D=[];s.entries.forEach(w=>{w.isDirectory?m.push(w):D.push(w)});for(let w of m){let S=E(w),F=g?w.header.fileAttr:void 0;try{i.makeDir(S),F&&i.fs.chmodSync(S,F),i.fs.utimesSync(S,w.header.time,w.header.time)}catch{v(A("Unable to create folder",S))}}D.reverse().reduce(function(w,S){return function(F){if(F)w(F);else{let _=wt.normalize(o(S.entryName)),k=a(f,_);S.getDataAsync(function(R,I){if(I)w(I);else if(!R)w(dt.Errors.CANT_EXTRACT_FILE());else{let B=g?S.header.fileAttr:void 0;i.writeFileToAsync(k,R,p,B,function(j){j||w(A("Unable to write file",k)),i.fs.utimes(k,S.header.time,S.header.time,function(K){K?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 g=s.compressToBuffer();if(g){var v=i.writeFileTo(f,g,!0);typeof p=="function"&&p(v?null:new Error("failed"),"")}}},writeZipPromise:function(f,p){let{overwrite:g,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,g,v,D)},A)})},toBufferPromise:function(){return new Promise((f,p)=>{s.toAsyncBuffer(f,p)})},toBuffer:function(f,p,g,v){return typeof f=="function"?(s.toAsyncBuffer(f,p,g,v),null):s.compressToBuffer()}}}});var lA=C((kye,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=C((Nye,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=C(($ye,dA)=>{"use strict";var S7=require("os"),ln=hA(),nr=process.env,Ko=void 0;ln("no-color")||ln("no-colors")||ln("color=false")?Ko=!1:(ln("color")||ln("colors")||ln("color=true")||ln("color=always"))&&(Ko=!0);"FORCE_COLOR"in nr&&(Ko=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(Ko===!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&&Ko!==!0)return 0;var e=Ko?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 lD(t){var e=O7(t);return A7(e)}dA.exports={supportsColor:lD,stdout:lD(process.stdout),stderr:lD(process.stderr)}});var gA=C((Lye,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=C((Bye,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 g=f[p],v=0;v<=h[g];v++)c[g]&&(l=l+n[g][s(n[g].length)])}return l}return a(e,r)}});var vA=C((jye,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=C((Mye,EA)=>{EA.exports=function(t){return function(e,r,n){return r%2===0?e:t.inverse(e)}}});var CA=C((Uye,_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=C((qye,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=C((Vye,PA)=>{var ve={};PA.exports=ve;ve.themes={};var x7=require("util"),Es=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 Hye=ve.stylize=function(e,r){if(!ve.enabled)return e+"";var n=Es[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 Es.grey=Es.gray,Object.keys(Es).forEach(function(e){Es[e].closeRe=new RegExp(P7(Es[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
|
+
`)!=-1,n=this._styles,i=n.length;i--;){var s=Es[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=C((zye,RA)=>{var $7=FA();RA.exports=$7});var NA=C(fD=>{"use strict";fD.indent=function(e){return new Array(e+1).join(" ")};fD.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=C((Gye,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=C(qu=>{"use strict";var En=kA(),Li=NA(),B7=/[^\w\s\n\r\v\t\.,]/i;qu.version=$A().version;var hD=function(t,e){return t!==void 0||e.renderUndefined},Vf=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)&&Vf(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},dD=function(t,e){return t.multilineStringColor===null||t.noColor?e:En[t.multilineStringColor](e)},M7=function(t,e,r){var n=t.split(`
|
|
46
|
-
`);return n=n.map(function(i){return
|
|
47
|
-
`)},Go=function(t,e,r){if(typeof t=="string"&&t.match(B7)&&e.escape&&(t=JSON.stringify(t)),!hD(t,e))return[];if(Vf(t,!1,e))return[
|
|
48
|
-
`)},e,r);var i=e.noAlign?0
|
|
46
|
+
`);return n=n.map(function(i){return Li.indent(e)+dD(r,i)}),n.join(`
|
|
47
|
+
`)},Go=function(t,e,r){if(typeof t=="string"&&t.match(B7)&&e.escape&&(t=JSON.stringify(t)),!hD(t,e))return[];if(Vf(t,!1,e))return[Li.indent(r)+j7(t,e)];if(typeof t=="string")return[Li.indent(r)+dD(e,'"""'),M7(t,r+e.defaultIndentation,e),Li.indent(r)+dD(e,'"""')];if(Array.isArray(t)){if(t.length===0)return[Li.indent(r)+e.emptyArrayMsg];var n=[];return t.forEach(function(a){if(hD(a,e)){var u="- ";e.noColor||(u=En[e.dashColor](u)),u=Li.indent(r)+u,Vf(a,!1,e)?(u+=Go(a,e,0)[0],n.push(u)):(n.push(u),n.push.apply(n,Go(a,e,r+e.defaultIndentation)))}}),n}if(t instanceof Error)return Go({message:t.message,stack:t.stack.split(`
|
|
48
|
+
`)},e,r);var i=e.noAlign?0:Li.getMaxIndexLength(t),s,o=[];return Object.getOwnPropertyNames(t).forEach(function(a){if(hD(t[a],e))if(s=a+": ",e.noColor||(s=En[e.keysColor](s)),s=Li.indent(r)+s,Vf(t[a],!1,e)){var u=e.noAlign?0:i-a.length;s+=Go(t[a],e,u)[0],o.push(s)}else o.push(s),o.push.apply(o,Go(t[a],e,r+e.defaultIndentation))}),o};qu.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,Go(e,r,n).join(`
|
|
49
49
|
`)};qu.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
50
|
`,e=e.substr(o)}try{s=JSON.parse(e)}catch{return En.red("Error:")+" Not valid JSON!"}return i+=qu.render(s,r,n),i}});var gD=C(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});zf.default=void 0;function Wo(t){"@babel/helpers - typeof";return Wo=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},Wo(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 Wo(e)=="symbol"?e:e+""}function H7(t,e){if(Wo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Wo(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=Vu(e),K7(t,mD()?Reflect.construct(e,r||[],Vu(t).constructor):e.apply(t,r))}function K7(t,e){if(e&&(Wo(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&&Hu(t,e)}function pD(t){var e=typeof Map=="function"?new Map:void 0;return pD=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,Vu(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Hu(i,n)},pD(t)}function X7(t,e,r){if(mD())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&Hu(i,r.prototype),i}function mD(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(mD=function(){return!!t})()}function Y7(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch{return typeof t=="function"}}function Hu(t,e){return Hu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Hu(t,e)}function Vu(t){return Vu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vu(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)})(pD(Error)),Xye=zf.default=J7});var yD=C(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});Kf.enableDebugLog=Z7;Kf.log=Q7;var jA=!1;function Z7(){jA=!0}function Q7(t){jA&&console.log(t)}});var UA=C(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.default=void 0;function zu(t){"@babel/helpers - typeof";return zu=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},zu(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 zu(e)=="symbol"?e:e+""}function nV(t,e){if(zu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(zu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Zye=Gf.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=C((DD,wD)=>{(function(t,e){typeof DD=="object"&&typeof wD<"u"?wD.exports=e():typeof define=="function"&&define.amd?define(e):(function(){var r=t.Base64,n=e();n.noConflict=function(){return t.Base64=r,n},t.Meteor&&(Base64=n),t.Base64=n})()})(typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:DD,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,g=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(g(U)):g(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 g(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)},S=function(U){return w(U,!0)},F=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,_=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,_)},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))},K=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=="-"?"+":"/"}))},b=function(U){return K(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 b(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:b,toBase64:w,encode:w,encodeURI:S,encodeURL:S,utob:m,btou:k,decode:b,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=C((eDe,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=C(vD=>{"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("&"):""}vD.stringify=aV;vD.parse=oV});var tO=C((rDe,eO)=>{"use strict";var XA=VA(),Wf=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 bD(t){return(t||"").toString().replace(uV,"")}var ED=[["#","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=bD(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=bD(t),t=t.replace(YA,""),!(this instanceof _n))return new _n(t,e,r);var n,i,s,o,a,u,c=ED.slice(),l=typeof e,h=this,d=0;for(l!=="object"&&l!=="string"&&(r=e,e=null),r&&typeof r!="function"&&(r=Wf.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||Wf.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<ED.length;o++){var a=ED[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=Wf.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=bD;_n.qs=Wf;eO.exports=_n});var rO=C(_D=>{"use strict";Object.defineProperty(_D,"__esModule",{value:!0});_D.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=C(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});Zf.default=void 0;var gV=qA(),yV=AD(tO()),Xf=AD(gD()),bs=yD(),DV=AD(rO());function AD(t){return t&&t.__esModule?t:{default:t}}function CD(){"use strict";CD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(b,T,P){b[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(b,T,P){return Object.defineProperty(b,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),b[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(b,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new K($||[]);return i(M,"_invoke",{value:R(b,P,G)}),M}function h(b,T,P){try{return{type:"normal",arg:b.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",g="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==r&&n.call(S,o)&&(D=S);var F=m.prototype=E.prototype=Object.create(D);function _(b){["next","throw","return"].forEach(function(T){c(b,T,function(P){return this._invoke(T,P)})})}function k(b,T){function P(q,M,G,U){var H=h(b[q],b,M);if(H.type!=="throw"){var te=H.arg,x=te.value;return x&&_s(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(b,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===g){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 $=g,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(b,T,P);if(H.type==="normal"){if($=P.done?g:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=g,P.method="throw",P.arg=H.arg)}}}function I(b,T){var P=T.method,$=b.iterator[P];if($===t)return T.delegate=null,P==="throw"&&b.iterator.return&&(T.method="return",T.arg=t,I(b,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($,b.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[b.resultName]=M.value,T.next=b.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(b){var T={tryLoc:b[0]};1 in b&&(T.catchLoc=b[1]),2 in b&&(T.finallyLoc=b[2],T.afterLoc=b[3]),this.tryEntries.push(T)}function j(b){var T=b.completion||{};T.type="normal",delete T.arg,b.completion=T}function K(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(B,this),this.reset(!0)}function L(b){if(b||b===""){var T=b[o];if(T)return T.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var P=-1,$=function q(){for(;++P<b.length;)if(n.call(b,P))return q.value=b[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(_s(b)+" 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(b){var T=typeof b=="function"&&b.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,m):(b.__proto__=m,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},_(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(b,T,P,$,q){q===void 0&&(q=Promise);var M=new k(l(b,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},_(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var T=Object(b),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,K.prototype={constructor:K,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(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 _s(t){"@babel/helpers - typeof";return _s=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},_s(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
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 Xo(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 _s(e)=="symbol"?e:e+""}function OV(t,e){if(_s(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(_s(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yf="tus-v1",Jf="ietf-draft-03",Ku="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:Yf},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(![Yf,Jf,Ku].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,bs.log)("No fingerprint was calculated meaning that the upload cannot be stored in the URL storage."):(0,bs.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(g,v){var E=Xo(Xo({},n.options),{},{uploadUrl:l.uploadUrl||null,storeFingerprintForResuming:!1,removeFingerprintOnSuccess:!1,parallelUploads:1,parallelUploadBoundaries:null,metadata:n.options.metadataForPartialUploads,headers:Xo(Xo({},n.options.headers),{},{"Upload-Concat":"partial"}),onSuccess:g,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(!Yo(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,bs.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,bs.log)("Resuming upload from previous URL: ".concat(this.url)),this._resumeUpload();return}if(this.options.uploadUrl!=null){(0,bs.log)("Resuming upload from provided URL: ".concat(this.options.uploadUrl)),this.url=this.options.uploadUrl,this._resumeUpload();return}(0,bs.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 Xf.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===Jf||this.options.protocol===Ku)&&n.setHeader("Upload-Complete","?0"),s=this._sendRequest(n,null)),s.then(function(o){if(!Yo(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,bs.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(!Yo(o,200)){if(o===423){r._emitHttpError(n,s,"tus: upload is currently locked; retry later");return}if(Yo(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===Yf){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(!Yo(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===Yf?r.setHeader("Content-Type","application/offset+octet-stream"):this.options.protocol===Ku&&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===Jf||n.options.protocol===Ku)&&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 Xf.default("tus: unexpected response while terminating upload",null,i,s)}).catch(function(s){if(s instanceof Xf.default||(s=new Xf.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=Xo(Xo({},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 Yo(t,e){return t>=e&&t<e+100}function uO(t,e,r){var n=r.httpStack.createRequest(t,e);r.protocol===Jf?n.setHeader("Upload-Draft-Interop-Version","5"):r.protocol===Ku?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 SD.apply(this,arguments)}function SD(){return SD=wV(CD().mark(function t(e,r,n){var i;return CD().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)})),SD.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(!Yo(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 iDe=Zf.default=mO});var wO=C((oDe,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=C(Qf=>{"use strict";Object.defineProperty(Qf,"__esModule",{value:!0});Qf.default=void 0;function Gu(t){"@babel/helpers - typeof";return Gu=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},Gu(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 Gu(e)=="symbol"?e:e+""}function kV(t,e){if(Gu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Gu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var aDe=Qf.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=C(TD=>{"use strict";Object.defineProperty(TD,"__esModule",{value:!0});TD.default=MV;var CO=require("fs");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 OD(){"use strict";OD=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(b,T,P){b[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(b,T,P){return Object.defineProperty(b,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),b[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(b,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new K($||[]);return i(M,"_invoke",{value:R(b,P,G)}),M}function h(b,T,P){try{return{type:"normal",arg:b.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",g="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==r&&n.call(S,o)&&(D=S);var F=m.prototype=E.prototype=Object.create(D);function _(b){["next","throw","return"].forEach(function(T){c(b,T,function(P){return this._invoke(T,P)})})}function k(b,T){function P(q,M,G,U){var H=h(b[q],b,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(b,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===g){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 $=g,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(b,T,P);if(H.type==="normal"){if($=P.done?g:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=g,P.method="throw",P.arg=H.arg)}}}function I(b,T){var P=T.method,$=b.iterator[P];if($===t)return T.delegate=null,P==="throw"&&b.iterator.return&&(T.method="return",T.arg=t,I(b,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($,b.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[b.resultName]=M.value,T.next=b.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(b){var T={tryLoc:b[0]};1 in b&&(T.catchLoc=b[1]),2 in b&&(T.finallyLoc=b[2],T.afterLoc=b[3]),this.tryEntries.push(T)}function j(b){var T=b.completion||{};T.type="normal",delete T.arg,b.completion=T}function K(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(B,this),this.reset(!0)}function L(b){if(b||b===""){var T=b[o];if(T)return T.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var P=-1,$=function q(){for(;++P<b.length;)if(n.call(b,P))return q.value=b[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Cs(b)+" 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(b){var T=typeof b=="function"&&b.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,m):(b.__proto__=m,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},_(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(b,T,P,$,q){q===void 0&&(q=Promise);var M=new k(l(b,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},_(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var T=Object(b),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,K.prototype={constructor:K,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(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 Cs(e)=="symbol"?e:e+""}function BV(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)}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 xD.apply(this,arguments)}function xD(){return xD=jV(OD().mark(function t(e){var r,n,i,s,o,a,u;return OD().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)})),xD.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 PD=C(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});eh.default=void 0;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 Wu(){"use strict";Wu=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(b,T,P){b[T]=P.value},s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(b,T,P){return Object.defineProperty(b,T,{value:P,enumerable:!0,configurable:!0,writable:!0}),b[T]}try{c({},"")}catch{c=function(P,$,q){return P[$]=q}}function l(b,T,P,$){var q=T&&T.prototype instanceof E?T:E,M=Object.create(q.prototype),G=new K($||[]);return i(M,"_invoke",{value:R(b,P,G)}),M}function h(b,T,P){try{return{type:"normal",arg:b.call(T,P)}}catch($){return{type:"throw",arg:$}}}e.wrap=l;var d="suspendedStart",f="suspendedYield",p="executing",g="completed",v={};function E(){}function A(){}function m(){}var D={};c(D,o,function(){return this});var w=Object.getPrototypeOf,S=w&&w(w(L([])));S&&S!==r&&n.call(S,o)&&(D=S);var F=m.prototype=E.prototype=Object.create(D);function _(b){["next","throw","return"].forEach(function(T){c(b,T,function(P){return this._invoke(T,P)})})}function k(b,T){function P(q,M,G,U){var H=h(b[q],b,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(b,T,P){var $=d;return function(q,M){if($===p)throw Error("Generator is already running");if($===g){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 $=g,P.arg;P.dispatchException(P.arg)}else P.method==="return"&&P.abrupt("return",P.arg);$=p;var H=h(b,T,P);if(H.type==="normal"){if($=P.done?g:f,H.arg===v)continue;return{value:H.arg,done:P.done}}H.type==="throw"&&($=g,P.method="throw",P.arg=H.arg)}}}function I(b,T){var P=T.method,$=b.iterator[P];if($===t)return T.delegate=null,P==="throw"&&b.iterator.return&&(T.method="return",T.arg=t,I(b,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($,b.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[b.resultName]=M.value,T.next=b.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(b){var T={tryLoc:b[0]};1 in b&&(T.catchLoc=b[1]),2 in b&&(T.finallyLoc=b[2],T.afterLoc=b[3]),this.tryEntries.push(T)}function j(b){var T=b.completion||{};T.type="normal",delete T.arg,b.completion=T}function K(b){this.tryEntries=[{tryLoc:"root"}],b.forEach(B,this),this.reset(!0)}function L(b){if(b||b===""){var T=b[o];if(T)return T.call(b);if(typeof b.next=="function")return b;if(!isNaN(b.length)){var P=-1,$=function q(){for(;++P<b.length;)if(n.call(b,P))return q.value=b[P],q.done=!1,q;return q.value=t,q.done=!0,q};return $.next=$}}throw new TypeError(Ss(b)+" 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(b){var T=typeof b=="function"&&b.constructor;return!!T&&(T===A||(T.displayName||T.name)==="GeneratorFunction")},e.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,m):(b.__proto__=m,c(b,u,"GeneratorFunction")),b.prototype=Object.create(F),b},e.awrap=function(b){return{__await:b}},_(k.prototype),c(k.prototype,a,function(){return this}),e.AsyncIterator=k,e.async=function(b,T,P,$,q){q===void 0&&(q=Promise);var M=new k(l(b,T,P,$),q);return e.isGeneratorFunction(T)?M:M.next().then(function(G){return G.done?G.value:M.next()})},_(F),c(F,u,"Generator"),c(F,o,function(){return this}),c(F,"toString",function(){return"[object Generator]"}),e.keys=function(b){var T=Object(b),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,K.prototype={constructor:K,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(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 Ss(e)=="symbol"?e:e+""}function zV(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 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 ID.apply(this,arguments)}function ID(){return ID=xO(Wu().mark(function t(e,r){return Wu().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)})),ID.apply(this,arguments)}var lDe=eh.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(Wu().mark(function n(i,s){var o,a,u,c,l;return Wu().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=C(rh=>{"use strict";Object.defineProperty(rh,"__esModule",{value:!0});rh.default=void 0;var GV=require("fs"),WV=th(wO()),XV=th(EO()),YV=th(SO()),JV=th(PD());function th(t){return t&&t.__esModule?t:{default:t}}function Xu(t){"@babel/helpers - typeof";return Xu=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},Xu(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 Xu(e)=="symbol"?e:e+""}function tz(t,e){if(Xu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Xu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var hDe=rh.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=C(FD=>{"use strict";Object.defineProperty(FD,"__esModule",{value:!0});FD.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=C((mDe,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,RD=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,nh(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(S){var F=n,_=i;return n=i=void 0,c=S,o=t.apply(_,F),o}function p(S){return c=S,a=setTimeout(E,e),l?f(S):o}function g(S){var F=S-u,_=S-c,k=e-F;return h?yz(k,s-_):k}function v(S){var F=S-u,_=S-c;return u===void 0||F>=e||F<0||h&&_>=s}function E(){var S=RD();if(v(S))return A(S);a=setTimeout(E,g(S))}function A(S){return a=void 0,d&&n?f(S):(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(RD())}function w(){var S=RD(),F=v(S);if(n=arguments,i=this,u=S,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 nh(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 nh(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(nh(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=nh(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=C(ah=>{"use strict";Object.defineProperty(ah,"__esModule",{value:!0});ah.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=ih(e),Oz(t,KO()?Reflect.construct(e,r||[],ih(t).constructor):e.apply(t,r))}function Oz(t,e){if(e&&(Jo(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 ih(t){return ih=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ih(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&&kD(t,e)}function kD(t,e){return kD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},kD(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 Yu(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 Jo(t){"@babel/helpers - typeof";return Jo=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},Jo(t)}function sh(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 oh(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 Jo(e)=="symbol"?e:e+""}function Pz(t,e){if(Jo(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Jo(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var gDe=ah.default=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};sh(this,t),this._requestOptions=e}return oh(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){sh(this,t),this._method=e,this._url=r,this._headers={},this._request=null,this._progressHandler=function(){},this._requestOptions=n||{}}return oh(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=Yu(Yu(Yu({},(0,Cz.parse)(r._url)),r._requestOptions),{},{method:r._method,headers:Yu(Yu({},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){sh(this,t),this._response=e,this._body=r}return oh(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 sh(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),oh(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=C(ND=>{"use strict";ND.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};ND.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=C((wDe,JO)=>{"use strict";JO.exports=As;As.factory=XO();var BD=As("CustomError");BD.order=As(BD,{message:"Arguments out of order.",code:"EOARG"});function As(t,e,r,n){var i,s;return e=uh(arguments,1,Error,YO,[$D,ch]),r=uh(arguments,2,{},$D,[ch]),n=uh(arguments,3,LD,ch,[]),t=uh(arguments,0,e===Error?"Error":e.prototype.CustomError.name,$z,[YO,$D,ch]),s=e===Error,s&&n===LD&&(n=As.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(As.factory).forEach(function(p){l[p]=function(g,v){As.factory[p].call(u,g,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==LD&&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 uh(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 BD.order;return o!==-1?t[o]:r}function ch(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 $D(t){return t&&typeof t=="object"}function LD(){}});var ex=C((vDe,QO)=>{QO.exports=ZO()});var sx=C((Os,Zo)=>{var Lz=1/0,Bz="[object Symbol]",Ju={function:!0,object:!0},jz=Ju[typeof Os]&&Os&&!Os.nodeType?Os:void 0,Mz=Ju[typeof Zo]&&Zo&&!Zo.nodeType?Zo:void 0,Uz=lh(jz&&Mz&&typeof global=="object"&&global),qz=lh(Ju[typeof self]&&self),tx=lh(Ju[typeof window]&&window),jD=lh(Ju[typeof Os]&&Os),Hz=Uz||tx!==(jD&&jD.window)&&tx||qz||jD||Function("return this")();function lh(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}Zo.exports=Kz});var hx=C((xs,Qo)=>{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\]$/,Qu={function:!0,object:!0},nK=Qu[typeof xs]&&xs&&!xs.nodeType?xs:void 0,iK=Qu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,sK=fh(nK&&iK&&typeof global=="object"&&global),oK=fh(Qu[typeof self]&&self),ox=fh(Qu[typeof window]&&window),MD=fh(Qu[typeof xs]&&xs),aK=sK||ox!==(MD&&MD.window)&&ox||oK||MD||Function("return this")();function fh(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,UD=ux.hasOwnProperty,lK=ux.toString,fK=RegExp("^"+cx.call(UD).replace(eK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hK=cK.splice,dK=lx(aK,"Map"),Zu=lx(Object,"create");function Ts(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function pK(){this.__data__=Zu?Zu(null):{}}function mK(t){return this.has(t)&&delete this.__data__[t]}function gK(t){var e=this.__data__;if(Zu){var r=e[t];return r===ax?void 0:r}return UD.call(e,t)?e[t]:void 0}function yK(t){var e=this.__data__;return Zu?e[t]!==void 0:UD.call(e,t)}function DK(t,e){var r=this.__data__;return r[t]=Zu&&e===void 0?ax:e,this}Ts.prototype.clear=pK;Ts.prototype.delete=mK;Ts.prototype.get=gK;Ts.prototype.has=yK;Ts.prototype.set=DK;function ea(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=hh(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=hh(e,t);return r<0?void 0:e[r][1]}function bK(t){return hh(this.__data__,t)>-1}function _K(t,e){var r=this.__data__,n=hh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ea.prototype.clear=wK;ea.prototype.delete=vK;ea.prototype.get=EK;ea.prototype.has=bK;ea.prototype.set=_K;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 CK(){this.__data__={hash:new Ts,map:new(dK||ea),string:new Ts}}function SK(t){return dh(this,t).delete(t)}function AK(t){return dh(this,t).get(t)}function OK(t){return dh(this,t).has(t)}function xK(t,e){return dh(this,t).set(t,e),this}Is.prototype.clear=CK;Is.prototype.delete=SK;Is.prototype.get=AK;Is.prototype.has=OK;Is.prototype.set=xK;function hh(t,e){for(var r=t.length;r--;)if(FK(t[r][0],e))return r;return-1}function dh(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=qD(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 qD(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(qD.Cache||Is),r}qD.Cache=Is;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)}Qo.exports=IK});var qx=C((Ps,ra)=>{var $K=hx(),LK=200,QD="__lodash_hash_undefined__",Dh=1,na=2,BK=1/0,Dx=9007199254740991,ph="[object Arguments]",zD="[object Array]",wx="[object Boolean]",vx="[object Date]",Ex="[object Error]",bx="[object Function]",jK="[object GeneratorFunction]",ec="[object Map]",_x="[object Number]",ta="[object Object]",dx="[object Promise]",Cx="[object RegExp]",tc="[object Set]",e0="[object String]",Sx="[object Symbol]",KD="[object WeakMap]",Ax="[object ArrayBuffer]",mh="[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[ph]=Qe[zD]=Qe[Ax]=Qe[wx]=Qe[mh]=Qe[vx]=Qe[Ex]=Qe[bx]=Qe[ec]=Qe[_x]=Qe[ta]=Qe[Cx]=Qe[tc]=Qe[e0]=Qe[KD]=!1;var nc={function:!0,object:!0},eG=nc[typeof Ps]&&Ps&&!Ps.nodeType?Ps:void 0,tG=nc[typeof ra]&&ra&&!ra.nodeType?ra:void 0,rG=wh(eG&&tG&&typeof global=="object"&&global),nG=wh(nc[typeof self]&&self),px=wh(nc[typeof window]&&window),HD=wh(nc[typeof Ps]&&Ps),ks=rG||px!==(HD&&HD.window)&&px||nG||HD||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 wh(t){return t&&t.Object===Object?t:null}function GD(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,vh=Object.prototype,xx=Function.prototype.toString,Fs=vh.hasOwnProperty,Ns=vh.toString,fG=RegExp("^"+xx.call(Fs).replace(JK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mx=ks.Symbol,gx=ks.Uint8Array,hG=vh.propertyIsEnumerable,dG=lG.splice,pG=Object.getPrototypeOf,mG=Object.keys,WD=ia(ks,"DataView"),gh=ia(ks,"Map"),XD=ia(ks,"Promise"),YD=ia(ks,"Set"),JD=ia(ks,"WeakMap"),rc=ia(Object,"create"),gG=Ls(WD),yG=Ls(gh),DG=Ls(XD),wG=Ls(YD),vG=Ls(JD),yx=mx?mx.prototype:void 0,VD=yx?yx.valueOf:void 0;function Rs(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__=rc?rc(null):{}}function bG(t){return this.has(t)&&delete this.__data__[t]}function _G(t){var e=this.__data__;if(rc){var r=e[t];return r===QD?void 0:r}return Fs.call(e,t)?e[t]:void 0}function CG(t){var e=this.__data__;return rc?e[t]!==void 0:Fs.call(e,t)}function SG(t,e){var r=this.__data__;return r[t]=rc&&e===void 0?QD:e,this}Rs.prototype.clear=EG;Rs.prototype.delete=bG;Rs.prototype.get=_G;Rs.prototype.has=CG;Rs.prototype.set=SG;function ti(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=Eh(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=Eh(e,t);return r<0?void 0:e[r][1]}function TG(t){return Eh(this.__data__,t)>-1}function IG(t,e){var r=this.__data__,n=Eh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ti.prototype.clear=AG;ti.prototype.delete=OG;ti.prototype.get=xG;ti.prototype.has=TG;ti.prototype.set=IG;function $s(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function PG(){this.__data__={hash:new Rs,map:new(gh||ti),string:new Rs}}function FG(t){return bh(this,t).delete(t)}function RG(t){return bh(this,t).get(t)}function kG(t){return bh(this,t).has(t)}function NG(t,e){return bh(this,t).set(t,e),this}$s.prototype.clear=PG;$s.prototype.delete=FG;$s.prototype.get=RG;$s.prototype.has=kG;$s.prototype.set=NG;function yh(t){var e=-1,r=t?t.length:0;for(this.__data__=new $s;++e<r;)this.add(t[e])}function $G(t){return this.__data__.set(t,QD),this}function LG(t){return this.__data__.has(t)}yh.prototype.add=yh.prototype.push=$G;yh.prototype.has=LG;function ei(t){this.__data__=new ti(t)}function BG(){this.__data__=new ti}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 ti&&r.__data__.length==LK&&(r=this.__data__=new $s(r.__data__)),r.set(t,e),this}ei.prototype.clear=BG;ei.prototype.delete=jG;ei.prototype.get=MG;ei.prototype.has=UG;ei.prototype.set=qG;function Eh(t,e){for(var r=t.length;r--;)if(aW(t[r][0],e))return r;return-1}function Tx(t,e){e=_h(e,t)?[e]:Fx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ch(e[r++])];return r&&r==n?t:void 0}function Ix(t,e){return Fs.call(t,e)||typeof t=="object"&&e in t&&rW(t)===null}function HG(t,e){return e in Object(t)}function t0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Ah(t)&&!ic(e)?t!==t&&e!==e:VG(t,e,t0,r,n,i)}function VG(t,e,r,n,i,s){var o=Li(t),a=Li(e),u=zD,c=zD;o||(u=Qn(t),u=u==ph?ta:u),a||(c=Qn(e),c=c==ph?ta:c);var l=u==ta&&!GD(t),h=c==ta&&!GD(e),d=u==c;if(d&&!l)return s||(s=new ei),o||lW(t)?Rx(t,e,r,n,i,s):ZG(t,e,u,r,n,i,s);if(!(i&na)){var f=l&&Fs.call(t,"__wrapped__"),p=h&&Fs.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,v=p?e.value():e;return s||(s=new ei),r(g,v,n,i,s)}}return d?(s||(s=new ei),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 ei;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?t0(l,c,n,Dh|na,h):d))return!1}}return!0}function KG(t){return typeof t=="function"?t:t==null?pW:typeof t=="object"?Li(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 _h(t)&&Nx(e)?$x(Ch(t),e):function(r){var n=fW(r,t);return n===void 0&&n===e?hW(r,t):t0(e,n,void 0,Dh|na)}}function Px(t){return function(e){return e?.[t]}}function YG(t){return function(e){return Tx(e,t)}}function Fx(t){return Li(t)?t:$K(t)}function JG(t){return function(e){var r=Qn(e);return r==ec?Ox(e):r==tc?cG(e):aG(e,t(e))}}function Rx(t,e,r,n,i,s){var o=i&na,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&Dh?new yh:void 0;for(s.set(t,e);++l<a;){var f=t[l],p=e[l];if(n)var g=o?n(p,f,l,e,t,s):n(f,p,l,t,e,s);if(g!==void 0){if(g)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 mh: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 e0:return t==e+"";case ec:var a=Ox;case tc:var u=s&na;if(a||(a=uG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=Dh,o.set(t,e),Rx(a(t),a(e),n,i,s,o));case Sx:if(VD)return VD.call(t)==VD.call(e)}return!1}function QG(t,e,r,n,i,s){var o=i&na,a=ZD(t),u=a.length,c=ZD(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 g=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}g||(g=d=="constructor")}if(p&&!g){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 bh(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 ia(t,e){var r=t[e];return cW(r)?r:void 0}function rW(t){return pG(Object(t))}function Qn(t){return Ns.call(t)}(WD&&Qn(new WD(new ArrayBuffer(1)))!=mh||gh&&Qn(new gh)!=ec||XD&&Qn(XD.resolve())!=dx||YD&&Qn(new YD)!=tc||JD&&Qn(new JD)!=KD)&&(Qn=function(t){var e=Ns.call(t),r=e==ta?t.constructor:void 0,n=r?Ls(r):void 0;if(n)switch(n){case gG:return mh;case yG:return ec;case DG:return dx;case wG:return tc;case vG:return KD}return e});function nW(t,e,r){e=_h(e,t)?[e]:Fx(e);for(var n,i=-1,o=e.length;++i<o;){var s=Ch(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&&Sh(o)&&kx(s,o)&&(Li(t)||Mx(t)||Lx(t))}function iW(t){var e=t?t.length:void 0;return Sh(e)&&(Li(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 _h(t,e){if(Li(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||vh;return t===r}function Nx(t){return t===t&&!Ah(t)}function $x(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Ch(t){if(typeof t=="string"||Ux(t))return t;var e=t+"";return e=="0"&&1/t==-BK?"-0":e}function Ls(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)&&Fs.call(t,"callee")&&(!hG.call(t,"callee")||Ns.call(t)==ph)}var Li=Array.isArray;function Bx(t){return t!=null&&Sh(eW(t))&&!jx(t)}function uW(t){return ic(t)&&Bx(t)}function jx(t){var e=Ah(t)?Ns.call(t):"";return e==bx||e==jK}function Sh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Dx}function Ah(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ic(t){return!!t&&typeof t=="object"}function cW(t){if(!Ah(t))return!1;var e=jx(t)||GD(t)?fG:ZK;return e.test(Ls(t))}function Mx(t){return typeof t=="string"||!Li(t)&&ic(t)&&Ns.call(t)==e0}function Ux(t){return typeof t=="symbol"||ic(t)&&Ns.call(t)==Sx}function lW(t){return ic(t)&&Sh(t.length)&&!!Qe[Ns.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 ZD(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(ZD);function pW(t){return t}function mW(t){return _h(t)?Px(Ch(t)):YG(t)}ra.exports=KG});var Gx=C((Bs,sa)=>{var gW=1/0,yW="[object Function]",DW="[object GeneratorFunction]",wW=/[\\^$.*+?()[\]{}|]/g,vW=/^\[object .+?Constructor\]$/,sc={function:!0,object:!0},EW=sc[typeof Bs]&&Bs&&!Bs.nodeType?Bs:void 0,bW=sc[typeof sa]&&sa&&!sa.nodeType?sa:void 0,_W=Oh(EW&&bW&&typeof global=="object"&&global),CW=Oh(sc[typeof self]&&self),Hx=Oh(sc[typeof window]&&window),r0=Oh(sc[typeof Bs]&&Bs),SW=_W||Hx!==(r0&&r0.window)&&Hx||CW||r0||Function("return this")();function Oh(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.*?")+"$"),n0=FW(SW,"Set"),PW=n0&&1/OW(new n0([,-0]))[1]==gW?function(t){return new n0(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(){}sa.exports=PW});var Xx=C((js,oa)=>{var oc={function:!0,object:!0},LW=oc[typeof js]&&js&&!js.nodeType?js:void 0,BW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,jW=xh(LW&&BW&&typeof global=="object"&&global),MW=xh(oc[typeof self]&&self),Wx=xh(oc[typeof window]&&window),i0=xh(oc[typeof js]&&js),UW=jW||Wx!==(i0&&i0.window)&&Wx||MW||i0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}oa.exports=UW});var tT=C((EDe,eT)=>{var qW=Gx(),HW=Xx(),VW=200,s0="__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,o0=Yx.hasOwnProperty,nX=Yx.toString,iX=RegExp("^"+Jx.call(o0).replace(GW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sX=rX.splice,oX=Zx(HW,"Map"),ac=Zx(Object,"create");function Ms(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__=ac?ac(null):{}}function uX(t){return this.has(t)&&delete this.__data__[t]}function cX(t){var e=this.__data__;if(ac){var r=e[t];return r===s0?void 0:r}return o0.call(e,t)?e[t]:void 0}function lX(t){var e=this.__data__;return ac?e[t]!==void 0:o0.call(e,t)}function fX(t,e){var r=this.__data__;return r[t]=ac&&e===void 0?s0:e,this}Ms.prototype.clear=aX;Ms.prototype.delete=uX;Ms.prototype.get=cX;Ms.prototype.has=lX;Ms.prototype.set=fX;function aa(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=Ih(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=Ih(e,t);return r<0?void 0:e[r][1]}function mX(t){return Ih(this.__data__,t)>-1}function gX(t,e){var r=this.__data__,n=Ih(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}aa.prototype.clear=hX;aa.prototype.delete=dX;aa.prototype.get=pX;aa.prototype.has=mX;aa.prototype.set=gX;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 yX(){this.__data__={hash:new Ms,map:new(oX||aa),string:new Ms}}function DX(t){return Ph(this,t).delete(t)}function wX(t){return Ph(this,t).get(t)}function vX(t){return Ph(this,t).has(t)}function EX(t,e){return Ph(this,t).set(t,e),this}ua.prototype.clear=yX;ua.prototype.delete=DX;ua.prototype.get=wX;ua.prototype.has=vX;ua.prototype.set=EX;function Th(t){var e=-1,r=t?t.length:0;for(this.__data__=new ua;++e<r;)this.add(t[e])}function bX(t){return this.__data__.set(t,s0),this}function _X(t){return this.__data__.has(t)}Th.prototype.add=Th.prototype.push=bX;Th.prototype.has=_X;function Ih(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 Th}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 Ph(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=C((bDe,rT)=>{var IX=qx(),PX=tT();function FX(t,e){return t&&t.length?PX(t,IX(e)):[]}rT.exports=FX});var sT=C((_De,iT)=>{"use strict";var RX=ex(),kX=nT(),NX=RX("MultiError");iT.exports=a0;function a0(t){if(!(this instanceof a0))return new a0(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=C((wDe,JO)=>{"use strict";JO.exports=As;As.factory=XO();var BD=As("CustomError");BD.order=As(BD,{message:"Arguments out of order.",code:"EOARG"});function As(t,e,r,n){var i,s;return e=uh(arguments,1,Error,YO,[$D,ch]),r=uh(arguments,2,{},$D,[ch]),n=uh(arguments,3,LD,ch,[]),t=uh(arguments,0,e===Error?"Error":e.prototype.CustomError.name,$z,[YO,$D,ch]),s=e===Error,s&&n===LD&&(n=As.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(As.factory).forEach(function(p){l[p]=function(g,v){As.factory[p].call(u,g,v,l)}}),h=this.CustomError.chain.length-1;h>=0;h--)d=this.CustomError.chain[h],d.factory!==LD&&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 uh(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 BD.order;return o!==-1?t[o]:r}function ch(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 $D(t){return t&&typeof t=="object"}function LD(){}});var ex=C((vDe,QO)=>{QO.exports=ZO()});var sx=C((Os,Zo)=>{var Lz=1/0,Bz="[object Symbol]",Ju={function:!0,object:!0},jz=Ju[typeof Os]&&Os&&!Os.nodeType?Os:void 0,Mz=Ju[typeof Zo]&&Zo&&!Zo.nodeType?Zo:void 0,Uz=lh(jz&&Mz&&typeof global=="object"&&global),qz=lh(Ju[typeof self]&&self),tx=lh(Ju[typeof window]&&window),jD=lh(Ju[typeof Os]&&Os),Hz=Uz||tx!==(jD&&jD.window)&&tx||qz||jD||Function("return this")();function lh(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}Zo.exports=Kz});var hx=C((xs,Qo)=>{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\]$/,Qu={function:!0,object:!0},nK=Qu[typeof xs]&&xs&&!xs.nodeType?xs:void 0,iK=Qu[typeof Qo]&&Qo&&!Qo.nodeType?Qo:void 0,sK=fh(nK&&iK&&typeof global=="object"&&global),oK=fh(Qu[typeof self]&&self),ox=fh(Qu[typeof window]&&window),MD=fh(Qu[typeof xs]&&xs),aK=sK||ox!==(MD&&MD.window)&&ox||oK||MD||Function("return this")();function fh(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,UD=ux.hasOwnProperty,lK=ux.toString,fK=RegExp("^"+cx.call(UD).replace(eK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hK=cK.splice,dK=lx(aK,"Map"),Zu=lx(Object,"create");function Ts(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function pK(){this.__data__=Zu?Zu(null):{}}function mK(t){return this.has(t)&&delete this.__data__[t]}function gK(t){var e=this.__data__;if(Zu){var r=e[t];return r===ax?void 0:r}return UD.call(e,t)?e[t]:void 0}function yK(t){var e=this.__data__;return Zu?e[t]!==void 0:UD.call(e,t)}function DK(t,e){var r=this.__data__;return r[t]=Zu&&e===void 0?ax:e,this}Ts.prototype.clear=pK;Ts.prototype.delete=mK;Ts.prototype.get=gK;Ts.prototype.has=yK;Ts.prototype.set=DK;function ea(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=hh(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=hh(e,t);return r<0?void 0:e[r][1]}function bK(t){return hh(this.__data__,t)>-1}function _K(t,e){var r=this.__data__,n=hh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ea.prototype.clear=wK;ea.prototype.delete=vK;ea.prototype.get=EK;ea.prototype.has=bK;ea.prototype.set=_K;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 CK(){this.__data__={hash:new Ts,map:new(dK||ea),string:new Ts}}function SK(t){return dh(this,t).delete(t)}function AK(t){return dh(this,t).get(t)}function OK(t){return dh(this,t).has(t)}function xK(t,e){return dh(this,t).set(t,e),this}Is.prototype.clear=CK;Is.prototype.delete=SK;Is.prototype.get=AK;Is.prototype.has=OK;Is.prototype.set=xK;function hh(t,e){for(var r=t.length;r--;)if(FK(t[r][0],e))return r;return-1}function dh(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=qD(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 qD(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(qD.Cache||Is),r}qD.Cache=Is;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)}Qo.exports=IK});var qx=C((Ps,ra)=>{var $K=hx(),LK=200,QD="__lodash_hash_undefined__",Dh=1,na=2,BK=1/0,Dx=9007199254740991,ph="[object Arguments]",zD="[object Array]",wx="[object Boolean]",vx="[object Date]",Ex="[object Error]",bx="[object Function]",jK="[object GeneratorFunction]",ec="[object Map]",_x="[object Number]",ta="[object Object]",dx="[object Promise]",Cx="[object RegExp]",tc="[object Set]",e0="[object String]",Sx="[object Symbol]",KD="[object WeakMap]",Ax="[object ArrayBuffer]",mh="[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[ph]=Qe[zD]=Qe[Ax]=Qe[wx]=Qe[mh]=Qe[vx]=Qe[Ex]=Qe[bx]=Qe[ec]=Qe[_x]=Qe[ta]=Qe[Cx]=Qe[tc]=Qe[e0]=Qe[KD]=!1;var nc={function:!0,object:!0},eG=nc[typeof Ps]&&Ps&&!Ps.nodeType?Ps:void 0,tG=nc[typeof ra]&&ra&&!ra.nodeType?ra:void 0,rG=wh(eG&&tG&&typeof global=="object"&&global),nG=wh(nc[typeof self]&&self),px=wh(nc[typeof window]&&window),HD=wh(nc[typeof Ps]&&Ps),ks=rG||px!==(HD&&HD.window)&&px||nG||HD||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 wh(t){return t&&t.Object===Object?t:null}function GD(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,vh=Object.prototype,xx=Function.prototype.toString,Fs=vh.hasOwnProperty,Ns=vh.toString,fG=RegExp("^"+xx.call(Fs).replace(JK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),mx=ks.Symbol,gx=ks.Uint8Array,hG=vh.propertyIsEnumerable,dG=lG.splice,pG=Object.getPrototypeOf,mG=Object.keys,WD=ia(ks,"DataView"),gh=ia(ks,"Map"),XD=ia(ks,"Promise"),YD=ia(ks,"Set"),JD=ia(ks,"WeakMap"),rc=ia(Object,"create"),gG=Ls(WD),yG=Ls(gh),DG=Ls(XD),wG=Ls(YD),vG=Ls(JD),yx=mx?mx.prototype:void 0,VD=yx?yx.valueOf:void 0;function Rs(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__=rc?rc(null):{}}function bG(t){return this.has(t)&&delete this.__data__[t]}function _G(t){var e=this.__data__;if(rc){var r=e[t];return r===QD?void 0:r}return Fs.call(e,t)?e[t]:void 0}function CG(t){var e=this.__data__;return rc?e[t]!==void 0:Fs.call(e,t)}function SG(t,e){var r=this.__data__;return r[t]=rc&&e===void 0?QD:e,this}Rs.prototype.clear=EG;Rs.prototype.delete=bG;Rs.prototype.get=_G;Rs.prototype.has=CG;Rs.prototype.set=SG;function ti(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=Eh(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=Eh(e,t);return r<0?void 0:e[r][1]}function TG(t){return Eh(this.__data__,t)>-1}function IG(t,e){var r=this.__data__,n=Eh(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}ti.prototype.clear=AG;ti.prototype.delete=OG;ti.prototype.get=xG;ti.prototype.has=TG;ti.prototype.set=IG;function $s(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function PG(){this.__data__={hash:new Rs,map:new(gh||ti),string:new Rs}}function FG(t){return bh(this,t).delete(t)}function RG(t){return bh(this,t).get(t)}function kG(t){return bh(this,t).has(t)}function NG(t,e){return bh(this,t).set(t,e),this}$s.prototype.clear=PG;$s.prototype.delete=FG;$s.prototype.get=RG;$s.prototype.has=kG;$s.prototype.set=NG;function yh(t){var e=-1,r=t?t.length:0;for(this.__data__=new $s;++e<r;)this.add(t[e])}function $G(t){return this.__data__.set(t,QD),this}function LG(t){return this.__data__.has(t)}yh.prototype.add=yh.prototype.push=$G;yh.prototype.has=LG;function ei(t){this.__data__=new ti(t)}function BG(){this.__data__=new ti}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 ti&&r.__data__.length==LK&&(r=this.__data__=new $s(r.__data__)),r.set(t,e),this}ei.prototype.clear=BG;ei.prototype.delete=jG;ei.prototype.get=MG;ei.prototype.has=UG;ei.prototype.set=qG;function Eh(t,e){for(var r=t.length;r--;)if(aW(t[r][0],e))return r;return-1}function Tx(t,e){e=_h(e,t)?[e]:Fx(e);for(var r=0,n=e.length;t!=null&&r<n;)t=t[Ch(e[r++])];return r&&r==n?t:void 0}function Ix(t,e){return Fs.call(t,e)||typeof t=="object"&&e in t&&rW(t)===null}function HG(t,e){return e in Object(t)}function t0(t,e,r,n,i){return t===e?!0:t==null||e==null||!Ah(t)&&!ic(e)?t!==t&&e!==e:VG(t,e,t0,r,n,i)}function VG(t,e,r,n,i,s){var o=Bi(t),a=Bi(e),u=zD,c=zD;o||(u=Qn(t),u=u==ph?ta:u),a||(c=Qn(e),c=c==ph?ta:c);var l=u==ta&&!GD(t),h=c==ta&&!GD(e),d=u==c;if(d&&!l)return s||(s=new ei),o||lW(t)?Rx(t,e,r,n,i,s):ZG(t,e,u,r,n,i,s);if(!(i&na)){var f=l&&Fs.call(t,"__wrapped__"),p=h&&Fs.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,v=p?e.value():e;return s||(s=new ei),r(g,v,n,i,s)}}return d?(s||(s=new ei),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 ei;if(n)var d=n(c,l,u,t,e,h);if(!(d===void 0?t0(l,c,n,Dh|na,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 _h(t)&&Nx(e)?$x(Ch(t),e):function(r){var n=fW(r,t);return n===void 0&&n===e?hW(r,t):t0(e,n,void 0,Dh|na)}}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=Qn(e);return r==ec?Ox(e):r==tc?cG(e):aG(e,t(e))}}function Rx(t,e,r,n,i,s){var o=i&na,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&Dh?new yh:void 0;for(s.set(t,e);++l<a;){var f=t[l],p=e[l];if(n)var g=o?n(p,f,l,e,t,s):n(f,p,l,t,e,s);if(g!==void 0){if(g)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 mh: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 e0:return t==e+"";case ec:var a=Ox;case tc:var u=s&na;if(a||(a=uG),t.size!=e.size&&!u)return!1;var c=o.get(t);return c?c==e:(s|=Dh,o.set(t,e),Rx(a(t),a(e),n,i,s,o));case Sx:if(VD)return VD.call(t)==VD.call(e)}return!1}function QG(t,e,r,n,i,s){var o=i&na,a=ZD(t),u=a.length,c=ZD(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 g=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}g||(g=d=="constructor")}if(p&&!g){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 bh(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 ia(t,e){var r=t[e];return cW(r)?r:void 0}function rW(t){return pG(Object(t))}function Qn(t){return Ns.call(t)}(WD&&Qn(new WD(new ArrayBuffer(1)))!=mh||gh&&Qn(new gh)!=ec||XD&&Qn(XD.resolve())!=dx||YD&&Qn(new YD)!=tc||JD&&Qn(new JD)!=KD)&&(Qn=function(t){var e=Ns.call(t),r=e==ta?t.constructor:void 0,n=r?Ls(r):void 0;if(n)switch(n){case gG:return mh;case yG:return ec;case DG:return dx;case wG:return tc;case vG:return KD}return e});function nW(t,e,r){e=_h(e,t)?[e]:Fx(e);for(var n,i=-1,o=e.length;++i<o;){var s=Ch(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&&Sh(o)&&kx(s,o)&&(Bi(t)||Mx(t)||Lx(t))}function iW(t){var e=t?t.length:void 0;return Sh(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 _h(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||vh;return t===r}function Nx(t){return t===t&&!Ah(t)}function $x(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}function Ch(t){if(typeof t=="string"||Ux(t))return t;var e=t+"";return e=="0"&&1/t==-BK?"-0":e}function Ls(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)&&Fs.call(t,"callee")&&(!hG.call(t,"callee")||Ns.call(t)==ph)}var Bi=Array.isArray;function Bx(t){return t!=null&&Sh(eW(t))&&!jx(t)}function uW(t){return ic(t)&&Bx(t)}function jx(t){var e=Ah(t)?Ns.call(t):"";return e==bx||e==jK}function Sh(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Dx}function Ah(t){var e=typeof t;return!!t&&(e=="object"||e=="function")}function ic(t){return!!t&&typeof t=="object"}function cW(t){if(!Ah(t))return!1;var e=jx(t)||GD(t)?fG:ZK;return e.test(Ls(t))}function Mx(t){return typeof t=="string"||!Bi(t)&&ic(t)&&Ns.call(t)==e0}function Ux(t){return typeof t=="symbol"||ic(t)&&Ns.call(t)==Sx}function lW(t){return ic(t)&&Sh(t.length)&&!!Qe[Ns.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 ZD(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(ZD);function pW(t){return t}function mW(t){return _h(t)?Px(Ch(t)):YG(t)}ra.exports=KG});var Gx=C((Bs,sa)=>{var gW=1/0,yW="[object Function]",DW="[object GeneratorFunction]",wW=/[\\^$.*+?()[\]{}|]/g,vW=/^\[object .+?Constructor\]$/,sc={function:!0,object:!0},EW=sc[typeof Bs]&&Bs&&!Bs.nodeType?Bs:void 0,bW=sc[typeof sa]&&sa&&!sa.nodeType?sa:void 0,_W=Oh(EW&&bW&&typeof global=="object"&&global),CW=Oh(sc[typeof self]&&self),Hx=Oh(sc[typeof window]&&window),r0=Oh(sc[typeof Bs]&&Bs),SW=_W||Hx!==(r0&&r0.window)&&Hx||CW||r0||Function("return this")();function Oh(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.*?")+"$"),n0=FW(SW,"Set"),PW=n0&&1/OW(new n0([,-0]))[1]==gW?function(t){return new n0(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(){}sa.exports=PW});var Xx=C((js,oa)=>{var oc={function:!0,object:!0},LW=oc[typeof js]&&js&&!js.nodeType?js:void 0,BW=oc[typeof oa]&&oa&&!oa.nodeType?oa:void 0,jW=xh(LW&&BW&&typeof global=="object"&&global),MW=xh(oc[typeof self]&&self),Wx=xh(oc[typeof window]&&window),i0=xh(oc[typeof js]&&js),UW=jW||Wx!==(i0&&i0.window)&&Wx||MW||i0||Function("return this")();function xh(t){return t&&t.Object===Object?t:null}oa.exports=UW});var tT=C((EDe,eT)=>{var qW=Gx(),HW=Xx(),VW=200,s0="__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,o0=Yx.hasOwnProperty,nX=Yx.toString,iX=RegExp("^"+Jx.call(o0).replace(GW,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),sX=rX.splice,oX=Zx(HW,"Map"),ac=Zx(Object,"create");function Ms(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__=ac?ac(null):{}}function uX(t){return this.has(t)&&delete this.__data__[t]}function cX(t){var e=this.__data__;if(ac){var r=e[t];return r===s0?void 0:r}return o0.call(e,t)?e[t]:void 0}function lX(t){var e=this.__data__;return ac?e[t]!==void 0:o0.call(e,t)}function fX(t,e){var r=this.__data__;return r[t]=ac&&e===void 0?s0:e,this}Ms.prototype.clear=aX;Ms.prototype.delete=uX;Ms.prototype.get=cX;Ms.prototype.has=lX;Ms.prototype.set=fX;function aa(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=Ih(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=Ih(e,t);return r<0?void 0:e[r][1]}function mX(t){return Ih(this.__data__,t)>-1}function gX(t,e){var r=this.__data__,n=Ih(r,t);return n<0?r.push([t,e]):r[n][1]=e,this}aa.prototype.clear=hX;aa.prototype.delete=dX;aa.prototype.get=pX;aa.prototype.has=mX;aa.prototype.set=gX;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 yX(){this.__data__={hash:new Ms,map:new(oX||aa),string:new Ms}}function DX(t){return Ph(this,t).delete(t)}function wX(t){return Ph(this,t).get(t)}function vX(t){return Ph(this,t).has(t)}function EX(t,e){return Ph(this,t).set(t,e),this}ua.prototype.clear=yX;ua.prototype.delete=DX;ua.prototype.get=wX;ua.prototype.has=vX;ua.prototype.set=EX;function Th(t){var e=-1,r=t?t.length:0;for(this.__data__=new ua;++e<r;)this.add(t[e])}function bX(t){return this.__data__.set(t,s0),this}function _X(t){return this.__data__.has(t)}Th.prototype.add=Th.prototype.push=bX;Th.prototype.has=_X;function Ih(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 Th}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 Ph(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=C((bDe,rT)=>{var IX=qx(),PX=tT();function FX(t,e){return t&&t.length?PX(t,IX(e)):[]}rT.exports=FX});var sT=C((_De,iT)=>{"use strict";var RX=ex(),kX=nT(),NX=RX("MultiError");iT.exports=a0;function a0(t){if(!(this instanceof a0))return new a0(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=C((CDe,oT)=>{var
|
|
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,Nh,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),pT()}return Object.defineProperty(e,Nh,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Us(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var dT;global[Ht]||mT(global,pt[Ht]);f0.exports=c0(VX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(f0.exports=c0(pt),pt.__patched=!0);function c0(t){qX(t),t.gracefulify=c0,t.createReadStream=w,t.createWriteStream=S;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,K,L,b){return e(j,K,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ca([B,[j,K,L],T,b||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(K,L,b,T,P){return n(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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(K,L,b,T,P){return s(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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(K,L,b,T,P){return a(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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,b,T,P){return c(L,j(L,b,T,P))}:function(L,b,T,P){return c(L,b,j(L,b,T,P))};return B(k,R,I);function j(K,L,b,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?ca([B,[K,L,b],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof b=="function"&&b.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 g=E;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(k){g=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;_(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;_(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 S(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=_;function _(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(K,L,b,T,P){return F(K,L,b,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ca(t){Us("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),l0()}var kh;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);l0()}function l0(){if(clearTimeout(kh),kh=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)Us("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Us("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?(Us("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}kh===void 0&&(kh=setTimeout(l0,0))}}});var yT=C((xDe,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=C(qs=>{var KX=yT();qs.operation=function(t){var e=qs.timeouts(t);return new KX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};qs.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};qs.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};qs.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=qs.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=C((IDe,wT)=>{wT.exports=DT()});var ET=C((PDe,$h)=>{$h.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&$h.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&$h.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Mh=C((FDe,ha)=>{var at=global.process,Hs=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"};Hs(at)?(bT=require("assert"),la=ET(),_T=/^win/i.test(at.platform),uc=require("events"),typeof uc!="function"&&(uc=uc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new uc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),ha.exports=function(t,e){if(!Hs(global.process))return function(){};bT.equal(typeof t,"function","a callback must be provided for exit handler"),fa===!1&&h0();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&&Lh()};return kt.on(r,t),n},Lh=function(){!fa||!Hs(global.process)||(fa=!1,la.forEach(function(e){try{at.removeListener(e,Bh[e])}catch{}}),at.emit=jh,at.reallyExit=d0,kt.count-=1)},ha.exports.unload=Lh,Vs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},Bh={},la.forEach(function(t){Bh[t]=function(){if(Hs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Lh(),Vs("exit",null,t),Vs("afterexit",null,t),_T&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),ha.exports.signals=function(){return la},fa=!1,h0=function(){fa||!Hs(global.process)||(fa=!0,kt.count+=1,la=la.filter(function(e){try{return at.on(e,Bh[e]),!0}catch{return!1}}),at.emit=ST,at.reallyExit=CT)},ha.exports.load=h0,d0=at.reallyExit,CT=function(e){Hs(global.process)&&(at.exitCode=e||0,Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),d0.call(at,at.exitCode))},jh=at.emit,ST=function(e,r){if(e==="exit"&&Hs(global.process)){r!==void 0&&(at.exitCode=r);var n=jh.apply(this,arguments);return Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),n}else return jh.apply(this,arguments)}):ha.exports=function(){return function(){}};var bT,la,_T,uc,kt,Lh,Vs,Bh,fa,h0,d0,CT,jh,ST});var OT=C((RDe,p0)=>{"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)}p0.exports.probe=GX;p0.exports.getMtime=WX});var FT=C((kDe,lc)=>{"use strict";var XX=require("path"),y0=vt(),YX=vT(),JX=Mh(),xT=OT(),ri={};function cc(t,e){return e.lockfilePath||`${t}.lock`}function D0(t,e,r){if(!e.realpath)return r(null,XX.resolve(t));e.fs.realpath(t,r)}function g0(t,e,r){let n=cc(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"?g0(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);g0(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(cc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Uh(t,e){let r=ri[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?m0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Uh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return m0(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?m0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Uh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Uh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function m0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ri[t]===e&&delete ri[t],e.options.onCompromised(r)}function ZX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,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),D0(t,e,(n,i)=>{if(n)return r(n);let s=YX.operation(e.retries);s.attempt(()=>{g0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ri[i]={lockfilePath:cc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Uh(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:y0,realpath:!0,...e},D0(t,e,(n,i)=>{if(n)return r(n);let s=ri[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 ri[i],IT(i,e,r)})}function QX(t,e,r){e={stale:1e4,realpath:!0,fs:y0,...e},e.stale=Math.max(e.stale||0,2e3),D0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(cc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!TT(o,e)))})}function eY(){return ri}JX(()=>{for(let t in ri){let e=ri[t].options;try{e.fs.rmdirSync(cc(t,e))}catch{}}});lc.exports.lock=ZX;lc.exports.unlock=PT;lc.exports.check=QX;lc.exports.getLocks=eY});var kT=C((NDe,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=C(($De,ji)=>{"use strict";var da=FT(),{toPromise:qh,toSync:Hh,toSyncOptions:w0}=kT();async function NT(t,e){let r=await qh(da.lock)(t,e);return qh(r)}function oY(t,e){let r=Hh(da.lock)(t,w0(e));return Hh(r)}function aY(t,e){return qh(da.unlock)(t,e)}function uY(t,e){return Hh(da.unlock)(t,w0(e))}function cY(t,e){return qh(da.check)(t,e)}function lY(t,e){return Hh(da.check)(t,w0(e))}ji.exports=NT;ji.exports.lock=NT;ji.exports.unlock=aY;ji.exports.lockSync=oY;ji.exports.unlockSync=uY;ji.exports.check=cY;ji.exports.checkSync=lY});var UT=C(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.canStoreURLs=pa.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 fc(t){"@babel/helpers - typeof";return fc=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},fc(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 fc(e)=="symbol"?e:e+""}function yY(t,e){if(fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var LDe=pa.canStoreURLs=!0,BDe=pa.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 zh=C(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=zs(gD()),wY=yD(),vY=zs(UA()),v0=zs(yO()),EY=zs(IO()),bY=zs(kO()),zT=zs(WO()),_Y=zs(PD()),KT=UT();function zs(t){return t&&t.__esModule?t:{default:t}}function ga(t){"@babel/helpers - typeof";return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ga(t)}function 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=Vh(e),OY(t,GT()?Reflect.construct(e,r||[],Vh(t).constructor):e.apply(t,r))}function OY(t,e){if(e&&(ga(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 Vh(t){return Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vh(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&&E0(t,e)}function E0(t,e){return E0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},E0(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 ma(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 ga(e)=="symbol"?e:e+""}function PY(t,e){if(ga(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ga(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var VT=Er.defaultOptions=ma(ma({},v0.default.defaultOptions),{},{httpStack:new zT.default,fileReader:new EY.default,urlStorage:new vY.default,fingerprint:bY.default}),MDe=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=ma(ma({},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=ma(ma({},VT),i),v0.default.terminate(n,i)}}])})(v0.default),UDe=Er.isSupported=!0});var ZT=C((t0e,JT)=>{var ya=1e3,Da=ya*60,wa=Da*60,Ks=wa*24,NY=Ks*7,$Y=Ks*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*Ks;case"hours":case"hour":case"hrs":case"hr":case"h":return r*wa;case"minutes":case"minute":case"mins":case"min":case"m":return r*Da;case"seconds":case"second":case"secs":case"sec":case"s":return r*ya;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function BY(t){var e=Math.abs(t);return e>=Ks?Math.round(t/Ks)+"d":e>=wa?Math.round(t/wa)+"h":e>=Da?Math.round(t/Da)+"m":e>=ya?Math.round(t/ya)+"s":t+"ms"}function jY(t){var e=Math.abs(t);return e>=Ks?Gh(t,e,Ks,"day"):e>=wa?Gh(t,e,wa,"hour"):e>=Da?Gh(t,e,Da,"minute"):e>=ya?Gh(t,e,ya,"second"):t+" ms"}function Gh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var _0=C((r0e,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 g(...v){if(!g.enabled)return;let E=g,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,(S,F)=>{if(S==="%%")return"%";D++;let _=r.formatters[F];if(typeof _=="function"){let k=v[D];S=_.call(E,k),v.splice(D,1),D--}return S}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}return g.namespace=l,g.useColors=r.useColors(),g.color=r.selectColor(l),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"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(g),g}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,g=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(p=f,g=d,f++):(d++,f++);else if(p!==-1)f=p+1,g++,d=g;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=C((br,Wh)=>{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 ":" ")+"+"+Wh.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{}}Wh.exports=_0()(br);var{formatters:KY}=Wh.exports;KY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var r1=C((n0e,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=C((i0e,i1)=>{"use strict";var GY=require("os"),n1=require("tty"),Gr=r1(),{env:Nt}=process,Ui;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?Ui=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(Ui=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?Ui=1:Nt.FORCE_COLOR==="false"?Ui=0:Ui=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function C0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function S0(t,e){if(Ui===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&Ui===void 0)return 0;let r=Ui||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=S0(t,t&&t.isTTY);return C0(e)}i1.exports={supportsColor:WY,stdout:C0(S0(!0,n1.isatty(1))),stderr:C0(S0(!0,n1.isatty(2)))}});var a1=C(($t,Yh)=>{var XY=require("tty"),Xh=require("util");$t.init=rJ;$t.log=QY;$t.formatArgs=JY;$t.save=eJ;$t.load=tJ;$t.useColors=YY;$t.destroy=Xh.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=C((CDe,oT)=>{var ji=require("constants"),$X=process.cwd,Fh=null,LX=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Fh||(Fh=$X.call(process)),Fh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(u0=process.chdir,process.chdir=function(t){Fh=null,u0.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,u0));var u0;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 g=Date.now(),v=0;l(d,f,function E(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-g<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,g,v,E){var A;if(E&&typeof E=="function"){var m=0;A=function(D,w,S){if(D&&D.code==="EAGAIN"&&m<10)return m++,l.call(t,d,f,p,g,v,A);E.apply(this,arguments)}}return l.call(t,d,f,p,g,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,g){for(var v=0;;)try{return l.call(t,h,d,f,p,g)}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,g){if(p){f&&f(p);return}l.fchmod(g,d,function(v){l.close(g,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,g;try{g=l.fchmodSync(f,d),p=!1}finally{if(p)try{l.closeSync(f)}catch{}else l.closeSync(f)}return g}}function r(l){ji.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(h,d,f,p){l.open(h,ji.O_SYMLINK,function(g,v){if(g){p&&p(g);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),g,v=!0;try{g=l.futimesSync(p,d,f),v=!1}finally{if(v)try{l.closeSync(p)}catch{}else l.closeSync(p)}return g}):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(g){c(g)&&(g=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(g,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=C((SDe,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=C((ADe,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=C((ODe,f0)=>{var pt=require("fs"),qX=aT(),HX=lT(),VX=hT(),Rh=require("util"),Ht,Nh;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ht=Symbol.for("graceful-fs.queue"),Nh=Symbol.for("graceful-fs.previous")):(Ht="___graceful-fs.queue",Nh="___graceful-fs.previous");function zX(){}function mT(t,e){Object.defineProperty(t,Ht,{get:function(){return e}})}var Us=zX;Rh.debuglog?Us=Rh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Us=function(){var t=Rh.format.apply(Rh,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,Nh,{value:t}),e})(pt.close),pt.closeSync=(function(t){function e(r){t.apply(pt,arguments),pT()}return Object.defineProperty(e,Nh,{value:t}),e})(pt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Us(pt[Ht]),require("assert").equal(pt[Ht].length,0)}));var dT;global[Ht]||mT(global,pt[Ht]);f0.exports=c0(VX(pt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!pt.__patched&&(f0.exports=c0(pt),pt.__patched=!0);function c0(t){qX(t),t.gracefulify=c0,t.createReadStream=w,t.createWriteStream=S;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,K,L,b){return e(j,K,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?ca([B,[j,K,L],T,b||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(K,L,b,T,P){return n(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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(K,L,b,T,P){return s(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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(K,L,b,T,P){return a(K,L,b,function($){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,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,b,T,P){return c(L,j(L,b,T,P))}:function(L,b,T,P){return c(L,b,j(L,b,T,P))};return B(k,R,I);function j(K,L,b,T){return function(P,$){P&&(P.code==="EMFILE"||P.code==="ENFILE")?ca([B,[K,L,b],P,T||Date.now(),Date.now()]):($&&$.sort&&$.sort(),typeof b=="function"&&b.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 g=E;Object.defineProperty(t,"FileReadStream",{get:function(){return g},set:function(k){g=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;_(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;_(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 S(k,R){return new t.WriteStream(k,R)}var F=t.open;t.open=_;function _(k,R,I,B){return typeof I=="function"&&(B=I,I=null),j(k,R,I,B);function j(K,L,b,T,P){return F(K,L,b,function($,q){$&&($.code==="EMFILE"||$.code==="ENFILE")?ca([j,[K,L,b,T],$,P||Date.now(),Date.now()]):typeof T=="function"&&T.apply(this,arguments)})}}return t}function ca(t){Us("ENQUEUE",t[0].name,t[1]),pt[Ht].push(t),l0()}var kh;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);l0()}function l0(){if(clearTimeout(kh),kh=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)Us("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Us("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?(Us("RETRY",e.name,r),e.apply(null,r.concat([i]))):pt[Ht].push(t)}kh===void 0&&(kh=setTimeout(l0,0))}}});var yT=C((xDe,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=C(qs=>{var KX=yT();qs.operation=function(t){var e=qs.timeouts(t);return new KX(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};qs.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};qs.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};qs.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=qs.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=C((IDe,wT)=>{wT.exports=DT()});var ET=C((PDe,$h)=>{$h.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&$h.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&$h.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var Mh=C((FDe,ha)=>{var at=global.process,Hs=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"};Hs(at)?(bT=require("assert"),la=ET(),_T=/^win/i.test(at.platform),uc=require("events"),typeof uc!="function"&&(uc=uc.EventEmitter),at.__signal_exit_emitter__?kt=at.__signal_exit_emitter__:(kt=at.__signal_exit_emitter__=new uc,kt.count=0,kt.emitted={}),kt.infinite||(kt.setMaxListeners(1/0),kt.infinite=!0),ha.exports=function(t,e){if(!Hs(global.process))return function(){};bT.equal(typeof t,"function","a callback must be provided for exit handler"),fa===!1&&h0();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&&Lh()};return kt.on(r,t),n},Lh=function(){!fa||!Hs(global.process)||(fa=!1,la.forEach(function(e){try{at.removeListener(e,Bh[e])}catch{}}),at.emit=jh,at.reallyExit=d0,kt.count-=1)},ha.exports.unload=Lh,Vs=function(e,r,n){kt.emitted[e]||(kt.emitted[e]=!0,kt.emit(e,r,n))},Bh={},la.forEach(function(t){Bh[t]=function(){if(Hs(global.process)){var r=at.listeners(t);r.length===kt.count&&(Lh(),Vs("exit",null,t),Vs("afterexit",null,t),_T&&t==="SIGHUP"&&(t="SIGINT"),at.kill(at.pid,t))}}}),ha.exports.signals=function(){return la},fa=!1,h0=function(){fa||!Hs(global.process)||(fa=!0,kt.count+=1,la=la.filter(function(e){try{return at.on(e,Bh[e]),!0}catch{return!1}}),at.emit=ST,at.reallyExit=CT)},ha.exports.load=h0,d0=at.reallyExit,CT=function(e){Hs(global.process)&&(at.exitCode=e||0,Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),d0.call(at,at.exitCode))},jh=at.emit,ST=function(e,r){if(e==="exit"&&Hs(global.process)){r!==void 0&&(at.exitCode=r);var n=jh.apply(this,arguments);return Vs("exit",at.exitCode,null),Vs("afterexit",at.exitCode,null),n}else return jh.apply(this,arguments)}):ha.exports=function(){return function(){}};var bT,la,_T,uc,kt,Lh,Vs,Bh,fa,h0,d0,CT,jh,ST});var OT=C((RDe,p0)=>{"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)}p0.exports.probe=GX;p0.exports.getMtime=WX});var FT=C((kDe,lc)=>{"use strict";var XX=require("path"),y0=vt(),YX=vT(),JX=Mh(),xT=OT(),ri={};function cc(t,e){return e.lockfilePath||`${t}.lock`}function D0(t,e,r){if(!e.realpath)return r(null,XX.resolve(t));e.fs.realpath(t,r)}function g0(t,e,r){let n=cc(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"?g0(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);g0(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(cc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Uh(t,e){let r=ri[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?m0(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Uh(t,e));if(!(r.mtime.getTime()===i.mtime.getTime()))return m0(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?m0(t,r,Object.assign(u,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Uh(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Uh(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function m0(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),ri[t]===e&&delete ri[t],e.options.onCompromised(r)}function ZX(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:y0,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),D0(t,e,(n,i)=>{if(n)return r(n);let s=YX.operation(e.retries);s.attempt(()=>{g0(i,e,(o,a,u)=>{if(s.retry(o))return;if(o)return r(s.mainError());let c=ri[i]={lockfilePath:cc(i,e),mtime:a,mtimePrecision:u,options:e,lastUpdate:Date.now()};Uh(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:y0,realpath:!0,...e},D0(t,e,(n,i)=>{if(n)return r(n);let s=ri[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 ri[i],IT(i,e,r)})}function QX(t,e,r){e={stale:1e4,realpath:!0,fs:y0,...e},e.stale=Math.max(e.stale||0,2e3),D0(t,e,(n,i)=>{if(n)return r(n);e.fs.stat(cc(i,e),(s,o)=>s?s.code==="ENOENT"?r(null,!1):r(s):r(null,!TT(o,e)))})}function eY(){return ri}JX(()=>{for(let t in ri){let e=ri[t].options;try{e.fs.rmdirSync(cc(t,e))}catch{}}});lc.exports.lock=ZX;lc.exports.unlock=PT;lc.exports.check=QX;lc.exports.getLocks=eY});var kT=C((NDe,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=C(($De,Mi)=>{"use strict";var da=FT(),{toPromise:qh,toSync:Hh,toSyncOptions:w0}=kT();async function NT(t,e){let r=await qh(da.lock)(t,e);return qh(r)}function oY(t,e){let r=Hh(da.lock)(t,w0(e));return Hh(r)}function aY(t,e){return qh(da.unlock)(t,e)}function uY(t,e){return Hh(da.unlock)(t,w0(e))}function cY(t,e){return qh(da.check)(t,e)}function lY(t,e){return Hh(da.check)(t,w0(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=C(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});pa.canStoreURLs=pa.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 fc(t){"@babel/helpers - typeof";return fc=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},fc(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 fc(e)=="symbol"?e:e+""}function yY(t,e){if(fc(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(fc(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var LDe=pa.canStoreURLs=!0,BDe=pa.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 zh=C(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=zs(gD()),wY=yD(),vY=zs(UA()),v0=zs(yO()),EY=zs(IO()),bY=zs(kO()),zT=zs(WO()),_Y=zs(PD()),KT=UT();function zs(t){return t&&t.__esModule?t:{default:t}}function ga(t){"@babel/helpers - typeof";return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ga(t)}function 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=Vh(e),OY(t,GT()?Reflect.construct(e,r||[],Vh(t).constructor):e.apply(t,r))}function OY(t,e){if(e&&(ga(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 Vh(t){return Vh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},Vh(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&&E0(t,e)}function E0(t,e){return E0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},E0(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 ma(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 ga(e)=="symbol"?e:e+""}function PY(t,e){if(ga(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ga(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var VT=Er.defaultOptions=ma(ma({},v0.default.defaultOptions),{},{httpStack:new zT.default,fileReader:new EY.default,urlStorage:new vY.default,fingerprint:bY.default}),MDe=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=ma(ma({},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=ma(ma({},VT),i),v0.default.terminate(n,i)}}])})(v0.default),UDe=Er.isSupported=!0});var ZT=C((t0e,JT)=>{var ya=1e3,Da=ya*60,wa=Da*60,Ks=wa*24,NY=Ks*7,$Y=Ks*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*Ks;case"hours":case"hour":case"hrs":case"hr":case"h":return r*wa;case"minutes":case"minute":case"mins":case"min":case"m":return r*Da;case"seconds":case"second":case"secs":case"sec":case"s":return r*ya;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function BY(t){var e=Math.abs(t);return e>=Ks?Math.round(t/Ks)+"d":e>=wa?Math.round(t/wa)+"h":e>=Da?Math.round(t/Da)+"m":e>=ya?Math.round(t/ya)+"s":t+"ms"}function jY(t){var e=Math.abs(t);return e>=Ks?Gh(t,e,Ks,"day"):e>=wa?Gh(t,e,wa,"hour"):e>=Da?Gh(t,e,Da,"minute"):e>=ya?Gh(t,e,ya,"second"):t+" ms"}function Gh(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var _0=C((r0e,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 g(...v){if(!g.enabled)return;let E=g,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,(S,F)=>{if(S==="%%")return"%";D++;let _=r.formatters[F];if(typeof _=="function"){let k=v[D];S=_.call(E,k),v.splice(D,1),D--}return S}),r.formatArgs.call(E,v),(E.log||r.log).apply(E,v)}return g.namespace=l,g.useColors=r.useColors(),g.color=r.selectColor(l),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"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(g),g}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,g=0;for(;d<l.length;)if(f<h.length&&(h[f]===l[d]||h[f]==="*"))h[f]==="*"?(p=f,g=d,f++):(d++,f++);else if(p!==-1)f=p+1,g++,d=g;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=C((br,Wh)=>{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 ":" ")+"+"+Wh.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{}}Wh.exports=_0()(br);var{formatters:KY}=Wh.exports;KY.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var r1=C((n0e,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=C((i0e,i1)=>{"use strict";var GY=require("os"),n1=require("tty"),Gr=r1(),{env:Nt}=process,Ui;Gr("no-color")||Gr("no-colors")||Gr("color=false")||Gr("color=never")?Ui=0:(Gr("color")||Gr("colors")||Gr("color=true")||Gr("color=always"))&&(Ui=1);"FORCE_COLOR"in Nt&&(Nt.FORCE_COLOR==="true"?Ui=1:Nt.FORCE_COLOR==="false"?Ui=0:Ui=Nt.FORCE_COLOR.length===0?1:Math.min(parseInt(Nt.FORCE_COLOR,10),3));function C0(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function S0(t,e){if(Ui===0)return 0;if(Gr("color=16m")||Gr("color=full")||Gr("color=truecolor"))return 3;if(Gr("color=256"))return 2;if(t&&!e&&Ui===void 0)return 0;let r=Ui||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=S0(t,t&&t.isTTY);return C0(e)}i1.exports={supportsColor:WY,stdout:C0(S0(!0,n1.isatty(1))),stderr:C0(S0(!0,n1.isatty(2)))}});var a1=C(($t,Yh)=>{var XY=require("tty"),Xh=require("util");$t.init=rJ;$t.log=QY;$t.formatArgs=JY;$t.save=eJ;$t.load=tJ;$t.useColors=YY;$t.destroy=Xh.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+"+Yh.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(Xh.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]]}Yh.exports=_0()($t);var{formatters:o1}=Yh.exports;o1.o=function(t){return this.inspectOpts.colors=this.useColors,Xh.inspect(t,this.inspectOpts).split(`
|
|
64
|
-
`).map(e=>e.trim()).join(" ")};o1.O=function(t){return this.inspectOpts.colors=this.useColors,Xh.inspect(t,this.inspectOpts)}});var Jh=C((s0e,A0)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?A0.exports=e1():A0.exports=a1()});var Re=C(O0=>{"use strict";O0.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};O0.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var sr=C(
|
|
64
|
+
`).map(e=>e.trim()).join(" ")};o1.O=function(t){return this.inspectOpts.colors=this.useColors,Xh.inspect(t,this.inspectOpts)}});var Jh=C((s0e,A0)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?A0.exports=e1():A0.exports=a1()});var Re=C(O0=>{"use strict";O0.fromCallback=function(t){return Object.defineProperty(function(...e){if(typeof e[e.length-1]=="function")t.apply(this,e);else return new Promise((r,n)=>{e.push((i,s)=>i!=null?n(i):r(s)),t.apply(this,e)})},"name",{value:t.name})};O0.fromPromise=function(t){return Object.defineProperty(function(...e){let r=e[e.length-1];if(typeof r!="function")return t.apply(this,e);e.pop(),t.apply(this,e).then(n=>r(null,n),r)},"name",{value:t.name})}});var sr=C(si=>{"use strict";var u1=Re().fromCallback,ir=vt(),nJ=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ir[t]=="function");Object.assign(si,ir);nJ.forEach(t=>{si[t]=u1(ir[t])});si.exists=function(t,e){return typeof e=="function"?ir.exists(t,e):new Promise(r=>ir.exists(t,r))};si.read=function(t,e,r,n,i,s){return typeof s=="function"?ir.read(t,e,r,n,i,s):new Promise((o,a)=>{ir.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};si.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.write(t,e,...r):new Promise((n,i)=>{ir.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};si.readv=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.readv(t,e,...r):new Promise((n,i)=>{ir.readv(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesRead:o,buffers:a})})})};si.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ir.writev(t,e,...r):new Promise((n,i)=>{ir.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})};typeof ir.realpath.native=="function"?si.realpath.native=u1(ir.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var l1=C((u0e,c1)=>{"use strict";var iJ=require("path");c1.exports.checkPath=function(e){if(process.platform==="win32"&&/[<>:"|?*]/.test(e.replace(iJ.parse(e).root,""))){let n=new Error(`Path contains invalid characters: ${e}`);throw n.code="EINVAL",n}}});var p1=C((c0e,x0)=>{"use strict";var f1=sr(),{checkPath:h1}=l1(),d1=t=>{let e={mode:511};return typeof t=="number"?t:{...e,...t}.mode};x0.exports.makeDir=async(t,e)=>(h1(t),f1.mkdir(t,{mode:d1(e),recursive:!0}));x0.exports.makeDirSync=(t,e)=>(h1(t),f1.mkdirSync(t,{mode:d1(e),recursive:!0}))});var fn=C((l0e,m1)=>{"use strict";var sJ=Re().fromPromise,{makeDir:oJ,makeDirSync:T0}=p1(),I0=sJ(oJ);m1.exports={mkdirs:I0,mkdirsSync:T0,mkdirp:I0,mkdirpSync:T0,ensureDir:I0,ensureDirSync:T0}});var qi=C((f0e,y1)=>{"use strict";var aJ=Re().fromPromise,g1=sr();function uJ(t){return g1.access(t).then(()=>!0).catch(()=>!1)}y1.exports={pathExists:aJ(uJ),pathExistsSync:g1.existsSync}});var P0=C((h0e,D1)=>{"use strict";var va=sr(),cJ=Re().fromPromise;async function lJ(t,e,r){let n=await va.open(t,"r+"),i=null;try{await va.futimes(n,e,r)}finally{try{await va.close(n)}catch(s){i=s}}if(i)throw i}function fJ(t,e,r){let n=va.openSync(t,"r+");return va.futimesSync(n,e,r),va.closeSync(n)}D1.exports={utimesMillis:cJ(lJ),utimesMillisSync:fJ}});var Gs=C((d0e,b1)=>{"use strict";var Ea=sr(),Lt=require("path"),w1=Re().fromPromise;function hJ(t,e,r){let n=r.dereference?i=>Ea.stat(i,{bigint:!0}):i=>Ea.lstat(i,{bigint:!0});return Promise.all([n(t),n(e).catch(i=>{if(i.code==="ENOENT")return null;throw i})]).then(([i,s])=>({srcStat:i,destStat:s}))}function dJ(t,e,r){let n,i=r.dereference?o=>Ea.statSync(o,{bigint:!0}):o=>Ea.lstatSync(o,{bigint:!0}),s=i(t);try{n=i(e)}catch(o){if(o.code==="ENOENT")return{srcStat:s,destStat:null};throw o}return{srcStat:s,destStat:n}}async function pJ(t,e,r,n){let{srcStat:i,destStat:s}=await hJ(t,e,n);if(s){if(hc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Zh(t,e,r));return{srcStat:i,destStat:s}}function mJ(t,e,r,n){let{srcStat:i,destStat:s}=dJ(t,e,n);if(s){if(hc(i,s)){let o=Lt.basename(t),a=Lt.basename(e);if(r==="move"&&o!==a&&o.toLowerCase()===a.toLowerCase())return{srcStat:i,destStat:s,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(i.isDirectory()&&!s.isDirectory())throw new Error(`Cannot overwrite non-directory '${e}' with directory '${t}'.`);if(!i.isDirectory()&&s.isDirectory())throw new Error(`Cannot overwrite directory '${e}' with non-directory '${t}'.`)}if(i.isDirectory()&&F0(t,e))throw new Error(Zh(t,e,r));return{srcStat:i,destStat:s}}async function v1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=await Ea.stat(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(hc(e,o))throw new Error(Zh(t,r,n));return v1(t,e,s,n)}function E1(t,e,r,n){let i=Lt.resolve(Lt.dirname(t)),s=Lt.resolve(Lt.dirname(r));if(s===i||s===Lt.parse(s).root)return;let o;try{o=Ea.statSync(s,{bigint:!0})}catch(a){if(a.code==="ENOENT")return;throw a}if(hc(e,o))throw new Error(Zh(t,r,n));return E1(t,e,s,n)}function hc(t,e){return e.ino!==void 0&&e.dev!==void 0&&e.ino===t.ino&&e.dev===t.dev}function F0(t,e){let r=Lt.resolve(t).split(Lt.sep).filter(i=>i),n=Lt.resolve(e).split(Lt.sep).filter(i=>i);return r.every((i,s)=>n[s]===i)}function Zh(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}b1.exports={checkPaths:w1(pJ),checkPathsSync:mJ,checkParentPaths:w1(v1),checkParentPathsSync:E1,isSrcSubdir:F0,areIdentical:hc}});var C1=C((p0e,_1)=>{"use strict";async function gJ(t,e){let r=[];for await(let n of t)r.push(e(n).then(()=>null,i=>i??new Error("unknown error")));await Promise.all(r.map(n=>n.then(i=>{if(i!==null)throw i})))}_1.exports={asyncIteratorConcurrentProcess:gJ}});var T1=C((m0e,x1)=>{"use strict";var Gt=sr(),dc=require("path"),{mkdirs:yJ}=fn(),{pathExists:DJ}=qi(),{utimesMillis:wJ}=P0(),pc=Gs(),{asyncIteratorConcurrentProcess:vJ}=C1();async function EJ(t,e,r={}){typeof r=="function"&&(r={filter:r}),r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
65
65
|
|
|
66
66
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");let{srcStat:n,destStat:i}=await pc.checkPaths(t,e,"copy",r);if(await pc.checkParentPaths(t,n,e,"copy"),!await A1(t,e,r))return;let o=dc.dirname(e);await DJ(o)||await yJ(o),await O1(i,t,e,r)}async function A1(t,e,r){return r.filter?r.filter(t,e):!0}async function O1(t,e,r,n){let s=await(n.dereference?Gt.stat:Gt.lstat)(e);if(s.isDirectory())return SJ(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return bJ(s,t,e,r,n);if(s.isSymbolicLink())return AJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}async function bJ(t,e,r,n,i){if(!e)return S1(t,r,n,i);if(i.overwrite)return await Gt.unlink(n),S1(t,r,n,i);if(i.errorOnExist)throw new Error(`'${n}' already exists`)}async function S1(t,e,r,n){if(await Gt.copyFile(e,r),n.preserveTimestamps){_J(t.mode)&&await CJ(r,t.mode);let i=await Gt.stat(e);await wJ(r,i.atime,i.mtime)}return Gt.chmod(r,t.mode)}function _J(t){return(t&128)===0}function CJ(t,e){return Gt.chmod(t,e|128)}async function SJ(t,e,r,n,i){e||await Gt.mkdir(n),await vJ(await Gt.opendir(r),async s=>{let o=dc.join(r,s.name),a=dc.join(n,s.name);if(await A1(o,a,i)){let{destStat:c}=await pc.checkPaths(o,a,"copy",i);await O1(c,o,a,i)}}),e||await Gt.chmod(n,t.mode)}async function AJ(t,e,r,n){let i=await Gt.readlink(e);if(n.dereference&&(i=dc.resolve(process.cwd(),i)),!t)return Gt.symlink(i,r);let s=null;try{s=await Gt.readlink(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return Gt.symlink(i,r);throw o}if(n.dereference&&(s=dc.resolve(process.cwd(),s)),pc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(pc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return await Gt.unlink(r),Gt.symlink(i,r)}x1.exports=EJ});var k1=C((g0e,R1)=>{"use strict";var or=vt(),mc=require("path"),OJ=fn().mkdirsSync,xJ=P0().utimesMillisSync,gc=Gs();function TJ(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
67
67
|
|
|
68
|
-
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=gc.checkPathsSync(t,e,"copy",r);if(gc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=mc.dirname(e);return or.existsSync(s)||OJ(s),I1(i,t,e,r)}function I1(t,e,r,n){let s=(n.dereference?or.statSync:or.lstatSync)(e);if(s.isDirectory())return $J(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return IJ(s,t,e,r,n);if(s.isSymbolicLink())return jJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function IJ(t,e,r,n,i){return e?PJ(t,r,n,i):P1(t,r,n,i)}function PJ(t,e,r,n){if(n.overwrite)return or.unlinkSync(r),P1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function P1(t,e,r,n){return or.copyFileSync(e,r),n.preserveTimestamps&&FJ(t.mode,e,r),R0(r,t.mode)}function FJ(t,e,r){return RJ(t)&&kJ(r,t),NJ(e,r)}function RJ(t){return(t&128)===0}function kJ(t,e){return R0(t,e|128)}function R0(t,e){return or.chmodSync(t,e)}function NJ(t,e){let r=or.statSync(t);return xJ(e,r.atime,r.mtime)}function $J(t,e,r,n,i){return e?F1(r,n,i):LJ(t.mode,r,n,i)}function LJ(t,e,r,n){return or.mkdirSync(r),F1(e,r,n),R0(r,t)}function F1(t,e,r){let n=or.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)BJ(i.name,t,e,r)}finally{n.closeSync()}}function BJ(t,e,r,n){let i=mc.join(e,t),s=mc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=gc.checkPathsSync(i,s,"copy",n);return I1(o,i,s,n)}function jJ(t,e,r,n){let i=or.readlinkSync(e);if(n.dereference&&(i=mc.resolve(process.cwd(),i)),t){let s;try{s=or.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return or.symlinkSync(i,r);throw o}if(n.dereference&&(s=mc.resolve(process.cwd(),s)),gc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(gc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return MJ(i,r)}else return or.symlinkSync(i,r)}function MJ(t,e){return or.unlinkSync(e),or.symlinkSync(t,e)}R1.exports=TJ});var Qh=C((y0e,N1)=>{"use strict";var UJ=Re().fromPromise;N1.exports={copy:UJ(T1()),copySync:k1()}});var yc=C((D0e,L1)=>{"use strict";var $1=vt(),qJ=Re().fromCallback;function HJ(t,e){$1.rm(t,{recursive:!0,force:!0},e)}function VJ(t){$1.rmSync(t,{recursive:!0,force:!0})}L1.exports={remove:qJ(HJ),removeSync:VJ}});var z1=C((w0e,V1)=>{"use strict";var zJ=Re().fromPromise,M1=sr(),U1=require("path"),q1=fn(),H1=yc(),B1=zJ(async function(e){let r;try{r=await M1.readdir(e)}catch{return q1.mkdirs(e)}return Promise.all(r.map(n=>H1.remove(U1.join(e,n))))});function j1(t){let e;try{e=M1.readdirSync(t)}catch{return q1.mkdirsSync(t)}e.forEach(r=>{r=U1.join(t,r),H1.removeSync(r)})}V1.exports={emptyDirSync:j1,emptydirSync:j1,emptyDir:B1,emptydir:B1}});var X1=C((v0e,W1)=>{"use strict";var KJ=Re().fromPromise,K1=require("path"),
|
|
68
|
+
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");let{srcStat:n,destStat:i}=gc.checkPathsSync(t,e,"copy",r);if(gc.checkParentPathsSync(t,n,e,"copy"),r.filter&&!r.filter(t,e))return;let s=mc.dirname(e);return or.existsSync(s)||OJ(s),I1(i,t,e,r)}function I1(t,e,r,n){let s=(n.dereference?or.statSync:or.lstatSync)(e);if(s.isDirectory())return $J(s,t,e,r,n);if(s.isFile()||s.isCharacterDevice()||s.isBlockDevice())return IJ(s,t,e,r,n);if(s.isSymbolicLink())return jJ(t,e,r,n);throw s.isSocket()?new Error(`Cannot copy a socket file: ${e}`):s.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${e}`):new Error(`Unknown file: ${e}`)}function IJ(t,e,r,n,i){return e?PJ(t,r,n,i):P1(t,r,n,i)}function PJ(t,e,r,n){if(n.overwrite)return or.unlinkSync(r),P1(t,e,r,n);if(n.errorOnExist)throw new Error(`'${r}' already exists`)}function P1(t,e,r,n){return or.copyFileSync(e,r),n.preserveTimestamps&&FJ(t.mode,e,r),R0(r,t.mode)}function FJ(t,e,r){return RJ(t)&&kJ(r,t),NJ(e,r)}function RJ(t){return(t&128)===0}function kJ(t,e){return R0(t,e|128)}function R0(t,e){return or.chmodSync(t,e)}function NJ(t,e){let r=or.statSync(t);return xJ(e,r.atime,r.mtime)}function $J(t,e,r,n,i){return e?F1(r,n,i):LJ(t.mode,r,n,i)}function LJ(t,e,r,n){return or.mkdirSync(r),F1(e,r,n),R0(r,t)}function F1(t,e,r){let n=or.opendirSync(t);try{let i;for(;(i=n.readSync())!==null;)BJ(i.name,t,e,r)}finally{n.closeSync()}}function BJ(t,e,r,n){let i=mc.join(e,t),s=mc.join(r,t);if(n.filter&&!n.filter(i,s))return;let{destStat:o}=gc.checkPathsSync(i,s,"copy",n);return I1(o,i,s,n)}function jJ(t,e,r,n){let i=or.readlinkSync(e);if(n.dereference&&(i=mc.resolve(process.cwd(),i)),t){let s;try{s=or.readlinkSync(r)}catch(o){if(o.code==="EINVAL"||o.code==="UNKNOWN")return or.symlinkSync(i,r);throw o}if(n.dereference&&(s=mc.resolve(process.cwd(),s)),gc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(gc.isSrcSubdir(s,i))throw new Error(`Cannot overwrite '${s}' with '${i}'.`);return MJ(i,r)}else return or.symlinkSync(i,r)}function MJ(t,e){return or.unlinkSync(e),or.symlinkSync(t,e)}R1.exports=TJ});var Qh=C((y0e,N1)=>{"use strict";var UJ=Re().fromPromise;N1.exports={copy:UJ(T1()),copySync:k1()}});var yc=C((D0e,L1)=>{"use strict";var $1=vt(),qJ=Re().fromCallback;function HJ(t,e){$1.rm(t,{recursive:!0,force:!0},e)}function VJ(t){$1.rmSync(t,{recursive:!0,force:!0})}L1.exports={remove:qJ(HJ),removeSync:VJ}});var z1=C((w0e,V1)=>{"use strict";var zJ=Re().fromPromise,M1=sr(),U1=require("path"),q1=fn(),H1=yc(),B1=zJ(async function(e){let r;try{r=await M1.readdir(e)}catch{return q1.mkdirs(e)}return Promise.all(r.map(n=>H1.remove(U1.join(e,n))))});function j1(t){let e;try{e=M1.readdirSync(t)}catch{return q1.mkdirsSync(t)}e.forEach(r=>{r=U1.join(t,r),H1.removeSync(r)})}V1.exports={emptyDirSync:j1,emptydirSync:j1,emptyDir:B1,emptydir:B1}});var X1=C((v0e,W1)=>{"use strict";var KJ=Re().fromPromise,K1=require("path"),oi=sr(),G1=fn();async function GJ(t){let e;try{e=await oi.stat(t)}catch{}if(e&&e.isFile())return;let r=K1.dirname(t),n=null;try{n=await oi.stat(r)}catch(i){if(i.code==="ENOENT"){await G1.mkdirs(r),await oi.writeFile(t,"");return}else throw i}n.isDirectory()?await oi.writeFile(t,""):await oi.readdir(r)}function WJ(t){let e;try{e=oi.statSync(t)}catch{}if(e&&e.isFile())return;let r=K1.dirname(t);try{oi.statSync(r).isDirectory()||oi.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")G1.mkdirsSync(r);else throw n}oi.writeFileSync(t,"")}W1.exports={createFile:KJ(GJ),createFileSync:WJ}});var eI=C((E0e,Q1)=>{"use strict";var XJ=Re().fromPromise,Y1=require("path"),Hi=sr(),J1=fn(),{pathExists:YJ}=qi(),{areIdentical:Z1}=Gs();async function JJ(t,e){let r;try{r=await Hi.lstat(e)}catch{}let n;try{n=await Hi.lstat(t)}catch(o){throw o.message=o.message.replace("lstat","ensureLink"),o}if(r&&Z1(n,r))return;let i=Y1.dirname(e);await YJ(i)||await J1.mkdirs(i),await Hi.link(t,e)}function ZJ(t,e){let r;try{r=Hi.lstatSync(e)}catch{}try{let s=Hi.lstatSync(t);if(r&&Z1(s,r))return}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=Y1.dirname(e);return Hi.existsSync(n)||J1.mkdirsSync(n),Hi.linkSync(t,e)}Q1.exports={createLink:XJ(JJ),createLinkSync:ZJ}});var rI=C((b0e,tI)=>{"use strict";var Vi=require("path"),Dc=sr(),{pathExists:QJ}=qi(),eZ=Re().fromPromise;async function tZ(t,e){if(Vi.isAbsolute(t)){try{await Dc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(await QJ(n))return{toCwd:n,toDst:t};try{await Dc.lstat(t)}catch(s){throw s.message=s.message.replace("lstat","ensureSymlink"),s}return{toCwd:t,toDst:Vi.relative(r,t)}}function rZ(t,e){if(Vi.isAbsolute(t)){if(!Dc.existsSync(t))throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}let r=Vi.dirname(e),n=Vi.join(r,t);if(Dc.existsSync(n))return{toCwd:n,toDst:t};if(!Dc.existsSync(t))throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:Vi.relative(r,t)}}tI.exports={symlinkPaths:eZ(tZ),symlinkPathsSync:rZ}});var sI=C((_0e,iI)=>{"use strict";var nI=sr(),nZ=Re().fromPromise;async function iZ(t,e){if(e)return e;let r;try{r=await nI.lstat(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}function sZ(t,e){if(e)return e;let r;try{r=nI.lstatSync(t)}catch{return"file"}return r&&r.isDirectory()?"dir":"file"}iI.exports={symlinkType:nZ(iZ),symlinkTypeSync:sZ}});var cI=C((C0e,uI)=>{"use strict";var oZ=Re().fromPromise,oI=require("path"),An=sr(),{mkdirs:aZ,mkdirsSync:uZ}=fn(),{symlinkPaths:cZ,symlinkPathsSync:lZ}=rI(),{symlinkType:fZ,symlinkTypeSync:hZ}=sI(),{pathExists:dZ}=qi(),{areIdentical:aI}=Gs();async function pZ(t,e,r){let n;try{n=await An.lstat(e)}catch{}if(n&&n.isSymbolicLink()){let[a,u]=await Promise.all([An.stat(t),An.stat(e)]);if(aI(a,u))return}let i=await cZ(t,e);t=i.toDst;let s=await fZ(i.toCwd,r),o=oI.dirname(e);return await dZ(o)||await aZ(o),An.symlink(t,e,s)}function mZ(t,e,r){let n;try{n=An.lstatSync(e)}catch{}if(n&&n.isSymbolicLink()){let a=An.statSync(t),u=An.statSync(e);if(aI(a,u))return}let i=lZ(t,e);t=i.toDst,r=hZ(i.toCwd,r);let s=oI.dirname(e);return An.existsSync(s)||uZ(s),An.symlinkSync(t,e,r)}uI.exports={createSymlink:oZ(pZ),createSymlinkSync:mZ}});var yI=C((S0e,gI)=>{"use strict";var{createFile:lI,createFileSync:fI}=X1(),{createLink:hI,createLinkSync:dI}=eI(),{createSymlink:pI,createSymlinkSync:mI}=cI();gI.exports={createFile:lI,createFileSync:fI,ensureFile:lI,ensureFileSync:fI,createLink:hI,createLinkSync:dI,ensureLink:hI,ensureLinkSync:dI,createSymlink:pI,createSymlinkSync:mI,ensureSymlink:pI,ensureSymlinkSync:mI}});var ba=C((A0e,DI)=>{function gZ(t,{EOL:e=`
|
|
69
69
|
`,finalEOL:r=!0,replacer:n=null,spaces:i}={}){let s=r?e:"";return JSON.stringify(t,n,i).replace(/\n/g,e)+s}function yZ(t){return Buffer.isBuffer(t)&&(t=t.toString("utf8")),t.replace(/^\uFEFF/,"")}DI.exports={stringify:gZ,stripBom:yZ}});var k0=C((O0e,EI)=>{var _a;try{_a=vt()}catch{_a=require("fs")}var ed=Re(),{stringify:wI,stripBom:vI}=ba();async function DZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||_a,n="throws"in e?e.throws:!0,i=await ed.fromCallback(r.readFile)(t,e);i=vI(i);let s;try{s=JSON.parse(i,e?e.reviver:null)}catch(o){if(n)throw o.message=`${t}: ${o.message}`,o;return null}return s}var wZ=ed.fromPromise(DZ);function vZ(t,e={}){typeof e=="string"&&(e={encoding:e});let r=e.fs||_a,n="throws"in e?e.throws:!0;try{let i=r.readFileSync(t,e);return i=vI(i),JSON.parse(i,e.reviver)}catch(i){if(n)throw i.message=`${t}: ${i.message}`,i;return null}}async function EZ(t,e,r={}){let n=r.fs||_a,i=wI(e,r);await ed.fromCallback(n.writeFile)(t,i,r)}var bZ=ed.fromPromise(EZ);function _Z(t,e,r={}){let n=r.fs||_a,i=wI(e,r);return n.writeFileSync(t,i,r)}EI.exports={readFile:wZ,readFileSync:vZ,writeFile:bZ,writeFileSync:_Z}});var _I=C((x0e,bI)=>{"use strict";var td=k0();bI.exports={readJson:td.readFile,readJsonSync:td.readFileSync,writeJson:td.writeFile,writeJsonSync:td.writeFileSync}});var rd=C((T0e,AI)=>{"use strict";var CZ=Re().fromPromise,N0=sr(),CI=require("path"),SI=fn(),SZ=qi().pathExists;async function AZ(t,e,r="utf-8"){let n=CI.dirname(t);return await SZ(n)||await SI.mkdirs(n),N0.writeFile(t,e,r)}function OZ(t,...e){let r=CI.dirname(t);N0.existsSync(r)||SI.mkdirsSync(r),N0.writeFileSync(t,...e)}AI.exports={outputFile:CZ(AZ),outputFileSync:OZ}});var xI=C((I0e,OI)=>{"use strict";var{stringify:xZ}=ba(),{outputFile:TZ}=rd();async function IZ(t,e,r={}){let n=xZ(e,r);await TZ(t,n,r)}OI.exports=IZ});var II=C((P0e,TI)=>{"use strict";var{stringify:PZ}=ba(),{outputFileSync:FZ}=rd();function RZ(t,e,r){let n=PZ(e,r);FZ(t,n,r)}TI.exports=RZ});var FI=C((F0e,PI)=>{"use strict";var kZ=Re().fromPromise,ar=_I();ar.outputJson=kZ(xI());ar.outputJsonSync=II();ar.outputJSON=ar.outputJson;ar.outputJSONSync=ar.outputJsonSync;ar.writeJSON=ar.writeJson;ar.writeJSONSync=ar.writeJsonSync;ar.readJSON=ar.readJson;ar.readJSONSync=ar.readJsonSync;PI.exports=ar});var LI=C((R0e,$I)=>{"use strict";var NZ=sr(),RI=require("path"),{copy:$Z}=Qh(),{remove:NI}=yc(),{mkdirp:LZ}=fn(),{pathExists:BZ}=qi(),kI=Gs();async function jZ(t,e,r={}){let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=await kI.checkPaths(t,e,"move",r);await kI.checkParentPaths(t,i,e,"move");let o=RI.dirname(e);return RI.parse(o).root!==o&&await LZ(o),MZ(t,e,n,s)}async function MZ(t,e,r,n){if(!n){if(r)await NI(e);else if(await BZ(e))throw new Error("dest already exists.")}try{await NZ.rename(t,e)}catch(i){if(i.code!=="EXDEV")throw i;await UZ(t,e,r)}}async function UZ(t,e,r){return await $Z(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),NI(t)}$I.exports=jZ});var qI=C((k0e,UI)=>{"use strict";var jI=vt(),L0=require("path"),qZ=Qh().copySync,MI=yc().removeSync,HZ=fn().mkdirpSync,BI=Gs();function VZ(t,e,r){r=r||{};let n=r.overwrite||r.clobber||!1,{srcStat:i,isChangingCase:s=!1}=BI.checkPathsSync(t,e,"move",r);return BI.checkParentPathsSync(t,i,e,"move"),zZ(e)||HZ(L0.dirname(e)),KZ(t,e,n,s)}function zZ(t){let e=L0.dirname(t);return L0.parse(e).root===e}function KZ(t,e,r,n){if(n)return $0(t,e,r);if(r)return MI(e),$0(t,e,r);if(jI.existsSync(e))throw new Error("dest already exists.");return $0(t,e,r)}function $0(t,e,r){try{jI.renameSync(t,e)}catch(n){if(n.code!=="EXDEV")throw n;return GZ(t,e,r)}}function GZ(t,e,r){return qZ(t,e,{overwrite:r,errorOnExist:!0,preserveTimestamps:!0}),MI(t)}UI.exports=VZ});var VI=C((N0e,HI)=>{"use strict";var WZ=Re().fromPromise;HI.exports={move:WZ(LI()),moveSync:qI()}});var Ca=C(($0e,zI)=>{"use strict";zI.exports={...sr(),...Qh(),...z1(),...yI(),...FI(),...fn(),...VI(),...rd(),...qi(),...yc()}});var ZI=C((L0e,JI)=>{"use strict";var B0,GI,WI,XI,YI=!0;typeof process<"u"&&({FORCE_COLOR:B0,NODE_DISABLE_COLORS:GI,NO_COLOR:WI,TERM:XI}=process.env||{},YI=process.stdout&&process.stdout.isTTY);var Be={enabled:!GI&&WI==null&&XI!=="dumb"&&(B0!=null&&B0!=="0"||YI),reset:Ye(0,0),bold:Ye(1,22),dim:Ye(2,22),italic:Ye(3,23),underline:Ye(4,24),inverse:Ye(7,27),hidden:Ye(8,28),strikethrough:Ye(9,29),black:Ye(30,39),red:Ye(31,39),green:Ye(32,39),yellow:Ye(33,39),blue:Ye(34,39),magenta:Ye(35,39),cyan:Ye(36,39),white:Ye(37,39),gray:Ye(90,39),grey:Ye(90,39),bgBlack:Ye(40,49),bgRed:Ye(41,49),bgGreen:Ye(42,49),bgYellow:Ye(43,49),bgBlue:Ye(44,49),bgMagenta:Ye(45,49),bgCyan:Ye(46,49),bgWhite:Ye(47,49)};function KI(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,~e.indexOf(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function XZ(t,e){let r={has:t,keys:e};return r.reset=Be.reset.bind(r),r.bold=Be.bold.bind(r),r.dim=Be.dim.bind(r),r.italic=Be.italic.bind(r),r.underline=Be.underline.bind(r),r.inverse=Be.inverse.bind(r),r.hidden=Be.hidden.bind(r),r.strikethrough=Be.strikethrough.bind(r),r.black=Be.black.bind(r),r.red=Be.red.bind(r),r.green=Be.green.bind(r),r.yellow=Be.yellow.bind(r),r.blue=Be.blue.bind(r),r.magenta=Be.magenta.bind(r),r.cyan=Be.cyan.bind(r),r.white=Be.white.bind(r),r.gray=Be.gray.bind(r),r.grey=Be.grey.bind(r),r.bgBlack=Be.bgBlack.bind(r),r.bgRed=Be.bgRed.bind(r),r.bgGreen=Be.bgGreen.bind(r),r.bgYellow=Be.bgYellow.bind(r),r.bgBlue=Be.bgBlue.bind(r),r.bgMagenta=Be.bgMagenta.bind(r),r.bgCyan=Be.bgCyan.bind(r),r.bgWhite=Be.bgWhite.bind(r),r}function Ye(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:Be.enabled?KI(this.keys,n+""):n+""):n===void 0?XZ([t],[r]):Be.enabled?KI([r],n+""):n+""}}JI.exports=Be});var Sa=C(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ancillary=St.failure=St.success=St.input=St.weak=St.strong=void 0;var YZ=(he(),ce(fe)),On=YZ.__importDefault(ZI());St.strong=On.default.bold;St.weak=On.default.dim;St.input=On.default.cyan;St.success=On.default.green;St.failure=On.default.red;St.ancillary=On.default.cyan;var JZ={strong:St.strong,weak:St.weak,input:St.input,success:St.success,failure:St.failure,ancillary:St.ancillary,log:{DEBUG:On.default.magenta,INFO:On.default.cyan,WARN:On.default.yellow,ERROR:On.default.red}};St.default=JZ});var j0=C(nd=>{"use strict";Object.defineProperty(nd,"__esModule",{value:!0});nd.EscapeCode=void 0;var hn="\x1B[",Bt=class{};nd.EscapeCode=Bt;Bt.cursorLeft=()=>`${hn}G`;Bt.cursorUp=(t=1)=>`${hn}${t}A`;Bt.cursorDown=(t=1)=>`${hn}${t}B`;Bt.cursorForward=(t=1)=>`${hn}${t}C`;Bt.cursorBackward=(t=1)=>`${hn}${t}D`;Bt.cursorHide=()=>`${hn}?25l`;Bt.cursorShow=()=>`${hn}?25h`;Bt.eraseLine=()=>`${hn}2K`;Bt.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=Bt.eraseLine(),r<t-1&&(e+=Bt.cursorUp());return`${e}${Bt.cursorLeft()}`};Bt.eraseUp=()=>`${hn}1J`;Bt.eraseDown=()=>`${hn}J`;Bt.eraseScreen=()=>`${hn}2J`});var eP=C(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});id.Cursor=void 0;var ZZ=(he(),ce(fe)),QZ=ZZ.__importDefault(Mh()),QI=j0(),Aa=class t{static show(){t.stream.isTTY&&(t._isVisible=!0,t.stream.write(QI.EscapeCode.cursorShow()))}static hide(){t.stream.isTTY&&(t._listenerAttached||((0,QZ.default)(()=>{t.show()}),t._listenerAttached=!0),t._isVisible=!1,t.stream.write(QI.EscapeCode.cursorHide()))}static toggle(){t._isVisible?t.hide():t.show()}};id.Cursor=Aa;Aa.stream=process.stderr;Aa._isVisible=!0;Aa._listenerAttached=!1});var U0=C((U0e,M0)=>{"use strict";var tP=t=>Number.isNaN(t)?!1:t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141);M0.exports=tP;M0.exports.default=tP});var iP=C((q0e,nP)=>{"use strict";var rP="[\uD800-\uDBFF][\uDC00-\uDFFF]",eQ=t=>t&&t.exact?new RegExp(`^${rP}$`):new RegExp(rP,"g");nP.exports=eQ});var oP=C((H0e,sP)=>{"use strict";sP.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var q0=C((V0e,uP)=>{var wc=oP(),aP={};for(let t of Object.keys(wc))aP[wc[t]]=t;var ie={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};uP.exports=ie;for(let t of Object.keys(ie)){if(!("channels"in ie[t]))throw new Error("missing channels property: "+t);if(!("labels"in ie[t]))throw new Error("missing channel labels property: "+t);if(ie[t].labels.length!==ie[t].channels)throw new Error("channel and label counts mismatch: "+t);let{channels:e,labels:r}=ie[t];delete ie[t].channels,delete ie[t].labels,Object.defineProperty(ie[t],"channels",{value:e}),Object.defineProperty(ie[t],"labels",{value:r})}ie.rgb.hsl=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(e,r,n),s=Math.max(e,r,n),o=s-i,a,u;s===i?a=0:e===s?a=(r-n)/o:r===s?a=2+(n-e)/o:n===s&&(a=4+(e-r)/o),a=Math.min(a*60,360),a<0&&(a+=360);let c=(i+s)/2;return s===i?u=0:c<=.5?u=o/(s+i):u=o/(2-s-i),[a,u*100,c*100]};ie.rgb.hsv=function(t){let e,r,n,i,s,o=t[0]/255,a=t[1]/255,u=t[2]/255,c=Math.max(o,a,u),l=c-Math.min(o,a,u),h=function(d){return(c-d)/6/l+1/2};return l===0?(i=0,s=0):(s=l/c,e=h(o),r=h(a),n=h(u),o===c?i=n-r:a===c?i=1/3+e-n:u===c&&(i=2/3+r-e),i<0?i+=1:i>1&&(i-=1)),[i*360,s*100,c*100]};ie.rgb.hwb=function(t){let e=t[0],r=t[1],n=t[2],i=ie.rgb.hsl(t)[0],s=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[i,s*100,n*100]};ie.rgb.cmyk=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.min(1-e,1-r,1-n),s=(1-e-i)/(1-i)||0,o=(1-r-i)/(1-i)||0,a=(1-n-i)/(1-i)||0;return[s*100,o*100,a*100,i*100]};function tQ(t,e){return(t[0]-e[0])**2+(t[1]-e[1])**2+(t[2]-e[2])**2}ie.rgb.keyword=function(t){let e=aP[t];if(e)return e;let r=1/0,n;for(let i of Object.keys(wc)){let s=wc[i],o=tQ(t,s);o<r&&(r=o,n=i)}return n};ie.keyword.rgb=function(t){return wc[t]};ie.rgb.xyz=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let i=e*.4124+r*.3576+n*.1805,s=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[i*100,s*100,o*100]};ie.rgb.lab=function(t){let e=ie.rgb.xyz(t),r=e[0],n=e[1],i=e[2];r/=95.047,n/=100,i/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*n-16,o=500*(r-n),a=200*(n-i);return[s,o,a]};ie.hsl.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i,s,o;if(r===0)return o=n*255,[o,o,o];n<.5?i=n*(1+r):i=n+r-n*r;let a=2*n-i,u=[0,0,0];for(let c=0;c<3;c++)s=e+1/3*-(c-1),s<0&&s++,s>1&&s--,6*s<1?o=a+(i-a)*6*s:2*s<1?o=i:3*s<2?o=a+(i-a)*(2/3-s)*6:o=a,u[c]=o*255;return u};ie.hsl.hsv=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,i*=s<=1?s:2-s;let o=(n+r)/2,a=n===0?2*i/(s+i):2*r/(n+r);return[e,a*100,o*100]};ie.hsv.rgb=function(t){let e=t[0]/60,r=t[1]/100,n=t[2]/100,i=Math.floor(e)%6,s=e-Math.floor(e),o=255*n*(1-r),a=255*n*(1-r*s),u=255*n*(1-r*(1-s));switch(n*=255,i){case 0:return[n,u,o];case 1:return[a,n,o];case 2:return[o,n,u];case 3:return[o,a,n];case 4:return[u,o,n];case 5:return[n,o,a]}};ie.hsv.hsl=function(t){let e=t[0],r=t[1]/100,n=t[2]/100,i=Math.max(n,.01),s,o;o=(2-r)*n;let a=(2-r)*i;return s=r*i,s/=a<=1?a:2-a,s=s||0,o/=2,[e,s*100,o*100]};ie.hwb.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100,i=r+n,s;i>1&&(r/=i,n/=i);let o=Math.floor(6*e),a=1-n;s=6*e-o,(o&1)!==0&&(s=1-s);let u=r+s*(a-r),c,l,h;switch(o){default:case 6:case 0:c=a,l=u,h=r;break;case 1:c=u,l=a,h=r;break;case 2:c=r,l=a,h=u;break;case 3:c=r,l=u,h=a;break;case 4:c=u,l=r,h=a;break;case 5:c=a,l=r,h=u;break}return[c*255,l*255,h*255]};ie.cmyk.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i=t[3]/100,s=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,r*(1-i)+i),a=1-Math.min(1,n*(1-i)+i);return[s*255,o*255,a*255]};ie.xyz.rgb=function(t){let e=t[0]/100,r=t[1]/100,n=t[2]/100,i,s,o;return i=e*3.2406+r*-1.5372+n*-.4986,s=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),o=Math.min(Math.max(0,o),1),[i*255,s*255,o*255]};ie.xyz.lab=function(t){let e=t[0],r=t[1],n=t[2];e/=95.047,r/=100,n/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let i=116*r-16,s=500*(e-r),o=200*(r-n);return[i,s,o]};ie.lab.xyz=function(t){let e=t[0],r=t[1],n=t[2],i,s,o;s=(e+16)/116,i=r/500+s,o=s-n/200;let a=s**3,u=i**3,c=o**3;return s=a>.008856?a:(s-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i*=95.047,s*=100,o*=108.883,[i,s,o]};ie.lab.lch=function(t){let e=t[0],r=t[1],n=t[2],i;i=Math.atan2(n,r)*360/2/Math.PI,i<0&&(i+=360);let o=Math.sqrt(r*r+n*n);return[e,o,i]};ie.lch.lab=function(t){let e=t[0],r=t[1],i=t[2]/360*2*Math.PI,s=r*Math.cos(i),o=r*Math.sin(i);return[e,s,o]};ie.rgb.ansi16=function(t,e=null){let[r,n,i]=t,s=e===null?ie.rgb.hsv(t)[2]:e;if(s=Math.round(s/50),s===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(o+=60),o};ie.hsv.ansi16=function(t){return ie.rgb.ansi16(ie.hsv.rgb(t),t[2])};ie.rgb.ansi256=function(t){let e=t[0],r=t[1],n=t[2];return e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};ie.ansi16.rgb=function(t){let e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let r=(~~(t>50)+1)*.5,n=(e&1)*r*255,i=(e>>1&1)*r*255,s=(e>>2&1)*r*255;return[n,i,s]};ie.ansi256.rgb=function(t){if(t>=232){let s=(t-232)*10+8;return[s,s,s]}t-=16;let e,r=Math.floor(t/36)/5*255,n=Math.floor((e=t%36)/6)/5*255,i=e%6/5*255;return[r,n,i]};ie.rgb.hex=function(t){let r=(((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};ie.hex.rgb=function(t){let e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let r=e[0];e[0].length===3&&(r=r.split("").map(a=>a+a).join(""));let n=parseInt(r,16),i=n>>16&255,s=n>>8&255,o=n&255;return[i,s,o]};ie.rgb.hcg=function(t){let e=t[0]/255,r=t[1]/255,n=t[2]/255,i=Math.max(Math.max(e,r),n),s=Math.min(Math.min(e,r),n),o=i-s,a,u;return o<1?a=s/(1-o):a=0,o<=0?u=0:i===e?u=(r-n)/o%6:i===r?u=2+(n-e)/o:u=4+(e-r)/o,u/=6,u%=1,[u*360,o*100,a*100]};ie.hsl.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=r<.5?2*e*r:2*e*(1-r),i=0;return n<1&&(i=(r-.5*n)/(1-n)),[t[0],n*100,i*100]};ie.hsv.hcg=function(t){let e=t[1]/100,r=t[2]/100,n=e*r,i=0;return n<1&&(i=(r-n)/(1-n)),[t[0],n*100,i*100]};ie.hcg.rgb=function(t){let e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];let i=[0,0,0],s=e%1*6,o=s%1,a=1-o,u=0;switch(Math.floor(s)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=a,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=a,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=a}return u=(1-r)*n,[(r*i[0]+u)*255,(r*i[1]+u)*255,(r*i[2]+u)*255]};ie.hcg.hsv=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e),i=0;return n>0&&(i=e/n),[t[0],i*100,n*100]};ie.hcg.hsl=function(t){let e=t[1]/100,n=t[2]/100*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[t[0],i*100,n*100]};ie.hcg.hwb=function(t){let e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};ie.hwb.hcg=function(t){let e=t[1]/100,n=1-t[2]/100,i=n-e,s=0;return i<1&&(s=(n-i)/(1-i)),[t[0],i*100,s*100]};ie.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};ie.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};ie.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};ie.gray.hsl=function(t){return[0,0,t[0]]};ie.gray.hsv=ie.gray.hsl;ie.gray.hwb=function(t){return[0,100,t[0]]};ie.gray.cmyk=function(t){return[0,0,0,t[0]]};ie.gray.lab=function(t){return[t[0],0,0]};ie.gray.hex=function(t){let e=Math.round(t[0]/100*255)&255,n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n};ie.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}});var lP=C((z0e,cP)=>{var sd=q0();function rQ(){let t={},e=Object.keys(sd);for(let r=e.length,n=0;n<r;n++)t[e[n]]={distance:-1,parent:null};return t}function nQ(t){let e=rQ(),r=[t];for(e[t].distance=0;r.length;){let n=r.pop(),i=Object.keys(sd[n]);for(let s=i.length,o=0;o<s;o++){let a=i[o],u=e[a];u.distance===-1&&(u.distance=e[n].distance+1,u.parent=n,r.unshift(a))}}return e}function iQ(t,e){return function(r){return e(t(r))}}function sQ(t,e){let r=[e[t].parent,t],n=sd[e[t].parent][t],i=e[t].parent;for(;e[i].parent;)r.unshift(e[i].parent),n=iQ(sd[e[i].parent][i],n),i=e[i].parent;return n.conversion=r,n}cP.exports=function(t){let e=nQ(t),r={},n=Object.keys(e);for(let i=n.length,s=0;s<i;s++){let o=n[s];e[o].parent!==null&&(r[o]=sQ(o,e))}return r}});var hP=C((K0e,fP)=>{var H0=q0(),oQ=lP(),Oa={},aQ=Object.keys(H0);function uQ(t){let e=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function cQ(t){let e=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let i=t(r);if(typeof i=="object")for(let s=i.length,o=0;o<s;o++)i[o]=Math.round(i[o]);return i};return"conversion"in t&&(e.conversion=t.conversion),e}aQ.forEach(t=>{Oa[t]={},Object.defineProperty(Oa[t],"channels",{value:H0[t].channels}),Object.defineProperty(Oa[t],"labels",{value:H0[t].labels});let e=oQ(t);Object.keys(e).forEach(n=>{let i=e[n];Oa[t][n]=cQ(i),Oa[t][n].raw=uQ(i)})});fP.exports=Oa});var z0=C((G0e,yP)=>{"use strict";var dP=(t,e)=>(...r)=>`\x1B[${t(...r)+e}m`,pP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};5;${n}m`},mP=(t,e)=>(...r)=>{let n=t(...r);return`\x1B[${38+e};2;${n[0]};${n[1]};${n[2]}m`},od=t=>t,gP=(t,e,r)=>[t,e,r],xa=(t,e,r)=>{Object.defineProperty(t,e,{get:()=>{let n=r();return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},V0,Ta=(t,e,r,n)=>{V0===void 0&&(V0=hP());let i=n?10:0,s={};for(let[o,a]of Object.entries(V0)){let u=o==="ansi16"?"ansi":o;o===e?s[u]=t(r,i):typeof a=="object"&&(s[u]=t(a[e],i))}return s};function lQ(){let t=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[r,n]of Object.entries(e)){for(let[i,s]of Object.entries(n))e[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[i]=e[i],t.set(s[0],s[1]);Object.defineProperty(e,r,{value:n,enumerable:!1})}return Object.defineProperty(e,"codes",{value:t,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",xa(e.color,"ansi",()=>Ta(dP,"ansi16",od,!1)),xa(e.color,"ansi256",()=>Ta(pP,"ansi256",od,!1)),xa(e.color,"ansi16m",()=>Ta(mP,"rgb",gP,!1)),xa(e.bgColor,"ansi",()=>Ta(dP,"ansi16",od,!0)),xa(e.bgColor,"ansi256",()=>Ta(pP,"ansi256",od,!0)),xa(e.bgColor,"ansi16m",()=>Ta(mP,"rgb",gP,!0)),e}Object.defineProperty(yP,"exports",{enumerable:!0,get:lQ})});var bP=C((W0e,EP)=>{"use strict";var fQ=U0(),hQ=iP(),DP=z0(),vP=["\x1B","\x9B"],ad=t=>`${vP[0]}[${t}m`,wP=(t,e,r)=>{let n=[];t=[...t];for(let i of t){let s=i;i.includes(";")&&(i=i.split(";")[0][0]+"0");let o=DP.codes.get(Number.parseInt(i,10));if(o){let a=t.indexOf(o.toString());a===-1?n.push(ad(e?o:s)):t.splice(a,1)}else if(e){n.push(ad(0));break}else n.push(ad(s))}if(e&&(n=n.filter((i,s)=>n.indexOf(i)===s),r!==void 0)){let i=ad(DP.codes.get(Number.parseInt(r,10)));n=n.reduce((s,o)=>o===i?[o,...s]:[...s,o],[])}return n.join("")};EP.exports=(t,e,r)=>{let n=[...t],i=[],s=typeof r=="number"?r:n.length,o=!1,a,u=0,c="";for(let[l,h]of n.entries()){let d=!1;if(vP.includes(h)){let f=/\d[^m]*/.exec(t.slice(l,l+18));a=f&&f.length>0?f[0]:void 0,u<s&&(o=!0,a!==void 0&&i.push(a))}else o&&h==="m"&&(o=!1,d=!0);if(!o&&!d&&u++,!hQ({exact:!0}).test(h)&&fQ(h.codePointAt())&&(u++,typeof r!="number"&&s++),u>e&&u<=s)c+=h;else if(u===e&&!o&&a!==void 0)c=wP(i);else if(u>=s){c+=wP(i,!0,a);break}}return c}});var CP=C((X0e,_P)=>{"use strict";_P.exports=({onlyFirst:t=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}});var ud=C((Y0e,SP)=>{"use strict";var dQ=CP();SP.exports=t=>typeof t=="string"?t.replace(dQ(),""):t});var OP=C((J0e,AP)=>{"use strict";AP.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var G0=C((Z0e,K0)=>{"use strict";var pQ=ud(),mQ=U0(),gQ=OP(),xP=t=>{if(typeof t!="string"||t.length===0||(t=pQ(t),t.length===0))return 0;t=t.replace(gQ()," ");let e=0;for(let r=0;r<t.length;r++){let n=t.codePointAt(r);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&r++,e+=mQ(n)?2:1)}return e};K0.exports=xP;K0.exports.default=xP});var kP=C((Q0e,RP)=>{"use strict";var vc=G0(),yQ=ud(),DQ=z0(),cd=new Set(["\x1B","\x9B"]),wQ=39,X0="\x07",PP="[",vQ="]",FP="m",Y0=`${vQ}8;;`,TP=t=>`${cd.values().next().value}${PP}${t}${FP}`,IP=t=>`${cd.values().next().value}${Y0}${t}${X0}`,EQ=t=>t.split(" ").map(e=>vc(e)),W0=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=vc(yQ(t[t.length-1]));for(let[a,u]of n.entries()){let c=vc(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),cd.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(Y0)),i){s?u===X0&&(i=!1,s=!1):u===FP&&(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())},bQ=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(vc(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},_Q=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,s,o=EQ(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let h=vc(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(""),W0(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){W0(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){W0(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(bQ));let u=[...a.join(`
|
|
70
70
|
`)];for(let[c,l]of u.entries()){if(n+=l,cd.has(l)){let{groups:d}=new RegExp(`(?:\\${PP}(?<code>\\d+)m|\\${Y0}(?<uri>.*)${X0})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===wQ?void 0:f}else d.uri!==void 0&&(s=d.uri.length===0?void 0:d.uri)}let h=DQ.codes.get(Number(i));u[c+1]===`
|
|
71
71
|
`?(s&&(n+=IP("")),i&&h&&(n+=TP(h))):l===`
|
|
72
72
|
`&&(i&&h&&(n+=TP(i)),s&&(n+=IP(s)))}return n};RP.exports=(t,e,r)=>String(t).normalize().replace(/\r\n/g,`
|
|
73
73
|
`).split(`
|
|
74
74
|
`).map(n=>_Q(n,e,r)).join(`
|
|
75
|
-
`)});var LP=C((ewe,$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=C(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")),
|
|
75
|
+
`)});var LP=C((ewe,$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=C(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 ld=G0();mt.stringWidth=ld;var AQ=ud();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=
|
|
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=>ld(o))),i=n>e?n+1:e,s=r.repeat(i);return t.map(o=>jP(s,0,i-ld(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
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,ld(p)),p}));return i&&e!==""&&c.splice(1,0,e.repeat(u)),c.join(`
|
|
79
79
|
`)}mt.columnar=RQ});var VP=C(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=Jh(),$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 zi=C(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var fd=(he(),ce(fe));fd.__exportStar(j0(),Ia);fd.__exportStar(eP(),Ia);fd.__exportStar(HP(),Ia);fd.__exportStar(VP(),Ia)});var dd=C(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.isFatal=xn.fatal=xn.FatalException=xn.BaseException=void 0;var hd=class extends Error{constructor(e,r){super(e),this.message=e,this.code=r}};xn.BaseException=hd;var Ec=class extends hd{constructor(e,r=1){super(e,"FATAL"),this.message=e,this.exitCode=r}};xn.FatalException=Ec;function jQ(t){throw new Ec(t)}xn.fatal=jQ;function MQ(t){return t&&t instanceof Ec}xn.isFatal=MQ});var pd=C(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 bc=C(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});md.NO_COLORS=void 0;var In=pd();md.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 ew=C(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=zi(),KQ=require("stream"),GQ=zQ.__importStar(require("util")),WQ=bc(),GP=pd();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 Q0(t){if(t){let e=Se.LOGGER_LEVEL_NAMES.get(t);if(e)return e}}Se.getLoggerLevelName=Q0;function J0(t,e){let r=Q0(e);if(r)return t.log[r]}Se.getLoggerLevelColor=J0;var _c=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=_c;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 _c({stream:process.stdout,filter:XQ}),new _c({stream:process.stderr,filter:YQ})]);var Z0=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(`
|
|
@@ -90,26 +90,26 @@ ${MP(r)}`)}mt.wordWrap=PQ;function FQ(t){t=UP(t);let e=process.cwd(),r=oi.dirnam
|
|
|
90
90
|
Run the command with ${iee.default.input("--help")} to see a list of arguments that must be provided.`),!1):!0:!1;Xs.checkInteractive=oee;var aee=()=>JP.TERMINAL_INFO.tty&&!JP.TERMINAL_INFO.ci;Xs.isInteractive=aee});var gt=C((dwe,eF)=>{"use strict";var{FORCE_COLOR:uee,NODE_DISABLE_COLORS:cee,TERM:lee}=process.env,je={enabled:!cee&&lee!=="dumb"&&uee!=="0",reset:Je(0,0),bold:Je(1,22),dim:Je(2,22),italic:Je(3,23),underline:Je(4,24),inverse:Je(7,27),hidden:Je(8,28),strikethrough:Je(9,29),black:Je(30,39),red:Je(31,39),green:Je(32,39),yellow:Je(33,39),blue:Je(34,39),magenta:Je(35,39),cyan:Je(36,39),white:Je(37,39),gray:Je(90,39),grey:Je(90,39),bgBlack:Je(40,49),bgRed:Je(41,49),bgGreen:Je(42,49),bgYellow:Je(43,49),bgBlue:Je(44,49),bgMagenta:Je(45,49),bgCyan:Je(46,49),bgWhite:Je(47,49)};function QP(t,e){let r=0,n,i="",s="";for(;r<t.length;r++)n=t[r],i+=n.open,s+=n.close,e.includes(n.close)&&(e=e.replace(n.rgx,n.close+n.open));return i+e+s}function fee(t,e){let r={has:t,keys:e};return r.reset=je.reset.bind(r),r.bold=je.bold.bind(r),r.dim=je.dim.bind(r),r.italic=je.italic.bind(r),r.underline=je.underline.bind(r),r.inverse=je.inverse.bind(r),r.hidden=je.hidden.bind(r),r.strikethrough=je.strikethrough.bind(r),r.black=je.black.bind(r),r.red=je.red.bind(r),r.green=je.green.bind(r),r.yellow=je.yellow.bind(r),r.blue=je.blue.bind(r),r.magenta=je.magenta.bind(r),r.cyan=je.cyan.bind(r),r.white=je.white.bind(r),r.gray=je.gray.bind(r),r.grey=je.grey.bind(r),r.bgBlack=je.bgBlack.bind(r),r.bgRed=je.bgRed.bind(r),r.bgGreen=je.bgGreen.bind(r),r.bgYellow=je.bgYellow.bind(r),r.bgBlue=je.bgBlue.bind(r),r.bgMagenta=je.bgMagenta.bind(r),r.bgCyan=je.bgCyan.bind(r),r.bgWhite=je.bgWhite.bind(r),r}function Je(t,e){let r={open:`\x1B[${t}m`,close:`\x1B[${e}m`,rgx:new RegExp(`\\x1b\\[${e}m`,"g")};return function(n){return this!==void 0&&this.has!==void 0?(this.has.includes(t)||(this.has.push(t),this.keys.push(r)),n===void 0?this:je.enabled?QP(this.keys,n+""):n+""):n===void 0?fee([t],[r]):je.enabled?QP([r],n+""):n+""}}eF.exports=je});var rF=C((pwe,tF)=>{"use strict";tF.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 Ed=C((mwe,nF)=>{"use strict";nF.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 uF=C((gwe,aF)=>{"use strict";function hee(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=dee(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.
|
|
91
91
|
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 dee(t,e){if(t){if(typeof t=="string")return iF(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 iF(t,e)}}function iF(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}var pee=Ed(),oF=Ze(),sF=oF.erase,mee=oF.cursor,gee=t=>[...pee(t)].length;aF.exports=function(t,e){if(!e)return sF.line+mee.to(0);let r=0,n=t.split(/\r?\n/);var i=hee(n),s;try{for(i.s();!(s=i.n()).done;){let o=s.value;r+=1+Math.floor(Math.max(gee(o)-1,0)/e)}}catch(o){i.e(o)}finally{i.f()}return sF.lines(r)}});var cw=C((ywe,cF)=>{"use strict";var Sc={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},yee={arrowUp:Sc.arrowUp,arrowDown:Sc.arrowDown,arrowLeft:Sc.arrowLeft,arrowRight:Sc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Dee=process.platform==="win32"?yee:Sc;cF.exports=Dee});var fF=C((Dwe,lF)=>{"use strict";var Fa=gt(),Ys=cw(),lw=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}`}}),wee=t=>lw[t]||lw.default,Ac=Object.freeze({aborted:Fa.red(Ys.cross),done:Fa.green(Ys.tick),exited:Fa.yellow(Ys.cross),default:Fa.cyan("?")}),vee=(t,e,r)=>e?Ac.aborted:r?Ac.exited:t?Ac.done:Ac.default,Eee=t=>Fa.gray(t?Ys.ellipsis:Ys.pointerSmall),bee=(t,e)=>Fa.gray(t?e?Ys.pointerSmall:"+":Ys.line);lF.exports={styles:lw,render:wee,symbols:Ac,symbol:vee,delimiter:Eee,item:bee}});var dF=C((wwe,hF)=>{"use strict";var _ee=Ed();hF.exports=function(t,e){let r=String(_ee(t)||"").split(/\r?\n/);return e?r.map(n=>Math.ceil(n.length/e)).reduce((n,i)=>n+i):r.length}});var mF=C((vwe,pF)=>{"use strict";pF.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(`
|
|
92
92
|
`)).join(`
|
|
93
|
-
`)}});var yF=C((Ewe,gF)=>{"use strict";gF.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 dn=C((bwe,DF)=>{"use strict";DF.exports={action:rF(),clear:uF(),style:fF(),strip:Ed(),figures:cw(),lines:dF(),wrap:mF(),entriesToDisplay:yF()}});var
|
|
93
|
+
`)}});var yF=C((Ewe,gF)=>{"use strict";gF.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 dn=C((bwe,DF)=>{"use strict";DF.exports={action:rF(),clear:uF(),style:fF(),strip:Ed(),figures:cw(),lines:dF(),wrap:mF(),entriesToDisplay:yF()}});var ui=C((_we,EF)=>{"use strict";var wF=require("readline"),Cee=dn(),See=Cee.action,Aee=require("events"),vF=Ze(),Oee=vF.beep,xee=vF.cursor,Tee=gt(),fw=class extends Aee{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=wF.createInterface({input:this.in,escapeCodeTimeout:50});wF.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=See(o,n);a===!1?this._&&this._(s,o):typeof this[a]=="function"?this[a](o):this.bell()};this.close=()=>{this.out.write(xee.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(Oee)}render(){this.onRender(Tee),this.firstRender&&(this.firstRender=!1)}};EF.exports=fw});var AF=C((Cwe,SF)=>{"use strict";function bF(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 _F(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){bF(s,n,i,o,a,"next",u)}function a(u){bF(s,n,i,o,a,"throw",u)}o(void 0)})}}var bd=gt(),Iee=ui(),CF=Ze(),Pee=CF.erase,Oc=CF.cursor,_d=dn(),hw=_d.style,dw=_d.clear,Fee=_d.lines,Ree=_d.figures,pw=class extends Iee{constructor(e={}){super(e),this.transform=hw.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=dw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=bd.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(`
|
|
94
94
|
`),this.close()}validate(){var e=this;return _F(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return _F(function*(){if(e.value=e.value||e.initial,e.cursorOffset=0,e.cursor=e.rendered.length,yield e.validate(),e.error){e.red=!0,e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
95
95
|
`),e.close()})()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Oc.down(Fee(this.outputError,this.out.columns)-1)+dw(this.outputError,this.out.columns)),this.out.write(dw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[hw.symbol(this.done,this.aborted),bd.bold(this.msg),hw.delimiter(this.done),this.red?bd.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
96
96
|
`).reduce((e,r,n)=>e+`
|
|
97
|
-
${n?" ":Ree.pointerSmall} ${bd.red().italic(r)}`,"")),this.out.write(Pee.line+Oc.to(0)+this.outputText+Oc.save+this.outputError+Oc.restore+Oc.move(this.cursorOffset,0)))}};SF.exports=pw});var IF=C((Swe,TF)=>{"use strict";var
|
|
97
|
+
${n?" ":Ree.pointerSmall} ${bd.red().italic(r)}`,"")),this.out.write(Pee.line+Oc.to(0)+this.outputText+Oc.save+this.outputError+Oc.restore+Oc.move(this.cursorOffset,0)))}};SF.exports=pw});var IF=C((Swe,TF)=>{"use strict";var ci=gt(),kee=ui(),xc=dn(),OF=xc.style,xF=xc.clear,Cd=xc.figures,Nee=xc.wrap,$ee=xc.entriesToDisplay,Lee=Ze(),Bee=Lee.cursor,mw=class extends kee{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=xF("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
98
98
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
99
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Bee.hide):this.out.write(xF(this.outputText,this.out.columns)),super.render();let e=$ee(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[OF.symbol(this.done,this.aborted),
|
|
100
|
-
`;for(let i=r;i<n;i++){let s,o,a="",u=this.choices[i];i===r&&r>0?o=Cd.arrowUp:i===n-1&&n<this.choices.length?o=Cd.arrowDown:o=" ",u.disabled?(s=this.cursor===i?
|
|
101
|
-
`+Nee(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${
|
|
102
|
-
`}}this.out.write(this.outputText)}};TF.exports=mw});var $F=C((Awe,NF)=>{"use strict";var Sd=gt(),jee=
|
|
99
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(Bee.hide):this.out.write(xF(this.outputText,this.out.columns)),super.render();let e=$ee(this.cursor,this.choices.length,this.optionsPerPage),r=e.startIndex,n=e.endIndex;if(this.outputText=[OF.symbol(this.done,this.aborted),ci.bold(this.msg),OF.delimiter(!1),this.done?this.selection.title:this.selection.disabled?ci.yellow(this.warn):ci.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
100
|
+
`;for(let i=r;i<n;i++){let s,o,a="",u=this.choices[i];i===r&&r>0?o=Cd.arrowUp:i===n-1&&n<this.choices.length?o=Cd.arrowDown:o=" ",u.disabled?(s=this.cursor===i?ci.gray().underline(u.title):ci.strikethrough().gray(u.title),o=(this.cursor===i?ci.bold().gray(Cd.pointer)+" ":" ")+o):(s=this.cursor===i?ci.cyan().underline(u.title):u.title,o=(this.cursor===i?ci.cyan(Cd.pointer)+" ":" ")+o,u.description&&this.cursor===i&&(a=` - ${u.description}`,(o.length+s.length+a.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(a=`
|
|
101
|
+
`+Nee(u.description,{margin:3,width:this.out.columns})))),this.outputText+=`${o} ${s}${ci.gray(a)}
|
|
102
|
+
`}}this.out.write(this.outputText)}};TF.exports=mw});var $F=C((Awe,NF)=>{"use strict";var Sd=gt(),jee=ui(),RF=dn(),PF=RF.style,Mee=RF.clear,kF=Ze(),FF=kF.cursor,Uee=kF.erase,gw=class extends jee{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,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(`
|
|
103
103
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
104
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(FF.hide):this.out.write(Mee(this.outputText,this.out.columns)),super.render(),this.outputText=[PF.symbol(this.done,this.aborted),Sd.bold(this.msg),PF.delimiter(this.done),this.value?this.inactive:Sd.cyan().underline(this.inactive),Sd.gray("/"),this.value?Sd.cyan().underline(this.active):this.active].join(" "),this.out.write(Uee.line+FF.to(0)+this.outputText))}};NF.exports=gw});var Pn=C((Owe,LF)=>{"use strict";var yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};LF.exports=yw});var jF=C((xwe,BF)=>{"use strict";var qee=Pn(),Dw=class extends qee{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};BF.exports=Dw});var UF=C((Twe,MF)=>{"use strict";var Hee=Pn(),Vee=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),ww=class extends Hee{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Vee(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};MF.exports=ww});var HF=C((Iwe,qF)=>{"use strict";var zee=Pn(),vw=class extends zee{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};qF.exports=vw});var zF=C((Pwe,VF)=>{"use strict";var Kee=Pn(),Ew=class extends Kee{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};VF.exports=Ew});var GF=C((Fwe,KF)=>{"use strict";var Gee=Pn(),bw=class extends Gee{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};KF.exports=bw});var XF=C((Rwe,WF)=>{"use strict";var Wee=Pn(),_w=class extends Wee{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};WF.exports=_w});var JF=C((kwe,YF)=>{"use strict";var Xee=Pn(),Cw=class extends Xee{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};YF.exports=Cw});var QF=C((Nwe,ZF)=>{"use strict";var Yee=Pn(),Sw=class extends Yee{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};ZF.exports=Sw});var tR=C(($we,eR)=>{"use strict";eR.exports={DatePart:Pn(),Meridiem:jF(),Day:UF(),Hours:HF(),Milliseconds:zF(),Minutes:GF(),Month:XF(),Seconds:JF(),Year:QF()}});var fR=C((Lwe,lR)=>{"use strict";function rR(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 nR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){rR(s,n,i,o,a,"next",u)}function a(u){rR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=gt(),Jee=
|
|
104
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(FF.hide):this.out.write(Mee(this.outputText,this.out.columns)),super.render(),this.outputText=[PF.symbol(this.done,this.aborted),Sd.bold(this.msg),PF.delimiter(this.done),this.value?this.inactive:Sd.cyan().underline(this.inactive),Sd.gray("/"),this.value?Sd.cyan().underline(this.active):this.active].join(" "),this.out.write(Uee.line+FF.to(0)+this.outputText))}};NF.exports=gw});var Pn=C((Owe,LF)=>{"use strict";var yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};LF.exports=yw});var jF=C((xwe,BF)=>{"use strict";var qee=Pn(),Dw=class extends qee{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};BF.exports=Dw});var UF=C((Twe,MF)=>{"use strict";var Hee=Pn(),Vee=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),ww=class extends Hee{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+Vee(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};MF.exports=ww});var HF=C((Iwe,qF)=>{"use strict";var zee=Pn(),vw=class extends zee{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};qF.exports=vw});var zF=C((Pwe,VF)=>{"use strict";var Kee=Pn(),Ew=class extends Kee{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};VF.exports=Ew});var GF=C((Fwe,KF)=>{"use strict";var Gee=Pn(),bw=class extends Gee{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};KF.exports=bw});var XF=C((Rwe,WF)=>{"use strict";var Wee=Pn(),_w=class extends Wee{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};WF.exports=_w});var JF=C((kwe,YF)=>{"use strict";var Xee=Pn(),Cw=class extends Xee{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};YF.exports=Cw});var QF=C((Nwe,ZF)=>{"use strict";var Yee=Pn(),Sw=class extends Yee{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};ZF.exports=Sw});var tR=C(($we,eR)=>{"use strict";eR.exports={DatePart:Pn(),Meridiem:jF(),Day:UF(),Hours:HF(),Milliseconds:zF(),Minutes:GF(),Month:XF(),Seconds:JF(),Year:QF()}});var fR=C((Lwe,lR)=>{"use strict";function rR(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 nR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){rR(s,n,i,o,a,"next",u)}function a(u){rR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Aw=gt(),Jee=ui(),xw=dn(),iR=xw.style,sR=xw.clear,Zee=xw.figures,cR=Ze(),Qee=cR.erase,oR=cR.cursor,li=tR(),aR=li.DatePart,ete=li.Meridiem,tte=li.Day,rte=li.Hours,nte=li.Milliseconds,ite=li.Minutes,ste=li.Month,ote=li.Seconds,ate=li.Year,ute=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,uR={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new tte(t),3:t=>new ste(t),4:t=>new ate(t),5:t=>new ete(t),6:t=>new rte(t),7:t=>new ite(t),8:t=>new ote(t),9:t=>new nte(t)},cte={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},Ow=class extends Jee{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(cte,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=sR("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=ute.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in uR?uR[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof aR)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
105
105
|
`),this.close()}validate(){var e=this;return nR(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return nR(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}e.done=!0,e.aborted=!1,e.fire(),e.render(),e.out.write(`
|
|
106
106
|
`),e.close()})()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof aR)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(oR.hide):this.out.write(sR(this.outputText,this.out.columns)),super.render(),this.outputText=[iR.symbol(this.done,this.aborted),Aw.bold(this.msg),iR.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?Aw.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
107
107
|
`).reduce((e,r,n)=>e+`
|
|
108
|
-
${n?" ":Zee.pointerSmall} ${Aw.red().italic(r)}`,"")),this.out.write(Qee.line+oR.to(0)+this.outputText))}};lR.exports=Ow});var DR=C((Bwe,yR)=>{"use strict";function hR(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 dR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){hR(s,n,i,o,a,"next",u)}function a(u){hR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ad=gt(),lte=
|
|
108
|
+
${n?" ":Zee.pointerSmall} ${Aw.red().italic(r)}`,"")),this.out.write(Qee.line+oR.to(0)+this.outputText))}};lR.exports=Ow});var DR=C((Bwe,yR)=>{"use strict";function hR(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 dR(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){hR(s,n,i,o,a,"next",u)}function a(u){hR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ad=gt(),lte=ui(),gR=Ze(),Od=gR.cursor,fte=gR.erase,xd=dn(),Tw=xd.style,hte=xd.figures,pR=xd.clear,dte=xd.lines,pte=/[0-9]/,Iw=t=>t!==void 0,mR=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},Pw=class extends lte{constructor(e={}){super(e),this.transform=Tw.render(e.style),this.msg=e.message,this.initial=Iw(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=Iw(e.min)?e.min:-1/0,this.max=Iw(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=Ad.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${mR(e,this.round)}`),this._value=mR(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||pte.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
109
109
|
`),this.close()}validate(){var e=this;return dR(function*(){let r=yield e.validator(e.value);typeof r=="string"&&(e.errorMsg=r,r=!1),e.error=!r})()}submit(){var e=this;return dR(function*(){if(yield e.validate(),e.error){e.color="red",e.fire(),e.render();return}let r=e.value;e.value=r!==""?r:e.initial,e.done=!0,e.aborted=!1,e.error=!1,e.fire(),e.render(),e.out.write(`
|
|
110
110
|
`),e.close()})()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Od.down(dte(this.outputError,this.out.columns)-1)+pR(this.outputError,this.out.columns)),this.out.write(pR(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Tw.symbol(this.done,this.aborted),Ad.bold(this.msg),Tw.delimiter(this.done),!this.done||!this.done&&!this.placeholder?Ad[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
111
111
|
`).reduce((e,r,n)=>e+`
|
|
112
|
-
${n?" ":hte.pointerSmall} ${Ad.red().italic(r)}`,"")),this.out.write(fte.line+Od.to(0)+this.outputText+Od.save+this.outputError+Od.restore))}};yR.exports=Pw});var Rw=C((jwe,ER)=>{"use strict";var Fn=gt(),mte=Ze(),gte=mte.cursor,yte=
|
|
112
|
+
${n?" ":hte.pointerSmall} ${Ad.red().italic(r)}`,"")),this.out.write(fte.line+Od.to(0)+this.outputText+Od.save+this.outputError+Od.restore))}};yR.exports=Pw});var Rw=C((jwe,ER)=>{"use strict";var Fn=gt(),mte=Ze(),gte=mte.cursor,yte=ui(),Tc=dn(),wR=Tc.clear,Gi=Tc.figures,vR=Tc.style,Dte=Tc.wrap,wte=Tc.entriesToDisplay,Fw=class extends yte{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=wR("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
113
113
|
`),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
114
114
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
115
115
|
Instructions:
|
|
@@ -119,45 +119,45 @@ Instructions:
|
|
|
119
119
|
`:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?Fn.green(Gi.radioOn):Gi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?Fn.gray().underline(r.title):Fn.strikethrough().gray(r.title):(o=e===n?Fn.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
|
|
120
120
|
`+Dte(r.description,{margin:s.length,width:this.out.columns})))),s+o+Fn.gray(a||"")}paginateOptions(e){if(e.length===0)return Fn.red("No matches for this query.");let r=wte(this.cursor,e.length,this.optionsPerPage),n=r.startIndex,i=r.endIndex,s,o=[];for(let a=n;a<i;a++)a===n&&n>0?s=Gi.arrowUp:a===i-1&&i<e.length?s=Gi.arrowDown:s=" ",o.push(this.renderOption(this.cursor,e[a],a,s));return`
|
|
121
121
|
`+o.join(`
|
|
122
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Fn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Fn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(gte.hide),super.render();let e=[vR.symbol(this.done,this.aborted),Fn.bold(this.msg),vR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Fn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=wR(e,this.out.columns)}};ER.exports=Fw});var xR=C((Mwe,OR)=>{"use strict";function bR(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 vte(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){bR(s,n,i,o,a,"next",u)}function a(u){bR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ic=gt(),Ete=
|
|
122
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Fn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Fn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(gte.hide),super.render();let e=[vR.symbol(this.done,this.aborted),Fn.bold(this.msg),vR.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Fn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=wR(e,this.out.columns)}};ER.exports=Fw});var xR=C((Mwe,OR)=>{"use strict";function bR(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 vte(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var s=t.apply(e,r);function o(u){bR(s,n,i,o,a,"next",u)}function a(u){bR(s,n,i,o,a,"throw",u)}o(void 0)})}}var Ic=gt(),Ete=ui(),AR=Ze(),bte=AR.erase,_R=AR.cursor,Pc=dn(),kw=Pc.style,CR=Pc.clear,Nw=Pc.figures,_te=Pc.wrap,Cte=Pc.entriesToDisplay,SR=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Ste=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Ate=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},$w=class extends Ete{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Ate(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=kw.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=CR("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=SR(this.suggestions,e):this.value=this.fallback.value,this.fire()}complete(e){var r=this;return vte(function*(){let n=r.completing=r.suggest(r.input,r.choices),i=yield n;if(r.completing!==n)return;r.suggestions=i.map((o,a,u)=>({title:Ste(u,a),value:SR(u,a),description:o.description})),r.completing=!1;let s=Math.max(i.length-1,0);r.moveSelect(Math.min(s,r.select)),e&&e()})()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
123
123
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
124
124
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
125
125
|
`),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?Nw.arrowUp:i?Nw.arrowDown:" ",a=r?Ic.cyan().underline(e.title):e.title;return o=(r?Ic.cyan(Nw.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
|
|
126
126
|
`+_te(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Ic.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(_R.hide):this.out.write(CR(this.outputText,this.out.columns)),super.render();let e=Cte(this.select,this.choices.length,this.limit),r=e.startIndex,n=e.endIndex;if(this.outputText=[kw.symbol(this.done,this.aborted,this.exited),Ic.bold(this.msg),kw.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let i=this.suggestions.slice(r,n).map((s,o)=>this.renderOption(s,this.select===o+r,o===0&&r>0,o+r===n-1&&n<this.choices.length)).join(`
|
|
127
127
|
`);this.outputText+=`
|
|
128
|
-
`+(i||Ic.gray(this.fallback.title))}this.out.write(bte.line+_R.to(0)+this.outputText)}};OR.exports=$w});var FR=C((Uwe,PR)=>{"use strict";var
|
|
128
|
+
`+(i||Ic.gray(this.fallback.title))}this.out.write(bte.line+_R.to(0)+this.outputText)}};OR.exports=$w});var FR=C((Uwe,PR)=>{"use strict";var fi=gt(),Ote=Ze(),xte=Ote.cursor,Tte=Rw(),Bw=dn(),TR=Bw.clear,IR=Bw.style,Ra=Bw.figures,Lw=class extends Tte{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=TR("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
129
129
|
Instructions:
|
|
130
130
|
${Ra.arrowUp}/${Ra.arrowDown}: Highlight option
|
|
131
131
|
${Ra.arrowLeft}/${Ra.arrowRight}/[space]: Toggle selection
|
|
132
132
|
[a,b,c]/delete: Filter choices
|
|
133
133
|
enter/return: Complete answer
|
|
134
134
|
`:""}renderCurrentInput(){return`
|
|
135
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
136
|
-
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?
|
|
135
|
+
Filtered results for: ${this.inputValue?this.inputValue:fi.gray("Enter something to filter")}
|
|
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(Ra.radioOn):Ra.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=Lw});var jR=C((qwe,BR)=>{"use strict";var RR=gt(),Ite=ui(),$R=dn(),kR=$R.style,Pte=$R.clear,LR=Ze(),Fte=LR.erase,NR=LR.cursor,jw=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=jw});var UR=C((Hwe,MR)=>{"use strict";MR.exports={TextPrompt:AF(),SelectPrompt:IF(),TogglePrompt:$F(),DatePrompt:fR(),NumberPrompt:DR(),MultiselectPrompt:Rw(),AutocompletePrompt:xR(),AutocompleteMultiselectPrompt:FR(),ConfirmPrompt:jR()}});var HR=C(qR=>{"use strict";var _r=qR,Rte=UR(),Td=t=>t;function Rn(t,e,r={}){return new Promise((n,i)=>{let s=new Rte[t](e),o=r.onAbort||Td,a=r.onSubmit||Td,u=r.onExit||Td;s.on("state",e.onState||Td),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=C((zwe,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
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 Mw=HR(),Bte=["suggest","format","onState","validate","onRender","type"],XR=()=>{};function Wi(){return Uw.apply(this,arguments)}function Uw(){return Uw=WR(function*(t=[],{onSubmit:e=XR,onCancel:r=XR}={}){let n={},i=Wi._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 g=o;if(u=g.name,c=g.type,Mw[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=Wi._injected?jte(Wi._injected,o.initial):yield Mw[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}),Uw.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){Wi._injected=(Wi._injected||[]).concat(t)}function Ute(t){Wi._override=Object.assign({},t)}YR.exports=Object.assign(Wi,{prompt:Wi,prompts:Mw,inject:Mte,override:Ute})});var QR=C((Kwe,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 Id=C((Gwe,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=C((Wwe,r2)=>{"use strict";var qte=Id(),{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 qw=C((Xwe,i2)=>{"use strict";var Fc={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:Fc.arrowUp,arrowDown:Fc.arrowDown,arrowLeft:Fc.arrowLeft,arrowRight:Fc.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Kte=process.platform==="win32"?zte:Fc;i2.exports=Kte});var o2=C((Ywe,s2)=>{"use strict";var ka=gt(),Js=qw(),Hw=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=>Hw[t]||Hw.default,Rc=Object.freeze({aborted:ka.red(Js.cross),done:ka.green(Js.tick),exited:ka.yellow(Js.cross),default:ka.cyan("?")}),Wte=(t,e,r)=>e?Rc.aborted:r?Rc.exited:t?Rc.done:Rc.default,Xte=t=>ka.gray(t?Js.ellipsis:Js.pointerSmall),Yte=(t,e)=>ka.gray(t?e?Js.pointerSmall:"+":Js.line);s2.exports={styles:Hw,render:Gte,symbols:Rc,symbol:Wte,delimiter:Xte,item:Yte}});var u2=C((Jwe,a2)=>{"use strict";var Jte=Id();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=C((Zwe,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
|
-
`)}});var h2=C((Qwe,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=C((eve,d2)=>{"use strict";d2.exports={action:QR(),clear:n2(),style:o2(),strip:Id(),figures:qw(),lines:u2(),wrap:l2(),entriesToDisplay:h2()}});var
|
|
141
|
+
`)}});var h2=C((Qwe,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=C((eve,d2)=>{"use strict";d2.exports={action:QR(),clear:n2(),style:o2(),strip:Id(),figures:qw(),lines:u2(),wrap:l2(),entriesToDisplay:h2()}});var hi=C((tve,m2)=>{"use strict";var p2=require("readline"),{action:Zte}=pn(),Qte=require("events"),{beep:ere,cursor:tre}=Ze(),rre=gt(),Vw=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=Vw});var y2=C((rve,g2)=>{var Pd=gt(),nre=hi(),{erase:ire,cursor:kc}=Ze(),{style:zw,clear:Kw,lines:sre,figures:ore}=pn(),Gw=class extends nre{constructor(e={}){super(e),this.transform=zw.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=Kw("",this.out.columns),this.render()}set value(e){!e&&this.initial?(this.placeholder=!0,this.rendered=Pd.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(`
|
|
143
143
|
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(e){this.placeholder||(this.cursor=this.cursor+e,this.cursorOffset+=e)}_(e,r){let n=this.value.slice(0,this.cursor),i=this.value.slice(this.cursor);this.value=`${n}${e}${i}`,this.red=!1,this.cursor=this.placeholder?0:n.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let e=this.value.slice(0,this.cursor-1),r=this.value.slice(this.cursor);this.value=`${e}${r}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let e=this.value.slice(0,this.cursor),r=this.value.slice(this.cursor+1);this.value=`${e}${r}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(kc.down(sre(this.outputError,this.out.columns)-1)+Kw(this.outputError,this.out.columns)),this.out.write(Kw(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[zw.symbol(this.done,this.aborted),Pd.bold(this.msg),zw.delimiter(this.done),this.red?Pd.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
144
144
|
`).reduce((e,r,n)=>e+`
|
|
145
|
-
${n?" ":ore.pointerSmall} ${Pd.red().italic(r)}`,"")),this.out.write(ire.line+kc.to(0)+this.outputText+kc.save+this.outputError+kc.restore+kc.move(this.cursorOffset,0)))}};g2.exports=Gw});var E2=C((nve,v2)=>{"use strict";var
|
|
145
|
+
${n?" ":ore.pointerSmall} ${Pd.red().italic(r)}`,"")),this.out.write(ire.line+kc.to(0)+this.outputText+kc.save+this.outputError+kc.restore+kc.move(this.cursorOffset,0)))}};g2.exports=Gw});var E2=C((nve,v2)=>{"use strict";var di=gt(),are=hi(),{style:D2,clear:w2,figures:Fd,wrap:ure,entriesToDisplay:cre}=pn(),{cursor:lre}=Ze(),Ww=class extends are{constructor(e={}){super(e),this.msg=e.message,this.hint=e.hint||"- Use arrow-keys. Return to submit.",this.warn=e.warn||"- This option is disabled",this.cursor=e.initial||0,this.choices=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),value:r&&(r.value===void 0?n:r.value),description:r&&r.description,selected:r&&r.selected,disabled:r&&r.disabled})),this.optionsPerPage=e.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=w2("",this.out.columns),this.render()}moveCursor(e){this.cursor=e,this.value=this.choices[e].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
146
146
|
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
147
|
-
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(lre.hide):this.out.write(w2(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=cre(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[D2.symbol(this.done,this.aborted),
|
|
148
|
-
`;for(let n=e;n<r;n++){let i,s,o="",a=this.choices[n];n===e&&e>0?s=Fd.arrowUp:n===r-1&&r<this.choices.length?s=Fd.arrowDown:s=" ",a.disabled?(i=this.cursor===n?
|
|
149
|
-
`+ure(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${i}${
|
|
150
|
-
`}}this.out.write(this.outputText)}};v2.exports=Ww});var S2=C((ive,C2)=>{var Rd=gt(),fre=
|
|
147
|
+
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(e,r){if(e===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(lre.hide):this.out.write(w2(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=cre(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[D2.symbol(this.done,this.aborted),di.bold(this.msg),D2.delimiter(!1),this.done?this.selection.title:this.selection.disabled?di.yellow(this.warn):di.gray(this.hint)].join(" "),!this.done){this.outputText+=`
|
|
148
|
+
`;for(let n=e;n<r;n++){let i,s,o="",a=this.choices[n];n===e&&e>0?s=Fd.arrowUp:n===r-1&&r<this.choices.length?s=Fd.arrowDown:s=" ",a.disabled?(i=this.cursor===n?di.gray().underline(a.title):di.strikethrough().gray(a.title),s=(this.cursor===n?di.bold().gray(Fd.pointer)+" ":" ")+s):(i=this.cursor===n?di.cyan().underline(a.title):a.title,s=(this.cursor===n?di.cyan(Fd.pointer)+" ":" ")+s,a.description&&this.cursor===n&&(o=` - ${a.description}`,(s.length+i.length+o.length>=this.out.columns||a.description.split(/\r?\n/).length>1)&&(o=`
|
|
149
|
+
`+ure(a.description,{margin:3,width:this.out.columns})))),this.outputText+=`${s} ${i}${di.gray(o)}
|
|
150
|
+
`}}this.out.write(this.outputText)}};v2.exports=Ww});var S2=C((ive,C2)=>{var Rd=gt(),fre=hi(),{style:b2,clear:hre}=pn(),{cursor:_2,erase:dre}=Ze(),Xw=class extends fre{constructor(e={}){super(e),this.msg=e.message,this.value=!!e.initial,this.active=e.active||"on",this.inactive=e.inactive||"off",this.initialValue=this.value,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(`
|
|
151
151
|
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
152
|
-
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(_2.hide):this.out.write(hre(this.outputText,this.out.columns)),super.render(),this.outputText=[b2.symbol(this.done,this.aborted),Rd.bold(this.msg),b2.delimiter(this.done),this.value?this.inactive:Rd.cyan().underline(this.inactive),Rd.gray("/"),this.value?Rd.cyan().underline(this.active):this.active].join(" "),this.out.write(dre.line+_2.to(0)+this.outputText))}};C2.exports=Xw});var kn=C((sve,A2)=>{"use strict";var Yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};A2.exports=Yw});var x2=C((ove,O2)=>{"use strict";var pre=kn(),Jw=class extends pre{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};O2.exports=Jw});var I2=C((ave,T2)=>{"use strict";var mre=kn(),gre=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Zw=class extends mre{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+gre(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};T2.exports=Zw});var F2=C((uve,P2)=>{"use strict";var yre=kn(),Qw=class extends yre{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};P2.exports=Qw});var k2=C((cve,R2)=>{"use strict";var Dre=kn(),ev=class extends Dre{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};R2.exports=ev});var $2=C((lve,N2)=>{"use strict";var wre=kn(),tv=class extends wre{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};N2.exports=tv});var B2=C((fve,L2)=>{"use strict";var vre=kn(),rv=class extends vre{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};L2.exports=rv});var M2=C((hve,j2)=>{"use strict";var Ere=kn(),nv=class extends Ere{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};j2.exports=nv});var q2=C((dve,U2)=>{"use strict";var bre=kn(),iv=class extends bre{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};U2.exports=iv});var V2=C((pve,H2)=>{"use strict";H2.exports={DatePart:kn(),Meridiem:x2(),Day:I2(),Hours:F2(),Milliseconds:k2(),Minutes:$2(),Month:B2(),Seconds:M2(),Year:q2()}});var J2=C((mve,Y2)=>{"use strict";var sv=gt(),_re=
|
|
152
|
+
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(e,r){if(e===" ")this.value=!this.value;else if(e==="1")this.value=!0;else if(e==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(_2.hide):this.out.write(hre(this.outputText,this.out.columns)),super.render(),this.outputText=[b2.symbol(this.done,this.aborted),Rd.bold(this.msg),b2.delimiter(this.done),this.value?this.inactive:Rd.cyan().underline(this.inactive),Rd.gray("/"),this.value?Rd.cyan().underline(this.active):this.active].join(" "),this.out.write(dre.line+_2.to(0)+this.outputText))}};C2.exports=Xw});var kn=C((sve,A2)=>{"use strict";var Yw=class t{constructor({token:e,date:r,parts:n,locales:i}){this.token=e,this.date=r||new Date,this.parts=n||[this],this.locales=i||{}}up(){}down(){}next(){let e=this.parts.indexOf(this);return this.parts.find((r,n)=>n>e&&r instanceof t)}setTo(e){}prev(){let e=[].concat(this.parts).reverse(),r=e.indexOf(this);return e.find((n,i)=>i>r&&n instanceof t)}toString(){return String(this.date)}};A2.exports=Yw});var x2=C((ove,O2)=>{"use strict";var pre=kn(),Jw=class extends pre{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}};O2.exports=Jw});var I2=C((ave,T2)=>{"use strict";var mre=kn(),gre=t=>(t=t%10,t===1?"st":t===2?"nd":t===3?"rd":"th"),Zw=class extends mre{constructor(e={}){super(e)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(e){this.date.setDate(parseInt(e.substr(-2)))}toString(){let e=this.date.getDate(),r=this.date.getDay();return this.token==="DD"?String(e).padStart(2,"0"):this.token==="Do"?e+gre(e):this.token==="d"?r+1:this.token==="ddd"?this.locales.weekdaysShort[r]:this.token==="dddd"?this.locales.weekdays[r]:e}};T2.exports=Zw});var F2=C((uve,P2)=>{"use strict";var yre=kn(),Qw=class extends yre{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}};P2.exports=Qw});var k2=C((cve,R2)=>{"use strict";var Dre=kn(),ev=class extends Dre{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};R2.exports=ev});var $2=C((lve,N2)=>{"use strict";var wre=kn(),tv=class extends wre{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}};N2.exports=tv});var B2=C((fve,L2)=>{"use strict";var vre=kn(),rv=class extends vre{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),r=this.token.length;return r===2?String(e+1).padStart(2,"0"):r===3?this.locales.monthsShort[e]:r===4?this.locales.months[e]:String(e+1)}};L2.exports=rv});var M2=C((hve,j2)=>{"use strict";var Ere=kn(),nv=class extends Ere{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}};j2.exports=nv});var q2=C((dve,U2)=>{"use strict";var bre=kn(),iv=class extends bre{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}};U2.exports=iv});var V2=C((pve,H2)=>{"use strict";H2.exports={DatePart:kn(),Meridiem:x2(),Day:I2(),Hours:F2(),Milliseconds:k2(),Minutes:$2(),Month:B2(),Seconds:M2(),Year:q2()}});var J2=C((mve,Y2)=>{"use strict";var sv=gt(),_re=hi(),{style:z2,clear:K2,figures:Cre}=pn(),{erase:Sre,cursor:G2}=Ze(),{DatePart:W2,Meridiem:Are,Day:Ore,Hours:xre,Milliseconds:Tre,Minutes:Ire,Month:Pre,Seconds:Fre,Year:Rre}=V2(),kre=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,X2={1:({token:t})=>t.replace(/\\(.)/g,"$1"),2:t=>new Ore(t),3:t=>new Pre(t),4:t=>new Rre(t),5:t=>new Are(t),6:t=>new xre(t),7:t=>new Ire(t),8:t=>new Fre(t),9:t=>new Tre(t)},Nre={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")},ov=class extends _re{constructor(e={}){super(e),this.msg=e.message,this.cursor=0,this.typed="",this.locales=Object.assign(Nre,e.locales),this._date=e.initial||new Date,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.mask=e.mask||"YYYY-MM-DD HH:mm:ss",this.clear=K2("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(e){e&&this._date.setTime(e.getTime())}set mask(e){let r;for(this.parts=[];r=kre.exec(e);){let i=r.shift(),s=r.findIndex(o=>o!=null);this.parts.push(s in X2?X2[s]({token:r[s]||i,date:this.date,parts:this.parts,locales:this.locales}):r[s]||i)}let n=this.parts.reduce((i,s)=>(typeof s=="string"&&typeof i[i.length-1]=="string"?i[i.length-1]+=s:i.push(s),i),[]);this.parts.splice(0),this.parts.push(...n),this.reset()}moveCursor(e){this.typed="",this.cursor=e,this.fire()}reset(){this.moveCursor(this.parts.findIndex(e=>e instanceof W2)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
153
153
|
`),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(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
154
154
|
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let e=this.parts[this.cursor].prev();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}right(){let e=this.parts[this.cursor].next();if(e==null)return this.bell();this.moveCursor(this.parts.indexOf(e)),this.render()}next(){let e=this.parts[this.cursor].next();this.moveCursor(e?this.parts.indexOf(e):this.parts.findIndex(r=>r instanceof W2)),this.render()}_(e){/\d/.test(e)&&(this.typed+=e,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(G2.hide):this.out.write(K2(this.outputText,this.out.columns)),super.render(),this.outputText=[z2.symbol(this.done,this.aborted),sv.bold(this.msg),z2.delimiter(!1),this.parts.reduce((e,r,n)=>e.concat(n===this.cursor&&!this.done?sv.cyan().underline(r.toString()):r),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
155
155
|
`).reduce((e,r,n)=>e+`
|
|
156
|
-
${n?" ":Cre.pointerSmall} ${sv.red().italic(r)}`,"")),this.out.write(Sre.line+G2.to(0)+this.outputText))}};Y2.exports=ov});var tk=C((gve,ek)=>{var kd=gt(),$re=
|
|
156
|
+
${n?" ":Cre.pointerSmall} ${sv.red().italic(r)}`,"")),this.out.write(Sre.line+G2.to(0)+this.outputText))}};Y2.exports=ov});var tk=C((gve,ek)=>{var kd=gt(),$re=hi(),{cursor:Nd,erase:Lre}=Ze(),{style:av,figures:Bre,clear:Z2,lines:jre}=pn(),Mre=/[0-9]/,uv=t=>t!==void 0,Q2=(t,e)=>{let r=Math.pow(10,e);return Math.round(t*r)/r},cv=class extends $re{constructor(e={}){super(e),this.transform=av.render(e.style),this.msg=e.message,this.initial=uv(e.initial)?e.initial:"",this.float=!!e.float,this.round=e.round||2,this.inc=e.increment||1,this.min=uv(e.min)?e.min:-1/0,this.max=uv(e.max)?e.max:1/0,this.errorMsg=e.error||"Please Enter A Valid Value",this.validator=e.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(e){!e&&e!==0?(this.placeholder=!0,this.rendered=kd.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${Q2(e,this.round)}`),this._value=Q2(e,this.round)),this.fire()}get value(){return this._value}parse(e){return this.float?parseFloat(e):parseInt(e)}valid(e){return e==="-"||e==="."&&this.float||Mre.test(e)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let e=this.value;this.value=e!==""?e:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
157
157
|
`),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(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let e=this.value;this.value=e!==""?e:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
|
|
158
158
|
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let e=this.value.toString();if(e.length===0)return this.bell();this.value=this.parse(e=e.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(e,r){if(!this.valid(e))return this.bell();let n=Date.now();if(n-this.lastHit>1e3&&(this.typed=""),this.typed+=e,this.lastHit=n,this.color="cyan",e===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(Nd.down(jre(this.outputError,this.out.columns)-1)+Z2(this.outputError,this.out.columns)),this.out.write(Z2(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[av.symbol(this.done,this.aborted),kd.bold(this.msg),av.delimiter(this.done),!this.done||!this.done&&!this.placeholder?kd[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
159
159
|
`).reduce((e,r,n)=>e+`
|
|
160
|
-
${n?" ":Bre.pointerSmall} ${kd.red().italic(r)}`,"")),this.out.write(Lre.line+Nd.to(0)+this.outputText+Nd.save+this.outputError+Nd.restore))}};ek.exports=cv});var fv=C((yve,ik)=>{"use strict";var Nn=gt(),{cursor:Ure}=Ze(),qre=
|
|
160
|
+
${n?" ":Bre.pointerSmall} ${kd.red().italic(r)}`,"")),this.out.write(Lre.line+Nd.to(0)+this.outputText+Nd.save+this.outputError+Nd.restore))}};ek.exports=cv});var fv=C((yve,ik)=>{"use strict";var Nn=gt(),{cursor:Ure}=Ze(),qre=hi(),{clear:rk,figures:Xi,style:nk,wrap:Hre,entriesToDisplay:Vre}=pn(),lv=class extends qre{constructor(e={}){super(e),this.msg=e.message,this.cursor=e.cursor||0,this.scrollIndex=e.cursor||0,this.hint=e.hint||"",this.warn=e.warn||"- This option is disabled -",this.minSelected=e.min,this.showMinError=!1,this.maxChoices=e.max,this.instructions=e.instructions,this.optionsPerPage=e.optionsPerPage||10,this.value=e.choices.map((r,n)=>(typeof r=="string"&&(r={title:r,value:n}),{title:r&&(r.title||r.value||r),description:r&&r.description,value:r&&(r.value===void 0?n:r.value),selected:r&&r.selected,disabled:r&&r.disabled})),this.clear=rk("",this.out.columns),e.overrideRender||this.render()}reset(){this.value.map(e=>!e.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(e=>e.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
|
|
161
161
|
`),this.close()}submit(){let e=this.value.filter(r=>r.selected);this.minSelected&&e.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
162
162
|
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){let e=this.value[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let e=!this.value[this.cursor].selected;this.value.filter(r=>!r.disabled).forEach(r=>r.selected=e),this.render()}_(e,r){if(e===" ")this.handleSpaceToggle();else if(e==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
163
163
|
Instructions:
|
|
@@ -167,21 +167,21 @@ Instructions:
|
|
|
167
167
|
`:"")+" enter/return: Complete answer":""}renderOption(e,r,n,i){let s=(r.selected?Nn.green(Xi.radioOn):Xi.radioOff)+" "+i+" ",o,a;return r.disabled?o=e===n?Nn.gray().underline(r.title):Nn.strikethrough().gray(r.title):(o=e===n?Nn.cyan().underline(r.title):r.title,e===n&&r.description&&(a=` - ${r.description}`,(s.length+o.length+a.length>=this.out.columns||r.description.split(/\r?\n/).length>1)&&(a=`
|
|
168
168
|
`+Hre(r.description,{margin:s.length,width:this.out.columns})))),s+o+Nn.gray(a||"")}paginateOptions(e){if(e.length===0)return Nn.red("No matches for this query.");let{startIndex:r,endIndex:n}=Vre(this.cursor,e.length,this.optionsPerPage),i,s=[];for(let o=r;o<n;o++)o===r&&r>0?i=Xi.arrowUp:o===n-1&&n<e.length?i=Xi.arrowDown:i=" ",s.push(this.renderOption(this.cursor,e[o],o,i));return`
|
|
169
169
|
`+s.join(`
|
|
170
|
-
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Nn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ure.hide),super.render();let e=[nk.symbol(this.done,this.aborted),Nn.bold(this.msg),nk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=rk(e,this.out.columns)}};ik.exports=lv});var ck=C((Dve,uk)=>{"use strict";var Nc=gt(),zre=
|
|
170
|
+
`)}renderOptions(e){return this.done?"":this.paginateOptions(e)}renderDoneOrInstructions(){if(this.done)return this.value.filter(r=>r.selected).map(r=>r.title).join(", ");let e=[Nn.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&e.push(Nn.yellow(this.warn)),e.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(Ure.hide),super.render();let e=[nk.symbol(this.done,this.aborted),Nn.bold(this.msg),nk.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(e+=Nn.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),e+=this.renderOptions(this.value),this.out.write(this.clear+e),this.clear=rk(e,this.out.columns)}};ik.exports=lv});var ck=C((Dve,uk)=>{"use strict";var Nc=gt(),zre=hi(),{erase:Kre,cursor:sk}=Ze(),{style:hv,clear:ok,figures:dv,wrap:Gre,entriesToDisplay:Wre}=pn(),ak=(t,e)=>t[e]&&(t[e].value||t[e].title||t[e]),Xre=(t,e)=>t[e]&&(t[e].title||t[e].value||t[e]),Yre=(t,e)=>{let r=t.findIndex(n=>n.value===e||n.title===e);return r>-1?r:void 0},pv=class extends zre{constructor(e={}){super(e),this.msg=e.message,this.suggest=e.suggest,this.choices=e.choices,this.initial=typeof e.initial=="number"?e.initial:Yre(e.choices,e.initial),this.select=this.initial||e.cursor||0,this.i18n={noMatches:e.noMatches||"no matches found"},this.fallback=e.fallback||this.initial,this.clearFirst=e.clearFirst||!1,this.suggestions=[],this.input="",this.limit=e.limit||10,this.cursor=0,this.transform=hv.render(e.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=ok("",this.out.columns),this.complete(this.render),this.render()}set fallback(e){this._fb=Number.isSafeInteger(parseInt(e))?parseInt(e):e}get fallback(){let e;return typeof this._fb=="number"?e=this.choices[this._fb]:typeof this._fb=="string"&&(e={title:this._fb}),e||this._fb||{title:this.i18n.noMatches}}moveSelect(e){this.select=e,this.suggestions.length>0?this.value=ak(this.suggestions,e):this.value=this.fallback.value,this.fire()}async complete(e){let r=this.completing=this.suggest(this.input,this.choices),n=await r;if(this.completing!==r)return;this.suggestions=n.map((s,o,a)=>({title:Xre(a,o),value:ak(a,o),description:s.description})),this.completing=!1;let i=Math.max(n.length-1,0);this.moveSelect(Math.min(i,this.select)),e&&e()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
|
|
171
171
|
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
172
172
|
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
|
|
173
173
|
`),this.close()}_(e,r){let n=this.input.slice(0,this.cursor),i=this.input.slice(this.cursor);this.input=`${n}${e}${i}`,this.cursor=n.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let e=this.input.slice(0,this.cursor-1),r=this.input.slice(this.cursor);this.input=`${e}${r}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let e=this.input.slice(0,this.cursor),r=this.input.slice(this.cursor+1);this.input=`${e}${r}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(e,r,n,i){let s,o=n?dv.arrowUp:i?dv.arrowDown:" ",a=r?Nc.cyan().underline(e.title):e.title;return o=(r?Nc.cyan(dv.pointer)+" ":" ")+o,e.description&&(s=` - ${e.description}`,(o.length+a.length+s.length>=this.out.columns||e.description.split(/\r?\n/).length>1)&&(s=`
|
|
174
174
|
`+Gre(e.description,{margin:3,width:this.out.columns}))),o+" "+a+Nc.gray(s||"")}render(){if(this.closed)return;this.firstRender?this.out.write(sk.hide):this.out.write(ok(this.outputText,this.out.columns)),super.render();let{startIndex:e,endIndex:r}=Wre(this.select,this.choices.length,this.limit);if(this.outputText=[hv.symbol(this.done,this.aborted,this.exited),Nc.bold(this.msg),hv.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let n=this.suggestions.slice(e,r).map((i,s)=>this.renderOption(i,this.select===s+e,s===0&&e>0,s+e===r-1&&r<this.choices.length)).join(`
|
|
175
175
|
`);this.outputText+=`
|
|
176
|
-
`+(n||Nc.gray(this.fallback.title))}this.out.write(Kre.line+sk.to(0)+this.outputText)}};uk.exports=pv});var dk=C((wve,hk)=>{"use strict";var
|
|
176
|
+
`+(n||Nc.gray(this.fallback.title))}this.out.write(Kre.line+sk.to(0)+this.outputText)}};uk.exports=pv});var dk=C((wve,hk)=>{"use strict";var pi=gt(),{cursor:Jre}=Ze(),Zre=fv(),{clear:lk,style:fk,figures:Na}=pn(),mv=class extends Zre{constructor(e={}){e.overrideRender=!0,super(e),this.inputValue="",this.clear=lk("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(e=>e.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){let e=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(n=>this.inputValue?!!(typeof n.title=="string"&&n.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof n.value=="string"&&n.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);let r=this.filteredOptions.findIndex(n=>n===e);this.cursor=r<0?0:r,this.render()}handleSpaceToggle(){let e=this.filteredOptions[this.cursor];if(e.selected)e.selected=!1,this.render();else{if(e.disabled||this.value.filter(r=>r.selected).length>=this.maxChoices)return this.bell();e.selected=!0,this.render()}}handleInputChange(e){this.inputValue=this.inputValue+e,this.updateFilteredOptions()}_(e,r){e===" "?this.handleSpaceToggle():this.handleInputChange(e)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
177
177
|
Instructions:
|
|
178
178
|
${Na.arrowUp}/${Na.arrowDown}: Highlight option
|
|
179
179
|
${Na.arrowLeft}/${Na.arrowRight}/[space]: Toggle selection
|
|
180
180
|
[a,b,c]/delete: Filter choices
|
|
181
181
|
enter/return: Complete answer
|
|
182
182
|
`:""}renderCurrentInput(){return`
|
|
183
|
-
Filtered results for: ${this.inputValue?this.inputValue:
|
|
184
|
-
`}renderOption(e,r,n){let i;return r.disabled?i=e===n?
|
|
183
|
+
Filtered results for: ${this.inputValue?this.inputValue:pi.gray("Enter something to filter")}
|
|
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(Na.radioOn):Na.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=mv});var Dk=C((vve,yk)=>{var pk=gt(),Qre=hi(),{style:mk,clear:ene}=pn(),{erase:tne,cursor:gk}=Ze(),gv=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
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=gv});var vk=C((Eve,wk)=>{"use strict";wk.exports={TextPrompt:y2(),SelectPrompt:E2(),TogglePrompt:S2(),DatePrompt:J2(),NumberPrompt:tk(),MultiselectPrompt:fv(),AutocompletePrompt:ck(),AutocompleteMultiselectPrompt:dk(),ConfirmPrompt:Dk()}});var bk=C(Ek=>{"use strict";var Cr=Ek,rne=vk(),$d=t=>t;function $n(t,e,r={}){return new Promise((n,i)=>{let s=new rne[t](e),o=r.onAbort||$d,a=r.onSubmit||$d,u=r.onExit||$d;s.on("state",e.onState||$d),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=C((_ve,Ck)=>{"use strict";var yv=bk(),ine=["suggest","format","onState","validate","onRender","type"],_k=()=>{};async function Yi(t=[],{onSubmit:e=_k,onCancel:r=_k}={}){let n={},i=Yi._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,yv[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=Yi._injected?sne(Yi._injected,o.initial):await yv[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){Yi._injected=(Yi._injected||[]).concat(t)}function ane(t){Yi._override=Object.assign({},t)}Ck.exports=Object.assign(Yi,{prompt:Yi,prompts:yv,inject:one,override:ane})});var Ld=C((Cve,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 Cc=C(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.logSuccess=Sr.logPrompt=Sr.logger=Sr.output=void 0;var Dv=(he(),ce(fe)),Zs=uw(),Qs=Dv.__importDefault(Sa()),cne=ZP(),Ok={colors:Qs.default,stream:process.argv.includes("--json")?process.stderr:process.stdout};Sr.output=(0,cne.isInteractive)()?new Zs.TTYOutputStrategy(Ok):new Zs.StreamOutputStrategy(Ok);Sr.logger=(0,Zs.createDefaultLogger)({output:Sr.output,formatterOptions:{titleize:!1,tags:new Map([[Zs.LOGGER_LEVELS.DEBUG,Qs.default.log.DEBUG("[debug]")],[Zs.LOGGER_LEVELS.INFO,Qs.default.log.INFO("[info]")],[Zs.LOGGER_LEVELS.WARN,Qs.default.log.WARN("[warn]")],[Zs.LOGGER_LEVELS.ERROR,Qs.default.log.ERROR("[error]")]])}});async function lne(t,e){let{wordWrap:r}=await Promise.resolve().then(()=>Dv.__importStar(uw())),{prompt:n}=await Promise.resolve().then(()=>Dv.__importStar(Ld()));return Sr.logger.log({msg:`${Qs.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(`${Qs.default.success("[success]")} ${t}`)}Sr.logSuccess=fne});var Bd=C($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});$a.resolveNode=$a.requireTS=void 0;var hne=require("fs"),dne=Ca(),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};$a.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}}$a.resolveNode=gne});var jd=C(wv=>{(function(){wv.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
187
|
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(wv)});var Ln=C((xk,Ji)=>{(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},Ji.exports.assign=t,Ji.exports.isFunction=i,Ji.exports.isObject=s,Ji.exports.isArray=r,Ji.exports.isEmpty=n,Ji.exports.isPlainObject=o,Ji.exports.getValue=e}).call(xk)});var vv=C((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=C((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=C((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=C((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 At=C((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 Ev=C((qk,Hk)=>{(function(){var t,e,r;t=At(),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 Md=C((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 Ud=C((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=At(),e=Ev(),n=Md(),Gk.exports=r=(function(h){c(d,h);function d(f,p,g){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,g!=null&&this.attribute(g),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,g,v;g=Object.create(this),g.isRoot&&(g.documentObject=null),g.attribs={},v=this.attribs;for(p in v)l.call(v,p)&&(f=v[p],g.attribs[p]=f.clone());return g.children=[],this.children.forEach(function(E){var A;return A=E.clone(),A.parent=g,g.children.push(A)}),g},d.prototype.attribute=function(f,p){var g,v;if(f!=null&&(f=s(f)),a(f))for(g in f)l.call(f,g)&&(v=f[g],this.attribute(g,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,g,v;if(f==null)throw new Error("Missing attribute name. "+this.debugInfo());if(f=s(f),Array.isArray(f))for(g=0,v=f.length;g<v;g++)p=f[g],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,g){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,g){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,g,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=g=0,v=this.attribs.length-1;0<=v?g<=v:g>=v;p=0<=v?++g:--g)if(!this.attribs[p].isEqualNode(f.attribs[p]))return!1;return!0},d})(i)}).call(Kk)});var $c=C((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 qd=C((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=At(),r=$c(),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 Hd=C((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=At(),e=$c(),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 Vd=C((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=At(),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 zd=C((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=At(),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 Kd=C((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=At(),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 Gd=C((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=At(),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 Wd=C((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=At(),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 Xd=C((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=At(),e=zd(),n=Kd(),r=Gd(),i=Wd(),o=Md(),fN.exports=s=(function(h){c(d,h);function d(f,p,g){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,g=D.sysID),g==null&&(w=[p,g],g=w[0],p=w[1]),p!=null&&(this.pubID=this.stringify.dtdPubID(p)),g!=null&&(this.sysID=this.stringify.dtdSysID(g))}return Object.defineProperty(d.prototype,"entities",{get:function(){var f,p,g,v,E;for(v={},E=this.children,p=0,g=E.length;p<g;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,g,v,E;for(v={},E=this.children,p=0,g=E.length;p<g;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 g;return g=new r(this,f,p),this.children.push(g),this},d.prototype.attList=function(f,p,g,v,E){var A;return A=new e(this,f,p,g,v,E),this.children.push(A),this},d.prototype.entity=function(f,p){var g;return g=new n(this,!1,f,p),this.children.push(g),this},d.prototype.pEntity=function(f,p){var g;return g=new n(this,!0,f,p),this.children.push(g),this},d.prototype.notation=function(f,p){var g;return g=new i(this,f,p),this.children.push(g),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,g,v,E){return this.attList(f,p,g,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 Yd=C((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=At(),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 Jd=C((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=At(),e=$c(),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 Zd=C((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=At(),e=$c(),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 bv=C((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=At(),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=C((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=C((_N,CN)=>{(function(){CN.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(_N)});var kr=C((AN,ON)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,p,g,v,E,A,m={}.hasOwnProperty;A=Ln(),E=A.isObject,v=A.isFunction,g=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=Ud(),r=qd(),n=Hd(),i=Vd(),s=Xd(),d=Yd(),f=Jd(),h=Zd(),o=bv(),e=At(),l=bN(),u=Md(),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,S,F,_,k;if(this.nodeType===e.Element||this.nodeType===e.DocumentFragment){for(k="",_=this.children,S=0,F=_.length;S<F;S++)w=_[S],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 S,F,_,k,R;for(this.parent=w,w&&(this.options=w.options,this.stringify=w.stringify),k=this.children,R=[],F=0,_=k.length;F<_;F++)S=k[F],R.push(S.setParent(this));return R},D.prototype.element=function(w,S,F){var _,k,R,I,B,j,K,L,b,T,P;if(j=null,S===null&&F==null&&(b=[{},null],S=b[0],F=b[1]),S==null&&(S={}),S=p(S),E(S)||(T=[S,F],F=T[0],S=T[1]),w!=null&&(w=p(w)),Array.isArray(w))for(R=0,K=w.length;R<K;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)&&g(P))j=this.dummy();else if(E(P)&&g(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]=k,j=this.element(_);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,S,F);if(j==null)throw new Error("Could not create any elements with: "+w+". "+this.debugInfo());return j},D.prototype.insertBefore=function(w,S,F){var _,k,R,I,B;if(w?.type)return R=w,I=S,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),_=this.parent.element(w,S,F),Array.prototype.push.apply(this.parent.children,B),_},D.prototype.insertAfter=function(w,S,F){var _,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),_=this.parent.element(w,S,F),Array.prototype.push.apply(this.parent.children,R),_},D.prototype.remove=function(){var w,S;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(S=[])),this.parent},D.prototype.node=function(w,S,F){var _,k;return w!=null&&(w=p(w)),S||(S={}),S=p(S),E(S)||(k=[S,F],F=k[0],S=k[1]),_=new a(this,w,S),F!=null&&_.text(F),this.children.push(_),_},D.prototype.text=function(w){var S;return E(w)&&this.element(w),S=new f(this,w),this.children.push(S),this},D.prototype.cdata=function(w){var S;return S=new r(this,w),this.children.push(S),this},D.prototype.comment=function(w){var S;return S=new n(this,w),this.children.push(S),this},D.prototype.commentBefore=function(w){var S,F,_;return F=this.parent.children.indexOf(this),_=this.parent.children.splice(F),S=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,_),this},D.prototype.commentAfter=function(w){var S,F,_;return F=this.parent.children.indexOf(this),_=this.parent.children.splice(F+1),S=this.parent.comment(w),Array.prototype.push.apply(this.parent.children,_),this},D.prototype.raw=function(w){var S;return S=new d(this,w),this.children.push(S),this},D.prototype.dummy=function(){var w;return w=new o(this),w},D.prototype.instruction=function(w,S){var F,_,k,R,I;if(w!=null&&(w=p(w)),S!=null&&(S=p(S)),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)&&(_=w[F],this.instruction(F,_));else v(S)&&(S=S.apply()),k=new h(this,w,S),this.children.push(k);return this},D.prototype.instructionBefore=function(w,S){var F,_,k;return _=this.parent.children.indexOf(this),k=this.parent.children.splice(_),F=this.parent.instruction(w,S),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.instructionAfter=function(w,S){var F,_,k;return _=this.parent.children.indexOf(this),k=this.parent.children.splice(_+1),F=this.parent.instruction(w,S),Array.prototype.push.apply(this.parent.children,k),this},D.prototype.declaration=function(w,S,F){var _,k;return _=this.document(),k=new i(_,w,S,F),_.children.length===0?_.children.unshift(k):_.children[0].type===e.Declaration?_.children[0]=k:_.children.unshift(k),_.root()||_},D.prototype.dtd=function(w,S){var F,_,k,R,I,B,j,K,L,b;for(_=this.document(),k=new s(_,w,S),L=_.children,R=I=0,j=L.length;I<j;R=++I)if(F=L[R],F.type===e.DocType)return _.children[R]=k,k;for(b=_.children,R=B=0,K=b.length;B<K;R=++B)if(F=b[R],F.isRoot)return _.children.splice(R,0,k),k;return _.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 S;return S=w.root().clone(),S.parent=this,S.isRoot=!1,this.children.push(S),this},D.prototype.debugInfo=function(w){var S,F;return w=w||this.name,w==null&&!((S=this.parent)!=null&&S.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,S,F){return this.element(w,S,F)},D.prototype.nod=function(w,S,F){return this.node(w,S,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,S){return this.instruction(w,S)},D.prototype.doc=function(){return this.document()},D.prototype.dec=function(w,S,F){return this.declaration(w,S,F)},D.prototype.e=function(w,S,F){return this.element(w,S,F)},D.prototype.n=function(w,S,F){return this.node(w,S,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,S){return this.instruction(w,S)},D.prototype.u=function(){return this.up()},D.prototype.importXMLBuilder=function(w){return this.importDocument(w)},D.prototype.replaceChild=function(w,S){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,S){return!0},D.prototype.hasAttributes=function(){return this.attribs.length!==0},D.prototype.compareDocumentPosition=function(w){var S,F;return S=this,S===w?0:this.document()!==w.document()?(F=t.Disconnected|t.ImplementationSpecific,Math.random()<.5?F|=t.Preceding:F|=t.Following,F):S.isAncestor(w)?t.Contains|t.Preceding:S.isDescendant(w)?t.Contains|t.Following:S.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 S,F,_;if(w.nodeType!==this.nodeType||w.children.length!==this.children.length)return!1;for(S=F=0,_=this.children.length-1;0<=_?F<=_:F>=_;S=0<=_?++F:--F)if(!this.children[S].isEqualNode(w.children[S]))return!1;return!0},D.prototype.getFeature=function(w,S){throw new Error("This DOM method is not implemented."+this.debugInfo())},D.prototype.setUserData=function(w,S,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 S,F,_,k,R;for(R=this.children,_=0,k=R.length;_<k;_++)if(S=R[_],w===S||(F=S.isDescendant(w),F))return!0;return!1},D.prototype.isAncestor=function(w){return w.isDescendant(this)},D.prototype.isPreceding=function(w){var S,F;return S=this.treePosition(w),F=this.treePosition(this),S===-1||F===-1?!1:S<F},D.prototype.isFollowing=function(w){var S,F;return S=this.treePosition(w),F=this.treePosition(this),S===-1||F===-1?!1:S>F},D.prototype.treePosition=function(w){var S,F;return F=0,S=!1,this.foreachTreeNode(this.document(),function(_){if(F++,!S&&_===w)return S=!0}),S?F:-1},D.prototype.foreachTreeNode=function(w,S){var F,_,k,R,I;for(w||(w=this.document()),R=w.children,_=0,k=R.length;_<k;_++){if(F=R[_],I=S(F))return I;if(I=this.foreachTreeNode(F,S),I)return I}},D})()}).call(AN)});var _v=C((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,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},n.prototype.attEscape=function(i){var s;return this.options.noValidation?i:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,i.replace(s,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},n})()}).call(xN)});var Lc=C((IN,PN)=>{(function(){PN.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(IN)});var Cv=C((FN,RN)=>{(function(){var t,e,r,n,i,s,o,a,u,c,l,h,d,f,p,g,v,E={}.hasOwnProperty;v=Ln().assign,t=At(),u=Vd(),c=Xd(),r=qd(),n=Hd(),h=Ud(),f=Yd(),p=Jd(),d=Zd(),l=bv(),i=zd(),s=Gd(),o=Kd(),a=Wd(),e=Lc(),RN.exports=g=(function(){function A(m){var D,w,S;m||(m={}),this.options=m,w=m.writer||{};for(D in w)E.call(w,D)&&(S=w[D],this["_"+D]=this[D],this[D]=S)}return A.prototype.filterOptions=function(m){var D,w,S,F,_,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=(S=m.newline)!=null?S:`
|
|
@@ -194,16 +194,16 @@ Actual: `+x.attribValue);else if(N==="xmlns"&&x.attribValue!==f)b(x,"xmlns: pref
|
|
|
194
194
|
Actual: `+x.attribValue);else{var ne=x.tag,z=x.tags[x.tags.length-1]||x;ne.ns===z.ns&&(ne.ns=Object.create(z.ns)),ne.ns[N]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,I(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function 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&&(b(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 z=0,oe=x.attribList.length;z<oe;z++){var we=x.attribList[z],Pe=we[0],Ve=we[1],bt=P(Pe,!0),pr=bt.prefix,dq=bt.local,Gb=pr===""?"":V.ns[pr]||"",Cm={name:Pe,value:Ve,prefix:pr,local:dq,uri:Gb};pr&&pr!=="xmlns"&&!Gb&&(b(x,"Unbound namespace prefix: "+JSON.stringify(pr)),Cm.uri=pr),x.tag.attributes[Pe]=Cm,I(x,"onattribute",Cm)}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=_.SCRIPT:x.state=_.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function M(x){if(!x.tagName){b(x,"Weird empty close tag."),x.textNode+="</>",x.state=_.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=_.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)b(x,"Unexpected close tag");else break}if(O<0){b(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=_.TEXT;return}x.tagName=V;for(var z=x.tags.length;z-- >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=_.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?(b(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(N))}function U(x,O){O==="<"?(x.state=_.OPEN_WAKA,x.startTagPosition=x.position):m(O)||(b(x,"Non-whitespace before first tag."),x.textNode=O,x.state=_.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 K(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 _.BEGIN:if(O.state=_.BEGIN_WHITESPACE,N==="\uFEFF")continue;U(O,N);continue;case _.BEGIN_WHITESPACE:U(O,N);continue;case _.TEXT:if(O.sawRoot&&!O.closedRoot){for(var z=V-1;N&&N!=="<"&&N!=="&";)N=H(x,V++),N&&O.trackPosition&&(O.position++,N===`
|
|
196
196
|
`?(O.line++,O.column=0):O.column++);O.textNode+=x.substring(z,V-1)}N==="<"&&!(O.sawRoot&&O.closedRoot&&!O.strict)?(O.state=_.OPEN_WAKA,O.startTagPosition=O.position):(!m(N)&&(!O.sawRoot||O.closedRoot)&&b(O,"Text data outside of root node."),N==="&"?O.state=_.TEXT_ENTITY:O.textNode+=N);continue;case _.SCRIPT:N==="<"?O.state=_.SCRIPT_ENDING:O.script+=N;continue;case _.SCRIPT_ENDING:N==="/"?O.state=_.CLOSE_TAG:(O.script+="<"+N,O.state=_.SCRIPT);continue;case _.OPEN_WAKA:if(N==="!")O.state=_.SGML_DECL,O.sgmlDecl="";else if(!m(N))if(S(g,N))O.state=_.OPEN_TAG,O.tagName=N;else if(N==="/")O.state=_.CLOSE_TAG,O.tagName="";else if(N==="?")O.state=_.PROC_INST,O.procInstName=O.procInstBody="";else{if(b(O,"Unencoded <"),O.startTagPosition+1<O.position){var ne=O.position-O.startTagPosition;N=new Array(ne).join(" ")+N}O.textNode+="<"+N,O.state=_.TEXT}continue;case _.SGML_DECL:if(O.sgmlDecl+N==="--"){O.state=_.COMMENT,O.comment="",O.sgmlDecl="";continue}O.doctype&&O.doctype!==!0&&O.sgmlDecl?(O.state=_.DOCTYPE_DTD,O.doctype+="<!"+O.sgmlDecl+N,O.sgmlDecl=""):(O.sgmlDecl+N).toUpperCase()===l?(I(O,"onopencdata"),O.state=_.CDATA,O.sgmlDecl="",O.cdata=""):(O.sgmlDecl+N).toUpperCase()===h?(O.state=_.DOCTYPE,(O.doctype||O.sawRoot)&&b(O,"Inappropriately located doctype declaration"),O.doctype="",O.sgmlDecl=""):N===">"?(I(O,"onsgmldeclaration",O.sgmlDecl),O.sgmlDecl="",O.state=_.TEXT):(D(N)&&(O.state=_.SGML_DECL_QUOTED),O.sgmlDecl+=N);continue;case _.SGML_DECL_QUOTED:N===O.q&&(O.state=_.SGML_DECL,O.q=""),O.sgmlDecl+=N;continue;case _.DOCTYPE:N===">"?(O.state=_.TEXT,I(O,"ondoctype",O.doctype),O.doctype=!0):(O.doctype+=N,N==="["?O.state=_.DOCTYPE_DTD:D(N)&&(O.state=_.DOCTYPE_QUOTED,O.q=N));continue;case _.DOCTYPE_QUOTED:O.doctype+=N,N===O.q&&(O.q="",O.state=_.DOCTYPE);continue;case _.DOCTYPE_DTD:N==="]"?(O.doctype+=N,O.state=_.DOCTYPE):N==="<"?(O.state=_.OPEN_WAKA,O.startTagPosition=O.position):D(N)?(O.doctype+=N,O.state=_.DOCTYPE_DTD_QUOTED,O.q=N):O.doctype+=N;continue;case _.DOCTYPE_DTD_QUOTED:O.doctype+=N,N===O.q&&(O.state=_.DOCTYPE_DTD,O.q="");continue;case _.COMMENT:N==="-"?O.state=_.COMMENT_ENDING:O.comment+=N;continue;case _.COMMENT_ENDING:N==="-"?(O.state=_.COMMENT_ENDED,O.comment=j(O.opt,O.comment),O.comment&&I(O,"oncomment",O.comment),O.comment=""):(O.comment+="-"+N,O.state=_.COMMENT);continue;case _.COMMENT_ENDED:N!==">"?(b(O,"Malformed comment"),O.comment+="--"+N,O.state=_.COMMENT):O.doctype&&O.doctype!==!0?O.state=_.DOCTYPE_DTD:O.state=_.TEXT;continue;case _.CDATA:for(var z=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(z,V-1),N==="]"&&(O.state=_.CDATA_ENDING);continue;case _.CDATA_ENDING:N==="]"?O.state=_.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=_.CDATA);continue;case _.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=_.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=_.CDATA);continue;case _.PROC_INST:N==="?"?O.state=_.PROC_INST_ENDING:m(N)?O.state=_.PROC_INST_BODY:O.procInstName+=N;continue;case _.PROC_INST_BODY:if(!O.procInstBody&&m(N))continue;N==="?"?O.state=_.PROC_INST_ENDING:O.procInstBody+=N;continue;case _.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=_.TEXT):(O.procInstBody+="?"+N,O.state=_.PROC_INST_BODY);continue;case _.OPEN_TAG:S(v,N)?O.tagName+=N:(T(O),N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:(m(N)||b(O,"Invalid character in tag name"),O.state=_.ATTRIB));continue;case _.OPEN_TAG_SLASH:N===">"?(q(O,!0),M(O)):(b(O,"Forward-slash in opening tag not followed by >"),O.state=_.ATTRIB);continue;case _.ATTRIB:if(m(N))continue;N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:S(g,N)?(O.attribName=N,O.attribValue="",O.state=_.ATTRIB_NAME):b(O,"Invalid attribute name");continue;case _.ATTRIB_NAME:N==="="?O.state=_.ATTRIB_VALUE:N===">"?(b(O,"Attribute without value"),O.attribValue=O.attribName,$(O),q(O)):m(N)?O.state=_.ATTRIB_NAME_SAW_WHITE:S(v,N)?O.attribName+=N:b(O,"Invalid attribute name");continue;case _.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=_.ATTRIB_VALUE;else{if(m(N))continue;b(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?q(O):S(g,N)?(O.attribName=N,O.state=_.ATTRIB_NAME):(b(O,"Invalid attribute name"),O.state=_.ATTRIB)}continue;case _.ATTRIB_VALUE:if(m(N))continue;D(N)?(O.q=N,O.state=_.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||K(O,"Unquoted attribute value"),O.state=_.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case _.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=_.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=_.ATTRIB_VALUE_CLOSED;continue;case _.ATTRIB_VALUE_CLOSED:m(N)?O.state=_.ATTRIB:N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:S(g,N)?(b(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=_.ATTRIB_NAME):b(O,"Invalid attribute name");continue;case _.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=_.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?q(O):O.state=_.ATTRIB;continue;case _.CLOSE_TAG:if(O.tagName)N===">"?M(O):S(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=_.SCRIPT):(m(N)||b(O,"Invalid tagname in closing tag"),O.state=_.CLOSE_TAG_SAW_WHITE);else{if(m(N))continue;F(g,N)?O.script?(O.script+="</"+N,O.state=_.SCRIPT):b(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case _.CLOSE_TAG_SAW_WHITE:if(m(N))continue;N===">"?M(O):b(O,"Invalid characters in closing tag");continue;case _.TEXT_ENTITY:case _.ATTRIB_VALUE_ENTITY_Q:case _.ATTRIB_VALUE_ENTITY_U:var oe,we;switch(O.state){case _.TEXT_ENTITY:oe=_.TEXT,we="textNode";break;case _.ATTRIB_VALUE_ENTITY_Q:oe=_.ATTRIB_VALUE_QUOTED,we="attribValue";break;case _.ATTRIB_VALUE_ENTITY_U:oe=_.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 S(O.entity.length?A:E,N)?O.entity+=N:(b(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=[],z,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,z=(bt>>10)+55296,oe=bt%1024+56320,ne.push(z,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 ep>"u"?ep.sax={}:ep)});var WN=C(Ov=>{(function(){"use strict";Ov.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Ov)});var xv=C(eo=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),eo.normalize=function(e){return e.toLowerCase()},eo.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},eo.stripPrefix=function(e){return e.replace(t,"")},eo.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},eo.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(eo)});var XN=C(pi=>{(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 g(){this.constructor=d}return g.prototype=f.prototype,d.prototype=new g,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=GN(),n=require("events"),t=WN(),o=xv(),u=require("timers").setImmediate,e=jd().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,p){var g,v,E;for(g=0,v=d.length;g<v;g++)E=d[g],f=E(f,p);return f},r=function(d,f,p){var g;return g=Object.create(null),g.value=p,g.writable=!0,g.enumerable=!0,g.configurable=!0,Object.defineProperty(d,f,g)},pi.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 g,v,E;if(!(this instanceof pi.Parser))return new pi.Parser(p);this.options={},v=e["0.2"];for(g in v)h.call(v,g)&&(E=v[g],this.options[g]=E);for(g in p)h.call(p,g)&&(E=p[g],this.options[g]=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,g;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(g=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(p,g,v){return g in p?(p[g]instanceof Array||r(p,g,[p[g]]),p[g].push(v)):this.options.explicitArray?r(p,g,[v]):r(p,g,v)},f.prototype.reset=function(){var p,g,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,g=this.options.charkey,this.saxParser.onopentag=(function(A){return function(m){var D,w,S,F,_;if(S={},S[g]="",!A.options.ignoreAttrs){_=m.attributes;for(D in _)h.call(_,D)&&(!(p in S)&&!A.options.mergeAttrs&&(S[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(S,F,w):r(S[p],F,w))}return S["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,m.name):m.name,A.options.xmlns&&(S[A.options.xmlnskey]={uri:m.uri,local:m.local}),E.push(S)}})(this),this.saxParser.onclosetag=(function(A){return function(){var m,D,w,S,F,_,k,R,I,B;if(_=E.pop(),F=_["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete _["#name"],_.cdata===!0&&(m=_.cdata,delete _.cdata),I=E[E.length-1],_[g].match(/^\s*$/)&&!m?(D=_[g],delete _[g]):(A.options.trim&&(_[g]=_[g].trim()),A.options.normalize&&(_[g]=_[g].replace(/\s{2,}/g," ").trim()),_[g]=A.options.valueProcessors?s(A.options.valueProcessors,_[g],F):_[g],Object.keys(_).length===1&&g in _&&!A.EXPLICIT_CHARKEY&&(_=_[g])),i(_)&&(typeof A.options.emptyTag=="function"?_=A.options.emptyTag():_=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(B="/"+(function(){var j,K,L;for(L=[],j=0,K=E.length;j<K;j++)S=E[j],L.push(S["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return _=A.options.validator(B,I&&I[F],_)}catch(K){return j=K,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof _=="object"){if(!A.options.preserveChildrenOrder)S={},A.options.attrkey in _&&(S[A.options.attrkey]=_[A.options.attrkey],delete _[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in _&&(S[A.options.charkey]=_[A.options.charkey],delete _[A.options.charkey]),Object.getOwnPropertyNames(_).length>0&&(S[A.options.childkey]=_),_=S;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in _)h.call(_,w)&&r(k,w,_[w]);I[A.options.childkey].push(k),delete _["#name"],Object.keys(_).length===1&&g in _&&!A.EXPLICIT_CHARKEY&&(_=_[g])}}return E.length>0?A.assignOrPush(I,F,_):(A.options.explicitRoot&&(R=_,_={},r(_,F,R)),A.resultObject=_,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[g]+=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[g]=m,A.options.normalize&&(D[g]=D[g].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,g){var v;g!=null&&typeof g=="function"&&(this.on("end",function(E){return this.reset(),g(null,E)}),this.on("error",function(E){return this.reset(),g(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(g){return function(v,E){return g.parseString(p,function(A,m){return A?E(A):v(m)})}})(this))},f})(n),pi.parseString=function(d,f,p){var g,v,E;return p!=null?(typeof p=="function"&&(g=p),typeof f=="object"&&(v=f)):(typeof f=="function"&&(g=f),v={}),E=new pi.Parser(v),E.parseString(d,g)},pi.parseStringPromise=function(d,f){var p,g;return typeof f=="object"&&(p=f),g=new pi.Parser(p),g.parseStringPromise(d)}}).call(pi)});var YN=C(mi=>{(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=jd(),t=KN(),r=XN(),n=xv(),mi.defaults=e.defaults,mi.processors=n,mi.ValidationError=(function(o){i(a,o);function a(u){this.message=u}return a})(Error),mi.Builder=t.Builder,mi.Parser=r.Parser,mi.parseString=r.parseString,mi.parseStringPromise=r.parseStringPromise}).call(mi)});var JN=C(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=Ca(),Bc=yne.__importDefault(YN());async function wne(t){var e;try{let r=await(0,Dne.readFile)(t,{encoding:"utf-8"});try{return await Bc.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 Bc.default.Parser({...e}):new Bc.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 Bc.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 Bc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=bne});var r$=C(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=Ca(),Tv=require("path"),La=_ne.__importDefault(Sa()),Sne=dd(),Ane=Cc(),ZN=Bd(),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 ${La.default.strong(`node_modules/${e}`)}.
|
|
197
|
+
`?(O.line++,O.column=0):O.column++);O.cdata+=x.substring(z,V-1),N==="]"&&(O.state=_.CDATA_ENDING);continue;case _.CDATA_ENDING:N==="]"?O.state=_.CDATA_ENDING_2:(O.cdata+="]"+N,O.state=_.CDATA);continue;case _.CDATA_ENDING_2:N===">"?(O.cdata&&I(O,"oncdata",O.cdata),I(O,"onclosecdata"),O.cdata="",O.state=_.TEXT):N==="]"?O.cdata+="]":(O.cdata+="]]"+N,O.state=_.CDATA);continue;case _.PROC_INST:N==="?"?O.state=_.PROC_INST_ENDING:m(N)?O.state=_.PROC_INST_BODY:O.procInstName+=N;continue;case _.PROC_INST_BODY:if(!O.procInstBody&&m(N))continue;N==="?"?O.state=_.PROC_INST_ENDING:O.procInstBody+=N;continue;case _.PROC_INST_ENDING:N===">"?(I(O,"onprocessinginstruction",{name:O.procInstName,body:O.procInstBody}),O.procInstName=O.procInstBody="",O.state=_.TEXT):(O.procInstBody+="?"+N,O.state=_.PROC_INST_BODY);continue;case _.OPEN_TAG:S(v,N)?O.tagName+=N:(T(O),N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:(m(N)||b(O,"Invalid character in tag name"),O.state=_.ATTRIB));continue;case _.OPEN_TAG_SLASH:N===">"?(q(O,!0),M(O)):(b(O,"Forward-slash in opening tag not followed by >"),O.state=_.ATTRIB);continue;case _.ATTRIB:if(m(N))continue;N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:S(g,N)?(O.attribName=N,O.attribValue="",O.state=_.ATTRIB_NAME):b(O,"Invalid attribute name");continue;case _.ATTRIB_NAME:N==="="?O.state=_.ATTRIB_VALUE:N===">"?(b(O,"Attribute without value"),O.attribValue=O.attribName,$(O),q(O)):m(N)?O.state=_.ATTRIB_NAME_SAW_WHITE:S(v,N)?O.attribName+=N:b(O,"Invalid attribute name");continue;case _.ATTRIB_NAME_SAW_WHITE:if(N==="=")O.state=_.ATTRIB_VALUE;else{if(m(N))continue;b(O,"Attribute without value"),O.tag.attributes[O.attribName]="",O.attribValue="",I(O,"onattribute",{name:O.attribName,value:""}),O.attribName="",N===">"?q(O):S(g,N)?(O.attribName=N,O.state=_.ATTRIB_NAME):(b(O,"Invalid attribute name"),O.state=_.ATTRIB)}continue;case _.ATTRIB_VALUE:if(m(N))continue;D(N)?(O.q=N,O.state=_.ATTRIB_VALUE_QUOTED):(O.opt.unquotedAttributeValues||K(O,"Unquoted attribute value"),O.state=_.ATTRIB_VALUE_UNQUOTED,O.attribValue=N);continue;case _.ATTRIB_VALUE_QUOTED:if(N!==O.q){N==="&"?O.state=_.ATTRIB_VALUE_ENTITY_Q:O.attribValue+=N;continue}$(O),O.q="",O.state=_.ATTRIB_VALUE_CLOSED;continue;case _.ATTRIB_VALUE_CLOSED:m(N)?O.state=_.ATTRIB:N===">"?q(O):N==="/"?O.state=_.OPEN_TAG_SLASH:S(g,N)?(b(O,"No whitespace between attributes"),O.attribName=N,O.attribValue="",O.state=_.ATTRIB_NAME):b(O,"Invalid attribute name");continue;case _.ATTRIB_VALUE_UNQUOTED:if(!w(N)){N==="&"?O.state=_.ATTRIB_VALUE_ENTITY_U:O.attribValue+=N;continue}$(O),N===">"?q(O):O.state=_.ATTRIB;continue;case _.CLOSE_TAG:if(O.tagName)N===">"?M(O):S(v,N)?O.tagName+=N:O.script?(O.script+="</"+O.tagName,O.tagName="",O.state=_.SCRIPT):(m(N)||b(O,"Invalid tagname in closing tag"),O.state=_.CLOSE_TAG_SAW_WHITE);else{if(m(N))continue;F(g,N)?O.script?(O.script+="</"+N,O.state=_.SCRIPT):b(O,"Invalid tagname in closing tag."):O.tagName=N}continue;case _.CLOSE_TAG_SAW_WHITE:if(m(N))continue;N===">"?M(O):b(O,"Invalid characters in closing tag");continue;case _.TEXT_ENTITY:case _.ATTRIB_VALUE_ENTITY_Q:case _.ATTRIB_VALUE_ENTITY_U:var oe,we;switch(O.state){case _.TEXT_ENTITY:oe=_.TEXT,we="textNode";break;case _.ATTRIB_VALUE_ENTITY_Q:oe=_.ATTRIB_VALUE_QUOTED,we="attribValue";break;case _.ATTRIB_VALUE_ENTITY_U:oe=_.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 S(O.entity.length?A:E,N)?O.entity+=N:(b(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=[],z,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,z=(bt>>10)+55296,oe=bt%1024+56320,ne.push(z,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 ep>"u"?ep.sax={}:ep)});var WN=C(Ov=>{(function(){"use strict";Ov.stripBOM=function(t){return t[0]==="\uFEFF"?t.substring(1):t}}).call(Ov)});var xv=C(eo=>{(function(){"use strict";var t;t=new RegExp(/(?!xmlns)^.*:/),eo.normalize=function(e){return e.toLowerCase()},eo.firstCharLowerCase=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},eo.stripPrefix=function(e){return e.replace(t,"")},eo.parseNumbers=function(e){return isNaN(e)||(e=e%1===0?parseInt(e,10):parseFloat(e)),e},eo.parseBooleans=function(e){return/^(?:true|false)$/i.test(e)&&(e=e.toLowerCase()==="true"),e}}).call(eo)});var XN=C(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 g(){this.constructor=d}return g.prototype=f.prototype,d.prototype=new g,d.__super__=f.prototype,d},h={}.hasOwnProperty;a=GN(),n=require("events"),t=WN(),o=xv(),u=require("timers").setImmediate,e=jd().defaults,i=function(d){return typeof d=="object"&&d!=null&&Object.keys(d).length===0},s=function(d,f,p){var g,v,E;for(g=0,v=d.length;g<v;g++)E=d[g],f=E(f,p);return f},r=function(d,f,p){var g;return g=Object.create(null),g.value=p,g.writable=!0,g.enumerable=!0,g.configurable=!0,Object.defineProperty(d,f,g)},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 g,v,E;if(!(this instanceof mi.Parser))return new mi.Parser(p);this.options={},v=e["0.2"];for(g in v)h.call(v,g)&&(E=v[g],this.options[g]=E);for(g in p)h.call(p,g)&&(E=p[g],this.options[g]=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,g;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(g=v,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(g)}},f.prototype.assignOrPush=function(p,g,v){return g in p?(p[g]instanceof Array||r(p,g,[p[g]]),p[g].push(v)):this.options.explicitArray?r(p,g,[v]):r(p,g,v)},f.prototype.reset=function(){var p,g,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,g=this.options.charkey,this.saxParser.onopentag=(function(A){return function(m){var D,w,S,F,_;if(S={},S[g]="",!A.options.ignoreAttrs){_=m.attributes;for(D in _)h.call(_,D)&&(!(p in S)&&!A.options.mergeAttrs&&(S[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(S,F,w):r(S[p],F,w))}return S["#name"]=A.options.tagNameProcessors?s(A.options.tagNameProcessors,m.name):m.name,A.options.xmlns&&(S[A.options.xmlnskey]={uri:m.uri,local:m.local}),E.push(S)}})(this),this.saxParser.onclosetag=(function(A){return function(){var m,D,w,S,F,_,k,R,I,B;if(_=E.pop(),F=_["#name"],(!A.options.explicitChildren||!A.options.preserveChildrenOrder)&&delete _["#name"],_.cdata===!0&&(m=_.cdata,delete _.cdata),I=E[E.length-1],_[g].match(/^\s*$/)&&!m?(D=_[g],delete _[g]):(A.options.trim&&(_[g]=_[g].trim()),A.options.normalize&&(_[g]=_[g].replace(/\s{2,}/g," ").trim()),_[g]=A.options.valueProcessors?s(A.options.valueProcessors,_[g],F):_[g],Object.keys(_).length===1&&g in _&&!A.EXPLICIT_CHARKEY&&(_=_[g])),i(_)&&(typeof A.options.emptyTag=="function"?_=A.options.emptyTag():_=A.options.emptyTag!==""?A.options.emptyTag:D),A.options.validator!=null&&(B="/"+(function(){var j,K,L;for(L=[],j=0,K=E.length;j<K;j++)S=E[j],L.push(S["#name"]);return L})().concat(F).join("/"),(function(){var j;try{return _=A.options.validator(B,I&&I[F],_)}catch(K){return j=K,A.emit("error",j)}})()),A.options.explicitChildren&&!A.options.mergeAttrs&&typeof _=="object"){if(!A.options.preserveChildrenOrder)S={},A.options.attrkey in _&&(S[A.options.attrkey]=_[A.options.attrkey],delete _[A.options.attrkey]),!A.options.charsAsChildren&&A.options.charkey in _&&(S[A.options.charkey]=_[A.options.charkey],delete _[A.options.charkey]),Object.getOwnPropertyNames(_).length>0&&(S[A.options.childkey]=_),_=S;else if(I){I[A.options.childkey]=I[A.options.childkey]||[],k={};for(w in _)h.call(_,w)&&r(k,w,_[w]);I[A.options.childkey].push(k),delete _["#name"],Object.keys(_).length===1&&g in _&&!A.EXPLICIT_CHARKEY&&(_=_[g])}}return E.length>0?A.assignOrPush(I,F,_):(A.options.explicitRoot&&(R=_,_={},r(_,F,R)),A.resultObject=_,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[g]+=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[g]=m,A.options.normalize&&(D[g]=D[g].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,g){var v;g!=null&&typeof g=="function"&&(this.on("end",function(E){return this.reset(),g(null,E)}),this.on("error",function(E){return this.reset(),g(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(g){return function(v,E){return g.parseString(p,function(A,m){return A?E(A):v(m)})}})(this))},f})(n),mi.parseString=function(d,f,p){var g,v,E;return p!=null?(typeof p=="function"&&(g=p),typeof f=="object"&&(v=f)):(typeof f=="function"&&(g=f),v={}),E=new mi.Parser(v),E.parseString(d,g)},mi.parseStringPromise=function(d,f){var p,g;return typeof f=="object"&&(p=f),g=new mi.Parser(p),g.parseStringPromise(d)}}).call(mi)});var YN=C(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=jd(),t=KN(),r=XN(),n=xv(),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=C(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=Ca(),Bc=yne.__importDefault(YN());async function wne(t){var e;try{let r=await(0,Dne.readFile)(t,{encoding:"utf-8"});try{return await Bc.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 Bc.default.Parser({...e}):new Bc.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 Bc.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 Bc.default.Builder({headless:!0,explicitRoot:!1,rootName:e}).buildObject(t)}Bn.buildXmlElement=bne});var r$=C(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=Ca(),Tv=require("path"),La=_ne.__importDefault(Sa()),Sne=dd(),Ane=Cc(),ZN=Bd(),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 ${La.default.strong(`node_modules/${e}`)}.
|
|
198
198
|
Are you sure ${La.default.strong(e)} is installed?`);let n=(0,Tv.dirname)(r),i=await(0,Cne.readJSON)(r);if(!i)return null;if(i.capacitor)return{id:e,name:Iv(e),version:i.version,rootPath:n,repository:i.repository,manifest:i.capacitor};let s=(0,Tv.join)(n,"plugin.xml"),o=await(0,One.readXML)(s);return{id:e,name:Iv(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 Iv(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=Iv;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 ${La.default.strong(e)}:
|
|
199
199
|
`;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${La.default.strong(e)}, skipped install:
|
|
200
200
|
`;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${La.default.strong(e)}:
|
|
201
201
|
`;break}n+=t.map(s=>`${s.id}${La.default.weak(`@${s.version}`)}`).join(`
|
|
202
|
-
`),Ane.logger.info(n)}Ue.printPlugins=Tne;function Pv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ue.getPluginPlatform=Pv;function Ine(t,e,r){let n=Pv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ue.getPlatformElement=Ine;function Pne(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Ue.getPluginType=Pne;function Fne(t,e){return Fv(t,e,"js-module")}Ue.getJSModules=Fne;function Rne(t,e){return Fv(t,e,"asset")}Ue.getAssets=Rne;function kne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,ZN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,Tv.join)(e.rootPath,r)}Ue.getFilePath=kne;function Fv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=Pv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ue.getAllElements=Fv});var n$=C(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function Nne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=Nne;async function $ne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=$ne;async function Lne(t,e){return Rv(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=Lne;async function Bne(t,e){return Rv(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=Bne;async function Rv(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=Rv;function tp(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=tp;function jne(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:tp(tp(t,e,1),r,0,n)}jt.move=jne;function Mne(t,e,r){return e<0||e>t.length?[...t]:tp(t,e,1,r)}jt.replace=Mne});var jc=C(Qi=>{"use strict";var i$=Re().fromCallback,ur=vt(),Une=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Qi[t]=ur[t])});Une.forEach(t=>{Qi[t]=i$(ur[t])});Qi.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Qi.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Qi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Qi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Qi.realpath.native=i$(ur.realpath.native))});var kv=C((Bve,s$)=>{s$.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var l$=C((jve,Nv)=>{"use strict";var Ba=jc(),
|
|
202
|
+
`),Ane.logger.info(n)}Ue.printPlugins=Tne;function Pv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ue.getPluginPlatform=Pv;function Ine(t,e,r){let n=Pv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ue.getPlatformElement=Ine;function Pne(t,e){var r,n,i,s;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(s=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&s!==void 0?s:0}return 0}Ue.getPluginType=Pne;function Fne(t,e){return Fv(t,e,"js-module")}Ue.getJSModules=Fne;function Rne(t,e){return Fv(t,e,"asset")}Ue.getAssets=Rne;function kne(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,ZN.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,Tv.join)(e.rootPath,r)}Ue.getFilePath=kne;function Fv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=Pv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ue.getAllElements=Fv});var n$=C(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.replace=jt.move=jt.splice=jt.reduce=jt.map=jt.filter=jt.concurrentFilter=jt.conform=void 0;function Nne(t){return typeof t>"u"?[]:Array.isArray(t)?t:[t]}jt.conform=Nne;async function $ne(t,e){let r=async i=>[i,await e(i)];return(await Promise.all(t.map(r))).filter(([,i])=>i).map(([i])=>i)}jt.concurrentFilter=$ne;async function Lne(t,e){return Rv(t,async(n,i,s,o)=>(await e(i,s,o)&&n.push(i),n),[])}jt.filter=Lne;async function Bne(t,e){return Rv(t,async(n,i,s,o)=>(n.push(await e(i,s,o)),n),[])}jt.map=Bne;async function Rv(t,e,r){let i=typeof r>"u"?1:0;if(typeof r>"u"){if(t.length===0)throw new TypeError("Reduce of empty array with no initial value");r=t[0]}let s=r;for(let o=i;o<t.length;o++)s=await e(s,t[o],o,t);return s}jt.reduce=Rv;function tp(t,e,r=t.length-e,...n){let i=[...t];return i.splice(e,r,...n),i}jt.splice=tp;function jne(t,e,r){let n=t[e];return e<0||r<0||e>=t.length||r>=t.length?[...t]:tp(tp(t,e,1),r,0,n)}jt.move=jne;function Mne(t,e,r){return e<0||e>t.length?[...t]:tp(t,e,1,r)}jt.replace=Mne});var jc=C(Qi=>{"use strict";var i$=Re().fromCallback,ur=vt(),Une=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(t=>typeof ur[t]=="function");Object.keys(ur).forEach(t=>{t!=="promises"&&(Qi[t]=ur[t])});Une.forEach(t=>{Qi[t]=i$(ur[t])});Qi.exists=function(t,e){return typeof e=="function"?ur.exists(t,e):new Promise(r=>ur.exists(t,r))};Qi.read=function(t,e,r,n,i,s){return typeof s=="function"?ur.read(t,e,r,n,i,s):new Promise((o,a)=>{ur.read(t,e,r,n,i,(u,c,l)=>{if(u)return a(u);o({bytesRead:c,buffer:l})})})};Qi.write=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.write(t,e,...r):new Promise((n,i)=>{ur.write(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffer:a})})})};typeof ur.writev=="function"&&(Qi.writev=function(t,e,...r){return typeof r[r.length-1]=="function"?ur.writev(t,e,...r):new Promise((n,i)=>{ur.writev(t,e,...r,(s,o,a)=>{if(s)return i(s);n({bytesWritten:o,buffers:a})})})});typeof ur.realpath.native=="function"&&(Qi.realpath.native=i$(ur.realpath.native))});var kv=C((Bve,s$)=>{s$.exports=t=>{let e=process.versions.node.split(".").map(r=>parseInt(r,10));return t=t.split(".").map(r=>parseInt(r,10)),e[0]>t[0]||e[0]===t[0]&&(e[1]>t[1]||e[1]===t[1]&&e[2]>=t[2])}});var l$=C((jve,Nv)=>{"use strict";var Ba=jc(),yi=require("path"),qne=kv(),o$=qne("10.12.0"),a$=t=>{if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(yi.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}},u$=t=>{let e={mode:511};return typeof t=="number"&&(t={mode:t}),{...e,...t}},c$=t=>{let e=new Error(`operation not permitted, mkdir '${t}'`);return e.code="EPERM",e.errno=-4048,e.path=t,e.syscall="mkdir",e};Nv.exports.makeDir=async(t,e)=>{if(a$(t),e=u$(e),o$){let n=yi.resolve(t);return Ba.mkdir(n,{mode:e.mode,recursive:!0})}let r=async n=>{try{await Ba.mkdir(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(yi.dirname(n)===n)throw c$(n);if(i.message.includes("null bytes"))throw i;return await r(yi.dirname(n)),r(n)}try{if(!(await Ba.stat(n)).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(yi.resolve(t))};Nv.exports.makeDirSync=(t,e)=>{if(a$(t),e=u$(e),o$){let n=yi.resolve(t);return Ba.mkdirSync(n,{mode:e.mode,recursive:!0})}let r=n=>{try{Ba.mkdirSync(n,e.mode)}catch(i){if(i.code==="EPERM")throw i;if(i.code==="ENOENT"){if(yi.dirname(n)===n)throw c$(n);if(i.message.includes("null bytes"))throw i;return r(yi.dirname(n)),r(n)}try{if(!Ba.statSync(n).isDirectory())throw new Error("The path is not a directory")}catch{throw i}}};return r(yi.resolve(t))}});var mn=C((Mve,f$)=>{"use strict";var Hne=Re().fromPromise,{makeDir:Vne,makeDirSync:$v}=l$(),Lv=Hne(Vne);f$.exports={mkdirs:Lv,mkdirsSync:$v,mkdirp:Lv,mkdirpSync:$v,ensureDir:Lv,ensureDirSync:$v}});var Bv=C((Uve,h$)=>{"use strict";var ja=vt();function zne(t,e,r,n){ja.open(t,"r+",(i,s)=>{if(i)return n(i);ja.futimes(s,e,r,o=>{ja.close(s,a=>{n&&n(o||a)})})})}function Kne(t,e,r){let n=ja.openSync(t,"r+");return ja.futimesSync(n,e,r),ja.closeSync(n)}h$.exports={utimesMillis:zne,utimesMillisSync:Kne}});var Mc=C((qve,g$)=>{"use strict";var Ma=jc(),Ar=require("path"),Gne=require("util"),Wne=kv(),rp=Wne("10.5.0"),d$=t=>rp?Ma.stat(t,{bigint:!0}):Ma.stat(t),jv=t=>rp?Ma.statSync(t,{bigint:!0}):Ma.statSync(t);function Xne(t,e){return Promise.all([d$(t),d$(e).catch(r=>{if(r.code==="ENOENT")return null;throw r})]).then(([r,n])=>({srcStat:r,destStat:n}))}function Yne(t,e){let r,n=jv(t);try{r=jv(e)}catch(i){if(i.code==="ENOENT")return{srcStat:n,destStat:null};throw i}return{srcStat:n,destStat:r}}function Jne(t,e,r,n){Gne.callbackify(Xne)(t,e,(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;return a&&np(o,a)?n(new Error("Source and destination must not be the same.")):o.isDirectory()&&Mv(t,e)?n(new Error(ip(t,e,r))):n(null,{srcStat:o,destStat:a})})}function Zne(t,e,r){let{srcStat:n,destStat:i}=Yne(t,e);if(i&&np(n,i))throw new Error("Source and destination must not be the same.");if(n.isDirectory()&&Mv(t,e))throw new Error(ip(t,e,r));return{srcStat:n,destStat:i}}function p$(t,e,r,n,i){let s=Ar.resolve(Ar.dirname(t)),o=Ar.resolve(Ar.dirname(r));if(o===s||o===Ar.parse(o).root)return i();let a=(u,c)=>u?u.code==="ENOENT"?i():i(u):np(e,c)?i(new Error(ip(t,r,n))):p$(t,e,o,n,i);rp?Ma.stat(o,{bigint:!0},a):Ma.stat(o,a)}function m$(t,e,r,n){let i=Ar.resolve(Ar.dirname(t)),s=Ar.resolve(Ar.dirname(r));if(s===i||s===Ar.parse(s).root)return;let o;try{o=jv(s)}catch(a){if(a.code==="ENOENT")return;throw a}if(np(e,o))throw new Error(ip(t,r,n));return m$(t,e,s,n)}function np(t,e){return!!(e.ino&&e.dev&&e.ino===t.ino&&e.dev===t.dev&&(rp||e.ino<Number.MAX_SAFE_INTEGER||e.size===t.size&&e.mode===t.mode&&e.nlink===t.nlink&&e.atimeMs===t.atimeMs&&e.mtimeMs===t.mtimeMs&&e.ctimeMs===t.ctimeMs&&e.birthtimeMs===t.birthtimeMs))}function Mv(t,e){let r=Ar.resolve(t).split(Ar.sep).filter(i=>i),n=Ar.resolve(e).split(Ar.sep).filter(i=>i);return r.reduce((i,s,o)=>i&&n[o]===s,!0)}function ip(t,e,r){return`Cannot ${r} '${t}' to a subdirectory of itself, '${e}'.`}g$.exports={checkPaths:Jne,checkPathsSync:Zne,checkParentPaths:p$,checkParentPathsSync:m$,isSrcSubdir:Mv}});var E$=C((Hve,v$)=>{"use strict";var Wt=vt(),Uc=require("path"),Qne=mn().mkdirsSync,eie=Bv().utimesMillisSync,qc=Mc();function tie(t,e,r){typeof r=="function"&&(r={filter:r}),r=r||{},r.clobber="clobber"in r?!!r.clobber:!0,r.overwrite="overwrite"in r?!!r.overwrite:r.clobber,r.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
203
203
|
|
|
204
204
|
see https://github.com/jprichardson/node-fs-extra/issues/269`);let{srcStat:n,destStat:i}=qc.checkPathsSync(t,e,"copy");return qc.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=Uc.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),Uv(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 Uv(t,e|128)}function Uv(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),Uv(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=Uc.join(e,t),s=Uc.join(r,t),{destStat:o}=qc.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=Uc.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=Uc.resolve(process.cwd(),s)),qc.isSrcSubdir(i,s))throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${s}'.`);if(Wt.statSync(r).isDirectory()&&qc.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 qv=C((Vve,b$)=>{"use strict";b$.exports={copySync:E$()}});var es=C((zve,C$)=>{"use strict";var mie=Re().fromPromise,_$=jc();function gie(t){return _$.access(t).then(()=>!0).catch(()=>!1)}C$.exports={pathExists:mie(gie),pathExistsSync:_$.existsSync}});var R$=C((Kve,F$)=>{"use strict";var Or=vt(),Hc=require("path"),yie=mn().mkdirs,Die=es().pathExists,wie=Bv().utimesMillis,Vc=Mc();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`),Vc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;Vc.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=Hc.dirname(r);Die(s,(o,a)=>{if(o)return i(o);if(a)return Hv(t,e,r,n,i);yie(s,u=>u?i(u):Hv(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 Hv(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):sp(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 sp(t,e|128,r)}function O$(t,e,r,n){Aie(e,r,i=>i?n(i):sp(r,t,n))}function sp(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):sp(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=Hc.join(r,e),a=Hc.join(n,e);Vc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Hv(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=Hc.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=Hc.resolve(process.cwd(),u)),Vc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&Vc.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 Vv=C((Gve,k$)=>{"use strict";var Fie=Re().fromCallback;k$.exports={copy:Fie(R$())}});var H$=C((Wve,q$)=>{"use strict";var N$=vt(),j$=require("path"),He=require("assert"),zc=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 zv(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"&&zc)return L$(t,e,n,r);if(i&&i.isDirectory())return op(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return zc?L$(t,e,s,r):op(t,e,s,r);if(s.code==="EISDIR")return op(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()?op(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()?ap(t,e,r):e.unlinkSync(t)}function op(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=>{zv(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"&&zc&&B$(t,e,n)}try{r&&r.isDirectory()?ap(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return zc?B$(t,e,n):ap(t,e,n);if(n.code!=="EISDIR")throw n;ap(t,e,n)}}function ap(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)),zc){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=zv;zv.sync=U$});var Kc=C((Xve,z$)=>{"use strict";var Nie=Re().fromCallback,V$=H$();z$.exports={remove:Nie(V$),removeSync:V$.sync}});var Q$=C((Yve,Z$)=>{"use strict";var $ie=Re().fromCallback,W$=vt(),X$=require("path"),Y$=mn(),J$=Kc(),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=C((Jve,rL)=>{"use strict";var Lie=Re().fromCallback,eL=require("path"),ts=vt(),tL=mn();function Bie(t,e){function r(){ts.writeFile(t,"",n=>{if(n)return e(n);e()})}ts.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=eL.dirname(t);ts.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():ts.readdir(s,u=>{if(u)return e(u)})})})}function jie(t){let e;try{e=ts.statSync(t)}catch{}if(e&&e.isFile())return;let r=eL.dirname(t);try{ts.statSync(r).isDirectory()||ts.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")tL.mkdirsSync(r);else throw n}ts.writeFileSync(t,"")}rL.exports={createFile:Lie(Bie),createFileSync:jie}});var uL=C((Zve,aL)=>{"use strict";var Mie=Re().fromCallback,sL=require("path"),to=vt(),oL=mn(),iL=es().pathExists;function Uie(t,e,r){function n(i,s){to.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);to.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(to.existsSync(e))return;try{to.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=sL.dirname(e);return to.existsSync(n)||oL.mkdirsSync(n),to.linkSync(t,e)}aL.exports={createLink:Mie(Uie),createLinkSync:qie}});var lL=C((Qve,cL)=>{"use strict";var rs=require("path"),Gc=vt(),Hie=es().pathExists;function Vie(t,e,r){if(rs.isAbsolute(t))return Gc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=rs.dirname(e),i=rs.join(n,t);return Hie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Gc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:rs.relative(n,t)})))}}function zie(t,e){let r;if(rs.isAbsolute(t)){if(r=Gc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=rs.dirname(e),i=rs.join(n,t);if(r=Gc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Gc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:rs.relative(n,t)}}}cL.exports={symlinkPaths:Vie,symlinkPathsSync:zie}});var dL=C((eEe,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=C((tEe,wL)=>{"use strict";var Wie=Re().fromCallback,mL=require("path"),Ua=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=es().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 Ua.symlink(t,e,c,n);Xie(l,f=>{if(f)return n(f);Ua.symlink(t,e,c,n)})})})})})}function rse(t,e,r){if(Ua.existsSync(e))return;let i=Zie(t,e);t=i.toDst,r=ese(i.toCwd,r);let s=mL.dirname(e);return Ua.existsSync(s)||Yie(s),Ua.symlinkSync(t,e,r)}wL.exports={createSymlink:Wie(tse),createSymlinkSync:rse}});var bL=C((rEe,EL)=>{"use strict";var up=nL(),cp=uL(),lp=vL();EL.exports={createFile:up.createFile,createFileSync:up.createFileSync,ensureFile:up.createFile,ensureFileSync:up.createFileSync,createLink:cp.createLink,createLinkSync:cp.createLinkSync,ensureLink:cp.createLink,ensureLinkSync:cp.createLinkSync,createSymlink:lp.createSymlink,createSymlinkSync:lp.createSymlinkSync,ensureSymlink:lp.createSymlink,ensureSymlinkSync:lp.createSymlinkSync}});var CL=C((nEe,_L)=>{"use strict";var fp=k0();_L.exports={readJson:fp.readFile,readJsonSync:fp.readFileSync,writeJson:fp.writeFile,writeJsonSync:fp.writeFileSync}});var hp=C((iEe,OL)=>{"use strict";var nse=Re().fromCallback,Wc=vt(),SL=require("path"),AL=mn(),ise=es().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 Wc.writeFile(t,e,r,n);AL.mkdirs(i,a=>{if(a)return n(a);Wc.writeFile(t,e,r,n)})})}function ose(t,...e){let r=SL.dirname(t);if(Wc.existsSync(r))return Wc.writeFileSync(t,...e);AL.mkdirsSync(r),Wc.writeFileSync(t,...e)}OL.exports={outputFile:nse(sse),outputFileSync:ose}});var TL=C((sEe,xL)=>{"use strict";var{stringify:ase}=ba(),{outputFile:use}=hp();async function cse(t,e,r={}){let n=ase(e,r);await use(t,n,r)}xL.exports=cse});var PL=C((oEe,IL)=>{"use strict";var{stringify:lse}=ba(),{outputFileSync:fse}=hp();function hse(t,e,r){let n=lse(e,r);fse(t,n,r)}IL.exports=hse});var RL=C((aEe,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=C((uEe,BL)=>{"use strict";var $L=vt(),pse=require("path"),mse=qv().copySync,LL=Kc().removeSync,gse=mn().mkdirpSync,kL=Mc();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=C((cEe,ML)=>{"use strict";ML.exports={moveSync:jL()}});var KL=C((lEe,zL)=>{"use strict";var vse=vt(),Ese=require("path"),bse=Vv().copy,VL=Kc().remove,_se=mn().mkdirp,Cse=es().pathExists,qL=Mc();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=C((fEe,GL)=>{"use strict";var xse=Re().fromCallback;GL.exports={move:xse(KL())}});var dp=C((hEe,Kv)=>{"use strict";Kv.exports={...jc(),...qv(),...Vv(),...Q$(),...bL(),...RL(),...mn(),...UL(),...WL(),...hp(),...es(),...Kc()};var XL=require("fs");Object.getOwnPropertyDescriptor(XL,"promises")&&Object.defineProperty(Kv.exports,"promises",{get(){return XL.promises}})});var Gv=C(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.readdir=qa.stat=void 0;var YL=dp();async function Tse(t){try{return await YL.stat(t)}catch{}}qa.stat=Tse;async function Ise(t){try{return await YL.readdir(t)}catch{return[]}}qa.readdir=Ise});var r3=C(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=dp(),Fse=require("os"),yi=require("path"),JL=require("stream"),ZL=Gv();Pse.__exportStar(dp(),me);var QL=Gv();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=Xv(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=yi.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=yi.resolve(t),Xv(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 Wv(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=Wv;async function $se(t){return Promise.all([Wv(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 Wv(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 Xc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Xc;async function jse(t){return Xc(t,Yr.constants.F_OK)}me.pathExists=jse;async function Mse(t){return Xc(t,Yr.constants.R_OK)}me.pathReadable=Mse;async function Use(t){return Xc(t,Yr.constants.W_OK)}me.pathWritable=Use;async function e3(t){return Xc(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 yi.resolve(Fse.tmpdir(),t?`${t}-${e}`:e)}me.tmpfilepath=Vse;function t3(t){if(t=yi.normalize(t),!yi.isAbsolute(t))throw new Error(`${t} is not an absolute path`);let e=yi.parse(t);return t===e.root?[t]:t.slice(e.root.length).split(yi.sep).map((r,n,i)=>e.root+yi.join(...i.slice(0,i.length-n))).concat(e.root)}me.compilePaths=t3;var pp=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=>yi.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=pp;function Xv(t,e={}){return new pp(t,e)}me.walk=Xv});var n3=C(Di=>{"use strict";Object.defineProperty(Di,"__esModule",{value:!0});Di.AliasedMap=Di.CaseInsensitiveProxyHandler=Di.createCaseInsensitiveObject=void 0;function zse(){return new Proxy({},Di.CaseInsensitiveProxyHandler)}Di.createCaseInsensitiveObject=zse;Di.CaseInsensitiveProxyHandler={has:(t,e)=>mp(e)in t,get:(t,e)=>t[mp(e)],set:(t,e,r)=>(t[mp(e)]=r,!0),deleteProperty:(t,e)=>delete t[mp(e)]};var mp=t=>typeof t=="string"?t.toLowerCase():t,Yv=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)}};Di.AliasedMap=Yv});var c3=C((gEe,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":Jv(t,n,i,function(s){return i3("pgrep",["-P",s])},function(){s3(n,e,r)});break;default:Jv(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 Jv(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,Jv(c,e,r,n,i)})};s.on("close",a)}});var h3=C(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 Zv=(he(),ce(fe)),Gse=n3(),Wse=zi(),Xse=Jh(),Yse=Zv.__importStar(require("path")),Jse=Zv.__importDefault(Mh()),Zse=Zv.__importDefault(c3()),ro=(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 ro("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)(()=>{ro("onExit: process.exit/normal shutdown"),t()})}et.onExit=ioe;var gp=new Set;function soe(t){gp.add(t)}et.onBeforeExit=soe;function ooe(t){gp.delete(t)}et.offBeforeExit=ooe;var aoe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Yc=t=>aoe(async()=>{ro("onBeforeExit handler: %O received",t),ro("onBeforeExit handler: running %O functions",gp.size),await Promise.all([...gp.values()].map(async e=>{try{await e()}catch(r){ro("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(ro("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:Yc("SIGINT"),SIGTERM:Yc("SIGTERM"),SIGHUP:Yc("SIGHUP"),SIGBREAK:Yc("SIGBREAK")};for(let[t,e]of Object.entries(f3))process.on(t,e);var uoe=Yc("process.exit");async function coe(t=0){process.exitCode=t,await uoe(),ro("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=coe});var m3=C(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var rE=require("stream"),loe=4,d3=32,p3=16,Qv=class extends rE.Writable{_write(e,r,n){n()}};jn.NullStream=Qv;var eE=class extends rE.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=nE(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=eE;var tE=class extends rE.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=nE(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=tE;function nE(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=nE});var v3=C((wEe,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=C((vEe,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=C((bEe,A3)=>{var EEe=require("fs"),yp;process.platform==="win32"||global.TESTING_WINDOWS?yp=v3():yp=S3();A3.exports=iE;iE.sync=moe;function iE(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){iE(t,e||{},function(s,o){s?i(s):n(o)})})}yp(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 yp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var k3=C((_Ee,R3)=>{var Ha=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x3=require("path"),goe=Ha?";":":",T3=O3(),I3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),P3=(t,e)=>{let r=e.colon||goe,n=t.match(/\//)||Ha&&t.match(/\\/)?[""]:[...Ha?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ha?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ha?i.split(r):[""];return Ha&&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),g=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;l(u(g,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},(g,v)=>{if(!g&&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=C((CEe,sE)=>{"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"};sE.exports=N3;sE.exports.default=N3});var M3=C((SEe,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=C((AEe,aE)=>{"use strict";var oE=/([()\][%!^"`<>&|;, *?])/g;function Eoe(t){return t=t.replace(oE,"^$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(oE,"^$1"),e&&(t=t.replace(oE,"^$1")),t}aE.exports.command=Eoe;aE.exports.argument=boe});var H3=C((OEe,q3)=>{"use strict";q3.exports=/^#!(.*)/});var z3=C((xEe,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=C((TEe,K3)=>{"use strict";var uE=require("fs"),Coe=z3();function Soe(t){let r=Buffer.alloc(150),n;try{n=uE.openSync(t,"r"),uE.readSync(n,r,0,150,0),uE.closeSync(n)}catch{}return Coe(r.toString())}K3.exports=Soe});var J3=C((IEe,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=C((PEe,Q3)=>{"use strict";var cE=process.platform==="win32";function lE(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(!cE)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 cE&&t===1&&!e.file?lE(e.original,"spawn"):null}function Noe(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawnSync"):null}Q3.exports={hookChildProcess:koe,verifyENOENT:Z3,verifyENOENTSync:Noe,notFoundError:lE}});var nB=C((FEe,Va)=>{"use strict";var tB=require("child_process"),fE=J3(),hE=eB();function rB(t,e,r){let n=fE(t,e,r),i=tB.spawn(n.command,n.args,n.options);return hE.hookChildProcess(i,n),i}function $oe(t,e,r){let n=fE(t,e,r),i=tB.spawnSync(n.command,n.args,n.options);return i.error=i.error||hE.verifyENOENTSync(i.status,n),i}Va.exports=rB;Va.exports.spawn=rB;Va.exports.sync=$oe;Va.exports._parse=fE;Va.exports._enoent=hE});var lB=C(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 mE=(he(),ce(fe)),iB=n$(),Loe=r3(),dE=h3(),Dp=m3(),sB=zi(),Boe=require("child_process"),joe=mE.__importDefault(nB()),Moe=mE.__importStar(require("os")),io=mE.__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(io.delimiter).map(oB).join(io.delimiter)}ke.convertPATH=aB;var no=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};ke.SubprocessError=no;var pE=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,dE.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 Dp.WritableStreamBuffer,n=new Dp.WritableStreamBuffer,i=new Dp.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 Dp.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 no("Command not found.",{cause:s}),o.code=ke.ERROR_COMMAND_NOT_FOUND):o=new no("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new no("Signal exit from subprocess."),a.code=ke.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new no("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(io.sep);return r>=0?e.substring(r+1):e}};ke.Subprocess=pE;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 gE=sB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){if(t.includes(io.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||gE}={}){return t.includes(io.sep)?[t]:cB(t,{PATH:e})}ke.findExecutables=Hoe;async function cB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){let n=(0,dE.getPathParts)(e),i;if(sB.TERMINAL_INFO.windows){let s=(0,dE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(io.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=>io.join(o,s)),async o=>(0,Loe.isExecutableFile)(o))))}});var wp=C(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.isInstalled=ns.getCommandOutput=ns.runCommand=void 0;var yE=lB();async function fB(t,e,r={}){let n=new yE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof yE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}ns.runCommand=fB;async function Voe(t,e,r={}){try{return(await fB(t,e,r)).trim()}catch{return null}}ns.getCommandOutput=Voe;async function zoe(t){try{await(0,yE.which)(t)}catch{return!1}return!0}ns.isInstalled=zoe});var Jc=C((NEe,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 Zc=C(($Ee,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 za=C((Mn,pB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:DE,MAX_SAFE_BUILD_LENGTH:Zoe,MAX_LENGTH:Qoe}=Jc(),eae=Zc();Mn=pB.exports={};var tae=Mn.re=[],rae=Mn.safeRe=[],Z=Mn.src=[],nae=Mn.safeSrc=[],Q=Mn.t={},iae=0,wE="[a-zA-Z0-9-]",sae=[["\\s",1],["\\d",Qoe],[wE,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-]${wE}*`);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",`${wE}+`);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,${DE}})(?:\\.(\\d{1,${DE}}))?(?:\\.(\\d{1,${DE}}))?`);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 vp=C((LEe,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 vE=C((BEe,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=C((jEe,vB)=>{"use strict";var Ep=Zc(),{MAX_LENGTH:wB,MAX_SAFE_INTEGER:bp}=Jc(),{safeRe:_p,t:Cp}=za(),fae=vp(),{compareIdentifiers:EE}=vE(),bE=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`);Ep("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?_p[Cp.LOOSE]:_p[Cp.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>bp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>bp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>bp||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<bp)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(Ep("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(Ep("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 EE(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(Ep("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 EE(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?_p[Cp.PRERELEASELOOSE]:_p[Cp.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]),EE(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=bE});var so=C((MEe,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=C((UEe,_B)=>{"use strict";var dae=so(),pae=(t,e)=>{let r=dae(t,e);return r?r.version:null};_B.exports=pae});var AB=C((qEe,SB)=>{"use strict";var mae=so(),gae=(t,e)=>{let r=mae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};SB.exports=gae});var TB=C((HEe,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=C((VEe,PB)=>{"use strict";var IB=so(),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=C((zEe,RB)=>{"use strict";var wae=Xt(),vae=(t,e)=>new wae(t,e).major;RB.exports=vae});var $B=C((KEe,NB)=>{"use strict";var Eae=Xt(),bae=(t,e)=>new Eae(t,e).minor;NB.exports=bae});var BB=C((GEe,LB)=>{"use strict";var _ae=Xt(),Cae=(t,e)=>new _ae(t,e).patch;LB.exports=Cae});var MB=C((WEe,jB)=>{"use strict";var Sae=so(),Aae=(t,e)=>{let r=Sae(t,e);return r&&r.prerelease.length?r.prerelease:null};jB.exports=Aae});var Jr=C((XEe,qB)=>{"use strict";var UB=Xt(),Oae=(t,e,r)=>new UB(t,r).compare(new UB(e,r));qB.exports=Oae});var VB=C((YEe,HB)=>{"use strict";var xae=Jr(),Tae=(t,e,r)=>xae(e,t,r);HB.exports=Tae});var KB=C((JEe,zB)=>{"use strict";var Iae=Jr(),Pae=(t,e)=>Iae(t,e,!0);zB.exports=Pae});var Sp=C((ZEe,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=C((QEe,XB)=>{"use strict";var Rae=Sp(),kae=(t,e)=>t.sort((r,n)=>Rae(r,n,e));XB.exports=kae});var ZB=C((ebe,JB)=>{"use strict";var Nae=Sp(),$ae=(t,e)=>t.sort((r,n)=>Nae(n,r,e));JB.exports=$ae});var Qc=C((tbe,QB)=>{"use strict";var Lae=Jr(),Bae=(t,e,r)=>Lae(t,e,r)>0;QB.exports=Bae});var Ap=C((rbe,ej)=>{"use strict";var jae=Jr(),Mae=(t,e,r)=>jae(t,e,r)<0;ej.exports=Mae});var _E=C((nbe,tj)=>{"use strict";var Uae=Jr(),qae=(t,e,r)=>Uae(t,e,r)===0;tj.exports=qae});var CE=C((ibe,rj)=>{"use strict";var Hae=Jr(),Vae=(t,e,r)=>Hae(t,e,r)!==0;rj.exports=Vae});var Op=C((sbe,nj)=>{"use strict";var zae=Jr(),Kae=(t,e,r)=>zae(t,e,r)>=0;nj.exports=Kae});var xp=C((obe,ij)=>{"use strict";var Gae=Jr(),Wae=(t,e,r)=>Gae(t,e,r)<=0;ij.exports=Wae});var SE=C((abe,sj)=>{"use strict";var Xae=_E(),Yae=CE(),Jae=Qc(),Zae=Op(),Qae=Ap(),eue=xp(),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=C((ube,oj)=>{"use strict";var rue=Xt(),nue=so(),{safeRe:Tp,t:Ip}=za(),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?Tp[Ip.COERCEFULL]:Tp[Ip.COERCE]);else{let u=e.includePrerelease?Tp[Ip.COERCERTLFULL]:Tp[Ip.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=C((cbe,uj)=>{"use strict";var AE=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=AE});var Zr=C((lbe,dj)=>{"use strict";var sue=/\s+/g,OE=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 xE)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 xE(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=OE;var oue=cj(),lj=new oue,aue=vp(),xE=el(),tt=Zc(),uue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:cue,tildeTrimReplace:lue,caretTrimReplace:fue}=za(),{FLAG_INCLUDE_PRERELEASE:hue,FLAG_LOOSE:due}=Jc(),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!==xE.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 el=C((fbe,wj)=>{"use strict";var tl=Symbol("SemVer ANY"),PE=class t{static get ANY(){return tl}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(" "),IE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===tl?this.value="":this.value=this.operator+this.semver.version,IE("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=tl}toString(){return this.value}test(e){if(IE("Comparator.test",e,this.options.loose),this.semver===tl||e===tl)return!0;if(typeof e=="string")try{e=new yj(e,this.options)}catch{return!1}return TE(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("=")||TE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||TE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};wj.exports=PE;var pj=vp(),{safeRe:mj,t:gj}=za(),TE=SE(),IE=Zc(),yj=Xt(),Dj=Zr()});var rl=C((hbe,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=C((dbe,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=C((pbe,_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=C((mbe,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=C((gbe,xj)=>{"use strict";var FE=Xt(),$ue=Zr(),Oj=Qc(),Lue=(t,e)=>{t=new $ue(t,e);let r=new FE("0.0.0");if(t.test(r)||(r=new FE("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 FE(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=C((ybe,Ij)=>{"use strict";var Bue=Zr(),jue=(t,e)=>{try{return new Bue(t,e).range||"*"}catch{return null}};Ij.exports=jue});var Pp=C((Dbe,Nj)=>{"use strict";var Mue=Xt(),kj=el(),{ANY:Uue}=kj,que=Zr(),Hue=rl(),Fj=Qc(),Rj=Ap(),Vue=xp(),zue=Op(),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=C((wbe,$j)=>{"use strict";var Gue=Pp(),Wue=(t,e,r)=>Gue(t,e,">",r);$j.exports=Wue});var jj=C((vbe,Bj)=>{"use strict";var Xue=Pp(),Yue=(t,e,r)=>Xue(t,e,"<",r);Bj.exports=Yue});var qj=C((Ebe,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=C((bbe,Hj)=>{"use strict";var Zue=rl(),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=C((_be,Xj)=>{"use strict";var zj=Zr(),kE=el(),{ANY:RE}=kE,nl=rl(),NE=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 kE(">=0.0.0-0")],Kj=[new kE(">=0.0.0")],rce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===RE){if(e.length===1&&e[0].semver===RE)return!0;r.includePrerelease?t=tce:t=Kj}if(e.length===1&&e[0].semver===RE){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=NE(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&&!nl(f,String(i),r)||s&&!nl(f,String(s),r))return null;for(let p of e)if(!nl(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===">="&&!nl(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==="<="&&!nl(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=NE(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=NE(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Xj.exports=ece});var eM=C((Cbe,Qj)=>{"use strict";var $E=za(),Jj=Jc(),nce=Xt(),Zj=vE(),ice=so(),sce=CB(),oce=AB(),ace=TB(),uce=FB(),cce=kB(),lce=$B(),fce=BB(),hce=MB(),dce=Jr(),pce=VB(),mce=KB(),gce=Sp(),yce=YB(),Dce=ZB(),wce=Qc(),vce=Ap(),Ece=_E(),bce=CE(),_ce=Op(),Cce=xp(),Sce=SE(),Ace=aj(),Oce=el(),xce=Zr(),Tce=rl(),Ice=bj(),Pce=Cj(),Fce=Aj(),Rce=Tj(),kce=Pj(),Nce=Pp(),$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:$E.re,src:$E.src,tokens:$E.t,SEMVER_SPEC_VERSION:Jj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Jj.RELEASE_TYPES,compareIdentifiers:Zj.compareIdentifiers,rcompareIdentifiers:Zj.rcompareIdentifiers}});var hM=C(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 sl=(he(),ce(fe)),tM=zi(),is=Ca(),oo=require("path"),qe=sl.__importDefault(Sa()),Ka=dd(),nM=Cc(),Uce=r$(),rM=$l(),il=Bd(),qce=wp();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`),Vc.checkPaths(t,e,"copy",(i,s)=>{if(i)return n(i);let{srcStat:o,destStat:a}=s;Vc.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=Hc.dirname(r);Die(s,(o,a)=>{if(o)return i(o);if(a)return Hv(t,e,r,n,i);yie(s,u=>u?i(u):Hv(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 Hv(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):sp(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 sp(t,e|128,r)}function O$(t,e,r,n){Aie(e,r,i=>i?n(i):sp(r,t,n))}function sp(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):sp(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=Hc.join(r,e),a=Hc.join(n,e);Vc.checkPaths(o,a,"copy",(u,c)=>{if(u)return s(u);let{destStat:l}=c;Hv(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=Hc.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=Hc.resolve(process.cwd(),u)),Vc.isSrcSubdir(o,u)?i(new Error(`Cannot copy '${o}' to a subdirectory of itself, '${u}'.`)):t.isDirectory()&&Vc.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 Vv=C((Gve,k$)=>{"use strict";var Fie=Re().fromCallback;k$.exports={copy:Fie(R$())}});var H$=C((Wve,q$)=>{"use strict";var N$=vt(),j$=require("path"),He=require("assert"),zc=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 zv(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"&&zc)return L$(t,e,n,r);if(i&&i.isDirectory())return op(t,e,n,r);e.unlink(t,s=>{if(s){if(s.code==="ENOENT")return r(null);if(s.code==="EPERM")return zc?L$(t,e,s,r):op(t,e,s,r);if(s.code==="EISDIR")return op(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()?op(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()?ap(t,e,r):e.unlinkSync(t)}function op(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=>{zv(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"&&zc&&B$(t,e,n)}try{r&&r.isDirectory()?ap(t,e,null):e.unlinkSync(t)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return zc?B$(t,e,n):ap(t,e,n);if(n.code!=="EISDIR")throw n;ap(t,e,n)}}function ap(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)),zc){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=zv;zv.sync=U$});var Kc=C((Xve,z$)=>{"use strict";var Nie=Re().fromCallback,V$=H$();z$.exports={remove:Nie(V$),removeSync:V$.sync}});var Q$=C((Yve,Z$)=>{"use strict";var $ie=Re().fromCallback,W$=vt(),X$=require("path"),Y$=mn(),J$=Kc(),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=C((Jve,rL)=>{"use strict";var Lie=Re().fromCallback,eL=require("path"),ts=vt(),tL=mn();function Bie(t,e){function r(){ts.writeFile(t,"",n=>{if(n)return e(n);e()})}ts.stat(t,(n,i)=>{if(!n&&i.isFile())return e();let s=eL.dirname(t);ts.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():ts.readdir(s,u=>{if(u)return e(u)})})})}function jie(t){let e;try{e=ts.statSync(t)}catch{}if(e&&e.isFile())return;let r=eL.dirname(t);try{ts.statSync(r).isDirectory()||ts.readdirSync(r)}catch(n){if(n&&n.code==="ENOENT")tL.mkdirsSync(r);else throw n}ts.writeFileSync(t,"")}rL.exports={createFile:Lie(Bie),createFileSync:jie}});var uL=C((Zve,aL)=>{"use strict";var Mie=Re().fromCallback,sL=require("path"),to=vt(),oL=mn(),iL=es().pathExists;function Uie(t,e,r){function n(i,s){to.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);to.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(to.existsSync(e))return;try{to.lstatSync(t)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let n=sL.dirname(e);return to.existsSync(n)||oL.mkdirsSync(n),to.linkSync(t,e)}aL.exports={createLink:Mie(Uie),createLinkSync:qie}});var lL=C((Qve,cL)=>{"use strict";var rs=require("path"),Gc=vt(),Hie=es().pathExists;function Vie(t,e,r){if(rs.isAbsolute(t))return Gc.lstat(t,n=>n?(n.message=n.message.replace("lstat","ensureSymlink"),r(n)):r(null,{toCwd:t,toDst:t}));{let n=rs.dirname(e),i=rs.join(n,t);return Hie(i,(s,o)=>s?r(s):o?r(null,{toCwd:i,toDst:t}):Gc.lstat(t,a=>a?(a.message=a.message.replace("lstat","ensureSymlink"),r(a)):r(null,{toCwd:t,toDst:rs.relative(n,t)})))}}function zie(t,e){let r;if(rs.isAbsolute(t)){if(r=Gc.existsSync(t),!r)throw new Error("absolute srcpath does not exist");return{toCwd:t,toDst:t}}else{let n=rs.dirname(e),i=rs.join(n,t);if(r=Gc.existsSync(i),r)return{toCwd:i,toDst:t};if(r=Gc.existsSync(t),!r)throw new Error("relative srcpath does not exist");return{toCwd:t,toDst:rs.relative(n,t)}}}cL.exports={symlinkPaths:Vie,symlinkPathsSync:zie}});var dL=C((eEe,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=C((tEe,wL)=>{"use strict";var Wie=Re().fromCallback,mL=require("path"),Ua=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=es().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 Ua.symlink(t,e,c,n);Xie(l,f=>{if(f)return n(f);Ua.symlink(t,e,c,n)})})})})})}function rse(t,e,r){if(Ua.existsSync(e))return;let i=Zie(t,e);t=i.toDst,r=ese(i.toCwd,r);let s=mL.dirname(e);return Ua.existsSync(s)||Yie(s),Ua.symlinkSync(t,e,r)}wL.exports={createSymlink:Wie(tse),createSymlinkSync:rse}});var bL=C((rEe,EL)=>{"use strict";var up=nL(),cp=uL(),lp=vL();EL.exports={createFile:up.createFile,createFileSync:up.createFileSync,ensureFile:up.createFile,ensureFileSync:up.createFileSync,createLink:cp.createLink,createLinkSync:cp.createLinkSync,ensureLink:cp.createLink,ensureLinkSync:cp.createLinkSync,createSymlink:lp.createSymlink,createSymlinkSync:lp.createSymlinkSync,ensureSymlink:lp.createSymlink,ensureSymlinkSync:lp.createSymlinkSync}});var CL=C((nEe,_L)=>{"use strict";var fp=k0();_L.exports={readJson:fp.readFile,readJsonSync:fp.readFileSync,writeJson:fp.writeFile,writeJsonSync:fp.writeFileSync}});var hp=C((iEe,OL)=>{"use strict";var nse=Re().fromCallback,Wc=vt(),SL=require("path"),AL=mn(),ise=es().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 Wc.writeFile(t,e,r,n);AL.mkdirs(i,a=>{if(a)return n(a);Wc.writeFile(t,e,r,n)})})}function ose(t,...e){let r=SL.dirname(t);if(Wc.existsSync(r))return Wc.writeFileSync(t,...e);AL.mkdirsSync(r),Wc.writeFileSync(t,...e)}OL.exports={outputFile:nse(sse),outputFileSync:ose}});var TL=C((sEe,xL)=>{"use strict";var{stringify:ase}=ba(),{outputFile:use}=hp();async function cse(t,e,r={}){let n=ase(e,r);await use(t,n,r)}xL.exports=cse});var PL=C((oEe,IL)=>{"use strict";var{stringify:lse}=ba(),{outputFileSync:fse}=hp();function hse(t,e,r){let n=lse(e,r);fse(t,n,r)}IL.exports=hse});var RL=C((aEe,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=C((uEe,BL)=>{"use strict";var $L=vt(),pse=require("path"),mse=qv().copySync,LL=Kc().removeSync,gse=mn().mkdirpSync,kL=Mc();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=C((cEe,ML)=>{"use strict";ML.exports={moveSync:jL()}});var KL=C((lEe,zL)=>{"use strict";var vse=vt(),Ese=require("path"),bse=Vv().copy,VL=Kc().remove,_se=mn().mkdirp,Cse=es().pathExists,qL=Mc();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=C((fEe,GL)=>{"use strict";var xse=Re().fromCallback;GL.exports={move:xse(KL())}});var dp=C((hEe,Kv)=>{"use strict";Kv.exports={...jc(),...qv(),...Vv(),...Q$(),...bL(),...RL(),...mn(),...UL(),...WL(),...hp(),...es(),...Kc()};var XL=require("fs");Object.getOwnPropertyDescriptor(XL,"promises")&&Object.defineProperty(Kv.exports,"promises",{get(){return XL.promises}})});var Gv=C(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});qa.readdir=qa.stat=void 0;var YL=dp();async function Tse(t){try{return await YL.stat(t)}catch{}}qa.stat=Tse;async function Ise(t){try{return await YL.readdir(t)}catch{return[]}}qa.readdir=Ise});var r3=C(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=dp(),Fse=require("os"),Di=require("path"),JL=require("stream"),ZL=Gv();Pse.__exportStar(dp(),me);var QL=Gv();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=Xv(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),Xv(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 Wv(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=Wv;async function $se(t){return Promise.all([Wv(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 Wv(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 Xc(t,e){try{await Yr.access(t,e)}catch{return!1}return!0}me.pathAccessible=Xc;async function jse(t){return Xc(t,Yr.constants.F_OK)}me.pathExists=jse;async function Mse(t){return Xc(t,Yr.constants.R_OK)}me.pathReadable=Mse;async function Use(t){return Xc(t,Yr.constants.W_OK)}me.pathWritable=Use;async function e3(t){return Xc(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 pp=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=pp;function Xv(t,e={}){return new pp(t,e)}me.walk=Xv});var n3=C(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)=>mp(e)in t,get:(t,e)=>t[mp(e)],set:(t,e,r)=>(t[mp(e)]=r,!0),deleteProperty:(t,e)=>delete t[mp(e)]};var mp=t=>typeof t=="string"?t.toLowerCase():t,Yv=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=Yv});var c3=C((gEe,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":Jv(t,n,i,function(s){return i3("pgrep",["-P",s])},function(){s3(n,e,r)});break;default:Jv(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 Jv(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,Jv(c,e,r,n,i)})};s.on("close",a)}});var h3=C(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 Zv=(he(),ce(fe)),Gse=n3(),Wse=zi(),Xse=Jh(),Yse=Zv.__importStar(require("path")),Jse=Zv.__importDefault(Mh()),Zse=Zv.__importDefault(c3()),ro=(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 ro("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)(()=>{ro("onExit: process.exit/normal shutdown"),t()})}et.onExit=ioe;var gp=new Set;function soe(t){gp.add(t)}et.onBeforeExit=soe;function ooe(t){gp.delete(t)}et.offBeforeExit=ooe;var aoe=t=>{let e=!1;return async()=>{e||(await t(),e=!0)}},Yc=t=>aoe(async()=>{ro("onBeforeExit handler: %O received",t),ro("onBeforeExit handler: running %O functions",gp.size),await Promise.all([...gp.values()].map(async e=>{try{await e()}catch(r){ro("onBeforeExit handler: error from function: %O",r)}})),t!=="process.exit"&&(ro("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:Yc("SIGINT"),SIGTERM:Yc("SIGTERM"),SIGHUP:Yc("SIGHUP"),SIGBREAK:Yc("SIGBREAK")};for(let[t,e]of Object.entries(f3))process.on(t,e);var uoe=Yc("process.exit");async function coe(t=0){process.exitCode=t,await uoe(),ro("processExit: exiting (exit code: %O)",process.exitCode),process.exit()}et.processExit=coe});var m3=C(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.growBufferForAppendedData=jn.WritableStreamBuffer=jn.ReadableStreamBuffer=jn.NullStream=void 0;var rE=require("stream"),loe=4,d3=32,p3=16,Qv=class extends rE.Writable{_write(e,r,n){n()}};jn.NullStream=Qv;var eE=class extends rE.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=nE(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=eE;var tE=class extends rE.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=nE(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=tE;function nE(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=nE});var v3=C((wEe,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=C((vEe,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=C((bEe,A3)=>{var EEe=require("fs"),yp;process.platform==="win32"||global.TESTING_WINDOWS?yp=v3():yp=S3();A3.exports=iE;iE.sync=moe;function iE(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){iE(t,e||{},function(s,o){s?i(s):n(o)})})}yp(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 yp.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var k3=C((_Ee,R3)=>{var Ha=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x3=require("path"),goe=Ha?";":":",T3=O3(),I3=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),P3=(t,e)=>{let r=e.colon||goe,n=t.match(/\//)||Ha&&t.match(/\\/)?[""]:[...Ha?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Ha?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ha?i.split(r):[""];return Ha&&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),g=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;l(u(g,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},(g,v)=>{if(!g&&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=C((CEe,sE)=>{"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"};sE.exports=N3;sE.exports.default=N3});var M3=C((SEe,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=C((AEe,aE)=>{"use strict";var oE=/([()\][%!^"`<>&|;, *?])/g;function Eoe(t){return t=t.replace(oE,"^$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(oE,"^$1"),e&&(t=t.replace(oE,"^$1")),t}aE.exports.command=Eoe;aE.exports.argument=boe});var H3=C((OEe,q3)=>{"use strict";q3.exports=/^#!(.*)/});var z3=C((xEe,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=C((TEe,K3)=>{"use strict";var uE=require("fs"),Coe=z3();function Soe(t){let r=Buffer.alloc(150),n;try{n=uE.openSync(t,"r"),uE.readSync(n,r,0,150,0),uE.closeSync(n)}catch{}return Coe(r.toString())}K3.exports=Soe});var J3=C((IEe,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=C((PEe,Q3)=>{"use strict";var cE=process.platform==="win32";function lE(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(!cE)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 cE&&t===1&&!e.file?lE(e.original,"spawn"):null}function Noe(t,e){return cE&&t===1&&!e.file?lE(e.original,"spawnSync"):null}Q3.exports={hookChildProcess:koe,verifyENOENT:Z3,verifyENOENTSync:Noe,notFoundError:lE}});var nB=C((FEe,Va)=>{"use strict";var tB=require("child_process"),fE=J3(),hE=eB();function rB(t,e,r){let n=fE(t,e,r),i=tB.spawn(n.command,n.args,n.options);return hE.hookChildProcess(i,n),i}function $oe(t,e,r){let n=fE(t,e,r),i=tB.spawnSync(n.command,n.args,n.options);return i.error=i.error||hE.verifyENOENTSync(i.status,n),i}Va.exports=rB;Va.exports.spawn=rB;Va.exports.sync=$oe;Va.exports._parse=fE;Va.exports._enoent=hE});var lB=C(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 mE=(he(),ce(fe)),iB=n$(),Loe=r3(),dE=h3(),Dp=m3(),sB=zi(),Boe=require("child_process"),joe=mE.__importDefault(nB()),Moe=mE.__importStar(require("os")),io=mE.__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(io.delimiter).map(oB).join(io.delimiter)}ke.convertPATH=aB;var no=class extends Error{constructor(){super(...arguments),this.name="SubprocessError"}};ke.SubprocessError=no;var pE=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,dE.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 Dp.WritableStreamBuffer,n=new Dp.WritableStreamBuffer,i=new Dp.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 Dp.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 no("Command not found.",{cause:s}),o.code=ke.ERROR_COMMAND_NOT_FOUND):o=new no("Command error.",{cause:s}),i(o)}),e.on("close",(s,o)=>{let a;if(s===0)return n();if(o)a=new no("Signal exit from subprocess."),a.code=ke.ERROR_SIGNAL_EXIT,a.signal=o;else if(s)a=new no("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(io.sep);return r>=0?e.substring(r+1):e}};ke.Subprocess=pE;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 gE=sB.TERMINAL_INFO.windows?".COM;.EXE;.BAT;.CMD":void 0;async function qoe(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){if(t.includes(io.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||gE}={}){return t.includes(io.sep)?[t]:cB(t,{PATH:e})}ke.findExecutables=Hoe;async function cB(t,{PATH:e=process.env.PATH,PATHEXT:r=process.env.PATHEXT||gE}={}){let n=(0,dE.getPathParts)(e),i;if(sB.TERMINAL_INFO.windows){let s=(0,dE.getPathParts)(r).map(o=>o.toLowerCase());i=s.includes(io.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=>io.join(o,s)),async o=>(0,Loe.isExecutableFile)(o))))}});var wp=C(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.isInstalled=ns.getCommandOutput=ns.runCommand=void 0;var yE=lB();async function fB(t,e,r={}){let n=new yE.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof yE.SubprocessError?i.output?i.output:i.cause?`${i.message} ${i.cause.toString()}`:i.code?i.code:"Unknown error":i}}ns.runCommand=fB;async function Voe(t,e,r={}){try{return(await fB(t,e,r)).trim()}catch{return null}}ns.getCommandOutput=Voe;async function zoe(t){try{await(0,yE.which)(t)}catch{return!1}return!0}ns.isInstalled=zoe});var Jc=C((NEe,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 Zc=C(($Ee,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 za=C((Mn,pB)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:DE,MAX_SAFE_BUILD_LENGTH:Zoe,MAX_LENGTH:Qoe}=Jc(),eae=Zc();Mn=pB.exports={};var tae=Mn.re=[],rae=Mn.safeRe=[],Z=Mn.src=[],nae=Mn.safeSrc=[],Q=Mn.t={},iae=0,wE="[a-zA-Z0-9-]",sae=[["\\s",1],["\\d",Qoe],[wE,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-]${wE}*`);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",`${wE}+`);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,${DE}})(?:\\.(\\d{1,${DE}}))?(?:\\.(\\d{1,${DE}}))?`);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 vp=C((LEe,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 vE=C((BEe,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=C((jEe,vB)=>{"use strict";var Ep=Zc(),{MAX_LENGTH:wB,MAX_SAFE_INTEGER:bp}=Jc(),{safeRe:_p,t:Cp}=za(),fae=vp(),{compareIdentifiers:EE}=vE(),bE=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`);Ep("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?_p[Cp.LOOSE]:_p[Cp.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>bp||this.major<0)throw new TypeError("Invalid major version");if(this.minor>bp||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>bp||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<bp)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(Ep("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(Ep("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 EE(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(Ep("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 EE(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?_p[Cp.PRERELEASELOOSE]:_p[Cp.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]),EE(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=bE});var so=C((MEe,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=C((UEe,_B)=>{"use strict";var dae=so(),pae=(t,e)=>{let r=dae(t,e);return r?r.version:null};_B.exports=pae});var AB=C((qEe,SB)=>{"use strict";var mae=so(),gae=(t,e)=>{let r=mae(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};SB.exports=gae});var TB=C((HEe,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=C((VEe,PB)=>{"use strict";var IB=so(),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=C((zEe,RB)=>{"use strict";var wae=Xt(),vae=(t,e)=>new wae(t,e).major;RB.exports=vae});var $B=C((KEe,NB)=>{"use strict";var Eae=Xt(),bae=(t,e)=>new Eae(t,e).minor;NB.exports=bae});var BB=C((GEe,LB)=>{"use strict";var _ae=Xt(),Cae=(t,e)=>new _ae(t,e).patch;LB.exports=Cae});var MB=C((WEe,jB)=>{"use strict";var Sae=so(),Aae=(t,e)=>{let r=Sae(t,e);return r&&r.prerelease.length?r.prerelease:null};jB.exports=Aae});var Jr=C((XEe,qB)=>{"use strict";var UB=Xt(),Oae=(t,e,r)=>new UB(t,r).compare(new UB(e,r));qB.exports=Oae});var VB=C((YEe,HB)=>{"use strict";var xae=Jr(),Tae=(t,e,r)=>xae(e,t,r);HB.exports=Tae});var KB=C((JEe,zB)=>{"use strict";var Iae=Jr(),Pae=(t,e)=>Iae(t,e,!0);zB.exports=Pae});var Sp=C((ZEe,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=C((QEe,XB)=>{"use strict";var Rae=Sp(),kae=(t,e)=>t.sort((r,n)=>Rae(r,n,e));XB.exports=kae});var ZB=C((ebe,JB)=>{"use strict";var Nae=Sp(),$ae=(t,e)=>t.sort((r,n)=>Nae(n,r,e));JB.exports=$ae});var Qc=C((tbe,QB)=>{"use strict";var Lae=Jr(),Bae=(t,e,r)=>Lae(t,e,r)>0;QB.exports=Bae});var Ap=C((rbe,ej)=>{"use strict";var jae=Jr(),Mae=(t,e,r)=>jae(t,e,r)<0;ej.exports=Mae});var _E=C((nbe,tj)=>{"use strict";var Uae=Jr(),qae=(t,e,r)=>Uae(t,e,r)===0;tj.exports=qae});var CE=C((ibe,rj)=>{"use strict";var Hae=Jr(),Vae=(t,e,r)=>Hae(t,e,r)!==0;rj.exports=Vae});var Op=C((sbe,nj)=>{"use strict";var zae=Jr(),Kae=(t,e,r)=>zae(t,e,r)>=0;nj.exports=Kae});var xp=C((obe,ij)=>{"use strict";var Gae=Jr(),Wae=(t,e,r)=>Gae(t,e,r)<=0;ij.exports=Wae});var SE=C((abe,sj)=>{"use strict";var Xae=_E(),Yae=CE(),Jae=Qc(),Zae=Op(),Qae=Ap(),eue=xp(),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=C((ube,oj)=>{"use strict";var rue=Xt(),nue=so(),{safeRe:Tp,t:Ip}=za(),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?Tp[Ip.COERCEFULL]:Tp[Ip.COERCE]);else{let u=e.includePrerelease?Tp[Ip.COERCERTLFULL]:Tp[Ip.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=C((cbe,uj)=>{"use strict";var AE=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=AE});var Zr=C((lbe,dj)=>{"use strict";var sue=/\s+/g,OE=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 xE)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 xE(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=OE;var oue=cj(),lj=new oue,aue=vp(),xE=el(),tt=Zc(),uue=Xt(),{safeRe:lr,t:Yt,comparatorTrimReplace:cue,tildeTrimReplace:lue,caretTrimReplace:fue}=za(),{FLAG_INCLUDE_PRERELEASE:hue,FLAG_LOOSE:due}=Jc(),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!==xE.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 el=C((fbe,wj)=>{"use strict";var tl=Symbol("SemVer ANY"),PE=class t{static get ANY(){return tl}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(" "),IE("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===tl?this.value="":this.value=this.operator+this.semver.version,IE("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=tl}toString(){return this.value}test(e){if(IE("Comparator.test",e,this.options.loose),this.semver===tl||e===tl)return!0;if(typeof e=="string")try{e=new yj(e,this.options)}catch{return!1}return TE(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("=")||TE(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||TE(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};wj.exports=PE;var pj=vp(),{safeRe:mj,t:gj}=za(),TE=SE(),IE=Zc(),yj=Xt(),Dj=Zr()});var rl=C((hbe,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=C((dbe,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=C((pbe,_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=C((mbe,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=C((gbe,xj)=>{"use strict";var FE=Xt(),$ue=Zr(),Oj=Qc(),Lue=(t,e)=>{t=new $ue(t,e);let r=new FE("0.0.0");if(t.test(r)||(r=new FE("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 FE(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=C((ybe,Ij)=>{"use strict";var Bue=Zr(),jue=(t,e)=>{try{return new Bue(t,e).range||"*"}catch{return null}};Ij.exports=jue});var Pp=C((Dbe,Nj)=>{"use strict";var Mue=Xt(),kj=el(),{ANY:Uue}=kj,que=Zr(),Hue=rl(),Fj=Qc(),Rj=Ap(),Vue=xp(),zue=Op(),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=C((wbe,$j)=>{"use strict";var Gue=Pp(),Wue=(t,e,r)=>Gue(t,e,">",r);$j.exports=Wue});var jj=C((vbe,Bj)=>{"use strict";var Xue=Pp(),Yue=(t,e,r)=>Xue(t,e,"<",r);Bj.exports=Yue});var qj=C((Ebe,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=C((bbe,Hj)=>{"use strict";var Zue=rl(),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=C((_be,Xj)=>{"use strict";var zj=Zr(),kE=el(),{ANY:RE}=kE,nl=rl(),NE=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 kE(">=0.0.0-0")],Kj=[new kE(">=0.0.0")],rce=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===RE){if(e.length===1&&e[0].semver===RE)return!0;r.includePrerelease?t=tce:t=Kj}if(e.length===1&&e[0].semver===RE){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=NE(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&&!nl(f,String(i),r)||s&&!nl(f,String(s),r))return null;for(let p of e)if(!nl(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===">="&&!nl(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==="<="&&!nl(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=NE(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=NE(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Xj.exports=ece});var eM=C((Cbe,Qj)=>{"use strict";var $E=za(),Jj=Jc(),nce=Xt(),Zj=vE(),ice=so(),sce=CB(),oce=AB(),ace=TB(),uce=FB(),cce=kB(),lce=$B(),fce=BB(),hce=MB(),dce=Jr(),pce=VB(),mce=KB(),gce=Sp(),yce=YB(),Dce=ZB(),wce=Qc(),vce=Ap(),Ece=_E(),bce=CE(),_ce=Op(),Cce=xp(),Sce=SE(),Ace=aj(),Oce=el(),xce=Zr(),Tce=rl(),Ice=bj(),Pce=Cj(),Fce=Aj(),Rce=Tj(),kce=Pj(),Nce=Pp(),$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:$E.re,src:$E.src,tokens:$E.t,SEMVER_SPEC_VERSION:Jj.SEMVER_SPEC_VERSION,RELEASE_TYPES:Jj.RELEASE_TYPES,compareIdentifiers:Zj.compareIdentifiers,rcompareIdentifiers:Zj.rcompareIdentifiers}});var hM=C(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 sl=(he(),ce(fe)),tM=zi(),is=Ca(),oo=require("path"),qe=sl.__importDefault(Sa()),Ka=dd(),nM=Cc(),Uce=r$(),rM=$l(),il=Bd(),qce=wp();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,is.pathExists)(t.app.webDirAbs)?await(0,is.pathExists)((0,oo.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,is.pathExists)("package.json")||await(0,is.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
|
|
@@ -236,9 +236,9 @@ Please follow the Upgrade Guide to move ${ao.default.strong("public")} inside th
|
|
|
236
236
|
const config: CapacitorConfig = ${(0,Dle.formatJSObject)(t)};
|
|
237
237
|
|
|
238
238
|
export default config;
|
|
239
|
-
`}});function Nle(){try{return zE.default.statSync("/.dockerenv"),!0}catch{return!1}}function $le(){try{return zE.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function KE(){return VE===void 0&&(VE=Nle()||$le()),VE}var zE,VE,EM=mr(()=>{zE=Ee(require("node:fs"),1)});function Xa(){return GE===void 0&&(GE=Lle()||KE()),GE}var bM,GE,Lle,WE=mr(()=>{bM=Ee(require("node:fs"),1);EM();Lle=()=>{try{return bM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var XE,CM,SM,_M,
|
|
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 ib(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 jp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=WM[n];if(!i)throw new jp(`Unknown browser ID: ${n}`);return i}var KM,GM,Vle,WM,nb,jp,sb=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"}},nb=new Map(Object.entries(WM)),jp=class extends Error{}});async function ob(){if(Mp.default.platform==="darwin"){let t=await eb();return{name:await rb(t),id:t}}if(Mp.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(Mp.default.platform==="win32")return ib();throw new Error("Only macOS, Linux, and Windows are supported")}var XM,Mp,YM,zle,Kle,JM=mr(()=>{XM=require("node:util"),Mp=Ee(require("node:process"),1),YM=require("node:child_process");MM();zM();sb();sb();zle=(0,XM.promisify)(YM.execFile),Kle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Up,Gle,ZM,QM=mr(()=>{Up=Ee(require("node:process"),1),Gle=!!(Up.default.env.SSH_CONNECTION||Up.default.env.SSH_CLIENT||Up.default.env.SSH_TTY),ZM=Gle});var lb={};Sm(lb,{apps:()=>lo,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 ul({[Ya]:t},{wsl:e}={}){if(e&&wi)return n8(e);if(!t)throw new Error(`${Ya} is not supported`);return n8(t)}var ub,cb,s8,o8,Hp,i8,qp,ab,e8,Ya,t8,r8,al,Wle,Xle,lo,Yle,fb=mr(()=>{ub=Ee(require("node:process"),1),cb=Ee(require("node:path"),1),s8=require("node:url"),o8=Ee(require("node:child_process"),1),Hp=Ee(require("node:fs/promises"),1);NM();QE();$M();JM();WE();QM();i8={},qp=Symbol("fallbackAttempt"),ab=i8.url?cb.default.dirname((0,s8.fileURLToPath)(i8.url)):"",e8=cb.default.join(ab,"xdg-open"),{platform:Ya,arch:t8}=ub.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")},al=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[qp]===!0;if(delete t[qp],Array.isArray(t.app))return r8(t.app,c=>al({...t,app:c,[qp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return r8(r,c=>al({...t,app:{name:c,arguments:n},[qp]:!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(wi){let d=await RM();h=nb.get(d)??{}}else h=await ob();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 al({...t,app:{name:lo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(wi&&!Xa()&&!ZM&&!r&&(a=await FM()),Ya==="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(Ya==="win32"||a){i=await Bp(),s.push(...Nr.argumentsPrefix),wi||(o.windowsVerbatimArguments=!0),wi&&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=!ab||ab==="/",l=!1;try{await Hp.default.access(e8,Hp.constants.X_OK),l=!0}catch{}i=ub.default.versions.electron??(Ya==="android"||c||!l)?"xdg-open":e8}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ya==="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 al({...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 al({...e,app:{name:t,arguments:r}})};lo={browser:"browser",browserPrivate:"browserPrivate"};co(lo,"chrome",()=>ul({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"]}}));co(lo,"brave",()=>ul({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"]}}));co(lo,"firefox",()=>ul({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));co(lo,"edge",()=>ul({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));co(lo,"safari",()=>ul({darwin:"Safari"}));Yle=Wle});var pm=C(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 mm=C((QCe,I6)=>{"use strict";var T6=pm();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=C((eSe,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=C((tSe,M6)=>{"use strict";var R6=F6(),Do=(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(Do.cache.hasOwnProperty(u))return Do.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}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 g=l<0?Math.abs(l):1;p=k6(g,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=jfe(p,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+p.length>1&&(d.result=`(?:${d.result})`),Do.cache[u]=d,d.result};function jfe(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 Mfe(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(Hfe),s}function Ufe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=qfe(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+=Vfe(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=Mfe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=Ufe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+B6(a.count),o=c+1;continue}r.isPadded&&(h=zfe(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 qfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function Hfe(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 Vfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function j6(t){return/^-?(0+)\d/.test(t)}function zfe(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}}`}}Do.cache={};Do.clearCache=()=>Do.cache={};M6.exports=Do});var Rb=C((rSe,W6)=>{"use strict";var Kfe=require("util"),H6=U6(),q6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Gfe=t=>e=>t===!0?Number(e):String(e),Pb=t=>typeof t=="number"||typeof t=="string"&&t!=="",vl=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},Wfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Xfe=(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},ym=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Yfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>ym(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>ym(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: "+Kfe.inspect(...t)),G6=(t,e,r)=>{if(r.strictRanges===!0)throw K6([t,e]);return[]},Jfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Zfe=(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&&Wfe(t,e,n)===!1,f=n.transform||Gfe(d);if(n.toRegex&&r===1)return V6(ym(t,h),ym(e,h),!0,n);let p={negatives:[],positives:[]},g=A=>p[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?g(i):v.push(Xfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Yfe(p,n,h):z6(v,null,{wrap:!1,...n}):v},Qfe=(t,e,r=1,n={})=>{if(!vl(t)&&t.length>1||!vl(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},gm=(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 gm(t,e,1,{transform:r});if(q6(r))return gm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,vl(r)?vl(t)&&vl(e)?Zfe(t,e,r,i):Qfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!q6(r)?Jfe(r,i):gm(t,e,1,r)};W6.exports=gm});var J6=C((nSe,Y6)=>{"use strict";var ehe=Rb(),X6=pm(),the=(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=ehe(...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=the});var eU=C((iSe,Q6)=>{"use strict";var rhe=Rb(),Z6=mm(),lu=pm(),wo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?lu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(wo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?wo(i,s,r):i+s);return lu.flatten(n)},nhe=(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(wo(a.pop(),Z6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(wo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=lu.reduce(i.nodes);if(lu.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=rhe(...h,e);d.length===0&&(d=Z6(i,e)),a.push(wo(a.pop(),d)),i.nodes=[];return}let u=lu.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(wo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(wo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return lu.flatten(n(t))};Q6.exports=nhe});var rU=C((sSe,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=C((oSe,oU)=>{"use strict";var ihe=mm(),{MAX_LENGTH:nU,CHAR_BACKSLASH:kb,CHAR_BACKTICK:she,CHAR_COMMA:ohe,CHAR_DOT:ahe,CHAR_LEFT_PARENTHESES:uhe,CHAR_RIGHT_PARENTHESES:che,CHAR_LEFT_CURLY_BRACE:lhe,CHAR_RIGHT_CURLY_BRACE:fhe,CHAR_LEFT_SQUARE_BRACKET:iU,CHAR_RIGHT_SQUARE_BRACKET:sU,CHAR_DOUBLE_QUOTE:hhe,CHAR_SINGLE_QUOTE:dhe,CHAR_NO_BREAK_SPACE:phe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:mhe}=rU(),ghe=(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=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(p({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===mhe||d===phe)){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 g;for(;l<c&&(g=f());){if(d+=g,g===iU){u++;continue}if(g===kb){d+=f();continue}if(g===sU&&(u--,u===0))break}p({type:"text",value:d});continue}if(d===uhe){o=p({type:"paren",nodes:[]}),s.push(o),p({type:"text",value:d});continue}if(d===che){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===hhe||d===dhe||d===she){let g=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===kb){d+=v+f();continue}if(v===g){e.keepQuotes===!0&&(d+=v);break}d+=v}p({type:"text",value:d});continue}if(d===lhe){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===fhe){if(o.type!=="brace"){p({type:"text",value:d});continue}let g="close";o=s.pop(),o.close=!0,p({type:g,value:d}),h--,o=s[s.length-1];continue}if(d===ohe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:ihe(o)}]}p({type:"comma",value:d}),o.commas++;continue}if(d===ahe&&h>0&&o.commas===0){let g=o.nodes;if(h===0||g.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"){g.pop();let v=g[g.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 g=s[s.length-1],v=g.nodes.indexOf(o);g.nodes.splice(v,1,...o.nodes)}while(s.length>0);return p({type:"eos"}),i};oU.exports=ghe});var lU=C((aSe,cU)=>{"use strict";var uU=mm(),yhe=J6(),Dhe=eU(),whe=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={})=>whe(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)),yhe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=Dhe(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 El=C((uSe,mU)=>{"use strict";var vhe=require("path"),Kn="\\\\/",fU=`[^${Kn}]`,Ai="\\.",Ehe="\\+",bhe="\\?",Dm="\\/",_he="(?=.)",hU="[^/]",Nb=`(?:${Dm}|$)`,dU=`(?:^|${Dm})`,$b=`${Ai}{1,2}${Nb}`,Che=`(?!${Ai})`,She=`(?!${dU}${$b})`,Ahe=`(?!${Ai}{0,1}${Nb})`,Ohe=`(?!${$b})`,xhe=`[^.${Dm}]`,The=`${hU}*?`,pU={DOT_LITERAL:Ai,PLUS_LITERAL:Ehe,QMARK_LITERAL:bhe,SLASH_LITERAL:Dm,ONE_CHAR:_he,QMARK:hU,END_ANCHOR:Nb,DOTS_SLASH:$b,NO_DOT:Che,NO_DOTS:She,NO_DOT_SLASH:Ahe,NO_DOTS_SLASH:Ohe,QMARK_NO_DOT:xhe,STAR:The,START_ANCHOR:dU},Ihe={...pU,SLASH_LITERAL:`[${Kn}]`,QMARK:fU,STAR:`${fU}*?`,DOTS_SLASH:`${Ai}{1,2}(?:[${Kn}]|$)`,NO_DOT:`(?!${Ai})`,NO_DOTS:`(?!(?:^|[${Kn}])${Ai}{1,2}(?:[${Kn}]|$))`,NO_DOT_SLASH:`(?!${Ai}{0,1}(?:[${Kn}]|$))`,NO_DOTS_SLASH:`(?!${Ai}{1,2}(?:[${Kn}]|$))`,QMARK_NO_DOT:`[^.${Kn}]`,START_ANCHOR:`(?:^|[${Kn}])`,END_ANCHOR:`(?:[${Kn}]|$)`},Phe={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:Phe,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:vhe.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?Ihe:pU}}});var bl=C(Tr=>{"use strict";var Fhe=require("path"),Rhe=process.platform==="win32",{REGEX_BACKSLASH:khe,REGEX_REMOVE_BACKSLASH:Nhe,REGEX_SPECIAL_CHARS:$he,REGEX_SPECIAL_CHARS_GLOBAL:Lhe}=El();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>$he.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace(Lhe,"\\$1");Tr.toPosixSlashes=t=>t.replace(khe,"/");Tr.removeBackslashes=t=>t.replace(Nhe,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:Rhe===!0||Fhe.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=C((lSe,bU)=>{"use strict";var gU=bl(),{CHAR_ASTERISK:Lb,CHAR_AT:Bhe,CHAR_BACKWARD_SLASH:_l,CHAR_COMMA:jhe,CHAR_DOT:Bb,CHAR_EXCLAMATION_MARK:jb,CHAR_FORWARD_SLASH:EU,CHAR_LEFT_CURLY_BRACE:Mb,CHAR_LEFT_PARENTHESES:Ub,CHAR_LEFT_SQUARE_BRACKET:Mhe,CHAR_PLUS:Uhe,CHAR_QUESTION_MARK:yU,CHAR_RIGHT_CURLY_BRACE:qhe,CHAR_RIGHT_PARENTHESES:DU,CHAR_RIGHT_SQUARE_BRACKET:Hhe}=El(),wU=t=>t===EU||t===_l,vU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Vhe=(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,g=!1,v=!1,E=!1,A=!1,m=!1,D=!1,w=!1,S=0,F,_,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=_,u.charCodeAt(++c));for(;c<n;){_=B();let T;if(_===_l){A=k.backslashes=!0,_=B(),_===Mb&&(E=!0);continue}if(E===!0||_===Mb){for(S++;R()!==!0&&(_=B());){if(_===_l){A=k.backslashes=!0,B();continue}if(_===Mb){S++;continue}if(E!==!0&&_===Bb&&(_=B())===Bb){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&_===jhe){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===qhe&&(S--,S===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(_===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&&(_===Uhe||_===Bhe||_===Lb||_===yU||_===jb)===!0&&I()===Ub){if(p=k.isGlob=!0,g=k.isExtglob=!0,w=!0,_===jb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(_=B());){if(_===_l){A=k.backslashes=!0,_=B();continue}if(_===DU){p=k.isGlob=!0,w=!0;break}}continue}break}if(_===Lb){if(F===Lb&&(v=k.isGlobstar=!0),p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===yU){if(p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===Mhe){for(;R()!==!0&&(T=B());){if(T===_l){A=k.backslashes=!0,B();continue}if(T===Hhe){f=k.isBracket=!0,p=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&_===jb&&c===l){m=k.negated=!0,l++;continue}if(r.noparen!==!0&&_===Ub){if(p=k.isGlob=!0,i===!0){for(;R()!==!0&&(_=B());){if(_===Ub){A=k.backslashes=!0,_=B();continue}if(_===DU){w=!0;break}}continue}break}if(p===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(g=!1,p=!1);let j=u,K="",L="";l>0&&(K=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 b={prefix:K,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:p,isExtglob:g,isGlobstar:v,negated:m,negatedExtglob:D};if(r.tokens===!0&&(b.maxDepth=0,wU(_)||o.push(k),b.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=K):o[P].value=M,vU(o[P]),b.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]),b.maxDepth+=o[o.length-1].depth)}b.slashes=s,b.parts=a}return b};bU.exports=Vhe});var AU=C((fSe,SU)=>{"use strict";var wm=El(),jr=bl(),{MAX_LENGTH:vm,POSIX_REGEX_SOURCE:zhe,REGEX_NON_SPECIAL_CHARS:Khe,REGEX_SPECIAL_CHARS_BACKREF:Ghe,REPLACEMENTS:CU}=wm,Whe=(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},fu=(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(vm,r.maxLength):vm,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=wm.globChars(u),l=wm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:g,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:m,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:S}=c,F=N=>`(${a}(?:(?!${S}${N.dot?g:h}).)*?)`,_=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=[],K=[],L=s,b,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]++,K.push(N)},te=N=>{I[N]--,K.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(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 z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=I.parens,z.output=I.output;let oe=(r.capture?"(":"")+z.open;H("parens"),x({type:N,value:ne,output:I.output?"":p}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(z)},V=N=>{let ne=N.close+(r.capture?")":""),z;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("*")&&(z=q())&&/^\.[^\\/.]+$/.test(z)){let we=qb(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:b,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Ghe,(z,oe,we,Pe,Ve,bt)=>Pe==="\\"?(N=!0,z):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?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(b=$(),b==="\0")continue;if(b==="\\"){let z=P();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){b+="\\",x({type:"text",value:b});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[0].length,I.index+=we,we%2!==0&&(b+="\\")),r.unescape===!0?b=$():b+=$(),I.brackets===0){x({type:"text",value:b});continue}}if(I.brackets>0&&(b!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&b===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Pe=L.value.slice(oe+2),Ve=zhe[Pe];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=p);continue}}}(b==="["&&P()!==":"||b==="-"&&P()==="]")&&(b=`\\${b}`),b==="]"&&(L.value==="["||L.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&L.value==="["&&(b="^"),L.value+=b,G({value:b});continue}if(I.quotes===1&&b!=='"'){b=jr.escapeRegex(b),L.value+=b,G({value:b});continue}if(b==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:b});continue}if(b==="("){H("parens"),x({type:"paren",value:b});continue}if(b===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(fu("opening","("));let z=B[B.length-1];if(z&&I.parens===z.parens+1){V(B.pop());continue}x({type:"paren",value:b,output:I.parens?")":"\\)"}),te("parens");continue}if(b==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(fu("closing","]"));b=`\\${b}`}else H("brackets");x({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:b,output:`\\${b}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(fu("opening","["));x({type:"text",value:b,output:`\\${b}`});continue}te("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(b=`/${b}`),L.value+=b,G({value:b}),r.literalBrackets===!1||jr.hasRegexChars(z))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(b==="{"&&r.nobrace!==!0){H("braces");let z={type:"brace",value:b,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(z),x(z);continue}if(b==="}"){let z=j[j.length-1];if(r.nobrace===!0||!z){x({type:"text",value:b,output:b});continue}let oe=")";if(z.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=Whe(Pe,r),I.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=I.output.slice(0,z.outputIndex),Pe=I.tokens.slice(z.tokensIndex);z.value=z.output="\\{",b=oe="\\}",I.output=we;for(let Ve of Pe)I.output+=Ve.output||Ve.value}x({type:"brace",value:b,output:oe}),te("braces"),j.pop();continue}if(b==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:b});continue}if(b===","){let z=b,oe=j[j.length-1];oe&&K[K.length-1]==="braces"&&(oe.comma=!0,z="|"),x({type:"comma",value:b,output:z});continue}if(b==="/"){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:b,output:f});continue}if(b==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=j[j.length-1];L.type="dots",L.output+=b,L.value+=b,z.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:b,output:h});continue}x({type:"dot",value:b,output:h});continue}if(b==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("qmark",b);continue}if(L&&L.type==="paren"){let oe=P(),we=b;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=`\\${b}`),x({type:"text",value:b,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:b,output:D});continue}x({type:"qmark",value:b,output:m});continue}if(b==="!"){if(r.noextglob!==!0&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",b);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(b==="+"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("plus",b);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:b,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:b});continue}x({type:"plus",value:d});continue}if(b==="@"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:b,output:""});continue}x({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let z=Khe.exec(q());z&&(b+=z[0],I.index+=z[0].length),x({type:"text",value:b});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=b,L.output=R,I.backtrack=!0,I.globstar=!0,M(b);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",b);continue}if(L.type==="star"){if(r.noglobstar===!0){M(b);continue}let z=L.prev,oe=z.prev,we=z.type==="slash"||z.type==="bos",Pe=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:b,output:""});continue}let Ve=I.braces>0&&(z.type==="comma"||z.type==="brace"),bt=B.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!Ve&&!bt){x({type:"star",value:b,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),M("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=b,L.output=F(r),I.output=L.output,I.globstar=!0,M(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Pe&&T()){I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=b,I.globstar=!0,I.output+=z.output+L.output,M(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=b,I.output+=z.output+L.output,I.globstar=!0,M(b+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=b,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(b+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=b,I.output+=L.output,I.globstar=!0,M(b);continue}let ne={type:"star",value:b,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=_+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=b,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+=_,L.output+=_),P()!=="*"&&(I.output+=p,L.output+=p)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("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(vm,r.maxLength):vm,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}=wm.globChars(s),g=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=_=>_.noglobstar===!0?m:`(${E}(?:(?!${p}${_.dot?c:o}).)*?)`,w=_=>{switch(_){case"*":return`${g}${u}${m}`;case".*":return`${o}${u}${m}`;case"*.*":return`${g}${m}${o}${u}${m}`;case"*/*":return`${g}${m}${a}${u}${v}${m}`;case"**":return g+D(r);case"**/*":return`(?:${g}${D(r)}${a})?${v}${u}${m}`;case"**/*.*":return`(?:${g}${D(r)}${a})?${v}${m}${o}${u}${m}`;case"**/.*":return`(?:${g}${D(r)}${a})?${o}${u}${m}`;default:{let k=/^(.*?)\.(\w+)$/.exec(_);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},S=jr.removePrefix(t,A),F=w(S);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};SU.exports=qb});var xU=C((hSe,OU)=>{"use strict";var Xhe=require("path"),Yhe=_U(),Hb=AU(),Vb=bl(),Jhe=El(),Zhe=t=>t&&typeof t=="object"&&!Array.isArray(t),Ot=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ot(d,e,r));return d=>{for(let f of l){let p=f(d);if(p)return p}return!1}}let n=Zhe(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?Ot.compileRe(t,e):Ot.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=Ot(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:p}=Ot.test(l,o,e,{glob:t,posix:s}),g={glob:t,state:a,regex:o,posix:s,input:l,output:p,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(g),d===!1?(g.isMatch=!1,h?g:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(g),g.isMatch=!1,h?g:!1):(typeof i.onMatch=="function"&&i.onMatch(g),h?g:!0)};return r&&(c.state=a),c};Ot.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=Ot.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ot.matchBase=(t,e,r,n=Vb.isWindows(r))=>(e instanceof RegExp?e:Ot.makeRe(e,r)).test(Xhe.basename(t));Ot.isMatch=(t,e,r)=>Ot(e,r)(t);Ot.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ot.parse(r,e)):Hb(t,{...e,fastpaths:!1});Ot.scan=(t,e)=>Yhe(t,e);Ot.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=Ot.toRegex(a,e);return n===!0&&(u.state=t),u};Ot.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)),Ot.compileRe(i,e,r,n)};Ot.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/$^/}};Ot.constants=Jhe;OU.exports=Ot});var IU=C((dSe,TU)=>{"use strict";TU.exports=xU()});var $U=C((pSe,NU)=>{"use strict";var FU=require("util"),RU=lU(),Gn=IU(),zb=bl(),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=Gn(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)=>Gn(t,e);rt.isMatch=(t,e,r)=>Gn(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=Gn(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=Gn(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=>Gn(n,r)(t))};rt.capture=(t,e,r)=>{let n=zb.isWindows(r),s=Gn.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)=>Gn.makeRe(...t);rt.scan=(...t)=>Gn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of RU(String(n),e))r.push(Gn.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 Hde={};Sm(Hde,{CapgoSDK:()=>nt,addApp:()=>Lde,addChannel:()=>jde,addOrganization:()=>kde,checkBundleCompatibility:()=>_de,createSupabaseClient:()=>pe,decryptBundle:()=>Sde,deleteLegacyEncryptionKey:()=>Tde,deleteOrganization:()=>$de,doctor:()=>bde,encryptBundle:()=>Cde,generateEncryptionKeys:()=>Ode,getAccountId:()=>Fde,getCapacitorConfig:()=>qde,getCurrentBundle:()=>Ide,getStats:()=>Ude,listBundles:()=>Bde,listOrganizations:()=>Rde,login:()=>Ede,requestBuild:()=>Mde,saveEncryptionKey:()=>xde,updateAppSetting:()=>Pde,updateOrganization:()=>Nde,uploadBundle:()=>vde,zipBundle:()=>Ade});module.exports=ce(Hde);var Vt=Ee(Ze(),1),_o=require("node:process"),Oi=Ee(require("node:readline"),1),Pm=Ee(require("node:readline"),1),o_=require("node:stream"),a_=Ee(xm(),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 du(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 Tm=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(Tm),it.bgColor.ansi256=e_(Tm),it.bgColor.ansi16m=t_(Tm),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(),Rl=new Set(["\x1B","\x9B"]),kq=39,Rm="\x07",f_="[",Nq="]",h_="m",km=`${Nq}8;;`,r_=t=>`${Rl.values().next().value}${f_}${t}${h_}`,n_=t=>`${Rl.values().next().value}${km}${t}${Rm}`,$q=t=>t.split(" ").map(e=>du(e)),Im=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=du(u_(t[t.length-1]));for(let[a,u]of n.entries()){let c=du(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Rl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(km)),i){s?u===Rm&&(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&&!(du(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=du(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(""),Im(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Im(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Im(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>Lq(c)));let u=[...a.join(`
|
|
239
|
+
`}});function Nle(){try{return zE.default.statSync("/.dockerenv"),!0}catch{return!1}}function $le(){try{return zE.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function KE(){return VE===void 0&&(VE=Nle()||$le()),VE}var zE,VE,EM=mr(()=>{zE=Ee(require("node:fs"),1)});function Xa(){return GE===void 0&&(GE=Lle()||KE()),GE}var bM,GE,Lle,WE=mr(()=>{bM=Ee(require("node:fs"),1);EM();Lle=()=>{try{return bM.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var XE,CM,SM,_M,vi,YE=mr(()=>{XE=Ee(require("node:process"),1),CM=Ee(require("node:os"),1),SM=Ee(require("node:fs"),1);WE();_M=()=>{if(XE.default.platform!=="linux")return!1;if(CM.default.release().toLowerCase().includes("microsoft"))return!Xa();try{return SM.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Xa():!1}catch{return!1}},vi=XE.default.env.__IS_WSL_TEST__?_M:_M()});var JE,AM,OM,xM,Ble,ZE,Nr,QE=mr(()=>{JE=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),ZE=()=>`${JE.default.env.SYSTEMROOT||JE.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??ZE(),[...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,uo,jle,Mle,Ule,Bp,TM,FM,RM,kM,NM=mr(()=>{IM=require("node:util"),PM=Ee(require("node:child_process"),1),uo=Ee(require("node:fs/promises"),1);YE();QE();YE();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 uo.default.access(r,uo.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await uo.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`,Bp=vi?Ule:ZE,FM=async()=>(TM??=(async()=>{try{let t=await Bp();return await uo.default.access(t,uo.constants.X_OK),!0}catch{return!1}})(),TM),RM=async()=>{let t=await Bp(),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 co(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 eb(){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,tb,Hle,VM=mr(()=>{UM=Ee(require("node:process"),1),qM=require("node:util"),tb=require("node:child_process"),Hle=(0,qM.promisify)(tb.execFile)});async function rb(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 ib(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 jp(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=WM[n];if(!i)throw new jp(`Unknown browser ID: ${n}`);return i}var KM,GM,Vle,WM,nb,jp,sb=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"}},nb=new Map(Object.entries(WM)),jp=class extends Error{}});async function ob(){if(Mp.default.platform==="darwin"){let t=await eb();return{name:await rb(t),id:t}}if(Mp.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(Mp.default.platform==="win32")return ib();throw new Error("Only macOS, Linux, and Windows are supported")}var XM,Mp,YM,zle,Kle,JM=mr(()=>{XM=require("node:util"),Mp=Ee(require("node:process"),1),YM=require("node:child_process");MM();zM();sb();sb();zle=(0,XM.promisify)(YM.execFile),Kle=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Up,Gle,ZM,QM=mr(()=>{Up=Ee(require("node:process"),1),Gle=!!(Up.default.env.SSH_CONNECTION||Up.default.env.SSH_CLIENT||Up.default.env.SSH_TTY),ZM=Gle});var lb={};Sm(lb,{apps:()=>lo,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 ul({[Ya]:t},{wsl:e}={}){if(e&&vi)return n8(e);if(!t)throw new Error(`${Ya} is not supported`);return n8(t)}var ub,cb,s8,o8,Hp,i8,qp,ab,e8,Ya,t8,r8,al,Wle,Xle,lo,Yle,fb=mr(()=>{ub=Ee(require("node:process"),1),cb=Ee(require("node:path"),1),s8=require("node:url"),o8=Ee(require("node:child_process"),1),Hp=Ee(require("node:fs/promises"),1);NM();QE();$M();JM();WE();QM();i8={},qp=Symbol("fallbackAttempt"),ab=i8.url?cb.default.dirname((0,s8.fileURLToPath)(i8.url)):"",e8=cb.default.join(ab,"xdg-open"),{platform:Ya,arch:t8}=ub.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")},al=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[qp]===!0;if(delete t[qp],Array.isArray(t.app))return r8(t.app,c=>al({...t,app:c,[qp]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return r8(r,c=>al({...t,app:{name:c,arguments:n},[qp]:!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=nb.get(d)??{}}else h=await ob();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 al({...t,app:{name:lo[d],arguments:n}})}throw new Error(`${h.name} is not supported as a default browser`)}let i,s=[],o={},a=!1;if(vi&&!Xa()&&!ZM&&!r&&(a=await FM()),Ya==="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(Ya==="win32"||a){i=await Bp(),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=!ab||ab==="/",l=!1;try{await Hp.default.access(e8,Hp.constants.X_OK),l=!0}catch{}i=ub.default.versions.electron??(Ya==="android"||c||!l)?"xdg-open":e8}n.length>0&&s.push(...n),t.wait||(o.stdio="ignore",o.detached=!0)}Ya==="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 al({...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 al({...e,app:{name:t,arguments:r}})};lo={browser:"browser",browserPrivate:"browserPrivate"};co(lo,"chrome",()=>ul({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"]}}));co(lo,"brave",()=>ul({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"]}}));co(lo,"firefox",()=>ul({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));co(lo,"edge",()=>ul({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));co(lo,"safari",()=>ul({darwin:"Safari"}));Yle=Wle});var pm=C(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 mm=C((QCe,I6)=>{"use strict";var T6=pm();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=C((eSe,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=C((tSe,M6)=>{"use strict";var R6=F6(),Do=(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(Do.cache.hasOwnProperty(u))return Do.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let g=t+"|"+e;return n.capture?`(${g})`:n.wrap===!1?g:`(?:${g})`}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 g=l<0?Math.abs(l):1;p=k6(g,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=jfe(p,f,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&f.length+p.length>1&&(d.result=`(?:${d.result})`),Do.cache[u]=d,d.result};function jfe(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 Mfe(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(Hfe),s}function Ufe(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=qfe(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+=Vfe(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=Mfe(t,e),s=[],o=t,a;for(let u=0;u<i.length;u++){let c=i[u],l=Ufe(String(o),String(c),n),h="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+B6(a.count),o=c+1;continue}r.isPadded&&(h=zfe(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 qfe(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function Hfe(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 Vfe(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function j6(t){return/^-?(0+)\d/.test(t)}function zfe(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}}`}}Do.cache={};Do.clearCache=()=>Do.cache={};M6.exports=Do});var Rb=C((rSe,W6)=>{"use strict";var Kfe=require("util"),H6=U6(),q6=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Gfe=t=>e=>t===!0?Number(e):String(e),Pb=t=>typeof t=="number"||typeof t=="string"&&t!=="",vl=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},Wfe=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,Xfe=(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},ym=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},Yfe=(t,e,r)=>{t.negatives.sort((a,u)=>a<u?-1:a>u?1:0),t.positives.sort((a,u)=>a<u?-1:a>u?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>ym(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>ym(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: "+Kfe.inspect(...t)),G6=(t,e,r)=>{if(r.strictRanges===!0)throw K6([t,e]);return[]},Jfe=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Zfe=(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&&Wfe(t,e,n)===!1,f=n.transform||Gfe(d);if(n.toRegex&&r===1)return V6(ym(t,h),ym(e,h),!0,n);let p={negatives:[],positives:[]},g=A=>p[A<0?"negatives":"positives"].push(Math.abs(A)),v=[],E=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?g(i):v.push(Xfe(f(i,E),h,d)),i=o?i-r:i+r,E++;return n.toRegex===!0?r>1?Yfe(p,n,h):z6(v,null,{wrap:!1,...n}):v},Qfe=(t,e,r=1,n={})=>{if(!vl(t)&&t.length>1||!vl(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},gm=(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 gm(t,e,1,{transform:r});if(q6(r))return gm(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,vl(r)?vl(t)&&vl(e)?Zfe(t,e,r,i):Qfe(t,e,Math.max(Math.abs(r),1),i):r!=null&&!q6(r)?Jfe(r,i):gm(t,e,1,r)};W6.exports=gm});var J6=C((nSe,Y6)=>{"use strict";var ehe=Rb(),X6=pm(),the=(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=ehe(...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=the});var eU=C((iSe,Q6)=>{"use strict";var rhe=Rb(),Z6=mm(),lu=pm(),wo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?lu.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(wo(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?wo(i,s,r):i+s);return lu.flatten(n)},nhe=(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(wo(a.pop(),Z6(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(wo(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let h=lu.reduce(i.nodes);if(lu.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=rhe(...h,e);d.length===0&&(d=Z6(i,e)),a.push(wo(a.pop(),d)),i.nodes=[];return}let u=lu.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(wo(a.pop(),c,u));continue}if(d.value&&d.type!=="open"){c.push(wo(c.pop(),d.value));continue}d.nodes&&n(d,i)}return c};return lu.flatten(n(t))};Q6.exports=nhe});var rU=C((sSe,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=C((oSe,oU)=>{"use strict";var ihe=mm(),{MAX_LENGTH:nU,CHAR_BACKSLASH:kb,CHAR_BACKTICK:she,CHAR_COMMA:ohe,CHAR_DOT:ahe,CHAR_LEFT_PARENTHESES:uhe,CHAR_RIGHT_PARENTHESES:che,CHAR_LEFT_CURLY_BRACE:lhe,CHAR_RIGHT_CURLY_BRACE:fhe,CHAR_LEFT_SQUARE_BRACKET:iU,CHAR_RIGHT_SQUARE_BRACKET:sU,CHAR_DOUBLE_QUOTE:hhe,CHAR_SINGLE_QUOTE:dhe,CHAR_NO_BREAK_SPACE:phe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:mhe}=rU(),ghe=(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=g=>{if(g.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&g.type==="text"){a.value+=g.value;return}return o.nodes.push(g),g.parent=o,g.prev=a,a=g,g};for(p({type:"bos"});l<c;)if(o=s[s.length-1],d=f(),!(d===mhe||d===phe)){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 g;for(;l<c&&(g=f());){if(d+=g,g===iU){u++;continue}if(g===kb){d+=f();continue}if(g===sU&&(u--,u===0))break}p({type:"text",value:d});continue}if(d===uhe){o=p({type:"paren",nodes:[]}),s.push(o),p({type:"text",value:d});continue}if(d===che){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===hhe||d===dhe||d===she){let g=d,v;for(e.keepQuotes!==!0&&(d="");l<c&&(v=f());){if(v===kb){d+=v+f();continue}if(v===g){e.keepQuotes===!0&&(d+=v);break}d+=v}p({type:"text",value:d});continue}if(d===lhe){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===fhe){if(o.type!=="brace"){p({type:"text",value:d});continue}let g="close";o=s.pop(),o.close=!0,p({type:g,value:d}),h--,o=s[s.length-1];continue}if(d===ohe&&h>0){if(o.ranges>0){o.ranges=0;let g=o.nodes.shift();o.nodes=[g,{type:"text",value:ihe(o)}]}p({type:"comma",value:d}),o.commas++;continue}if(d===ahe&&h>0&&o.commas===0){let g=o.nodes;if(h===0||g.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"){g.pop();let v=g[g.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 g=s[s.length-1],v=g.nodes.indexOf(o);g.nodes.splice(v,1,...o.nodes)}while(s.length>0);return p({type:"eos"}),i};oU.exports=ghe});var lU=C((aSe,cU)=>{"use strict";var uU=mm(),yhe=J6(),Dhe=eU(),whe=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={})=>whe(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)),yhe(t,e));Br.expand=(t,e={})=>{typeof t=="string"&&(t=Br.parse(t,e));let r=Dhe(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 El=C((uSe,mU)=>{"use strict";var vhe=require("path"),Kn="\\\\/",fU=`[^${Kn}]`,Oi="\\.",Ehe="\\+",bhe="\\?",Dm="\\/",_he="(?=.)",hU="[^/]",Nb=`(?:${Dm}|$)`,dU=`(?:^|${Dm})`,$b=`${Oi}{1,2}${Nb}`,Che=`(?!${Oi})`,She=`(?!${dU}${$b})`,Ahe=`(?!${Oi}{0,1}${Nb})`,Ohe=`(?!${$b})`,xhe=`[^.${Dm}]`,The=`${hU}*?`,pU={DOT_LITERAL:Oi,PLUS_LITERAL:Ehe,QMARK_LITERAL:bhe,SLASH_LITERAL:Dm,ONE_CHAR:_he,QMARK:hU,END_ANCHOR:Nb,DOTS_SLASH:$b,NO_DOT:Che,NO_DOTS:She,NO_DOT_SLASH:Ahe,NO_DOTS_SLASH:Ohe,QMARK_NO_DOT:xhe,STAR:The,START_ANCHOR:dU},Ihe={...pU,SLASH_LITERAL:`[${Kn}]`,QMARK:fU,STAR:`${fU}*?`,DOTS_SLASH:`${Oi}{1,2}(?:[${Kn}]|$)`,NO_DOT:`(?!${Oi})`,NO_DOTS:`(?!(?:^|[${Kn}])${Oi}{1,2}(?:[${Kn}]|$))`,NO_DOT_SLASH:`(?!${Oi}{0,1}(?:[${Kn}]|$))`,NO_DOTS_SLASH:`(?!${Oi}{1,2}(?:[${Kn}]|$))`,QMARK_NO_DOT:`[^.${Kn}]`,START_ANCHOR:`(?:^|[${Kn}])`,END_ANCHOR:`(?:[${Kn}]|$)`},Phe={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:Phe,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:vhe.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?Ihe:pU}}});var bl=C(Tr=>{"use strict";var Fhe=require("path"),Rhe=process.platform==="win32",{REGEX_BACKSLASH:khe,REGEX_REMOVE_BACKSLASH:Nhe,REGEX_SPECIAL_CHARS:$he,REGEX_SPECIAL_CHARS_GLOBAL:Lhe}=El();Tr.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Tr.hasRegexChars=t=>$he.test(t);Tr.isRegexChar=t=>t.length===1&&Tr.hasRegexChars(t);Tr.escapeRegex=t=>t.replace(Lhe,"\\$1");Tr.toPosixSlashes=t=>t.replace(khe,"/");Tr.removeBackslashes=t=>t.replace(Nhe,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:Rhe===!0||Fhe.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=C((lSe,bU)=>{"use strict";var gU=bl(),{CHAR_ASTERISK:Lb,CHAR_AT:Bhe,CHAR_BACKWARD_SLASH:_l,CHAR_COMMA:jhe,CHAR_DOT:Bb,CHAR_EXCLAMATION_MARK:jb,CHAR_FORWARD_SLASH:EU,CHAR_LEFT_CURLY_BRACE:Mb,CHAR_LEFT_PARENTHESES:Ub,CHAR_LEFT_SQUARE_BRACKET:Mhe,CHAR_PLUS:Uhe,CHAR_QUESTION_MARK:yU,CHAR_RIGHT_CURLY_BRACE:qhe,CHAR_RIGHT_PARENTHESES:DU,CHAR_RIGHT_SQUARE_BRACKET:Hhe}=El(),wU=t=>t===EU||t===_l,vU=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Vhe=(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,g=!1,v=!1,E=!1,A=!1,m=!1,D=!1,w=!1,S=0,F,_,k={value:"",depth:0,isGlob:!1},R=()=>c>=n,I=()=>u.charCodeAt(c+1),B=()=>(F=_,u.charCodeAt(++c));for(;c<n;){_=B();let T;if(_===_l){A=k.backslashes=!0,_=B(),_===Mb&&(E=!0);continue}if(E===!0||_===Mb){for(S++;R()!==!0&&(_=B());){if(_===_l){A=k.backslashes=!0,B();continue}if(_===Mb){S++;continue}if(E!==!0&&_===Bb&&(_=B())===Bb){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(E!==!0&&_===jhe){if(d=k.isBrace=!0,p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===qhe&&(S--,S===0)){E=!1,d=k.isBrace=!0,w=!0;break}}if(i===!0)continue;break}if(_===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&&(_===Uhe||_===Bhe||_===Lb||_===yU||_===jb)===!0&&I()===Ub){if(p=k.isGlob=!0,g=k.isExtglob=!0,w=!0,_===jb&&c===l&&(D=!0),i===!0){for(;R()!==!0&&(_=B());){if(_===_l){A=k.backslashes=!0,_=B();continue}if(_===DU){p=k.isGlob=!0,w=!0;break}}continue}break}if(_===Lb){if(F===Lb&&(v=k.isGlobstar=!0),p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===yU){if(p=k.isGlob=!0,w=!0,i===!0)continue;break}if(_===Mhe){for(;R()!==!0&&(T=B());){if(T===_l){A=k.backslashes=!0,B();continue}if(T===Hhe){f=k.isBracket=!0,p=k.isGlob=!0,w=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&_===jb&&c===l){m=k.negated=!0,l++;continue}if(r.noparen!==!0&&_===Ub){if(p=k.isGlob=!0,i===!0){for(;R()!==!0&&(_=B());){if(_===Ub){A=k.backslashes=!0,_=B();continue}if(_===DU){w=!0;break}}continue}break}if(p===!0){if(w=!0,i===!0)continue;break}}r.noext===!0&&(g=!1,p=!1);let j=u,K="",L="";l>0&&(K=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 b={prefix:K,input:t,start:l,base:j,glob:L,isBrace:d,isBracket:f,isGlob:p,isExtglob:g,isGlobstar:v,negated:m,negatedExtglob:D};if(r.tokens===!0&&(b.maxDepth=0,wU(_)||o.push(k),b.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=K):o[P].value=M,vU(o[P]),b.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]),b.maxDepth+=o[o.length-1].depth)}b.slashes=s,b.parts=a}return b};bU.exports=Vhe});var AU=C((fSe,SU)=>{"use strict";var wm=El(),jr=bl(),{MAX_LENGTH:vm,POSIX_REGEX_SOURCE:zhe,REGEX_NON_SPECIAL_CHARS:Khe,REGEX_SPECIAL_CHARS_BACKREF:Ghe,REPLACEMENTS:CU}=wm,Whe=(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},fu=(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(vm,r.maxLength):vm,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=wm.globChars(u),l=wm.extglobChars(c),{DOT_LITERAL:h,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:g,NO_DOT:v,NO_DOT_SLASH:E,NO_DOTS_SLASH:A,QMARK:m,QMARK_NO_DOT:D,STAR:w,START_ANCHOR:S}=c,F=N=>`(${a}(?:(?!${S}${N.dot?g:h}).)*?)`,_=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=[],K=[],L=s,b,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]++,K.push(N)},te=N=>{I[N]--,K.pop()},x=N=>{if(L.type==="globstar"){let ne=I.braces>0&&(N.type==="comma"||N.type==="brace"),z=N.extglob===!0||B.length&&(N.type==="pipe"||N.type==="paren");N.type!=="slash"&&N.type!=="paren"&&!ne&&!z&&(I.output=I.output.slice(0,-L.output.length),L.type="star",L.value="*",L.output=R,I.output+=L.output)}if(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 z={...l[ne],conditions:1,inner:""};z.prev=L,z.parens=I.parens,z.output=I.output;let oe=(r.capture?"(":"")+z.open;H("parens"),x({type:N,value:ne,output:I.output?"":p}),x({type:"paren",extglob:!0,value:$(),output:oe}),B.push(z)},V=N=>{let ne=N.close+(r.capture?")":""),z;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("*")&&(z=q())&&/^\.[^\\/.]+$/.test(z)){let we=qb(z,{...e,fastpaths:!1}).output;ne=N.close=`)${we})${oe})`}N.prev.type==="bos"&&(I.negatedExtglob=!0)}x({type:"paren",extglob:!0,value:b,output:ne}),te("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let N=!1,ne=t.replace(Ghe,(z,oe,we,Pe,Ve,bt)=>Pe==="\\"?(N=!0,z):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?z:`\\${z}`);return N===!0&&(r.unescape===!0?ne=ne.replace(/\\/g,""):ne=ne.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),ne===t&&r.contains===!0?(I.output=t,I):(I.output=jr.wrapOutput(ne,I,e),I)}for(;!T();){if(b=$(),b==="\0")continue;if(b==="\\"){let z=P();if(z==="/"&&r.bash!==!0||z==="."||z===";")continue;if(!z){b+="\\",x({type:"text",value:b});continue}let oe=/^\\+/.exec(q()),we=0;if(oe&&oe[0].length>2&&(we=oe[0].length,I.index+=we,we%2!==0&&(b+="\\")),r.unescape===!0?b=$():b+=$(),I.brackets===0){x({type:"text",value:b});continue}}if(I.brackets>0&&(b!=="]"||L.value==="["||L.value==="[^")){if(r.posix!==!1&&b===":"){let z=L.value.slice(1);if(z.includes("[")&&(L.posix=!0,z.includes(":"))){let oe=L.value.lastIndexOf("["),we=L.value.slice(0,oe),Pe=L.value.slice(oe+2),Ve=zhe[Pe];if(Ve){L.value=we+Ve,I.backtrack=!0,$(),!s.output&&o.indexOf(L)===1&&(s.output=p);continue}}}(b==="["&&P()!==":"||b==="-"&&P()==="]")&&(b=`\\${b}`),b==="]"&&(L.value==="["||L.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&L.value==="["&&(b="^"),L.value+=b,G({value:b});continue}if(I.quotes===1&&b!=='"'){b=jr.escapeRegex(b),L.value+=b,G({value:b});continue}if(b==='"'){I.quotes=I.quotes===1?0:1,r.keepQuotes===!0&&x({type:"text",value:b});continue}if(b==="("){H("parens"),x({type:"paren",value:b});continue}if(b===")"){if(I.parens===0&&r.strictBrackets===!0)throw new SyntaxError(fu("opening","("));let z=B[B.length-1];if(z&&I.parens===z.parens+1){V(B.pop());continue}x({type:"paren",value:b,output:I.parens?")":"\\)"}),te("parens");continue}if(b==="["){if(r.nobracket===!0||!q().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(fu("closing","]"));b=`\\${b}`}else H("brackets");x({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||L&&L.type==="bracket"&&L.value.length===1){x({type:"text",value:b,output:`\\${b}`});continue}if(I.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(fu("opening","["));x({type:"text",value:b,output:`\\${b}`});continue}te("brackets");let z=L.value.slice(1);if(L.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(b=`/${b}`),L.value+=b,G({value:b}),r.literalBrackets===!1||jr.hasRegexChars(z))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(b==="{"&&r.nobrace!==!0){H("braces");let z={type:"brace",value:b,output:"(",outputIndex:I.output.length,tokensIndex:I.tokens.length};j.push(z),x(z);continue}if(b==="}"){let z=j[j.length-1];if(r.nobrace===!0||!z){x({type:"text",value:b,output:b});continue}let oe=")";if(z.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=Whe(Pe,r),I.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let we=I.output.slice(0,z.outputIndex),Pe=I.tokens.slice(z.tokensIndex);z.value=z.output="\\{",b=oe="\\}",I.output=we;for(let Ve of Pe)I.output+=Ve.output||Ve.value}x({type:"brace",value:b,output:oe}),te("braces"),j.pop();continue}if(b==="|"){B.length>0&&B[B.length-1].conditions++,x({type:"text",value:b});continue}if(b===","){let z=b,oe=j[j.length-1];oe&&K[K.length-1]==="braces"&&(oe.comma=!0,z="|"),x({type:"comma",value:b,output:z});continue}if(b==="/"){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:b,output:f});continue}if(b==="."){if(I.braces>0&&L.type==="dot"){L.value==="."&&(L.output=h);let z=j[j.length-1];L.type="dots",L.output+=b,L.value+=b,z.dots=!0;continue}if(I.braces+I.parens===0&&L.type!=="bos"&&L.type!=="slash"){x({type:"text",value:b,output:h});continue}x({type:"dot",value:b,output:h});continue}if(b==="?"){if(!(L&&L.value==="(")&&r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("qmark",b);continue}if(L&&L.type==="paren"){let oe=P(),we=b;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=`\\${b}`),x({type:"text",value:b,output:we});continue}if(r.dot!==!0&&(L.type==="slash"||L.type==="bos")){x({type:"qmark",value:b,output:D});continue}x({type:"qmark",value:b,output:m});continue}if(b==="!"){if(r.noextglob!==!0&&P()==="("&&(P(2)!=="?"||!/[!=<:]/.test(P(3)))){O("negate",b);continue}if(r.nonegate!==!0&&I.index===0){U();continue}}if(b==="+"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){O("plus",b);continue}if(L&&L.value==="("||r.regex===!1){x({type:"plus",value:b,output:d});continue}if(L&&(L.type==="bracket"||L.type==="paren"||L.type==="brace")||I.parens>0){x({type:"plus",value:b});continue}x({type:"plus",value:d});continue}if(b==="@"){if(r.noextglob!==!0&&P()==="("&&P(2)!=="?"){x({type:"at",extglob:!0,value:b,output:""});continue}x({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let z=Khe.exec(q());z&&(b+=z[0],I.index+=z[0].length),x({type:"text",value:b});continue}if(L&&(L.type==="globstar"||L.star===!0)){L.type="star",L.star=!0,L.value+=b,L.output=R,I.backtrack=!0,I.globstar=!0,M(b);continue}let N=q();if(r.noextglob!==!0&&/^\([^?]/.test(N)){O("star",b);continue}if(L.type==="star"){if(r.noglobstar===!0){M(b);continue}let z=L.prev,oe=z.prev,we=z.type==="slash"||z.type==="bos",Pe=oe&&(oe.type==="star"||oe.type==="globstar");if(r.bash===!0&&(!we||N[0]&&N[0]!=="/")){x({type:"star",value:b,output:""});continue}let Ve=I.braces>0&&(z.type==="comma"||z.type==="brace"),bt=B.length&&(z.type==="pipe"||z.type==="paren");if(!we&&z.type!=="paren"&&!Ve&&!bt){x({type:"star",value:b,output:""});continue}for(;N.slice(0,3)==="/**";){let pr=t[I.index+4];if(pr&&pr!=="/")break;N=N.slice(3),M("/**",3)}if(z.type==="bos"&&T()){L.type="globstar",L.value+=b,L.output=F(r),I.output=L.output,I.globstar=!0,M(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Pe&&T()){I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=F(r)+(r.strictSlashes?")":"|$)"),L.value+=b,I.globstar=!0,I.output+=z.output+L.output,M(b);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&N[0]==="/"){let pr=N[1]!==void 0?"|$":"";I.output=I.output.slice(0,-(z.output+L.output).length),z.output=`(?:${z.output}`,L.type="globstar",L.output=`${F(r)}${f}|${f}${pr})`,L.value+=b,I.output+=z.output+L.output,I.globstar=!0,M(b+$()),x({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&N[0]==="/"){L.type="globstar",L.value+=b,L.output=`(?:^|${f}|${F(r)}${f})`,I.output=L.output,I.globstar=!0,M(b+$()),x({type:"slash",value:"/",output:""});continue}I.output=I.output.slice(0,-L.output.length),L.type="globstar",L.output=F(r),L.value+=b,I.output+=L.output,I.globstar=!0,M(b);continue}let ne={type:"star",value:b,output:R};if(r.bash===!0){ne.output=".*?",(L.type==="bos"||L.type==="slash")&&(ne.output=_+ne.output),x(ne);continue}if(L&&(L.type==="bracket"||L.type==="paren")&&r.regex===!0){ne.output=b,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+=_,L.output+=_),P()!=="*"&&(I.output+=p,L.output+=p)),x(ne)}for(;I.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("closing","]"));I.output=jr.escapeLast(I.output,"["),te("brackets")}for(;I.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("closing",")"));I.output=jr.escapeLast(I.output,"("),te("parens")}for(;I.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(fu("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(vm,r.maxLength):vm,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}=wm.globChars(s),g=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=_=>_.noglobstar===!0?m:`(${E}(?:(?!${p}${_.dot?c:o}).)*?)`,w=_=>{switch(_){case"*":return`${g}${u}${m}`;case".*":return`${o}${u}${m}`;case"*.*":return`${g}${m}${o}${u}${m}`;case"*/*":return`${g}${m}${a}${u}${v}${m}`;case"**":return g+D(r);case"**/*":return`(?:${g}${D(r)}${a})?${v}${u}${m}`;case"**/*.*":return`(?:${g}${D(r)}${a})?${v}${m}${o}${u}${m}`;case"**/.*":return`(?:${g}${D(r)}${a})?${o}${u}${m}`;default:{let k=/^(.*?)\.(\w+)$/.exec(_);if(!k)return;let R=w(k[1]);return R?R+o+k[2]:void 0}}},S=jr.removePrefix(t,A),F=w(S);return F&&r.strictSlashes!==!0&&(F+=`${a}?`),F};SU.exports=qb});var xU=C((hSe,OU)=>{"use strict";var Xhe=require("path"),Yhe=_U(),Hb=AU(),Vb=bl(),Jhe=El(),Zhe=t=>t&&typeof t=="object"&&!Array.isArray(t),Ot=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(d=>Ot(d,e,r));return d=>{for(let f of l){let p=f(d);if(p)return p}return!1}}let n=Zhe(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?Ot.compileRe(t,e):Ot.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=Ot(i.ignore,l,r)}let c=(l,h=!1)=>{let{isMatch:d,match:f,output:p}=Ot.test(l,o,e,{glob:t,posix:s}),g={glob:t,state:a,regex:o,posix:s,input:l,output:p,match:f,isMatch:d};return typeof i.onResult=="function"&&i.onResult(g),d===!1?(g.isMatch=!1,h?g:!1):u(l)?(typeof i.onIgnore=="function"&&i.onIgnore(g),g.isMatch=!1,h?g:!1):(typeof i.onMatch=="function"&&i.onMatch(g),h?g:!0)};return r&&(c.state=a),c};Ot.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=Ot.matchBase(t,e,r,i):a=e.exec(u)),{isMatch:!!a,match:a,output:u}};Ot.matchBase=(t,e,r,n=Vb.isWindows(r))=>(e instanceof RegExp?e:Ot.makeRe(e,r)).test(Xhe.basename(t));Ot.isMatch=(t,e,r)=>Ot(e,r)(t);Ot.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ot.parse(r,e)):Hb(t,{...e,fastpaths:!1});Ot.scan=(t,e)=>Yhe(t,e);Ot.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=Ot.toRegex(a,e);return n===!0&&(u.state=t),u};Ot.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)),Ot.compileRe(i,e,r,n)};Ot.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/$^/}};Ot.constants=Jhe;OU.exports=Ot});var IU=C((dSe,TU)=>{"use strict";TU.exports=xU()});var $U=C((pSe,NU)=>{"use strict";var FU=require("util"),RU=lU(),Gn=IU(),zb=bl(),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=Gn(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)=>Gn(t,e);rt.isMatch=(t,e,r)=>Gn(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=Gn(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=Gn(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=>Gn(n,r)(t))};rt.capture=(t,e,r)=>{let n=zb.isWindows(r),s=Gn.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)=>Gn.makeRe(...t);rt.scan=(...t)=>Gn.scan(...t);rt.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of RU(String(n),e))r.push(Gn.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 Hde={};Sm(Hde,{CapgoSDK:()=>nt,addApp:()=>Lde,addChannel:()=>jde,addOrganization:()=>kde,checkBundleCompatibility:()=>_de,createSupabaseClient:()=>pe,decryptBundle:()=>Sde,deleteLegacyEncryptionKey:()=>Tde,deleteOrganization:()=>$de,doctor:()=>bde,encryptBundle:()=>Cde,generateEncryptionKeys:()=>Ode,getAccountId:()=>Fde,getCapacitorConfig:()=>qde,getCurrentBundle:()=>Ide,getStats:()=>Ude,listBundles:()=>Bde,listOrganizations:()=>Rde,login:()=>Ede,requestBuild:()=>Mde,saveEncryptionKey:()=>xde,updateAppSetting:()=>Pde,updateOrganization:()=>Nde,uploadBundle:()=>vde,zipBundle:()=>Ade});module.exports=ce(Hde);var Vt=Ee(Ze(),1),_o=require("node:process"),xi=Ee(require("node:readline"),1),Pm=Ee(require("node:readline"),1),o_=require("node:stream"),a_=Ee(xm(),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 du(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 Tm=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(Tm),it.bgColor.ansi256=e_(Tm),it.bgColor.ansi16m=t_(Tm),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(),Rl=new Set(["\x1B","\x9B"]),kq=39,Rm="\x07",f_="[",Nq="]",h_="m",km=`${Nq}8;;`,r_=t=>`${Rl.values().next().value}${f_}${t}${h_}`,n_=t=>`${Rl.values().next().value}${km}${t}${Rm}`,$q=t=>t.split(" ").map(e=>du(e)),Im=(t,e,r)=>{let n=[...e],i=!1,s=!1,o=du(u_(t[t.length-1]));for(let[a,u]of n.entries()){let c=du(u);if(o+c<=r?t[t.length-1]+=u:(t.push(u),o=0),Rl.has(u)&&(i=!0,s=n.slice(a+1).join("").startsWith(km)),i){s?u===Rm&&(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&&!(du(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=du(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(""),Im(a,l,e);continue}if(h+o[c]>e&&h>0&&o[c]>0){if(r.wordWrap===!1&&h<e){Im(a,l,e);continue}a.push("")}if(h+o[c]>e&&r.wordWrap===!1){Im(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,Rl.has(l)){let{groups:d}=new RegExp(`(?:\\${f_}(?<code>\\d+)m|\\${km}(?<uri>.*)${Rm})`).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,`
|
|
@@ -246,12 +246,12 @@ tell application "System Events" to get value of property list item "CFBundleNam
|
|
|
246
246
|
`).map(n=>Bq(n,e,r)).join(`
|
|
247
247
|
`)}var jq=["up","down","left","right","space","enter","cancel"],Tl={actions:new Set(jq),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["","cancel"],["escape","cancel"]])};function Nm(t,e){if(typeof t=="string")return Tl.aliases.get(t)===e;for(let r of t)if(r!==void 0&&Nm(r,e))return!0;return!1}function Mq(t,e){if(t===e)return;let r=t.split(`
|
|
248
248
|
`),n=e.split(`
|
|
249
|
-
`),i=[];for(let s=0;s<Math.max(r.length,n.length);s++)r[s]!==n[s]&&i.push(s);return i}var Uq=globalThis.process.platform.startsWith("win"),Fm=Symbol("clack:cancel");function st(t){return t===Fm}function xl(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function d_({input:t=_o.stdin,output:e=_o.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let i=
|
|
249
|
+
`),i=[];for(let s=0;s<Math.max(r.length,n.length);s++)r[s]!==n[s]&&i.push(s);return i}var Uq=globalThis.process.platform.startsWith("win"),Fm=Symbol("clack:cancel");function st(t){return t===Fm}function xl(t,e){let r=t;r.isTTY&&r.setRawMode(e)}function d_({input:t=_o.stdin,output:e=_o.stdout,overwrite:r=!0,hideCursor:n=!0}={}){let i=xi.createInterface({input:t,output:e,prompt:"",tabSize:1});xi.emitKeypressEvents(t,i),t.isTTY&&t.setRawMode(!0);let s=(o,{name:a,sequence:u})=>{let c=String(o);if(Nm([c,a,u],"cancel")){n&&e.write(Vt.cursor.show),process.exit(0);return}if(!r)return;xi.moveCursor(e,a==="return"?0:-1,a==="return"?-1:0,()=>{xi.clearLine(e,1,()=>{t.once("keypress",s)})})};return n&&e.write(Vt.cursor.hide),t.once("keypress",s),()=>{t.off("keypress",s),n&&e.write(Vt.cursor.show),t.isTTY&&!Uq&&t.setRawMode(!1),i.terminal=!1,i.close()}}var qq=Object.defineProperty,Hq=(t,e,r)=>e in t?qq(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ir=(t,e,r)=>(Hq(t,typeof e!="symbol"?e+"":e,r),r),pu=class{constructor(e,r=!0){Ir(this,"input"),Ir(this,"output"),Ir(this,"_abortSignal"),Ir(this,"rl"),Ir(this,"opts"),Ir(this,"_render"),Ir(this,"_track",!1),Ir(this,"_prevFrame",""),Ir(this,"_subscribers",new Map),Ir(this,"_cursor",0),Ir(this,"state","initial"),Ir(this,"error",""),Ir(this,"value");let{input:n=_o.stdin,output:i=_o.stdout,render:s,signal:o,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=s.bind(this),this._track=r,this._abortSignal=o,this.input=n,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,r){let n=this._subscribers.get(e)??[];n.push(r),this._subscribers.set(e,n)}on(e,r){this.setSubscriber(e,{cb:r})}once(e,r){this.setSubscriber(e,{cb:r,once:!0})}emit(e,...r){let n=this._subscribers.get(e)??[],i=[];for(let s of n)s.cb(...r),s.once&&i.push(()=>n.splice(n.indexOf(s),1));for(let s of i)s()}prompt(){return new Promise((e,r)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Fm);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let n=new o_.Writable;n._write=(i,s,o)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),o()},this.input.pipe(n),this.rl=Pm.default.createInterface({input:this.input,output:n,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Pm.default.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),xl(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Vt.cursor.show),this.output.off("resize",this.render),xl(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Vt.cursor.show),this.output.off("resize",this.render),xl(this.input,!1),e(Fm)})})}onKeypress(e,r){if(this.state==="error"&&(this.state="active"),r?.name&&(!this._track&&Tl.aliases.has(r.name)&&this.emit("cursor",Tl.aliases.get(r.name)),Tl.actions.has(r.name)&&this.emit("cursor",r.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),e===" "&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),e&&this.emit("key",e.toLowerCase()),r?.name==="return"){if(this.opts.validate){let n=this.opts.validate(this.value);n&&(this.error=n instanceof Error?n.message:n,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}Nm([e,r?.name,r?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
250
250
|
`),xl(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=i_(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
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}}},Il=class extends pu{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),Pl=class extends pu{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 Fl=class extends pu{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(xm(),1),kl=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 $m=Gq(),_t=(t,e)=>$m?t:e,Wq=_t("\u25C6","*"),p_=_t("\u25A0","x"),m_=_t("\u25B2","x"),jm=_t("\u25C7","o"),Xq=_t("\u250C","T"),ct=_t("\u2502","|"),mu=_t("\u2514","\u2014"),Lm=_t("\u25CF",">"),Bm=_t("\u25CB"," "),epe=_t("\u25FB","[\u2022]"),tpe=_t("\u25FC","[+]"),rpe=_t("\u25FB","[ ]"),npe=_t("\u25AA","\u2022"),ipe=_t("\u2500","-"),spe=_t("\u256E","+"),ope=_t("\u251C","+"),ape=_t("\u256F","+"),Yq=_t("\u25CF","\u2022"),Jq=_t("\u25C6","*"),Zq=_t("\u25B2","!"),Qq=_t("\u25A0","x"),Mm=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(jm)}},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)})},
|
|
254
|
+
`)),this._prevFrame=e;return}this.output.write(Vt.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}},Il=class extends pu{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),Pl=class extends pu{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 Fl=class extends pu{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(xm(),1),kl=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 $m=Gq(),_t=(t,e)=>$m?t:e,Wq=_t("\u25C6","*"),p_=_t("\u25A0","x"),m_=_t("\u25B2","x"),jm=_t("\u25C7","o"),Xq=_t("\u250C","T"),ct=_t("\u2502","|"),mu=_t("\u2514","\u2014"),Lm=_t("\u25CF",">"),Bm=_t("\u25CB"," "),epe=_t("\u25FB","[\u2022]"),tpe=_t("\u25FC","[+]"),rpe=_t("\u25FB","[ ]"),npe=_t("\u25AA","\u2022"),ipe=_t("\u2500","-"),spe=_t("\u256E","+"),ope=_t("\u251C","+"),ape=_t("\u256F","+"),Yq=_t("\u25CF","\u2022"),Jq=_t("\u25C6","*"),Zq=_t("\u25B2","!"),Qq=_t("\u25A0","x"),Mm=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(jm)}},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 Fl({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let e=`${J.default.gray(ct)}
|
|
255
255
|
${Mm(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}
|
|
@@ -283,8 +283,8 @@ ${J.default.gray(mu)} ${t}
|
|
|
283
283
|
`);let w=0,S=0;f(),s=setInterval(()=>{if(n&&a===u)return;g(),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 _=".".repeat(Math.floor(S)).slice(0,3);process.stdout.write(`${F} ${a}${_}`)}w=w+1<e.length?w+1:0,S=S<e.length?S+.125:0},r)},m=(D="",w=0)=>{o=!1,clearInterval(s),g();let S=w===0?J.default.green(jm):w===1?J.default.red(p_):J.default.red(m_);a=v(D??a),t==="timer"?process.stdout.write(`${S} ${a} ${E(c)}
|
|
284
284
|
`):process.stdout.write(`${S} ${a}
|
|
285
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"),zp=require("node:os"),xe=Ee(require("node:path")),Un=require("node:process"),os=Ee($l());var Zt=require("fs"),yu=(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},Ll=(t=yu(),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 Bl(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 Vm(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 Co="0|[1-9]\\d*",i4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",s4=`(?<major>${Co})\\.(?<minor>${Co})\\.(?<patch>${Co})`,D_=`(?:${Co}|${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|\\*",Hm=`${Co}|${o4}`,jl=`[v=\\s]*(?<major>${Hm})(?:\\.(?<minor>${Hm})(?:\\.(?<patch>${Hm})${E_}?${b_}?)?)?`,A_=new RegExp(`^(?<operator>~>?|\\^|${S_})\\s*${jl}$`),O_=new RegExp(`^(?<operator>${S_})\\s*(${__})$|^$`);function zm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Km=256;var a4=new RegExp(`^${Co}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(a4.test(e)){let r=Number(e);if(zm(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Ii(t,e){let r=Number(t);if(!zm(r))throw new TypeError(e);return r}function Wn(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:Bl(t.major,e.major)||Bl(t.minor,e.minor)||Bl(t.patch,e.patch)||v_(t.prerelease,e.prerelease)||Vm(t.prerelease,e.prerelease)}function Gm(t){return t.toFixed(0)}function sn(t){let e=Gm(t.major),r=Gm(t.minor),n=Gm(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(Wn(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 Ml(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(Wn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function Du(t,e){return e.some(r=>Ml(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 wu(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 vu(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:wu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:wu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:wu(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:wu(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:wu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Ul={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},So={operator:void 0,...Ul};function Wm(t,e){return er(t,e)>0}function ds(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:Ii(r.major,`Cannot parse comparator ${t}: invalid major version`),minor:Ii(r.minor,`Cannot parse comparator ${t}: invalid minor version`),patch:Ii(r.patch,`Cannot parse comparator ${t}: invalid patch version`),prerelease:i?Qt(i):[],build:s?nn(s):[]}:Ul;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(`^${jl}`)),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(`^${jl}\\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[So];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[So];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[So];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[So];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 ql(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>Km)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Km}`);t=t.trim();let e=t.match(C_)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Ii(e.major,`Cannot parse version ${t}: invalid major version`),n=Ii(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Ii(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 Wn(t)?!0:Du(t,[[e]]);if(n===void 0)return Wn(e)?!0:Du(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function _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 Za=Ee(xS()),db=Ee(cD()),p8=Ee(LA()),Kp=Ee(zh());var Mi={name:"@capgo/cli",version:"7.56.3",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test: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 Kh(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 Kh("@capgo/cli")??"",e=t?.split(".")[0];t!==Mi.version&&y.warning(`\u{1F6A8} You are using @capgo/cli@${Mi.version} it's not the latest version.
|
|
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 b0=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
|
|
286
|
+
`)}};var d8=require("node:child_process"),Te=require("node:fs"),zp=require("node:os"),xe=Ee(require("node:path")),Un=require("node:process"),os=Ee($l());var Zt=require("fs"),yu=(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},Ll=(t=yu(),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 Bl(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 Vm(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 Co="0|[1-9]\\d*",i4="\\d*[a-zA-Z-][a-zA-Z0-9-]*",s4=`(?<major>${Co})\\.(?<minor>${Co})\\.(?<patch>${Co})`,D_=`(?:${Co}|${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|\\*",Hm=`${Co}|${o4}`,jl=`[v=\\s]*(?<major>${Hm})(?:\\.(?<minor>${Hm})(?:\\.(?<patch>${Hm})${E_}?${b_}?)?)?`,A_=new RegExp(`^(?<operator>~>?|\\^|${S_})\\s*${jl}$`),O_=new RegExp(`^(?<operator>${S_})\\s*(${__})$|^$`);function zm(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Km=256;var a4=new RegExp(`^${Co}$`);function Qt(t){return t.split(".").filter(Boolean).map(e=>{if(a4.test(e)){let r=Number(e);if(zm(r))return r}return e})}function nn(t){return t.split(".").filter(Boolean)}function Pi(t,e){let r=Number(t);if(!zm(r))throw new TypeError(e);return r}function Wn(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:Bl(t.major,e.major)||Bl(t.minor,e.minor)||Bl(t.patch,e.patch)||v_(t.prerelease,e.prerelease)||Vm(t.prerelease,e.prerelease)}function Gm(t){return t.toFixed(0)}function sn(t){let e=Gm(t.major),r=Gm(t.minor),n=Gm(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(Wn(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 Ml(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(Wn(r))continue;let{major:n,minor:i,patch:s,prerelease:o}=r;if(o&&o.length>0&&t.major===n&&t.minor===i&&t.patch===s)return!0}return!1}return!0}function Du(t,e){return e.some(r=>Ml(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 wu(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 vu(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:wu(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:wu(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:wu(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:wu(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:wu(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var Ul={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},So={operator:void 0,...Ul};function Wm(t,e){return er(t,e)>0}function ds(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):[]}:Ul;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(`^${jl}`)),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(`^${jl}\\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[So];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[So];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[So];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[So];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 ql(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>Km)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Km}`);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 Wn(t)?!0:Du(t,[[e]]);if(n===void 0)return Wn(e)?!0:Du(e,[[t]]);let i=er(t,e);return(r===">="||r===">")&&(n===">="||n===">")||(r==="<="||r==="<")&&(n==="<="||n==="<")||i===0&&((r===">="||r==="<=")&&(n===">="||n==="<="))||i===-1&&(r===">="||r===">")&&(n==="<="||n==="<")||i===1&&(r==="<="||r==="<")&&(n===">="||n===">")}function _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 Za=Ee(xS()),db=Ee(cD()),p8=Ee(LA()),Kp=Ee(zh());var ni={name:"@capgo/cli",version:"7.57.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 Kh(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 Kh("@capgo/cli")??"",e=t?.split(".")[0];t!==ni.version&&y.warning(`\u{1F6A8} You are using @capgo/cli@${ni.version} it's not the latest version.
|
|
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 b0=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=b0.Buffer.isBuffer(t)?t:b0.Buffer.from(t);if(e==="crc32")return kY(r);let n=(0,YT.createHash)(e);return n.update(r),n.digest("hex")}var ol=Ee(wM());async function vM(){let t=await(0,ol.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function HE(t,e,r=!1){let n=await(0,ol.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,ol.writeConfig)(i,n.app.extConfigFilePath))}async function Wa(t,e=!1){await HE("CapacitorUpdater",t,e)}var eu=".capgo_key",$r=".capgo_key_v2",Gp=`${eu}.pub`,Ei=`${$r}.pub`,a8="https://capgo.app",u8="https://files.capgo.app",c8="https://api.capgo.app",l8="https://console.capgo.app",pb=12e4,Jle=1024*1024*20,Zle=1024*1024*1024,Qle=1024*1024*99,Qa="package.json",tu=/^(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 Vp(t){return new Promise(e=>{setTimeout(e,t)})}function Lr(t){return(0,os.isMonorepo)(t)?(0,os.findMonorepoRoot)(t):(0,os.isNXMonorepo)(t)?(0,os.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 y.error(i),new Error(i)}let n=(0,Te.readFileSync)(r??(0,xe.join)(t,Qa));return JSON.parse(n)}function as(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 us(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,Qa);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,Qa);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 Wp(e)).get(t);if(c)return c}catch{}return null}async function Wp(t=Lr((0,Un.cwd)()),e=void 0){let r=e?.split(",");if(r??=[(0,xe.join)(t,Qa)],r){for(let i of r)if(!(0,Te.existsSync)(i)){let s=`Package.json at ${i} does not exist`;throw y.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 y.error(e),new Error(e)}return t}catch(t){let e=`No capacitor config file found, run \`cap init\` first ${W(t)}`;throw y.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 HE(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&&(y.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 Xp(){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 y.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 Xp();if(e&&r&&(y.info("Using custom supabase instance from provided options"),n.supaHost=e,n.supaKey=r),!n.supaHost||!n.supaKey)throw y.error("Cannot connect to server please try again later"),new Error("Cannot connect to server please try again later");return(0,Za.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){y.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 y.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||{}),ru=(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 y.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")?(y.info("Please accept/deny the organization invitation before trying to access the app"),new Error("Organization invitation pending")):(y.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 y.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){y.error(`Cannot get cli warnings: ${W(i)}`);return}if(n.length>0){y.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"){y.error(`Invalid cli warning: ${o}`);continue}let a=o;a.fatal?(y.error(`${a.message.replaceAll("\\n",`
|
|
289
289
|
`)}`),s=new Error(a.message)):y.warn(`${a.message.replaceAll("\\n",`
|
|
290
290
|
`)}`)}if(s)throw y.error("Please fix the warnings and try again."),s;y.info("End of cli warnings.")}}async function E8(t,e,r,n,i=!0){let s=await Xp();if(!await(n?sfe(t,n,r):ife(t,e)))throw y.error(`You need to upgrade your plan to continue to use capgo.
|
|
@@ -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
|
`),Vp(100),Promise.resolve().then(()=>(fb(),lb)).then(c=>{c.default(`${s.hostWeb}/settings/organization/plans`)}),Vp(500),new Error("Plan upgrade required for upload");let[a,u]=await Promise.all([D8(t,e),y8(t,e)]);a>0&&i&&!u&&y.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||y.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,zp.homedir)(),n,i=`${r}/.capgo`;if((0,Te.existsSync)(i)&&(t||y.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||y.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 y.error(s),new Error(s)}return n}function nu(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 mb(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 Za.FunctionsHttpError){let o=await s.error.context.json();y.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){y.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",ll="7.0.30";function cs(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ds(t,lt(e))||t.major===6&&ds(t,lt(r))||t.major===7&&ds(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))){y.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){y.info(`Ignoring empty file ${n}, please ensure you have only required files in your dist folder`);continue}let s=await ni(i,"sha256"),o=(0,xe.relative)(t,n);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:s})}return e}async function Yp(t){return(0,zp.platform)()==="win32"?afe(t):ofe(t)}function ofe(t){let e=new db.default;return e.addLocalFolder(t),e.toBuffer()}async function afe(t){y.info("Zipping file windows mode");let e=new db.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 Kp.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(y.error(`Error uploading bundle: ${h.message}`),h instanceof Kp.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 Za.FunctionsHttpError){let o=await s.error.context.json();y.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Za.FunctionsHttpError){let s=await i.context.json();y.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else y.error(`Cannot delete failed version: ${W(i)}`)}}async function Jp(t,e){if(!e.app_id||!e.name||!e.created_by)return y.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&&y.info(`Get remove config: for ${e.event}`);let n=await Xp();r&&y.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&&y.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(y.error("Failed to send Stats event details:"),y.error(W(n)))}}async function Zp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw y.error("Cannot get the list of organizations - exiting"),y.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 y.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw y.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 y.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return y.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 y.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 y.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 iu(t){return new Date(t||"").toLocaleString()}var h8=!1,Ja="npm",cl="install",hb="npx";function qn(){if(h8)return{pm:Ja,command:cl,installCommand:`${Ja} ${cl}`,runner:hb};let t=Lr((0,Un.cwd)());return Ja=yu(t,"npm"),cl=Ll(Ja),h8=!0,hb=y_(t),{pm:Ja,command:cl,installCommand:`${Ja} ${cl}`,runner:hb}}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 gb(t,e){let r=e?e.split(","):[],n;try{n=await Wp("",t)}catch(l){throw y.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(Qa,""):Lr((0,Un.cwd)());if(!n)throw y.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 y.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=yu(s,"npm"),h=Ll(l);throw y.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 g of o){let v=(0,xe.join)(g,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,Qa);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 y.error(`Error reading node_modules files for ${l} package in ${g}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let g=yu(s,"npm"),v=Ll(g);return y.error(`Missing dependency ${l}, please run ${g} ${v}`),{name:l,version:h}}return{name:l,version:p,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw y.error("Missing dependencies or invalid dependencies"),y.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 y.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 y.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 y.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 y.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||y.info("Use CAPGO_TOKEN environment variable"),e;let r=(0,zp.homedir)(),n,i=`${r}/.capgo`;if((0,Te.existsSync)(i)&&(t||y.info(`Use global API key ${i}`),n=(0,Te.readFileSync)(i,"utf8").trim()),i=".capgo",!n&&(0,Te.existsSync)(i)&&(t||y.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 y.error(s),new Error(s)}return n}function nu(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 mb(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 Za.FunctionsHttpError){let o=await s.error.context.json();y.error(`Upload URL error: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot get upload url: ${s.error.message}`);return""}return s.data.url}catch(i){y.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",ll="7.0.30";function cs(t,e="5.10.0",r="6.25.0",n="7.25.0"){return!!(t.major===5&&ds(t,lt(e))||t.major===6&&ds(t,lt(r))||t.major===7&&ds(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))){y.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){y.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 Yp(t){return(0,zp.platform)()==="win32"?afe(t):ofe(t)}function ofe(t){let e=new db.default;return e.addLocalFolder(t),e.toBuffer()}async function afe(t){y.info("Zipping file windows mode");let e=new db.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 Kp.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(y.error(`Error uploading bundle: ${h.message}`),h instanceof Kp.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 Za.FunctionsHttpError){let o=await s.error.context.json();y.error(`Cannot delete failed version: ${o.status||JSON.stringify(o)}`)}else y.error(`Cannot delete failed version: ${s.error.message}`);return}return s.data?.status}catch(i){if(i instanceof Za.FunctionsHttpError){let s=await i.context.json();y.error(`Cannot delete failed version: ${s.message||JSON.stringify(s)}`)}else y.error(`Cannot delete failed version: ${W(i)}`)}}async function Jp(t,e){if(!e.app_id||!e.name||!e.created_by)return y.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&&y.info(`Get remove config: for ${e.event}`);let n=await Xp();r&&y.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&&y.error(`Failed to send LogSnag event: ${a.error}`)}finally{clearTimeout(s)}}catch(n){r&&(y.error("Failed to send Stats event details:"),y.error(W(n)))}}async function Zp(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");if(r)throw y.error("Cannot get the list of organizations - exiting"),y.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 y.error("Could not get organization please create an organization first"),new Error("No organizations available");if(i.length===0)throw y.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 y.error("Canceled organization selection, exiting"),new Error("Organization selection cancelled");let o=s,a=n.find(u=>u.gid===o);return y.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 y.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 y.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 iu(t){return new Date(t||"").toLocaleString()}var h8=!1,Ja="npm",cl="install",hb="npx";function qn(){if(h8)return{pm:Ja,command:cl,installCommand:`${Ja} ${cl}`,runner:hb};let t=Lr((0,Un.cwd)());return Ja=yu(t,"npm"),cl=Ll(Ja),h8=!0,hb=y_(t),{pm:Ja,command:cl,installCommand:`${Ja} ${cl}`,runner:hb}}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 gb(t,e){let r=e?e.split(","):[],n;try{n=await Wp("",t)}catch(l){throw y.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(Qa,""):Lr((0,Un.cwd)());if(!n)throw y.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 y.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=yu(s,"npm"),h=Ll(l);throw y.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 g of o){let v=(0,xe.join)(g,l);if((0,Te.existsSync)(v)){d=!0;try{let E=(0,xe.join)(v,Qa);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 y.error(`Error reading node_modules files for ${l} package in ${g}`),console.error(E),E instanceof Error?E:new Error(`Error reading node_modules files for ${l}`)}}}if(!d){u=!0;let g=yu(s,"npm"),v=Ll(g);return y.error(`Missing dependency ${l}, please run ${g} ${v}`),{name:l,version:h}}return{name:l,version:p,native:f}})).catch(()=>[]);if(u||c.find(l=>l.native===void 0))throw y.error("Missing dependencies or invalid dependencies"),y.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 y.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 y.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 y.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 y.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 y.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=xt();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"),y.error(`Cannot upload the same bundle content.
|
|
301
301
|
Current bundle checksum matches remote bundle for channel ${r}
|
|
@@ -319,10 +319,10 @@ ${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||y.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function wb(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||y.error(o),new Error(`${o}: ${W(s)}`)}}async function em(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 wb(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,iu(n.created_at),n.keep??""]);y.success("Bundles"),y.success(r.toString())}async function tm(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||y.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||y.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||y.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var su=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||y.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||y.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||y.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||y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||y.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||(y.error(`Invalid app ID format: "${t}"`),y.info("App ID must be in reverse domain notation (e.g., com.example.app)"),y.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),y.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||y.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||y.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 Zp(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||y.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||y.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,su.existsSync)(l)?(h=(0,su.readFileSync)(l),d=nu(l)||"image/png",n||y.warn(`Found app icon ${l}`)):(0,su.existsSync)(Qr)?(h=(0,su.readFileSync)(Qr),d=nu(Qr)||"image/png",n||y.warn(`Found app icon ${Qr}`)):n||y.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||y.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:g}=await o.from("apps").insert({icon_url:p,owner_org:u,user_id:a,name:c,app_id:s});if(g)throw n||y.error(`Could not add app ${W(g)}`),new Error(`Could not add app ${W(g)}`);return n||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.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");{y.warn("Deleting the app is not recommended for users that are not the organization owner"),y.warn("You are invited as a super_admin but your are not the owner"),y.warn("It's strongly recommended that you do not continue!");let g=await gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(g)||g==="no")throw y.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&y.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&&y.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&y.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||y.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||(y.success("App deleted in Capgo"),le("Done \u2705")),!0}var rm=require("node:os"),W8=require("node:process");async function G8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Kh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function pfe(){let t=await Wp(),e={"@capgo/cli":Mi.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||y.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=as("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Le("",r?.config),a=r?.config?.webDir||"";e||(y.info(` App Name: ${s}`),y.info(` App ID: ${o}`),y.info(` App Version: ${i}`),y.info(` Web Dir: ${a}`),y.info(` OS: ${(0,rm.platform)()} ${(0,rm.version)()}`),y.info(` Node: ${W8.version}`),y.info(" Installed Dependencies:"));let u=await pfe();if(Object.keys(u).length===0)throw e||y.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))y.info(` ${l}: ${u[l]}`);let c={};if(e)c=await G8(u);else{let l=xt();l.start("Running: Loading latest dependencies"),c=await G8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))y.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||y.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||y.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,iu(r.created_at)]);y.success("Apps"),y.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||y.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||y.info("Getting active bundle in Capgo");let n=await gfe(r,e);if(!n.length)throw e||y.error("No apps found"),new Error("No apps found");return e||(y.info(`Active app in Capgo: ${n.length}`),mfe(n),le("Done \u2705")),n}var J8=require("node:crypto"),ou=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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.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 Zp(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||y.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||y.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||y.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)()}`,g="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ou.existsSync)(c)?(d=(0,ou.readFileSync)(c),f=nu(c)||"image/png",r||y.warn(`Found app icon ${c}`)):(0,ou.existsSync)(Qr)?(d=(0,ou.readFileSync)(Qr),f=nu(Qr)||"image/png",r||y.warn(`Found app icon ${Qr}`)):r||y.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||y.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);g=A?.publicUrl||g}let{error:v}=await i.from("apps").update({icon_url:g,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||y.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||y.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||y.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||y.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||y.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 Wa(n,!0),r||y.success(`Set "${t}" to "${o}"`)}catch(n){throw r||y.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"),Eb=require("node:process");var i6=Ee(cD()),sm=Ee(zh());var nm=require("node:fs/promises"),e6=require("node:os"),im=require("node:path"),Ie=require("node:process"),yfe=(0,im.join)((0,e6.homedir)(),".capgo-credentials"),Dfe=(0,im.join)(yfe,"credentials.json"),wfe=".capgo-credentials.json";function vfe(t){return t?(0,im.join)((0,Ie.cwd)(),wfe):Dfe}async function vb(t){try{let e=vfe(t),r=await(0,nm.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Efe(t,e){if(e!==void 0){let i=await vb(e);if(!t){let s=Object.keys(i);return s.length===0?null:i[s[0]]||null}return i[t]||null}let r=await vb(!0),n=await vb(!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,s=!1){if(i)return null;let o=null,a=!1,u=`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`;y.info(`Connecting to log stream: ${u}`);try{let c=await fetch(u,{headers:{authorization:n}});if(y.info(`Log stream response: ${c.status}`),!c.ok){let p=await c.text().catch(()=>"unknown error");return y.warn(`Could not stream logs (${c.status}): ${p}`),null}let l=c.body?.getReader();if(!l)return y.warn("No response body for log stream"),null;y.info("Reading log stream...");let h=new TextDecoder,d="",f=p=>{if(!p.trim())return;let g=p.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(g){o=g[1].toLowerCase();return}o||(a||(a=!0,y.info("")),y.info(p))};for(;;){let{done:p,value:g}=await l.read();if(p)break;d+=h.decode(g,{stream:!0});let v=d.split(`
|
|
322
|
+
`).eq("app_id",e).order("created_at",{ascending:!1});if(i)throw r||y.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${W(i)}`);return n}async function wb(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||y.error(o),new Error(`${o}: ${W(s)}`)}}async function em(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 wb(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,iu(n.created_at),n.keep??""]);y.success("Bundles"),y.success(r.toString())}async function tm(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||y.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||y.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||y.error(a),new Error(`${a}${o?`: ${W(o)}`:""}`)}return s}var su=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||y.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||y.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw i||y.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||y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||y.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||(y.error(`Invalid app ID format: "${t}"`),y.info("App ID must be in reverse domain notation (e.g., com.example.app)"),y.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),y.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||y.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||y.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 Zp(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||y.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||y.info(`Adding ${s} to Capgo`);let h=null,d=null;l&&(0,su.existsSync)(l)?(h=(0,su.readFileSync)(l),d=nu(l)||"image/png",n||y.warn(`Found app icon ${l}`)):(0,su.existsSync)(Qr)?(h=(0,su.readFileSync)(Qr),d=nu(Qr)||"image/png",n||y.warn(`Found app icon ${Qr}`)):n||y.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||y.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:g}=await o.from("apps").insert({icon_url:p,owner_org:u,user_id:a,name:c,app_id:s});if(g)throw n||y.error(`Could not add app ${W(g)}`),new Error(`Could not add app ${W(g)}`);return n||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.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");{y.warn("Deleting the app is not recommended for users that are not the organization owner"),y.warn("You are invited as a super_admin but your are not the owner"),y.warn("It's strongly recommended that you do not continue!");let g=await gn({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(st(g)||g==="no")throw y.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&y.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&&y.error("Could not delete app logo");let{error:d}=await o.storage.from(`apps/${s}/${a}`).remove(["versions"]);d&&!r&&y.error("Could not delete app version");let{error:f}=await o.from("apps").delete().eq("app_id",s);if(f)throw r||y.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||(y.success("App deleted in Capgo"),le("Done \u2705")),!0}var rm=require("node:os"),W8=require("node:process");async function G8(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(i=>Kh(i)))).forEach((i,s)=>{i&&(e[r[s]]=i)}),e}async function pfe(){let t=await Wp(),e={"@capgo/cli":ni.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||y.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await de(),n=as("",t.packageJson),i=r?.config?.plugins?.CapacitorUpdater?.version||n,s=r?.config?.appName||"",o=Le("",r?.config),a=r?.config?.webDir||"";e||(y.info(` App Name: ${s}`),y.info(` App ID: ${o}`),y.info(` App Version: ${i}`),y.info(` Web Dir: ${a}`),y.info(` OS: ${(0,rm.platform)()} ${(0,rm.version)()}`),y.info(` Node: ${W8.version}`),y.info(" Installed Dependencies:"));let u=await pfe();if(Object.keys(u).length===0)throw e||y.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))y.info(` ${l}: ${u[l]}`);let c={};if(e)c=await G8(u);else{let l=xt();l.start("Running: Loading latest dependencies"),c=await G8(u),l.stop("Latest Dependencies:");for(let h of Object.keys(c))y.info(` ${h}: ${c[h]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||y.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||y.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,iu(r.created_at)]);y.success("Apps"),y.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||y.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||y.info("Getting active bundle in Capgo");let n=await gfe(r,e);if(!n.length)throw e||y.error("No apps found"),new Error("No apps found");return e||(y.info(`Active app in Capgo: ${n.length}`),mfe(n),le("Done \u2705")),n}var J8=require("node:crypto"),ou=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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.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 Zp(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||y.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||y.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||y.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)()}`,g="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ou.existsSync)(c)?(d=(0,ou.readFileSync)(c),f=nu(c)||"image/png",r||y.warn(`Found app icon ${c}`)):(0,ou.existsSync)(Qr)?(d=(0,ou.readFileSync)(Qr),f=nu(Qr)||"image/png",r||y.warn(`Found app icon ${Qr}`)):r||y.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||y.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);g=A?.publicUrl||g}let{error:v}=await i.from("apps").update({icon_url:g,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||y.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||y.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||y.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||y.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||y.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 Wa(n,!0),r||y.success(`Set "${t}" to "${o}"`)}catch(n){throw r||y.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"),Eb=require("node:process");var i6=Ee(cD()),sm=Ee(zh());var nm=require("node:fs/promises"),e6=require("node:os"),im=require("node:path"),Ie=require("node:process"),yfe=(0,im.join)((0,e6.homedir)(),".capgo-credentials"),Dfe=(0,im.join)(yfe,"credentials.json"),wfe=".capgo-credentials.json";function vfe(t){return t?(0,im.join)((0,Ie.cwd)(),wfe):Dfe}async function vb(t){try{let e=vfe(t),r=await(0,nm.readFile)(e,"utf-8");return JSON.parse(r)}catch{return{}}}async function Efe(t,e){if(e!==void 0){let i=await vb(e);if(!t){let s=Object.keys(i);return s.length===0?null:i[s[0]]||null}return i[t]||null}let r=await vb(!0),n=await vb(!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,s=!1){if(i)return null;let o=null,a=!1,u=`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`;y.info(`Connecting to log stream: ${u}`);try{let c=await fetch(u,{headers:{authorization:n}});if(y.info(`Log stream response: ${c.status}`),!c.ok){let p=await c.text().catch(()=>"unknown error");return y.warn(`Could not stream logs (${c.status}): ${p}`),null}let l=c.body?.getReader();if(!l)return y.warn("No response body for log stream"),null;y.info("Reading log stream...");let h=new TextDecoder,d="",f=p=>{if(!p.trim())return;let g=p.match(/^(?:Build|Job already) (succeeded|failed|expired|released|cancelled)$/i);if(g){o=g[1].toLowerCase();return}o||(a||(a=!0,y.info("")),y.info(p))};for(;;){let{done:p,value:g}=await l.read();if(p)break;d+=h.decode(g,{stream:!0});let v=d.split(`
|
|
323
323
|
`);d=v.pop()||"";for(let E of v)if(E.startsWith("data: ")){let A=E.slice(6);f(A)}}if(d.startsWith("data: ")){let p=d.slice(6);f(p)}return o}catch(c){return i||y.warn(`Log streaming interrupted${c instanceof Error?`: ${c.message}`:""}`),null}}async function Cfe(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||y.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||y.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),a++}return s||y.warn("Build status polling timed out"),"timeout"}async function Sfe(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 fl(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){fl(t,a,u,n,i);continue}if(o==="node_modules"){fl(t,a,u,n,i);continue}if(o==="resources"){fl(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}`)))&&fl(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 Afe(t,e,r){let n=await Sfe(t,r),i=new i6.default;fl(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,Eb.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||(y.info(`Requesting native build for ${t}`),y.info(`Platform: ${e.platform}`),y.info(`Project: ${o}`),y.info(`
|
|
324
|
-
\u{1F512} Security: Credentials are never stored on Capgo servers`),y.info(" They are used only during build and deleted after
|
|
325
|
-
`)),i&&y.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||(y.error("\u274C No credentials found for this app and platform"),y.error(""),y.error("You must provide credentials via:"),y.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),y.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),y.error(" 3. Saved credentials file:"),y.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),y.error(""),y.error("Documentation:"),y.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let g=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||g.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(y.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),y.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||g.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||g.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||g.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||g.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||g.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||g.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||g.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&g.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&y.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),g.length>0){if(!r){y.error(`\u274C Missing required credentials for ${e.platform}:`),y.error("");for(let D of g)y.error(` \u2022 ${D}`);y.error(""),y.error("Provide credentials via:"),y.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),y.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),y.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),y.error(""),y.error("Documentation:"),y.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${g.join(", ")}`)}if(p.credentials=f,r||y.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);y.info(`Credentials provided: ${D.join(", ")}`)}r||y.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||(y.success(`Build job created: ${E.job_id}`),y.info(`Status: ${E.status}`)),i&&(y.info(`Upload URL: ${E.upload_url}`),y.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||y.info(`Zipping ${e.platform} project from ${o}...`),await Afe(o,m,e.platform);let w=((await(0,en.stat)(m)).size/1024/1024).toFixed(2);r||y.success(`Created zip: ${m} (${w} MB)`),r||y.info("Uploading to builder..."),i&&(y.info(`Upload endpoint: ${E.upload_url}`),y.info(`File size: ${w} MB`),y.info(`Job ID: ${E.job_id}`));let S=(0,Hn.readFileSync)(m),F=xt();r||F.start("Uploading bundle"),await new Promise((j,K)=>{let L=new sm.Upload(S,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,tn.basename)(m),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(b){if(i){y.info(`[TUS] ${b.getMethod()} ${b.getURL()}`);let T=b.getHeader("authorization");y.info(`[TUS] Authorization header present: ${!!T}`)}},onAfterResponse(b,T){if(i){y.info(`[TUS] Response status: ${T.getStatus()}`);let P=T.getHeader("upload-offset"),$=T.getHeader("tus-resumable");y.info(`[TUS] Upload-Offset: ${P}, Tus-Resumable: ${$}`)}},onError(b){if(r||(F.stop("Upload failed"),y.error(`Upload error: ${b.message}`)),b instanceof sm.DetailedError){let T=b.originalResponse?.getBody(),P=b.originalResponse?.getStatus(),$=b.originalRequest?.getURL();i&&(y.error(`[TUS] Request URL: ${$}`),y.error(`[TUS] Response status: ${P}`),y.error(`[TUS] Response body: ${T}`));let q="Unknown error";try{let M=JSON.parse(T||'{"error": "unknown error"}');q=M.status||M.error||M.message||"unknown error"}catch{q=T||b.message}K(new Error(`TUS upload failed: ${q}`))}else K(new Error(`TUS upload failed: ${b.message||b.toString()}`))},onProgress(b,T){let P=(b/T*100).toFixed(2);r||F.message(`Uploading ${P}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&y.success("TUS upload completed successfully"),j()}});i&&y.info("[TUS] Starting upload..."),L.start()}),r||y.info("Starting build job...");let _=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(!_.ok){let j=await _.text();throw new Error(`Failed to start build: ${_.status} - ${j}`)}let k=await _.json();r||(y.success("Build started!"),y.info("Streaming build logs..."));let R,I=await _fe(a,E.job_id,t,e.apikey,r,i);I?R=I:R=await Cfe(a,E.job_id,t,e.platform,e.apikey,r),r||(R==="succeeded"?y.success("Build completed successfully!"):R==="failed"?y.error("Build failed"):y.warn(`Build finished with status: ${R}`));let B=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:R==="succeeded"?"Build succeeded":"Build failed",icon:R==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:R||"unknown",time:B},notify:!1}).catch(),{success:R==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:R||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||y.error(o),{success:!1,error:o}}}async function Ofe(t,e,r,n){for await(let i of t)n||y.warn(`Removing ${i.name} created on ${iu(i.created_at)}`),await em(e,r,i.name)}function xfe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Wm(s,e)&&ds(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||y.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||y.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||y.info("Querying all available versions in Capgo");let c=await tm(u,t),l=await H8(u,t);if(r||y.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||y.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=lt(n),p=vu(f,"major");r||y.info(`Querying available versions in Capgo between ${sn(f)} and ${sn(p)}`),c=xfe(c,f,p),r||y.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(g=>g===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||y.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 y.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||y.success("You have confirmed removal, removing versions now"),await Ofe(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||y.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.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 Qp(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:g}=d,v=fo(d)?l:h;c.rows.push([f,p,g,v])}y.success("Compatibility"),y.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}var _i=require("node:fs");var Ei=require("node:buffer"),Ut=require("node:crypto"),c6="aes-128-cbc",bi="base64",u6="hex",hl=Ut.constants.RSA_PKCS1_PADDING;function om(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(bi),i=(0,Ut.privateEncrypt)({key:t,padding:hl},r).toString(bi);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function au(t,e,r){let[n]=r.split(":"),i=Ei.Buffer.from(n,bi),s=(0,Ut.createCipheriv)(c6,e,i);return s.setAutoPadding(!0),Ei.Buffer.concat([s.update(t),s.final()])}function l6(t,e,r){let[n,i]=e.split(":"),s=(0,Ut.publicDecrypt)({key:r,padding:hl},Ei.Buffer.from(i,bi)),o=Ei.Buffer.from(n,bi),a=(0,Ut.createDecipheriv)(c6,s,o);return a.setAutoPadding(!0),Ei.Buffer.concat([a.update(t),a.final()])}function uu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:hl},Ei.Buffer.from(t,bi)).toString(bi)}function am(t,e){return(0,Ut.privateEncrypt)({key:e,padding:hl},Ei.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:hl},Ei.Buffer.from(t,bi)).toString(bi)}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 Tfe(t,e){let r=t.key||vi,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,_i.existsSync)(r)?n=(0,_i.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,_i.existsSync)(t)){let h=`Zip not found at the path ${t}`;throw n||y.error(h),new Error(h)}let i=await de();if(!r.key&&!(0,_i.existsSync)(vi)&&!i.config.plugins?.CapacitorUpdater?.publicKey){let h=`Public Key not found at the path ${vi} or in ${i.path}`;throw n||y.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Tfe(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||y.error(h),new Error(h)}let a=(0,_i.readFileSync)(t),u=l6(a,e,r.keyData??s),c=`${t}_decrypted.zip`;(0,_i.writeFileSync)(c,u),n||y.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let h=await ni(u,"sha256"),d=h6(r.checksum,r.keyData??s);if(l=h===d,!l){let f=`Checksum does not match ${h} !== ${d}`;throw n||y.error(f),new Error(f)}n||y.info("Checksum matches")}return n||le("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.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||(y.info(`Deleting bundle ${e}@${t} from Capgo`),y.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await em(s,e,t),n||(y.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Ci=require("node:fs");function dl(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&&y.warning("There is still a privateKey in the config"),!(0,Ci.existsSync)(t)){let E=`Zip not found at the path ${t}`;throw n||(i?dl({error:"zip_not_found"}):y.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?dl({error:"missing_public_key"}):y.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||$r,l=r.keyData||"";if(!(0,Ci.existsSync)(c)&&!l)throw n||(i?dl({error:"missing_key"}):(y.warning(`Cannot find a private key at ${c} or as a keyData option`),y.error("Error: Missing key"))),new Error("Missing private key");if((0,Ci.existsSync)(c)&&(l=(0,Ci.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(i?dl({error:"invalid_private_key"}):y.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let h=(0,Ci.readFileSync)(t),{sessionKey:d,ivSessionKey:f}=om(l),p=au(h,d,f),g=uu(e,l),v=`${t}_encrypted.zip`;return(0,Ci.writeFileSync)(v,p),n||(i?console.log(JSON.stringify({checksum:g,filename:v,ivSessionKey:f},null,2)):(y.success(`Encoded Checksum: ${g}`),y.success(`ivSessionKey: ${f}`),y.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:g,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?dl(o):y.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var KU=require("node:crypto"),Eo=require("node:fs"),bm=require("node:process");var um=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 ls(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("<","<").replaceAll(">",">").replaceAll("&","&")}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 Vn=class extends Error{};var Jt=class extends Vn{},pl=class extends Vn{},cm=class extends Vn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},zn=class extends Vn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},fs=class extends Vn{constructor(){super("accessKey is required")}},cu=class extends Vn{constructor(){super("secretKey is required")}},ml=class extends Vn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Si=class extends Vn{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=ls(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 Si(t.status,n,i,{key:s,bucketName:o,resource:a,region:u})}catch{return new Si(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 hs(t){return!(!Ife(t)||t.length===0)}function Ife(t){return!(typeof t!="string"||t.length>1024)}function gl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function ho(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function _b(t){return t.get("x-amz-version-id")??null}function po(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 po(t).slice(0,8)}function Sb(t,e){return`${Cb(e)}/${t}/s3/aws4_request`}async function lm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),gl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Pfe=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],fm=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 g=a++;try{if(g==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:ho(A.headers.get("etag")??void 0),versionId:_b(A.headers)};return}g===1&&(u=(await Ffe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Pfe){let m=s[A];m&&(v[A]=m)}let E=e.makeRequest({method:"PUT",query:{partNumber:g.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:g,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 Rfe({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 Ffe(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=ls(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 Rfe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
|
|
324
|
+
\u{1F512} Security: Credentials are never stored on Capgo servers`),y.info(" They are used only during build and deleted after"),y.info(` Builds sent directly to app stores - Capgo keeps nothing
|
|
325
|
+
`)),i&&y.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||(y.error("\u274C No credentials found for this app and platform"),y.error(""),y.error("You must provide credentials via:"),y.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),y.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),y.error(" 3. Saved credentials file:"),y.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),y.error(""),y.error("Documentation:"),y.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let g=[];if(e.platform==="ios"?(f.BUILD_CERTIFICATE_BASE64||g.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!f.P12_PASSWORD&&!r&&(y.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),y.warn(" If your certificate requires a password, provide it with --p12-password")),f.BUILD_PROVISION_PROFILE_BASE64||g.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),f.APPLE_KEY_ID||g.push("APPLE_KEY_ID (or --apple-key-id)"),f.APPLE_ISSUER_ID||g.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),f.APPLE_KEY_CONTENT||g.push("APPLE_KEY_CONTENT (or --apple-key-content)"),f.APP_STORE_CONNECT_TEAM_ID||g.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(f.ANDROID_KEYSTORE_FILE||g.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),f.KEYSTORE_KEY_ALIAS||g.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!f.KEYSTORE_KEY_PASSWORD&&!f.KEYSTORE_STORE_PASSWORD&&g.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!f.PLAY_CONFIG_JSON&&!r&&y.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),g.length>0){if(!r){y.error(`\u274C Missing required credentials for ${e.platform}:`),y.error("");for(let D of g)y.error(` \u2022 ${D}`);y.error(""),y.error("Provide credentials via:"),y.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),y.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),y.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),y.error(""),y.error("Documentation:"),y.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${g.join(", ")}`)}if(p.credentials=f,r||y.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),i){let D=Object.keys(f).filter(w=>f[w]);y.info(`Credentials provided: ${D.join(", ")}`)}r||y.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||(y.success(`Build job created: ${E.job_id}`),y.info(`Status: ${E.status}`)),i&&(y.info(`Upload URL: ${E.upload_url}`),y.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||y.info(`Zipping ${e.platform} project from ${o}...`),await Afe(o,m,e.platform);let w=((await(0,en.stat)(m)).size/1024/1024).toFixed(2);r||y.success(`Created zip: ${m} (${w} MB)`),r||y.info("Uploading to builder..."),i&&(y.info(`Upload endpoint: ${E.upload_url}`),y.info(`File size: ${w} MB`),y.info(`Job ID: ${E.job_id}`));let S=(0,Hn.readFileSync)(m),F=xt();r||F.start("Uploading bundle"),await new Promise((j,K)=>{let L=new sm.Upload(S,{endpoint:E.upload_url,chunkSize:5242880,metadata:{filename:(0,tn.basename)(m),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(b){if(i){y.info(`[TUS] ${b.getMethod()} ${b.getURL()}`);let T=b.getHeader("authorization");y.info(`[TUS] Authorization header present: ${!!T}`)}},onAfterResponse(b,T){if(i){y.info(`[TUS] Response status: ${T.getStatus()}`);let P=T.getHeader("upload-offset"),$=T.getHeader("tus-resumable");y.info(`[TUS] Upload-Offset: ${P}, Tus-Resumable: ${$}`)}},onError(b){if(r||(F.stop("Upload failed"),y.error(`Upload error: ${b.message}`)),b instanceof sm.DetailedError){let T=b.originalResponse?.getBody(),P=b.originalResponse?.getStatus(),$=b.originalRequest?.getURL();i&&(y.error(`[TUS] Request URL: ${$}`),y.error(`[TUS] Response status: ${P}`),y.error(`[TUS] Response body: ${T}`));let q="Unknown error";try{let M=JSON.parse(T||'{"error": "unknown error"}');q=M.status||M.error||M.message||"unknown error"}catch{q=T||b.message}K(new Error(`TUS upload failed: ${q}`))}else K(new Error(`TUS upload failed: ${b.message||b.toString()}`))},onProgress(b,T){let P=(b/T*100).toFixed(2);r||F.message(`Uploading ${P}%`)},onSuccess(){r||F.stop("Upload complete!"),i&&y.success("TUS upload completed successfully"),j()}});i&&y.info("[TUS] Starting upload..."),L.start()}),r||y.info("Starting build job...");let _=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(!_.ok){let j=await _.text();throw new Error(`Failed to start build: ${_.status} - ${j}`)}let k=await _.json();r||(y.success("Build started!"),y.info("Streaming build logs..."));let R,I=await _fe(a,E.job_id,t,e.apikey,r,i);I?R=I:R=await Cfe(a,E.job_id,t,e.platform,e.apikey,r),r||(R==="succeeded"?y.success("Build completed successfully!"):R==="failed"?y.error("Build failed"):y.warn(`Build finished with status: ${R}`));let B=((Date.now()-n)/1e3).toFixed(2);return await _e(e.apikey,{channel:"native-builder",event:R==="succeeded"?"Build succeeded":"Build failed",icon:R==="succeeded"?"\u2705":"\u274C",user_id:c,tags:{"app-id":t,platform:e.platform,status:R||"unknown",time:B},notify:!1}).catch(),{success:R==="succeeded",jobId:E.job_id,uploadUrl:E.upload_url,status:R||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||y.error(o),{success:!1,error:o}}}async function Ofe(t,e,r,n){for await(let i of t)n||y.warn(`Removing ${i.name} created on ${iu(i.created_at)}`),await em(e,r,i.name)}function xfe(t,e,r){let n=[];for(let i of t??[]){let s=lt(i.name);Wm(s,e)&&ds(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||y.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||y.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||y.info("Querying all available versions in Capgo");let c=await tm(u,t),l=await H8(u,t);if(r||y.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||y.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let f=lt(n),p=vu(f,"major");r||y.info(`Querying available versions in Capgo between ${sn(f)} and ${sn(p)}`),c=xfe(c,f,p),r||y.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(g=>g===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||y.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 y.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||y.success("You have confirmed removal, removing versions now"),await Ofe(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||y.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!s)throw r||y.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 Qp(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:g}=d,v=fo(d)?l:h;c.rows.push([f,p,g,v])}y.success("Compatibility"),y.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",hl=Ut.constants.RSA_PKCS1_PADDING;function om(t){let e=(0,Ut.randomBytes)(16),r=(0,Ut.randomBytes)(16),n=e.toString(_i),i=(0,Ut.privateEncrypt)({key:t,padding:hl},r).toString(_i);return{sessionKey:r,ivSessionKey:`${n}:${i}`}}function au(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:hl},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 uu(t,e){return(0,Ut.privateEncrypt)({key:e,padding:hl},bi.Buffer.from(t,_i)).toString(_i)}function am(t,e){return(0,Ut.privateEncrypt)({key:e,padding:hl},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:hl},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 Tfe(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||y.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||y.error(h),new Error(h)}let{publicKey:s,fallbackKeyPath:o}=Tfe(r,i);if(!s){let h=`Cannot find public key ${o} or as keyData option or in ${i.path}`;throw n||y.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||y.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||y.error(f),new Error(f)}n||y.info("Checksum matches")}return n||le("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(i){throw n||y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.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||(y.info(`Deleting bundle ${e}@${t} from Capgo`),y.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await em(s,e,t),n||(y.success(`Bundle ${e}@${t} deleted in Capgo`),le("Done")),!0}var Si=require("node:fs");function dl(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&&y.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?dl({error:"zip_not_found"}):y.error(`Error: ${E}`)),new Error(E)}if(!u)throw n||(i?dl({error:"missing_public_key"}):y.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?dl({error:"missing_key"}):(y.warning(`Cannot find a private key at ${c} or as a keyData option`),y.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?dl({error:"invalid_private_key"}):y.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}=om(l),p=au(h,d,f),g=uu(e,l),v=`${t}_encrypted.zip`;return(0,Si.writeFileSync)(v,p),n||(i?console.log(JSON.stringify({checksum:g,filename:v,ivSessionKey:f},null,2)):(y.success(`Encoded Checksum: ${g}`),y.success(`ivSessionKey: ${f}`),y.success(`Encrypted zip saved at ${v}`),le("Done \u2705"))),{checksum:g,filename:v,ivSessionKey:f}}catch(o){throw n||(r.json?dl(o):y.error(`Error encrypting zip file ${W(o)}`)),o instanceof Error?o:new Error(String(o))}}var KU=require("node:crypto"),Eo=require("node:fs"),bm=require("node:process");var um=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 ls(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("<","<").replaceAll(">",">").replaceAll("&","&")}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 Vn=class extends Error{};var Jt=class extends Vn{},pl=class extends Vn{},cm=class extends Vn{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},zn=class extends Vn{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},fs=class extends Vn{constructor(){super("accessKey is required")}},cu=class extends Vn{constructor(){super("secretKey is required")}},ml=class extends Vn{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},Ai=class extends Vn{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=ls(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 hs(t){return!(!Ife(t)||t.length===0)}function Ife(t){return!(typeof t!="string"||t.length>1024)}function gl(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function ho(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function _b(t){return t.get("x-amz-version-id")??null}function po(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 po(t).slice(0,8)}function Sb(t,e){return`${Cb(e)}/${t}/s3/aws4_request`}async function lm(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),gl(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var Pfe=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],fm=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 g=a++;try{if(g==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:ho(A.headers.get("etag")??void 0),versionId:_b(A.headers)};return}g===1&&(u=(await Ffe({client:e,bucketName:r,objectName:n,metadata:s})).uploadId);let v={"Content-Length":String(d.length)};for(let A of Pfe){let m=s[A];m&&(v[A]=m)}let E=e.makeRequest({method:"PUT",query:{partNumber:g.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:g,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 Rfe({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 Ffe(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=ls(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 Rfe({client:t,bucketName:e,objectName:r,uploadId:n,etags:i}){let s=`
|
|
326
326
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
327
327
|
${i.map(h=>` <Part><PartNumber>${h.part}</PartNumber><ETag>${h.etag}</ETag></Part>`).join(`
|
|
328
328
|
`)}
|
|
@@ -331,22 +331,22 @@ ${W(s)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${W(s)}`)}fun
|
|
|
331
331
|
`)+`
|
|
332
332
|
`,n.join(";").toLowerCase(),i].join(`
|
|
333
333
|
`)}async function C6(t,e,r){let n=await lm(t),i=Sb(r,e);return[yl,po(e),i,n].join(`
|
|
334
|
-
`)}async function Ob(t,e,r){let n=Cb(t),i=await go("AWS4"+r,n),s=await go(i,e),o=await go(s,"s3");return await go(o,"aws4_request")}function xb(t,e,r){return`${t}/${Sb(e,r)}`}async function go(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 fs;if(!t.secretKey)throw new cu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ml;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=xb(t.accessKey,t.region,t.date),n=po(t.date),i={"X-Amz-Algorithm":yl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":yl},{"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=gl(await go(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var Nfe=["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"],$fe=5*1024*1024,Lfe=5*1024*1024*1024,Tb=5*1024*1024*1024*1024,Dl=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 pl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new pl(`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 cm(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 lm(r??new Uint8Array);s.set("x-amz-date",po(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 Si(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 Si(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(!hs(e))throw new zn(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 Si&&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(!hs(e))throw new zn(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 fs;if(!hs(r))throw new zn(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=ls(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:ho(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 g=f.type==="Object"?f.key:f.prefix,v=p.type==="Object"?p.key:p.prefix;return g>v?1:g<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(!hs(e))throw new zn(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<$fe)throw new Jt("Part size should be greater than 5MB");if(a>Lfe)throw new Jt("Part size should be less than 6MB");let u=new um(a),c=new fm({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(!hs(e))throw new zn(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 Nfe)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:ho(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!hs(r))throw new zn(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=ls(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:ho(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 Si&&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(!hs(e))throw new zn(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(vu(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 y.info(`\u{1F522} Auto-bumped version from ${t} to ${r}`),r;let s=await xi({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(vu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var yo=require("node:fs"),hm=require("node:path");function Bfe(t,e){return(0,yo.readFileSync)(t,"utf8").includes(e)}function wl(t,e){let r=(0,yo.readdirSync)(t);for(let n of r){let i=(0,hm.join)(t,n),s=(0,yo.statSync)(i);if(s.isDirectory()){if(wl(i,e))return!0}else if(s.isFile()&&(0,hm.extname)(i)===".js"&&Bfe(i,e))return!0}return!1}function dm(t){return(0,yo.readdirSync)(t).indexOf("index.html")>-1}var LU=require("node:buffer"),BU=require("node:crypto"),hu=require("node:fs"),jU=require("node:os"),vo=require("node:path"),MU=require("node:process"),Em=require("node:stream/consumers"),UU=require("node:zlib");var qU=Ee($U()),HU=Ee(zh());async function Qhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var ede=8192;async function tde(t){let e=Lr((0,MU.cwd)()),r=await us("@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=!cs(n,void 0,void 0,ll);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function rde(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 nde(t,e,r){let i=(0,hu.statSync)(t).size,s=await(0,Em.buffer)((0,hu.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(rde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<ede)return{buffer:s,useBrotli:!1};try{let o=await(0,Em.buffer)((0,hu.createReadStream)(t).pipe((0,UU.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return y.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=xt();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?am(c.hash,s):uu(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 ide(t){return(0,jU.platform)()!=="win32"?t:vo.win32.normalize(t).split(vo.win32.sep).join(vo.posix.sep)}function sde(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&y.warn(`File "${t}" contains spaces in its name.`),e}async function zU(t,e,r,n,i,s,o){let a=xt();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 tde(o);if(d)o.disableBrotli?y.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&y.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 ${ll} (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,g=e.length,v=0;try{a.message(`Uploading ${g} files using TUS protocol`);let E=async S=>{let F=(0,vo.join)(r,S.file),_=ide(S.file),k,R=!1;if(o.disableBrotli)k=await(0,Em.buffer)((0,hu.createReadStream)(F)),R=!1;else{let b=await nde(F,_,o);k=b.buffer,R=b.useBrotli}let I=k;s&&(I=au(k,s.sessionKey,s.ivSessionKey));let B=_;R&&(B=`${_}.br`,v++);let j=sde(B),K=(0,BU.createHash)("sha256").update(S.hash).digest("hex"),L;if(s){let b=LU.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${b}/${K}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${K}_${j}`;return!s&&await Qhe(c,L)?(p++,Promise.resolve({file_name:j,s3_path:L,file_hash:S.hash})):new Promise((b,T)=>{a.message(`Prepare upload partial file: ${_}`),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}]`:"";y.error(`Failed to upload ${_}: ${q}${G}`),T($)},onProgress(){let $=(p/g*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){p++,b({file_name:j,s3_path:L,file_hash:S.hash})}}).start()})},A=500,m=[];for(let S=0;S<e.length;S+=A){let F=e.slice(S,S+A),_=Math.floor(S/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${_}/${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&&y.info(`${v} of ${g} 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 y.error(`Error uploading partial update: ${E}`),y.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return y.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 y.error(t),new Error(t)}async function ode(t,e){let r=as("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,KU.randomUUID)().split("-")[0]}`;return tu.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ade(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 ude(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,Eo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function cde(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(wl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
335
|
-
If you are sure your app has this code, you can use the --no-code-check option`),dm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function lde(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=xt();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await Qp(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(m=>!fo(m)))v.stop(`Bundle NOT compatible with ${n} channel`),y.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,y.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:m}=c.version;(!m||!tu.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||(y.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await gb(r.packageJson,r.nodeModules),a&&(u=s,y.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&&(tu.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 fde(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 y.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){y.error(`\u274C Version ${r} already exists`);let a=x6(r);y.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{y.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 y.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function hde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",p="",g=e.keyV2,v=e.key===!1,E=xt();E.start(`Zipping bundle from ${t}`),h=await Yp(t),E.message("Calculating checksum");let A=Lr((0,bm.cwd)()),m=await us("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=m?lt(m):void 0}catch{w=void 0}if(m?w?D=!cs(w,ll):(m==="link:@capgo/capacitor-updater"||m==="file:.."||m==="file:../")&&(y.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"),(g||e.keyDataV2||(0,Eo.existsSync)($r))&&!v||D?l=await
|
|
334
|
+
`)}async function Ob(t,e,r){let n=Cb(t),i=await go("AWS4"+r,n),s=await go(i,e),o=await go(s,"s3");return await go(o,"aws4_request")}function xb(t,e,r){return`${t}/${Sb(e,r)}`}async function go(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 fs;if(!t.secretKey)throw new cu;if(t.expirySeconds<1||t.expirySeconds>604800)throw new ml;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=xb(t.accessKey,t.region,t.date),n=po(t.date),i={"X-Amz-Algorithm":yl,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},s=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":yl},{"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=gl(await go(l,c)).toLowerCase();return i["X-Amz-Signature"]=h,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:i}}var Nfe=["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"],$fe=5*1024*1024,Lfe=5*1024*1024*1024,Tb=5*1024*1024*1024*1024,Dl=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 pl(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new pl(`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 cm(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 lm(r??new Uint8Array);s.set("x-amz-date",po(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(!hs(e))throw new zn(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(!hs(e))throw new zn(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 fs;if(!hs(r))throw new zn(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=ls(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:ho(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 g=f.type==="Object"?f.key:f.prefix,v=p.type==="Object"?p.key:p.prefix;return g>v?1:g<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(!hs(e))throw new zn(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<$fe)throw new Jt("Part size should be greater than 5MB");if(a>Lfe)throw new Jt("Part size should be less than 6MB");let u=new um(a),c=new fm({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(!hs(e))throw new zn(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 Nfe)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:ho(s.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),s=e.sourceBucketName??i;if(!hs(r))throw new zn(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=ls(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:ho(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(!hs(e))throw new zn(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(vu(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 y.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(vu(r,"minor")),`${t}-beta.1`,`${t}.1`]}catch{return[e,`${t}.1`,`${t}-beta.1`,`${t}-rc.1`]}}var yo=require("node:fs"),hm=require("node:path");function Bfe(t,e){return(0,yo.readFileSync)(t,"utf8").includes(e)}function wl(t,e){let r=(0,yo.readdirSync)(t);for(let n of r){let i=(0,hm.join)(t,n),s=(0,yo.statSync)(i);if(s.isDirectory()){if(wl(i,e))return!0}else if(s.isFile()&&(0,hm.extname)(i)===".js"&&Bfe(i,e))return!0}return!1}function dm(t){return(0,yo.readdirSync)(t).indexOf("index.html")>-1}var LU=require("node:buffer"),BU=require("node:crypto"),hu=require("node:fs"),jU=require("node:os"),vo=require("node:path"),MU=require("node:process"),Em=require("node:stream/consumers"),UU=require("node:zlib");var qU=Ee($U()),HU=Ee(zh());async function Qhe(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var ede=8192;async function tde(t){let e=Lr((0,MU.cwd)()),r=await us("@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=!cs(n,void 0,void 0,ll);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:i}}function rde(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 nde(t,e,r){let i=(0,hu.statSync)(t).size,s=await(0,Em.buffer)((0,hu.createReadStream)(t));if(i===0)return{buffer:s,useBrotli:!1};if(rde(e,r.noBrotliPatterns))return{buffer:s,useBrotli:!1};if(i<ede)return{buffer:s,useBrotli:!1};try{let o=await(0,Em.buffer)((0,hu.createReadStream)(t).pipe((0,UU.createBrotliCompress)({})));return o.length>=i-10?{buffer:s,useBrotli:!1}:{buffer:o,useBrotli:!0}}catch(o){return y.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=xt();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?am(c.hash,s):uu(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 ide(t){return(0,jU.platform)()!=="win32"?t:vo.win32.normalize(t).split(vo.win32.sep).join(vo.posix.sep)}function sde(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&y.warn(`File "${t}" contains spaces in its name.`),e}async function zU(t,e,r,n,i,s,o){let a=xt();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 tde(o);if(d)o.disableBrotli?y.info("Brotli compression disabled by user request"):o.noBrotliPatterns&&y.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 ${ll} (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,g=e.length,v=0;try{a.message(`Uploading ${g} files using TUS protocol`);let E=async S=>{let F=(0,vo.join)(r,S.file),_=ide(S.file),k,R=!1;if(o.disableBrotli)k=await(0,Em.buffer)((0,hu.createReadStream)(F)),R=!1;else{let b=await nde(F,_,o);k=b.buffer,R=b.useBrotli}let I=k;s&&(I=au(k,s.sessionKey,s.ivSessionKey));let B=_;R&&(B=`${_}.br`,v++);let j=sde(B),K=(0,BU.createHash)("sha256").update(S.hash).digest("hex"),L;if(s){let b=LU.Buffer.from(s.ivSessionKey).toString("hex");L=`orgs/${i}/apps/${n}/delta/${b}/${K}_${j}`}else L=`orgs/${i}/apps/${n}/delta/${K}_${j}`;return!s&&await Qhe(c,L)?(p++,Promise.resolve({file_name:j,s3_path:L,file_hash:S.hash})):new Promise((b,T)=>{a.message(`Prepare upload partial file: ${_}`),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}]`:"";y.error(`Failed to upload ${_}: ${q}${G}`),T($)},onProgress(){let $=(p/g*100).toFixed(2);a.message(`Uploading partial update: ${$}%`)},onSuccess(){p++,b({file_name:j,s3_path:L,file_hash:S.hash})}}).start()})},A=500,m=[];for(let S=0;S<e.length;S+=A){let F=e.slice(S,S+A),_=Math.floor(S/A)+1,k=Math.ceil(e.length/A);k>1&&a.message(`Processing batch ${_}/${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&&y.info(`${v} of ${g} 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 y.error(`Error uploading partial update: ${E}`),y.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),E;return y.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 y.error(t),new Error(t)}async function ode(t,e){let r=as("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,KU.randomUUID)().split("-")[0]}`;return tu.test(n)||ut(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function ade(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 ude(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,Eo.existsSync)(i)||ut(`Path ${i} does not exist, build your app first, or provide a valid path`),{appid:n,path:i}}function cde(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(wl(e,"notifyAppReady")||ut(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
335
|
+
If you are sure your app has this code, you can use the --no-code-check option`),dm(e)||ut(`index.html is missing in the root folder of ${e}`))}async function lde(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=xt();v.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:E,localDependencies:A}=await Qp(t,i,n,r.packageJson,r.nodeModules);if(f=E,d=A,f.find(m=>!fo(m)))v.stop(`Bundle NOT compatible with ${n} channel`),y.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=s,y.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:m}=c.version;(!m||!tu.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||(y.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await gb(r.packageJson,r.nodeModules),a&&(u=s,y.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&&(tu.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 fde(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 y.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),le("Bundle version already exists - exiting gracefully \u{1F389}"),!0;if(i){y.error(`\u274C Version ${r} already exists`);let a=x6(r);y.info("\u{1F4A1} Here are some suggestions:"),a.forEach((l,h)=>{y.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 y.info(`\u{1F504} Retrying with new version: ${c}`),c}ut(`Version ${r} already exists ${W(o)}`)}return!1}async function hde(t,e,r,n,i,s,o,a){let u,c,l="",h=null,d="none",f="",p="",g=e.keyV2,v=e.key===!1,E=xt();E.start(`Zipping bundle from ${t}`),h=await Yp(t),E.message("Calculating checksum");let A=Lr((0,bm.cwd)()),m=await us("@capgo/capacitor-updater",A,e.packageJson),D=!1,w;try{w=m?lt(m):void 0}catch{w=void 0}if(m?w?D=!cs(w,ll):(m==="link:@capgo/capacitor-updater"||m==="file:.."||m==="file:../")&&(y.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"),(g||e.keyDataV2||(0,Eo.existsSync)($r))&&!v||D?l=await ii(h,"sha256"):l=await ii(h,"crc32"),E.stop(`Checksum ${D?"SHA256":"CRC32"}: ${l}`),v)y.info("Encryption ignored");else if((g||(0,Eo.existsSync)($r)||e.keyDataV2)&&!e.oldEncryption){let _=typeof g=="string"?g:$r,k=e.keyDataV2||"";!k&&!(0,Eo.existsSync)(_)&&ut(`Cannot find private key ${_}`),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,Eo.readFileSync)(_).toString());let R=w&&!cs(w,"5.30.0","6.30.0","7.30.0");y.info(`Encrypting your bundle with ${R?"V3":"V2"}`);let{sessionKey:I,ivSessionKey:B}=om(k),j=au(h,I,B);l=R?am(l,k):uu(l,k),u=B,c=I,d="v2",f=k,a&&(p=d6(a),e.verbose&&y.info(`[Verbose] Encryption key_id: ${p}`)),e.displayIvSession&&y.info(`Your Iv Session key is ${u},
|
|
336
336
|
keep it safe, you will need it to decrypt your bundle.
|
|
337
337
|
It will be also visible in your dashboard
|
|
338
338
|
`),h=j}let S=Math.floor((h?.byteLength??0)/1024/1024),F=Math.floor(s/1024/1024);return h?.byteLength>s?ut(`The bundle size is ${S} Mb, this is greater than the maximum upload length ${F} Mb, please reduce the size of your bundle`):h?.byteLength>o?(y.warn(`WARNING !!
|
|
339
339
|
The bundle size is ${S} Mb, this may take a while to download for users
|
|
340
340
|
`),y.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
341
341
|
`),e.verbose&&(y.info("[Verbose] Bundle size details:"),y.info(` - Actual size: ${S} MB (${h?.byteLength} bytes)`),y.info(` - Alert threshold: ${Math.floor(o/1024/1024)} MB`),y.info(` - Maximum allowed: ${F} MB`),y.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&&y.info("[Verbose] Event sent successfully")):e.verbose&&y.info(`[Verbose] Bundle size OK: ${S} MB (under ${Math.floor(o/1024/1024)} MB alert threshold)`),e.verbose&&y.info("[Verbose] Bundle preparation complete, returning bundle data"),{zipped:h,ivSessionKey:u,sessionKey:c,checksum:l,encryptionMethod:d,finalKeyData:f,keyId:p}}async function dde(t,e,r,n,i,s,o,a){let u=xt();u.start("Uploading Bundle");let c=performance.now(),l=!1;if(o.verbose&&(y.info("[Verbose] uploadBundleToCapgoCloud called:"),y.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),y.info(` - App ID: ${r}`),y.info(` - Bundle version: ${n}`),y.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),o.dryUpload){u.stop(`Dry run, bundle not uploaded
|
|
342
|
-
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&y.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();if(o.verbose&&y.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?y.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):y.info("Uploading bundle with TUS protocol"),o.verbose&&(y.info("[Verbose] Starting TUS resumable upload..."),y.info(` - Host: ${f.hostWeb}`),y.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await x8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&y.info("[Verbose] TUS upload completed, updating database with R2 path...");let p=`orgs/${i}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:p}).eq("name",n).eq("app_id",r);if(g)return y.error(`Cannot finish TUS upload ${W(g)}`),o.verbose&&y.info(`[Verbose] Database update failed: ${W(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&y.info(`[Verbose] Database updated with R2 path: ${p}`)}else{o.verbose&&y.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let p=await _8(e,r,n);if(!p)return y.error("Cannot get upload url"),o.verbose&&y.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(y.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),y.info(` - Timeout: ${o.timeout||pb}ms`),y.info(" - Retry attempts: 5"),y.info(" - Content-Type: application/zip"));let g=new AbortController,v=setTimeout(()=>g.abort(),o.timeout||pb);try{let E=await fetch(p,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}o.verbose&&y.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),o.verbose&&(y.info(`[Verbose] Upload failed after ${g} seconds`),y.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";y.error(`Upload failed with status ${E}: ${f.message}`)}catch{y.error(`Upload failed: ${f.message}`)}else o.verbose&&y.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?y.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):y.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&y.info("[Verbose] Cleaning up failed version from database..."),await T8(e,r,n),o.verbose&&y.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&&(y.info("[Verbose] Upload successful:"),y.info(` - Upload time: ${d} seconds`),y.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),y.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),y.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&&y.info("[Verbose] Performance event sent successfully")}async function pde(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){y.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){y.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){y.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){y.error(`Cannot delete linked bundle on upload ${W(o)}`);return}y.info("Linked bundle deleted")}async function mde(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 Jp(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?y.info("Your update is now available in your public channel \u{1F389}"):f?.id&&y.info(`Link device to this bundle to try it: ${p}`),r&&y.info(`Bundle url: ${p}`)}else y.warn("The upload key is not allowed to set the version in the channel")}async function gde(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(y.warn("Cannot find default upload channel"),y.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 ${Mi.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&&(y.info("[Verbose] Starting upload process with options:"),y.info(` - API key: ${e.apikey?"provided":"from saved key"}`),y.info(` - Path: ${e.path||"from capacitor config"}`),y.info(` - Channel: ${e.channel||"from default upload channel"}`),y.info(` - Bundle: ${e.bundle||"auto-detected"}`),y.info(` - External: ${e.external||"false"}`),y.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),y.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),y.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=ade(e);e.verbose&&y.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&y.info("[Verbose] Capacitor config loaded successfully");let p=await g8();e.verbose&&(y.info("[Verbose] Remote file config retrieved:"),y.info(` - Max upload length: ${Math.floor(p.maxUploadLength/1024/1024)} MB`),y.info(` - Alert upload size: ${Math.floor(p.alertUploadSize/1024/1024)} MB`),y.info(` - TUS upload: ${p.TUSUpload?"enabled":"disabled"}`),y.info(` - TUS upload forced: ${p.TUSUploadForced?"yes":"no"}`),y.info(` - Partial upload: ${p.partialUpload?"enabled":"disabled"}`),y.info(` - Max chunk size: ${Math.floor(p.maxChunkSize/1024/1024)} MB`));let{appid:g,path:v}=ude(t,e,f.config);e.verbose&&y.info(`[Verbose] App ID: ${g}, Build path: ${v}`);let E=await ode(f.config,e);e.verbose&&y.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",m="none";e.autoSetBundle&&(await m8({version:E}),e.verbose&&y.info("[Verbose] Auto-set bundle version in capacitor.config.json")),cde(e,v),e.verbose&&y.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),y.info(`Upload ${g}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();e.verbose&&y.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(y.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&y.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&y.info("[Verbose] Supabase client created successfully");let S=await De(w,d,["write","all","upload"]);e.verbose&&y.info(`[Verbose] User verified successfully, user_id: ${S}`);let F=e.channel||await gde(g,w,D.hostWeb)||"production";e.verbose&&y.info(`[Verbose] Target channel: ${F}`);let _=await Rr(w,g);e.verbose&&y.info(`[Verbose] Organization ID: ${_}`),await v8(w,_,Mi.version),e.verbose&&y.info("[Verbose] Remote CLI messages checked"),await b8(w,_,d,g,!0),e.verbose&&y.info("[Verbose] Plan validation passed"),e.verbose&&y.info("[Verbose] Trial check completed"),e.verbose&&y.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await lde(w,i,e,F,g,E);e.verbose&&(y.info("[Verbose] Compatibility check completed:"),y.info(` - Native packages: ${k?k.length:0}`),y.info(` - Min update version: ${R||"none"}`)),e.verbose&&y.info(`[Verbose] Checking if version ${E} already exists...`);let I=!r,B=await fde(w,g,E,e.versionExistsOk,I);if(e.verbose&&y.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 y.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&&(y.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),y.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:g,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:_,user_id:S,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0},K=null,L="";if(e.external)e.verbose&&y.info(`[Verbose] Using external URL: ${e.external}`),await _e(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:_,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(y.info("[Verbose] External bundle configured:"),y.info(` - URL: ${e.external}`),y.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),y.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&y.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:z}=await hde(v,e,d,_,g,p.maxUploadLength,p.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=z||void 0,n=V,K=te,m=N,L=ne,e.verbose&&(y.info("[Verbose] Bundle prepared:"),y.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),y.info(` - Checksum: ${O}`),y.info(` - Encryption: ${N}`),y.info(` - IV Session Key: ${x?"present":"none"}`),y.info(` - Key ID: ${z||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&y.info("[Verbose] Checking for duplicate checksum..."),await F8(w,g,F,O),e.verbose&&y.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!p.TUSUpload||e.external?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||p.TUSUploadForced,e.verbose&&y.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!p.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&y.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||p.partialUploadForced,e.verbose&&y.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 b="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&m==="v2"&&!e.encryptPartial){let H=Lr((0,bm.cwd)()),te=await us("@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"))&&(y.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&y.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,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!cs(x,b,T,P),e.verbose&&$&&y.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&y.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await VU(v,d,_,g,e.encryptPartial?m:"none",L,$):[];e.verbose&&e.delta&&y.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&y.info("[Verbose] Creating version record in database...");let{error:M}=await mb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),e.verbose&&y.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>p.maxChunkSize?(y.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&&y.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),K&&(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"),y.info("Uploading to S3"),e.verbose&&(y.info("[Verbose] S3 configuration:"),y.info(` - Endpoint: ${c}`),y.info(` - Region: ${s}`),y.info(` - Bucket: ${u}`),y.info(` - Port: ${l}`),y.info(` - SSL: ${h?"enabled":"disabled"}`));let H=h?`https://${c}`:`http://${c}`,te=new Dl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${g}-${E}`,O=encodeURIComponent(x);e.verbose&&y.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(K)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&y.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(K){!e.partialOnly&&!e.deltaOnly?(e.verbose&&y.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await dde(d,w,g,E,_,K,e,e.tusChunkSize)):e.verbose&&y.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&y.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&&(y.info("[Verbose] Starting delta/partial file upload..."),y.info(` - Manifest entries: ${q.length}`),y.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await zU(d,q,v,g,_,x,e):null,e.verbose&&H&&y.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;y.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&&y.info(`[Verbose] Delta upload error details: ${W(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&y.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await mb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&y.info("[Verbose] Version record updated successfully")}e.verbose&&y.info("[Verbose] Checking app permissions...");let G=await Et(w,d,g,2);e.verbose&&(y.info("[Verbose] Permissions:"),y.info(` - Upload: ${ru(G,2)?"yes":"no"}`),y.info(` - Write: ${ru(G,3)?"yes":"no"}`),y.info(` - Admin: ${ru(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ru(G,3)?(e.verbose&&y.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await pde(w,g,F)):e.deleteLinkedBundleOnUpload&&y.warn("Cannot delete linked bundle on upload as a upload organization member"),ru(G,3)?(e.verbose&&y.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await mde(w,d,!!e.bundleUrl,E,F,S,_,g,D,e.selfAssign),e.verbose&&y.info("[Verbose] Channel updated successfully")):y.warn("Cannot set channel as a upload organization member"),e.verbose&&y.info("[Verbose] Sending upload event..."),await _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:_,tags:{"app-id":g},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&&(y.info("[Verbose] Upload completed successfully:"),y.info(` - Bundle: ${U.bundle}`),y.info(` - Checksum: ${U.checksum}`),y.info(` - Encryption: ${U.encryptionMethod}`),y.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var GU=require("node:crypto"),_m=require("node:fs"),WU=require("node:process");var yde=20;function Dde(t){console.log(JSON.stringify(t,null,2))}function Cl(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=as("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!tu.test(i)){let S=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Cl({error:"invalid_semver"}):y.error(S)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let S="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Cl({error:"missing_argument"}):y.error(S)),new Error(S)}if(o&&y.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!wl(s,"notifyAppReady"))throw r||(n?Cl({error:"notifyAppReady_not_in_source_code"}):y.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(!dm(s))throw r||(n?Cl({error:"index_html_not_found"}):y.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Yp(s);o&&y.info(`Zipped ${d.byteLength} bytes`);let f=o?xt():null;f&&f.start("Calculating checksum");let p=Lr((0,WU.cwd)()),g=await us("@capgo/capacitor-updater",p,e.packageJson);if(!g){let S="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||y.warn(S),new Error(S)}let v=!1,E;try{E=g?lt(g):void 0}catch{E=void 0}E?v=!cs(E,void 0,void 0,"7.0.0"):g==="link:@capgo/capacitor-updater"&&(r||y.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ni(d,e.keyV2||(0,_m.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let m=Math.floor(d.byteLength/1024/1024);m>yde&&o&&(y.warn(`WARNING !!
|
|
342
|
+
Bundle uploaded \u{1F4AA} in 0 seconds`),o.verbose&&y.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let f=await Sn();if(o.verbose&&y.info("[Verbose] Local config retrieved for upload"),o.multipart!==void 0&&o.multipart||o.tus!==void 0&&o.tus){o.multipart?y.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):y.info("Uploading bundle with TUS protocol"),o.verbose&&(y.info("[Verbose] Starting TUS resumable upload..."),y.info(` - Host: ${f.hostWeb}`),y.info(` - Chunk size: ${Math.floor(a/1024/1024)} MB`)),await x8(t,s,i,r,n,u,f,a),l=!0,o.verbose&&y.info("[Verbose] TUS upload completed, updating database with R2 path...");let p=`orgs/${i}/apps/${r}/${n}.zip`,{error:g}=await e.from("app_versions").update({r2_path:p}).eq("name",n).eq("app_id",r);if(g)return y.error(`Cannot finish TUS upload ${W(g)}`),o.verbose&&y.info(`[Verbose] Database update failed: ${W(g)}`),Promise.reject(new Error("Cannot finish TUS upload"));o.verbose&&y.info(`[Verbose] Database updated with R2 path: ${p}`)}else{o.verbose&&y.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let p=await _8(e,r,n);if(!p)return y.error("Cannot get upload url"),o.verbose&&y.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));o.verbose&&(y.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),y.info(` - Timeout: ${o.timeout||pb}ms`),y.info(" - Retry attempts: 5"),y.info(" - Content-Type: application/zip"));let g=new AbortController,v=setTimeout(()=>g.abort(),o.timeout||pb);try{let E=await fetch(p,{method:"PUT",body:s,headers:{"Content-Type":"application/zip"},signal:g.signal});if(!E.ok)throw new Error(`HTTP error! status: ${E.status}`)}finally{clearTimeout(v)}o.verbose&&y.info("[Verbose] HTTP PUT upload completed successfully")}}catch(f){let g=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${g} seconds)`),o.verbose&&(y.info(`[Verbose] Upload failed after ${g} seconds`),y.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";y.error(`Upload failed with status ${E}: ${f.message}`)}catch{y.error(`Upload failed: ${f.message}`)}else o.verbose&&y.info(`[Verbose] Non-HTTP error: ${W(f)}`),o.tus?y.error(`Cannot upload bundle please contact support if the issue persists ${W(f)}`):y.error(`Cannot upload bundle ( try again with --tus option) ${W(f)}`);throw o.verbose&&y.info("[Verbose] Cleaning up failed version from database..."),await T8(e,r,n),o.verbose&&y.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&&(y.info("[Verbose] Upload successful:"),y.info(` - Upload time: ${d} seconds`),y.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),y.info(` - Bundle size: ${Math.floor(s.byteLength/1024)} KB`),y.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&&y.info("[Verbose] Performance event sent successfully")}async function pde(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){y.error(`Cannot delete linked bundle on upload ${W(i)}`);return}if(n.length===0){y.warn("No linked bundle found in the channel you are trying to upload to");return}let s=n[0].version;if(s.deleted){y.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){y.error(`Cannot delete linked bundle on upload ${W(o)}`);return}y.info("Linked bundle deleted")}async function mde(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 Jp(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?y.info("Your update is now available in your public channel \u{1F389}"):f?.id&&y.info(`Link device to this bundle to try it: ${p}`),r&&y.info(`Bundle url: ${p}`)}else y.warn("The upload key is not allowed to set the version in the channel")}async function gde(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(y.warn("Cannot find default upload channel"),y.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 ${ni.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&&(y.info("[Verbose] Starting upload process with options:"),y.info(` - API key: ${e.apikey?"provided":"from saved key"}`),y.info(` - Path: ${e.path||"from capacitor config"}`),y.info(` - Channel: ${e.channel||"from default upload channel"}`),y.info(` - Bundle: ${e.bundle||"auto-detected"}`),y.info(` - External: ${e.external||"false"}`),y.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),y.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),y.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let d=ade(e);e.verbose&&y.info("[Verbose] API key retrieved successfully");let f=await de();e.verbose&&y.info("[Verbose] Capacitor config loaded successfully");let p=await g8();e.verbose&&(y.info("[Verbose] Remote file config retrieved:"),y.info(` - Max upload length: ${Math.floor(p.maxUploadLength/1024/1024)} MB`),y.info(` - Alert upload size: ${Math.floor(p.alertUploadSize/1024/1024)} MB`),y.info(` - TUS upload: ${p.TUSUpload?"enabled":"disabled"}`),y.info(` - TUS upload forced: ${p.TUSUploadForced?"yes":"no"}`),y.info(` - Partial upload: ${p.partialUpload?"enabled":"disabled"}`),y.info(` - Max chunk size: ${Math.floor(p.maxChunkSize/1024/1024)} MB`));let{appid:g,path:v}=ude(t,e,f.config);e.verbose&&y.info(`[Verbose] App ID: ${g}, Build path: ${v}`);let E=await ode(f.config,e);e.verbose&&y.info(`[Verbose] Bundle version: ${E}`);let A=e.external?"external":"r2-direct",m="none";e.autoSetBundle&&(await m8({version:E}),e.verbose&&y.info("[Verbose] Auto-set bundle version in capacitor.config.json")),cde(e,v),e.verbose&&y.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),y.info(`Upload ${g}@${E} started from path "${v}" to Capgo cloud`);let D=await Sn();e.verbose&&y.info(`[Verbose] Local config loaded: host=${D.hostWeb}`),e.supaHost&&e.supaAnon&&(y.info("Using custom supabase instance from provided options"),D.supaHost=e.supaHost,D.supaKey=e.supaAnon,e.verbose&&y.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let w=await pe(d,e.supaHost,e.supaAnon);e.verbose&&y.info("[Verbose] Supabase client created successfully");let S=await De(w,d,["write","all","upload"]);e.verbose&&y.info(`[Verbose] User verified successfully, user_id: ${S}`);let F=e.channel||await gde(g,w,D.hostWeb)||"production";e.verbose&&y.info(`[Verbose] Target channel: ${F}`);let _=await Rr(w,g);e.verbose&&y.info(`[Verbose] Organization ID: ${_}`),await v8(w,_,ni.version),e.verbose&&y.info("[Verbose] Remote CLI messages checked"),await b8(w,_,d,g,!0),e.verbose&&y.info("[Verbose] Plan validation passed"),e.verbose&&y.info("[Verbose] Trial check completed"),e.verbose&&y.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:k,minUpdateVersion:R}=await lde(w,i,e,F,g,E);e.verbose&&(y.info("[Verbose] Compatibility check completed:"),y.info(` - Native packages: ${k?k.length:0}`),y.info(` - Min update version: ${R||"none"}`)),e.verbose&&y.info(`[Verbose] Checking if version ${E} already exists...`);let I=!r,B=await fde(w,g,E,e.versionExistsOk,I);if(e.verbose&&y.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 y.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&&(y.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),y.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:g,session_key:void 0,external_url:e.external,storage_provider:A,min_update_version:R,native_packages:k,owner_org:_,user_id:S,checksum:void 0,link:e.link||null,comment:e.comment||null,key_id:void 0,cli_version:ni.version},K=null,L="";if(e.external)e.verbose&&y.info(`[Verbose] Using external URL: ${e.external}`),await _e(d,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:_,tags:{"app-id":g},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(y.info("[Verbose] External bundle configured:"),y.info(` - URL: ${e.external}`),y.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),y.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&y.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:z}=await hde(v,e,d,_,g,p.maxUploadLength,p.alertUploadSize,H);j.session_key=x,j.checksum=O,j.key_id=z||void 0,n=V,K=te,m=N,L=ne,e.verbose&&(y.info("[Verbose] Bundle prepared:"),y.info(` - Size: ${Math.floor((te?.byteLength??0)/1024)} KB`),y.info(` - Checksum: ${O}`),y.info(` - Encryption: ${N}`),y.info(` - IV Session Key: ${x?"present":"none"}`),y.info(` - Key ID: ${z||"none"}`)),e.ignoreChecksumCheck||(e.verbose&&y.info("[Verbose] Checking for duplicate checksum..."),await F8(w,g,F,O),e.verbose&&y.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!p.TUSUpload||e.external?(e.tus=!1,e.verbose&&y.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||p.TUSUploadForced,e.verbose&&y.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!p.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&y.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||p.partialUploadForced,e.verbose&&y.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 b="5.30.0",T="6.30.0",P="7.30.0",$=!1;if(e.delta&&m==="v2"&&!e.encryptPartial){let H=Lr((0,bm.cwd)()),te=await us("@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"))&&(y.info(`Auto-enabling partial update encryption for updater version ${x} (> 6.14.4)`),e.verbose&&y.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,bm.cwd)()),te=await us("@capgo/capacitor-updater",H,e.packageJson),x;try{x=te?lt(te):void 0}catch{x=void 0}te&&x&&($=!cs(x,b,T,P),e.verbose&&$&&y.info(`[Verbose] Using hex checksum format for updater version ${x}`))}e.verbose&&e.delta&&y.info("[Verbose] Preparing delta/partial update manifest...");let q=e.delta?await VU(v,d,_,g,e.encryptPartial?m:"none",L,$):[];e.verbose&&e.delta&&y.info(`[Verbose] Delta manifest prepared with ${q.length} files`),e.verbose&&y.info("[Verbose] Creating version record in database...");let{error:M}=await mb(w,j);if(M&&ut(`Cannot add bundle ${W(M)}`),e.verbose&&y.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>p.maxChunkSize?(y.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&&y.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),K&&(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"),y.info("Uploading to S3"),e.verbose&&(y.info("[Verbose] S3 configuration:"),y.info(` - Endpoint: ${c}`),y.info(` - Region: ${s}`),y.info(` - Bucket: ${u}`),y.info(` - Port: ${l}`),y.info(` - SSL: ${h?"enabled":"disabled"}`));let H=h?`https://${c}`:`http://${c}`,te=new Dl({endPoint:c,region:s,port:l,pathStyle:!0,bucket:u,accessKey:o,secretKey:a}),x=`${g}-${E}`,O=encodeURIComponent(x);e.verbose&&y.info(`[Verbose] Uploading to S3 as: ${x}`),await te.putObject(x,Uint8Array.from(K)),j.external_url=`${H}/${O}`,j.storage_provider="external",e.verbose&&y.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(K){!e.partialOnly&&!e.deltaOnly?(e.verbose&&y.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await dde(d,w,g,E,_,K,e,e.tusChunkSize)):e.verbose&&y.info("[Verbose] Skipping full bundle upload (delta-only mode)");let H=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&y.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&&(y.info("[Verbose] Starting delta/partial file upload..."),y.info(` - Manifest entries: ${q.length}`),y.info(` - Encryption: ${x?"enabled":"disabled"}`)),H=e.delta?await zU(d,q,v,g,_,x,e):null,e.verbose&&H&&y.info(`[Verbose] Delta upload complete with ${H.length} files`)}catch(x){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw x;y.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&&y.info(`[Verbose] Delta upload error details: ${W(x)}`)}j.storage_provider="r2",j.manifest=H,e.verbose&&y.info("[Verbose] Updating version record with storage provider and manifest...");let{error:te}=await mb(w,j);te&&ut(`Cannot update bundle ${W(te)}`),e.verbose&&y.info("[Verbose] Version record updated successfully")}e.verbose&&y.info("[Verbose] Checking app permissions...");let G=await Et(w,d,g,2);e.verbose&&(y.info("[Verbose] Permissions:"),y.info(` - Upload: ${ru(G,2)?"yes":"no"}`),y.info(` - Write: ${ru(G,3)?"yes":"no"}`),y.info(` - Admin: ${ru(G,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&ru(G,3)?(e.verbose&&y.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await pde(w,g,F)):e.deleteLinkedBundleOnUpload&&y.warn("Cannot delete linked bundle on upload as a upload organization member"),ru(G,3)?(e.verbose&&y.info(`[Verbose] Setting bundle ${E} to channel ${F}...`),await mde(w,d,!!e.bundleUrl,E,F,S,_,g,D,e.selfAssign),e.verbose&&y.info("[Verbose] Channel updated successfully")):y.warn("Cannot set channel as a upload organization member"),e.verbose&&y.info("[Verbose] Sending upload event..."),await _e(d,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:_,tags:{"app-id":g},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&&(y.info("[Verbose] Upload completed successfully:"),y.info(` - Bundle: ${U.bundle}`),y.info(` - Checksum: ${U.checksum}`),y.info(` - Encryption: ${U.encryptionMethod}`),y.info(` - Storage: ${U.storageProvider}`)),r&&!U.skipped&&le("Time to share your update to the world \u{1F30D}"),U}var GU=require("node:crypto"),_m=require("node:fs"),WU=require("node:process");var yde=20;function Dde(t){console.log(JSON.stringify(t,null,2))}function Cl(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=as("",e.packageJson);if(i=i||l||`0.0.1-beta.${c}`,o&&ae(`Zipping ${u}@${i}`),i&&!tu.test(i)){let S=`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Cl({error:"invalid_semver"}):y.error(S)),new Error("Invalid bundle version format")}if(s=s||a?.config?.webDir,!u||!i||!s){let S="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Cl({error:"missing_argument"}):y.error(S)),new Error(S)}if(o&&y.info(`Started from path "${s}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!wl(s,"notifyAppReady"))throw r||(n?Cl({error:"notifyAppReady_not_in_source_code"}):y.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(!dm(s))throw r||(n?Cl({error:"index_html_not_found"}):y.error(`index.html is missing in the root folder of ${s}`)),new Error("index.html is missing in root folder")}let d=await Yp(s);o&&y.info(`Zipped ${d.byteLength} bytes`);let f=o?xt():null;f&&f.start("Calculating checksum");let p=Lr((0,WU.cwd)()),g=await us("@capgo/capacitor-updater",p,e.packageJson);if(!g){let S="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||y.warn(S),new Error(S)}let v=!1,E;try{E=g?lt(g):void 0}catch{E=void 0}E?v=!cs(E,void 0,void 0,"7.0.0"):g==="link:@capgo/capacitor-updater"&&(r||y.warn("Using local @capgo/capacitor-updater. Assuming v7"),v=!0);let A=await ii(d,e.keyV2||(0,_m.existsSync)($r)||v?"sha256":"crc32");f&&f.stop(`Checksum ${v?"SHA256":"CRC32"}: ${A}`);let m=Math.floor(d.byteLength/1024/1024);m>yde&&o&&(y.warn(`WARNING !!
|
|
343
343
|
The bundle size is ${m} Mb, this may take a while to download for users
|
|
344
344
|
`),y.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
345
345
|
`));let D=o?xt():null,w=e.name||`${u}_${i}.zip`;return D&&D.start(`Saving to ${w}`),(0,_m.writeFileSync)(w,d),D&&D.stop(`Saved to ${w}`),o&&le("Done \u2705"),!r&&n&&Dde({bundle:i,filename:w,checksum:A}),{bundle:i,filename:w,checksum:A}}catch(a){throw r||(n?Cl(a):y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.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||y.info(`Creating channel ${e}#${t} to Capgo`);let o=await Db(s,e);if(!o)throw n||y.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||y.error(`Cannot create Channel \u{1F640}
|
|
346
|
-
${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||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.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||y.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||y.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||y.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?y.info(c.name):y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.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&&y.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await j8(s,e,t);d?.name&&!n&&y.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await wb(s,e,d.name)}let{data:a,error:u}=await L8(s,e,t);if(u||!a){if(n||y.error(`Channel ${t} not found`),r.successIfNotFound)return n||y.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||y.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||y.info(`Deleting channel ${e}#${t} from Capgo`);let l=await $8(s,t,e,o);if(l.error)throw n||y.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||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.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||y.info("Querying available channels in Capgo");let o=await U8(i,t);return r||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.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:g,disableAutoUpdate:v,dev:E,emulator:A}=r;if(h&&u)throw n||y.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||y.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||y.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&&g==null&&E==null&&A==null&&v==null)throw n||y.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||y.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||as("",r.packageJson):u;if(w!=null){let{data:F,error:_}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(_||!F)throw n||y.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await yb(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!fo(B)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.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?y.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):y.info(`Bundle is compatible with ${t} channel`))}n||y.info(`Set ${e} channel: ${t} to @${w}`),m.version=F.id}if(d){let{data:F,error:_}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(_||!F)throw n||y.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await yb(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!fo(I)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||y.info(`Set ${e} channel: ${t} to @${F.name}`),m.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||y.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||y.info(`Set ${e} channel: ${t} to ${c}`),m.public=c==="default"}if(l!=null&&(n||y.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),m.disable_auto_update_under_native=!l),f!=null&&(n||y.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),m.ios=!!f),p!=null&&(n||y.info(`Set ${e} channel: ${t} to ${p?"allow":"disallow"} android update`),m.android=!!p),g!=null&&(n||y.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),m.allow_device_self_set=!!g),E!=null&&(n||y.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),m.allow_dev=!!E),A!=null&&(n||y.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||y.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||y.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:S}=await Jp(s,m);if(S)throw n||y.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||vi,i=t.keyData||"";if(!(0,dr.existsSync)(n)&&!i)throw e||y.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||y.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||y.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 Wa(r)}return e||(y.success(`Public key saved into ${r.path} file in local directory`),y.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 Wa(r),(0,dr.existsSync)(eu))try{(0,dr.unlinkSync)(eu),e||y.success(`Old private key file deleted: ${eu}`)}catch(i){e||y.error(`Failed to delete old private key file: ${eu} (${String(i)})`)}if((0,dr.existsSync)(Gp))try{(0,dr.unlinkSync)(Gp),e||y.success(`Old public key file deleted: ${Gp}`)}catch(i){e||y.error(`Failed to delete old public key file: ${vi} (${String(i)})`)}return e||(y.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||y.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)(vi)&&!t.force)throw e||y.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,dr.writeFileSync)(vi,r),(0,dr.existsSync)($r)&&!t.force)throw e||y.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||y.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 Wa(i)}if(!e){y.success("Your RSA key has been generated"),y.success(`Private key saved in ${$r}`),y.success("This key will be used to encrypt your bundle before sending it to Capgo"),y.success("Keep it safe"),y.success("Then make it unreadable by Capgo and unmodifiable by anyone"),y.success(`Public key saved in ${i.path}`),y.success("Your app will be the only one having it"),y.success("Only your users can decrypt your update"),y.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 bo=require("node:fs"),oq=require("node:os");async function aq(t,e,r=!1){if(r||ae("Login to Capgo"),!t)throw r||y.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,bo.existsSync)(".git"))throw r||y.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,bo.writeFileSync)(".capgo",`${t}
|
|
346
|
+
${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||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.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||y.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||y.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||y.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?y.info(c.name):y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.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&&y.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let d=await j8(s,e,t);d?.name&&!n&&y.info(`Deleting bundle ${d.name} from Capgo`),d?.name&&await wb(s,e,d.name)}let{data:a,error:u}=await L8(s,e,t);if(u||!a){if(n||y.error(`Channel ${t} not found`),r.successIfNotFound)return n||y.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||y.error(`Cannot delete channel devices: ${W(c)}`),new Error(`Cannot delete channel devices: ${W(c)}`);n||y.info(`Deleting channel ${e}#${t} from Capgo`);let l=await $8(s,t,e,o);if(l.error)throw n||y.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||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||y.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||y.info("Querying available channels in Capgo");let o=await U8(i,t);return r||(y.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||y.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||y.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||y.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:g,disableAutoUpdate:v,dev:E,emulator:A}=r;if(h&&u)throw n||y.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(d&&u)throw n||y.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||y.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&&g==null&&E==null&&A==null&&v==null)throw n||y.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||y.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let w=h?i?.config?.plugins?.CapacitorUpdater?.version||as("",r.packageJson):u;if(w!=null){let{data:F,error:_}=await s.from("app_versions").select().eq("app_id",e).eq("name",w).eq("user_id",o).eq("deleted",!1).single();if(_||!F)throw n||y.error(`Cannot find version ${w}`),new Error(`Cannot find version ${w}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:k,localDependencies:R}=await yb(s,e,t,F.native_packages??[]),I=qn();if(R.length>0&&k.some(B=>!fo(B)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.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?y.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):y.info(`Bundle is compatible with ${t} channel`))}n||y.info(`Set ${e} channel: ${t} to @${w}`),m.version=F.id}if(d){let{data:F,error:_}=await s.from("app_versions").select().eq("app_id",e).eq("user_id",o).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(_||!F)throw n||y.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:k}=await yb(s,e,t,F.native_packages??[]),R=qn();if(k.some(I=>!fo(I)))throw n||(y.warn(`Bundle NOT compatible with ${t} channel`),y.warn(`You can check compatibility with "${R.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||y.info(`Set ${e} channel: ${t} to @${F.name}`),m.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||y.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||y.info(`Set ${e} channel: ${t} to ${c}`),m.public=c==="default"}if(l!=null&&(n||y.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),m.disable_auto_update_under_native=!l),f!=null&&(n||y.info(`Set ${e} channel: ${t} to ${f?"allow":"disallow"} ios update`),m.ios=!!f),p!=null&&(n||y.info(`Set ${e} channel: ${t} to ${p?"allow":"disallow"} android update`),m.android=!!p),g!=null&&(n||y.info(`Set ${e} channel: ${t} to ${g?"allow":"disallow"} self assign to this channel`),m.allow_device_self_set=!!g),E!=null&&(n||y.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} dev devices`),m.allow_dev=!!E),A!=null&&(n||y.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||y.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||y.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:S}=await Jp(s,m);if(S)throw n||y.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||y.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||y.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||y.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 Wa(r)}return e||(y.success(`Public key saved into ${r.path} file in local directory`),y.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 Wa(r),(0,dr.existsSync)(eu))try{(0,dr.unlinkSync)(eu),e||y.success(`Old private key file deleted: ${eu}`)}catch(i){e||y.error(`Failed to delete old private key file: ${eu} (${String(i)})`)}if((0,dr.existsSync)(Gp))try{(0,dr.unlinkSync)(Gp),e||y.success(`Old public key file deleted: ${Gp}`)}catch(i){e||y.error(`Failed to delete old public key file: ${Ei} (${String(i)})`)}return e||(y.success(`Old private key deleted from ${r.path} file`),le("Done \u2705")),!0}return e||y.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||y.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||y.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||y.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 Wa(i)}if(!e){y.success("Your RSA key has been generated"),y.success(`Private key saved in ${$r}`),y.success("This key will be used to encrypt your bundle before sending it to Capgo"),y.success("Keep it safe"),y.success("Then make it unreadable by Capgo and unmodifiable by anyone"),y.success(`Public key saved in ${i.path}`),y.success("Your app will be the only one having it"),y.success("Only your users can decrypt your update"),y.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 bo=require("node:fs"),oq=require("node:os");async function aq(t,e,r=!1){if(r||ae("Login to Capgo"),!t)throw r||y.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,bo.existsSync)(".git"))throw r||y.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,bo.writeFileSync)(".capgo",`${t}
|
|
347
347
|
`),(0,bo.appendFileSync)(".gitignore",`.capgo
|
|
348
348
|
`)}else{let o=(0,oq.homedir)();(0,bo.writeFileSync)(`${o}/.capgo`,`${t}
|
|
349
|
-
`)}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||(y.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||y.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 xi({message:"Organization name:",placeholder:"My Organization"});if(st(c))throw y.error("Canceled adding organization"),new Error("Organization creation cancelled");s=c}if(!e&&!o){let c=await xi({message:"Management email:",placeholder:"admin@example.com"});if(st(c))throw y.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||y.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||y.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||(y.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||y.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||y.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||y.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");y.warn("Deleting an organization is restricted to the organization owner"),y.warn("You are not the owner of this organization"),y.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 y.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 y.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||y.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||y.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||(y.success(`Organization "${o.name}" deleted from Capgo`),le("Done \u2705")),!0}function wde(t,e){if(e)return;if(!t.length){y.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"]);y.success("Organizations"),y.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||y.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||y.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||y.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(y.info(`Organizations found: ${o.length}`),wde(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||y.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||y.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||y.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 xi({message:"New organization name:",placeholder:s.name||"My Organization"});if(st(l))throw y.error("Canceled updating organization"),new Error("Organization update cancelled");a=l}if(!r&&!u){let l=await xi({message:"Management email:",placeholder:s.management_email||"admin@example.com"});if(st(l))throw y.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||y.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||y.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||(y.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||y.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||y.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 tm(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 vde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Ede(t){return new nt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function bde(t){return new nt().doctor(t)}async function _de(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Cde(t){return new nt().encryptBundle(t)}async function Sde(t){return new nt().decryptBundle(t)}async function Ade(t){return new nt().zipBundle(t)}async function Ode(t){return new nt().generateEncryptionKeys(t)}async function xde(t){return new nt().saveEncryptionKey(t)}async function Tde(t){return new nt().deleteLegacyEncryptionKey(t)}async function Ide(t,e,r){return new nt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Pde(t,e){return new nt({apikey:e.apikey}).setAppSetting(t,e)}async function Fde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Rde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function kde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function Nde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function $de(t,e){return new nt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function Lde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function Bde(t,e){return new nt(e).listBundles(t)}async function jde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function Mde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function Ude(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function qde(){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});
|
|
349
|
+
`)}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||(y.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||y.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 y.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 y.error("Canceled adding organization"),new Error("Organization creation cancelled");o=c}if(!s||!o)throw e||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");e||y.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||y.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||(y.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||y.error("Missing API key, you need to provide an API key to delete an organization"),new Error("Missing API key");if(!t)throw r||y.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||y.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");y.warn("Deleting an organization is restricted to the organization owner"),y.warn("You are not the owner of this organization"),y.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 y.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 y.error("Canceled deleting the organization"),new Error("Organization deletion cancelled")}r||y.info(`Deleting organization "${o.name}"`);let{error:u}=await i.from("orgs").delete().eq("id",t);if(u)throw r||y.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||(y.success(`Organization "${o.name}" deleted from Capgo`),le("Done \u2705")),!0}function wde(t,e){if(e)return;if(!t.length){y.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"]);y.success("Organizations"),y.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||y.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||y.info("Getting organizations from Capgo");let{error:i,data:s}=await n.rpc("get_orgs_v6");if(i)throw e||y.error(`Cannot get organizations ${W(i)}`),new Error(`Cannot get organizations: ${W(i)}`);let o=s||[];return e||(y.info(`Organizations found: ${o.length}`),wde(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||y.error("Missing API key, you need to provide an API key to update an organization"),new Error("Missing API key");if(!t)throw r||y.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||y.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 y.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 y.error("Canceled updating organization"),new Error("Organization update cancelled");u=l}if(!a||!u)throw r||y.error("Missing arguments, you need to provide an organization name and management email"),new Error("Missing organization name or management email");r||y.info(`Updating organization "${t}"`);let{error:c}=await i.from("orgs").update({name:a,management_email:u}).eq("id",t);if(c)throw r||y.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||(y.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||y.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||y.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 tm(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 vde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).uploadBundle(t)}async function Ede(t){return new nt({supaHost:t.supaHost,supaAnon:t.supaAnon}).login(t)}async function bde(t){return new nt().doctor(t)}async function _de(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).checkBundleCompatibility(t)}async function Cde(t){return new nt().encryptBundle(t)}async function Sde(t){return new nt().decryptBundle(t)}async function Ade(t){return new nt().zipBundle(t)}async function Ode(t){return new nt().generateEncryptionKeys(t)}async function xde(t){return new nt().saveEncryptionKey(t)}async function Tde(t){return new nt().deleteLegacyEncryptionKey(t)}async function Ide(t,e,r){return new nt({apikey:r?.apikey,supaHost:r?.supaHost,supaAnon:r?.supaAnon}).getCurrentBundle(t,e,r)}async function Pde(t,e){return new nt({apikey:e.apikey}).setAppSetting(t,e)}async function Fde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).getAccountId(t)}async function Rde(t){return new nt({apikey:t?.apikey,supaHost:t?.supaHost,supaAnon:t?.supaAnon}).listOrganizations(t)}async function kde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addOrganization(t)}async function Nde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).updateOrganization(t)}async function $de(t,e){return new nt({apikey:e?.apikey,supaHost:e?.supaHost,supaAnon:e?.supaAnon}).deleteOrganization(t,e)}async function Lde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addApp(t)}async function Bde(t,e){return new nt(e).listBundles(t)}async function jde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).addChannel(t)}async function Mde(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).requestBuild(t)}async function Ude(t){return new nt({apikey:t.apikey,supaHost:t.supaHost,supaAnon:t.supaAnon}).getStats(t)}async function qde(){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});
|
|
350
350
|
/*! Bundled license information:
|
|
351
351
|
|
|
352
352
|
tus-js-client/lib.es5/upload.js:
|