petdex 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/petdex.js +89 -88
  2. package/package.json +1 -1
package/dist/petdex.js CHANGED
@@ -1,84 +1,85 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as eJ}from"node:module";var oJ=Object.create;var{getPrototypeOf:iJ,defineProperty:bQ,getOwnPropertyNames:nJ}=Object;var rJ=Object.prototype.hasOwnProperty;function aJ($){return this[$]}var sJ,tJ,C1=($,Q,V)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?sJ??=new WeakMap:tJ??=new WeakMap,X=Y.get($);if(X)return X}V=$!=null?oJ(iJ($)):{};let J=Q||!$||!$.__esModule?bQ(V,"default",{value:$,enumerable:!0}):V;for(let G of nJ($))if(!rJ.call(J,G))bQ(J,G,{get:aJ.bind($,G),enumerable:!0});if(q)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var i=eJ(import.meta.url);var I8=w((QH,_Q)=>{var L8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let V="";if($<0)V+=`\x1B[${-$}D`;else if($>0)V+=`\x1B[${$}C`;if(Q<0)V+=`\x1B[${-Q}A`;else if(Q>0)V+=`\x1B[${Q}B`;return V},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},$Y={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},QY={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Q="";for(let V=0;V<$;V++)Q+=this.line+(V<$-1?L8.up():"");if($)Q+=L8.left;return Q}};_Q.exports={cursor:L8,scroll:$Y,erase:QY,beep:"\x07"}});var f1=w((VH,B8)=>{var e$=process||{},fQ=e$.argv||[],t$=e$.env||{},VY=!(!!t$.NO_COLOR||fQ.includes("--no-color"))&&(!!t$.FORCE_COLOR||fQ.includes("--color")||e$.platform==="win32"||(e$.stdout||{}).isTTY&&t$.TERM!=="dumb"||!!t$.CI),qY=($,Q,V=$)=>(q)=>{let Y=""+q,X=Y.indexOf(Q,$.length);return~X?$+JY(Y,Q,V,X)+Q:$+Y+Q},JY=($,Q,V,q)=>{let Y="",X=0;do Y+=$.substring(X,q)+V,X=q+Q.length,q=$.indexOf(Q,X);while(~q);return Y+$.substring(X)},mQ=($=VY)=>{let Q=$?qY:()=>String;return{isColorSupported:$,reset:Q("\x1B[0m","\x1B[0m"),bold:Q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Q("\x1B[3m","\x1B[23m"),underline:Q("\x1B[4m","\x1B[24m"),inverse:Q("\x1B[7m","\x1B[27m"),hidden:Q("\x1B[8m","\x1B[28m"),strikethrough:Q("\x1B[9m","\x1B[29m"),black:Q("\x1B[30m","\x1B[39m"),red:Q("\x1B[31m","\x1B[39m"),green:Q("\x1B[32m","\x1B[39m"),yellow:Q("\x1B[33m","\x1B[39m"),blue:Q("\x1B[34m","\x1B[39m"),magenta:Q("\x1B[35m","\x1B[39m"),cyan:Q("\x1B[36m","\x1B[39m"),white:Q("\x1B[37m","\x1B[39m"),gray:Q("\x1B[90m","\x1B[39m"),bgBlack:Q("\x1B[40m","\x1B[49m"),bgRed:Q("\x1B[41m","\x1B[49m"),bgGreen:Q("\x1B[42m","\x1B[49m"),bgYellow:Q("\x1B[43m","\x1B[49m"),bgBlue:Q("\x1B[44m","\x1B[49m"),bgMagenta:Q("\x1B[45m","\x1B[49m"),bgCyan:Q("\x1B[46m","\x1B[49m"),bgWhite:Q("\x1B[47m","\x1B[49m"),blackBright:Q("\x1B[90m","\x1B[39m"),redBright:Q("\x1B[91m","\x1B[39m"),greenBright:Q("\x1B[92m","\x1B[39m"),yellowBright:Q("\x1B[93m","\x1B[39m"),blueBright:Q("\x1B[94m","\x1B[39m"),magentaBright:Q("\x1B[95m","\x1B[39m"),cyanBright:Q("\x1B[96m","\x1B[39m"),whiteBright:Q("\x1B[97m","\x1B[39m"),bgBlackBright:Q("\x1B[100m","\x1B[49m"),bgRedBright:Q("\x1B[101m","\x1B[49m"),bgGreenBright:Q("\x1B[102m","\x1B[49m"),bgYellowBright:Q("\x1B[103m","\x1B[49m"),bgBlueBright:Q("\x1B[104m","\x1B[49m"),bgMagentaBright:Q("\x1B[105m","\x1B[49m"),bgCyanBright:Q("\x1B[106m","\x1B[49m"),bgWhiteBright:Q("\x1B[107m","\x1B[49m")}};B8.exports=mQ();B8.exports.createColors=mQ});var Y$=w((OH,k8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)k8.exports={nextTick:uY};else k8.exports=process;function uY($,Q,V,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,V)});case 4:return process.nextTick(function(){$.call(null,Q,V,q)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var ZV=w((NH,jV)=>{var dY={}.toString;jV.exports=Array.isArray||function($){return dY.call($)=="[object Array]"}});var X$=w((y8,PV)=>{var X6=i("buffer"),c1=X6.Buffer;function HV($,Q){for(var V in $)Q[V]=$[V]}if(c1.from&&c1.alloc&&c1.allocUnsafe&&c1.allocUnsafeSlow)PV.exports=X6;else HV(X6,y8),y8.Buffer=v0;function v0($,Q,V){return c1($,Q,V)}HV(c1,v0);v0.from=function($,Q,V){if(typeof $==="number")throw TypeError("Argument must not be a number");return c1($,Q,V)};v0.alloc=function($,Q,V){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=c1($);if(Q!==void 0)if(typeof V==="string")q.fill(Q,V);else q.fill(Q);else q.fill(0);return q};v0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return c1($)};v0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return X6.SlowBuffer($)}});var x0=w((Y4)=>{function lY($){if(Array.isArray)return Array.isArray($);return G6($)==="[object Array]"}Y4.isArray=lY;function oY($){return typeof $==="boolean"}Y4.isBoolean=oY;function iY($){return $===null}Y4.isNull=iY;function nY($){return $==null}Y4.isNullOrUndefined=nY;function rY($){return typeof $==="number"}Y4.isNumber=rY;function aY($){return typeof $==="string"}Y4.isString=aY;function sY($){return typeof $==="symbol"}Y4.isSymbol=sY;function tY($){return $===void 0}Y4.isUndefined=tY;function eY($){return G6($)==="[object RegExp]"}Y4.isRegExp=eY;function $4($){return typeof $==="object"&&$!==null}Y4.isObject=$4;function Q4($){return G6($)==="[object Date]"}Y4.isDate=Q4;function V4($){return G6($)==="[object Error]"||$ instanceof Error}Y4.isError=V4;function q4($){return typeof $==="function"}Y4.isFunction=q4;function J4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}Y4.isPrimitive=J4;Y4.isBuffer=i("buffer").Buffer.isBuffer;function G6($){return Object.prototype.toString.call($)}});var zV=w((CH,D8)=>{if(typeof Object.create==="function")D8.exports=function(Q,V){if(V)Q.super_=V,Q.prototype=Object.create(V.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else D8.exports=function(Q,V){if(V){Q.super_=V;var q=function(){};q.prototype=V.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var S0=w((wH,h8)=>{try{if(K6=i("util"),typeof K6.inherits!=="function")throw"";h8.exports=K6.inherits}catch($){h8.exports=zV()}var K6});var IV=w((TH,b8)=>{function M4($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var LV=X$().Buffer,G$=i("util");function C4($,Q,V){$.copy(Q,V)}b8.exports=function(){function $(){M4(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(V){var q={data:V,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(V){var q={data:V,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var V=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,V},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(V){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=V+q.data;return Y},$.prototype.concat=function(V){if(this.length===0)return LV.alloc(0);var q=LV.allocUnsafe(V>>>0),Y=this.head,X=0;while(Y)C4(Y.data,q,X),X+=Y.data.length,Y=Y.next;return q},$}();if(G$&&G$.inspect&&G$.inspect.custom)b8.exports.prototype[G$.inspect.custom]=function(){var $=G$.inspect({length:this.length});return this.constructor.name+" "+$}});var _8=w((AH,BV)=>{var W6=Y$();function w4($,Q){var V=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)W6.nextTick(U6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,W6.nextTick(U6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!V._writableState)W6.nextTick(U6,V,X);else if(!V._writableState.errorEmitted)V._writableState.errorEmitted=!0,W6.nextTick(U6,V,X)}else if(Q)Q(X)}),this}function T4(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function U6($,Q){$.emit("error",Q)}BV.exports={destroy:w4,undestroy:T4}});var NV=w((FH,OV)=>{OV.exports=i("util").deprecate});var m8=w((RH,vV)=>{var W0=Y$();vV.exports=l;function CV($){var Q=this;this.next=null,this.entry=null,this.finish=function(){p4(Q,$)}}var A4=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:W0.nextTick,E0;l.WritableState=W$;var wV=Object.create(x0());wV.inherits=S0();var F4={deprecate:NV()},TV=i("stream"),Z6=X$().Buffer,R4=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function v4($){return Z6.from($)}function x4($){return Z6.isBuffer($)||$ instanceof R4}var AV=_8();wV.inherits(l,TV);function S4(){}function W$($,Q){E0=E0||U0(),$=$||{};var V=Q instanceof E0;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){b4(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CV(this)}W$.prototype.getBuffer=function(){var Q=this.bufferedRequest,V=[];while(Q)V.push(Q),Q=Q.next;return V};(function(){try{Object.defineProperty(W$.prototype,"buffer",{get:F4.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var j6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")j6=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function($){if(j6.call(this,$))return!0;if(this!==l)return!1;return $&&$._writableState instanceof W$}});else j6=function($){return $ instanceof this};function l($){if(E0=E0||U0(),!j6.call(l,this)&&!(this instanceof E0))return new l($);if(this._writableState=new W$($,this),this.writable=!0,$){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}TV.call(this)}l.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function E4($,Q){var V=Error("write after end");$.emit("error",V),W0.nextTick(Q,V)}function g4($,Q,V,q){var Y=!0,X=!1;if(V===null)X=TypeError("May not write null values to stream");else if(typeof V!=="string"&&V!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),W0.nextTick(q,X),Y=!1;return Y}l.prototype.write=function($,Q,V){var q=this._writableState,Y=!1,X=!q.objectMode&&x4($);if(X&&!Z6.isBuffer($))$=v4($);if(typeof Q==="function")V=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof V!=="function")V=S4;if(q.ended)E4(this,V);else if(X||g4(this,q,$,V))q.pendingcb++,Y=y4(this,q,X,$,Q,V);return Y};l.prototype.cork=function(){var $=this._writableState;$.corked++};l.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)FV(this,$)}};l.prototype.setDefaultEncoding=function(Q){if(typeof Q==="string")Q=Q.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Q+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+Q);return this._writableState.defaultEncoding=Q,this};function k4($,Q,V){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=Z6.from(Q,V);return Q}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function y4($,Q,V,q,Y,X){if(!V){var J=k4(Q,q,Y);if(q!==J)V=!0,Y="buffer",q=J}var G=Q.objectMode?1:q.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:V,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else f8($,Q,!1,G,q,Y,X);return U}function f8($,Q,V,q,Y,X,J){if(Q.writelen=q,Q.writecb=J,Q.writing=!0,Q.sync=!0,V)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function D4($,Q,V,q,Y){if(--Q.pendingcb,V)W0.nextTick(Y,q),W0.nextTick(K$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),K$($,Q)}function h4($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function b4($,Q){var V=$._writableState,q=V.sync,Y=V.writecb;if(h4(V),Q)D4($,V,q,Q,Y);else{var X=RV(V);if(!X&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest)FV($,V);if(q)A4(MV,$,V,X,Y);else MV($,V,X,Y)}}function MV($,Q,V,q){if(!V)_4($,Q);Q.pendingcb--,q(),K$($,Q)}function _4($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function FV($,Q){Q.bufferProcessing=!0;var V=Q.bufferedRequest;if($._writev&&V&&V.next){var q=Q.bufferedRequestCount,Y=Array(q),X=Q.corkedRequestsFree;X.entry=V;var J=0,G=!0;while(V){if(Y[J]=V,!V.isBuf)G=!1;V=V.next,J+=1}if(Y.allBuffers=G,f8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new CV(Q);Q.bufferedRequestCount=0}else{while(V){var{chunk:U,encoding:K,callback:W}=V,j=Q.objectMode?1:U.length;if(f8($,Q,!1,j,U,K,W),V=V.next,Q.bufferedRequestCount--,Q.writing)break}if(V===null)Q.lastBufferedRequest=null}Q.bufferedRequest=V,Q.bufferProcessing=!1}l.prototype._write=function($,Q,V){V(Error("_write() is not implemented"))};l.prototype._writev=null;l.prototype.end=function($,Q,V){var q=this._writableState;if(typeof $==="function")V=$,$=null,Q=null;else if(typeof Q==="function")V=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)c4(this,q,V)};function RV($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function f4($,Q){$._final(function(V){if(Q.pendingcb--,V)$.emit("error",V);Q.prefinished=!0,$.emit("prefinish"),K$($,Q)})}function m4($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,W0.nextTick(f4,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function K$($,Q){var V=RV(Q);if(V){if(m4($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return V}function c4($,Q,V){if(Q.ending=!0,K$($,Q),V)if(Q.finished)W0.nextTick(V);else $.once("finish",V);Q.ended=!0,$.writable=!1}function p4($,Q,V){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(V),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(l.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});l.prototype.destroy=AV.destroy;l.prototype._undestroy=AV.undestroy;l.prototype._destroy=function($,Q){this.end(),Q($)}});var U0=w((vH,gV)=>{var xV=Y$(),u4=Object.keys||function($){var Q=[];for(var V in $)Q.push(V);return Q};gV.exports=p1;var SV=Object.create(x0());SV.inherits=S0();var EV=p8(),c8=m8();SV.inherits(p1,EV);{H6=u4(c8.prototype);for(U$=0;U$<H6.length;U$++)if(j$=H6[U$],!p1.prototype[j$])p1.prototype[j$]=c8.prototype[j$]}var H6,j$,U$;function p1($){if(!(this instanceof p1))return new p1($);if(EV.call(this,$),c8.call(this,$),$&&$.readable===!1)this.readable=!1;if($&&$.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,$&&$.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",d4)}Object.defineProperty(p1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function d4(){if(this.allowHalfOpen||this._writableState.ended)return;xV.nextTick(l4,this)}function l4($){$.end()}Object.defineProperty(p1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});p1.prototype._destroy=function($,Q){this.push(null),this.end(),xV.nextTick(Q,$)}});var l8=w((YX)=>{var d8=X$().Buffer,kV=d8.isEncoding||function($){switch($=""+$,$&&$.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o4($){if(!$)return"utf8";var Q;while(!0)switch($){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return $;default:if(Q)return;$=(""+$).toLowerCase(),Q=!0}}function i4($){var Q=o4($);if(typeof Q!=="string"&&(d8.isEncoding===kV||!kV($)))throw Error("Unknown encoding: "+$);return Q||$}YX.StringDecoder=Z$;function Z$($){this.encoding=i4($);var Q;switch(this.encoding){case"utf16le":this.text=e4,this.end=$X,Q=4;break;case"utf8":this.fillLast=a4,Q=4;break;case"base64":this.text=QX,this.end=VX,Q=3;break;default:this.write=qX,this.end=JX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=d8.allocUnsafe(Q)}Z$.prototype.write=function($){if($.length===0)return"";var Q,V;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";V=this.lastNeed,this.lastNeed=0}else V=0;if(V<$.length)return Q?Q+this.text($,V):this.text($,V);return Q||""};Z$.prototype.end=t4;Z$.prototype.text=s4;Z$.prototype.fillLast=function($){if(this.lastNeed<=$.length)return $.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length),this.lastNeed-=$.length};function u8($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function n4($,Q,V){var q=Q.length-1;if(q<V)return 0;var Y=u8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<V||Y===-2)return 0;if(Y=u8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<V||Y===-2)return 0;if(Y=u8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function r4($,Q,V){if((Q[0]&192)!==128)return $.lastNeed=0,"�";if($.lastNeed>1&&Q.length>1){if((Q[1]&192)!==128)return $.lastNeed=1,"�";if($.lastNeed>2&&Q.length>2){if((Q[2]&192)!==128)return $.lastNeed=2,"�"}}}function a4($){var Q=this.lastTotal-this.lastNeed,V=r4(this,$,Q);if(V!==void 0)return V;if(this.lastNeed<=$.length)return $.copy(this.lastChar,Q,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,Q,0,$.length),this.lastNeed-=$.length}function s4($,Q){var V=n4(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=V;var q=$.length-(V-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function t4($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function e4($,Q){if(($.length-Q)%2===0){var V=$.toString("utf16le",Q);if(V){var q=V.charCodeAt(V.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],V.slice(0,-1)}return V}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function $X($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var V=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,V)}return Q}function QX($,Q){var V=($.length-Q)%3;if(V===0)return $.toString("base64",Q);if(this.lastNeed=3-V,this.lastTotal=3,V===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-V)}function VX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function qX($){return $.toString(this.encoding)}function JX($){return $&&$.length?this.write($):""}});var p8=w((EH,lV)=>{var k0=Y$();lV.exports=_;var GX=ZV(),H$;_.ReadableState=mV;var SH=i("events").EventEmitter,bV=function($,Q){return $.listeners(Q).length},a8=i("stream"),P$=X$().Buffer,KX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function WX($){return P$.from($)}function UX($){return P$.isBuffer($)||$ instanceof KX}var _V=Object.create(x0());_V.inherits=S0();var o8=i("util"),k=void 0;if(o8&&o8.debuglog)k=o8.debuglog("stream");else k=function(){};var jX=IV(),fV=_8(),g0;_V.inherits(_,a8);var i8=["error","close","destroy","pause","resume"];function ZX($,Q,V){if(typeof $.prependListener==="function")return $.prependListener(Q,V);if(!$._events||!$._events[Q])$.on(Q,V);else if(GX($._events[Q]))$._events[Q].unshift(V);else $._events[Q]=[V,$._events[Q]]}function mV($,Q){H$=H$||U0(),$=$||{};var V=Q instanceof H$;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new jX,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding){if(!g0)g0=l8().StringDecoder;this.decoder=new g0($.encoding),this.encoding=$.encoding}}function _($){if(H$=H$||U0(),!(this instanceof _))return new _($);if(this._readableState=new mV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}a8.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=fV.destroy;_.prototype._undestroy=fV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var V=this._readableState,q;if(!V.objectMode){if(typeof $==="string"){if(Q=Q||V.defaultEncoding,Q!==V.encoding)$=P$.from($,Q),Q="";q=!0}}else q=!0;return cV(this,$,Q,!1,q)};_.prototype.unshift=function($){return cV(this,$,null,!0,!1)};function cV($,Q,V,q,Y){var X=$._readableState;if(Q===null)X.reading=!1,LX($,X);else{var J;if(!Y)J=HX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==P$.prototype)Q=WX(Q);if(q)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else n8($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!V)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)n8($,X,Q,!1);else pV($,X);else n8($,X,Q,!1)}else if(!q)X.reading=!1}return PX(X)}function n8($,Q,V,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",V),$.read(0);else{if(Q.length+=Q.objectMode?1:V.length,q)Q.buffer.unshift(V);else Q.buffer.push(V);if(Q.needReadable)P6($)}pV($,Q)}function HX($,Q){var V;if(!UX(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)V=TypeError("Invalid non-string/buffer chunk");return V}function PX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!g0)g0=l8().StringDecoder;return this._readableState.decoder=new g0($),this._readableState.encoding=$,this};var yV=8388608;function zX($){if($>=yV)$=yV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function DV($,Q){if($<=0||Q.length===0&&Q.ended)return 0;if(Q.objectMode)return 1;if($!==$)if(Q.flowing&&Q.length)return Q.buffer.head.data.length;else return Q.length;if($>Q.highWaterMark)Q.highWaterMark=zX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){k("read",$),$=parseInt($,10);var Q=this._readableState,V=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(k("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)r8(this);else P6(this);return null}if($=DV($,Q),$===0&&Q.ended){if(Q.length===0)r8(this);return null}var q=Q.needReadable;if(k("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,k("length less than watermark",q);if(Q.ended||Q.reading)q=!1,k("reading or ended",q);else if(q){if(k("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=DV(V,Q)}var Y;if($>0)Y=uV($,Q);else Y=null;if(Y===null)Q.needReadable=!0,$=0;else Q.length-=$;if(Q.length===0){if(!Q.ended)Q.needReadable=!0;if(V!==$&&Q.ended)r8(this)}if(Y!==null)this.emit("data",Y);return Y};function LX($,Q){if(Q.ended)return;if(Q.decoder){var V=Q.decoder.end();if(V&&V.length)Q.buffer.push(V),Q.length+=Q.objectMode?1:V.length}Q.ended=!0,P6($)}function P6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(k("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)k0.nextTick(hV,$);else hV($)}function hV($){k("emit readable"),$.emit("readable"),s8($)}function pV($,Q){if(!Q.readingMore)Q.readingMore=!0,k0.nextTick(IX,$,Q)}function IX($,Q){var V=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(k("maybeReadMore read 0"),$.read(0),V===Q.length)break;else V=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var V=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=$;break;case 1:q.pipes=[q.pipes,$];break;default:q.pipes.push($);break}q.pipesCount+=1,k("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:M;if(q.endEmitted)k0.nextTick(X);else V.once("end",X);$.on("unpipe",J);function J(N,L){if(k("onunpipe"),N===V){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){k("onend"),$.end()}var U=BX(V);$.on("drain",U);var K=!1;function W(){if(k("cleanup"),$.removeListener("close",C),$.removeListener("finish",z),$.removeListener("drain",U),$.removeListener("error",H),$.removeListener("unpipe",J),V.removeListener("end",G),V.removeListener("end",M),V.removeListener("data",Z),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var j=!1;V.on("data",Z);function Z(N){k("ondata"),j=!1;var L=$.write(N);if(L===!1&&!j){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&dV(q.pipes,$)!==-1)&&!K)k("false write response, pause",q.awaitDrain),q.awaitDrain++,j=!0;V.pause()}}function H(N){if(k("onerror",N),M(),$.removeListener("error",H),bV($,"error")===0)$.emit("error",N)}ZX($,"error",H);function C(){$.removeListener("finish",z),M()}$.once("close",C);function z(){k("onfinish"),$.removeListener("close",C),M()}$.once("finish",z);function M(){k("unpipe"),V.unpipe($)}if($.emit("pipe",V),!q.flowing)k("pipe resume"),V.resume();return $};function BX($){return function(){var Q=$._readableState;if(k("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&bV($,"data"))Q.flowing=!0,s8($)}}_.prototype.unpipe=function($){var Q=this._readableState,V={hasUnpiped:!1};if(Q.pipesCount===0)return this;if(Q.pipesCount===1){if($&&$!==Q.pipes)return this;if(!$)$=Q.pipes;if(Q.pipes=null,Q.pipesCount=0,Q.flowing=!1,$)$.emit("unpipe",this,V);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)q[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=dV(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,V),this};_.prototype.on=function($,Q){var V=a8.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var q=this._readableState;if(!q.endEmitted&&!q.readableListening){if(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,!q.reading)k0.nextTick(OX,this);else if(q.length)P6(this)}}return V};_.prototype.addListener=_.prototype.on;function OX($){k("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)k("resume"),$.flowing=!0,NX(this,$);return this};function NX($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,k0.nextTick(MX,$,Q)}function MX($,Q){if(!Q.reading)k("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),s8($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(k("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)k("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function s8($){var Q=$._readableState;k("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,V=this._readableState,q=!1;$.on("end",function(){if(k("wrapped end"),V.decoder&&!V.ended){var J=V.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(k("wrapped data"),V.decoder)J=V.decoder.write(J);if(V.objectMode&&(J===null||J===void 0))return;else if(!V.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<i8.length;X++)$.on(i8[X],this.emit.bind(this,i8[X]));return this._read=function(J){if(k("wrapped _read",J),q)q=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=uV;function uV($,Q){if(Q.length===0)return null;var V;if(Q.objectMode)V=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)V=Q.buffer.join("");else if(Q.buffer.length===1)V=Q.buffer.head.data;else V=Q.buffer.concat(Q.length);Q.buffer.clear()}else V=CX($,Q.buffer,Q.decoder);return V}function CX($,Q,V){var q;if($<Q.head.data.length)q=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)q=Q.shift();else q=V?wX($,Q):TX($,Q);return q}function wX($,Q){var V=Q.head,q=1,Y=V.data;$-=Y.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++q,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++q}return Q.length-=q,Y}function TX($,Q){var V=P$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(V),$-=q.data.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(X.copy(V,V.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++Y}return Q.length-=Y,V}function r8($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,k0.nextTick(AX,Q,$)}function AX($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function dV($,Q){for(var V=0,q=$.length;V<q;V++)if($[V]===Q)return V;return-1}});var t8=w((gH,nV)=>{nV.exports=u1;var z6=U0(),iV=Object.create(x0());iV.inherits=S0();iV.inherits(u1,z6);function FX($,Q){var V=this._transformState;V.transforming=!1;var q=V.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(V.writechunk=null,V.writecb=null,Q!=null)this.push(Q);q($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function u1($){if(!(this instanceof u1))return new u1($);if(z6.call(this,$),this._transformState={afterTransform:FX.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,$){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",RX)}function RX(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,V){oV($,Q,V)});else oV(this,null,null)}u1.prototype.push=function($,Q){return this._transformState.needTransform=!1,z6.prototype.push.call(this,$,Q)};u1.prototype._transform=function($,Q,V){throw Error("_transform() is not implemented")};u1.prototype._write=function($,Q,V){var q=this._transformState;if(q.writecb=V,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};u1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};u1.prototype._destroy=function($,Q){var V=this;z6.prototype._destroy.call(this,$,function(q){Q(q),V.emit("close")})};function oV($,Q,V){if(Q)return $.emit("error",Q);if(V!=null)$.push(V);if($._writableState.length)throw Error("Calling transform done when ws.length != 0");if($._transformState.transforming)throw Error("Calling transform done when still transforming");return $.push(null)}});var tV=w((kH,sV)=>{sV.exports=z$;var rV=t8(),aV=Object.create(x0());aV.inherits=S0();aV.inherits(z$,rV);function z$($){if(!(this instanceof z$))return new z$($);rV.call(this,$)}z$.prototype._transform=function($,Q,V){V(null,$)}});var e8=w((a,L6)=>{var S1=i("stream");if(process.env.READABLE_STREAM==="disable"&&S1)L6.exports=S1,a=L6.exports=S1.Readable,a.Readable=S1.Readable,a.Writable=S1.Writable,a.Duplex=S1.Duplex,a.Transform=S1.Transform,a.PassThrough=S1.PassThrough,a.Stream=S1;else a=L6.exports=p8(),a.Stream=S1||a,a.Readable=a,a.Writable=m8(),a.Duplex=U0(),a.Transform=t8(),a.PassThrough=tV()});var d1=w((xX)=>{xX.base64=!0;xX.array=!0;xX.string=!0;xX.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";xX.nodebuffer=typeof Buffer<"u";xX.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")xX.blob=!1;else{I6=new ArrayBuffer(0);try{xX.blob=new Blob([I6],{type:"application/zip"}).size===0}catch($){try{Q5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,B6=new Q5,B6.append(I6),xX.blob=B6.getBlob("application/zip").size===0}catch(Q){xX.blob=!1}}}var I6,Q5,B6;try{xX.nodestream=!!e8().Readable}catch($){xX.nodestream=!1}});var V5=w((_X)=>{var hX=p(),bX=d1(),E1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";_X.encode=function($){var Q=[],V,q,Y,X,J,G,U,K=0,W=$.length,j=W,Z=hX.getTypeOf($)!=="string";while(K<$.length){if(j=W-K,!Z)V=$.charCodeAt(K++),q=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else V=$[K++],q=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=V>>2,J=(V&3)<<4|q>>4,G=j>1?(q&15)<<2|Y>>6:64,U=j>2?Y&63:64,Q.push(E1.charAt(X)+E1.charAt(J)+E1.charAt(G)+E1.charAt(U))}return Q.join("")};_X.decode=function($){var Q,V,q,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var j=$.length*3/4;if($.charAt($.length-1)===E1.charAt(64))j--;if($.charAt($.length-2)===E1.charAt(64))j--;if(j%1!==0)throw Error("Invalid base64 input, bad content length.");var Z;if(bX.uint8array)Z=new Uint8Array(j|0);else Z=Array(j|0);while(U<$.length){if(Y=E1.indexOf($.charAt(U++)),X=E1.indexOf($.charAt(U++)),J=E1.indexOf($.charAt(U++)),G=E1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,V=(X&15)<<4|J>>2,q=(J&3)<<6|G,Z[K++]=Q,J!==64)Z[K++]=V;if(G!==64)Z[K++]=q}return Z}});var L$=w((hH,eV)=>{eV.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,Q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,Q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,Q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var Q=new Buffer($);return Q.fill(0),Q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var Vq=w((_H,Qq)=>{var bH=global.MutationObserver||global.WebKitMutationObserver,$q;$q=function(){process.nextTick(lX)};var cX,pX,uX,dX,q5,I$=[];function lX(){q5=!0;var $,Q,V=I$.length;while(V){Q=I$,I$=[],$=-1;while(++$<V)Q[$]();V=I$.length}q5=!1}Qq.exports=oX;function oX($){if(I$.push($)===1&&!q5)$q()}});var Wq=w((fH,Kq)=>{var qq=Vq();function D0(){}var $1={},Jq=["REJECTED"],J5=["FULFILLED"],Yq=["PENDING"];y0=["UNHANDLED"];var y0;Kq.exports=t1;function t1($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Yq,this.queue=[],this.outcome=void 0,this.handled=y0,$!==D0)Xq(this,$)}t1.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(V,q);function V(Y){function X(){return Y}return Q.resolve($()).then(X)}function q(Y){function X(){throw Y}return Q.resolve($()).then(X)}};t1.prototype.catch=function($){return this.then(null,$)};t1.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===J5||typeof Q!=="function"&&this.state===Jq)return this;var V=new this.constructor(D0);if(this.handled===y0)this.handled=null;if(this.state!==Yq){var q=this.state===J5?$:Q;Y5(V,q,this.outcome)}else this.queue.push(new B$(V,$,Q));return V};function B$($,Q,V){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof V==="function")this.onRejected=V,this.callRejected=this.otherCallRejected}B$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};B$.prototype.otherCallFulfilled=function($){Y5(this.promise,this.onFulfilled,$)};B$.prototype.callRejected=function($){$1.reject(this.promise,$)};B$.prototype.otherCallRejected=function($){Y5(this.promise,this.onRejected,$)};function Y5($,Q,V){qq(function(){var q;try{q=Q(V)}catch(Y){return $1.reject($,Y)}if(q===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,q)})}$1.resolve=function($,Q){var V=Gq(iX,Q);if(V.status==="error")return $1.reject($,V.value);var q=V.value;if(q)Xq($,q);else{$.state=J5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=Jq,$.outcome=Q,$.handled===y0)qq(function(){if($.handled===y0)process.emit("unhandledRejection",Q,$)});var V=-1,q=$.queue.length;while(++V<q)$.queue[V].callRejected(Q);return $};function iX($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function Xq($,Q){var V=!1;function q(G){if(V)return;V=!0,$1.reject($,G)}function Y(G){if(V)return;V=!0,$1.resolve($,G)}function X(){Q(Y,q)}var J=Gq(X);if(J.status==="error")q(J.value)}function Gq($,Q){var V={};try{V.value=$(Q),V.status="success"}catch(q){V.status="error",V.value=q}return V}t1.resolve=nX;function nX($){if($ instanceof this)return $;return $1.resolve(new this(D0),$)}t1.reject=rX;function rX($){var Q=new this(D0);return $1.reject(Q,$)}t1.all=aX;function aX($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=Array(V),X=0,J=-1,G=new this(D0);while(++J<V)U($[J],J);return G;function U(K,W){Q.resolve(K).then(j,function(Z){if(!q)q=!0,$1.reject(G,Z)});function j(Z){if(Y[W]=Z,++X===V&&!q)q=!0,$1.resolve(G,Y)}}}t1.race=sX;function sX($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=-1,X=new this(D0);while(++Y<V)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!q)q=!0,$1.resolve(X,U)},function(U){if(!q)q=!0,$1.reject(X,U)})}}});var h0=w((mH,Uq)=>{var X5=null;if(typeof Promise<"u")X5=Promise;else X5=Wq();Uq.exports={Promise:X5}});var Zq=w((jq)=>{(function($,Q){if($.setImmediate)return;var V=1,q={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var T=Array(arguments.length-1);for(var B=0;B<T.length;B++)T[B]=arguments[B+1];var I={callback:L,args:T};return q[V]=I,J(V),V++}function U(L){delete q[L]}function K(L){var{callback:T,args:B}=L;switch(B.length){case 0:T();break;case 1:T(B[0]);break;case 2:T(B[0],B[1]);break;case 3:T(B[0],B[1],B[2]);break;default:T.apply(Q,B);break}}function W(L){if(Y)setTimeout(W,0,L);else{var T=q[L];if(T){Y=!0;try{K(T)}finally{U(L),Y=!1}}}}function j(){J=function(L){process.nextTick(function(){W(L)})}}function Z(){if($.postMessage&&!$.importScripts){var L=!0,T=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=T,L}}function H(){var L="setImmediate$"+Math.random()+"$",T=function(B){if(B.source===$&&typeof B.data==="string"&&B.data.indexOf(L)===0)W(+B.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",T,!1);else $.attachEvent("onmessage",T);J=function(B){$.postMessage(L+B,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(T){var B=T.data;W(B)},J=function(T){L.port2.postMessage(T)}}function z(){var L=X.documentElement;J=function(T){var B=X.createElement("script");B.onreadystatechange=function(){W(T),B.onreadystatechange=null,L.removeChild(B),B=null},L.appendChild(B)}}function M(){J=function(L){setTimeout(W,0,L)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf($);if(N=N&&N.setTimeout?N:$,{}.toString.call($.process)==="[object process]")j();else if(Z())H();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))z();else M();N.setImmediate=G,N.clearImmediate=U})(typeof self>"u"?typeof global>"u"?jq:global:self)});var p=w(($G)=>{var e1=d1(),tX=V5(),b0=L$(),G5=h0();Zq();function eX($){var Q=null;if(e1.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return N6($,Q)}$G.newBlob=function($,Q){$G.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var V=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new V;return q.append($),q.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function O$($){return $}function N6($,Q){for(var V=0;V<$.length;++V)Q[V]=$.charCodeAt(V)&255;return Q}var O6={stringifyByChunk:function($,Q,V){var q=[],Y=0,X=$.length;if(X<=V)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+V,X))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+V,X))));Y+=V}return q.join("")},stringifyByChar:function($){var Q="";for(var V=0;V<$.length;V++)Q+=String.fromCharCode($[V]);return Q},applyCanBeUsed:{uint8array:function(){try{return e1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return e1.nodebuffer&&String.fromCharCode.apply(null,b0.allocBuffer(1)).length===1}catch($){return!1}}()}};function N$($){var Q=65536,V=$G.getTypeOf($),q=!0;if(V==="uint8array")q=O6.applyCanBeUsed.uint8array;else if(V==="nodebuffer")q=O6.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return O6.stringifyByChunk($,V,Q)}catch(Y){Q=Math.floor(Q/2)}return O6.stringifyByChar($)}$G.applyFromCharCode=N$;function M6($,Q){for(var V=0;V<$.length;V++)Q[V]=$[V];return Q}var $0={};$0.string={string:O$,array:function($){return N6($,Array($.length))},arraybuffer:function($){return $0.string.uint8array($).buffer},uint8array:function($){return N6($,new Uint8Array($.length))},nodebuffer:function($){return N6($,b0.allocBuffer($.length))}};$0.array={string:N$,array:O$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return b0.newBufferFrom($)}};$0.arraybuffer={string:function($){return N$(new Uint8Array($))},array:function($){return M6(new Uint8Array($),Array($.byteLength))},arraybuffer:O$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return b0.newBufferFrom(new Uint8Array($))}};$0.uint8array={string:N$,array:function($){return M6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:O$,nodebuffer:function($){return b0.newBufferFrom($)}};$0.nodebuffer={string:N$,array:function($){return M6($,Array($.length))},arraybuffer:function($){return $0.nodebuffer.uint8array($).buffer},uint8array:function($){return M6($,new Uint8Array($.length))},nodebuffer:O$};$G.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;$G.checkSupport($);var V=$G.getTypeOf(Q),q=$0[V][$](Q);return q};$G.resolve=function($){var Q=$.split("/"),V=[];for(var q=0;q<Q.length;q++){var Y=Q[q];if(Y==="."||Y===""&&q!==0&&q!==Q.length-1)continue;else if(Y==="..")V.pop();else V.push(Y)}return V.join("/")};$G.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(e1.nodebuffer&&b0.isBuffer($))return"nodebuffer";if(e1.uint8array&&$ instanceof Uint8Array)return"uint8array";if(e1.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};$G.checkSupport=function($){var Q=e1[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};$G.MAX_VALUE_16BITS=65535;$G.MAX_VALUE_32BITS=-1;$G.pretty=function($){var Q="",V,q;for(q=0;q<($||"").length;q++)V=$.charCodeAt(q),Q+="\\x"+(V<16?"0":"")+V.toString(16).toUpperCase();return Q};$G.delay=function($,Q,V){setImmediate(function(){$.apply(V||null,Q||[])})};$G.inherits=function($,Q){var V=function(){};V.prototype=Q.prototype,$.prototype=new V};$G.extend=function(){var $={},Q,V;for(Q=0;Q<arguments.length;Q++)for(V in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],V)&&typeof $[V]>"u")$[V]=arguments[Q][V];return $};$G.prepareContent=function($,Q,V,q,Y){var X=G5.Promise.resolve(Q).then(function(J){var G=e1.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new G5.Promise(function(U,K){var W=new FileReader;W.onload=function(j){U(j.target.result)},W.onerror=function(j){K(j.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=$G.getTypeOf(J);if(!G)return G5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=$G.transformTo("uint8array",J);else if(G==="string"){if(Y)J=tX.decode(J);else if(V){if(q!==!0)J=eX(J)}}return J})}});var Z1=w((uH,Lq)=>{function zq($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}zq.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,Q){return this._listeners[$].push(Q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,Q){if(this._listeners[$])for(var V=0;V<this._listeners[$].length;V++)this._listeners[$][V].call(this,Q)},pipe:function($){return $.registerPrevious(this)},registerPrevious:function($){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=$.streamInfo,this.mergeStreamInfo(),this.previous=$;var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){Q.end()}),$.on("error",function(V){Q.error(V)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var $=!1;if(this.generatedError)this.error(this.generatedError),$=!0;if(this.previous)this.previous.resume();return!$},flush:function(){},processChunk:function($){this.push($)},withStreamInfo:function($,Q){return this.extraStreamInfo[$]=Q,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var $ in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,$))continue;this.streamInfo[$]=this.extraStreamInfo[$]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var $="Worker "+this.name;if(this.previous)return this.previous+" -> "+$;else return $}};Lq.exports=zq});var f0=w((zG)=>{var _0=p(),j0=d1(),jG=L$(),C6=Z1(),M$=Array(256);for(g1=0;g1<256;g1++)M$[g1]=g1>=252?6:g1>=248?5:g1>=240?4:g1>=224?3:g1>=192?2:1;var g1;M$[254]=M$[254]=1;var ZG=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}if(j0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q},HG=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+M$[$[V]]>Q?V:Q},PG=function($){var Q,V,q,Y,X=$.length,J=Array(X*2);for(V=0,Q=0;Q<X;){if(q=$[Q++],q<128){J[V++]=q;continue}if(Y=M$[q],Y>4){J[V++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)q=q<<6|$[Q++]&63,Y--;if(Y>1){J[V++]=65533;continue}if(q<65536)J[V++]=q;else q-=65536,J[V++]=55296|q>>10&1023,J[V++]=56320|q&1023}if(J.length!==V)if(J.subarray)J=J.subarray(0,V);else J.length=V;return _0.applyFromCharCode(J)};zG.utf8encode=function(Q){if(j0.nodebuffer)return jG.newBufferFrom(Q,"utf-8");return ZG(Q)};zG.utf8decode=function(Q){if(j0.nodebuffer)return _0.transformTo("nodebuffer",Q).toString("utf-8");return Q=_0.transformTo(j0.uint8array?"uint8array":"array",Q),PG(Q)};function w6(){C6.call(this,"utf-8 decode"),this.leftOver=null}_0.inherits(w6,C6);w6.prototype.processChunk=function($){var Q=_0.transformTo(j0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(j0.uint8array){var V=Q;Q=new Uint8Array(V.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(V,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=HG(Q),Y=Q;if(q!==Q.length)if(j0.uint8array)Y=Q.subarray(0,q),this.leftOver=Q.subarray(q,Q.length);else Y=Q.slice(0,q),this.leftOver=Q.slice(q,Q.length);this.push({data:zG.utf8decode(Y),meta:$.meta})};w6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:zG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};zG.Utf8DecodeWorker=w6;function W5(){C6.call(this,"utf-8 encode")}_0.inherits(W5,C6);W5.prototype.processChunk=function($){this.push({data:zG.utf8encode($.data),meta:$.meta})};zG.Utf8EncodeWorker=W5});var Mq=w((lH,Nq)=>{var Bq=Z1(),Oq=p();function j5($){Bq.call(this,"ConvertWorker to "+$),this.destType=$}Oq.inherits(j5,Bq);j5.prototype.processChunk=function($){this.push({data:Oq.transformTo(this.destType,$.data),meta:$.meta})};Nq.exports=j5});var Tq=w((oH,wq)=>{var Cq=e8().Readable,BG=p();BG.inherits(Z5,Cq);function Z5($,Q,V){Cq.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,X){if(!q.push(Y))q._helper.pause();if(V)V(X)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}Z5.prototype._read=function(){this._helper.resume()};wq.exports=Z5});var H5=w((iH,Rq)=>{var Z0=p(),OG=Mq(),NG=Z1(),MG=V5(),CG=d1(),wG=h0(),Aq=null;if(CG.nodestream)try{Aq=Tq()}catch($){}function TG($,Q,V){switch($){case"blob":return Z0.newBlob(Z0.transformTo("arraybuffer",Q),V);case"base64":return MG.encode(Q);default:return Z0.transformTo($,Q)}}function AG($,Q){var V,q=0,Y=null,X=0;for(V=0;V<Q.length;V++)X+=Q[V].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(V=0;V<Q.length;V++)Y.set(Q[V],q),q+=Q[V].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function FG($,Q){return new wG.Promise(function(V,q){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],q(U)}).on("end",function(){try{var U=TG(J,AG(X,Y),G);V(U)}catch(K){q(K)}Y=[]}).resume()})}function Fq($,Q,V){var q=Q;switch(Q){case"blob":case"arraybuffer":q="uint8array";break;case"base64":q="string";break}try{this._internalType=q,this._outputType=Q,this._mimeType=V,Z0.checkSupport(q),this._worker=$.pipe(new OG(q)),$.lock()}catch(Y){this._worker=new NG("error"),this._worker.error(Y)}}Fq.prototype={accumulate:function($){return FG(this,$)},on:function($,Q){var V=this;if($==="data")this._worker.on($,function(q){Q.call(V,q.data,q.meta)});else this._worker.on($,function(){Z0.delay(Q,arguments,V)});return this},resume:function(){return Z0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(Z0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new Aq(this,{objectMode:this._outputType!=="nodebuffer"},$)}};Rq.exports=Fq});var P5=w((RG)=>{RG.base64=!1;RG.binary=!1;RG.dir=!1;RG.createFolders=!0;RG.date=null;RG.compression=null;RG.compressionOptions=null;RG.comment=null;RG.unixPermissions=null;RG.dosPermissions=null});var z5=w((rH,vq)=>{var T6=p(),A6=Z1(),_G=16384;function m0($){A6.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(V){if(Q.dataIsReady=!0,Q.data=V,Q.max=V&&V.length||0,Q.type=T6.getTypeOf(V),!Q.isPaused)Q._tickAndRepeat()},function(V){Q.error(V)})}T6.inherits(m0,A6);m0.prototype.cleanUp=function(){A6.prototype.cleanUp.call(this),this.data=null};m0.prototype.resume=function(){if(!A6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,T6.delay(this._tickAndRepeat,[],this);return!0};m0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)T6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};m0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=_G,Q=null,V=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":Q=this.data.substring(this.index,V);break;case"uint8array":Q=this.data.subarray(this.index,V);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,V);break}return this.index=V,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};vq.exports=m0});var F6=w((aH,Sq)=>{var fG=p();function mG(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var xq=mG();function cG($,Q,V,q){var Y=xq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function pG($,Q,V,q){var Y=xq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}Sq.exports=function(Q,V){if(typeof Q>"u"||!Q.length)return 0;var q=fG.getTypeOf(Q)!=="string";if(q)return cG(V|0,Q,Q.length,0);else return pG(V|0,Q,Q.length,0)}});var I5=w((sH,gq)=>{var Eq=Z1(),uG=F6(),dG=p();function L5(){Eq.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}dG.inherits(L5,Eq);L5.prototype.processChunk=function($){this.streamInfo.crc32=uG($.data,this.streamInfo.crc32||0),this.push($)};gq.exports=L5});var yq=w((tH,kq)=>{var lG=p(),B5=Z1();function O5($){B5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}lG.inherits(O5,B5);O5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}B5.prototype.processChunk.call(this,$)};kq.exports=O5});var R6=w((eH,bq)=>{var Dq=h0(),hq=z5(),oG=I5(),N5=yq();function M5($,Q,V,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=V,this.compression=q,this.compressedContent=Y}M5.prototype={getContentWorker:function(){var $=new hq(Dq.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new N5("data_length")),Q=this;return $.on("end",function(){if(this.streamInfo.data_length!==Q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new hq(Dq.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};M5.createWorkerFrom=function($,Q,V){return $.pipe(new oG).pipe(new N5("uncompressedSize")).pipe(Q.compressWorker(V)).pipe(new N5("compressedSize")).withStreamInfo("compression",Q)};bq.exports=M5});var cq=w(($P,mq)=>{var iG=H5(),nG=z5(),C5=f0(),w5=R6(),_q=Z1(),T5=function($,Q,V){this.name=$,this.dir=V.dir,this.date=V.date,this.comment=V.comment,this.unixPermissions=V.unixPermissions,this.dosPermissions=V.dosPermissions,this._data=Q,this._dataBinary=V.binary,this.options={compression:V.compression,compressionOptions:V.compressionOptions}};T5.prototype={internalStream:function($){var Q=null,V="string";try{if(!$)throw Error("No output type specified.");V=$.toLowerCase();var q=V==="string"||V==="text";if(V==="binarystring"||V==="text")V="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new C5.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new C5.Utf8DecodeWorker)}catch(X){Q=new _q("error"),Q.error(X)}return new iG(Q,V,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof w5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var V=this._decompressWorker();if(!this._dataBinary)V=V.pipe(new C5.Utf8EncodeWorker);return w5.createWorkerFrom(V,$,Q)}},_decompressWorker:function(){if(this._data instanceof w5)return this._data.getContentWorker();else if(this._data instanceof _q)return this._data;else return new nG(this._data)}};var fq=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],rG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(C$=0;C$<fq.length;C$++)T5.prototype[fq[C$]]=rG;var C$;mq.exports=T5});var l1=w((A5)=>{var eG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function $3($,Q){return Object.prototype.hasOwnProperty.call($,Q)}A5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var V=Q.shift();if(!V)continue;if(typeof V!=="object")throw TypeError(V+"must be non-object");for(var q in V)if($3(V,q))$[q]=V[q]}return $};A5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var Q3={arraySet:function($,Q,V,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(V,V+q),Y);return}for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){var Q,V,q,Y,X,J;q=0;for(Q=0,V=$.length;Q<V;Q++)q+=$[Q].length;J=new Uint8Array(q),Y=0;for(Q=0,V=$.length;Q<V;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},V3={arraySet:function($,Q,V,q,Y){for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){return[].concat.apply([],$)}};A5.setTyped=function($){if($)A5.Buf8=Uint8Array,A5.Buf16=Uint16Array,A5.Buf32=Int32Array,A5.assign(A5,Q3);else A5.Buf8=Array,A5.Buf16=Array,A5.Buf32=Array,A5.assign(A5,V3)};A5.setTyped(eG)});var j9=w((A3)=>{var J3=l1(),Y3=4,uq=0,dq=1,X3=2;function p0($){var Q=$.length;while(--Q>=0)$[Q]=0}var G3=0,aq=1,K3=2,W3=3,U3=258,k5=29,v$=256,T$=v$+1+k5,c0=30,y5=19,sq=2*T$+1,H0=15,R5=16,j3=7,D5=256,tq=16,eq=17,$9=18,E5=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],v6=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Z3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Q9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H3=512,o1=Array((T$+2)*2);p0(o1);var w$=Array(c0*2);p0(w$);var A$=Array(H3);p0(A$);var F$=Array(U3-W3+1);p0(F$);var h5=Array(k5);p0(h5);var x6=Array(c0);p0(x6);function v5($,Q,V,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=V,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var V9,q9,J9;function x5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function Y9($){return $<256?A$[$]:A$[256+($>>>7)]}function R$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function X1($,Q,V){if($.bi_valid>R5-V)$.bi_buf|=Q<<$.bi_valid&65535,R$($,$.bi_buf),$.bi_buf=Q>>R5-$.bi_valid,$.bi_valid+=V-R5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=V}function k1($,Q,V){X1($,V[Q*2],V[Q*2+1])}function X9($,Q){var V=0;do V|=$&1,$>>>=1,V<<=1;while(--Q>0);return V>>>1}function P3($){if($.bi_valid===16)R$($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function z3($,Q){var{dyn_tree:V,max_code:q}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,j,Z,H,C,z=0;for(Z=0;Z<=H0;Z++)$.bl_count[Z]=0;V[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<sq;K++){if(W=$.heap[K],Z=V[V[W*2+1]*2+1]+1,Z>U)Z=U,z++;if(V[W*2+1]=Z,W>q)continue;if($.bl_count[Z]++,H=0,W>=G)H=J[W-G];if(C=V[W*2],$.opt_len+=C*(Z+H),X)$.static_len+=C*(Y[W*2+1]+H)}if(z===0)return;do{Z=U-1;while($.bl_count[Z]===0)Z--;$.bl_count[Z]--,$.bl_count[Z+1]+=2,$.bl_count[U]--,z-=2}while(z>0);for(Z=U;Z!==0;Z--){W=$.bl_count[Z];while(W!==0){if(j=$.heap[--K],j>q)continue;if(V[j*2+1]!==Z)$.opt_len+=(Z-V[j*2+1])*V[j*2],V[j*2+1]=Z;W--}}}function G9($,Q,V){var q=Array(H0+1),Y=0,X,J;for(X=1;X<=H0;X++)q[X]=Y=Y+V[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=X9(q[G]++,G)}}function L3(){var $,Q,V,q,Y,X=Array(H0+1);V=0;for(q=0;q<k5-1;q++){h5[q]=V;for($=0;$<1<<E5[q];$++)F$[V++]=q}F$[V-1]=q,Y=0;for(q=0;q<16;q++){x6[q]=Y;for($=0;$<1<<v6[q];$++)A$[Y++]=q}Y>>=7;for(;q<c0;q++){x6[q]=Y<<7;for($=0;$<1<<v6[q]-7;$++)A$[256+Y++]=q}for(Q=0;Q<=H0;Q++)X[Q]=0;$=0;while($<=143)o1[$*2+1]=8,$++,X[8]++;while($<=255)o1[$*2+1]=9,$++,X[9]++;while($<=279)o1[$*2+1]=7,$++,X[7]++;while($<=287)o1[$*2+1]=8,$++,X[8]++;G9(o1,T$+1,X);for($=0;$<c0;$++)w$[$*2+1]=5,w$[$*2]=X9($,5);V9=new v5(o1,E5,v$+1,T$,H0),q9=new v5(w$,v6,0,c0,H0),J9=new v5([],Z3,0,y5,j3)}function K9($){var Q;for(Q=0;Q<T$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<c0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<y5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[D5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function W9($){if($.bi_valid>8)R$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function I3($,Q,V,q){if(W9($),q)R$($,V),R$($,~V);J3.arraySet($.pending_buf,$.window,Q,V,$.pending),$.pending+=V}function lq($,Q,V,q){var Y=Q*2,X=V*2;return $[Y]<$[X]||$[Y]===$[X]&&q[Q]<=q[V]}function S5($,Q,V){var q=$.heap[V],Y=V<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&lq(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(lq(Q,q,$.heap[Y],$.depth))break;$.heap[V]=$.heap[Y],V=Y,Y<<=1}$.heap[V]=q}function oq($,Q,V){var q,Y,X=0,J,G;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,q===0)k1($,Y,Q);else{if(J=F$[Y],k1($,J+v$+1,Q),G=E5[J],G!==0)Y-=h5[J],X1($,Y,G);if(q--,J=Y9(q),k1($,J,V),G=v6[J],G!==0)q-=x6[J],X1($,q,G)}while(X<$.last_lit);k1($,D5,Q)}function g5($,Q){var V=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=sq;for(J=0;J<X;J++)if(V[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else V[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,V[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)S5($,V,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],S5($,V,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,V[K*2]=V[J*2]+V[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,V[J*2+1]=V[G*2+1]=K,$.heap[1]=K++,S5($,V,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],z3($,Q),G9(V,U,$.bl_count)}function iq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(V+1)*2+1]=65535;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[tq*2]++}else if(G<=10)$.bl_tree[eq*2]++;else $.bl_tree[$9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function nq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)do k1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)k1($,X,$.bl_tree),G--;k1($,tq,$.bl_tree),X1($,G-3,2)}else if(G<=10)k1($,eq,$.bl_tree),X1($,G-3,3);else k1($,$9,$.bl_tree),X1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function B3($){var Q;iq($,$.dyn_ltree,$.l_desc.max_code),iq($,$.dyn_dtree,$.d_desc.max_code),g5($,$.bl_desc);for(Q=y5-1;Q>=3;Q--)if($.bl_tree[Q9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function O3($,Q,V,q){var Y;X1($,Q-257,5),X1($,V-1,5),X1($,q-4,4);for(Y=0;Y<q;Y++)X1($,$.bl_tree[Q9[Y]*2+1],3);nq($,$.dyn_ltree,Q-1),nq($,$.dyn_dtree,V-1)}function N3($){var Q=4093624447,V;for(V=0;V<=31;V++,Q>>>=1)if(Q&1&&$.dyn_ltree[V*2]!==0)return uq;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return dq;for(V=32;V<v$;V++)if($.dyn_ltree[V*2]!==0)return dq;return uq}var rq=!1;function M3($){if(!rq)L3(),rq=!0;$.l_desc=new x5($.dyn_ltree,V9),$.d_desc=new x5($.dyn_dtree,q9),$.bl_desc=new x5($.bl_tree,J9),$.bi_buf=0,$.bi_valid=0,K9($)}function U9($,Q,V,q){X1($,(G3<<1)+(q?1:0),3),I3($,Q,V,!0)}function C3($){X1($,aq<<1,3),k1($,D5,o1),P3($)}function w3($,Q,V,q){var Y,X,J=0;if($.level>0){if($.strm.data_type===X3)$.strm.data_type=N3($);if(g5($,$.l_desc),g5($,$.d_desc),J=B3($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=V+5;if(V+4<=Y&&Q!==-1)U9($,Q,V,q);else if($.strategy===Y3||X===Y)X1($,(aq<<1)+(q?1:0),3),oq($,o1,w$);else X1($,(K3<<1)+(q?1:0),3),O3($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),oq($,$.dyn_ltree,$.dyn_dtree);if(K9($),q)W9($)}function T3($,Q,V){if($.pending_buf[$.d_buf+$.last_lit*2]=Q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Q&255,$.pending_buf[$.l_buf+$.last_lit]=V&255,$.last_lit++,Q===0)$.dyn_ltree[V*2]++;else $.matches++,Q--,$.dyn_ltree[(F$[V]+v$+1)*2]++,$.dyn_dtree[Y9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}A3._tr_init=M3;A3._tr_stored_block=U9;A3._tr_flush_block=w3;A3._tr_tally=T3;A3._tr_align=C3});var b5=w((qP,Z9)=>{function E3($,Q,V,q){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(V!==0){J=V>2000?2000:V,V-=J;do Y=Y+Q[q++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}Z9.exports=E3});var _5=w((JP,H9)=>{function g3(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var k3=g3();function y3($,Q,V,q){var Y=k3,X=q+V;$^=-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}H9.exports=y3});var S6=w((YP,P9)=>{P9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var w9=w((HK)=>{var J1=l1(),z1=j9(),B9=b5(),Q0=_5(),D3=S6(),I0=0,h3=1,b3=3,X0=4,z9=5,D1=0,L9=1,L1=-2,_3=-3,f5=-5,f3=-1,m3=1,E6=2,c3=3,p3=4,u3=0,d3=2,D6=8,l3=9,o3=15,i3=8,n3=29,r3=256,c5=r3+1+n3,a3=30,s3=19,t3=2*c5+1,e3=15,S=3,J0=258,F1=J0+S+1,$K=32,h6=42,p5=69,g6=73,k6=91,y6=103,P0=113,S$=666,n=1,E$=2,z0=3,l0=4,QK=3;function Y0($,Q){return $.msg=D3[Q],Q}function I9($){return($<<1)-($>4?9:0)}function q0($){var Q=$.length;while(--Q>=0)$[Q]=0}function V0($){var Q=$.state,V=Q.pending;if(V>$.avail_out)V=$.avail_out;if(V===0)return;if(J1.arraySet($.output,Q.pending_buf,Q.pending_out,V,$.next_out),$.next_out+=V,Q.pending_out+=V,$.total_out+=V,$.avail_out-=V,Q.pending-=V,Q.pending===0)Q.pending_out=0}function s($,Q){z1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,V0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function x$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function VK($,Q,V,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,J1.arraySet(Q,$.input,$.next_in,Y,V),$.state.wrap===1)$.adler=B9($.adler,Q,Y,V);else if($.state.wrap===2)$.adler=Q0($.adler,Q,Y,V);return $.next_in+=Y,$.total_in+=Y,Y}function O9($,Q){var{max_chain_length:V,strstart:q}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-F1?$.strstart-($.w_size-F1):0,K=$.window,W=$.w_mask,j=$.prev,Z=$.strstart+J0,H=K[q+J-1],C=K[q+J];if($.prev_length>=$.good_match)V>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==H||K[Y]!==K[q]||K[++Y]!==K[q+1])continue;q+=2,Y++;do;while(K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&q<Z);if(X=J0-(Z-q),q=Z-J0,X>J){if($.match_start=Q,J=X,X>=G)break;H=K[q+J-1],C=K[q+J]}}while((Q=j[Q&W])>U&&--V!==0);if(J<=$.lookahead)return J;return $.lookahead}function L0($){var Q=$.w_size,V,q,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-F1)){J1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,V=q;do Y=$.head[--V],$.head[V]=Y>=Q?Y-Q:0;while(--q);q=Q,V=q;do Y=$.prev[--V],$.prev[V]=Y>=Q?Y-Q:0;while(--q);X+=Q}if($.strm.avail_in===0)break;if(q=VK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=q,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<F1&&$.strm.avail_in!==0)}function qK($,Q){var V=65535;if(V>$.pending_buf_size-5)V=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(L0($),$.lookahead===0&&Q===I0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+V;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-F1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return z0;return l0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function m5($,Q){var V,q;for(;;){if($.lookahead<F1){if(L0($),$.lookahead<F1&&Q===I0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(V!==0&&$.strstart-V<=$.w_size-F1)$.match_length=O9($,V);if($.match_length>=S)if(q=z1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else q=z1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return z0;return l0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return E$}function u0($,Q){var V,q,Y;for(;;){if($.lookahead<F1){if(L0($),$.lookahead<F1&&Q===I0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,V!==0&&$.prev_length<$.max_lazy_match&&$.strstart-V<=$.w_size-F1){if($.match_length=O9($,V),$.match_length<=5&&($.strategy===m3||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,q=z1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(q=z1._tr_tally($,0,$.window[$.strstart-1]),q)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=z1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return z0;return l0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return E$}function JK($,Q){var V,q,Y,X,J=$.window;for(;;){if($.lookahead<=J0){if(L0($),$.lookahead<=J0&&Q===I0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,q=J[Y],q===J[++Y]&&q===J[++Y]&&q===J[++Y]){X=$.strstart+J0;do;while(q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&Y<X);if($.match_length=J0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)V=z1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else V=z1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return z0;return l0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return E$}function YK($,Q){var V;for(;;){if($.lookahead===0){if(L0($),$.lookahead===0){if(Q===I0)return n;break}}if($.match_length=0,V=z1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return z0;return l0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return E$}function y1($,Q,V,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=V,this.max_chain=q,this.func=Y}var d0;d0=[new y1(0,0,0,0,qK),new y1(4,4,8,4,m5),new y1(4,5,16,8,m5),new y1(4,6,32,32,m5),new y1(4,4,16,16,u0),new y1(8,16,32,32,u0),new y1(8,16,128,128,u0),new y1(8,32,128,256,u0),new y1(32,128,258,1024,u0),new y1(32,258,258,4096,u0)];function XK($){$.window_size=2*$.w_size,q0($.head),$.max_lazy_match=d0[$.level].max_lazy,$.good_match=d0[$.level].good_length,$.nice_match=d0[$.level].nice_length,$.max_chain_length=d0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function GK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=D6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new J1.Buf16(t3*2),this.dyn_dtree=new J1.Buf16((2*a3+1)*2),this.bl_tree=new J1.Buf16((2*s3+1)*2),q0(this.dyn_ltree),q0(this.dyn_dtree),q0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new J1.Buf16(e3+1),this.heap=new J1.Buf16(2*c5+1),q0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new J1.Buf16(2*c5+1),q0(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function N9($){var Q;if(!$||!$.state)return Y0($,L1);if($.total_in=$.total_out=0,$.data_type=d3,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?h6:P0,$.adler=Q.wrap===2?0:1,Q.last_flush=I0,z1._tr_init(Q),D1}function M9($){var Q=N9($);if(Q===D1)XK($.state);return Q}function KK($,Q){if(!$||!$.state)return L1;if($.state.wrap!==2)return L1;return $.state.gzhead=Q,D1}function C9($,Q,V,q,Y,X){if(!$)return L1;var J=1;if(Q===f3)Q=6;if(q<0)J=0,q=-q;else if(q>15)J=2,q-=16;if(Y<1||Y>l3||V!==D6||q<8||q>15||Q<0||Q>9||X<0||X>p3)return Y0($,L1);if(q===8)q=9;var G=new GK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=q,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new J1.Buf8(G.w_size*2),G.head=new J1.Buf16(G.hash_size),G.prev=new J1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new J1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=V,M9($)}function WK($,Q){return C9($,Q,D6,o3,i3,u3)}function UK($,Q){var V,q,Y,X;if(!$||!$.state||Q>z9||Q<0)return $?Y0($,L1):L1;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===S$&&Q!==X0)return Y0($,$.avail_out===0?f5:L1);if(q.strm=$,V=q.last_flush,q.last_flush=Q,q.status===h6)if(q.wrap===2)if($.adler=0,E(q,31),E(q,139),E(q,8),!q.gzhead)E(q,0),E(q,0),E(q,0),E(q,0),E(q,0),E(q,q.level===9?2:q.strategy>=E6||q.level<2?4:0),E(q,QK),q.status=P0;else{if(E(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(!q.gzhead.extra?0:4)+(!q.gzhead.name?0:8)+(!q.gzhead.comment?0:16)),E(q,q.gzhead.time&255),E(q,q.gzhead.time>>8&255),E(q,q.gzhead.time>>16&255),E(q,q.gzhead.time>>24&255),E(q,q.level===9?2:q.strategy>=E6||q.level<2?4:0),E(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)E(q,q.gzhead.extra.length&255),E(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=Q0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=p5}else{var J=D6+(q.w_bits-8<<4)<<8,G=-1;if(q.strategy>=E6||q.level<2)G=0;else if(q.level<6)G=1;else if(q.level===6)G=2;else G=3;if(J|=G<<6,q.strstart!==0)J|=$K;if(J+=31-J%31,q.status=P0,x$(q,J),q.strstart!==0)x$(q,$.adler>>>16),x$(q,$.adler&65535);$.adler=1}if(q.status===p5)if(q.gzhead.extra){Y=q.pending;while(q.gzindex<(q.gzhead.extra.length&65535)){if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size)break}E(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=g6}else q.status=g6;if(q.status===g6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.name.length)X=q.gzhead.name.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.gzindex=0,q.status=k6}else q.status=k6;if(q.status===k6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.comment.length)X=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.status=y6}else q.status=y6;if(q.status===y6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)V0($);if(q.pending+2<=q.pending_buf_size)E(q,$.adler&255),E(q,$.adler>>8&255),$.adler=0,q.status=P0}else q.status=P0;if(q.pending!==0){if(V0($),$.avail_out===0)return q.last_flush=-1,D1}else if($.avail_in===0&&I9(Q)<=I9(V)&&Q!==X0)return Y0($,f5);if(q.status===S$&&$.avail_in!==0)return Y0($,f5);if($.avail_in!==0||q.lookahead!==0||Q!==I0&&q.status!==S$){var U=q.strategy===E6?YK(q,Q):q.strategy===c3?JK(q,Q):d0[q.level].func(q,Q);if(U===z0||U===l0)q.status=S$;if(U===n||U===z0){if($.avail_out===0)q.last_flush=-1;return D1}if(U===E$){if(Q===h3)z1._tr_align(q);else if(Q!==z9){if(z1._tr_stored_block(q,0,0,!1),Q===b3){if(q0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(V0($),$.avail_out===0)return q.last_flush=-1,D1}}if(Q!==X0)return D1;if(q.wrap<=0)return L9;if(q.wrap===2)E(q,$.adler&255),E(q,$.adler>>8&255),E(q,$.adler>>16&255),E(q,$.adler>>24&255),E(q,$.total_in&255),E(q,$.total_in>>8&255),E(q,$.total_in>>16&255),E(q,$.total_in>>24&255);else x$(q,$.adler>>>16),x$(q,$.adler&65535);if(V0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?D1:L9}function jK($){var Q;if(!$||!$.state)return L1;if(Q=$.state.status,Q!==h6&&Q!==p5&&Q!==g6&&Q!==k6&&Q!==y6&&Q!==P0&&Q!==S$)return Y0($,L1);return $.state=null,Q===P0?Y0($,_3):D1}function ZK($,Q){var V=Q.length,q,Y,X,J,G,U,K,W;if(!$||!$.state)return L1;if(q=$.state,J=q.wrap,J===2||J===1&&q.status!==h6||q.lookahead)return L1;if(J===1)$.adler=B9($.adler,Q,V,0);if(q.wrap=0,V>=q.w_size){if(J===0)q0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new J1.Buf8(q.w_size),J1.arraySet(W,Q,V-q.w_size,q.w_size,0),Q=W,V=q.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=V,$.next_in=0,$.input=Q,L0(q);while(q.lookahead>=S){Y=q.strstart,X=q.lookahead-(S-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+S-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--X);q.strstart=Y,q.lookahead=S-1,L0(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=S-1,q.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,q.wrap=J,D1}HK.deflateInit=WK;HK.deflateInit2=C9;HK.deflateReset=M9;HK.deflateResetKeep=N9;HK.deflateSetHeader=KK;HK.deflate=UK;HK.deflateEnd=jK;HK.deflateSetDictionary=ZK;HK.deflateInfo="pako deflate (from Nodeca project)"});var u5=w((wK)=>{var b6=l1(),T9=!0,A9=!0;try{String.fromCharCode.apply(null,[0])}catch($){T9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){A9=!1}var g$=new b6.Buf8(256);for(h1=0;h1<256;h1++)g$[h1]=h1>=252?6:h1>=248?5:h1>=240?4:h1>=224?3:h1>=192?2:1;var h1;g$[254]=g$[254]=1;wK.string2buf=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}Q=new b6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q};function F9($,Q){if(Q<65534){if($.subarray&&A9||!$.subarray&&T9)return String.fromCharCode.apply(null,b6.shrinkBuf($,Q))}var V="";for(var q=0;q<Q;q++)V+=String.fromCharCode($[q]);return V}wK.buf2binstring=function($){return F9($,$.length)};wK.binstring2buf=function($){var Q=new b6.Buf8($.length);for(var V=0,q=Q.length;V<q;V++)Q[V]=$.charCodeAt(V);return Q};wK.buf2string=function($,Q){var V,q,Y,X,J=Q||$.length,G=Array(J*2);for(q=0,V=0;V<J;){if(Y=$[V++],Y<128){G[q++]=Y;continue}if(X=g$[Y],X>4){G[q++]=65533,V+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&V<J)Y=Y<<6|$[V++]&63,X--;if(X>1){G[q++]=65533;continue}if(Y<65536)G[q++]=Y;else Y-=65536,G[q++]=55296|Y>>10&1023,G[q++]=56320|Y&1023}return F9(G,q)};wK.utf8border=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+g$[$[V]]>Q?V:Q}});var d5=w((KP,R9)=>{function xK(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}R9.exports=xK});var E9=w((bK)=>{var k$=w9(),y$=l1(),o5=u5(),i5=S6(),SK=d5(),S9=Object.prototype.toString,EK=0,l5=4,o0=0,v9=1,x9=2,gK=-1,kK=0,yK=8;function B0($){if(!(this instanceof B0))return new B0($);this.options=y$.assign({level:gK,method:yK,chunkSize:16384,windowBits:15,memLevel:8,strategy:kK,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new SK,this.strm.avail_out=0;var V=k$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(V!==o0)throw Error(i5[V]);if(Q.header)k$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=o5.string2buf(Q.dictionary);else if(S9.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(V=k$.deflateSetDictionary(this.strm,q),V!==o0)throw Error(i5[V]);this._dict_set=!0}}B0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?l5:EK,typeof $==="string")V.input=o5.string2buf($);else if(S9.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new y$.Buf8(q),V.next_out=0,V.avail_out=q;if(Y=k$.deflate(V,X),Y!==v9&&Y!==o0)return this.onEnd(Y),this.ended=!0,!1;if(V.avail_out===0||V.avail_in===0&&(X===l5||X===x9))if(this.options.to==="string")this.onData(o5.buf2binstring(y$.shrinkBuf(V.output,V.next_out)));else this.onData(y$.shrinkBuf(V.output,V.next_out))}while((V.avail_in>0||V.avail_out===0)&&Y!==v9);if(X===l5)return Y=k$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===o0;if(X===x9)return this.onEnd(o0),V.avail_out=0,!0;return!0};B0.prototype.onData=function($){this.chunks.push($)};B0.prototype.onEnd=function($){if($===o0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=y$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function n5($,Q){var V=new B0(Q);if(V.push($,!0),V.err)throw V.msg||i5[V.err];return V.result}function DK($,Q){return Q=Q||{},Q.raw=!0,n5($,Q)}function hK($,Q){return Q=Q||{},Q.gzip=!0,n5($,Q)}bK.Deflate=B0;bK.deflate=n5;bK.deflateRaw=DK;bK.gzip=hK});var k9=w((UP,g9)=>{var _6=30,pK=12;g9.exports=function(Q,V){var q,Y,X,J,G,U,K,W,j,Z,H,C,z,M,N,L,T,B,I,F,R,v,x,b,A;q=Q.state,Y=Q.next_in,b=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,A=Q.output,G=J-(V-Q.avail_out),U=J+(Q.avail_out-257),K=q.dmax,W=q.wsize,j=q.whave,Z=q.wnext,H=q.window,C=q.hold,z=q.bits,M=q.lencode,N=q.distcode,L=(1<<q.lenbits)-1,T=(1<<q.distbits)-1;$:do{if(z<15)C+=b[Y++]<<z,z+=8,C+=b[Y++]<<z,z+=8;B=M[C&L];Q:for(;;){if(I=B>>>24,C>>>=I,z-=I,I=B>>>16&255,I===0)A[J++]=B&65535;else if(I&16){if(F=B&65535,I&=15,I){if(z<I)C+=b[Y++]<<z,z+=8;F+=C&(1<<I)-1,C>>>=I,z-=I}if(z<15)C+=b[Y++]<<z,z+=8,C+=b[Y++]<<z,z+=8;B=N[C&T];V:for(;;){if(I=B>>>24,C>>>=I,z-=I,I=B>>>16&255,I&16){if(R=B&65535,I&=15,z<I){if(C+=b[Y++]<<z,z+=8,z<I)C+=b[Y++]<<z,z+=8}if(R+=C&(1<<I)-1,R>K){Q.msg="invalid distance too far back",q.mode=_6;break $}if(C>>>=I,z-=I,I=J-G,R>I){if(I=R-I,I>j){if(q.sane){Q.msg="invalid distance too far back",q.mode=_6;break $}}if(v=0,x=H,Z===0){if(v+=W-I,I<F){F-=I;do A[J++]=H[v++];while(--I);v=J-R,x=A}}else if(Z<I){if(v+=W+Z-I,I-=Z,I<F){F-=I;do A[J++]=H[v++];while(--I);if(v=0,Z<F){I=Z,F-=I;do A[J++]=H[v++];while(--I);v=J-R,x=A}}}else if(v+=Z-I,I<F){F-=I;do A[J++]=H[v++];while(--I);v=J-R,x=A}while(F>2)A[J++]=x[v++],A[J++]=x[v++],A[J++]=x[v++],F-=3;if(F){if(A[J++]=x[v++],F>1)A[J++]=x[v++]}}else{v=J-R;do A[J++]=A[v++],A[J++]=A[v++],A[J++]=A[v++],F-=3;while(F>2);if(F){if(A[J++]=A[v++],F>1)A[J++]=A[v++]}}}else if((I&64)===0){B=N[(B&65535)+(C&(1<<I)-1)];continue V}else{Q.msg="invalid distance code",q.mode=_6;break $}break}}else if((I&64)===0){B=M[(B&65535)+(C&(1<<I)-1)];continue Q}else if(I&32){q.mode=pK;break $}else{Q.msg="invalid literal/length code",q.mode=_6;break $}break}}while(Y<X&&J<U);F=z>>3,Y-=F,z-=F<<3,C&=(1<<z)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),q.hold=C,q.bits=z;return}});var m9=w((jP,f9)=>{var y9=l1(),i0=15,D9=852,h9=592,b9=0,r5=1,_9=2,uK=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],dK=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],lK=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],oK=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];f9.exports=function(Q,V,q,Y,X,J,G,U){var K=U.bits,W=0,j=0,Z=0,H=0,C=0,z=0,M=0,N=0,L=0,T=0,B,I,F,R,v,x=null,b=0,A,W1=new y9.Buf16(i0+1),F0=new y9.Buf16(i0+1),r$=null,DQ=0,hQ,a$,s$;for(W=0;W<=i0;W++)W1[W]=0;for(j=0;j<Y;j++)W1[V[q+j]]++;C=K;for(H=i0;H>=1;H--)if(W1[H]!==0)break;if(C>H)C=H;if(H===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(Z=1;Z<H;Z++)if(W1[Z]!==0)break;if(C<Z)C=Z;N=1;for(W=1;W<=i0;W++)if(N<<=1,N-=W1[W],N<0)return-1;if(N>0&&(Q===b9||H!==1))return-1;F0[1]=0;for(W=1;W<i0;W++)F0[W+1]=F0[W]+W1[W];for(j=0;j<Y;j++)if(V[q+j]!==0)G[F0[V[q+j]]++]=j;if(Q===b9)x=r$=G,A=19;else if(Q===r5)x=uK,b-=257,r$=dK,DQ-=257,A=256;else x=lK,r$=oK,A=-1;if(T=0,j=0,W=Z,v=J,z=C,M=0,F=-1,L=1<<C,R=L-1,Q===r5&&L>D9||Q===_9&&L>h9)return 1;for(;;){if(hQ=W-M,G[j]<A)a$=0,s$=G[j];else if(G[j]>A)a$=r$[DQ+G[j]],s$=x[b+G[j]];else a$=96,s$=0;B=1<<W-M,I=1<<z,Z=I;do I-=B,X[v+(T>>M)+I]=hQ<<24|a$<<16|s$|0;while(I!==0);B=1<<W-1;while(T&B)B>>=1;if(B!==0)T&=B-1,T+=B;else T=0;if(j++,--W1[W]===0){if(W===H)break;W=V[q+G[j]]}if(W>C&&(T&R)!==F){if(M===0)M=C;v+=Z,z=W-M,N=1<<z;while(z+M<H){if(N-=W1[z+M],N<=0)break;z++,N<<=1}if(L+=1<<z,Q===r5&&L>D9||Q===_9&&L>h9)return 1;F=T&R,X[F]=C<<24|z<<16|v-J|0}}if(T!==0)X[v+T]=W-M<<24|4194304|0;return U.bits=C,0}});var M2=w((jW)=>{var H1=l1(),QQ=b5(),b1=_5(),iK=k9(),D$=m9(),nK=0,Z2=1,H2=2,c9=4,rK=5,f6=6,O0=0,aK=1,sK=2,I1=-2,P2=-3,VQ=-4,tK=-5,p9=8,z2=1,u9=2,d9=3,l9=4,o9=5,i9=6,n9=7,r9=8,a9=9,s9=10,p6=11,i1=12,a5=13,t9=14,s5=15,e9=16,$2=17,Q2=18,V2=19,m6=20,c6=21,q2=22,J2=23,Y2=24,X2=25,G2=26,t5=27,K2=28,W2=29,c=30,qQ=31,eK=32,$W=852,QW=592,VW=15,qW=VW;function U2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function JW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new H1.Buf16(320),this.work=new H1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L2($){var Q;if(!$||!$.state)return I1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=z2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new H1.Buf32($W),Q.distcode=Q.distdyn=new H1.Buf32(QW),Q.sane=1,Q.back=-1,O0}function I2($){var Q;if(!$||!$.state)return I1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,L2($)}function B2($,Q){var V,q;if(!$||!$.state)return I1;if(q=$.state,Q<0)V=0,Q=-Q;else if(V=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return I1;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=V,q.wbits=Q,I2($)}function O2($,Q){var V,q;if(!$)return I1;if(q=new JW,$.state=q,q.window=null,V=B2($,Q),V!==O0)$.state=null;return V}function YW($){return O2($,qW)}var j2=!0,e5,$Q;function XW($){if(j2){var Q;e5=new H1.Buf32(512),$Q=new H1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;D$(Z2,$.lens,0,288,e5,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;D$(H2,$.lens,0,32,$Q,0,$.work,{bits:5}),j2=!1}$.lencode=e5,$.lenbits=9,$.distcode=$Q,$.distbits=5}function N2($,Q,V,q){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new H1.Buf8(X.wsize);if(q>=X.wsize)H1.arraySet(X.window,Q,V-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>q)Y=q;if(H1.arraySet(X.window,Q,V-q,Y,X.wnext),q-=Y,q)H1.arraySet(X.window,Q,V-q,q,0),X.wnext=q,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function GW($,Q){var V,q,Y,X,J,G,U,K,W,j,Z,H,C,z,M=0,N,L,T,B,I,F,R,v,x=new H1.Buf8(4),b,A,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return I1;if(V=$.state,V.mode===i1)V.mode=a5;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,j=G,Z=U,v=O0;$:for(;;)switch(V.mode){case z2:if(V.wrap===0){V.mode=a5;break}while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.wrap&2&&K===35615){V.check=0,x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0),K=0,W=0,V.mode=u9;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",V.mode=c;break}if((K&15)!==p9){$.msg="unknown compression method",V.mode=c;break}if(K>>>=4,W-=4,R=(K&15)+8,V.wbits===0)V.wbits=R;else if(R>V.wbits){$.msg="invalid window size",V.mode=c;break}V.dmax=1<<R,$.adler=V.check=1,V.mode=K&512?s9:i1,K=0,W=0;break;case u9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.flags=K,(V.flags&255)!==p9){$.msg="unknown compression method",V.mode=c;break}if(V.flags&57344){$.msg="unknown header flags set",V.mode=c;break}if(V.head)V.head.text=K>>8&1;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=d9;case d9:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.time=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,V.check=b1(V.check,x,4,0);K=0,W=0,V.mode=l9;case l9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.xflags=K&255,V.head.os=K>>8;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=o9;case o9:if(V.flags&1024){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.length=K,V.head)V.head.extra_len=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0}else if(V.head)V.head.extra=null;V.mode=i9;case i9:if(V.flags&1024){if(H=V.length,H>G)H=G;if(H){if(V.head){if(R=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);H1.arraySet(V.head.extra,q,X,H,R)}if(V.flags&512)V.check=b1(V.check,q,H,X);G-=H,X+=H,V.length-=H}if(V.length)break $}V.length=0,V.mode=n9;case n9:if(V.flags&2048){if(G===0)break $;H=0;do if(R=q[X+H++],V.head&&R&&V.length<65536)V.head.name+=String.fromCharCode(R);while(R&&H<G);if(V.flags&512)V.check=b1(V.check,q,H,X);if(G-=H,X+=H,R)break $}else if(V.head)V.head.name=null;V.length=0,V.mode=r9;case r9:if(V.flags&4096){if(G===0)break $;H=0;do if(R=q[X+H++],V.head&&R&&V.length<65536)V.head.comment+=String.fromCharCode(R);while(R&&H<G);if(V.flags&512)V.check=b1(V.check,q,H,X);if(G-=H,X+=H,R)break $}else if(V.head)V.head.comment=null;V.mode=a9;case a9:if(V.flags&512){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.check&65535)){$.msg="header crc mismatch",V.mode=c;break}K=0,W=0}if(V.head)V.head.hcrc=V.flags>>9&1,V.head.done=!0;$.adler=V.check=0,V.mode=i1;break;case s9:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}$.adler=V.check=U2(K),K=0,W=0,V.mode=p6;case p6:if(V.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,sK;$.adler=V.check=1,V.mode=i1;case i1:if(Q===rK||Q===f6)break $;case a5:if(V.last){K>>>=W&7,W-=W&7,V.mode=t5;break}while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}switch(V.last=K&1,K>>>=1,W-=1,K&3){case 0:V.mode=t9;break;case 1:if(XW(V),V.mode=m6,Q===f6){K>>>=2,W-=2;break $}break;case 2:V.mode=$2;break;case 3:$.msg="invalid block type",V.mode=c}K>>>=2,W-=2;break;case t9:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",V.mode=c;break}if(V.length=K&65535,K=0,W=0,V.mode=s5,Q===f6)break $;case s5:V.mode=e9;case e9:if(H=V.length,H){if(H>G)H=G;if(H>U)H=U;if(H===0)break $;H1.arraySet(Y,q,X,H,J),G-=H,X+=H,U-=H,J+=H,V.length-=H;break}V.mode=i1;break;case $2:while(W<14){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.nlen=(K&31)+257,K>>>=5,W-=5,V.ndist=(K&31)+1,K>>>=5,W-=5,V.ncode=(K&15)+4,K>>>=4,W-=4,V.nlen>286||V.ndist>30){$.msg="too many length or distance symbols",V.mode=c;break}V.have=0,V.mode=Q2;case Q2:while(V.have<V.ncode){while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.lens[W1[V.have++]]=K&7,K>>>=3,W-=3}while(V.have<19)V.lens[W1[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,b={bits:V.lenbits},v=D$(nK,V.lens,0,19,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid code lengths set",V.mode=c;break}V.have=0,V.mode=V2;case V2:while(V.have<V.nlen+V.ndist){for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],N=M>>>24,L=M>>>16&255,T=M&65535,N<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(T<16)K>>>=N,W-=N,V.lens[V.have++]=T;else{if(T===16){A=N+2;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K>>>=N,W-=N,V.have===0){$.msg="invalid bit length repeat",V.mode=c;break}R=V.lens[V.have-1],H=3+(K&3),K>>>=2,W-=2}else if(T===17){A=N+3;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=N,W-=N,R=0,H=3+(K&7),K>>>=3,W-=3}else{A=N+7;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=N,W-=N,R=0,H=11+(K&127),K>>>=7,W-=7}if(V.have+H>V.nlen+V.ndist){$.msg="invalid bit length repeat",V.mode=c;break}while(H--)V.lens[V.have++]=R}}if(V.mode===c)break;if(V.lens[256]===0){$.msg="invalid code -- missing end-of-block",V.mode=c;break}if(V.lenbits=9,b={bits:V.lenbits},v=D$(Z2,V.lens,0,V.nlen,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid literal/lengths set",V.mode=c;break}if(V.distbits=6,V.distcode=V.distdyn,b={bits:V.distbits},v=D$(H2,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,b),V.distbits=b.bits,v){$.msg="invalid distances set",V.mode=c;break}if(V.mode=m6,Q===f6)break $;case m6:V.mode=c6;case c6:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,iK($,Z),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,V.mode===i1)V.back=-1;break}V.back=0;for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],N=M>>>24,L=M>>>16&255,T=M&65535,N<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(L&&(L&240)===0){B=N,I=L,F=T;for(;;){if(M=V.lencode[F+((K&(1<<B+I)-1)>>B)],N=M>>>24,L=M>>>16&255,T=M&65535,B+N<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,V.back+=B}if(K>>>=N,W-=N,V.back+=N,V.length=T,L===0){V.mode=G2;break}if(L&32){V.back=-1,V.mode=i1;break}if(L&64){$.msg="invalid literal/length code",V.mode=c;break}V.extra=L&15,V.mode=q2;case q2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.length+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=J2;case J2:for(;;){if(M=V.distcode[K&(1<<V.distbits)-1],N=M>>>24,L=M>>>16&255,T=M&65535,N<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((L&240)===0){B=N,I=L,F=T;for(;;){if(M=V.distcode[F+((K&(1<<B+I)-1)>>B)],N=M>>>24,L=M>>>16&255,T=M&65535,B+N<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,V.back+=B}if(K>>>=N,W-=N,V.back+=N,L&64){$.msg="invalid distance code",V.mode=c;break}V.offset=T,V.extra=L&15,V.mode=Y2;case Y2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.offset+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){$.msg="invalid distance too far back",V.mode=c;break}V.mode=X2;case X2:if(U===0)break $;if(H=Z-U,V.offset>H){if(H=V.offset-H,H>V.whave){if(V.sane){$.msg="invalid distance too far back",V.mode=c;break}}if(H>V.wnext)H-=V.wnext,C=V.wsize-H;else C=V.wnext-H;if(H>V.length)H=V.length;z=V.window}else z=Y,C=J-V.offset,H=V.length;if(H>U)H=U;U-=H,V.length-=H;do Y[J++]=z[C++];while(--H);if(V.length===0)V.mode=c6;break;case G2:if(U===0)break $;Y[J++]=V.length,U--,V.mode=c6;break;case t5:if(V.wrap){while(W<32){if(G===0)break $;G--,K|=q[X++]<<W,W+=8}if(Z-=U,$.total_out+=Z,V.total+=Z,Z)$.adler=V.check=V.flags?b1(V.check,Y,Z,J-Z):QQ(V.check,Y,Z,J-Z);if(Z=U,(V.flags?K:U2(K))!==V.check){$.msg="incorrect data check",V.mode=c;break}K=0,W=0}V.mode=K2;case K2:if(V.wrap&&V.flags){while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.total&4294967295)){$.msg="incorrect length check",V.mode=c;break}K=0,W=0}V.mode=W2;case W2:v=aK;break $;case c:v=P2;break $;case qQ:return VQ;case eK:default:return I1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,V.wsize||Z!==$.avail_out&&V.mode<c&&(V.mode<t5||Q!==c9)){if(N2($,$.output,$.next_out,Z-$.avail_out))return V.mode=qQ,VQ}if(j-=$.avail_in,Z-=$.avail_out,$.total_in+=j,$.total_out+=Z,V.total+=Z,V.wrap&&Z)$.adler=V.check=V.flags?b1(V.check,Y,Z,$.next_out-Z):QQ(V.check,Y,Z,$.next_out-Z);if($.data_type=V.bits+(V.last?64:0)+(V.mode===i1?128:0)+(V.mode===m6||V.mode===s5?256:0),(j===0&&Z===0||Q===c9)&&v===O0)v=tK;return v}function KW($){if(!$||!$.state)return I1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,O0}function WW($,Q){var V;if(!$||!$.state)return I1;if(V=$.state,(V.wrap&2)===0)return I1;return V.head=Q,Q.done=!1,O0}function UW($,Q){var V=Q.length,q,Y,X;if(!$||!$.state)return I1;if(q=$.state,q.wrap!==0&&q.mode!==p6)return I1;if(q.mode===p6){if(Y=1,Y=QQ(Y,Q,V,0),Y!==q.check)return P2}if(X=N2($,Q,V,V),X)return q.mode=qQ,VQ;return q.havedict=1,O0}jW.inflateReset=I2;jW.inflateReset2=B2;jW.inflateResetKeep=L2;jW.inflateInit=YW;jW.inflateInit2=O2;jW.inflate=GW;jW.inflateEnd=KW;jW.inflateGetHeader=WW;jW.inflateSetDictionary=UW;jW.inflateInfo="pako inflate (from Nodeca project)"});var JQ=w((HP,C2)=>{C2.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var T2=w((PP,w2)=>{function CW(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}w2.exports=CW});var F2=w((FW)=>{var n0=M2(),h$=l1(),u6=u5(),d=JQ(),YQ=S6(),wW=d5(),TW=T2(),A2=Object.prototype.toString;function N0($){if(!(this instanceof N0))return new N0($);this.options=h$.assign({chunkSize:16384,windowBits:0,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!($&&$.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new wW,this.strm.avail_out=0;var V=n0.inflateInit2(this.strm,Q.windowBits);if(V!==d.Z_OK)throw Error(YQ[V]);if(this.header=new TW,n0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=u6.string2buf(Q.dictionary);else if(A2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(V=n0.inflateSetDictionary(this.strm,Q.dictionary),V!==d.Z_OK)throw Error(YQ[V])}}}N0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?d.Z_FINISH:d.Z_NO_FLUSH,typeof $==="string")V.input=u6.binstring2buf($);else if(A2.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new h$.Buf8(q),V.next_out=0,V.avail_out=q;if(X=n0.inflate(V,d.Z_NO_FLUSH),X===d.Z_NEED_DICT&&Y)X=n0.inflateSetDictionary(this.strm,Y);if(X===d.Z_BUF_ERROR&&W===!0)X=d.Z_OK,W=!1;if(X!==d.Z_STREAM_END&&X!==d.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(V.next_out){if(V.avail_out===0||X===d.Z_STREAM_END||V.avail_in===0&&(J===d.Z_FINISH||J===d.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=u6.utf8border(V.output,V.next_out),U=V.next_out-G,K=u6.buf2string(V.output,G),V.next_out=U,V.avail_out=q-U,U)h$.arraySet(V.output,V.output,G,U,0);this.onData(K)}else this.onData(h$.shrinkBuf(V.output,V.next_out))}if(V.avail_in===0&&V.avail_out===0)W=!0}while((V.avail_in>0||V.avail_out===0)&&X!==d.Z_STREAM_END);if(X===d.Z_STREAM_END)J=d.Z_FINISH;if(J===d.Z_FINISH)return X=n0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===d.Z_OK;if(J===d.Z_SYNC_FLUSH)return this.onEnd(d.Z_OK),V.avail_out=0,!0;return!0};N0.prototype.onData=function($){this.chunks.push($)};N0.prototype.onEnd=function($){if($===d.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=h$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function XQ($,Q){var V=new N0(Q);if(V.push($,!0),V.err)throw V.msg||YQ[V.err];return V.result}function AW($,Q){return Q=Q||{},Q.raw=!0,XQ($,Q)}FW.Inflate=N0;FW.inflate=XQ;FW.inflateRaw=AW;FW.ungzip=XQ});var x2=w((LP,v2)=>{var EW=l1().assign,gW=E9(),kW=F2(),yW=JQ(),R2={};EW(R2,gW,kW,yW);v2.exports=R2});var E2=w((_W)=>{var DW=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",hW=x2(),S2=p(),d6=Z1(),bW=DW?"uint8array":"array";_W.magic="\b\x00";function M0($,Q){d6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}S2.inherits(M0,d6);M0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(S2.transformTo(bW,$.data),!1)};M0.prototype.flush=function(){if(d6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};M0.prototype.cleanUp=function(){d6.prototype.cleanUp.call(this),this._pako=null};M0.prototype._createPako=function(){this._pako=new hW[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};_W.compressWorker=function($){return new M0("Deflate",$)};_W.uncompressWorker=function(){return new M0("Inflate",{})}});var GQ=w((pW)=>{var g2=Z1();pW.STORE={magic:"\x00\x00",compressWorker:function(){return new g2("STORE compression")},uncompressWorker:function(){return new g2("STORE decompression")}};pW.DEFLATE=E2()});var KQ=w((lW)=>{lW.LOCAL_FILE_HEADER="PK\x03\x04";lW.CENTRAL_FILE_HEADER="PK\x01\x02";lW.CENTRAL_DIRECTORY_END="PK\x05\x06";lW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";lW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";lW.DATA_DESCRIPTOR="PK\x07\b"});var h2=w((NP,D2)=>{var r0=p(),a0=Z1(),WQ=f0(),k2=F6(),l6=KQ(),h=function($,Q){var V="",q;for(q=0;q<Q;q++)V+=String.fromCharCode($&255),$=$>>>8;return V},tW=function($,Q){var V=$;if(!$)V=Q?16893:33204;return(V&65535)<<16},eW=function($){return($||0)&63},y2=function($,Q,V,q,Y,X){var{file:J,compression:G}=$,U=X!==WQ.utf8encode,K=r0.transformTo("string",X(J.name)),W=r0.transformTo("string",WQ.utf8encode(J.name)),j=J.comment,Z=r0.transformTo("string",X(j)),H=r0.transformTo("string",WQ.utf8encode(j)),C=W.length!==J.name.length,z=H.length!==j.length,M,N,L="",T="",B="",I=J.dir,F=J.date,R={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||V)R.crc32=$.crc32,R.compressedSize=$.compressedSize,R.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||z))v|=2048;var x=0,b=0;if(I)x|=16;if(Y==="UNIX")b=798,x|=tW(J.unixPermissions,I);else b=20,x|=eW(J.dosPermissions,I);if(M=F.getUTCHours(),M=M<<6,M=M|F.getUTCMinutes(),M=M<<5,M=M|F.getUTCSeconds()/2,N=F.getUTCFullYear()-1980,N=N<<4,N=N|F.getUTCMonth()+1,N=N<<5,N=N|F.getUTCDate(),C)T=h(1,1)+h(k2(K),4)+W,L+="up"+h(T.length,2)+T;if(z)B=h(1,1)+h(k2(Z),4)+H,L+="uc"+h(B.length,2)+B;var A="";A+=`
3
- \x00`,A+=h(v,2),A+=G.magic,A+=h(M,2),A+=h(N,2),A+=h(R.crc32,4),A+=h(R.compressedSize,4),A+=h(R.uncompressedSize,4),A+=h(K.length,2),A+=h(L.length,2);var W1=l6.LOCAL_FILE_HEADER+A+K+L,F0=l6.CENTRAL_FILE_HEADER+h(b,2)+A+h(Z.length,2)+"\x00\x00\x00\x00"+h(x,4)+h(q,4)+K+L+Z;return{fileRecord:W1,dirRecord:F0}},$U=function($,Q,V,q,Y){var X="",J=r0.transformTo("string",Y(q));return X=l6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+h($,2)+h($,2)+h(Q,4)+h(V,4)+h(J.length,2)+J,X},QU=function($){var Q="";return Q=l6.DATA_DESCRIPTOR+h($.crc32,4)+h($.compressedSize,4)+h($.uncompressedSize,4),Q};function R1($,Q,V,q){a0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=V,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r0.inherits(R1,a0);R1.prototype.push=function($){var Q=$.meta.percent||0,V=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,a0.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:V?(Q+100*(V-q-1))/V:100}})};R1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var V=y2($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:V.fileRecord,meta:{percent:0}})}else this.accumulate=!0};R1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,V=y2($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(V.dirRecord),Q)this.push({data:QU($),meta:{percent:100}});else{this.push({data:V.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};R1.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var V=this.bytesWritten-$,q=$U(this.dirRecords.length,V,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};R1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};R1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(V){Q.error(V)}),this};R1.prototype.resume=function(){if(!a0.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};R1.prototype.error=function($){var Q=this._sources;if(!a0.prototype.error.call(this,$))return!1;for(var V=0;V<Q.length;V++)try{Q[V].error($)}catch(q){}return!0};R1.prototype.lock=function(){a0.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};D2.exports=R1});var b2=w((YU)=>{var VU=GQ(),qU=h2(),JU=function($,Q){var V=$||Q,q=VU[V];if(!q)throw Error(V+" is not a valid compression method !");return q};YU.generateWorker=function($,Q,V){var q=new qU(Q.streamFiles,V,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=JU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(X){q.error(X)}return q}});var f2=w((CP,_2)=>{var GU=p(),o6=Z1();function b$($,Q){o6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}GU.inherits(b$,o6);b$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(V){Q.push({data:V,meta:{percent:0}})}).on("error",function(V){if(Q.isPaused)this.generatedError=V;else Q.error(V)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};b$.prototype.pause=function(){if(!o6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};b$.prototype.resume=function(){if(!o6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};_2.exports=b$});var r2=w((wP,n2)=>{var KU=f0(),_$=p(),u2=Z1(),WU=H5(),d2=P5(),m2=R6(),UU=cq(),jU=b2(),c2=L$(),ZU=f2(),l2=function($,Q,V){var q=_$.getTypeOf(Q),Y,X=_$.extend(V||{},d2);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=o2($);if(X.createFolders&&(Y=HU($)))i2.call(this,Y,!0);var J=q==="string"&&X.binary===!1&&X.base64===!1;if(!V||typeof V.binary>"u")X.binary=!J;var G=Q instanceof m2&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",q="string";var U=null;if(Q instanceof m2||Q instanceof u2)U=Q;else if(c2.isNode&&c2.isStream(Q))U=new ZU($,Q);else U=_$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new UU($,U,X);this.files[$]=K},HU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},o2=function($){if($.slice(-1)!=="/")$+="/";return $},i2=function($,Q){if(Q=typeof Q<"u"?Q:d2.createFolders,$=o2($),!this.files[$])l2.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function p2($){return Object.prototype.toString.call($)==="[object RegExp]"}var PU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,V,q;for(Q in this.files)if(q=this.files[Q],V=Q.slice(this.root.length,Q.length),V&&Q.slice(0,this.root.length)===this.root)$(V,q)},filter:function($){var Q=[];return this.forEach(function(V,q){if($(V,q))Q.push(q)}),Q},file:function($,Q,V){if(arguments.length===1)if(p2($)){var q=$;return this.filter(function(X,J){return!J.dir&&q.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,l2.call(this,$,Q,V);return this},folder:function($){if(!$)return this;if(p2($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,V=i2.call(this,Q),q=this.clone();return q.root=V.name,q},remove:function($){$=this.root+$;var Q=this.files[$];if(!Q){if($.slice(-1)!=="/")$+="/";Q=this.files[$]}if(Q&&!Q.dir)delete this.files[$];else{var V=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var q=0;q<V.length;q++)delete this.files[V[q].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function($){var Q,V={};try{if(V=_$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:KU.utf8encode}),V.type=V.type.toLowerCase(),V.compression=V.compression.toUpperCase(),V.type==="binarystring")V.type="string";if(!V.type)throw Error("No output type specified.");if(_$.checkSupport(V.type),V.platform==="darwin"||V.platform==="freebsd"||V.platform==="linux"||V.platform==="sunos")V.platform="UNIX";if(V.platform==="win32")V.platform="DOS";var q=V.comment||this.comment||"";Q=jU.generateWorker(this,V,q)}catch(Y){Q=new u2("error"),Q.error(Y)}return new WU(Q,V.type||"string",V.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};n2.exports=PU});var UQ=w((TP,s2)=>{var zU=p();function a2($){this.data=$,this.length=$.length,this.index=0,this.zero=0}a2.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length<this.zero+$||$<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+$+"). Corrupted zip ?")},setIndex:function($){this.checkIndex($),this.index=$},skip:function($){this.setIndex(this.index+$)},byteAt:function(){},readInt:function($){var Q=0,V;this.checkOffset($);for(V=this.index+$-1;V>=this.index;V--)Q=(Q<<8)+this.byteAt(V);return this.index+=$,Q},readString:function($){return zU.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};s2.exports=a2});var jQ=w((AP,e2)=>{var t2=UQ(),LU=p();function s0($){t2.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}LU.inherits(s0,t2);s0.prototype.byteAt=function($){return this.data[this.zero+$]};s0.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===V&&this.data[X+2]===q&&this.data[X+3]===Y)return X-this.zero;return-1};s0.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&V===X[1]&&q===X[2]&&Y===X[3]};s0.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};e2.exports=s0});var V7=w((FP,Q7)=>{var $7=UQ(),IU=p();function t0($){$7.call(this,$)}IU.inherits(t0,$7);t0.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};t0.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};t0.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};t0.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};Q7.exports=t0});var HQ=w((RP,J7)=>{var q7=jQ(),BU=p();function ZQ($){q7.call(this,$)}BU.inherits(ZQ,q7);ZQ.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var Q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};J7.exports=ZQ});var G7=w((vP,X7)=>{var Y7=HQ(),OU=p();function PQ($){Y7.call(this,$)}OU.inherits(PQ,Y7);PQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};X7.exports=PQ});var zQ=w((xP,W7)=>{var i6=p(),K7=d1(),NU=jQ(),MU=V7(),CU=G7(),wU=HQ();W7.exports=function($){var Q=i6.getTypeOf($);if(i6.checkSupport(Q),Q==="string"&&!K7.uint8array)return new MU($);if(Q==="nodebuffer")return new CU($);if(K7.uint8array)return new wU(i6.transformTo("uint8array",$));return new NU(i6.transformTo("array",$))}});var H7=w((SP,Z7)=>{var LQ=zQ(),G0=p(),TU=R6(),U7=F6(),n6=f0(),r6=GQ(),AU=d1(),FU=0,RU=3,vU=function($){for(var Q in r6){if(!Object.prototype.hasOwnProperty.call(r6,Q))continue;if(r6[Q].magic===$)return r6[Q]}return null};function j7($,Q){this.options=$,this.loadOptions=Q}j7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,V;if($.skip(22),this.fileNameLength=$.readInt(2),V=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(V),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(Q=vU(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+G0.pretty(this.compressionMethod)+" unknown (inner file : "+G0.transformTo("string",this.fileName)+")");this.decompressed=new TU(this.compressedSize,this.uncompressedSize,this.crc32,Q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var Q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(Q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===FU)this.dosPermissions=this.externalFileAttributes&63;if($===RU)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=LQ(this.extraFields[1].value);if(this.uncompressedSize===G0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,V,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)V=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[V]={id:V,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=AU.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=n6.utf8decode(this.fileName),this.fileCommentStr=n6.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var V=G0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(V)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=G0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=LQ($.value);if(Q.readInt(1)!==1)return null;if(U7(this.fileName)!==Q.readInt(4))return null;return n6.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=LQ($.value);if(Q.readInt(1)!==1)return null;if(U7(this.fileComment)!==Q.readInt(4))return null;return n6.utf8decode(Q.readData($.length-5))}return null}};Z7.exports=j7});var L7=w((EP,z7)=>{var xU=zQ(),n1=p(),v1=KQ(),SU=H7(),EU=d1();function P7($){this.files=[],this.loadOptions=$}P7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+n1.pretty(Q)+", expected "+n1.pretty($)+")")}},isSignature:function($,Q){var V=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(V),Y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),Q=EU.uint8array?"uint8array":"array",V=n1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(V)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,Q=0,V,q,Y;while(Q<$)V=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[V]={id:V,length:q,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(v1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(v1.CENTRAL_FILE_HEADER))$=new SU({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(v1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,v1.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var V=$;if(this.checkSignature(v1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n1.MAX_VALUE_16BITS||this.centralDirRecords===n1.MAX_VALUE_16BITS||this.centralDirSize===n1.MAX_VALUE_32BITS||this.centralDirOffset===n1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,v1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=V-q;if(Y>0)if(this.isSignature(V,v1.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=xU($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};z7.exports=P7});var O7=w((gP,B7)=>{var IQ=p(),a6=h0(),gU=f0(),kU=L7(),yU=I5(),I7=L$();function DU($){return new a6.Promise(function(Q,V){var q=$.decompressed.getContentWorker().pipe(new yU);q.on("error",function(Y){V(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)V(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}B7.exports=function($,Q){var V=this;if(Q=IQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:gU.utf8decode}),I7.isNode&&I7.isStream($))return a6.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return IQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new kU(Q);return Y.load(q),Y}).then(function(Y){var X=[a6.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(DU(J[G]));return a6.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=IQ.resolve(U.fileNameStr);if(V.file(W,U.decompressed,{binary:!0,optimizedBinaryString:!0,date:U.date,dir:U.dir,comment:U.fileCommentStr.length?U.fileCommentStr:null,unixPermissions:U.unixPermissions,dosPermissions:U.dosPermissions,createFolders:Q.createFolders}),!U.dir)V.file(W).unsafeOriginalName=K}if(X.zipComment.length)V.comment=X.zipComment;return V})}});var M7=w((kP,N7)=>{function B1(){if(!(this instanceof B1))return new B1;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new B1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}B1.prototype=r2();B1.prototype.loadAsync=O7();B1.support=d1();B1.defaults=P5();B1.version="3.10.1";B1.loadAsync=function($,Q){return new B1().loadAsync($,Q)};B1.external=h0();N7.exports=B1});import{mkdir as yJ,readdir as RZ,readFile as kQ,stat as cJ,writeFile as j8}from"node:fs/promises";import{homedir as DJ}from"node:os";import Y1 from"node:path";import{stripVTControlCharacters as R8}from"node:util";var e=C1(I8(),1);import{stdin as aQ,stdout as sQ}from"node:process";import*as s1 from"node:readline";import cQ from"node:readline";import{Writable as YY}from"node:stream";function XY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}var GY=XY();function tQ($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(GY,"")}function eQ($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var $V={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(q){var Y=q.charCodeAt(0),X=q.length==2?q.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(q){var Y=this.eastAsianWidth(q);return Y=="F"||Y=="W"||Y=="A"?2:1};function V(q){return q.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(q){for(var Y=V(q),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(q,Y,X){textLen=Q.length(q),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=V(q),K=0;K<U.length;K++){var W=U[K],j=Q.length(W);if(G>=Y-(j==2?1:0))if(G+j<=X)J+=W;else break;G+=j}return J}})($V);var KY=$V.exports,WY=eQ(KY),UY=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},jY=eQ(UY);function V$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=tQ($),$.length===0))return 0;$=$.replace(jY()," ");let V=Q.ambiguousIsNarrow?1:2,q=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(WY.eastAsianWidth(Y)){case"F":case"W":q+=2;break;case"A":q+=V;break;default:q+=1}}return q}var O8=10,pQ=($=0)=>(Q)=>`\x1B[${Q+$}m`,uQ=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,dQ=($=0)=>(Q,V,q)=>`\x1B[${38+$};2;${Q};${V};${q}m`,f={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(f.modifier);var ZY=Object.keys(f.color),HY=Object.keys(f.bgColor);[...ZY,...HY];function PY(){let $=new Map;for(let[Q,V]of Object.entries(f)){for(let[q,Y]of Object.entries(V))f[q]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},V[q]=f[q],$.set(Y[0],Y[1]);Object.defineProperty(f,Q,{value:V,enumerable:!1})}return Object.defineProperty(f,"codes",{value:$,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=pQ(),f.color.ansi256=uQ(),f.color.ansi16m=dQ(),f.bgColor.ansi=pQ(O8),f.bgColor.ansi256=uQ(O8),f.bgColor.ansi16m=dQ(O8),Object.defineProperties(f,{rgbToAnsi256:{value:(Q,V,q)=>Q===V&&V===q?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(V/255*5)+Math.round(q/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let V=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!V)return[0,0,0];let[q]=V;q.length===3&&(q=[...q].map((X)=>X+X).join(""));let Y=Number.parseInt(q,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>f.rgbToAnsi256(...f.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let V,q,Y;if(Q>=232)V=((Q-232)*10+8)/255,q=V,Y=V;else{Q-=16;let G=Q%36;V=Math.floor(Q/36)/5,q=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(V,q,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(q)<<1|Math.round(V));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,V,q)=>f.ansi256ToAnsi(f.rgbToAnsi256(Q,V,q)),enumerable:!1},hexToAnsi:{value:(Q)=>f.ansi256ToAnsi(f.hexToAnsi256(Q)),enumerable:!1}}),f}var zY=PY(),V6=new Set(["\x1B","›"]),LY=39,C8="\x07",QV="[",IY="]",VV="m",w8=`${IY}8;;`,lQ=($)=>`${V6.values().next().value}${QV}${$}${VV}`,oQ=($)=>`${V6.values().next().value}${w8}${$}${C8}`,BY=($)=>$.split(" ").map((Q)=>V$(Q)),N8=($,Q,V)=>{let q=[...Q],Y=!1,X=!1,J=V$(tQ($[$.length-1]));for(let[G,U]of q.entries()){let K=V$(U);if(J+K<=V?$[$.length-1]+=U:($.push(U),J=0),V6.has(U)&&(Y=!0,X=q.slice(G+1).join("").startsWith(w8)),Y){X?U===C8&&(Y=!1,X=!1):U===VV&&(Y=!1);continue}J+=K,J===V&&G<q.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},OY=($)=>{let Q=$.split(" "),V=Q.length;for(;V>0&&!(V$(Q[V-1])>0);)V--;return V===Q.length?$:Q.slice(0,V).join(" ")+Q.slice(V).join("")},NY=($,Q,V={})=>{if(V.trim!==!1&&$.trim()==="")return"";let q="",Y,X,J=BY($),G=[""];for(let[K,W]of $.split(" ").entries()){V.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let j=V$(G[G.length-1]);if(K!==0&&(j>=Q&&(V.wordWrap===!1||V.trim===!1)&&(G.push(""),j=0),(j>0||V.trim===!1)&&(G[G.length-1]+=" ",j++)),V.hard&&J[K]>Q){let Z=Q-j,H=1+Math.floor((J[K]-Z-1)/Q);Math.floor((J[K]-1)/Q)<H&&G.push(""),N8(G,W,Q);continue}if(j+J[K]>Q&&j>0&&J[K]>0){if(V.wordWrap===!1&&j<Q){N8(G,W,Q);continue}G.push("")}if(j+J[K]>Q&&V.wordWrap===!1){N8(G,W,Q);continue}G[G.length-1]+=W}V.trim!==!1&&(G=G.map((K)=>OY(K)));let U=[...G.join(`
4
- `)];for(let[K,W]of U.entries()){if(q+=W,V6.has(W)){let{groups:Z}=new RegExp(`(?:\\${QV}(?<code>\\d+)m|\\${w8}(?<uri>.*)${C8})`).exec(U.slice(K).join(""))||{groups:{}};if(Z.code!==void 0){let H=Number.parseFloat(Z.code);Y=H===LY?void 0:H}else Z.uri!==void 0&&(X=Z.uri.length===0?void 0:Z.uri)}let j=zY.codes.get(Number(Y));U[K+1]===`
5
- `?(X&&(q+=oQ("")),Y&&j&&(q+=lQ(j))):W===`
6
- `&&(Y&&j&&(q+=lQ(Y)),X&&(q+=oQ(X)))}return q};function iQ($,Q,V){return String($).normalize().replace(/\r\n/g,`
2
+ import{createRequire as qY}from"node:module";var aJ=Object.create;var{getPrototypeOf:sJ,defineProperty:mQ,getOwnPropertyNames:tJ}=Object;var eJ=Object.prototype.hasOwnProperty;function $Y($){return this[$]}var QY,VY,C1=($,Q,V)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?QY??=new WeakMap:VY??=new WeakMap,X=Y.get($);if(X)return X}V=$!=null?aJ(sJ($)):{};let J=Q||!$||!$.__esModule?mQ(V,"default",{value:$,enumerable:!0}):V;for(let G of tJ($))if(!eJ.call(J,G))mQ(J,G,{get:$Y.bind($,G),enumerable:!0});if(q)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var i=qY(import.meta.url);var N8=w((YH,cQ)=>{var O8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let V="";if($<0)V+=`\x1B[${-$}D`;else if($>0)V+=`\x1B[${$}C`;if(Q<0)V+=`\x1B[${-Q}A`;else if(Q>0)V+=`\x1B[${Q}B`;return V},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},JY={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},YY={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Q="";for(let V=0;V<$;V++)Q+=this.line+(V<$-1?O8.up():"");if($)Q+=O8.left;return Q}};cQ.exports={cursor:O8,scroll:JY,erase:YY,beep:"\x07"}});var f1=w((XH,B8)=>{var Y6=process||{},pQ=Y6.argv||[],J6=Y6.env||{},XY=!(!!J6.NO_COLOR||pQ.includes("--no-color"))&&(!!J6.FORCE_COLOR||pQ.includes("--color")||Y6.platform==="win32"||(Y6.stdout||{}).isTTY&&J6.TERM!=="dumb"||!!J6.CI),GY=($,Q,V=$)=>(q)=>{let Y=""+q,X=Y.indexOf(Q,$.length);return~X?$+KY(Y,Q,V,X)+Q:$+Y+Q},KY=($,Q,V,q)=>{let Y="",X=0;do Y+=$.substring(X,q)+V,X=q+Q.length,q=$.indexOf(Q,X);while(~q);return Y+$.substring(X)},uQ=($=XY)=>{let Q=$?GY:()=>String;return{isColorSupported:$,reset:Q("\x1B[0m","\x1B[0m"),bold:Q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Q("\x1B[3m","\x1B[23m"),underline:Q("\x1B[4m","\x1B[24m"),inverse:Q("\x1B[7m","\x1B[27m"),hidden:Q("\x1B[8m","\x1B[28m"),strikethrough:Q("\x1B[9m","\x1B[29m"),black:Q("\x1B[30m","\x1B[39m"),red:Q("\x1B[31m","\x1B[39m"),green:Q("\x1B[32m","\x1B[39m"),yellow:Q("\x1B[33m","\x1B[39m"),blue:Q("\x1B[34m","\x1B[39m"),magenta:Q("\x1B[35m","\x1B[39m"),cyan:Q("\x1B[36m","\x1B[39m"),white:Q("\x1B[37m","\x1B[39m"),gray:Q("\x1B[90m","\x1B[39m"),bgBlack:Q("\x1B[40m","\x1B[49m"),bgRed:Q("\x1B[41m","\x1B[49m"),bgGreen:Q("\x1B[42m","\x1B[49m"),bgYellow:Q("\x1B[43m","\x1B[49m"),bgBlue:Q("\x1B[44m","\x1B[49m"),bgMagenta:Q("\x1B[45m","\x1B[49m"),bgCyan:Q("\x1B[46m","\x1B[49m"),bgWhite:Q("\x1B[47m","\x1B[49m"),blackBright:Q("\x1B[90m","\x1B[39m"),redBright:Q("\x1B[91m","\x1B[39m"),greenBright:Q("\x1B[92m","\x1B[39m"),yellowBright:Q("\x1B[93m","\x1B[39m"),blueBright:Q("\x1B[94m","\x1B[39m"),magentaBright:Q("\x1B[95m","\x1B[39m"),cyanBright:Q("\x1B[96m","\x1B[39m"),whiteBright:Q("\x1B[97m","\x1B[39m"),bgBlackBright:Q("\x1B[100m","\x1B[49m"),bgRedBright:Q("\x1B[101m","\x1B[49m"),bgGreenBright:Q("\x1B[102m","\x1B[49m"),bgYellowBright:Q("\x1B[103m","\x1B[49m"),bgBlueBright:Q("\x1B[104m","\x1B[49m"),bgMagentaBright:Q("\x1B[105m","\x1B[49m"),bgCyanBright:Q("\x1B[106m","\x1B[49m"),bgWhiteBright:Q("\x1B[107m","\x1B[49m")}};B8.exports=uQ();B8.exports.createColors=uQ});var K$=w((wH,D8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)D8.exports={nextTick:iY};else D8.exports=process;function iY($,Q,V,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,V)});case 4:return process.nextTick(function(){$.call(null,Q,V,q)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var PV=w((TH,zV)=>{var nY={}.toString;zV.exports=Array.isArray||function($){return nY.call($)=="[object Array]"}});var W$=w((h8,IV)=>{var Z6=i("buffer"),c1=Z6.Buffer;function LV($,Q){for(var V in $)Q[V]=$[V]}if(c1.from&&c1.alloc&&c1.allocUnsafe&&c1.allocUnsafeSlow)IV.exports=Z6;else LV(Z6,h8),h8.Buffer=x0;function x0($,Q,V){return c1($,Q,V)}LV(c1,x0);x0.from=function($,Q,V){if(typeof $==="number")throw TypeError("Argument must not be a number");return c1($,Q,V)};x0.alloc=function($,Q,V){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=c1($);if(Q!==void 0)if(typeof V==="string")q.fill(Q,V);else q.fill(Q);else q.fill(0);return q};x0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return c1($)};x0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Z6.SlowBuffer($)}});var S0=w((W4)=>{function rY($){if(Array.isArray)return Array.isArray($);return H6($)==="[object Array]"}W4.isArray=rY;function aY($){return typeof $==="boolean"}W4.isBoolean=aY;function sY($){return $===null}W4.isNull=sY;function tY($){return $==null}W4.isNullOrUndefined=tY;function eY($){return typeof $==="number"}W4.isNumber=eY;function $4($){return typeof $==="string"}W4.isString=$4;function Q4($){return typeof $==="symbol"}W4.isSymbol=Q4;function V4($){return $===void 0}W4.isUndefined=V4;function q4($){return H6($)==="[object RegExp]"}W4.isRegExp=q4;function J4($){return typeof $==="object"&&$!==null}W4.isObject=J4;function Y4($){return H6($)==="[object Date]"}W4.isDate=Y4;function X4($){return H6($)==="[object Error]"||$ instanceof Error}W4.isError=X4;function G4($){return typeof $==="function"}W4.isFunction=G4;function K4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}W4.isPrimitive=K4;W4.isBuffer=i("buffer").Buffer.isBuffer;function H6($){return Object.prototype.toString.call($)}});var OV=w((RH,b8)=>{if(typeof Object.create==="function")b8.exports=function(Q,V){if(V)Q.super_=V,Q.prototype=Object.create(V.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else b8.exports=function(Q,V){if(V){Q.super_=V;var q=function(){};q.prototype=V.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var E0=w((FH,_8)=>{try{if(z6=i("util"),typeof z6.inherits!=="function")throw"";_8.exports=z6.inherits}catch($){_8.exports=OV()}var z6});var BV=w((vH,f8)=>{function A4($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var NV=W$().Buffer,U$=i("util");function R4($,Q,V){$.copy(Q,V)}f8.exports=function(){function $(){A4(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(V){var q={data:V,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(V){var q={data:V,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var V=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,V},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(V){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=V+q.data;return Y},$.prototype.concat=function(V){if(this.length===0)return NV.alloc(0);var q=NV.allocUnsafe(V>>>0),Y=this.head,X=0;while(Y)R4(Y.data,q,X),X+=Y.data.length,Y=Y.next;return q},$}();if(U$&&U$.inspect&&U$.inspect.custom)f8.exports.prototype[U$.inspect.custom]=function(){var $=U$.inspect({length:this.length});return this.constructor.name+" "+$}});var m8=w((xH,MV)=>{var P6=K$();function F4($,Q){var V=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)P6.nextTick(L6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P6.nextTick(L6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!V._writableState)P6.nextTick(L6,V,X);else if(!V._writableState.errorEmitted)V._writableState.errorEmitted=!0,P6.nextTick(L6,V,X)}else if(Q)Q(X)}),this}function v4(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function L6($,Q){$.emit("error",Q)}MV.exports={destroy:F4,undestroy:v4}});var wV=w((SH,CV)=>{CV.exports=i("util").deprecate});var p8=w((EH,EV)=>{var U0=K$();EV.exports=l;function AV($){var Q=this;this.next=null,this.entry=null,this.finish=function(){o4(Q,$)}}var x4=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:U0.nextTick,g0;l.WritableState=Z$;var RV=Object.create(S0());RV.inherits=E0();var S4={deprecate:wV()},FV=i("stream"),O6=W$().Buffer,E4=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function g4($){return O6.from($)}function k4($){return O6.isBuffer($)||$ instanceof E4}var vV=m8();RV.inherits(l,FV);function y4(){}function Z$($,Q){g0=g0||j0(),$=$||{};var V=Q instanceof g0;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){c4(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new AV(this)}Z$.prototype.getBuffer=function(){var Q=this.bufferedRequest,V=[];while(Q)V.push(Q),Q=Q.next;return V};(function(){try{Object.defineProperty(Z$.prototype,"buffer",{get:S4.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var I6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")I6=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function($){if(I6.call(this,$))return!0;if(this!==l)return!1;return $&&$._writableState instanceof Z$}});else I6=function($){return $ instanceof this};function l($){if(g0=g0||j0(),!I6.call(l,this)&&!(this instanceof g0))return new l($);if(this._writableState=new Z$($,this),this.writable=!0,$){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}FV.call(this)}l.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function D4($,Q){var V=Error("write after end");$.emit("error",V),U0.nextTick(Q,V)}function h4($,Q,V,q){var Y=!0,X=!1;if(V===null)X=TypeError("May not write null values to stream");else if(typeof V!=="string"&&V!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),U0.nextTick(q,X),Y=!1;return Y}l.prototype.write=function($,Q,V){var q=this._writableState,Y=!1,X=!q.objectMode&&k4($);if(X&&!O6.isBuffer($))$=g4($);if(typeof Q==="function")V=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof V!=="function")V=y4;if(q.ended)D4(this,V);else if(X||h4(this,q,$,V))q.pendingcb++,Y=_4(this,q,X,$,Q,V);return Y};l.prototype.cork=function(){var $=this._writableState;$.corked++};l.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)xV(this,$)}};l.prototype.setDefaultEncoding=function(Q){if(typeof Q==="string")Q=Q.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Q+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+Q);return this._writableState.defaultEncoding=Q,this};function b4($,Q,V){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=O6.from(Q,V);return Q}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function _4($,Q,V,q,Y,X){if(!V){var J=b4(Q,q,Y);if(q!==J)V=!0,Y="buffer",q=J}var G=Q.objectMode?1:q.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:V,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else c8($,Q,!1,G,q,Y,X);return U}function c8($,Q,V,q,Y,X,J){if(Q.writelen=q,Q.writecb=J,Q.writing=!0,Q.sync=!0,V)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function f4($,Q,V,q,Y){if(--Q.pendingcb,V)U0.nextTick(Y,q),U0.nextTick(j$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),j$($,Q)}function m4($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function c4($,Q){var V=$._writableState,q=V.sync,Y=V.writecb;if(m4(V),Q)f4($,V,q,Q,Y);else{var X=SV(V);if(!X&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest)xV($,V);if(q)x4(TV,$,V,X,Y);else TV($,V,X,Y)}}function TV($,Q,V,q){if(!V)p4($,Q);Q.pendingcb--,q(),j$($,Q)}function p4($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function xV($,Q){Q.bufferProcessing=!0;var V=Q.bufferedRequest;if($._writev&&V&&V.next){var q=Q.bufferedRequestCount,Y=Array(q),X=Q.corkedRequestsFree;X.entry=V;var J=0,G=!0;while(V){if(Y[J]=V,!V.isBuf)G=!1;V=V.next,J+=1}if(Y.allBuffers=G,c8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new AV(Q);Q.bufferedRequestCount=0}else{while(V){var{chunk:U,encoding:K,callback:W}=V,j=Q.objectMode?1:U.length;if(c8($,Q,!1,j,U,K,W),V=V.next,Q.bufferedRequestCount--,Q.writing)break}if(V===null)Q.lastBufferedRequest=null}Q.bufferedRequest=V,Q.bufferProcessing=!1}l.prototype._write=function($,Q,V){V(Error("_write() is not implemented"))};l.prototype._writev=null;l.prototype.end=function($,Q,V){var q=this._writableState;if(typeof $==="function")V=$,$=null,Q=null;else if(typeof Q==="function")V=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)l4(this,q,V)};function SV($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function u4($,Q){$._final(function(V){if(Q.pendingcb--,V)$.emit("error",V);Q.prefinished=!0,$.emit("prefinish"),j$($,Q)})}function d4($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,U0.nextTick(u4,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function j$($,Q){var V=SV(Q);if(V){if(d4($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return V}function l4($,Q,V){if(Q.ending=!0,j$($,Q),V)if(Q.finished)U0.nextTick(V);else $.once("finish",V);Q.ended=!0,$.writable=!1}function o4($,Q,V){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(V),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(l.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});l.prototype.destroy=vV.destroy;l.prototype._undestroy=vV.undestroy;l.prototype._destroy=function($,Q){this.end(),Q($)}});var j0=w((gH,DV)=>{var gV=K$(),i4=Object.keys||function($){var Q=[];for(var V in $)Q.push(V);return Q};DV.exports=p1;var kV=Object.create(S0());kV.inherits=E0();var yV=d8(),u8=p8();kV.inherits(p1,yV);{N6=i4(u8.prototype);for(H$=0;H$<N6.length;H$++)if(z$=N6[H$],!p1.prototype[z$])p1.prototype[z$]=u8.prototype[z$]}var N6,z$,H$;function p1($){if(!(this instanceof p1))return new p1($);if(yV.call(this,$),u8.call(this,$),$&&$.readable===!1)this.readable=!1;if($&&$.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,$&&$.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",n4)}Object.defineProperty(p1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function n4(){if(this.allowHalfOpen||this._writableState.ended)return;gV.nextTick(r4,this)}function r4($){$.end()}Object.defineProperty(p1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});p1.prototype._destroy=function($,Q){this.push(null),this.end(),gV.nextTick(Q,$)}});var i8=w((WX)=>{var o8=W$().Buffer,hV=o8.isEncoding||function($){switch($=""+$,$&&$.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a4($){if(!$)return"utf8";var Q;while(!0)switch($){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return $;default:if(Q)return;$=(""+$).toLowerCase(),Q=!0}}function s4($){var Q=a4($);if(typeof Q!=="string"&&(o8.isEncoding===hV||!hV($)))throw Error("Unknown encoding: "+$);return Q||$}WX.StringDecoder=P$;function P$($){this.encoding=s4($);var Q;switch(this.encoding){case"utf16le":this.text=qX,this.end=JX,Q=4;break;case"utf8":this.fillLast=$X,Q=4;break;case"base64":this.text=YX,this.end=XX,Q=3;break;default:this.write=GX,this.end=KX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=o8.allocUnsafe(Q)}P$.prototype.write=function($){if($.length===0)return"";var Q,V;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";V=this.lastNeed,this.lastNeed=0}else V=0;if(V<$.length)return Q?Q+this.text($,V):this.text($,V);return Q||""};P$.prototype.end=VX;P$.prototype.text=QX;P$.prototype.fillLast=function($){if(this.lastNeed<=$.length)return $.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length),this.lastNeed-=$.length};function l8($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function t4($,Q,V){var q=Q.length-1;if(q<V)return 0;var Y=l8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<V||Y===-2)return 0;if(Y=l8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<V||Y===-2)return 0;if(Y=l8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function e4($,Q,V){if((Q[0]&192)!==128)return $.lastNeed=0,"�";if($.lastNeed>1&&Q.length>1){if((Q[1]&192)!==128)return $.lastNeed=1,"�";if($.lastNeed>2&&Q.length>2){if((Q[2]&192)!==128)return $.lastNeed=2,"�"}}}function $X($){var Q=this.lastTotal-this.lastNeed,V=e4(this,$,Q);if(V!==void 0)return V;if(this.lastNeed<=$.length)return $.copy(this.lastChar,Q,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,Q,0,$.length),this.lastNeed-=$.length}function QX($,Q){var V=t4(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=V;var q=$.length-(V-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function VX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function qX($,Q){if(($.length-Q)%2===0){var V=$.toString("utf16le",Q);if(V){var q=V.charCodeAt(V.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],V.slice(0,-1)}return V}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function JX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var V=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,V)}return Q}function YX($,Q){var V=($.length-Q)%3;if(V===0)return $.toString("base64",Q);if(this.lastNeed=3-V,this.lastTotal=3,V===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-V)}function XX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function GX($){return $.toString(this.encoding)}function KX($){return $&&$.length?this.write($):""}});var d8=w((DH,nV)=>{var y0=K$();nV.exports=_;var jX=PV(),L$;_.ReadableState=uV;var yH=i("events").EventEmitter,mV=function($,Q){return $.listeners(Q).length},t8=i("stream"),I$=W$().Buffer,ZX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function HX($){return I$.from($)}function zX($){return I$.isBuffer($)||$ instanceof ZX}var cV=Object.create(S0());cV.inherits=E0();var n8=i("util"),k=void 0;if(n8&&n8.debuglog)k=n8.debuglog("stream");else k=function(){};var PX=BV(),pV=m8(),k0;cV.inherits(_,t8);var r8=["error","close","destroy","pause","resume"];function LX($,Q,V){if(typeof $.prependListener==="function")return $.prependListener(Q,V);if(!$._events||!$._events[Q])$.on(Q,V);else if(jX($._events[Q]))$._events[Q].unshift(V);else $._events[Q]=[V,$._events[Q]]}function uV($,Q){L$=L$||j0(),$=$||{};var V=Q instanceof L$;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new PX,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding){if(!k0)k0=i8().StringDecoder;this.decoder=new k0($.encoding),this.encoding=$.encoding}}function _($){if(L$=L$||j0(),!(this instanceof _))return new _($);if(this._readableState=new uV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}t8.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=pV.destroy;_.prototype._undestroy=pV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var V=this._readableState,q;if(!V.objectMode){if(typeof $==="string"){if(Q=Q||V.defaultEncoding,Q!==V.encoding)$=I$.from($,Q),Q="";q=!0}}else q=!0;return dV(this,$,Q,!1,q)};_.prototype.unshift=function($){return dV(this,$,null,!0,!1)};function dV($,Q,V,q,Y){var X=$._readableState;if(Q===null)X.reading=!1,BX($,X);else{var J;if(!Y)J=IX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==I$.prototype)Q=HX(Q);if(q)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else a8($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!V)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)a8($,X,Q,!1);else lV($,X);else a8($,X,Q,!1)}else if(!q)X.reading=!1}return OX(X)}function a8($,Q,V,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",V),$.read(0);else{if(Q.length+=Q.objectMode?1:V.length,q)Q.buffer.unshift(V);else Q.buffer.push(V);if(Q.needReadable)B6($)}lV($,Q)}function IX($,Q){var V;if(!zX(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)V=TypeError("Invalid non-string/buffer chunk");return V}function OX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!k0)k0=i8().StringDecoder;return this._readableState.decoder=new k0($),this._readableState.encoding=$,this};var bV=8388608;function NX($){if($>=bV)$=bV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function _V($,Q){if($<=0||Q.length===0&&Q.ended)return 0;if(Q.objectMode)return 1;if($!==$)if(Q.flowing&&Q.length)return Q.buffer.head.data.length;else return Q.length;if($>Q.highWaterMark)Q.highWaterMark=NX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){k("read",$),$=parseInt($,10);var Q=this._readableState,V=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(k("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)s8(this);else B6(this);return null}if($=_V($,Q),$===0&&Q.ended){if(Q.length===0)s8(this);return null}var q=Q.needReadable;if(k("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,k("length less than watermark",q);if(Q.ended||Q.reading)q=!1,k("reading or ended",q);else if(q){if(k("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=_V(V,Q)}var Y;if($>0)Y=oV($,Q);else Y=null;if(Y===null)Q.needReadable=!0,$=0;else Q.length-=$;if(Q.length===0){if(!Q.ended)Q.needReadable=!0;if(V!==$&&Q.ended)s8(this)}if(Y!==null)this.emit("data",Y);return Y};function BX($,Q){if(Q.ended)return;if(Q.decoder){var V=Q.decoder.end();if(V&&V.length)Q.buffer.push(V),Q.length+=Q.objectMode?1:V.length}Q.ended=!0,B6($)}function B6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(k("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)y0.nextTick(fV,$);else fV($)}function fV($){k("emit readable"),$.emit("readable"),e8($)}function lV($,Q){if(!Q.readingMore)Q.readingMore=!0,y0.nextTick(MX,$,Q)}function MX($,Q){var V=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(k("maybeReadMore read 0"),$.read(0),V===Q.length)break;else V=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var V=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=$;break;case 1:q.pipes=[q.pipes,$];break;default:q.pipes.push($);break}q.pipesCount+=1,k("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:M;if(q.endEmitted)y0.nextTick(X);else V.once("end",X);$.on("unpipe",J);function J(B,L){if(k("onunpipe"),B===V){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){k("onend"),$.end()}var U=CX(V);$.on("drain",U);var K=!1;function W(){if(k("cleanup"),$.removeListener("close",C),$.removeListener("finish",P),$.removeListener("drain",U),$.removeListener("error",z),$.removeListener("unpipe",J),V.removeListener("end",G),V.removeListener("end",M),V.removeListener("data",H),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var j=!1;V.on("data",H);function H(B){k("ondata"),j=!1;var L=$.write(B);if(L===!1&&!j){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&iV(q.pipes,$)!==-1)&&!K)k("false write response, pause",q.awaitDrain),q.awaitDrain++,j=!0;V.pause()}}function z(B){if(k("onerror",B),M(),$.removeListener("error",z),mV($,"error")===0)$.emit("error",B)}LX($,"error",z);function C(){$.removeListener("finish",P),M()}$.once("close",C);function P(){k("onfinish"),$.removeListener("close",C),M()}$.once("finish",P);function M(){k("unpipe"),V.unpipe($)}if($.emit("pipe",V),!q.flowing)k("pipe resume"),V.resume();return $};function CX($){return function(){var Q=$._readableState;if(k("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&mV($,"data"))Q.flowing=!0,e8($)}}_.prototype.unpipe=function($){var Q=this._readableState,V={hasUnpiped:!1};if(Q.pipesCount===0)return this;if(Q.pipesCount===1){if($&&$!==Q.pipes)return this;if(!$)$=Q.pipes;if(Q.pipes=null,Q.pipesCount=0,Q.flowing=!1,$)$.emit("unpipe",this,V);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)q[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=iV(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,V),this};_.prototype.on=function($,Q){var V=t8.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var q=this._readableState;if(!q.endEmitted&&!q.readableListening){if(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,!q.reading)y0.nextTick(wX,this);else if(q.length)B6(this)}}return V};_.prototype.addListener=_.prototype.on;function wX($){k("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)k("resume"),$.flowing=!0,TX(this,$);return this};function TX($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,y0.nextTick(AX,$,Q)}function AX($,Q){if(!Q.reading)k("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),e8($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(k("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)k("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function e8($){var Q=$._readableState;k("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,V=this._readableState,q=!1;$.on("end",function(){if(k("wrapped end"),V.decoder&&!V.ended){var J=V.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(k("wrapped data"),V.decoder)J=V.decoder.write(J);if(V.objectMode&&(J===null||J===void 0))return;else if(!V.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<r8.length;X++)$.on(r8[X],this.emit.bind(this,r8[X]));return this._read=function(J){if(k("wrapped _read",J),q)q=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=oV;function oV($,Q){if(Q.length===0)return null;var V;if(Q.objectMode)V=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)V=Q.buffer.join("");else if(Q.buffer.length===1)V=Q.buffer.head.data;else V=Q.buffer.concat(Q.length);Q.buffer.clear()}else V=RX($,Q.buffer,Q.decoder);return V}function RX($,Q,V){var q;if($<Q.head.data.length)q=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)q=Q.shift();else q=V?FX($,Q):vX($,Q);return q}function FX($,Q){var V=Q.head,q=1,Y=V.data;$-=Y.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++q,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++q}return Q.length-=q,Y}function vX($,Q){var V=I$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(V),$-=q.data.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(X.copy(V,V.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++Y}return Q.length-=Y,V}function s8($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,y0.nextTick(xX,Q,$)}function xX($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function iV($,Q){for(var V=0,q=$.length;V<q;V++)if($[V]===Q)return V;return-1}});var $5=w((hH,sV)=>{sV.exports=u1;var M6=j0(),aV=Object.create(S0());aV.inherits=E0();aV.inherits(u1,M6);function SX($,Q){var V=this._transformState;V.transforming=!1;var q=V.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(V.writechunk=null,V.writecb=null,Q!=null)this.push(Q);q($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function u1($){if(!(this instanceof u1))return new u1($);if(M6.call(this,$),this._transformState={afterTransform:SX.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,$){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",EX)}function EX(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,V){rV($,Q,V)});else rV(this,null,null)}u1.prototype.push=function($,Q){return this._transformState.needTransform=!1,M6.prototype.push.call(this,$,Q)};u1.prototype._transform=function($,Q,V){throw Error("_transform() is not implemented")};u1.prototype._write=function($,Q,V){var q=this._transformState;if(q.writecb=V,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};u1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};u1.prototype._destroy=function($,Q){var V=this;M6.prototype._destroy.call(this,$,function(q){Q(q),V.emit("close")})};function rV($,Q,V){if(Q)return $.emit("error",Q);if(V!=null)$.push(V);if($._writableState.length)throw Error("Calling transform done when ws.length != 0");if($._transformState.transforming)throw Error("Calling transform done when still transforming");return $.push(null)}});var Qq=w((bH,$q)=>{$q.exports=O$;var tV=$5(),eV=Object.create(S0());eV.inherits=E0();eV.inherits(O$,tV);function O$($){if(!(this instanceof O$))return new O$($);tV.call(this,$)}O$.prototype._transform=function($,Q,V){V(null,$)}});var Q5=w((a,C6)=>{var S1=i("stream");if(process.env.READABLE_STREAM==="disable"&&S1)C6.exports=S1,a=C6.exports=S1.Readable,a.Readable=S1.Readable,a.Writable=S1.Writable,a.Duplex=S1.Duplex,a.Transform=S1.Transform,a.PassThrough=S1.PassThrough,a.Stream=S1;else a=C6.exports=d8(),a.Stream=S1||a,a.Readable=a,a.Writable=p8(),a.Duplex=j0(),a.Transform=$5(),a.PassThrough=Qq()});var d1=w((kX)=>{kX.base64=!0;kX.array=!0;kX.string=!0;kX.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";kX.nodebuffer=typeof Buffer<"u";kX.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")kX.blob=!1;else{w6=new ArrayBuffer(0);try{kX.blob=new Blob([w6],{type:"application/zip"}).size===0}catch($){try{q5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,T6=new q5,T6.append(w6),kX.blob=T6.getBlob("application/zip").size===0}catch(Q){kX.blob=!1}}}var w6,q5,T6;try{kX.nodestream=!!Q5().Readable}catch($){kX.nodestream=!1}});var J5=w((pX)=>{var mX=p(),cX=d1(),E1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";pX.encode=function($){var Q=[],V,q,Y,X,J,G,U,K=0,W=$.length,j=W,H=mX.getTypeOf($)!=="string";while(K<$.length){if(j=W-K,!H)V=$.charCodeAt(K++),q=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else V=$[K++],q=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=V>>2,J=(V&3)<<4|q>>4,G=j>1?(q&15)<<2|Y>>6:64,U=j>2?Y&63:64,Q.push(E1.charAt(X)+E1.charAt(J)+E1.charAt(G)+E1.charAt(U))}return Q.join("")};pX.decode=function($){var Q,V,q,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var j=$.length*3/4;if($.charAt($.length-1)===E1.charAt(64))j--;if($.charAt($.length-2)===E1.charAt(64))j--;if(j%1!==0)throw Error("Invalid base64 input, bad content length.");var H;if(cX.uint8array)H=new Uint8Array(j|0);else H=Array(j|0);while(U<$.length){if(Y=E1.indexOf($.charAt(U++)),X=E1.indexOf($.charAt(U++)),J=E1.indexOf($.charAt(U++)),G=E1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,V=(X&15)<<4|J>>2,q=(J&3)<<6|G,H[K++]=Q,J!==64)H[K++]=V;if(G!==64)H[K++]=q}return H}});var N$=w((mH,Vq)=>{Vq.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,Q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,Q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,Q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var Q=new Buffer($);return Q.fill(0),Q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var Yq=w((pH,Jq)=>{var cH=global.MutationObserver||global.WebKitMutationObserver,qq;qq=function(){process.nextTick(rX)};var lX,oX,iX,nX,Y5,B$=[];function rX(){Y5=!0;var $,Q,V=B$.length;while(V){Q=B$,B$=[],$=-1;while(++$<V)Q[$]();V=B$.length}Y5=!1}Jq.exports=aX;function aX($){if(B$.push($)===1&&!Y5)qq()}});var Zq=w((uH,jq)=>{var Xq=Yq();function h0(){}var $1={},Gq=["REJECTED"],X5=["FULFILLED"],Kq=["PENDING"];D0=["UNHANDLED"];var D0;jq.exports=t1;function t1($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Kq,this.queue=[],this.outcome=void 0,this.handled=D0,$!==h0)Wq(this,$)}t1.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(V,q);function V(Y){function X(){return Y}return Q.resolve($()).then(X)}function q(Y){function X(){throw Y}return Q.resolve($()).then(X)}};t1.prototype.catch=function($){return this.then(null,$)};t1.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===X5||typeof Q!=="function"&&this.state===Gq)return this;var V=new this.constructor(h0);if(this.handled===D0)this.handled=null;if(this.state!==Kq){var q=this.state===X5?$:Q;G5(V,q,this.outcome)}else this.queue.push(new M$(V,$,Q));return V};function M$($,Q,V){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof V==="function")this.onRejected=V,this.callRejected=this.otherCallRejected}M$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};M$.prototype.otherCallFulfilled=function($){G5(this.promise,this.onFulfilled,$)};M$.prototype.callRejected=function($){$1.reject(this.promise,$)};M$.prototype.otherCallRejected=function($){G5(this.promise,this.onRejected,$)};function G5($,Q,V){Xq(function(){var q;try{q=Q(V)}catch(Y){return $1.reject($,Y)}if(q===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,q)})}$1.resolve=function($,Q){var V=Uq(sX,Q);if(V.status==="error")return $1.reject($,V.value);var q=V.value;if(q)Wq($,q);else{$.state=X5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=Gq,$.outcome=Q,$.handled===D0)Xq(function(){if($.handled===D0)process.emit("unhandledRejection",Q,$)});var V=-1,q=$.queue.length;while(++V<q)$.queue[V].callRejected(Q);return $};function sX($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function Wq($,Q){var V=!1;function q(G){if(V)return;V=!0,$1.reject($,G)}function Y(G){if(V)return;V=!0,$1.resolve($,G)}function X(){Q(Y,q)}var J=Uq(X);if(J.status==="error")q(J.value)}function Uq($,Q){var V={};try{V.value=$(Q),V.status="success"}catch(q){V.status="error",V.value=q}return V}t1.resolve=tX;function tX($){if($ instanceof this)return $;return $1.resolve(new this(h0),$)}t1.reject=eX;function eX($){var Q=new this(h0);return $1.reject(Q,$)}t1.all=$G;function $G($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=Array(V),X=0,J=-1,G=new this(h0);while(++J<V)U($[J],J);return G;function U(K,W){Q.resolve(K).then(j,function(H){if(!q)q=!0,$1.reject(G,H)});function j(H){if(Y[W]=H,++X===V&&!q)q=!0,$1.resolve(G,Y)}}}t1.race=QG;function QG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=-1,X=new this(h0);while(++Y<V)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!q)q=!0,$1.resolve(X,U)},function(U){if(!q)q=!0,$1.reject(X,U)})}}});var b0=w((dH,Hq)=>{var K5=null;if(typeof Promise<"u")K5=Promise;else K5=Zq();Hq.exports={Promise:K5}});var Pq=w((zq)=>{(function($,Q){if($.setImmediate)return;var V=1,q={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var T=Array(arguments.length-1);for(var O=0;O<T.length;O++)T[O]=arguments[O+1];var I={callback:L,args:T};return q[V]=I,J(V),V++}function U(L){delete q[L]}function K(L){var{callback:T,args:O}=L;switch(O.length){case 0:T();break;case 1:T(O[0]);break;case 2:T(O[0],O[1]);break;case 3:T(O[0],O[1],O[2]);break;default:T.apply(Q,O);break}}function W(L){if(Y)setTimeout(W,0,L);else{var T=q[L];if(T){Y=!0;try{K(T)}finally{U(L),Y=!1}}}}function j(){J=function(L){process.nextTick(function(){W(L)})}}function H(){if($.postMessage&&!$.importScripts){var L=!0,T=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=T,L}}function z(){var L="setImmediate$"+Math.random()+"$",T=function(O){if(O.source===$&&typeof O.data==="string"&&O.data.indexOf(L)===0)W(+O.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",T,!1);else $.attachEvent("onmessage",T);J=function(O){$.postMessage(L+O,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(T){var O=T.data;W(O)},J=function(T){L.port2.postMessage(T)}}function P(){var L=X.documentElement;J=function(T){var O=X.createElement("script");O.onreadystatechange=function(){W(T),O.onreadystatechange=null,L.removeChild(O),O=null},L.appendChild(O)}}function M(){J=function(L){setTimeout(W,0,L)}}var B=Object.getPrototypeOf&&Object.getPrototypeOf($);if(B=B&&B.setTimeout?B:$,{}.toString.call($.process)==="[object process]")j();else if(H())z();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))P();else M();B.setImmediate=G,B.clearImmediate=U})(typeof self>"u"?typeof global>"u"?zq:global:self)});var p=w((JG)=>{var e1=d1(),VG=J5(),_0=N$(),W5=b0();Pq();function qG($){var Q=null;if(e1.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return R6($,Q)}JG.newBlob=function($,Q){JG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var V=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new V;return q.append($),q.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function C$($){return $}function R6($,Q){for(var V=0;V<$.length;++V)Q[V]=$.charCodeAt(V)&255;return Q}var A6={stringifyByChunk:function($,Q,V){var q=[],Y=0,X=$.length;if(X<=V)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+V,X))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+V,X))));Y+=V}return q.join("")},stringifyByChar:function($){var Q="";for(var V=0;V<$.length;V++)Q+=String.fromCharCode($[V]);return Q},applyCanBeUsed:{uint8array:function(){try{return e1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return e1.nodebuffer&&String.fromCharCode.apply(null,_0.allocBuffer(1)).length===1}catch($){return!1}}()}};function w$($){var Q=65536,V=JG.getTypeOf($),q=!0;if(V==="uint8array")q=A6.applyCanBeUsed.uint8array;else if(V==="nodebuffer")q=A6.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return A6.stringifyByChunk($,V,Q)}catch(Y){Q=Math.floor(Q/2)}return A6.stringifyByChar($)}JG.applyFromCharCode=w$;function F6($,Q){for(var V=0;V<$.length;V++)Q[V]=$[V];return Q}var $0={};$0.string={string:C$,array:function($){return R6($,Array($.length))},arraybuffer:function($){return $0.string.uint8array($).buffer},uint8array:function($){return R6($,new Uint8Array($.length))},nodebuffer:function($){return R6($,_0.allocBuffer($.length))}};$0.array={string:w$,array:C$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return _0.newBufferFrom($)}};$0.arraybuffer={string:function($){return w$(new Uint8Array($))},array:function($){return F6(new Uint8Array($),Array($.byteLength))},arraybuffer:C$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return _0.newBufferFrom(new Uint8Array($))}};$0.uint8array={string:w$,array:function($){return F6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:C$,nodebuffer:function($){return _0.newBufferFrom($)}};$0.nodebuffer={string:w$,array:function($){return F6($,Array($.length))},arraybuffer:function($){return $0.nodebuffer.uint8array($).buffer},uint8array:function($){return F6($,new Uint8Array($.length))},nodebuffer:C$};JG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;JG.checkSupport($);var V=JG.getTypeOf(Q),q=$0[V][$](Q);return q};JG.resolve=function($){var Q=$.split("/"),V=[];for(var q=0;q<Q.length;q++){var Y=Q[q];if(Y==="."||Y===""&&q!==0&&q!==Q.length-1)continue;else if(Y==="..")V.pop();else V.push(Y)}return V.join("/")};JG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(e1.nodebuffer&&_0.isBuffer($))return"nodebuffer";if(e1.uint8array&&$ instanceof Uint8Array)return"uint8array";if(e1.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};JG.checkSupport=function($){var Q=e1[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};JG.MAX_VALUE_16BITS=65535;JG.MAX_VALUE_32BITS=-1;JG.pretty=function($){var Q="",V,q;for(q=0;q<($||"").length;q++)V=$.charCodeAt(q),Q+="\\x"+(V<16?"0":"")+V.toString(16).toUpperCase();return Q};JG.delay=function($,Q,V){setImmediate(function(){$.apply(V||null,Q||[])})};JG.inherits=function($,Q){var V=function(){};V.prototype=Q.prototype,$.prototype=new V};JG.extend=function(){var $={},Q,V;for(Q=0;Q<arguments.length;Q++)for(V in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],V)&&typeof $[V]>"u")$[V]=arguments[Q][V];return $};JG.prepareContent=function($,Q,V,q,Y){var X=W5.Promise.resolve(Q).then(function(J){var G=e1.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new W5.Promise(function(U,K){var W=new FileReader;W.onload=function(j){U(j.target.result)},W.onerror=function(j){K(j.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=JG.getTypeOf(J);if(!G)return W5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=JG.transformTo("uint8array",J);else if(G==="string"){if(Y)J=VG.decode(J);else if(V){if(q!==!0)J=qG(J)}}return J})}});var Z1=w((iH,Nq)=>{function Oq($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Oq.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,Q){return this._listeners[$].push(Q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,Q){if(this._listeners[$])for(var V=0;V<this._listeners[$].length;V++)this._listeners[$][V].call(this,Q)},pipe:function($){return $.registerPrevious(this)},registerPrevious:function($){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=$.streamInfo,this.mergeStreamInfo(),this.previous=$;var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){Q.end()}),$.on("error",function(V){Q.error(V)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var $=!1;if(this.generatedError)this.error(this.generatedError),$=!0;if(this.previous)this.previous.resume();return!$},flush:function(){},processChunk:function($){this.push($)},withStreamInfo:function($,Q){return this.extraStreamInfo[$]=Q,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var $ in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,$))continue;this.streamInfo[$]=this.extraStreamInfo[$]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var $="Worker "+this.name;if(this.previous)return this.previous+" -> "+$;else return $}};Nq.exports=Oq});var m0=w((NG)=>{var f0=p(),Z0=d1(),PG=N$(),v6=Z1(),T$=Array(256);for(g1=0;g1<256;g1++)T$[g1]=g1>=252?6:g1>=248?5:g1>=240?4:g1>=224?3:g1>=192?2:1;var g1;T$[254]=T$[254]=1;var LG=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}if(Z0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q},IG=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+T$[$[V]]>Q?V:Q},OG=function($){var Q,V,q,Y,X=$.length,J=Array(X*2);for(V=0,Q=0;Q<X;){if(q=$[Q++],q<128){J[V++]=q;continue}if(Y=T$[q],Y>4){J[V++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)q=q<<6|$[Q++]&63,Y--;if(Y>1){J[V++]=65533;continue}if(q<65536)J[V++]=q;else q-=65536,J[V++]=55296|q>>10&1023,J[V++]=56320|q&1023}if(J.length!==V)if(J.subarray)J=J.subarray(0,V);else J.length=V;return f0.applyFromCharCode(J)};NG.utf8encode=function(Q){if(Z0.nodebuffer)return PG.newBufferFrom(Q,"utf-8");return LG(Q)};NG.utf8decode=function(Q){if(Z0.nodebuffer)return f0.transformTo("nodebuffer",Q).toString("utf-8");return Q=f0.transformTo(Z0.uint8array?"uint8array":"array",Q),OG(Q)};function x6(){v6.call(this,"utf-8 decode"),this.leftOver=null}f0.inherits(x6,v6);x6.prototype.processChunk=function($){var Q=f0.transformTo(Z0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(Z0.uint8array){var V=Q;Q=new Uint8Array(V.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(V,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=IG(Q),Y=Q;if(q!==Q.length)if(Z0.uint8array)Y=Q.subarray(0,q),this.leftOver=Q.subarray(q,Q.length);else Y=Q.slice(0,q),this.leftOver=Q.slice(q,Q.length);this.push({data:NG.utf8decode(Y),meta:$.meta})};x6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:NG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};NG.Utf8DecodeWorker=x6;function j5(){v6.call(this,"utf-8 encode")}f0.inherits(j5,v6);j5.prototype.processChunk=function($){this.push({data:NG.utf8encode($.data),meta:$.meta})};NG.Utf8EncodeWorker=j5});var Tq=w((rH,wq)=>{var Mq=Z1(),Cq=p();function H5($){Mq.call(this,"ConvertWorker to "+$),this.destType=$}Cq.inherits(H5,Mq);H5.prototype.processChunk=function($){this.push({data:Cq.transformTo(this.destType,$.data),meta:$.meta})};wq.exports=H5});var Fq=w((aH,Rq)=>{var Aq=Q5().Readable,CG=p();CG.inherits(z5,Aq);function z5($,Q,V){Aq.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,X){if(!q.push(Y))q._helper.pause();if(V)V(X)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}z5.prototype._read=function(){this._helper.resume()};Rq.exports=z5});var P5=w((sH,Sq)=>{var H0=p(),wG=Tq(),TG=Z1(),AG=J5(),RG=d1(),FG=b0(),vq=null;if(RG.nodestream)try{vq=Fq()}catch($){}function vG($,Q,V){switch($){case"blob":return H0.newBlob(H0.transformTo("arraybuffer",Q),V);case"base64":return AG.encode(Q);default:return H0.transformTo($,Q)}}function xG($,Q){var V,q=0,Y=null,X=0;for(V=0;V<Q.length;V++)X+=Q[V].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(V=0;V<Q.length;V++)Y.set(Q[V],q),q+=Q[V].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function SG($,Q){return new FG.Promise(function(V,q){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],q(U)}).on("end",function(){try{var U=vG(J,xG(X,Y),G);V(U)}catch(K){q(K)}Y=[]}).resume()})}function xq($,Q,V){var q=Q;switch(Q){case"blob":case"arraybuffer":q="uint8array";break;case"base64":q="string";break}try{this._internalType=q,this._outputType=Q,this._mimeType=V,H0.checkSupport(q),this._worker=$.pipe(new wG(q)),$.lock()}catch(Y){this._worker=new TG("error"),this._worker.error(Y)}}xq.prototype={accumulate:function($){return SG(this,$)},on:function($,Q){var V=this;if($==="data")this._worker.on($,function(q){Q.call(V,q.data,q.meta)});else this._worker.on($,function(){H0.delay(Q,arguments,V)});return this},resume:function(){return H0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(H0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new vq(this,{objectMode:this._outputType!=="nodebuffer"},$)}};Sq.exports=xq});var L5=w((EG)=>{EG.base64=!1;EG.binary=!1;EG.dir=!1;EG.createFolders=!0;EG.date=null;EG.compression=null;EG.compressionOptions=null;EG.comment=null;EG.unixPermissions=null;EG.dosPermissions=null});var I5=w((eH,Eq)=>{var S6=p(),E6=Z1(),pG=16384;function c0($){E6.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(V){if(Q.dataIsReady=!0,Q.data=V,Q.max=V&&V.length||0,Q.type=S6.getTypeOf(V),!Q.isPaused)Q._tickAndRepeat()},function(V){Q.error(V)})}S6.inherits(c0,E6);c0.prototype.cleanUp=function(){E6.prototype.cleanUp.call(this),this.data=null};c0.prototype.resume=function(){if(!E6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,S6.delay(this._tickAndRepeat,[],this);return!0};c0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)S6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};c0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=pG,Q=null,V=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":Q=this.data.substring(this.index,V);break;case"uint8array":Q=this.data.subarray(this.index,V);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,V);break}return this.index=V,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};Eq.exports=c0});var g6=w(($z,kq)=>{var uG=p();function dG(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var gq=dG();function lG($,Q,V,q){var Y=gq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function oG($,Q,V,q){var Y=gq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}kq.exports=function(Q,V){if(typeof Q>"u"||!Q.length)return 0;var q=uG.getTypeOf(Q)!=="string";if(q)return lG(V|0,Q,Q.length,0);else return oG(V|0,Q,Q.length,0)}});var N5=w((Qz,Dq)=>{var yq=Z1(),iG=g6(),nG=p();function O5(){yq.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}nG.inherits(O5,yq);O5.prototype.processChunk=function($){this.streamInfo.crc32=iG($.data,this.streamInfo.crc32||0),this.push($)};Dq.exports=O5});var bq=w((Vz,hq)=>{var rG=p(),B5=Z1();function M5($){B5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}rG.inherits(M5,B5);M5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}B5.prototype.processChunk.call(this,$)};hq.exports=M5});var k6=w((qz,mq)=>{var _q=b0(),fq=I5(),aG=N5(),C5=bq();function w5($,Q,V,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=V,this.compression=q,this.compressedContent=Y}w5.prototype={getContentWorker:function(){var $=new fq(_q.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new C5("data_length")),Q=this;return $.on("end",function(){if(this.streamInfo.data_length!==Q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new fq(_q.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};w5.createWorkerFrom=function($,Q,V){return $.pipe(new aG).pipe(new C5("uncompressedSize")).pipe(Q.compressWorker(V)).pipe(new C5("compressedSize")).withStreamInfo("compression",Q)};mq.exports=w5});var dq=w((Jz,uq)=>{var sG=P5(),tG=I5(),T5=m0(),A5=k6(),cq=Z1(),R5=function($,Q,V){this.name=$,this.dir=V.dir,this.date=V.date,this.comment=V.comment,this.unixPermissions=V.unixPermissions,this.dosPermissions=V.dosPermissions,this._data=Q,this._dataBinary=V.binary,this.options={compression:V.compression,compressionOptions:V.compressionOptions}};R5.prototype={internalStream:function($){var Q=null,V="string";try{if(!$)throw Error("No output type specified.");V=$.toLowerCase();var q=V==="string"||V==="text";if(V==="binarystring"||V==="text")V="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new T5.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new T5.Utf8DecodeWorker)}catch(X){Q=new cq("error"),Q.error(X)}return new sG(Q,V,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof A5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var V=this._decompressWorker();if(!this._dataBinary)V=V.pipe(new T5.Utf8EncodeWorker);return A5.createWorkerFrom(V,$,Q)}},_decompressWorker:function(){if(this._data instanceof A5)return this._data.getContentWorker();else if(this._data instanceof cq)return this._data;else return new tG(this._data)}};var pq=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],eG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(A$=0;A$<pq.length;A$++)R5.prototype[pq[A$]]=eG;var A$;uq.exports=R5});var l1=w((F5)=>{var q3=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function J3($,Q){return Object.prototype.hasOwnProperty.call($,Q)}F5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var V=Q.shift();if(!V)continue;if(typeof V!=="object")throw TypeError(V+"must be non-object");for(var q in V)if(J3(V,q))$[q]=V[q]}return $};F5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var Y3={arraySet:function($,Q,V,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(V,V+q),Y);return}for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){var Q,V,q,Y,X,J;q=0;for(Q=0,V=$.length;Q<V;Q++)q+=$[Q].length;J=new Uint8Array(q),Y=0;for(Q=0,V=$.length;Q<V;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},X3={arraySet:function($,Q,V,q,Y){for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){return[].concat.apply([],$)}};F5.setTyped=function($){if($)F5.Buf8=Uint8Array,F5.Buf16=Uint16Array,F5.Buf32=Int32Array,F5.assign(F5,Y3);else F5.Buf8=Array,F5.Buf16=Array,F5.Buf32=Array,F5.assign(F5,X3)};F5.setTyped(q3)});var z9=w((x3)=>{var K3=l1(),W3=4,oq=0,iq=1,U3=2;function u0($){var Q=$.length;while(--Q>=0)$[Q]=0}var j3=0,eq=1,Z3=2,H3=3,z3=258,D5=29,E$=256,F$=E$+1+D5,p0=30,h5=19,$9=2*F$+1,z0=15,x5=16,P3=7,b5=256,Q9=16,V9=17,q9=18,k5=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],y6=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],J9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I3=512,o1=Array((F$+2)*2);u0(o1);var R$=Array(p0*2);u0(R$);var v$=Array(I3);u0(v$);var x$=Array(z3-H3+1);u0(x$);var _5=Array(D5);u0(_5);var D6=Array(p0);u0(D6);function S5($,Q,V,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=V,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var Y9,X9,G9;function E5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function K9($){return $<256?v$[$]:v$[256+($>>>7)]}function S$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G1($,Q,V){if($.bi_valid>x5-V)$.bi_buf|=Q<<$.bi_valid&65535,S$($,$.bi_buf),$.bi_buf=Q>>x5-$.bi_valid,$.bi_valid+=V-x5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=V}function k1($,Q,V){G1($,V[Q*2],V[Q*2+1])}function W9($,Q){var V=0;do V|=$&1,$>>>=1,V<<=1;while(--Q>0);return V>>>1}function O3($){if($.bi_valid===16)S$($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function N3($,Q){var{dyn_tree:V,max_code:q}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,j,H,z,C,P=0;for(H=0;H<=z0;H++)$.bl_count[H]=0;V[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<$9;K++){if(W=$.heap[K],H=V[V[W*2+1]*2+1]+1,H>U)H=U,P++;if(V[W*2+1]=H,W>q)continue;if($.bl_count[H]++,z=0,W>=G)z=J[W-G];if(C=V[W*2],$.opt_len+=C*(H+z),X)$.static_len+=C*(Y[W*2+1]+z)}if(P===0)return;do{H=U-1;while($.bl_count[H]===0)H--;$.bl_count[H]--,$.bl_count[H+1]+=2,$.bl_count[U]--,P-=2}while(P>0);for(H=U;H!==0;H--){W=$.bl_count[H];while(W!==0){if(j=$.heap[--K],j>q)continue;if(V[j*2+1]!==H)$.opt_len+=(H-V[j*2+1])*V[j*2],V[j*2+1]=H;W--}}}function U9($,Q,V){var q=Array(z0+1),Y=0,X,J;for(X=1;X<=z0;X++)q[X]=Y=Y+V[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=W9(q[G]++,G)}}function B3(){var $,Q,V,q,Y,X=Array(z0+1);V=0;for(q=0;q<D5-1;q++){_5[q]=V;for($=0;$<1<<k5[q];$++)x$[V++]=q}x$[V-1]=q,Y=0;for(q=0;q<16;q++){D6[q]=Y;for($=0;$<1<<y6[q];$++)v$[Y++]=q}Y>>=7;for(;q<p0;q++){D6[q]=Y<<7;for($=0;$<1<<y6[q]-7;$++)v$[256+Y++]=q}for(Q=0;Q<=z0;Q++)X[Q]=0;$=0;while($<=143)o1[$*2+1]=8,$++,X[8]++;while($<=255)o1[$*2+1]=9,$++,X[9]++;while($<=279)o1[$*2+1]=7,$++,X[7]++;while($<=287)o1[$*2+1]=8,$++,X[8]++;U9(o1,F$+1,X);for($=0;$<p0;$++)R$[$*2+1]=5,R$[$*2]=W9($,5);Y9=new S5(o1,k5,E$+1,F$,z0),X9=new S5(R$,y6,0,p0,z0),G9=new S5([],L3,0,h5,P3)}function j9($){var Q;for(Q=0;Q<F$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<p0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<h5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[b5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function Z9($){if($.bi_valid>8)S$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function M3($,Q,V,q){if(Z9($),q)S$($,V),S$($,~V);K3.arraySet($.pending_buf,$.window,Q,V,$.pending),$.pending+=V}function nq($,Q,V,q){var Y=Q*2,X=V*2;return $[Y]<$[X]||$[Y]===$[X]&&q[Q]<=q[V]}function g5($,Q,V){var q=$.heap[V],Y=V<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&nq(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(nq(Q,q,$.heap[Y],$.depth))break;$.heap[V]=$.heap[Y],V=Y,Y<<=1}$.heap[V]=q}function rq($,Q,V){var q,Y,X=0,J,G;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,q===0)k1($,Y,Q);else{if(J=x$[Y],k1($,J+E$+1,Q),G=k5[J],G!==0)Y-=_5[J],G1($,Y,G);if(q--,J=K9(q),k1($,J,V),G=y6[J],G!==0)q-=D6[J],G1($,q,G)}while(X<$.last_lit);k1($,b5,Q)}function y5($,Q){var V=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=$9;for(J=0;J<X;J++)if(V[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else V[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,V[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)g5($,V,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],g5($,V,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,V[K*2]=V[J*2]+V[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,V[J*2+1]=V[G*2+1]=K,$.heap[1]=K++,g5($,V,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],N3($,Q),U9(V,U,$.bl_count)}function aq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(V+1)*2+1]=65535;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[Q9*2]++}else if(G<=10)$.bl_tree[V9*2]++;else $.bl_tree[q9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function sq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)do k1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)k1($,X,$.bl_tree),G--;k1($,Q9,$.bl_tree),G1($,G-3,2)}else if(G<=10)k1($,V9,$.bl_tree),G1($,G-3,3);else k1($,q9,$.bl_tree),G1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function C3($){var Q;aq($,$.dyn_ltree,$.l_desc.max_code),aq($,$.dyn_dtree,$.d_desc.max_code),y5($,$.bl_desc);for(Q=h5-1;Q>=3;Q--)if($.bl_tree[J9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function w3($,Q,V,q){var Y;G1($,Q-257,5),G1($,V-1,5),G1($,q-4,4);for(Y=0;Y<q;Y++)G1($,$.bl_tree[J9[Y]*2+1],3);sq($,$.dyn_ltree,Q-1),sq($,$.dyn_dtree,V-1)}function T3($){var Q=4093624447,V;for(V=0;V<=31;V++,Q>>>=1)if(Q&1&&$.dyn_ltree[V*2]!==0)return oq;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return iq;for(V=32;V<E$;V++)if($.dyn_ltree[V*2]!==0)return iq;return oq}var tq=!1;function A3($){if(!tq)B3(),tq=!0;$.l_desc=new E5($.dyn_ltree,Y9),$.d_desc=new E5($.dyn_dtree,X9),$.bl_desc=new E5($.bl_tree,G9),$.bi_buf=0,$.bi_valid=0,j9($)}function H9($,Q,V,q){G1($,(j3<<1)+(q?1:0),3),M3($,Q,V,!0)}function R3($){G1($,eq<<1,3),k1($,b5,o1),O3($)}function F3($,Q,V,q){var Y,X,J=0;if($.level>0){if($.strm.data_type===U3)$.strm.data_type=T3($);if(y5($,$.l_desc),y5($,$.d_desc),J=C3($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=V+5;if(V+4<=Y&&Q!==-1)H9($,Q,V,q);else if($.strategy===W3||X===Y)G1($,(eq<<1)+(q?1:0),3),rq($,o1,R$);else G1($,(Z3<<1)+(q?1:0),3),w3($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),rq($,$.dyn_ltree,$.dyn_dtree);if(j9($),q)Z9($)}function v3($,Q,V){if($.pending_buf[$.d_buf+$.last_lit*2]=Q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Q&255,$.pending_buf[$.l_buf+$.last_lit]=V&255,$.last_lit++,Q===0)$.dyn_ltree[V*2]++;else $.matches++,Q--,$.dyn_ltree[(x$[V]+E$+1)*2]++,$.dyn_dtree[K9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}x3._tr_init=A3;x3._tr_stored_block=H9;x3._tr_flush_block=F3;x3._tr_tally=v3;x3._tr_align=R3});var f5=w((Gz,P9)=>{function D3($,Q,V,q){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(V!==0){J=V>2000?2000:V,V-=J;do Y=Y+Q[q++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}P9.exports=D3});var m5=w((Kz,L9)=>{function h3(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var b3=h3();function _3($,Q,V,q){var Y=b3,X=q+V;$^=-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}L9.exports=_3});var h6=w((Wz,I9)=>{I9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var R9=w((IK)=>{var Y1=l1(),P1=z9(),M9=f5(),Q0=m5(),f3=h6(),O0=0,m3=1,c3=3,X0=4,O9=5,D1=0,N9=1,L1=-2,p3=-3,c5=-5,u3=-1,d3=1,b6=2,l3=3,o3=4,i3=0,n3=2,c6=8,r3=9,a3=15,s3=8,t3=29,e3=256,u5=e3+1+t3,$K=30,QK=19,VK=2*u5+1,qK=15,S=3,J0=258,R1=J0+S+1,JK=32,p6=42,d5=69,_6=73,f6=91,m6=103,P0=113,k$=666,n=1,y$=2,L0=3,o0=4,YK=3;function Y0($,Q){return $.msg=f3[Q],Q}function B9($){return($<<1)-($>4?9:0)}function q0($){var Q=$.length;while(--Q>=0)$[Q]=0}function V0($){var Q=$.state,V=Q.pending;if(V>$.avail_out)V=$.avail_out;if(V===0)return;if(Y1.arraySet($.output,Q.pending_buf,Q.pending_out,V,$.next_out),$.next_out+=V,Q.pending_out+=V,$.total_out+=V,$.avail_out-=V,Q.pending-=V,Q.pending===0)Q.pending_out=0}function s($,Q){P1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,V0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function g$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function XK($,Q,V,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Y1.arraySet(Q,$.input,$.next_in,Y,V),$.state.wrap===1)$.adler=M9($.adler,Q,Y,V);else if($.state.wrap===2)$.adler=Q0($.adler,Q,Y,V);return $.next_in+=Y,$.total_in+=Y,Y}function C9($,Q){var{max_chain_length:V,strstart:q}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-R1?$.strstart-($.w_size-R1):0,K=$.window,W=$.w_mask,j=$.prev,H=$.strstart+J0,z=K[q+J-1],C=K[q+J];if($.prev_length>=$.good_match)V>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==z||K[Y]!==K[q]||K[++Y]!==K[q+1])continue;q+=2,Y++;do;while(K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&q<H);if(X=J0-(H-q),q=H-J0,X>J){if($.match_start=Q,J=X,X>=G)break;z=K[q+J-1],C=K[q+J]}}while((Q=j[Q&W])>U&&--V!==0);if(J<=$.lookahead)return J;return $.lookahead}function I0($){var Q=$.w_size,V,q,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-R1)){Y1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,V=q;do Y=$.head[--V],$.head[V]=Y>=Q?Y-Q:0;while(--q);q=Q,V=q;do Y=$.prev[--V],$.prev[V]=Y>=Q?Y-Q:0;while(--q);X+=Q}if($.strm.avail_in===0)break;if(q=XK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=q,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<R1&&$.strm.avail_in!==0)}function GK($,Q){var V=65535;if(V>$.pending_buf_size-5)V=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I0($),$.lookahead===0&&Q===O0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+V;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-R1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function p5($,Q){var V,q;for(;;){if($.lookahead<R1){if(I0($),$.lookahead<R1&&Q===O0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(V!==0&&$.strstart-V<=$.w_size-R1)$.match_length=C9($,V);if($.match_length>=S)if(q=P1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else q=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function d0($,Q){var V,q,Y;for(;;){if($.lookahead<R1){if(I0($),$.lookahead<R1&&Q===O0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,V!==0&&$.prev_length<$.max_lazy_match&&$.strstart-V<=$.w_size-R1){if($.match_length=C9($,V),$.match_length<=5&&($.strategy===d3||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,q=P1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(q=P1._tr_tally($,0,$.window[$.strstart-1]),q)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=P1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function KK($,Q){var V,q,Y,X,J=$.window;for(;;){if($.lookahead<=J0){if(I0($),$.lookahead<=J0&&Q===O0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,q=J[Y],q===J[++Y]&&q===J[++Y]&&q===J[++Y]){X=$.strstart+J0;do;while(q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&Y<X);if($.match_length=J0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)V=P1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else V=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function WK($,Q){var V;for(;;){if($.lookahead===0){if(I0($),$.lookahead===0){if(Q===O0)return n;break}}if($.match_length=0,V=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function y1($,Q,V,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=V,this.max_chain=q,this.func=Y}var l0;l0=[new y1(0,0,0,0,GK),new y1(4,4,8,4,p5),new y1(4,5,16,8,p5),new y1(4,6,32,32,p5),new y1(4,4,16,16,d0),new y1(8,16,32,32,d0),new y1(8,16,128,128,d0),new y1(8,32,128,256,d0),new y1(32,128,258,1024,d0),new y1(32,258,258,4096,d0)];function UK($){$.window_size=2*$.w_size,q0($.head),$.max_lazy_match=l0[$.level].max_lazy,$.good_match=l0[$.level].good_length,$.nice_match=l0[$.level].nice_length,$.max_chain_length=l0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function jK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=c6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Y1.Buf16(VK*2),this.dyn_dtree=new Y1.Buf16((2*$K+1)*2),this.bl_tree=new Y1.Buf16((2*QK+1)*2),q0(this.dyn_ltree),q0(this.dyn_dtree),q0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Y1.Buf16(qK+1),this.heap=new Y1.Buf16(2*u5+1),q0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Y1.Buf16(2*u5+1),q0(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function w9($){var Q;if(!$||!$.state)return Y0($,L1);if($.total_in=$.total_out=0,$.data_type=n3,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?p6:P0,$.adler=Q.wrap===2?0:1,Q.last_flush=O0,P1._tr_init(Q),D1}function T9($){var Q=w9($);if(Q===D1)UK($.state);return Q}function ZK($,Q){if(!$||!$.state)return L1;if($.state.wrap!==2)return L1;return $.state.gzhead=Q,D1}function A9($,Q,V,q,Y,X){if(!$)return L1;var J=1;if(Q===u3)Q=6;if(q<0)J=0,q=-q;else if(q>15)J=2,q-=16;if(Y<1||Y>r3||V!==c6||q<8||q>15||Q<0||Q>9||X<0||X>o3)return Y0($,L1);if(q===8)q=9;var G=new jK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=q,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new Y1.Buf8(G.w_size*2),G.head=new Y1.Buf16(G.hash_size),G.prev=new Y1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new Y1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=V,T9($)}function HK($,Q){return A9($,Q,c6,a3,s3,i3)}function zK($,Q){var V,q,Y,X;if(!$||!$.state||Q>O9||Q<0)return $?Y0($,L1):L1;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===k$&&Q!==X0)return Y0($,$.avail_out===0?c5:L1);if(q.strm=$,V=q.last_flush,q.last_flush=Q,q.status===p6)if(q.wrap===2)if($.adler=0,E(q,31),E(q,139),E(q,8),!q.gzhead)E(q,0),E(q,0),E(q,0),E(q,0),E(q,0),E(q,q.level===9?2:q.strategy>=b6||q.level<2?4:0),E(q,YK),q.status=P0;else{if(E(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(!q.gzhead.extra?0:4)+(!q.gzhead.name?0:8)+(!q.gzhead.comment?0:16)),E(q,q.gzhead.time&255),E(q,q.gzhead.time>>8&255),E(q,q.gzhead.time>>16&255),E(q,q.gzhead.time>>24&255),E(q,q.level===9?2:q.strategy>=b6||q.level<2?4:0),E(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)E(q,q.gzhead.extra.length&255),E(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=Q0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=d5}else{var J=c6+(q.w_bits-8<<4)<<8,G=-1;if(q.strategy>=b6||q.level<2)G=0;else if(q.level<6)G=1;else if(q.level===6)G=2;else G=3;if(J|=G<<6,q.strstart!==0)J|=JK;if(J+=31-J%31,q.status=P0,g$(q,J),q.strstart!==0)g$(q,$.adler>>>16),g$(q,$.adler&65535);$.adler=1}if(q.status===d5)if(q.gzhead.extra){Y=q.pending;while(q.gzindex<(q.gzhead.extra.length&65535)){if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size)break}E(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=_6}else q.status=_6;if(q.status===_6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.name.length)X=q.gzhead.name.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.gzindex=0,q.status=f6}else q.status=f6;if(q.status===f6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.comment.length)X=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.status=m6}else q.status=m6;if(q.status===m6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)V0($);if(q.pending+2<=q.pending_buf_size)E(q,$.adler&255),E(q,$.adler>>8&255),$.adler=0,q.status=P0}else q.status=P0;if(q.pending!==0){if(V0($),$.avail_out===0)return q.last_flush=-1,D1}else if($.avail_in===0&&B9(Q)<=B9(V)&&Q!==X0)return Y0($,c5);if(q.status===k$&&$.avail_in!==0)return Y0($,c5);if($.avail_in!==0||q.lookahead!==0||Q!==O0&&q.status!==k$){var U=q.strategy===b6?WK(q,Q):q.strategy===l3?KK(q,Q):l0[q.level].func(q,Q);if(U===L0||U===o0)q.status=k$;if(U===n||U===L0){if($.avail_out===0)q.last_flush=-1;return D1}if(U===y$){if(Q===m3)P1._tr_align(q);else if(Q!==O9){if(P1._tr_stored_block(q,0,0,!1),Q===c3){if(q0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(V0($),$.avail_out===0)return q.last_flush=-1,D1}}if(Q!==X0)return D1;if(q.wrap<=0)return N9;if(q.wrap===2)E(q,$.adler&255),E(q,$.adler>>8&255),E(q,$.adler>>16&255),E(q,$.adler>>24&255),E(q,$.total_in&255),E(q,$.total_in>>8&255),E(q,$.total_in>>16&255),E(q,$.total_in>>24&255);else g$(q,$.adler>>>16),g$(q,$.adler&65535);if(V0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?D1:N9}function PK($){var Q;if(!$||!$.state)return L1;if(Q=$.state.status,Q!==p6&&Q!==d5&&Q!==_6&&Q!==f6&&Q!==m6&&Q!==P0&&Q!==k$)return Y0($,L1);return $.state=null,Q===P0?Y0($,p3):D1}function LK($,Q){var V=Q.length,q,Y,X,J,G,U,K,W;if(!$||!$.state)return L1;if(q=$.state,J=q.wrap,J===2||J===1&&q.status!==p6||q.lookahead)return L1;if(J===1)$.adler=M9($.adler,Q,V,0);if(q.wrap=0,V>=q.w_size){if(J===0)q0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new Y1.Buf8(q.w_size),Y1.arraySet(W,Q,V-q.w_size,q.w_size,0),Q=W,V=q.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=V,$.next_in=0,$.input=Q,I0(q);while(q.lookahead>=S){Y=q.strstart,X=q.lookahead-(S-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+S-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--X);q.strstart=Y,q.lookahead=S-1,I0(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=S-1,q.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,q.wrap=J,D1}IK.deflateInit=HK;IK.deflateInit2=A9;IK.deflateReset=T9;IK.deflateResetKeep=w9;IK.deflateSetHeader=ZK;IK.deflate=zK;IK.deflateEnd=PK;IK.deflateSetDictionary=LK;IK.deflateInfo="pako deflate (from Nodeca project)"});var l5=w((FK)=>{var u6=l1(),F9=!0,v9=!0;try{String.fromCharCode.apply(null,[0])}catch($){F9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){v9=!1}var D$=new u6.Buf8(256);for(h1=0;h1<256;h1++)D$[h1]=h1>=252?6:h1>=248?5:h1>=240?4:h1>=224?3:h1>=192?2:1;var h1;D$[254]=D$[254]=1;FK.string2buf=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}Q=new u6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q};function x9($,Q){if(Q<65534){if($.subarray&&v9||!$.subarray&&F9)return String.fromCharCode.apply(null,u6.shrinkBuf($,Q))}var V="";for(var q=0;q<Q;q++)V+=String.fromCharCode($[q]);return V}FK.buf2binstring=function($){return x9($,$.length)};FK.binstring2buf=function($){var Q=new u6.Buf8($.length);for(var V=0,q=Q.length;V<q;V++)Q[V]=$.charCodeAt(V);return Q};FK.buf2string=function($,Q){var V,q,Y,X,J=Q||$.length,G=Array(J*2);for(q=0,V=0;V<J;){if(Y=$[V++],Y<128){G[q++]=Y;continue}if(X=D$[Y],X>4){G[q++]=65533,V+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&V<J)Y=Y<<6|$[V++]&63,X--;if(X>1){G[q++]=65533;continue}if(Y<65536)G[q++]=Y;else Y-=65536,G[q++]=55296|Y>>10&1023,G[q++]=56320|Y&1023}return x9(G,q)};FK.utf8border=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+D$[$[V]]>Q?V:Q}});var o5=w((Zz,S9)=>{function kK(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}S9.exports=kK});var y9=w((cK)=>{var h$=R9(),b$=l1(),n5=l5(),r5=h6(),yK=o5(),k9=Object.prototype.toString,DK=0,i5=4,i0=0,E9=1,g9=2,hK=-1,bK=0,_K=8;function N0($){if(!(this instanceof N0))return new N0($);this.options=b$.assign({level:hK,method:_K,chunkSize:16384,windowBits:15,memLevel:8,strategy:bK,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yK,this.strm.avail_out=0;var V=h$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(V!==i0)throw Error(r5[V]);if(Q.header)h$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=n5.string2buf(Q.dictionary);else if(k9.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(V=h$.deflateSetDictionary(this.strm,q),V!==i0)throw Error(r5[V]);this._dict_set=!0}}N0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?i5:DK,typeof $==="string")V.input=n5.string2buf($);else if(k9.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new b$.Buf8(q),V.next_out=0,V.avail_out=q;if(Y=h$.deflate(V,X),Y!==E9&&Y!==i0)return this.onEnd(Y),this.ended=!0,!1;if(V.avail_out===0||V.avail_in===0&&(X===i5||X===g9))if(this.options.to==="string")this.onData(n5.buf2binstring(b$.shrinkBuf(V.output,V.next_out)));else this.onData(b$.shrinkBuf(V.output,V.next_out))}while((V.avail_in>0||V.avail_out===0)&&Y!==E9);if(X===i5)return Y=h$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===i0;if(X===g9)return this.onEnd(i0),V.avail_out=0,!0;return!0};N0.prototype.onData=function($){this.chunks.push($)};N0.prototype.onEnd=function($){if($===i0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=b$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a5($,Q){var V=new N0(Q);if(V.push($,!0),V.err)throw V.msg||r5[V.err];return V.result}function fK($,Q){return Q=Q||{},Q.raw=!0,a5($,Q)}function mK($,Q){return Q=Q||{},Q.gzip=!0,a5($,Q)}cK.Deflate=N0;cK.deflate=a5;cK.deflateRaw=fK;cK.gzip=mK});var h9=w((zz,D9)=>{var d6=30,oK=12;D9.exports=function(Q,V){var q,Y,X,J,G,U,K,W,j,H,z,C,P,M,B,L,T,O,I,R,F,v,x,b,A;q=Q.state,Y=Q.next_in,b=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,A=Q.output,G=J-(V-Q.avail_out),U=J+(Q.avail_out-257),K=q.dmax,W=q.wsize,j=q.whave,H=q.wnext,z=q.window,C=q.hold,P=q.bits,M=q.lencode,B=q.distcode,L=(1<<q.lenbits)-1,T=(1<<q.distbits)-1;$:do{if(P<15)C+=b[Y++]<<P,P+=8,C+=b[Y++]<<P,P+=8;O=M[C&L];Q:for(;;){if(I=O>>>24,C>>>=I,P-=I,I=O>>>16&255,I===0)A[J++]=O&65535;else if(I&16){if(R=O&65535,I&=15,I){if(P<I)C+=b[Y++]<<P,P+=8;R+=C&(1<<I)-1,C>>>=I,P-=I}if(P<15)C+=b[Y++]<<P,P+=8,C+=b[Y++]<<P,P+=8;O=B[C&T];V:for(;;){if(I=O>>>24,C>>>=I,P-=I,I=O>>>16&255,I&16){if(F=O&65535,I&=15,P<I){if(C+=b[Y++]<<P,P+=8,P<I)C+=b[Y++]<<P,P+=8}if(F+=C&(1<<I)-1,F>K){Q.msg="invalid distance too far back",q.mode=d6;break $}if(C>>>=I,P-=I,I=J-G,F>I){if(I=F-I,I>j){if(q.sane){Q.msg="invalid distance too far back",q.mode=d6;break $}}if(v=0,x=z,H===0){if(v+=W-I,I<R){R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}}else if(H<I){if(v+=W+H-I,I-=H,I<R){R-=I;do A[J++]=z[v++];while(--I);if(v=0,H<R){I=H,R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}}}else if(v+=H-I,I<R){R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}while(R>2)A[J++]=x[v++],A[J++]=x[v++],A[J++]=x[v++],R-=3;if(R){if(A[J++]=x[v++],R>1)A[J++]=x[v++]}}else{v=J-F;do A[J++]=A[v++],A[J++]=A[v++],A[J++]=A[v++],R-=3;while(R>2);if(R){if(A[J++]=A[v++],R>1)A[J++]=A[v++]}}}else if((I&64)===0){O=B[(O&65535)+(C&(1<<I)-1)];continue V}else{Q.msg="invalid distance code",q.mode=d6;break $}break}}else if((I&64)===0){O=M[(O&65535)+(C&(1<<I)-1)];continue Q}else if(I&32){q.mode=oK;break $}else{Q.msg="invalid literal/length code",q.mode=d6;break $}break}}while(Y<X&&J<U);R=P>>3,Y-=R,P-=R<<3,C&=(1<<P)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),q.hold=C,q.bits=P;return}});var u9=w((Pz,p9)=>{var b9=l1(),n0=15,_9=852,f9=592,m9=0,s5=1,c9=2,iK=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],nK=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rK=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],aK=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];p9.exports=function(Q,V,q,Y,X,J,G,U){var K=U.bits,W=0,j=0,H=0,z=0,C=0,P=0,M=0,B=0,L=0,T=0,O,I,R,F,v,x=null,b=0,A,W1=new b9.Buf16(n0+1),F0=new b9.Buf16(n0+1),Q6=null,_Q=0,fQ,V6,q6;for(W=0;W<=n0;W++)W1[W]=0;for(j=0;j<Y;j++)W1[V[q+j]]++;C=K;for(z=n0;z>=1;z--)if(W1[z]!==0)break;if(C>z)C=z;if(z===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(H=1;H<z;H++)if(W1[H]!==0)break;if(C<H)C=H;B=1;for(W=1;W<=n0;W++)if(B<<=1,B-=W1[W],B<0)return-1;if(B>0&&(Q===m9||z!==1))return-1;F0[1]=0;for(W=1;W<n0;W++)F0[W+1]=F0[W]+W1[W];for(j=0;j<Y;j++)if(V[q+j]!==0)G[F0[V[q+j]]++]=j;if(Q===m9)x=Q6=G,A=19;else if(Q===s5)x=iK,b-=257,Q6=nK,_Q-=257,A=256;else x=rK,Q6=aK,A=-1;if(T=0,j=0,W=H,v=J,P=C,M=0,R=-1,L=1<<C,F=L-1,Q===s5&&L>_9||Q===c9&&L>f9)return 1;for(;;){if(fQ=W-M,G[j]<A)V6=0,q6=G[j];else if(G[j]>A)V6=Q6[_Q+G[j]],q6=x[b+G[j]];else V6=96,q6=0;O=1<<W-M,I=1<<P,H=I;do I-=O,X[v+(T>>M)+I]=fQ<<24|V6<<16|q6|0;while(I!==0);O=1<<W-1;while(T&O)O>>=1;if(O!==0)T&=O-1,T+=O;else T=0;if(j++,--W1[W]===0){if(W===z)break;W=V[q+G[j]]}if(W>C&&(T&F)!==R){if(M===0)M=C;v+=H,P=W-M,B=1<<P;while(P+M<z){if(B-=W1[P+M],B<=0)break;P++,B<<=1}if(L+=1<<P,Q===s5&&L>_9||Q===c9&&L>f9)return 1;R=T&F,X[R]=C<<24|P<<16|v-J|0}}if(T!==0)X[v+T]=W-M<<24|4194304|0;return U.bits=C,0}});var T2=w((PW)=>{var H1=l1(),qQ=f5(),b1=m5(),sK=h9(),_$=u9(),tK=0,P2=1,L2=2,d9=4,eK=5,l6=6,B0=0,$W=1,QW=2,I1=-2,I2=-3,JQ=-4,VW=-5,l9=8,O2=1,o9=2,i9=3,n9=4,r9=5,a9=6,s9=7,t9=8,e9=9,$2=10,n6=11,i1=12,t5=13,Q2=14,e5=15,V2=16,q2=17,J2=18,Y2=19,o6=20,i6=21,X2=22,G2=23,K2=24,W2=25,U2=26,$Q=27,j2=28,Z2=29,c=30,YQ=31,qW=32,JW=852,YW=592,XW=15,GW=XW;function H2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function KW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new H1.Buf16(320),this.work=new H1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function N2($){var Q;if(!$||!$.state)return I1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=O2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new H1.Buf32(JW),Q.distcode=Q.distdyn=new H1.Buf32(YW),Q.sane=1,Q.back=-1,B0}function B2($){var Q;if(!$||!$.state)return I1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,N2($)}function M2($,Q){var V,q;if(!$||!$.state)return I1;if(q=$.state,Q<0)V=0,Q=-Q;else if(V=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return I1;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=V,q.wbits=Q,B2($)}function C2($,Q){var V,q;if(!$)return I1;if(q=new KW,$.state=q,q.window=null,V=M2($,Q),V!==B0)$.state=null;return V}function WW($){return C2($,GW)}var z2=!0,QQ,VQ;function UW($){if(z2){var Q;QQ=new H1.Buf32(512),VQ=new H1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;_$(P2,$.lens,0,288,QQ,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;_$(L2,$.lens,0,32,VQ,0,$.work,{bits:5}),z2=!1}$.lencode=QQ,$.lenbits=9,$.distcode=VQ,$.distbits=5}function w2($,Q,V,q){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new H1.Buf8(X.wsize);if(q>=X.wsize)H1.arraySet(X.window,Q,V-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>q)Y=q;if(H1.arraySet(X.window,Q,V-q,Y,X.wnext),q-=Y,q)H1.arraySet(X.window,Q,V-q,q,0),X.wnext=q,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function jW($,Q){var V,q,Y,X,J,G,U,K,W,j,H,z,C,P,M=0,B,L,T,O,I,R,F,v,x=new H1.Buf8(4),b,A,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return I1;if(V=$.state,V.mode===i1)V.mode=t5;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,j=G,H=U,v=B0;$:for(;;)switch(V.mode){case O2:if(V.wrap===0){V.mode=t5;break}while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.wrap&2&&K===35615){V.check=0,x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0),K=0,W=0,V.mode=o9;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",V.mode=c;break}if((K&15)!==l9){$.msg="unknown compression method",V.mode=c;break}if(K>>>=4,W-=4,F=(K&15)+8,V.wbits===0)V.wbits=F;else if(F>V.wbits){$.msg="invalid window size",V.mode=c;break}V.dmax=1<<F,$.adler=V.check=1,V.mode=K&512?$2:i1,K=0,W=0;break;case o9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.flags=K,(V.flags&255)!==l9){$.msg="unknown compression method",V.mode=c;break}if(V.flags&57344){$.msg="unknown header flags set",V.mode=c;break}if(V.head)V.head.text=K>>8&1;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=i9;case i9:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.time=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,V.check=b1(V.check,x,4,0);K=0,W=0,V.mode=n9;case n9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.xflags=K&255,V.head.os=K>>8;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=r9;case r9:if(V.flags&1024){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.length=K,V.head)V.head.extra_len=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0}else if(V.head)V.head.extra=null;V.mode=a9;case a9:if(V.flags&1024){if(z=V.length,z>G)z=G;if(z){if(V.head){if(F=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);H1.arraySet(V.head.extra,q,X,z,F)}if(V.flags&512)V.check=b1(V.check,q,z,X);G-=z,X+=z,V.length-=z}if(V.length)break $}V.length=0,V.mode=s9;case s9:if(V.flags&2048){if(G===0)break $;z=0;do if(F=q[X+z++],V.head&&F&&V.length<65536)V.head.name+=String.fromCharCode(F);while(F&&z<G);if(V.flags&512)V.check=b1(V.check,q,z,X);if(G-=z,X+=z,F)break $}else if(V.head)V.head.name=null;V.length=0,V.mode=t9;case t9:if(V.flags&4096){if(G===0)break $;z=0;do if(F=q[X+z++],V.head&&F&&V.length<65536)V.head.comment+=String.fromCharCode(F);while(F&&z<G);if(V.flags&512)V.check=b1(V.check,q,z,X);if(G-=z,X+=z,F)break $}else if(V.head)V.head.comment=null;V.mode=e9;case e9:if(V.flags&512){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.check&65535)){$.msg="header crc mismatch",V.mode=c;break}K=0,W=0}if(V.head)V.head.hcrc=V.flags>>9&1,V.head.done=!0;$.adler=V.check=0,V.mode=i1;break;case $2:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}$.adler=V.check=H2(K),K=0,W=0,V.mode=n6;case n6:if(V.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,QW;$.adler=V.check=1,V.mode=i1;case i1:if(Q===eK||Q===l6)break $;case t5:if(V.last){K>>>=W&7,W-=W&7,V.mode=$Q;break}while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}switch(V.last=K&1,K>>>=1,W-=1,K&3){case 0:V.mode=Q2;break;case 1:if(UW(V),V.mode=o6,Q===l6){K>>>=2,W-=2;break $}break;case 2:V.mode=q2;break;case 3:$.msg="invalid block type",V.mode=c}K>>>=2,W-=2;break;case Q2:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",V.mode=c;break}if(V.length=K&65535,K=0,W=0,V.mode=e5,Q===l6)break $;case e5:V.mode=V2;case V2:if(z=V.length,z){if(z>G)z=G;if(z>U)z=U;if(z===0)break $;H1.arraySet(Y,q,X,z,J),G-=z,X+=z,U-=z,J+=z,V.length-=z;break}V.mode=i1;break;case q2:while(W<14){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.nlen=(K&31)+257,K>>>=5,W-=5,V.ndist=(K&31)+1,K>>>=5,W-=5,V.ncode=(K&15)+4,K>>>=4,W-=4,V.nlen>286||V.ndist>30){$.msg="too many length or distance symbols",V.mode=c;break}V.have=0,V.mode=J2;case J2:while(V.have<V.ncode){while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.lens[W1[V.have++]]=K&7,K>>>=3,W-=3}while(V.have<19)V.lens[W1[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,b={bits:V.lenbits},v=_$(tK,V.lens,0,19,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid code lengths set",V.mode=c;break}V.have=0,V.mode=Y2;case Y2:while(V.have<V.nlen+V.ndist){for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(T<16)K>>>=B,W-=B,V.lens[V.have++]=T;else{if(T===16){A=B+2;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K>>>=B,W-=B,V.have===0){$.msg="invalid bit length repeat",V.mode=c;break}F=V.lens[V.have-1],z=3+(K&3),K>>>=2,W-=2}else if(T===17){A=B+3;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,F=0,z=3+(K&7),K>>>=3,W-=3}else{A=B+7;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,F=0,z=11+(K&127),K>>>=7,W-=7}if(V.have+z>V.nlen+V.ndist){$.msg="invalid bit length repeat",V.mode=c;break}while(z--)V.lens[V.have++]=F}}if(V.mode===c)break;if(V.lens[256]===0){$.msg="invalid code -- missing end-of-block",V.mode=c;break}if(V.lenbits=9,b={bits:V.lenbits},v=_$(P2,V.lens,0,V.nlen,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid literal/lengths set",V.mode=c;break}if(V.distbits=6,V.distcode=V.distdyn,b={bits:V.distbits},v=_$(L2,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,b),V.distbits=b.bits,v){$.msg="invalid distances set",V.mode=c;break}if(V.mode=o6,Q===l6)break $;case o6:V.mode=i6;case i6:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,sK($,H),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,V.mode===i1)V.back=-1;break}V.back=0;for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(L&&(L&240)===0){O=B,I=L,R=T;for(;;){if(M=V.lencode[R+((K&(1<<O+I)-1)>>O)],B=M>>>24,L=M>>>16&255,T=M&65535,O+B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=O,W-=O,V.back+=O}if(K>>>=B,W-=B,V.back+=B,V.length=T,L===0){V.mode=U2;break}if(L&32){V.back=-1,V.mode=i1;break}if(L&64){$.msg="invalid literal/length code",V.mode=c;break}V.extra=L&15,V.mode=X2;case X2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.length+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=G2;case G2:for(;;){if(M=V.distcode[K&(1<<V.distbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((L&240)===0){O=B,I=L,R=T;for(;;){if(M=V.distcode[R+((K&(1<<O+I)-1)>>O)],B=M>>>24,L=M>>>16&255,T=M&65535,O+B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=O,W-=O,V.back+=O}if(K>>>=B,W-=B,V.back+=B,L&64){$.msg="invalid distance code",V.mode=c;break}V.offset=T,V.extra=L&15,V.mode=K2;case K2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.offset+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){$.msg="invalid distance too far back",V.mode=c;break}V.mode=W2;case W2:if(U===0)break $;if(z=H-U,V.offset>z){if(z=V.offset-z,z>V.whave){if(V.sane){$.msg="invalid distance too far back",V.mode=c;break}}if(z>V.wnext)z-=V.wnext,C=V.wsize-z;else C=V.wnext-z;if(z>V.length)z=V.length;P=V.window}else P=Y,C=J-V.offset,z=V.length;if(z>U)z=U;U-=z,V.length-=z;do Y[J++]=P[C++];while(--z);if(V.length===0)V.mode=i6;break;case U2:if(U===0)break $;Y[J++]=V.length,U--,V.mode=i6;break;case $Q:if(V.wrap){while(W<32){if(G===0)break $;G--,K|=q[X++]<<W,W+=8}if(H-=U,$.total_out+=H,V.total+=H,H)$.adler=V.check=V.flags?b1(V.check,Y,H,J-H):qQ(V.check,Y,H,J-H);if(H=U,(V.flags?K:H2(K))!==V.check){$.msg="incorrect data check",V.mode=c;break}K=0,W=0}V.mode=j2;case j2:if(V.wrap&&V.flags){while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.total&4294967295)){$.msg="incorrect length check",V.mode=c;break}K=0,W=0}V.mode=Z2;case Z2:v=$W;break $;case c:v=I2;break $;case YQ:return JQ;case qW:default:return I1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,V.wsize||H!==$.avail_out&&V.mode<c&&(V.mode<$Q||Q!==d9)){if(w2($,$.output,$.next_out,H-$.avail_out))return V.mode=YQ,JQ}if(j-=$.avail_in,H-=$.avail_out,$.total_in+=j,$.total_out+=H,V.total+=H,V.wrap&&H)$.adler=V.check=V.flags?b1(V.check,Y,H,$.next_out-H):qQ(V.check,Y,H,$.next_out-H);if($.data_type=V.bits+(V.last?64:0)+(V.mode===i1?128:0)+(V.mode===o6||V.mode===e5?256:0),(j===0&&H===0||Q===d9)&&v===B0)v=VW;return v}function ZW($){if(!$||!$.state)return I1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,B0}function HW($,Q){var V;if(!$||!$.state)return I1;if(V=$.state,(V.wrap&2)===0)return I1;return V.head=Q,Q.done=!1,B0}function zW($,Q){var V=Q.length,q,Y,X;if(!$||!$.state)return I1;if(q=$.state,q.wrap!==0&&q.mode!==n6)return I1;if(q.mode===n6){if(Y=1,Y=qQ(Y,Q,V,0),Y!==q.check)return I2}if(X=w2($,Q,V,V),X)return q.mode=YQ,JQ;return q.havedict=1,B0}PW.inflateReset=B2;PW.inflateReset2=M2;PW.inflateResetKeep=N2;PW.inflateInit=WW;PW.inflateInit2=C2;PW.inflate=jW;PW.inflateEnd=ZW;PW.inflateGetHeader=HW;PW.inflateSetDictionary=zW;PW.inflateInfo="pako inflate (from Nodeca project)"});var XQ=w((Iz,A2)=>{A2.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var F2=w((Oz,R2)=>{function RW(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}R2.exports=RW});var x2=w((SW)=>{var r0=T2(),f$=l1(),r6=l5(),d=XQ(),GQ=h6(),FW=o5(),vW=F2(),v2=Object.prototype.toString;function M0($){if(!(this instanceof M0))return new M0($);this.options=f$.assign({chunkSize:16384,windowBits:0,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!($&&$.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new FW,this.strm.avail_out=0;var V=r0.inflateInit2(this.strm,Q.windowBits);if(V!==d.Z_OK)throw Error(GQ[V]);if(this.header=new vW,r0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=r6.string2buf(Q.dictionary);else if(v2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(V=r0.inflateSetDictionary(this.strm,Q.dictionary),V!==d.Z_OK)throw Error(GQ[V])}}}M0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?d.Z_FINISH:d.Z_NO_FLUSH,typeof $==="string")V.input=r6.binstring2buf($);else if(v2.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new f$.Buf8(q),V.next_out=0,V.avail_out=q;if(X=r0.inflate(V,d.Z_NO_FLUSH),X===d.Z_NEED_DICT&&Y)X=r0.inflateSetDictionary(this.strm,Y);if(X===d.Z_BUF_ERROR&&W===!0)X=d.Z_OK,W=!1;if(X!==d.Z_STREAM_END&&X!==d.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(V.next_out){if(V.avail_out===0||X===d.Z_STREAM_END||V.avail_in===0&&(J===d.Z_FINISH||J===d.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=r6.utf8border(V.output,V.next_out),U=V.next_out-G,K=r6.buf2string(V.output,G),V.next_out=U,V.avail_out=q-U,U)f$.arraySet(V.output,V.output,G,U,0);this.onData(K)}else this.onData(f$.shrinkBuf(V.output,V.next_out))}if(V.avail_in===0&&V.avail_out===0)W=!0}while((V.avail_in>0||V.avail_out===0)&&X!==d.Z_STREAM_END);if(X===d.Z_STREAM_END)J=d.Z_FINISH;if(J===d.Z_FINISH)return X=r0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===d.Z_OK;if(J===d.Z_SYNC_FLUSH)return this.onEnd(d.Z_OK),V.avail_out=0,!0;return!0};M0.prototype.onData=function($){this.chunks.push($)};M0.prototype.onEnd=function($){if($===d.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=f$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function KQ($,Q){var V=new M0(Q);if(V.push($,!0),V.err)throw V.msg||GQ[V.err];return V.result}function xW($,Q){return Q=Q||{},Q.raw=!0,KQ($,Q)}SW.Inflate=M0;SW.inflate=KQ;SW.inflateRaw=xW;SW.ungzip=KQ});var g2=w((Bz,E2)=>{var DW=l1().assign,hW=y9(),bW=x2(),_W=XQ(),S2={};DW(S2,hW,bW,_W);E2.exports=S2});var y2=w((pW)=>{var fW=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",mW=g2(),k2=p(),a6=Z1(),cW=fW?"uint8array":"array";pW.magic="\b\x00";function C0($,Q){a6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}k2.inherits(C0,a6);C0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(k2.transformTo(cW,$.data),!1)};C0.prototype.flush=function(){if(a6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};C0.prototype.cleanUp=function(){a6.prototype.cleanUp.call(this),this._pako=null};C0.prototype._createPako=function(){this._pako=new mW[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};pW.compressWorker=function($){return new C0("Deflate",$)};pW.uncompressWorker=function(){return new C0("Inflate",{})}});var WQ=w((oW)=>{var D2=Z1();oW.STORE={magic:"\x00\x00",compressWorker:function(){return new D2("STORE compression")},uncompressWorker:function(){return new D2("STORE decompression")}};oW.DEFLATE=y2()});var UQ=w((rW)=>{rW.LOCAL_FILE_HEADER="PK\x03\x04";rW.CENTRAL_FILE_HEADER="PK\x01\x02";rW.CENTRAL_DIRECTORY_END="PK\x05\x06";rW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";rW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";rW.DATA_DESCRIPTOR="PK\x07\b"});var f2=w((Tz,_2)=>{var a0=p(),s0=Z1(),jQ=m0(),h2=g6(),s6=UQ(),h=function($,Q){var V="",q;for(q=0;q<Q;q++)V+=String.fromCharCode($&255),$=$>>>8;return V},VU=function($,Q){var V=$;if(!$)V=Q?16893:33204;return(V&65535)<<16},qU=function($){return($||0)&63},b2=function($,Q,V,q,Y,X){var{file:J,compression:G}=$,U=X!==jQ.utf8encode,K=a0.transformTo("string",X(J.name)),W=a0.transformTo("string",jQ.utf8encode(J.name)),j=J.comment,H=a0.transformTo("string",X(j)),z=a0.transformTo("string",jQ.utf8encode(j)),C=W.length!==J.name.length,P=z.length!==j.length,M,B,L="",T="",O="",I=J.dir,R=J.date,F={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||V)F.crc32=$.crc32,F.compressedSize=$.compressedSize,F.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||P))v|=2048;var x=0,b=0;if(I)x|=16;if(Y==="UNIX")b=798,x|=VU(J.unixPermissions,I);else b=20,x|=qU(J.dosPermissions,I);if(M=R.getUTCHours(),M=M<<6,M=M|R.getUTCMinutes(),M=M<<5,M=M|R.getUTCSeconds()/2,B=R.getUTCFullYear()-1980,B=B<<4,B=B|R.getUTCMonth()+1,B=B<<5,B=B|R.getUTCDate(),C)T=h(1,1)+h(h2(K),4)+W,L+="up"+h(T.length,2)+T;if(P)O=h(1,1)+h(h2(H),4)+z,L+="uc"+h(O.length,2)+O;var A="";A+=`
3
+ \x00`,A+=h(v,2),A+=G.magic,A+=h(M,2),A+=h(B,2),A+=h(F.crc32,4),A+=h(F.compressedSize,4),A+=h(F.uncompressedSize,4),A+=h(K.length,2),A+=h(L.length,2);var W1=s6.LOCAL_FILE_HEADER+A+K+L,F0=s6.CENTRAL_FILE_HEADER+h(b,2)+A+h(H.length,2)+"\x00\x00\x00\x00"+h(x,4)+h(q,4)+K+L+H;return{fileRecord:W1,dirRecord:F0}},JU=function($,Q,V,q,Y){var X="",J=a0.transformTo("string",Y(q));return X=s6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+h($,2)+h($,2)+h(Q,4)+h(V,4)+h(J.length,2)+J,X},YU=function($){var Q="";return Q=s6.DATA_DESCRIPTOR+h($.crc32,4)+h($.compressedSize,4)+h($.uncompressedSize,4),Q};function F1($,Q,V,q){s0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=V,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a0.inherits(F1,s0);F1.prototype.push=function($){var Q=$.meta.percent||0,V=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,s0.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:V?(Q+100*(V-q-1))/V:100}})};F1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var V=b2($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:V.fileRecord,meta:{percent:0}})}else this.accumulate=!0};F1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,V=b2($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(V.dirRecord),Q)this.push({data:YU($),meta:{percent:100}});else{this.push({data:V.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};F1.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var V=this.bytesWritten-$,q=JU(this.dirRecords.length,V,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};F1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};F1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(V){Q.error(V)}),this};F1.prototype.resume=function(){if(!s0.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};F1.prototype.error=function($){var Q=this._sources;if(!s0.prototype.error.call(this,$))return!1;for(var V=0;V<Q.length;V++)try{Q[V].error($)}catch(q){}return!0};F1.prototype.lock=function(){s0.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};_2.exports=F1});var m2=w((WU)=>{var XU=WQ(),GU=f2(),KU=function($,Q){var V=$||Q,q=XU[V];if(!q)throw Error(V+" is not a valid compression method !");return q};WU.generateWorker=function($,Q,V){var q=new GU(Q.streamFiles,V,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=KU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(X){q.error(X)}return q}});var p2=w((Rz,c2)=>{var jU=p(),t6=Z1();function m$($,Q){t6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}jU.inherits(m$,t6);m$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(V){Q.push({data:V,meta:{percent:0}})}).on("error",function(V){if(Q.isPaused)this.generatedError=V;else Q.error(V)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};m$.prototype.pause=function(){if(!t6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};m$.prototype.resume=function(){if(!t6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};c2.exports=m$});var t2=w((Fz,s2)=>{var ZU=m0(),c$=p(),o2=Z1(),HU=P5(),i2=L5(),u2=k6(),zU=dq(),PU=m2(),d2=N$(),LU=p2(),n2=function($,Q,V){var q=c$.getTypeOf(Q),Y,X=c$.extend(V||{},i2);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=r2($);if(X.createFolders&&(Y=IU($)))a2.call(this,Y,!0);var J=q==="string"&&X.binary===!1&&X.base64===!1;if(!V||typeof V.binary>"u")X.binary=!J;var G=Q instanceof u2&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",q="string";var U=null;if(Q instanceof u2||Q instanceof o2)U=Q;else if(d2.isNode&&d2.isStream(Q))U=new LU($,Q);else U=c$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new zU($,U,X);this.files[$]=K},IU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},r2=function($){if($.slice(-1)!=="/")$+="/";return $},a2=function($,Q){if(Q=typeof Q<"u"?Q:i2.createFolders,$=r2($),!this.files[$])n2.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function l2($){return Object.prototype.toString.call($)==="[object RegExp]"}var OU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,V,q;for(Q in this.files)if(q=this.files[Q],V=Q.slice(this.root.length,Q.length),V&&Q.slice(0,this.root.length)===this.root)$(V,q)},filter:function($){var Q=[];return this.forEach(function(V,q){if($(V,q))Q.push(q)}),Q},file:function($,Q,V){if(arguments.length===1)if(l2($)){var q=$;return this.filter(function(X,J){return!J.dir&&q.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,n2.call(this,$,Q,V);return this},folder:function($){if(!$)return this;if(l2($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,V=a2.call(this,Q),q=this.clone();return q.root=V.name,q},remove:function($){$=this.root+$;var Q=this.files[$];if(!Q){if($.slice(-1)!=="/")$+="/";Q=this.files[$]}if(Q&&!Q.dir)delete this.files[$];else{var V=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var q=0;q<V.length;q++)delete this.files[V[q].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function($){var Q,V={};try{if(V=c$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:ZU.utf8encode}),V.type=V.type.toLowerCase(),V.compression=V.compression.toUpperCase(),V.type==="binarystring")V.type="string";if(!V.type)throw Error("No output type specified.");if(c$.checkSupport(V.type),V.platform==="darwin"||V.platform==="freebsd"||V.platform==="linux"||V.platform==="sunos")V.platform="UNIX";if(V.platform==="win32")V.platform="DOS";var q=V.comment||this.comment||"";Q=PU.generateWorker(this,V,q)}catch(Y){Q=new o2("error"),Q.error(Y)}return new HU(Q,V.type||"string",V.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};s2.exports=OU});var ZQ=w((vz,$7)=>{var NU=p();function e2($){this.data=$,this.length=$.length,this.index=0,this.zero=0}e2.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length<this.zero+$||$<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+$+"). Corrupted zip ?")},setIndex:function($){this.checkIndex($),this.index=$},skip:function($){this.setIndex(this.index+$)},byteAt:function(){},readInt:function($){var Q=0,V;this.checkOffset($);for(V=this.index+$-1;V>=this.index;V--)Q=(Q<<8)+this.byteAt(V);return this.index+=$,Q},readString:function($){return NU.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};$7.exports=e2});var HQ=w((xz,V7)=>{var Q7=ZQ(),BU=p();function t0($){Q7.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}BU.inherits(t0,Q7);t0.prototype.byteAt=function($){return this.data[this.zero+$]};t0.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===V&&this.data[X+2]===q&&this.data[X+3]===Y)return X-this.zero;return-1};t0.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&V===X[1]&&q===X[2]&&Y===X[3]};t0.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};V7.exports=t0});var Y7=w((Sz,J7)=>{var q7=ZQ(),MU=p();function e0($){q7.call(this,$)}MU.inherits(e0,q7);e0.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};e0.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};e0.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};e0.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};J7.exports=e0});var PQ=w((Ez,G7)=>{var X7=HQ(),CU=p();function zQ($){X7.call(this,$)}CU.inherits(zQ,X7);zQ.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var Q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};G7.exports=zQ});var U7=w((gz,W7)=>{var K7=PQ(),wU=p();function LQ($){K7.call(this,$)}wU.inherits(LQ,K7);LQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};W7.exports=LQ});var IQ=w((kz,Z7)=>{var e6=p(),j7=d1(),TU=HQ(),AU=Y7(),RU=U7(),FU=PQ();Z7.exports=function($){var Q=e6.getTypeOf($);if(e6.checkSupport(Q),Q==="string"&&!j7.uint8array)return new AU($);if(Q==="nodebuffer")return new RU($);if(j7.uint8array)return new FU(e6.transformTo("uint8array",$));return new TU(e6.transformTo("array",$))}});var L7=w((yz,P7)=>{var OQ=IQ(),G0=p(),vU=k6(),H7=g6(),$8=m0(),Q8=WQ(),xU=d1(),SU=0,EU=3,gU=function($){for(var Q in Q8){if(!Object.prototype.hasOwnProperty.call(Q8,Q))continue;if(Q8[Q].magic===$)return Q8[Q]}return null};function z7($,Q){this.options=$,this.loadOptions=Q}z7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,V;if($.skip(22),this.fileNameLength=$.readInt(2),V=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(V),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(Q=gU(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+G0.pretty(this.compressionMethod)+" unknown (inner file : "+G0.transformTo("string",this.fileName)+")");this.decompressed=new vU(this.compressedSize,this.uncompressedSize,this.crc32,Q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var Q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(Q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===SU)this.dosPermissions=this.externalFileAttributes&63;if($===EU)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=OQ(this.extraFields[1].value);if(this.uncompressedSize===G0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,V,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)V=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[V]={id:V,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=xU.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=$8.utf8decode(this.fileName),this.fileCommentStr=$8.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var V=G0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(V)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=G0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=OQ($.value);if(Q.readInt(1)!==1)return null;if(H7(this.fileName)!==Q.readInt(4))return null;return $8.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=OQ($.value);if(Q.readInt(1)!==1)return null;if(H7(this.fileComment)!==Q.readInt(4))return null;return $8.utf8decode(Q.readData($.length-5))}return null}};P7.exports=z7});var N7=w((Dz,O7)=>{var kU=IQ(),n1=p(),v1=UQ(),yU=L7(),DU=d1();function I7($){this.files=[],this.loadOptions=$}I7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+n1.pretty(Q)+", expected "+n1.pretty($)+")")}},isSignature:function($,Q){var V=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(V),Y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),Q=DU.uint8array?"uint8array":"array",V=n1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(V)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,Q=0,V,q,Y;while(Q<$)V=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[V]={id:V,length:q,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(v1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(v1.CENTRAL_FILE_HEADER))$=new yU({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(v1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,v1.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var V=$;if(this.checkSignature(v1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n1.MAX_VALUE_16BITS||this.centralDirRecords===n1.MAX_VALUE_16BITS||this.centralDirSize===n1.MAX_VALUE_32BITS||this.centralDirOffset===n1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,v1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=V-q;if(Y>0)if(this.isSignature(V,v1.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=kU($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};O7.exports=I7});var C7=w((hz,M7)=>{var NQ=p(),V8=b0(),hU=m0(),bU=N7(),_U=N5(),B7=N$();function fU($){return new V8.Promise(function(Q,V){var q=$.decompressed.getContentWorker().pipe(new _U);q.on("error",function(Y){V(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)V(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}M7.exports=function($,Q){var V=this;if(Q=NQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:hU.utf8decode}),B7.isNode&&B7.isStream($))return V8.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return NQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new bU(Q);return Y.load(q),Y}).then(function(Y){var X=[V8.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(fU(J[G]));return V8.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=NQ.resolve(U.fileNameStr);if(V.file(W,U.decompressed,{binary:!0,optimizedBinaryString:!0,date:U.date,dir:U.dir,comment:U.fileCommentStr.length?U.fileCommentStr:null,unixPermissions:U.unixPermissions,dosPermissions:U.dosPermissions,createFolders:Q.createFolders}),!U.dir)V.file(W).unsafeOriginalName=K}if(X.zipComment.length)V.comment=X.zipComment;return V})}});var T7=w((bz,w7)=>{function O1(){if(!(this instanceof O1))return new O1;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new O1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}O1.prototype=t2();O1.prototype.loadAsync=C7();O1.support=d1();O1.defaults=L5();O1.version="3.10.1";O1.loadAsync=function($,Q){return new O1().loadAsync($,Q)};O1.external=b0();w7.exports=O1});import{mkdir as _J,readdir as SZ,readFile as hQ,stat as lJ,writeFile as H8}from"node:fs/promises";import{homedir as fJ}from"node:os";import X1 from"node:path";import{stripVTControlCharacters as x8}from"node:util";var e=C1(N8(),1);import{stdin as eQ,stdout as $V}from"node:process";import*as s1 from"node:readline";import dQ from"node:readline";import{Writable as WY}from"node:stream";function UY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}var jY=UY();function QV($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(jY,"")}function VV($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var qV={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(q){var Y=q.charCodeAt(0),X=q.length==2?q.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(q){var Y=this.eastAsianWidth(q);return Y=="F"||Y=="W"||Y=="A"?2:1};function V(q){return q.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(q){for(var Y=V(q),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(q,Y,X){textLen=Q.length(q),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=V(q),K=0;K<U.length;K++){var W=U[K],j=Q.length(W);if(G>=Y-(j==2?1:0))if(G+j<=X)J+=W;else break;G+=j}return J}})(qV);var ZY=qV.exports,HY=VV(ZY),zY=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},PY=VV(zY);function Y$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=QV($),$.length===0))return 0;$=$.replace(PY()," ");let V=Q.ambiguousIsNarrow?1:2,q=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(HY.eastAsianWidth(Y)){case"F":case"W":q+=2;break;case"A":q+=V;break;default:q+=1}}return q}var M8=10,lQ=($=0)=>(Q)=>`\x1B[${Q+$}m`,oQ=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,iQ=($=0)=>(Q,V,q)=>`\x1B[${38+$};2;${Q};${V};${q}m`,f={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(f.modifier);var LY=Object.keys(f.color),IY=Object.keys(f.bgColor);[...LY,...IY];function OY(){let $=new Map;for(let[Q,V]of Object.entries(f)){for(let[q,Y]of Object.entries(V))f[q]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},V[q]=f[q],$.set(Y[0],Y[1]);Object.defineProperty(f,Q,{value:V,enumerable:!1})}return Object.defineProperty(f,"codes",{value:$,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=lQ(),f.color.ansi256=oQ(),f.color.ansi16m=iQ(),f.bgColor.ansi=lQ(M8),f.bgColor.ansi256=oQ(M8),f.bgColor.ansi16m=iQ(M8),Object.defineProperties(f,{rgbToAnsi256:{value:(Q,V,q)=>Q===V&&V===q?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(V/255*5)+Math.round(q/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let V=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!V)return[0,0,0];let[q]=V;q.length===3&&(q=[...q].map((X)=>X+X).join(""));let Y=Number.parseInt(q,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>f.rgbToAnsi256(...f.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let V,q,Y;if(Q>=232)V=((Q-232)*10+8)/255,q=V,Y=V;else{Q-=16;let G=Q%36;V=Math.floor(Q/36)/5,q=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(V,q,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(q)<<1|Math.round(V));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,V,q)=>f.ansi256ToAnsi(f.rgbToAnsi256(Q,V,q)),enumerable:!1},hexToAnsi:{value:(Q)=>f.ansi256ToAnsi(f.hexToAnsi256(Q)),enumerable:!1}}),f}var NY=OY(),K6=new Set(["\x1B","›"]),BY=39,T8="\x07",JV="[",MY="]",YV="m",A8=`${MY}8;;`,nQ=($)=>`${K6.values().next().value}${JV}${$}${YV}`,rQ=($)=>`${K6.values().next().value}${A8}${$}${T8}`,CY=($)=>$.split(" ").map((Q)=>Y$(Q)),C8=($,Q,V)=>{let q=[...Q],Y=!1,X=!1,J=Y$(QV($[$.length-1]));for(let[G,U]of q.entries()){let K=Y$(U);if(J+K<=V?$[$.length-1]+=U:($.push(U),J=0),K6.has(U)&&(Y=!0,X=q.slice(G+1).join("").startsWith(A8)),Y){X?U===T8&&(Y=!1,X=!1):U===YV&&(Y=!1);continue}J+=K,J===V&&G<q.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},wY=($)=>{let Q=$.split(" "),V=Q.length;for(;V>0&&!(Y$(Q[V-1])>0);)V--;return V===Q.length?$:Q.slice(0,V).join(" ")+Q.slice(V).join("")},TY=($,Q,V={})=>{if(V.trim!==!1&&$.trim()==="")return"";let q="",Y,X,J=CY($),G=[""];for(let[K,W]of $.split(" ").entries()){V.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let j=Y$(G[G.length-1]);if(K!==0&&(j>=Q&&(V.wordWrap===!1||V.trim===!1)&&(G.push(""),j=0),(j>0||V.trim===!1)&&(G[G.length-1]+=" ",j++)),V.hard&&J[K]>Q){let H=Q-j,z=1+Math.floor((J[K]-H-1)/Q);Math.floor((J[K]-1)/Q)<z&&G.push(""),C8(G,W,Q);continue}if(j+J[K]>Q&&j>0&&J[K]>0){if(V.wordWrap===!1&&j<Q){C8(G,W,Q);continue}G.push("")}if(j+J[K]>Q&&V.wordWrap===!1){C8(G,W,Q);continue}G[G.length-1]+=W}V.trim!==!1&&(G=G.map((K)=>wY(K)));let U=[...G.join(`
4
+ `)];for(let[K,W]of U.entries()){if(q+=W,K6.has(W)){let{groups:H}=new RegExp(`(?:\\${JV}(?<code>\\d+)m|\\${A8}(?<uri>.*)${T8})`).exec(U.slice(K).join(""))||{groups:{}};if(H.code!==void 0){let z=Number.parseFloat(H.code);Y=z===BY?void 0:z}else H.uri!==void 0&&(X=H.uri.length===0?void 0:H.uri)}let j=NY.codes.get(Number(Y));U[K+1]===`
5
+ `?(X&&(q+=rQ("")),Y&&j&&(q+=nQ(j))):W===`
6
+ `&&(Y&&j&&(q+=nQ(Y)),X&&(q+=rQ(X)))}return q};function aQ($,Q,V){return String($).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map((q)=>NY(q,Q,V)).join(`
9
- `)}var MY=["up","down","left","right","space","enter","cancel"],Q6={actions:new Set(MY),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function T8($,Q){if(typeof $=="string")return Q6.aliases.get($)===Q;for(let V of $)if(V!==void 0&&T8(V,Q))return!0;return!1}function CY($,Q){if($===Q)return;let V=$.split(`
8
+ `).map((q)=>TY(q,Q,V)).join(`
9
+ `)}var AY=["up","down","left","right","space","enter","cancel"],G6={actions:new Set(AY),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function R8($,Q){if(typeof $=="string")return G6.aliases.get($)===Q;for(let V of $)if(V!==void 0&&R8(V,Q))return!0;return!1}function RY($,Q){if($===Q)return;let V=$.split(`
10
10
  `),q=Q.split(`
11
- `),Y=[];for(let X=0;X<Math.max(V.length,q.length);X++)V[X]!==q[X]&&Y.push(X);return Y}var wY=globalThis.process.platform.startsWith("win"),M8=Symbol("clack:cancel");function m1($){return $===M8}function $6($,Q){let V=$;V.isTTY&&V.setRawMode(Q)}function qV({input:$=aQ,output:Q=sQ,overwrite:V=!0,hideCursor:q=!0}={}){let Y=s1.createInterface({input:$,output:Q,prompt:"",tabSize:1});s1.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(T8([K,G,U],"cancel")){q&&Q.write(e.cursor.show),process.exit(0);return}if(!V)return;s1.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{s1.clearLine(Q,1,()=>{$.once("keypress",X)})})};return q&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),q&&Q.write(e.cursor.show),$.isTTY&&!wY&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var TY=Object.defineProperty,AY=($,Q,V)=>(Q in $)?TY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,U1=($,Q,V)=>(AY($,typeof Q!="symbol"?Q+"":Q,V),V);class q6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:V=aQ,output:q=sQ,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=V,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let V=this._subscribers.get($)??[];V.push(Q),this._subscribers.set($,V)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let V=this._subscribers.get($)??[],q=[];for(let Y of V)Y.cb(...Q),Y.once&&q.push(()=>V.splice(V.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(M8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let V=new YY;V._write=(q,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(V),this.rl=cQ.createInterface({input:this.input,output:V,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),cQ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),$6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),$6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),$6(this.input,!1),$(M8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&Q6.aliases.has(Q.name)&&this.emit("cursor",Q6.aliases.get(Q.name)),Q6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let V=this.opts.validate(this.value);V&&(this.error=V instanceof Error?V.message:V,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}T8([$,Q?.name,Q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
- `),$6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=iQ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
- `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=iQ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=CY(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.lines(1));let q=$.split(`
11
+ `),Y=[];for(let X=0;X<Math.max(V.length,q.length);X++)V[X]!==q[X]&&Y.push(X);return Y}var FY=globalThis.process.platform.startsWith("win"),w8=Symbol("clack:cancel");function m1($){return $===w8}function X6($,Q){let V=$;V.isTTY&&V.setRawMode(Q)}function XV({input:$=eQ,output:Q=$V,overwrite:V=!0,hideCursor:q=!0}={}){let Y=s1.createInterface({input:$,output:Q,prompt:"",tabSize:1});s1.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(R8([K,G,U],"cancel")){q&&Q.write(e.cursor.show),process.exit(0);return}if(!V)return;s1.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{s1.clearLine(Q,1,()=>{$.once("keypress",X)})})};return q&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),q&&Q.write(e.cursor.show),$.isTTY&&!FY&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var vY=Object.defineProperty,xY=($,Q,V)=>(Q in $)?vY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,U1=($,Q,V)=>(xY($,typeof Q!="symbol"?Q+"":Q,V),V);class W6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:V=eQ,output:q=$V,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=V,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let V=this._subscribers.get($)??[];V.push(Q),this._subscribers.set($,V)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let V=this._subscribers.get($)??[],q=[];for(let Y of V)Y.cb(...Q),Y.once&&q.push(()=>V.splice(V.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(w8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let V=new WY;V._write=(q,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(V),this.rl=dQ.createInterface({input:this.input,output:V,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),dQ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),X6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),X6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),X6(this.input,!1),$(w8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&G6.aliases.has(Q.name)&&this.emit("cursor",G6.aliases.get(Q.name)),G6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let V=this.opts.validate(this.value);V&&(this.error=V instanceof Error?V.message:V,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}R8([$,Q?.name,Q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
+ `),X6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=aQ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
+ `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=aQ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=RY(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.lines(1));let q=$.split(`
14
14
  `);this.output.write(q[V]),this._prevFrame=$,this.output.write(e.cursor.move(0,q.length-V-1));return}if(Q&&Q?.length>1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.down());let q=$.split(`
15
15
  `).slice(V);this.output.write(q.join(`
16
- `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class A8 extends q6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var FY;FY=new WeakMap;var RY=Object.defineProperty,vY=($,Q,V)=>(Q in $)?RY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,nQ=($,Q,V)=>(vY($,typeof Q!="symbol"?Q+"":Q,V),V),JV=class extends q6{constructor($){super($,!1),nQ(this,"options"),nQ(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}};var xY=Object.defineProperty,SY=($,Q,V)=>(Q in $)?xY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,rQ=($,Q,V)=>(SY($,typeof Q!="symbol"?Q+"":Q,V),V);class F8 extends q6{constructor($){super($,!1),rQ(this,"options"),rQ(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var O=C1(f1(),1),J6=C1(I8(),1);import w1 from"node:process";function EY(){return w1.platform!=="win32"?w1.env.TERM!=="linux":!!w1.env.CI||!!w1.env.WT_SESSION||!!w1.env.TERMINUS_SUBLIME||w1.env.ConEmuTask==="{cmd::Cmder}"||w1.env.TERM_PROGRAM==="Terminus-Sublime"||w1.env.TERM_PROGRAM==="vscode"||w1.env.TERM==="xterm-256color"||w1.env.TERM==="alacritty"||w1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var v8=EY(),u=($,Q)=>v8?$:Q,gY=u("◆","*"),GV=u("■","x"),KV=u("▲","x"),Y6=u("◇","o"),kY=u("┌","T"),y=u("│","|"),R0=u("└","—"),x8=u("●",">"),S8=u("○"," "),yY=u("◻","[•]"),YV=u("◼","[+]"),DY=u("◻","[ ]"),LH=u("▪","•"),XV=u("─","-"),hY=u("╮","+"),bY=u("├","+"),_Y=u("╯","+"),fY=u("●","•"),mY=u("◆","*"),cY=u("▲","!"),pY=u("■","x"),g8=($)=>{switch($){case"initial":case"active":return O.default.cyan(gY);case"cancel":return O.default.red(GV);case"error":return O.default.yellow(KV);case"submit":return O.default.green(Y6)}},E8=($)=>{let{cursor:Q,options:V,style:q}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,V.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<V.length&&G>0,K=J<V.length&&G+J<V.length;return V.slice(G,G+J).map((W,j,Z)=>{let H=j===0&&U,C=j===Z.length-1&&K;return H||C?O.default.dim("..."):q(W,j+G===Q)})};var q$=($)=>{let Q=$.active??"Yes",V=$.inactive??"No";return new A8({active:Q,inactive:V,initialValue:$.initialValue??!0,render(){let q=`${O.default.gray(y)}
17
- ${g8(this.state)} ${$.message}
18
- `,Y=this.value?Q:V;switch(this.state){case"submit":return`${q}${O.default.gray(y)} ${O.default.dim(Y)}`;case"cancel":return`${q}${O.default.gray(y)} ${O.default.strikethrough(O.default.dim(Y))}
19
- ${O.default.gray(y)}`;default:return`${q}${O.default.cyan(y)} ${this.value?`${O.default.green(x8)} ${Q}`:`${O.default.dim(S8)} ${O.default.dim(Q)}`} ${O.default.dim("/")} ${this.value?`${O.default.dim(S8)} ${O.default.dim(V)}`:`${O.default.green(x8)} ${V}`}
20
- ${O.default.cyan(R0)}
21
- `}}}).prompt()},WV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);switch(q){case"selected":return`${O.default.dim(Y)}`;case"active":return`${O.default.green(x8)} ${Y} ${V.hint?O.default.dim(`(${V.hint})`):""}`;case"cancelled":return`${O.default.strikethrough(O.default.dim(Y))}`;default:return`${O.default.dim(S8)} ${O.default.dim(Y)}`}};return new F8({options:$.options,initialValue:$.initialValue,render(){let V=`${O.default.gray(y)}
22
- ${g8(this.state)} ${$.message}
23
- `;switch(this.state){case"submit":return`${V}${O.default.gray(y)} ${Q(this.options[this.cursor],"selected")}`;case"cancel":return`${V}${O.default.gray(y)} ${Q(this.options[this.cursor],"cancelled")}
24
- ${O.default.gray(y)}`;default:return`${V}${O.default.cyan(y)} ${E8({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(q,Y)=>Q(q,Y?"active":"inactive")}).join(`
25
- ${O.default.cyan(y)} `)}
26
- ${O.default.cyan(R0)}
27
- `}}}).prompt()};var UV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);return q==="active"?`${O.default.cyan(yY)} ${Y} ${V.hint?O.default.dim(`(${V.hint})`):""}`:q==="selected"?`${O.default.green(YV)} ${O.default.dim(Y)} ${V.hint?O.default.dim(`(${V.hint})`):""}`:q==="cancelled"?`${O.default.strikethrough(O.default.dim(Y))}`:q==="active-selected"?`${O.default.green(YV)} ${Y} ${V.hint?O.default.dim(`(${V.hint})`):""}`:q==="submitted"?`${O.default.dim(Y)}`:`${O.default.dim(DY)} ${O.default.dim(Y)}`};return new JV({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(V){if(this.required&&V.length===0)return`Please select at least one option.
28
- ${O.default.reset(O.default.dim(`Press ${O.default.gray(O.default.bgWhite(O.default.inverse(" space ")))} to select, ${O.default.gray(O.default.bgWhite(O.default.inverse(" enter ")))} to submit`))}`},render(){let V=`${O.default.gray(y)}
29
- ${g8(this.state)} ${$.message}
30
- `,q=(Y,X)=>{let J=this.value.includes(Y.value);return X&&J?Q(Y,"active-selected"):J?Q(Y,"selected"):Q(Y,X?"active":"inactive")};switch(this.state){case"submit":return`${V}${O.default.gray(y)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>Q(Y,"submitted")).join(O.default.dim(", "))||O.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:X})=>this.value.includes(X)).map((X)=>Q(X,"cancelled")).join(O.default.dim(", "));return`${V}${O.default.gray(y)} ${Y.trim()?`${Y}
31
- ${O.default.gray(y)}`:""}`}case"error":{let Y=this.error.split(`
32
- `).map((X,J)=>J===0?`${O.default.yellow(R0)} ${O.default.yellow(X)}`:` ${X}`).join(`
33
- `);return`${V+O.default.yellow(y)} ${E8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
34
- ${O.default.yellow(y)} `)}
16
+ `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class F8 extends W6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var SY;SY=new WeakMap;var EY=Object.defineProperty,gY=($,Q,V)=>(Q in $)?EY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,sQ=($,Q,V)=>(gY($,typeof Q!="symbol"?Q+"":Q,V),V),GV=class extends W6{constructor($){super($,!1),sQ(this,"options"),sQ(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}};var kY=Object.defineProperty,yY=($,Q,V)=>(Q in $)?kY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,tQ=($,Q,V)=>(yY($,typeof Q!="symbol"?Q+"":Q,V),V);class v8 extends W6{constructor($){super($,!1),tQ(this,"options"),tQ(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var N=C1(f1(),1),U6=C1(N8(),1);import w1 from"node:process";function DY(){return w1.platform!=="win32"?w1.env.TERM!=="linux":!!w1.env.CI||!!w1.env.WT_SESSION||!!w1.env.TERMINUS_SUBLIME||w1.env.ConEmuTask==="{cmd::Cmder}"||w1.env.TERM_PROGRAM==="Terminus-Sublime"||w1.env.TERM_PROGRAM==="vscode"||w1.env.TERM==="xterm-256color"||w1.env.TERM==="alacritty"||w1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S8=DY(),u=($,Q)=>S8?$:Q,hY=u("◆","*"),UV=u("■","x"),jV=u("▲","x"),j6=u("◇","o"),bY=u("┌","T"),y=u("│","|"),v0=u("└","—"),E8=u("●",">"),g8=u("○"," "),_Y=u("◻","[•]"),KV=u("◼","[+]"),fY=u("◻","[ ]"),BH=u("▪","•"),WV=u("─","-"),mY=u("╮","+"),cY=u("├","+"),pY=u("╯","+"),uY=u("●","•"),dY=u("◆","*"),lY=u("▲","!"),oY=u("■","x"),y8=($)=>{switch($){case"initial":case"active":return N.default.cyan(hY);case"cancel":return N.default.red(UV);case"error":return N.default.yellow(jV);case"submit":return N.default.green(j6)}},k8=($)=>{let{cursor:Q,options:V,style:q}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,V.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<V.length&&G>0,K=J<V.length&&G+J<V.length;return V.slice(G,G+J).map((W,j,H)=>{let z=j===0&&U,C=j===H.length-1&&K;return z||C?N.default.dim("..."):q(W,j+G===Q)})};var X$=($)=>{let Q=$.active??"Yes",V=$.inactive??"No";return new F8({active:Q,inactive:V,initialValue:$.initialValue??!0,render(){let q=`${N.default.gray(y)}
17
+ ${y8(this.state)} ${$.message}
18
+ `,Y=this.value?Q:V;switch(this.state){case"submit":return`${q}${N.default.gray(y)} ${N.default.dim(Y)}`;case"cancel":return`${q}${N.default.gray(y)} ${N.default.strikethrough(N.default.dim(Y))}
19
+ ${N.default.gray(y)}`;default:return`${q}${N.default.cyan(y)} ${this.value?`${N.default.green(E8)} ${Q}`:`${N.default.dim(g8)} ${N.default.dim(Q)}`} ${N.default.dim("/")} ${this.value?`${N.default.dim(g8)} ${N.default.dim(V)}`:`${N.default.green(E8)} ${V}`}
20
+ ${N.default.cyan(v0)}
21
+ `}}}).prompt()},ZV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);switch(q){case"selected":return`${N.default.dim(Y)}`;case"active":return`${N.default.green(E8)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`;case"cancelled":return`${N.default.strikethrough(N.default.dim(Y))}`;default:return`${N.default.dim(g8)} ${N.default.dim(Y)}`}};return new v8({options:$.options,initialValue:$.initialValue,render(){let V=`${N.default.gray(y)}
22
+ ${y8(this.state)} ${$.message}
23
+ `;switch(this.state){case"submit":return`${V}${N.default.gray(y)} ${Q(this.options[this.cursor],"selected")}`;case"cancel":return`${V}${N.default.gray(y)} ${Q(this.options[this.cursor],"cancelled")}
24
+ ${N.default.gray(y)}`;default:return`${V}${N.default.cyan(y)} ${k8({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(q,Y)=>Q(q,Y?"active":"inactive")}).join(`
25
+ ${N.default.cyan(y)} `)}
26
+ ${N.default.cyan(v0)}
27
+ `}}}).prompt()};var HV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);return q==="active"?`${N.default.cyan(_Y)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="selected"?`${N.default.green(KV)} ${N.default.dim(Y)} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="cancelled"?`${N.default.strikethrough(N.default.dim(Y))}`:q==="active-selected"?`${N.default.green(KV)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="submitted"?`${N.default.dim(Y)}`:`${N.default.dim(fY)} ${N.default.dim(Y)}`};return new GV({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(V){if(this.required&&V.length===0)return`Please select at least one option.
28
+ ${N.default.reset(N.default.dim(`Press ${N.default.gray(N.default.bgWhite(N.default.inverse(" space ")))} to select, ${N.default.gray(N.default.bgWhite(N.default.inverse(" enter ")))} to submit`))}`},render(){let V=`${N.default.gray(y)}
29
+ ${y8(this.state)} ${$.message}
30
+ `,q=(Y,X)=>{let J=this.value.includes(Y.value);return X&&J?Q(Y,"active-selected"):J?Q(Y,"selected"):Q(Y,X?"active":"inactive")};switch(this.state){case"submit":return`${V}${N.default.gray(y)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>Q(Y,"submitted")).join(N.default.dim(", "))||N.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:X})=>this.value.includes(X)).map((X)=>Q(X,"cancelled")).join(N.default.dim(", "));return`${V}${N.default.gray(y)} ${Y.trim()?`${Y}
31
+ ${N.default.gray(y)}`:""}`}case"error":{let Y=this.error.split(`
32
+ `).map((X,J)=>J===0?`${N.default.yellow(v0)} ${N.default.yellow(X)}`:` ${X}`).join(`
33
+ `);return`${V+N.default.yellow(y)} ${k8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
34
+ ${N.default.yellow(y)} `)}
35
35
  ${Y}
36
- `}default:return`${V}${O.default.cyan(y)} ${E8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
37
- ${O.default.cyan(y)} `)}
38
- ${O.default.cyan(R0)}
36
+ `}default:return`${V}${N.default.cyan(y)} ${k8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
37
+ ${N.default.cyan(y)} `)}
38
+ ${N.default.cyan(v0)}
39
39
  `}}}).prompt()};var T1=($="",Q="")=>{let V=`
40
40
  ${$}
41
41
  `.split(`
42
- `),q=R8(Q).length,Y=Math.max(V.reduce((J,G)=>{let U=R8(G);return U.length>J?U.length:J},0),q)+2,X=V.map((J)=>`${O.default.gray(y)} ${O.default.dim(J)}${" ".repeat(Y-R8(J).length)}${O.default.gray(y)}`).join(`
43
- `);process.stdout.write(`${O.default.gray(y)}
44
- ${O.default.green(Y6)} ${O.default.reset(Q)} ${O.default.gray(XV.repeat(Math.max(Y-q-1,1))+hY)}
42
+ `),q=x8(Q).length,Y=Math.max(V.reduce((J,G)=>{let U=x8(G);return U.length>J?U.length:J},0),q)+2,X=V.map((J)=>`${N.default.gray(y)} ${N.default.dim(J)}${" ".repeat(Y-x8(J).length)}${N.default.gray(y)}`).join(`
43
+ `);process.stdout.write(`${N.default.gray(y)}
44
+ ${N.default.green(j6)} ${N.default.reset(Q)} ${N.default.gray(WV.repeat(Math.max(Y-q-1,1))+mY)}
45
45
  ${X}
46
- ${O.default.gray(bY+XV.repeat(Y+2)+_Y)}
47
- `)},q1=($="")=>{process.stdout.write(`${O.default.gray(R0)} ${O.default.red($)}
46
+ ${N.default.gray(cY+WV.repeat(Y+2)+pY)}
47
+ `)},J1=($="")=>{process.stdout.write(`${N.default.gray(v0)} ${N.default.red($)}
48
48
 
49
- `)},A1=($="")=>{process.stdout.write(`${O.default.gray(kY)} ${$}
50
- `)},j1=($="")=>{process.stdout.write(`${O.default.gray(y)}
51
- ${O.default.gray(R0)} ${$}
49
+ `)},A1=($="")=>{process.stdout.write(`${N.default.gray(bY)} ${$}
50
+ `)},j1=($="")=>{process.stdout.write(`${N.default.gray(y)}
51
+ ${N.default.gray(v0)} ${$}
52
52
 
53
- `)},m={message:($="",{symbol:Q=O.default.gray(y)}={})=>{let V=[`${O.default.gray(y)}`];if($){let[q,...Y]=$.split(`
54
- `);V.push(`${Q} ${q}`,...Y.map((X)=>`${O.default.gray(y)} ${X}`))}process.stdout.write(`${V.join(`
53
+ `)},m={message:($="",{symbol:Q=N.default.gray(y)}={})=>{let V=[`${N.default.gray(y)}`];if($){let[q,...Y]=$.split(`
54
+ `);V.push(`${Q} ${q}`,...Y.map((X)=>`${N.default.gray(y)} ${X}`))}process.stdout.write(`${V.join(`
55
55
  `)}
56
- `)},info:($)=>{m.message($,{symbol:O.default.blue(fY)})},success:($)=>{m.message($,{symbol:O.default.green(mY)})},step:($)=>{m.message($,{symbol:O.default.green(Y6)})},warn:($)=>{m.message($,{symbol:O.default.yellow(cY)})},warning:($)=>{m.warn($)},error:($)=>{m.message($,{symbol:O.default.red(pY)})}},IH=`${O.default.gray(y)} `;var P1=({indicator:$="dots"}={})=>{let Q=v8?["◒","◐","◓","◑"]:["•","o","O","0"],V=v8?80:120,q=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(B)=>{let I=B>1?"Something went wrong":"Canceled";J&&T(I,B)},j=()=>W(2),Z=()=>W(1),H=()=>{process.on("uncaughtExceptionMonitor",j),process.on("unhandledRejection",j),process.on("SIGINT",Z),process.on("SIGTERM",Z),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",j),process.removeListener("unhandledRejection",j),process.removeListener("SIGINT",Z),process.removeListener("SIGTERM",Z),process.removeListener("exit",W)},z=()=>{if(U===void 0)return;q&&process.stdout.write(`
57
- `);let B=U.split(`
58
- `);process.stdout.write(J6.cursor.move(-999,B.length-1)),process.stdout.write(J6.erase.down(B.length))},M=(B)=>B.replace(/\.+$/,""),N=(B)=>{let I=(performance.now()-B)/1000,F=Math.floor(I/60),R=Math.floor(I%60);return F>0?`[${F}m ${R}s]`:`[${R}s]`},L=(B="")=>{J=!0,Y=qV(),G=M(B),K=performance.now(),process.stdout.write(`${O.default.gray(y)}
59
- `);let I=0,F=0;H(),X=setInterval(()=>{if(q&&G===U)return;z(),U=G;let R=O.default.magenta(Q[I]);if(q)process.stdout.write(`${R} ${G}...`);else if($==="timer")process.stdout.write(`${R} ${G} ${N(K)}`);else{let v=".".repeat(Math.floor(F)).slice(0,3);process.stdout.write(`${R} ${G}${v}`)}I=I+1<Q.length?I+1:0,F=F<Q.length?F+0.125:0},V)},T=(B="",I=0)=>{J=!1,clearInterval(X),z();let F=I===0?O.default.green(Y6):I===1?O.default.red(GV):O.default.red(KV);G=M(B??G),$==="timer"?process.stdout.write(`${F} ${G} ${N(K)}
60
- `):process.stdout.write(`${F} ${G}
61
- `),C(),Y()};return{start:L,stop:T,message:(B="")=>{G=M(B??G)}}};var yQ=C1(M7(),1),P=C1(f1(),1);import{spawn as rU}from"node:child_process";import{createServer as hU}from"node:http";class D extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var bU=`<!doctype html>
56
+ `)},info:($)=>{m.message($,{symbol:N.default.blue(uY)})},success:($)=>{m.message($,{symbol:N.default.green(dY)})},step:($)=>{m.message($,{symbol:N.default.green(j6)})},warn:($)=>{m.message($,{symbol:N.default.yellow(lY)})},warning:($)=>{m.warn($)},error:($)=>{m.message($,{symbol:N.default.red(oY)})}},MH=`${N.default.gray(y)} `;var z1=({indicator:$="dots"}={})=>{let Q=S8?["◒","◐","◓","◑"]:["•","o","O","0"],V=S8?80:120,q=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(O)=>{let I=O>1?"Something went wrong":"Canceled";J&&T(I,O)},j=()=>W(2),H=()=>W(1),z=()=>{process.on("uncaughtExceptionMonitor",j),process.on("unhandledRejection",j),process.on("SIGINT",H),process.on("SIGTERM",H),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",j),process.removeListener("unhandledRejection",j),process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),process.removeListener("exit",W)},P=()=>{if(U===void 0)return;q&&process.stdout.write(`
57
+ `);let O=U.split(`
58
+ `);process.stdout.write(U6.cursor.move(-999,O.length-1)),process.stdout.write(U6.erase.down(O.length))},M=(O)=>O.replace(/\.+$/,""),B=(O)=>{let I=(performance.now()-O)/1000,R=Math.floor(I/60),F=Math.floor(I%60);return R>0?`[${R}m ${F}s]`:`[${F}s]`},L=(O="")=>{J=!0,Y=XV(),G=M(O),K=performance.now(),process.stdout.write(`${N.default.gray(y)}
59
+ `);let I=0,R=0;z(),X=setInterval(()=>{if(q&&G===U)return;P(),U=G;let F=N.default.magenta(Q[I]);if(q)process.stdout.write(`${F} ${G}...`);else if($==="timer")process.stdout.write(`${F} ${G} ${B(K)}`);else{let v=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${F} ${G}${v}`)}I=I+1<Q.length?I+1:0,R=R<Q.length?R+0.125:0},V)},T=(O="",I=0)=>{J=!1,clearInterval(X),P();let R=I===0?N.default.green(j6):I===1?N.default.red(UV):N.default.red(jV);G=M(O??G),$==="timer"?process.stdout.write(`${R} ${G} ${B(K)}
60
+ `):process.stdout.write(`${R} ${G}
61
+ `),C(),Y()};return{start:L,stop:T,message:(O="")=>{G=M(O??G)}}};var bQ=C1(T7(),1),Z=C1(f1(),1);import{spawn as eU}from"node:child_process";import{createServer as mU}from"node:http";class D extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var cU=`<!doctype html>
62
62
  <html>
63
63
  <head><meta charset="utf-8"><title>Authentication complete</title></head>
64
64
  <body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
65
- </html>`,_U=`<!doctype html>
65
+ </html>`,pU=`<!doctype html>
66
66
  <html>
67
67
  <head><meta charset="utf-8"><title>Authentication failed</title></head>
68
68
  <body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
69
- </html>`;function BQ($,Q){return new D($,Q)}function C7($){let{expectedState:Q,port:V=0,timeoutMs:q=120000,successHtml:Y=bU,errorHtml:X=_U}=$,J,G=!1,U=!1,K,W,j=new Promise((C,z)=>{K=C,W=z}),Z=(C)=>{if(U)return;U=!0,C.close()},H=hU((C,z)=>{if(G){z.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){z.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Not found");return}let M=new URL(C.url,"http://127.0.0.1");if(M.pathname!=="/callback"){z.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Clerk CLI auth server is waiting for /callback.");return}let N=M.searchParams.get("code"),L=M.searchParams.get("state"),T=M.searchParams.get("error"),B=M.searchParams.get("error_description")??T,I=(F,R,v)=>{if(G=!0,J)clearTimeout(J);z.writeHead(F,{"Content-Type":"text/html; charset=utf-8"}),z.end(R,()=>{if(v)W(v);else if(N&&L)K({code:N,state:L});Z(H)})};if(T){I(400,X,BQ("token_exchange",`OAuth authorization failed: ${B??"unknown error"}`));return}if(L!==Q){I(400,X,BQ("state_mismatch","OAuth callback state did not match."));return}if(!N){I(400,X,BQ("token_exchange","OAuth callback did not include an authorization code."));return}I(200,Y)});return new Promise((C,z)=>{H.once("error",(M)=>{z(new D("config",`Failed to start local auth callback server: ${M.message}`))}),H.listen(V,"127.0.0.1",()=>{let N=H.address().port,L=`http://127.0.0.1:${N}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new D("timeout",`OAuth callback timed out after ${q}ms.`)),Z(H)},q),C({port:N,redirectUri:L,waitForCallback:()=>j,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new D("timeout","OAuth callback server was closed."));Z(H)}})})})}import{chmod as fU,mkdir as mU,readFile as cU,writeFile as pU}from"node:fs/promises";import{homedir as uU}from"node:os";import{dirname as dU,join as lU}from"node:path";function w7($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`${$}: ${V}`)}function A7($){return $?.environment??"default"}function oU($){return lU(uU(),".config","clerk-cli-auth",`${$}.json`)}class F7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class R7{filePath;queue=Promise.resolve();constructor($){this.filePath=$}enqueue($){let Q=this.queue.then($,$);return this.queue=Q.catch(()=>{return}),Q}async readAll(){try{let $=await cU(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let V={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")V[q]=Y;return V}catch($){if($.code==="ENOENT")return{};throw w7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await mU(dU(this.filePath),{recursive:!0}),await pU(this.filePath,`${JSON.stringify($,null,2)}
70
- `,{mode:384}),await fU(this.filePath,384)}catch(Q){throw w7(`Failed to write credential file ${this.filePath}`,Q)}}async get($){return this.enqueue(async()=>{return(await this.readAll())[$]??null})}async set($,Q){return this.enqueue(async()=>{let V=await this.readAll();V[$]=Q,await this.writeAll(V)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class v7{service;environment;fallback;keyringPromise=null;constructor($,Q,V){this.service=$;this.environment=Q;this.fallback=V}account($){return`${this.environment}:${$}`}warnFallback($,Q){let V=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&V.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${V}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch(($)=>{return this.warnFallback("initialization",$),null}),this.keyringPromise}async get($){try{let Q=await this.loadKeyring();if(!Q)return this.fallback.get($);return new Q.Entry(this.service,this.account($)).getPassword()??await this.fallback.get($)}catch(Q){return this.warnFallback("get",Q),this.fallback.get($)}}async set($,Q){try{let V=await this.loadKeyring();if(!V){await this.fallback.set($,Q);return}new V.Entry(this.service,this.account($)).setPassword(Q)}catch(V){this.warnFallback("set",V),await this.fallback.set($,Q)}}async delete($){try{let Q=await this.loadKeyring();if(Q)new Q.Entry(this.service,this.account($)).deletePassword()}catch(Q){this.warnFallback("delete",Q)}await this.fallback.delete($)}}function T7($){let Q=A7($);return new R7($?.filePath??oU(Q))}function x7($,Q){if($==="memory")return new F7;if($==="file")return T7(Q);let V=T7(Q),q=Q?.keychainService??"clerk-cli-auth",Y=A7(Q);return new v7(q,Y,V)}import{createHash as iU,randomBytes as S7}from"node:crypto";function OQ($){return $.toString("base64url")}function E7(){return OQ(S7(32))}async function g7($){return OQ(iU("sha256").update($).digest())}function k7(){return OQ(S7(32))}function y7($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function D7($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function h7($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let V=$;for(let q of["error_description","message","error"]){let Y=V[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function nU($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new D("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function b7($,Q){let V;try{V=await fetch(y7($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new D("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await D7(V)}catch(Y){throw new D("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!V.ok)throw new D("token_exchange",h7(q,`Token request failed with HTTP ${V.status}.`));if(!q||typeof q!=="object")throw new D("token_exchange","Token response was not JSON.");return nU(q)}async function _7($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return b7($.issuer,Q)}async function f7($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return b7($.issuer,Q)}async function NQ($){let Q;try{Q=await fetch(y7($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new D("userinfo",`Userinfo request failed: ${Y.message}`)}let V;try{V=await D7(Q)}catch(Y){throw new D("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new D("userinfo",h7(V,`Userinfo request failed with HTTP ${Q.status}.`));if(!V||typeof V!=="object")throw new D("userinfo","Userinfo response was not JSON.");let q=V;if(typeof q.sub!=="string"||q.sub.length===0)throw new D("userinfo","Userinfo response did not include sub.");return q}var aU=["profile","email","openid","offline_access"];function sU($){let Q=$.trim().replace(/\/+$/,"");try{let V=new URL(Q);if(V.protocol!=="http:"&&V.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(V){throw new D("config",`issuer must be a valid URL: ${V.message}`)}}function s6($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`Failed to ${$}: ${V}`)}async function tU($){console.log(`Open this URL to sign in:
71
- ${$}`);let Q=process.platform,V=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=rU(V,q,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class t6{config;constructor($){if(!$.clientId)throw new D("config","clientId is required");if(!$.issuer)throw new D("config","issuer is required");let Q=$.environment??"default",V=typeof $.storage==="object"&&$.storage!==null?$.storage:x7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:sU($.issuer),scopes:$.scopes??aU,storage:V,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=E7(),Q=await g7($),V=k7(),q=await C7({expectedState:V,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let Y=new URL(`${this.config.issuer}/oauth/authorize`);Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",this.config.clientId),Y.searchParams.set("redirect_uri",q.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",V),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??tU)(Y.toString())}catch(U){throw new D("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await q.waitForCallback(),J=await _7({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",J);let G=await NQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{q.close()}}async getAccessToken(){let $=await this.getTokenSet();if(!$)return null;if(($.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return $.accessToken;if(!$.refreshToken)return null;let V=await f7({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...V,refreshToken:V.refreshToken??$.refreshToken};return await this.setJson("tokens",q),q.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let V=await NQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",V),V}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw s6("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(V){throw s6(`read ${$}`,V)}if(!Q)return null;try{return JSON.parse(Q)}catch(V){throw s6(`parse stored ${$}`,V)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(V){throw s6(`write ${$}`,V)}}}import{randomBytes as eU}from"node:crypto";import{existsSync as $j,statSync as Qj}from"node:fs";import{chmod as Vj,mkdir as e6,rename as f$,rm as r1,writeFile as $8}from"node:fs/promises";import{homedir as Q8,arch as qj,platform as MQ}from"node:os";import G1 from"node:path";var r=C1(f1(),1),Jj="https://api.github.com/repos/crafter-station/petdex/releases",m7=30,Yj=5,c7="desktop-v",l7="petdex-desktop-sidecar.js";function o7(){let $=MQ(),Q=qj(),V=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,q=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:V,archLabel:q,assetSuffix:`${V}-${q}`}}function e0(){let $=MQ()==="win32"?".exe":"";return G1.join(Q8(),".petdex","bin",`petdex-desktop${$}`)}function V8(){return G1.join(Q8(),".petdex","sidecar","server.js")}async function CQ($={}){let Q=$.fetchOverride??fetch,V=$.maxPages??Yj,q=0;for(let Y=1;Y<=V;Y++){let X=`${Jj}?per_page=${m7}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;q+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(c7));if(U)return U;if(G.length<m7)break}throw Error(`No ${c7}* release found in the last ${q} releases (scanned ${V} page(s))`)}function Xj($,Q){let V=`petdex-desktop-${Q}`,q=$.assets.find((Y)=>Y.name.startsWith(V));if(!q){let Y=$.assets.map((X)=>` ${X.name}`).join(`
69
+ </html>`;function BQ($,Q){return new D($,Q)}function A7($){let{expectedState:Q,port:V=0,timeoutMs:q=120000,successHtml:Y=cU,errorHtml:X=pU}=$,J,G=!1,U=!1,K,W,j=new Promise((C,P)=>{K=C,W=P}),H=(C)=>{if(U)return;U=!0,C.close()},z=mU((C,P)=>{if(G){P.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Not found");return}let M=new URL(C.url,"http://127.0.0.1");if(M.pathname!=="/callback"){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Clerk CLI auth server is waiting for /callback.");return}let B=M.searchParams.get("code"),L=M.searchParams.get("state"),T=M.searchParams.get("error"),O=M.searchParams.get("error_description")??T,I=(R,F,v)=>{if(G=!0,J)clearTimeout(J);P.writeHead(R,{"Content-Type":"text/html; charset=utf-8"}),P.end(F,()=>{if(v)W(v);else if(B&&L)K({code:B,state:L});H(z)})};if(T){I(400,X,BQ("token_exchange",`OAuth authorization failed: ${O??"unknown error"}`));return}if(L!==Q){I(400,X,BQ("state_mismatch","OAuth callback state did not match."));return}if(!B){I(400,X,BQ("token_exchange","OAuth callback did not include an authorization code."));return}I(200,Y)});return new Promise((C,P)=>{z.once("error",(M)=>{P(new D("config",`Failed to start local auth callback server: ${M.message}`))}),z.listen(V,"127.0.0.1",()=>{let B=z.address().port,L=`http://127.0.0.1:${B}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new D("timeout",`OAuth callback timed out after ${q}ms.`)),H(z)},q),C({port:B,redirectUri:L,waitForCallback:()=>j,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new D("timeout","OAuth callback server was closed."));H(z)}})})})}import{chmod as uU,mkdir as dU,readFile as lU,writeFile as oU}from"node:fs/promises";import{homedir as iU}from"node:os";import{dirname as nU,join as rU}from"node:path";function R7($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`${$}: ${V}`)}function v7($){return $?.environment??"default"}function aU($){return rU(iU(),".config","clerk-cli-auth",`${$}.json`)}class x7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class S7{filePath;queue=Promise.resolve();constructor($){this.filePath=$}enqueue($){let Q=this.queue.then($,$);return this.queue=Q.catch(()=>{return}),Q}async readAll(){try{let $=await lU(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let V={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")V[q]=Y;return V}catch($){if($.code==="ENOENT")return{};throw R7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await dU(nU(this.filePath),{recursive:!0}),await oU(this.filePath,`${JSON.stringify($,null,2)}
70
+ `,{mode:384}),await uU(this.filePath,384)}catch(Q){throw R7(`Failed to write credential file ${this.filePath}`,Q)}}async get($){return this.enqueue(async()=>{return(await this.readAll())[$]??null})}async set($,Q){return this.enqueue(async()=>{let V=await this.readAll();V[$]=Q,await this.writeAll(V)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class E7{service;environment;fallback;keyringPromise=null;constructor($,Q,V){this.service=$;this.environment=Q;this.fallback=V}account($){return`${this.environment}:${$}`}warnFallback($,Q){let V=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&V.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${V}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch(($)=>{return this.warnFallback("initialization",$),null}),this.keyringPromise}async get($){try{let Q=await this.loadKeyring();if(!Q)return this.fallback.get($);return new Q.Entry(this.service,this.account($)).getPassword()??await this.fallback.get($)}catch(Q){return this.warnFallback("get",Q),this.fallback.get($)}}async set($,Q){try{let V=await this.loadKeyring();if(!V){await this.fallback.set($,Q);return}new V.Entry(this.service,this.account($)).setPassword(Q)}catch(V){this.warnFallback("set",V),await this.fallback.set($,Q)}}async delete($){try{let Q=await this.loadKeyring();if(Q)new Q.Entry(this.service,this.account($)).deletePassword()}catch(Q){this.warnFallback("delete",Q)}await this.fallback.delete($)}}function F7($){let Q=v7($);return new S7($?.filePath??aU(Q))}function g7($,Q){if($==="memory")return new x7;if($==="file")return F7(Q);let V=F7(Q),q=Q?.keychainService??"clerk-cli-auth",Y=v7(Q);return new E7(q,Y,V)}import{createHash as sU,randomBytes as k7}from"node:crypto";function MQ($){return $.toString("base64url")}function y7(){return MQ(k7(32))}async function D7($){return MQ(sU("sha256").update($).digest())}function h7(){return MQ(k7(32))}function b7($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function _7($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function f7($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let V=$;for(let q of["error_description","message","error"]){let Y=V[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function tU($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new D("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function m7($,Q){let V;try{V=await fetch(b7($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new D("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await _7(V)}catch(Y){throw new D("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!V.ok)throw new D("token_exchange",f7(q,`Token request failed with HTTP ${V.status}.`));if(!q||typeof q!=="object")throw new D("token_exchange","Token response was not JSON.");return tU(q)}async function c7($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return m7($.issuer,Q)}async function p7($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return m7($.issuer,Q)}async function CQ($){let Q;try{Q=await fetch(b7($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new D("userinfo",`Userinfo request failed: ${Y.message}`)}let V;try{V=await _7(Q)}catch(Y){throw new D("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new D("userinfo",f7(V,`Userinfo request failed with HTTP ${Q.status}.`));if(!V||typeof V!=="object")throw new D("userinfo","Userinfo response was not JSON.");let q=V;if(typeof q.sub!=="string"||q.sub.length===0)throw new D("userinfo","Userinfo response did not include sub.");return q}var $j=["profile","email","openid","offline_access"];function Qj($){let Q=$.trim().replace(/\/+$/,"");try{let V=new URL(Q);if(V.protocol!=="http:"&&V.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(V){throw new D("config",`issuer must be a valid URL: ${V.message}`)}}function q8($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`Failed to ${$}: ${V}`)}async function Vj($){console.log(`Open this URL to sign in:
71
+ ${$}`);let Q=process.platform,V=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=eU(V,q,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class J8{config;constructor($){if(!$.clientId)throw new D("config","clientId is required");if(!$.issuer)throw new D("config","issuer is required");let Q=$.environment??"default",V=typeof $.storage==="object"&&$.storage!==null?$.storage:g7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:Qj($.issuer),scopes:$.scopes??$j,storage:V,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=y7(),Q=await D7($),V=h7(),q=await A7({expectedState:V,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let Y=new URL(`${this.config.issuer}/oauth/authorize`);Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",this.config.clientId),Y.searchParams.set("redirect_uri",q.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",V),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??Vj)(Y.toString())}catch(U){throw new D("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await q.waitForCallback(),J=await c7({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",J);let G=await CQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{q.close()}}async getAccessToken(){let $=await this.getTokenSet();if(!$)return null;if(($.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return $.accessToken;if(!$.refreshToken)return null;let V=await p7({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...V,refreshToken:V.refreshToken??$.refreshToken};return await this.setJson("tokens",q),q.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let V=await CQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",V),V}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw q8("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(V){throw q8(`read ${$}`,V)}if(!Q)return null;try{return JSON.parse(Q)}catch(V){throw q8(`parse stored ${$}`,V)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(V){throw q8(`write ${$}`,V)}}}import{randomBytes as qj}from"node:crypto";import{existsSync as wQ,statSync as Jj}from"node:fs";import{chmod as Yj,mkdir as Y8,rename as p$,rm as r1,writeFile as X8}from"node:fs/promises";import{homedir as $$,arch as Xj,platform as u$}from"node:os";import Q1 from"node:path";var r=C1(f1(),1),Gj="https://api.github.com/repos/crafter-station/petdex/releases",u7=30,Kj=5,d7="desktop-v",n7="petdex-desktop-sidecar.js";function r7(){let $=u$(),Q=Xj(),V=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,q=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:V,archLabel:q,assetSuffix:`${V}-${q}`}}function Q$(){let $=u$()==="win32"?".exe":"";if(u$()==="darwin"){let Q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q1.join($$(),"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let V of Q)if(wQ(V))return V}return Q1.join($$(),".petdex","bin",`petdex-desktop${$}`)}function G8(){if(u$()==="darwin"){let $=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q1.join($$(),"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let Q of $)if(wQ(Q))return Q}return Q1.join($$(),".petdex","sidecar","server.js")}async function TQ($={}){let Q=$.fetchOverride??fetch,V=$.maxPages??Kj,q=0;for(let Y=1;Y<=V;Y++){let X=`${Gj}?per_page=${u7}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;q+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(d7));if(U)return U;if(G.length<u7)break}throw Error(`No ${d7}* release found in the last ${q} releases (scanned ${V} page(s))`)}function Wj($,Q){let V=`petdex-desktop-${Q}`,q=$.assets.find((Y)=>Y.name.startsWith(V));if(!q){let Y=$.assets.map((X)=>` ${X.name}`).join(`
72
72
  `);throw Error(`No binary for ${Q} in ${$.tag_name}.
73
73
  Available:
74
- ${Y}`)}return q}function Gj($){return $.assets.find((Q)=>Q.name===l7)??null}async function p7($,Q,V){let q=await fetch($);if(!q.ok||!q.body)throw Error(`download ${$} → ${q.status}`);let Y=Buffer.from(await q.arrayBuffer()),X=`${Q}.tmp`;try{if(await $8(X,Y),V!==void 0)await Vj(X,V);if(MQ()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await r1(X,{force:!0})}catch{}throw J}}async function Kj($){let Q=[];for(let V of $){let q=null;try{let Y=`${V.destPath}.prev`;try{await f$(V.destPath,Y),q=Y}catch(X){if(X.code!=="ENOENT")throw X}await f$(V.tmpPath,V.destPath),Q.push({dest:V.destPath,backup:q})}catch(Y){if(q)try{await r1(V.destPath,{force:!0}),await f$(q,V.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await r1(X.dest,{force:!0}),await f$(X.backup,X.dest);else await r1(X.dest,{force:!0})}catch{}for(let X of $)try{await r1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let V of Q){if(!V.backup)continue;try{await r1(V.backup,{force:!0})}catch{}}}async function wQ($){let Q=o7(),V=Xj($,Q.assetSuffix),q=Gj($),Y=e0(),X=V8();await e6(G1.dirname(Y),{recursive:!0}),await e6(G1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await p7(V.browser_download_url,Y,493)),q)J.push(await p7(q.browser_download_url,X))}catch(G){for(let U of J)try{await r1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:V,sidecarAsset:q,staged:J}}async function TQ($){await Kj($.staged)}async function Wj($){let Q=await wQ($);return await TQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var Uj="boba",jj=process.env.PETDEX_URL??"https://petdex.crafter.run",Zj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function m$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return Zj.has(Q.hostname)}catch{return!1}}function i7(){return process.env.HOME??Q8()}function n7(){return G1.join(i7(),".petdex","pets")}function r7(){return G1.join(i7(),".codex","pets")}var Hj=16777216;function Pj($){for(let Q of["spritesheet.webp","spritesheet.png"]){let V=G1.join($,Q);try{let q=Qj(V);if(q.isFile()&&q.size>0&&q.size<=Hj)return!0}catch{}}return!1}async function zj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[n7(),r7()]){let V;try{V=await $(Q)}catch{continue}for(let q of V)if(Pj(G1.join(Q,q)))return!0}return!1}async function Lj($={}){let Q=$.fetchOverride??fetch,V=$.petdexUrl??jj,q;try{let G=await Q(`${V}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();q=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(q.length===0)return null;let Y=[],X=new Set,J=q.find((G)=>G.slug===Uj);if(J)Y.push(J),X.add(J.slug);for(let G of q)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await Ij(G,Q);if(U)return U}return null}async function Ij($,Q){if(!m$($.spritesheetUrl)||!m$($.petJsonUrl))return null;let V=$.spritesheetUrl.endsWith(".png")?"png":"webp",q=[G1.join(n7(),$.slug),G1.join(r7(),$.slug)];for(let K of q)if($j(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of q){let W=`${K}.partial-${eU(6).toString("hex")}`;await e6(W,{recursive:!0}),G.push(W),await Promise.all([$8(G1.join(W,"pet.json"),Buffer.from(X)),$8(G1.join(W,`spritesheet.${V}`),Buffer.from(J))]),await e6(G1.dirname(K),{recursive:!0}),await f$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>r1(K,{recursive:!0,force:!0})),...U.map((K)=>r1(K,{recursive:!0,force:!0}))]),null}}async function a7(){A1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=o7();m.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=P1();Q.start("Looking up the latest release");let V;try{V=await CQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
75
- ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(V.tag_name)}`);let q=P1();q.start("Downloading desktop binary and sidecar");let Y;try{Y=await Wj(V)}catch(W){throw q.stop(r.default.red("failed")),W}let X=e0(),J=G1.join(Q8(),".petdex","version");await $8(J,`${V.tag_name}
74
+ ${Y}`)}return q}function Uj($){return $.assets.find((Q)=>Q.name===n7)??null}async function l7($,Q,V){let q=await fetch($);if(!q.ok||!q.body)throw Error(`download ${$} → ${q.status}`);let Y=Buffer.from(await q.arrayBuffer()),X=`${Q}.tmp`;try{if(await X8(X,Y),V!==void 0)await Yj(X,V);if(u$()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await r1(X,{force:!0})}catch{}throw J}}async function jj($){let Q=[];for(let V of $){let q=null;try{let Y=`${V.destPath}.prev`;try{await p$(V.destPath,Y),q=Y}catch(X){if(X.code!=="ENOENT")throw X}await p$(V.tmpPath,V.destPath),Q.push({dest:V.destPath,backup:q})}catch(Y){if(q)try{await r1(V.destPath,{force:!0}),await p$(q,V.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await r1(X.dest,{force:!0}),await p$(X.backup,X.dest);else await r1(X.dest,{force:!0})}catch{}for(let X of $)try{await r1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let V of Q){if(!V.backup)continue;try{await r1(V.backup,{force:!0})}catch{}}}async function AQ($){let Q=r7(),V=Wj($,Q.assetSuffix),q=Uj($),Y=Q$(),X=G8();await Y8(Q1.dirname(Y),{recursive:!0}),await Y8(Q1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await l7(V.browser_download_url,Y,493)),q)J.push(await l7(q.browser_download_url,X))}catch(G){for(let U of J)try{await r1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:V,sidecarAsset:q,staged:J}}async function RQ($){await jj($.staged)}async function Zj($){let Q=await AQ($);return await RQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var Hj="boba",zj=process.env.PETDEX_URL??"https://petdex.crafter.run",Pj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function d$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return Pj.has(Q.hostname)}catch{return!1}}function a7(){return process.env.HOME??$$()}function s7(){return Q1.join(a7(),".petdex","pets")}function t7(){return Q1.join(a7(),".codex","pets")}var Lj=16777216;function Ij($){for(let Q of["spritesheet.webp","spritesheet.png"]){let V=Q1.join($,Q);try{let q=Jj(V);if(q.isFile()&&q.size>0&&q.size<=Lj)return!0}catch{}}return!1}async function Oj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[s7(),t7()]){let V;try{V=await $(Q)}catch{continue}for(let q of V)if(Ij(Q1.join(Q,q)))return!0}return!1}async function Nj($={}){let Q=$.fetchOverride??fetch,V=$.petdexUrl??zj,q;try{let G=await Q(`${V}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();q=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(q.length===0)return null;let Y=[],X=new Set,J=q.find((G)=>G.slug===Hj);if(J)Y.push(J),X.add(J.slug);for(let G of q)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await Bj(G,Q);if(U)return U}return null}async function Bj($,Q){if(!d$($.spritesheetUrl)||!d$($.petJsonUrl))return null;let V=$.spritesheetUrl.endsWith(".png")?"png":"webp",q=[Q1.join(s7(),$.slug),Q1.join(t7(),$.slug)];for(let K of q)if(wQ(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of q){let W=`${K}.partial-${qj(6).toString("hex")}`;await Y8(W,{recursive:!0}),G.push(W),await Promise.all([X8(Q1.join(W,"pet.json"),Buffer.from(X)),X8(Q1.join(W,`spritesheet.${V}`),Buffer.from(J))]),await Y8(Q1.dirname(K),{recursive:!0}),await p$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>r1(K,{recursive:!0,force:!0})),...U.map((K)=>r1(K,{recursive:!0,force:!0}))]),null}}async function e7(){A1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=r7();m.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=z1();Q.start("Looking up the latest release");let V;try{V=await TQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
75
+ ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(V.tag_name)}`);let q=z1();q.start("Downloading desktop binary and sidecar");let Y;try{Y=await Zj(V)}catch(W){throw q.stop(r.default.red("failed")),W}let X=Q$(),J=Q1.join($$(),".petdex","version");await X8(J,`${V.tag_name}
76
76
  `);let G=Y.sidecarAsset?`
77
- ${r.default.dim("•")} Sidecar at ${r.default.cyan(d7(V8()))} (${u7(Y.sidecarAsset.size)})`:`
78
- ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${l7}.`;q.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(d7(X))} (${u7(Y.binAsset.size)})${G}`);let U=null;if(!await zj()){let W=P1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await Lj(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return T1(K.join(`
79
- `),"Next"),j1(`${r.default.green("✓")} ${V.tag_name}`),{tag:V.tag_name}}function u7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function d7($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var O1=C1(f1(),1);import{execFileSync as Bj,spawn as Oj}from"node:child_process";import{existsSync as s7,readFileSync as Nj,unlinkSync as Mj}from"node:fs";import{mkdir as Cj,writeFile as wj}from"node:fs/promises";import{homedir as t7}from"node:os";import AQ from"node:path";function J8(){let $=process.env.HOME??t7();return AQ.join($,".petdex","desktop.pid")}function q8(){let $=process.env.HOME??t7();return AQ.join($,".petdex","desktop.log")}function e7(){if(!s7(J8()))return null;let $;try{$=Nj(J8(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let V=JSON.parse($);if(typeof V.pid==="number"&&Number.isFinite(V.pid)&&V.pid>0&&typeof V.lstart==="string"&&V.lstart.length>0)return{pid:V.pid,lstart:V.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function $J($){try{let V=Bj("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return V.length>0?V:null}catch{return null}}function QJ($){if($.lstart.length===0)return!1;let Q=$J($.pid);return Q!==null&&Q===$.lstart}function c$(){try{Mj(J8())}catch{}}function x1(){let $=e7();if($==null)return{state:"stopped"};if(QJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function C0(){let $=x1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")c$();let Q=e0();if(!s7(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await Cj(AQ.dirname(q8()),{recursive:!0});let V=await import("node:fs").then((G)=>G.openSync(q8(),"a")),q=await import("node:fs").then((G)=>G.openSync(q8(),"a")),Y=Oj(Q,[],{detached:!0,stdio:["ignore",V,q]});if(Y.unref(),!Y.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let X=$J(Y.pid)??"",J={pid:Y.pid,lstart:X};return await wj(J8(),JSON.stringify(J)),{ok:!0,pid:Y.pid,alreadyRunning:!1}}var VJ=7777;async function p$($={}){let Q=$.sidecarPort??VJ,V=$.portWaitTimeoutMs??5000,q=x1();if(q.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(q.state==="stale")return c$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${q.pid} cleared)`};let Y=q.pid,X=e7();if(X===null||!QJ(X))return c$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(c$(),G.code==="ESRCH"){let K=await Y8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}c$();let J=await Y8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:J}}async function qJ(){let $=await C0();if(!$.ok)console.error(`${O1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${O1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${O1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(O1.default.dim(` log: ${q8()}`))}async function JJ(){let $=await p$();if(!$.ok)console.error(`${O1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${O1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${O1.default.yellow("!")} stopped pid ${$.pid}, but :${VJ} still busy`),console.log(O1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function Y8($,Q={}){let V=Q.timeoutMs??1e4,q=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+V;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(j)=>{K.removeAllListeners(),K.destroy(),U(j)};K.once("connect",()=>W(!1)),K.once("error",(j)=>{W(j.code==="ECONNREFUSED")}),K.setTimeout(q,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,q))}return!1}function YJ(){let $=x1();switch($.state){case"running":console.log(`${O1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${O1.default.dim("○")} stopped`);break;case"stale":console.log(`${O1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}var K1=C1(f1(),1);import{execSync as kj}from"node:child_process";import{existsSync as _1,readFileSync as X8,statSync as RQ}from"node:fs";import{homedir as yj}from"node:os";import A0 from"node:path";import{homedir as Tj}from"node:os";import Q1 from"node:path";var u$=7777,K0=`http://127.0.0.1:${u$}/state`;var V1=Tj(),T0=[{id:"claude-code",displayName:"Claude Code",configDir:Q1.join(V1,".claude"),configFile:Q1.join(V1,".claude","settings.json"),slashCommandPath:Q1.join(V1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("claude-code","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("claude-code","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("claude-code","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:Q1.join(V1,".codex"),configFile:Q1.join(V1,".codex","hooks.json"),slashCommandPath:Q1.join(V1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=Q1.join(V1,".codex","config.toml"),V=!0,q="";try{q=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")V=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=V?Fj(q):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${w0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${w0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${w0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(Q1.dirname(Q),{recursive:!0}),!V)try{return await J(Q,`[features]
77
+ ${r.default.dim("•")} Sidecar at ${r.default.cyan(i7(G8()))} (${o7(Y.sidecarAsset.size)})`:`
78
+ ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${n7}.`;q.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(i7(X))} (${o7(Y.binAsset.size)})${G}`);let U=null;if(!await Oj()){let W=z1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await Nj(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return T1(K.join(`
79
+ `),"Next"),j1(`${r.default.green("✓")} ${V.tag_name}`),{tag:V.tag_name}}function o7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function i7($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var N1=C1(f1(),1);import{execFileSync as $J,spawn as QJ}from"node:child_process";import{existsSync as VJ,readFileSync as Mj,unlinkSync as Cj}from"node:fs";import{mkdir as wj,writeFile as qJ}from"node:fs/promises";import{homedir as JJ}from"node:os";import K0 from"node:path";function i$(){let $=process.env.HOME??JJ();return K0.join($,".petdex","desktop.pid")}function o$(){let $=process.env.HOME??JJ();return K0.join($,".petdex","desktop.log")}function YJ(){if(!VJ(i$()))return null;let $;try{$=Mj(i$(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let V=JSON.parse($);if(typeof V.pid==="number"&&Number.isFinite(V.pid)&&V.pid>0&&typeof V.lstart==="string"&&V.lstart.length>0)return{pid:V.pid,lstart:V.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function FQ($){try{let V=$J("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return V.length>0?V:null}catch{return null}}function XJ($){if($.lstart.length===0)return!1;let Q=FQ($.pid);return Q!==null&&Q===$.lstart}function l$(){try{Cj(i$())}catch{}}function x1(){let $=YJ();if($==null)return{state:"stopped"};if(XJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function w0(){let $=x1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")l$();let Q=Q$();if(!VJ(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await wj(K0.dirname(o$()),{recursive:!0});let V=await import("node:fs").then((U)=>U.openSync(o$(),"a")),q=await import("node:fs").then((U)=>U.openSync(o$(),"a")),Y=Tj(Q);if(Y)return Aj(Y);let X=QJ(Q,[],{detached:!0,stdio:["ignore",V,q]});if(X.unref(),!X.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let J=FQ(X.pid)??"",G={pid:X.pid,lstart:J};return await qJ(i$(),JSON.stringify(G)),{ok:!0,pid:X.pid,alreadyRunning:!1}}function Tj($){let Q=K0.dirname($);if(K0.basename(Q)!=="MacOS")return null;let V=K0.dirname(Q);if(K0.basename(V)!=="Contents")return null;let q=K0.dirname(V);if(!q.endsWith(".app"))return null;return q}async function Aj($){QJ("open",["-gj",$],{stdio:"ignore",detached:!0}).unref();let V=Date.now()+3000,q=null;while(Date.now()<V){if(q=Rj(),q)break;await new Promise((J)=>setTimeout(J,100))}if(!q)return{ok:!1,reason:`Launched ${$} but couldn't find the resulting process. Check ${o$()}.`};let Y=FQ(q)??"",X={pid:q,lstart:Y};return await qJ(i$(),JSON.stringify(X)),{ok:!0,pid:q,alreadyRunning:!1}}function Rj(){try{let $=$J("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!$)return null;let Q=$.split(`
80
+ `).filter((q)=>q.length>0),V=Number(Q[Q.length-1]);return Number.isFinite(V)&&V>0?V:null}catch{return null}}var GJ=7777;async function n$($={}){let Q=$.sidecarPort??GJ,V=$.portWaitTimeoutMs??5000,q=x1();if(q.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(q.state==="stale")return l$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${q.pid} cleared)`};let Y=q.pid,X=YJ();if(X===null||!XJ(X))return l$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(l$(),G.code==="ESRCH"){let K=await K8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}l$();let J=await K8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:J}}async function KJ(){let $=await w0();if(!$.ok)console.error(`${N1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${N1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${N1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(N1.default.dim(` log: ${o$()}`))}async function WJ(){let $=await n$();if(!$.ok)console.error(`${N1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${N1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${N1.default.yellow("!")} stopped pid ${$.pid}, but :${GJ} still busy`),console.log(N1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function K8($,Q={}){let V=Q.timeoutMs??1e4,q=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+V;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(j)=>{K.removeAllListeners(),K.destroy(),U(j)};K.once("connect",()=>W(!1)),K.once("error",(j)=>{W(j.code==="ECONNREFUSED")}),K.setTimeout(q,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,q))}return!1}function UJ(){let $=x1();switch($.state){case"running":console.log(`${N1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${N1.default.dim("○")} stopped`);break;case"stale":console.log(`${N1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}var K1=C1(f1(),1);import{execSync as hj}from"node:child_process";import{existsSync as _1,readFileSync as W8,statSync as xQ}from"node:fs";import{homedir as bj}from"node:os";import R0 from"node:path";import{homedir as Fj}from"node:os";import V1 from"node:path";var r$=7777,W0=`http://127.0.0.1:${r$}/state`;var q1=Fj(),A0=[{id:"claude-code",displayName:"Claude Code",configDir:V1.join(q1,".claude"),configFile:V1.join(q1,".claude","settings.json"),slashCommandPath:V1.join(q1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("claude-code","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("claude-code","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("claude-code","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:V1.join(q1,".codex"),configFile:V1.join(q1,".codex","hooks.json"),slashCommandPath:V1.join(q1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=V1.join(q1,".codex","config.toml"),V=!0,q="";try{q=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")V=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=V?xj(q):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${T0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(V1.dirname(Q),{recursive:!0}),!V)try{return await J(Q,`[features]
80
81
  codex_hooks = true
81
- `,"utf8"),{ok:!0,message:`Created ${w0(Q)} with [features] codex_hooks = true`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,q)}catch(j){return{ok:!1,message:`Backup failed: ${j.message}`}}let W=Rj(q,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${w0(Q)} (backup: ${Q1.basename(K)})`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${w0(Q)} before it loads ${w0(Q1.join(V1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("codex","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("codex","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("codex","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:Q1.join(V1,".gemini"),configFile:Q1.join(V1,".gemini","settings.json"),slashCommandPath:Q1.join(V1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:a1("gemini","running")}]}],AfterTool:[{hooks:[{type:"command",command:a1("gemini","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:a1("gemini","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:Q1.join(V1,".config","opencode"),configFile:Q1.join(V1,".config","opencode","plugins","petdex.js"),slashCommandPath:Q1.join(V1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return Aj()}}];function a1($,Q,V){let q=V!=null?`{"state":"${Q}","duration":${V},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`,Y='[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0',X='T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"';return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"; ${[`[ -n "$T" ] && curl -s -m 0.3 -X POST ${K0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${q}'`,">/dev/null 2>&1 || true"].join(" ")}`}function Aj(){return`// petdex hook plugin — auto-generated by \`petdex hooks install\`.
82
+ `,"utf8"),{ok:!0,message:`Created ${T0(Q)} with [features] codex_hooks = true`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,q)}catch(j){return{ok:!1,message:`Backup failed: ${j.message}`}}let W=Sj(q,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${T0(Q)} (backup: ${V1.basename(K)})`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${T0(Q)} before it loads ${T0(V1.join(q1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("codex","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("codex","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("codex","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:V1.join(q1,".gemini"),configFile:V1.join(q1,".gemini","settings.json"),slashCommandPath:V1.join(q1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:a1("gemini","running")}]}],AfterTool:[{hooks:[{type:"command",command:a1("gemini","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:a1("gemini","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:V1.join(q1,".config","opencode"),configFile:V1.join(q1,".config","opencode","plugins","petdex.js"),slashCommandPath:V1.join(q1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return vj()}}];function a1($,Q,V){let q=V!=null?`{"state":"${Q}","duration":${V},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`,Y='[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0',X='T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"';return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"; ${[`[ -n "$T" ] && curl -s -m 0.3 -X POST ${W0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${q}'`,">/dev/null 2>&1 || true"].join(" ")}`}function vj(){return`// petdex hook plugin — auto-generated by \`petdex hooks install\`.
82
83
  // Forwards OpenCode lifecycle events to the petdex desktop mascot via HTTP.
83
84
  // Edit STATE_MAP below to customize which state each event triggers.
84
85
 
@@ -87,7 +88,7 @@ import { readFile } from "node:fs/promises";
87
88
  import { homedir } from "node:os";
88
89
  import { join } from "node:path";
89
90
 
90
- const SIDECAR_URL = ${JSON.stringify(K0)};
91
+ const SIDECAR_URL = ${JSON.stringify(W0)};
91
92
  const RUNTIME_DIR = join(homedir(), ".petdex", "runtime");
92
93
  const TOKEN_PATH = join(RUNTIME_DIR, "update-token");
93
94
  const KILLSWITCH_PATH = join(RUNTIME_DIR, "hooks-disabled");
@@ -143,8 +144,8 @@ export const PetdexPlugin = async () => ({
143
144
  else if (event.type === "session.error") setState("failed", 2500);
144
145
  },
145
146
  });
146
- `}function w0($){if($.startsWith(V1))return`~${$.slice(V1.length)}`;return $}function Fj($){let Q=$.split(`
147
- `),V=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,q=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(V);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(q);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function Rj($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let V=$.split(`
147
+ `}function T0($){if($.startsWith(q1))return`~${$.slice(q1.length)}`;return $}function xj($){let Q=$.split(`
148
+ `),V=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,q=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(V);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(q);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function Sj($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let V=$.split(`
148
149
  `);if(Q.state==="wrong-value"){let Y=V[Q.replaceLine],X=/^(\s*codex_hooks\s*=\s*)([^#\n]+?)(\s*(?:#.*)?)$/,J=Y.match(X);return V[Q.replaceLine]=J?`${J[1]}true${J[3]}`:"codex_hooks = true",V.join(`
149
150
  `)}if(Q.state==="no-key")return V.splice(Q.insertAfterLine+1,0,"codex_hooks = true"),V.join(`
150
151
  `);let q=$.endsWith(`
@@ -152,42 +153,42 @@ export const PetdexPlugin = async () => ({
152
153
  `;return`${$}${q}
153
154
  [features]
154
155
  codex_hooks = true
155
- `}import{existsSync as vj,mkdirSync as xj,unlinkSync as Sj,writeFileSync as Ej}from"node:fs";import{homedir as gj}from"node:os";import FQ from"node:path";function XJ(){return process.env.HOME??gj()}function GJ(){return FQ.join(XJ(),".petdex","runtime","hooks-disabled")}function d$(){return FQ.join(XJ(),".petdex","runtime","update-token")}function $$(){return vj(GJ())?"off":"on"}function Q$($){let Q=GJ();if($==="off")xj(FQ.dirname(Q),{recursive:!0}),Ej(Q,`# Petdex hook killswitch.
156
+ `}import{existsSync as Ej,mkdirSync as gj,unlinkSync as kj,writeFileSync as yj}from"node:fs";import{homedir as Dj}from"node:os";import vQ from"node:path";function jJ(){return process.env.HOME??Dj()}function ZJ(){return vQ.join(jJ(),".petdex","runtime","hooks-disabled")}function a$(){return vQ.join(jJ(),".petdex","runtime","update-token")}function V$(){return Ej(ZJ())?"off":"on"}function q$($){let Q=ZJ();if($==="off")gj(vQ.dirname(Q),{recursive:!0}),yj(Q,`# Petdex hook killswitch.
156
157
  # Hooks are DISABLED while this file exists.
157
158
  # Re-enable: petdex hooks on (or /petdex from inside your agent).
158
- `,{mode:384});else try{Sj(Q)}catch{}return $}function KJ(){return Q$($$()==="on"?"off":"on")}function l$(){return process.env.HOME??yj()}function Dj(){return A0.join(l$(),".petdex","runtime","update-token")}function hj(){return A0.join(l$(),".petdex","desktop.pid")}function bj(){let $=e0();if(!_1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(RQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function _j(){let $=V8();if(!_1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function fj(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function mj(){let $=hj();if(!_1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=X8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let V=JSON.parse(Q);if(typeof V.pid!=="number"||typeof V.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${V.pid}, started ${V.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function cj(){let $=Dj();if(!_1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(X8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let q=RQ($).mode&511;if(q!==384)return{status:"warn",label:"Update token",detail:`present, mode ${q.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function pj(){if($$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED — agent hooks are short-circuited",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function uj(){let $=[];for(let Q of T0){let V=_1(Q.configFile),q=_1(Q.slashCommandPath);if(!_1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(V)try{let X=X8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!q){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function dj(){let $=A0.join(l$(),".codex","config.toml");if(!_1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=X8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function lj(){let $=[A0.join(l$(),".petdex","pets"),A0.join(l$(),".codex","pets")],Q=0;for(let V of $){if(!_1(V))continue;try{let{readdirSync:q}=i("node:fs"),Y=q(V);for(let X of Y){let J=A0.join(V,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=A0.join(J,G);if(!_1(U))continue;try{let K=RQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function oj($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function N1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${oj($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function WJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),N1(bj()),N1(_j()),N1(lj()),console.log(""),console.log(K1.default.bold("Runtime")),N1(await fj()),N1(mj()),N1(cj()),N1(pj()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of uj())N1(Q);N1(dj()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=kj("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)N1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)N1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
159
- `).length-1;N1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}import{existsSync as ij,readFileSync as jJ}from"node:fs";import{writeFile as nj}from"node:fs/promises";import{homedir as ZJ}from"node:os";import HJ from"node:path";var o=C1(f1(),1);var G8=7777,rj="x-petdex-update-token",aj=HJ.join(ZJ(),".petdex","runtime","update-token"),vQ=HJ.join(ZJ(),".petdex","version");async function sj($={}){let Q=$.port??G8,V=$.timeoutMs??2000,q=$.tokenPath??aj,Y;try{Y=jJ(q,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),V);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[rj]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function tj(){if(!ij(vQ))return null;try{return jJ(vQ,"utf8").trim()||null}catch{return null}}async function PJ($=[]){let Q=$.includes("--force"),V=$.includes("--silent"),q=(z)=>{if(V)console.log(`[petdex update] ${z}`);else A1(o.default.bgMagenta(o.default.white(` ${z} `)))},Y=(z)=>{if(V)console.log(z);else m.info(z)},X=(z)=>{if(V)console.warn(z);else m.warn(z)},J=(z)=>{if(V)console.log(z);else j1(z)},G=()=>{if(V)return{start:(M)=>console.log(M),stop:(M)=>console.log(M)};let z=P1();return{start:(M)=>z.start(M),stop:(M)=>z.stop(M)}};q("petdex update");let U=tj();Y(U?`Installed: ${V?U:o.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await CQ()}catch(z){throw K.stop(V?"failed":o.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
160
- ${z.message}`)}if(K.stop(V?`Latest: ${W.tag_name}`:`${o.default.green("✓")} Latest: ${o.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(V?"Already up to date.":`${o.default.green("✓")} Already up to date.`);return}let j=G();j.start(`Downloading ${W.tag_name}`);let Z;try{Z=await wQ(W)}catch(z){throw j.stop(V?"failed":o.default.red("failed")),z}j.stop(V?`Downloaded ${W.tag_name} (${UJ(Z.binAsset.size)})`:`${o.default.green("✓")} Downloaded ${o.default.bold(W.tag_name)} (${UJ(Z.binAsset.size)})`);let H=x1().state==="running";if(H)Y(V?"Stopping running petdex-desktop":`${o.default.dim("•")} Stopping running petdex-desktop`),await p$();if(await TQ(Z),await nj(vQ,`${W.tag_name}
161
- `),H){Y(V?"Asking sidecar to release port":`${o.default.dim("•")} Asking sidecar to release port`);let z=await sj();if(Y(V?z?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":z?`${o.default.dim("•")} Sidecar acknowledged handoff`:`${o.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await Y8(G8,{timeoutMs:1e4})){X(V?`Port ${G8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${o.default.yellow("!")} Port ${G8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(V?"Restarting petdex-desktop":`${o.default.dim("•")} Restarting petdex-desktop`);let N=await C0();if(N.ok)Y(V?`Restarted (pid ${N.pid})`:`${o.default.green("✓")} Restarted (pid ${N.pid})`);else X(V?`Could not restart: ${N.reason}. Run 'petdex desktop start' manually.`:`${o.default.yellow("!")} Could not restart: ${N.reason}. Run \`petdex desktop start\` manually.`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(V?C:`${o.default.green("✓")} ${C}`)}function UJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}import{mkdir as JZ,readFile as BJ,stat as YZ,writeFile as xQ}from"node:fs/promises";import OJ from"node:path";var g=C1(f1(),1);import{mkdir as ej,rm as $Z,writeFile as QZ}from"node:fs/promises";import VZ from"node:path";var qZ="---\ndescription: Wake or sleep the petdex mascot — toggles the floating pet on/off\n---\n\nThe user wants to control the petdex mascot from inside the agent. The mascot is a floating macOS window driven by hooks installed in agent settings. /petdex is a one-shot toggle that flips the entire state in a single command:\n\n- `/petdex` (no args) → run `petdex toggle` (if mascot is awake, send to sleep; otherwise wake it up)\n- `/petdex up` → run `petdex up` (force-wake: enables hooks AND starts the desktop)\n- `/petdex down` → run `petdex down` (force-sleep: disables hooks AND stops the desktop)\n- `/petdex status` → run `petdex hooks status`\n- `/petdex doctor` → run `petdex doctor` (diagnose install + agents)\n\nShow the command output verbatim to the user. Don't reinterpret, don't explain — the CLI's output is already user-facing.\n\nIf the `petdex` binary isn't on PATH, suggest `npx petdex <subcommand>` instead.\n\nArguments: `$ARGUMENTS`\n";async function zJ($){await ej(VZ.dirname($.slashCommandPath),{recursive:!0}),await QZ($.slashCommandPath,qZ,"utf8")}async function LJ($){try{await $Z($.slashCommandPath,{force:!0})}catch{}}async function XZ(){return Promise.all(T0.map(async($)=>({agent:$,installed:await NJ($.configDir)})))}async function NJ($){try{return await YZ($),!0}catch{return!1}}async function MJ(){A1(g.default.bgMagenta(g.default.white(" petdex hooks install ")));let $=await XZ(),Q=$.some((U)=>U.installed);m.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent — they'll activate when you install it.");for(let{agent:U,installed:K}of $){let W=K?g.default.green("●"):g.default.dim("○"),j=K?g.default.dim("installed"):g.default.dim("not found");console.log(` ${W} ${g.default.bold(U.displayName)} ${j}`)}let V=await UV({message:"Which agents should drive the mascot?",options:$.map(({agent:U,installed:K})=>({value:U.id,label:U.displayName,hint:K?"installed":"not installed yet"})),initialValues:$.filter((U)=>U.installed).map((U)=>U.agent.id),required:!1});if(m1(V)||V.length===0)return q1("No agents selected. Bye."),{installedAgents:[]};let q=[],Y=[],X=[];for(let U of V){let K=T0.find((W)=>W.id===U);if(!K)continue;try{let W=await GZ(K);if(X.push(K.id),q.push(` ${g.default.green("✓")} ${g.default.bold(K.displayName)} ${g.default.dim(`→ ${ZZ(K.configFile)}`)}${W.backupPath?g.default.dim(` (backup: ${OJ.basename(W.backupPath)})`):""}`),K.postInstallChecks)try{let j=await K.postInstallChecks();if(j.length>0)Y.push({agent:K.displayName,notes:j})}catch{}}catch(W){q.push(` ${g.default.red("✗")} ${g.default.bold(K.displayName)} ${g.default.red(W instanceof Error?W.message:String(W))}`)}}T1(q.join(`
159
+ `,{mode:384});else try{kj(Q)}catch{}return $}function HJ(){return q$(V$()==="on"?"off":"on")}function s$(){return process.env.HOME??bj()}function _j(){return R0.join(s$(),".petdex","runtime","update-token")}function fj(){return R0.join(s$(),".petdex","desktop.pid")}function mj(){let $=Q$();if(!_1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(xQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function cj(){let $=G8();if(!_1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function pj(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function uj(){let $=fj();if(!_1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=W8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let V=JSON.parse(Q);if(typeof V.pid!=="number"||typeof V.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${V.pid}, started ${V.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function dj(){let $=_j();if(!_1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(W8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let q=xQ($).mode&511;if(q!==384)return{status:"warn",label:"Update token",detail:`present, mode ${q.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function lj(){if(V$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED — agent hooks are short-circuited",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function oj(){let $=[];for(let Q of A0){let V=_1(Q.configFile),q=_1(Q.slashCommandPath);if(!_1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(V)try{let X=W8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!q){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function ij(){let $=R0.join(s$(),".codex","config.toml");if(!_1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=W8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function nj(){let $=[R0.join(s$(),".petdex","pets"),R0.join(s$(),".codex","pets")],Q=0;for(let V of $){if(!_1(V))continue;try{let{readdirSync:q}=i("node:fs"),Y=q(V);for(let X of Y){let J=R0.join(V,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=R0.join(J,G);if(!_1(U))continue;try{let K=xQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function rj($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function B1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${rj($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function zJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),B1(mj()),B1(cj()),B1(nj()),console.log(""),console.log(K1.default.bold("Runtime")),B1(await pj()),B1(uj()),B1(dj()),B1(lj()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of oj())B1(Q);B1(ij()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=hj("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)B1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)B1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
160
+ `).length-1;B1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}import{existsSync as aj,readFileSync as LJ}from"node:fs";import{writeFile as sj}from"node:fs/promises";import{homedir as IJ}from"node:os";import OJ from"node:path";var o=C1(f1(),1);var U8=7777,tj="x-petdex-update-token",ej=OJ.join(IJ(),".petdex","runtime","update-token"),SQ=OJ.join(IJ(),".petdex","version");async function $Z($={}){let Q=$.port??U8,V=$.timeoutMs??2000,q=$.tokenPath??ej,Y;try{Y=LJ(q,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),V);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[tj]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function QZ(){if(!aj(SQ))return null;try{return LJ(SQ,"utf8").trim()||null}catch{return null}}async function NJ($=[]){let Q=$.includes("--force"),V=$.includes("--silent"),q=(P)=>{if(V)console.log(`[petdex update] ${P}`);else A1(o.default.bgMagenta(o.default.white(` ${P} `)))},Y=(P)=>{if(V)console.log(P);else m.info(P)},X=(P)=>{if(V)console.warn(P);else m.warn(P)},J=(P)=>{if(V)console.log(P);else j1(P)},G=()=>{if(V)return{start:(M)=>console.log(M),stop:(M)=>console.log(M)};let P=z1();return{start:(M)=>P.start(M),stop:(M)=>P.stop(M)}};q("petdex update");let U=QZ();Y(U?`Installed: ${V?U:o.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await TQ()}catch(P){throw K.stop(V?"failed":o.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
161
+ ${P.message}`)}if(K.stop(V?`Latest: ${W.tag_name}`:`${o.default.green("✓")} Latest: ${o.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(V?"Already up to date.":`${o.default.green("✓")} Already up to date.`);return}let j=G();j.start(`Downloading ${W.tag_name}`);let H;try{H=await AQ(W)}catch(P){throw j.stop(V?"failed":o.default.red("failed")),P}j.stop(V?`Downloaded ${W.tag_name} (${PJ(H.binAsset.size)})`:`${o.default.green("✓")} Downloaded ${o.default.bold(W.tag_name)} (${PJ(H.binAsset.size)})`);let z=x1().state==="running";if(z)Y(V?"Stopping running petdex-desktop":`${o.default.dim("•")} Stopping running petdex-desktop`),await n$();if(await RQ(H),await sj(SQ,`${W.tag_name}
162
+ `),z){Y(V?"Asking sidecar to release port":`${o.default.dim("•")} Asking sidecar to release port`);let P=await $Z();if(Y(V?P?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":P?`${o.default.dim("•")} Sidecar acknowledged handoff`:`${o.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await K8(U8,{timeoutMs:1e4})){X(V?`Port ${U8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${o.default.yellow("!")} Port ${U8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(V?"Restarting petdex-desktop":`${o.default.dim("•")} Restarting petdex-desktop`);let B=await w0();if(B.ok)Y(V?`Restarted (pid ${B.pid})`:`${o.default.green("✓")} Restarted (pid ${B.pid})`);else X(V?`Could not restart: ${B.reason}. Run 'petdex desktop start' manually.`:`${o.default.yellow("!")} Could not restart: ${B.reason}. Run \`petdex desktop start\` manually.`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(V?C:`${o.default.green("✓")} ${C}`)}function PJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}import{mkdir as GZ,readFile as wJ,stat as KZ,writeFile as EQ}from"node:fs/promises";import TJ from"node:path";var g=C1(f1(),1);import{mkdir as VZ,rm as qZ,writeFile as JZ}from"node:fs/promises";import YZ from"node:path";var XZ="---\ndescription: Wake or sleep the petdex mascot — toggles the floating pet on/off\n---\n\nThe user wants to control the petdex mascot from inside the agent. The mascot is a floating macOS window driven by hooks installed in agent settings. /petdex is a one-shot toggle that flips the entire state in a single command:\n\n- `/petdex` (no args) → run `petdex toggle` (if mascot is awake, send to sleep; otherwise wake it up)\n- `/petdex up` → run `petdex up` (force-wake: enables hooks AND starts the desktop)\n- `/petdex down` → run `petdex down` (force-sleep: disables hooks AND stops the desktop)\n- `/petdex status` → run `petdex hooks status`\n- `/petdex doctor` → run `petdex doctor` (diagnose install + agents)\n\nShow the command output verbatim to the user. Don't reinterpret, don't explain — the CLI's output is already user-facing.\n\nIf the `petdex` binary isn't on PATH, suggest `npx petdex <subcommand>` instead.\n\nArguments: `$ARGUMENTS`\n";async function BJ($){await VZ(YZ.dirname($.slashCommandPath),{recursive:!0}),await JZ($.slashCommandPath,XZ,"utf8")}async function MJ($){try{await qZ($.slashCommandPath,{force:!0})}catch{}}async function WZ(){return Promise.all(A0.map(async($)=>({agent:$,installed:await AJ($.configDir)})))}async function AJ($){try{return await KZ($),!0}catch{return!1}}async function gQ(){A1(g.default.bgMagenta(g.default.white(" petdex hooks install ")));let $=await WZ(),Q=$.some((U)=>U.installed);m.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent — they'll activate when you install it.");for(let{agent:U,installed:K}of $){let W=K?g.default.green("●"):g.default.dim("○"),j=K?g.default.dim("installed"):g.default.dim("not found");console.log(` ${W} ${g.default.bold(U.displayName)} ${j}`)}let V=await HV({message:"Which agents should drive the mascot?",options:$.map(({agent:U,installed:K})=>({value:U.id,label:U.displayName,hint:K?"installed":"not installed yet"})),initialValues:$.filter((U)=>U.installed).map((U)=>U.agent.id),required:!1});if(m1(V)||V.length===0)return J1("No agents selected. Bye."),{installedAgents:[]};let q=[],Y=[],X=[];for(let U of V){let K=A0.find((W)=>W.id===U);if(!K)continue;try{let W=await UZ(K);if(X.push(K.id),q.push(` ${g.default.green("✓")} ${g.default.bold(K.displayName)} ${g.default.dim(`→ ${PZ(K.configFile)}`)}${W.backupPath?g.default.dim(` (backup: ${TJ.basename(W.backupPath)})`):""}`),K.postInstallChecks)try{let j=await K.postInstallChecks();if(j.length>0)Y.push({agent:K.displayName,notes:j})}catch{}}catch(W){q.push(` ${g.default.red("✗")} ${g.default.bold(K.displayName)} ${g.default.red(W instanceof Error?W.message:String(W))}`)}}T1(q.join(`
162
163
  `),"Done");for(let{agent:U,notes:K}of Y)for(let W of K){let j=W.level==="action"?g.default.bgYellow(g.default.black(" action needed ")):W.level==="warn"?g.default.yellow("!"):g.default.cyan("i");if(m.warn(`${j} ${g.default.bold(U)}
163
- ${W.message}`),W.fix){let Z=await q$({message:W.fix.prompt,initialValue:!0});if(!m1(Z)&&Z){let H=await W.fix.apply();if(H.ok)m.info(`${g.default.green("✓")} ${H.message}`);else m.warn(`${g.default.red("✗")} ${H.message}`)}}}let J=x1();if(J.state==="running")m.info(`${g.default.green("●")} petdex-desktop already running (pid ${J.pid}).`);else{let U=await q$({message:"Start petdex-desktop now so hooks have somewhere to land?",initialValue:!0});if(!m1(U)&&U){let K=await C0();if(K.ok)m.info(K.alreadyRunning?`${g.default.dim("•")} already running (pid ${K.pid})`:`${g.default.green("✓")} petdex-desktop started (pid ${K.pid})`);else m.warn(`${g.default.yellow("!")} Could not start petdex-desktop: ${K.reason}`),m.info(`Install it with ${g.default.cyan("petdex install desktop")} and then ${g.default.cyan("petdex desktop start")}.`)}}let G=["T=$(cat ~/.petdex/runtime/update-token)",`curl -X POST ${K0}`,'-H "X-Petdex-Update-Token: $T"',`--data-raw '{"state":"waving"}'`].join(" ");return m.info([`Petdex listens on ${g.default.cyan(K0)} when ${g.default.bold("petdex-desktop")} is running.`,`Test it: ${g.default.cyan(G)}`].join(`
164
- `)),j1(g.default.dim("Restart your agent for the hooks to load.")),{installedAgents:X}}async function GZ($){await JZ(OJ.dirname($.configFile),{recursive:!0});let Q=$.build();if(await zJ($),$.id==="opencode"){let J=await IJ($.configFile);return await xQ($.configFile,Q,"utf8"),{backupPath:J}}let V=await KZ($.configFile);if(V.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${V.message}.
165
- Fix the file (or rename it) and run \`petdex hooks install\` again.`);let q=V.kind==="ok"?await IJ($.configFile):null,Y=V.kind==="ok"?V.value:{},X=WZ(Y,Q);return await xQ($.configFile,`${JSON.stringify(X,null,2)}
166
- `,"utf8"),{backupPath:q}}async function KZ($){let Q;try{Q=await BJ($,"utf8")}catch(V){let q=V.code;if(q==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${q??V.name}): ${V.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(V){return{kind:"error",message:`JSON parse failed: ${V.message}`}}}async function IJ($){if(!await NJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await BJ($);return await xQ(V,q),V}function WZ($,Q){let V={...$},q=Q.hooks??{},X={...V.hooks??{}};for(let[J,G]of Object.entries(q)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!UZ(W));X[J]=[...K,...G]}return V.hooks=X,V}function UZ($){if(typeof $!=="object"||$==null)return!1;return jZ($).some((V)=>V.includes(`localhost:${u$}/state`)||V.includes(K0))}function jZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}function ZZ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}import{existsSync as o$}from"node:fs";import{readFile as wJ,rm as TJ,writeFile as AJ}from"node:fs/promises";import HZ from"node:path";var t=C1(f1(),1);async function FJ($={}){A1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let V=(await PZ()).filter((X)=>X.installed);if(V.length===0)return j1(t.default.dim("No agent configs found — nothing to uninstall.")),{uninstalledAgents:[]};let q=[],Y=[];for(let{agent:X}of V)try{let J=await zZ(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${HZ.basename(J.backupPath)})`)}`:"";q.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else q.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await LJ(X)}catch(J){q.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(T1(q.join(`
167
- `),"Done"),$.removeToken)try{await TJ(d$(),{force:!0}),m.info(`${t.default.green("✓")} Removed ${d$()}`)}catch{}else if(o$(d$()))m.info(t.default.dim(`Token file at ${d$()} kept. Pass --remove-token to delete it.`));return j1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function PZ(){return Promise.all(T0.map(async($)=>({agent:$,installed:o$($.configDir)})))}async function zZ($){if($.id==="opencode"){if(!o$($.configFile))return{removed:!1,backupPath:null};let X=await CJ($.configFile);return await TJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!o$($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await wJ($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let V;try{V=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let q=LZ(V);if(!q.changed)return{removed:!1,backupPath:null};let Y=await CJ($.configFile);return await AJ($.configFile,`${JSON.stringify(q.value,null,2)}
168
- `,"utf8"),{removed:!0,backupPath:Y}}function LZ($){let Q={...$},V=Q.hooks;if(!V||typeof V!=="object"||Array.isArray(V))return{value:Q,changed:!1};let q=!1,Y={};for(let[X,J]of Object.entries(V)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!IZ(U));if(G.length!==J.length)q=!0;if(G.length>0)Y[X]=G}if(!q)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function IZ($){if(typeof $!=="object"||$==null)return!1;return BZ($).some((V)=>V.includes(`localhost:${u$}/state`)||V.includes(K0))}function BZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}async function CJ($){if(!o$($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await wJ($);return await AJ(V,q),V}import{spawn as OZ}from"node:child_process";import{randomUUID as RJ}from"node:crypto";import{existsSync as NZ,mkdirSync as MZ,readFileSync as CZ,writeFileSync as wZ}from"node:fs";import{homedir as TZ}from"node:os";import vJ from"node:path";function K8(){let $=process.env.HOME??TZ();return vJ.join($,".petdex","telemetry.json")}var AZ=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",FZ=2000;function W8(){if(!NZ(K8()))return{kind:"missing"};let $;try{$=CZ(K8(),"utf8")}catch(Q){return{kind:"error",reason:`read failed: ${Q.message}`}}try{return{kind:"ok",config:JSON.parse($)}}catch(Q){return{kind:"error",reason:`parse failed: ${Q.message}`}}}function SQ($){try{return MZ(vJ.dirname(K8()),{recursive:!0}),wZ(K8(),`${JSON.stringify($,null,2)}
169
- `),!0}catch{return!1}}function xJ(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=W8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:RJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return SQ(Q)?Q:null}function SJ(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=W8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function EJ($){let Q=W8(),V;if(Q.kind==="ok")V=Q.config,V.enabled=$;else V={install_id:RJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return SQ(V)}function gJ(){let $=W8();return{enabled:SJ(),install_id:$.kind==="ok"?$.config.install_id:null}}function kJ(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=xJ();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
170
- `)),$.notice_seen=!0,SQ($)}function U8($,Q={}){if(!SJ())return;let V=xJ();if(!V)return;let q=JSON.stringify({install_id:V.install_id,event:$,...Q});try{let Y=`
164
+ ${W.message}`),W.fix){let H=await X$({message:W.fix.prompt,initialValue:!0});if(!m1(H)&&H){let z=await W.fix.apply();if(z.ok)m.info(`${g.default.green("✓")} ${z.message}`);else m.warn(`${g.default.red("✗")} ${z.message}`)}}}let J=x1();if(J.state==="running")m.info(`${g.default.green("●")} petdex-desktop already running (pid ${J.pid}).`);else{let U=await X$({message:"Start petdex-desktop now so hooks have somewhere to land?",initialValue:!0});if(!m1(U)&&U){let K=await w0();if(K.ok)m.info(K.alreadyRunning?`${g.default.dim("•")} already running (pid ${K.pid})`:`${g.default.green("✓")} petdex-desktop started (pid ${K.pid})`);else m.warn(`${g.default.yellow("!")} Could not start petdex-desktop: ${K.reason}`),m.info(`Install it with ${g.default.cyan("petdex install desktop")} and then ${g.default.cyan("petdex desktop start")}.`)}}let G=["T=$(cat ~/.petdex/runtime/update-token)",`curl -X POST ${W0}`,'-H "X-Petdex-Update-Token: $T"',`--data-raw '{"state":"waving"}'`].join(" ");return m.info([`Petdex listens on ${g.default.cyan(W0)} when ${g.default.bold("petdex-desktop")} is running.`,`Test it: ${g.default.cyan(G)}`].join(`
165
+ `)),j1(g.default.dim("Restart your agent for the hooks to load.")),{installedAgents:X}}async function UZ($){await GZ(TJ.dirname($.configFile),{recursive:!0});let Q=$.build();if(await BJ($),$.id==="opencode"){let J=await CJ($.configFile);return await EQ($.configFile,Q,"utf8"),{backupPath:J}}let V=await jZ($.configFile);if(V.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${V.message}.
166
+ Fix the file (or rename it) and run \`petdex hooks install\` again.`);let q=V.kind==="ok"?await CJ($.configFile):null,Y=V.kind==="ok"?V.value:{},X=ZZ(Y,Q);return await EQ($.configFile,`${JSON.stringify(X,null,2)}
167
+ `,"utf8"),{backupPath:q}}async function jZ($){let Q;try{Q=await wJ($,"utf8")}catch(V){let q=V.code;if(q==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${q??V.name}): ${V.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(V){return{kind:"error",message:`JSON parse failed: ${V.message}`}}}async function CJ($){if(!await AJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await wJ($);return await EQ(V,q),V}function ZZ($,Q){let V={...$},q=Q.hooks??{},X={...V.hooks??{}};for(let[J,G]of Object.entries(q)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!HZ(W));X[J]=[...K,...G]}return V.hooks=X,V}function HZ($){if(typeof $!=="object"||$==null)return!1;return zZ($).some((V)=>V.includes(`localhost:${r$}/state`)||V.includes(W0))}function zZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}function PZ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}import{existsSync as t$}from"node:fs";import{readFile as FJ,rm as vJ,writeFile as xJ}from"node:fs/promises";import LZ from"node:path";var t=C1(f1(),1);async function SJ($={}){A1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let V=(await IZ()).filter((X)=>X.installed);if(V.length===0)return j1(t.default.dim("No agent configs found — nothing to uninstall.")),{uninstalledAgents:[]};let q=[],Y=[];for(let{agent:X}of V)try{let J=await OZ(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${LZ.basename(J.backupPath)})`)}`:"";q.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else q.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await MJ(X)}catch(J){q.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(T1(q.join(`
168
+ `),"Done"),$.removeToken)try{await vJ(a$(),{force:!0}),m.info(`${t.default.green("✓")} Removed ${a$()}`)}catch{}else if(t$(a$()))m.info(t.default.dim(`Token file at ${a$()} kept. Pass --remove-token to delete it.`));return j1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function IZ(){return Promise.all(A0.map(async($)=>({agent:$,installed:t$($.configDir)})))}async function OZ($){if($.id==="opencode"){if(!t$($.configFile))return{removed:!1,backupPath:null};let X=await RJ($.configFile);return await vJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!t$($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await FJ($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let V;try{V=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let q=NZ(V);if(!q.changed)return{removed:!1,backupPath:null};let Y=await RJ($.configFile);return await xJ($.configFile,`${JSON.stringify(q.value,null,2)}
169
+ `,"utf8"),{removed:!0,backupPath:Y}}function NZ($){let Q={...$},V=Q.hooks;if(!V||typeof V!=="object"||Array.isArray(V))return{value:Q,changed:!1};let q=!1,Y={};for(let[X,J]of Object.entries(V)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!BZ(U));if(G.length!==J.length)q=!0;if(G.length>0)Y[X]=G}if(!q)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function BZ($){if(typeof $!=="object"||$==null)return!1;return MZ($).some((V)=>V.includes(`localhost:${r$}/state`)||V.includes(W0))}function MZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}async function RJ($){if(!t$($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await FJ($);return await xJ(V,q),V}import{spawn as CZ}from"node:child_process";import{randomUUID as EJ}from"node:crypto";import{existsSync as wZ,mkdirSync as TZ,readFileSync as AZ,writeFileSync as RZ}from"node:fs";import{homedir as FZ}from"node:os";import gJ from"node:path";function j8(){let $=process.env.HOME??FZ();return gJ.join($,".petdex","telemetry.json")}var vZ=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",xZ=2000;function Z8(){if(!wZ(j8()))return{kind:"missing"};let $;try{$=AZ(j8(),"utf8")}catch(Q){return{kind:"error",reason:`read failed: ${Q.message}`}}try{return{kind:"ok",config:JSON.parse($)}}catch(Q){return{kind:"error",reason:`parse failed: ${Q.message}`}}}function kQ($){try{return TZ(gJ.dirname(j8()),{recursive:!0}),RZ(j8(),`${JSON.stringify($,null,2)}
170
+ `),!0}catch{return!1}}function kJ(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=Z8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:EJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return kQ(Q)?Q:null}function yJ(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=Z8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function DJ($){let Q=Z8(),V;if(Q.kind==="ok")V=Q.config,V.enabled=$;else V={install_id:EJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return kQ(V)}function hJ(){let $=Z8();return{enabled:yJ(),install_id:$.kind==="ok"?$.config.install_id:null}}function bJ(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=kJ();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
171
+ `)),$.notice_seen=!0,kQ($)}function e$($,Q={}){if(!yJ())return;let V=kJ();if(!V)return;let q=JSON.stringify({install_id:V.install_id,event:$,...Q});try{let Y=`
171
172
  const controller = new AbortController();
172
- const t = setTimeout(() => controller.abort(), ${FZ});
173
- fetch(${JSON.stringify(AZ)}, {
173
+ const t = setTimeout(() => controller.abort(), ${xZ});
174
+ fetch(${JSON.stringify(vZ)}, {
174
175
  method: "POST",
175
176
  headers: { "content-type": "application/json" },
176
177
  body: ${JSON.stringify(q)},
177
178
  signal: controller.signal,
178
179
  }).catch(() => {}).finally(() => clearTimeout(t));
179
- `;OZ(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",vZ="https://clerk.petdex.crafter.run",xZ="LcThwEayl6KAA1Qm",EQ=["profile","email","openid","offline_access"];async function SZ(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:EQ};try{let V=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(V.ok){let q=await V.json(),Y=typeof q.issuer==="string"?q.issuer:null,X=typeof q.clientId==="string"?q.clientId:null,J=Array.isArray(q.scopes)?q.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:EQ}}}catch{}return{issuer:$??vZ,clientId:Q??xZ,scopes:EQ}}var Z8=null;async function z8(){if(Z8)return Z8;let $=await SZ();return Z8=new t6({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),Z8}var n$="0.2.0";EZ().catch(($)=>{q1(`petdex: ${$.message}`),process.exit(1)});async function EZ(){let $=process.argv.slice(2),Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){hJ();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))kJ();switch(Q){case"login":await gZ();break;case"logout":await kZ();break;case"whoami":await yZ();break;case"submit":await bZ($.slice(1));break;case"install":await DZ($.slice(1));break;case"list":await hZ();break;case"hooks":await nZ($.slice(1));break;case"desktop":await sZ($.slice(1));break;case"up":await dJ();break;case"down":await lJ();break;case"toggle":await aZ();break;case"update":await PJ($.slice(1));break;case"doctor":await WJ();break;case"telemetry":tZ($.slice(1));break;case"version":case"--version":case"-v":console.log(n$);break;default:console.error(P.default.red(`Unknown command: ${Q}`)),hJ(),process.exit(1)}}function hJ(){let $=P.default.cyan,Q=P.default.dim;console.log(["",` ${P.default.bold(P.default.magenta("petdex"))} ${Q(n$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${P.default.bold("login")} Sign in with Clerk OAuth`,` ${P.default.bold("logout")} Clear stored credentials`,` ${P.default.bold("whoami")} Show signed-in user`,` ${P.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${P.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${P.default.bold("install desktop")} Install the petdex-desktop binary for your platform`,` ${P.default.bold("list")} List approved pets`,` ${P.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${P.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${P.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${P.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${P.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${P.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${P.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${P.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex submit ~/Downloads/boba.zip ${Q("# zip file")}`,` ${Q("$")} petdex submit ~/.codex/pets ${Q("# bulk all subfolders")}`,` ${Q("$")} petdex install boba`,` ${Q("$")} petdex install desktop ${Q("# fetch the latest binary")}`,` ${Q("$")} petdex hooks install ${Q("# pick agents, write hooks")}`,` ${Q("$")} petdex desktop start ${Q("# launch the mascot")}`,` ${Q("$")} petdex update ${Q("# pull latest release")}`,"",` ${Q("Gallery & docs:")} ${P.default.underline(M1)}`,""].join(`
180
- `))}async function gZ(){A1(P.default.bgMagenta(P.default.white(" petdex login ")));let $=P1();$.start("Opening your browser to sign in with Clerk");try{let Q=await z8(),{user:V}=await Q.login(),q=pJ(V.email,V.username,V.sub)??"unknown";$.stop(`${P.default.green("✓ ")}Signed in as ${P.default.cyan(q)}`),j1(`Try ${P.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(P.default.red("× login failed")),Error(dZ(Q.message))}}async function kZ(){await(await z8()).logout(),console.log(`${P.default.green("✓ ")}Signed out`)}async function yZ(){try{let Q=await(await z8()).whoami();if(!Q)throw Error("not signed in");let V=[P8(Q.given_name),P8(Q.family_name)].filter(Boolean).join(" ");T1([`${P.default.dim("user: ")}${Q.sub}`,`${P.default.dim("email: ")}${Q.email??"—"}`,`${P.default.dim("name: ")}${V||"—"}`,`${P.default.dim("username:")}${P8(Q.preferred_username)??"—"}`].join(`
181
- `),"Signed in")}catch{q1(`Not signed in. Run ${P.default.cyan("petdex login")}.`),process.exit(1)}}async function DZ($){let Q=$[0];if(!Q)q1(`Usage: ${P.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await a7();U8("cli_install_desktop_success",{cli_version:n$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let V=P1();V.start(`Resolving ${Q}`);let q;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw V.stop(P.default.red("failed")),Error(`manifest fetch ${W.status}`);let Z=(await W.json()).pets.find((H)=>H.slug===Q);if(!Z)V.stop(P.default.red("not found")),q1(`No pet with slug ${P.default.bold(Q)}. Try ${P.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!m$(Z.spritesheetUrl)||!m$(Z.petJsonUrl))V.stop(P.default.red("untrusted asset host")),q1(`Refusing to install ${P.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);q=Z}catch(W){throw V.stop(P.default.red("failed")),W}let Y=Y1.join(DJ(),".petdex","pets",Q),X=Y1.join(DJ(),".codex","pets",Q);V.message(`Downloading ${Q}`),await Promise.all([yJ(Y,{recursive:!0}),yJ(X,{recursive:!0})]);let J=q.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let j=await fetch(W);if(!j.ok)throw Error(`download ${W} → ${j.status} ${j.statusText}`);return j.arrayBuffer()},[U,K]=await Promise.all([G(q.petJsonUrl),G(q.spritesheetUrl)]);await Promise.all([j8(Y1.join(Y,"pet.json"),Buffer.from(U)),j8(Y1.join(Y,`spritesheet.${J}`),Buffer.from(K)),j8(Y1.join(X,"pet.json"),Buffer.from(U)),j8(Y1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),V.stop(`Installed ${P.default.cyan(q.displayName)}`),T1(["Paths:",` ${P.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${P.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${P.default.cyan("Settings → Appearance → Pets")} → select ${P.default.bold(q.displayName)}`].join(`
182
- `),"Next steps")}async function hZ(){let $=P1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(P.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let V=await Q.json();$.stop(`${V.total} pets`);let q=V.pets.map((Y)=>{let X=Y.submittedBy?P.default.dim(` — by ${Y.submittedBy}`):"";return` ${P.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(q.join(`
180
+ `;CZ(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",EZ="https://clerk.petdex.crafter.run",gZ="LcThwEayl6KAA1Qm",yQ=["profile","email","openid","offline_access"];async function kZ(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:yQ};try{let V=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(V.ok){let q=await V.json(),Y=typeof q.issuer==="string"?q.issuer:null,X=typeof q.clientId==="string"?q.clientId:null,J=Array.isArray(q.scopes)?q.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:yQ}}}catch{}return{issuer:$??EZ,clientId:Q??gZ,scopes:yQ}}var z8=null;async function I8(){if(z8)return z8;let $=await kZ();return z8=new J8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),z8}var J$="0.3.0";yZ().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function yZ(){let $=process.argv.slice(2),Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){mJ();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))bJ();switch(Q){case"login":await DZ();break;case"logout":await hZ();break;case"whoami":await bZ();break;case"submit":await mZ($.slice(1));break;case"install":await _Z($.slice(1));break;case"list":await fZ();break;case"hooks":await sZ($.slice(1));break;case"desktop":await QH($.slice(1));break;case"init":await eZ();break;case"up":await nJ();break;case"down":await rJ();break;case"toggle":await $H();break;case"update":await NJ($.slice(1));break;case"doctor":await zJ();break;case"telemetry":VH($.slice(1));break;case"version":case"--version":case"-v":console.log(J$);break;default:console.error(Z.default.red(`Unknown command: ${Q}`)),mJ(),process.exit(1)}}function mJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex"))} ${Q(J$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${Z.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${Z.default.green("(start here)")}`,` ${Z.default.bold("login")} Sign in with Clerk OAuth`,` ${Z.default.bold("logout")} Clear stored credentials`,` ${Z.default.bold("whoami")} Show signed-in user`,` ${Z.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${Z.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${Z.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${Z.default.bold("list")} List approved pets`,` ${Z.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${Z.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${Z.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${Z.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${Z.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${Z.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${Z.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${Z.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${Z.default.underline(M1)}`,""].join(`
181
+ `))}async function DZ(){A1(Z.default.bgMagenta(Z.default.white(" petdex login ")));let $=z1();$.start("Opening your browser to sign in with Clerk");try{let Q=await I8(),{user:V}=await Q.login(),q=oJ(V.email,V.username,V.sub)??"unknown";$.stop(`${Z.default.green("✓ ")}Signed in as ${Z.default.cyan(q)}`),j1(`Try ${Z.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(Z.default.red("× login failed")),Error(iZ(Q.message))}}async function hZ(){await(await I8()).logout(),console.log(`${Z.default.green("✓ ")}Signed out`)}async function bZ(){try{let Q=await(await I8()).whoami();if(!Q)throw Error("not signed in");let V=[L8(Q.given_name),L8(Q.family_name)].filter(Boolean).join(" ");T1([`${Z.default.dim("user: ")}${Q.sub}`,`${Z.default.dim("email: ")}${Q.email??"—"}`,`${Z.default.dim("name: ")}${V||"—"}`,`${Z.default.dim("username:")}${L8(Q.preferred_username)??"—"}`].join(`
182
+ `),"Signed in")}catch{J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1)}}async function _Z($){let Q=$[0];if(!Q)J1(`Usage: ${Z.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await e7();e$("cli_install_desktop_success",{cli_version:J$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let V=z1();V.start(`Resolving ${Q}`);let q;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw V.stop(Z.default.red("failed")),Error(`manifest fetch ${W.status}`);let H=(await W.json()).pets.find((z)=>z.slug===Q);if(!H)V.stop(Z.default.red("not found")),J1(`No pet with slug ${Z.default.bold(Q)}. Try ${Z.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!d$(H.spritesheetUrl)||!d$(H.petJsonUrl))V.stop(Z.default.red("untrusted asset host")),J1(`Refusing to install ${Z.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);q=H}catch(W){throw V.stop(Z.default.red("failed")),W}let Y=X1.join(fJ(),".petdex","pets",Q),X=X1.join(fJ(),".codex","pets",Q);V.message(`Downloading ${Q}`),await Promise.all([_J(Y,{recursive:!0}),_J(X,{recursive:!0})]);let J=q.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let j=await fetch(W);if(!j.ok)throw Error(`download ${W} → ${j.status} ${j.statusText}`);return j.arrayBuffer()},[U,K]=await Promise.all([G(q.petJsonUrl),G(q.spritesheetUrl)]);await Promise.all([H8(X1.join(Y,"pet.json"),Buffer.from(U)),H8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),H8(X1.join(X,"pet.json"),Buffer.from(U)),H8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),V.stop(`Installed ${Z.default.cyan(q.displayName)}`),T1(["Paths:",` ${Z.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${Z.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${Z.default.cyan("Settings → Appearance → Pets")} → select ${Z.default.bold(q.displayName)}`].join(`
183
+ `),"Next steps")}async function fZ(){let $=z1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(Z.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let V=await Q.json();$.stop(`${V.total} pets`);let q=V.pets.map((Y)=>{let X=Y.submittedBy?Z.default.dim(` — by ${Y.submittedBy}`):"";return` ${Z.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(q.join(`
183
184
  `)),console.log(`
184
- ${P.default.dim("Install with")} ${P.default.cyan("petdex install <slug>")}
185
- ${P.default.dim("Browse:")} ${P.default.underline(M1)}`)}async function bZ($){let V=$.filter((L)=>!L.startsWith("--"))[0];if(!V)q1(`Usage: ${P.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await z8(),Y;try{let L=await q.getAccessToken();if(!L)q1(`Not signed in. Run ${P.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{q1(`Not signed in. Run ${P.default.cyan("petdex login")}.`),process.exit(1)}let X=M1;try{X=oZ(await q.whoami())}catch{}let J=Y1.resolve(V),G=await cJ(J).catch(()=>null);if(!G)q1(`No such file or directory: ${V}`),process.exit(1);A1(P.default.bgMagenta(P.default.white(" petdex submit ")));let U=P1();U.start(`Scanning ${J}`);let K=await _Z(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:P.default.red("no pets found")),K.length===0)q1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let j=$.includes("--force")?new Map:await uZ(K,Y),Z=K,H=0;if(j.size>0){let L=K.filter((I)=>j.has(i$(I.petIdHint))),T=K.filter((I)=>!j.has(i$(I.petIdHint)));T1(L.map((I)=>{let R=j.get(i$(I.petIdHint))?.status??"unknown";return`${P.default.yellow("•")} ${P.default.bold(I.label)} ${P.default.dim(`(${R})`)}`}).join(`
186
- `),`${L.length} already submitted by you`);let B=await WV({message:"How should we handle these duplicates?",options:[{value:"skip",label:"Skip duplicates (recommended)"},{value:"resubmit",label:"Submit all anyway (will create -2 / -3 slugs)"},{value:"cancel",label:"Cancel"}],initialValue:"skip"});if(m1(B)||B==="cancel")q1("Aborted."),process.exit(1);if(B==="skip"){if(Z=T,H=L.length,Z.length===0){j1(`Nothing new to submit. Track approval at ${P.default.underline(X)}.`);return}}}if(Z.length>1){let L=await q$({message:`Submit ${P.default.bold(String(Z.length))} pet${Z.length===1?"":"s"}?`});if(m1(L)||!L)q1("Aborted."),process.exit(1)}let C=0,z=0,M=[];for(let L of Z){let T=P1();T.start(`Submitting ${P.default.cyan(L.label)}`);try{let B=await q.getAccessToken();if(!B)throw Error("session expired");Y=B;let I=await mZ(L,Y);X=lZ(I.profileUrl)??X,T.stop(`${P.default.green("✓")} ${P.default.cyan(L.label)} → ${cZ(I)}`),C++}catch(B){let I=B.message;T.stop(`${P.default.red("×")} ${P.default.cyan(L.label)} ${P.default.red(I.slice(0,60))}`),M.push({label:L.label,error:I}),z++}}if(M.length>0)T1(M.map((L)=>`${P.default.red("•")} ${P.default.bold(L.label)}: ${L.error}`).join(`
187
- `),"Failures");let N=H>0?`, ${P.default.yellow(String(H))} skipped`:"";if(j1([`${P.default.green(String(C))} submitted${N}, ${z>0?P.default.red(String(z)):P.default.dim(String(z))} failed.`,`Held submissions stay visible at ${P.default.underline(X)}.`].join(`
188
- `)),z>0)process.exit(1)}async function _Z($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await fZ($);return X?[X]:[]}if(await H8(Y1.join($,"pet.json"))){let X=await bJ($);return X?[X]:[]}let q=await RZ($,{withFileTypes:!0}),Y=[];for(let X of q){if(!X.isDirectory())continue;let J=Y1.join($,X.name),G=await bJ(J);if(G)Y.push(G)}return Y}async function bJ($){let Q=Y1.join($,"pet.json");if(!await H8(Q))return null;let V=Y1.join($,"spritesheet.webp"),q="webp";if(!await H8(V)){let W=Y1.join($,"spritesheet.png");if(!await H8(W))return null;V=W,q="png"}let Y=await kQ(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await kQ(V),G=new yQ.default;G.file("pet.json",Y),G.file(`spritesheet.${q}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=Y1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:q,petIdHint:typeof X.id==="string"?X.id:K}}async function fZ($){let Q=await kQ($),V=await yQ.default.loadAsync(Q),q=V.file("pet.json"),Y=V.file("spritesheet.webp"),X=V.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!q||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await q.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),j=Y1.basename($,".zip");return{label:j,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:Y1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:j}}async function mZ($,Q){let{width:V,height:q}=iZ($.spritesheetBuffer);if(V===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${M1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:i$($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let X=await Y.json(),J=(H)=>{let C=X.files.find((z)=>z.role===H);if(!C)throw Error(`presign response missing ${H}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([gQ(G.uploadUrl,$.zipBuffer,"application/zip"),gQ(U.uploadUrl,$.spritesheetBuffer,W),gQ(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let j=await fetch(`${M1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:_J($.petJsonObj.displayName,"Untitled pet"),description:_J($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:V,spritesheetHeight:q})});if(!j.ok){let H=await j.text().catch(()=>"");throw Error(`register ${j.status} ${H.slice(0,100)}`)}return await j.json()}function cZ($){let Q=P.default.dim($.slug),V=pZ($.review);if($.review.decision==="approved")return`${Q} ${P.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${P.default.red("rejected")}${V?P.default.dim(` — ${V}`):""}`;return`${Q} ${P.default.yellow("held for review")}${V?P.default.dim(` — ${V}`):""}`}function pZ($){let Q=$.reasonCode??"";if(Q.startsWith("duplicate_"))return $.summary??"appears to duplicate an existing pet";if(Q.startsWith("policy_"))return"possible policy issue";if(Q.startsWith("asset_"))return"package file or spritesheet issue";if(Q==="review_timeout")return"automated review timed out";if(Q==="review_error"||Q==="review_failed")return"automated review failed";if($.decision==="rejected")return"high-confidence automated review issue";if($.decision==="hold")return"not confident enough to approve automatically";return null}async function gQ($,Q,V){let q=await fetch($,{method:"PUT",headers:{"Content-Type":V},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function uZ($,Q){let V=new Map;if($.length===0)return V;try{let q=await fetch(`${M1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:i$(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return V;let Y=await q.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")V.set(X.slug,X)}catch{}return V}function dZ($){let Q=$.toLowerCase();if(Q.includes("invalid_client")||Q.includes("client does not exist"))return["Clerk OAuth rejected this CLI build (invalid_client).","This usually means your installed CLI is out of date. Try:"," npm cache clean --force && npx -y petdex@latest login","If it still fails: https://github.com/crafter-station/petdex/issues"].join(`
185
+ ${Z.default.dim("Install with")} ${Z.default.cyan("petdex install <slug>")}
186
+ ${Z.default.dim("Browse:")} ${Z.default.underline(M1)}`)}async function mZ($){let V=$.filter((L)=>!L.startsWith("--"))[0];if(!V)J1(`Usage: ${Z.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await I8(),Y;try{let L=await q.getAccessToken();if(!L)J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1)}let X=M1;try{X=rZ(await q.whoami())}catch{}let J=X1.resolve(V),G=await lJ(J).catch(()=>null);if(!G)J1(`No such file or directory: ${V}`),process.exit(1);A1(Z.default.bgMagenta(Z.default.white(" petdex submit ")));let U=z1();U.start(`Scanning ${J}`);let K=await cZ(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:Z.default.red("no pets found")),K.length===0)J1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let j=$.includes("--force")?new Map:await oZ(K,Y),H=K,z=0;if(j.size>0){let L=K.filter((I)=>j.has($6(I.petIdHint))),T=K.filter((I)=>!j.has($6(I.petIdHint)));T1(L.map((I)=>{let F=j.get($6(I.petIdHint))?.status??"unknown";return`${Z.default.yellow("•")} ${Z.default.bold(I.label)} ${Z.default.dim(`(${F})`)}`}).join(`
187
+ `),`${L.length} already submitted by you`);let O=await ZV({message:"How should we handle these duplicates?",options:[{value:"skip",label:"Skip duplicates (recommended)"},{value:"resubmit",label:"Submit all anyway (will create -2 / -3 slugs)"},{value:"cancel",label:"Cancel"}],initialValue:"skip"});if(m1(O)||O==="cancel")J1("Aborted."),process.exit(1);if(O==="skip"){if(H=T,z=L.length,H.length===0){j1(`Nothing new to submit. Track approval at ${Z.default.underline(X)}.`);return}}}if(H.length>1){let L=await X$({message:`Submit ${Z.default.bold(String(H.length))} pet${H.length===1?"":"s"}?`});if(m1(L)||!L)J1("Aborted."),process.exit(1)}let C=0,P=0,M=[];for(let L of H){let T=z1();T.start(`Submitting ${Z.default.cyan(L.label)}`);try{let O=await q.getAccessToken();if(!O)throw Error("session expired");Y=O;let I=await uZ(L,Y);X=nZ(I.profileUrl)??X,T.stop(`${Z.default.green("✓")} ${Z.default.cyan(L.label)} → ${dZ(I)}`),C++}catch(O){let I=O.message;T.stop(`${Z.default.red("×")} ${Z.default.cyan(L.label)} ${Z.default.red(I.slice(0,60))}`),M.push({label:L.label,error:I}),P++}}if(M.length>0)T1(M.map((L)=>`${Z.default.red("•")} ${Z.default.bold(L.label)}: ${L.error}`).join(`
188
+ `),"Failures");let B=z>0?`, ${Z.default.yellow(String(z))} skipped`:"";if(j1([`${Z.default.green(String(C))} submitted${B}, ${P>0?Z.default.red(String(P)):Z.default.dim(String(P))} failed.`,`Held submissions stay visible at ${Z.default.underline(X)}.`].join(`
189
+ `)),P>0)process.exit(1)}async function cZ($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await pZ($);return X?[X]:[]}if(await P8(X1.join($,"pet.json"))){let X=await cJ($);return X?[X]:[]}let q=await SZ($,{withFileTypes:!0}),Y=[];for(let X of q){if(!X.isDirectory())continue;let J=X1.join($,X.name),G=await cJ(J);if(G)Y.push(G)}return Y}async function cJ($){let Q=X1.join($,"pet.json");if(!await P8(Q))return null;let V=X1.join($,"spritesheet.webp"),q="webp";if(!await P8(V)){let W=X1.join($,"spritesheet.png");if(!await P8(W))return null;V=W,q="png"}let Y=await hQ(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await hQ(V),G=new bQ.default;G.file("pet.json",Y),G.file(`spritesheet.${q}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=X1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:q,petIdHint:typeof X.id==="string"?X.id:K}}async function pZ($){let Q=await hQ($),V=await bQ.default.loadAsync(Q),q=V.file("pet.json"),Y=V.file("spritesheet.webp"),X=V.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!q||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await q.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),j=X1.basename($,".zip");return{label:j,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:X1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:j}}async function uZ($,Q){let{width:V,height:q}=aZ($.spritesheetBuffer);if(V===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${M1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:$6($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let z=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${z.slice(0,100)}`)}let X=await Y.json(),J=(z)=>{let C=X.files.find((P)=>P.role===z);if(!C)throw Error(`presign response missing ${z}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([DQ(G.uploadUrl,$.zipBuffer,"application/zip"),DQ(U.uploadUrl,$.spritesheetBuffer,W),DQ(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let j=await fetch(`${M1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:pJ($.petJsonObj.displayName,"Untitled pet"),description:pJ($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:V,spritesheetHeight:q})});if(!j.ok){let z=await j.text().catch(()=>"");throw Error(`register ${j.status} ${z.slice(0,100)}`)}return await j.json()}function dZ($){let Q=Z.default.dim($.slug),V=lZ($.review);if($.review.decision==="approved")return`${Q} ${Z.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${Z.default.red("rejected")}${V?Z.default.dim(` — ${V}`):""}`;return`${Q} ${Z.default.yellow("held for review")}${V?Z.default.dim(` — ${V}`):""}`}function lZ($){let Q=$.reasonCode??"";if(Q.startsWith("duplicate_"))return $.summary??"appears to duplicate an existing pet";if(Q.startsWith("policy_"))return"possible policy issue";if(Q.startsWith("asset_"))return"package file or spritesheet issue";if(Q==="review_timeout")return"automated review timed out";if(Q==="review_error"||Q==="review_failed")return"automated review failed";if($.decision==="rejected")return"high-confidence automated review issue";if($.decision==="hold")return"not confident enough to approve automatically";return null}async function DQ($,Q,V){let q=await fetch($,{method:"PUT",headers:{"Content-Type":V},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function oZ($,Q){let V=new Map;if($.length===0)return V;try{let q=await fetch(`${M1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:$6(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return V;let Y=await q.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")V.set(X.slug,X)}catch{}return V}function iZ($){let Q=$.toLowerCase();if(Q.includes("invalid_client")||Q.includes("client does not exist"))return["Clerk OAuth rejected this CLI build (invalid_client).","This usually means your installed CLI is out of date. Try:"," npm cache clean --force && npx -y petdex@latest login","If it still fails: https://github.com/crafter-station/petdex/issues"].join(`
189
190
  `);if(Q.includes("invalid_grant")||Q.includes("does not match the redirect"))return["OAuth callback was rejected by Clerk (invalid_grant).","Common cause: you closed the browser before approving, or the local","callback server timed out. Try `petdex login` again."].join(`
190
191
  `);if(Q.includes("redirect_uri")&&Q.includes("pre-registered"))return["Clerk OAuth rejected the local callback URL.","The petdex OAuth Application needs http://127.0.0.1 in its allowed","redirect URLs. Please file an issue:"," https://github.com/crafter-station/petdex/issues"].join(`
191
- `);return $}async function H8($){try{return await cJ($),!0}catch{return!1}}function _J($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function P8($){return typeof $==="string"&&$.trim()?$.trim():null}function pJ(...$){for(let Q of $){let V=P8(Q);if(V)return V}return null}function uJ($){let Q=M1.replace(/\/+$/,""),V=$.startsWith("/")?$:`/${$}`;return`${Q}${V}`}function lZ($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return uJ($)}function oZ($){let Q=pJ($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?uJ(`/u/${encodeURIComponent(Q.toLowerCase())}`):M1}function i$($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function iZ($){if($.length>24&&$[0]===137&&$[1]===80&&$[2]===78&&$[3]===71)return{width:$.readUInt32BE(16),height:$.readUInt32BE(20)};if($.length>30&&$.slice(0,4).toString()==="RIFF"&&$.slice(8,12).toString()==="WEBP"){let Q=$.slice(12,16).toString();if(Q==="VP8X")return{width:(($[24]|$[25]<<8|$[26]<<16)>>>0)+1,height:(($[27]|$[28]<<8|$[29]<<16)>>>0)+1};if(Q==="VP8L"){let V=$[22],q=$[23],Y=$[24];return{width:(($[21]|(V&63)<<8)>>>0)+1,height:((V>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let V=23;V<Math.min(60,$.length-7);V++)if($[V]===157&&$[V+1]===1&&$[V+2]===42)return{width:($[V+3]|$[V+4]<<8)&16383,height:($[V+5]|$[V+6]<<8)&16383}}}return{width:0,height:0}}async function nZ($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){fJ();return}switch(Q){case"install":{let{installedAgents:V}=await MJ();if(V.length>0)U8("cli_hooks_install_success",{cli_version:n$,agents:V});break}case"toggle":case"on":case"off":case"status":{rZ(Q);break}case"uninstall":{let V=$.includes("--remove-token");await FJ({removeToken:V});break}default:console.error(P.default.red(`Unknown hooks command: ${Q}`)),fJ(),process.exit(1)}}function rZ($){let Q;if($==="toggle")Q=KJ();else if($==="on")Q=Q$("on");else if($==="off")Q=Q$("off");else Q=$$();if(Q==="on")console.log(`${P.default.green("●")} Petdex hooks are ${P.default.bold("ENABLED")}`),console.log(P.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${P.default.yellow("○")} Petdex hooks are ${P.default.bold("DISABLED")}`),console.log(P.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function dJ(){Q$("on"),console.log(`${P.default.green("●")} Hooks ${P.default.bold("ENABLED")}`);let $=x1();if($.state==="running"){console.log(`${P.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await C0();if(Q.ok)console.log(Q.alreadyRunning?`${P.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${P.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${P.default.yellow("!")} ${Q.reason}`),console.log(P.default.dim(` Install the binary first: ${P.default.cyan("petdex install desktop")}`))}async function aZ(){let $=$$()==="on",Q=x1().state==="running";if($&&Q)await lJ();else await dJ()}async function lJ(){if(Q$("off"),console.log(`${P.default.yellow("○")} Hooks ${P.default.bold("DISABLED")}`),x1().state==="stopped"){console.log(`${P.default.dim("•")} Desktop wasn't running`);return}let Q=await p$();if(Q.ok)console.log(`${P.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${P.default.dim("•")} ${Q.reason}`)}function fJ(){let $=P.default.cyan,Q=P.default.dim;console.log(["",` ${P.default.bold(P.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${P.default.bold("install")} Wire petdex into your coding agents`,` ${P.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${P.default.bold("toggle")} Flip the killswitch — disable/enable hooks without restarting agents`,` ${P.default.bold("on")} Enable hooks (clears the killswitch)`,` ${P.default.bold("off")} Disable hooks (sets the killswitch — agent tool calls become no-ops)`,` ${P.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
192
- `))}async function sZ($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){mJ();return}switch(Q){case"start":await qJ(),U8("cli_desktop_start_success",{cli_version:n$});break;case"stop":await JJ();break;case"status":YJ();break;default:console.error(P.default.red(`Unknown desktop command: ${Q}`)),mJ(),process.exit(1)}}function mJ(){let $=P.default.cyan,Q=P.default.dim;console.log(["",` ${P.default.bold(P.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${P.default.bold("start")} Launch petdex-desktop in the background`,` ${P.default.bold("stop")} Terminate the running petdex-desktop process`,` ${P.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
193
- `))}function tZ($){let Q=$[0];if(Q==="on"||Q==="off"){let V=Q==="on";if(EJ(V))console.log(V?"Telemetry enabled":"Telemetry disabled");else console.error(P.default.red(`${P.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let V=gJ();if(console.log(`Status: ${V.enabled?"enabled":"disabled"}`),V.install_id)console.log(`Install ID: ${V.install_id}`)}else console.error(P.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
192
+ `);return $}async function P8($){try{return await lJ($),!0}catch{return!1}}function pJ($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function L8($){return typeof $==="string"&&$.trim()?$.trim():null}function oJ(...$){for(let Q of $){let V=L8(Q);if(V)return V}return null}function iJ($){let Q=M1.replace(/\/+$/,""),V=$.startsWith("/")?$:`/${$}`;return`${Q}${V}`}function nZ($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return iJ($)}function rZ($){let Q=oJ($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?iJ(`/u/${encodeURIComponent(Q.toLowerCase())}`):M1}function $6($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function aZ($){if($.length>24&&$[0]===137&&$[1]===80&&$[2]===78&&$[3]===71)return{width:$.readUInt32BE(16),height:$.readUInt32BE(20)};if($.length>30&&$.slice(0,4).toString()==="RIFF"&&$.slice(8,12).toString()==="WEBP"){let Q=$.slice(12,16).toString();if(Q==="VP8X")return{width:(($[24]|$[25]<<8|$[26]<<16)>>>0)+1,height:(($[27]|$[28]<<8|$[29]<<16)>>>0)+1};if(Q==="VP8L"){let V=$[22],q=$[23],Y=$[24];return{width:(($[21]|(V&63)<<8)>>>0)+1,height:((V>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let V=23;V<Math.min(60,$.length-7);V++)if($[V]===157&&$[V+1]===1&&$[V+2]===42)return{width:($[V+3]|$[V+4]<<8)&16383,height:($[V+5]|$[V+6]<<8)&16383}}}return{width:0,height:0}}async function sZ($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){uJ();return}switch(Q){case"install":{let{installedAgents:V}=await gQ();if(V.length>0)e$("cli_hooks_install_success",{cli_version:J$,agents:V});break}case"toggle":case"on":case"off":case"status":{tZ(Q);break}case"uninstall":{let V=$.includes("--remove-token");await SJ({removeToken:V});break}default:console.error(Z.default.red(`Unknown hooks command: ${Q}`)),uJ(),process.exit(1)}}function tZ($){let Q;if($==="toggle")Q=HJ();else if($==="on")Q=q$("on");else if($==="off")Q=q$("off");else Q=V$();if(Q==="on")console.log(`${Z.default.green("●")} Petdex hooks are ${Z.default.bold("ENABLED")}`),console.log(Z.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${Z.default.yellow("○")} Petdex hooks are ${Z.default.bold("DISABLED")}`),console.log(Z.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function eZ(){let{installedAgents:$}=await gQ();if($.length>0)e$("cli_hooks_install_success",{cli_version:J$,agents:$}),console.log(""),console.log(`${Z.default.green("✓")} ${Z.default.bold("All set.")} Open your agent and run ${Z.default.cyan("/petdex")} to wake the mascot.`),console.log(Z.default.dim(` Or from a shell: ${Z.default.cyan("petdex up")} (force-wake) · ${Z.default.cyan("petdex toggle")} (smart wake/sleep)`))}async function nJ(){q$("on"),console.log(`${Z.default.green("●")} Hooks ${Z.default.bold("ENABLED")}`);let $=x1();if($.state==="running"){console.log(`${Z.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await w0();if(Q.ok)console.log(Q.alreadyRunning?`${Z.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${Z.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${Z.default.yellow("!")} ${Q.reason}`),console.log(Z.default.dim(` Install the binary first: ${Z.default.cyan("petdex install desktop")}`))}async function $H(){let $=V$()==="on",Q=x1().state==="running";if($&&Q)await rJ();else await nJ()}async function rJ(){if(q$("off"),console.log(`${Z.default.yellow("○")} Hooks ${Z.default.bold("DISABLED")}`),x1().state==="stopped"){console.log(`${Z.default.dim("•")} Desktop wasn't running`);return}let Q=await n$();if(Q.ok)console.log(`${Z.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${Z.default.dim("•")} ${Q.reason}`)}function uJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${Z.default.bold("install")} Wire petdex into your coding agents`,` ${Z.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${Z.default.bold("toggle")} Flip the killswitch — disable/enable hooks without restarting agents`,` ${Z.default.bold("on")} Enable hooks (clears the killswitch)`,` ${Z.default.bold("off")} Disable hooks (sets the killswitch — agent tool calls become no-ops)`,` ${Z.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
193
+ `))}async function QH($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){dJ();return}switch(Q){case"start":await KJ(),e$("cli_desktop_start_success",{cli_version:J$});break;case"stop":await WJ();break;case"status":UJ();break;default:console.error(Z.default.red(`Unknown desktop command: ${Q}`)),dJ(),process.exit(1)}}function dJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${Z.default.bold("start")} Launch petdex-desktop in the background`,` ${Z.default.bold("stop")} Terminate the running petdex-desktop process`,` ${Z.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
194
+ `))}function VH($){let Q=$[0];if(Q==="on"||Q==="off"){let V=Q==="on";if(DJ(V))console.log(V?"Telemetry enabled":"Telemetry disabled");else console.error(Z.default.red(`${Z.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let V=hJ();if(console.log(`Status: ${V.enabled?"enabled":"disabled"}`),V.install_id)console.log(`Install ID: ${V.install_id}`)}else console.error(Z.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}