@capgo/cli 4.20.3 → 4.20.5
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 +15 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ Expecting one of '${i.join("', '")}'`);let n=`${t}Help`;return this.on(n,a=>{let
|
|
|
26
26
|
`+Object.keys(i).map(n=>`${n}: ${i[n]}`).join(`\r
|
|
27
27
|
`)+`\r
|
|
28
28
|
\r
|
|
29
|
-
`+r)}function hl(e,t,r,i,n){if(e.listenerCount("wsClientError")){let a=new Error(n);Error.captureStackTrace(a,hl),e.emit("wsClientError",a,r,t)}else dh(r,i,n)}});var _L=g((idt,vL)=>{"use strict";var Bs=h7();Bs.createWebSocketStream=uL();Bs.Server=yL();Bs.Receiver=a7();Bs.Sender=o7();Bs.WebSocket=Bs;Bs.WebSocketServer=Bs.Server;vL.exports=Bs});var bL=g(Qn=>{"use strict";var e9e=Qn&&Qn.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),t9e=Qn&&Qn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wL=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e9e(t,e,r);return t9e(t,e),t},v7=Qn&&Qn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qn,"__esModule",{value:!0});var Ur=Gg(),r9e=v7(hI()),i9e=v7(q_()),n9e=Wg(),a9e=v7(K_()),s9e=()=>{},o9e=typeof WebSocket<"u",g7=class{constructor(t,r){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=Ur.DEFAULT_HEADERS,this.params={},this.timeout=Ur.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=s9e,this.conn=null,this.sendBuffer=[],this.serializer=new r9e.default,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=a=>{let s;return a?s=a:typeof fetch>"u"?s=(...o)=>Promise.resolve().then(()=>wL(Zo())).then(({default:u})=>u(...o)):s=fetch,(...o)=>s(...o)},this.endPoint=`${t}/${Ur.TRANSPORTS.websocket}`,this.httpEndpoint=(0,n9e.httpEndpointURL)(t),r?.transport?this.transport=r.transport:this.transport=null,r?.params&&(this.params=r.params),r?.headers&&(this.headers=Object.assign(Object.assign({},this.headers),r.headers)),r?.timeout&&(this.timeout=r.timeout),r?.logger&&(this.logger=r.logger),r?.heartbeatIntervalMs&&(this.heartbeatIntervalMs=r.heartbeatIntervalMs);let n=(i=r?.params)===null||i===void 0?void 0:i.apikey;n&&(this.accessToken=n,this.apiKey=n),this.reconnectAfterMs=r?.reconnectAfterMs?r.reconnectAfterMs:a=>[1e3,2e3,5e3,1e4][a-1]||1e4,this.encode=r?.encode?r.encode:(a,s)=>s(JSON.stringify(a)),this.decode=r?.decode?r.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new i9e.default(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(o9e){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new y7(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>wL(_L())).then(({default:t})=>{this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(t,r){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,r??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){let r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.disconnect(),t}log(t,r,i){this.logger(t,r,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Ur.SOCKET_STATES.connecting:return Ur.CONNECTION_STATE.Connecting;case Ur.SOCKET_STATES.open:return Ur.CONNECTION_STATE.Open;case Ur.SOCKET_STATES.closing:return Ur.CONNECTION_STATE.Closing;default:return Ur.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Ur.CONNECTION_STATE.Open}channel(t,r={config:{}}){let i=new a9e.default(`realtime:${t}`,r,this);return this.channels.push(i),i}push(t){let{topic:r,event:i,payload:n,ref:a}=t,s=()=>{this.encode(t,o=>{var u;(u=this.conn)===null||u===void 0||u.send(o)})};this.log("push",`${r} ${i} (${a})`,n),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(t){this.accessToken=t,this.channels.forEach(r=>{t&&r.updateJoinPayload({access_token:t}),r.joinedOnce&&r._isJoined()&&r._push(Ur.CHANNEL_EVENTS.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(i=>i.topic===t&&(i._isJoined()||i._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r._joinRef()!==t._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Ur.VSN}))}_onConnMessage(t){this.decode(t.data,r=>{let{topic:i,event:n,payload:a,ref:s}=r;(s&&s===this.pendingHeartbeatRef||n===a?.type)&&(this.pendingHeartbeatRef=null),this.log("receive",`${a.status||""} ${i} ${n} ${s&&"("+s+")"||""}`,a),this.channels.filter(o=>o._isMember(i)).forEach(o=>o._trigger(n,a,s)),this.stateChangeCallbacks.message.forEach(o=>o(r))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(r=>r(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(r=>r(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(Ur.CHANNEL_EVENTS.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;let i=t.match(/\?/)?"&":"?",n=new URLSearchParams(r);return`${t}${i}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(Ur.WS_CLOSE_NORMAL,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}};Qn.default=g7;var y7=class{constructor(t,r,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Ur.SOCKET_STATES.connecting,this.send=()=>{},this.url=null,this.url=t,this.close=i.close}}});var _7=g(Je=>{"use strict";var u9e=Je&&Je.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),l9e=Je&&Je.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DL=Je&&Je.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&u9e(t,e,r);return l9e(t,e),t},c9e=Je&&Je.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Je,"__esModule",{value:!0});Je.REALTIME_CHANNEL_STATES=Je.REALTIME_SUBSCRIBE_STATES=Je.REALTIME_PRESENCE_LISTEN_EVENTS=Je.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Je.REALTIME_LISTEN_TYPES=Je.RealtimeClient=Je.RealtimeChannel=Je.RealtimePresence=void 0;var p9e=c9e(bL());Je.RealtimeClient=p9e.default;var fh=DL(K_());Je.RealtimeChannel=fh.default;Object.defineProperty(Je,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return fh.REALTIME_LISTEN_TYPES}});Object.defineProperty(Je,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return fh.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Je,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return fh.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Je,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return fh.REALTIME_CHANNEL_STATES}});var EL=DL(H_());Je.RealtimePresence=EL.default;Object.defineProperty(Je,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return EL.REALTIME_PRESENCE_LISTEN_EVENTS}})});var mh=g(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.StorageUnknownError=Sa.StorageApiError=Sa.isStorageError=Sa.StorageError=void 0;var hh=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};Sa.StorageError=hh;function d9e(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}Sa.isStorageError=d9e;var w7=class extends hh{constructor(t,r){super(t),this.name="StorageApiError",this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}};Sa.StorageApiError=w7;var b7=class extends hh{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}};Sa.StorageUnknownError=b7});var s6=g(pr=>{"use strict";var f9e=pr&&pr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),h9e=pr&&pr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xL=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&f9e(t,e,r);return h9e(t,e),t},m9e=pr&&pr.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(pr,"__esModule",{value:!0});pr.recursiveToCamel=pr.resolveResponse=pr.resolveFetch=void 0;var g9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>xL(Zo())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};pr.resolveFetch=g9e;var y9e=()=>m9e(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>xL(Zo()))).Response:Response});pr.resolveResponse=y9e;var v9e=e=>{if(Array.isArray(e))return e.map(r=>(0,pr.recursiveToCamel)(r));if(typeof e=="function"||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([r,i])=>{let n=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));t[n]=(0,pr.recursiveToCamel)(i)}),t};pr.recursiveToCamel=v9e});var x7=g(xi=>{"use strict";var ml=xi&&xi.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(xi,"__esModule",{value:!0});xi.remove=xi.head=xi.put=xi.post=xi.get=void 0;var D7=mh(),_9e=s6(),E7=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),w9e=(e,t,r)=>ml(void 0,void 0,void 0,function*(){let i=yield(0,_9e.resolveResponse)();e instanceof i&&!r?.noResolveJson?e.json().then(n=>{t(new D7.StorageApiError(E7(n),e.status||500))}).catch(n=>{t(new D7.StorageUnknownError(E7(n),n))}):t(new D7.StorageUnknownError(E7(e),e))}),b9e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json"},t?.headers),i&&(n.body=JSON.stringify(i)),Object.assign(Object.assign({},n),r))};function gh(e,t,r,i,n,a){return ml(this,void 0,void 0,function*(){return new Promise((s,o)=>{e(r,b9e(t,i,n,a)).then(u=>{if(!u.ok)throw u;return i?.noResolveJson?u:u.json()}).then(u=>s(u)).catch(u=>w9e(u,o,i))})})}function D9e(e,t,r,i){return ml(this,void 0,void 0,function*(){return gh(e,"GET",t,r,i)})}xi.get=D9e;function E9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"POST",t,i,n,r)})}xi.post=E9e;function x9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"PUT",t,i,n,r)})}xi.put=x9e;function C9e(e,t,r,i){return ml(this,void 0,void 0,function*(){return gh(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),i)})}xi.head=C9e;function S9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"DELETE",t,i,n,r)})}xi.remove=S9e});var AL=g(yh=>{"use strict";var Ci=yh&&yh.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(yh,"__esModule",{value:!0});var Si=mh(),Aa=x7(),CL=s6(),A9e={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},SL={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},C7=class{constructor(t,r={},i,n){this.url=t,this.headers=r,this.bucketId=i,this.fetch=(0,CL.resolveFetch)(n)}uploadOrUpdate(t,r,i,n){return Ci(this,void 0,void 0,function*(){try{let a,s=Object.assign(Object.assign({},SL),n),o=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(s.upsert)}),u=s.metadata;typeof Blob<"u"&&i instanceof Blob?(a=new FormData,a.append("cacheControl",s.cacheControl),a.append("",i),u&&a.append("metadata",this.encodeMetadata(u))):typeof FormData<"u"&&i instanceof FormData?(a=i,a.append("cacheControl",s.cacheControl),u&&a.append("metadata",this.encodeMetadata(u))):(a=i,o["cache-control"]=`max-age=${s.cacheControl}`,o["content-type"]=s.contentType,u&&(o["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),n?.headers&&(o=Object.assign(Object.assign({},o),n.headers));let l=this._removeEmptyFolders(r),c=this._getFinalPath(l),p=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:t,body:a,headers:o},s?.duplex?{duplex:s.duplex}:{})),d=yield p.json();return p.ok?{data:{path:l,id:d.Id,fullPath:d.Key},error:null}:{data:null,error:d}}catch(a){if((0,Si.isStorageError)(a))return{data:null,error:a};throw a}})}upload(t,r,i){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,i)})}uploadToSignedUrl(t,r,i,n){return Ci(this,void 0,void 0,function*(){let a=this._removeEmptyFolders(t),s=this._getFinalPath(a),o=new URL(this.url+`/object/upload/sign/${s}`);o.searchParams.set("token",r);try{let u,l=Object.assign({upsert:SL.upsert},n),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&i instanceof Blob?(u=new FormData,u.append("cacheControl",l.cacheControl),u.append("",i)):typeof FormData<"u"&&i instanceof FormData?(u=i,u.append("cacheControl",l.cacheControl)):(u=i,c["cache-control"]=`max-age=${l.cacheControl}`,c["content-type"]=l.contentType);let p=yield this.fetch(o.toString(),{method:"PUT",body:u,headers:c}),d=yield p.json();return p.ok?{data:{path:a,fullPath:d.Key},error:null}:{data:null,error:d}}catch(u){if((0,Si.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,r){return Ci(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),n=Object.assign({},this.headers);r?.upsert&&(n["x-upsert"]="true");let a=yield(0,Aa.post)(this.fetch,`${this.url}/object/upload/sign/${i}`,{},{headers:n}),s=new URL(this.url+a.url),o=s.searchParams.get("token");if(!o)throw new Si.StorageError("No token returned by API");return{data:{signedUrl:s.toString(),path:t,token:o},error:null}}catch(i){if((0,Si.isStorageError)(i))return{data:null,error:i};throw i}})}update(t,r,i){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,i)})}move(t,r,i){return Ci(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers}),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}copy(t,r,i){return Ci(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Aa.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrl(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t),a=yield(0,Aa.post)(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:r},i?.transform?{transform:i.transform}:{}),{headers:this.headers}),s=i?.download?`&download=${i.download===!0?"":i.download}`:"";return a={signedUrl:encodeURI(`${this.url}${a.signedURL}${s}`)},{data:a,error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrls(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=yield(0,Aa.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),a=i?.download?`&download=${i.download===!0?"":i.download}`:"";return{data:n.map(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.signedURL}${a}`):null})),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}download(t,r){return Ci(this,void 0,void 0,function*(){let n=typeof r?.transform<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString(r?.transform||{}),s=a?`?${a}`:"";try{let o=this._getFinalPath(t);return{data:yield(yield(0,Aa.get)(this.fetch,`${this.url}/${n}/${o}${s}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if((0,Si.isStorageError)(o))return{data:null,error:o};throw o}})}info(t){return Ci(this,void 0,void 0,function*(){let r=this._getFinalPath(t);try{let i=yield(0,Aa.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,CL.recursiveToCamel)(i),error:null}}catch(i){if((0,Si.isStorageError)(i))return{data:null,error:i};throw i}})}exists(t){return Ci(this,void 0,void 0,function*(){let r=this._getFinalPath(t);try{return yield(0,Aa.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(i){if((0,Si.isStorageError)(i)&&i instanceof Si.StorageUnknownError){let n=i.originalError;if([400,404].includes(n?.status))return{data:!1,error:i}}throw i}})}getPublicUrl(t,r){let i=this._getFinalPath(t),n=[],a=r?.download?`download=${r.download===!0?"":r.download}`:"";a!==""&&n.push(a);let o=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&n.push(u);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${i}${l}`)}}}remove(t){return Ci(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if((0,Si.isStorageError)(r))return{data:null,error:r};throw r}})}list(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},A9e),r),{prefix:t||""});return{data:yield(0,Aa.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},i),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}};yh.default=C7});var OL=g(o6=>{"use strict";Object.defineProperty(o6,"__esModule",{value:!0});o6.version=void 0;o6.version="2.7.0"});var TL=g(u6=>{"use strict";Object.defineProperty(u6,"__esModule",{value:!0});u6.DEFAULT_HEADERS=void 0;var O9e=OL();u6.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${O9e.version}`}});var FL=g(vh=>{"use strict";var Tp=vh&&vh.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(vh,"__esModule",{value:!0});var T9e=TL(),Fp=mh(),kp=x7(),F9e=s6(),S7=class{constructor(t,r={},i){this.url=t,this.headers=Object.assign(Object.assign({},T9e.DEFAULT_HEADERS),r),this.fetch=(0,F9e.resolveFetch)(i)}listBuckets(){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.get)(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if((0,Fp.isStorageError)(t))return{data:null,error:t};throw t}})}getBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.get)(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(t,r={public:!1}){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.post)(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,Fp.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(t,r){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.put)(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,Fp.isStorageError)(i))return{data:null,error:i};throw i}})}emptyBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.post)(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.remove)(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}};vh.default=S7});var NL=g(Np=>{"use strict";var kL=Np&&Np.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Np,"__esModule",{value:!0});Np.StorageClient=void 0;var k9e=kL(AL()),N9e=kL(FL()),A7=class extends N9e.default{constructor(t,r={},i){super(t,r,i)}from(t){return new k9e.default(this.url,this.headers,t,this.fetch)}};Np.StorageClient=A7});var PL=g(RL=>{"use strict";Object.defineProperty(RL,"__esModule",{value:!0})});var LL=g(Oa=>{"use strict";var R9e=Oa&&Oa.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),IL=Oa&&Oa.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&R9e(t,e,r)};Object.defineProperty(Oa,"__esModule",{value:!0});Oa.StorageClient=void 0;var P9e=NL();Object.defineProperty(Oa,"StorageClient",{enumerable:!0,get:function(){return P9e.StorageClient}});IL(PL(),Oa);IL(mh(),Oa)});var BL=g(l6=>{"use strict";Object.defineProperty(l6,"__esModule",{value:!0});l6.version=void 0;l6.version="2.45.2"});var jL=g(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.DEFAULT_REALTIME_OPTIONS=Wi.DEFAULT_AUTH_OPTIONS=Wi.DEFAULT_DB_OPTIONS=Wi.DEFAULT_GLOBAL_OPTIONS=Wi.DEFAULT_HEADERS=void 0;var I9e=BL(),_h="";typeof Deno<"u"?_h="deno":typeof document<"u"?_h="web":typeof navigator<"u"&&navigator.product==="ReactNative"?_h="react-native":_h="node";Wi.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${_h}/${I9e.version}`};Wi.DEFAULT_GLOBAL_OPTIONS={headers:Wi.DEFAULT_HEADERS};Wi.DEFAULT_DB_OPTIONS={schema:"public"};Wi.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Wi.DEFAULT_REALTIME_OPTIONS={}});var $L=g(dr=>{"use strict";var L9e=dr&&dr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),B9e=dr&&dr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),j9e=dr&&dr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&L9e(t,e,r);return B9e(t,e),t},q9e=dr&&dr.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(dr,"__esModule",{value:!0});dr.fetchWithAuth=dr.resolveHeadersConstructor=dr.resolveFetch=void 0;var qL=j9e(Zo()),$9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=qL.default:t=fetch,(...r)=>t(...r)};dr.resolveFetch=$9e;var M9e=()=>typeof Headers>"u"?qL.Headers:Headers;dr.resolveHeadersConstructor=M9e;var U9e=(e,t,r)=>{let i=(0,dr.resolveFetch)(r),n=(0,dr.resolveHeadersConstructor)();return(a,s)=>q9e(void 0,void 0,void 0,function*(){var o;let u=(o=yield t())!==null&&o!==void 0?o:e,l=new n(s?.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${u}`),i(a,Object.assign(Object.assign({},s),{headers:l}))})};dr.fetchWithAuth=U9e});var ML=g(vn=>{"use strict";var V9e=vn&&vn.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(vn,"__esModule",{value:!0});vn.applySettingDefaults=vn.isBrowser=vn.stripTrailingSlash=vn.uuid=void 0;function H9e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e=="x"?t:t&3|8;return r.toString(16)})}vn.uuid=H9e;function z9e(e){return e.replace(/\/$/,"")}vn.stripTrailingSlash=z9e;var G9e=()=>typeof window<"u";vn.isBrowser=G9e;function W9e(e,t){let{db:r,auth:i,realtime:n,global:a}=e,{db:s,auth:o,realtime:u,global:l}=t,c={db:Object.assign(Object.assign({},s),r),auth:Object.assign(Object.assign({},o),i),realtime:Object.assign(Object.assign({},u),n),global:Object.assign(Object.assign({},l),a),accessToken:()=>V9e(this,void 0,void 0,function*(){return""})};return e.accessToken?c.accessToken=e.accessToken:delete c.accessToken,c}vn.applySettingDefaults=W9e});var O7=g(c6=>{"use strict";Object.defineProperty(c6,"__esModule",{value:!0});c6.version=void 0;c6.version="2.64.4"});var p6=g(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.API_VERSIONS=fr.API_VERSION_HEADER_NAME=fr.NETWORK_FAILURE=fr.EXPIRY_MARGIN=fr.DEFAULT_HEADERS=fr.AUDIENCE=fr.STORAGE_KEY=fr.GOTRUE_URL=void 0;var K9e=O7();fr.GOTRUE_URL="http://localhost:9999";fr.STORAGE_KEY="supabase.auth.token";fr.AUDIENCE="";fr.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${K9e.version}`};fr.EXPIRY_MARGIN=10;fr.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};fr.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";fr.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}}});var Rp=g(de=>{"use strict";var Y9e=de&&de.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),X9e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J9e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Y9e(t,e,r);return X9e(t,e),t};Object.defineProperty(de,"__esModule",{value:!0});de.parseResponseAPIVersion=de.getCodeChallengeAndMethod=de.generatePKCEChallenge=de.generatePKCEVerifier=de.retryable=de.sleep=de.decodeJWTPayload=de.Deferred=de.decodeBase64URL=de.removeItemAsync=de.getItemAsync=de.setItemAsync=de.looksLikeFetchResponse=de.resolveFetch=de.parseParametersFromURL=de.supportsLocalStorage=de.isBrowser=de.uuid=de.expiresAt=void 0;var Z9e=p6();function Q9e(e){return Math.round(Date.now()/1e3)+e}de.expiresAt=Q9e;function e5e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}de.uuid=e5e;var t5e=()=>typeof document<"u";de.isBrowser=t5e;var gl={tested:!1,writable:!1},r5e=()=>{if(!(0,de.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gl.tested)return gl.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gl.tested=!0,gl.writable=!0}catch{gl.tested=!0,gl.writable=!1}return gl.writable};de.supportsLocalStorage=r5e;function i5e(e){let t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,a)=>{t[a]=n})}catch{}return r.searchParams.forEach((i,n)=>{t[n]=i}),t}de.parseParametersFromURL=i5e;var n5e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>J9e(Zo())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};de.resolveFetch=n5e;var a5e=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function";de.looksLikeFetchResponse=a5e;var s5e=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))};de.setItemAsync=s5e;var o5e=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}};de.getItemAsync=o5e;var u5e=async(e,t)=>{await e.removeItem(t)};de.removeItemAsync=u5e;function UL(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="",i,n,a,s,o,u,l,c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)s=t.indexOf(e.charAt(c++)),o=t.indexOf(e.charAt(c++)),u=t.indexOf(e.charAt(c++)),l=t.indexOf(e.charAt(c++)),i=s<<2|o>>4,n=(o&15)<<4|u>>2,a=(u&3)<<6|l,r=r+String.fromCharCode(i),u!=64&&n!=0&&(r=r+String.fromCharCode(n)),l!=64&&a!=0&&(r=r+String.fromCharCode(a));return r}de.decodeBase64URL=UL;var d6=class e{constructor(){this.promise=new e.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}};de.Deferred=d6;d6.promiseConstructor=Promise;function l5e(e){let t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,r=e.split(".");if(r.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(r[1]))throw new Error("JWT is not valid: payload is not in base64url format");let i=r[1];return JSON.parse(UL(i))}de.decodeJWTPayload=l5e;async function c5e(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}de.sleep=c5e;function p5e(e,t){return new Promise((i,n)=>{(async()=>{for(let a=0;a<1/0;a++)try{let s=await e(a);if(!t(a,null,s)){i(s);return}}catch(s){if(!t(a,s)){n(s);return}}})()})}de.retryable=p5e;function d5e(e){return("0"+e.toString(16)).substr(-2)}function VL(){let t=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=r.length,n="";for(let a=0;a<56;a++)n+=r.charAt(Math.floor(Math.random()*i));return n}return crypto.getRandomValues(t),Array.from(t,d5e).join("")}de.generatePKCEVerifier=VL;async function f5e(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(i);return Array.from(n).map(a=>String.fromCharCode(a)).join("")}function h5e(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function HL(e){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."),e;let r=await f5e(e);return h5e(r)}de.generatePKCEChallenge=HL;async function m5e(e,t,r=!1){let i=VL(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await(0,de.setItemAsync)(e,`${t}-code-verifier`,n);let a=await HL(i);return[a,i===a?"plain":"s256"]}de.getCodeChallengeAndMethod=m5e;var g5e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function y5e(e){let t=e.headers.get(Z9e.API_VERSION_HEADER_NAME);if(!t||!t.match(g5e))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}de.parseResponseAPIVersion=y5e});var wh=g(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.isAuthWeakPasswordError=Le.AuthWeakPasswordError=Le.isAuthRetryableFetchError=Le.AuthRetryableFetchError=Le.AuthPKCEGrantCodeExchangeError=Le.AuthImplicitGrantRedirectError=Le.AuthInvalidCredentialsError=Le.AuthInvalidTokenResponseError=Le.AuthSessionMissingError=Le.CustomAuthError=Le.AuthUnknownError=Le.isAuthApiError=Le.AuthApiError=Le.isAuthError=Le.AuthError=void 0;var Pp=class extends Error{constructor(t,r,i){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=i}};Le.AuthError=Pp;function f6(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}Le.isAuthError=f6;var T7=class extends Pp{constructor(t,r,i){super(t,r,i),this.name="AuthApiError",this.status=r,this.code=i}};Le.AuthApiError=T7;function v5e(e){return f6(e)&&e.name==="AuthApiError"}Le.isAuthApiError=v5e;var F7=class extends Pp{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}};Le.AuthUnknownError=F7;var Ta=class extends Pp{constructor(t,r,i,n){super(t,i,n),this.name=r,this.status=i}};Le.CustomAuthError=Ta;var k7=class extends Ta{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Le.AuthSessionMissingError=k7;var N7=class extends Ta{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Le.AuthInvalidTokenResponseError=N7;var R7=class extends Ta{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}};Le.AuthInvalidCredentialsError=R7;var P7=class extends Ta{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Le.AuthImplicitGrantRedirectError=P7;var I7=class extends Ta{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Le.AuthPKCEGrantCodeExchangeError=I7;var L7=class extends Ta{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}};Le.AuthRetryableFetchError=L7;function _5e(e){return f6(e)&&e.name==="AuthRetryableFetchError"}Le.isAuthRetryableFetchError=_5e;var B7=class extends Ta{constructor(t,r,i){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=i}};Le.AuthWeakPasswordError=B7;function w5e(e){return f6(e)&&e.name==="AuthWeakPasswordError"}Le.isAuthWeakPasswordError=w5e});var $7=g(Gt=>{"use strict";var b5e=Gt&&Gt.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(Gt,"__esModule",{value:!0});Gt._noResolveJsonResponse=Gt._generateLinkResponse=Gt._ssoResponse=Gt._userResponse=Gt._sessionResponsePassword=Gt._sessionResponse=Gt._request=Gt.handleError=void 0;var h6=p6(),j7=Rp(),yl=wh(),vl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),D5e=[502,503,504];async function q7(e){var t;if(!(0,j7.looksLikeFetchResponse)(e))throw new yl.AuthRetryableFetchError(vl(e),0);if(D5e.includes(e.status))throw new yl.AuthRetryableFetchError(vl(e),e.status);let r;try{r=await e.json()}catch(a){throw new yl.AuthUnknownError(vl(a),a)}let i,n=(0,j7.parseResponseAPIVersion)(e);if(n&&n.getTime()>=h6.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?i=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(i=r.error_code),i){if(i==="weak_password")throw new yl.AuthWeakPasswordError(vl(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[])}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((a,s)=>a&&typeof s=="string",!0))throw new yl.AuthWeakPasswordError(vl(r),e.status,r.weak_password.reasons);throw new yl.AuthApiError(vl(r),e.status||500,i)}Gt.handleError=q7;var E5e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};async function x5e(e,t,r,i){var n;let a=Object.assign({},i?.headers);a[h6.API_VERSION_HEADER_NAME]||(a[h6.API_VERSION_HEADER_NAME]=h6.API_VERSIONS["2024-01-01"].name),i?.jwt&&(a.Authorization=`Bearer ${i.jwt}`);let s=(n=i?.query)!==null&&n!==void 0?n:{};i?.redirectTo&&(s.redirect_to=i.redirectTo);let o=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",u=await C5e(e,t,r+o,{headers:a,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(u):{data:Object.assign({},u),error:null}}Gt._request=x5e;async function C5e(e,t,r,i,n,a){let s=E5e(t,i,n,a),o;try{o=await e(r,Object.assign({},s))}catch(u){throw console.error(u),new yl.AuthRetryableFetchError(vl(u),0)}if(o.ok||await q7(o),i?.noResolveJson)return o;try{return await o.json()}catch(u){await q7(u)}}function zL(e){var t;let r=null;k5e(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=(0,j7.expiresAt)(e.expires_in)));let i=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:i},error:null}}Gt._sessionResponse=zL;function S5e(e){let t=zL(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,i)=>r&&typeof i=="string",!0)&&(t.data.weak_password=e.weak_password),t}Gt._sessionResponsePassword=S5e;function A5e(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}Gt._userResponse=A5e;function O5e(e){return{data:e,error:null}}Gt._ssoResponse=O5e;function T5e(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a}=e,s=b5e(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a},u=Object.assign({},s);return{data:{properties:o,user:u},error:null}}Gt._generateLinkResponse=T5e;function F5e(e){return e}Gt._noResolveJsonResponse=F5e;function k5e(e){return e.access_token&&e.refresh_token&&e.expires_in}});var m6=g(bh=>{"use strict";var N5e=bh&&bh.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(bh,"__esModule",{value:!0});var Ar=$7(),R5e=Rp(),Fa=wh(),M7=class{constructor({url:t="",headers:r={},fetch:i}){this.url=t,this.headers=r,this.fetch=(0,R5e.resolveFetch)(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(t,r="global"){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(i){if((0,Fa.isAuthError)(i))return{data:null,error:i};throw i}}async inviteUserByEmail(t,r={}){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async generateLink(t){try{let{options:r}=t,i=N5e(t,["options"]),n=Object.assign(Object.assign({},i),r);return"newEmail"in i&&(n.new_email=i?.newEmail,delete n.newEmail),await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Ar._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Fa.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Fa.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,i,n,a,s,o,u;try{let l={nextPage:null,lastPage:0,total:0},c=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(r=t?.page)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:"",per_page:(a=(n=t?.perPage)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:""},xform:Ar._noResolveJsonResponse});if(c.error)throw c.error;let p=await c.json(),d=(s=c.headers.get("x-total-count"))!==null&&s!==void 0?s:0,f=(u=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(h=>{let m=parseInt(h.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(h.split(";")[1].split("=")[1]);l[`${v}Page`]=m}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},p),l),error:null}}catch(l){if((0,Fa.isAuthError)(l))return{data:{users:[]},error:l};throw l}}async getUserById(t){try{return await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Fa.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){try{return await(0,Ar._request)(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async deleteUser(t,r=!1){try{return await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async _listFactors(t){try{let{data:r,error:i}=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:i}}catch(r){if((0,Fa.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(t){try{return{data:await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Fa.isAuthError)(r))return{data:null,error:r};throw r}}};bh.default=M7});var GL=g(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.memoryLocalStorageAdapter=Ip.localStorageAdapter=void 0;var U7=Rp();Ip.localStorageAdapter={getItem:e=>(0,U7.supportsLocalStorage)()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{(0,U7.supportsLocalStorage)()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{(0,U7.supportsLocalStorage)()&&globalThis.localStorage.removeItem(e)}};function P5e(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}Ip.memoryLocalStorageAdapter=P5e});var WL=g(g6=>{"use strict";Object.defineProperty(g6,"__esModule",{value:!0});g6.polyfillGlobalThis=void 0;function I5e(){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)}}g6.polyfillGlobalThis=I5e});var V7=g(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.navigatorLock=Vr.NavigatorLockAcquireTimeoutError=Vr.LockAcquireTimeoutError=Vr.internals=void 0;var L5e=Rp();Vr.internals={debug:!!(globalThis&&(0,L5e.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var y6=class extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}};Vr.LockAcquireTimeoutError=y6;var v6=class extends y6{};Vr.NavigatorLockAcquireTimeoutError=v6;async function B5e(e,t,r){Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async n=>{if(n){Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(t===0)throw Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new v6(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Vr.internals.debug)try{let a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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()}})}Vr.navigatorLock=B5e});var z7=g(xh=>{"use strict";var j5e=xh&&xh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xh,"__esModule",{value:!0});var q5e=j5e(m6()),Eh=p6(),le=wh(),De=$7(),Oe=Rp(),H7=GL(),$5e=WL(),M5e=O7(),KL=V7();(0,$5e.polyfillGlobalThis)();var U5e={url:Eh.GOTRUE_URL,storageKey:Eh.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Eh.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},Dh=30*1e3,YL=3;async function XL(e,t,r){return await r()}var _6=class e{constructor(t){var r,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=e.nextInstanceID,e.nextInstanceID+=1,this.instanceID>0&&(0,Oe.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let n=Object.assign(Object.assign({},U5e),t);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new q5e.default({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=(0,Oe.resolveFetch)(n.fetch),this.lock=n.lock||XL,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:(0,Oe.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=KL.navigatorLock:this.lock=XL,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)},this.persistSession?n.storage?this.storage=n.storage:(0,Oe.supportsLocalStorage)()?this.storage=H7.localStorageAdapter:(this.memoryStorage={},this.storage=(0,H7.memoryLocalStorageAdapter)(this.memoryStorage)):(this.memoryStorage={},this.storage=(0,H7.memoryLocalStorageAdapter)(this.memoryStorage)),(0,Oe.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${M5e.version}) ${new Date().toISOString()}`,...t),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(){try{let t=(0,Oe.isBrowser)()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:r,error:i}=await this._getSessionFromURL(t);if(i)return this._debug("#_initialize()","error detecting session from URL",i),i?.message==="Identity is already linked"||i?.message==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});let{session:n,redirectType:a}=r;return this._debug("#_initialize()","detected session in URL",n,"redirect type",a),await this._saveSession(n),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return(0,le.isAuthError)(t)?{error:t}:{error:new le.AuthUnknownError("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,i,n;try{let a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(r=t?.options)===null||r===void 0?void 0:r.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}},xform:De._sessionResponse}),{data:s,error:o}=a;if(o||!s)return{data:{user:null,session:null},error:o};let u=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(a){if((0,le.isAuthError)(a))return{data:{user:null,session:null},error:a};throw a}}async signUp(t){var r,i,n;try{let a;if("email"in t){let{email:c,password:p,options:d}=t,f=null,h=null;this.flowType==="pkce"&&([f,h]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey)),a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:c,password:p,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:h},xform:De._sessionResponse})}else if("phone"in t){let{phone:c,password:p,options:d}=t;a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:p,data:(i=d?.data)!==null&&i!==void 0?i:{},channel:(n=d?.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:De._sessionResponse})}else throw new le.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:s,error:o}=a;if(o||!s)return{data:{user:null,session:null},error:o};let u=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(a){if((0,le.isAuthError)(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithPassword(t){try{let r;if("email"in t){let{email:a,password:s,options:o}=t;r=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:De._sessionResponsePassword})}else if("phone"in t){let{phone:a,password:s,options:o}=t;r=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:De._sessionResponsePassword})}else throw new le.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:i,error:n}=r;return n?{data:{user:null,session:null},error:n}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new le.AuthInvalidTokenResponseError}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:n})}catch(r){if((0,le.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(t){var r,i,n,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(n=t.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(a=t.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){let r=await(0,Oe.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[i,n]=(r??"").split("/"),{data:a,error:s}=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:i},xform:De._sessionResponse});return await(0,Oe.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),s?{data:{user:null,session:null,redirectType:null},error:s}:!a||!a.session||!a.user?{data:{user:null,session:null,redirectType:null},error:new le.AuthInvalidTokenResponseError}:(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:Object.assign(Object.assign({},a),{redirectType:n??null}),error:s})}async signInWithIdToken(t){try{let{options:r,provider:i,token:n,access_token:a,nonce:s}=t,o=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:n,access_token:a,nonce:s,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:De._sessionResponse}),{data:u,error:l}=o;return l?{data:{user:null,session:null},error:l}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new le.AuthInvalidTokenResponseError}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:l})}catch(r){if((0,le.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(t){var r,i,n,a,s;try{if("email"in t){let{email:o,options:u}=t,l=null,c=null;this.flowType==="pkce"&&([l,c]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:p}=await(0,De._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(i=u?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:l,code_challenge_method:c},redirectTo:u?.emailRedirectTo});return{data:{user:null,session:null},error:p}}if("phone"in t){let{phone:o,options:u}=t,{data:l,error:c}=await(0,De._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(a=u?.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(s=u?.channel)!==null&&s!==void 0?s:"sms"}});return{data:{user:null,session:null,messageId:l?.message_id},error:c}}throw new le.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(o){if((0,le.isAuthError)(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(t){var r,i;try{let n,a;"options"in t&&(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo,a=(i=t.options)===null||i===void 0?void 0:i.captchaToken);let{data:s,error:o}=await(0,De._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:n,xform:De._sessionResponse});if(o)throw o;if(!s)throw new Error("An error occurred on token verification.");let u=s.session,l=s.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(n){if((0,le.isAuthError)(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(t){var r,i,n;try{let a=null,s=null;return this.flowType==="pkce"&&([a,s]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey)),await(0,De._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(i=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&i!==void 0?i:void 0}),!((n=t?.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:s}),headers:this.headers,xform:De._ssoResponse})}catch(a){if((0,le.isAuthError)(a))return{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 t=>{let{data:{session:r},error:i}=t;if(i)throw i;if(!r)throw new le.AuthSessionMissingError;let{error:n}=await(0,De._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:n}})}catch(t){if((0,le.isAuthError)(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{let r=`${this.url}/resend`;if("email"in t){let{email:i,type:n,options:a}=t,{error:s}=await(0,De._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:i,type:n,gotrue_meta_security:{captcha_token:a?.captchaToken}},redirectTo:a?.emailRedirectTo});return{data:{user:null,session:null},error:s}}else if("phone"in t){let{phone:i,type:n,options:a}=t,{data:s,error:o}=await(0,De._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:i,type:n,gotrue_meta_security:{captcha_token:a?.captchaToken}}});return{data:{user:null,session:null,messageId:s?.message_id},error:o}}throw new le.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,le.isAuthError)(r))return{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(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){let i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await i,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let i=r();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){let n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await t(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 t=null,r=await(0,Oe.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let i=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",t.expires_at),!i){if(this.storage.isServer){let s=this.suppressGetSessionWarning;t=new Proxy(t,{get:(u,l,c)=>(!s&&l==="user"&&(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 many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),s=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,l,c))})}return{data:{session:t},error:null}}let{session:n,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{session:null},error:a}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await(0,De._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:De._userResponse}):await this._useSession(async r=>{var i,n,a;let{data:s,error:o}=r;if(o)throw o;return!(!((i=s.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new le.AuthSessionMissingError}:await(0,De._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&a!==void 0?a:void 0,xform:De._userResponse})})}catch(r){if((0,le.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async i=>{let{data:n,error:a}=i;if(a)throw a;if(!n.session)throw new le.AuthSessionMissingError;let s=n.session,o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:l,error:c}=await(0,De._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:u}),jwt:s.access_token,xform:De._userResponse});if(c)throw c;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(i){if((0,le.isAuthError)(i))return{data:{user:null},error:i};throw i}}_decodeJWT(t){return(0,Oe.decodeJWTPayload)(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new le.AuthSessionMissingError;let r=Date.now()/1e3,i=r,n=!0,a=null,s=(0,Oe.decodeJWTPayload)(t.access_token);if(s.exp&&(i=s.exp,n=i<=r),n){let{session:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!o)return{data:{user:null,session:null},error:null};a=o}else{let{data:o,error:u}=await this._getUser(t.access_token);if(u)throw u;a={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:i-r,expires_at:i},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return{data:{user:a.user,session:a},error:null}}catch(r){if((0,le.isAuthError)(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var i;if(!t){let{data:s,error:o}=r;if(o)throw o;t=(i=s.session)!==null&&i!==void 0?i:void 0}if(!t?.refresh_token)throw new le.AuthSessionMissingError;let{session:n,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{user:null,session:null},error:a}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if((0,le.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(t){try{if(!(0,Oe.isBrowser)())throw new le.AuthImplicitGrantRedirectError("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new le.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new le.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");let r=(0,Oe.parseParametersFromURL)(window.location.href);if(t){if(!r.code)throw new le.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:D,error:b}=await this._exchangeCodeForSession(r.code);if(b)throw b;let _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:D.session,redirectType:null},error:null}}if(r.error||r.error_description||r.error_code)throw new le.AuthImplicitGrantRedirectError(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});let{provider_token:i,provider_refresh_token:n,access_token:a,refresh_token:s,expires_in:o,expires_at:u,token_type:l}=r;if(!a||!o||!s||!l)throw new le.AuthImplicitGrantRedirectError("No session defined in URL");let c=Math.round(Date.now()/1e3),p=parseInt(o),d=c+p;u&&(d=parseInt(u));let f=d-c;f*1e3<=Dh&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${p}s`);let h=d-p;c-h>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",h,d,c):c-h<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",h,d,c);let{data:m,error:v}=await this._getUser(a);if(v)throw v;let y={provider_token:i,provider_refresh_token:n,access_token:a,expires_in:p,expires_at:d,refresh_token:s,token_type:l,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:r.type},error:null}}catch(r){if((0,le.isAuthError)(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantFlow(){let t=(0,Oe.parseParametersFromURL)(window.location.href);return!!((0,Oe.isBrowser)()&&(t.access_token||t.error_description))}async _isPKCEFlow(){let t=(0,Oe.parseParametersFromURL)(window.location.href),r=await(0,Oe.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var i;let{data:n,error:a}=r;if(a)return{error:a};let s=(i=n.session)===null||i===void 0?void 0:i.access_token;if(s){let{error:o}=await this.admin.signOut(s,t);if(o&&!((0,le.isAuthApiError)(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return t!=="others"&&(await this._removeSession(),await(0,Oe.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){let r=(0,Oe.uuid)(),i={id:r,callback:t,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,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:i}}}async _emitInitialSession(t){return await this._useSession(async r=>{var i,n;try{let{data:{session:a},error:s}=r;if(s)throw s;await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),console.error(a)}})}async resetPasswordForEmail(t,r={}){let i=null,n=null;this.flowType==="pkce"&&([i,n]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,De._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:i,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if((0,le.isAuthError)(a))return{data:null,error:a};throw a}}async getUserIdentities(){var t;try{let{data:r,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}}async linkIdentity(t){var r;try{let{data:i,error:n}=await this._useSession(async a=>{var s,o,u,l,c;let{data:p,error:d}=a;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,De._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(l=p.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})});if(n)throw n;return(0,Oe.isBrowser)()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(i?.url),{data:{provider:t.provider,url:i?.url},error:null}}catch(i){if((0,le.isAuthError)(i))return{data:{provider:t.provider,url:null},error:i};throw i}}async unlinkIdentity(t){try{return await this._useSession(async r=>{var i,n;let{data:a,error:s}=r;if(s)throw s;return await(0,De._request)(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(n=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}}async _refreshAccessToken(t){let r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{let i=Date.now();return await(0,Oe.retryable)(async n=>(n>0&&await(0,Oe.sleep)(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:De._sessionResponse})),(n,a)=>{let s=200*Math.pow(2,n);return a&&(0,le.isAuthRetryableFetchError)(a)&&Date.now()+s-i<Dh})}catch(i){if(this._debug(r,"error",i),(0,le.isAuthError)(i))return{data:{session:null,user:null},error:i};throw i}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){let i=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",i),(0,Oe.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(i),{data:{provider:t,url:i},error:null}}async _recoverAndRefresh(){var t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await(0,Oe.getItemAsync)(this.storage,this.storageKey);if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),a=((t=i.expires_at)!==null&&t!==void 0?t:1/0)<n+Eh.EXPIRY_MARGIN;if(this._debug(r,`session has${a?"":" not"} expired with margin of ${Eh.EXPIRY_MARGIN}s`),a){if(this.autoRefreshToken&&i.refresh_token){let{error:s}=await this._callRefreshToken(i.refresh_token);s&&(console.error(s),(0,le.isAuthRetryableFetchError)(s)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",s),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var r,i;if(!t)throw new le.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Oe.Deferred;let{data:a,error:s}=await this._refreshAccessToken(t);if(s)throw s;if(!a.session)throw new le.AuthSessionMissingError;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);let o={session:a.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(a){if(this._debug(n,"error",a),(0,le.isAuthError)(a)){let s={session:null,error:a};return(0,le.isAuthRetryableFetchError)(a)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(s),s}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(a),a}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(t,r,i=!0){let n=`#_notifyAllSubscribers(${t})`;this._debug(n,"begin",r,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:t,session:r});let a=[],s=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,r)}catch(u){a.push(u)}});if(await Promise.all(s),a.length>0){for(let o=0;o<a.length;o+=1)console.error(a[o]);throw a[0]}}finally{this._debug(n,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await(0,Oe.setItemAsync)(this.storage,this.storageKey,t)}async _removeSession(){this._debug("#_removeSession()"),await(0,Oe.removeItemAsync)(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&(0,Oe.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let t=setInterval(()=>this._autoRefreshTokenTick(),Dh);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}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 t=Date.now();try{return await this._useSession(async r=>{let{data:{session:i}}=r;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let n=Math.floor((i.expires_at*1e3-t)/Dh);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${Dh}ms, refresh threshold is ${YL} ticks`),n<=YL&&await this._callRefreshToken(i.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(t){if(t.isAcquireTimeout||t instanceof KL.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,Oe.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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){let r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(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(t,r,i){let n=[`provider=${encodeURIComponent(r)}`];if(i?.redirectTo&&n.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&n.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){let[a,s]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(s)}`});n.push(o.toString())}if(i?.queryParams){let a=new URLSearchParams(i.queryParams);n.push(a.toString())}return i?.skipBrowserRedirect&&n.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${t}?${n.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;return a?{data:null,error:a}:await(0,De._request)(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}}async _enroll(t){try{return await this._useSession(async r=>{var i,n;let{data:a,error:s}=r;if(s)return{data:null,error:s};let{data:o,error:u}=await(0,De._request)(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(i=a?.session)===null||i===void 0?void 0:i.access_token});return u?{data:null,error:u}:(!((n=o?.totp)===null||n===void 0)&&n.qr_code&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;if(a)return{data:null,error:a};let{data:s,error:o}=await(0,De._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:o})})}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;return a?{data:null,error:a}:await(0,De._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,le.isAuthError)(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(t){let{data:r,error:i}=await this._challenge({factorId:t.factorId});return i?{data:null,error:i}:await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let i=t?.factors||[],n=i.filter(a=>a.factor_type==="totp"&&a.status==="verified");return{data:{all:i,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var r,i;let{data:{session:n},error:a}=t;if(a)return{data:null,error:a};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let s=this._decodeJWT(n.access_token),o=null;s.aal&&(o=s.aal);let u=o;((i=(r=n.user.factors)===null||r===void 0?void 0:r.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:u,currentAuthenticationMethods:c},error:null}}))}};xh.default=_6;_6.nextInstanceID=0});var JL=g(Ch=>{"use strict";var V5e=Ch&&Ch.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ch,"__esModule",{value:!0});var H5e=V5e(m6()),z5e=H5e.default;Ch.default=z5e});var ZL=g(Sh=>{"use strict";var G5e=Sh&&Sh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sh,"__esModule",{value:!0});var W5e=G5e(z7()),K5e=W5e.default;Sh.default=K5e});var eB=g(QL=>{"use strict";Object.defineProperty(QL,"__esModule",{value:!0})});var W7=g(mt=>{"use strict";var Y5e=mt&&mt.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),tB=mt&&mt.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Y5e(t,e,r)},w6=mt&&mt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mt,"__esModule",{value:!0});mt.lockInternals=mt.NavigatorLockAcquireTimeoutError=mt.navigatorLock=mt.AuthClient=mt.AuthAdminApi=mt.GoTrueClient=mt.GoTrueAdminApi=void 0;var X5e=w6(m6());mt.GoTrueAdminApi=X5e.default;var J5e=w6(z7());mt.GoTrueClient=J5e.default;var Z5e=w6(JL());mt.AuthAdminApi=Z5e.default;var Q5e=w6(ZL());mt.AuthClient=Q5e.default;tB(eB(),mt);tB(wh(),mt);var G7=V7();Object.defineProperty(mt,"navigatorLock",{enumerable:!0,get:function(){return G7.navigatorLock}});Object.defineProperty(mt,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return G7.NavigatorLockAcquireTimeoutError}});Object.defineProperty(mt,"lockInternals",{enumerable:!0,get:function(){return G7.internals}})});var rB=g(b6=>{"use strict";Object.defineProperty(b6,"__esModule",{value:!0});b6.SupabaseAuthClient=void 0;var e_e=W7(),K7=class extends e_e.AuthClient{constructor(t){super(t)}};b6.SupabaseAuthClient=K7});var X7=g(Ah=>{"use strict";var t_e=Ah&&Ah.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(Ah,"__esModule",{value:!0});var r_e=x_(),i_e=dI(),n_e=_7(),a_e=LL(),D6=jL(),s_e=$L(),iB=ML(),o_e=rB(),Y7=class{constructor(t,r,i){var n,a,s;if(this.supabaseUrl=t,this.supabaseKey=r,!t)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");let o=(0,iB.stripTrailingSlash)(t);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;let u=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l={db:D6.DEFAULT_DB_OPTIONS,realtime:D6.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},D6.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:D6.DEFAULT_GLOBAL_OPTIONS},c=(0,iB.applySettingDefaults)(i??{},l);this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(a=c.global.headers)!==null&&a!==void 0?a:{},c.accessToken?(this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(p,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((s=c.auth)!==null&&s!==void 0?s:{},this.headers,c.global.fetch),this.fetch=(0,s_e.fetchWithAuth)(r,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new i_e.PostgrestClient(`${o}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),c.accessToken||this._listenForAuthEvents()}get functions(){return new r_e.FunctionsClient(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new a_e.StorageClient(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,r={},i={}){return this.rest.rpc(t,r,i)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,r;return t_e(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();let{data:i}=yield this.auth.getSession();return(r=(t=i.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,storageKey:a,flowType:s,lock:o,debug:u},l,c){var p;let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new o_e.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},d),l),storageKey:a,autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,flowType:s,lock:o,debug:u,fetch:c,hasCustomAuthorizationHeader:(p="Authorization"in this.headers)!==null&&p!==void 0?p:!1})}_initRealtimeClient(t){return new n_e.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,i)=>{this._handleTokenChanged(r,"CLIENT",i?.access_token)})}_handleTokenChanged(t,r,i){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Ah.default=Y7});var sB=g(gt=>{"use strict";var u_e=gt&>.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),nB=gt&>.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&u_e(t,e,r)},aB=gt&>.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gt,"__esModule",{value:!0});gt.createClient=gt.SupabaseClient=gt.FunctionRegion=gt.FunctionsError=gt.FunctionsRelayError=gt.FunctionsFetchError=gt.FunctionsHttpError=void 0;var l_e=aB(X7());nB(W7(),gt);var Oh=x_();Object.defineProperty(gt,"FunctionsHttpError",{enumerable:!0,get:function(){return Oh.FunctionsHttpError}});Object.defineProperty(gt,"FunctionsFetchError",{enumerable:!0,get:function(){return Oh.FunctionsFetchError}});Object.defineProperty(gt,"FunctionsRelayError",{enumerable:!0,get:function(){return Oh.FunctionsRelayError}});Object.defineProperty(gt,"FunctionsError",{enumerable:!0,get:function(){return Oh.FunctionsError}});Object.defineProperty(gt,"FunctionRegion",{enumerable:!0,get:function(){return Oh.FunctionRegion}});nB(_7(),gt);var c_e=X7();Object.defineProperty(gt,"SupabaseClient",{enumerable:!0,get:function(){return aB(c_e).default}});var p_e=(e,t,r)=>new l_e.default(e,t,r);gt.createClient=p_e});var cB=g((Bdt,lB)=>{var uB={};lB.exports=uB;var oB={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(oB).forEach(function(e){var t=oB[e],r=uB[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var dB=g((jdt,pB)=>{"use strict";pB.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),i=/^-{1,2}/.test(e)?"":"--",n=t.indexOf(i+e);return n!==-1&&(r===-1?!0:n<r)}});var hB=g((qdt,fB)=>{"use strict";var d_e=require("os"),ea=dB(),ni=process.env,Lp=void 0;ea("no-color")||ea("no-colors")||ea("color=false")?Lp=!1:(ea("color")||ea("colors")||ea("color=true")||ea("color=always"))&&(Lp=!0);"FORCE_COLOR"in ni&&(Lp=ni.FORCE_COLOR.length===0||parseInt(ni.FORCE_COLOR,10)!==0);function f_e(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function h_e(e){if(Lp===!1)return 0;if(ea("color=16m")||ea("color=full")||ea("color=truecolor"))return 3;if(ea("color=256"))return 2;if(e&&!e.isTTY&&Lp!==!0)return 0;var t=Lp?1:0;if(process.platform==="win32"){var r=d_e.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 ni)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in ni})||ni.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in ni)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ni.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in ni){var i=parseInt((ni.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ni.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ni.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(ni.TERM)||"COLORTERM"in ni?1:(ni.TERM==="dumb",t)}function J7(e){var t=h_e(e);return f_e(t)}fB.exports={supportsColor:J7,stdout:J7(process.stdout),stderr:J7(process.stderr)}});var gB=g(($dt,mB)=>{mB.exports=function(t,r){var i="";t=t||"Run the trap, drop the bass",t=t.split("");var n={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 t.forEach(function(a){a=a.toLowerCase();var s=n[a]||[" "],o=Math.floor(Math.random()*s.length);typeof n[a]<"u"?i+=n[a][o]:i+=a}),i}});var vB=g((Mdt,yB)=>{yB.exports=function(t,r){t=t||" he is here ";var i={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"]},n=[].concat(i.up,i.down,i.mid);function a(u){var l=Math.floor(Math.random()*u);return l}function s(u){var l=!1;return n.filter(function(c){l=c===u}),l}function o(u,l){var c="",p,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(d in u)if(!s(d)){switch(c=c+u[d],p={up:0,down:0,mid:0},l.size){case"mini":p.up=a(8),p.mid=a(2),p.down=a(8);break;case"maxi":p.up=a(16)+3,p.mid=a(4)+1,p.down=a(64)+3;break;default:p.up=a(8)+1,p.mid=a(6)/2,p.down=a(8)+1;break}var f=["up","mid","down"];for(var h in f)for(var m=f[h],v=0;v<=p[m];v++)l[m]&&(c=c+i[m][a(i[m].length)])}return c}return o(t,r)}});var wB=g((Udt,_B)=>{_B.exports=function(e){return function(t,r,i){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var DB=g((Vdt,bB)=>{bB.exports=function(e){return function(t,r,i){return r%2===0?t:e.inverse(t)}}});var xB=g((Hdt,EB)=>{EB.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,i,n){return r===" "?r:e[t[i++%t.length]](r)}}});var SB=g((zdt,CB)=>{CB.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,n){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var NB=g((Wdt,kB)=>{var Ce={};kB.exports=Ce;Ce.themes={};var m_e=require("util"),_l=Ce.styles=cB(),OB=Object.defineProperties,g_e=new RegExp(/[\r\n]+/g);Ce.supportsColor=hB().supportsColor;typeof Ce.enabled>"u"&&(Ce.enabled=Ce.supportsColor()!==!1);Ce.enable=function(){Ce.enabled=!0};Ce.disable=function(){Ce.enabled=!1};Ce.stripColors=Ce.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var Gdt=Ce.stylize=function(t,r){if(!Ce.enabled)return t+"";var i=_l[r];return!i&&r in Ce?Ce[r](t):i.open+t+i.close},y_e=/[|\\{}()[\]^$+*?.]/g,v_e=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(y_e,"\\$&")};function TB(e){var t=function r(){return w_e.apply(r,arguments)};return t._styles=e,t.__proto__=__e,t}var FB=function(){var e={};return _l.grey=_l.gray,Object.keys(_l).forEach(function(t){_l[t].closeRe=new RegExp(v_e(_l[t].close),"g"),e[t]={get:function(){return TB(this._styles.concat(t))}}}),e}(),__e=OB(function(){},FB);function w_e(){var e=Array.prototype.slice.call(arguments),t=e.map(function(s){return s!=null&&s.constructor===String?s:m_e.inspect(s)}).join(" ");if(!Ce.enabled||!t)return t;for(var r=t.indexOf(`
|
|
29
|
+
`+r)}function hl(e,t,r,i,n){if(e.listenerCount("wsClientError")){let a=new Error(n);Error.captureStackTrace(a,hl),e.emit("wsClientError",a,r,t)}else dh(r,i,n)}});var _L=g((idt,vL)=>{"use strict";var Bs=h7();Bs.createWebSocketStream=uL();Bs.Server=yL();Bs.Receiver=a7();Bs.Sender=o7();Bs.WebSocket=Bs;Bs.WebSocketServer=Bs.Server;vL.exports=Bs});var bL=g(Qn=>{"use strict";var e9e=Qn&&Qn.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),t9e=Qn&&Qn.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),wL=Qn&&Qn.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&e9e(t,e,r);return t9e(t,e),t},v7=Qn&&Qn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qn,"__esModule",{value:!0});var Ur=Gg(),r9e=v7(hI()),i9e=v7(q_()),n9e=Wg(),a9e=v7(K_()),s9e=()=>{},o9e=typeof WebSocket<"u",g7=class{constructor(t,r){var i;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers=Ur.DEFAULT_HEADERS,this.params={},this.timeout=Ur.DEFAULT_TIMEOUT,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=s9e,this.conn=null,this.sendBuffer=[],this.serializer=new r9e.default,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=a=>{let s;return a?s=a:typeof fetch>"u"?s=(...o)=>Promise.resolve().then(()=>wL(Zo())).then(({default:u})=>u(...o)):s=fetch,(...o)=>s(...o)},this.endPoint=`${t}/${Ur.TRANSPORTS.websocket}`,this.httpEndpoint=(0,n9e.httpEndpointURL)(t),r?.transport?this.transport=r.transport:this.transport=null,r?.params&&(this.params=r.params),r?.headers&&(this.headers=Object.assign(Object.assign({},this.headers),r.headers)),r?.timeout&&(this.timeout=r.timeout),r?.logger&&(this.logger=r.logger),r?.heartbeatIntervalMs&&(this.heartbeatIntervalMs=r.heartbeatIntervalMs);let n=(i=r?.params)===null||i===void 0?void 0:i.apikey;n&&(this.accessToken=n,this.apiKey=n),this.reconnectAfterMs=r?.reconnectAfterMs?r.reconnectAfterMs:a=>[1e3,2e3,5e3,1e4][a-1]||1e4,this.encode=r?.encode?r.encode:(a,s)=>s(JSON.stringify(a)),this.decode=r?.decode?r.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new i9e.default(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(o9e){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new y7(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),Promise.resolve().then(()=>wL(_L())).then(({default:t})=>{this.conn=new t(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(t,r){this.conn&&(this.conn.onclose=function(){},t?this.conn.close(t,r??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(t){let r=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){let t=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.disconnect(),t}log(t,r,i){this.logger(t,r,i)}connectionState(){switch(this.conn&&this.conn.readyState){case Ur.SOCKET_STATES.connecting:return Ur.CONNECTION_STATE.Connecting;case Ur.SOCKET_STATES.open:return Ur.CONNECTION_STATE.Open;case Ur.SOCKET_STATES.closing:return Ur.CONNECTION_STATE.Closing;default:return Ur.CONNECTION_STATE.Closed}}isConnected(){return this.connectionState()===Ur.CONNECTION_STATE.Open}channel(t,r={config:{}}){let i=new a9e.default(`realtime:${t}`,r,this);return this.channels.push(i),i}push(t){let{topic:r,event:i,payload:n,ref:a}=t,s=()=>{this.encode(t,o=>{var u;(u=this.conn)===null||u===void 0||u.send(o)})};this.log("push",`${r} ${i} (${a})`,n),this.isConnected()?s():this.sendBuffer.push(s)}setAuth(t){this.accessToken=t,this.channels.forEach(r=>{t&&r.updateJoinPayload({access_token:t}),r.joinedOnce&&r._isJoined()&&r._push(Ur.CHANNEL_EVENTS.access_token,{access_token:t})})}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let r=this.channels.find(i=>i.topic===t&&(i._isJoined()||i._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${t}"`),r.unsubscribe())}_remove(t){this.channels=this.channels.filter(r=>r._joinRef()!==t._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Ur.VSN}))}_onConnMessage(t){this.decode(t.data,r=>{let{topic:i,event:n,payload:a,ref:s}=r;(s&&s===this.pendingHeartbeatRef||n===a?.type)&&(this.pendingHeartbeatRef=null),this.log("receive",`${a.status||""} ${i} ${n} ${s&&"("+s+")"||""}`,a),this.channels.filter(o=>o._isMember(i)).forEach(o=>o._trigger(n,a,s)),this.stateChangeCallbacks.message.forEach(o=>o(r))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(t=>t())}_onConnClose(t){this.log("transport","close",t),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(r=>r(t))}_onConnError(t){this.log("transport",t.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(r=>r(t))}_triggerChanError(){this.channels.forEach(t=>t._trigger(Ur.CHANNEL_EVENTS.error))}_appendParams(t,r){if(Object.keys(r).length===0)return t;let i=t.match(/\?/)?"&":"?",n=new URLSearchParams(r);return`${t}${i}${n}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_sendHeartbeat(){var t;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(t=this.conn)===null||t===void 0||t.close(Ur.WS_CLOSE_NORMAL,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}};Qn.default=g7;var y7=class{constructor(t,r,i){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Ur.SOCKET_STATES.connecting,this.send=()=>{},this.url=null,this.url=t,this.close=i.close}}});var _7=g(Je=>{"use strict";var u9e=Je&&Je.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),l9e=Je&&Je.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),DL=Je&&Je.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&u9e(t,e,r);return l9e(t,e),t},c9e=Je&&Je.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Je,"__esModule",{value:!0});Je.REALTIME_CHANNEL_STATES=Je.REALTIME_SUBSCRIBE_STATES=Je.REALTIME_PRESENCE_LISTEN_EVENTS=Je.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT=Je.REALTIME_LISTEN_TYPES=Je.RealtimeClient=Je.RealtimeChannel=Je.RealtimePresence=void 0;var p9e=c9e(bL());Je.RealtimeClient=p9e.default;var fh=DL(K_());Je.RealtimeChannel=fh.default;Object.defineProperty(Je,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return fh.REALTIME_LISTEN_TYPES}});Object.defineProperty(Je,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return fh.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}});Object.defineProperty(Je,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return fh.REALTIME_SUBSCRIBE_STATES}});Object.defineProperty(Je,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return fh.REALTIME_CHANNEL_STATES}});var EL=DL(H_());Je.RealtimePresence=EL.default;Object.defineProperty(Je,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return EL.REALTIME_PRESENCE_LISTEN_EVENTS}})});var mh=g(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.StorageUnknownError=Sa.StorageApiError=Sa.isStorageError=Sa.StorageError=void 0;var hh=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};Sa.StorageError=hh;function d9e(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}Sa.isStorageError=d9e;var w7=class extends hh{constructor(t,r){super(t),this.name="StorageApiError",this.status=r}toJSON(){return{name:this.name,message:this.message,status:this.status}}};Sa.StorageApiError=w7;var b7=class extends hh{constructor(t,r){super(t),this.name="StorageUnknownError",this.originalError=r}};Sa.StorageUnknownError=b7});var s6=g(pr=>{"use strict";var f9e=pr&&pr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),h9e=pr&&pr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),xL=pr&&pr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&f9e(t,e,r);return h9e(t,e),t},m9e=pr&&pr.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(pr,"__esModule",{value:!0});pr.recursiveToCamel=pr.resolveResponse=pr.resolveFetch=void 0;var g9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>xL(Zo())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};pr.resolveFetch=g9e;var y9e=()=>m9e(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>xL(Zo()))).Response:Response});pr.resolveResponse=y9e;var v9e=e=>{if(Array.isArray(e))return e.map(r=>(0,pr.recursiveToCamel)(r));if(typeof e=="function"||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([r,i])=>{let n=r.replace(/([-_][a-z])/gi,a=>a.toUpperCase().replace(/[-_]/g,""));t[n]=(0,pr.recursiveToCamel)(i)}),t};pr.recursiveToCamel=v9e});var x7=g(xi=>{"use strict";var ml=xi&&xi.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(xi,"__esModule",{value:!0});xi.remove=xi.head=xi.put=xi.post=xi.get=void 0;var D7=mh(),_9e=s6(),E7=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),w9e=(e,t,r)=>ml(void 0,void 0,void 0,function*(){let i=yield(0,_9e.resolveResponse)();e instanceof i&&!r?.noResolveJson?e.json().then(n=>{t(new D7.StorageApiError(E7(n),e.status||500))}).catch(n=>{t(new D7.StorageUnknownError(E7(n),n))}):t(new D7.StorageUnknownError(E7(e),e))}),b9e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json"},t?.headers),i&&(n.body=JSON.stringify(i)),Object.assign(Object.assign({},n),r))};function gh(e,t,r,i,n,a){return ml(this,void 0,void 0,function*(){return new Promise((s,o)=>{e(r,b9e(t,i,n,a)).then(u=>{if(!u.ok)throw u;return i?.noResolveJson?u:u.json()}).then(u=>s(u)).catch(u=>w9e(u,o,i))})})}function D9e(e,t,r,i){return ml(this,void 0,void 0,function*(){return gh(e,"GET",t,r,i)})}xi.get=D9e;function E9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"POST",t,i,n,r)})}xi.post=E9e;function x9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"PUT",t,i,n,r)})}xi.put=x9e;function C9e(e,t,r,i){return ml(this,void 0,void 0,function*(){return gh(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),i)})}xi.head=C9e;function S9e(e,t,r,i,n){return ml(this,void 0,void 0,function*(){return gh(e,"DELETE",t,i,n,r)})}xi.remove=S9e});var AL=g(yh=>{"use strict";var Ci=yh&&yh.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(yh,"__esModule",{value:!0});var Si=mh(),Aa=x7(),CL=s6(),A9e={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},SL={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1},C7=class{constructor(t,r={},i,n){this.url=t,this.headers=r,this.bucketId=i,this.fetch=(0,CL.resolveFetch)(n)}uploadOrUpdate(t,r,i,n){return Ci(this,void 0,void 0,function*(){try{let a,s=Object.assign(Object.assign({},SL),n),o=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(s.upsert)}),u=s.metadata;typeof Blob<"u"&&i instanceof Blob?(a=new FormData,a.append("cacheControl",s.cacheControl),a.append("",i),u&&a.append("metadata",this.encodeMetadata(u))):typeof FormData<"u"&&i instanceof FormData?(a=i,a.append("cacheControl",s.cacheControl),u&&a.append("metadata",this.encodeMetadata(u))):(a=i,o["cache-control"]=`max-age=${s.cacheControl}`,o["content-type"]=s.contentType,u&&(o["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),n?.headers&&(o=Object.assign(Object.assign({},o),n.headers));let l=this._removeEmptyFolders(r),c=this._getFinalPath(l),p=yield this.fetch(`${this.url}/object/${c}`,Object.assign({method:t,body:a,headers:o},s?.duplex?{duplex:s.duplex}:{})),d=yield p.json();return p.ok?{data:{path:l,id:d.Id,fullPath:d.Key},error:null}:{data:null,error:d}}catch(a){if((0,Si.isStorageError)(a))return{data:null,error:a};throw a}})}upload(t,r,i){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,r,i)})}uploadToSignedUrl(t,r,i,n){return Ci(this,void 0,void 0,function*(){let a=this._removeEmptyFolders(t),s=this._getFinalPath(a),o=new URL(this.url+`/object/upload/sign/${s}`);o.searchParams.set("token",r);try{let u,l=Object.assign({upsert:SL.upsert},n),c=Object.assign(Object.assign({},this.headers),{"x-upsert":String(l.upsert)});typeof Blob<"u"&&i instanceof Blob?(u=new FormData,u.append("cacheControl",l.cacheControl),u.append("",i)):typeof FormData<"u"&&i instanceof FormData?(u=i,u.append("cacheControl",l.cacheControl)):(u=i,c["cache-control"]=`max-age=${l.cacheControl}`,c["content-type"]=l.contentType);let p=yield this.fetch(o.toString(),{method:"PUT",body:u,headers:c}),d=yield p.json();return p.ok?{data:{path:a,fullPath:d.Key},error:null}:{data:null,error:d}}catch(u){if((0,Si.isStorageError)(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,r){return Ci(this,void 0,void 0,function*(){try{let i=this._getFinalPath(t),n=Object.assign({},this.headers);r?.upsert&&(n["x-upsert"]="true");let a=yield(0,Aa.post)(this.fetch,`${this.url}/object/upload/sign/${i}`,{},{headers:n}),s=new URL(this.url+a.url),o=s.searchParams.get("token");if(!o)throw new Si.StorageError("No token returned by API");return{data:{signedUrl:s.toString(),path:t,token:o},error:null}}catch(i){if((0,Si.isStorageError)(i))return{data:null,error:i};throw i}})}update(t,r,i){return Ci(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,r,i)})}move(t,r,i){return Ci(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.post)(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers}),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}copy(t,r,i){return Ci(this,void 0,void 0,function*(){try{return{data:{path:(yield(0,Aa.post)(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:r,destinationBucket:i?.destinationBucket},{headers:this.headers})).Key},error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrl(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=this._getFinalPath(t),a=yield(0,Aa.post)(this.fetch,`${this.url}/object/sign/${n}`,Object.assign({expiresIn:r},i?.transform?{transform:i.transform}:{}),{headers:this.headers}),s=i?.download?`&download=${i.download===!0?"":i.download}`:"";return a={signedUrl:encodeURI(`${this.url}${a.signedURL}${s}`)},{data:a,error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}createSignedUrls(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=yield(0,Aa.post)(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:r,paths:t},{headers:this.headers}),a=i?.download?`&download=${i.download===!0?"":i.download}`:"";return{data:n.map(s=>Object.assign(Object.assign({},s),{signedUrl:s.signedURL?encodeURI(`${this.url}${s.signedURL}${a}`):null})),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}download(t,r){return Ci(this,void 0,void 0,function*(){let n=typeof r?.transform<"u"?"render/image/authenticated":"object",a=this.transformOptsToQueryString(r?.transform||{}),s=a?`?${a}`:"";try{let o=this._getFinalPath(t);return{data:yield(yield(0,Aa.get)(this.fetch,`${this.url}/${n}/${o}${s}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if((0,Si.isStorageError)(o))return{data:null,error:o};throw o}})}info(t){return Ci(this,void 0,void 0,function*(){let r=this._getFinalPath(t);try{let i=yield(0,Aa.get)(this.fetch,`${this.url}/object/info/${r}`,{headers:this.headers});return{data:(0,CL.recursiveToCamel)(i),error:null}}catch(i){if((0,Si.isStorageError)(i))return{data:null,error:i};throw i}})}exists(t){return Ci(this,void 0,void 0,function*(){let r=this._getFinalPath(t);try{return yield(0,Aa.head)(this.fetch,`${this.url}/object/${r}`,{headers:this.headers}),{data:!0,error:null}}catch(i){if((0,Si.isStorageError)(i)&&i instanceof Si.StorageUnknownError){let n=i.originalError;if([400,404].includes(n?.status))return{data:!1,error:i}}throw i}})}getPublicUrl(t,r){let i=this._getFinalPath(t),n=[],a=r?.download?`download=${r.download===!0?"":r.download}`:"";a!==""&&n.push(a);let o=typeof r?.transform<"u"?"render/image":"object",u=this.transformOptsToQueryString(r?.transform||{});u!==""&&n.push(u);let l=n.join("&");return l!==""&&(l=`?${l}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${i}${l}`)}}}remove(t){return Ci(this,void 0,void 0,function*(){try{return{data:yield(0,Aa.remove)(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(r){if((0,Si.isStorageError)(r))return{data:null,error:r};throw r}})}list(t,r,i){return Ci(this,void 0,void 0,function*(){try{let n=Object.assign(Object.assign(Object.assign({},A9e),r),{prefix:t||""});return{data:yield(0,Aa.post)(this.fetch,`${this.url}/object/list/${this.bucketId}`,n,{headers:this.headers},i),error:null}}catch(n){if((0,Si.isStorageError)(n))return{data:null,error:n};throw n}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){let r=[];return t.width&&r.push(`width=${t.width}`),t.height&&r.push(`height=${t.height}`),t.resize&&r.push(`resize=${t.resize}`),t.format&&r.push(`format=${t.format}`),t.quality&&r.push(`quality=${t.quality}`),r.join("&")}};yh.default=C7});var OL=g(o6=>{"use strict";Object.defineProperty(o6,"__esModule",{value:!0});o6.version=void 0;o6.version="2.7.0"});var TL=g(u6=>{"use strict";Object.defineProperty(u6,"__esModule",{value:!0});u6.DEFAULT_HEADERS=void 0;var O9e=OL();u6.DEFAULT_HEADERS={"X-Client-Info":`storage-js/${O9e.version}`}});var FL=g(vh=>{"use strict";var Tp=vh&&vh.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(vh,"__esModule",{value:!0});var T9e=TL(),Fp=mh(),kp=x7(),F9e=s6(),S7=class{constructor(t,r={},i){this.url=t,this.headers=Object.assign(Object.assign({},T9e.DEFAULT_HEADERS),r),this.fetch=(0,F9e.resolveFetch)(i)}listBuckets(){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.get)(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(t){if((0,Fp.isStorageError)(t))return{data:null,error:t};throw t}})}getBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.get)(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}createBucket(t,r={public:!1}){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.post)(this.fetch,`${this.url}/bucket`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,Fp.isStorageError)(i))return{data:null,error:i};throw i}})}updateBucket(t,r){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.put)(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,public:r.public,file_size_limit:r.fileSizeLimit,allowed_mime_types:r.allowedMimeTypes},{headers:this.headers}),error:null}}catch(i){if((0,Fp.isStorageError)(i))return{data:null,error:i};throw i}})}emptyBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.post)(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}deleteBucket(t){return Tp(this,void 0,void 0,function*(){try{return{data:yield(0,kp.remove)(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(r){if((0,Fp.isStorageError)(r))return{data:null,error:r};throw r}})}};vh.default=S7});var NL=g(Np=>{"use strict";var kL=Np&&Np.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Np,"__esModule",{value:!0});Np.StorageClient=void 0;var k9e=kL(AL()),N9e=kL(FL()),A7=class extends N9e.default{constructor(t,r={},i){super(t,r,i)}from(t){return new k9e.default(this.url,this.headers,t,this.fetch)}};Np.StorageClient=A7});var PL=g(RL=>{"use strict";Object.defineProperty(RL,"__esModule",{value:!0})});var LL=g(Oa=>{"use strict";var R9e=Oa&&Oa.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),IL=Oa&&Oa.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&R9e(t,e,r)};Object.defineProperty(Oa,"__esModule",{value:!0});Oa.StorageClient=void 0;var P9e=NL();Object.defineProperty(Oa,"StorageClient",{enumerable:!0,get:function(){return P9e.StorageClient}});IL(PL(),Oa);IL(mh(),Oa)});var BL=g(l6=>{"use strict";Object.defineProperty(l6,"__esModule",{value:!0});l6.version=void 0;l6.version="2.45.2"});var jL=g(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});Wi.DEFAULT_REALTIME_OPTIONS=Wi.DEFAULT_AUTH_OPTIONS=Wi.DEFAULT_DB_OPTIONS=Wi.DEFAULT_GLOBAL_OPTIONS=Wi.DEFAULT_HEADERS=void 0;var I9e=BL(),_h="";typeof Deno<"u"?_h="deno":typeof document<"u"?_h="web":typeof navigator<"u"&&navigator.product==="ReactNative"?_h="react-native":_h="node";Wi.DEFAULT_HEADERS={"X-Client-Info":`supabase-js-${_h}/${I9e.version}`};Wi.DEFAULT_GLOBAL_OPTIONS={headers:Wi.DEFAULT_HEADERS};Wi.DEFAULT_DB_OPTIONS={schema:"public"};Wi.DEFAULT_AUTH_OPTIONS={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"};Wi.DEFAULT_REALTIME_OPTIONS={}});var $L=g(dr=>{"use strict";var L9e=dr&&dr.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),B9e=dr&&dr.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),j9e=dr&&dr.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&L9e(t,e,r);return B9e(t,e),t},q9e=dr&&dr.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(dr,"__esModule",{value:!0});dr.fetchWithAuth=dr.resolveHeadersConstructor=dr.resolveFetch=void 0;var qL=j9e(Zo()),$9e=e=>{let t;return e?t=e:typeof fetch>"u"?t=qL.default:t=fetch,(...r)=>t(...r)};dr.resolveFetch=$9e;var M9e=()=>typeof Headers>"u"?qL.Headers:Headers;dr.resolveHeadersConstructor=M9e;var U9e=(e,t,r)=>{let i=(0,dr.resolveFetch)(r),n=(0,dr.resolveHeadersConstructor)();return(a,s)=>q9e(void 0,void 0,void 0,function*(){var o;let u=(o=yield t())!==null&&o!==void 0?o:e,l=new n(s?.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${u}`),i(a,Object.assign(Object.assign({},s),{headers:l}))})};dr.fetchWithAuth=U9e});var ML=g(vn=>{"use strict";var V9e=vn&&vn.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(vn,"__esModule",{value:!0});vn.applySettingDefaults=vn.isBrowser=vn.stripTrailingSlash=vn.uuid=void 0;function H9e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=Math.random()*16|0,r=e=="x"?t:t&3|8;return r.toString(16)})}vn.uuid=H9e;function z9e(e){return e.replace(/\/$/,"")}vn.stripTrailingSlash=z9e;var G9e=()=>typeof window<"u";vn.isBrowser=G9e;function W9e(e,t){let{db:r,auth:i,realtime:n,global:a}=e,{db:s,auth:o,realtime:u,global:l}=t,c={db:Object.assign(Object.assign({},s),r),auth:Object.assign(Object.assign({},o),i),realtime:Object.assign(Object.assign({},u),n),global:Object.assign(Object.assign({},l),a),accessToken:()=>V9e(this,void 0,void 0,function*(){return""})};return e.accessToken?c.accessToken=e.accessToken:delete c.accessToken,c}vn.applySettingDefaults=W9e});var O7=g(c6=>{"use strict";Object.defineProperty(c6,"__esModule",{value:!0});c6.version=void 0;c6.version="2.64.4"});var p6=g(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.API_VERSIONS=fr.API_VERSION_HEADER_NAME=fr.NETWORK_FAILURE=fr.EXPIRY_MARGIN=fr.DEFAULT_HEADERS=fr.AUDIENCE=fr.STORAGE_KEY=fr.GOTRUE_URL=void 0;var K9e=O7();fr.GOTRUE_URL="http://localhost:9999";fr.STORAGE_KEY="supabase.auth.token";fr.AUDIENCE="";fr.DEFAULT_HEADERS={"X-Client-Info":`gotrue-js/${K9e.version}`};fr.EXPIRY_MARGIN=10;fr.NETWORK_FAILURE={MAX_RETRIES:10,RETRY_INTERVAL:2};fr.API_VERSION_HEADER_NAME="X-Supabase-Api-Version";fr.API_VERSIONS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}}});var Rp=g(de=>{"use strict";var Y9e=de&&de.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),X9e=de&&de.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),J9e=de&&de.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Y9e(t,e,r);return X9e(t,e),t};Object.defineProperty(de,"__esModule",{value:!0});de.parseResponseAPIVersion=de.getCodeChallengeAndMethod=de.generatePKCEChallenge=de.generatePKCEVerifier=de.retryable=de.sleep=de.decodeJWTPayload=de.Deferred=de.decodeBase64URL=de.removeItemAsync=de.getItemAsync=de.setItemAsync=de.looksLikeFetchResponse=de.resolveFetch=de.parseParametersFromURL=de.supportsLocalStorage=de.isBrowser=de.uuid=de.expiresAt=void 0;var Z9e=p6();function Q9e(e){return Math.round(Date.now()/1e3)+e}de.expiresAt=Q9e;function e5e(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}de.uuid=e5e;var t5e=()=>typeof document<"u";de.isBrowser=t5e;var gl={tested:!1,writable:!1},r5e=()=>{if(!(0,de.isBrowser)())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(gl.tested)return gl.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),gl.tested=!0,gl.writable=!0}catch{gl.tested=!0,gl.writable=!1}return gl.writable};de.supportsLocalStorage=r5e;function i5e(e){let t={},r=new URL(e);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((n,a)=>{t[a]=n})}catch{}return r.searchParams.forEach((i,n)=>{t[n]=i}),t}de.parseParametersFromURL=i5e;var n5e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...r)=>Promise.resolve().then(()=>J9e(Zo())).then(({default:i})=>i(...r)):t=fetch,(...r)=>t(...r)};de.resolveFetch=n5e;var a5e=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function";de.looksLikeFetchResponse=a5e;var s5e=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))};de.setItemAsync=s5e;var o5e=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return r}};de.getItemAsync=o5e;var u5e=async(e,t)=>{await e.removeItem(t)};de.removeItemAsync=u5e;function UL(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r="",i,n,a,s,o,u,l,c=0;for(e=e.replace("-","+").replace("_","/");c<e.length;)s=t.indexOf(e.charAt(c++)),o=t.indexOf(e.charAt(c++)),u=t.indexOf(e.charAt(c++)),l=t.indexOf(e.charAt(c++)),i=s<<2|o>>4,n=(o&15)<<4|u>>2,a=(u&3)<<6|l,r=r+String.fromCharCode(i),u!=64&&n!=0&&(r=r+String.fromCharCode(n)),l!=64&&a!=0&&(r=r+String.fromCharCode(a));return r}de.decodeBase64URL=UL;var d6=class e{constructor(){this.promise=new e.promiseConstructor((t,r)=>{this.resolve=t,this.reject=r})}};de.Deferred=d6;d6.promiseConstructor=Promise;function l5e(e){let t=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,r=e.split(".");if(r.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!t.test(r[1]))throw new Error("JWT is not valid: payload is not in base64url format");let i=r[1];return JSON.parse(UL(i))}de.decodeJWTPayload=l5e;async function c5e(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}de.sleep=c5e;function p5e(e,t){return new Promise((i,n)=>{(async()=>{for(let a=0;a<1/0;a++)try{let s=await e(a);if(!t(a,null,s)){i(s);return}}catch(s){if(!t(a,s)){n(s);return}}})()})}de.retryable=p5e;function d5e(e){return("0"+e.toString(16)).substr(-2)}function VL(){let t=new Uint32Array(56);if(typeof crypto>"u"){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",i=r.length,n="";for(let a=0;a<56;a++)n+=r.charAt(Math.floor(Math.random()*i));return n}return crypto.getRandomValues(t),Array.from(t,d5e).join("")}de.generatePKCEVerifier=VL;async function f5e(e){let r=new TextEncoder().encode(e),i=await crypto.subtle.digest("SHA-256",r),n=new Uint8Array(i);return Array.from(n).map(a=>String.fromCharCode(a)).join("")}function h5e(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function HL(e){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."),e;let r=await f5e(e);return h5e(r)}de.generatePKCEChallenge=HL;async function m5e(e,t,r=!1){let i=VL(),n=i;r&&(n+="/PASSWORD_RECOVERY"),await(0,de.setItemAsync)(e,`${t}-code-verifier`,n);let a=await HL(i);return[a,i===a?"plain":"s256"]}de.getCodeChallengeAndMethod=m5e;var g5e=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function y5e(e){let t=e.headers.get(Z9e.API_VERSION_HEADER_NAME);if(!t||!t.match(g5e))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}de.parseResponseAPIVersion=y5e});var wh=g(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.isAuthWeakPasswordError=Le.AuthWeakPasswordError=Le.isAuthRetryableFetchError=Le.AuthRetryableFetchError=Le.AuthPKCEGrantCodeExchangeError=Le.AuthImplicitGrantRedirectError=Le.AuthInvalidCredentialsError=Le.AuthInvalidTokenResponseError=Le.AuthSessionMissingError=Le.CustomAuthError=Le.AuthUnknownError=Le.isAuthApiError=Le.AuthApiError=Le.isAuthError=Le.AuthError=void 0;var Pp=class extends Error{constructor(t,r,i){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=i}};Le.AuthError=Pp;function f6(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}Le.isAuthError=f6;var T7=class extends Pp{constructor(t,r,i){super(t,r,i),this.name="AuthApiError",this.status=r,this.code=i}};Le.AuthApiError=T7;function v5e(e){return f6(e)&&e.name==="AuthApiError"}Le.isAuthApiError=v5e;var F7=class extends Pp{constructor(t,r){super(t),this.name="AuthUnknownError",this.originalError=r}};Le.AuthUnknownError=F7;var Ta=class extends Pp{constructor(t,r,i,n){super(t,i,n),this.name=r,this.status=i}};Le.CustomAuthError=Ta;var k7=class extends Ta{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}};Le.AuthSessionMissingError=k7;var N7=class extends Ta{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}};Le.AuthInvalidTokenResponseError=N7;var R7=class extends Ta{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}};Le.AuthInvalidCredentialsError=R7;var P7=class extends Ta{constructor(t,r=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Le.AuthImplicitGrantRedirectError=P7;var I7=class extends Ta{constructor(t,r=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}};Le.AuthPKCEGrantCodeExchangeError=I7;var L7=class extends Ta{constructor(t,r){super(t,"AuthRetryableFetchError",r,void 0)}};Le.AuthRetryableFetchError=L7;function _5e(e){return f6(e)&&e.name==="AuthRetryableFetchError"}Le.isAuthRetryableFetchError=_5e;var B7=class extends Ta{constructor(t,r,i){super(t,"AuthWeakPasswordError",r,"weak_password"),this.reasons=i}};Le.AuthWeakPasswordError=B7;function w5e(e){return f6(e)&&e.name==="AuthWeakPasswordError"}Le.isAuthWeakPasswordError=w5e});var $7=g(Gt=>{"use strict";var b5e=Gt&&Gt.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(Gt,"__esModule",{value:!0});Gt._noResolveJsonResponse=Gt._generateLinkResponse=Gt._ssoResponse=Gt._userResponse=Gt._sessionResponsePassword=Gt._sessionResponse=Gt._request=Gt.handleError=void 0;var h6=p6(),j7=Rp(),yl=wh(),vl=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),D5e=[502,503,504];async function q7(e){var t;if(!(0,j7.looksLikeFetchResponse)(e))throw new yl.AuthRetryableFetchError(vl(e),0);if(D5e.includes(e.status))throw new yl.AuthRetryableFetchError(vl(e),e.status);let r;try{r=await e.json()}catch(a){throw new yl.AuthUnknownError(vl(a),a)}let i,n=(0,j7.parseResponseAPIVersion)(e);if(n&&n.getTime()>=h6.API_VERSIONS["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?i=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(i=r.error_code),i){if(i==="weak_password")throw new yl.AuthWeakPasswordError(vl(r),e.status,((t=r.weak_password)===null||t===void 0?void 0:t.reasons)||[])}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((a,s)=>a&&typeof s=="string",!0))throw new yl.AuthWeakPasswordError(vl(r),e.status,r.weak_password.reasons);throw new yl.AuthApiError(vl(r),e.status||500,i)}Gt.handleError=q7;var E5e=(e,t,r,i)=>{let n={method:e,headers:t?.headers||{}};return e==="GET"?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),n.body=JSON.stringify(i),Object.assign(Object.assign({},n),r))};async function x5e(e,t,r,i){var n;let a=Object.assign({},i?.headers);a[h6.API_VERSION_HEADER_NAME]||(a[h6.API_VERSION_HEADER_NAME]=h6.API_VERSIONS["2024-01-01"].name),i?.jwt&&(a.Authorization=`Bearer ${i.jwt}`);let s=(n=i?.query)!==null&&n!==void 0?n:{};i?.redirectTo&&(s.redirect_to=i.redirectTo);let o=Object.keys(s).length?"?"+new URLSearchParams(s).toString():"",u=await C5e(e,t,r+o,{headers:a,noResolveJson:i?.noResolveJson},{},i?.body);return i?.xform?i?.xform(u):{data:Object.assign({},u),error:null}}Gt._request=x5e;async function C5e(e,t,r,i,n,a){let s=E5e(t,i,n,a),o;try{o=await e(r,Object.assign({},s))}catch(u){throw console.error(u),new yl.AuthRetryableFetchError(vl(u),0)}if(o.ok||await q7(o),i?.noResolveJson)return o;try{return await o.json()}catch(u){await q7(u)}}function zL(e){var t;let r=null;k5e(e)&&(r=Object.assign({},e),e.expires_at||(r.expires_at=(0,j7.expiresAt)(e.expires_in)));let i=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:r,user:i},error:null}}Gt._sessionResponse=zL;function S5e(e){let t=zL(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((r,i)=>r&&typeof i=="string",!0)&&(t.data.weak_password=e.weak_password),t}Gt._sessionResponsePassword=S5e;function A5e(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}Gt._userResponse=A5e;function O5e(e){return{data:e,error:null}}Gt._ssoResponse=O5e;function T5e(e){let{action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a}=e,s=b5e(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:t,email_otp:r,hashed_token:i,redirect_to:n,verification_type:a},u=Object.assign({},s);return{data:{properties:o,user:u},error:null}}Gt._generateLinkResponse=T5e;function F5e(e){return e}Gt._noResolveJsonResponse=F5e;function k5e(e){return e.access_token&&e.refresh_token&&e.expires_in}});var m6=g(bh=>{"use strict";var N5e=bh&&bh.__rest||function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r};Object.defineProperty(bh,"__esModule",{value:!0});var Ar=$7(),R5e=Rp(),Fa=wh(),M7=class{constructor({url:t="",headers:r={},fetch:i}){this.url=t,this.headers=r,this.fetch=(0,R5e.resolveFetch)(i),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)}}async signOut(t,r="global"){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(i){if((0,Fa.isAuthError)(i))return{data:null,error:i};throw i}}async inviteUserByEmail(t,r={}){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async generateLink(t){try{let{options:r}=t,i=N5e(t,["options"]),n=Object.assign(Object.assign({},i),r);return"newEmail"in i&&(n.new_email=i?.newEmail,delete n.newEmail),await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:n,headers:this.headers,xform:Ar._generateLinkResponse,redirectTo:r?.redirectTo})}catch(r){if((0,Fa.isAuthError)(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(t){try{return await(0,Ar._request)(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Fa.isAuthError)(r))return{data:{user:null},error:r};throw r}}async listUsers(t){var r,i,n,a,s,o,u;try{let l={nextPage:null,lastPage:0,total:0},c=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(i=(r=t?.page)===null||r===void 0?void 0:r.toString())!==null&&i!==void 0?i:"",per_page:(a=(n=t?.perPage)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:""},xform:Ar._noResolveJsonResponse});if(c.error)throw c.error;let p=await c.json(),d=(s=c.headers.get("x-total-count"))!==null&&s!==void 0?s:0,f=(u=(o=c.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&u!==void 0?u:[];return f.length>0&&(f.forEach(h=>{let m=parseInt(h.split(";")[0].split("=")[1].substring(0,1)),v=JSON.parse(h.split(";")[1].split("=")[1]);l[`${v}Page`]=m}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},p),l),error:null}}catch(l){if((0,Fa.isAuthError)(l))return{data:{users:[]},error:l};throw l}}async getUserById(t){try{return await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:Ar._userResponse})}catch(r){if((0,Fa.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUserById(t,r){try{return await(0,Ar._request)(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:r,headers:this.headers,xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async deleteUser(t,r=!1){try{return await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ar._userResponse})}catch(i){if((0,Fa.isAuthError)(i))return{data:{user:null},error:i};throw i}}async _listFactors(t){try{let{data:r,error:i}=await(0,Ar._request)(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:n=>({data:{factors:n},error:null})});return{data:r,error:i}}catch(r){if((0,Fa.isAuthError)(r))return{data:null,error:r};throw r}}async _deleteFactor(t){try{return{data:await(0,Ar._request)(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(r){if((0,Fa.isAuthError)(r))return{data:null,error:r};throw r}}};bh.default=M7});var GL=g(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.memoryLocalStorageAdapter=Ip.localStorageAdapter=void 0;var U7=Rp();Ip.localStorageAdapter={getItem:e=>(0,U7.supportsLocalStorage)()?globalThis.localStorage.getItem(e):null,setItem:(e,t)=>{(0,U7.supportsLocalStorage)()&&globalThis.localStorage.setItem(e,t)},removeItem:e=>{(0,U7.supportsLocalStorage)()&&globalThis.localStorage.removeItem(e)}};function P5e(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}Ip.memoryLocalStorageAdapter=P5e});var WL=g(g6=>{"use strict";Object.defineProperty(g6,"__esModule",{value:!0});g6.polyfillGlobalThis=void 0;function I5e(){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)}}g6.polyfillGlobalThis=I5e});var V7=g(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.navigatorLock=Vr.NavigatorLockAcquireTimeoutError=Vr.LockAcquireTimeoutError=Vr.internals=void 0;var L5e=Rp();Vr.internals={debug:!!(globalThis&&(0,L5e.supportsLocalStorage)()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};var y6=class extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}};Vr.LockAcquireTimeoutError=y6;var v6=class extends y6{};Vr.NavigatorLockAcquireTimeoutError=v6;async function B5e(e,t,r){Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let i=new globalThis.AbortController;return t>0&&setTimeout(()=>{i.abort(),Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:i.signal},async n=>{if(n){Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,n.name);try{return await r()}finally{Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,n.name)}}else{if(t===0)throw Vr.internals.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new v6(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(Vr.internals.debug)try{let a=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(a,null," "))}catch(a){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",a)}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()}})}Vr.navigatorLock=B5e});var z7=g(xh=>{"use strict";var j5e=xh&&xh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xh,"__esModule",{value:!0});var q5e=j5e(m6()),Eh=p6(),ce=wh(),De=$7(),Oe=Rp(),H7=GL(),$5e=WL(),M5e=O7(),KL=V7();(0,$5e.polyfillGlobalThis)();var U5e={url:Eh.GOTRUE_URL,storageKey:Eh.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Eh.DEFAULT_HEADERS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},Dh=30*1e3,YL=3;async function XL(e,t,r){return await r()}var _6=class e{constructor(t){var r,i;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=e.nextInstanceID,e.nextInstanceID+=1,this.instanceID>0&&(0,Oe.isBrowser)()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let n=Object.assign(Object.assign({},U5e),t);if(this.logDebugMessages=!!n.debug,typeof n.debug=="function"&&(this.logger=n.debug),this.persistSession=n.persistSession,this.storageKey=n.storageKey,this.autoRefreshToken=n.autoRefreshToken,this.admin=new q5e.default({url:n.url,headers:n.headers,fetch:n.fetch}),this.url=n.url,this.headers=n.headers,this.fetch=(0,Oe.resolveFetch)(n.fetch),this.lock=n.lock||XL,this.detectSessionInUrl=n.detectSessionInUrl,this.flowType=n.flowType,this.hasCustomAuthorizationHeader=n.hasCustomAuthorizationHeader,n.lock?this.lock=n.lock:(0,Oe.isBrowser)()&&(!((r=globalThis?.navigator)===null||r===void 0)&&r.locks)?this.lock=KL.navigatorLock:this.lock=XL,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)},this.persistSession?n.storage?this.storage=n.storage:(0,Oe.supportsLocalStorage)()?this.storage=H7.localStorageAdapter:(this.memoryStorage={},this.storage=(0,H7.memoryLocalStorageAdapter)(this.memoryStorage)):(this.memoryStorage={},this.storage=(0,H7.memoryLocalStorageAdapter)(this.memoryStorage)),(0,Oe.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}_debug(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${M5e.version}) ${new Date().toISOString()}`,...t),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(){try{let t=(0,Oe.isBrowser)()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",t),t||this.detectSessionInUrl&&this._isImplicitGrantFlow()){let{data:r,error:i}=await this._getSessionFromURL(t);if(i)return this._debug("#_initialize()","error detecting session from URL",i),i?.message==="Identity is already linked"||i?.message==="Identity is already linked to another user"?{error:i}:(await this._removeSession(),{error:i});let{session:n,redirectType:a}=r;return this._debug("#_initialize()","detected session in URL",n,"redirect type",a),await this._saveSession(n),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",n):await this._notifyAllSubscribers("SIGNED_IN",n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(t){return(0,ce.isAuthError)(t)?{error:t}:{error:new ce.AuthUnknownError("Unexpected error during initialization",t)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var r,i,n;try{let a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(i=(r=t?.options)===null||r===void 0?void 0:r.data)!==null&&i!==void 0?i:{},gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}},xform:De._sessionResponse}),{data:s,error:o}=a;if(o||!s)return{data:{user:null,session:null},error:o};let u=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(a){if((0,ce.isAuthError)(a))return{data:{user:null,session:null},error:a};throw a}}async signUp(t){var r,i,n;try{let a;if("email"in t){let{email:c,password:p,options:d}=t,f=null,h=null;this.flowType==="pkce"&&([f,h]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey)),a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d?.emailRedirectTo,body:{email:c,password:p,data:(r=d?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:f,code_challenge_method:h},xform:De._sessionResponse})}else if("phone"in t){let{phone:c,password:p,options:d}=t;a=await(0,De._request)(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:c,password:p,data:(i=d?.data)!==null&&i!==void 0?i:{},channel:(n=d?.channel)!==null&&n!==void 0?n:"sms",gotrue_meta_security:{captcha_token:d?.captchaToken}},xform:De._sessionResponse})}else throw new ce.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:s,error:o}=a;if(o||!s)return{data:{user:null,session:null},error:o};let u=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(a){if((0,ce.isAuthError)(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithPassword(t){try{let r;if("email"in t){let{email:a,password:s,options:o}=t;r=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:a,password:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:De._sessionResponsePassword})}else if("phone"in t){let{phone:a,password:s,options:o}=t;r=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:a,password:s,gotrue_meta_security:{captcha_token:o?.captchaToken}},xform:De._sessionResponsePassword})}else throw new ce.AuthInvalidCredentialsError("You must provide either an email or phone number and a password");let{data:i,error:n}=r;return n?{data:{user:null,session:null},error:n}:!i||!i.session||!i.user?{data:{user:null,session:null},error:new ce.AuthInvalidTokenResponseError}:(i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:Object.assign({user:i.user,session:i.session},i.weak_password?{weakPassword:i.weak_password}:null),error:n})}catch(r){if((0,ce.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOAuth(t){var r,i,n,a;return await this._handleProviderSignIn(t.provider,{redirectTo:(r=t.options)===null||r===void 0?void 0:r.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(n=t.options)===null||n===void 0?void 0:n.queryParams,skipBrowserRedirect:(a=t.options)===null||a===void 0?void 0:a.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async _exchangeCodeForSession(t){let r=await(0,Oe.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[i,n]=(r??"").split("/"),{data:a,error:s}=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:i},xform:De._sessionResponse});return await(0,Oe.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),s?{data:{user:null,session:null,redirectType:null},error:s}:!a||!a.session||!a.user?{data:{user:null,session:null,redirectType:null},error:new ce.AuthInvalidTokenResponseError}:(a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),{data:Object.assign(Object.assign({},a),{redirectType:n??null}),error:s})}async signInWithIdToken(t){try{let{options:r,provider:i,token:n,access_token:a,nonce:s}=t,o=await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:i,id_token:n,access_token:a,nonce:s,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:De._sessionResponse}),{data:u,error:l}=o;return l?{data:{user:null,session:null},error:l}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new ce.AuthInvalidTokenResponseError}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:l})}catch(r){if((0,ce.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithOtp(t){var r,i,n,a,s;try{if("email"in t){let{email:o,options:u}=t,l=null,c=null;this.flowType==="pkce"&&([l,c]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{error:p}=await(0,De._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(r=u?.data)!==null&&r!==void 0?r:{},create_user:(i=u?.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},code_challenge:l,code_challenge_method:c},redirectTo:u?.emailRedirectTo});return{data:{user:null,session:null},error:p}}if("phone"in t){let{phone:o,options:u}=t,{data:l,error:c}=await(0,De._request)(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(n=u?.data)!==null&&n!==void 0?n:{},create_user:(a=u?.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:u?.captchaToken},channel:(s=u?.channel)!==null&&s!==void 0?s:"sms"}});return{data:{user:null,session:null,messageId:l?.message_id},error:c}}throw new ce.AuthInvalidCredentialsError("You must provide either an email or phone number.")}catch(o){if((0,ce.isAuthError)(o))return{data:{user:null,session:null},error:o};throw o}}async verifyOtp(t){var r,i;try{let n,a;"options"in t&&(n=(r=t.options)===null||r===void 0?void 0:r.redirectTo,a=(i=t.options)===null||i===void 0?void 0:i.captchaToken);let{data:s,error:o}=await(0,De._request)(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:a}}),redirectTo:n,xform:De._sessionResponse});if(o)throw o;if(!s)throw new Error("An error occurred on token verification.");let u=s.session,l=s.user;return u?.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:l,session:u},error:null}}catch(n){if((0,ce.isAuthError)(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithSSO(t){var r,i,n;try{let a=null,s=null;return this.flowType==="pkce"&&([a,s]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey)),await(0,De._request)(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(i=(r=t.options)===null||r===void 0?void 0:r.redirectTo)!==null&&i!==void 0?i:void 0}),!((n=t?.options)===null||n===void 0)&&n.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:s}),headers:this.headers,xform:De._ssoResponse})}catch(a){if((0,ce.isAuthError)(a))return{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 t=>{let{data:{session:r},error:i}=t;if(i)throw i;if(!r)throw new ce.AuthSessionMissingError;let{error:n}=await(0,De._request)(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return{data:{user:null,session:null},error:n}})}catch(t){if((0,ce.isAuthError)(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{let r=`${this.url}/resend`;if("email"in t){let{email:i,type:n,options:a}=t,{error:s}=await(0,De._request)(this.fetch,"POST",r,{headers:this.headers,body:{email:i,type:n,gotrue_meta_security:{captcha_token:a?.captchaToken}},redirectTo:a?.emailRedirectTo});return{data:{user:null,session:null},error:s}}else if("phone"in t){let{phone:i,type:n,options:a}=t,{data:s,error:o}=await(0,De._request)(this.fetch,"POST",r,{headers:this.headers,body:{phone:i,type:n,gotrue_meta_security:{captcha_token:a?.captchaToken}}});return{data:{user:null,session:null,messageId:s?.message_id},error:o}}throw new ce.AuthInvalidCredentialsError("You must provide either an email or phone number and a type")}catch(r){if((0,ce.isAuthError)(r))return{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(t,r){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){let i=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),n=(async()=>(await i,await r()))();return this.pendingInLock.push((async()=>{try{await n}catch{}})()),n}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let i=r();for(this.pendingInLock.push((async()=>{try{await i}catch{}})()),await i;this.pendingInLock.length;){let n=[...this.pendingInLock];await Promise.all(n),this.pendingInLock.splice(0,n.length)}return await i}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{let r=await this.__loadSession();return await t(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 t=null,r=await(0,Oe.getItemAsync)(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};let i=t.expires_at?t.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${i?"":" not"} expired`,"expires_at",t.expires_at),!i){if(this.storage.isServer){let s=this.suppressGetSessionWarning;t=new Proxy(t,{get:(u,l,c)=>(!s&&l==="user"&&(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 many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),s=!0,this.suppressGetSessionWarning=!0),Reflect.get(u,l,c))})}return{data:{session:t},error:null}}let{session:n,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{session:null},error:a}:{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(t){return t?await this._getUser(t):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(t){try{return t?await(0,De._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:De._userResponse}):await this._useSession(async r=>{var i,n,a;let{data:s,error:o}=r;if(o)throw o;return!(!((i=s.session)===null||i===void 0)&&i.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new ce.AuthSessionMissingError}:await(0,De._request)(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(a=(n=s.session)===null||n===void 0?void 0:n.access_token)!==null&&a!==void 0?a:void 0,xform:De._userResponse})})}catch(r){if((0,ce.isAuthError)(r))return{data:{user:null},error:r};throw r}}async updateUser(t,r={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,r))}async _updateUser(t,r={}){try{return await this._useSession(async i=>{let{data:n,error:a}=i;if(a)throw a;if(!n.session)throw new ce.AuthSessionMissingError;let s=n.session,o=null,u=null;this.flowType==="pkce"&&t.email!=null&&([o,u]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey));let{data:l,error:c}=await(0,De._request)(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:o,code_challenge_method:u}),jwt:s.access_token,xform:De._userResponse});if(c)throw c;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(i){if((0,ce.isAuthError)(i))return{data:{user:null},error:i};throw i}}_decodeJWT(t){return(0,Oe.decodeJWTPayload)(t)}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new ce.AuthSessionMissingError;let r=Date.now()/1e3,i=r,n=!0,a=null,s=(0,Oe.decodeJWTPayload)(t.access_token);if(s.exp&&(i=s.exp,n=i<=r),n){let{session:o,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!o)return{data:{user:null,session:null},error:null};a=o}else{let{data:o,error:u}=await this._getUser(t.access_token);if(u)throw u;a={access_token:t.access_token,refresh_token:t.refresh_token,user:o.user,token_type:"bearer",expires_in:i-r,expires_at:i},await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)}return{data:{user:a.user,session:a},error:null}}catch(r){if((0,ce.isAuthError)(r))return{data:{session:null,user:null},error:r};throw r}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async r=>{var i;if(!t){let{data:s,error:o}=r;if(o)throw o;t=(i=s.session)!==null&&i!==void 0?i:void 0}if(!t?.refresh_token)throw new ce.AuthSessionMissingError;let{session:n,error:a}=await this._callRefreshToken(t.refresh_token);return a?{data:{user:null,session:null},error:a}:n?{data:{user:n.user,session:n},error:null}:{data:{user:null,session:null},error:null}})}catch(r){if((0,ce.isAuthError)(r))return{data:{user:null,session:null},error:r};throw r}}async _getSessionFromURL(t){try{if(!(0,Oe.isBrowser)())throw new ce.AuthImplicitGrantRedirectError("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new ce.AuthImplicitGrantRedirectError("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!t)throw new ce.AuthPKCEGrantCodeExchangeError("Not a valid PKCE flow url.");let r=(0,Oe.parseParametersFromURL)(window.location.href);if(t){if(!r.code)throw new ce.AuthPKCEGrantCodeExchangeError("No code detected.");let{data:D,error:b}=await this._exchangeCodeForSession(r.code);if(b)throw b;let _=new URL(window.location.href);return _.searchParams.delete("code"),window.history.replaceState(window.history.state,"",_.toString()),{data:{session:D.session,redirectType:null},error:null}}if(r.error||r.error_description||r.error_code)throw new ce.AuthImplicitGrantRedirectError(r.error_description||"Error in URL with unspecified error_description",{error:r.error||"unspecified_error",code:r.error_code||"unspecified_code"});let{provider_token:i,provider_refresh_token:n,access_token:a,refresh_token:s,expires_in:o,expires_at:u,token_type:l}=r;if(!a||!o||!s||!l)throw new ce.AuthImplicitGrantRedirectError("No session defined in URL");let c=Math.round(Date.now()/1e3),p=parseInt(o),d=c+p;u&&(d=parseInt(u));let f=d-c;f*1e3<=Dh&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${f}s, should have been closer to ${p}s`);let h=d-p;c-h>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",h,d,c):c-h<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",h,d,c);let{data:m,error:v}=await this._getUser(a);if(v)throw v;let y={provider_token:i,provider_refresh_token:n,access_token:a,expires_in:p,expires_at:d,refresh_token:s,token_type:l,user:m.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:y,redirectType:r.type},error:null}}catch(r){if((0,ce.isAuthError)(r))return{data:{session:null,redirectType:null},error:r};throw r}}_isImplicitGrantFlow(){let t=(0,Oe.parseParametersFromURL)(window.location.href);return!!((0,Oe.isBrowser)()&&(t.access_token||t.error_description))}async _isPKCEFlow(){let t=(0,Oe.parseParametersFromURL)(window.location.href),r=await(0,Oe.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&r)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async r=>{var i;let{data:n,error:a}=r;if(a)return{error:a};let s=(i=n.session)===null||i===void 0?void 0:i.access_token;if(s){let{error:o}=await this.admin.signOut(s,t);if(o&&!((0,ce.isAuthApiError)(o)&&(o.status===404||o.status===401||o.status===403)))return{error:o}}return t!=="others"&&(await this._removeSession(),await(0,Oe.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(t){let r=(0,Oe.uuid)(),i={id:r,callback:t,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,i),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:i}}}async _emitInitialSession(t){return await this._useSession(async r=>{var i,n;try{let{data:{session:a},error:s}=r;if(s)throw s;await((i=this.stateChangeEmitters.get(t))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",t,"session",a)}catch(a){await((n=this.stateChangeEmitters.get(t))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",a),console.error(a)}})}async resetPasswordForEmail(t,r={}){let i=null,n=null;this.flowType==="pkce"&&([i,n]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,De._request)(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:i,code_challenge_method:n,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(a){if((0,ce.isAuthError)(a))return{data:null,error:a};throw a}}async getUserIdentities(){var t;try{let{data:r,error:i}=await this.getUser();if(i)throw i;return{data:{identities:(t=r.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}}async linkIdentity(t){var r;try{let{data:i,error:n}=await this._useSession(async a=>{var s,o,u,l,c;let{data:p,error:d}=a;if(d)throw d;let f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(s=t.options)===null||s===void 0?void 0:s.redirectTo,scopes:(o=t.options)===null||o===void 0?void 0:o.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await(0,De._request)(this.fetch,"GET",f,{headers:this.headers,jwt:(c=(l=p.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})});if(n)throw n;return(0,Oe.isBrowser)()&&!(!((r=t.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(i?.url),{data:{provider:t.provider,url:i?.url},error:null}}catch(i){if((0,ce.isAuthError)(i))return{data:{provider:t.provider,url:null},error:i};throw i}}async unlinkIdentity(t){try{return await this._useSession(async r=>{var i,n;let{data:a,error:s}=r;if(s)throw s;return await(0,De._request)(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(n=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&n!==void 0?n:void 0})})}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}}async _refreshAccessToken(t){let r=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(r,"begin");try{let i=Date.now();return await(0,Oe.retryable)(async n=>(n>0&&await(0,Oe.sleep)(200*Math.pow(2,n-1)),this._debug(r,"refreshing attempt",n),await(0,De._request)(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:De._sessionResponse})),(n,a)=>{let s=200*Math.pow(2,n);return a&&(0,ce.isAuthRetryableFetchError)(a)&&Date.now()+s-i<Dh})}catch(i){if(this._debug(r,"error",i),(0,ce.isAuthError)(i))return{data:{session:null,user:null},error:i};throw i}finally{this._debug(r,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,r){let i=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",r,"url",i),(0,Oe.isBrowser)()&&!r.skipBrowserRedirect&&window.location.assign(i),{data:{provider:t,url:i},error:null}}async _recoverAndRefresh(){var t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let i=await(0,Oe.getItemAsync)(this.storage,this.storageKey);if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}let n=Math.round(Date.now()/1e3),a=((t=i.expires_at)!==null&&t!==void 0?t:1/0)<n+Eh.EXPIRY_MARGIN;if(this._debug(r,`session has${a?"":" not"} expired with margin of ${Eh.EXPIRY_MARGIN}s`),a){if(this.autoRefreshToken&&i.refresh_token){let{error:s}=await this._callRefreshToken(i.refresh_token);s&&(console.error(s),(0,ce.isAuthRetryableFetchError)(s)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",s),await this._removeSession()))}}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(t){var r,i;if(!t)throw new ce.AuthSessionMissingError;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let n=`#_callRefreshToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{this.refreshingDeferred=new Oe.Deferred;let{data:a,error:s}=await this._refreshAccessToken(t);if(s)throw s;if(!a.session)throw new ce.AuthSessionMissingError;await this._saveSession(a.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",a.session);let o={session:a.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(a){if(this._debug(n,"error",a),(0,ce.isAuthError)(a)){let s={session:null,error:a};return(0,ce.isAuthRetryableFetchError)(a)||(await this._removeSession(),await this._notifyAllSubscribers("SIGNED_OUT",null)),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(s),s}throw(i=this.refreshingDeferred)===null||i===void 0||i.reject(a),a}finally{this.refreshingDeferred=null,this._debug(n,"end")}}async _notifyAllSubscribers(t,r,i=!0){let n=`#_notifyAllSubscribers(${t})`;this._debug(n,"begin",r,`broadcast = ${i}`);try{this.broadcastChannel&&i&&this.broadcastChannel.postMessage({event:t,session:r});let a=[],s=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(t,r)}catch(u){a.push(u)}});if(await Promise.all(s),a.length>0){for(let o=0;o<a.length;o+=1)console.error(a[o]);throw a[0]}}finally{this._debug(n,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await(0,Oe.setItemAsync)(this.storage,this.storageKey,t)}async _removeSession(){this._debug("#_removeSession()"),await(0,Oe.removeItemAsync)(this.storage,this.storageKey)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&(0,Oe.isBrowser)()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let t=setInterval(()=>this._autoRefreshTokenTick(),Dh);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}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 t=Date.now();try{return await this._useSession(async r=>{let{data:{session:i}}=r;if(!i||!i.refresh_token||!i.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}let n=Math.floor((i.expires_at*1e3-t)/Dh);this._debug("#_autoRefreshTokenTick()",`access token expires in ${n} ticks, a tick lasts ${Dh}ms, refresh threshold is ${YL} ticks`),n<=YL&&await this._callRefreshToken(i.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(t){if(t.isAcquireTimeout||t instanceof KL.LockAcquireTimeoutError)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!(0,Oe.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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){let r=`#_onVisibilityChanged(${t})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(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(t,r,i){let n=[`provider=${encodeURIComponent(r)}`];if(i?.redirectTo&&n.push(`redirect_to=${encodeURIComponent(i.redirectTo)}`),i?.scopes&&n.push(`scopes=${encodeURIComponent(i.scopes)}`),this.flowType==="pkce"){let[a,s]=await(0,Oe.getCodeChallengeAndMethod)(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(s)}`});n.push(o.toString())}if(i?.queryParams){let a=new URLSearchParams(i.queryParams);n.push(a.toString())}return i?.skipBrowserRedirect&&n.push(`skip_http_redirect=${i.skipBrowserRedirect}`),`${t}?${n.join("&")}`}async _unenroll(t){try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;return a?{data:null,error:a}:await(0,De._request)(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}}async _enroll(t){try{return await this._useSession(async r=>{var i,n;let{data:a,error:s}=r;if(s)return{data:null,error:s};let{data:o,error:u}=await(0,De._request)(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:t.friendlyName,factor_type:t.factorType,issuer:t.issuer},headers:this.headers,jwt:(i=a?.session)===null||i===void 0?void 0:i.access_token});return u?{data:null,error:u}:(!((n=o?.totp)===null||n===void 0)&&n.qr_code&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}}async _verify(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;if(a)return{data:null,error:a};let{data:s,error:o}=await(0,De._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:{code:t.code,challenge_id:t.challengeId},headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token});return o?{data:null,error:o}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+s.expires_in},s)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",s),{data:s,error:o})})}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}})}async _challenge(t){return this._acquireLock(-1,async()=>{try{return await this._useSession(async r=>{var i;let{data:n,error:a}=r;return a?{data:null,error:a}:await(0,De._request)(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{headers:this.headers,jwt:(i=n?.session)===null||i===void 0?void 0:i.access_token})})}catch(r){if((0,ce.isAuthError)(r))return{data:null,error:r};throw r}})}async _challengeAndVerify(t){let{data:r,error:i}=await this._challenge({factorId:t.factorId});return i?{data:null,error:i}:await this._verify({factorId:t.factorId,challengeId:r.id,code:t.code})}async _listFactors(){let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let i=t?.factors||[],n=i.filter(a=>a.factor_type==="totp"&&a.status==="verified");return{data:{all:i,totp:n},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async t=>{var r,i;let{data:{session:n},error:a}=t;if(a)return{data:null,error:a};if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let s=this._decodeJWT(n.access_token),o=null;s.aal&&(o=s.aal);let u=o;((i=(r=n.user.factors)===null||r===void 0?void 0:r.filter(p=>p.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");let c=s.amr||[];return{data:{currentLevel:o,nextLevel:u,currentAuthenticationMethods:c},error:null}}))}};xh.default=_6;_6.nextInstanceID=0});var JL=g(Ch=>{"use strict";var V5e=Ch&&Ch.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ch,"__esModule",{value:!0});var H5e=V5e(m6()),z5e=H5e.default;Ch.default=z5e});var ZL=g(Sh=>{"use strict";var G5e=Sh&&Sh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Sh,"__esModule",{value:!0});var W5e=G5e(z7()),K5e=W5e.default;Sh.default=K5e});var eB=g(QL=>{"use strict";Object.defineProperty(QL,"__esModule",{value:!0})});var W7=g(mt=>{"use strict";var Y5e=mt&&mt.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),tB=mt&&mt.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Y5e(t,e,r)},w6=mt&&mt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(mt,"__esModule",{value:!0});mt.lockInternals=mt.NavigatorLockAcquireTimeoutError=mt.navigatorLock=mt.AuthClient=mt.AuthAdminApi=mt.GoTrueClient=mt.GoTrueAdminApi=void 0;var X5e=w6(m6());mt.GoTrueAdminApi=X5e.default;var J5e=w6(z7());mt.GoTrueClient=J5e.default;var Z5e=w6(JL());mt.AuthAdminApi=Z5e.default;var Q5e=w6(ZL());mt.AuthClient=Q5e.default;tB(eB(),mt);tB(wh(),mt);var G7=V7();Object.defineProperty(mt,"navigatorLock",{enumerable:!0,get:function(){return G7.navigatorLock}});Object.defineProperty(mt,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return G7.NavigatorLockAcquireTimeoutError}});Object.defineProperty(mt,"lockInternals",{enumerable:!0,get:function(){return G7.internals}})});var rB=g(b6=>{"use strict";Object.defineProperty(b6,"__esModule",{value:!0});b6.SupabaseAuthClient=void 0;var e_e=W7(),K7=class extends e_e.AuthClient{constructor(t){super(t)}};b6.SupabaseAuthClient=K7});var X7=g(Ah=>{"use strict";var t_e=Ah&&Ah.__awaiter||function(e,t,r,i){function n(a){return a instanceof r?a:new r(function(s){s(a)})}return new(r||(r=Promise))(function(a,s){function o(c){try{l(i.next(c))}catch(p){s(p)}}function u(c){try{l(i.throw(c))}catch(p){s(p)}}function l(c){c.done?a(c.value):n(c.value).then(o,u)}l((i=i.apply(e,t||[])).next())})};Object.defineProperty(Ah,"__esModule",{value:!0});var r_e=x_(),i_e=dI(),n_e=_7(),a_e=LL(),D6=jL(),s_e=$L(),iB=ML(),o_e=rB(),Y7=class{constructor(t,r,i){var n,a,s;if(this.supabaseUrl=t,this.supabaseKey=r,!t)throw new Error("supabaseUrl is required.");if(!r)throw new Error("supabaseKey is required.");let o=(0,iB.stripTrailingSlash)(t);this.realtimeUrl=`${o}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${o}/auth/v1`,this.storageUrl=`${o}/storage/v1`,this.functionsUrl=`${o}/functions/v1`;let u=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,l={db:D6.DEFAULT_DB_OPTIONS,realtime:D6.DEFAULT_REALTIME_OPTIONS,auth:Object.assign(Object.assign({},D6.DEFAULT_AUTH_OPTIONS),{storageKey:u}),global:D6.DEFAULT_GLOBAL_OPTIONS},c=(0,iB.applySettingDefaults)(i??{},l);this.storageKey=(n=c.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(a=c.global.headers)!==null&&a!==void 0?a:{},c.accessToken?(this.accessToken=c.accessToken,this.auth=new Proxy({},{get:(p,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((s=c.auth)!==null&&s!==void 0?s:{},this.headers,c.global.fetch),this.fetch=(0,s_e.fetchWithAuth)(r,this._getAccessToken.bind(this),c.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},c.realtime)),this.rest=new i_e.PostgrestClient(`${o}/rest/v1`,{headers:this.headers,schema:c.db.schema,fetch:this.fetch}),c.accessToken||this._listenForAuthEvents()}get functions(){return new r_e.FunctionsClient(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new a_e.StorageClient(this.storageUrl,this.headers,this.fetch)}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,r={},i={}){return this.rest.rpc(t,r,i)}channel(t,r={config:{}}){return this.realtime.channel(t,r)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var t,r;return t_e(this,void 0,void 0,function*(){if(this.accessToken)return yield this.accessToken();let{data:i}=yield this.auth.getSession();return(r=(t=i.session)===null||t===void 0?void 0:t.access_token)!==null&&r!==void 0?r:null})}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,storageKey:a,flowType:s,lock:o,debug:u},l,c){var p;let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new o_e.SupabaseAuthClient({url:this.authUrl,headers:Object.assign(Object.assign({},d),l),storageKey:a,autoRefreshToken:t,persistSession:r,detectSessionInUrl:i,storage:n,flowType:s,lock:o,debug:u,fetch:c,hasCustomAuthorizationHeader:(p="Authorization"in this.headers)!==null&&p!==void 0?p:!1})}_initRealtimeClient(t){return new n_e.RealtimeClient(this.realtimeUrl,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((r,i)=>{this._handleTokenChanged(r,"CLIENT",i?.access_token)})}_handleTokenChanged(t,r,i){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==i?(this.realtime.setAuth(i??null),this.changedAccessToken=i):t==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),r=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};Ah.default=Y7});var sB=g(gt=>{"use strict";var u_e=gt&>.__createBinding||(Object.create?function(e,t,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}),nB=gt&>.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&u_e(t,e,r)},aB=gt&>.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gt,"__esModule",{value:!0});gt.createClient=gt.SupabaseClient=gt.FunctionRegion=gt.FunctionsError=gt.FunctionsRelayError=gt.FunctionsFetchError=gt.FunctionsHttpError=void 0;var l_e=aB(X7());nB(W7(),gt);var Oh=x_();Object.defineProperty(gt,"FunctionsHttpError",{enumerable:!0,get:function(){return Oh.FunctionsHttpError}});Object.defineProperty(gt,"FunctionsFetchError",{enumerable:!0,get:function(){return Oh.FunctionsFetchError}});Object.defineProperty(gt,"FunctionsRelayError",{enumerable:!0,get:function(){return Oh.FunctionsRelayError}});Object.defineProperty(gt,"FunctionsError",{enumerable:!0,get:function(){return Oh.FunctionsError}});Object.defineProperty(gt,"FunctionRegion",{enumerable:!0,get:function(){return Oh.FunctionRegion}});nB(_7(),gt);var c_e=X7();Object.defineProperty(gt,"SupabaseClient",{enumerable:!0,get:function(){return aB(c_e).default}});var p_e=(e,t,r)=>new l_e.default(e,t,r);gt.createClient=p_e});var cB=g((Bdt,lB)=>{var uB={};lB.exports=uB;var oB={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(oB).forEach(function(e){var t=oB[e],r=uB[e]=[];r.open="\x1B["+t[0]+"m",r.close="\x1B["+t[1]+"m"})});var dB=g((jdt,pB)=>{"use strict";pB.exports=function(e,t){t=t||process.argv;var r=t.indexOf("--"),i=/^-{1,2}/.test(e)?"":"--",n=t.indexOf(i+e);return n!==-1&&(r===-1?!0:n<r)}});var hB=g((qdt,fB)=>{"use strict";var d_e=require("os"),ea=dB(),ni=process.env,Lp=void 0;ea("no-color")||ea("no-colors")||ea("color=false")?Lp=!1:(ea("color")||ea("colors")||ea("color=true")||ea("color=always"))&&(Lp=!0);"FORCE_COLOR"in ni&&(Lp=ni.FORCE_COLOR.length===0||parseInt(ni.FORCE_COLOR,10)!==0);function f_e(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function h_e(e){if(Lp===!1)return 0;if(ea("color=16m")||ea("color=full")||ea("color=truecolor"))return 3;if(ea("color=256"))return 2;if(e&&!e.isTTY&&Lp!==!0)return 0;var t=Lp?1:0;if(process.platform==="win32"){var r=d_e.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 ni)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(n){return n in ni})||ni.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in ni)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ni.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in ni){var i=parseInt((ni.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ni.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ni.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(ni.TERM)||"COLORTERM"in ni?1:(ni.TERM==="dumb",t)}function J7(e){var t=h_e(e);return f_e(t)}fB.exports={supportsColor:J7,stdout:J7(process.stdout),stderr:J7(process.stderr)}});var gB=g(($dt,mB)=>{mB.exports=function(t,r){var i="";t=t||"Run the trap, drop the bass",t=t.split("");var n={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 t.forEach(function(a){a=a.toLowerCase();var s=n[a]||[" "],o=Math.floor(Math.random()*s.length);typeof n[a]<"u"?i+=n[a][o]:i+=a}),i}});var vB=g((Mdt,yB)=>{yB.exports=function(t,r){t=t||" he is here ";var i={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"]},n=[].concat(i.up,i.down,i.mid);function a(u){var l=Math.floor(Math.random()*u);return l}function s(u){var l=!1;return n.filter(function(c){l=c===u}),l}function o(u,l){var c="",p,d;l=l||{},l.up=typeof l.up<"u"?l.up:!0,l.mid=typeof l.mid<"u"?l.mid:!0,l.down=typeof l.down<"u"?l.down:!0,l.size=typeof l.size<"u"?l.size:"maxi",u=u.split("");for(d in u)if(!s(d)){switch(c=c+u[d],p={up:0,down:0,mid:0},l.size){case"mini":p.up=a(8),p.mid=a(2),p.down=a(8);break;case"maxi":p.up=a(16)+3,p.mid=a(4)+1,p.down=a(64)+3;break;default:p.up=a(8)+1,p.mid=a(6)/2,p.down=a(8)+1;break}var f=["up","mid","down"];for(var h in f)for(var m=f[h],v=0;v<=p[m];v++)l[m]&&(c=c+i[m][a(i[m].length)])}return c}return o(t,r)}});var wB=g((Udt,_B)=>{_B.exports=function(e){return function(t,r,i){if(t===" ")return t;switch(r%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}});var DB=g((Vdt,bB)=>{bB.exports=function(e){return function(t,r,i){return r%2===0?t:e.inverse(t)}}});var xB=g((Hdt,EB)=>{EB.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(r,i,n){return r===" "?r:e[t[i++%t.length]](r)}}});var SB=g((zdt,CB)=>{CB.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(r,i,n){return r===" "?r:e[t[Math.round(Math.random()*(t.length-2))]](r)}}});var NB=g((Wdt,kB)=>{var Ce={};kB.exports=Ce;Ce.themes={};var m_e=require("util"),_l=Ce.styles=cB(),OB=Object.defineProperties,g_e=new RegExp(/[\r\n]+/g);Ce.supportsColor=hB().supportsColor;typeof Ce.enabled>"u"&&(Ce.enabled=Ce.supportsColor()!==!1);Ce.enable=function(){Ce.enabled=!0};Ce.disable=function(){Ce.enabled=!1};Ce.stripColors=Ce.strip=function(e){return(""+e).replace(/\x1B\[\d+m/g,"")};var Gdt=Ce.stylize=function(t,r){if(!Ce.enabled)return t+"";var i=_l[r];return!i&&r in Ce?Ce[r](t):i.open+t+i.close},y_e=/[|\\{}()[\]^$+*?.]/g,v_e=function(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(y_e,"\\$&")};function TB(e){var t=function r(){return w_e.apply(r,arguments)};return t._styles=e,t.__proto__=__e,t}var FB=function(){var e={};return _l.grey=_l.gray,Object.keys(_l).forEach(function(t){_l[t].closeRe=new RegExp(v_e(_l[t].close),"g"),e[t]={get:function(){return TB(this._styles.concat(t))}}}),e}(),__e=OB(function(){},FB);function w_e(){var e=Array.prototype.slice.call(arguments),t=e.map(function(s){return s!=null&&s.constructor===String?s:m_e.inspect(s)}).join(" ");if(!Ce.enabled||!t)return t;for(var r=t.indexOf(`
|
|
30
30
|
`)!=-1,i=this._styles,n=i.length;n--;){var a=_l[i[n]];t=a.open+t.replace(a.closeRe,a.open)+a.close,r&&(t=t.replace(g_e,function(s){return a.close+s+a.open}))}return t}Ce.setTheme=function(e){if(typeof e=="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 t in e)(function(r){Ce[r]=function(i){if(typeof e[r]=="object"){var n=i;for(var a in e[r])n=Ce[e[r][a]](n);return n}return Ce[e[r]](i)}})(t)};function b_e(){var e={};return Object.keys(FB).forEach(function(t){e[t]={get:function(){return TB([t])}}}),e}var D_e=function(t,r){var i=r.split("");return i=i.map(t),i.join("")};Ce.trap=gB();Ce.zalgo=vB();Ce.maps={};Ce.maps.america=wB()(Ce);Ce.maps.zebra=DB()(Ce);Ce.maps.rainbow=xB()(Ce);Ce.maps.random=SB()(Ce);for(AB in Ce.maps)(function(e){Ce[e]=function(t){return D_e(Ce.maps[e],t)}})(AB);var AB;OB(Ce,b_e())});var PB=g((Kdt,RB)=>{var E_e=NB();RB.exports=E_e});var IB=g(Z7=>{"use strict";Z7.indent=function(t){return new Array(t+1).join(" ")};Z7.getMaxIndexLength=function(e){var t=0;return Object.getOwnPropertyNames(e).forEach(function(r){e[r]!==void 0&&(t=Math.max(t,r.length))}),t}});var LB=g((Xdt,x_e)=>{x_e.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 BB=g(Th=>{"use strict";var ka=PB(),ru=IB(),C_e=/[^\w\s\n\r\v\t\.,]/i;Th.version=LB().version;var Q7=function(e,t){return e!==void 0||t.renderUndefined},E6=function(e,t,r){return!!(typeof e=="boolean"||typeof e=="number"||typeof e=="function"||e===null||e===void 0||e instanceof Date||typeof e=="string"&&e.indexOf(`
|
|
31
31
|
`)===-1||r.inlineArrays&&!t&&Array.isArray(e)&&E6(e[0],!0,r))},S_e=function(e,t){if(t.noColor)return e;if(typeof e=="string")return t.stringColor?ka[t.stringColor](e):e;var r=e+"";return e===!0?ka.green(r):e===!1?ka.red(r):e==null?ka.grey(r):typeof e=="number"?e>=0?ka[t.positiveNumberColor](r):ka[t.negativeNumberColor](r):typeof e=="function"?"function() {}":Array.isArray(e)?e.join(", "):r},ew=function(e,t){return e.multilineStringColor===null||e.noColor?t:ka[e.multilineStringColor](t)},A_e=function(e,t,r){var i=e.split(`
|
|
32
32
|
`);return i=i.map(function(n){return ru.indent(t)+ew(r,n)}),i.join(`
|
|
@@ -289,7 +289,7 @@ GFS4: `),console.error(e)});Ot[qr]||(M0e=global[qr]||[],V0e(Ot,M0e),Ot.close=fun
|
|
|
289
289
|
`;function X0e(e,t){var r=[],i="";typeof t=="string"?t={section:t,whitespace:!1}:(t=t||{},t.whitespace=t.whitespace===!0);var n=t.whitespace?" = ":"=";return Object.keys(e).forEach(function(a,s,o){var u=e[a];u&&Array.isArray(u)?u.forEach(function(l){i+=_1(a+"[]")+n+_1(l)+`
|
|
290
290
|
`}):u&&typeof u=="object"?r.push(a):i+=_1(a)+n+_1(u)+oN}),t.section&&i.length&&(i="["+_1(t.section)+"]"+oN+i),r.forEach(function(a,s,o){var u=J0e(a).join("\\."),l=(t.section?t.section+".":"")+u,c=X0e(e[a],{section:l,whitespace:t.whitespace});i.length&&c.length&&(i+=oN),i+=c}),i}function J0e(e){return e.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(t){return t.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function bnt(e){var t={},r=t,i=null,n=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,a=e.split(/[\r\n]+/g);return a.forEach(function(s,o,u){if(!(!s||s.match(/^\s*[;#]/))){var l=s.match(n);if(l){if(l[1]!==void 0){if(i=R9(l[1]),i==="__proto__"){r={};return}r=t[i]=t[i]||{};return}var c=R9(l[2]);if(c!=="__proto__"){var p=l[3]?R9(l[4]):!0;switch(p){case"true":case"false":case"null":p=JSON.parse(p)}if(c.length>2&&c.slice(-2)==="[]"){if(c=c.substring(0,c.length-2),c==="__proto__")return;r[c]?Array.isArray(r[c])||(r[c]=[r[c]]):r[c]=[]}Array.isArray(r[c])?r[c].push(p):r[c]=p}}}}),Object.keys(t).filter(function(s,o,u){if(!t[s]||typeof t[s]!="object"||Array.isArray(t[s]))return!1;var l=J0e(s),c=t,p=l.pop(),d=p.replace(/\\\./g,".");return l.forEach(function(f,h,m){f!=="__proto__"&&((!c[f]||typeof c[f]!="object")&&(c[f]={}),c=c[f])}),c===t&&d===p?!1:(c[d]=t[s],!0)}).forEach(function(s,o,u){delete t[s]}),t}function Z0e(e){return e.charAt(0)==='"'&&e.slice(-1)==='"'||e.charAt(0)==="'"&&e.slice(-1)==="'"}function _1(e){return typeof e!="string"||e.match(/[=\r\n]/)||e.match(/^\[/)||e.length>1&&Z0e(e)||e!==e.trim()?JSON.stringify(e):e.replace(/;/g,"\\;").replace(/#/g,"\\#")}function R9(e,t){if(e=(e||"").trim(),Z0e(e)){e.charAt(0)==="'"&&(e=e.substr(1,e.length-2));try{e=JSON.parse(e)}catch{}}else{for(var r=!1,i="",n=0,a=e.length;n<a;n++){var s=e.charAt(n);if(r)"\\;#".indexOf(s)!==-1?i+=s:i+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:i+=s}}return r&&(i+="\\"),i.trim()}return e}});var ime=g((Ro,rme)=>{var eme=Y0e(),Z2=require("path"),P9=require("fs"),uN=Q0e(),lN=require("events").EventEmitter,Dnt=require("url"),Ent=require("http"),Ro=rme.exports=function(){for(var e=[].slice.call(arguments),t=new Qr;e.length;){var r=e.shift();r&&t.push(typeof r=="string"?Cnt(r):r)}return t},Byt=Ro.find=function(){var e=Z2.join.apply(null,[].slice.call(arguments));function t(r,i){var n=Z2.join(r,i);try{return P9.statSync(n),n}catch{if(Z2.dirname(r)!==r)return t(Z2.dirname(r),i)}}return t(__dirname,e)},xnt=Ro.parse=function(e,t,r){if(e=""+e,r)if(r==="json")if(this.emit)try{return JSON.parse(e)}catch(i){this.emit("error",i)}else return JSON.parse(e);else return uN.parse(e);else try{return JSON.parse(e)}catch{return uN.parse(e)}},Cnt=Ro.json=function(){var e=[].slice.call(arguments).filter(function(i){return i!=null}),t=Z2.join.apply(null,e),r;try{r=P9.readFileSync(t,"utf-8")}catch{return}return xnt(r,t,"json")},jyt=Ro.env=function(e,t){t=t||process.env;var r={},i=e.length;for(var n in t)n.indexOf(e)===0&&(r[n.substring(i)]=t[n]);return r};Ro.ConfigChain=Qr;function Qr(){lN.apply(this),eme.apply(this,arguments),this._awaiting=0,this._saving=0,this.sources={}}var tme={constructor:{value:Qr}};Object.keys(lN.prototype).forEach(function(e){tme[e]=Object.getOwnPropertyDescriptor(lN.prototype,e)});Qr.prototype=Object.create(eme.prototype,tme);Qr.prototype.del=function(e,t){if(t){var r=this.sources[t];if(r=r&&r.data,!r)return this.emit("error",new Error("not found "+t));delete r[e]}else for(var i=0,n=this.list.length;i<n;i++)delete this.list[i][e];return this};Qr.prototype.set=function(e,t,r){var i;if(r){if(i=this.sources[r],i=i&&i.data,!i)return this.emit("error",new Error("not found "+r))}else if(i=this.list[0],!i)return this.emit("error",new Error("cannot set, no confs!"));return i[e]=t,this};Qr.prototype.get=function(e,t){return t?(t=this.sources[t],t&&(t=t.data),t&&Object.hasOwnProperty.call(t,e)?t[e]:void 0):this.list[0][e]};Qr.prototype.save=function(e,a,r){typeof a=="function"&&(r=a,a=null);var i=this.sources[e];if(!i||!(i.path||i.source)||!i.data)return this.emit("error",new Error("bad save target: "+e));if(i.source){var n=i.prefix||"";return Object.keys(i.data).forEach(function(o){i.source[n+o]=i.data[o]}),this}var a=a||i.type,s=i.data;return i.type==="json"?s=JSON.stringify(s):s=uN.stringify(s),this._saving++,P9.writeFile(i.path,s,"utf8",function(o){if(this._saving--,o)return r?r(o):this.emit("error",o);this._saving===0&&(r&&r(),this.emit("save"))}.bind(this)),this};Qr.prototype.addFile=function(e,t,r){r=r||e;var i={__source__:r};return this.sources[r]={path:e,type:t},this.push(i),this._await(),P9.readFile(e,"utf8",function(n,a){n&&this.emit("error",n),this.addString(a,e,t,i)}.bind(this)),this};Qr.prototype.addEnv=function(e,t,r){r=r||"env";var i=Ro.env(e,t);return this.sources[r]={data:i,source:t,prefix:e},this.add(i,r)};Qr.prototype.addUrl=function(e,t,r){this._await();var i=Dnt.format(e);r=r||i;var n={__source__:r};return this.sources[r]={href:i,type:t},this.push(n),Ent.request(e,function(a){var s=[],o=a.headers["content-type"];t||(t=o.indexOf("json")!==-1?"json":o.indexOf("ini")!==-1?"ini":i.match(/\.json$/)?"json":i.match(/\.ini$/)?"ini":null,n.type=t),a.on("data",s.push.bind(s)).on("end",function(){this.addString(Buffer.concat(s),i,t,n)}.bind(this)).on("error",this.emit.bind(this,"error"))}.bind(this)).on("error",this.emit.bind(this,"error")).end(),this};Qr.prototype.addString=function(e,t,r,i){return e=this.parse(e,t,r),this.add(e,i),this};Qr.prototype.add=function(e,t){if(t&&typeof t=="object"){var r=this.list.indexOf(t);if(r===-1)return this.emit("error",new Error("bad marker"));this.splice(r,1,e),t=t.__source__,this.sources[t]=this.sources[t]||{},this.sources[t].data=e,this._resolve()}else typeof t=="string"&&(this.sources[t]=this.sources[t]||{},this.sources[t].data=e),this._await(),this.push(e),process.nextTick(this._resolve.bind(this));return this};Qr.prototype.parse=Ro.parse;Qr.prototype._await=function(){this._awaiting++};Qr.prototype._resolve=function(){this._awaiting--,this._awaiting===0&&this.emit("load",this)}});var ame=g((qyt,nme)=>{nme.exports=function(e){let t=e.indexOf(":");if(t===-1)return cN(e);let r=e.substr(0,t),i=e.substr(t+1);return`${cN(r)}:${cN(i)}`};function cN(e){if(e=e.toLowerCase(),e==="_authtoken")return"_authToken";let t=e[0];for(let r=1;r<e.length;r++)t+=e[r]==="_"?"-":e[r];return t}});var sme=g(I9=>{"use strict";Object.defineProperty(I9,"__esModule",{value:!0});I9.envReplace=void 0;var Snt=/(?<!\\)(\\*)\$\{([^${}]+)\}/g;function Ant(e,t){return e.replace(Snt,Ont.bind(null,t))}I9.envReplace=Ant;function Ont(e,t,r,i){if(r.length%2)return t.slice((r.length+1)/2);let n=Fnt(e,i);if(n===void 0)throw new Error(`Failed to replace env in config: ${t}`);return`${r.slice(r.length/2)}${n}`}var Tnt=/([^:-]+)(:?)-(.+)/;function Fnt(e,t){let r=t.match(Tnt);if(!r)return e[t];let[,i,n,a]=r;return Object.prototype.hasOwnProperty.call(e,i)?!e[i]&&n?a:e[i]:a}});var ome=g(L9=>{"use strict";Object.defineProperty(L9,"__esModule",{value:!0});L9.envReplace=void 0;var knt=sme();Object.defineProperty(L9,"envReplace",{enumerable:!0,get:function(){return knt.envReplace}})});var lme=g(B9=>{"use strict";var Nnt=require("fs"),Qc=require("path"),{envReplace:ume}=ome(),Rnt=(e,t,r)=>{if(typeof t!="string")return t;let i=[].concat(e[r]),n=i.indexOf(Qc)!==-1,a=i.indexOf(Boolean)!==-1,s=i.indexOf(String)!==-1,o=i.indexOf(Number)!==-1;if(t=`${t}`.trim(),/^".*"$/.test(t))try{t=JSON.parse(t)}catch{throw new Error(`Failed parsing JSON config key ${r}: ${t}`)}if(a&&!s&&t==="")return!0;switch(t){case"true":return!0;case"false":return!1;case"null":return null;case"undefined":return}return t=ume(t,process.env),n&&((process.platform==="win32"?/^~(\/|\\)/:/^~\//).test(t)&&process.env.HOME&&(t=Qc.resolve(process.env.HOME,t.substr(2))),t=Qc.resolve(t)),o&&!isNaN(t)&&(t=Number(t)),t},Pnt=e=>{e=Qc.resolve(e);let t=!1;for(;Qc.basename(e)==="node_modules";)e=Qc.dirname(e),t=!0;if(t)return e;let r=(i,n)=>{let a=/^[a-zA-Z]:(\\|\/)?$/;if(i==="/"||process.platform==="win32"&&a.test(i))return n;try{let s=Nnt.readdirSync(i);if(s.includes("node_modules")||s.includes("package.json")||s.includes("package.json5")||s.includes("package.yaml")||s.includes("pnpm-workspace.yaml"))return i;let o=Qc.dirname(i);return o===i?n:r(o,n)}catch(s){if(i===n){if(s.code==="ENOENT")return n;throw s}return n}};return r(e,e)};B9.envReplace=ume;B9.findPrefix=Pnt;B9.parseField=Rnt});var dme=g(pme=>{"use strict";var ep=require("path"),Int=require("stream").Stream,j9=require("url"),Lnt=()=>{},Bnt=()=>[],cme=()=>{};pme.types={access:[null,"restricted","public"],"allow-same-version":Boolean,"always-auth":Boolean,also:[null,"dev","development"],audit:Boolean,"auth-type":["legacy","sso","saml","oauth"],"bin-links":Boolean,browser:[null,String],ca:[null,String,Array],cafile:ep,cache:ep,"cache-lock-stale":Number,"cache-lock-retries":Number,"cache-lock-wait":Number,"cache-max":Number,"cache-min":Number,cert:[null,String],cidr:[null,String,Array],color:["always",Boolean],depth:Number,description:Boolean,dev:Boolean,"dry-run":Boolean,editor:String,"engine-strict":Boolean,force:Boolean,"fetch-retries":Number,"fetch-retry-factor":Number,"fetch-retry-mintimeout":Number,"fetch-retry-maxtimeout":Number,git:String,"git-tag-version":Boolean,"commit-hooks":Boolean,global:Boolean,globalconfig:ep,"global-style":Boolean,group:[Number,String],"https-proxy":[null,j9],"user-agent":String,"ham-it-up":Boolean,heading:String,"if-present":Boolean,"ignore-prepublish":Boolean,"ignore-scripts":Boolean,"init-module":ep,"init-author-name":String,"init-author-email":String,"init-author-url":["",j9],"init-license":String,"init-version":cme,json:Boolean,key:[null,String],"legacy-bundling":Boolean,link:Boolean,"local-address":Bnt(),loglevel:["silent","error","warn","notice","http","timing","info","verbose","silly"],logstream:Int,"logs-max":Number,long:Boolean,maxsockets:Number,message:String,"metrics-registry":[null,String],"node-options":[null,String],"node-version":[null,cme],"no-proxy":[null,String,Array],offline:Boolean,"onload-script":[null,String],only:[null,"dev","development","prod","production"],optional:Boolean,"package-lock":Boolean,otp:[null,String],"package-lock-only":Boolean,parseable:Boolean,"prefer-offline":Boolean,"prefer-online":Boolean,prefix:ep,production:Boolean,progress:Boolean,proxy:[null,!1,j9],provenance:Boolean,"read-only":Boolean,"rebuild-bundle":Boolean,registry:[null,j9],rollback:Boolean,save:Boolean,"save-bundle":Boolean,"save-dev":Boolean,"save-exact":Boolean,"save-optional":Boolean,"save-prefix":String,"save-prod":Boolean,scope:String,"script-shell":[null,String],"scripts-prepend-node-path":[!1,!0,"auto","warn-only"],searchopts:String,searchexclude:[null,String],searchlimit:Number,searchstaleness:Number,"send-metrics":Boolean,shell:String,shrinkwrap:Boolean,"sign-git-tag":Boolean,"sso-poll-frequency":Number,"sso-type":[null,"oauth","saml"],"strict-ssl":Boolean,tag:String,timing:Boolean,tmp:ep,unicode:Boolean,"unsafe-perm":Boolean,usage:Boolean,user:[Number,String],userconfig:ep,umask:Lnt,version:Boolean,"tag-version-prefix":String,versions:Boolean,viewer:String,_exit:Boolean}});var gme=g((Hyt,mme)=>{"use strict";var{readCAFileSync:jnt}=G0e(),fme=require("fs"),pN=require("path"),{ConfigChain:qnt}=ime(),$nt=ame(),hme=lme(),dN=class extends qnt{constructor(t,r){super(t),this.root=t,this._parseField=hme.parseField.bind(null,r||dme())}add(t,r){try{for(let i of Object.keys(t))t[i]=this._parseField(t[i],i)}catch(i){throw i}return super.add(t,r)}addFile(t,r){r=r||t;let i={__source__:r};this.sources[r]={path:t,type:"ini"},this.push(i),this._await();try{let n=fme.readFileSync(t,"utf8");this.addString(n,t,"ini",i)}catch(n){if(n.code==="ENOENT")this.add({},i);else return`Issue while reading "${t}". ${n.message}`}}addEnv(t){t=t||process.env;let r={};return Object.keys(t).filter(i=>/^npm_config_/i.test(i)).forEach(i=>{t[i]&&(r[$nt(i.substr(11))]=t[i])}),super.addEnv("",r,"env")}loadPrefix(){let t=this.list[0];Object.defineProperty(this,"prefix",{enumerable:!0,set:i=>{let n=this.get("global");this[n?"globalPrefix":"localPrefix"]=i},get:()=>this.get("global")?this.globalPrefix:this.localPrefix}),Object.defineProperty(this,"globalPrefix",{enumerable:!0,set:i=>{this.set("prefix",i)},get:()=>pN.resolve(this.get("prefix"))});let r;if(Object.defineProperty(this,"localPrefix",{enumerable:!0,set:i=>{r=i},get:()=>r}),Object.prototype.hasOwnProperty.call(t,"prefix"))r=pN.resolve(t.prefix);else try{r=hme.findPrefix(process.cwd())}catch(i){throw i}return r}loadCAFile(t){if(!t)return;let r=jnt(t);r&&this.set("ca",r)}loadUser(){let t=this.root;if(this.get("global"))return;if(process.env.SUDO_UID){t.user=Number(process.env.SUDO_UID);return}let r=pN.resolve(this.get("prefix"));try{let i=fme.statSync(r);t.user=i.uid}catch(i){if(i.code==="ENOENT")return;throw i}}};mme.exports=dN});var Dme=g(bme=>{"use strict";var _me=require("os"),Po=require("path"),wme=_me.tmpdir(),Mnt=process.getuid?process.getuid():process.pid,Unt=()=>!0,yme=process.platform==="win32",vme={editor:()=>process.env.EDITOR||process.env.VISUAL||(yme?"notepad.exe":"vi"),shell:()=>yme?process.env.COMSPEC||"cmd.exe":process.env.SHELL||"/bin/bash"},Vnt={fromString:()=>process.umask()},w1=_me.homedir();w1?process.env.HOME=w1:w1=Po.resolve(wme,"npm-"+Mnt);var Hnt=process.platform==="win32"?"npm-cache":".npm",znt=process.platform==="win32"&&process.env.APPDATA||w1,Gnt=Po.resolve(znt,Hnt),q9,tp;Object.defineProperty(bme,"defaults",{get:function(){return q9||(process.env.PREFIX?tp=process.env.PREFIX:process.platform==="win32"?tp=Po.dirname(process.execPath):(tp=Po.dirname(Po.dirname(process.execPath)),process.env.DESTDIR&&(tp=Po.join(process.env.DESTDIR,tp))),q9={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":"legacy","bin-links":!0,browser:null,ca:null,cafile:null,cache:Gnt,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:vme.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:"git","git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:Po.resolve(tp,"etc","npmrc"),"global-style":!1,group:process.platform==="win32"?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:"npm","if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":Po.resolve(w1,".npm-init.js"),"init-author-name":"","init-author-email":"","init-author-url":"","init-version":"1.0.0","init-license":"ISC",json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:"notice",logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:"%s","metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:tp,production:process.env.NODE_ENV==="production",progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":"npm/{npm-version} node/{node-version} {platform} {arch}","read-only":!1,"rebuild-bundle":!0,registry:"https://registry.npmjs.org/",rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":"^","save-prod":!1,scope:"","script-shell":null,"scripts-prepend-node-path":"warn-only",searchopts:"",searchexclude:null,searchlimit:20,searchstaleness:15*60,"send-metrics":!1,shell:vme.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":"oauth","strict-ssl":!0,tag:"latest","tag-version-prefix":"v",timing:!1,tmp:wme,unicode:Unt(),"unsafe-perm":process.platform==="win32"||process.platform==="cygwin"||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform==="win32"?0:"nobody",userconfig:Po.resolve(w1,".npmrc"),umask:process.umask?process.umask():Vnt.fromString("022"),version:!1,versions:!1,viewer:process.platform==="win32"?"browser":"man",_exit:!0},q9)}})});var xme=g((Gyt,fN)=>{"use strict";var rp=require("path"),Wnt=gme(),Eme=Dme();fN.exports=(e,t,r)=>{let i=new Wnt(Object.assign({},Eme.defaults,r),t);i.add(Object.assign({},e),"cli");let n=[],a=!1;if(require.resolve.paths){let l=require.resolve.paths("npm"),c;try{c=require.resolve("npm",{paths:l.slice(-1)})}catch{a=!0}c&&n.push(i.addFile(rp.resolve(rp.dirname(c),"..","npmrc"),"builtin"))}i.addEnv(),i.loadPrefix();let s=rp.resolve(i.localPrefix,".npmrc"),o=i.get("userconfig");if(!i.get("global")&&s!==o?n.push(i.addFile(s,"project")):i.add({},"project"),i.get("workspace-prefix")&&i.get("workspace-prefix")!==s){let l=rp.resolve(i.get("workspace-prefix"),".npmrc");n.push(i.addFile(l,"workspace"))}if(n.push(i.addFile(i.get("userconfig"),"user")),i.get("prefix")){let l=rp.resolve(i.get("prefix"),"etc");i.root.globalconfig=rp.resolve(l,"npmrc"),i.root.globalignorefile=rp.resolve(l,"npmignore")}n.push(i.addFile(i.get("globalconfig"),"global")),i.loadUser();let u=i.get("cafile");return u&&i.loadCAFile(u),{config:i,warnings:n.filter(Boolean),failedToLoadBuiltInConfig:a}};Object.defineProperty(fN.exports,"defaults",{get(){return Eme.defaults},enumerable:!0})});var Nme=g((Wyt,kme)=>{var hN=require("url"),Cme=xme(),Sme=":_authToken",Ame=":_auth",Ome=":username",Tme=":_password";kme.exports=function(){let t,r;arguments.length>=2?(t=arguments[0],r=Object.assign({},arguments[1])):typeof arguments[0]=="string"?t=arguments[0]:r=Object.assign({},arguments[0]),r=r||{};let i=r.npmrc;return r.npmrc=(r.npmrc?{config:{get:n=>i[n]}}:Cme()).config,t=t||r.npmrc.get("registry")||Cme.defaults.registry,Fme(t,r)||Knt(r.npmrc)};function Fme(e,t){let r=hN.parse(e,!1,!0),i;for(;i!=="/"&&r.pathname!==i;){i=r.pathname||"/";let n="//"+r.host+i.replace(/\/$/,""),a=Xnt(n,t.npmrc);if(a)return a;if(!t.recursive)return/\/$/.test(e)?void 0:Fme(hN.resolve(e,"."),t);r.pathname=hN.resolve(Ynt(i),"..")||"/"}}function Knt(e){return e.get("_auth")?{token:$9(e.get("_auth")),type:"Basic"}:void 0}function Ynt(e){return e[e.length-1]==="/"?e:e+"/"}function Xnt(e,t){let r=Jnt(t.get(e+Sme)||t.get(e+"/"+Sme));if(r)return r;let i=t.get(e+Ome)||t.get(e+"/"+Ome),n=t.get(e+Tme)||t.get(e+"/"+Tme),a=Znt(i,n);if(a)return a;let s=Qnt(t.get(e+Ame)||t.get(e+"/"+Ame));if(s)return s}function $9(e){return e.replace(/^\$\{?([^}]*)\}?$/,function(t,r){return process.env[r]})}function Jnt(e){return e?{token:$9(e),type:"Bearer"}:void 0}function Znt(e,t){if(!e||!t)return;let r=Buffer.from($9(t),"base64").toString("utf8");return{token:Buffer.from(e+":"+r,"utf8").toString("base64"),type:"Basic",password:r,username:e}}function Qnt(e){return e?{token:$9(e),type:"Basic"}:void 0}});var Q2=g((Kyt,Rme)=>{var eat="2.0.0",tat=Number.MAX_SAFE_INTEGER||9007199254740991,rat=16,iat=250,nat=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Rme.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:rat,MAX_SAFE_BUILD_LENGTH:iat,MAX_SAFE_INTEGER:tat,RELEASE_TYPES:nat,SEMVER_SPEC_VERSION:eat,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var eg=g((Yyt,Pme)=>{var aat=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Pme.exports=aat});var b1=g((Io,Ime)=>{var{MAX_SAFE_COMPONENT_LENGTH:mN,MAX_SAFE_BUILD_LENGTH:sat,MAX_LENGTH:oat}=Q2(),uat=eg();Io=Ime.exports={};var lat=Io.re=[],cat=Io.safeRe=[],ee=Io.src=[],te=Io.t={},pat=0,gN="[a-zA-Z0-9-]",dat=[["\\s",1],["\\d",oat],[gN,sat]],fat=e=>{for(let[t,r]of dat)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},we=(e,t,r)=>{let i=fat(t),n=pat++;uat(e,n,t),te[e]=n,ee[n]=t,lat[n]=new RegExp(t,r?"g":void 0),cat[n]=new RegExp(i,r?"g":void 0)};we("NUMERICIDENTIFIER","0|[1-9]\\d*");we("NUMERICIDENTIFIERLOOSE","\\d+");we("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${gN}*`);we("MAINVERSION",`(${ee[te.NUMERICIDENTIFIER]})\\.(${ee[te.NUMERICIDENTIFIER]})\\.(${ee[te.NUMERICIDENTIFIER]})`);we("MAINVERSIONLOOSE",`(${ee[te.NUMERICIDENTIFIERLOOSE]})\\.(${ee[te.NUMERICIDENTIFIERLOOSE]})\\.(${ee[te.NUMERICIDENTIFIERLOOSE]})`);we("PRERELEASEIDENTIFIER",`(?:${ee[te.NUMERICIDENTIFIER]}|${ee[te.NONNUMERICIDENTIFIER]})`);we("PRERELEASEIDENTIFIERLOOSE",`(?:${ee[te.NUMERICIDENTIFIERLOOSE]}|${ee[te.NONNUMERICIDENTIFIER]})`);we("PRERELEASE",`(?:-(${ee[te.PRERELEASEIDENTIFIER]}(?:\\.${ee[te.PRERELEASEIDENTIFIER]})*))`);we("PRERELEASELOOSE",`(?:-?(${ee[te.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${ee[te.PRERELEASEIDENTIFIERLOOSE]})*))`);we("BUILDIDENTIFIER",`${gN}+`);we("BUILD",`(?:\\+(${ee[te.BUILDIDENTIFIER]}(?:\\.${ee[te.BUILDIDENTIFIER]})*))`);we("FULLPLAIN",`v?${ee[te.MAINVERSION]}${ee[te.PRERELEASE]}?${ee[te.BUILD]}?`);we("FULL",`^${ee[te.FULLPLAIN]}$`);we("LOOSEPLAIN",`[v=\\s]*${ee[te.MAINVERSIONLOOSE]}${ee[te.PRERELEASELOOSE]}?${ee[te.BUILD]}?`);we("LOOSE",`^${ee[te.LOOSEPLAIN]}$`);we("GTLT","((?:<|>)?=?)");we("XRANGEIDENTIFIERLOOSE",`${ee[te.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);we("XRANGEIDENTIFIER",`${ee[te.NUMERICIDENTIFIER]}|x|X|\\*`);we("XRANGEPLAIN",`[v=\\s]*(${ee[te.XRANGEIDENTIFIER]})(?:\\.(${ee[te.XRANGEIDENTIFIER]})(?:\\.(${ee[te.XRANGEIDENTIFIER]})(?:${ee[te.PRERELEASE]})?${ee[te.BUILD]}?)?)?`);we("XRANGEPLAINLOOSE",`[v=\\s]*(${ee[te.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ee[te.XRANGEIDENTIFIERLOOSE]})(?:\\.(${ee[te.XRANGEIDENTIFIERLOOSE]})(?:${ee[te.PRERELEASELOOSE]})?${ee[te.BUILD]}?)?)?`);we("XRANGE",`^${ee[te.GTLT]}\\s*${ee[te.XRANGEPLAIN]}$`);we("XRANGELOOSE",`^${ee[te.GTLT]}\\s*${ee[te.XRANGEPLAINLOOSE]}$`);we("COERCE",`(^|[^\\d])(\\d{1,${mN}})(?:\\.(\\d{1,${mN}}))?(?:\\.(\\d{1,${mN}}))?(?:$|[^\\d])`);we("COERCERTL",ee[te.COERCE],!0);we("LONETILDE","(?:~>?)");we("TILDETRIM",`(\\s*)${ee[te.LONETILDE]}\\s+`,!0);Io.tildeTrimReplace="$1~";we("TILDE",`^${ee[te.LONETILDE]}${ee[te.XRANGEPLAIN]}$`);we("TILDELOOSE",`^${ee[te.LONETILDE]}${ee[te.XRANGEPLAINLOOSE]}$`);we("LONECARET","(?:\\^)");we("CARETTRIM",`(\\s*)${ee[te.LONECARET]}\\s+`,!0);Io.caretTrimReplace="$1^";we("CARET",`^${ee[te.LONECARET]}${ee[te.XRANGEPLAIN]}$`);we("CARETLOOSE",`^${ee[te.LONECARET]}${ee[te.XRANGEPLAINLOOSE]}$`);we("COMPARATORLOOSE",`^${ee[te.GTLT]}\\s*(${ee[te.LOOSEPLAIN]})$|^$`);we("COMPARATOR",`^${ee[te.GTLT]}\\s*(${ee[te.FULLPLAIN]})$|^$`);we("COMPARATORTRIM",`(\\s*)${ee[te.GTLT]}\\s*(${ee[te.LOOSEPLAIN]}|${ee[te.XRANGEPLAIN]})`,!0);Io.comparatorTrimReplace="$1$2$3";we("HYPHENRANGE",`^\\s*(${ee[te.XRANGEPLAIN]})\\s+-\\s+(${ee[te.XRANGEPLAIN]})\\s*$`);we("HYPHENRANGELOOSE",`^\\s*(${ee[te.XRANGEPLAINLOOSE]})\\s+-\\s+(${ee[te.XRANGEPLAINLOOSE]})\\s*$`);we("STAR","(<|>)?=?\\s*\\*");we("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");we("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var M9=g((Xyt,Lme)=>{var hat=Object.freeze({loose:!0}),mat=Object.freeze({}),gat=e=>e?typeof e!="object"?hat:e:mat;Lme.exports=gat});var yN=g((Jyt,qme)=>{var Bme=/^[0-9]+$/,jme=(e,t)=>{let r=Bme.test(e),i=Bme.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1},yat=(e,t)=>jme(t,e);qme.exports={compareIdentifiers:jme,rcompareIdentifiers:yat}});var ei=g((Zyt,Vme)=>{var U9=eg(),{MAX_LENGTH:$me,MAX_SAFE_INTEGER:V9}=Q2(),{safeRe:Mme,t:Ume}=b1(),vat=M9(),{compareIdentifiers:D1}=yN(),vN=class e{constructor(t,r){if(r=vat(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>$me)throw new TypeError(`version is longer than ${$me} characters`);U9("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let i=t.trim().match(r.loose?Mme[Ume.LOOSE]:Mme[Ume.FULL]);if(!i)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>V9||this.major<0)throw new TypeError("Invalid major version");if(this.minor>V9||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>V9||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let a=+n;if(a>=0&&a<V9)return a}return n}):this.prerelease=[],this.build=i[5]?i[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(t){if(U9("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),D1(this.major,t.major)||D1(this.minor,t.minor)||D1(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let i=this.prerelease[r],n=t.prerelease[r];if(U9("prerelease compare",r,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return D1(i,n)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let i=this.build[r],n=t.build[r];if(U9("prerelease compare",r,i,n),i===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(i===void 0)return-1;if(i===n)continue;return D1(i,n)}while(++r)}inc(t,r,i){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,i);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,i);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,i),this.inc("pre",r,i);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,i),this.inc("pre",r,i);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 n=Number(i)?1:0;if(!r&&i===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[n];else{let a=this.prerelease.length;for(;--a>=0;)typeof this.prerelease[a]=="number"&&(this.prerelease[a]++,a=-2);if(a===-1){if(r===this.prerelease.join(".")&&i===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let a=[r,n];i===!1&&(a=[r]),D1(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Vme.exports=vN});var ip=g((Qyt,zme)=>{var Hme=ei(),_at=(e,t,r=!1)=>{if(e instanceof Hme)return e;try{return new Hme(e,t)}catch(i){if(!r)return null;throw i}};zme.exports=_at});var Wme=g((evt,Gme)=>{var wat=ip(),bat=(e,t)=>{let r=wat(e,t);return r?r.version:null};Gme.exports=bat});var Yme=g((tvt,Kme)=>{var Dat=ip(),Eat=(e,t)=>{let r=Dat(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Kme.exports=Eat});var Zme=g((rvt,Jme)=>{var Xme=ei(),xat=(e,t,r,i,n)=>{typeof r=="string"&&(n=i,i=r,r=void 0);try{return new Xme(e instanceof Xme?e.version:e,r).inc(t,i,n).version}catch{return null}};Jme.exports=xat});var t2e=g((ivt,e2e)=>{var Qme=ip(),Cat=(e,t)=>{let r=Qme(e,null,!0),i=Qme(t,null,!0),n=r.compare(i);if(n===0)return null;let a=n>0,s=a?r:i,o=a?i:r,u=!!s.prerelease.length;if(!!o.prerelease.length&&!u)return!o.patch&&!o.minor?"major":s.patch?"patch":s.minor?"minor":"major";let c=u?"pre":"";return r.major!==i.major?c+"major":r.minor!==i.minor?c+"minor":r.patch!==i.patch?c+"patch":"prerelease"};e2e.exports=Cat});var i2e=g((nvt,r2e)=>{var Sat=ei(),Aat=(e,t)=>new Sat(e,t).major;r2e.exports=Aat});var a2e=g((avt,n2e)=>{var Oat=ei(),Tat=(e,t)=>new Oat(e,t).minor;n2e.exports=Tat});var o2e=g((svt,s2e)=>{var Fat=ei(),kat=(e,t)=>new Fat(e,t).patch;s2e.exports=kat});var l2e=g((ovt,u2e)=>{var Nat=ip(),Rat=(e,t)=>{let r=Nat(e,t);return r&&r.prerelease.length?r.prerelease:null};u2e.exports=Rat});var Hn=g((uvt,p2e)=>{var c2e=ei(),Pat=(e,t,r)=>new c2e(e,r).compare(new c2e(t,r));p2e.exports=Pat});var f2e=g((lvt,d2e)=>{var Iat=Hn(),Lat=(e,t,r)=>Iat(t,e,r);d2e.exports=Lat});var m2e=g((cvt,h2e)=>{var Bat=Hn(),jat=(e,t)=>Bat(e,t,!0);h2e.exports=jat});var H9=g((pvt,y2e)=>{var g2e=ei(),qat=(e,t,r)=>{let i=new g2e(e,r),n=new g2e(t,r);return i.compare(n)||i.compareBuild(n)};y2e.exports=qat});var _2e=g((dvt,v2e)=>{var $at=H9(),Mat=(e,t)=>e.sort((r,i)=>$at(r,i,t));v2e.exports=Mat});var b2e=g((fvt,w2e)=>{var Uat=H9(),Vat=(e,t)=>e.sort((r,i)=>Uat(i,r,t));w2e.exports=Vat});var tg=g((hvt,D2e)=>{var Hat=Hn(),zat=(e,t,r)=>Hat(e,t,r)>0;D2e.exports=zat});var z9=g((mvt,E2e)=>{var Gat=Hn(),Wat=(e,t,r)=>Gat(e,t,r)<0;E2e.exports=Wat});var _N=g((gvt,x2e)=>{var Kat=Hn(),Yat=(e,t,r)=>Kat(e,t,r)===0;x2e.exports=Yat});var wN=g((yvt,C2e)=>{var Xat=Hn(),Jat=(e,t,r)=>Xat(e,t,r)!==0;C2e.exports=Jat});var G9=g((vvt,S2e)=>{var Zat=Hn(),Qat=(e,t,r)=>Zat(e,t,r)>=0;S2e.exports=Qat});var W9=g((_vt,A2e)=>{var est=Hn(),tst=(e,t,r)=>est(e,t,r)<=0;A2e.exports=tst});var bN=g((wvt,O2e)=>{var rst=_N(),ist=wN(),nst=tg(),ast=G9(),sst=z9(),ost=W9(),ust=(e,t,r,i)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return rst(e,r,i);case"!=":return ist(e,r,i);case">":return nst(e,r,i);case">=":return ast(e,r,i);case"<":return sst(e,r,i);case"<=":return ost(e,r,i);default:throw new TypeError(`Invalid operator: ${t}`)}};O2e.exports=ust});var F2e=g((bvt,T2e)=>{var lst=ei(),cst=ip(),{safeRe:K9,t:Y9}=b1(),pst=(e,t)=>{if(e instanceof lst)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(K9[Y9.COERCE]);else{let i;for(;(i=K9[Y9.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||i.index+i[0].length!==r.index+r[0].length)&&(r=i),K9[Y9.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;K9[Y9.COERCERTL].lastIndex=-1}return r===null?null:cst(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};T2e.exports=pst});var N2e=g((Dvt,k2e)=>{"use strict";k2e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var P2e=g((Evt,R2e)=>{"use strict";R2e.exports=je;je.Node=np;je.create=je;function je(e){var t=this;if(t instanceof je||(t=new je),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach=="function")e.forEach(function(n){t.push(n)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}je.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t};je.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}};je.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}};je.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)fst(this,arguments[e]);return this.length};je.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)hst(this,arguments[e]);return this.length};je.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}};je.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}};je.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;r!==null;i++)e.call(t,r.value,i,this),r=r.next};je.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;r!==null;i--)e.call(t,r.value,i,this),r=r.prev};je.prototype.get=function(e){for(var t=0,r=this.head;r!==null&&t<e;t++)r=r.next;if(t===e&&r!==null)return r.value};je.prototype.getReverse=function(e){for(var t=0,r=this.tail;r!==null&&t<e;t++)r=r.prev;if(t===e&&r!==null)return r.value};je.prototype.map=function(e,t){t=t||this;for(var r=new je,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r};je.prototype.mapReverse=function(e,t){t=t||this;for(var r=new je,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r};je.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else if(this.head)i=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;i!==null;n++)r=e(r,i.value,n),i=i.next;return r};je.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else if(this.tail)i=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;i!==null;n--)r=e(r,i.value,n),i=i.prev;return r};je.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};je.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};je.prototype.slice=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new je;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,n=this.head;n!==null&&i<e;i++)n=n.next;for(;n!==null&&i<t;i++,n=n.next)r.push(n.value);return r};je.prototype.sliceReverse=function(e,t){t=t||this.length,t<0&&(t+=this.length),e=e||0,e<0&&(e+=this.length);var r=new je;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,n=this.tail;n!==null&&i>t;i--)n=n.prev;for(;n!==null&&i>e;i--,n=n.prev)r.push(n.value);return r};je.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,n=this.head;n!==null&&i<e;i++)n=n.next;for(var a=[],i=0;n&&i<t;i++)a.push(n.value),n=this.removeNode(n);n===null&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var i=0;i<r.length;i++)n=dst(this,n,r[i]);return a};je.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;r!==null;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};function dst(e,t,r){var i=t===e.head?new np(r,null,t,e):new np(r,t,t.next,e);return i.next===null&&(e.tail=i),i.prev===null&&(e.head=i),e.length++,i}function fst(e,t){e.tail=new np(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function hst(e,t){e.head=new np(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function np(e,t,r,i){if(!(this instanceof np))return new np(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}try{N2e()(je)}catch{}});var q2e=g((xvt,j2e)=>{"use strict";var mst=P2e(),ap=Symbol("max"),Bo=Symbol("length"),E1=Symbol("lengthCalculator"),ig=Symbol("allowStale"),sp=Symbol("maxAge"),Lo=Symbol("dispose"),I2e=Symbol("noDisposeOnSet"),Cr=Symbol("lruList"),va=Symbol("cache"),B2e=Symbol("updateAgeOnGet"),DN=()=>1,xN=class{constructor(t){if(typeof t=="number"&&(t={max:t}),t||(t={}),t.max&&(typeof t.max!="number"||t.max<0))throw new TypeError("max must be a non-negative number");let r=this[ap]=t.max||1/0,i=t.length||DN;if(this[E1]=typeof i!="function"?DN:i,this[ig]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[sp]=t.maxAge||0,this[Lo]=t.dispose,this[I2e]=t.noDisposeOnSet||!1,this[B2e]=t.updateAgeOnGet||!1,this.reset()}set max(t){if(typeof t!="number"||t<0)throw new TypeError("max must be a non-negative number");this[ap]=t||1/0,rg(this)}get max(){return this[ap]}set allowStale(t){this[ig]=!!t}get allowStale(){return this[ig]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[sp]=t,rg(this)}get maxAge(){return this[sp]}set lengthCalculator(t){typeof t!="function"&&(t=DN),t!==this[E1]&&(this[E1]=t,this[Bo]=0,this[Cr].forEach(r=>{r.length=this[E1](r.value,r.key),this[Bo]+=r.length})),rg(this)}get lengthCalculator(){return this[E1]}get length(){return this[Bo]}get itemCount(){return this[Cr].length}rforEach(t,r){r=r||this;for(let i=this[Cr].tail;i!==null;){let n=i.prev;L2e(this,t,i,r),i=n}}forEach(t,r){r=r||this;for(let i=this[Cr].head;i!==null;){let n=i.next;L2e(this,t,i,r),i=n}}keys(){return this[Cr].toArray().map(t=>t.key)}values(){return this[Cr].toArray().map(t=>t.value)}reset(){this[Lo]&&this[Cr]&&this[Cr].length&&this[Cr].forEach(t=>this[Lo](t.key,t.value)),this[va]=new Map,this[Cr]=new mst,this[Bo]=0}dump(){return this[Cr].map(t=>X9(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[Cr]}set(t,r,i){if(i=i||this[sp],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let n=i?Date.now():0,a=this[E1](r,t);if(this[va].has(t)){if(a>this[ap])return x1(this,this[va].get(t)),!1;let u=this[va].get(t).value;return this[Lo]&&(this[I2e]||this[Lo](t,u.value)),u.now=n,u.maxAge=i,u.value=r,this[Bo]+=a-u.length,u.length=a,this.get(t),rg(this),!0}let s=new CN(t,r,a,n,i);return s.length>this[ap]?(this[Lo]&&this[Lo](t,r),!1):(this[Bo]+=s.length,this[Cr].unshift(s),this[va].set(t,this[Cr].head),rg(this),!0)}has(t){if(!this[va].has(t))return!1;let r=this[va].get(t).value;return!X9(this,r)}get(t){return EN(this,t,!0)}peek(t){return EN(this,t,!1)}pop(){let t=this[Cr].tail;return t?(x1(this,t),t.value):null}del(t){x1(this,this[va].get(t))}load(t){this.reset();let r=Date.now();for(let i=t.length-1;i>=0;i--){let n=t[i],a=n.e||0;if(a===0)this.set(n.k,n.v);else{let s=a-r;s>0&&this.set(n.k,n.v,s)}}}prune(){this[va].forEach((t,r)=>EN(this,r,!1))}},EN=(e,t,r)=>{let i=e[va].get(t);if(i){let n=i.value;if(X9(e,n)){if(x1(e,i),!e[ig])return}else r&&(e[B2e]&&(i.value.now=Date.now()),e[Cr].unshiftNode(i));return n.value}},X9=(e,t)=>{if(!t||!t.maxAge&&!e[sp])return!1;let r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[sp]&&r>e[sp]},rg=e=>{if(e[Bo]>e[ap])for(let t=e[Cr].tail;e[Bo]>e[ap]&&t!==null;){let r=t.prev;x1(e,t),t=r}},x1=(e,t)=>{if(t){let r=t.value;e[Lo]&&e[Lo](r.key,r.value),e[Bo]-=r.length,e[va].delete(r.key),e[Cr].removeNode(t)}},CN=class{constructor(t,r,i,n,a){this.key=t,this.value=r,this.length=i,this.now=n,this.maxAge=a||0}},L2e=(e,t,r,i)=>{let n=r.value;X9(e,n)&&(x1(e,r),e[ig]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};j2e.exports=xN});var zn=g((Cvt,V2e)=>{var SN=class e{constructor(t,r){if(r=yst(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof AN)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!M2e(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&xst(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(t=>t.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(t){let i=((this.options.includePrerelease&&Dst)|(this.options.loose&&Est))+":"+t,n=$2e.get(i);if(n)return n;let a=this.options.loose,s=a?Ui[yi.HYPHENRANGELOOSE]:Ui[yi.HYPHENRANGE];t=t.replace(s,Pst(this.options.includePrerelease)),pt("hyphen replace",t),t=t.replace(Ui[yi.COMPARATORTRIM],_st),pt("comparator trim",t),t=t.replace(Ui[yi.TILDETRIM],wst),pt("tilde trim",t),t=t.replace(Ui[yi.CARETTRIM],bst),pt("caret trim",t);let o=t.split(" ").map(p=>Cst(p,this.options)).join(" ").split(/\s+/).map(p=>Rst(p,this.options));a&&(o=o.filter(p=>(pt("loose invalid filter",p,this.options),!!p.match(Ui[yi.COMPARATORLOOSE])))),pt("range list",o);let u=new Map,l=o.map(p=>new AN(p,this.options));for(let p of l){if(M2e(p))return[p];u.set(p.value,p)}u.size>1&&u.has("")&&u.delete("");let c=[...u.values()];return $2e.set(i,c),c}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(i=>U2e(i,r)&&t.set.some(n=>U2e(n,r)&&i.every(a=>n.every(s=>a.intersects(s,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new vst(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Ist(this.set[r],t,this.options))return!0;return!1}};V2e.exports=SN;var gst=q2e(),$2e=new gst({max:1e3}),yst=M9(),AN=ng(),pt=eg(),vst=ei(),{safeRe:Ui,t:yi,comparatorTrimReplace:_st,tildeTrimReplace:wst,caretTrimReplace:bst}=b1(),{FLAG_INCLUDE_PRERELEASE:Dst,FLAG_LOOSE:Est}=Q2(),M2e=e=>e.value==="<0.0.0-0",xst=e=>e.value==="",U2e=(e,t)=>{let r=!0,i=e.slice(),n=i.pop();for(;r&&i.length;)r=i.every(a=>n.intersects(a,t)),n=i.pop();return r},Cst=(e,t)=>(pt("comp",e,t),e=Ost(e,t),pt("caret",e),e=Sst(e,t),pt("tildes",e),e=Fst(e,t),pt("xrange",e),e=Nst(e,t),pt("stars",e),e),vi=e=>!e||e.toLowerCase()==="x"||e==="*",Sst=(e,t)=>e.trim().split(/\s+/).map(r=>Ast(r,t)).join(" "),Ast=(e,t)=>{let r=t.loose?Ui[yi.TILDELOOSE]:Ui[yi.TILDE];return e.replace(r,(i,n,a,s,o)=>{pt("tilde",e,i,n,a,s,o);let u;return vi(n)?u="":vi(a)?u=`>=${n}.0.0 <${+n+1}.0.0-0`:vi(s)?u=`>=${n}.${a}.0 <${n}.${+a+1}.0-0`:o?(pt("replaceTilde pr",o),u=`>=${n}.${a}.${s}-${o} <${n}.${+a+1}.0-0`):u=`>=${n}.${a}.${s} <${n}.${+a+1}.0-0`,pt("tilde return",u),u})},Ost=(e,t)=>e.trim().split(/\s+/).map(r=>Tst(r,t)).join(" "),Tst=(e,t)=>{pt("caret",e,t);let r=t.loose?Ui[yi.CARETLOOSE]:Ui[yi.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,(n,a,s,o,u)=>{pt("caret",e,n,a,s,o,u);let l;return vi(a)?l="":vi(s)?l=`>=${a}.0.0${i} <${+a+1}.0.0-0`:vi(o)?a==="0"?l=`>=${a}.${s}.0${i} <${a}.${+s+1}.0-0`:l=`>=${a}.${s}.0${i} <${+a+1}.0.0-0`:u?(pt("replaceCaret pr",u),a==="0"?s==="0"?l=`>=${a}.${s}.${o}-${u} <${a}.${s}.${+o+1}-0`:l=`>=${a}.${s}.${o}-${u} <${a}.${+s+1}.0-0`:l=`>=${a}.${s}.${o}-${u} <${+a+1}.0.0-0`):(pt("no pr"),a==="0"?s==="0"?l=`>=${a}.${s}.${o}${i} <${a}.${s}.${+o+1}-0`:l=`>=${a}.${s}.${o}${i} <${a}.${+s+1}.0-0`:l=`>=${a}.${s}.${o} <${+a+1}.0.0-0`),pt("caret return",l),l})},Fst=(e,t)=>(pt("replaceXRanges",e,t),e.split(/\s+/).map(r=>kst(r,t)).join(" ")),kst=(e,t)=>{e=e.trim();let r=t.loose?Ui[yi.XRANGELOOSE]:Ui[yi.XRANGE];return e.replace(r,(i,n,a,s,o,u)=>{pt("xRange",e,i,n,a,s,o,u);let l=vi(a),c=l||vi(s),p=c||vi(o),d=p;return n==="="&&d&&(n=""),u=t.includePrerelease?"-0":"",l?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&d?(c&&(s=0),o=0,n===">"?(n=">=",c?(a=+a+1,s=0,o=0):(s=+s+1,o=0)):n==="<="&&(n="<",c?a=+a+1:s=+s+1),n==="<"&&(u="-0"),i=`${n+a}.${s}.${o}${u}`):c?i=`>=${a}.0.0${u} <${+a+1}.0.0-0`:p&&(i=`>=${a}.${s}.0${u} <${a}.${+s+1}.0-0`),pt("xRange return",i),i})},Nst=(e,t)=>(pt("replaceStars",e,t),e.trim().replace(Ui[yi.STAR],"")),Rst=(e,t)=>(pt("replaceGTE0",e,t),e.trim().replace(Ui[t.includePrerelease?yi.GTE0PRE:yi.GTE0],"")),Pst=e=>(t,r,i,n,a,s,o,u,l,c,p,d,f)=>(vi(i)?r="":vi(n)?r=`>=${i}.0.0${e?"-0":""}`:vi(a)?r=`>=${i}.${n}.0${e?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,vi(l)?u="":vi(c)?u=`<${+l+1}.0.0-0`:vi(p)?u=`<${l}.${+c+1}.0-0`:d?u=`<=${l}.${c}.${p}-${d}`:e?u=`<${l}.${c}.${+p+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Ist=(e,t,r)=>{for(let i=0;i<e.length;i++)if(!e[i].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let i=0;i<e.length;i++)if(pt(e[i].semver),e[i].semver!==AN.ANY&&e[i].semver.prerelease.length>0){let n=e[i].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0}});var ng=g((Svt,Y2e)=>{var ag=Symbol("SemVer ANY"),FN=class e{static get ANY(){return ag}constructor(t,r){if(r=H2e(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),TN("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===ag?this.value="":this.value=this.operator+this.semver.version,TN("comp",this)}parse(t){let r=this.options.loose?z2e[G2e.COMPARATORLOOSE]:z2e[G2e.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new W2e(i[2],this.options.loose):this.semver=ag}toString(){return this.value}test(t){if(TN("Comparator.test",t,this.options.loose),this.semver===ag||t===ag)return!0;if(typeof t=="string")try{t=new W2e(t,this.options)}catch{return!1}return ON(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new K2e(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new K2e(this.value,r).test(t.semver):(r=H2e(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||ON(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||ON(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};Y2e.exports=FN;var H2e=M9(),{safeRe:z2e,t:G2e}=b1(),ON=bN(),TN=eg(),W2e=ei(),K2e=zn()});var sg=g((Avt,X2e)=>{var Lst=zn(),Bst=(e,t,r)=>{try{t=new Lst(t,r)}catch{return!1}return t.test(e)};X2e.exports=Bst});var Z2e=g((Ovt,J2e)=>{var jst=zn(),qst=(e,t)=>new jst(e,t).set.map(r=>r.map(i=>i.value).join(" ").trim().split(" "));J2e.exports=qst});var ege=g((Tvt,Q2e)=>{var $st=ei(),Mst=zn(),Ust=(e,t,r)=>{let i=null,n=null,a=null;try{a=new Mst(t,r)}catch{return null}return e.forEach(s=>{a.test(s)&&(!i||n.compare(s)===-1)&&(i=s,n=new $st(i,r))}),i};Q2e.exports=Ust});var rge=g((Fvt,tge)=>{var Vst=ei(),Hst=zn(),zst=(e,t,r)=>{let i=null,n=null,a=null;try{a=new Hst(t,r)}catch{return null}return e.forEach(s=>{a.test(s)&&(!i||n.compare(s)===1)&&(i=s,n=new Vst(i,r))}),i};tge.exports=zst});var age=g((kvt,nge)=>{var kN=ei(),Gst=zn(),ige=tg(),Wst=(e,t)=>{e=new Gst(e,t);let r=new kN("0.0.0");if(e.test(r)||(r=new kN("0.0.0-0"),e.test(r)))return r;r=null;for(let i=0;i<e.set.length;++i){let n=e.set[i],a=null;n.forEach(s=>{let o=new kN(s.semver.version);switch(s.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!a||ige(o,a))&&(a=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),a&&(!r||ige(r,a))&&(r=a)}return r&&e.test(r)?r:null};nge.exports=Wst});var oge=g((Nvt,sge)=>{var Kst=zn(),Yst=(e,t)=>{try{return new Kst(e,t).range||"*"}catch{return null}};sge.exports=Yst});var J9=g((Rvt,pge)=>{var Xst=ei(),cge=ng(),{ANY:Jst}=cge,Zst=zn(),Qst=sg(),uge=tg(),lge=z9(),eot=W9(),tot=G9(),rot=(e,t,r,i)=>{e=new Xst(e,i),t=new Zst(t,i);let n,a,s,o,u;switch(r){case">":n=uge,a=eot,s=lge,o=">",u=">=";break;case"<":n=lge,a=tot,s=uge,o="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Qst(e,t,i))return!1;for(let l=0;l<t.set.length;++l){let c=t.set[l],p=null,d=null;if(c.forEach(f=>{f.semver===Jst&&(f=new cge(">=0.0.0")),p=p||f,d=d||f,n(f.semver,p.semver,i)?p=f:s(f.semver,d.semver,i)&&(d=f)}),p.operator===o||p.operator===u||(!d.operator||d.operator===o)&&a(e,d.semver))return!1;if(d.operator===u&&s(e,d.semver))return!1}return!0};pge.exports=rot});var fge=g((Pvt,dge)=>{var iot=J9(),not=(e,t,r)=>iot(e,t,">",r);dge.exports=not});var mge=g((Ivt,hge)=>{var aot=J9(),sot=(e,t,r)=>aot(e,t,"<",r);hge.exports=sot});var vge=g((Lvt,yge)=>{var gge=zn(),oot=(e,t,r)=>(e=new gge(e,r),t=new gge(t,r),e.intersects(t,r));yge.exports=oot});var wge=g((Bvt,_ge)=>{var uot=sg(),lot=Hn();_ge.exports=(e,t,r)=>{let i=[],n=null,a=null,s=e.sort((c,p)=>lot(c,p,r));for(let c of s)uot(c,t,r)?(a=c,n||(n=c)):(a&&i.push([n,a]),a=null,n=null);n&&i.push([n,null]);let o=[];for(let[c,p]of i)c===p?o.push(c):!p&&c===s[0]?o.push("*"):p?c===s[0]?o.push(`<=${p}`):o.push(`${c} - ${p}`):o.push(`>=${c}`);let u=o.join(" || "),l=typeof t.raw=="string"?t.raw:String(t);return u.length<l.length?u:t}});var Sge=g((jvt,Cge)=>{var bge=zn(),RN=ng(),{ANY:NN}=RN,og=sg(),PN=Hn(),cot=(e,t,r={})=>{if(e===t)return!0;e=new bge(e,r),t=new bge(t,r);let i=!1;e:for(let n of e.set){for(let a of t.set){let s=dot(n,a,r);if(i=i||s!==null,s)continue e}if(i)return!1}return!0},pot=[new RN(">=0.0.0-0")],Dge=[new RN(">=0.0.0")],dot=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===NN){if(t.length===1&&t[0].semver===NN)return!0;r.includePrerelease?e=pot:e=Dge}if(t.length===1&&t[0].semver===NN){if(r.includePrerelease)return!0;t=Dge}let i=new Set,n,a;for(let f of e)f.operator===">"||f.operator===">="?n=Ege(n,f,r):f.operator==="<"||f.operator==="<="?a=xge(a,f,r):i.add(f.semver);if(i.size>1)return null;let s;if(n&&a){if(s=PN(n.semver,a.semver,r),s>0)return null;if(s===0&&(n.operator!==">="||a.operator!=="<="))return null}for(let f of i){if(n&&!og(f,String(n),r)||a&&!og(f,String(a),r))return null;for(let h of t)if(!og(f,String(h),r))return!1;return!0}let o,u,l,c,p=a&&!r.includePrerelease&&a.semver.prerelease.length?a.semver:!1,d=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;p&&p.prerelease.length===1&&a.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let f of t){if(c=c||f.operator===">"||f.operator===">=",l=l||f.operator==="<"||f.operator==="<=",n){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(o=Ege(n,f,r),o===f&&o!==n)return!1}else if(n.operator===">="&&!og(n.semver,String(f),r))return!1}if(a){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(u=xge(a,f,r),u===f&&u!==a)return!1}else if(a.operator==="<="&&!og(a.semver,String(f),r))return!1}if(!f.operator&&(a||n)&&s!==0)return!1}return!(n&&l&&!a&&s!==0||a&&c&&!n&&s!==0||d||p)},Ege=(e,t,r)=>{if(!e)return t;let i=PN(e.semver,t.semver,r);return i>0?e:i<0||t.operator===">"&&e.operator===">="?t:e},xge=(e,t,r)=>{if(!e)return t;let i=PN(e.semver,t.semver,r);return i<0?e:i>0||t.operator==="<"&&e.operator==="<="?t:e};Cge.exports=cot});var Fge=g((qvt,Tge)=>{var IN=b1(),Age=Q2(),fot=ei(),Oge=yN(),hot=ip(),mot=Wme(),got=Yme(),yot=Zme(),vot=t2e(),_ot=i2e(),wot=a2e(),bot=o2e(),Dot=l2e(),Eot=Hn(),xot=f2e(),Cot=m2e(),Sot=H9(),Aot=_2e(),Oot=b2e(),Tot=tg(),Fot=z9(),kot=_N(),Not=wN(),Rot=G9(),Pot=W9(),Iot=bN(),Lot=F2e(),Bot=ng(),jot=zn(),qot=sg(),$ot=Z2e(),Mot=ege(),Uot=rge(),Vot=age(),Hot=oge(),zot=J9(),Got=fge(),Wot=mge(),Kot=vge(),Yot=wge(),Xot=Sge();Tge.exports={parse:hot,valid:mot,clean:got,inc:yot,diff:vot,major:_ot,minor:wot,patch:bot,prerelease:Dot,compare:Eot,rcompare:xot,compareLoose:Cot,compareBuild:Sot,sort:Aot,rsort:Oot,gt:Tot,lt:Fot,eq:kot,neq:Not,gte:Rot,lte:Pot,cmp:Iot,coerce:Lot,Comparator:Bot,Range:jot,satisfies:qot,toComparators:$ot,maxSatisfying:Mot,minSatisfying:Uot,minVersion:Vot,validRange:Hot,outside:zot,gtr:Got,ltr:Wot,intersects:Kot,simplifyRange:Yot,subset:Xot,SemVer:fot,re:IN.re,src:IN.src,tokens:IN.t,SEMVER_SPEC_VERSION:Age.SEMVER_SPEC_VERSION,RELEASE_TYPES:Age.RELEASE_TYPES,compareIdentifiers:Oge.compareIdentifiers,rcompareIdentifiers:Oge.rcompareIdentifiers}});var LN=g(($vt,Pge)=>{var Jot=require("url"),{getIt:Zot}=Vhe(),{debug:Qot,retry:kge,promise:eut,httpErrors:tut,jsonResponse:rut}=u0e(),iut=R0e(),nut=Nme(),aut=Fge(),sut=e=>/(application\/json|\+json)/.test(e||"");function out(e,t,r){let i=e.response||{statusCode:500,headers:{}};return kge.shouldRetry(e,t,r)||i&&i.statusCode>=500||i.statusCode<300&&!sut(i.headers["content-type"])}function uut(e,t){if(t.registryUrl)return t.registryUrl;let r=e.split("/")[0];return iut(r)}var Nge=Zot([rut({force:!0}),tut(),Qot({namespace:"get-latest-version"}),eut(),kge({shouldRetry:out})]);async function Rge(e,t){let r=typeof t=="string"?{range:t,auth:!0}:Object.assign({range:"latest",auth:!0},t),i=uut(e,r),n=Jot.resolve(i,encodeURIComponent(e).replace(/^%40/,"@")),a=r.auth&&nut(i,{recursive:!0}),s=r.request||Nge,o={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};a&&(o.authorization=`${a.type} ${a.token}`);let u;try{u=await s({url:n,headers:o})}catch(h){throw h.response&&h.response.statusCode===404?new Error(`Package \`${e}\` doesn't exist`):h}let l=u.body,c=r.range,p=l["dist-tags"].latest;if(l["dist-tags"][c])return r.includeLatest?{latest:p,inRange:l["dist-tags"][c]}:l["dist-tags"][c];if(l.versions[c])return r.includeLatest?{latest:p,inRange:c}:c;let d=Object.keys(l.versions),f=aut.maxSatisfying(d,c);return f?r.includeLatest?{latest:p,inRange:f}:f:r.includeLatest?{latest:p,inRange:void 0}:void 0}Rge.request=Nge;Pge.exports=Rge});var e6e=g((Jvt,jo)=>{var er=require("fs"),UN=require("os"),cn=require("path"),qge=require("crypto"),ws={fs:er.constants,os:UN.constants},$ge="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",Uge=/XXXXXX/,put=3,Vge=(ws.O_CREAT||ws.fs.O_CREAT)|(ws.O_EXCL||ws.fs.O_EXCL)|(ws.O_RDWR||ws.fs.O_RDWR),dut=UN.platform()==="win32",fut=ws.EBADF||ws.os.errno.EBADF,hut=ws.ENOENT||ws.os.errno.ENOENT,Hge=448,zge=384,mut="exit",C1=[],Gge=er.rmdirSync.bind(er),Wge=!1;function gut(e,t){return er.rm(e,{recursive:!0},t)}function Kge(e){return er.rmSync(e,{recursive:!0})}function VN(e,t){let r=S1(e,t),i=r[0],n=r[1];try{Jge(i)}catch(s){return n(s)}let a=i.tries;(function s(){try{let o=Xge(i);er.stat(o,function(u){if(!u)return a-- >0?s():n(new Error("Could not get a unique tmp filename, max tries reached "+o));n(null,o)})}catch(o){n(o)}})()}function HN(e){let t=S1(e),r=t[0];Jge(r);let i=r.tries;do{let n=Xge(r);try{er.statSync(n)}catch{return n}}while(i-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function yut(e,t){let r=S1(e,t),i=r[0],n=r[1];VN(i,function(s,o){if(s)return n(s);er.open(o,Vge,i.mode||zge,function(l,c){if(l)return n(l);if(i.discardDescriptor)return er.close(c,function(d){return n(d,o,void 0,qN(o,-1,i,!1))});{let p=i.discardDescriptor||i.detachDescriptor;n(null,o,c,qN(o,p?-1:c,i,!1))}})})}function vut(e){let t=S1(e),r=t[0],i=r.discardDescriptor||r.detachDescriptor,n=HN(r);var a=er.openSync(n,Vge,r.mode||zge);return r.discardDescriptor&&(er.closeSync(a),a=void 0),{name:n,fd:a,removeCallback:qN(n,i?-1:a,r,!0)}}function _ut(e,t){let r=S1(e,t),i=r[0],n=r[1];VN(i,function(s,o){if(s)return n(s);er.mkdir(o,i.mode||Hge,function(l){if(l)return n(l);n(null,o,Yge(o,i,!1))})})}function wut(e){let t=S1(e),r=t[0],i=HN(r);return er.mkdirSync(i,r.mode||Hge),{name:i,removeCallback:Yge(i,r,!0)}}function but(e,t){let r=function(i){if(i&&!MN(i))return t(i);t()};0<=e[0]?er.close(e[0],function(){er.unlink(e[1],r)}):er.unlink(e[1],r)}function Dut(e){let t=null;try{0<=e[0]&&er.closeSync(e[0])}catch(r){if(!Cut(r)&&!MN(r))throw r}finally{try{er.unlinkSync(e[1])}catch(r){MN(r)||(t=r)}}if(t!==null)throw t}function qN(e,t,r,i){let n=Q9(Dut,[t,e],i),a=Q9(but,[t,e],i,n);return r.keep||C1.unshift(n),i?n:a}function Yge(e,t,r){let i=t.unsafeCleanup?gut:er.rmdir.bind(er),n=t.unsafeCleanup?Kge:Gge,a=Q9(n,e,r),s=Q9(i,e,r,a);return t.keep||C1.unshift(a),r?a:s}function Q9(e,t,r,i){let n=!1;return function a(s){if(!n){let o=i||a,u=C1.indexOf(o);return u>=0&&C1.splice(u,1),n=!0,r||e===Gge||e===Kge?e(t):e(t,s||function(){})}}}function Eut(){if(Wge)for(;C1.length;)try{C1[0]()}catch{}}function Mge(e){let t=[],r=null;try{r=qge.randomBytes(e)}catch{r=qge.pseudoRandomBytes(e)}for(var i=0;i<e;i++)t.push($ge[r[i]%$ge.length]);return t.join("")}function xut(e){return e===null||Vi(e)||!e.trim()}function Vi(e){return typeof e>"u"}function S1(e,t){if(typeof e=="function")return[{},e];if(Vi(e))return[{},t];let r={};for(let i of Object.getOwnPropertyNames(e))r[i]=e[i];return[r,t]}function Xge(e){let t=e.tmpdir;if(!Vi(e.name))return cn.join(t,e.dir,e.name);if(!Vi(e.template))return cn.join(t,e.dir,e.template).replace(Uge,Mge(6));let r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",Mge(12),e.postfix?"-"+e.postfix:""].join("");return cn.join(t,e.dir,r)}function Jge(e){e.tmpdir=Qge(e);let t=e.tmpdir;if(Vi(e.name)||jN(e.name,"name",t),Vi(e.dir)||jN(e.dir,"dir",t),!Vi(e.template)&&(jN(e.template,"template",t),!e.template.match(Uge)))throw new Error(`Invalid template, found "${e.template}".`);if(!Vi(e.tries)&&isNaN(e.tries)||e.tries<0)throw new Error(`Invalid tries, found "${e.tries}".`);e.tries=Vi(e.name)?e.tries||put:1,e.keep=!!e.keep,e.detachDescriptor=!!e.detachDescriptor,e.discardDescriptor=!!e.discardDescriptor,e.unsafeCleanup=!!e.unsafeCleanup,e.dir=Vi(e.dir)?"":cn.relative(t,$N(e.dir,t)),e.template=Vi(e.template)?void 0:cn.relative(t,$N(e.template,t)),e.template=xut(e.template)?void 0:cn.relative(e.dir,e.template),e.name=Vi(e.name)?void 0:e.name,e.prefix=Vi(e.prefix)?"":e.prefix,e.postfix=Vi(e.postfix)?"":e.postfix}function $N(e,t){return e.startsWith(t)?cn.resolve(e):cn.resolve(cn.join(t,e))}function jN(e,t,r){if(t==="name"){if(cn.isAbsolute(e))throw new Error(`${t} option must not contain an absolute path, found "${e}".`);let i=cn.basename(e);if(i===".."||i==="."||i!==e)throw new Error(`${t} option must not contain a path, found "${e}".`)}else{if(cn.isAbsolute(e)&&!e.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${e}".`);let i=$N(e,r);if(!i.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${i}".`)}}function Cut(e){return Zge(e,-fut,"EBADF")}function MN(e){return Zge(e,-hut,"ENOENT")}function Zge(e,t,r){return dut?e.code===r:e.code===r&&e.errno===t}function Sut(){Wge=!0}function Qge(e){return cn.resolve(e&&e.tmpdir||UN.tmpdir())}process.addListener(mut,Eut);Object.defineProperty(jo.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return Qge()}});jo.exports.dir=_ut;jo.exports.dirSync=wut;jo.exports.file=yut;jo.exports.fileSync=vut;jo.exports.tmpName=VN;jo.exports.tmpNameSync=HN;jo.exports.setGracefulCleanup=Sut});var YN=g(A1=>{"use strict";Object.defineProperty(A1,"__esModule",{value:!0});A1.DEFAULT_COLOR_MAP=void 0;A1.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var KN=class{constructor(t=A1.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,r){let i=this.colorMap[t];this.text+=i!==void 0?`${i}${r}${this.colorMap.reset}`:r}renderConsole(){return this.text}};A1.default=KN});var dg=g(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_HEADER_ALIGNMENT=tr.DEFAULT_ROW_ALIGNMENT=tr.DEFAULT_HEADER_FONT_COLOR=tr.DEFAULT_ROW_FONT_COLOR=tr.COLORS=tr.ALIGNMENTS=tr.DEFAULT_TABLE_STYLE=tr.DEFAULT_ROW_SEPARATOR=tr.DEFAULT_COLUMN_LEN=void 0;tr.DEFAULT_COLUMN_LEN=20;tr.DEFAULT_ROW_SEPARATOR=!1;tr.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};tr.ALIGNMENTS=["right","left","center"];tr.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];tr.DEFAULT_ROW_FONT_COLOR="white";tr.DEFAULT_HEADER_FONT_COLOR="white_bold";tr.DEFAULT_ROW_ALIGNMENT="right";tr.DEFAULT_HEADER_ALIGNMENT="center"});var XN=g($o=>{"use strict";Object.defineProperty($o,"__esModule",{value:!0});$o.rawColumnToInternalColumn=$o.objIfExists=void 0;var Rut=dg(),Put=(e,t)=>t?{[e]:t}:{};$o.objIfExists=Put;var Iut=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,$o.objIfExists)("color",e.color)),(0,$o.objIfExists)("maxLen",e.maxLen)),(0,$o.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||Rut.DEFAULT_ROW_ALIGNMENT})};$o.rawColumnToInternalColumn=Iut});var c6e=g(JN=>{"use strict";Object.defineProperty(JN,"__esModule",{value:!0});var Lut=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];JN.default=Lut});var p6e=g(ZN=>{"use strict";Object.defineProperty(ZN,"__esModule",{value:!0});var But=(e,t,r)=>{let i=0,n,a=r;if(e<t[0].first||e>t[a].last)return 0;for(;a>=i;)if(n=Math.floor((i+a)/2),e>t[n].last)i=n+1;else if(e<t[n].first)a=n-1;else return 1;return 0};ZN.default=But});var QN=g(fg=>{"use strict";var f6e=fg&&fg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fg,"__esModule",{value:!0});var d6e=f6e(c6e()),jut=f6e(p6e()),qut=e=>e===0?0:e<32||e>=127&&e<160?-1:jut.default(e,d6e.default,d6e.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));fg.default=qut});var h6e=g(hg=>{"use strict";var $ut=hg&&hg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(hg,"__esModule",{value:!0});var Mut=$ut(QN()),Uut=e=>{let t=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r),n=Mut.default(i);if(n<0)return-1;t+=n}return t};hg.default=Uut});var g6e=g(il=>{"use strict";var m6e=il&&il.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(il,"__esModule",{value:!0});il.wcswidth=il.wcwidth=void 0;var Vut=m6e(h6e());il.wcswidth=Vut.default;var Hut=m6e(QN());il.wcwidth=Hut.default});var eR=g(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});op.findWidthInConsole=op.stripAnsi=void 0;var zut=g6e(),Gut=/\x1b\[\d{1,3}(;\d{1,3})*m/g,Wut=e=>e.replace(Gut,"");op.stripAnsi=Wut;var Kut=(e,t)=>{let r=0;return e=(0,op.stripAnsi)(e),t&&Object.entries(t).forEach(([i,n])=>{let a=new RegExp(i,"g");r+=(e.match(a)||[]).length*n,e=e.replace(i,"")}),r+=(0,zut.wcswidth)(e),r};op.findWidthInConsole=Kut});var rR=g(bs=>{"use strict";Object.defineProperty(bs,"__esModule",{value:!0});bs.biggestWordInSentence=bs.textWithPadding=bs.splitTextIntoTextsOfMinLen=void 0;var tR=eR(),Yut=(e,t,r)=>{let i=[];return e.split(/[\n\r]/).forEach(a=>{let s=a.split(" "),o=[],u=0;s.forEach(l=>{let c=(0,tR.findWidthInConsole)(l,r);u+c<=t?(u+=c+1,o.push(l)):(o.length>0&&i.push(o.join(" ")),o=[l],u=c+1)}),i.push(o.join(" "))}),i};bs.splitTextIntoTextsOfMinLen=Yut;var Xut=(e,t,r,i)=>{let n=(0,tR.findWidthInConsole)(e,i),a=Math.floor((r-n)/2),s=r-a-n;if(r<n){let o=(0,bs.splitTextIntoTextsOfMinLen)(e,r);return o.length===1?e:o.map(u=>(0,bs.textWithPadding)(u,t,r,i)).join(`
|
|
291
291
|
`)}switch(t){case"left":return e.concat(" ".repeat(r-n));case"center":return" ".repeat(a).concat(e).concat(" ".repeat(s));case"right":default:return" ".repeat(r-n).concat(e)}};bs.textWithPadding=Xut;var Jut=(e,t)=>e.split(" ").reduce((r,i)=>Math.max(r,(0,tR.findWidthInConsole)(i,t)),0);bs.biggestWordInSentence=Jut});var mg=g(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.getWidthLimitedColumnsArray=rt.createHeaderAsRow=rt.renderTableHorizontalBorders=rt.findLenOfColumn=rt.createRow=rt.createColumFromComputedColumn=rt.createColumFromOnlyName=rt.createTableHorizontalBorders=rt.convertRawRowOptionsToStandard=rt.cellText=void 0;var iR=XN(),y6e=eR(),nR=rR(),i5=dg(),O1=(e,t)=>Math.max(e,t),Zut=e=>e==null?"":`${e}`;rt.cellText=Zut;var Qut=e=>{if(e)return{color:e.color,separator:e.separator||i5.DEFAULT_ROW_SEPARATOR}};rt.convertRawRowOptionsToStandard=Qut;var elt=({left:e,mid:t,right:r,other:i},n)=>{let a=e;return n.forEach(s=>{a+=i.repeat(s+2),a+=t}),a=a.slice(0,-t.length),a+=r,a};rt.createTableHorizontalBorders=elt;var tlt=e=>({name:e,title:e});rt.createColumFromOnlyName=tlt;var rlt=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,iR.objIfExists)("color",e.color)),(0,iR.objIfExists)("maxLen",e.maxLen)),(0,iR.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||i5.DEFAULT_ROW_ALIGNMENT})};rt.createColumFromComputedColumn=rlt;var ilt=(e,t,r)=>({color:e,separator:r,text:t});rt.createRow=ilt;var nlt=(e,t,r)=>{let i=e.name,n=e.title,a=O1(0,e?.minLen||0);return e.maxLen?(a=O1(a,O1(e.maxLen,(0,nR.biggestWordInSentence)(n,r))),a=t.reduce((s,o)=>O1(s,(0,nR.biggestWordInSentence)((0,rt.cellText)(o.text[i]),r)),a),a):(a=O1(a,(0,y6e.findWidthInConsole)(n,r)),t.forEach(s=>{a=O1(a,(0,y6e.findWidthInConsole)((0,rt.cellText)(s.text[i]),r))}),a)};rt.findLenOfColumn=nlt;var alt=(e,t)=>(0,rt.createTableHorizontalBorders)(e,t);rt.renderTableHorizontalBorders=alt;var slt=(e,t)=>{let r=i5.DEFAULT_HEADER_FONT_COLOR,i=e(r,{},!1);return t.forEach(n=>{i.text[n.name]=n.title}),i};rt.createHeaderAsRow=slt;var olt=(e,t,r)=>{let i={};return e.forEach(n=>{i[n.name]=(0,nR.splitTextIntoTextsOfMinLen)((0,rt.cellText)(t.text[n.name]),n.length||i5.DEFAULT_COLUMN_LEN,r)}),i};rt.getWidthLimitedColumnsArray=olt});var v6e=g(T1=>{"use strict";Object.defineProperty(T1,"__esModule",{value:!0});T1.preProcessRows=T1.preProcessColumns=void 0;var ult=mg(),llt=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.addColumn(t),e.rows.forEach(r=>{r.text[t.name]=t.function(r.text)})})},clt=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},plt=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},dlt=e=>{e.columns.forEach(t=>{t.length=(0,ult.findLenOfColumn)(t,e.rows,e.charLength)})},flt=e=>{llt(e),plt(e),clt(e),dlt(e)};T1.preProcessColumns=flt;var hlt=e=>{let t=e.rows.filter(r=>e.filterFunction(r.text)).sort((r,i)=>e.sortFunction(r.text,i.text));e.rows=t};T1.preProcessRows=hlt});var aR=g(Wn=>{"use strict";var w6e=Wn&&Wn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.printSimpleTable=Wn.renderSimpleTable=Wn.renderTable=void 0;var b6e=w6e(YN()),D6e=rR(),_a=dg(),nl=mg(),mlt=w6e(sR()),_6e=v6e(),glt=(e,t,r,i,n,a,s,o)=>{let u=new b6e.default(s);return u.addCharsWithColor("",e.vertical),t.forEach(l=>{let p=r<i[l.name].length?(0,nl.cellText)(i[l.name][r]):"";u.addCharsWithColor(_a.DEFAULT_ROW_FONT_COLOR," "),u.addCharsWithColor(n&&_a.DEFAULT_HEADER_FONT_COLOR||l.color||a.color,(0,D6e.textWithPadding)(p,l.alignment||_a.DEFAULT_ROW_ALIGNMENT,l.length||_a.DEFAULT_COLUMN_LEN,o)),u.addCharsWithColor("",` ${e.vertical}`)}),u.renderConsole()},E6e=(e,t,r,i,n,a)=>{let s=(0,nl.getWidthLimitedColumnsArray)(t,r,a),o=Object.values(s).reduce((l,c)=>Math.max(l,c.length),0),u=[];for(let l=0;l<o;l+=1){let c=glt(e,t,l,s,n,r,i,a);u.push(c)}return u},ylt=(e,t)=>{let r=[];return r=r.concat(E6e(e.tableStyle,e.columns,t,e.colorMap,void 0,e.charLength)),r},vlt=e=>{let t=[];if(e.title===void 0)return t;let r=()=>{let a=(s,o)=>s+o+2+1;return e.columns.map(s=>s.length||_a.DEFAULT_COLUMN_LEN).reduce(a,1)},i=(0,D6e.textWithPadding)(e.title,_a.DEFAULT_HEADER_ALIGNMENT,r()),n=new b6e.default(e.colorMap);return n.addCharsWithColor(_a.DEFAULT_HEADER_FONT_COLOR,i),t.push(n.renderConsole()),t},_lt=e=>{let t=[];t.push((0,nl.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(i=>i.length||_a.DEFAULT_COLUMN_LEN)));let r=(0,nl.createHeaderAsRow)(nl.createRow,e.columns);return t=t.concat(E6e(e.tableStyle,e.columns,r,e.colorMap,!0)),t.push((0,nl.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(i=>i.length||_a.DEFAULT_COLUMN_LEN))),t},wlt=e=>{let t=[];return t.push((0,nl.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(r=>r.length||_a.DEFAULT_COLUMN_LEN))),t},blt=(e,t)=>{let r=[],i=e.rows.length-1;return e.rows.indexOf(t)!==i&&t.separator&&r.push((0,nl.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(a=>a.length||_a.DEFAULT_COLUMN_LEN))),r},Dlt=e=>{(0,_6e.preProcessColumns)(e),(0,_6e.preProcessRows)(e);let t=[];return vlt(e).forEach(r=>t.push(r)),_lt(e).forEach(r=>t.push(r)),e.rows.forEach(r=>{ylt(e,r).forEach(i=>t.push(i)),blt(e,r).forEach(i=>t.push(i))}),wlt(e).forEach(r=>t.push(r)),t.join(`
|
|
292
|
-
`)};Wn.renderTable=Dlt;var Elt=e=>{let t=new mlt.default;return t.addRows(e),(0,Wn.renderTable)(t)};Wn.renderSimpleTable=Elt;var xlt=e=>{console.log((0,Wn.renderSimpleTable)(e))};Wn.printSimpleTable=xlt});var sR=g(uR=>{"use strict";Object.defineProperty(uR,"__esModule",{value:!0});var Clt=YN(),n5=dg(),a5=mg(),Slt=XN(),Alt=aR(),Olt=()=>0,Tlt=()=>!0,oR=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:n5.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(Slt.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=n5.DEFAULT_TABLE_STYLE,this.filterFunction=Tlt,this.sortFunction=Olt,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=n5.DEFAULT_ROW_SEPARATOR,this.colorMap=Clt.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,a5.createColumFromOnlyName)(i))})}addColumn(t){typeof t=="string"?this.columns.push((0,a5.createColumFromOnlyName)(t)):this.columns.push((0,a5.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,a5.createRow)(r?.color||n5.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,Alt.renderTable)(this)}};uR.default=oR});var C6e=g(gg=>{"use strict";var Flt=gg&&gg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gg,"__esModule",{value:!0});var klt=Flt(sR()),x6e=mg(),lR=class{constructor(t){this.table=new klt.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,x6e.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,x6e.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};gg.default=lR});var yg=g(Ds=>{"use strict";var Nlt=Ds&&Ds.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.renderTable=Ds.printTable=Ds.Table=void 0;var Rlt=Nlt(C6e());Ds.Table=Rlt.default;var S6e=aR();Object.defineProperty(Ds,"printTable",{enumerable:!0,get:function(){return S6e.printSimpleTable}});Object.defineProperty(Ds,"renderTable",{enumerable:!0,get:function(){return S6e.renderSimpleTable}})});var K4e=g((w7t,W4e)=>{W4e.exports=Hv()});var HR=ve(VR(),1),{program:$,createCommand:Pct,createArgument:Ict,createOption:Lct,CommanderError:Bct,InvalidArgumentError:jct,InvalidOptionArgumentError:qct,Command:$ct,Argument:Mct,Option:Uct,Help:Vct}=HR.default;var zo={name:"@capgo/cli",version:"4.20.3",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#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"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=18.0.0"},scripts:{build:"node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^2.27.3","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.1.2","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.7.0","@manypkg/find-root":"^2.2.3","@supabase/supabase-js":"^2.45.2","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"0.5.5","@types/mime":"^4.0.0","@types/node":"^22.5.0","@types/node-dir":"^0.0.37","@types/npmcli__ci-detect":"^2.0.3","@types/prettyjson":"^0.0.33","@types/prompt-sync":"^4.2.3","@types/semver":"^7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^8.3.0","@typescript-eslint/parser":"^8.3.0","@vercel/ncc":"^0.38.1","adm-zip":"0.5.14","ci-info":"^4.0.0",commander:"12.1.0","console-table-printer":"^2.12.1",esbuild:"^0.23.1",eslint:"9.11.0","get-latest-version":"^5.1.0","git-format-staged":"3.1.1",husky:"^9.1.5","is-wsl":"^3.1.0",jszip:"^3.10.1",ky:"^1.7.1",logsnag:"1.0.0",mime:"^4.0.4","node-dir":"^0.1.17",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.3",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0","tus-js-client":"^4.2.3",typescript:"5.6.2"}};var a1=require("node:process");var ri=ve(it(),1),hp=require("node:process"),Go=ve(require("node:readline"),1),K5=ve(require("node:readline"),1),rP=require("node:tty"),kg=ve(KR(),1);function I3e({onlyFirst:e=!1}={}){let t=["[\\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(t,e?void 0:"g")}function iP(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(I3e(),"")}var Y5={},L3e={get exports(){return Y5},set exports(e){Y5=e}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),a=i.length==2?i.charCodeAt(1):0,s=n;return 55296<=n&&n<=56319&&56320<=a&&a<=57343&&(n&=1023,a&=1023,s=n<<10|a,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),a=0,s=0;s<n.length;s++)a=a+this.characterLength(n[s]);return a},t.slice=function(i,n,a){textLen=t.length(i),n=n||0,a=a||1,n<0&&(n=textLen+n),a<0&&(a=textLen+a);for(var s="",o=0,u=r(i),l=0;l<u.length;l++){var c=u[l],p=t.length(c);if(o>=n-(p==2?1:0))if(o+p<=a)s+=c;else break;o+=p}return s}})(L3e);var B3e=Y5,j3e=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};function q1(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=iP(e),e.length===0))return 0;e=e.replace(j3e()," ");let r=t.ambiguousIsNarrow?1:2,i=0;for(let n of e){let a=n.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(B3e.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}var G5=10,YR=(e=0)=>t=>`\x1B[${t+e}m`,XR=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,JR=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,ft={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(ft.modifier);var q3e=Object.keys(ft.color),$3e=Object.keys(ft.bgColor);[...q3e,...$3e];function M3e(){let e=new Map;for(let[t,r]of Object.entries(ft)){for(let[i,n]of Object.entries(r))ft[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=ft[i],e.set(n[0],n[1]);Object.defineProperty(ft,t,{value:r,enumerable:!1})}return Object.defineProperty(ft,"codes",{value:e,enumerable:!1}),ft.color.close="\x1B[39m",ft.bgColor.close="\x1B[49m",ft.color.ansi=YR(),ft.color.ansi256=XR(),ft.color.ansi16m=JR(),ft.bgColor.ansi=YR(G5),ft.bgColor.ansi256=XR(G5),ft.bgColor.ansi16m=JR(G5),Object.defineProperties(ft,{rgbToAnsi256:{value:(t,r,i)=>t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(a=>a+a).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>ft.rgbToAnsi256(...ft.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let o=t%36;r=Math.floor(t/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let a=Math.max(r,i,n)*2;if(a===0)return 30;let s=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return a===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>ft.ansi256ToAnsi(ft.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>ft.ansi256ToAnsi(ft.hexToAnsi256(t)),enumerable:!1}}),ft}var U3e=M3e(),Ig=new Set(["\x1B","\x9B"]),V3e=39,X5="\x07",nP="[",H3e="]",aP="m",J5=`${H3e}8;;`,ZR=e=>`${Ig.values().next().value}${nP}${e}${aP}`,QR=e=>`${Ig.values().next().value}${J5}${e}${X5}`,z3e=e=>e.split(" ").map(t=>q1(t)),W5=(e,t,r)=>{let i=[...t],n=!1,a=!1,s=q1(iP(e[e.length-1]));for(let[o,u]of i.entries()){let l=q1(u);if(s+l<=r?e[e.length-1]+=u:(e.push(u),s=0),Ig.has(u)&&(n=!0,a=i.slice(o+1).join("").startsWith(J5)),n){a?u===X5&&(n=!1,a=!1):u===aP&&(n=!1);continue}s+=l,s===r&&o<i.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},G3e=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(q1(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},W3e=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a,s=z3e(e),o=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let p=q1(o[o.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),p=0),(p>0||r.trim===!1)&&(o[o.length-1]+=" ",p++)),r.hard&&s[l]>t){let d=t-p,f=1+Math.floor((s[l]-d-1)/t);Math.floor((s[l]-1)/t)<f&&o.push(""),W5(o,c,t);continue}if(p+s[l]>t&&p>0&&s[l]>0){if(r.wordWrap===!1&&p<t){W5(o,c,t);continue}o.push("")}if(p+s[l]>t&&r.wordWrap===!1){W5(o,c,t);continue}o[o.length-1]+=c}r.trim!==!1&&(o=o.map(l=>G3e(l)));let u=[...o.join(`
|
|
292
|
+
`)};Wn.renderTable=Dlt;var Elt=e=>{let t=new mlt.default;return t.addRows(e),(0,Wn.renderTable)(t)};Wn.renderSimpleTable=Elt;var xlt=e=>{console.log((0,Wn.renderSimpleTable)(e))};Wn.printSimpleTable=xlt});var sR=g(uR=>{"use strict";Object.defineProperty(uR,"__esModule",{value:!0});var Clt=YN(),n5=dg(),a5=mg(),Slt=XN(),Alt=aR(),Olt=()=>0,Tlt=()=>!0,oR=class{initSimple(t){this.columns=t.map(r=>({name:r,title:r,alignment:n5.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var r;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((r=t?.columns)===null||r===void 0?void 0:r.map(Slt.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.shouldDisableColors?this.colorMap={}:t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=n5.DEFAULT_TABLE_STYLE,this.filterFunction=Tlt,this.sortFunction=Olt,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=n5.DEFAULT_ROW_SEPARATOR,this.colorMap=Clt.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let r=this.columns.map(i=>i.name);Object.keys(t).forEach(i=>{r.includes(i)||this.columns.push((0,a5.createColumFromOnlyName)(i))})}addColumn(t){typeof t=="string"?this.columns.push((0,a5.createColumFromOnlyName)(t)):this.columns.push((0,a5.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(r=>{this.addColumn(r)})}addRow(t,r){this.createColumnFromRow(t),this.rows.push((0,a5.createRow)(r?.color||n5.DEFAULT_ROW_FONT_COLOR,t,r?.separator!==void 0?r?.separator:this.rowSeparator))}addRows(t,r){t.forEach(i=>{this.addRow(i,r)})}renderTable(){return(0,Alt.renderTable)(this)}};uR.default=oR});var C6e=g(gg=>{"use strict";var Flt=gg&&gg.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(gg,"__esModule",{value:!0});var klt=Flt(sR()),x6e=mg(),lR=class{constructor(t){this.table=new klt.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,r){return this.table.addRow(t,(0,x6e.convertRawRowOptionsToStandard)(r)),this}addRows(t,r){return this.table.addRows(t,(0,x6e.convertRawRowOptionsToStandard)(r)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};gg.default=lR});var yg=g(Ds=>{"use strict";var Nlt=Ds&&Ds.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ds,"__esModule",{value:!0});Ds.renderTable=Ds.printTable=Ds.Table=void 0;var Rlt=Nlt(C6e());Ds.Table=Rlt.default;var S6e=aR();Object.defineProperty(Ds,"printTable",{enumerable:!0,get:function(){return S6e.printSimpleTable}});Object.defineProperty(Ds,"renderTable",{enumerable:!0,get:function(){return S6e.renderSimpleTable}})});var K4e=g((w7t,W4e)=>{W4e.exports=Hv()});var HR=ve(VR(),1),{program:$,createCommand:Pct,createArgument:Ict,createOption:Lct,CommanderError:Bct,InvalidArgumentError:jct,InvalidOptionArgumentError:qct,Command:$ct,Argument:Mct,Option:Uct,Help:Vct}=HR.default;var zo={name:"@capgo/cli",version:"4.20.5",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#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"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=18.0.0"},scripts:{build:"node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^2.27.3","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.1.2","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.7.0","@manypkg/find-root":"^2.2.3","@supabase/supabase-js":"^2.45.2","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"0.5.5","@types/mime":"^4.0.0","@types/node":"^22.5.0","@types/node-dir":"^0.0.37","@types/npmcli__ci-detect":"^2.0.3","@types/prettyjson":"^0.0.33","@types/prompt-sync":"^4.2.3","@types/semver":"^7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^8.3.0","@typescript-eslint/parser":"^8.3.0","@vercel/ncc":"^0.38.1","adm-zip":"0.5.14","ci-info":"^4.0.0",commander:"12.1.0","console-table-printer":"^2.12.1",esbuild:"^0.23.1",eslint:"9.11.1","get-latest-version":"^5.1.0","git-format-staged":"3.1.1",husky:"^9.1.5","is-wsl":"^3.1.0",jszip:"^3.10.1",ky:"^1.7.1",logsnag:"1.0.0",mime:"^4.0.4","node-dir":"^0.1.17",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.3",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0","tus-js-client":"^4.2.3",typescript:"5.6.2"}};var a1=require("node:process");var ri=ve(it(),1),hp=require("node:process"),Go=ve(require("node:readline"),1),K5=ve(require("node:readline"),1),rP=require("node:tty"),kg=ve(KR(),1);function I3e({onlyFirst:e=!1}={}){let t=["[\\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(t,e?void 0:"g")}function iP(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(I3e(),"")}var Y5={},L3e={get exports(){return Y5},set exports(e){Y5=e}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(i){var n=i.charCodeAt(0),a=i.length==2?i.charCodeAt(1):0,s=n;return 55296<=n&&n<=56319&&56320<=a&&a<=57343&&(n&=1023,a&=1023,s=n<<10|a,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},t.characterLength=function(i){var n=this.eastAsianWidth(i);return n=="F"||n=="W"||n=="A"?2:1};function r(i){return i.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(i){for(var n=r(i),a=0,s=0;s<n.length;s++)a=a+this.characterLength(n[s]);return a},t.slice=function(i,n,a){textLen=t.length(i),n=n||0,a=a||1,n<0&&(n=textLen+n),a<0&&(a=textLen+a);for(var s="",o=0,u=r(i),l=0;l<u.length;l++){var c=u[l],p=t.length(c);if(o>=n-(p==2?1:0))if(o+p<=a)s+=c;else break;o+=p}return s}})(L3e);var B3e=Y5,j3e=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};function q1(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=iP(e),e.length===0))return 0;e=e.replace(j3e()," ");let r=t.ambiguousIsNarrow?1:2,i=0;for(let n of e){let a=n.codePointAt(0);if(!(a<=31||a>=127&&a<=159||a>=768&&a<=879))switch(B3e.eastAsianWidth(n)){case"F":case"W":i+=2;break;case"A":i+=r;break;default:i+=1}}return i}var G5=10,YR=(e=0)=>t=>`\x1B[${t+e}m`,XR=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,JR=(e=0)=>(t,r,i)=>`\x1B[${38+e};2;${t};${r};${i}m`,ft={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(ft.modifier);var q3e=Object.keys(ft.color),$3e=Object.keys(ft.bgColor);[...q3e,...$3e];function M3e(){let e=new Map;for(let[t,r]of Object.entries(ft)){for(let[i,n]of Object.entries(r))ft[i]={open:`\x1B[${n[0]}m`,close:`\x1B[${n[1]}m`},r[i]=ft[i],e.set(n[0],n[1]);Object.defineProperty(ft,t,{value:r,enumerable:!1})}return Object.defineProperty(ft,"codes",{value:e,enumerable:!1}),ft.color.close="\x1B[39m",ft.bgColor.close="\x1B[49m",ft.color.ansi=YR(),ft.color.ansi256=XR(),ft.color.ansi16m=JR(),ft.bgColor.ansi=YR(G5),ft.bgColor.ansi256=XR(G5),ft.bgColor.ansi16m=JR(G5),Object.defineProperties(ft,{rgbToAnsi256:{value:(t,r,i)=>t===r&&r===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(i/255*5),enumerable:!1},hexToRgb:{value:t=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[i]=r;i.length===3&&(i=[...i].map(a=>a+a).join(""));let n=Number.parseInt(i,16);return[n>>16&255,n>>8&255,n&255]},enumerable:!1},hexToAnsi256:{value:t=>ft.rgbToAnsi256(...ft.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value:t=>{if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,i,n;if(t>=232)r=((t-232)*10+8)/255,i=r,n=r;else{t-=16;let o=t%36;r=Math.floor(t/36)/5,i=Math.floor(o/6)/5,n=o%6/5}let a=Math.max(r,i,n)*2;if(a===0)return 30;let s=30+(Math.round(n)<<2|Math.round(i)<<1|Math.round(r));return a===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,i)=>ft.ansi256ToAnsi(ft.rgbToAnsi256(t,r,i)),enumerable:!1},hexToAnsi:{value:t=>ft.ansi256ToAnsi(ft.hexToAnsi256(t)),enumerable:!1}}),ft}var U3e=M3e(),Ig=new Set(["\x1B","\x9B"]),V3e=39,X5="\x07",nP="[",H3e="]",aP="m",J5=`${H3e}8;;`,ZR=e=>`${Ig.values().next().value}${nP}${e}${aP}`,QR=e=>`${Ig.values().next().value}${J5}${e}${X5}`,z3e=e=>e.split(" ").map(t=>q1(t)),W5=(e,t,r)=>{let i=[...t],n=!1,a=!1,s=q1(iP(e[e.length-1]));for(let[o,u]of i.entries()){let l=q1(u);if(s+l<=r?e[e.length-1]+=u:(e.push(u),s=0),Ig.has(u)&&(n=!0,a=i.slice(o+1).join("").startsWith(J5)),n){a?u===X5&&(n=!1,a=!1):u===aP&&(n=!1);continue}s+=l,s===r&&o<i.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},G3e=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(q1(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},W3e=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,a,s=z3e(e),o=[""];for(let[l,c]of e.split(" ").entries()){r.trim!==!1&&(o[o.length-1]=o[o.length-1].trimStart());let p=q1(o[o.length-1]);if(l!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(o.push(""),p=0),(p>0||r.trim===!1)&&(o[o.length-1]+=" ",p++)),r.hard&&s[l]>t){let d=t-p,f=1+Math.floor((s[l]-d-1)/t);Math.floor((s[l]-1)/t)<f&&o.push(""),W5(o,c,t);continue}if(p+s[l]>t&&p>0&&s[l]>0){if(r.wordWrap===!1&&p<t){W5(o,c,t);continue}o.push("")}if(p+s[l]>t&&r.wordWrap===!1){W5(o,c,t);continue}o[o.length-1]+=c}r.trim!==!1&&(o=o.map(l=>G3e(l)));let u=[...o.join(`
|
|
293
293
|
`)];for(let[l,c]of u.entries()){if(i+=c,Ig.has(c)){let{groups:d}=new RegExp(`(?:\\${nP}(?<code>\\d+)m|\\${J5}(?<uri>.*)${X5})`).exec(u.slice(l).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);n=f===V3e?void 0:f}else d.uri!==void 0&&(a=d.uri.length===0?void 0:d.uri)}let p=U3e.codes.get(Number(n));u[l+1]===`
|
|
294
294
|
`?(a&&(i+=QR("")),n&&p&&(i+=ZR(p))):c===`
|
|
295
295
|
`&&(n&&p&&(i+=ZR(n)),a&&(i+=QR(a)))}return i};function eP(e,t,r){return String(e).normalize().replace(/\r\n/g,`
|
|
@@ -332,21 +332,21 @@ ${Y.default.gray(gp)} ${e}
|
|
|
332
332
|
`)}
|
|
333
333
|
`)},info:e=>{T.message(e,{symbol:Y.default.blue(t8e)})},success:e=>{T.message(e,{symbol:Y.default.green(r8e)})},step:e=>{T.message(e,{symbol:Y.default.green(r_)})},warn:e=>{T.message(e,{symbol:Y.default.yellow(i8e)})},warning:e=>{T.warn(e)},error:e=>{T.message(e,{symbol:Y.default.red(n8e)})}},Ue=()=>{let e=Q5?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],t=Q5?80:120,r,i,n=!1,a="",s=(c="")=>{n=!0,r=oP(),a=c.replace(/\.+$/,""),process.stdout.write(`${Y.default.gray(Ft)}
|
|
334
334
|
`);let p=0,d=0;i=setInterval(()=>{let f=Y.default.magenta(e[p]),h=".".repeat(Math.floor(d)).slice(0,3);process.stdout.write(mp.cursor.move(-999,0)),process.stdout.write(mp.erase.down(1)),process.stdout.write(`${f} ${a}${h}`),p=p+1<e.length?p+1:0,d=d<e.length?d+.125:0},t)},o=(c="",p=0)=>{a=c??a,n=!1,clearInterval(i);let d=p===0?Y.default.green(r_):p===1?Y.default.red(pP):Y.default.red(dP);process.stdout.write(mp.cursor.move(-999,0)),process.stdout.write(mp.erase.down(1)),process.stdout.write(`${d} ${a}
|
|
335
|
-
`),r()},u=(c="")=>{a=c??a},l=c=>{let p=c>1?"Something went wrong":"Canceled";n&&o(p,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:s,stop:o,message:u}};var ur=require("node:fs"),Qv=require("node:os"),hi=require("node:path"),Zr=require("node:process"),ffe=require("node:crypto");var hfe=ve(sB()),mfe=ve(BB()),gfe=ve(Xj());var uu=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",s=`${n} ${a}`.trim(),o=s?`status code ${s}`:"an unknown error";super(`Request failed with ${o}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Gp=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Wp=e=>e!==null&&typeof e=="object";var $h=(...e)=>{for(let t of e)if((!Wp(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Zw({},...e)},Xw=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,s]of n.entries())i&&s==="undefined"||s===void 0?r.delete(a):r.set(a,s);return r};function z6(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Zw(e[r]??[],t[r]??[])}var Jw=(e={},t={})=>({beforeRequest:z6(e,t,"beforeRequest"),beforeRetry:z6(e,t,"beforeRetry"),afterResponse:z6(e,t,"afterResponse"),beforeError:z6(e,t,"beforeError")}),Zw=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Wp(n)){for(let[a,s]of Object.entries(n))Wp(s)&&a in t&&(s=Zw(t[a],s)),t={...t,[a]:s};Wp(n.hooks)&&(i=Jw(i,n.hooks),t.hooks=i),Wp(n.headers)&&(r=Xw(r,n.headers),t.headers=r)}return t};var Jj=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),Zj=typeof globalThis.AbortController=="function",Qj=typeof globalThis.ReadableStream=="function",eq=typeof globalThis.FormData=="function",G6=["get","post","put","patch","head","delete"],l7e=()=>{};l7e();var tq={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},W6=2147483647,K6=Symbol("stop"),rq={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},iq={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var aq=e=>G6.includes(e)?e.toUpperCase():e,c7e=["get","put","head","delete","options","trace"],p7e=[408,413,429,500,502,503,504],d7e=[413,429,503],nq={limit:2,methods:c7e,statusCodes:p7e,afterStatusCodes:d7e,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},sq=(e={})=>{if(typeof e=="number")return{...nq,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...nq,...e}};async function Qw(e,t,r,i){return new Promise((n,a)=>{let s=setTimeout(()=>{r&&r.abort(),a(new Gp(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(s)})})}async function eb(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var oq=(e,t)=>{let r={};for(let i in t)!(i in iq)&&!(i in rq)&&!(i in e)&&(r[i]=t[i]);return r};var Mh=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>W6)throw new RangeError(`The \`timeout\` option cannot be greater than ${W6}`);await Promise.resolve();let o=await i._fetch();for(let u of i._options.hooks.afterResponse){let l=await u(i.request,i._options,i._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(i._decorateResponse(o),!o.ok&&i._options.throwHttpErrors){let u=new uu(o,i.request,i._options);for(let l of i._options.hooks.beforeError)u=await l(u);throw u}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Qj)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(o.clone(),i._options.onDownloadProgress)}return o},s=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[o,u]of Object.entries(tq))s[o]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||u);let c=(await s).clone();if(o==="json"){if(c.status===204||(await c.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await c.text())}return c[o]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Xw(this._input.headers,r.headers),hooks:Jw({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:aq(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:sq(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(Zj){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(Jj&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(eq&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Gp)throw t;if(t instanceof uu){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),W6);if(this._retryCount<1)throw r;await eb(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===K6)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=oq(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Qw(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let s=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function o(){let{done:u,value:l}=await s.read();if(u){a.close();return}if(r){n+=l.byteLength;let c=i===0?0:n/i;r({percent:c,transferredBytes:n,totalBytes:i},l)}a.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var tb=e=>{let t=(r,i)=>Mh.create(r,$h(e,i));for(let r of G6)t[r]=(i,n)=>Mh.create(i,$h(e,n,{method:r}));return t.create=r=>tb($h(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),tb($h(e,r))),t.stop=K6,t},f7e=tb(),Kp=f7e;var zF=ve($V());var Xs=require("fs"),D0=(e=".",t="unknown")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,a=`${e}/package-lock.json`;return(0,Xs.existsSync)(r)?"bun":(0,Xs.existsSync)(i)?"pnpm":(0,Xs.existsSync)(n)?"yarn":(0,Xs.existsSync)(a)?"npm":t},$4=(e=D0(),t=!1)=>{switch(e){case"bun":return t?"bun install":"install";case"pnpm":return t?"pnpm install":"install";case"yarn":return t?"yarn install":"install";case"npm":return t?"npm install":"install";case"unknown":return t?"unknown unknown":"unknown";default:return t?"npm install":"install"}},MV=(e=".",t="npx")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,a=`${e}/package-lock.json`;return(0,Xs.existsSync)(r)?"bunx":(0,Xs.existsSync)(i)?"pnpm exec":(0,Xs.existsSync)(n)?"yarn dlx":(0,Xs.existsSync)(a)?"npx":t};var yfe=ve(yH()),vfe=ve(OK());var _fe=ve(sY()),wfe=ve(GS());var S2=ve(Fde());async function kde(){let e=await(0,S2.loadConfig)();return{config:e.app.extConfig,path:e.app.extConfigFilePath}}async function ms(e,t=!1){let r=await(0,S2.loadConfig)(),{extConfig:i}=r.app;i&&(i.plugins||(i.plugins={extConfig:{},CapacitorUpdater:{}}),i.plugins.CapacitorUpdater||(i.plugins.CapacitorUpdater={}),t?i=e.config:i.plugins.CapacitorUpdater=e.config.plugins?.CapacitorUpdater,(0,S2.writeConfig)(i,r.app.extConfigFilePath))}var $i=".capgo_key",on=".capgo_key_v2",un=`${$i}.pub`,Fo=`${on}.pub`;var lfe="https://capgo.app",GF="https://api.capgo.app",cfe="https://web.capgo.app",bfe=20,Dfe=12e4,zZe="package.json",t1=/^(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,ce=e=>e?`
|
|
336
|
-
${mfe.default.render(e)}`:"";function pfe(e){return new Promise(t=>{setTimeout(t,e)})}async function mi(){let e=(0,ur.readFileSync)((0,hi.join)((0,Zr.cwd)(),zZe));return JSON.parse(e)}async function pe(){try{let e=await kde();return e||(T.error("No capacitor config file found, run `cap init` first"),$.error("")),e}catch(e){T.error(`No capacitor config file found, run \`cap init\` first ${
|
|
335
|
+
`),r()},u=(c="")=>{a=c??a},l=c=>{let p=c>1?"Something went wrong":"Canceled";n&&o(p,c)};return process.on("uncaughtExceptionMonitor",()=>l(2)),process.on("unhandledRejection",()=>l(2)),process.on("SIGINT",()=>l(1)),process.on("SIGTERM",()=>l(1)),process.on("exit",l),{start:s,stop:o,message:u}};var ur=require("node:fs"),Qv=require("node:os"),hi=require("node:path"),Zr=require("node:process"),ffe=require("node:crypto");var hfe=ve(sB()),mfe=ve(BB()),gfe=ve(Xj());var uu=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",s=`${n} ${a}`.trim(),o=s?`status code ${s}`:"an unknown error";super(`Request failed with ${o}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var Gp=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var Wp=e=>e!==null&&typeof e=="object";var $h=(...e)=>{for(let t of e)if((!Wp(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return Zw({},...e)},Xw=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,s]of n.entries())i&&s==="undefined"||s===void 0?r.delete(a):r.set(a,s);return r};function z6(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:Zw(e[r]??[],t[r]??[])}var Jw=(e={},t={})=>({beforeRequest:z6(e,t,"beforeRequest"),beforeRetry:z6(e,t,"beforeRetry"),afterResponse:z6(e,t,"afterResponse"),beforeError:z6(e,t,"beforeError")}),Zw=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(Wp(n)){for(let[a,s]of Object.entries(n))Wp(s)&&a in t&&(s=Zw(t[a],s)),t={...t,[a]:s};Wp(n.hooks)&&(i=Jw(i,n.hooks),t.hooks=i),Wp(n.headers)&&(r=Xw(r,n.headers),t.headers=r)}return t};var Jj=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),Zj=typeof globalThis.AbortController=="function",Qj=typeof globalThis.ReadableStream=="function",eq=typeof globalThis.FormData=="function",G6=["get","post","put","patch","head","delete"],l7e=()=>{};l7e();var tq={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},W6=2147483647,K6=Symbol("stop"),rq={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},iq={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var aq=e=>G6.includes(e)?e.toUpperCase():e,c7e=["get","put","head","delete","options","trace"],p7e=[408,413,429,500,502,503,504],d7e=[413,429,503],nq={limit:2,methods:c7e,statusCodes:p7e,afterStatusCodes:d7e,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},sq=(e={})=>{if(typeof e=="number")return{...nq,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...nq,...e}};async function Qw(e,t,r,i){return new Promise((n,a)=>{let s=setTimeout(()=>{r&&r.abort(),a(new Gp(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(s)})})}async function eb(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var oq=(e,t)=>{let r={};for(let i in t)!(i in iq)&&!(i in rq)&&!(i in e)&&(r[i]=t[i]);return r};var Mh=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>W6)throw new RangeError(`The \`timeout\` option cannot be greater than ${W6}`);await Promise.resolve();let o=await i._fetch();for(let u of i._options.hooks.afterResponse){let l=await u(i.request,i._options,i._decorateResponse(o.clone()));l instanceof globalThis.Response&&(o=l)}if(i._decorateResponse(o),!o.ok&&i._options.throwHttpErrors){let u=new uu(o,i.request,i._options);for(let l of i._options.hooks.beforeError)u=await l(u);throw u}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Qj)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(o.clone(),i._options.onDownloadProgress)}return o},s=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[o,u]of Object.entries(tq))s[o]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||u);let c=(await s).clone();if(o==="json"){if(c.status===204||(await c.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await c.text())}return c[o]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:Xw(this._input.headers,r.headers),hooks:Jw({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:aq(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:sq(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(Zj){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if(Jj&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(eq&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof Gp)throw t;if(t instanceof uu){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),W6);if(this._retryCount<1)throw r;await eb(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===K6)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=oq(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):Qw(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let s=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function o(){let{done:u,value:l}=await s.read();if(u){a.close();return}if(r){n+=l.byteLength;let c=i===0?0:n/i;r({percent:c,transferredBytes:n,totalBytes:i},l)}a.enqueue(l),await o()}await o()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var tb=e=>{let t=(r,i)=>Mh.create(r,$h(e,i));for(let r of G6)t[r]=(i,n)=>Mh.create(i,$h(e,n,{method:r}));return t.create=r=>tb($h(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),tb($h(e,r))),t.stop=K6,t},f7e=tb(),Kp=f7e;var zF=ve($V());var Xs=require("fs"),D0=(e=".",t="unknown")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,a=`${e}/package-lock.json`;return(0,Xs.existsSync)(r)?"bun":(0,Xs.existsSync)(i)?"pnpm":(0,Xs.existsSync)(n)?"yarn":(0,Xs.existsSync)(a)?"npm":t},$4=(e=D0(),t=!1)=>{switch(e){case"bun":return t?"bun install":"install";case"pnpm":return t?"pnpm install":"install";case"yarn":return t?"yarn install":"install";case"npm":return t?"npm install":"install";case"unknown":return t?"unknown unknown":"unknown";default:return t?"npm install":"install"}},MV=(e=".",t="npx")=>{let r=`${e}/bun.lockb`,i=`${e}/pnpm-lock.yaml`,n=`${e}/yarn.lock`,a=`${e}/package-lock.json`;return(0,Xs.existsSync)(r)?"bunx":(0,Xs.existsSync)(i)?"pnpm exec":(0,Xs.existsSync)(n)?"yarn dlx":(0,Xs.existsSync)(a)?"npx":t};var yfe=ve(yH()),vfe=ve(OK());var _fe=ve(sY()),wfe=ve(GS());var S2=ve(Fde());async function kde(){let e=await(0,S2.loadConfig)();return{config:e.app.extConfig,path:e.app.extConfigFilePath}}async function ms(e,t=!1){let r=await(0,S2.loadConfig)(),{extConfig:i}=r.app;i&&(i.plugins||(i.plugins={extConfig:{},CapacitorUpdater:{}}),i.plugins.CapacitorUpdater||(i.plugins.CapacitorUpdater={}),t?i=e.config:i.plugins.CapacitorUpdater=e.config.plugins?.CapacitorUpdater,(0,S2.writeConfig)(i,r.app.extConfigFilePath))}var $i=".capgo_key",on=".capgo_key_v2",un=`${$i}.pub`,Fo=`${on}.pub`;var lfe="https://capgo.app",GF="https://api.capgo.app",cfe="https://web.capgo.app",bfe=20,Dfe=12e4,zZe="package.json",t1=/^(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,le=e=>e?`
|
|
336
|
+
${mfe.default.render(e)}`:"";function pfe(e){return new Promise(t=>{setTimeout(t,e)})}async function mi(){let e=(0,ur.readFileSync)((0,hi.join)((0,Zr.cwd)(),zZe));return JSON.parse(e)}async function pe(){try{let e=await kde();return e||(T.error("No capacitor config file found, run `cap init` first"),$.error("")),e}catch(e){T.error(`No capacitor config file found, run \`cap init\` first ${le(e)}`),$.error("")}}async function e9(e){let t=await pe();return t?.config&&(t.config.plugins||(t.config.plugins={extConfig:{},CapacitorUpdater:{}}),t.config.plugins.CapacitorUpdater||(t.config.plugins.CapacitorUpdater={}),t.config.plugins.CapacitorUpdater={...t.config.plugins.CapacitorUpdater,...e},ms(t)),t}async function k2(){try{let e=await pe(),t={host:e?.config?.plugins?.CapacitorUpdater?.localHost||lfe,hostWeb:e?.config?.plugins?.CapacitorUpdater?.localWebHost||cfe};return e?.config?.plugins?.CapacitorUpdater?.localSupa&&e?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(T.info("Using custom supabase instance from capacitor.config.json"),t.supaKey=e?.config?.plugins?.CapacitorUpdater?.localSupaAnon,t.supaHost=e?.config?.plugins?.CapacitorUpdater?.localSupa),t}catch{return{host:lfe,hostWeb:cfe}}}var GZe=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function Efe(){let e=await k2();return Kp.get(`${GF}/private/config`).then(t=>t.json()).then(t=>({...t,...e})).catch(()=>(T.info(`Local config ${le(e)}`),e))}async function Se(e){let t=await Efe();return(!t.supaHost||!t.supaKey)&&(T.error("Cannot connect to server please try again later"),$.error("")),(0,hfe.createClient)(t.supaHost,t.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:e}}})}async function WZe(e,t,r){let{data:i}=await e.rpc("is_allowed_capgkey",{apikey:t,keymode:r}).single();if(!i){T.error("Invalid API key or insufficient permissions.");let n=r.map((a,s)=>s===r.length-1?`or ${a}`:`${a}, `).join("");T.error(`Your key should be: ${n} mode.`),$.error("")}}async function KZe(e,t){let{data:r}=await e.rpc("is_paying_org",{orgid:t}).single();return r||!1}async function YZe(e,t){let{data:r}=await e.rpc("is_trial_org",{orgid:t}).single();return r||0}async function XZe(e,t){let{data:r}=await e.rpc("is_allowed_action_org",{orgid:t}).single();return!!r}async function JZe(e,t,r){let{data:i}=await e.rpc("is_allowed_action",{apikey:r,appid:t}).single();return!!i}var Br=(s=>(s[s.none=0]="none",s[s.read=1]="read",s[s.upload=2]="upload",s[s.write=3]="write",s[s.admin=4]="admin",s[s.super_admin=5]="super_admin",s))(Br||{}),xfe=(e,t)=>e>=t;async function Cfe(e,t,r){let{data:i,error:n}=await e.rpc("get_org_perm_for_apikey",{apikey:t,app_id:r}).single();if(n&&(T.error("Cannot get permissions for organization!"),console.error(n),(0,Zr.exit)(1)),i.includes("perm")){let o=null;switch(i){case"perm_none":{o=0;break}case"perm_read":{o=1;break}case"perm_upload":{o=2;break}case"perm_write":{o=3;break}case"perm_admin":{o=4;break}case"perm_owner":{o=5;break}default:i.includes("invite")&&(T.info("Please accept/deny the organization invitation before trying to access the app"),(0,Zr.exit)(1)),T.error(`Invalid output when fetching organization permission. Response: ${i}`),(0,Zr.exit)(1)}return{okay:!0,data:o}}let s=null;switch(i){case"INVALID_APIKEY":{s="INVALID_APIKEY";break}case"NO_APP":{s="NO_APP";break}case"NO_ORG":{s="NO_ORG";break}default:T.error(`Invalid error when fetching organization permission. Response: ${i}`),(0,Zr.exit)(1)}return{okay:!1,error:s}}async function r1(e,t,r,i,n=!0){let a=await Efe();await(i?JZe(e,i,r):XZe(e,t))||(T.error(`You need to upgrade your plan to continue to use capgo.
|
|
337
337
|
Upgrade here: ${a.hostWeb}/dashboard/settings/plans
|
|
338
338
|
`),pfe(100),Promise.resolve().then(()=>(ufe(),ofe)).then(l=>{l.default(`${a.hostWeb}/dashboard/settings/plans`)}),pfe(500),$.error(""));let[o,u]=await Promise.all([YZe(e,t),KZe(e,t)]);o>0&&n&&!u&&T.warn(`WARNING !!
|
|
339
339
|
Trial expires in ${o} days, upgrade here: ${a.hostWeb}/dashboard/settings/plans
|
|
340
|
-
`)}function Fe(e=!1){let t=(0,Qv.homedir)(),r,i=`${t}/.capgo`;return(0,ur.existsSync)(i)&&(e||T.info(`Use global API key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),i=".capgo",!r&&(0,ur.existsSync)(i)&&(e||T.info(`Use local API key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),r||(T.error(`Cannot find API key in local folder or global, please login first with ${gi().runner} @capacitor/cli login`),$.error("")),r}async function*WF(e){let t=await(0,ur.readdirSync)(e,{withFileTypes:!0});for(let r of t){let i=(0,hi.resolve)(e,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*WF(i):yield i}}async function KF(){let e=(0,Zr.cwd)(),t=!1,r=(0,hi.resolve)(e,"tsconfig.json");(0,ur.existsSync)(r)&&(t=!0);for await(let i of WF(e)){if(i.includes("angular.json"))return T.info("Found angular project"),t?"angular-ts":"angular-js";if(i.includes("nuxt.config.js"))return T.info("Found nuxtjs project"),t?"nuxtjs-ts":"nuxtjs-js";if(i.includes("next.config.js")||i.includes("next.config.mjs"))return T.info("Found nextjs project"),t?"nextjs-ts":"nextjs-js";if(i.includes("svelte.config.js"))return T.info("Found sveltekit project"),t?"sveltekit-ts":"sveltekit-js";if(i.includes("rolluconfig.js"))return T.info("Found svelte project"),t?"svelte-ts":"svelte-js";if(i.includes("vue.config.js"))return T.info("Found vue project"),t?"vue-ts":"vue-js";if(i.includes("package.json")){let n=await mi();if(n.dependencies){if(n.dependencies.react)return T.info("Found react project test"),t?"react-ts":"react-js";if(n.dependencies.vue)return T.info("Found vue project"),t?"vue-ts":"vue-js"}}}return"unknown"}function Sfe(e,t){return e==="angular-js"||e==="angular-ts"?t?"src/main.ts":"src/main.js":e==="nextjs-js"||e==="nextjs-ts"?t?"src/app/layout.tsx":"src/app/layout.js":e==="svelte-js"||e==="svelte-ts"||e==="vue-js"||e==="vue-ts"?t?"src/main.ts":"src/main.js":e==="react-js"||e==="react-ts"?t?"src/index.tsx":"src/index.js":null}async function Afe(e){return e==="angular"?(T.info("Angular project detected"),"build"):e==="nuxtjs"?(T.info("Nuxtjs project detected"),"generate"):e==="nextjs"?(T.info("Nextjs project detected"),T.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),T.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await nt({message:"Do you want to continue?"})||(T.error("Aborted"),$.error("")),"build"):(e==="sveltekit"&&(T.info("Sveltekit project detected"),T.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),T.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await nt({message:"Do you want to continue?"})||(T.error("Aborted"),$.error(""))),"build")}async function Ofe(){let e=/(main|index)\.(ts|tsx|js|jsx)$/,t="",r=(0,Zr.cwd)(),i=r.split("/").length;for await(let n of WF(r))if(n.split("/").length-i<=2&&e.test(n)){t=n,T.info(`Found main file here ${n}`);break}return t}async function YF(e,t){return e.from("app_versions").upsert(t,{onConflict:"name,app_id"}).eq("app_id",t.app_id).eq("name",t.name)}async function Tfe(e,t,r){let i={app_id:t,name:r,version:0};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data.url}catch(n){T.error(`Cannot get upload url ${
|
|
340
|
+
`)}function Fe(e=!1){let t=(0,Qv.homedir)(),r,i=`${t}/.capgo`;return(0,ur.existsSync)(i)&&(e||T.info(`Use global API key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),i=".capgo",!r&&(0,ur.existsSync)(i)&&(e||T.info(`Use local API key ${i}`),r=(0,ur.readFileSync)(i,"utf8").trim()),r||(T.error(`Cannot find API key in local folder or global, please login first with ${gi().runner} @capacitor/cli login`),$.error("")),r}async function*WF(e){let t=await(0,ur.readdirSync)(e,{withFileTypes:!0});for(let r of t){let i=(0,hi.resolve)(e,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*WF(i):yield i}}async function KF(){let e=(0,Zr.cwd)(),t=!1,r=(0,hi.resolve)(e,"tsconfig.json");(0,ur.existsSync)(r)&&(t=!0);for await(let i of WF(e)){if(i.includes("angular.json"))return T.info("Found angular project"),t?"angular-ts":"angular-js";if(i.includes("nuxt.config.js"))return T.info("Found nuxtjs project"),t?"nuxtjs-ts":"nuxtjs-js";if(i.includes("next.config.js")||i.includes("next.config.mjs"))return T.info("Found nextjs project"),t?"nextjs-ts":"nextjs-js";if(i.includes("svelte.config.js"))return T.info("Found sveltekit project"),t?"sveltekit-ts":"sveltekit-js";if(i.includes("rolluconfig.js"))return T.info("Found svelte project"),t?"svelte-ts":"svelte-js";if(i.includes("vue.config.js"))return T.info("Found vue project"),t?"vue-ts":"vue-js";if(i.includes("package.json")){let n=await mi();if(n.dependencies){if(n.dependencies.react)return T.info("Found react project test"),t?"react-ts":"react-js";if(n.dependencies.vue)return T.info("Found vue project"),t?"vue-ts":"vue-js"}}}return"unknown"}function Sfe(e,t){return e==="angular-js"||e==="angular-ts"?t?"src/main.ts":"src/main.js":e==="nextjs-js"||e==="nextjs-ts"?t?"src/app/layout.tsx":"src/app/layout.js":e==="svelte-js"||e==="svelte-ts"||e==="vue-js"||e==="vue-ts"?t?"src/main.ts":"src/main.js":e==="react-js"||e==="react-ts"?t?"src/index.tsx":"src/index.js":null}async function Afe(e){return e==="angular"?(T.info("Angular project detected"),"build"):e==="nuxtjs"?(T.info("Nuxtjs project detected"),"generate"):e==="nextjs"?(T.info("Nextjs project detected"),T.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),T.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await nt({message:"Do you want to continue?"})||(T.error("Aborted"),$.error("")),"build"):(e==="sveltekit"&&(T.info("Sveltekit project detected"),T.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),T.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await nt({message:"Do you want to continue?"})||(T.error("Aborted"),$.error(""))),"build")}async function Ofe(){let e=/(main|index)\.(ts|tsx|js|jsx)$/,t="",r=(0,Zr.cwd)(),i=r.split("/").length;for await(let n of WF(r))if(n.split("/").length-i<=2&&e.test(n)){t=n,T.info(`Found main file here ${n}`);break}return t}async function YF(e,t){return e.from("app_versions").upsert(t,{onConflict:"name,app_id"}).eq("app_id",t.app_id).eq("name",t.name)}async function Tfe(e,t,r){let i={app_id:t,name:r,version:0};try{return(await e.functions.invoke("private/upload_link",{body:JSON.stringify(i)})).data.url}catch(n){T.error(`Cannot get upload url ${le(n)}`)}return""}async function Ffe(e){return(await(0,_fe.promiseFiles)(e)).map(r=>{let i=(0,ur.readFileSync)(r),n=(0,ffe.createHash)("sha-256").update(i).digest("hex"),a=r.replace(e,"");return a.startsWith("/")&&(a=a.substring(1,a.length)),{file:a,hash:n}})}async function t9(e){return(0,Qv.platform)()==="win32"?QZe(e):ZZe(e)}function ZZe(e){let t=new yfe.default;return t.addLocalFolder(e),t.toBuffer()}async function QZe(e){T.info("Zipping file windows mode");let t=new vfe.default,r=async(n,a)=>{let s=(0,ur.readdirSync)(n);for(let o of s){let u=(0,hi.join)(n,o),l=(0,ur.statSync)(u);if(l.isFile()){let c=await(0,ur.readFileSync)(u);t.file((0,hi.join)(a,o).split(hi.sep).join("/"),c)}else l.isDirectory()&&await r(u,(0,hi.join)(a,o))}};return await r(e,""),await t.generateAsync({type:"nodebuffer",platform:"UNIX",compression:"DEFLATE",compressionOptions:{level:6}})}function XF(e,t,r,i,n,a){return new Promise((s,o)=>{let u=At();u.track({channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":i},notify:!1}).catch(),new wfe.Upload(t,{endpoint:"https://api.capgo.app/private/files/upload/attachments/",metadata:{filename:`orgs/${r}/apps/${i}/${n}.zip`,filetype:"application/zip"},headers:{Authorization:e},onError(c){T.error(`Failed because: ${c}`),o(c)},onProgress(c,p){let d=(c/p*100).toFixed(2);a.message(`Uploaded ${d}%`)},async onSuccess(){await u.track({channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":i},notify:!1}).catch(),s(!0)}}).start()})}async function kfe(e,t,r){let i={app_id:t,name:r};try{return(await e.functions.invoke("private/delete_failed_version",{body:JSON.stringify(i),method:"DELETE"})).data.status}catch(n){return T.error(`Cannot delete failed version ${le(n)}`),Promise.reject(new Error("Cannot delete failed version"))}}async function r9(e,t){if(!t.app_id||!t.name||!t.created_by)return T.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:i}=await e.from("channels").select("enable_progressive_deploy, secondary_version_percentage, second_version").eq("app_id",t.app_id).eq("name",t.name).single();if(r&&!i){if(r.enable_progressive_deploy){if(T.info("Progressive deploy is enabled"),r.secondary_version_percentage!==1&&T.warn("Latest progressive deploy has not finished"),t.second_version=t.version,!r.second_version)return T.error("missing secondVersion"),Promise.reject(new Error("missing secondVersion"));t.version=r.second_version,t.secondary_version_percentage=.1,T.info("Started new progressive upload!")}return e.from("channels").update(t).eq("app_id",t.app_id).eq("name",t.name).select().single()}return e.from("channels").insert(t).select().single()}function At(){return new gfe.LogSnag({token:Zr.env.CAPGO_LOGSNAG??"c124f5e9d0ce5bdd14bbb48f815d5583",project:Zr.env.CAPGO_LOGSNAG_PROJECT??"capgo"})}async function i1(e,t){let{error:r,data:i}=await e.rpc("get_orgs_v5");r&&(T.error("Cannot get the list of organizations - exiting"),T.error(`Error ${JSON.stringify(r)}`),$.error(""));let n=i.filter(u=>!!t.find(l=>l===u.role));n.length===0&&(T.error(`Could not get organization with roles: ${t.join(" or ")} because the user does not have any org`),$.error(""));let a=n.length>1?await yp({message:"Please pick the organization that you want to insert to",options:n.map(u=>({value:u.gid,label:u.name}))}):n[0].gid;Di(a)&&(T.error("Canceled organization selection, exiting"),$.error(""));let s=a,o=i.find(u=>u.gid===s);return T.info(`Using the organization "${o.name}" as the app owner`),o}var jc=e=>e.replace(/\./g,"--");async function Ae(e,t,r=["all"]){await WZe(e,t,r);let{data:i,error:n}=await e.rpc("get_user_id",{apikey:t}).single(),a=(i||"").toString();return(!a||n)&&(T.error("Cannot auth user with apikey"),$.error("")),a}async function Mn(e,t){let{data:r,error:i}=await e.from("apps").select("owner_org").eq("app_id",t).single();return(!r||i)&&(T.error(`Cannot get organization id for app id ${t}`),le(i),$.error("")),r.owner_org}function n1(e){return new Date(e||"").toLocaleString()}var dfe=!1,e1="npm",F2="install",HF="npx";function gi(){if(dfe)return{pm:e1,command:F2,installCommand:`${e1} ${F2}`,runner:HF};let e=(0,zF.findRootSync)((0,Zr.cwd)());return e1=D0(e.rootDir,"npm"),F2=$4(e1),dfe=!0,HF=MV(e.rootDir),{pm:e1,command:F2,installCommand:`${e1} ${F2}`,runner:HF}}function Nfe(e){return(0,ur.readdirSync)(e,{withFileTypes:!0}).flatMap(i=>{let n=(0,hi.join)(e,i.name);return i.isDirectory()?Nfe(n):n.split(`node_modules${hi.sep}`)[1]||n})}async function JF(){let e=(0,zF.findRootSync)((0,Zr.cwd)()),t=(0,hi.join)((0,Zr.cwd)(),"package.json");(0,ur.existsSync)(t)||(T.error("Missing package.json, you need to be in a capacitor project"),$.error(""));let r;try{r=await mi()}catch(o){T.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",o),$.error("")}let{dependencies:i}=r;i||(T.error("Missing dependencies section in package.json"),$.error(""));for(let[o,u]of Object.entries(i))typeof u!="string"&&(T.error(`Invalid dependency ${o}: ${u}, expected string, got ${typeof u}`),$.error(""));let n=(0,hi.join)((0,Zr.cwd)(),"node_modules");if(!(0,ur.existsSync)(n)){let o=D0(e.rootDir,"npm"),u=$4(o);T.error(`Missing node_modules folder, please run ${o} ${u}`),$.error("")}let a=!1,s=await Promise.all(Object.entries(i).map(async([o,u])=>{let l=(0,hi.join)(n,o);if(!(0,ur.existsSync)(l)){a=!0;let d=D0(e.rootDir,"npm"),f=$4(d);return T.error(`Missing dependency ${o}, please run ${d} ${f}`),{name:o,version:u}}let p=!1;try{p=Nfe(l).some(f=>GZe.test(f))}catch(d){T.error(`Error reading node_modules files for ${o} package`),console.error(d),$.error("")}return{name:o,version:u,native:p}})).catch(()=>[]);return(a||s.find(o=>o.native===void 0))&&$.error(""),s}async function eQe(e,t,r){let{data:i,error:n}=await e.from("channels").select("version(checksum)").eq("name",r).eq("app_id",t).single(),a=i;return n||a===null||!a.version||!a.version.checksum?null:a.version.checksum}async function tQe(e,t,r){let{data:i,error:n}=await e.from("channels").select(`version (
|
|
341
341
|
native_packages
|
|
342
342
|
)`).eq("name",r).eq("app_id",t).single();n&&(T.error(`Error fetching native packages: ${n.message}`),$.error(""));let a;try{a=i.version.native_packages}catch{T.error("Error parsing native packages"),$.error("")}return a||(T.error("Error parsing native packages, perhaps the metadata does not exist?"),$.error("")),a.forEach(o=>{typeof o!="object"&&(T.error(`Invalid remote native package data: ${o}, expected object, got ${typeof o}`),$.error(""));let{name:u,version:l}=o;(!u||typeof u!="string")&&(T.error(`Invalid remote native package name: ${u}, expected string, got ${typeof u}`),$.error("")),(!l||typeof l!="string")&&(T.error(`Invalid remote native package version: ${l}, expected string, got ${typeof l}`),$.error(""))}),new Map(a.map(o=>[o.name,o]))}async function Rfe(e,t,r,i){let n=Ue();n.start(`Checking bundle checksum compatibility with channel ${r}`);let a=await eQe(e,t,r);a&&a===i&&(T.error(`Cannot upload the same bundle content.
|
|
343
343
|
Current bundle checksum matches remote bundle for channel ${r}
|
|
344
344
|
Did you builded your app before uploading?
|
|
345
|
-
PS: You can ignore this check with "--ignore-checksum-check"`),$.error("")),n.stop(`Checksum compatible with ${r} channel`)}async function i9(e,t,r){let i=await JF(),n=await tQe(e,t,r),a=i.filter(o=>!!o.native).map(o=>{let u=n.get(o.name);return u?{name:o.name,localVersion:o.version,remoteVersion:u.version}:{name:o.name,localVersion:o.version,remoteVersion:void 0}}),s=[...n].filter(([o])=>i.find(u=>u.name===o)===void 0).map(([o,u])=>({name:o,localVersion:void 0,remoteVersion:u.version}));return a.push(...s),{finalCompatibility:a,localDependencies:i}}async function Pfe(e,t){re("Set a specific setting in capacitor config"),t.bool&&t.string&&(T.error("Bool and string CANNOT be set at the same time"),(0,a1.exit)(1)),!t.bool&&!t.string&&(T.error("You MUST provide either bool or string as the value"),(0,a1.exit)(1)),t.bool&&t.bool!=="true"&&t.bool!=="false"&&(T.error("Invalid bool"),(0,a1.exit)(1));try{let r=await pe(),i=r.config,n=e.split(".");n.length===0&&(T.error("Invalid path"),(0,a1.exit)(1));for(let s of n.slice(0,-1))Object.prototype.hasOwnProperty.call(i,s)||(i[s]={}),i=i[s];let a=t.bool?t.bool==="true":t.string;i[n.at(-1)]=a,await ms(r,!0),T.success(`Set "${e}" to "${a}"`)}catch(r){T.error(`Cannot set config in capacitor settings ${
|
|
346
|
-
Please use @capgo/cli@${e}" or @capgo/cli@${t} to keep up to date with the latest features and bug fixes.`)}var rl=require("node:fs"),ug=require("node:path");function lut(e,t){return(0,rl.readFileSync)(e,"utf8").includes(t)}function lg(e,t){let r=(0,rl.readdirSync)(e);for(let i of r){let n=(0,ug.join)(e,i),a=(0,rl.statSync)(n);if(a.isDirectory()){if(lg(n,t))return!0}else if(a.isFile()&&(0,ug.extname)(n)===".js"&&lut(n,t))return!0}return!1}function cg(e){let t=(0,rl.readdirSync)(e);if(t.length===1){let i=(0,ug.join)(e,t[0]);if((0,rl.statSync)(i).isDirectory())return cg(i)}return t.indexOf("index.html")>-1}var cut=20;async function jge(e,t){try{let{bundle:r,path:i}=t,{json:n}=t,a=At();n||await Ie();let s=await pe();e=e||s?.config?.appId;let o=(0,Lge.randomUUID)().split("-")[0],u=await mi();r=r||u?.version||`0.0.1-beta.${o}`,n||re(`Zipping ${e}@${r}`),r&&!t1.test(r)&&(n?console.error(
|
|
345
|
+
PS: You can ignore this check with "--ignore-checksum-check"`),$.error("")),n.stop(`Checksum compatible with ${r} channel`)}async function i9(e,t,r){let i=await JF(),n=await tQe(e,t,r),a=i.filter(o=>!!o.native).map(o=>{let u=n.get(o.name);return u?{name:o.name,localVersion:o.version,remoteVersion:u.version}:{name:o.name,localVersion:o.version,remoteVersion:void 0}}),s=[...n].filter(([o])=>i.find(u=>u.name===o)===void 0).map(([o,u])=>({name:o,localVersion:void 0,remoteVersion:u.version}));return a.push(...s),{finalCompatibility:a,localDependencies:i}}async function Pfe(e,t){re("Set a specific setting in capacitor config"),t.bool&&t.string&&(T.error("Bool and string CANNOT be set at the same time"),(0,a1.exit)(1)),!t.bool&&!t.string&&(T.error("You MUST provide either bool or string as the value"),(0,a1.exit)(1)),t.bool&&t.bool!=="true"&&t.bool!=="false"&&(T.error("Invalid bool"),(0,a1.exit)(1));try{let r=await pe(),i=r.config,n=e.split(".");n.length===0&&(T.error("Invalid path"),(0,a1.exit)(1));for(let s of n.slice(0,-1))Object.prototype.hasOwnProperty.call(i,s)||(i[s]={}),i=i[s];let a=t.bool?t.bool==="true":t.string;i[n.at(-1)]=a,await ms(r,!0),T.success(`Set "${e}" to "${a}"`)}catch(r){T.error(`Cannot set config in capacitor settings ${le(r)}`),(0,a1.exit)(1)}ae("Done \u2705")}async function Ife(e){re("Getting user id"),e.apikey=e.apikey||Fe();let t=await Se(e.apikey),r=await Ae(t,e.apikey,["read"]);ae(`Done \u2705: ${r}`)}var Lge=require("node:crypto"),Z9=require("node:fs"),Bge=require("node:process");var BN=ve(_9());var Ige=ve(LN());async function Ie(){let e=await(0,Ige.default)("@capgo/cli"),t=e?.split(".")[0];e!==zo.version&&T.warning(`\u{1F6A8} You are using @capgo/cli@${zo.version} it's not the latest version.
|
|
346
|
+
Please use @capgo/cli@${e}" or @capgo/cli@${t} to keep up to date with the latest features and bug fixes.`)}var rl=require("node:fs"),ug=require("node:path");function lut(e,t){return(0,rl.readFileSync)(e,"utf8").includes(t)}function lg(e,t){let r=(0,rl.readdirSync)(e);for(let i of r){let n=(0,ug.join)(e,i),a=(0,rl.statSync)(n);if(a.isDirectory()){if(lg(n,t))return!0}else if(a.isFile()&&(0,ug.extname)(n)===".js"&&lut(n,t))return!0}return!1}function cg(e){let t=(0,rl.readdirSync)(e);if(t.length===1){let i=(0,ug.join)(e,t[0]);if((0,rl.statSync)(i).isDirectory())return cg(i)}return t.indexOf("index.html")>-1}var cut=20;async function jge(e,t){try{let{bundle:r,path:i}=t,{json:n}=t,a=At();n||await Ie();let s=await pe();e=e||s?.config?.appId;let o=(0,Lge.randomUUID)().split("-")[0],u=await mi();r=r||u?.version||`0.0.1-beta.${o}`,n||re(`Zipping ${e}@${r}`),r&&!t1.test(r)&&(n?console.error(le({error:"invalid_semver"})):T.error(`Your bundle name ${r}, is not valid it should follow semver convention : https://semver.org/`),$.error("")),i=i||s?.config?.webDir,(!e||!r||!i)&&(n?console.error(le({error:"missing_argument"})):T.error("Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project"),$.error("")),n||T.info(`Started from path "${i}"`);let l=t.codeCheck;(typeof l>"u"||l)&&(lg(i,"notifyAppReady")||(n?console.error(le({error:"notifyAppReady_not_in_source_code"})):T.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),$.error("")),cg(i)||(n?console.error(le({error:"index_html_not_found"})):T.error("index.html is missing in the root folder or in the only folder in the root folder"),$.error("")));let c=await t9(i);n||T.info(`Zipped ${c.byteLength} bytes`);let p=Ue();n||p.start("Calculating checksum");let d="";t.keyV2||(0,Z9.existsSync)(on)?d=await(0,BN.checksum)(c,"sha256"):d=await(0,BN.checksum)(c,"crc32"),n||p.stop(`Checksum: ${d}`);let f=Math.floor(c.byteLength/1024/1024);f>cut&&!n&&(T.warn(`WARNING !!
|
|
347
347
|
The app size is ${f} Mb, this may take a while to download for users
|
|
348
348
|
`),T.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
349
|
-
`),await a.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",tags:{"app-id":e},notify:!1}).catch());let h=Ue(),m=t.name||`${e}_${r}.zip`;n||h.start(`Saving to ${m}`),(0,Z9.writeFileSync)(m,c),n||h.stop(`Saved to ${m}`),await a.track({channel:"app",event:"App zip",icon:"\u23EB",tags:{"app-id":e},notify:!1}).catch(),n||ae("Done \u2705"),n&&console.log(JSON.stringify({bundle:r,filename:m,checksum:d},null,2)),(0,Bge.exit)()}catch(r){T.error(
|
|
349
|
+
`),await a.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",tags:{"app-id":e},notify:!1}).catch());let h=Ue(),m=t.name||`${e}_${r}.zip`;n||h.start(`Saving to ${m}`),(0,Z9.writeFileSync)(m,c),n||h.stop(`Saved to ${m}`),await a.track({channel:"app",event:"App zip",icon:"\u23EB",tags:{"app-id":e},notify:!1}).catch(),n||ae("Done \u2705"),n&&console.log(JSON.stringify({bundle:r,filename:m,checksum:d},null,2)),(0,Bge.exit)()}catch(r){T.error(le(r)),$.error("")}}var rr=require("node:fs"),Cg=require("node:child_process"),pn=require("node:process"),_5=require("node:path");var w5=ve(Hv()),b5=ve(e6e());var wi=require("node:fs");var _i=require("node:crypto"),pg=require("node:buffer"),t6e="aes-128-cbc",r6e="sha256",e5="base64",i6e=_i.constants.RSA_PKCS1_OAEP_PADDING;function n6e(e,t,r){let[i,n]=t.split(":"),a=(0,_i.privateDecrypt)({key:r,padding:i6e,oaepHash:r6e},pg.Buffer.from(n,e5)),s=pg.Buffer.from(i,e5),o=(0,_i.createDecipheriv)(t6e,a,s);return o.setAutoPadding(!0),pg.Buffer.concat([o.update(e),o.final()])}function t5(e,t){let r=(0,_i.randomBytes)(16),i=(0,_i.randomBytes)(16),n=(0,_i.createCipheriv)(t6e,i,r);n.setAutoPadding(!0);let a=r.toString(e5),s=(0,_i.publicEncrypt)({key:t,padding:i6e,oaepHash:r6e},i).toString(e5),o=`${a}:${s}`;return{encryptedData:pg.Buffer.concat([n.update(e),n.final()]),ivSessionKey:o}}function r5(e="pem",t=2048){let{publicKey:r,privateKey:i}=(0,_i.generateKeyPairSync)("rsa",{modulusLength:t});return e==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:i.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:i.export({type:"pkcs1",format:"pem"}).toString("base64")}}async function Aut(e,t=!0){t&&re("Save keys \u{1F511}");let r=await pe(),i=e.key||Fo,n=e.keyData||"";if(!(0,wi.existsSync)(i)&&!n)if(T)T.error(`Cannot find a public key at ${i} or as keyData option or in ${r.path}`),$.error("");else return!1;else(0,wi.existsSync)(i)&&(n=(0,wi.readFileSync)(i).toString());if(n&&!n.startsWith("-----BEGIN RSA PUBLIC KEY-----"))if(T)T.error("the public key provided is not a valid RSA Public key"),$.error("");else return!1;return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey&&(delete r.config.plugins.CapacitorUpdater.privateKey,T.info("Old private key deleted from config file"),await nt({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"})&&(r.config.plugins.CapacitorUpdater.defaultChannel="encryption_v2")),r.config.plugins.CapacitorUpdater.publicKey=n,await ms(r)),t&&(T.success(`public key saved into ${r.path} file in local directory`),T.success("your app will decode the zip archive with this key")),!0}async function Out(e,t=!0){t&&re("Deleting old private key \u{1F5D1}\uFE0F");let r=await pe();if(r?.config?.plugins?.CapacitorUpdater?.privateKey){if(delete r.config.plugins.CapacitorUpdater.privateKey,await ms(r),(0,wi.existsSync)($i))try{(0,wi.unlinkSync)($i),t&&T.success(`Old private key file deleted: ${$i}`)}catch{t&&T.error(`Failed to delete old private key file: ${$i}`)}if((0,wi.existsSync)(un))try{(0,wi.unlinkSync)(un),t&&T.success(`Old public key file deleted: ${un}`)}catch{t&&T.error(`Failed to delete old public key file: ${Fo}`)}return t&&T.success(`Old private key deleted from ${r.path} file`),!0}else return t&&T.info("No old private key found in config file"),!1}async function a6e(e){re("Save keys \u{1F511}"),await Ie(),await Aut(e)}async function zN(e,t=!0){t&&re("Create keys \u{1F511}");let{publicKey:r,privateKey:i}=r5();if((0,wi.existsSync)(Fo)&&!e.force)if(T.error("Public Key already exists, use --force to overwrite"),t)$.error("");else return!1;if((0,wi.writeFileSync)(Fo,r),(0,wi.existsSync)(on)&&!e.force)if(T.error("Private Key already exists, use --force to overwrite"),t)$.error("");else return!1;(0,wi.writeFileSync)(on,i);let n=await pe();return n&&(n.config.plugins||(n.config.plugins={extConfig:{},CapacitorUpdater:{}}),n.config.plugins.CapacitorUpdater||(n.config.plugins.CapacitorUpdater={}),n.config.plugins.CapacitorUpdater.privateKey&&(delete n.config.plugins.CapacitorUpdater.privateKey,T.info("Old private key deleted from config file"),await nt({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"})&&(n.config.plugins.CapacitorUpdater.defaultChannel="encryption_v2")),n.config.plugins.CapacitorUpdater.publicKey=r,ms(n)),T&&(T.success("Your RSA key has been generated"),T.success(`Private key saved in ${on}`),T.success("This key will be use to encrypt your bundle before sending it to Capgo"),T.success("Keep it safe"),T.success("Than make it unreadable by Capgo and unmodifiable by anyone"),T.success(`Public key saved in ${n.path}`),T.success("Your app will be the only one having it"),T.success("Only your users can decrypt your update"),T.success("Only you can send them an update"),ae("Done \u2705")),!0}async function s6e(e){await Ie(),await zN(e)}async function o6e(e){await Ie(),await Out(e)}var GN=require("node:process");async function u6e(e,t){let{data:r}=await e.rpc("exist_app_v2",{appid:t}).single();return!!r}async function tt(e,t,r,i){let n=gi(),a=await Cfe(e,t,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{T.error("Invalid apikey, such apikey does not exists!"),$.error("");break}case"NO_APP":{T.error(`App ${r} does not exist, run first \`${n.runner} @capgo/cli app add ${r}\` to create it`),$.error("");break}case"NO_ORG":{T.error("Could not find organization, please contact support to resolve this!"),$.error("");break}}let s=a.data;return i>s&&(T.error(`Insuficcent permissions for app ${r}. Current permission: ${Br[a.data]}, required for this action: ${Br[i]}.`),$.error("")),a.data}var Gn="assets/icon.png";function Tut(e){return new Promise(t=>{setTimeout(t,e)})}async function qo(e,t,r,i,n="\u2705"){await r.track({channel:e,event:i,icon:n,user_id:t,notify:!1}).catch()}async function Fut(e,t,r,i){Di(t)&&(await qo(e,r,i,"canceled","\u{1F937}"),(0,GN.exit)())}async function kut(e,t,r){try{let i=await Kp.post(`${GF}/private/stats`,{headers:{"Content-Type":"application/json",capgkey:e},body:JSON.stringify(t)}).then(n=>n.json()).catch(n=>(console.error("Cannot get devices",n),[]));if(i?.length>0&&(r===null||r!==i[0].created_at))return i}catch(i){T.error(`Cannot get stats ${le(i)}`)}return[]}async function Nut(e,t,r,i,n){if(T.info(`Log from Device: ${e.device_id}`),e.action==="get")T.info("Update Sent your your device, wait until event download complete"),await qo(t,r,i,"done");else if(e.action.startsWith("download_")){let a=e.action.split("_")[1];a==="complete"?(T.info("Your bundle has been downloaded on your device, background the app now and open it again to see the update"),await qo(t,r,i,"downloaded")):a==="fail"?(T.error("Your bundle has failed to download on your device."),T.error("Please check if you have network connection and try again")):T.info(`Your bundle is downloading ${a}% ...`)}else{if(e.action==="set")return T.info("Your bundle has been set on your device \u2764\uFE0F"),await qo(t,r,i,"set"),!1;e.action==="NoChannelOrOverride"?T.error(`No default channel or override (channel/device) found, please create it here ${n}`):e.action==="needPlanUpgrade"?T.error("Your are out of quota, please upgrade your plan here https://web.capgo.app/dashboard/settings/plans"):e.action==="missingBundle"?T.error("Your bundle is missing, please check how you build your app"):e.action==="noNew"?(T.error(`The version number you uploaded to your default channel in Capgo, is the same as the present in the device ${e.device_id}.`),T.error(`To fix it, ensure the variable:
|
|
350
350
|
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
351
351
|
- Android: versionName
|
|
352
352
|
Are lower than the version number you uploaded to Capgo.`),T.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disablePlatformIos"?T.error(`iOS is disabled in the default channel and your device ${e.device_id} is an iOS device ${n}`):e.action==="disablePlatformAndroid"?T.error(`Android is disabled in the default channel and your device ${e.device_id} is an Android device ${n}`):e.action==="disableAutoUpdateToMajor"?(T.error(`The version number you uploaded to your default channel in Capgo, is a major version higher (ex: 1.0.0 in device to 2.0.0 in Capgo) than the present in the device ${e.device_id}.`),T.error("Capgo is set by default to protect you from this, and avoid sending breaking changes incompatible with the native code present in the device."),T.error(`To fix it, ensure the variable:
|
|
@@ -355,8 +355,8 @@ The app size is ${f} Mb, this may take a while to download for users
|
|
|
355
355
|
Are lower than the version number you uploaded to Capgo.`),T.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableAutoUpdateUnderNative"?(T.error(`The version number you uploaded to your default channel in Capgo, is lower than the present in the device ${e.device_id}.`),T.error(`To fix it, ensure the variable:
|
|
356
356
|
- iOS: keyCFBundleShortVersionString or MARKETING_VERSION
|
|
357
357
|
- Android: versionName
|
|
358
|
-
Are lower than the version number you uploaded to Capgo.`),T.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableDevBuild"?(T.error(`Dev build is disabled in the default channel. ${n}`),T.error("Set your channel to allow it if you wanna test your app")):e.action==="disableEmulator"?(T.error(`Emulator is disabled in the default channel. ${n}`),T.error("Set your channel to allow it if you wanna test your app")):e.action==="cannotGetBundle"?(T.error(`We cannot get your bundle from the default channel. ${n}`),T.error("Are you sure your default channel has a bundle set?")):e.action==="set_fail"?T.error(`Your bundle seems to be corrupted, try to download from ${n} to identify the issue`):e.action==="reset"?T.error("Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?"):e.action==="update_fail"?(T.error("Your bundle has been installed but failed to call notifyAppReady()"),T.error("Please check if you have network connection and try again")):e.action==="checksum_fail"?T.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo"):T.error(`Log from Capgo ${e.action}`)}return!0}async function WN(e,t,r,i,n,a){let s=!0,o=jc(r),l=`${(await k2()).hostWeb}/app/p/${o}`;await qo(e,n,i,"Use waitlog");let c={appId:r,devicesId:a?[a]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},p=null,d=Ue();for(d.start("Waiting for logs (Expect delay of 30 sec)");s;){await Tut(5e3);let f=await kut(t,c,p);if(f.length>0){p=f[0].created_at;for(let h of f)if(s=await Nut(h,e,n,i,l),!s)break}}return d.stop("Stop watching logs"),Promise.resolve()}async function l6e(e,t){re("Debug Live update in Capgo"),await Ie(),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=t.device;t.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=At(),s=await Ae(n,t.apikey);T.info("Getting active bundle in Capgo"),await tt(n,t.apikey,e,4);let o=await Mn(n,e),u=await nt({message:"Automatic check if update working in device ?"});await Fut("debug",u,s,a),u?(T.info(`Wait logs sent to Capgo from ${e} device, Please open your app \u{1F4AA}`),await WN("debug",t.apikey,e,a,o,i),ae("Done \u2705")):ae("Canceled \u274C"),ae("Done \u2705"),(0,GN.exit)()}var P6e=require("node:process");var A6e=require("node:process");var O6e=ve(yg());async function T6e(e,t,r){let{data:i,error:n}=await e.from("channels").select().eq("app_id",t).eq("version",r.id);if(n&&(T.error(`Cannot check Version ${t}@${r.name}`),$.error("")),i&&i.length>0){if(re(`\u274C Version ${t}@${r.name} is used in ${i.length} channel`),await nt({message:"unlink it?"}))for(let a of i){let s=Ue();s.start(`Unlinking channel ${a.name}`);let{error:o}=await e.from("channels").update({version:(await cR(e,t))?.id}).eq("id",a.id);o&&(s.stop(`Cannot update channel ${a.name} ${
|
|
359
|
-
${
|
|
358
|
+
Are lower than the version number you uploaded to Capgo.`),T.error("More info here: https://capgo.app/blog/how-version-work-in-capgo/#versioning-system")):e.action==="disableDevBuild"?(T.error(`Dev build is disabled in the default channel. ${n}`),T.error("Set your channel to allow it if you wanna test your app")):e.action==="disableEmulator"?(T.error(`Emulator is disabled in the default channel. ${n}`),T.error("Set your channel to allow it if you wanna test your app")):e.action==="cannotGetBundle"?(T.error(`We cannot get your bundle from the default channel. ${n}`),T.error("Are you sure your default channel has a bundle set?")):e.action==="set_fail"?T.error(`Your bundle seems to be corrupted, try to download from ${n} to identify the issue`):e.action==="reset"?T.error("Your device has been reset to the builtin bundle, did notifyAppReady() is present in the code builded and uploaded to Capgo ?"):e.action==="update_fail"?(T.error("Your bundle has been installed but failed to call notifyAppReady()"),T.error("Please check if you have network connection and try again")):e.action==="checksum_fail"?T.error("Your bundle has failed to validate checksum, please check your code and send it again to Capgo"):T.error(`Log from Capgo ${e.action}`)}return!0}async function WN(e,t,r,i,n,a){let s=!0,o=jc(r),l=`${(await k2()).hostWeb}/app/p/${o}`;await qo(e,n,i,"Use waitlog");let c={appId:r,devicesId:a?[a]:void 0,order:[{key:"created_at",sortable:"desc"}],rangeStart:new Date().toISOString()},p=null,d=Ue();for(d.start("Waiting for logs (Expect delay of 30 sec)");s;){await Tut(5e3);let f=await kut(t,c,p);if(f.length>0){p=f[0].created_at;for(let h of f)if(s=await Nut(h,e,n,i,l),!s)break}}return d.stop("Stop watching logs"),Promise.resolve()}async function l6e(e,t){re("Debug Live update in Capgo"),await Ie(),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=t.device;t.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=At(),s=await Ae(n,t.apikey);T.info("Getting active bundle in Capgo"),await tt(n,t.apikey,e,4);let o=await Mn(n,e),u=await nt({message:"Automatic check if update working in device ?"});await Fut("debug",u,s,a),u?(T.info(`Wait logs sent to Capgo from ${e} device, Please open your app \u{1F4AA}`),await WN("debug",t.apikey,e,a,o,i),ae("Done \u2705")):ae("Canceled \u274C"),ae("Done \u2705"),(0,GN.exit)()}var P6e=require("node:process");var A6e=require("node:process");var O6e=ve(yg());async function T6e(e,t,r){let{data:i,error:n}=await e.from("channels").select().eq("app_id",t).eq("version",r.id);if(n&&(T.error(`Cannot check Version ${t}@${r.name}`),$.error("")),i&&i.length>0){if(re(`\u274C Version ${t}@${r.name} is used in ${i.length} channel`),await nt({message:"unlink it?"}))for(let a of i){let s=Ue();s.start(`Unlinking channel ${a.name}`);let{error:o}=await e.from("channels").update({version:(await cR(e,t))?.id}).eq("id",a.id);o&&(s.stop(`Cannot update channel ${a.name} ${le(o)}`),(0,A6e.exit)(1)),s.stop(`\u2705 Channel ${a.name} unlinked`)}else T.error("Unlink it first"),$.error("");ae(`Version unlinked from ${i.length} channel`)}}function cR(e,t){return e.from("app_versions").select("id").eq("app_id",t).eq("name","unknown").throwOnError().single().then(({data:r,error:i})=>(i&&(T.error(`Cannot call findUnknownVersion as it returned an error.
|
|
359
|
+
${le(i)}`),$.error("")),r))}function F6e(e,t){return e.from("channels").insert(t).select().single()}function k6e(e,t,r,i){return e.from("channels").delete().eq("name",t).eq("app_id",r).single()}function N6e(e){let t=new O6e.Table({title:"Channels",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,...r.version?{Version:r.version.name}:void 0,Public:r.public?"\u2705":"\u274C",iOS:r.ios?"\u2705":"\u274C",Android:r.android?"\u2705":"\u274C","\u2B06\uFE0F limit":r.disable_auto_update,"\u2B07\uFE0F under native":r.disable_auto_update_under_native?"\u274C":"\u2705","Self assign":r.allow_device_self_set?"\u2705":"\u274C",Progressive:r.enable_progressive_deploy?"\u2705":"\u274C",...r.enable_progressive_deploy&&r.second_version?{"Next version":r.second_version.name}:void 0,...r.enable_progressive_deploy&&r.second_version?{"Next %":r.secondary_version_percentage}:void 0,"AB Testing":r.enable_ab_testing?"\u2705":"\u274C",...r.enable_ab_testing&&r.second_version?{"Version B":r.second_version.name}:void 0,...r.enable_ab_testing&&r.second_version?{"A/B %":`${(1-r.secondary_version_percentage)*100}% / ${r.secondary_version_percentage*100}%`}:void 0,Emulator:r.allow_emulator?"\u2705":"\u274C","Dev \u{1F4F1}":r.allow_dev?"\u2705":"\u274C"})}),T.success(t.render())}async function R6e(e,t){let{data:r,error:i}=await e.from("channels").select(`
|
|
360
360
|
id,
|
|
361
361
|
name,
|
|
362
362
|
public,
|
|
@@ -376,7 +376,7 @@ ${ce(i)}`),$.error("")),r))}function F6e(e,t){return e.from("channels").insert(t
|
|
|
376
376
|
app_id,
|
|
377
377
|
version (id, name)
|
|
378
378
|
`).eq("app_id",t).order("created_at",{ascending:!1});return i&&(T.error(`App ${t} not found in database`),$.error("")),r}async function pR(e,t,r,i=!0){re("Create channel"),r.apikey=r.apikey||Fe();let n=await pe();t=t||n?.config?.appId;let a=At();r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let s=await Se(r.apikey);await Ae(s,r.apikey,["write","all"]),await tt(s,r.apikey,t,4),T.info(`Creating channel ${t}#${e} to Capgo`);try{let o=await cR(s,t),u=await Mn(s,t);o||(T.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),$.error(""));let l=await F6e(s,{name:e,app_id:t,version:o.id,owner_org:u});l.error&&(T.error(`Cannot create Channel \u{1F640}
|
|
379
|
-
${
|
|
379
|
+
${le(l.error)}`),$.error("")),T.success("Channel created \u2705"),await a.track({channel:"channel",event:"Create channel",icon:"\u2705",user_id:u,tags:{"app-id":t,channel:e},notify:!1}).catch()}catch{return T.error("Cannot create Channel \u{1F640}"),!1}return i&&(ae("Done \u2705"),(0,P6e.exit)()),!0}async function I6e(e,t,r){pR(e,t,r,!0)}var r4e=require("node:crypto"),xs=require("node:fs"),i4e=require("node:process");var _R=ve(_9());function vg(e,t,r=0){r=Math.max(0,Math.min(r,t.byteLength));let i=t.byteLength-r;return e.byteLength>i&&(e=e.subarray(0,i)),t.set(e,r),e.byteLength}var s5=32*1024,dR=2**32-2,o5=class{#e;#t=0;constructor(t){this.#e=t===void 0?new Uint8Array(0):new Uint8Array(t)}bytes(t={copy:!0}){return t.copy===!1?this.#e.subarray(this.#t):this.#e.slice(this.#t)}empty(){return this.#e.byteLength<=this.#t}get length(){return this.#e.byteLength-this.#t}get capacity(){return this.#e.buffer.byteLength}truncate(t){if(t===0){this.reset();return}if(t<0||t>this.length)throw Error("bytes.Buffer: truncation out of range");this.#r(this.#t+t)}reset(){this.#r(0),this.#t=0}#n(t){let r=this.#e.byteLength;return t<=this.capacity-r?(this.#r(r+t),r):-1}#r(t){if(t>this.#e.buffer.byteLength)throw new RangeError("Length is greater than buffer capacity");this.#e=new Uint8Array(this.#e.buffer,0,t)}readSync(t){if(this.empty())return this.reset(),t.byteLength===0?0:null;let r=vg(this.#e.subarray(this.#t),t);return this.#t+=r,r}read(t){let r=this.readSync(t);return Promise.resolve(r)}writeSync(t){let r=this.#i(t.byteLength);return vg(t,this.#e,r)}write(t){let r=this.writeSync(t);return Promise.resolve(r)}#i(t){let r=this.length;r===0&&this.#t!==0&&this.reset();let i=this.#n(t);if(i>=0)return i;let n=this.capacity;if(t<=Math.floor(n/2)-r)vg(this.#e.subarray(this.#t),this.#e);else{if(n+t>dR)throw new Error("The buffer cannot be grown beyond the maximum size.");{let a=new Uint8Array(Math.min(2*n+t,dR));vg(this.#e.subarray(this.#t),a),this.#e=a}}return this.#t=0,this.#r(Math.min(r+t,dR)),r}grow(t){if(t<0)throw Error("Buffer.grow: negative count");let r=this.#i(t);this.#r(r)}async readFrom(t){let r=0,i=new Uint8Array(s5);for(;;){let n=this.capacity-this.length<s5,a=n?i:new Uint8Array(this.#e.buffer,this.length),s=await t.read(a);if(s===null)return r;n?this.writeSync(a.subarray(0,s)):this.#r(this.length+s),r+=s}}readFromSync(t){let r=0,i=new Uint8Array(s5);for(;;){let n=this.capacity-this.length<s5,a=n?i:new Uint8Array(this.#e.buffer,this.length),s=t.readSync(a);if(s===null)return r;n?this.writeSync(a.subarray(0,s)):this.#r(this.length+s),r+=s}}};var u5=class extends TransformStream{constructor(t){let r=new o5;r.grow(t),super({start(){},async transform(i,n){for(r.write(i);r.length>=t;){let a=new Uint8Array(t),s=await r.read(a);if(s!==t)throw new Error(`Unexpectedly read ${s} bytes from transform buffer when trying to read ${t} bytes.`);n.enqueue(a)}},flush(i){r.length&&i.enqueue(r.bytes())}})}};function al(e){return e=e.trim(),e=e.replace(/<!--[\s\S]*?-->/g,""),t();function t(){return{declaration:r(),root:i()}}function r(){if(!u(/^<\?xml\s*/))return;let d={attributes:{}};for(;!(l()||c("?>"));){let f=a();if(!f)return d;d.attributes[f.name]=f.value}return u(/\?>\s*/),d}function i(){let p=u(/^<([\w-:.]+)\s*/);if(!p)return;let d={name:p[1],attributes:{},children:[]};for(;!(l()||c(">")||c("?>")||c("/>"));){let h=a();if(!h)return d;d.attributes[h.name]=h.value}if(u(/^\s*\/>\s*/))return d;u(/\??>\s*/),d.content=n();let f;for(;f=i();)d.children.push(f);return u(/^<\/[\w-:.]+>\s*/),d}function n(){let p=u(/^([^<]*)/);return p?o(p[1]):""}function a(){let p=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(p)return{name:p[1],value:o(s(p[2]))}}function s(p){return p.replace(/^['"]|['"]$/g,"")}function o(p){return p.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function u(p){let d=e.match(p);if(d)return e=e.slice(d[0].length),d}function l(){return e.length==0}function c(p){return e.indexOf(p)==0}}var Es=class extends Error{constructor(t){super(t)}};var Kn=class extends Es{},l5=class extends Es{},c5=class extends Es{},Mo=class extends Es{},up=class extends Es{},_g=class extends Es{},wg=class extends Es{},Uo=class extends Es{statusCode;code;key;bucketName;resource;region;constructor(t,r,i,n={}){super(i),this.statusCode=t,this.code=r,this.key=n.key,this.bucketName=n.bucketName,this.resource=n.resource,this.region=n.region}};async function L6e(e){try{let r=al(await e.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let i=r.children.find(l=>l.name==="Code")?.content??"UnknownErrorCode",n=r.children.find(l=>l.name==="Message")?.content??"The error message could not be determined.",a=r.children.find(l=>l.name==="Key")?.content,s=r.children.find(l=>l.name==="BucketName")?.content,o=r.children.find(l=>l.name==="Resource")?.content,u=r.children.find(l=>l.name==="Region")?.content;return new Uo(e.status,i,n,{key:a,bucketName:s,resource:o,region:u})}catch{return new Uo(e.status,"UnrecognizedError",`Error: Unexpected response code ${e.status} ${e.statusText}. Unable to parse response as XML.`)}}function B6e(e){return typeof e!="number"||isNaN(e)||e<=0?!1:e>=1&&e<=65535}function j6e(e){return typeof e!="string"||e.length<3||e.length>63||e.indexOf("..")>-1||e.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!e.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function lp(e){return!(!Plt(e)||e.length===0)}function Plt(e){return!(typeof e!="string"||e.length>1024)}function p5(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function cp(e=""){let t={'"':"",""":"",""":"",""":"",""":""};return e.replace(/^("|"|")|("|"|")$/g,r=>t[r])}function hR(e){return e.get("x-amz-version-id")??null}function bg(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,5)+t.substr(14,2)+t.substr(17,2)+"Z"}function mR(e){e=e||new Date;let t=e.toISOString();return t.substr(0,4)+t.substr(5,2)+t.substr(8,2)}function gR(e,t){return`${mR(t)}/${e}/s3/aws4_request`}async function d5(e){return e instanceof Uint8Array||(e=new TextEncoder().encode(e)),p5(new Uint8Array(await crypto.subtle.digest("SHA-256",e)))}var Ilt=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],f5=class extends WritableStream{getResult;constructor({client:t,bucketName:r,objectName:i,partSize:n,metadata:a}){let s,o=1,u,l=[],c=[];super({start(){},async write(p,d){let f="PUT",h=o++;try{if(h==1&&p.length<n){let y=await t.makeRequest({method:f,headers:new Headers({...a,"Content-Length":String(p.length)}),bucketName:r,objectName:i,payload:p});s={etag:cp(y.headers.get("etag")??void 0),versionId:hR(y.headers)};return}h===1&&(u=(await Llt({client:t,bucketName:r,objectName:i,metadata:a})).uploadId);let m={"Content-Length":String(p.length)};for(let y of Ilt){let D=a[y];D&&(m[y]=D)}let v=t.makeRequest({method:f,query:{partNumber:h.toString(),uploadId:u},headers:new Headers(m),bucketName:r,objectName:i,payload:p});v.then(y=>{let D=y.headers.get("etag")??"";D&&(D=D.replace(/^"/,"").replace(/"$/,"")),l.push({part:h,etag:D})}),c.push(v)}catch(m){throw m}},async close(){if(!s)if(u)await Promise.all(c),l.sort((p,d)=>p.part>d.part?1:-1),s=await Blt({client:t,bucketName:r,objectName:i,uploadId:u,etags:l});else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(s===void 0)throw new Error("Result is not ready. await the stream first.");return s}}};async function Llt(e){let t="POST",r=new Headers(e.metadata),a=await(await e.client.makeRequest({method:t,bucketName:e.bucketName,objectName:e.objectName,query:"uploads",headers:r,returnBody:!0})).text(),s=al(a).root;if(!s||s.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${a}`);let o=s.children.find(u=>u.name==="UploadId")?.content;if(!o)throw new Error(`Unable to get UploadId from response: ${a}`);return{uploadId:o}}async function Blt({client:e,bucketName:t,objectName:r,uploadId:i,etags:n}){let a=`
|
|
380
380
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
381
381
|
${n.map(p=>` <Part><PartNumber>${p.part}</PartNumber><ETag>${p.etag}</ETag></Part>`).join(`
|
|
382
382
|
`)}
|
|
@@ -386,7 +386,7 @@ ${ce(l.error)}`),$.error("")),T.success("Channel created \u2705"),await a.track(
|
|
|
386
386
|
`),u.push(i.join(";").toLowerCase()),u.push(n),u.join(`
|
|
387
387
|
`)}async function V6e(e,t,r){let i=await d5(e),n=gR(r,t),a=[];return a.push(yR),a.push(bg(t)),a.push(n),a.push(i),a.join(`
|
|
388
388
|
`)}async function H6e(e,t,r){let i=mR(e),n=await F1("AWS4"+r,i),a=await F1(n,t),s=await F1(a,"s3");return await F1(s,"aws4_request")}function z6e(e,t,r){return`${e}/${gR(t,r)}`}async function F1(e,t){let r=new TextEncoder,i=await crypto.subtle.importKey("raw",e instanceof Uint8Array?e:r.encode(e),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),n=await crypto.subtle.sign("HMAC",i,t instanceof Uint8Array?t:r.encode(t));return new Uint8Array(n)}var $lt=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","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"],Mlt=5*1024*1024,Ult=5*1024*1024*1024,vR=5*1024*1024*1024*1024,Dg=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;constructor(t){if(t.useSSL===void 0&&(t.useSSL=!0),typeof t.endPoint!="string"||t.endPoint.length===0||t.endPoint.indexOf("/")!==-1)throw new l5(`Invalid endPoint : ${t.endPoint}`);if(t.port!==void 0&&!B6e(t.port))throw new Kn(`Invalid port : ${t.port}`);if(t.accessKey&&!t.secretKey)throw new Kn("If specifying access key, secret key must also be provided.");if(t.accessKey&&t.accessKey.startsWith("ASIA")&&!t.sessionToken)throw new Kn("If specifying temporary access key, session token must also be provided.");let r=t.useSSL?443:80;this.port=t.port??r,this.host=t.endPoint.toLowerCase()+(this.port!==r?`:${t.port}`:""),this.protocol=t.useSSL?"https:":"http:",this.accessKey=t.accessKey,this.#e=t.secretKey??"",this.sessionToken=t.sessionToken,this.pathStyle=t.pathStyle??!0,this.defaultBucket=t.bucket,this.region=t.region}getBucketName(t){let r=t?.bucketName??this.defaultBucket;if(r===void 0||!j6e(r))throw new c5(`Invalid bucket name: ${r}`);return r}buildRequestOptions(t){let r=this.getBucketName(t),i=this.pathStyle?this.host:`${r}.${this.host}`,n=t.headers??new Headers;n.set("host",i);let a=typeof t.query=="object"?new URLSearchParams(t.query).toString().replace("+","%20"):t.query,s=(this.pathStyle?`/${r}/${t.objectName}`:`/${t.objectName}`)+(a?`?${a}`:"");return{headers:n,host:i,path:s}}async makeRequest({method:t,payload:r,...i}){let n=new Date,{headers:a,host:s,path:o}=this.buildRequestOptions(i),u=i.statusCode??200;if(t==="POST"||t==="PUT"||t==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),a.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${t} request.`);let l=await d5(r??new Uint8Array);a.set("x-amz-date",bg(n)),a.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&a.set("x-amz-security-token",this.sessionToken),a.set("authorization",await q6e({headers:a,method:t,path:o,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:n})));let c=`${this.protocol}//${s}${o}`,p=await fetch(c,{method:t,headers:a,body:r});if(p.status!==u)throw p.status>=400?await L6e(p):p.status===301?new Uo(p.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new Uo(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${u}, got ${p.status} ${p.statusText}).`);return i.returnBody||await p.body?.getReader().read(),p}async deleteObject(t,r={}){let i=this.getBucketName(r);if(!lp(t))throw new Mo(`Invalid object name: ${t}`);let n=r.versionId?{versionId:r.versionId}:{},a=new Headers;r.governanceBypass&&a.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:i,objectName:t,headers:a,query:n,statusCode:204})}async exists(t,r){try{return await this.statObject(t,r),!0}catch(i){if(i instanceof Uo&&i.statusCode===404)return!1;throw i}}getObject(t,r){return this.getPartialObject(t,{...r,offset:0,length:0})}async getPartialObject(t,{offset:r,length:i,...n}){let a=this.getBucketName(n);if(!lp(t))throw new Mo(`Invalid object name: ${t}`);let s=new Headers(Object.entries(n.metadata??{})),o=200;if(r||i){let l="";r?l=`bytes=${+r}-`:(l="bytes=0-",r=0),i&&(l+=`${+i+r-1}`),s.set("Range",l),o=206}let u={...n.responseParams,...n.versionId?{versionId:n.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:a,objectName:t,headers:s,query:u,statusCode:o,returnBody:!0})}getPresignedUrl(t,r,i={}){if(!this.accessKey)throw new up(`Presigned ${t} URLs cannot be generated for anonymous requests. Specify an accessKey and secretKey.`);if(!lp(r))throw new Mo(`Invalid object name: ${r}`);let{headers:n,path:a}=this.buildRequestOptions({objectName:r,bucketName:i.bucketName,query:i.parameters}),s=i.requestDate??new Date,o=i.expirySeconds??24*60*60*7;return $6e({protocol:this.protocol,headers:n,method:t,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:s,expirySeconds:o})}presignedGetObject(t,r={}){let{versionId:i,responseParams:n,...a}=r,s={...n,...i?{versionId:i}:{}};return this.getPresignedUrl("GET",t,{parameters:s,...a})}async*listObjects(t={}){for await(let r of this.listObjectsGrouped({...t,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(t){let r=this.getBucketName(t),i="",n=t.pageSize??1e3;if(n<1||n>1e3)throw new Kn("pageSize must be between 1 and 1,000.");let a=0;for(;;){let s=t.maxResults?Math.min(n,t.maxResults-a):n;if(s===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:t.prefix??"",delimiter:t.delimiter,"max-keys":String(s),...i?{"continuation-token":i}:{}},returnBody:!0})).text(),l=al(u).root;if(!l||l.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let c=l.children.filter(f=>f.name==="CommonPrefixes").flatMap(f=>f.children),p=[];for(let f of c)p.push({type:"CommonPrefix",prefix:f.content??""}),a++;for(let f of l.children.filter(h=>h.name==="Contents"))p.push({type:"Object",key:f.children.find(h=>h.name==="Key")?.content??"",etag:cp(f.children.find(h=>h.name==="ETag")?.content??""),size:parseInt(f.children.find(h=>h.name==="Size")?.content??"",10),lastModified:new Date(f.children.find(h=>h.name==="LastModified")?.content??"invalid")}),a++;p.sort((f,h)=>{let m=f.type==="Object"?f.key:f.prefix,v=h.type==="Object"?h.key:h.prefix;return m>v?1:m<v?-1:0});for(let f of p)yield f;if(l.children.find(f=>f.name==="IsTruncated")?.content==="true"){let f=l.children.find(h=>h.name==="NextContinuationToken")?.content;if(!f)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");i=f}else return}}async putObject(t,r,i){let n=this.getBucketName(i);if(!lp(t))throw new Mo(`Invalid object name: ${t}`);let a,s;if(typeof r=="string"){let c=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?s=ReadableStream.from([c]):s=new ReadableStream({start(p){p.enqueue(c),p.close()}}),a=c.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?s=ReadableStream.from([r]):s=new ReadableStream({start(c){c.enqueue(r),c.close()}}),a=r.byteLength;else if(r instanceof ReadableStream)s=r;else throw new Kn("Invalid stream/data type provided.");if(i?.size!==void 0){if(a!==void 0&&i?.size!==a)throw new Kn(`size was specified (${i.size}) but doesn't match auto-detected size (${a}).`);if(typeof i.size!="number"||i.size<0||isNaN(i.size))throw new Kn(`invalid size specified: ${i.size}`);a=i.size}let o=i?.partSize??this.calculatePartSize(a);if(o<Mlt)throw new Kn("Part size should be greater than 5MB");if(o>Ult)throw new Kn("Part size should be less than 6MB");let u=new u5(o),l=new f5({client:this,bucketName:n,objectName:t,partSize:o,metadata:i?.metadata??{}});return await s.pipeThrough(u).pipeTo(l),l.getResult()}calculatePartSize(t){if(t===void 0&&(t=vR),t>vR)throw new TypeError(`size should not be more than ${vR}`);let r=64*1024*1024;for(;;){if(r*1e4>t)return r;r+=16*1024*1024}}async statObject(t,r){let i=this.getBucketName(r);if(!lp(t))throw new Mo(`Invalid object name: ${t}`);let n={};r?.versionId&&(n.versionId=r.versionId);let a=await this.makeRequest({method:"HEAD",bucketName:i,objectName:t,query:n}),s={};for(let o of $lt)a.headers.has(o)&&(s[o]=a.headers.get(o));return a.headers.forEach((o,u)=>{u.startsWith("x-amz-meta-")&&(s[u]=a.headers.get(u))}),{type:"Object",key:t,size:parseInt(a.headers.get("content-length")??"",10),metadata:s,lastModified:new Date(a.headers.get("Last-Modified")??"error: missing last modified"),versionId:a.headers.get("x-amz-version-id")||null,etag:cp(a.headers.get("ETag")??"")}}async copyObject(t,r,i){let n=this.getBucketName(i),a=t.sourceBucketName??n;if(!lp(r))throw new Mo(`Invalid object name: ${r}`);let s=`${a}/${t.sourceKey}`;t.sourceVersionId&&(s+=`?versionId=${t.sourceVersionId}`);let o=new Headers(i?.metadata);i?.metadata!==void 0&&o.set("x-amz-metadata-directive","REPLACE"),o.set("x-amz-copy-source",s);let u=await this.makeRequest({method:"PUT",bucketName:n,objectName:r,headers:o,returnBody:!0}),l=await u.text(),c=al(l).root;if(!c||c.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${l}`);let p=c.children.find(f=>f.name==="ETag")?.content??"",d=c.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:cp(p),lastModified:new Date(d),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(t){try{return await this.listObjects({bucketName:t}).next(),!0}catch(r){if(r instanceof Uo&&r.statusCode===404)return!1;throw r}}async makeBucket(t){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:t}),objectName:"",statusCode:200})}async removeBucket(t){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:t}),objectName:"",statusCode:204})}};var ti=require("node:crypto"),dp=require("node:buffer"),G6e="aes-128-cbc",sl="base64",h5=ti.constants.RSA_PKCS1_PADDING;function W6e(e,t,r){let[i,n]=t.split(":"),a=(0,ti.publicDecrypt)({key:r,padding:h5},dp.Buffer.from(n,sl)),s=dp.Buffer.from(i,sl),o=(0,ti.createDecipheriv)(G6e,a,s);return o.setAutoPadding(!0),dp.Buffer.concat([o.update(e),o.final()])}function m5(e,t){return(0,ti.privateEncrypt)({key:t,padding:h5},dp.Buffer.from(e,sl)).toString(sl)}function K6e(e,t){return(0,ti.publicDecrypt)({key:t,padding:h5},dp.Buffer.from(e,sl)).toString(sl)}function g5(e,t){let r=(0,ti.randomBytes)(16),i=(0,ti.randomBytes)(16),n=(0,ti.createCipheriv)(G6e,i,r);n.setAutoPadding(!0);let a=r.toString(sl),s=(0,ti.privateEncrypt)({key:t,padding:h5},i).toString(sl),o=`${a}:${s}`;return{encryptedData:dp.Buffer.concat([n.update(e),n.final()]),ivSessionKey:o}}var Y6e=require("node:fs"),X6e=require("node:zlib"),J6e=require("node:stream/consumers"),Z6e=require("node:path");var Q6e=ve(GS());async function e4e(e,t,r,i){let n=Ue();n.start("Generating the update manifest");let a=await Ffe(e);return n.stop("Manifest generated successfully"),await t.track({channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":i},notify:!1}).catch(),a}async function t4e(e,t,r,i,n,a){let s=Ue();s.start("Preparing partial update");let o=At(),u=0,l=t.length,c=t.map(async p=>{let d=(0,Z6e.join)(r,p.file),f=(0,Y6e.createReadStream)(d).pipe((0,X6e.createGzip)({level:9})),h=await(0,J6e.buffer)(f);return new Promise((m,v)=>{new Q6e.Upload(h,{endpoint:"https://api.capgo.app/private/files/upload/attachments/",metadata:{filename:`orgs/${a}/apps/${i}/${n}/${p.file}`,filetype:"application/gzip"},headers:{Authorization:e},onError(D){T.error(`Failed to upload ${p.file}: ${D}`),v(D)},onProgress(){let D=(u/l*100).toFixed(2);s.message(`Uploading partial update: ${D}%`)},onSuccess(){u++,m({file_name:p.file,s3_path:`orgs/${a}/apps/${i}/${n}/${p.file}`,file_hash:p.hash})}}).start()})});try{let p=await Promise.all(c);return s.stop("Partial update uploaded successfully"),await o.track({channel:"app",event:"App Partial TUS done",icon:"\u23EB",user_id:a,tags:{"app-id":i},notify:!1}).catch(),p}catch(p){return s.stop("Partial update failed"),T.error(`Error uploading partial update: ${p}`),null}}async function Vlt(e,t){let r=await mi(),i=t.bundle||e?.plugins?.CapacitorUpdater?.version||r?.version||`0.0.1-beta.${(0,r4e.randomUUID)().split("-")[0]}`;return t1.test(i)||(T.error(`Your bundle name ${i}, is not valid it should follow semver convention : https://semver.org/`),$.error("")),i}function Hlt(e){let t=e.apikey||Fe();return t||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t}function zlt(e,t,r){let i=e||r?.plugins?.CapacitorUpdater?.appId||r?.appId,n=t.path||r?.webDir;return(!i||!n)&&(T.error("Missing argument, you need to provide a appid and a path (--path), or be in a capacitor project"),$.error("")),(0,xs.existsSync)(n)||(T.error(`Path ${n} does not exist, build your app first, or provide a valid path`),$.error("")),{appid:i,path:n}}function Glt(e,t){let r=e.codeCheck;(typeof r>"u"||r)&&(lg(t,"notifyAppReady")||(T.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),$.error("")),cg(t)||(T.error("index.html is missing in the root folder or in the only folder in the root folder"),$.error("")))}async function Wlt(e,t,r,i,n,a){let s=r.ignoreMetadataCheck,o=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:l,error:c}=await e.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",i).eq("app_id",n).single(),p=!!l&&l.disable_auto_update==="version_number",d,f;if(!c&&l&&l.version&&l.version.native_packages&&!s){let v=Ue();v.start(`Checking bundle compatibility with channel ${i}`);let{finalCompatibility:y,localDependencies:D}=await i9(e,n,i);if(f=y,d=D,f.find(b=>b.localVersion!==b.remoteVersion))v.stop(`Bundle NOT compatible with ${i} channel`),T.warn(`You can check compatibility with "${t.runner} @capgo/cli bundle compatibility"`),o&&(u=a,T.info(`Auto set min-update-version to ${u}`));else if(o)try{let{minUpdateVersion:b}=l.version;(!b||!t1.test(b))&&(T.error("Invalid remote min update version, skipping auto setting compatibility"),$.error("")),u=b,v.stop(`Auto set min-update-version to ${u}`)}catch{T.error(`Cannot auto set compatibility, invalid data ${l}`),$.error("")}else v.stop(`Bundle compatible with ${i} channel`)}else s||(T.warn(`Channel ${i} is new or it's your first upload with compatibility check, it will be ignored this time`),d=await JF(),o&&(u=a,T.info(`Auto set min-update-version to ${u}`)));p&&!u&&!s&&(T.error("You need to provide a min-update-version to upload a bundle to this channel"),$.error("")),u&&(t1.test(u)||(T.error(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`),$.error("")));let h=d?new Map(d.filter(v=>!!v.native&&v.native!==void 0).map(v=>[v.name,v])):new Map;return{nativePackages:h.size>0||!r.ignoreMetadataCheck?Array.from(h,([v,y])=>({name:v,version:y.version})):void 0,minUpdateVersion:u}}async function Klt(e,t,r){let{data:i,error:n}=await e.rpc("is_trial_org",{orgid:t}).single();(i&&i>0||n)&&(T.warn(`WARNING !!
|
|
389
|
-
Trial expires in ${i} days`),T.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${t}`))}async function Ylt(e,t,r){let{data:i,error:n}=await e.rpc("exist_app_versions",{appid:t,apikey:"",name_version:r}).single();(i||n)&&(T.error(`Version already exists ${
|
|
389
|
+
Trial expires in ${i} days`),T.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${t}`))}async function Ylt(e,t,r){let{data:i,error:n}=await e.rpc("exist_app_versions",{appid:t,apikey:"",name_version:r}).single();(i||n)&&(T.error(`Version already exists ${le(n)}`),$.error(""))}async function Xlt(e,t,r,i,n,a){let s,o="",u=null,l=t.key,c=t.keyV2;u=await t9(e);let p=Ue();if(p.start("Calculating checksum"),c||(0,xs.existsSync)(on)?o=await(0,_R.checksum)(u,"sha256"):o=await(0,_R.checksum)(u,"crc32"),p.stop(`Checksum: ${o}`),l===!1)T.info("Encryption ignored");else if((c||(0,xs.existsSync)(on))&&!t.oldEncryption){let f=typeof c=="string"?c:on,h=t.keyDataV2||"";!h&&!(0,xs.existsSync)(f)&&(T.error(`Cannot find private key ${f}`),$.error("")),await i.track({channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":a},notify:!1}).catch(),h||(h=(0,xs.readFileSync)(f).toString()),T.info("Encrypting your bundle with V2");let m=g5(u,h);o=m5(o,h),s=m.ivSessionKey,t.displayIvSession&&T.info(`Your Iv Session key is ${s},
|
|
390
390
|
keep it safe, you will need it to decrypt your bundle.
|
|
391
391
|
It will be also visible in your dashboard
|
|
392
392
|
`),u=m.encryptedData}else if(l||(0,xs.existsSync)(un)){let f=typeof l=="string"?l:un,h=t.keyData||"";!h&&!(0,xs.existsSync)(f)&&(T.error(`Cannot find public key ${f}`),$.error("")),await i.track({channel:"app",event:"App encryption",icon:"\u{1F511}",user_id:n,tags:{"app-id":a},notify:!1}).catch(),h||(h=(0,xs.readFileSync)(f).toString()),T.info("Encrypting your bundle");let m=t5(u,h);s=m.ivSessionKey,t.displayIvSession&&T.info(`Your Iv Session key is ${s},
|
|
@@ -395,10 +395,10 @@ It will be also visible in your dashboard
|
|
|
395
395
|
`),u=m.encryptedData}let d=Math.floor((u?.byteLength??0)/1024/1024);return d>bfe&&(T.warn(`WARNING !!
|
|
396
396
|
The app size is ${d} Mb, this may take a while to download for users
|
|
397
397
|
`),T.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
398
|
-
`),await i.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":a},notify:!1}).catch()),{zipped:u,sessionKey:s,checksum:o}}async function Jlt(e,t,r,i,n,a,s){let o=Ue();o.start("Uploading Bundle");let u=performance.now();try{if(s.tus!==void 0&&s.tus
|
|
398
|
+
`),await i.track({channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:n,tags:{"app-id":a},notify:!1}).catch()),{zipped:u,sessionKey:s,checksum:o}}async function Jlt(e,t,r,i,n,a,s){let o=Ue();o.start("Uploading Bundle");let u=performance.now();try{if(s.tus!==void 0&&s.tus){T.info("Uploading bundle as TUS"),await XF(e,a,n,r,i,o);let p=`orgs/${n}/apps/${r}/${i}.zip`,{error:d}=await t.from("app_versions").update({r2_path:p}).eq("id",i);d&&(T.error(`Cannot finish TUS upload ${le(d)}`),$.error(""))}if(s.multipart!==void 0&&s.multipart)T.info("Uploading bundle as TUS, multipart is deprecated"),await XF(e,a,n,r,i,o);else{let p=await Tfe(t,r,i);p||(T.error("Cannot get upload url"),$.error("")),await Kp.put(p,{timeout:s.timeout||Dfe,retry:5,body:a})}}catch(p){let f=((performance.now()-u)/1e3).toFixed(2);if(o.stop(`Failed to upload bundle ( after ${f} seconds)`),T.error(`Cannot upload bundle ( try again with --tus option) ${le(p)}`),p instanceof uu){let h=await p.response.text();T.error(`Response: ${le(h)}`)}await kfe(t,r,i),$.error("")}let c=((performance.now()-u)/1e3).toFixed(2);o.stop(`Bundle Uploaded \u{1F4AA} (${c} seconds)`)}async function Zlt(e,t,r,i,n,a,s,o,u){let{data:l}=await e.rpc("get_app_versions",{apikey:t,name_version:i,appid:o}).single();l||(T.warn("Cannot get version id, cannot set channel"),$.error(""));let{error:c,data:p}=await r9(e,{name:n,app_id:o,created_by:a,version:l,owner_org:s});c&&(T.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${le(c)}`),$.error(""));let d=jc(o),f=`${u.hostWeb}/app/p/${d}/channel/${p.id}`;p?.public?T.info("Your update is now available in your public channel \u{1F389}"):p?.id&&T.info(`Link device to this bundle to try it: ${f}`),r?T.info(`Bundle url: ${f}`):l||(T.warn("Cannot set bundle with upload key, use key with more rights for that"),$.error(""))}async function Qlt(e,t){let{error:r,data:i}=await t.from("apps").select("default_upload_channel").single();if(r){T.error("Cannot find default upload channel");let n=jc(e);return T.info(`You can set it here: https://web.capgo.app/app/p/${n}/settings`),null}return i.default_upload_channel}async function y5(e,t,r=!0){re("Uploading");let i=gi();await Ie();let{s3Region:n,s3Apikey:a,s3Apisecret:s,s3BucketName:o,s3Endpoint:u,s3Port:l,s3SSL:c}=t,p=Hlt(t),d=await pe(),{appid:f,path:h}=zlt(e,t,d.config),m=await Vlt(d.config,t),v=At();Glt(t,h),T.info(`Upload ${f}@${m} started from path "${h}" to Capgo cloud`);let y=await k2(),D=await Se(p),b=await Ae(D,p,["write","all","upload"]),_=t.channel||await Qlt(f,D)||"dev",w=await Mn(D,f);await r1(D,w,p,f,!0),await Klt(D,w,y);let{nativePackages:O,minUpdateVersion:C}=await Wlt(D,i,t,_,f,m);await Ylt(D,f,m),t.external&&!t.external.startsWith("https://")&&(T.error(`External link should should start with "https://" current is "${external}"`),$.error(""));let S={name:m,app_id:f,session_key:void 0,external_url:t.external,storage_provider:t.external?"external":"r2-direct",min_update_version:C,native_packages:O,owner_org:w,user_id:b,checksum:void 0},F=null;if(t.external)await v.track({channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:w,tags:{"app-id":f},notify:!1}).catch(),S.session_key=t.ivSessionKey,S.checksum=t.encryptedChecksum;else{let{zipped:q,sessionKey:H,checksum:B}=await Xlt(h,t,y,v,w,f);S.session_key=H,S.checksum=B,F=q,t.ignoreChecksumCheck||await Rfe(D,f,_,B)}let x=t.partial?await e4e(h,v,w,f):[],{error:E}=await YF(D,S);if(E&&(T.error(`Cannot add bundle ${le(E)}`),$.error("")),F&&(o||u||n||a||s||l||c)){(!o||!u||!n||!a||!s||!l)&&(T.error("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),$.error("")),T.info("Uploading to S3");let q=new Dg({endPoint:u,region:n,port:l,useSSL:c,bucket:o,credentials:{accessKeyId:a,secretAccessKey:s}}),H=`${f}-${m}`,B=encodeURIComponent(H);await q.putObject(H,F),S.external_url=`https://${u}/${B}`,S.storage_provider="external"}else if(F){await Jlt(p,D,f,m,w,F,t);let q=null;try{q=t.partial?await t4e(p,x,h,f,m,w):null}catch(B){T.error(`Failed to upload partial files to capgo cloud. Error: ${le(B)}`)}S.storage_provider="r2",S.manifest=q;let{error:H}=await YF(D,S);H&&(T.error(`Cannot update bundle ${le(H)}`),$.error(""))}let I=await tt(D,p,f,2);return xfe(I,3)?await Zlt(D,p,!!t.bundleUrl,m,_,b,w,f,y):T.warn("Cannot set channel as a upload organization member"),await v.track({channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:w,tags:{"app-id":f},notify:!1}).catch(),r&&(ae("Time to share your update to the world \u{1F30D}"),(0,i4e.exit)()),!0}async function n4e(e,t){try{await y5(e,t,!0)}catch(r){T.error(le(r)),$.error("")}}async function a4e(e,t){let r=gi();T.warn(`\u26A0\uFE0F This command is deprecated, use "${r.runner} @capgo/cli bundle upload" instead \u26A0\uFE0F`);try{await y5(e,t,!0)}catch(i){T.error(le(i)),$.error("")}}var Vo=require("node:fs"),bR=require("node:os"),wR=require("node:process");async function s4e(){let e=(0,bR.homedir)();return(0,Vo.existsSync)(`${e}/.capgo`)||(0,Vo.existsSync)(".capgo")}async function DR(e,t,r=!0){if(r&&re("Login to Capgo"),!e)return r&&(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),!1;await Ie();try{let{local:i}=t,n=At();if(i)(0,Vo.existsSync)(".git")||(T.error("To use local you should be in a git repository"),$.error("")),(0,Vo.writeFileSync)(".capgo",`${e}
|
|
399
399
|
`),(0,Vo.appendFileSync)(".gitignore",`.capgo
|
|
400
400
|
`);else{let o=(0,bR.homedir)();(0,Vo.writeFileSync)(`${o}/.capgo`,`${e}
|
|
401
|
-
`)}let a=await Se(e),s=await Ae(a,e,["write","all","upload"]);await n.track({channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),T.success(`login saved into .capgo file in ${i?"local":"home"} directory`)}catch{T.error("Error while saving login"),(0,wR.exit)(1)}return r&&(ae("Done \u2705"),(0,wR.exit)()),!0}async function o4e(e,t){DR(e,t,!0)}var R1=require("node:fs"),d4e=require("node:process");var u4e={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(u4e);var l4e=u4e;var c4e={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(c4e);var p4e=c4e;var Yn=function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)},k1,Eg,fp,ER=class{constructor(...t){k1.set(this,new Map),Eg.set(this,new Map),fp.set(this,new Map);for(let r of t)this.define(r)}define(t,r=!1){for(let[i,n]of Object.entries(t)){i=i.toLowerCase(),n=n.map(o=>o.toLowerCase()),Yn(this,fp,"f").has(i)||Yn(this,fp,"f").set(i,new Set);let a=Yn(this,fp,"f").get(i),s=!0;for(let o of n){let u=o.startsWith("*");if(o=u?o.slice(1):o,a?.add(o),s&&Yn(this,Eg,"f").set(i,o),s=!1,u)continue;let l=Yn(this,k1,"f").get(o);if(l&&l!=i&&!r)throw new Error(`"${i} -> ${o}" conflicts with "${l} -> ${o}". Pass \`force=true\` to override this definition.`);Yn(this,k1,"f").set(o,i)}}return this}getType(t){if(typeof t!="string")return null;let r=t.replace(/^.*[/\\]/,"").toLowerCase(),i=r.replace(/^.*\./,"").toLowerCase(),n=r.length<t.length;return!(i.length<r.length-1)&&n?null:Yn(this,k1,"f").get(i)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&Yn(this,Eg,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:Yn(this,fp,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let t of Yn(this,fp,"f").values())Object.freeze(t);return this}_getTestState(){return{types:Yn(this,k1,"f"),extensions:Yn(this,Eg,"f")}}};k1=new WeakMap,Eg=new WeakMap,fp=new WeakMap;var xR=ER;var N1=new xR(p4e,l4e)._freeze();async function ect(e,t,r=!0){await CR(e,t,void 0,r)}async function CR(e,t,r,i=!0){i&&re("Adding"),await Ie(),t.apikey=t.apikey||Fe();let n=await pe();e=e||n?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error("")),e.includes("--")&&(T.error('The app id includes illegal symbols. You cannot use "--" in the app id'),$.error(""));let a=await Se(t.apikey);await Ae(a,t.apikey,["write","all"]),await u6e(a,e)&&(T.error(`App ${e} already exist`),$.error("")),r||(r=await i1(a,["admin","super_admin"]));let o=r.gid;await r1(a,o,t.apikey,void 0,!1);let{name:u,icon:l}=t;u=u||n.config?.appName||"Unknown",l=l||"resources/icon.png",(!l||!u)&&(T.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),$.error("")),i&&T.info(`Adding ${e} to Capgo`);let c,p;l&&(0,R1.existsSync)(l)?(c=(0,R1.readFileSync)(l),p=N1.getType(l)||"image/png",T.warn(`Found app icon ${l}`)):(0,R1.existsSync)(Gn)?(c=(0,R1.readFileSync)(Gn),p=N1.getType(Gn)||"image/png",T.warn(`Found app icon ${Gn}`)):T.warn(`Cannot find app icon in any of the following locations: ${l}, ${Gn}`);let d="icon",f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&p){let{error:v}=await a.storage.from(`images/org/${o}/${e}`).upload(d,c,{contentType:p});v&&(console.error(v),T.error(`Could not add app ${ce(v)}`),$.error(""));let{data:y}=await a.storage.from(`images/org/${o}/${e}`).getPublicUrl(d);f=y?.publicUrl||f}let{error:h}=await a.from("apps").insert({icon_url:f,owner_org:o,name:u,app_id:e});h&&(T.error(`Could not add app ${ce(h)}`),$.error(""));let{error:m}=await a.from("app_versions").insert([{owner_org:o,deleted:!0,name:"unknown",app_id:e},{owner_org:o,deleted:!0,name:"builtin",app_id:e}]);return m&&(T.error(`Could not add app ${ce(m)}`),$.error("")),T.success(`App ${e} added to Capgo. ${i?"You can upload a bundle now":""}`),i&&(ae("Done \u2705"),(0,d4e.exit)()),!0}async function f4e(e,t){ect(e,t,!0)}var h4e="import { CapacitorUpdater } from '@capgo/capacitor-updater'",v5="CapacitorUpdater.notifyAppReady()",tct=/import.*from.*/g,xg="production",m4e={stdio:"pipe"},P1;function g4e(){P1||(P1=(0,rr.readdirSync)(b5.default.tmpdir).map(e=>({name:e,full:`${b5.default.tmpdir}/${e}`})).find(e=>e.name.startsWith("capgocli"))?.full??b5.default.fileSync({prefix:"capgocli"}).name)}function ol(e){try{g4e(),(0,rr.writeFileSync)(P1,JSON.stringify({step_done:e}))}catch(t){T.error(`Cannot mark step as done in the CLI, error:
|
|
401
|
+
`)}let a=await Se(e),s=await Ae(a,e,["write","all","upload"]);await n.track({channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:s,notify:!1}).catch(),T.success(`login saved into .capgo file in ${i?"local":"home"} directory`)}catch{T.error("Error while saving login"),(0,wR.exit)(1)}return r&&(ae("Done \u2705"),(0,wR.exit)()),!0}async function o4e(e,t){DR(e,t,!0)}var R1=require("node:fs"),d4e=require("node:process");var u4e={"application/prs.cww":["cww"],"application/prs.xsf+xml":["xsf"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["*xfdf"],"application/vnd.age":["age"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["*fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["*mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.pwg-xhtml-print+xml":["xhtm"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml","uo"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["*prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["*sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["*aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif","btf"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.cld":["cld"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.pytha.pyox":["pyo","pyox"],"model/vnd.sap.vds":["vds"],"model/vnd.usda":["usda"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.familysearch.gedcom":["ged"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};Object.freeze(u4e);var l4e=u4e;var c4e={"application/andrew-inset":["ez"],"application/appinstaller":["appinstaller"],"application/applixware":["aw"],"application/appx":["appx"],"application/appxbundle":["appxbundle"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/automationml-aml+xml":["aml"],"application/automationml-amlx+zip":["amlx"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cpl+xml":["cpl"],"application/cu-seeme":["cu"],"application/cwl":["cwl"],"application/dash+xml":["mpd"],"application/dash-patch+xml":["mpp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdf":["fdf"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["*js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/media-policy-dataset+xml":["mpf"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["*mp4","*mpg4","mp4s","m4p"],"application/msix":["msix"],"application/msixbundle":["msixbundle"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-keys":["asc"],"application/pgp-signature":["sig","*asc"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/sql":["sql"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/watcherinfo+xml":["wif"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xfdf":["xfdf"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/aac":["adts","aac"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avci":["avci"],"image/avcs":["avcs"],"image/avif":["avif"],"image/bmp":["bmp","dib"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/dpx":["dpx"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm","jpgm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/jt":["jt"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/prc":["prc"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/u3d":["u3d"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/javascript":["js","mjs"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["md","markdown"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/wgsl":["wgsl"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","*jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]};Object.freeze(c4e);var p4e=c4e;var Yn=function(e,t,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)},k1,Eg,fp,ER=class{constructor(...t){k1.set(this,new Map),Eg.set(this,new Map),fp.set(this,new Map);for(let r of t)this.define(r)}define(t,r=!1){for(let[i,n]of Object.entries(t)){i=i.toLowerCase(),n=n.map(o=>o.toLowerCase()),Yn(this,fp,"f").has(i)||Yn(this,fp,"f").set(i,new Set);let a=Yn(this,fp,"f").get(i),s=!0;for(let o of n){let u=o.startsWith("*");if(o=u?o.slice(1):o,a?.add(o),s&&Yn(this,Eg,"f").set(i,o),s=!1,u)continue;let l=Yn(this,k1,"f").get(o);if(l&&l!=i&&!r)throw new Error(`"${i} -> ${o}" conflicts with "${l} -> ${o}". Pass \`force=true\` to override this definition.`);Yn(this,k1,"f").set(o,i)}}return this}getType(t){if(typeof t!="string")return null;let r=t.replace(/^.*[/\\]/,"").toLowerCase(),i=r.replace(/^.*\./,"").toLowerCase(),n=r.length<t.length;return!(i.length<r.length-1)&&n?null:Yn(this,k1,"f").get(i)??null}getExtension(t){return typeof t!="string"?null:(t=t?.split?.(";")[0],(t&&Yn(this,Eg,"f").get(t.trim().toLowerCase()))??null)}getAllExtensions(t){return typeof t!="string"?null:Yn(this,fp,"f").get(t.toLowerCase())??null}_freeze(){this.define=()=>{throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances")},Object.freeze(this);for(let t of Yn(this,fp,"f").values())Object.freeze(t);return this}_getTestState(){return{types:Yn(this,k1,"f"),extensions:Yn(this,Eg,"f")}}};k1=new WeakMap,Eg=new WeakMap,fp=new WeakMap;var xR=ER;var N1=new xR(p4e,l4e)._freeze();async function ect(e,t,r=!0){await CR(e,t,void 0,r)}async function CR(e,t,r,i=!0){i&&re("Adding"),await Ie(),t.apikey=t.apikey||Fe();let n=await pe();e=e||n?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error("")),e.includes("--")&&(T.error('The app id includes illegal symbols. You cannot use "--" in the app id'),$.error(""));let a=await Se(t.apikey);await Ae(a,t.apikey,["write","all"]),await u6e(a,e)&&(T.error(`App ${e} already exist`),$.error("")),r||(r=await i1(a,["admin","super_admin"]));let o=r.gid;await r1(a,o,t.apikey,void 0,!1);let{name:u,icon:l}=t;u=u||n.config?.appName||"Unknown",l=l||"resources/icon.png",(!l||!u)&&(T.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),$.error("")),i&&T.info(`Adding ${e} to Capgo`);let c,p;l&&(0,R1.existsSync)(l)?(c=(0,R1.readFileSync)(l),p=N1.getType(l)||"image/png",T.warn(`Found app icon ${l}`)):(0,R1.existsSync)(Gn)?(c=(0,R1.readFileSync)(Gn),p=N1.getType(Gn)||"image/png",T.warn(`Found app icon ${Gn}`)):T.warn(`Cannot find app icon in any of the following locations: ${l}, ${Gn}`);let d="icon",f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&p){let{error:v}=await a.storage.from(`images/org/${o}/${e}`).upload(d,c,{contentType:p});v&&(console.error(v),T.error(`Could not add app ${le(v)}`),$.error(""));let{data:y}=await a.storage.from(`images/org/${o}/${e}`).getPublicUrl(d);f=y?.publicUrl||f}let{error:h}=await a.from("apps").insert({icon_url:f,owner_org:o,name:u,app_id:e});h&&(T.error(`Could not add app ${le(h)}`),$.error(""));let{error:m}=await a.from("app_versions").insert([{owner_org:o,deleted:!0,name:"unknown",app_id:e},{owner_org:o,deleted:!0,name:"builtin",app_id:e}]);return m&&(T.error(`Could not add app ${le(m)}`),$.error("")),T.success(`App ${e} added to Capgo. ${i?"You can upload a bundle now":""}`),i&&(ae("Done \u2705"),(0,d4e.exit)()),!0}async function f4e(e,t){ect(e,t,!0)}var h4e="import { CapacitorUpdater } from '@capgo/capacitor-updater'",v5="CapacitorUpdater.notifyAppReady()",tct=/import.*from.*/g,xg="production",m4e={stdio:"pipe"},P1;function g4e(){P1||(P1=(0,rr.readdirSync)(b5.default.tmpdir).map(e=>({name:e,full:`${b5.default.tmpdir}/${e}`})).find(e=>e.name.startsWith("capgocli"))?.full??b5.default.fileSync({prefix:"capgocli"}).name)}function ol(e){try{g4e(),(0,rr.writeFileSync)(P1,JSON.stringify({step_done:e}))}catch(t){T.error(`Cannot mark step as done in the CLI, error:
|
|
402
402
|
${t}`),T.warn("Onboarding will continue but please report it to the capgo team!")}}async function rct(e,t){try{g4e();let r=(0,rr.readFileSync)(P1,"utf-8");if(!r||r.length===0)return;let{step_done:i}=JSON.parse(r);T.info(`You have already got to the step ${i}/10 in the previous session`);let n=await nt({message:"Would you like to continue from where you left off?"});return await Cs(n,e,t),n?i:void 0}catch(r){T.error(`Cannot read which steps have been compleated, error:
|
|
403
403
|
${r}`),T.warn("Onboarding will continue but please report it to the capgo team!");return}}function ict(){if(P1)try{(0,rr.rmSync)(P1)}catch(e){T.error(`Cannot delete the tmp steps file.
|
|
404
404
|
Error: ${e}`)}}async function Cs(e,t,r){Di(e)&&(await qo("onboarding-v2",t,r,"canceled","\u{1F937}"),(0,pn.exit)())}async function wa(e,t,r){return qo("onboarding-v2",e,t,`onboarding-step-${r}`)}async function nct(e,t,r,i){let n=gi(),a=await nt({message:`Add ${r} in Capgo?`});if(await Cs(a,e.gid,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest app add ${r}`),await CR(r,i,e,!1)?s.stop("App add Done \u2705"):s.stop("App already add \u2705")}else T.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest app add ${r}"`);await wa(e.gid,t,2)}async function act(e,t,r,i){let n=gi(),a=await nt({message:`Create default channel ${xg} for ${i} in Capgo?`});if(await Cs(a,e,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest channel add ${xg} ${i} --default`),await pR(xg,i,{default:!0,apikey:r},!1)?s.stop("Channel add Done \u2705"):s.stop("Channel already added \u2705")}else T.info(`If you change your mind, run it for yourself with: "${n.runner} @capgo/cli@latest channel add ${xg} ${i} --default"`);await wa(e,t,3)}var sct="https://capacitorjs.com/docs/updating/6-0",oct="https://capacitorjs.com/docs/updating/5-0";async function uct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic Install "@capgo/capacitor-updater" dependency in ${i}?`});if(await Cs(a,e,t),a){let s=Ue();s.start("Checking if @capgo/capacitor-updater is installed");let o="latest",u=await mi(),l=u.dependencies["@capacitor/core"]||u.devDependencies["@capacitor/core"];if(l=w5.default.coerce(l?.replace("^","").replace("~",""),{includePrerelease:!0}),l?w5.default.lt(l,"5.0.0")?(s.stop("Error"),T.warn(`@capacitor/core version is ${l}, please update to Capacitor v5 first: ${oct}`),ae("Bye \u{1F44B}"),(0,pn.exit)()):w5.default.lt(l,"6.0.0")&&(s.stop(`@capacitor/core version is ${l}, please update to Capacitor v6: ${sct} to access the best features of Capgo`),o="^5.0.0"):(s.stop("Error"),T.warn("Cannot find @capacitor/core in package.json, please run `capgo init` in a capacitor project"),ae("Bye \u{1F44B}"),(0,pn.exit)()),n.pm==="unknown"&&(s.stop("Error"),T.warn("Cannot reconize package manager, please run `capgo init` in a capacitor project with npm, pnpm, bun or yarn"),ae("Bye \u{1F44B}"),(0,pn.exit)()),u.dependencies["@capgo/capacitor-updater"])s.stop("Capgo already installed \u2705");else{await(0,Cg.execSync)(`${n.installCommand} @capgo/capacitor-updater@${o}`,m4e);let c=await mi();await e9({version:c?.version||"1.0.0",appId:i,autoUpdate:!0}),s.stop("Install Done \u2705")}}else T.info(`If you change your mind, run it for yourself with: "${n.installCommand} @capgo/capacitor-updater@latest"`);await wa(e,t,4)}async function lct(e,t,r,i){let n=await nt({message:`Automatic Add "${v5}" code and import in ${i}?`});if(await Cs(n,e,t),n){let a=Ue();a.start("Adding @capacitor-updater to your main file");let s=await KF();if(s==="nuxtjs-js"||s==="nuxtjs-ts"){let o=(0,_5.join)("plugins");(0,rr.existsSync)(o)||(0,rr.mkdirSync)(o,{recursive:!0});let u;s==="nuxtjs-ts"?u=(0,_5.join)(o,"capacitorUpdater.client.ts"):u=(0,_5.join)(o,"capacitorUpdater.client.js");let l=`
|
|
@@ -416,7 +416,7 @@ ${v5};
|
|
|
416
416
|
${h4e};
|
|
417
417
|
|
|
418
418
|
${v5};
|
|
419
|
-
`)}async function cct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic configure end-to-end encryption in ${i} updates?`});if(await Cs(a,e,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest key create`),await zN({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),T.warn("Cannot create key \u274C"),ae("Bye \u{1F44B}"),(0,pn.exit)(1)),qo("onboarding-v2",e,t,"Use encryption v2")}await wa(e,t,6)}async function pct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic build ${i} with "${n.pm} run build" ?`});if(await Cs(a,e,t),a){let s=Ue(),o=await KF(),u=await Afe(o);s.start(`Running: ${n.pm} run ${u} && ${n.runner} cap sync`),(await mi()).scripts[u]||(s.stop("Error"),T.warn(`Cannot find ${u} script in package.json, please add it and run \`capgo init\` again`),ae("Bye \u{1F44B}"),(0,pn.exit)()),(0,Cg.execSync)(`${n.pm} run ${u} && ${n.runner} cap sync`,m4e),s.stop("Build & Sync Done \u2705")}else T.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await wa(e,t,7)}async function dct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic upload ${i} bundle to Capgo?`});if(await Cs(a,e,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await y5(i,{channel:xg,apikey:r},!1)?s.stop("Upload Done \u2705"):(s.stop("Error"),T.warn("Upload failed \u274C"),ae("Bye \u{1F44B}"),(0,pn.exit)())}else T.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await wa(e,t,8)}async function fct(e,t){let r=gi(),i=await nt({message:"Run in device now ?"});if(await Cs(i,e,t),i){let n=await yp({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});Di(n)&&(ae("Bye \u{1F44B}"),(0,pn.exit)());let a=n,s=Ue();s.start(`Running: ${r.runner} cap run ${a}`),await(0,Cg.spawnSync)(r.runner,["cap","run",a],{stdio:"inherit"}),s.stop("Started Done \u2705")}else T.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await wa(e,t,9)}async function hct(e,t,r,i){let n=await nt({message:"Automatic check if update working in device ?"});if(await Cs(n,e,t),n)T.info(`Wait logs sent to Capgo from ${i} device, Please open your app \u{1F4AA}`),await WN("onboarding-v2",r,i,t,e);else{let a=jc(i);T.info(`Check logs in https://web.capgo.app/app/p/${a}/logs to see if update works.`)}await wa(e,t,10)}async function y4e(e,t,r){let i=gi();re("Capgo onboarding \u{1F6EB}"),await Ie();let n=At(),a=await pe();t=t||a?.config?.appId,r.apikey=e||Fe();let s=Ue();(!s4e()||e)&&(s.start(`Running: ${i.runner} @capgo/cli@latest login ***`),await DR(r.apikey,r,!1),s.stop("Login Done \u2705"));let o=await Se(r.apikey);await Ae(o,r.apikey,["upload","all","read","write"]);let u=await i1(o,["admin","super_admin"]),l=u.gid,c=await rct(l,n)??0;try{c<1&&await wa(l,n,1),c<2&&(await nct(u,n,t,r),ol(2)),c<3&&(await act(l,n,r.apikey,t),ol(3)),c<4&&(await uct(l,n,r.apikey,t),ol(4)),c<5&&(await lct(l,n,r.apikey,t),ol(5)),c<6&&(await cct(l,n,r.apikey,t),ol(6)),c<7&&(await pct(l,n,r.apikey,t),ol(7)),c<8&&(await dct(l,n,r.apikey,t),ol(8)),c<9&&(await fct(l,n),ol(9)),await hct(l,n,r.apikey,t),await wa(l,n,0),ict()}catch(p){console.error(p),T.error("Error during onboarding, please try again later"),(0,pn.exit)(1)}T.info("Welcome onboard \u2708\uFE0F!"),T.info("Your Capgo update system is setup"),T.info(`Next time use \`${i.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),T.info(`If you have any issue try to use the debug command \`${i.runner} @capgo/cli@latest app debug\``),ae("Bye \u{1F44B}"),(0,pn.exit)()}var E4e=require("node:process");var w4e=require("node:process");var b4e=ve(yg());var v4e=require("node:process");async function _4e(e,t,r){let{data:i,error:n}=await e.from("devices_override").select().eq("app_id",t).eq("version",r.id);if(n&&(T.error(`Cannot check Device override ${t}@${r.name}`),$.error("")),i&&i.length>0)if(re(`\u274C Version ${t}@${r.name} is used in ${i.length} device override`),await nt({message:"unlink it?"}))for(let a of i){let s=Ue();s.start(`Unlinking device ${a.device_id}`);let{error:o}=await e.from("devices_override").delete().eq("device_id",a.device_id);o&&(s.stop(`Cannot unlink device ${a.device_id} ${ce(o)}`),(0,v4e.exit)(1)),s.stop(`\u2705 Device ${a.device_id} unlinked`)}else T.error("Unlink it first"),$.error("")}async function mct(e,t,r){let{error:i}=await e.from("app_versions").update({deleted:!0}).eq("app_id",t).eq("deleted",!1).eq("name",r);i&&(T.error(`App Version ${t}@${r} not found in database`),$.error(""))}async function D5(e,t,r){let i=await gct(e,t,r);await T6e(e,t,i),await _4e(e,t,i),await mct(e,t,r)}function E5(e){e.length||(T.error("No bundle found"),(0,w4e.exit)(1));let t=new b4e.Table({title:"Bundles",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Version:r.name,Created:n1(r.created_at),...r.keep!=null?{Keep:r.keep}:{}})}),T.success(t.render())}async function x5(e,t){let{data:r,error:i}=await e.from("app_versions").select().eq("app_id",t).eq("deleted",!1).order("created_at",{ascending:!1});return i&&(T.error(`App ${t} not found in database`),$.error("")),r}async function D4e(e,t){let{data:r,error:i}=await e.from("channels").select("version").eq("app_id",t);return i&&(T.error(`App ${t} not found in database`),$.error("")),r.map(n=>n.version)}async function gct(e,t,r){let{data:i,error:n}=await e.from("app_versions").select().eq("app_id",t).eq("name",r).eq("deleted",!1).single();return(!i||n)&&(T.error(`App Version ${t}@${r} doesn't exist`),$.error("")),i}async function x4e(e,t){re("List bundles"),await Ie(),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appid, or be in a capacitor project"),$.error(""));let i=await Se(t.apikey);await Ae(i,t.apikey,["write","all","read","upload"]),T.info(`Querying available versions of: ${e} in Capgo`),await tt(i,t.apikey,e,1);let n=await x5(i,e);T.info(`Active versions in Capgo: ${n?.length}`),E5(n),ae("Done \u2705"),(0,E4e.exit)()}var Ss=require("node:fs"),C4e=require("node:process");async function S4e(e,t,r){re("Decrypt zip file"),await Ie(),(0,Ss.existsSync)(e)||(T.error(`Zip not found at the path ${e}`),$.error(""));let i=await pe();!r.key&&!(0,Ss.existsSync)($i)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(T.error(`Private Key not found at the path ${$i} or in ${i.path}`),$.error(""));let n=r.key||$i,a=i.config.plugins?.CapacitorUpdater?.privateKey;!(0,Ss.existsSync)(n)&&!a?(T.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),$.error("")):(0,Ss.existsSync)(n)&&(a=(0,Ss.readFileSync)(n).toString());let s=(0,Ss.readFileSync)(e),o=n6e(s,t,r.keyData??a??"");(0,Ss.writeFileSync)(`${e}_decrypted.zip`,o),ae(`Decrypted zip file at ${e}_decrypted.zip`),(0,C4e.exit)()}var As=require("node:fs"),A4e=require("node:process");var O4e=ve(_9());async function T4e(e,t,r){re("Decrypt zip file"),await Ie(),(0,As.existsSync)(e)||(T.error(`Zip not found at the path ${e}`),$.error(""));let i=await pe();!r.key&&!(0,As.existsSync)(Fo)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(T.error(`Private Key not found at the path ${Fo} or in ${i.path}`),$.error(""));let n=r.key||Fo,a=i.config.plugins?.CapacitorUpdater?.publicKey;!(0,As.existsSync)(n)&&!a?(T.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),$.error("")):(0,As.existsSync)(n)&&(a=(0,As.readFileSync)(n).toString());let s=(0,As.readFileSync)(e),o=W6e(s,t,r.keyData??a??"");if((0,As.writeFileSync)(`${e}_decrypted.zip`,o),T.info(`Decrypted zip file at ${e}_decrypted.zip`),r.checksum){let u=await(0,O4e.checksum)(o,"sha256"),l=K6e(r.checksum,r.keyData??a??"");u!==l?(T.error(`Checksum does not match ${u} !== ${l}`),$.error("")):T.info("Checksum matches")}ae("\u2705 done"),(0,A4e.exit)()}var ul=require("node:fs"),F4e=require("node:process");async function k4e(e,t){re("Encryption"),await Ie(),(0,ul.existsSync)(e)||(T.error(`Error: Zip not found at the path ${e}`),$.error(""));let r=t.key||un,i=t.keyData||"";(0,ul.existsSync)(r)&&(i=(0,ul.readFileSync)(r).toString());let n=(0,ul.readFileSync)(e),a=t5(n,i);T.success(`ivSessionKey: ${a.ivSessionKey}`),(0,ul.writeFileSync)(`${e}_encrypted.zip`,a.encryptedData),T.success(`Encrypted zip saved at ${e}_encrypted.zip`),ae("Done \u2705"),(0,F4e.exit)()}var Ho=require("node:fs"),N4e=require("node:process");async function R4e(e,t,r){let{json:i}=r;i||(re("Encryption"),await Ie());let n=await pe(),a=!!n.config.plugins?.CapacitorUpdater?.privateKey,s=!!n.config.plugins?.CapacitorUpdater?.publicKey;a&&!i&&T.warning("There is still a privateKey in the config"),(0,Ho.existsSync)(e)||(i?console.error(ce({error:"zip_not_found"})):T.error(`Error: Zip not found at the path ${e}`),$.error("")),s||(i?console.error(ce({error:"missing_public_key"})):T.warning("Warning: Missing Public Key in config"),$.error(""));let o=r.key||on,u=r.keyData||"";!(0,Ho.existsSync)(o)&&!u?(i?console.error(ce({error:"missing_key"})):(T.warning(`Cannot find a private key at ${o} or as a keyData option`),T.error("Error: Missing key")),$.error("")):(0,Ho.existsSync)(o)&&(u=(0,Ho.readFileSync)(o).toString()),u&&!u.startsWith("-----BEGIN RSA PRIVATE KEY-----")&&(i?console.error(ce({error:"invalid_private_key"})):T.error("the private key provided is not a valid RSA Private key"),$.error(""));let l=(0,Ho.readFileSync)(e),c=g5(l,u),p=m5(t,u),d=`${e}_encrypted.zip`;i?console.log(JSON.stringify({checksum:p,filename:d,ivSessionKey:c.ivSessionKey},null,2)):(T.success(`Encoded Checksum: ${p}`),T.success(`ivSessionKey: ${c.ivSessionKey}`)),(0,Ho.writeFileSync)(d,c.encryptedData),i||(T.success(`Encrypted zip saved at ${d}`),ae("Done \u2705")),(0,N4e.exit)()}var I1=require("node:process"),C5=require("node:os"),P4e=ve(LN());async function yct(e){let t={},r=[];for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.push((0,P4e.default)(i));return await Promise.all(r).then(i=>{let n=Object.keys(e);for(let a=0;a<i.length;a+=1){let s=i[a];s&&(t[n[a]]=s)}}),t}async function vct(){let{dependencies:e}=await mi(),t={"@capgo/cli":zo.version};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let i=e[r].replace("^","").replace("~","");t[r]=i}return t}async function I4e(){T.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await pe(),t=await mi(),r=e?.config?.plugins?.CapacitorUpdater?.version||t?.version,i=e?.config?.appName||"";T.info(` App Name: ${i}`);let n=e?.config?.appId||"";T.info(` App ID: ${n}`),T.info(` App Version: ${r}`);let a=e?.config?.webDir||"";T.info(` Web Dir: ${a}`),T.info(` OS: ${(0,C5.platform)()} ${(0,C5.version)()}`),T.info(` Node: ${I1.version}`),T.info(" Installed Dependencies:");let s=await vct();Object.keys(s).length===0&&(T.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,I1.exit)(1));for(let l in s)if(Object.prototype.hasOwnProperty.call(s,l)){let c=s[l];T.info(` ${l}: ${c}`)}let o=Ue();o.start("Running: Loading latest dependencies");let u=await yct(s);o.stop("Latest Dependencies:");for(let l in u)if(Object.prototype.hasOwnProperty.call(u,l)){let c=u[l];T.info(` ${l}: ${c}`)}JSON.stringify(s)!==JSON.stringify(u)&&(T.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,I1.exit)(1)),T.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,I1.exit)()}var Os=require("node:fs");async function _ct(e,t=!0){t&&re("Save keys \u{1F511}");let r=await pe(),i=e.key||$i,n=e.keyData||"";if(!(0,Os.existsSync)(i)&&!n)if(t)T.error(`Cannot find public key ${i} or as keyData option or in ${r.path}`),$.error("");else return!1;else(0,Os.existsSync)(i)&&(n=(0,Os.readFileSync)(i).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=n,await ms(r)),T&&(T.success(`private key saved into ${r.path} file in local directory`),T.success("your app will decode the zip archive with this key")),!0}async function L4e(e){re("Save keys \u{1F511}"),await Ie(),await _ct(e)}async function wct(e,t=!0){t&&re("Create keys \u{1F511}");let{publicKey:r,privateKey:i}=r5();if((0,Os.existsSync)(un)&&!e.force)if(T.error("Public Key already exists, use --force to overwrite"),t)$.error("");else return!1;if((0,Os.writeFileSync)(un,r),(0,Os.existsSync)($i)&&!e.force)if(T.error("Private Key already exists, use --force to overwrite"),t)$.error("");else return!1;(0,Os.writeFileSync)($i,i);let n=i.replace(/\\n/g,"\\n"),a=await e9({privateKey:n});return t&&(T.success("Your RSA key has been generated"),T.success(`Public key saved in ${un}`),T.success("This key will be use to encrypt your bundle before sending it to Capgo"),T.success("Keep it safe"),T.success("Than make it unreadable by Capgo and unmodifiable by anyone"),T.success(`Private key saved in ${a.path}`),T.success("Your app will be the only one having it"),T.success("Only your users can decrypt your update"),T.success("Only you can send them an update"),ae("Done \u2705")),!0}async function B4e(e){await Ie(),await wct(e)}var j4e=require("node:process");async function q4e(e,t,r){re("Delete bundle"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId,r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(r.apikey);await Ae(n,r.apikey,["write","all"]),await tt(n,r.apikey,t,3),r.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error("")),T.info(`Deleting bundle ${t}@${e} from Capgo`),T.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever"),await D5(n,t,e),T.success(`Bundle ${t}@${e} deleted in Capgo`),ae("Done"),(0,j4e.exit)()}var M4e=require("node:process");var $4e=["major","minor","metadata","patch","none"];async function U4e(e,t,r){re("Set channel"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId;let n=At();r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all"]);await tt(a,r.apikey,t,4);let o=await Mn(a,t),{bundle:u,state:l,downgrade:c,latest:p,upgrade:d,ios:f,android:h,selfAssign:m,disableAutoUpdate:v,dev:y,emulator:D}=r;e||(T.error("Missing argument, you need to provide a channel"),$.error("")),p&&u&&(T.error("Cannot set latest and bundle at the same time"),$.error("")),u==null&&l==null&&p==null&&c==null&&d==null&&f==null&&h==null&&m==null&&y==null&&D==null&&v==null&&(T.error("Missing argument, you need to provide a option to set"),$.error(""));try{await r1(a,o,r.apikey,t);let b={created_by:s,app_id:t,name:e,owner_org:o,version:void 0},_=await mi(),w=p?i?.config?.plugins?.CapacitorUpdater?.version||_?.version:u;if(w!=null){let{data:O,error:C}=await a.from("app_versions").select().eq("app_id",t).eq("name",w).eq("user_id",s).eq("deleted",!1).single();(C||!O)&&(T.error(`Cannot find version ${w}`),$.error("")),T.info(`Set ${t} channel: ${e} to @${w}`),b.version=O.id}if(l!=null&&((l==="public"||l==="private")&&T.info(`Set ${t} channel: ${e} to public or private is deprecated, use default or normal instead`),T.info(`Set ${t} channel: ${e} to ${l==="public"||l==="default"?"default":"normal"}`),b.public=l==="public"||l==="default"),c!=null&&(T.info(`Set ${t} channel: ${e} to ${c?"allow":"disallow"} downgrade`),b.disable_auto_update_under_native=!c),f!=null&&(T.info(`Set ${t} channel: ${e} to ${f?"allow":"disallow"} ios update`),b.ios=!!f),h!=null&&(T.info(`Set ${t} channel: ${e} to ${h?"allow":"disallow"} android update`),b.android=!!h),m!=null&&(T.info(`Set ${t} channel: ${e} to ${m?"allow":"disallow"} self assign to this channel`),b.allow_device_self_set=!!m),v!=null){let O=v.toLocaleLowerCase();$4e.includes(O)||(T.error(`Channel strategy ${O} is not known. The possible values are: ${$4e.join(", ")}.`),$.error("")),O==="metadata"&&(O="version_number"),b.disable_auto_update=O,T.info(`Set ${t} channel: ${e} to ${O} disable update strategy to this channel`)}try{let{error:O}=await r9(a,b);O&&(T.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),$.error(""))}catch{T.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),$.error("")}await n.track({channel:"channel",event:"Set channel",icon:"\u2705",user_id:o,tags:{"app-id":t},notify:!1}).catch()}catch(b){T.error(`Unknow error ${ce(b)}`),$.error("")}ae("Done \u2705"),(0,M4e.exit)()}var V4e=require("node:process");async function H4e(e,t,r){let{quiet:i}=r;i||re("List current bundle"),r.apikey=r.apikey||Fe(i);let n=await pe();t=t||n?.config?.appId,r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all","read"]);await tt(a,r.apikey,t,1),e||(T.error("Please provide a channel to get the bundle from."),$.error(""));let{data:o,error:u}=await a.from("channels").select("version ( name )").eq("name",e).eq("app_id",t).limit(1);(u||o.length===0)&&(T.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),$.error(""));let{version:l}=o[0];l||(T.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),$.error("")),i?T.info(l.name):T.info(`Current bundle for channel ${e} is ${l.name}`),(0,V4e.exit)()}var SR=require("node:process");var z4e=ve(yg());function bct(e){e.length||(T.error("No apps found"),(0,SR.exit)(1));let t=new z4e.Table({title:"Apps",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,id:r.app_id,Created:n1(r.created_at)})}),T.success(t.render())}async function Dct(e){let{data:t,error:r}=await e.from("apps").select().order("created_at",{ascending:!1});return r&&(T.error("Apps not found"),$.error("")),t}async function G4e(e){re("List apps in Capgo"),await Ie(),e.apikey=e.apikey||Fe();let t=await Se(e.apikey);await Ae(t,e.apikey,["write","all","read","upload"]),T.info("Getting active bundle in Capgo");let r=await Dct(t);T.info(`Active app in Capgo: ${r?.length}`),bct(r),ae("Done \u2705"),(0,SR.exit)()}var AR=require("node:process");var S5=ve(K4e());async function Ect(e,t,r){for await(let i of e)T.warn(`Removing ${i.name} created on ${n1(i.created_at)}`),await D5(t,r,i.name)}function xct(e,t,r){let i=[];return e?.forEach(n=>{S5.default.gte(n.name,t)&&S5.default.lt(n.name,`${r}`)&&i.push(n)}),i}async function Y4e(e,t){re("Cleanup versions in Capgo"),await Ie(),t.apikey=t.apikey||Fe();let{bundle:r,keep:i=4}=t,n=t.force||!1,a=await pe();e=e||a?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a appid, or be in a capacitor project"),$.error(""));let s=await Se(t.apikey);await Ae(s,t.apikey,["write","all"]),await tt(s,t.apikey,e,3),T.info("Querying all available versions in Capgo");let o=await x5(s,e),u=await D4e(s,e);if(T.info(`Total active versions in Capgo: ${o?.length}`),o?.length===0){T.error("No versions found, aborting cleanup");return}if(r){let p=`${S5.default.inc(r,"major")}`;T.info(`Querying available versions in Capgo between ${r} and ${p}`),o=xct(o,r,p),T.info(`Active versions in Capgo between ${r} and ${p}: ${o?.length}`)}let l=[],c=0;if(o.forEach(p=>{let d=u.find(f=>f===p.id);c<i||d?(d?p.keep="\u2705 (Linked to channel)":p.keep="\u2705",c+=1):(p.keep="\u274C",l.push(p))}),l.length===0){T.warn("Nothing to be removed, aborting removal...");return}if(E5(o),!n){let p=await nt({message:"Do you want to continue removing the versions specified?"});(Di(p)||!p)&&(T.warn("Not confirmed, aborting removal..."),(0,AR.exit)())}T.success("You have confirmed removal, removing versions now"),await Ect(l,s,e),ae("Done \u2705"),(0,AR.exit)()}var X4e=require("node:process");async function J4e(e,t,r){re("Delete channel"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId;let n=At();r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all"]);await tt(a,r.apikey,t,4),T.info(`Deleting channel ${t}#${e} from Capgo`);try{let o=await k6e(a,e,t,s);o.error&&(T.error(`Cannot delete Channel \u{1F640} ${ce(o.error)}`),$.error(""));let u=await Mn(a,t);T.success("Channel deleted"),await n.track({channel:"channel",event:"Delete channel",icon:"\u2705",user_id:u,tags:{"user-id":s,"app-id":t,channel:e},notify:!1}).catch()}catch{T.error("Cannot delete Channel \u{1F640}")}ae("Done \u2705"),(0,X4e.exit)()}var Z4e=require("node:process");async function Q4e(e,t){re("List channels"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=At();t.apikey||T.error("Missing API key, you need to provide a API key to upload your bundle"),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=await Ae(n,t.apikey,["write","all","read","upload"]);await tt(n,t.apikey,e,1),T.info("Querying available channels in Capgo");let s=await R6e(n,e);T.info(`Active channels in Capgo: ${s?.length}`),N6e(s),await i.track({channel:"channel",event:"List channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(),ae("Done \u2705"),(0,Z4e.exit)()}var e3e=require("node:crypto"),L1=require("node:fs"),t3e=require("node:process");async function r3e(e,t){re("Set app"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let i=await Se(t.apikey),a=(await i1(i,["admin","super_admin"])).gid,s=await Ae(i,t.apikey,["write","all"]);await tt(i,t.apikey,e,4);let{name:o,icon:u,retention:l}=t;l&&Number.isNaN(Number(l))?(T.error("retention value must be a number"),$.error("")):l&&l<0&&(T.error("retention value cannot be less than 0"),$.error(""));let c,p,d=`icon_${(0,e3e.randomUUID)()}`,f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(u&&(0,L1.existsSync)(u)?(c=(0,L1.readFileSync)(u),p=N1.getType(u)||"image/png",T.warn(`Found app icon ${u}`)):(0,L1.existsSync)(Gn)?(c=(0,L1.readFileSync)(Gn),p=N1.getType(Gn)||"image/png",T.warn(`Found app icon ${Gn}`)):T.warn(`Cannot find app icon in any of the following locations: ${u}, ${Gn}`),c&&p){let{error:m}=await i.storage.from(`images/org/${a}/${e}`).upload(d,c,{contentType:p});m&&(T.error(`Could not set app ${ce(m)}`),$.error(""));let{data:v}=await i.storage.from(`images/org/${a}/${e}`).getPublicUrl(d);f=v?.publicUrl||f}let{error:h}=await i.from("apps").update({icon_url:f,name:o,retention:l?l*24*60*60:void 0}).eq("app_id",e).eq("user_id",s);h&&(T.error(`Could not set app ${ce(h)}`),$.error("")),ae("Done \u2705"),(0,t3e.exit)()}var i3e=require("node:process");async function n3e(e,t){re("Deleting"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=At();t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=await Ae(n,t.apikey,["write","all"]);await tt(n,t.apikey,e,5);let{data:s,error:o}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",e).single(),u=s;if(!o&&(u?.owner_org.created_by??"")!==a){T.warn("Deleting the app is not recomended for users that are not the organization owner"),T.warn("You are invited as a super_admin but your are not the owner"),T.warn("It's strongly recomended that you do not continue!");let f=await yp({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(Di(f)||f==="no")&&(T.error("Canceled deleting the app, exiting"),$.error(""))}else o&&T.warn(`Cannot get the app owner ${ce(o)}`);let{error:l}=await n.storage.from("images").remove([`org/${u?.owner_org.id}/${e}/icon`]);l&&(console.error(l,`images/org/${u?.owner_org.id}/${e}`),T.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${e}/${a}`).remove(["versions"]);c&&T.error("Could not delete app version");let{error:p}=await n.from("apps").delete().eq("app_id",e);p&&(T.error("Could not delete app"),$.error(""));let d=await Mn(n,e);await i.track({channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:d,tags:{"app-id":e},notify:!1}).catch(),T.success("App deleted in Capgo"),ae("Done \u2705"),(0,i3e.exit)()}var a3e=ve(yg());async function s3e(e,t){re("Check compatibility"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let{channel:i}=t;i||(T.error("Missing argument, you need to provide a channel"),$.error("")),t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey);await Ae(n,t.apikey,["write","all","read","upload"]),await tt(n,t.apikey,e,1);let{finalCompatibility:a}=await i9(n,e,i),s=new a3e.Table({title:"Compatibility",charLength:{"\u274C":2,"\u2705":2}}),o=t.text?"Yes":"\u2705",u=t.text?"No":"\u274C";a.forEach(l=>{let{name:c,localVersion:p,remoteVersion:d}=l;s.addRow({Package:c,"Local version":p??"None","Remote version":d??"None",Compatible:d===p?o:u})}),T.success(s.render())}$.name(zo.name).description("Manage packages and bundle versions in Capgo Cloud").version(zo.version);$.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(o4e).option("--local","Only save in local folder");$.command("doctor").description("Get info about your Capgo app install").action(I4e);$.command("init [apikey] [appId]").description("Init a new app").action(y4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path");var B1=$.command("app").description("Manage app");B1.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(f4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");B1.command("delete [appId]").description("Delete an app in Capgo Cloud").action(n3e).option("-a, --apikey <apikey>","apikey to link to your account");B1.command("list").alias("l").description("list apps in Capgo Cloud").action(G4e).option("-a, --apikey <apikey>","apikey to link to your account");B1.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(l6e);B1.command("setting [path]").description("Modifies capacitor config programmatically").option("--bool <bool>","A value for the setting to modify as a boolean").option("--string <string>","A value for the setting to modify as a string").action(Pfe);B1.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(r3e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var Ts=$.command("bundle").description("Manage bundle");Ts.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(n4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","public signing key").option("--key-v2 <key>","custom path for private signing key").option("--key-data-v2 <keyData>","private signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("--tus","Upload the bundle using tus").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3").option("--partial","Upload partial files to S3").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.");Ts.command("compatibility [appId]").action(s3e).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis");Ts.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action(q4e).option("-a, --apikey <apikey>","apikey to link to your account");Ts.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(x4e).option("-a, --apikey <apikey>","apikey to link to your account");Ts.command("cleanup [appId]").alias("c").action(Y4e).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");Ts.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(S4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");Ts.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(k4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");Ts.command("encryptV2 [zipPath] [checksum]").description("Encrypt a zip bundle using the new encryption method").action(R4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("-j, --json","output in JSON");Ts.command("decryptV2 [zipPath] [checksum]").description("Decrypt a zip bundle using the new encryption method").action(T4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("--checksum <checksum>","checksum of the bundle, to verify the integrity of the bundle");Ts.command("zip [appId]").description("Zip a bundle").action(jge).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--key-v2","use encryption v2");var Sg=$.command("channel").description("Manage channel");Sg.command("add [channelId] [appId]").alias("a").description("Create channel").action(I6e).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(J4e).option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("list [appId]").alias("l").description("List channel").action(Q4e).option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(H4e).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");Sg.command("set [channelId] [appId]").alias("s").description("Set channel").action(U4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices");var o3e=$.command("key_old").description("Manage old encryption key");o3e.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(L4e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");o3e.command("create").description("Create a new encryption key").action(B4e).option("-f, --force","force generate a new one");var OR=$.command("key").description("Manage encryption key");OR.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(a6e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");OR.command("create").description("Create a new encryption key").action(s6e).option("-f, --force","force generate a new one");OR.command("delete_old").description("Delete the old encryption key").action(o6e);$.command("upload [appId]").alias("u").description("(Deprecated) Upload a new bundle to Capgo Cloud").action(a4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--old-encryption","use old encryption").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the file to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel");var Cct=$.command("account").description("Manage account");Cct.command("id").description("Get your account ID").action(Ife).option("-a, --apikey <apikey>","apikey to link to your account");$.parseAsync();
|
|
419
|
+
`)}async function cct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic configure end-to-end encryption in ${i} updates?`});if(await Cs(a,e,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest key create`),await zN({force:!0},!1)?s.stop("key created \u{1F511}"):(s.stop("Error"),T.warn("Cannot create key \u274C"),ae("Bye \u{1F44B}"),(0,pn.exit)(1)),qo("onboarding-v2",e,t,"Use encryption v2")}await wa(e,t,6)}async function pct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic build ${i} with "${n.pm} run build" ?`});if(await Cs(a,e,t),a){let s=Ue(),o=await KF(),u=await Afe(o);s.start(`Running: ${n.pm} run ${u} && ${n.runner} cap sync`),(await mi()).scripts[u]||(s.stop("Error"),T.warn(`Cannot find ${u} script in package.json, please add it and run \`capgo init\` again`),ae("Bye \u{1F44B}"),(0,pn.exit)()),(0,Cg.execSync)(`${n.pm} run ${u} && ${n.runner} cap sync`,m4e),s.stop("Build & Sync Done \u2705")}else T.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await wa(e,t,7)}async function dct(e,t,r,i){let n=gi(),a=await nt({message:`Automatic upload ${i} bundle to Capgo?`});if(await Cs(a,e,t),a){let s=Ue();s.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await y5(i,{channel:xg,apikey:r},!1)?s.stop("Upload Done \u2705"):(s.stop("Error"),T.warn("Upload failed \u274C"),ae("Bye \u{1F44B}"),(0,pn.exit)())}else T.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await wa(e,t,8)}async function fct(e,t){let r=gi(),i=await nt({message:"Run in device now ?"});if(await Cs(i,e,t),i){let n=await yp({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});Di(n)&&(ae("Bye \u{1F44B}"),(0,pn.exit)());let a=n,s=Ue();s.start(`Running: ${r.runner} cap run ${a}`),await(0,Cg.spawnSync)(r.runner,["cap","run",a],{stdio:"inherit"}),s.stop("Started Done \u2705")}else T.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await wa(e,t,9)}async function hct(e,t,r,i){let n=await nt({message:"Automatic check if update working in device ?"});if(await Cs(n,e,t),n)T.info(`Wait logs sent to Capgo from ${i} device, Please open your app \u{1F4AA}`),await WN("onboarding-v2",r,i,t,e);else{let a=jc(i);T.info(`Check logs in https://web.capgo.app/app/p/${a}/logs to see if update works.`)}await wa(e,t,10)}async function y4e(e,t,r){let i=gi();re("Capgo onboarding \u{1F6EB}"),await Ie();let n=At(),a=await pe();t=t||a?.config?.appId,r.apikey=e||Fe();let s=Ue();(!s4e()||e)&&(s.start(`Running: ${i.runner} @capgo/cli@latest login ***`),await DR(r.apikey,r,!1),s.stop("Login Done \u2705"));let o=await Se(r.apikey);await Ae(o,r.apikey,["upload","all","read","write"]);let u=await i1(o,["admin","super_admin"]),l=u.gid,c=await rct(l,n)??0;try{c<1&&await wa(l,n,1),c<2&&(await nct(u,n,t,r),ol(2)),c<3&&(await act(l,n,r.apikey,t),ol(3)),c<4&&(await uct(l,n,r.apikey,t),ol(4)),c<5&&(await lct(l,n,r.apikey,t),ol(5)),c<6&&(await cct(l,n,r.apikey,t),ol(6)),c<7&&(await pct(l,n,r.apikey,t),ol(7)),c<8&&(await dct(l,n,r.apikey,t),ol(8)),c<9&&(await fct(l,n),ol(9)),await hct(l,n,r.apikey,t),await wa(l,n,0),ict()}catch(p){console.error(p),T.error("Error during onboarding, please try again later"),(0,pn.exit)(1)}T.info("Welcome onboard \u2708\uFE0F!"),T.info("Your Capgo update system is setup"),T.info(`Next time use \`${i.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),T.info(`If you have any issue try to use the debug command \`${i.runner} @capgo/cli@latest app debug\``),ae("Bye \u{1F44B}"),(0,pn.exit)()}var E4e=require("node:process");var w4e=require("node:process");var b4e=ve(yg());var v4e=require("node:process");async function _4e(e,t,r){let{data:i,error:n}=await e.from("devices_override").select().eq("app_id",t).eq("version",r.id);if(n&&(T.error(`Cannot check Device override ${t}@${r.name}`),$.error("")),i&&i.length>0)if(re(`\u274C Version ${t}@${r.name} is used in ${i.length} device override`),await nt({message:"unlink it?"}))for(let a of i){let s=Ue();s.start(`Unlinking device ${a.device_id}`);let{error:o}=await e.from("devices_override").delete().eq("device_id",a.device_id);o&&(s.stop(`Cannot unlink device ${a.device_id} ${le(o)}`),(0,v4e.exit)(1)),s.stop(`\u2705 Device ${a.device_id} unlinked`)}else T.error("Unlink it first"),$.error("")}async function mct(e,t,r){let{error:i}=await e.from("app_versions").update({deleted:!0}).eq("app_id",t).eq("deleted",!1).eq("name",r);i&&(T.error(`App Version ${t}@${r} not found in database`),$.error(""))}async function D5(e,t,r){let i=await gct(e,t,r);await T6e(e,t,i),await _4e(e,t,i),await mct(e,t,r)}function E5(e){e.length||(T.error("No bundle found"),(0,w4e.exit)(1));let t=new b4e.Table({title:"Bundles",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Version:r.name,Created:n1(r.created_at),...r.keep!=null?{Keep:r.keep}:{}})}),T.success(t.render())}async function x5(e,t){let{data:r,error:i}=await e.from("app_versions").select().eq("app_id",t).eq("deleted",!1).order("created_at",{ascending:!1});return i&&(T.error(`App ${t} not found in database`),$.error("")),r}async function D4e(e,t){let{data:r,error:i}=await e.from("channels").select("version").eq("app_id",t);return i&&(T.error(`App ${t} not found in database`),$.error("")),r.map(n=>n.version)}async function gct(e,t,r){let{data:i,error:n}=await e.from("app_versions").select().eq("app_id",t).eq("name",r).eq("deleted",!1).single();return(!i||n)&&(T.error(`App Version ${t}@${r} doesn't exist`),$.error("")),i}async function x4e(e,t){re("List bundles"),await Ie(),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appid, or be in a capacitor project"),$.error(""));let i=await Se(t.apikey);await Ae(i,t.apikey,["write","all","read","upload"]),T.info(`Querying available versions of: ${e} in Capgo`),await tt(i,t.apikey,e,1);let n=await x5(i,e);T.info(`Active versions in Capgo: ${n?.length}`),E5(n),ae("Done \u2705"),(0,E4e.exit)()}var Ss=require("node:fs"),C4e=require("node:process");async function S4e(e,t,r){re("Decrypt zip file"),await Ie(),(0,Ss.existsSync)(e)||(T.error(`Zip not found at the path ${e}`),$.error(""));let i=await pe();!r.key&&!(0,Ss.existsSync)($i)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(T.error(`Private Key not found at the path ${$i} or in ${i.path}`),$.error(""));let n=r.key||$i,a=i.config.plugins?.CapacitorUpdater?.privateKey;!(0,Ss.existsSync)(n)&&!a?(T.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),$.error("")):(0,Ss.existsSync)(n)&&(a=(0,Ss.readFileSync)(n).toString());let s=(0,Ss.readFileSync)(e),o=n6e(s,t,r.keyData??a??"");(0,Ss.writeFileSync)(`${e}_decrypted.zip`,o),ae(`Decrypted zip file at ${e}_decrypted.zip`),(0,C4e.exit)()}var As=require("node:fs"),A4e=require("node:process");var O4e=ve(_9());async function T4e(e,t,r){re("Decrypt zip file"),await Ie(),(0,As.existsSync)(e)||(T.error(`Zip not found at the path ${e}`),$.error(""));let i=await pe();!r.key&&!(0,As.existsSync)(Fo)&&!i.config.plugins?.CapacitorUpdater?.privateKey&&(T.error(`Private Key not found at the path ${Fo} or in ${i.path}`),$.error(""));let n=r.key||Fo,a=i.config.plugins?.CapacitorUpdater?.publicKey;!(0,As.existsSync)(n)&&!a?(T.error(`Cannot find public key ${n} or as keyData option or in ${i.path}`),$.error("")):(0,As.existsSync)(n)&&(a=(0,As.readFileSync)(n).toString());let s=(0,As.readFileSync)(e),o=W6e(s,t,r.keyData??a??"");if((0,As.writeFileSync)(`${e}_decrypted.zip`,o),T.info(`Decrypted zip file at ${e}_decrypted.zip`),r.checksum){let u=await(0,O4e.checksum)(o,"sha256"),l=K6e(r.checksum,r.keyData??a??"");u!==l?(T.error(`Checksum does not match ${u} !== ${l}`),$.error("")):T.info("Checksum matches")}ae("\u2705 done"),(0,A4e.exit)()}var ul=require("node:fs"),F4e=require("node:process");async function k4e(e,t){re("Encryption"),await Ie(),(0,ul.existsSync)(e)||(T.error(`Error: Zip not found at the path ${e}`),$.error(""));let r=t.key||un,i=t.keyData||"";(0,ul.existsSync)(r)&&(i=(0,ul.readFileSync)(r).toString());let n=(0,ul.readFileSync)(e),a=t5(n,i);T.success(`ivSessionKey: ${a.ivSessionKey}`),(0,ul.writeFileSync)(`${e}_encrypted.zip`,a.encryptedData),T.success(`Encrypted zip saved at ${e}_encrypted.zip`),ae("Done \u2705"),(0,F4e.exit)()}var Ho=require("node:fs"),N4e=require("node:process");async function R4e(e,t,r){let{json:i}=r;i||(re("Encryption"),await Ie());let n=await pe(),a=!!n.config.plugins?.CapacitorUpdater?.privateKey,s=!!n.config.plugins?.CapacitorUpdater?.publicKey;a&&!i&&T.warning("There is still a privateKey in the config"),(0,Ho.existsSync)(e)||(i?console.error(le({error:"zip_not_found"})):T.error(`Error: Zip not found at the path ${e}`),$.error("")),s||(i?console.error(le({error:"missing_public_key"})):T.warning("Warning: Missing Public Key in config"),$.error(""));let o=r.key||on,u=r.keyData||"";!(0,Ho.existsSync)(o)&&!u?(i?console.error(le({error:"missing_key"})):(T.warning(`Cannot find a private key at ${o} or as a keyData option`),T.error("Error: Missing key")),$.error("")):(0,Ho.existsSync)(o)&&(u=(0,Ho.readFileSync)(o).toString()),u&&!u.startsWith("-----BEGIN RSA PRIVATE KEY-----")&&(i?console.error(le({error:"invalid_private_key"})):T.error("the private key provided is not a valid RSA Private key"),$.error(""));let l=(0,Ho.readFileSync)(e),c=g5(l,u),p=m5(t,u),d=`${e}_encrypted.zip`;i?console.log(JSON.stringify({checksum:p,filename:d,ivSessionKey:c.ivSessionKey},null,2)):(T.success(`Encoded Checksum: ${p}`),T.success(`ivSessionKey: ${c.ivSessionKey}`)),(0,Ho.writeFileSync)(d,c.encryptedData),i||(T.success(`Encrypted zip saved at ${d}`),ae("Done \u2705")),(0,N4e.exit)()}var I1=require("node:process"),C5=require("node:os"),P4e=ve(LN());async function yct(e){let t={},r=[];for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.push((0,P4e.default)(i));return await Promise.all(r).then(i=>{let n=Object.keys(e);for(let a=0;a<i.length;a+=1){let s=i[a];s&&(t[n[a]]=s)}}),t}async function vct(){let{dependencies:e}=await mi(),t={"@capgo/cli":zo.version};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let i=e[r].replace("^","").replace("~","");t[r]=i}return t}async function I4e(){T.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await pe(),t=await mi(),r=e?.config?.plugins?.CapacitorUpdater?.version||t?.version,i=e?.config?.appName||"";T.info(` App Name: ${i}`);let n=e?.config?.appId||"";T.info(` App ID: ${n}`),T.info(` App Version: ${r}`);let a=e?.config?.webDir||"";T.info(` Web Dir: ${a}`),T.info(` OS: ${(0,C5.platform)()} ${(0,C5.version)()}`),T.info(` Node: ${I1.version}`),T.info(" Installed Dependencies:");let s=await vct();Object.keys(s).length===0&&(T.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,I1.exit)(1));for(let l in s)if(Object.prototype.hasOwnProperty.call(s,l)){let c=s[l];T.info(` ${l}: ${c}`)}let o=Ue();o.start("Running: Loading latest dependencies");let u=await yct(s);o.stop("Latest Dependencies:");for(let l in u)if(Object.prototype.hasOwnProperty.call(u,l)){let c=u[l];T.info(` ${l}: ${c}`)}JSON.stringify(s)!==JSON.stringify(u)&&(T.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,I1.exit)(1)),T.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,I1.exit)()}var Os=require("node:fs");async function _ct(e,t=!0){t&&re("Save keys \u{1F511}");let r=await pe(),i=e.key||$i,n=e.keyData||"";if(!(0,Os.existsSync)(i)&&!n)if(t)T.error(`Cannot find public key ${i} or as keyData option or in ${r.path}`),$.error("");else return!1;else(0,Os.existsSync)(i)&&(n=(0,Os.readFileSync)(i).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=n,await ms(r)),T&&(T.success(`private key saved into ${r.path} file in local directory`),T.success("your app will decode the zip archive with this key")),!0}async function L4e(e){re("Save keys \u{1F511}"),await Ie(),await _ct(e)}async function wct(e,t=!0){t&&re("Create keys \u{1F511}");let{publicKey:r,privateKey:i}=r5();if((0,Os.existsSync)(un)&&!e.force)if(T.error("Public Key already exists, use --force to overwrite"),t)$.error("");else return!1;if((0,Os.writeFileSync)(un,r),(0,Os.existsSync)($i)&&!e.force)if(T.error("Private Key already exists, use --force to overwrite"),t)$.error("");else return!1;(0,Os.writeFileSync)($i,i);let n=i.replace(/\\n/g,"\\n"),a=await e9({privateKey:n});return t&&(T.success("Your RSA key has been generated"),T.success(`Public key saved in ${un}`),T.success("This key will be use to encrypt your bundle before sending it to Capgo"),T.success("Keep it safe"),T.success("Than make it unreadable by Capgo and unmodifiable by anyone"),T.success(`Private key saved in ${a.path}`),T.success("Your app will be the only one having it"),T.success("Only your users can decrypt your update"),T.success("Only you can send them an update"),ae("Done \u2705")),!0}async function B4e(e){await Ie(),await wct(e)}var j4e=require("node:process");async function q4e(e,t,r){re("Delete bundle"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId,r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(r.apikey);await Ae(n,r.apikey,["write","all"]),await tt(n,r.apikey,t,3),r.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error("")),T.info(`Deleting bundle ${t}@${e} from Capgo`),T.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever"),await D5(n,t,e),T.success(`Bundle ${t}@${e} deleted in Capgo`),ae("Done"),(0,j4e.exit)()}var M4e=require("node:process");var $4e=["major","minor","metadata","patch","none"];async function U4e(e,t,r){re("Set channel"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId;let n=At();r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all"]);await tt(a,r.apikey,t,4);let o=await Mn(a,t),{bundle:u,state:l,downgrade:c,latest:p,upgrade:d,ios:f,android:h,selfAssign:m,disableAutoUpdate:v,dev:y,emulator:D}=r;e||(T.error("Missing argument, you need to provide a channel"),$.error("")),p&&u&&(T.error("Cannot set latest and bundle at the same time"),$.error("")),u==null&&l==null&&p==null&&c==null&&d==null&&f==null&&h==null&&m==null&&y==null&&D==null&&v==null&&(T.error("Missing argument, you need to provide a option to set"),$.error(""));try{await r1(a,o,r.apikey,t);let b={created_by:s,app_id:t,name:e,owner_org:o,version:void 0},_=await mi(),w=p?i?.config?.plugins?.CapacitorUpdater?.version||_?.version:u;if(w!=null){let{data:O,error:C}=await a.from("app_versions").select().eq("app_id",t).eq("name",w).eq("user_id",s).eq("deleted",!1).single();(C||!O)&&(T.error(`Cannot find version ${w}`),$.error("")),T.info(`Set ${t} channel: ${e} to @${w}`),b.version=O.id}if(l!=null&&((l==="public"||l==="private")&&T.info(`Set ${t} channel: ${e} to public or private is deprecated, use default or normal instead`),T.info(`Set ${t} channel: ${e} to ${l==="public"||l==="default"?"default":"normal"}`),b.public=l==="public"||l==="default"),c!=null&&(T.info(`Set ${t} channel: ${e} to ${c?"allow":"disallow"} downgrade`),b.disable_auto_update_under_native=!c),f!=null&&(T.info(`Set ${t} channel: ${e} to ${f?"allow":"disallow"} ios update`),b.ios=!!f),h!=null&&(T.info(`Set ${t} channel: ${e} to ${h?"allow":"disallow"} android update`),b.android=!!h),m!=null&&(T.info(`Set ${t} channel: ${e} to ${m?"allow":"disallow"} self assign to this channel`),b.allow_device_self_set=!!m),v!=null){let O=v.toLocaleLowerCase();$4e.includes(O)||(T.error(`Channel strategy ${O} is not known. The possible values are: ${$4e.join(", ")}.`),$.error("")),O==="metadata"&&(O="version_number"),b.disable_auto_update=O,T.info(`Set ${t} channel: ${e} to ${O} disable update strategy to this channel`)}try{let{error:O}=await r9(a,b);O&&(T.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),$.error(""))}catch{T.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),$.error("")}await n.track({channel:"channel",event:"Set channel",icon:"\u2705",user_id:o,tags:{"app-id":t},notify:!1}).catch()}catch(b){T.error(`Unknow error ${le(b)}`),$.error("")}ae("Done \u2705"),(0,M4e.exit)()}var V4e=require("node:process");async function H4e(e,t,r){let{quiet:i}=r;i||re("List current bundle"),r.apikey=r.apikey||Fe(i);let n=await pe();t=t||n?.config?.appId,r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all","read"]);await tt(a,r.apikey,t,1),e||(T.error("Please provide a channel to get the bundle from."),$.error(""));let{data:o,error:u}=await a.from("channels").select("version ( name )").eq("name",e).eq("app_id",t).limit(1);(u||o.length===0)&&(T.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),$.error(""));let{version:l}=o[0];l||(T.error(`Error retrieving channel ${e} for app ${t}. Perhaps the channel does not exists?`),$.error("")),i?T.info(l.name):T.info(`Current bundle for channel ${e} is ${l.name}`),(0,V4e.exit)()}var SR=require("node:process");var z4e=ve(yg());function bct(e){e.length||(T.error("No apps found"),(0,SR.exit)(1));let t=new z4e.Table({title:"Apps",charLength:{"\u274C":2,"\u2705":2}});e.reverse().forEach(r=>{t.addRow({Name:r.name,id:r.app_id,Created:n1(r.created_at)})}),T.success(t.render())}async function Dct(e){let{data:t,error:r}=await e.from("apps").select().order("created_at",{ascending:!1});return r&&(T.error("Apps not found"),$.error("")),t}async function G4e(e){re("List apps in Capgo"),await Ie(),e.apikey=e.apikey||Fe();let t=await Se(e.apikey);await Ae(t,e.apikey,["write","all","read","upload"]),T.info("Getting active bundle in Capgo");let r=await Dct(t);T.info(`Active app in Capgo: ${r?.length}`),bct(r),ae("Done \u2705"),(0,SR.exit)()}var AR=require("node:process");var S5=ve(K4e());async function Ect(e,t,r){for await(let i of e)T.warn(`Removing ${i.name} created on ${n1(i.created_at)}`),await D5(t,r,i.name)}function xct(e,t,r){let i=[];return e?.forEach(n=>{S5.default.gte(n.name,t)&&S5.default.lt(n.name,`${r}`)&&i.push(n)}),i}async function Y4e(e,t){re("Cleanup versions in Capgo"),await Ie(),t.apikey=t.apikey||Fe();let{bundle:r,keep:i=4}=t,n=t.force||!1,a=await pe();e=e||a?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide an API key to delete your app"),$.error("")),e||(T.error("Missing argument, you need to provide a appid, or be in a capacitor project"),$.error(""));let s=await Se(t.apikey);await Ae(s,t.apikey,["write","all"]),await tt(s,t.apikey,e,3),T.info("Querying all available versions in Capgo");let o=await x5(s,e),u=await D4e(s,e);if(T.info(`Total active versions in Capgo: ${o?.length}`),o?.length===0){T.error("No versions found, aborting cleanup");return}if(r){let p=`${S5.default.inc(r,"major")}`;T.info(`Querying available versions in Capgo between ${r} and ${p}`),o=xct(o,r,p),T.info(`Active versions in Capgo between ${r} and ${p}: ${o?.length}`)}let l=[],c=0;if(o.forEach(p=>{let d=u.find(f=>f===p.id);c<i||d?(d?p.keep="\u2705 (Linked to channel)":p.keep="\u2705",c+=1):(p.keep="\u274C",l.push(p))}),l.length===0){T.warn("Nothing to be removed, aborting removal...");return}if(E5(o),!n){let p=await nt({message:"Do you want to continue removing the versions specified?"});(Di(p)||!p)&&(T.warn("Not confirmed, aborting removal..."),(0,AR.exit)())}T.success("You have confirmed removal, removing versions now"),await Ect(l,s,e),ae("Done \u2705"),(0,AR.exit)()}var X4e=require("node:process");async function J4e(e,t,r){re("Delete channel"),r.apikey=r.apikey||Fe();let i=await pe();t=t||i?.config?.appId;let n=At();r.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),t||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let a=await Se(r.apikey),s=await Ae(a,r.apikey,["write","all"]);await tt(a,r.apikey,t,4),T.info(`Deleting channel ${t}#${e} from Capgo`);try{let o=await k6e(a,e,t,s);o.error&&(T.error(`Cannot delete Channel \u{1F640} ${le(o.error)}`),$.error(""));let u=await Mn(a,t);T.success("Channel deleted"),await n.track({channel:"channel",event:"Delete channel",icon:"\u2705",user_id:u,tags:{"user-id":s,"app-id":t,channel:e},notify:!1}).catch()}catch{T.error("Cannot delete Channel \u{1F640}")}ae("Done \u2705"),(0,X4e.exit)()}var Z4e=require("node:process");async function Q4e(e,t){re("List channels"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=At();t.apikey||T.error("Missing API key, you need to provide a API key to upload your bundle"),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=await Ae(n,t.apikey,["write","all","read","upload"]);await tt(n,t.apikey,e,1),T.info("Querying available channels in Capgo");let s=await R6e(n,e);T.info(`Active channels in Capgo: ${s?.length}`),N6e(s),await i.track({channel:"channel",event:"List channel",icon:"\u2705",user_id:a,tags:{"app-id":e},notify:!1}).catch(),ae("Done \u2705"),(0,Z4e.exit)()}var e3e=require("node:crypto"),L1=require("node:fs"),t3e=require("node:process");async function r3e(e,t){re("Set app"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId,t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let i=await Se(t.apikey),a=(await i1(i,["admin","super_admin"])).gid,s=await Ae(i,t.apikey,["write","all"]);await tt(i,t.apikey,e,4);let{name:o,icon:u,retention:l}=t;l&&Number.isNaN(Number(l))?(T.error("retention value must be a number"),$.error("")):l&&l<0&&(T.error("retention value cannot be less than 0"),$.error(""));let c,p,d=`icon_${(0,e3e.randomUUID)()}`,f="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(u&&(0,L1.existsSync)(u)?(c=(0,L1.readFileSync)(u),p=N1.getType(u)||"image/png",T.warn(`Found app icon ${u}`)):(0,L1.existsSync)(Gn)?(c=(0,L1.readFileSync)(Gn),p=N1.getType(Gn)||"image/png",T.warn(`Found app icon ${Gn}`)):T.warn(`Cannot find app icon in any of the following locations: ${u}, ${Gn}`),c&&p){let{error:m}=await i.storage.from(`images/org/${a}/${e}`).upload(d,c,{contentType:p});m&&(T.error(`Could not set app ${le(m)}`),$.error(""));let{data:v}=await i.storage.from(`images/org/${a}/${e}`).getPublicUrl(d);f=v?.publicUrl||f}let{error:h}=await i.from("apps").update({icon_url:f,name:o,retention:l?l*24*60*60:void 0}).eq("app_id",e).eq("user_id",s);h&&(T.error(`Could not set app ${le(h)}`),$.error("")),ae("Done \u2705"),(0,t3e.exit)()}var i3e=require("node:process");async function n3e(e,t){re("Deleting"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let i=At();t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey),a=await Ae(n,t.apikey,["write","all"]);await tt(n,t.apikey,e,5);let{data:s,error:o}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",e).single(),u=s;if(!o&&(u?.owner_org.created_by??"")!==a){T.warn("Deleting the app is not recomended for users that are not the organization owner"),T.warn("You are invited as a super_admin but your are not the owner"),T.warn("It's strongly recomended that you do not continue!");let f=await yp({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(Di(f)||f==="no")&&(T.error("Canceled deleting the app, exiting"),$.error(""))}else o&&T.warn(`Cannot get the app owner ${le(o)}`);let{error:l}=await n.storage.from("images").remove([`org/${u?.owner_org.id}/${e}/icon`]);l&&(console.error(l,`images/org/${u?.owner_org.id}/${e}`),T.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${e}/${a}`).remove(["versions"]);c&&T.error("Could not delete app version");let{error:p}=await n.from("apps").delete().eq("app_id",e);p&&(T.error("Could not delete app"),$.error(""));let d=await Mn(n,e);await i.track({channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:d,tags:{"app-id":e},notify:!1}).catch(),T.success("App deleted in Capgo"),ae("Done \u2705"),(0,i3e.exit)()}var a3e=ve(yg());async function s3e(e,t){re("Check compatibility"),t.apikey=t.apikey||Fe();let r=await pe();e=e||r?.config?.appId;let{channel:i}=t;i||(T.error("Missing argument, you need to provide a channel"),$.error("")),t.apikey||(T.error("Missing API key, you need to provide a API key to upload your bundle"),$.error("")),e||(T.error("Missing argument, you need to provide a appId, or be in a capacitor project"),$.error(""));let n=await Se(t.apikey);await Ae(n,t.apikey,["write","all","read","upload"]),await tt(n,t.apikey,e,1);let{finalCompatibility:a}=await i9(n,e,i),s=new a3e.Table({title:"Compatibility",charLength:{"\u274C":2,"\u2705":2}}),o=t.text?"Yes":"\u2705",u=t.text?"No":"\u274C";a.forEach(l=>{let{name:c,localVersion:p,remoteVersion:d}=l;s.addRow({Package:c,"Local version":p??"None","Remote version":d??"None",Compatible:d===p?o:u})}),T.success(s.render())}$.name(zo.name).description("Manage packages and bundle versions in Capgo Cloud").version(zo.version);$.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(o4e).option("--local","Only save in local folder");$.command("doctor").description("Get info about your Capgo app install").action(I4e);$.command("init [apikey] [appId]").description("Init a new app").action(y4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path");var B1=$.command("app").description("Manage app");B1.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(f4e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");B1.command("delete [appId]").description("Delete an app in Capgo Cloud").action(n3e).option("-a, --apikey <apikey>","apikey to link to your account");B1.command("list").alias("l").description("list apps in Capgo Cloud").action(G4e).option("-a, --apikey <apikey>","apikey to link to your account");B1.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(l6e);B1.command("setting [path]").description("Modifies capacitor config programmatically").option("--bool <bool>","A value for the setting to modify as a boolean").option("--string <string>","A value for the setting to modify as a string").action(Pfe);B1.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(r3e).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var Ts=$.command("bundle").description("Manage bundle");Ts.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(n4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","public signing key").option("--key-v2 <key>","custom path for private signing key").option("--key-data-v2 <keyData>","private signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("--tus","Upload the bundle using tus").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3").option("--partial","Upload partial files to S3").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.");Ts.command("compatibility [appId]").action(s3e).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis");Ts.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action(q4e).option("-a, --apikey <apikey>","apikey to link to your account");Ts.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(x4e).option("-a, --apikey <apikey>","apikey to link to your account");Ts.command("cleanup [appId]").alias("c").action(Y4e).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");Ts.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(S4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");Ts.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(k4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");Ts.command("encryptV2 [zipPath] [checksum]").description("Encrypt a zip bundle using the new encryption method").action(R4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("-j, --json","output in JSON");Ts.command("decryptV2 [zipPath] [checksum]").description("Decrypt a zip bundle using the new encryption method").action(T4e).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("--checksum <checksum>","checksum of the bundle, to verify the integrity of the bundle");Ts.command("zip [appId]").description("Zip a bundle").action(jge).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--key-v2","use encryption v2");var Sg=$.command("channel").description("Manage channel");Sg.command("add [channelId] [appId]").alias("a").description("Create channel").action(I6e).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(J4e).option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("list [appId]").alias("l").description("List channel").action(Q4e).option("-a, --apikey <apikey>","apikey to link to your account");Sg.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(H4e).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");Sg.command("set [channelId] [appId]").alias("s").description("Set channel").action(U4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices");var o3e=$.command("key_old").description("Manage old encryption key");o3e.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(L4e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");o3e.command("create").description("Create a new encryption key").action(B4e).option("-f, --force","force generate a new one");var OR=$.command("key").description("Manage encryption key");OR.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(a6e).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");OR.command("create").description("Create a new encryption key").action(s6e).option("-f, --force","force generate a new one");OR.command("delete_old").description("Delete the old encryption key").action(o6e);$.command("upload [appId]").alias("u").description("(Deprecated) Upload a new bundle to Capgo Cloud").action(a4e).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--old-encryption","use old encryption").option("--key <key>","custom path for public signing key").option("--key-data <keyData>","public signing key").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the file to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel");var Cct=$.command("account").description("Manage account");Cct.command("id").description("Get your account ID").action(Ife).option("-a, --apikey <apikey>","apikey to link to your account");$.parseAsync();
|
|
420
420
|
/*! Bundled license information:
|
|
421
421
|
|
|
422
422
|
is-extglob/index.js:
|