petdex 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/petdex.js +74 -80
- package/package.json +1 -1
package/dist/petdex.js
CHANGED
|
@@ -1,96 +1,90 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as yq}from"node:module";var Cq=Object.create;var{getPrototypeOf:Aq,defineProperty:c6,getOwnPropertyNames:Rq}=Object;var kq=Object.prototype.hasOwnProperty;function Eq($){return this[$]}var gq,xq,_1=($,Q,J)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?gq??=new WeakMap:xq??=new WeakMap,G=Y.get($);if(G)return G}J=$!=null?Cq(Aq($)):{};let V=Q||!$||!$.__esModule?c6(J,"default",{value:$,enumerable:!0}):J;for(let X of Rq($))if(!kq.call(V,X))c6(V,X,{get:Eq.bind($,X),enumerable:!0});if(q)Y.set($,V);return V};var D=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var Sq=($)=>$;function Tq($,Q){this[$]=Sq.bind(null,Q)}var W4=($,Q)=>{for(var J in Q)c6($,J,{get:Q[J],enumerable:!0,configurable:!0,set:Tq.bind(Q,J)})};var j4=($,Q)=>()=>($&&(Q=$($=0)),Q);var z0=yq(import.meta.url);var o6=D((CF,C4)=>{var l6={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(Q<0)J+=`\x1B[${-Q}A`;else if(Q>0)J+=`\x1B[${Q}B`;return J},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"},rq={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},aq={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 J=0;J<$;J++)Q+=this.line+(J<$-1?l6.up():"");if($)Q+=l6.left;return Q}};C4.exports={cursor:l6,scroll:rq,erase:aq,beep:"\x07"}});var o1=D((YH,G$)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)G$.exports={nextTick:vY};else G$.exports=process;function vY($,Q,J,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,G,V;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,J)});case 4:return process.nextTick(function(){$.call(null,Q,J,q)});default:G=Array(Y-1),V=0;while(V<G.length)G[V++]=arguments[V];return process.nextTick(function(){$.apply(null,G)})}}});var d4=D((GH,u4)=>{var CY={}.toString;u4.exports=Array.isArray||function($){return CY.call($)=="[object Array]"}});var i1=D((V$,o4)=>{var b8=z0("buffer"),g0=b8.Buffer;function l4($,Q){for(var J in $)Q[J]=$[J]}if(g0.from&&g0.alloc&&g0.allocUnsafe&&g0.allocUnsafeSlow)o4.exports=b8;else l4(b8,V$),V$.Buffer=H1;function H1($,Q,J){return g0($,Q,J)}l4(g0,H1);H1.from=function($,Q,J){if(typeof $==="number")throw TypeError("Argument must not be a number");return g0($,Q,J)};H1.alloc=function($,Q,J){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=g0($);if(Q!==void 0)if(typeof J==="string")q.fill(Q,J);else q.fill(Q);else q.fill(0);return q};H1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return g0($)};H1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return b8.SlowBuffer($)}});var P1=D((cY)=>{function AY($){if(Array.isArray)return Array.isArray($);return _8($)==="[object Array]"}cY.isArray=AY;function RY($){return typeof $==="boolean"}cY.isBoolean=RY;function kY($){return $===null}cY.isNull=kY;function EY($){return $==null}cY.isNullOrUndefined=EY;function gY($){return typeof $==="number"}cY.isNumber=gY;function xY($){return typeof $==="string"}cY.isString=xY;function SY($){return typeof $==="symbol"}cY.isSymbol=SY;function TY($){return $===void 0}cY.isUndefined=TY;function yY($){return _8($)==="[object RegExp]"}cY.isRegExp=yY;function hY($){return typeof $==="object"&&$!==null}cY.isObject=hY;function fY($){return _8($)==="[object Date]"}cY.isDate=fY;function bY($){return _8($)==="[object Error]"||$ instanceof Error}cY.isError=bY;function _Y($){return typeof $==="function"}cY.isFunction=_Y;function mY($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}cY.isPrimitive=mY;cY.isBuffer=z0("buffer").Buffer.isBuffer;function _8($){return Object.prototype.toString.call($)}});var i4=D((XH,X$)=>{if(typeof Object.create==="function")X$.exports=function(Q,J){if(J)Q.super_=J,Q.prototype=Object.create(J.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else X$.exports=function(Q,J){if(J){Q.super_=J;var q=function(){};q.prototype=J.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var Z1=D((KH,K$)=>{try{if(m8=z0("util"),typeof m8.inherits!=="function")throw"";K$.exports=m8.inherits}catch($){K$.exports=i4()}var m8});var r4=D((UH,U$)=>{function q9($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var n4=i1().Buffer,n1=z0("util");function Y9($,Q,J){$.copy(Q,J)}U$.exports=function(){function $(){q9(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(J){var q={data:J,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(J){var q={data:J,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var J=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,J},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(J){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=J+q.data;return Y},$.prototype.concat=function(J){if(this.length===0)return n4.alloc(0);var q=n4.allocUnsafe(J>>>0),Y=this.head,G=0;while(Y)Y9(Y.data,q,G),G+=Y.data.length,Y=Y.next;return q},$}();if(n1&&n1.inspect&&n1.inspect.custom)U$.exports.prototype[n1.inspect.custom]=function(){var $=n1.inspect({length:this.length});return this.constructor.name+" "+$}});var W$=D((WH,a4)=>{var c8=o1();function G9($,Q){var J=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)c8.nextTick(p8,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,c8.nextTick(p8,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(G){if(!Q&&G){if(!J._writableState)c8.nextTick(p8,J,G);else if(!J._writableState.errorEmitted)J._writableState.errorEmitted=!0,c8.nextTick(p8,J,G)}else if(Q)Q(G)}),this}function V9(){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 p8($,Q){$.emit("error",Q)}a4.exports={destroy:G9,undestroy:V9}});var t4=D((jH,s4)=>{s4.exports=z0("util").deprecate});var F$=D((FH,V5)=>{var t0=o1();V5.exports=d;function $5($){var Q=this;this.next=null,this.entry=null,this.finish=function(){D9(Q,$)}}var X9=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t0.nextTick,z1;d.WritableState=a1;var Q5=Object.create(P1());Q5.inherits=Z1();var K9={deprecate:t4()},J5=z0("stream"),d8=i1().Buffer,U9=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function W9($){return d8.from($)}function j9($){return d8.isBuffer($)||$ instanceof U9}var q5=W$();Q5.inherits(d,J5);function F9(){}function a1($,Q){z1=z1||e0(),$=$||{};var J=Q instanceof z1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;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 V=$.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(X){I9(Q,X)},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 $5(this)}a1.prototype.getBuffer=function(){var Q=this.bufferedRequest,J=[];while(Q)J.push(Q),Q=Q.next;return J};(function(){try{Object.defineProperty(a1.prototype,"buffer",{get:K9.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var u8;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")u8=Function.prototype[Symbol.hasInstance],Object.defineProperty(d,Symbol.hasInstance,{value:function($){if(u8.call(this,$))return!0;if(this!==d)return!1;return $&&$._writableState instanceof a1}});else u8=function($){return $ instanceof this};function d($){if(z1=z1||e0(),!u8.call(d,this)&&!(this instanceof z1))return new d($);if(this._writableState=new a1($,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}J5.call(this)}d.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function H9($,Q){var J=Error("write after end");$.emit("error",J),t0.nextTick(Q,J)}function P9($,Q,J,q){var Y=!0,G=!1;if(J===null)G=TypeError("May not write null values to stream");else if(typeof J!=="string"&&J!==void 0&&!Q.objectMode)G=TypeError("Invalid non-string/buffer chunk");if(G)$.emit("error",G),t0.nextTick(q,G),Y=!1;return Y}d.prototype.write=function($,Q,J){var q=this._writableState,Y=!1,G=!q.objectMode&&j9($);if(G&&!d8.isBuffer($))$=W9($);if(typeof Q==="function")J=Q,Q=null;if(G)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof J!=="function")J=F9;if(q.ended)H9(this,J);else if(G||P9(this,q,$,J))q.pendingcb++,Y=z9(this,q,G,$,Q,J);return Y};d.prototype.cork=function(){var $=this._writableState;$.corked++};d.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)Y5(this,$)}};d.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 Z9($,Q,J){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=d8.from(Q,J);return Q}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function z9($,Q,J,q,Y,G){if(!J){var V=Z9(Q,q,Y);if(q!==V)J=!0,Y="buffer",q=V}var X=Q.objectMode?1:q.length;Q.length+=X;var W=Q.length<Q.highWaterMark;if(!W)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:J,callback:G,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else j$($,Q,!1,X,q,Y,G);return W}function j$($,Q,J,q,Y,G,V){if(Q.writelen=q,Q.writecb=V,Q.writing=!0,Q.sync=!0,J)$._writev(Y,Q.onwrite);else $._write(Y,G,Q.onwrite);Q.sync=!1}function L9($,Q,J,q,Y){if(--Q.pendingcb,J)t0.nextTick(Y,q),t0.nextTick(r1,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),r1($,Q)}function M9($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function I9($,Q){var J=$._writableState,q=J.sync,Y=J.writecb;if(M9(J),Q)L9($,J,q,Q,Y);else{var G=G5(J);if(!G&&!J.corked&&!J.bufferProcessing&&J.bufferedRequest)Y5($,J);if(q)X9(e4,$,J,G,Y);else e4($,J,G,Y)}}function e4($,Q,J,q){if(!J)N9($,Q);Q.pendingcb--,q(),r1($,Q)}function N9($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function Y5($,Q){Q.bufferProcessing=!0;var J=Q.bufferedRequest;if($._writev&&J&&J.next){var q=Q.bufferedRequestCount,Y=Array(q),G=Q.corkedRequestsFree;G.entry=J;var V=0,X=!0;while(J){if(Y[V]=J,!J.isBuf)X=!1;J=J.next,V+=1}if(Y.allBuffers=X,j$($,Q,!0,Q.length,Y,"",G.finish),Q.pendingcb++,Q.lastBufferedRequest=null,G.next)Q.corkedRequestsFree=G.next,G.next=null;else Q.corkedRequestsFree=new $5(Q);Q.bufferedRequestCount=0}else{while(J){var{chunk:W,encoding:K,callback:U}=J,F=Q.objectMode?1:W.length;if(j$($,Q,!1,F,W,K,U),J=J.next,Q.bufferedRequestCount--,Q.writing)break}if(J===null)Q.lastBufferedRequest=null}Q.bufferedRequest=J,Q.bufferProcessing=!1}d.prototype._write=function($,Q,J){J(Error("_write() is not implemented"))};d.prototype._writev=null;d.prototype.end=function($,Q,J){var q=this._writableState;if(typeof $==="function")J=$,$=null,Q=null;else if(typeof Q==="function")J=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)B9(this,q,J)};function G5($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function w9($,Q){$._final(function(J){if(Q.pendingcb--,J)$.emit("error",J);Q.prefinished=!0,$.emit("prefinish"),r1($,Q)})}function O9($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,t0.nextTick(w9,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function r1($,Q){var J=G5(Q);if(J){if(O9($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return J}function B9($,Q,J){if(Q.ending=!0,r1($,Q),J)if(Q.finished)t0.nextTick(J);else $.once("finish",J);Q.ended=!0,$.writable=!1}function D9($,Q,J){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(J),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(d.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});d.prototype.destroy=q5.destroy;d.prototype._undestroy=q5.undestroy;d.prototype._destroy=function($,Q){this.end(),Q($)}});var e0=D((HH,W5)=>{var X5=o1(),v9=Object.keys||function($){var Q=[];for(var J in $)Q.push(J);return Q};W5.exports=x0;var K5=Object.create(P1());K5.inherits=Z1();var U5=P$(),H$=F$();K5.inherits(x0,U5);{l8=v9(H$.prototype);for(s1=0;s1<l8.length;s1++)if(t1=l8[s1],!x0.prototype[t1])x0.prototype[t1]=H$.prototype[t1]}var l8,t1,s1;function x0($){if(!(this instanceof x0))return new x0($);if(U5.call(this,$),H$.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",C9)}Object.defineProperty(x0.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C9(){if(this.allowHalfOpen||this._writableState.ended)return;X5.nextTick(A9,this)}function A9($){$.end()}Object.defineProperty(x0.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=$}});x0.prototype._destroy=function($,Q){this.push(null),this.end(),X5.nextTick(Q,$)}});var L$=D((c9)=>{var z$=i1().Buffer,j5=z$.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 R9($){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 k9($){var Q=R9($);if(typeof Q!=="string"&&(z$.isEncoding===j5||!j5($)))throw Error("Unknown encoding: "+$);return Q||$}c9.StringDecoder=e1;function e1($){this.encoding=k9($);var Q;switch(this.encoding){case"utf16le":this.text=y9,this.end=h9,Q=4;break;case"utf8":this.fillLast=x9,Q=4;break;case"base64":this.text=f9,this.end=b9,Q=3;break;default:this.write=_9,this.end=m9;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=z$.allocUnsafe(Q)}e1.prototype.write=function($){if($.length===0)return"";var Q,J;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;if(J<$.length)return Q?Q+this.text($,J):this.text($,J);return Q||""};e1.prototype.end=T9;e1.prototype.text=S9;e1.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 Z$($){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 E9($,Q,J){var q=Q.length-1;if(q<J)return 0;var Y=Z$(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<J||Y===-2)return 0;if(Y=Z$(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<J||Y===-2)return 0;if(Y=Z$(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function g9($,Q,J){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 x9($){var Q=this.lastTotal-this.lastNeed,J=g9(this,$,Q);if(J!==void 0)return J;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 S9($,Q){var J=E9(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=J;var q=$.length-(J-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function T9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function y9($,Q){if(($.length-Q)%2===0){var J=$.toString("utf16le",Q);if(J){var q=J.charCodeAt(J.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function h9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,J)}return Q}function f9($,Q){var J=($.length-Q)%3;if(J===0)return $.toString("base64",Q);if(this.lastNeed=3-J,this.lastTotal=3,J===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-J)}function b9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function _9($){return $.toString(this.encoding)}function m9($){return $&&$.length?this.write($):""}});var P$=D((zH,B5)=>{var M1=o1();B5.exports=b;var u9=d4(),$8;b.ReadableState=M5;var ZH=z0("events").EventEmitter,Z5=function($,Q){return $.listeners(Q).length},O$=z0("stream"),Q8=i1().Buffer,d9=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l9($){return Q8.from($)}function o9($){return Q8.isBuffer($)||$ instanceof d9}var z5=Object.create(P1());z5.inherits=Z1();var M$=z0("util"),S=void 0;if(M$&&M$.debuglog)S=M$.debuglog("stream");else S=function(){};var i9=r4(),L5=W$(),L1;z5.inherits(b,O$);var I$=["error","close","destroy","pause","resume"];function n9($,Q,J){if(typeof $.prependListener==="function")return $.prependListener(Q,J);if(!$._events||!$._events[Q])$.on(Q,J);else if(u9($._events[Q]))$._events[Q].unshift(J);else $._events[Q]=[J,$._events[Q]]}function M5($,Q){$8=$8||e0(),$=$||{};var J=Q instanceof $8;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new i9,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(!L1)L1=L$().StringDecoder;this.decoder=new L1($.encoding),this.encoding=$.encoding}}function b($){if($8=$8||e0(),!(this instanceof b))return new b($);if(this._readableState=new M5($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}O$.call(this)}Object.defineProperty(b.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});b.prototype.destroy=L5.destroy;b.prototype._undestroy=L5.undestroy;b.prototype._destroy=function($,Q){this.push(null),Q($)};b.prototype.push=function($,Q){var J=this._readableState,q;if(!J.objectMode){if(typeof $==="string"){if(Q=Q||J.defaultEncoding,Q!==J.encoding)$=Q8.from($,Q),Q="";q=!0}}else q=!0;return I5(this,$,Q,!1,q)};b.prototype.unshift=function($){return I5(this,$,null,!0,!1)};function I5($,Q,J,q,Y){var G=$._readableState;if(Q===null)G.reading=!1,t9($,G);else{var V;if(!Y)V=r9(G,Q);if(V)$.emit("error",V);else if(G.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!G.objectMode&&Object.getPrototypeOf(Q)!==Q8.prototype)Q=l9(Q);if(q)if(G.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else N$($,G,Q,!0);else if(G.ended)$.emit("error",Error("stream.push() after EOF"));else if(G.reading=!1,G.decoder&&!J)if(Q=G.decoder.write(Q),G.objectMode||Q.length!==0)N$($,G,Q,!1);else N5($,G);else N$($,G,Q,!1)}else if(!q)G.reading=!1}return a9(G)}function N$($,Q,J,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",J),$.read(0);else{if(Q.length+=Q.objectMode?1:J.length,q)Q.buffer.unshift(J);else Q.buffer.push(J);if(Q.needReadable)o8($)}N5($,Q)}function r9($,Q){var J;if(!o9(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)J=TypeError("Invalid non-string/buffer chunk");return J}function a9($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}b.prototype.isPaused=function(){return this._readableState.flowing===!1};b.prototype.setEncoding=function($){if(!L1)L1=L$().StringDecoder;return this._readableState.decoder=new L1($),this._readableState.encoding=$,this};var F5=8388608;function s9($){if($>=F5)$=F5;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function H5($,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=s9($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}b.prototype.read=function($){S("read",$),$=parseInt($,10);var Q=this._readableState,J=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(S("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)w$(this);else o8(this);return null}if($=H5($,Q),$===0&&Q.ended){if(Q.length===0)w$(this);return null}var q=Q.needReadable;if(S("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,S("length less than watermark",q);if(Q.ended||Q.reading)q=!1,S("reading or ended",q);else if(q){if(S("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=H5(J,Q)}var Y;if($>0)Y=w5($,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(J!==$&&Q.ended)w$(this)}if(Y!==null)this.emit("data",Y);return Y};function t9($,Q){if(Q.ended)return;if(Q.decoder){var J=Q.decoder.end();if(J&&J.length)Q.buffer.push(J),Q.length+=Q.objectMode?1:J.length}Q.ended=!0,o8($)}function o8($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(S("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)M1.nextTick(P5,$);else P5($)}function P5($){S("emit readable"),$.emit("readable"),B$($)}function N5($,Q){if(!Q.readingMore)Q.readingMore=!0,M1.nextTick(e9,$,Q)}function e9($,Q){var J=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(S("maybeReadMore read 0"),$.read(0),J===Q.length)break;else J=Q.length;Q.readingMore=!1}b.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};b.prototype.pipe=function($,Q){var J=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,S("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,G=Y?X:w;if(q.endEmitted)M1.nextTick(G);else J.once("end",G);$.on("unpipe",V);function V(N,P){if(S("onunpipe"),N===J){if(P&&P.hasUnpiped===!1)P.hasUnpiped=!0,U()}}function X(){S("onend"),$.end()}var W=$G(J);$.on("drain",W);var K=!1;function U(){if(S("cleanup"),$.removeListener("close",Z),$.removeListener("finish",z),$.removeListener("drain",W),$.removeListener("error",H),$.removeListener("unpipe",V),J.removeListener("end",X),J.removeListener("end",w),J.removeListener("data",j),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))W()}var F=!1;J.on("data",j);function j(N){S("ondata"),F=!1;var P=$.write(N);if(P===!1&&!F){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&O5(q.pipes,$)!==-1)&&!K)S("false write response, pause",q.awaitDrain),q.awaitDrain++,F=!0;J.pause()}}function H(N){if(S("onerror",N),w(),$.removeListener("error",H),Z5($,"error")===0)$.emit("error",N)}n9($,"error",H);function Z(){$.removeListener("finish",z),w()}$.once("close",Z);function z(){S("onfinish"),$.removeListener("close",Z),w()}$.once("finish",z);function w(){S("unpipe"),J.unpipe($)}if($.emit("pipe",J),!q.flowing)S("pipe resume"),J.resume();return $};function $G($){return function(){var Q=$._readableState;if(S("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&Z5($,"data"))Q.flowing=!0,B$($)}}b.prototype.unpipe=function($){var Q=this._readableState,J={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,J);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var G=0;G<Y;G++)q[G].emit("unpipe",this,{hasUnpiped:!1});return this}var V=O5(Q.pipes,$);if(V===-1)return this;if(Q.pipes.splice(V,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,J),this};b.prototype.on=function($,Q){var J=O$.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)M1.nextTick(QG,this);else if(q.length)o8(this)}}return J};b.prototype.addListener=b.prototype.on;function QG($){S("readable nexttick read 0"),$.read(0)}b.prototype.resume=function(){var $=this._readableState;if(!$.flowing)S("resume"),$.flowing=!0,JG(this,$);return this};function JG($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,M1.nextTick(qG,$,Q)}function qG($,Q){if(!Q.reading)S("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),B$($),Q.flowing&&!Q.reading)$.read(0)}b.prototype.pause=function(){if(S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)S("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function B$($){var Q=$._readableState;S("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}b.prototype.wrap=function($){var Q=this,J=this._readableState,q=!1;$.on("end",function(){if(S("wrapped end"),J.decoder&&!J.ended){var V=J.decoder.end();if(V&&V.length)Q.push(V)}Q.push(null)}),$.on("data",function(V){if(S("wrapped data"),J.decoder)V=J.decoder.write(V);if(J.objectMode&&(V===null||V===void 0))return;else if(!J.objectMode&&(!V||!V.length))return;var X=Q.push(V);if(!X)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(V){return function(){return $[V].apply($,arguments)}}(Y);for(var G=0;G<I$.length;G++)$.on(I$[G],this.emit.bind(this,I$[G]));return this._read=function(V){if(S("wrapped _read",V),q)q=!1,$.resume()},this};Object.defineProperty(b.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});b._fromList=w5;function w5($,Q){if(Q.length===0)return null;var J;if(Q.objectMode)J=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)J=Q.buffer.join("");else if(Q.buffer.length===1)J=Q.buffer.head.data;else J=Q.buffer.concat(Q.length);Q.buffer.clear()}else J=YG($,Q.buffer,Q.decoder);return J}function YG($,Q,J){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=J?GG($,Q):VG($,Q);return q}function GG($,Q){var J=Q.head,q=1,Y=J.data;$-=Y.length;while(J=J.next){var G=J.data,V=$>G.length?G.length:$;if(V===G.length)Y+=G;else Y+=G.slice(0,$);if($-=V,$===0){if(V===G.length)if(++q,J.next)Q.head=J.next;else Q.head=Q.tail=null;else Q.head=J,J.data=G.slice(V);break}++q}return Q.length-=q,Y}function VG($,Q){var J=Q8.allocUnsafe($),q=Q.head,Y=1;q.data.copy(J),$-=q.data.length;while(q=q.next){var G=q.data,V=$>G.length?G.length:$;if(G.copy(J,J.length-$,0,V),$-=V,$===0){if(V===G.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=G.slice(V);break}++Y}return Q.length-=Y,J}function w$($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,M1.nextTick(XG,Q,$)}function XG($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function O5($,Q){for(var J=0,q=$.length;J<q;J++)if($[J]===Q)return J;return-1}});var D$=D((LH,C5)=>{C5.exports=S0;var i8=e0(),v5=Object.create(P1());v5.inherits=Z1();v5.inherits(S0,i8);function KG($,Q){var J=this._transformState;J.transforming=!1;var q=J.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(J.writechunk=null,J.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 S0($){if(!(this instanceof S0))return new S0($);if(i8.call(this,$),this._transformState={afterTransform:KG.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",UG)}function UG(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,J){D5($,Q,J)});else D5(this,null,null)}S0.prototype.push=function($,Q){return this._transformState.needTransform=!1,i8.prototype.push.call(this,$,Q)};S0.prototype._transform=function($,Q,J){throw Error("_transform() is not implemented")};S0.prototype._write=function($,Q,J){var q=this._transformState;if(q.writecb=J,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};S0.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};S0.prototype._destroy=function($,Q){var J=this;i8.prototype._destroy.call(this,$,function(q){Q(q),J.emit("close")})};function D5($,Q,J){if(Q)return $.emit("error",Q);if(J!=null)$.push(J);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 E5=D((MH,k5)=>{k5.exports=J8;var A5=D$(),R5=Object.create(P1());R5.inherits=Z1();R5.inherits(J8,A5);function J8($){if(!(this instanceof J8))return new J8($);A5.call(this,$)}J8.prototype._transform=function($,Q,J){J(null,$)}});var v$=D((r,n8)=>{var O0=z0("stream");if(process.env.READABLE_STREAM==="disable"&&O0)n8.exports=O0,r=n8.exports=O0.Readable,r.Readable=O0.Readable,r.Writable=O0.Writable,r.Duplex=O0.Duplex,r.Transform=O0.Transform,r.PassThrough=O0.PassThrough,r.Stream=O0;else r=n8.exports=P$(),r.Stream=O0||r,r.Readable=r,r.Writable=F$(),r.Duplex=e0(),r.Transform=D$(),r.PassThrough=E5()});var T0=D((jG)=>{jG.base64=!0;jG.array=!0;jG.string=!0;jG.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";jG.nodebuffer=typeof Buffer<"u";jG.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")jG.blob=!1;else{r8=new ArrayBuffer(0);try{jG.blob=new Blob([r8],{type:"application/zip"}).size===0}catch($){try{A$=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,a8=new A$,a8.append(r8),jG.blob=a8.getBlob("application/zip").size===0}catch(Q){jG.blob=!1}}}var r8,A$,a8;try{jG.nodestream=!!v$().Readable}catch($){jG.nodestream=!1}});var R$=D((NG)=>{var MG=m(),IG=T0(),B0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";NG.encode=function($){var Q=[],J,q,Y,G,V,X,W,K=0,U=$.length,F=U,j=MG.getTypeOf($)!=="string";while(K<$.length){if(F=U-K,!j)J=$.charCodeAt(K++),q=K<U?$.charCodeAt(K++):0,Y=K<U?$.charCodeAt(K++):0;else J=$[K++],q=K<U?$[K++]:0,Y=K<U?$[K++]:0;G=J>>2,V=(J&3)<<4|q>>4,X=F>1?(q&15)<<2|Y>>6:64,W=F>2?Y&63:64,Q.push(B0.charAt(G)+B0.charAt(V)+B0.charAt(X)+B0.charAt(W))}return Q.join("")};NG.decode=function($){var Q,J,q,Y,G,V,X,W=0,K=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var F=$.length*3/4;if($.charAt($.length-1)===B0.charAt(64))F--;if($.charAt($.length-2)===B0.charAt(64))F--;if(F%1!==0)throw Error("Invalid base64 input, bad content length.");var j;if(IG.uint8array)j=new Uint8Array(F|0);else j=Array(F|0);while(W<$.length){if(Y=B0.indexOf($.charAt(W++)),G=B0.indexOf($.charAt(W++)),V=B0.indexOf($.charAt(W++)),X=B0.indexOf($.charAt(W++)),Q=Y<<2|G>>4,J=(G&15)<<4|V>>2,q=(V&3)<<6|X,j[K++]=Q,V!==64)j[K++]=J;if(X!==64)j[K++]=q}return j}});var q8=D((wH,g5)=>{g5.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 T5=D((BH,S5)=>{var OH=global.MutationObserver||global.WebKitMutationObserver,x5;x5=function(){process.nextTick(AG)};var BG,DG,vG,CG,k$,Y8=[];function AG(){k$=!0;var $,Q,J=Y8.length;while(J){Q=Y8,Y8=[],$=-1;while(++$<J)Q[$]();J=Y8.length}k$=!1}S5.exports=RG;function RG($){if(Y8.push($)===1&&!k$)x5()}});var c5=D((DH,m5)=>{var y5=T5();function N1(){}var t={},h5=["REJECTED"],E$=["FULFILLED"],f5=["PENDING"];I1=["UNHANDLED"];var I1;m5.exports=m0;function m0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=f5,this.queue=[],this.outcome=void 0,this.handled=I1,$!==N1)b5(this,$)}m0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(J,q);function J(Y){function G(){return Y}return Q.resolve($()).then(G)}function q(Y){function G(){throw Y}return Q.resolve($()).then(G)}};m0.prototype.catch=function($){return this.then(null,$)};m0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===E$||typeof Q!=="function"&&this.state===h5)return this;var J=new this.constructor(N1);if(this.handled===I1)this.handled=null;if(this.state!==f5){var q=this.state===E$?$:Q;g$(J,q,this.outcome)}else this.queue.push(new G8(J,$,Q));return J};function G8($,Q,J){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof J==="function")this.onRejected=J,this.callRejected=this.otherCallRejected}G8.prototype.callFulfilled=function($){t.resolve(this.promise,$)};G8.prototype.otherCallFulfilled=function($){g$(this.promise,this.onFulfilled,$)};G8.prototype.callRejected=function($){t.reject(this.promise,$)};G8.prototype.otherCallRejected=function($){g$(this.promise,this.onRejected,$)};function g$($,Q,J){y5(function(){var q;try{q=Q(J)}catch(Y){return t.reject($,Y)}if(q===$)t.reject($,TypeError("Cannot resolve promise with itself"));else t.resolve($,q)})}t.resolve=function($,Q){var J=_5(kG,Q);if(J.status==="error")return t.reject($,J.value);var q=J.value;if(q)b5($,q);else{$.state=E$,$.outcome=Q;var Y=-1,G=$.queue.length;while(++Y<G)$.queue[Y].callFulfilled(Q)}return $};t.reject=function($,Q){if($.state=h5,$.outcome=Q,$.handled===I1)y5(function(){if($.handled===I1)process.emit("unhandledRejection",Q,$)});var J=-1,q=$.queue.length;while(++J<q)$.queue[J].callRejected(Q);return $};function kG($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function b5($,Q){var J=!1;function q(X){if(J)return;J=!0,t.reject($,X)}function Y(X){if(J)return;J=!0,t.resolve($,X)}function G(){Q(Y,q)}var V=_5(G);if(V.status==="error")q(V.value)}function _5($,Q){var J={};try{J.value=$(Q),J.status="success"}catch(q){J.status="error",J.value=q}return J}m0.resolve=EG;function EG($){if($ instanceof this)return $;return t.resolve(new this(N1),$)}m0.reject=gG;function gG($){var Q=new this(N1);return t.reject(Q,$)}m0.all=xG;function xG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=Array(J),G=0,V=-1,X=new this(N1);while(++V<J)W($[V],V);return X;function W(K,U){Q.resolve(K).then(F,function(j){if(!q)q=!0,t.reject(X,j)});function F(j){if(Y[U]=j,++G===J&&!q)q=!0,t.resolve(X,Y)}}}m0.race=SG;function SG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=-1,G=new this(N1);while(++Y<J)V($[Y]);return G;function V(X){Q.resolve(X).then(function(W){if(!q)q=!0,t.resolve(G,W)},function(W){if(!q)q=!0,t.reject(G,W)})}}});var w1=D((vH,p5)=>{var x$=null;if(typeof Promise<"u")x$=Promise;else x$=c5();p5.exports={Promise:x$}});var d5=D((u5)=>{(function($,Q){if($.setImmediate)return;var J=1,q={},Y=!1,G=$.document,V;function X(P){if(typeof P!=="function")P=Function(""+P);var O=Array(arguments.length-1);for(var M=0;M<O.length;M++)O[M]=arguments[M+1];var L={callback:P,args:O};return q[J]=L,V(J),J++}function W(P){delete q[P]}function K(P){var{callback:O,args:M}=P;switch(M.length){case 0:O();break;case 1:O(M[0]);break;case 2:O(M[0],M[1]);break;case 3:O(M[0],M[1],M[2]);break;default:O.apply(Q,M);break}}function U(P){if(Y)setTimeout(U,0,P);else{var O=q[P];if(O){Y=!0;try{K(O)}finally{W(P),Y=!1}}}}function F(){V=function(P){process.nextTick(function(){U(P)})}}function j(){if($.postMessage&&!$.importScripts){var P=!0,O=$.onmessage;return $.onmessage=function(){P=!1},$.postMessage("","*"),$.onmessage=O,P}}function H(){var P="setImmediate$"+Math.random()+"$",O=function(M){if(M.source===$&&typeof M.data==="string"&&M.data.indexOf(P)===0)U(+M.data.slice(P.length))};if($.addEventListener)$.addEventListener("message",O,!1);else $.attachEvent("onmessage",O);V=function(M){$.postMessage(P+M,"*")}}function Z(){var P=new MessageChannel;P.port1.onmessage=function(O){var M=O.data;U(M)},V=function(O){P.port2.postMessage(O)}}function z(){var P=G.documentElement;V=function(O){var M=G.createElement("script");M.onreadystatechange=function(){U(O),M.onreadystatechange=null,P.removeChild(M),M=null},P.appendChild(M)}}function w(){V=function(P){setTimeout(U,0,P)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf($);if(N=N&&N.setTimeout?N:$,{}.toString.call($.process)==="[object process]")F();else if(j())H();else if($.MessageChannel)Z();else if(G&&"onreadystatechange"in G.createElement("script"))z();else w();N.setImmediate=X,N.clearImmediate=W})(typeof self>"u"?typeof global>"u"?u5:global:self)});var m=D((hG)=>{var c0=T0(),TG=R$(),O1=q8(),S$=w1();d5();function yG($){var Q=null;if(c0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return t8($,Q)}hG.newBlob=function($,Q){hG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var J=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new J;return q.append($),q.getBlob(Q)}catch(G){throw Error("Bug : can't construct the Blob.")}}};function V8($){return $}function t8($,Q){for(var J=0;J<$.length;++J)Q[J]=$.charCodeAt(J)&255;return Q}var s8={stringifyByChunk:function($,Q,J){var q=[],Y=0,G=$.length;if(G<=J)return String.fromCharCode.apply(null,$);while(Y<G){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+J,G))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+J,G))));Y+=J}return q.join("")},stringifyByChar:function($){var Q="";for(var J=0;J<$.length;J++)Q+=String.fromCharCode($[J]);return Q},applyCanBeUsed:{uint8array:function(){try{return c0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return c0.nodebuffer&&String.fromCharCode.apply(null,O1.allocBuffer(1)).length===1}catch($){return!1}}()}};function X8($){var Q=65536,J=hG.getTypeOf($),q=!0;if(J==="uint8array")q=s8.applyCanBeUsed.uint8array;else if(J==="nodebuffer")q=s8.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return s8.stringifyByChunk($,J,Q)}catch(Y){Q=Math.floor(Q/2)}return s8.stringifyByChar($)}hG.applyFromCharCode=X8;function e8($,Q){for(var J=0;J<$.length;J++)Q[J]=$[J];return Q}var p0={};p0.string={string:V8,array:function($){return t8($,Array($.length))},arraybuffer:function($){return p0.string.uint8array($).buffer},uint8array:function($){return t8($,new Uint8Array($.length))},nodebuffer:function($){return t8($,O1.allocBuffer($.length))}};p0.array={string:X8,array:V8,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return O1.newBufferFrom($)}};p0.arraybuffer={string:function($){return X8(new Uint8Array($))},array:function($){return e8(new Uint8Array($),Array($.byteLength))},arraybuffer:V8,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return O1.newBufferFrom(new Uint8Array($))}};p0.uint8array={string:X8,array:function($){return e8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:V8,nodebuffer:function($){return O1.newBufferFrom($)}};p0.nodebuffer={string:X8,array:function($){return e8($,Array($.length))},arraybuffer:function($){return p0.nodebuffer.uint8array($).buffer},uint8array:function($){return e8($,new Uint8Array($.length))},nodebuffer:V8};hG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;hG.checkSupport($);var J=hG.getTypeOf(Q),q=p0[J][$](Q);return q};hG.resolve=function($){var Q=$.split("/"),J=[];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==="..")J.pop();else J.push(Y)}return J.join("/")};hG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(c0.nodebuffer&&O1.isBuffer($))return"nodebuffer";if(c0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(c0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};hG.checkSupport=function($){var Q=c0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};hG.MAX_VALUE_16BITS=65535;hG.MAX_VALUE_32BITS=-1;hG.pretty=function($){var Q="",J,q;for(q=0;q<($||"").length;q++)J=$.charCodeAt(q),Q+="\\x"+(J<16?"0":"")+J.toString(16).toUpperCase();return Q};hG.delay=function($,Q,J){setImmediate(function(){$.apply(J||null,Q||[])})};hG.inherits=function($,Q){var J=function(){};J.prototype=Q.prototype,$.prototype=new J};hG.extend=function(){var $={},Q,J;for(Q=0;Q<arguments.length;Q++)for(J in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],J)&&typeof $[J]>"u")$[J]=arguments[Q][J];return $};hG.prepareContent=function($,Q,J,q,Y){var G=S$.Promise.resolve(Q).then(function(V){var X=c0.blob&&(V instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(V))!==-1);if(X&&typeof FileReader<"u")return new S$.Promise(function(W,K){var U=new FileReader;U.onload=function(F){W(F.target.result)},U.onerror=function(F){K(F.target.error)},U.readAsArrayBuffer(V)});else return V});return G.then(function(V){var X=hG.getTypeOf(V);if(!X)return S$.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(X==="arraybuffer")V=hG.transformTo("uint8array",V);else if(X==="string"){if(Y)V=TG.decode(V);else if(J){if(q!==!0)V=yG(V)}}return V})}});var G0=D((RH,n5)=>{function i5($){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}i5.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 J=0;J<this._listeners[$].length;J++)this._listeners[$][J].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(J){Q.processChunk(J)}),$.on("end",function(){Q.end()}),$.on("error",function(J){Q.error(J)}),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 $}};n5.exports=i5});var D1=D((sG)=>{var B1=m(),$1=T0(),iG=q8(),$6=G0(),K8=Array(256);for(D0=0;D0<256;D0++)K8[D0]=D0>=252?6:D0>=248?5:D0>=240?4:D0>=224?3:D0>=192?2:1;var D0;K8[254]=K8[254]=1;var nG=function($){var Q,J,q,Y,G,V=$.length,X=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}X+=J<128?1:J<2048?2:J<65536?3:4}if($1.uint8array)Q=new Uint8Array(X);else Q=Array(X);for(G=0,Y=0;G<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q},rG=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+K8[$[J]]>Q?J:Q},aG=function($){var Q,J,q,Y,G=$.length,V=Array(G*2);for(J=0,Q=0;Q<G;){if(q=$[Q++],q<128){V[J++]=q;continue}if(Y=K8[q],Y>4){V[J++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<G)q=q<<6|$[Q++]&63,Y--;if(Y>1){V[J++]=65533;continue}if(q<65536)V[J++]=q;else q-=65536,V[J++]=55296|q>>10&1023,V[J++]=56320|q&1023}if(V.length!==J)if(V.subarray)V=V.subarray(0,J);else V.length=J;return B1.applyFromCharCode(V)};sG.utf8encode=function(Q){if($1.nodebuffer)return iG.newBufferFrom(Q,"utf-8");return nG(Q)};sG.utf8decode=function(Q){if($1.nodebuffer)return B1.transformTo("nodebuffer",Q).toString("utf-8");return Q=B1.transformTo($1.uint8array?"uint8array":"array",Q),aG(Q)};function Q6(){$6.call(this,"utf-8 decode"),this.leftOver=null}B1.inherits(Q6,$6);Q6.prototype.processChunk=function($){var Q=B1.transformTo($1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if($1.uint8array){var J=Q;Q=new Uint8Array(J.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(J,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=rG(Q),Y=Q;if(q!==Q.length)if($1.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:sG.utf8decode(Y),meta:$.meta})};Q6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:sG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};sG.Utf8DecodeWorker=Q6;function y$(){$6.call(this,"utf-8 encode")}B1.inherits(y$,$6);y$.prototype.processChunk=function($){this.push({data:sG.utf8encode($.data),meta:$.meta})};sG.Utf8EncodeWorker=y$});var e5=D((EH,t5)=>{var a5=G0(),s5=m();function f$($){a5.call(this,"ConvertWorker to "+$),this.destType=$}s5.inherits(f$,a5);f$.prototype.processChunk=function($){this.push({data:s5.transformTo(this.destType,$.data),meta:$.meta})};t5.exports=f$});var JQ=D((gH,QQ)=>{var $Q=v$().Readable,$V=m();$V.inherits(b$,$Q);function b$($,Q,J){$Q.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,G){if(!q.push(Y))q._helper.pause();if(J)J(G)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}b$.prototype._read=function(){this._helper.resume()};QQ.exports=b$});var _$=D((xH,GQ)=>{var Q1=m(),QV=e5(),JV=G0(),qV=R$(),YV=T0(),GV=w1(),qQ=null;if(YV.nodestream)try{qQ=JQ()}catch($){}function VV($,Q,J){switch($){case"blob":return Q1.newBlob(Q1.transformTo("arraybuffer",Q),J);case"base64":return qV.encode(Q);default:return Q1.transformTo($,Q)}}function XV($,Q){var J,q=0,Y=null,G=0;for(J=0;J<Q.length;J++)G+=Q[J].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(G);for(J=0;J<Q.length;J++)Y.set(Q[J],q),q+=Q[J].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function KV($,Q){return new GV.Promise(function(J,q){var Y=[],G=$._internalType,V=$._outputType,X=$._mimeType;$.on("data",function(W,K){if(Y.push(W),Q)Q(K)}).on("error",function(W){Y=[],q(W)}).on("end",function(){try{var W=VV(V,XV(G,Y),X);J(W)}catch(K){q(K)}Y=[]}).resume()})}function YQ($,Q,J){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=J,Q1.checkSupport(q),this._worker=$.pipe(new QV(q)),$.lock()}catch(Y){this._worker=new JV("error"),this._worker.error(Y)}}YQ.prototype={accumulate:function($){return KV(this,$)},on:function($,Q){var J=this;if($==="data")this._worker.on($,function(q){Q.call(J,q.data,q.meta)});else this._worker.on($,function(){Q1.delay(Q,arguments,J)});return this},resume:function(){return Q1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(Q1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new qQ(this,{objectMode:this._outputType!=="nodebuffer"},$)}};GQ.exports=YQ});var m$=D((UV)=>{UV.base64=!1;UV.binary=!1;UV.dir=!1;UV.createFolders=!0;UV.date=null;UV.compression=null;UV.compressionOptions=null;UV.comment=null;UV.unixPermissions=null;UV.dosPermissions=null});var c$=D((TH,VQ)=>{var J6=m(),q6=G0(),NV=16384;function v1($){q6.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(J){if(Q.dataIsReady=!0,Q.data=J,Q.max=J&&J.length||0,Q.type=J6.getTypeOf(J),!Q.isPaused)Q._tickAndRepeat()},function(J){Q.error(J)})}J6.inherits(v1,q6);v1.prototype.cleanUp=function(){q6.prototype.cleanUp.call(this),this.data=null};v1.prototype.resume=function(){if(!q6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,J6.delay(this._tickAndRepeat,[],this);return!0};v1.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)J6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};v1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=NV,Q=null,J=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,J);break;case"uint8array":Q=this.data.subarray(this.index,J);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,J);break}return this.index=J,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};VQ.exports=v1});var Y6=D((yH,KQ)=>{var wV=m();function OV(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var XQ=OV();function BV($,Q,J,q){var Y=XQ,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}function DV($,Q,J,q){var Y=XQ,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q.charCodeAt(V))&255];return $^-1}KQ.exports=function(Q,J){if(typeof Q>"u"||!Q.length)return 0;var q=wV.getTypeOf(Q)!=="string";if(q)return BV(J|0,Q,Q.length,0);else return DV(J|0,Q,Q.length,0)}});var u$=D((hH,WQ)=>{var UQ=G0(),vV=Y6(),CV=m();function p$(){UQ.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}CV.inherits(p$,UQ);p$.prototype.processChunk=function($){this.streamInfo.crc32=vV($.data,this.streamInfo.crc32||0),this.push($)};WQ.exports=p$});var FQ=D((fH,jQ)=>{var AV=m(),d$=G0();function l$($){d$.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}AV.inherits(l$,d$);l$.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}d$.prototype.processChunk.call(this,$)};jQ.exports=l$});var G6=D((bH,ZQ)=>{var HQ=w1(),PQ=c$(),RV=u$(),o$=FQ();function i$($,Q,J,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=J,this.compression=q,this.compressedContent=Y}i$.prototype={getContentWorker:function(){var $=new PQ(HQ.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o$("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 PQ(HQ.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};i$.createWorkerFrom=function($,Q,J){return $.pipe(new RV).pipe(new o$("uncompressedSize")).pipe(Q.compressWorker(J)).pipe(new o$("compressedSize")).withStreamInfo("compression",Q)};ZQ.exports=i$});var IQ=D((_H,MQ)=>{var kV=_$(),EV=c$(),n$=D1(),r$=G6(),zQ=G0(),a$=function($,Q,J){this.name=$,this.dir=J.dir,this.date=J.date,this.comment=J.comment,this.unixPermissions=J.unixPermissions,this.dosPermissions=J.dosPermissions,this._data=Q,this._dataBinary=J.binary,this.options={compression:J.compression,compressionOptions:J.compressionOptions}};a$.prototype={internalStream:function($){var Q=null,J="string";try{if(!$)throw Error("No output type specified.");J=$.toLowerCase();var q=J==="string"||J==="text";if(J==="binarystring"||J==="text")J="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new n$.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new n$.Utf8DecodeWorker)}catch(G){Q=new zQ("error"),Q.error(G)}return new kV(Q,J,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof r$&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var J=this._decompressWorker();if(!this._dataBinary)J=J.pipe(new n$.Utf8EncodeWorker);return r$.createWorkerFrom(J,$,Q)}},_decompressWorker:function(){if(this._data instanceof r$)return this._data.getContentWorker();else if(this._data instanceof zQ)return this._data;else return new EV(this._data)}};var LQ=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],gV=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(U8=0;U8<LQ.length;U8++)a$.prototype[LQ[U8]]=gV;var U8;MQ.exports=a$});var y0=D((s$)=>{var yV=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function hV($,Q){return Object.prototype.hasOwnProperty.call($,Q)}s$.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var J=Q.shift();if(!J)continue;if(typeof J!=="object")throw TypeError(J+"must be non-object");for(var q in J)if(hV(J,q))$[q]=J[q]}return $};s$.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var fV={arraySet:function($,Q,J,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(J,J+q),Y);return}for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){var Q,J,q,Y,G,V;q=0;for(Q=0,J=$.length;Q<J;Q++)q+=$[Q].length;V=new Uint8Array(q),Y=0;for(Q=0,J=$.length;Q<J;Q++)G=$[Q],V.set(G,Y),Y+=G.length;return V}},bV={arraySet:function($,Q,J,q,Y){for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){return[].concat.apply([],$)}};s$.setTyped=function($){if($)s$.Buf8=Uint8Array,s$.Buf16=Uint16Array,s$.Buf32=Int32Array,s$.assign(s$,fV);else s$.Buf8=Array,s$.Buf16=Array,s$.Buf32=Array,s$.assign(s$,bV)};s$.setTyped(yV)});var uQ=D((XX)=>{var mV=y0(),cV=4,wQ=0,OQ=1,pV=2;function A1($){var Q=$.length;while(--Q>=0)$[Q]=0}var uV=0,RQ=1,dV=2,lV=3,oV=258,G2=29,Z8=256,j8=Z8+1+G2,C1=30,V2=19,kQ=2*j8+1,J1=15,e$=16,iV=7,X2=256,EQ=16,gQ=17,xQ=18,q2=[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],nV=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],SQ=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rV=512,h0=Array((j8+2)*2);A1(h0);var W8=Array(C1*2);A1(W8);var F8=Array(rV);A1(F8);var H8=Array(oV-lV+1);A1(H8);var K2=Array(G2);A1(K2);var X6=Array(C1);A1(X6);function $2($,Q,J,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=J,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var TQ,yQ,hQ;function Q2($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function fQ($){return $<256?F8[$]:F8[256+($>>>7)]}function P8($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function Y0($,Q,J){if($.bi_valid>e$-J)$.bi_buf|=Q<<$.bi_valid&65535,P8($,$.bi_buf),$.bi_buf=Q>>e$-$.bi_valid,$.bi_valid+=J-e$;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=J}function v0($,Q,J){Y0($,J[Q*2],J[Q*2+1])}function bQ($,Q){var J=0;do J|=$&1,$>>>=1,J<<=1;while(--Q>0);return J>>>1}function aV($){if($.bi_valid===16)P8($,$.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 sV($,Q){var{dyn_tree:J,max_code:q}=Q,Y=Q.stat_desc.static_tree,G=Q.stat_desc.has_stree,V=Q.stat_desc.extra_bits,X=Q.stat_desc.extra_base,W=Q.stat_desc.max_length,K,U,F,j,H,Z,z=0;for(j=0;j<=J1;j++)$.bl_count[j]=0;J[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<kQ;K++){if(U=$.heap[K],j=J[J[U*2+1]*2+1]+1,j>W)j=W,z++;if(J[U*2+1]=j,U>q)continue;if($.bl_count[j]++,H=0,U>=X)H=V[U-X];if(Z=J[U*2],$.opt_len+=Z*(j+H),G)$.static_len+=Z*(Y[U*2+1]+H)}if(z===0)return;do{j=W-1;while($.bl_count[j]===0)j--;$.bl_count[j]--,$.bl_count[j+1]+=2,$.bl_count[W]--,z-=2}while(z>0);for(j=W;j!==0;j--){U=$.bl_count[j];while(U!==0){if(F=$.heap[--K],F>q)continue;if(J[F*2+1]!==j)$.opt_len+=(j-J[F*2+1])*J[F*2],J[F*2+1]=j;U--}}}function _Q($,Q,J){var q=Array(J1+1),Y=0,G,V;for(G=1;G<=J1;G++)q[G]=Y=Y+J[G-1]<<1;for(V=0;V<=Q;V++){var X=$[V*2+1];if(X===0)continue;$[V*2]=bQ(q[X]++,X)}}function tV(){var $,Q,J,q,Y,G=Array(J1+1);J=0;for(q=0;q<G2-1;q++){K2[q]=J;for($=0;$<1<<q2[q];$++)H8[J++]=q}H8[J-1]=q,Y=0;for(q=0;q<16;q++){X6[q]=Y;for($=0;$<1<<V6[q];$++)F8[Y++]=q}Y>>=7;for(;q<C1;q++){X6[q]=Y<<7;for($=0;$<1<<V6[q]-7;$++)F8[256+Y++]=q}for(Q=0;Q<=J1;Q++)G[Q]=0;$=0;while($<=143)h0[$*2+1]=8,$++,G[8]++;while($<=255)h0[$*2+1]=9,$++,G[9]++;while($<=279)h0[$*2+1]=7,$++,G[7]++;while($<=287)h0[$*2+1]=8,$++,G[8]++;_Q(h0,j8+1,G);for($=0;$<C1;$++)W8[$*2+1]=5,W8[$*2]=bQ($,5);TQ=new $2(h0,q2,Z8+1,j8,J1),yQ=new $2(W8,V6,0,C1,J1),hQ=new $2([],nV,0,V2,iV)}function mQ($){var Q;for(Q=0;Q<j8;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<C1;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<V2;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[X2*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function cQ($){if($.bi_valid>8)P8($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function eV($,Q,J,q){if(cQ($),q)P8($,J),P8($,~J);mV.arraySet($.pending_buf,$.window,Q,J,$.pending),$.pending+=J}function BQ($,Q,J,q){var Y=Q*2,G=J*2;return $[Y]<$[G]||$[Y]===$[G]&&q[Q]<=q[J]}function J2($,Q,J){var q=$.heap[J],Y=J<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&BQ(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(BQ(Q,q,$.heap[Y],$.depth))break;$.heap[J]=$.heap[Y],J=Y,Y<<=1}$.heap[J]=q}function DQ($,Q,J){var q,Y,G=0,V,X;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+G*2]<<8|$.pending_buf[$.d_buf+G*2+1],Y=$.pending_buf[$.l_buf+G],G++,q===0)v0($,Y,Q);else{if(V=H8[Y],v0($,V+Z8+1,Q),X=q2[V],X!==0)Y-=K2[V],Y0($,Y,X);if(q--,V=fQ(q),v0($,V,J),X=V6[V],X!==0)q-=X6[V],Y0($,q,X)}while(G<$.last_lit);v0($,X2,Q)}function Y2($,Q){var J=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,G=Q.stat_desc.elems,V,X,W=-1,K;$.heap_len=0,$.heap_max=kQ;for(V=0;V<G;V++)if(J[V*2]!==0)$.heap[++$.heap_len]=W=V,$.depth[V]=0;else J[V*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=W<2?++W:0,J[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=W;for(V=$.heap_len>>1;V>=1;V--)J2($,J,V);K=G;do V=$.heap[1],$.heap[1]=$.heap[$.heap_len--],J2($,J,1),X=$.heap[1],$.heap[--$.heap_max]=V,$.heap[--$.heap_max]=X,J[K*2]=J[V*2]+J[X*2],$.depth[K]=($.depth[V]>=$.depth[X]?$.depth[V]:$.depth[X])+1,J[V*2+1]=J[X*2+1]=K,$.heap[1]=K++,J2($,J,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],sV($,Q),_Q(J,W,$.bl_count)}function vQ($,Q,J){var q,Y=-1,G,V=Q[1],X=0,W=7,K=4;if(V===0)W=138,K=3;Q[(J+1)*2+1]=65535;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++X<W&&G===V)continue;else if(X<K)$.bl_tree[G*2]+=X;else if(G!==0){if(G!==Y)$.bl_tree[G*2]++;$.bl_tree[EQ*2]++}else if(X<=10)$.bl_tree[gQ*2]++;else $.bl_tree[xQ*2]++;if(X=0,Y=G,V===0)W=138,K=3;else if(G===V)W=6,K=3;else W=7,K=4}}function CQ($,Q,J){var q,Y=-1,G,V=Q[1],X=0,W=7,K=4;if(V===0)W=138,K=3;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++X<W&&G===V)continue;else if(X<K)do v0($,G,$.bl_tree);while(--X!==0);else if(G!==0){if(G!==Y)v0($,G,$.bl_tree),X--;v0($,EQ,$.bl_tree),Y0($,X-3,2)}else if(X<=10)v0($,gQ,$.bl_tree),Y0($,X-3,3);else v0($,xQ,$.bl_tree),Y0($,X-11,7);if(X=0,Y=G,V===0)W=138,K=3;else if(G===V)W=6,K=3;else W=7,K=4}}function $X($){var Q;vQ($,$.dyn_ltree,$.l_desc.max_code),vQ($,$.dyn_dtree,$.d_desc.max_code),Y2($,$.bl_desc);for(Q=V2-1;Q>=3;Q--)if($.bl_tree[SQ[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function QX($,Q,J,q){var Y;Y0($,Q-257,5),Y0($,J-1,5),Y0($,q-4,4);for(Y=0;Y<q;Y++)Y0($,$.bl_tree[SQ[Y]*2+1],3);CQ($,$.dyn_ltree,Q-1),CQ($,$.dyn_dtree,J-1)}function JX($){var Q=4093624447,J;for(J=0;J<=31;J++,Q>>>=1)if(Q&1&&$.dyn_ltree[J*2]!==0)return wQ;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return OQ;for(J=32;J<Z8;J++)if($.dyn_ltree[J*2]!==0)return OQ;return wQ}var AQ=!1;function qX($){if(!AQ)tV(),AQ=!0;$.l_desc=new Q2($.dyn_ltree,TQ),$.d_desc=new Q2($.dyn_dtree,yQ),$.bl_desc=new Q2($.bl_tree,hQ),$.bi_buf=0,$.bi_valid=0,mQ($)}function pQ($,Q,J,q){Y0($,(uV<<1)+(q?1:0),3),eV($,Q,J,!0)}function YX($){Y0($,RQ<<1,3),v0($,X2,h0),aV($)}function GX($,Q,J,q){var Y,G,V=0;if($.level>0){if($.strm.data_type===pV)$.strm.data_type=JX($);if(Y2($,$.l_desc),Y2($,$.d_desc),V=$X($),Y=$.opt_len+3+7>>>3,G=$.static_len+3+7>>>3,G<=Y)Y=G}else Y=G=J+5;if(J+4<=Y&&Q!==-1)pQ($,Q,J,q);else if($.strategy===cV||G===Y)Y0($,(RQ<<1)+(q?1:0),3),DQ($,h0,W8);else Y0($,(dV<<1)+(q?1:0),3),QX($,$.l_desc.max_code+1,$.d_desc.max_code+1,V+1),DQ($,$.dyn_ltree,$.dyn_dtree);if(mQ($),q)cQ($)}function VX($,Q,J){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]=J&255,$.last_lit++,Q===0)$.dyn_ltree[J*2]++;else $.matches++,Q--,$.dyn_ltree[(H8[J]+Z8+1)*2]++,$.dyn_dtree[fQ(Q)*2]++;return $.last_lit===$.lit_bufsize-1}XX._tr_init=qX;XX._tr_stored_block=pQ;XX._tr_flush_block=GX;XX._tr_tally=VX;XX._tr_align=YX});var U2=D((pH,dQ)=>{function HX($,Q,J,q){var Y=$&65535|0,G=$>>>16&65535|0,V=0;while(J!==0){V=J>2000?2000:J,J-=V;do Y=Y+Q[q++]|0,G=G+Y|0;while(--V);Y%=65521,G%=65521}return Y|G<<16|0}dQ.exports=HX});var W2=D((uH,lQ)=>{function PX(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var ZX=PX();function zX($,Q,J,q){var Y=ZX,G=q+J;$^=-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}lQ.exports=zX});var K6=D((dH,oQ)=>{oQ.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 Q7=D((rX)=>{var Q0=y0(),j0=uQ(),aQ=U2(),u0=W2(),LX=K6(),V1=0,MX=1,IX=3,n0=4,iQ=5,A0=0,nQ=1,F0=-2,NX=-3,j2=-5,wX=-1,OX=1,U6=2,BX=3,DX=4,vX=0,CX=2,H6=8,AX=9,RX=15,kX=8,EX=29,gX=256,H2=gX+1+EX,xX=30,SX=19,TX=2*H2+1,yX=15,g=3,o0=258,L0=o0+g+1,hX=32,P6=42,P2=69,W6=73,j6=91,F6=103,q1=113,L8=666,l=1,M8=2,Y1=3,E1=4,fX=3;function i0($,Q){return $.msg=LX[Q],Q}function rQ($){return($<<1)-($>4?9:0)}function l0($){var Q=$.length;while(--Q>=0)$[Q]=0}function d0($){var Q=$.state,J=Q.pending;if(J>$.avail_out)J=$.avail_out;if(J===0)return;if(Q0.arraySet($.output,Q.pending_buf,Q.pending_out,J,$.next_out),$.next_out+=J,Q.pending_out+=J,$.total_out+=J,$.avail_out-=J,Q.pending-=J,Q.pending===0)Q.pending_out=0}function a($,Q){j0._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,d0($.strm)}function x($,Q){$.pending_buf[$.pending++]=Q}function z8($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function bX($,Q,J,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Q0.arraySet(Q,$.input,$.next_in,Y,J),$.state.wrap===1)$.adler=aQ($.adler,Q,Y,J);else if($.state.wrap===2)$.adler=u0($.adler,Q,Y,J);return $.next_in+=Y,$.total_in+=Y,Y}function sQ($,Q){var{max_chain_length:J,strstart:q}=$,Y,G,V=$.prev_length,X=$.nice_match,W=$.strstart>$.w_size-L0?$.strstart-($.w_size-L0):0,K=$.window,U=$.w_mask,F=$.prev,j=$.strstart+o0,H=K[q+V-1],Z=K[q+V];if($.prev_length>=$.good_match)J>>=2;if(X>$.lookahead)X=$.lookahead;do{if(Y=Q,K[Y+V]!==Z||K[Y+V-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<j);if(G=o0-(j-q),q=j-o0,G>V){if($.match_start=Q,V=G,G>=X)break;H=K[q+V-1],Z=K[q+V]}}while((Q=F[Q&U])>W&&--J!==0);if(V<=$.lookahead)return V;return $.lookahead}function G1($){var Q=$.w_size,J,q,Y,G,V;do{if(G=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-L0)){Q0.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,J=q;do Y=$.head[--J],$.head[J]=Y>=Q?Y-Q:0;while(--q);q=Q,J=q;do Y=$.prev[--J],$.prev[J]=Y>=Q?Y-Q:0;while(--q);G+=Q}if($.strm.avail_in===0)break;if(q=bX($.strm,$.window,$.strstart+$.lookahead,G),$.lookahead+=q,$.lookahead+$.insert>=g){V=$.strstart-$.insert,$.ins_h=$.window[V],$.ins_h=($.ins_h<<$.hash_shift^$.window[V+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[V+g-1])&$.hash_mask,$.prev[V&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=V,V++,$.insert--,$.lookahead+$.insert<g)break}}while($.lookahead<L0&&$.strm.avail_in!==0)}function _X($,Q){var J=65535;if(J>$.pending_buf_size-5)J=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(G1($),$.lookahead===0&&Q===V1)return l;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+J;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,a($,!1),$.strm.avail_out===0)return l}if($.strstart-$.block_start>=$.w_size-L0){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.strstart>$.block_start){if(a($,!1),$.strm.avail_out===0)return l}return l}function F2($,Q){var J,q;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return l;if($.lookahead===0)break}if(J=0,$.lookahead>=g)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(J!==0&&$.strstart-J<=$.w_size-L0)$.match_length=sQ($,J);if($.match_length>=g)if(q=j0._tr_tally($,$.strstart-$.match_start,$.match_length-g),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=g){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.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=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=$.strstart<g-1?$.strstart:g-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function R1($,Q){var J,q,Y;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return l;if($.lookahead===0)break}if(J=0,$.lookahead>=g)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=g-1,J!==0&&$.prev_length<$.max_lazy_match&&$.strstart-J<=$.w_size-L0){if($.match_length=sQ($,J),$.match_length<=5&&($.strategy===OX||$.match_length===g&&$.strstart-$.match_start>4096))$.match_length=g-1}if($.prev_length>=g&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-g,q=j0._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-g),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=g-1,$.strstart++,q){if(a($,!1),$.strm.avail_out===0)return l}}else if($.match_available){if(q=j0._tr_tally($,0,$.window[$.strstart-1]),q)a($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return l}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=j0._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<g-1?$.strstart:g-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function mX($,Q){var J,q,Y,G,V=$.window;for(;;){if($.lookahead<=o0){if(G1($),$.lookahead<=o0&&Q===V1)return l;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=g&&$.strstart>0){if(Y=$.strstart-1,q=V[Y],q===V[++Y]&&q===V[++Y]&&q===V[++Y]){G=$.strstart+o0;do;while(q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&Y<G);if($.match_length=o0-(G-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=g)J=j0._tr_tally($,1,$.match_length-g),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(J){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function cX($,Q){var J;for(;;){if($.lookahead===0){if(G1($),$.lookahead===0){if(Q===V1)return l;break}}if($.match_length=0,J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,J){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function C0($,Q,J,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=J,this.max_chain=q,this.func=Y}var k1;k1=[new C0(0,0,0,0,_X),new C0(4,4,8,4,F2),new C0(4,5,16,8,F2),new C0(4,6,32,32,F2),new C0(4,4,16,16,R1),new C0(8,16,32,32,R1),new C0(8,16,128,128,R1),new C0(8,32,128,256,R1),new C0(32,128,258,1024,R1),new C0(32,258,258,4096,R1)];function pX($){$.window_size=2*$.w_size,l0($.head),$.max_lazy_match=k1[$.level].max_lazy,$.good_match=k1[$.level].good_length,$.nice_match=k1[$.level].nice_length,$.max_chain_length=k1[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=g-1,$.match_available=0,$.ins_h=0}function uX(){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=H6,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 Q0.Buf16(TX*2),this.dyn_dtree=new Q0.Buf16((2*xX+1)*2),this.bl_tree=new Q0.Buf16((2*SX+1)*2),l0(this.dyn_ltree),l0(this.dyn_dtree),l0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q0.Buf16(yX+1),this.heap=new Q0.Buf16(2*H2+1),l0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q0.Buf16(2*H2+1),l0(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 tQ($){var Q;if(!$||!$.state)return i0($,F0);if($.total_in=$.total_out=0,$.data_type=CX,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?P6:q1,$.adler=Q.wrap===2?0:1,Q.last_flush=V1,j0._tr_init(Q),A0}function eQ($){var Q=tQ($);if(Q===A0)pX($.state);return Q}function dX($,Q){if(!$||!$.state)return F0;if($.state.wrap!==2)return F0;return $.state.gzhead=Q,A0}function $7($,Q,J,q,Y,G){if(!$)return F0;var V=1;if(Q===wX)Q=6;if(q<0)V=0,q=-q;else if(q>15)V=2,q-=16;if(Y<1||Y>AX||J!==H6||q<8||q>15||Q<0||Q>9||G<0||G>DX)return i0($,F0);if(q===8)q=9;var X=new uX;return $.state=X,X.strm=$,X.wrap=V,X.gzhead=null,X.w_bits=q,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=Y+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+g-1)/g),X.window=new Q0.Buf8(X.w_size*2),X.head=new Q0.Buf16(X.hash_size),X.prev=new Q0.Buf16(X.w_size),X.lit_bufsize=1<<Y+6,X.pending_buf_size=X.lit_bufsize*4,X.pending_buf=new Q0.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=Q,X.strategy=G,X.method=J,eQ($)}function lX($,Q){return $7($,Q,H6,RX,kX,vX)}function oX($,Q){var J,q,Y,G;if(!$||!$.state||Q>iQ||Q<0)return $?i0($,F0):F0;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===L8&&Q!==n0)return i0($,$.avail_out===0?j2:F0);if(q.strm=$,J=q.last_flush,q.last_flush=Q,q.status===P6)if(q.wrap===2)if($.adler=0,x(q,31),x(q,139),x(q,8),!q.gzhead)x(q,0),x(q,0),x(q,0),x(q,0),x(q,0),x(q,q.level===9?2:q.strategy>=U6||q.level<2?4:0),x(q,fX),q.status=q1;else{if(x(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)),x(q,q.gzhead.time&255),x(q,q.gzhead.time>>8&255),x(q,q.gzhead.time>>16&255),x(q,q.gzhead.time>>24&255),x(q,q.level===9?2:q.strategy>=U6||q.level<2?4:0),x(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)x(q,q.gzhead.extra.length&255),x(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=u0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=P2}else{var V=H6+(q.w_bits-8<<4)<<8,X=-1;if(q.strategy>=U6||q.level<2)X=0;else if(q.level<6)X=1;else if(q.level===6)X=2;else X=3;if(V|=X<<6,q.strstart!==0)V|=hX;if(V+=31-V%31,q.status=q1,z8(q,V),q.strstart!==0)z8(q,$.adler>>>16),z8(q,$.adler&65535);$.adler=1}if(q.status===P2)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=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size)break}x(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=W6}else q.status=W6;if(q.status===W6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.name.length)G=q.gzhead.name.charCodeAt(q.gzindex++)&255;else G=0;x(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.gzindex=0,q.status=j6}else q.status=j6;if(q.status===j6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.comment.length)G=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else G=0;x(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.status=F6}else q.status=F6;if(q.status===F6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)d0($);if(q.pending+2<=q.pending_buf_size)x(q,$.adler&255),x(q,$.adler>>8&255),$.adler=0,q.status=q1}else q.status=q1;if(q.pending!==0){if(d0($),$.avail_out===0)return q.last_flush=-1,A0}else if($.avail_in===0&&rQ(Q)<=rQ(J)&&Q!==n0)return i0($,j2);if(q.status===L8&&$.avail_in!==0)return i0($,j2);if($.avail_in!==0||q.lookahead!==0||Q!==V1&&q.status!==L8){var W=q.strategy===U6?cX(q,Q):q.strategy===BX?mX(q,Q):k1[q.level].func(q,Q);if(W===Y1||W===E1)q.status=L8;if(W===l||W===Y1){if($.avail_out===0)q.last_flush=-1;return A0}if(W===M8){if(Q===MX)j0._tr_align(q);else if(Q!==iQ){if(j0._tr_stored_block(q,0,0,!1),Q===IX){if(l0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(d0($),$.avail_out===0)return q.last_flush=-1,A0}}if(Q!==n0)return A0;if(q.wrap<=0)return nQ;if(q.wrap===2)x(q,$.adler&255),x(q,$.adler>>8&255),x(q,$.adler>>16&255),x(q,$.adler>>24&255),x(q,$.total_in&255),x(q,$.total_in>>8&255),x(q,$.total_in>>16&255),x(q,$.total_in>>24&255);else z8(q,$.adler>>>16),z8(q,$.adler&65535);if(d0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?A0:nQ}function iX($){var Q;if(!$||!$.state)return F0;if(Q=$.state.status,Q!==P6&&Q!==P2&&Q!==W6&&Q!==j6&&Q!==F6&&Q!==q1&&Q!==L8)return i0($,F0);return $.state=null,Q===q1?i0($,NX):A0}function nX($,Q){var J=Q.length,q,Y,G,V,X,W,K,U;if(!$||!$.state)return F0;if(q=$.state,V=q.wrap,V===2||V===1&&q.status!==P6||q.lookahead)return F0;if(V===1)$.adler=aQ($.adler,Q,J,0);if(q.wrap=0,J>=q.w_size){if(V===0)l0(q.head),q.strstart=0,q.block_start=0,q.insert=0;U=new Q0.Buf8(q.w_size),Q0.arraySet(U,Q,J-q.w_size,q.w_size,0),Q=U,J=q.w_size}X=$.avail_in,W=$.next_in,K=$.input,$.avail_in=J,$.next_in=0,$.input=Q,G1(q);while(q.lookahead>=g){Y=q.strstart,G=q.lookahead-(g-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+g-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--G);q.strstart=Y,q.lookahead=g-1,G1(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=g-1,q.match_available=0,$.next_in=W,$.input=K,$.avail_in=X,q.wrap=V,A0}rX.deflateInit=lX;rX.deflateInit2=$7;rX.deflateReset=eQ;rX.deflateResetKeep=tQ;rX.deflateSetHeader=dX;rX.deflate=oX;rX.deflateEnd=iX;rX.deflateSetDictionary=nX;rX.deflateInfo="pako deflate (from Nodeca project)"});var Z2=D((GK)=>{var Z6=y0(),J7=!0,q7=!0;try{String.fromCharCode.apply(null,[0])}catch($){J7=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){q7=!1}var I8=new Z6.Buf8(256);for(R0=0;R0<256;R0++)I8[R0]=R0>=252?6:R0>=248?5:R0>=240?4:R0>=224?3:R0>=192?2:1;var R0;I8[254]=I8[254]=1;GK.string2buf=function($){var Q,J,q,Y,G,V=$.length,X=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}X+=J<128?1:J<2048?2:J<65536?3:4}Q=new Z6.Buf8(X);for(G=0,Y=0;G<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q};function Y7($,Q){if(Q<65534){if($.subarray&&q7||!$.subarray&&J7)return String.fromCharCode.apply(null,Z6.shrinkBuf($,Q))}var J="";for(var q=0;q<Q;q++)J+=String.fromCharCode($[q]);return J}GK.buf2binstring=function($){return Y7($,$.length)};GK.binstring2buf=function($){var Q=new Z6.Buf8($.length);for(var J=0,q=Q.length;J<q;J++)Q[J]=$.charCodeAt(J);return Q};GK.buf2string=function($,Q){var J,q,Y,G,V=Q||$.length,X=Array(V*2);for(q=0,J=0;J<V;){if(Y=$[J++],Y<128){X[q++]=Y;continue}if(G=I8[Y],G>4){X[q++]=65533,J+=G-1;continue}Y&=G===2?31:G===3?15:7;while(G>1&&J<V)Y=Y<<6|$[J++]&63,G--;if(G>1){X[q++]=65533;continue}if(Y<65536)X[q++]=Y;else Y-=65536,X[q++]=55296|Y>>10&1023,X[q++]=56320|Y&1023}return Y7(X,q)};GK.utf8border=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+I8[$[J]]>Q?J:Q}});var z2=D((iH,G7)=>{function jK(){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}G7.exports=jK});var U7=D((IK)=>{var N8=Q7(),w8=y0(),M2=Z2(),I2=K6(),FK=z2(),K7=Object.prototype.toString,HK=0,L2=4,g1=0,V7=1,X7=2,PK=-1,ZK=0,zK=8;function X1($){if(!(this instanceof X1))return new X1($);this.options=w8.assign({level:PK,method:zK,chunkSize:16384,windowBits:15,memLevel:8,strategy:ZK,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 FK,this.strm.avail_out=0;var J=N8.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(J!==g1)throw Error(I2[J]);if(Q.header)N8.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=M2.string2buf(Q.dictionary);else if(K7.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(J=N8.deflateSetDictionary(this.strm,q),J!==g1)throw Error(I2[J]);this._dict_set=!0}}X1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y,G;if(this.ended)return!1;if(G=Q===~~Q?Q:Q===!0?L2:HK,typeof $==="string")J.input=M2.string2buf($);else if(K7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new w8.Buf8(q),J.next_out=0,J.avail_out=q;if(Y=N8.deflate(J,G),Y!==V7&&Y!==g1)return this.onEnd(Y),this.ended=!0,!1;if(J.avail_out===0||J.avail_in===0&&(G===L2||G===X7))if(this.options.to==="string")this.onData(M2.buf2binstring(w8.shrinkBuf(J.output,J.next_out)));else this.onData(w8.shrinkBuf(J.output,J.next_out))}while((J.avail_in>0||J.avail_out===0)&&Y!==V7);if(G===L2)return Y=N8.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===g1;if(G===X7)return this.onEnd(g1),J.avail_out=0,!0;return!0};X1.prototype.onData=function($){this.chunks.push($)};X1.prototype.onEnd=function($){if($===g1)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=w8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function N2($,Q){var J=new X1(Q);if(J.push($,!0),J.err)throw J.msg||I2[J.err];return J.result}function LK($,Q){return Q=Q||{},Q.raw=!0,N2($,Q)}function MK($,Q){return Q=Q||{},Q.gzip=!0,N2($,Q)}IK.Deflate=X1;IK.deflate=N2;IK.deflateRaw=LK;IK.gzip=MK});var j7=D((rH,W7)=>{var z6=30,DK=12;W7.exports=function(Q,J){var q,Y,G,V,X,W,K,U,F,j,H,Z,z,w,N,P,O,M,L,A,C,B,R,E,v;q=Q.state,Y=Q.next_in,E=Q.input,G=Y+(Q.avail_in-5),V=Q.next_out,v=Q.output,X=V-(J-Q.avail_out),W=V+(Q.avail_out-257),K=q.dmax,U=q.wsize,F=q.whave,j=q.wnext,H=q.window,Z=q.hold,z=q.bits,w=q.lencode,N=q.distcode,P=(1<<q.lenbits)-1,O=(1<<q.distbits)-1;$:do{if(z<15)Z+=E[Y++]<<z,z+=8,Z+=E[Y++]<<z,z+=8;M=w[Z&P];Q:for(;;){if(L=M>>>24,Z>>>=L,z-=L,L=M>>>16&255,L===0)v[V++]=M&65535;else if(L&16){if(A=M&65535,L&=15,L){if(z<L)Z+=E[Y++]<<z,z+=8;A+=Z&(1<<L)-1,Z>>>=L,z-=L}if(z<15)Z+=E[Y++]<<z,z+=8,Z+=E[Y++]<<z,z+=8;M=N[Z&O];J:for(;;){if(L=M>>>24,Z>>>=L,z-=L,L=M>>>16&255,L&16){if(C=M&65535,L&=15,z<L){if(Z+=E[Y++]<<z,z+=8,z<L)Z+=E[Y++]<<z,z+=8}if(C+=Z&(1<<L)-1,C>K){Q.msg="invalid distance too far back",q.mode=z6;break $}if(Z>>>=L,z-=L,L=V-X,C>L){if(L=C-L,L>F){if(q.sane){Q.msg="invalid distance too far back",q.mode=z6;break $}}if(B=0,R=H,j===0){if(B+=U-L,L<A){A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}}else if(j<L){if(B+=U+j-L,L-=j,L<A){A-=L;do v[V++]=H[B++];while(--L);if(B=0,j<A){L=j,A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}}}else if(B+=j-L,L<A){A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}while(A>2)v[V++]=R[B++],v[V++]=R[B++],v[V++]=R[B++],A-=3;if(A){if(v[V++]=R[B++],A>1)v[V++]=R[B++]}}else{B=V-C;do v[V++]=v[B++],v[V++]=v[B++],v[V++]=v[B++],A-=3;while(A>2);if(A){if(v[V++]=v[B++],A>1)v[V++]=v[B++]}}}else if((L&64)===0){M=N[(M&65535)+(Z&(1<<L)-1)];continue J}else{Q.msg="invalid distance code",q.mode=z6;break $}break}}else if((L&64)===0){M=w[(M&65535)+(Z&(1<<L)-1)];continue Q}else if(L&32){q.mode=DK;break $}else{Q.msg="invalid literal/length code",q.mode=z6;break $}break}}while(Y<G&&V<W);A=z>>3,Y-=A,z-=A<<3,Z&=(1<<z)-1,Q.next_in=Y,Q.next_out=V,Q.avail_in=Y<G?5+(G-Y):5-(Y-G),Q.avail_out=V<W?257+(W-V):257-(V-W),q.hold=Z,q.bits=z;return}});var M7=D((aH,L7)=>{var F7=y0(),x1=15,H7=852,P7=592,Z7=0,w2=1,z7=2,vK=[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],CK=[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],AK=[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],RK=[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];L7.exports=function(Q,J,q,Y,G,V,X,W){var K=W.bits,U=0,F=0,j=0,H=0,Z=0,z=0,w=0,N=0,P=0,O=0,M,L,A,C,B,R=null,E=0,v,i=new F7.Buf16(x1+1),K0=new F7.Buf16(x1+1),y=null,e=0,U0,q0,E0;for(U=0;U<=x1;U++)i[U]=0;for(F=0;F<Y;F++)i[J[q+F]]++;Z=K;for(H=x1;H>=1;H--)if(i[H]!==0)break;if(Z>H)Z=H;if(H===0)return G[V++]=20971520,G[V++]=20971520,W.bits=1,0;for(j=1;j<H;j++)if(i[j]!==0)break;if(Z<j)Z=j;N=1;for(U=1;U<=x1;U++)if(N<<=1,N-=i[U],N<0)return-1;if(N>0&&(Q===Z7||H!==1))return-1;K0[1]=0;for(U=1;U<x1;U++)K0[U+1]=K0[U]+i[U];for(F=0;F<Y;F++)if(J[q+F]!==0)X[K0[J[q+F]]++]=F;if(Q===Z7)R=y=X,v=19;else if(Q===w2)R=vK,E-=257,y=CK,e-=257,v=256;else R=AK,y=RK,v=-1;if(O=0,F=0,U=j,B=V,z=Z,w=0,A=-1,P=1<<Z,C=P-1,Q===w2&&P>H7||Q===z7&&P>P7)return 1;for(;;){if(U0=U-w,X[F]<v)q0=0,E0=X[F];else if(X[F]>v)q0=y[e+X[F]],E0=R[E+X[F]];else q0=96,E0=0;M=1<<U-w,L=1<<z,j=L;do L-=M,G[B+(O>>w)+L]=U0<<24|q0<<16|E0|0;while(L!==0);M=1<<U-1;while(O&M)M>>=1;if(M!==0)O&=M-1,O+=M;else O=0;if(F++,--i[U]===0){if(U===H)break;U=J[q+X[F]]}if(U>Z&&(O&C)!==A){if(w===0)w=Z;B+=j,z=U-w,N=1<<z;while(z+w<H){if(N-=i[z+w],N<=0)break;z++,N<<=1}if(P+=1<<z,Q===w2&&P>H7||Q===z7&&P>P7)return 1;A=O&C,G[A]=Z<<24|z<<16|B-V|0}}if(O!==0)G[B+O]=U-w<<24|4194304|0;return W.bits=Z,0}});var e7=D((iK)=>{var V0=y0(),A2=U2(),k0=W2(),kK=j7(),O8=M7(),EK=0,d7=1,l7=2,I7=4,gK=5,L6=6,K1=0,xK=1,SK=2,H0=-2,o7=-3,R2=-4,TK=-5,N7=8,i7=1,w7=2,O7=3,B7=4,D7=5,v7=6,C7=7,A7=8,R7=9,k7=10,N6=11,f0=12,O2=13,E7=14,B2=15,g7=16,x7=17,S7=18,T7=19,M6=20,I6=21,y7=22,h7=23,f7=24,b7=25,_7=26,D2=27,m7=28,c7=29,_=30,k2=31,yK=32,hK=852,fK=592,bK=15,_K=bK;function p7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function mK(){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 V0.Buf16(320),this.work=new V0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function n7($){var Q;if(!$||!$.state)return H0;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=i7,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new V0.Buf32(hK),Q.distcode=Q.distdyn=new V0.Buf32(fK),Q.sane=1,Q.back=-1,K1}function r7($){var Q;if(!$||!$.state)return H0;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,n7($)}function a7($,Q){var J,q;if(!$||!$.state)return H0;if(q=$.state,Q<0)J=0,Q=-Q;else if(J=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return H0;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=J,q.wbits=Q,r7($)}function s7($,Q){var J,q;if(!$)return H0;if(q=new mK,$.state=q,q.window=null,J=a7($,Q),J!==K1)$.state=null;return J}function cK($){return s7($,_K)}var u7=!0,v2,C2;function pK($){if(u7){var Q;v2=new V0.Buf32(512),C2=new V0.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;O8(d7,$.lens,0,288,v2,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;O8(l7,$.lens,0,32,C2,0,$.work,{bits:5}),u7=!1}$.lencode=v2,$.lenbits=9,$.distcode=C2,$.distbits=5}function t7($,Q,J,q){var Y,G=$.state;if(G.window===null)G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new V0.Buf8(G.wsize);if(q>=G.wsize)V0.arraySet(G.window,Q,J-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize;else{if(Y=G.wsize-G.wnext,Y>q)Y=q;if(V0.arraySet(G.window,Q,J-q,Y,G.wnext),q-=Y,q)V0.arraySet(G.window,Q,J-q,q,0),G.wnext=q,G.whave=G.wsize;else{if(G.wnext+=Y,G.wnext===G.wsize)G.wnext=0;if(G.whave<G.wsize)G.whave+=Y}}return 0}function uK($,Q){var J,q,Y,G,V,X,W,K,U,F,j,H,Z,z,w=0,N,P,O,M,L,A,C,B,R=new V0.Buf8(4),E,v,i=[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 H0;if(J=$.state,J.mode===f0)J.mode=O2;V=$.next_out,Y=$.output,W=$.avail_out,G=$.next_in,q=$.input,X=$.avail_in,K=J.hold,U=J.bits,F=X,j=W,B=K1;$:for(;;)switch(J.mode){case i7:if(J.wrap===0){J.mode=O2;break}while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.wrap&2&&K===35615){J.check=0,R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0),K=0,U=0,J.mode=w7;break}if(J.flags=0,J.head)J.head.done=!1;if(!(J.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",J.mode=_;break}if((K&15)!==N7){$.msg="unknown compression method",J.mode=_;break}if(K>>>=4,U-=4,C=(K&15)+8,J.wbits===0)J.wbits=C;else if(C>J.wbits){$.msg="invalid window size",J.mode=_;break}J.dmax=1<<C,$.adler=J.check=1,J.mode=K&512?k7:f0,K=0,U=0;break;case w7:while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.flags=K,(J.flags&255)!==N7){$.msg="unknown compression method",J.mode=_;break}if(J.flags&57344){$.msg="unknown header flags set",J.mode=_;break}if(J.head)J.head.text=K>>8&1;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0,J.mode=O7;case O7:while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.head)J.head.time=K;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,R[2]=K>>>16&255,R[3]=K>>>24&255,J.check=k0(J.check,R,4,0);K=0,U=0,J.mode=B7;case B7:while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.head)J.head.xflags=K&255,J.head.os=K>>8;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0,J.mode=D7;case D7:if(J.flags&1024){while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.length=K,J.head)J.head.extra_len=K;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0}else if(J.head)J.head.extra=null;J.mode=v7;case v7:if(J.flags&1024){if(H=J.length,H>X)H=X;if(H){if(J.head){if(C=J.head.extra_len-J.length,!J.head.extra)J.head.extra=Array(J.head.extra_len);V0.arraySet(J.head.extra,q,G,H,C)}if(J.flags&512)J.check=k0(J.check,q,H,G);X-=H,G+=H,J.length-=H}if(J.length)break $}J.length=0,J.mode=C7;case C7:if(J.flags&2048){if(X===0)break $;H=0;do if(C=q[G+H++],J.head&&C&&J.length<65536)J.head.name+=String.fromCharCode(C);while(C&&H<X);if(J.flags&512)J.check=k0(J.check,q,H,G);if(X-=H,G+=H,C)break $}else if(J.head)J.head.name=null;J.length=0,J.mode=A7;case A7:if(J.flags&4096){if(X===0)break $;H=0;do if(C=q[G+H++],J.head&&C&&J.length<65536)J.head.comment+=String.fromCharCode(C);while(C&&H<X);if(J.flags&512)J.check=k0(J.check,q,H,G);if(X-=H,G+=H,C)break $}else if(J.head)J.head.comment=null;J.mode=R7;case R7:if(J.flags&512){while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K!==(J.check&65535)){$.msg="header crc mismatch",J.mode=_;break}K=0,U=0}if(J.head)J.head.hcrc=J.flags>>9&1,J.head.done=!0;$.adler=J.check=0,J.mode=f0;break;case k7:while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}$.adler=J.check=p7(K),K=0,U=0,J.mode=N6;case N6:if(J.havedict===0)return $.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,SK;$.adler=J.check=1,J.mode=f0;case f0:if(Q===gK||Q===L6)break $;case O2:if(J.last){K>>>=U&7,U-=U&7,J.mode=D2;break}while(U<3){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}switch(J.last=K&1,K>>>=1,U-=1,K&3){case 0:J.mode=E7;break;case 1:if(pK(J),J.mode=M6,Q===L6){K>>>=2,U-=2;break $}break;case 2:J.mode=x7;break;case 3:$.msg="invalid block type",J.mode=_}K>>>=2,U-=2;break;case E7:K>>>=U&7,U-=U&7;while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",J.mode=_;break}if(J.length=K&65535,K=0,U=0,J.mode=B2,Q===L6)break $;case B2:J.mode=g7;case g7:if(H=J.length,H){if(H>X)H=X;if(H>W)H=W;if(H===0)break $;V0.arraySet(Y,q,G,H,V),X-=H,G+=H,W-=H,V+=H,J.length-=H;break}J.mode=f0;break;case x7:while(U<14){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.nlen=(K&31)+257,K>>>=5,U-=5,J.ndist=(K&31)+1,K>>>=5,U-=5,J.ncode=(K&15)+4,K>>>=4,U-=4,J.nlen>286||J.ndist>30){$.msg="too many length or distance symbols",J.mode=_;break}J.have=0,J.mode=S7;case S7:while(J.have<J.ncode){while(U<3){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.lens[i[J.have++]]=K&7,K>>>=3,U-=3}while(J.have<19)J.lens[i[J.have++]]=0;if(J.lencode=J.lendyn,J.lenbits=7,E={bits:J.lenbits},B=O8(EK,J.lens,0,19,J.lencode,0,J.work,E),J.lenbits=E.bits,B){$.msg="invalid code lengths set",J.mode=_;break}J.have=0,J.mode=T7;case T7:while(J.have<J.nlen+J.ndist){for(;;){if(w=J.lencode[K&(1<<J.lenbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(O<16)K>>>=N,U-=N,J.lens[J.have++]=O;else{if(O===16){v=N+2;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K>>>=N,U-=N,J.have===0){$.msg="invalid bit length repeat",J.mode=_;break}C=J.lens[J.have-1],H=3+(K&3),K>>>=2,U-=2}else if(O===17){v=N+3;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=N,U-=N,C=0,H=3+(K&7),K>>>=3,U-=3}else{v=N+7;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=N,U-=N,C=0,H=11+(K&127),K>>>=7,U-=7}if(J.have+H>J.nlen+J.ndist){$.msg="invalid bit length repeat",J.mode=_;break}while(H--)J.lens[J.have++]=C}}if(J.mode===_)break;if(J.lens[256]===0){$.msg="invalid code -- missing end-of-block",J.mode=_;break}if(J.lenbits=9,E={bits:J.lenbits},B=O8(d7,J.lens,0,J.nlen,J.lencode,0,J.work,E),J.lenbits=E.bits,B){$.msg="invalid literal/lengths set",J.mode=_;break}if(J.distbits=6,J.distcode=J.distdyn,E={bits:J.distbits},B=O8(l7,J.lens,J.nlen,J.ndist,J.distcode,0,J.work,E),J.distbits=E.bits,B){$.msg="invalid distances set",J.mode=_;break}if(J.mode=M6,Q===L6)break $;case M6:J.mode=I6;case I6:if(X>=6&&W>=258){if($.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,kK($,j),V=$.next_out,Y=$.output,W=$.avail_out,G=$.next_in,q=$.input,X=$.avail_in,K=J.hold,U=J.bits,J.mode===f0)J.back=-1;break}J.back=0;for(;;){if(w=J.lencode[K&(1<<J.lenbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(P&&(P&240)===0){M=N,L=P,A=O;for(;;){if(w=J.lencode[A+((K&(1<<M+L)-1)>>M)],N=w>>>24,P=w>>>16&255,O=w&65535,M+N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=M,U-=M,J.back+=M}if(K>>>=N,U-=N,J.back+=N,J.length=O,P===0){J.mode=_7;break}if(P&32){J.back=-1,J.mode=f0;break}if(P&64){$.msg="invalid literal/length code",J.mode=_;break}J.extra=P&15,J.mode=y7;case y7:if(J.extra){v=J.extra;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.length+=K&(1<<J.extra)-1,K>>>=J.extra,U-=J.extra,J.back+=J.extra}J.was=J.length,J.mode=h7;case h7:for(;;){if(w=J.distcode[K&(1<<J.distbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if((P&240)===0){M=N,L=P,A=O;for(;;){if(w=J.distcode[A+((K&(1<<M+L)-1)>>M)],N=w>>>24,P=w>>>16&255,O=w&65535,M+N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=M,U-=M,J.back+=M}if(K>>>=N,U-=N,J.back+=N,P&64){$.msg="invalid distance code",J.mode=_;break}J.offset=O,J.extra=P&15,J.mode=f7;case f7:if(J.extra){v=J.extra;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.offset+=K&(1<<J.extra)-1,K>>>=J.extra,U-=J.extra,J.back+=J.extra}if(J.offset>J.dmax){$.msg="invalid distance too far back",J.mode=_;break}J.mode=b7;case b7:if(W===0)break $;if(H=j-W,J.offset>H){if(H=J.offset-H,H>J.whave){if(J.sane){$.msg="invalid distance too far back",J.mode=_;break}}if(H>J.wnext)H-=J.wnext,Z=J.wsize-H;else Z=J.wnext-H;if(H>J.length)H=J.length;z=J.window}else z=Y,Z=V-J.offset,H=J.length;if(H>W)H=W;W-=H,J.length-=H;do Y[V++]=z[Z++];while(--H);if(J.length===0)J.mode=I6;break;case _7:if(W===0)break $;Y[V++]=J.length,W--,J.mode=I6;break;case D2:if(J.wrap){while(U<32){if(X===0)break $;X--,K|=q[G++]<<U,U+=8}if(j-=W,$.total_out+=j,J.total+=j,j)$.adler=J.check=J.flags?k0(J.check,Y,j,V-j):A2(J.check,Y,j,V-j);if(j=W,(J.flags?K:p7(K))!==J.check){$.msg="incorrect data check",J.mode=_;break}K=0,U=0}J.mode=m7;case m7:if(J.wrap&&J.flags){while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K!==(J.total&4294967295)){$.msg="incorrect length check",J.mode=_;break}K=0,U=0}J.mode=c7;case c7:B=xK;break $;case _:B=o7;break $;case k2:return R2;case yK:default:return H0}if($.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,J.wsize||j!==$.avail_out&&J.mode<_&&(J.mode<D2||Q!==I7)){if(t7($,$.output,$.next_out,j-$.avail_out))return J.mode=k2,R2}if(F-=$.avail_in,j-=$.avail_out,$.total_in+=F,$.total_out+=j,J.total+=j,J.wrap&&j)$.adler=J.check=J.flags?k0(J.check,Y,j,$.next_out-j):A2(J.check,Y,j,$.next_out-j);if($.data_type=J.bits+(J.last?64:0)+(J.mode===f0?128:0)+(J.mode===M6||J.mode===B2?256:0),(F===0&&j===0||Q===I7)&&B===K1)B=TK;return B}function dK($){if(!$||!$.state)return H0;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,K1}function lK($,Q){var J;if(!$||!$.state)return H0;if(J=$.state,(J.wrap&2)===0)return H0;return J.head=Q,Q.done=!1,K1}function oK($,Q){var J=Q.length,q,Y,G;if(!$||!$.state)return H0;if(q=$.state,q.wrap!==0&&q.mode!==N6)return H0;if(q.mode===N6){if(Y=1,Y=A2(Y,Q,J,0),Y!==q.check)return o7}if(G=t7($,Q,J,J),G)return q.mode=k2,R2;return q.havedict=1,K1}iK.inflateReset=r7;iK.inflateReset2=a7;iK.inflateResetKeep=n7;iK.inflateInit=cK;iK.inflateInit2=s7;iK.inflate=uK;iK.inflateEnd=dK;iK.inflateGetHeader=lK;iK.inflateSetDictionary=oK;iK.inflateInfo="pako inflate (from Nodeca project)"});var E2=D((tH,$J)=>{$J.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 JJ=D((eH,QJ)=>{function YU(){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}QJ.exports=YU});var YJ=D((KU)=>{var S1=e7(),B8=y0(),w6=Z2(),p=E2(),g2=K6(),GU=z2(),VU=JJ(),qJ=Object.prototype.toString;function U1($){if(!(this instanceof U1))return new U1($);this.options=B8.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 GU,this.strm.avail_out=0;var J=S1.inflateInit2(this.strm,Q.windowBits);if(J!==p.Z_OK)throw Error(g2[J]);if(this.header=new VU,S1.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=w6.string2buf(Q.dictionary);else if(qJ.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(J=S1.inflateSetDictionary(this.strm,Q.dictionary),J!==p.Z_OK)throw Error(g2[J])}}}U1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,G,V,X,W,K,U=!1;if(this.ended)return!1;if(V=Q===~~Q?Q:Q===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof $==="string")J.input=w6.binstring2buf($);else if(qJ.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new B8.Buf8(q),J.next_out=0,J.avail_out=q;if(G=S1.inflate(J,p.Z_NO_FLUSH),G===p.Z_NEED_DICT&&Y)G=S1.inflateSetDictionary(this.strm,Y);if(G===p.Z_BUF_ERROR&&U===!0)G=p.Z_OK,U=!1;if(G!==p.Z_STREAM_END&&G!==p.Z_OK)return this.onEnd(G),this.ended=!0,!1;if(J.next_out){if(J.avail_out===0||G===p.Z_STREAM_END||J.avail_in===0&&(V===p.Z_FINISH||V===p.Z_SYNC_FLUSH))if(this.options.to==="string"){if(X=w6.utf8border(J.output,J.next_out),W=J.next_out-X,K=w6.buf2string(J.output,X),J.next_out=W,J.avail_out=q-W,W)B8.arraySet(J.output,J.output,X,W,0);this.onData(K)}else this.onData(B8.shrinkBuf(J.output,J.next_out))}if(J.avail_in===0&&J.avail_out===0)U=!0}while((J.avail_in>0||J.avail_out===0)&&G!==p.Z_STREAM_END);if(G===p.Z_STREAM_END)V=p.Z_FINISH;if(V===p.Z_FINISH)return G=S1.inflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===p.Z_OK;if(V===p.Z_SYNC_FLUSH)return this.onEnd(p.Z_OK),J.avail_out=0,!0;return!0};U1.prototype.onData=function($){this.chunks.push($)};U1.prototype.onEnd=function($){if($===p.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=B8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function x2($,Q){var J=new U1(Q);if(J.push($,!0),J.err)throw J.msg||g2[J.err];return J.result}function XU($,Q){return Q=Q||{},Q.raw=!0,x2($,Q)}KU.Inflate=U1;KU.inflate=x2;KU.inflateRaw=XU;KU.ungzip=x2});var XJ=D((QP,VJ)=>{var HU=y0().assign,PU=U7(),ZU=YJ(),zU=E2(),GJ={};HU(GJ,PU,ZU,zU);VJ.exports=GJ});var UJ=D((NU)=>{var LU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",MU=XJ(),KJ=m(),O6=G0(),IU=LU?"uint8array":"array";NU.magic="\b\x00";function W1($,Q){O6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}KJ.inherits(W1,O6);W1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(KJ.transformTo(IU,$.data),!1)};W1.prototype.flush=function(){if(O6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};W1.prototype.cleanUp=function(){O6.prototype.cleanUp.call(this),this._pako=null};W1.prototype._createPako=function(){this._pako=new MU[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};NU.compressWorker=function($){return new W1("Deflate",$)};NU.uncompressWorker=function(){return new W1("Inflate",{})}});var S2=D((DU)=>{var WJ=G0();DU.STORE={magic:"\x00\x00",compressWorker:function(){return new WJ("STORE compression")},uncompressWorker:function(){return new WJ("STORE decompression")}};DU.DEFLATE=UJ()});var T2=D((AU)=>{AU.LOCAL_FILE_HEADER="PK\x03\x04";AU.CENTRAL_FILE_HEADER="PK\x01\x02";AU.CENTRAL_DIRECTORY_END="PK\x05\x06";AU.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";AU.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";AU.DATA_DESCRIPTOR="PK\x07\b"});var PJ=D((GP,HJ)=>{var T1=m(),y1=G0(),y2=D1(),jJ=Y6(),B6=T2(),f=function($,Q){var J="",q;for(q=0;q<Q;q++)J+=String.fromCharCode($&255),$=$>>>8;return J},TU=function($,Q){var J=$;if(!$)J=Q?16893:33204;return(J&65535)<<16},yU=function($){return($||0)&63},FJ=function($,Q,J,q,Y,G){var{file:V,compression:X}=$,W=G!==y2.utf8encode,K=T1.transformTo("string",G(V.name)),U=T1.transformTo("string",y2.utf8encode(V.name)),F=V.comment,j=T1.transformTo("string",G(F)),H=T1.transformTo("string",y2.utf8encode(F)),Z=U.length!==V.name.length,z=H.length!==F.length,w,N,P="",O="",M="",L=V.dir,A=V.date,C={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||J)C.crc32=$.crc32,C.compressedSize=$.compressedSize,C.uncompressedSize=$.uncompressedSize;var B=0;if(Q)B|=8;if(!W&&(Z||z))B|=2048;var R=0,E=0;if(L)R|=16;if(Y==="UNIX")E=798,R|=TU(V.unixPermissions,L);else E=20,R|=yU(V.dosPermissions,L);if(w=A.getUTCHours(),w=w<<6,w=w|A.getUTCMinutes(),w=w<<5,w=w|A.getUTCSeconds()/2,N=A.getUTCFullYear()-1980,N=N<<4,N=N|A.getUTCMonth()+1,N=N<<5,N=N|A.getUTCDate(),Z)O=f(1,1)+f(jJ(K),4)+U,P+="up"+f(O.length,2)+O;if(z)M=f(1,1)+f(jJ(j),4)+H,P+="uc"+f(M.length,2)+M;var v="";v+=`
|
|
3
|
-
\x00`,v+=f(B,2),v+=X.magic,v+=f(w,2),v+=f(N,2),v+=f(C.crc32,4),v+=f(C.compressedSize,4),v+=f(C.uncompressedSize,4),v+=f(K.length,2),v+=f(P.length,2);var i=B6.LOCAL_FILE_HEADER+v+K+P,K0=B6.CENTRAL_FILE_HEADER+f(E,2)+v+f(j.length,2)+"\x00\x00\x00\x00"+f(R,4)+f(q,4)+K+P+j;return{fileRecord:i,dirRecord:K0}},hU=function($,Q,J,q,Y){var G="",V=T1.transformTo("string",Y(q));return G=B6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+f($,2)+f($,2)+f(Q,4)+f(J,4)+f(V.length,2)+V,G},fU=function($){var Q="";return Q=B6.DATA_DESCRIPTOR+f($.crc32,4)+f($.compressedSize,4)+f($.uncompressedSize,4),Q};function M0($,Q,J,q){y1.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=J,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}T1.inherits(M0,y1);M0.prototype.push=function($){var Q=$.meta.percent||0,J=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,y1.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:J?(Q+100*(J-q-1))/J:100}})};M0.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var J=FJ($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:J.fileRecord,meta:{percent:0}})}else this.accumulate=!0};M0.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,J=FJ($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(J.dirRecord),Q)this.push({data:fU($),meta:{percent:100}});else{this.push({data:J.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};M0.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 J=this.bytesWritten-$,q=hU(this.dirRecords.length,J,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};M0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};M0.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(J){Q.processChunk(J)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(J){Q.error(J)}),this};M0.prototype.resume=function(){if(!y1.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};M0.prototype.error=function($){var Q=this._sources;if(!y1.prototype.error.call(this,$))return!1;for(var J=0;J<Q.length;J++)try{Q[J].error($)}catch(q){}return!0};M0.prototype.lock=function(){y1.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};HJ.exports=M0});var ZJ=D((cU)=>{var bU=S2(),_U=PJ(),mU=function($,Q){var J=$||Q,q=bU[J];if(!q)throw Error(J+" is not a valid compression method !");return q};cU.generateWorker=function($,Q,J){var q=new _U(Q.streamFiles,J,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(G,V){Y++;var X=mU(V.options.compression,Q.compression),W=V.options.compressionOptions||Q.compressionOptions||{},K=V.dir,U=V.date;V._compressWorker(X,W).withStreamInfo("file",{name:G,dir:K,date:U,comment:V.comment||"",unixPermissions:V.unixPermissions,dosPermissions:V.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(G){q.error(G)}return q}});var LJ=D((XP,zJ)=>{var uU=m(),D6=G0();function D8($,Q){D6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}uU.inherits(D8,D6);D8.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(J){Q.push({data:J,meta:{percent:0}})}).on("error",function(J){if(Q.isPaused)this.generatedError=J;else Q.error(J)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};D8.prototype.pause=function(){if(!D6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};D8.prototype.resume=function(){if(!D6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};zJ.exports=D8});var AJ=D((KP,CJ)=>{var dU=D1(),v8=m(),wJ=G0(),lU=_$(),OJ=m$(),MJ=G6(),oU=IQ(),iU=ZJ(),IJ=q8(),nU=LJ(),BJ=function($,Q,J){var q=v8.getTypeOf(Q),Y,G=v8.extend(J||{},OJ);if(G.date=G.date||new Date,G.compression!==null)G.compression=G.compression.toUpperCase();if(typeof G.unixPermissions==="string")G.unixPermissions=parseInt(G.unixPermissions,8);if(G.unixPermissions&&G.unixPermissions&16384)G.dir=!0;if(G.dosPermissions&&G.dosPermissions&16)G.dir=!0;if(G.dir)$=DJ($);if(G.createFolders&&(Y=rU($)))vJ.call(this,Y,!0);var V=q==="string"&&G.binary===!1&&G.base64===!1;if(!J||typeof J.binary>"u")G.binary=!V;var X=Q instanceof MJ&&Q.uncompressedSize===0;if(X||G.dir||!Q||Q.length===0)G.base64=!1,G.binary=!0,Q="",G.compression="STORE",q="string";var W=null;if(Q instanceof MJ||Q instanceof wJ)W=Q;else if(IJ.isNode&&IJ.isStream(Q))W=new nU($,Q);else W=v8.prepareContent($,Q,G.binary,G.optimizedBinaryString,G.base64);var K=new oU($,W,G);this.files[$]=K},rU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},DJ=function($){if($.slice(-1)!=="/")$+="/";return $},vJ=function($,Q){if(Q=typeof Q<"u"?Q:OJ.createFolders,$=DJ($),!this.files[$])BJ.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function NJ($){return Object.prototype.toString.call($)==="[object RegExp]"}var aU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,J,q;for(Q in this.files)if(q=this.files[Q],J=Q.slice(this.root.length,Q.length),J&&Q.slice(0,this.root.length)===this.root)$(J,q)},filter:function($){var Q=[];return this.forEach(function(J,q){if($(J,q))Q.push(q)}),Q},file:function($,Q,J){if(arguments.length===1)if(NJ($)){var q=$;return this.filter(function(G,V){return!V.dir&&q.test(G)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,BJ.call(this,$,Q,J);return this},folder:function($){if(!$)return this;if(NJ($))return this.filter(function(Y,G){return G.dir&&$.test(Y)});var Q=this.root+$,J=vJ.call(this,Q),q=this.clone();return q.root=J.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 J=this.filter(function(Y,G){return G.name.slice(0,$.length)===$});for(var q=0;q<J.length;q++)delete this.files[J[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,J={};try{if(J=v8.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:dU.utf8encode}),J.type=J.type.toLowerCase(),J.compression=J.compression.toUpperCase(),J.type==="binarystring")J.type="string";if(!J.type)throw Error("No output type specified.");if(v8.checkSupport(J.type),J.platform==="darwin"||J.platform==="freebsd"||J.platform==="linux"||J.platform==="sunos")J.platform="UNIX";if(J.platform==="win32")J.platform="DOS";var q=J.comment||this.comment||"";Q=iU.generateWorker(this,J,q)}catch(Y){Q=new wJ("error"),Q.error(Y)}return new lU(Q,J.type||"string",J.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};CJ.exports=aU});var h2=D((UP,kJ)=>{var sU=m();function RJ($){this.data=$,this.length=$.length,this.index=0,this.zero=0}RJ.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,J;this.checkOffset($);for(J=this.index+$-1;J>=this.index;J--)Q=(Q<<8)+this.byteAt(J);return this.index+=$,Q},readString:function($){return sU.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))}};kJ.exports=RJ});var f2=D((WP,gJ)=>{var EJ=h2(),tU=m();function h1($){EJ.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}tU.inherits(h1,EJ);h1.prototype.byteAt=function($){return this.data[this.zero+$]};h1.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var G=this.length-4;G>=0;--G)if(this.data[G]===Q&&this.data[G+1]===J&&this.data[G+2]===q&&this.data[G+3]===Y)return G-this.zero;return-1};h1.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),G=this.readData(4);return Q===G[0]&&J===G[1]&&q===G[2]&&Y===G[3]};h1.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};gJ.exports=h1});var TJ=D((jP,SJ)=>{var xJ=h2(),eU=m();function f1($){xJ.call(this,$)}eU.inherits(f1,xJ);f1.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};f1.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};f1.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};f1.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};SJ.exports=f1});var _2=D((FP,hJ)=>{var yJ=f2(),$W=m();function b2($){yJ.call(this,$)}$W.inherits(b2,yJ);b2.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};hJ.exports=b2});var _J=D((HP,bJ)=>{var fJ=_2(),QW=m();function m2($){fJ.call(this,$)}QW.inherits(m2,fJ);m2.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};bJ.exports=m2});var c2=D((PP,cJ)=>{var v6=m(),mJ=T0(),JW=f2(),qW=TJ(),YW=_J(),GW=_2();cJ.exports=function($){var Q=v6.getTypeOf($);if(v6.checkSupport(Q),Q==="string"&&!mJ.uint8array)return new qW($);if(Q==="nodebuffer")return new YW($);if(mJ.uint8array)return new GW(v6.transformTo("uint8array",$));return new JW(v6.transformTo("array",$))}});var lJ=D((ZP,dJ)=>{var p2=c2(),r0=m(),VW=G6(),pJ=Y6(),C6=D1(),A6=S2(),XW=T0(),KW=0,UW=3,WW=function($){for(var Q in A6){if(!Object.prototype.hasOwnProperty.call(A6,Q))continue;if(A6[Q].magic===$)return A6[Q]}return null};function uJ($,Q){this.options=$,this.loadOptions=Q}uJ.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,J;if($.skip(22),this.fileNameLength=$.readInt(2),J=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(J),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=WW(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+r0.pretty(this.compressionMethod)+" unknown (inner file : "+r0.transformTo("string",this.fileName)+")");this.decompressed=new VW(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,$===KW)this.dosPermissions=this.externalFileAttributes&63;if($===UW)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=p2(this.extraFields[1].value);if(this.uncompressedSize===r0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===r0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===r0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===r0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,J,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)J=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[J]={id:J,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=XW.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=C6.utf8decode(this.fileName),this.fileCommentStr=C6.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var J=r0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(J)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=r0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=p2($.value);if(Q.readInt(1)!==1)return null;if(pJ(this.fileName)!==Q.readInt(4))return null;return C6.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=p2($.value);if(Q.readInt(1)!==1)return null;if(pJ(this.fileComment)!==Q.readInt(4))return null;return C6.utf8decode(Q.readData($.length-5))}return null}};dJ.exports=uJ});var nJ=D((zP,iJ)=>{var jW=c2(),b0=m(),I0=T2(),FW=lJ(),HW=T0();function oJ($){this.files=[],this.loadOptions=$}oJ.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 ("+b0.pretty(Q)+", expected "+b0.pretty($)+")")}},isSignature:function($,Q){var J=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(J),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=HW.uint8array?"uint8array":"array",J=b0.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(J)},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,J,q,Y;while(Q<$)J=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[J]={id:J,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(I0.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(I0.CENTRAL_FILE_HEADER))$=new FW({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(I0.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,I0.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 J=$;if(this.checkSignature(I0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===b0.MAX_VALUE_16BITS||this.diskWithCentralDirStart===b0.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===b0.MAX_VALUE_16BITS||this.centralDirRecords===b0.MAX_VALUE_16BITS||this.centralDirSize===b0.MAX_VALUE_32BITS||this.centralDirOffset===b0.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,I0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=J-q;if(Y>0)if(this.isSignature(J,I0.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=jW($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};iJ.exports=oJ});var sJ=D((LP,aJ)=>{var u2=m(),R6=w1(),PW=D1(),ZW=nJ(),zW=u$(),rJ=q8();function LW($){return new R6.Promise(function(Q,J){var q=$.decompressed.getContentWorker().pipe(new zW);q.on("error",function(Y){J(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)J(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}aJ.exports=function($,Q){var J=this;if(Q=u2.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:PW.utf8decode}),rJ.isNode&&rJ.isStream($))return R6.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return u2.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new ZW(Q);return Y.load(q),Y}).then(function(Y){var G=[R6.Promise.resolve(Y)],V=Y.files;if(Q.checkCRC32)for(var X=0;X<V.length;X++)G.push(LW(V[X]));return R6.Promise.all(G)}).then(function(Y){var G=Y.shift(),V=G.files;for(var X=0;X<V.length;X++){var W=V[X],K=W.fileNameStr,U=u2.resolve(W.fileNameStr);if(J.file(U,W.decompressed,{binary:!0,optimizedBinaryString:!0,date:W.date,dir:W.dir,comment:W.fileCommentStr.length?W.fileCommentStr:null,unixPermissions:W.unixPermissions,dosPermissions:W.dosPermissions,createFolders:Q.createFolders}),!W.dir)J.file(U).unsafeOriginalName=K}if(G.zipComment.length)J.comment=G.zipComment;return J})}});var d2=D((MP,tJ)=>{function P0(){if(!(this instanceof P0))return new P0;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 P0;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}P0.prototype=AJ();P0.prototype.loadAsync=sJ();P0.support=T0();P0.defaults=m$();P0.version="3.10.1";P0.loadAsync=function($,Q){return new P0().loadAsync($,Q)};P0.external=w1();tJ.exports=P0});var Q3=D((IP,l2)=>{var E6=process||{},eJ=E6.argv||[],k6=E6.env||{},MW=!(!!k6.NO_COLOR||eJ.includes("--no-color"))&&(!!k6.FORCE_COLOR||eJ.includes("--color")||E6.platform==="win32"||(E6.stdout||{}).isTTY&&k6.TERM!=="dumb"||!!k6.CI),IW=($,Q,J=$)=>(q)=>{let Y=""+q,G=Y.indexOf(Q,$.length);return~G?$+NW(Y,Q,J,G)+Q:$+Y+Q},NW=($,Q,J,q)=>{let Y="",G=0;do Y+=$.substring(G,q)+J,G=q+Q.length,q=$.indexOf(Q,G);while(~q);return Y+$.substring(G)},$3=($=MW)=>{let Q=$?IW:()=>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")}};l2.exports=$3();l2.exports.createColors=$3});function jj($){let Q=$.toLowerCase();if(Q==="read")return"read";if(Q==="edit"||Q==="multiedit")return"edit";if(Q==="write")return"write";if(Q==="bash"||Q==="shell")return"bash";if(Q==="grep")return"grep";if(Q==="glob")return"glob";if(Q==="webfetch"||Q==="websearch")return"webfetch";if(Q==="task"||Q==="agent")return"task";return"unknown"}function N0($,Q){if($==null||typeof $!=="object")return null;let J=$[Q];return typeof J==="string"?J:null}function b3($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function X0($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function _3($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:J,toolInput:q}=$;if(J==="failed")return Q?`${X0(Q,28)} failed`:"Tool failed";let Y=jj(Q),G=J==="done";switch(Y){case"read":{let V=N0(q,"file_path")??N0(q,"path"),X=V?X0(b3(V)):null;if(X)return G?`Read ${X}`:`Reading ${X}`;return G?"Read file":"Reading file"}case"edit":case"write":{let V=N0(q,"file_path")??N0(q,"path"),X=V?X0(b3(V)):null;if(X)return G?`Edited ${X}`:`Editing ${X}`;return G?"Edited file":"Editing file"}case"bash":{let V=N0(q,"description");if(V)return X0(V,40);let X=N0(q,"command");if(X){let W=X0(X.split(/\s+/)[0]??X,24);return G?`Ran ${W}`:`Running ${W}`}return G?"Ran command":"Running command"}case"grep":{let V=N0(q,"pattern");if(V)return G?`Searched “${X0(V,28)}”`:`Searching “${X0(V,28)}”`;return G?"Searched files":"Searching files"}case"glob":{let V=N0(q,"pattern");if(V)return G?`Listed ${X0(V,28)}`:`Listing ${X0(V,28)}`;return G?"Listed files":"Listing files"}case"webfetch":{let V=N0(q,"url");if(V)try{let X=new URL(V).hostname;return G?`Fetched ${X0(X,28)}`:`Fetching ${X0(X,28)}`}catch{}return G?"Fetched web":"Searching web"}case"task":{let V=N0(q,"description")??N0(q,"subject");if(V)return G?"Subagent done":`Spawning ${X0(V,28)}`;return G?"Subagent done":"Spawning subagent"}default:{let V=X0(Q,28);return G?`Called ${V}`:`Calling ${V}`}}}var qq={};W4(qq,{stateForEvent:()=>s3,stateBody:()=>e3,sessionTitle:()=>o3,runBubble:()=>Tj,rememberSessionTitle:()=>l3,readStdin:()=>Qq,pruneSessions:()=>a3,lastAssistantText:()=>r3,eventFromArgs:()=>Jq,clipTitle:()=>i3,clipPreview:()=>n3,bubbleBody:()=>$q,FAILED_DURATION_MS:()=>t3});import{closeSync as Fj,existsSync as Hj,fstatSync as Pj,mkdirSync as Zj,openSync as zj,readdirSync as Lj,readFileSync as u3,readSync as Mj,statSync as Ij,unlinkSync as Nj,writeFileSync as wj}from"node:fs";import{homedir as Oj}from"node:os";import{join as j1}from"node:path";function l3($,Q,J){try{let q=i3(J);if(!q)return;Zj($,{recursive:!0}),wj(j1($,`${Q}.json`),JSON.stringify({title:q,at:Date.now()}))}catch{}}function o3($,Q){try{let J=u3(j1($,`${Q}.json`),"utf8"),q=JSON.parse(J);return typeof q.title==="string"&&q.title.length>0?q.title:null}catch{return null}}function i3($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=m3)return Q;return`${Q.slice(0,m3-1)}…`}function n3($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=c3)return Q;return`${Q.slice(0,c3-1)}…`}function r3($){let Q=null;try{Q=zj($,"r");let J=Pj(Q).size,q=Math.min(J,Rj),Y=Buffer.alloc(q);Mj(Q,Y,0,q,J-q);let G=Y.toString("utf8").split(`
|
|
4
|
-
`);for(let
|
|
5
|
-
`);return}let
|
|
2
|
+
import{createRequire as kh}from"node:module";var yh=Object.create;var{getPrototypeOf:wh,defineProperty:da,getOwnPropertyNames:_h}=Object;var pa=Object.prototype.hasOwnProperty;function bh(e){return this[e]}var xh,Sh,zt=(e,t,r)=>{var i=e!=null&&typeof e==="object";if(i){var n=t?xh??=new WeakMap:Sh??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?yh(wh(e)):{};let a=t||!e||!e.__esModule||!pa.call(e,"default")?da(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let o of _h(e))if(!pa.call(a,o))da(a,o,{get:bh.bind(e,o),enumerable:!0})}if(i)n.set(e,a);return a};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ga=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(i){r=[i]}if(r)throw r[0];return t};var be=kh(import.meta.url);var Gi=T(function(Sb,Aa){var Zi={to(e,t){if(!t)return`\x1B[${e+1}G`;return`\x1B[${t+1};${e+1}H`},move(e,t){let r="";if(e<0)r+=`\x1B[${-e}D`;else if(e>0)r+=`\x1B[${e}C`;if(t<0)r+=`\x1B[${-t}A`;else if(t>0)r+=`\x1B[${t}B`;return r},up:(e=1)=>`\x1B[${e}A`,down:(e=1)=>`\x1B[${e}B`,forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Mh={up:(e=1)=>"\x1B[S".repeat(e),down:(e=1)=>"\x1B[T".repeat(e)},Lh={screen:"\x1B[2J",up:(e=1)=>"\x1B[1J".repeat(e),down:(e=1)=>"\x1B[J".repeat(e),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(e){let t="";for(let r=0;r<e;r++)t+=this.line+(r<e-1?Zi.up():"");if(e)t+=Zi.left;return t}};Aa.exports={cursor:Zi,scroll:Mh,erase:Lh,beep:"\x07"}});var Gt=T(function(sx,an){if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)an.exports={nextTick:ad};else an.exports=process;function ad(e,t,r,i){if(typeof e!=="function")throw TypeError('"callback" argument must be a function');var n=arguments.length,s,a;switch(n){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,i)});default:s=Array(n-1),a=0;while(a<s.length)s[a++]=arguments[a];return process.nextTick(function(){e.apply(null,s)})}}});var ja=T(function(ax,Ua){var od={}.toString;Ua.exports=Array.isArray||function(e){return od.call(e)=="[object Array]"}});var Jt=T(function(on,qa){var Ur=be("buffer"),Oe=Ur.Buffer;function za(e,t){for(var r in e)t[r]=e[r]}if(Oe.from&&Oe.alloc&&Oe.allocUnsafe&&Oe.allocUnsafeSlow)qa.exports=Ur;else za(Ur,on),on.Buffer=gt;function gt(e,t,r){return Oe(e,t,r)}za(Oe,gt);gt.from=function(e,t,r){if(typeof e==="number")throw TypeError("Argument must not be a number");return Oe(e,t,r)};gt.alloc=function(e,t,r){if(typeof e!=="number")throw TypeError("Argument must be a number");var i=Oe(e);if(t!==void 0)if(typeof r==="string")i.fill(t,r);else i.fill(t);else i.fill(0);return i};gt.allocUnsafe=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return Oe(e)};gt.allocUnsafeSlow=function(e){if(typeof e!=="number")throw TypeError("Argument must be a number");return Ur.SlowBuffer(e)}});var mt=T(function(xd){function ld(e){if(Array.isArray)return Array.isArray(e);return jr(e)==="[object Array]"}xd.isArray=ld;function ud(e){return typeof e==="boolean"}xd.isBoolean=ud;function cd(e){return e===null}xd.isNull=cd;function fd(e){return e==null}xd.isNullOrUndefined=fd;function hd(e){return typeof e==="number"}xd.isNumber=hd;function dd(e){return typeof e==="string"}xd.isString=dd;function pd(e){return typeof e==="symbol"}xd.isSymbol=pd;function gd(e){return e===void 0}xd.isUndefined=gd;function md(e){return jr(e)==="[object RegExp]"}xd.isRegExp=md;function vd(e){return typeof e==="object"&&e!==null}xd.isObject=vd;function yd(e){return jr(e)==="[object Date]"}xd.isDate=yd;function wd(e){return jr(e)==="[object Error]"||e instanceof Error}xd.isError=wd;function _d(e){return typeof e==="function"}xd.isFunction=_d;function bd(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e>"u"}xd.isPrimitive=bd;xd.isBuffer=be("buffer").Buffer.isBuffer;function jr(e){return Object.prototype.toString.call(e)}});var Wa=T(function(lx,ln){if(typeof Object.create==="function")ln.exports=function(t,r){if(r)t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})};else ln.exports=function(t,r){if(r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}});var vt=T(function(ux,un){try{if(zr=be("util"),typeof zr.inherits!=="function")throw"";un.exports=zr.inherits}catch(e){un.exports=Wa()}var zr});var Va=T(function(cx,cn){function Md(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}var Ha=Jt().Buffer,Kt=be("util");function Ld(e,t,r){e.copy(t,r)}cn.exports=function(){function e(){Md(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var i={data:r,next:null};if(this.length>0)this.tail.next=i;else this.head=i;this.tail=i,++this.length},e.prototype.unshift=function(r){var i={data:r,next:this.head};if(this.length===0)this.tail=i;this.head=i,++this.length},e.prototype.shift=function(){if(this.length===0)return;var r=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,r},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";var i=this.head,n=""+i.data;while(i=i.next)n+=r+i.data;return n},e.prototype.concat=function(r){if(this.length===0)return Ha.alloc(0);var i=Ha.allocUnsafe(r>>>0),n=this.head,s=0;while(n)Ld(n.data,i,s),s+=n.data.length,n=n.next;return i},e}();if(Kt&&Kt.inspect&&Kt.inspect.custom)cn.exports.prototype[Kt.inspect.custom]=function(){var e=Kt.inspect({length:this.length});return this.constructor.name+" "+e}});var fn=T(function(fx,Za){var qr=Gt();function Ud(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;if(i||n){if(t)t(e);else if(e){if(!this._writableState)qr.nextTick(Wr,this,e);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,qr.nextTick(Wr,this,e)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(e||null,function(s){if(!t&&s){if(!r._writableState)qr.nextTick(Wr,r,s);else if(!r._writableState.errorEmitted)r._writableState.errorEmitted=!0,qr.nextTick(Wr,r,s)}else if(t)t(s)}),this}function jd(){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 Wr(e,t){e.emit("error",t)}Za.exports={destroy:Ud,undestroy:jd}});var Ja=T(function(hx,Ga){Ga.exports=be("util").deprecate});var dn=T(function(dx,io){var Xe=Gt();io.exports=H;function Ya(e){var t=this;this.next=null,this.entry=null,this.finish=function(){sp(t,e)}}var zd=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Xe.nextTick,yt;H.WritableState=Xt;var Xa=Object.create(mt());Xa.inherits=vt();var qd={deprecate:Ja()},Qa=be("stream"),Vr=Jt().Buffer,Wd=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Hd(e){return Vr.from(e)}function Vd(e){return Vr.isBuffer(e)||e instanceof Wd}var eo=fn();Xa.inherits(H,Qa);function Zd(){}function Xt(e,t){yt=yt||Qe(),e=e||{};var r=t instanceof yt;if(this.objectMode=!!e.objectMode,r)this.objectMode=this.objectMode||!!e.writableObjectMode;var i=e.highWaterMark,n=e.writableHighWaterMark,s=this.objectMode?16:16384;if(i||i===0)this.highWaterMark=i;else if(r&&(n||n===0))this.highWaterMark=n;else this.highWaterMark=s;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 a=e.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(o){ep(t,o)},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 Ya(this)}Xt.prototype.getBuffer=function(){var t=this.bufferedRequest,r=[];while(t)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Xt.prototype,"buffer",{get:qd.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var Hr;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")Hr=Function.prototype[Symbol.hasInstance],Object.defineProperty(H,Symbol.hasInstance,{value:function(e){if(Hr.call(this,e))return!0;if(this!==H)return!1;return e&&e._writableState instanceof Xt}});else Hr=function(e){return e instanceof this};function H(e){if(yt=yt||Qe(),!Hr.call(H,this)&&!(this instanceof yt))return new H(e);if(this._writableState=new Xt(e,this),this.writable=!0,e){if(typeof e.write==="function")this._write=e.write;if(typeof e.writev==="function")this._writev=e.writev;if(typeof e.destroy==="function")this._destroy=e.destroy;if(typeof e.final==="function")this._final=e.final}Qa.call(this)}H.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function Gd(e,t){var r=Error("write after end");e.emit("error",r),Xe.nextTick(t,r)}function Jd(e,t,r,i){var n=!0,s=!1;if(r===null)s=TypeError("May not write null values to stream");else if(typeof r!=="string"&&r!==void 0&&!t.objectMode)s=TypeError("Invalid non-string/buffer chunk");if(s)e.emit("error",s),Xe.nextTick(i,s),n=!1;return n}H.prototype.write=function(e,t,r){var i=this._writableState,n=!1,s=!i.objectMode&&Vd(e);if(s&&!Vr.isBuffer(e))e=Hd(e);if(typeof t==="function")r=t,t=null;if(s)t="buffer";else if(!t)t=i.defaultEncoding;if(typeof r!=="function")r=Zd;if(i.ended)Gd(this,r);else if(s||Jd(this,i,e,r))i.pendingcb++,n=Yd(this,i,s,e,t,r);return n};H.prototype.cork=function(){var e=this._writableState;e.corked++};H.prototype.uncork=function(){var e=this._writableState;if(e.corked){if(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest)to(this,e)}};H.prototype.setDefaultEncoding=function(t){if(typeof t==="string")t=t.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function Kd(e,t,r){if(!e.objectMode&&e.decodeStrings!==!1&&typeof t==="string")t=Vr.from(t,r);return t}Object.defineProperty(H.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Yd(e,t,r,i,n,s){if(!r){var a=Kd(t,i,n);if(i!==a)r=!0,n="buffer",i=a}var o=t.objectMode?1:i.length;t.length+=o;var c=t.length<t.highWaterMark;if(!c)t.needDrain=!0;if(t.writing||t.corked){var l=t.lastBufferedRequest;if(t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:s,next:null},l)l.next=t.lastBufferedRequest;else t.bufferedRequest=t.lastBufferedRequest;t.bufferedRequestCount+=1}else hn(e,t,!1,o,i,n,s);return c}function hn(e,t,r,i,n,s,a){if(t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,r)e._writev(n,t.onwrite);else e._write(n,s,t.onwrite);t.sync=!1}function Xd(e,t,r,i,n){if(--t.pendingcb,r)Xe.nextTick(n,i),Xe.nextTick(Yt,e,t),e._writableState.errorEmitted=!0,e.emit("error",i);else n(i),e._writableState.errorEmitted=!0,e.emit("error",i),Yt(e,t)}function Qd(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function ep(e,t){var r=e._writableState,{sync:i,writecb:n}=r;if(Qd(r),t)Xd(e,r,i,t,n);else{var s=ro(r);if(!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest)to(e,r);if(i)zd(Ka,e,r,s,n);else Ka(e,r,s,n)}}function Ka(e,t,r,i){if(!r)tp(e,t);t.pendingcb--,i(),Yt(e,t)}function tp(e,t){if(t.length===0&&t.needDrain)t.needDrain=!1,e.emit("drain")}function to(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=Array(i),s=t.corkedRequestsFree;s.entry=r;var a=0,o=!0;while(r){if(n[a]=r,!r.isBuf)o=!1;r=r.next,a+=1}if(n.allBuffers=o,hn(e,t,!0,t.length,n,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next)t.corkedRequestsFree=s.next,s.next=null;else t.corkedRequestsFree=new Ya(t);t.bufferedRequestCount=0}else{while(r){var c=r.chunk,l=r.encoding,u=r.callback,h=t.objectMode?1:c.length;if(hn(e,t,!1,h,c,l,u),r=r.next,t.bufferedRequestCount--,t.writing)break}if(r===null)t.lastBufferedRequest=null}t.bufferedRequest=r,t.bufferProcessing=!1}H.prototype._write=function(e,t,r){r(Error("_write() is not implemented"))};H.prototype._writev=null;H.prototype.end=function(e,t,r){var i=this._writableState;if(typeof e==="function")r=e,e=null,t=null;else if(typeof t==="function")r=t,t=null;if(e!==null&&e!==void 0)this.write(e,t);if(i.corked)i.corked=1,this.uncork();if(!i.ending)np(this,i,r)};function ro(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function rp(e,t){e._final(function(r){if(t.pendingcb--,r)e.emit("error",r);t.prefinished=!0,e.emit("prefinish"),Yt(e,t)})}function ip(e,t){if(!t.prefinished&&!t.finalCalled)if(typeof e._final==="function")t.pendingcb++,t.finalCalled=!0,Xe.nextTick(rp,e,t);else t.prefinished=!0,e.emit("prefinish")}function Yt(e,t){var r=ro(t);if(r){if(ip(e,t),t.pendingcb===0)t.finished=!0,e.emit("finish")}return r}function np(e,t,r){if(t.ending=!0,Yt(e,t),r)if(t.finished)Xe.nextTick(r);else e.once("finish",r);t.ended=!0,e.writable=!1}function sp(e,t,r){var i=e.entry;e.entry=null;while(i){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(H.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function(e){if(!this._writableState)return;this._writableState.destroyed=e}});H.prototype.destroy=eo.destroy;H.prototype._undestroy=eo.undestroy;H.prototype._destroy=function(e,t){this.end(),t(e)}});var Qe=T(function(px,oo){var no=Gt(),ap=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};oo.exports=Be;var so=Object.create(mt());so.inherits=vt();var ao=gn(),pn=dn();so.inherits(Be,ao);{Zr=ap(pn.prototype);for(Qt=0;Qt<Zr.length;Qt++)if(er=Zr[Qt],!Be.prototype[er])Be.prototype[er]=pn.prototype[er]}var Zr,er,Qt;function Be(e){if(!(this instanceof Be))return new Be(e);if(ao.call(this,e),pn.call(this,e),e&&e.readable===!1)this.readable=!1;if(e&&e.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",op)}Object.defineProperty(Be.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function op(){if(this.allowHalfOpen||this._writableState.ended)return;no.nextTick(lp,this)}function lp(e){e.end()}Object.defineProperty(Be.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function(e){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=e,this._writableState.destroyed=e}});Be.prototype._destroy=function(e,t){this.push(null),this.end(),no.nextTick(t,e)}});var yn=T(function(xp){var vn=Jt().Buffer,lo=vn.isEncoding||function(e){switch(e=""+e,e&&e.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 up(e){if(!e)return"utf8";var t;while(!0)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function cp(e){var t=up(e);if(typeof t!=="string"&&(vn.isEncoding===lo||!lo(e)))throw Error("Unknown encoding: "+e);return t||e}xp.StringDecoder=tr;function tr(e){this.encoding=cp(e);var t;switch(this.encoding){case"utf16le":this.text=mp,this.end=vp,t=4;break;case"utf8":this.fillLast=dp,t=4;break;case"base64":this.text=yp,this.end=wp,t=3;break;default:this.write=_p,this.end=bp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=vn.allocUnsafe(t)}tr.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;if(r<e.length)return t?t+this.text(e,r):this.text(e,r);return t||""};tr.prototype.end=gp;tr.prototype.text=pp;tr.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function mn(e){if(e<=127)return 0;else if(e>>5===6)return 2;else if(e>>4===14)return 3;else if(e>>3===30)return 4;return e>>6===2?-1:-2}function fp(e,t,r){var i=t.length-1;if(i<r)return 0;var n=mn(t[i]);if(n>=0){if(n>0)e.lastNeed=n-1;return n}if(--i<r||n===-2)return 0;if(n=mn(t[i]),n>=0){if(n>0)e.lastNeed=n-2;return n}if(--i<r||n===-2)return 0;if(n=mn(t[i]),n>=0){if(n>0)if(n===2)n=0;else e.lastNeed=n-3;return n}return 0}function hp(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2){if((t[2]&192)!==128)return e.lastNeed=2,"�"}}}function dp(e){var t=this.lastTotal-this.lastNeed,r=hp(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function pp(e,t){var r=fp(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function gp(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+"�";return t}function mp(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function vp(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function yp(e,t){var r=(e.length-t)%3;if(r===0)return e.toString("base64",t);if(this.lastNeed=3-r,this.lastTotal=3,r===1)this.lastChar[0]=e[e.length-1];else this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1];return e.toString("base64",t,e.length-r)}function wp(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed)return t+this.lastChar.toString("base64",0,3-this.lastNeed);return t}function _p(e){return e.toString(this.encoding)}function bp(e){return e&&e.length?this.write(e):""}});var gn=T(function(vx,bo){var _t=Gt();bo.exports=L;var kp=ja(),rr;L.ReadableState=mo;var mx=be("events").EventEmitter,ho=function(e,t){return e.listeners(t).length},Sn=be("stream"),ir=Jt().Buffer,Ep=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function $p(e){return ir.from(e)}function Tp(e){return ir.isBuffer(e)||e instanceof Ep}var po=Object.create(mt());po.inherits=vt();var wn=be("util"),D=void 0;if(wn&&wn.debuglog)D=wn.debuglog("stream");else D=function(){};var Cp=Va(),go=fn(),wt;po.inherits(L,Sn);var _n=["error","close","destroy","pause","resume"];function Ip(e,t,r){if(typeof e.prependListener==="function")return e.prependListener(t,r);if(!e._events||!e._events[t])e.on(t,r);else if(kp(e._events[t]))e._events[t].unshift(r);else e._events[t]=[r,e._events[t]]}function mo(e,t){rr=rr||Qe(),e=e||{};var r=t instanceof rr;if(this.objectMode=!!e.objectMode,r)this.objectMode=this.objectMode||!!e.readableObjectMode;var i=e.highWaterMark,n=e.readableHighWaterMark,s=this.objectMode?16:16384;if(i||i===0)this.highWaterMark=i;else if(r&&(n||n===0))this.highWaterMark=n;else this.highWaterMark=s;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Cp,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=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding){if(!wt)wt=yn().StringDecoder;this.decoder=new wt(e.encoding),this.encoding=e.encoding}}function L(e){if(rr=rr||Qe(),!(this instanceof L))return new L(e);if(this._readableState=new mo(e,this),this.readable=!0,e){if(typeof e.read==="function")this._read=e.read;if(typeof e.destroy==="function")this._destroy=e.destroy}Sn.call(this)}Object.defineProperty(L.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(e){if(!this._readableState)return;this._readableState.destroyed=e}});L.prototype.destroy=go.destroy;L.prototype._undestroy=go.undestroy;L.prototype._destroy=function(e,t){this.push(null),t(e)};L.prototype.push=function(e,t){var r=this._readableState,i;if(!r.objectMode){if(typeof e==="string"){if(t=t||r.defaultEncoding,t!==r.encoding)e=ir.from(e,t),t="";i=!0}}else i=!0;return vo(this,e,t,!1,i)};L.prototype.unshift=function(e){return vo(this,e,null,!0,!1)};function vo(e,t,r,i,n){var s=e._readableState;if(t===null)s.reading=!1,Bp(e,s);else{var a;if(!n)a=Ap(s,t);if(a)e.emit("error",a);else if(s.objectMode||t&&t.length>0){if(typeof t!=="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==ir.prototype)t=$p(t);if(i)if(s.endEmitted)e.emit("error",Error("stream.unshift() after end event"));else bn(e,s,t,!0);else if(s.ended)e.emit("error",Error("stream.push() after EOF"));else if(s.reading=!1,s.decoder&&!r)if(t=s.decoder.write(t),s.objectMode||t.length!==0)bn(e,s,t,!1);else yo(e,s);else bn(e,s,t,!1)}else if(!i)s.reading=!1}return Rp(s)}function bn(e,t,r,i){if(t.flowing&&t.length===0&&!t.sync)e.emit("data",r),e.read(0);else{if(t.length+=t.objectMode?1:r.length,i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)Gr(e)}yo(e,t)}function Ap(e,t){var r;if(!Tp(t)&&typeof t!=="string"&&t!==void 0&&!e.objectMode)r=TypeError("Invalid non-string/buffer chunk");return r}function Rp(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}L.prototype.isPaused=function(){return this._readableState.flowing===!1};L.prototype.setEncoding=function(e){if(!wt)wt=yn().StringDecoder;return this._readableState.decoder=new wt(e),this._readableState.encoding=e,this};var uo=8388608;function Op(e){if(e>=uo)e=uo;else e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++;return e}function co(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e)if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length;if(e>t.highWaterMark)t.highWaterMark=Op(e);if(e<=t.length)return e;if(!t.ended)return t.needReadable=!0,0;return t.length}L.prototype.read=function(e){D("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0)t.emittedReadable=!1;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){if(D("read: emitReadable",t.length,t.ended),t.length===0&&t.ended)xn(this);else Gr(this);return null}if(e=co(e,t),e===0&&t.ended){if(t.length===0)xn(this);return null}var i=t.needReadable;if(D("need readable",i),t.length===0||t.length-e<t.highWaterMark)i=!0,D("length less than watermark",i);if(t.ended||t.reading)i=!1,D("reading or ended",i);else if(i){if(D("do read"),t.reading=!0,t.sync=!0,t.length===0)t.needReadable=!0;if(this._read(t.highWaterMark),t.sync=!1,!t.reading)e=co(r,t)}var n;if(e>0)n=wo(e,t);else n=null;if(n===null)t.needReadable=!0,e=0;else t.length-=e;if(t.length===0){if(!t.ended)t.needReadable=!0;if(r!==e&&t.ended)xn(this)}if(n!==null)this.emit("data",n);return n};function Bp(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();if(r&&r.length)t.buffer.push(r),t.length+=t.objectMode?1:r.length}t.ended=!0,Gr(e)}function Gr(e){var t=e._readableState;if(t.needReadable=!1,!t.emittedReadable)if(D("emitReadable",t.flowing),t.emittedReadable=!0,t.sync)_t.nextTick(fo,e);else fo(e)}function fo(e){D("emit readable"),e.emit("readable"),kn(e)}function yo(e,t){if(!t.readingMore)t.readingMore=!0,_t.nextTick(Dp,e,t)}function Dp(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark)if(D("maybeReadMore read 0"),e.read(0),r===t.length)break;else r=t.length;t.readingMore=!1}L.prototype._read=function(e){this.emit("error",Error("_read() is not implemented"))};L.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,D("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=n?o:b;if(i.endEmitted)_t.nextTick(s);else r.once("end",s);e.on("unpipe",a);function a(w,v){if(D("onunpipe"),w===r){if(v&&v.hasUnpiped===!1)v.hasUnpiped=!0,u()}}function o(){D("onend"),e.end()}var c=Pp(r);e.on("drain",c);var l=!1;function u(){if(D("cleanup"),e.removeListener("close",p),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",d),e.removeListener("unpipe",a),r.removeListener("end",o),r.removeListener("end",b),r.removeListener("data",f),l=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain))c()}var h=!1;r.on("data",f);function f(w){D("ondata"),h=!1;var v=e.write(w);if(v===!1&&!h){if((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&_o(i.pipes,e)!==-1)&&!l)D("false write response, pause",i.awaitDrain),i.awaitDrain++,h=!0;r.pause()}}function d(w){if(D("onerror",w),b(),e.removeListener("error",d),ho(e,"error")===0)e.emit("error",w)}Ip(e,"error",d);function p(){e.removeListener("finish",m),b()}e.once("close",p);function m(){D("onfinish"),e.removeListener("close",p),b()}e.once("finish",m);function b(){D("unpipe"),r.unpipe(e)}if(e.emit("pipe",r),!i.flowing)D("pipe resume"),r.resume();return e};function Pp(e){return function(){var t=e._readableState;if(D("pipeOnDrain",t.awaitDrain),t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&ho(e,"data"))t.flowing=!0,kn(e)}}L.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;if(t.pipes=null,t.pipesCount=0,t.flowing=!1,e)e.emit("unpipe",this,r);return this}if(!e){var{pipes:i,pipesCount:n}=t;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<n;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}var a=_o(t.pipes,e);if(a===-1)return this;if(t.pipes.splice(a,1),t.pipesCount-=1,t.pipesCount===1)t.pipes=t.pipes[0];return e.emit("unpipe",this,r),this};L.prototype.on=function(e,t){var r=Sn.prototype.on.call(this,e,t);if(e==="data"){if(this._readableState.flowing!==!1)this.resume()}else if(e==="readable"){var i=this._readableState;if(!i.endEmitted&&!i.readableListening){if(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,!i.reading)_t.nextTick(Np,this);else if(i.length)Gr(this)}}return r};L.prototype.addListener=L.prototype.on;function Np(e){D("readable nexttick read 0"),e.read(0)}L.prototype.resume=function(){var e=this._readableState;if(!e.flowing)D("resume"),e.flowing=!0,Fp(this,e);return this};function Fp(e,t){if(!t.resumeScheduled)t.resumeScheduled=!0,_t.nextTick(Mp,e,t)}function Mp(e,t){if(!t.reading)D("resume read 0"),e.read(0);if(t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),kn(e),t.flowing&&!t.reading)e.read(0)}L.prototype.pause=function(){if(D("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)D("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function kn(e){var t=e._readableState;D("flow",t.flowing);while(t.flowing&&e.read()!==null);}L.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(D("wrapped end"),r.decoder&&!r.ended){var a=r.decoder.end();if(a&&a.length)t.push(a)}t.push(null)}),e.on("data",function(a){if(D("wrapped data"),r.decoder)a=r.decoder.write(a);if(r.objectMode&&(a===null||a===void 0))return;else if(!r.objectMode&&(!a||!a.length))return;var o=t.push(a);if(!o)i=!0,e.pause()});for(var n in e)if(this[n]===void 0&&typeof e[n]==="function")this[n]=function(a){return function(){return e[a].apply(e,arguments)}}(n);for(var s=0;s<_n.length;s++)e.on(_n[s],this.emit.bind(this,_n[s]));return this._read=function(a){if(D("wrapped _read",a),i)i=!1,e.resume()},this};Object.defineProperty(L.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});L._fromList=wo;function wo(e,t){if(t.length===0)return null;var r;if(t.objectMode)r=t.buffer.shift();else if(!e||e>=t.length){if(t.decoder)r=t.buffer.join("");else if(t.buffer.length===1)r=t.buffer.head.data;else r=t.buffer.concat(t.length);t.buffer.clear()}else r=Lp(e,t.buffer,t.decoder);return r}function Lp(e,t,r){var i;if(e<t.head.data.length)i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e);else if(e===t.head.data.length)i=t.shift();else i=r?Up(e,t):jp(e,t);return i}function Up(e,t){var r=t.head,i=1,n=r.data;e-=n.length;while(r=r.next){var s=r.data,a=e>s.length?s.length:e;if(a===s.length)n+=s;else n+=s.slice(0,e);if(e-=a,e===0){if(a===s.length)if(++i,r.next)t.head=r.next;else t.head=t.tail=null;else t.head=r,r.data=s.slice(a);break}++i}return t.length-=i,n}function jp(e,t){var r=ir.allocUnsafe(e),i=t.head,n=1;i.data.copy(r),e-=i.data.length;while(i=i.next){var s=i.data,a=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,a),e-=a,e===0){if(a===s.length)if(++n,i.next)t.head=i.next;else t.head=t.tail=null;else t.head=i,i.data=s.slice(a);break}++n}return t.length-=n,r}function xn(e){var t=e._readableState;if(t.length>0)throw Error('"endReadable()" called on non-empty stream');if(!t.endEmitted)t.ended=!0,_t.nextTick(zp,t,e)}function zp(e,t){if(!e.endEmitted&&e.length===0)e.endEmitted=!0,t.readable=!1,t.emit("end")}function _o(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var En=T(function(yx,ko){ko.exports=De;var Jr=Qe(),So=Object.create(mt());So.inherits=vt();So.inherits(De,Jr);function qp(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",Error("write callback called multiple times"));if(r.writechunk=null,r.writecb=null,t!=null)this.push(t);i(e);var n=this._readableState;if(n.reading=!1,n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}function De(e){if(!(this instanceof De))return new De(e);if(Jr.call(this,e),this._transformState={afterTransform:qp.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e){if(typeof e.transform==="function")this._transform=e.transform;if(typeof e.flush==="function")this._flush=e.flush}this.on("prefinish",Wp)}function Wp(){var e=this;if(typeof this._flush==="function")this._flush(function(t,r){xo(e,t,r)});else xo(this,null,null)}De.prototype.push=function(e,t){return this._transformState.needTransform=!1,Jr.prototype.push.call(this,e,t)};De.prototype._transform=function(e,t,r){throw Error("_transform() is not implemented")};De.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;if(i.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};De.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&t.writecb&&!t.transforming)t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform);else t.needTransform=!0};De.prototype._destroy=function(e,t){var r=this;Jr.prototype._destroy.call(this,e,function(i){t(i),r.emit("close")})};function xo(e,t,r){if(t)return e.emit("error",t);if(r!=null)e.push(r);if(e._writableState.length)throw Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw Error("Calling transform done when still transforming");return e.push(null)}});var Co=T(function(wx,To){To.exports=nr;var Eo=En(),$o=Object.create(mt());$o.inherits=vt();$o.inherits(nr,Eo);function nr(e){if(!(this instanceof nr))return new nr(e);Eo.call(this,e)}nr.prototype._transform=function(e,t,r){r(null,e)}});var $n=T(function(J,Kr){var Se=be("stream");if(process.env.READABLE_STREAM==="disable"&&Se)Kr.exports=Se,J=Kr.exports=Se.Readable,J.Readable=Se.Readable,J.Writable=Se.Writable,J.Duplex=Se.Duplex,J.Transform=Se.Transform,J.PassThrough=Se.PassThrough,J.Stream=Se;else J=Kr.exports=gn(),J.Stream=Se||J,J.Readable=J,J.Writable=dn(),J.Duplex=Qe(),J.Transform=En(),J.PassThrough=Co()});var Pe=T(function(Vp){Vp.base64=!0;Vp.array=!0;Vp.string=!0;Vp.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Vp.nodebuffer=typeof Buffer<"u";Vp.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Vp.blob=!1;else{Yr=new ArrayBuffer(0);try{Vp.blob=new Blob([Yr],{type:"application/zip"}).size===0}catch(e){try{Cn=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,Xr=new Cn,Xr.append(Yr),Vp.blob=Xr.getBlob("application/zip").size===0}catch(t){Vp.blob=!1}}}var Yr,Cn,Xr;try{Vp.nodestream=!!$n().Readable}catch(e){Vp.nodestream=!1}});var In=T(function(tg){var Qp=j(),eg=Pe(),ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";tg.encode=function(e){var t=[],r,i,n,s,a,o,c,l=0,u=e.length,h=u,f=Qp.getTypeOf(e)!=="string";while(l<e.length){if(h=u-l,!f)r=e.charCodeAt(l++),i=l<u?e.charCodeAt(l++):0,n=l<u?e.charCodeAt(l++):0;else r=e[l++],i=l<u?e[l++]:0,n=l<u?e[l++]:0;s=r>>2,a=(r&3)<<4|i>>4,o=h>1?(i&15)<<2|n>>6:64,c=h>2?n&63:64,t.push(ke.charAt(s)+ke.charAt(a)+ke.charAt(o)+ke.charAt(c))}return t.join("")};tg.decode=function(e){var t,r,i,n,s,a,o,c=0,l=0,u="data:";if(e.substr(0,u.length)===u)throw Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var h=e.length*3/4;if(e.charAt(e.length-1)===ke.charAt(64))h--;if(e.charAt(e.length-2)===ke.charAt(64))h--;if(h%1!==0)throw Error("Invalid base64 input, bad content length.");var f;if(eg.uint8array)f=new Uint8Array(h|0);else f=Array(h|0);while(c<e.length){if(n=ke.indexOf(e.charAt(c++)),s=ke.indexOf(e.charAt(c++)),a=ke.indexOf(e.charAt(c++)),o=ke.indexOf(e.charAt(c++)),t=n<<2|s>>4,r=(s&15)<<4|a>>2,i=(a&3)<<6|o,f[l++]=t,a!==64)f[l++]=r;if(o!==64)f[l++]=i}return f}});var sr=T(function(xx,Io){Io.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);else{if(typeof e==="number")throw Error('The "data" argument must not be a number');return new Buffer(e,t)}},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);else{var t=new Buffer(e);return t.fill(0),t}},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on==="function"&&typeof e.pause==="function"&&typeof e.resume==="function"}}});var Oo=T(function(kx,Ro){var Sx=global.MutationObserver||global.WebKitMutationObserver,Ao;Ao=function(){process.nextTick(lg)};var ng,sg,ag,og,An,ar=[];function lg(){An=!0;var e,t,r=ar.length;while(r){t=ar,ar=[],e=-1;while(++e<r)t[e]();r=ar.length}An=!1}Ro.exports=ug;function ug(e){if(ar.push(e)===1&&!An)Ao()}});var Lo=T(function(Ex,Mo){var Bo=Oo();function xt(){}var X={},Do=["REJECTED"],Rn=["FULFILLED"],Po=["PENDING"];bt=["UNHANDLED"];var bt;Mo.exports=je;function je(e){if(typeof e!=="function")throw TypeError("resolver must be a function");if(this.state=Po,this.queue=[],this.outcome=void 0,this.handled=bt,e!==xt)No(this,e)}je.prototype.finally=function(e){if(typeof e!=="function")return this;var t=this.constructor;return this.then(r,i);function r(n){function s(){return n}return t.resolve(e()).then(s)}function i(n){function s(){throw n}return t.resolve(e()).then(s)}};je.prototype.catch=function(e){return this.then(null,e)};je.prototype.then=function(e,t){if(typeof e!=="function"&&this.state===Rn||typeof t!=="function"&&this.state===Do)return this;var r=new this.constructor(xt);if(this.handled===bt)this.handled=null;if(this.state!==Po){var i=this.state===Rn?e:t;On(r,i,this.outcome)}else this.queue.push(new or(r,e,t));return r};function or(e,t,r){if(this.promise=e,typeof t==="function")this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled;if(typeof r==="function")this.onRejected=r,this.callRejected=this.otherCallRejected}or.prototype.callFulfilled=function(e){X.resolve(this.promise,e)};or.prototype.otherCallFulfilled=function(e){On(this.promise,this.onFulfilled,e)};or.prototype.callRejected=function(e){X.reject(this.promise,e)};or.prototype.otherCallRejected=function(e){On(this.promise,this.onRejected,e)};function On(e,t,r){Bo(function(){var i;try{i=t(r)}catch(n){return X.reject(e,n)}if(i===e)X.reject(e,TypeError("Cannot resolve promise with itself"));else X.resolve(e,i)})}X.resolve=function(e,t){var r=Fo(cg,t);if(r.status==="error")return X.reject(e,r.value);var i=r.value;if(i)No(e,i);else{e.state=Rn,e.outcome=t;var n=-1,s=e.queue.length;while(++n<s)e.queue[n].callFulfilled(t)}return e};X.reject=function(e,t){if(e.state=Do,e.outcome=t,e.handled===bt)Bo(function(){if(e.handled===bt)process.emit("unhandledRejection",t,e)});var r=-1,i=e.queue.length;while(++r<i)e.queue[r].callRejected(t);return e};function cg(e){var t=e&&e.then;if(e&&(typeof e==="object"||typeof e==="function")&&typeof t==="function")return function(){t.apply(e,arguments)}}function No(e,t){var r=!1;function i(o){if(r)return;r=!0,X.reject(e,o)}function n(o){if(r)return;r=!0,X.resolve(e,o)}function s(){t(n,i)}var a=Fo(s);if(a.status==="error")i(a.value)}function Fo(e,t){var r={};try{r.value=e(t),r.status="success"}catch(i){r.status="error",r.value=i}return r}je.resolve=fg;function fg(e){if(e instanceof this)return e;return X.resolve(new this(xt),e)}je.reject=hg;function hg(e){var t=new this(xt);return X.reject(t,e)}je.all=dg;function dg(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);var n=Array(r),s=0,a=-1,o=new this(xt);while(++a<r)c(e[a],a);return o;function c(l,u){t.resolve(l).then(h,function(f){if(!i)i=!0,X.reject(o,f)});function h(f){if(n[u]=f,++s===r&&!i)i=!0,X.resolve(o,n)}}}je.race=pg;function pg(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);var n=-1,s=new this(xt);while(++n<r)a(e[n]);return s;function a(o){t.resolve(o).then(function(c){if(!i)i=!0,X.resolve(s,c)},function(c){if(!i)i=!0,X.reject(s,c)})}}});var St=T(function($x,Uo){var Bn=null;if(typeof Promise<"u")Bn=Promise;else Bn=Lo();Uo.exports={Promise:Bn}});var zo=T(function(jo){(function(e,t){if(e.setImmediate)return;var r=1,i={},n=!1,s=e.document,a;function o(v){if(typeof v!=="function")v=Function(""+v);var S=Array(arguments.length-1);for(var g=0;g<S.length;g++)S[g]=arguments[g+1];var y={callback:v,args:S};return i[r]=y,a(r),r++}function c(v){delete i[v]}function l(v){var{callback:S,args:g}=v;switch(g.length){case 0:S();break;case 1:S(g[0]);break;case 2:S(g[0],g[1]);break;case 3:S(g[0],g[1],g[2]);break;default:S.apply(t,g);break}}function u(v){if(n)setTimeout(u,0,v);else{var S=i[v];if(S){n=!0;try{l(S)}finally{c(v),n=!1}}}}function h(){a=function(v){process.nextTick(function(){u(v)})}}function f(){if(e.postMessage&&!e.importScripts){var v=!0,S=e.onmessage;return e.onmessage=function(){v=!1},e.postMessage("","*"),e.onmessage=S,v}}function d(){var v="setImmediate$"+Math.random()+"$",S=function(g){if(g.source===e&&typeof g.data==="string"&&g.data.indexOf(v)===0)u(+g.data.slice(v.length))};if(e.addEventListener)e.addEventListener("message",S,!1);else e.attachEvent("onmessage",S);a=function(g){e.postMessage(v+g,"*")}}function p(){var v=new MessageChannel;v.port1.onmessage=function(S){var g=S.data;u(g)},a=function(S){v.port2.postMessage(S)}}function m(){var v=s.documentElement;a=function(S){var g=s.createElement("script");g.onreadystatechange=function(){u(S),g.onreadystatechange=null,v.removeChild(g),g=null},v.appendChild(g)}}function b(){a=function(v){setTimeout(u,0,v)}}var w=Object.getPrototypeOf&&Object.getPrototypeOf(e);if(w=w&&w.setTimeout?w:e,{}.toString.call(e.process)==="[object process]")h();else if(f())d();else if(e.MessageChannel)p();else if(s&&"onreadystatechange"in s.createElement("script"))m();else b();w.setImmediate=o,w.clearImmediate=c})(typeof self>"u"?typeof global>"u"?jo:global:self)});var j=T(function(et){var ze=Pe(),gg=In(),kt=sr(),Dn=St();zo();function mg(e){var t=null;if(ze.uint8array)t=new Uint8Array(e.length);else t=Array(e.length);return ei(e,t)}et.newBlob=function(e,t){et.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,i=new r;return i.append(e),i.getBlob(t)}catch(s){throw Error("Bug : can't construct the Blob.")}}};function lr(e){return e}function ei(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var Qr={stringifyByChunk:function(e,t,r){var i=[],n=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);while(n<s){if(t==="array"||t==="nodebuffer")i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,s))));else i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,s))));n+=r}return i.join("")},stringifyByChar:function(e){var t="";for(var r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return ze.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(e){return!1}}(),nodebuffer:function(){try{return ze.nodebuffer&&String.fromCharCode.apply(null,kt.allocBuffer(1)).length===1}catch(e){return!1}}()}};function ur(e){var t=65536,r=et.getTypeOf(e),i=!0;if(r==="uint8array")i=Qr.applyCanBeUsed.uint8array;else if(r==="nodebuffer")i=Qr.applyCanBeUsed.nodebuffer;if(i)while(t>1)try{return Qr.stringifyByChunk(e,r,t)}catch(n){t=Math.floor(t/2)}return Qr.stringifyByChar(e)}et.applyFromCharCode=ur;function ti(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var qe={};qe.string={string:lr,array:function(e){return ei(e,Array(e.length))},arraybuffer:function(e){return qe.string.uint8array(e).buffer},uint8array:function(e){return ei(e,new Uint8Array(e.length))},nodebuffer:function(e){return ei(e,kt.allocBuffer(e.length))}};qe.array={string:ur,array:lr,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return kt.newBufferFrom(e)}};qe.arraybuffer={string:function(e){return ur(new Uint8Array(e))},array:function(e){return ti(new Uint8Array(e),Array(e.byteLength))},arraybuffer:lr,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return kt.newBufferFrom(new Uint8Array(e))}};qe.uint8array={string:ur,array:function(e){return ti(e,Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:lr,nodebuffer:function(e){return kt.newBufferFrom(e)}};qe.nodebuffer={string:ur,array:function(e){return ti(e,Array(e.length))},arraybuffer:function(e){return qe.nodebuffer.uint8array(e).buffer},uint8array:function(e){return ti(e,new Uint8Array(e.length))},nodebuffer:lr};et.transformTo=function(e,t){if(!t)t="";if(!e)return t;et.checkSupport(e);var r=et.getTypeOf(t),i=qe[r][e](t);return i};et.resolve=function(e){var t=e.split("/"),r=[];for(var i=0;i<t.length;i++){var n=t[i];if(n==="."||n===""&&i!==0&&i!==t.length-1)continue;else if(n==="..")r.pop();else r.push(n)}return r.join("/")};et.getTypeOf=function(e){if(typeof e==="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(ze.nodebuffer&&kt.isBuffer(e))return"nodebuffer";if(ze.uint8array&&e instanceof Uint8Array)return"uint8array";if(ze.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};et.checkSupport=function(e){var t=ze[e.toLowerCase()];if(!t)throw Error(e+" is not supported by this platform")};et.MAX_VALUE_16BITS=65535;et.MAX_VALUE_32BITS=-1;et.pretty=function(e){var t="",r,i;for(i=0;i<(e||"").length;i++)r=e.charCodeAt(i),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};et.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};et.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};et.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])if(Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]>"u")e[r]=arguments[t][r];return e};et.prepareContent=function(e,t,r,i,n){var s=Dn.Promise.resolve(t).then(function(a){var o=ze.blob&&(a instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(a))!==-1);if(o&&typeof FileReader<"u")return new Dn.Promise(function(c,l){var u=new FileReader;u.onload=function(h){c(h.target.result)},u.onerror=function(h){l(h.target.error)},u.readAsArrayBuffer(a)});else return a});return s.then(function(a){var o=et.getTypeOf(a);if(!o)return Dn.Promise.reject(Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(o==="arraybuffer")a=et.transformTo("uint8array",a);else if(o==="string"){if(n)a=gg.decode(a);else if(r){if(i!==!0)a=mg(a)}}return a})}});var ae=T(function(Ix,Vo){function Ho(e){this.name=e||"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}Ho.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=e;else{if(this.isFinished=!0,this.emit("error",e),this.previous)this.previous.error(e);this.cleanUp()}return!0},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),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 e=!1;if(this.generatedError)this.error(this.generatedError),e=!0;if(this.previous)this.previous.resume();return!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e))continue;this.streamInfo[e]=this.extraStreamInfo[e]}},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 e="Worker "+this.name;if(this.previous)return this.previous+" -> "+e;else return e}};Vo.exports=Ho});var $t=T(function(Rg){var Et=j(),tt=Pe(),Tg=sr(),ri=ae(),cr=Array(256);for(Ee=0;Ee<256;Ee++)cr[Ee]=Ee>=252?6:Ee>=248?5:Ee>=240?4:Ee>=224?3:Ee>=192?2:1;var Ee;cr[254]=cr[254]=1;var Cg=function(e){var t,r,i,n,s,a=e.length,o=0;for(n=0;n<a;n++){if(r=e.charCodeAt(n),(r&64512)===55296&&n+1<a){if(i=e.charCodeAt(n+1),(i&64512)===56320)r=65536+(r-55296<<10)+(i-56320),n++}o+=r<128?1:r<2048?2:r<65536?3:4}if(tt.uint8array)t=new Uint8Array(o);else t=Array(o);for(s=0,n=0;s<o;n++){if(r=e.charCodeAt(n),(r&64512)===55296&&n+1<a){if(i=e.charCodeAt(n+1),(i&64512)===56320)r=65536+(r-55296<<10)+(i-56320),n++}if(r<128)t[s++]=r;else if(r<2048)t[s++]=192|r>>>6,t[s++]=128|r&63;else if(r<65536)t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|r&63;else t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|r&63}return t},Ig=function(e,t){var r;if(t=t||e.length,t>e.length)t=e.length;r=t-1;while(r>=0&&(e[r]&192)===128)r--;if(r<0)return t;if(r===0)return t;return r+cr[e[r]]>t?r:t},Ag=function(e){var t,r,i,n,s=e.length,a=Array(s*2);for(r=0,t=0;t<s;){if(i=e[t++],i<128){a[r++]=i;continue}if(n=cr[i],n>4){a[r++]=65533,t+=n-1;continue}i&=n===2?31:n===3?15:7;while(n>1&&t<s)i=i<<6|e[t++]&63,n--;if(n>1){a[r++]=65533;continue}if(i<65536)a[r++]=i;else i-=65536,a[r++]=55296|i>>10&1023,a[r++]=56320|i&1023}if(a.length!==r)if(a.subarray)a=a.subarray(0,r);else a.length=r;return Et.applyFromCharCode(a)};Rg.utf8encode=function(t){if(tt.nodebuffer)return Tg.newBufferFrom(t,"utf-8");return Cg(t)};Rg.utf8decode=function(t){if(tt.nodebuffer)return Et.transformTo("nodebuffer",t).toString("utf-8");return t=Et.transformTo(tt.uint8array?"uint8array":"array",t),Ag(t)};function ii(){ri.call(this,"utf-8 decode"),this.leftOver=null}Et.inherits(ii,ri);ii.prototype.processChunk=function(e){var t=Et.transformTo(tt.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(tt.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=Ig(t),n=t;if(i!==t.length)if(tt.uint8array)n=t.subarray(0,i),this.leftOver=t.subarray(i,t.length);else n=t.slice(0,i),this.leftOver=t.slice(i,t.length);this.push({data:Rg.utf8decode(n),meta:e.meta})};ii.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:Rg.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};Rg.Utf8DecodeWorker=ii;function Nn(){ri.call(this,"utf-8 encode")}Et.inherits(Nn,ri);Nn.prototype.processChunk=function(e){this.push({data:Rg.utf8encode(e.data),meta:e.meta})};Rg.Utf8EncodeWorker=Nn});var Yo=T(function(Rx,Ko){var Go=ae(),Jo=j();function Mn(e){Go.call(this,"ConvertWorker to "+e),this.destType=e}Jo.inherits(Mn,Go);Mn.prototype.processChunk=function(e){this.push({data:Jo.transformTo(this.destType,e.data),meta:e.meta})};Ko.exports=Mn});var el=T(function(Ox,Qo){var Xo=$n().Readable,Dg=j();Dg.inherits(Ln,Xo);function Ln(e,t,r){Xo.call(this,t),this._helper=e;var i=this;e.on("data",function(n,s){if(!i.push(n))i._helper.pause();if(r)r(s)}).on("error",function(n){i.emit("error",n)}).on("end",function(){i.push(null)})}Ln.prototype._read=function(){this._helper.resume()};Qo.exports=Ln});var Un=T(function(Bx,il){var rt=j(),Pg=Yo(),Ng=ae(),Fg=In(),Mg=Pe(),Lg=St(),tl=null;if(Mg.nodestream)try{tl=el()}catch(e){}function Ug(e,t,r){switch(e){case"blob":return rt.newBlob(rt.transformTo("arraybuffer",t),r);case"base64":return Fg.encode(t);default:return rt.transformTo(e,t)}}function jg(e,t){var r,i=0,n=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":n=new Uint8Array(s);for(r=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw Error("concat : unsupported type '"+e+"'")}}function zg(e,t){return new Lg.Promise(function(r,i){var n=[],{_internalType:s,_outputType:a,_mimeType:o}=e;e.on("data",function(c,l){if(n.push(c),t)t(l)}).on("error",function(c){n=[],i(c)}).on("end",function(){try{var c=Ug(a,jg(s,n),o);r(c)}catch(l){i(l)}n=[]}).resume()})}function rl(e,t,r){var i=t;switch(t){case"blob":case"arraybuffer":i="uint8array";break;case"base64":i="string";break}try{this._internalType=i,this._outputType=t,this._mimeType=r,rt.checkSupport(i),this._worker=e.pipe(new Pg(i)),e.lock()}catch(n){this._worker=new Ng("error"),this._worker.error(n)}}rl.prototype={accumulate:function(e){return zg(this,e)},on:function(e,t){var r=this;if(e==="data")this._worker.on(e,function(i){t.call(r,i.data,i.meta)});else this._worker.on(e,function(){rt.delay(t,arguments,r)});return this},resume:function(){return rt.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(rt.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new tl(this,{objectMode:this._outputType!=="nodebuffer"},e)}};il.exports=rl});var jn=T(function(qg){qg.base64=!1;qg.binary=!1;qg.dir=!1;qg.createFolders=!0;qg.date=null;qg.compression=null;qg.compressionOptions=null;qg.comment=null;qg.unixPermissions=null;qg.dosPermissions=null});var zn=T(function(Px,nl){var ni=j(),si=ae(),em=16384;function Tt(e){si.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){if(t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=ni.getTypeOf(r),!t.isPaused)t._tickAndRepeat()},function(r){t.error(r)})}ni.inherits(Tt,si);Tt.prototype.cleanUp=function(){si.prototype.cleanUp.call(this),this.data=null};Tt.prototype.resume=function(){if(!si.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,ni.delay(this._tickAndRepeat,[],this);return!0};Tt.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)ni.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};Tt.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=em,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})}};nl.exports=Tt});var ai=T(function(Nx,al){var tm=j();function rm(){var e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var sl=rm();function im(e,t,r,i){var n=sl,s=i+r;e=e^-1;for(var a=i;a<s;a++)e=e>>>8^n[(e^t[a])&255];return e^-1}function nm(e,t,r,i){var n=sl,s=i+r;e=e^-1;for(var a=i;a<s;a++)e=e>>>8^n[(e^t.charCodeAt(a))&255];return e^-1}al.exports=function(t,r){if(typeof t>"u"||!t.length)return 0;var i=tm.getTypeOf(t)!=="string";if(i)return im(r|0,t,t.length,0);else return nm(r|0,t,t.length,0)}});var Wn=T(function(Fx,ll){var ol=ae(),sm=ai(),am=j();function qn(){ol.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}am.inherits(qn,ol);qn.prototype.processChunk=function(e){this.streamInfo.crc32=sm(e.data,this.streamInfo.crc32||0),this.push(e)};ll.exports=qn});var cl=T(function(Mx,ul){var om=j(),Hn=ae();function Vn(e){Hn.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}om.inherits(Vn,Hn);Vn.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}Hn.prototype.processChunk.call(this,e)};ul.exports=Vn});var oi=T(function(Lx,dl){var fl=St(),hl=zn(),lm=Wn(),Zn=cl();function Gn(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}Gn.prototype={getContentWorker:function(){var e=new hl(fl.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Zn("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new hl(fl.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};Gn.createWorkerFrom=function(e,t,r){return e.pipe(new lm).pipe(new Zn("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new Zn("compressedSize")).withStreamInfo("compression",t)};dl.exports=Gn});var vl=T(function(Ux,ml){var um=Un(),cm=zn(),Jn=$t(),Kn=oi(),pl=ae(),Yn=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};Yn.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw Error("No output type specified.");r=e.toLowerCase();var i=r==="string"||r==="text";if(r==="binarystring"||r==="text")r="string";t=this._decompressWorker();var n=!this._dataBinary;if(n&&!i)t=t.pipe(new Jn.Utf8EncodeWorker);if(!n&&i)t=t.pipe(new Jn.Utf8DecodeWorker)}catch(s){t=new pl("error"),t.error(s)}return new um(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof Kn&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();else{var r=this._decompressWorker();if(!this._dataBinary)r=r.pipe(new Jn.Utf8EncodeWorker);return Kn.createWorkerFrom(r,e,t)}},_decompressWorker:function(){if(this._data instanceof Kn)return this._data.getContentWorker();else if(this._data instanceof pl)return this._data;else return new cm(this._data)}};var gl=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],fm=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(fr=0;fr<gl.length;fr++)Yn.prototype[gl[fr]]=fm;var fr;ml.exports=Yn});var Ne=T(function(Ct){var gm=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function mm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}Ct.assign=function(e){var t=Array.prototype.slice.call(arguments,1);while(t.length){var r=t.shift();if(!r)continue;if(typeof r!=="object")throw TypeError(r+"must be non-object");for(var i in r)if(mm(r,i))e[i]=r[i]}return e};Ct.shrinkBuf=function(e,t){if(e.length===t)return e;if(e.subarray)return e.subarray(0,t);return e.length=t,e};var vm={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+i),n);return}for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){var t,r,i,n,s,a;i=0;for(t=0,r=e.length;t<r;t++)i+=e[t].length;a=new Uint8Array(i),n=0;for(t=0,r=e.length;t<r;t++)s=e[t],a.set(s,n),n+=s.length;return a}},ym={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};Ct.setTyped=function(e){if(e)Ct.Buf8=Uint8Array,Ct.Buf16=Uint16Array,Ct.Buf32=Int32Array,Ct.assign(Ct,vm);else Ct.Buf8=Array,Ct.Buf16=Array,Ct.Buf32=Array,Ct.assign(Ct,ym)};Ct.setTyped(gm)});var jl=T(function(jm){var _m=Ne(),bm=4,wl=0,_l=1,xm=2;function At(e){var t=e.length;while(--t>=0)e[t]=0}var Sm=0,$l=1,km=2,Em=3,$m=258,ss=29,vr=256,dr=vr+1+ss,It=30,as=19,Tl=2*dr+1,it=15,Qn=16,Tm=7,os=256,Cl=16,Il=17,Al=18,is=[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],li=[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],Cm=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Rl=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Im=512,Fe=Array((dr+2)*2);At(Fe);var hr=Array(It*2);At(hr);var pr=Array(Im);At(pr);var gr=Array($m-Em+1);At(gr);var ls=Array(ss);At(ls);var ui=Array(It);At(ui);function es(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}var Ol,Bl,Dl;function ts(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Pl(e){return e<256?pr[e]:pr[256+(e>>>7)]}function mr(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function se(e,t,r){if(e.bi_valid>Qn-r)e.bi_buf|=t<<e.bi_valid&65535,mr(e,e.bi_buf),e.bi_buf=t>>Qn-e.bi_valid,e.bi_valid+=r-Qn;else e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r}function $e(e,t,r){se(e,r[t*2],r[t*2+1])}function Nl(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Am(e){if(e.bi_valid===16)mr(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0;else if(e.bi_valid>=8)e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8}function Rm(e,t){var{dyn_tree:r,max_code:i}=t,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,h,f,d,p,m=0;for(f=0;f<=it;f++)e.bl_count[f]=0;r[e.heap[e.heap_max]*2+1]=0;for(l=e.heap_max+1;l<Tl;l++){if(u=e.heap[l],f=r[r[u*2+1]*2+1]+1,f>c)f=c,m++;if(r[u*2+1]=f,u>i)continue;if(e.bl_count[f]++,d=0,u>=o)d=a[u-o];if(p=r[u*2],e.opt_len+=p*(f+d),s)e.static_len+=p*(n[u*2+1]+d)}if(m===0)return;do{f=c-1;while(e.bl_count[f]===0)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--){u=e.bl_count[f];while(u!==0){if(h=e.heap[--l],h>i)continue;if(r[h*2+1]!==f)e.opt_len+=(f-r[h*2+1])*r[h*2],r[h*2+1]=f;u--}}}function Fl(e,t,r){var i=Array(it+1),n=0,s,a;for(s=1;s<=it;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=t;a++){var o=e[a*2+1];if(o===0)continue;e[a*2]=Nl(i[o]++,o)}}function Om(){var e,t,r,i,n,s=Array(it+1);r=0;for(i=0;i<ss-1;i++){ls[i]=r;for(e=0;e<1<<is[i];e++)gr[r++]=i}gr[r-1]=i,n=0;for(i=0;i<16;i++){ui[i]=n;for(e=0;e<1<<li[i];e++)pr[n++]=i}n>>=7;for(;i<It;i++){ui[i]=n<<7;for(e=0;e<1<<li[i]-7;e++)pr[256+n++]=i}for(t=0;t<=it;t++)s[t]=0;e=0;while(e<=143)Fe[e*2+1]=8,e++,s[8]++;while(e<=255)Fe[e*2+1]=9,e++,s[9]++;while(e<=279)Fe[e*2+1]=7,e++,s[7]++;while(e<=287)Fe[e*2+1]=8,e++,s[8]++;Fl(Fe,dr+1,s);for(e=0;e<It;e++)hr[e*2+1]=5,hr[e*2]=Nl(e,5);Ol=new es(Fe,is,vr+1,dr,it),Bl=new es(hr,li,0,It,it),Dl=new es([],Cm,0,as,Tm)}function Ml(e){var t;for(t=0;t<dr;t++)e.dyn_ltree[t*2]=0;for(t=0;t<It;t++)e.dyn_dtree[t*2]=0;for(t=0;t<as;t++)e.bl_tree[t*2]=0;e.dyn_ltree[os*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Ll(e){if(e.bi_valid>8)mr(e,e.bi_buf);else if(e.bi_valid>0)e.pending_buf[e.pending++]=e.bi_buf;e.bi_buf=0,e.bi_valid=0}function Bm(e,t,r,i){if(Ll(e),i)mr(e,r),mr(e,~r);_m.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function bl(e,t,r,i){var n=t*2,s=r*2;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function rs(e,t,r){var i=e.heap[r],n=r<<1;while(n<=e.heap_len){if(n<e.heap_len&&bl(t,e.heap[n+1],e.heap[n],e.depth))n++;if(bl(t,i,e.heap[n],e.depth))break;e.heap[r]=e.heap[n],r=n,n<<=1}e.heap[r]=i}function xl(e,t,r){var i,n,s=0,a,o;if(e.last_lit!==0)do if(i=e.pending_buf[e.d_buf+s*2]<<8|e.pending_buf[e.d_buf+s*2+1],n=e.pending_buf[e.l_buf+s],s++,i===0)$e(e,n,t);else{if(a=gr[n],$e(e,a+vr+1,t),o=is[a],o!==0)n-=ls[a],se(e,n,o);if(i--,a=Pl(i),$e(e,a,r),o=li[a],o!==0)i-=ui[a],se(e,i,o)}while(s<e.last_lit);$e(e,os,t)}function ns(e,t){var r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,s=t.stat_desc.elems,a,o,c=-1,l;e.heap_len=0,e.heap_max=Tl;for(a=0;a<s;a++)if(r[a*2]!==0)e.heap[++e.heap_len]=c=a,e.depth[a]=0;else r[a*2+1]=0;while(e.heap_len<2)if(l=e.heap[++e.heap_len]=c<2?++c:0,r[l*2]=1,e.depth[l]=0,e.opt_len--,n)e.static_len-=i[l*2+1];t.max_code=c;for(a=e.heap_len>>1;a>=1;a--)rs(e,r,a);l=s;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],rs(e,r,1),o=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=o,r[l*2]=r[a*2]+r[o*2],e.depth[l]=(e.depth[a]>=e.depth[o]?e.depth[a]:e.depth[o])+1,r[a*2+1]=r[o*2+1]=l,e.heap[1]=l++,rs(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Rm(e,t),Fl(r,c,e.bl_count)}function Sl(e,t,r){var i,n=-1,s,a=t[1],o=0,c=7,l=4;if(a===0)c=138,l=3;t[(r+1)*2+1]=65535;for(i=0;i<=r;i++){if(s=a,a=t[(i+1)*2+1],++o<c&&s===a)continue;else if(o<l)e.bl_tree[s*2]+=o;else if(s!==0){if(s!==n)e.bl_tree[s*2]++;e.bl_tree[Cl*2]++}else if(o<=10)e.bl_tree[Il*2]++;else e.bl_tree[Al*2]++;if(o=0,n=s,a===0)c=138,l=3;else if(s===a)c=6,l=3;else c=7,l=4}}function kl(e,t,r){var i,n=-1,s,a=t[1],o=0,c=7,l=4;if(a===0)c=138,l=3;for(i=0;i<=r;i++){if(s=a,a=t[(i+1)*2+1],++o<c&&s===a)continue;else if(o<l)do $e(e,s,e.bl_tree);while(--o!==0);else if(s!==0){if(s!==n)$e(e,s,e.bl_tree),o--;$e(e,Cl,e.bl_tree),se(e,o-3,2)}else if(o<=10)$e(e,Il,e.bl_tree),se(e,o-3,3);else $e(e,Al,e.bl_tree),se(e,o-11,7);if(o=0,n=s,a===0)c=138,l=3;else if(s===a)c=6,l=3;else c=7,l=4}}function Dm(e){var t;Sl(e,e.dyn_ltree,e.l_desc.max_code),Sl(e,e.dyn_dtree,e.d_desc.max_code),ns(e,e.bl_desc);for(t=as-1;t>=3;t--)if(e.bl_tree[Rl[t]*2+1]!==0)break;return e.opt_len+=3*(t+1)+5+5+4,t}function Pm(e,t,r,i){var n;se(e,t-257,5),se(e,r-1,5),se(e,i-4,4);for(n=0;n<i;n++)se(e,e.bl_tree[Rl[n]*2+1],3);kl(e,e.dyn_ltree,t-1),kl(e,e.dyn_dtree,r-1)}function Nm(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return wl;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return _l;for(r=32;r<vr;r++)if(e.dyn_ltree[r*2]!==0)return _l;return wl}var El=!1;function Fm(e){if(!El)Om(),El=!0;e.l_desc=new ts(e.dyn_ltree,Ol),e.d_desc=new ts(e.dyn_dtree,Bl),e.bl_desc=new ts(e.bl_tree,Dl),e.bi_buf=0,e.bi_valid=0,Ml(e)}function Ul(e,t,r,i){se(e,(Sm<<1)+(i?1:0),3),Bm(e,t,r,!0)}function Mm(e){se(e,$l<<1,3),$e(e,os,Fe),Am(e)}function Lm(e,t,r,i){var n,s,a=0;if(e.level>0){if(e.strm.data_type===xm)e.strm.data_type=Nm(e);if(ns(e,e.l_desc),ns(e,e.d_desc),a=Dm(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n)n=s}else n=s=r+5;if(r+4<=n&&t!==-1)Ul(e,t,r,i);else if(e.strategy===bm||s===n)se(e,($l<<1)+(i?1:0),3),xl(e,Fe,hr);else se(e,(km<<1)+(i?1:0),3),Pm(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),xl(e,e.dyn_ltree,e.dyn_dtree);if(Ml(e),i)Ll(e)}function Um(e,t,r){if(e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0)e.dyn_ltree[r*2]++;else e.matches++,t--,e.dyn_ltree[(gr[r]+vr+1)*2]++,e.dyn_dtree[Pl(t)*2]++;return e.last_lit===e.lit_bufsize-1}jm._tr_init=Fm;jm._tr_stored_block=Ul;jm._tr_flush_block=Lm;jm._tr_tally=Um;jm._tr_align=Mm});var us=T(function(qx,zl){function Zm(e,t,r,i){var n=e&65535|0,s=e>>>16&65535|0,a=0;while(r!==0){a=r>2000?2000:r,r-=a;do n=n+t[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}zl.exports=Zm});var cs=T(function(Wx,ql){function Gm(){var e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Jm=Gm();function Km(e,t,r,i){var n=Jm,s=i+r;e^=-1;for(var a=i;a<s;a++)e=e>>>8^n[(e^t[a])&255];return e^-1}ql.exports=Km});var ci=T(function(Hx,Wl){Wl.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 Ql=T(function(I0){var re=Ne(),he=jl(),Gl=us(),We=cs(),Ym=ci(),ot=0,Xm=1,Qm=3,Je=4,Hl=5,Ce=0,Vl=1,de=-2,e0=-3,fs=-5,t0=-1,r0=1,fi=2,i0=3,n0=4,s0=0,a0=2,gi=8,o0=9,l0=15,u0=8,c0=29,f0=256,ds=f0+1+c0,h0=30,d0=19,p0=2*ds+1,g0=15,O=3,Ze=258,ve=Ze+O+1,m0=32,mi=42,ps=69,hi=73,di=91,pi=103,nt=113,wr=666,V=1,_r=2,st=3,Bt=4,v0=3;function Ge(e,t){return e.msg=Ym[t],t}function Zl(e){return(e<<1)-(e>4?9:0)}function Ve(e){var t=e.length;while(--t>=0)e[t]=0}function He(e){var t=e.state,r=t.pending;if(r>e.avail_out)r=e.avail_out;if(r===0)return;if(re.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0)t.pending_out=0}function K(e,t){he._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,He(e.strm)}function B(e,t){e.pending_buf[e.pending++]=t}function yr(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function y0(e,t,r,i){var n=e.avail_in;if(n>i)n=i;if(n===0)return 0;if(e.avail_in-=n,re.arraySet(t,e.input,e.next_in,n,r),e.state.wrap===1)e.adler=Gl(e.adler,t,n,r);else if(e.state.wrap===2)e.adler=We(e.adler,t,n,r);return e.next_in+=n,e.total_in+=n,n}function Jl(e,t){var{max_chain_length:r,strstart:i}=e,n,s,{prev_length:a,nice_match:o}=e,c=e.strstart>e.w_size-ve?e.strstart-(e.w_size-ve):0,{window:l,w_mask:u,prev:h}=e,f=e.strstart+Ze,d=l[i+a-1],p=l[i+a];if(e.prev_length>=e.good_match)r>>=2;if(o>e.lookahead)o=e.lookahead;do{if(n=t,l[n+a]!==p||l[n+a-1]!==d||l[n]!==l[i]||l[++n]!==l[i+1])continue;i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<f);if(s=Ze-(f-i),i=f-Ze,s>a){if(e.match_start=t,a=s,s>=o)break;d=l[i+a-1],p=l[i+a]}}while((t=h[t&u])>c&&--r!==0);if(a<=e.lookahead)return a;return e.lookahead}function at(e){var t=e.w_size,r,i,n,s,a;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ve)){re.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,r=i;do n=e.head[--r],e.head[r]=n>=t?n-t:0;while(--i);i=t,r=i;do n=e.prev[--r],e.prev[r]=n>=t?n-t:0;while(--i);s+=t}if(e.strm.avail_in===0)break;if(i=y0(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=O){a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;while(e.insert)if(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+O-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,e.lookahead+e.insert<O)break}}while(e.lookahead<ve&&e.strm.avail_in!==0)}function w0(e,t){var r=65535;if(r>e.pending_buf_size-5)r=e.pending_buf_size-5;for(;;){if(e.lookahead<=1){if(at(e),e.lookahead===0&&t===ot)return V;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if(e.strstart===0||e.strstart>=i){if(e.lookahead=e.strstart-i,e.strstart=i,K(e,!1),e.strm.avail_out===0)return V}if(e.strstart-e.block_start>=e.w_size-ve){if(K(e,!1),e.strm.avail_out===0)return V}}if(e.insert=0,t===Je){if(K(e,!0),e.strm.avail_out===0)return st;return Bt}if(e.strstart>e.block_start){if(K(e,!1),e.strm.avail_out===0)return V}return V}function hs(e,t){var r,i;for(;;){if(e.lookahead<ve){if(at(e),e.lookahead<ve&&t===ot)return V;if(e.lookahead===0)break}if(r=0,e.lookahead>=O)e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;if(r!==0&&e.strstart-r<=e.w_size-ve)e.match_length=Jl(e,r);if(e.match_length>=O)if(i=he._tr_tally(e,e.strstart-e.match_start,e.match_length-O),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=he._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i){if(K(e,!1),e.strm.avail_out===0)return V}}if(e.insert=e.strstart<O-1?e.strstart:O-1,t===Je){if(K(e,!0),e.strm.avail_out===0)return st;return Bt}if(e.last_lit){if(K(e,!1),e.strm.avail_out===0)return V}return _r}function Rt(e,t){var r,i,n;for(;;){if(e.lookahead<ve){if(at(e),e.lookahead<ve&&t===ot)return V;if(e.lookahead===0)break}if(r=0,e.lookahead>=O)e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;if(e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=O-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-ve){if(e.match_length=Jl(e,r),e.match_length<=5&&(e.strategy===r0||e.match_length===O&&e.strstart-e.match_start>4096))e.match_length=O-1}if(e.prev_length>=O&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-O,i=he._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O),e.lookahead-=e.prev_length-1,e.prev_length-=2;do if(++e.strstart<=n)e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.prev_length!==0);if(e.match_available=0,e.match_length=O-1,e.strstart++,i){if(K(e,!1),e.strm.avail_out===0)return V}}else if(e.match_available){if(i=he._tr_tally(e,0,e.window[e.strstart-1]),i)K(e,!1);if(e.strstart++,e.lookahead--,e.strm.avail_out===0)return V}else e.match_available=1,e.strstart++,e.lookahead--}if(e.match_available)i=he._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0;if(e.insert=e.strstart<O-1?e.strstart:O-1,t===Je){if(K(e,!0),e.strm.avail_out===0)return st;return Bt}if(e.last_lit){if(K(e,!1),e.strm.avail_out===0)return V}return _r}function _0(e,t){var r,i,n,s,a=e.window;for(;;){if(e.lookahead<=Ze){if(at(e),e.lookahead<=Ze&&t===ot)return V;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=O&&e.strstart>0){if(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n]){s=e.strstart+Ze;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<s);if(e.match_length=Ze-(s-n),e.match_length>e.lookahead)e.match_length=e.lookahead}}if(e.match_length>=O)r=he._tr_tally(e,1,e.match_length-O),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0;else r=he._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r){if(K(e,!1),e.strm.avail_out===0)return V}}if(e.insert=0,t===Je){if(K(e,!0),e.strm.avail_out===0)return st;return Bt}if(e.last_lit){if(K(e,!1),e.strm.avail_out===0)return V}return _r}function b0(e,t){var r;for(;;){if(e.lookahead===0){if(at(e),e.lookahead===0){if(t===ot)return V;break}}if(e.match_length=0,r=he._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r){if(K(e,!1),e.strm.avail_out===0)return V}}if(e.insert=0,t===Je){if(K(e,!0),e.strm.avail_out===0)return st;return Bt}if(e.last_lit){if(K(e,!1),e.strm.avail_out===0)return V}return _r}function Te(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}var Ot;Ot=[new Te(0,0,0,0,w0),new Te(4,4,8,4,hs),new Te(4,5,16,8,hs),new Te(4,6,32,32,hs),new Te(4,4,16,16,Rt),new Te(8,16,32,32,Rt),new Te(8,16,128,128,Rt),new Te(8,32,128,256,Rt),new Te(32,128,258,1024,Rt),new Te(32,258,258,4096,Rt)];function x0(e){e.window_size=2*e.w_size,Ve(e.head),e.max_lazy_match=Ot[e.level].max_lazy,e.good_match=Ot[e.level].good_length,e.nice_match=Ot[e.level].nice_length,e.max_chain_length=Ot[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=O-1,e.match_available=0,e.ins_h=0}function S0(){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=gi,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 re.Buf16(p0*2),this.dyn_dtree=new re.Buf16((2*h0+1)*2),this.bl_tree=new re.Buf16((2*d0+1)*2),Ve(this.dyn_ltree),Ve(this.dyn_dtree),Ve(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new re.Buf16(g0+1),this.heap=new re.Buf16(2*ds+1),Ve(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new re.Buf16(2*ds+1),Ve(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 Kl(e){var t;if(!e||!e.state)return Ge(e,de);if(e.total_in=e.total_out=0,e.data_type=a0,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0)t.wrap=-t.wrap;return t.status=t.wrap?mi:nt,e.adler=t.wrap===2?0:1,t.last_flush=ot,he._tr_init(t),Ce}function Yl(e){var t=Kl(e);if(t===Ce)x0(e.state);return t}function k0(e,t){if(!e||!e.state)return de;if(e.state.wrap!==2)return de;return e.state.gzhead=t,Ce}function Xl(e,t,r,i,n,s){if(!e)return de;var a=1;if(t===t0)t=6;if(i<0)a=0,i=-i;else if(i>15)a=2,i-=16;if(n<1||n>o0||r!==gi||i<8||i>15||t<0||t>9||s<0||s>n0)return Ge(e,de);if(i===8)i=9;var o=new S0;return e.state=o,o.strm=e,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+O-1)/O),o.window=new re.Buf8(o.w_size*2),o.head=new re.Buf16(o.hash_size),o.prev=new re.Buf16(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new re.Buf8(o.pending_buf_size),o.d_buf=1*o.lit_bufsize,o.l_buf=3*o.lit_bufsize,o.level=t,o.strategy=s,o.method=r,Yl(e)}function E0(e,t){return Xl(e,t,gi,l0,u0,s0)}function $0(e,t){var r,i,n,s;if(!e||!e.state||t>Hl||t<0)return e?Ge(e,de):de;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===wr&&t!==Je)return Ge(e,e.avail_out===0?fs:de);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===mi)if(i.wrap===2)if(e.adler=0,B(i,31),B(i,139),B(i,8),!i.gzhead)B(i,0),B(i,0),B(i,0),B(i,0),B(i,0),B(i,i.level===9?2:i.strategy>=fi||i.level<2?4:0),B(i,v0),i.status=nt;else{if(B(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(!i.gzhead.extra?0:4)+(!i.gzhead.name?0:8)+(!i.gzhead.comment?0:16)),B(i,i.gzhead.time&255),B(i,i.gzhead.time>>8&255),B(i,i.gzhead.time>>16&255),B(i,i.gzhead.time>>24&255),B(i,i.level===9?2:i.strategy>=fi||i.level<2?4:0),B(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length)B(i,i.gzhead.extra.length&255),B(i,i.gzhead.extra.length>>8&255);if(i.gzhead.hcrc)e.adler=We(e.adler,i.pending_buf,i.pending,0);i.gzindex=0,i.status=ps}else{var a=gi+(i.w_bits-8<<4)<<8,o=-1;if(i.strategy>=fi||i.level<2)o=0;else if(i.level<6)o=1;else if(i.level===6)o=2;else o=3;if(a|=o<<6,i.strstart!==0)a|=m0;if(a+=31-a%31,i.status=nt,yr(i,a),i.strstart!==0)yr(i,e.adler>>>16),yr(i,e.adler&65535);e.adler=1}if(i.status===ps)if(i.gzhead.extra){n=i.pending;while(i.gzindex<(i.gzhead.extra.length&65535)){if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(He(e),n=i.pending,i.pending===i.pending_buf_size)break}B(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++}if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(i.gzindex===i.gzhead.extra.length)i.gzindex=0,i.status=hi}else i.status=hi;if(i.status===hi)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(He(e),n=i.pending,i.pending===i.pending_buf_size){s=1;break}}if(i.gzindex<i.gzhead.name.length)s=i.gzhead.name.charCodeAt(i.gzindex++)&255;else s=0;B(i,s)}while(s!==0);if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(s===0)i.gzindex=0,i.status=di}else i.status=di;if(i.status===di)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(He(e),n=i.pending,i.pending===i.pending_buf_size){s=1;break}}if(i.gzindex<i.gzhead.comment.length)s=i.gzhead.comment.charCodeAt(i.gzindex++)&255;else s=0;B(i,s)}while(s!==0);if(i.gzhead.hcrc&&i.pending>n)e.adler=We(e.adler,i.pending_buf,i.pending-n,n);if(s===0)i.status=pi}else i.status=pi;if(i.status===pi)if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size)He(e);if(i.pending+2<=i.pending_buf_size)B(i,e.adler&255),B(i,e.adler>>8&255),e.adler=0,i.status=nt}else i.status=nt;if(i.pending!==0){if(He(e),e.avail_out===0)return i.last_flush=-1,Ce}else if(e.avail_in===0&&Zl(t)<=Zl(r)&&t!==Je)return Ge(e,fs);if(i.status===wr&&e.avail_in!==0)return Ge(e,fs);if(e.avail_in!==0||i.lookahead!==0||t!==ot&&i.status!==wr){var c=i.strategy===fi?b0(i,t):i.strategy===i0?_0(i,t):Ot[i.level].func(i,t);if(c===st||c===Bt)i.status=wr;if(c===V||c===st){if(e.avail_out===0)i.last_flush=-1;return Ce}if(c===_r){if(t===Xm)he._tr_align(i);else if(t!==Hl){if(he._tr_stored_block(i,0,0,!1),t===Qm){if(Ve(i.head),i.lookahead===0)i.strstart=0,i.block_start=0,i.insert=0}}if(He(e),e.avail_out===0)return i.last_flush=-1,Ce}}if(t!==Je)return Ce;if(i.wrap<=0)return Vl;if(i.wrap===2)B(i,e.adler&255),B(i,e.adler>>8&255),B(i,e.adler>>16&255),B(i,e.adler>>24&255),B(i,e.total_in&255),B(i,e.total_in>>8&255),B(i,e.total_in>>16&255),B(i,e.total_in>>24&255);else yr(i,e.adler>>>16),yr(i,e.adler&65535);if(He(e),i.wrap>0)i.wrap=-i.wrap;return i.pending!==0?Ce:Vl}function T0(e){var t;if(!e||!e.state)return de;if(t=e.state.status,t!==mi&&t!==ps&&t!==hi&&t!==di&&t!==pi&&t!==nt&&t!==wr)return Ge(e,de);return e.state=null,t===nt?Ge(e,e0):Ce}function C0(e,t){var r=t.length,i,n,s,a,o,c,l,u;if(!e||!e.state)return de;if(i=e.state,a=i.wrap,a===2||a===1&&i.status!==mi||i.lookahead)return de;if(a===1)e.adler=Gl(e.adler,t,r,0);if(i.wrap=0,r>=i.w_size){if(a===0)Ve(i.head),i.strstart=0,i.block_start=0,i.insert=0;u=new re.Buf8(i.w_size),re.arraySet(u,t,r-i.w_size,i.w_size,0),t=u,r=i.w_size}o=e.avail_in,c=e.next_in,l=e.input,e.avail_in=r,e.next_in=0,e.input=t,at(i);while(i.lookahead>=O){n=i.strstart,s=i.lookahead-(O-1);do i.ins_h=(i.ins_h<<i.hash_shift^i.window[n+O-1])&i.hash_mask,i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++;while(--s);i.strstart=n,i.lookahead=O-1,at(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=O-1,i.match_available=0,e.next_in=c,e.input=l,e.avail_in=o,i.wrap=a,Ce}I0.deflateInit=E0;I0.deflateInit2=Xl;I0.deflateReset=Yl;I0.deflateResetKeep=Kl;I0.deflateSetHeader=k0;I0.deflate=$0;I0.deflateEnd=T0;I0.deflateSetDictionary=C0;I0.deflateInfo="pako deflate (from Nodeca project)"});var gs=T(function(L0){var vi=Ne(),eu=!0,tu=!0;try{String.fromCharCode.apply(null,[0])}catch(e){eu=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){tu=!1}var br=new vi.Buf8(256);for(Ie=0;Ie<256;Ie++)br[Ie]=Ie>=252?6:Ie>=248?5:Ie>=240?4:Ie>=224?3:Ie>=192?2:1;var Ie;br[254]=br[254]=1;L0.string2buf=function(e){var t,r,i,n,s,a=e.length,o=0;for(n=0;n<a;n++){if(r=e.charCodeAt(n),(r&64512)===55296&&n+1<a){if(i=e.charCodeAt(n+1),(i&64512)===56320)r=65536+(r-55296<<10)+(i-56320),n++}o+=r<128?1:r<2048?2:r<65536?3:4}t=new vi.Buf8(o);for(s=0,n=0;s<o;n++){if(r=e.charCodeAt(n),(r&64512)===55296&&n+1<a){if(i=e.charCodeAt(n+1),(i&64512)===56320)r=65536+(r-55296<<10)+(i-56320),n++}if(r<128)t[s++]=r;else if(r<2048)t[s++]=192|r>>>6,t[s++]=128|r&63;else if(r<65536)t[s++]=224|r>>>12,t[s++]=128|r>>>6&63,t[s++]=128|r&63;else t[s++]=240|r>>>18,t[s++]=128|r>>>12&63,t[s++]=128|r>>>6&63,t[s++]=128|r&63}return t};function ru(e,t){if(t<65534){if(e.subarray&&tu||!e.subarray&&eu)return String.fromCharCode.apply(null,vi.shrinkBuf(e,t))}var r="";for(var i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}L0.buf2binstring=function(e){return ru(e,e.length)};L0.binstring2buf=function(e){var t=new vi.Buf8(e.length);for(var r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t};L0.buf2string=function(e,t){var r,i,n,s,a=t||e.length,o=Array(a*2);for(i=0,r=0;r<a;){if(n=e[r++],n<128){o[i++]=n;continue}if(s=br[n],s>4){o[i++]=65533,r+=s-1;continue}n&=s===2?31:s===3?15:7;while(s>1&&r<a)n=n<<6|e[r++]&63,s--;if(s>1){o[i++]=65533;continue}if(n<65536)o[i++]=n;else n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|n&1023}return ru(o,i)};L0.utf8border=function(e,t){var r;if(t=t||e.length,t>e.length)t=e.length;r=t-1;while(r>=0&&(e[r]&192)===128)r--;if(r<0)return t;if(r===0)return t;return r+br[e[r]]>t?r:t}});var ms=T(function(Gx,iu){function H0(){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}iu.exports=H0});var ou=T(function(Q0){var xr=Ql(),Sr=Ne(),ys=gs(),ws=ci(),V0=ms(),au=Object.prototype.toString,Z0=0,vs=4,Dt=0,nu=1,su=2,G0=-1,J0=0,K0=8;function lt(e){if(!(this instanceof lt))return new lt(e);this.options=Sr.assign({level:G0,method:K0,chunkSize:16384,windowBits:15,memLevel:8,strategy:J0,to:""},e||{});var t=this.options;if(t.raw&&t.windowBits>0)t.windowBits=-t.windowBits;else if(t.gzip&&t.windowBits>0&&t.windowBits<16)t.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new V0,this.strm.avail_out=0;var r=xr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Dt)throw Error(ws[r]);if(t.header)xr.deflateSetHeader(this.strm,t.header);if(t.dictionary){var i;if(typeof t.dictionary==="string")i=ys.string2buf(t.dictionary);else if(au.call(t.dictionary)==="[object ArrayBuffer]")i=new Uint8Array(t.dictionary);else i=t.dictionary;if(r=xr.deflateSetDictionary(this.strm,i),r!==Dt)throw Error(ws[r]);this._dict_set=!0}}lt.prototype.push=function(e,t){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;if(s=t===~~t?t:t===!0?vs:Z0,typeof e==="string")r.input=ys.string2buf(e);else if(au.call(e)==="[object ArrayBuffer]")r.input=new Uint8Array(e);else r.input=e;r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0)r.output=new Sr.Buf8(i),r.next_out=0,r.avail_out=i;if(n=xr.deflate(r,s),n!==nu&&n!==Dt)return this.onEnd(n),this.ended=!0,!1;if(r.avail_out===0||r.avail_in===0&&(s===vs||s===su))if(this.options.to==="string")this.onData(ys.buf2binstring(Sr.shrinkBuf(r.output,r.next_out)));else this.onData(Sr.shrinkBuf(r.output,r.next_out))}while((r.avail_in>0||r.avail_out===0)&&n!==nu);if(s===vs)return n=xr.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Dt;if(s===su)return this.onEnd(Dt),r.avail_out=0,!0;return!0};lt.prototype.onData=function(e){this.chunks.push(e)};lt.prototype.onEnd=function(e){if(e===Dt)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=Sr.flattenChunks(this.chunks);this.chunks=[],this.err=e,this.msg=this.strm.msg};function _s(e,t){var r=new lt(t);if(r.push(e,!0),r.err)throw r.msg||ws[r.err];return r.result}function Y0(e,t){return t=t||{},t.raw=!0,_s(e,t)}function X0(e,t){return t=t||{},t.gzip=!0,_s(e,t)}Q0.Deflate=lt;Q0.deflate=_s;Q0.deflateRaw=Y0;Q0.gzip=X0});var uu=T(function(Kx,lu){var yi=30,nv=12;lu.exports=function(t,r){var i,n,s,a,o,c,l,u,h,f,d,p,m,b,w,v,S,g,y,E,k,x,I,R,C;i=t.state,n=t.next_in,R=t.input,s=n+(t.avail_in-5),a=t.next_out,C=t.output,o=a-(r-t.avail_out),c=a+(t.avail_out-257),l=i.dmax,u=i.wsize,h=i.whave,f=i.wnext,d=i.window,p=i.hold,m=i.bits,b=i.lencode,w=i.distcode,v=(1<<i.lenbits)-1,S=(1<<i.distbits)-1;e:do{if(m<15)p+=R[n++]<<m,m+=8,p+=R[n++]<<m,m+=8;g=b[p&v];t:for(;;){if(y=g>>>24,p>>>=y,m-=y,y=g>>>16&255,y===0)C[a++]=g&65535;else if(y&16){if(E=g&65535,y&=15,y){if(m<y)p+=R[n++]<<m,m+=8;E+=p&(1<<y)-1,p>>>=y,m-=y}if(m<15)p+=R[n++]<<m,m+=8,p+=R[n++]<<m,m+=8;g=w[p&S];r:for(;;){if(y=g>>>24,p>>>=y,m-=y,y=g>>>16&255,y&16){if(k=g&65535,y&=15,m<y){if(p+=R[n++]<<m,m+=8,m<y)p+=R[n++]<<m,m+=8}if(k+=p&(1<<y)-1,k>l){t.msg="invalid distance too far back",i.mode=yi;break e}if(p>>>=y,m-=y,y=a-o,k>y){if(y=k-y,y>h){if(i.sane){t.msg="invalid distance too far back",i.mode=yi;break e}}if(x=0,I=d,f===0){if(x+=u-y,y<E){E-=y;do C[a++]=d[x++];while(--y);x=a-k,I=C}}else if(f<y){if(x+=u+f-y,y-=f,y<E){E-=y;do C[a++]=d[x++];while(--y);if(x=0,f<E){y=f,E-=y;do C[a++]=d[x++];while(--y);x=a-k,I=C}}}else if(x+=f-y,y<E){E-=y;do C[a++]=d[x++];while(--y);x=a-k,I=C}while(E>2)C[a++]=I[x++],C[a++]=I[x++],C[a++]=I[x++],E-=3;if(E){if(C[a++]=I[x++],E>1)C[a++]=I[x++]}}else{x=a-k;do C[a++]=C[x++],C[a++]=C[x++],C[a++]=C[x++],E-=3;while(E>2);if(E){if(C[a++]=C[x++],E>1)C[a++]=C[x++]}}}else if((y&64)===0){g=w[(g&65535)+(p&(1<<y)-1)];continue r}else{t.msg="invalid distance code",i.mode=yi;break e}break}}else if((y&64)===0){g=b[(g&65535)+(p&(1<<y)-1)];continue t}else if(y&32){i.mode=nv;break e}else{t.msg="invalid literal/length code",i.mode=yi;break e}break}}while(n<s&&a<c);E=m>>3,n-=E,m-=E<<3,p&=(1<<m)-1,t.next_in=n,t.next_out=a,t.avail_in=n<s?5+(s-n):5-(n-s),t.avail_out=a<c?257+(c-a):257-(a-c),i.hold=p,i.bits=m;return}});var mu=T(function(Yx,gu){var cu=Ne(),Pt=15,fu=852,hu=592,du=0,bs=1,pu=2,sv=[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],av=[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],ov=[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],lv=[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];gu.exports=function(t,r,i,n,s,a,o,c){var l=c.bits,u=0,h=0,f=0,d=0,p=0,m=0,b=0,w=0,v=0,S=0,g,y,E,k,x,I=null,R=0,C,G=new cu.Buf16(Pt+1),ue=new cu.Buf16(Pt+1),N=null,Q=0,ce,ne,Re;for(u=0;u<=Pt;u++)G[u]=0;for(h=0;h<n;h++)G[r[i+h]]++;p=l;for(d=Pt;d>=1;d--)if(G[d]!==0)break;if(p>d)p=d;if(d===0)return s[a++]=20971520,s[a++]=20971520,c.bits=1,0;for(f=1;f<d;f++)if(G[f]!==0)break;if(p<f)p=f;w=1;for(u=1;u<=Pt;u++)if(w<<=1,w-=G[u],w<0)return-1;if(w>0&&(t===du||d!==1))return-1;ue[1]=0;for(u=1;u<Pt;u++)ue[u+1]=ue[u]+G[u];for(h=0;h<n;h++)if(r[i+h]!==0)o[ue[r[i+h]]++]=h;if(t===du)I=N=o,C=19;else if(t===bs)I=sv,R-=257,N=av,Q-=257,C=256;else I=ov,N=lv,C=-1;if(S=0,h=0,u=f,x=a,m=p,b=0,E=-1,v=1<<p,k=v-1,t===bs&&v>fu||t===pu&&v>hu)return 1;for(;;){if(ce=u-b,o[h]<C)ne=0,Re=o[h];else if(o[h]>C)ne=N[Q+o[h]],Re=I[R+o[h]];else ne=96,Re=0;g=1<<u-b,y=1<<m,f=y;do y-=g,s[x+(S>>b)+y]=ce<<24|ne<<16|Re|0;while(y!==0);g=1<<u-1;while(S&g)g>>=1;if(g!==0)S&=g-1,S+=g;else S=0;if(h++,--G[u]===0){if(u===d)break;u=r[i+o[h]]}if(u>p&&(S&k)!==E){if(b===0)b=p;x+=f,m=u-b,w=1<<m;while(m+b<d){if(w-=G[m+b],w<=0)break;m++,w<<=1}if(v+=1<<m,t===bs&&v>fu||t===pu&&v>hu)return 1;E=S&k,s[E]=p<<24|m<<16|x-a|0}}if(S!==0)s[x+S]=u-b<<24|4194304|0;return c.bits=p,0}});var Yu=T(function(Tv){var oe=Ne(),Ts=us(),Ae=cs(),uv=uu(),kr=mu(),cv=0,zu=1,qu=2,vu=4,fv=5,wi=6,ut=0,hv=1,dv=2,pe=-2,Wu=-3,Cs=-4,pv=-5,yu=8,Hu=1,wu=2,_u=3,bu=4,xu=5,Su=6,ku=7,Eu=8,$u=9,Tu=10,xi=11,Me=12,xs=13,Cu=14,Ss=15,Iu=16,Au=17,Ru=18,Ou=19,_i=20,bi=21,Bu=22,Du=23,Pu=24,Nu=25,Fu=26,ks=27,Mu=28,Lu=29,U=30,Is=31,gv=32,mv=852,vv=592,yv=15,wv=yv;function Uu(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function _v(){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 oe.Buf16(320),this.work=new oe.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Vu(e){var t;if(!e||!e.state)return pe;if(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap)e.adler=t.wrap&1;return t.mode=Hu,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new oe.Buf32(mv),t.distcode=t.distdyn=new oe.Buf32(vv),t.sane=1,t.back=-1,ut}function Zu(e){var t;if(!e||!e.state)return pe;return t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Vu(e)}function Gu(e,t){var r,i;if(!e||!e.state)return pe;if(i=e.state,t<0)r=0,t=-t;else if(r=(t>>4)+1,t<48)t&=15;if(t&&(t<8||t>15))return pe;if(i.window!==null&&i.wbits!==t)i.window=null;return i.wrap=r,i.wbits=t,Zu(e)}function Ju(e,t){var r,i;if(!e)return pe;if(i=new _v,e.state=i,i.window=null,r=Gu(e,t),r!==ut)e.state=null;return r}function bv(e){return Ju(e,wv)}var ju=!0,Es,$s;function xv(e){if(ju){var t;Es=new oe.Buf32(512),$s=new oe.Buf32(32),t=0;while(t<144)e.lens[t++]=8;while(t<256)e.lens[t++]=9;while(t<280)e.lens[t++]=7;while(t<288)e.lens[t++]=8;kr(zu,e.lens,0,288,Es,0,e.work,{bits:9}),t=0;while(t<32)e.lens[t++]=5;kr(qu,e.lens,0,32,$s,0,e.work,{bits:5}),ju=!1}e.lencode=Es,e.lenbits=9,e.distcode=$s,e.distbits=5}function Ku(e,t,r,i){var n,s=e.state;if(s.window===null)s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new oe.Buf8(s.wsize);if(i>=s.wsize)oe.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize;else{if(n=s.wsize-s.wnext,n>i)n=i;if(oe.arraySet(s.window,t,r-i,n,s.wnext),i-=n,i)oe.arraySet(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize;else{if(s.wnext+=n,s.wnext===s.wsize)s.wnext=0;if(s.whave<s.wsize)s.whave+=n}}return 0}function Sv(e,t){var r,i,n,s,a,o,c,l,u,h,f,d,p,m,b=0,w,v,S,g,y,E,k,x,I=new oe.Buf8(4),R,C,G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return pe;if(r=e.state,r.mode===Me)r.mode=xs;a=e.next_out,n=e.output,c=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,l=r.hold,u=r.bits,h=o,f=c,x=ut;e:for(;;)switch(r.mode){case Hu:if(r.wrap===0){r.mode=xs;break}while(u<16){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.wrap&2&&l===35615){r.check=0,I[0]=l&255,I[1]=l>>>8&255,r.check=Ae(r.check,I,2,0),l=0,u=0,r.mode=wu;break}if(r.flags=0,r.head)r.head.done=!1;if(!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=U;break}if((l&15)!==yu){e.msg="unknown compression method",r.mode=U;break}if(l>>>=4,u-=4,k=(l&15)+8,r.wbits===0)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=U;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=l&512?Tu:Me,l=0,u=0;break;case wu:while(u<16){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.flags=l,(r.flags&255)!==yu){e.msg="unknown compression method",r.mode=U;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=U;break}if(r.head)r.head.text=l>>8&1;if(r.flags&512)I[0]=l&255,I[1]=l>>>8&255,r.check=Ae(r.check,I,2,0);l=0,u=0,r.mode=_u;case _u:while(u<32){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.head)r.head.time=l;if(r.flags&512)I[0]=l&255,I[1]=l>>>8&255,I[2]=l>>>16&255,I[3]=l>>>24&255,r.check=Ae(r.check,I,4,0);l=0,u=0,r.mode=bu;case bu:while(u<16){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.head)r.head.xflags=l&255,r.head.os=l>>8;if(r.flags&512)I[0]=l&255,I[1]=l>>>8&255,r.check=Ae(r.check,I,2,0);l=0,u=0,r.mode=xu;case xu:if(r.flags&1024){while(u<16){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.length=l,r.head)r.head.extra_len=l;if(r.flags&512)I[0]=l&255,I[1]=l>>>8&255,r.check=Ae(r.check,I,2,0);l=0,u=0}else if(r.head)r.head.extra=null;r.mode=Su;case Su:if(r.flags&1024){if(d=r.length,d>o)d=o;if(d){if(r.head){if(k=r.head.extra_len-r.length,!r.head.extra)r.head.extra=Array(r.head.extra_len);oe.arraySet(r.head.extra,i,s,d,k)}if(r.flags&512)r.check=Ae(r.check,i,d,s);o-=d,s+=d,r.length-=d}if(r.length)break e}r.length=0,r.mode=ku;case ku:if(r.flags&2048){if(o===0)break e;d=0;do if(k=i[s+d++],r.head&&k&&r.length<65536)r.head.name+=String.fromCharCode(k);while(k&&d<o);if(r.flags&512)r.check=Ae(r.check,i,d,s);if(o-=d,s+=d,k)break e}else if(r.head)r.head.name=null;r.length=0,r.mode=Eu;case Eu:if(r.flags&4096){if(o===0)break e;d=0;do if(k=i[s+d++],r.head&&k&&r.length<65536)r.head.comment+=String.fromCharCode(k);while(k&&d<o);if(r.flags&512)r.check=Ae(r.check,i,d,s);if(o-=d,s+=d,k)break e}else if(r.head)r.head.comment=null;r.mode=$u;case $u:if(r.flags&512){while(u<16){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(l!==(r.check&65535)){e.msg="header crc mismatch",r.mode=U;break}l=0,u=0}if(r.head)r.head.hcrc=r.flags>>9&1,r.head.done=!0;e.adler=r.check=0,r.mode=Me;break;case Tu:while(u<32){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}e.adler=r.check=Uu(l),l=0,u=0,r.mode=xi;case xi:if(r.havedict===0)return e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=o,r.hold=l,r.bits=u,dv;e.adler=r.check=1,r.mode=Me;case Me:if(t===fv||t===wi)break e;case xs:if(r.last){l>>>=u&7,u-=u&7,r.mode=ks;break}while(u<3){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}switch(r.last=l&1,l>>>=1,u-=1,l&3){case 0:r.mode=Cu;break;case 1:if(xv(r),r.mode=_i,t===wi){l>>>=2,u-=2;break e}break;case 2:r.mode=Au;break;case 3:e.msg="invalid block type",r.mode=U}l>>>=2,u-=2;break;case Cu:l>>>=u&7,u-=u&7;while(u<32){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=U;break}if(r.length=l&65535,l=0,u=0,r.mode=Ss,t===wi)break e;case Ss:r.mode=Iu;case Iu:if(d=r.length,d){if(d>o)d=o;if(d>c)d=c;if(d===0)break e;oe.arraySet(n,i,s,d,a),o-=d,s+=d,c-=d,a+=d,r.length-=d;break}r.mode=Me;break;case Au:while(u<14){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(r.nlen=(l&31)+257,l>>>=5,u-=5,r.ndist=(l&31)+1,l>>>=5,u-=5,r.ncode=(l&15)+4,l>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=U;break}r.have=0,r.mode=Ru;case Ru:while(r.have<r.ncode){while(u<3){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}r.lens[G[r.have++]]=l&7,l>>>=3,u-=3}while(r.have<19)r.lens[G[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},x=kr(cv,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,x){e.msg="invalid code lengths set",r.mode=U;break}r.have=0,r.mode=Ou;case Ou:while(r.have<r.nlen+r.ndist){for(;;){if(b=r.lencode[l&(1<<r.lenbits)-1],w=b>>>24,v=b>>>16&255,S=b&65535,w<=u)break;if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(S<16)l>>>=w,u-=w,r.lens[r.have++]=S;else{if(S===16){C=w+2;while(u<C){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(l>>>=w,u-=w,r.have===0){e.msg="invalid bit length repeat",r.mode=U;break}k=r.lens[r.have-1],d=3+(l&3),l>>>=2,u-=2}else if(S===17){C=w+3;while(u<C){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}l>>>=w,u-=w,k=0,d=3+(l&7),l>>>=3,u-=3}else{C=w+7;while(u<C){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}l>>>=w,u-=w,k=0,d=11+(l&127),l>>>=7,u-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=U;break}while(d--)r.lens[r.have++]=k}}if(r.mode===U)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=U;break}if(r.lenbits=9,R={bits:r.lenbits},x=kr(zu,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,x){e.msg="invalid literal/lengths set",r.mode=U;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},x=kr(qu,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,x){e.msg="invalid distances set",r.mode=U;break}if(r.mode=_i,t===wi)break e;case _i:r.mode=bi;case bi:if(o>=6&&c>=258){if(e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=o,r.hold=l,r.bits=u,uv(e,f),a=e.next_out,n=e.output,c=e.avail_out,s=e.next_in,i=e.input,o=e.avail_in,l=r.hold,u=r.bits,r.mode===Me)r.back=-1;break}r.back=0;for(;;){if(b=r.lencode[l&(1<<r.lenbits)-1],w=b>>>24,v=b>>>16&255,S=b&65535,w<=u)break;if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(v&&(v&240)===0){g=w,y=v,E=S;for(;;){if(b=r.lencode[E+((l&(1<<g+y)-1)>>g)],w=b>>>24,v=b>>>16&255,S=b&65535,g+w<=u)break;if(o===0)break e;o--,l+=i[s++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=w,u-=w,r.back+=w,r.length=S,v===0){r.mode=Fu;break}if(v&32){r.back=-1,r.mode=Me;break}if(v&64){e.msg="invalid literal/length code",r.mode=U;break}r.extra=v&15,r.mode=Bu;case Bu:if(r.extra){C=r.extra;while(u<C){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Du;case Du:for(;;){if(b=r.distcode[l&(1<<r.distbits)-1],w=b>>>24,v=b>>>16&255,S=b&65535,w<=u)break;if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if((v&240)===0){g=w,y=v,E=S;for(;;){if(b=r.distcode[E+((l&(1<<g+y)-1)>>g)],w=b>>>24,v=b>>>16&255,S=b&65535,g+w<=u)break;if(o===0)break e;o--,l+=i[s++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=w,u-=w,r.back+=w,v&64){e.msg="invalid distance code",r.mode=U;break}r.offset=S,r.extra=v&15,r.mode=Pu;case Pu:if(r.extra){C=r.extra;while(u<C){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=U;break}r.mode=Nu;case Nu:if(c===0)break e;if(d=f-c,r.offset>d){if(d=r.offset-d,d>r.whave){if(r.sane){e.msg="invalid distance too far back",r.mode=U;break}}if(d>r.wnext)d-=r.wnext,p=r.wsize-d;else p=r.wnext-d;if(d>r.length)d=r.length;m=r.window}else m=n,p=a-r.offset,d=r.length;if(d>c)d=c;c-=d,r.length-=d;do n[a++]=m[p++];while(--d);if(r.length===0)r.mode=bi;break;case Fu:if(c===0)break e;n[a++]=r.length,c--,r.mode=bi;break;case ks:if(r.wrap){while(u<32){if(o===0)break e;o--,l|=i[s++]<<u,u+=8}if(f-=c,e.total_out+=f,r.total+=f,f)e.adler=r.check=r.flags?Ae(r.check,n,f,a-f):Ts(r.check,n,f,a-f);if(f=c,(r.flags?l:Uu(l))!==r.check){e.msg="incorrect data check",r.mode=U;break}l=0,u=0}r.mode=Mu;case Mu:if(r.wrap&&r.flags){while(u<32){if(o===0)break e;o--,l+=i[s++]<<u,u+=8}if(l!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=U;break}l=0,u=0}r.mode=Lu;case Lu:x=hv;break e;case U:x=Wu;break e;case Is:return Cs;case gv:default:return pe}if(e.next_out=a,e.avail_out=c,e.next_in=s,e.avail_in=o,r.hold=l,r.bits=u,r.wsize||f!==e.avail_out&&r.mode<U&&(r.mode<ks||t!==vu)){if(Ku(e,e.output,e.next_out,f-e.avail_out))return r.mode=Is,Cs}if(h-=e.avail_in,f-=e.avail_out,e.total_in+=h,e.total_out+=f,r.total+=f,r.wrap&&f)e.adler=r.check=r.flags?Ae(r.check,n,f,e.next_out-f):Ts(r.check,n,f,e.next_out-f);if(e.data_type=r.bits+(r.last?64:0)+(r.mode===Me?128:0)+(r.mode===_i||r.mode===Ss?256:0),(h===0&&f===0||t===vu)&&x===ut)x=pv;return x}function kv(e){if(!e||!e.state)return pe;var t=e.state;if(t.window)t.window=null;return e.state=null,ut}function Ev(e,t){var r;if(!e||!e.state)return pe;if(r=e.state,(r.wrap&2)===0)return pe;return r.head=t,t.done=!1,ut}function $v(e,t){var r=t.length,i,n,s;if(!e||!e.state)return pe;if(i=e.state,i.wrap!==0&&i.mode!==xi)return pe;if(i.mode===xi){if(n=1,n=Ts(n,t,r,0),n!==i.check)return Wu}if(s=Ku(e,t,r,r),s)return i.mode=Is,Cs;return i.havedict=1,ut}Tv.inflateReset=Zu;Tv.inflateReset2=Gu;Tv.inflateResetKeep=Vu;Tv.inflateInit=bv;Tv.inflateInit2=Ju;Tv.inflate=Sv;Tv.inflateEnd=kv;Tv.inflateGetHeader=Ev;Tv.inflateSetDictionary=$v;Tv.inflateInfo="pako inflate (from Nodeca project)"});var As=T(function(Qx,Xu){Xu.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 ec=T(function(e1,Qu){function Mv(){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}Qu.exports=Mv});var rc=T(function(zv){var Nt=Yu(),Er=Ne(),Si=gs(),W=As(),Rs=ci(),Lv=ms(),Uv=ec(),tc=Object.prototype.toString;function ct(e){if(!(this instanceof ct))return new ct(e);this.options=Er.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;if(t.raw&&t.windowBits>=0&&t.windowBits<16){if(t.windowBits=-t.windowBits,t.windowBits===0)t.windowBits=-15}if(t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits))t.windowBits+=32;if(t.windowBits>15&&t.windowBits<48){if((t.windowBits&15)===0)t.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Lv,this.strm.avail_out=0;var r=Nt.inflateInit2(this.strm,t.windowBits);if(r!==W.Z_OK)throw Error(Rs[r]);if(this.header=new Uv,Nt.inflateGetHeader(this.strm,this.header),t.dictionary){if(typeof t.dictionary==="string")t.dictionary=Si.string2buf(t.dictionary);else if(tc.call(t.dictionary)==="[object ArrayBuffer]")t.dictionary=new Uint8Array(t.dictionary);if(t.raw){if(r=Nt.inflateSetDictionary(this.strm,t.dictionary),r!==W.Z_OK)throw Error(Rs[r])}}}ct.prototype.push=function(e,t){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,o,c,l,u=!1;if(this.ended)return!1;if(a=t===~~t?t:t===!0?W.Z_FINISH:W.Z_NO_FLUSH,typeof e==="string")r.input=Si.binstring2buf(e);else if(tc.call(e)==="[object ArrayBuffer]")r.input=new Uint8Array(e);else r.input=e;r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0)r.output=new Er.Buf8(i),r.next_out=0,r.avail_out=i;if(s=Nt.inflate(r,W.Z_NO_FLUSH),s===W.Z_NEED_DICT&&n)s=Nt.inflateSetDictionary(this.strm,n);if(s===W.Z_BUF_ERROR&&u===!0)s=W.Z_OK,u=!1;if(s!==W.Z_STREAM_END&&s!==W.Z_OK)return this.onEnd(s),this.ended=!0,!1;if(r.next_out){if(r.avail_out===0||s===W.Z_STREAM_END||r.avail_in===0&&(a===W.Z_FINISH||a===W.Z_SYNC_FLUSH))if(this.options.to==="string"){if(o=Si.utf8border(r.output,r.next_out),c=r.next_out-o,l=Si.buf2string(r.output,o),r.next_out=c,r.avail_out=i-c,c)Er.arraySet(r.output,r.output,o,c,0);this.onData(l)}else this.onData(Er.shrinkBuf(r.output,r.next_out))}if(r.avail_in===0&&r.avail_out===0)u=!0}while((r.avail_in>0||r.avail_out===0)&&s!==W.Z_STREAM_END);if(s===W.Z_STREAM_END)a=W.Z_FINISH;if(a===W.Z_FINISH)return s=Nt.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===W.Z_OK;if(a===W.Z_SYNC_FLUSH)return this.onEnd(W.Z_OK),r.avail_out=0,!0;return!0};ct.prototype.onData=function(e){this.chunks.push(e)};ct.prototype.onEnd=function(e){if(e===W.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=Er.flattenChunks(this.chunks);this.chunks=[],this.err=e,this.msg=this.strm.msg};function Os(e,t){var r=new ct(t);if(r.push(e,!0),r.err)throw r.msg||Rs[r.err];return r.result}function jv(e,t){return t=t||{},t.raw=!0,Os(e,t)}zv.Inflate=ct;zv.inflate=Os;zv.inflateRaw=jv;zv.ungzip=Os});var sc=T(function(r1,nc){var Zv=Ne().assign,Gv=ou(),Jv=rc(),Kv=As(),ic={};Zv(ic,Gv,Jv,Kv);nc.exports=ic});var oc=T(function(ey){var Yv=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",Xv=sc(),ac=j(),ki=ae(),Qv=Yv?"uint8array":"array";ey.magic="\b\x00";function ft(e,t){ki.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}ac.inherits(ft,ki);ft.prototype.processChunk=function(e){if(this.meta=e.meta,this._pako===null)this._createPako();this._pako.push(ac.transformTo(Qv,e.data),!1)};ft.prototype.flush=function(){if(ki.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};ft.prototype.cleanUp=function(){ki.prototype.cleanUp.call(this),this._pako=null};ft.prototype._createPako=function(){this._pako=new Xv[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};ey.compressWorker=function(e){return new ft("Deflate",e)};ey.uncompressWorker=function(){return new ft("Inflate",{})}});var Bs=T(function(ny){var lc=ae();ny.STORE={magic:"\x00\x00",compressWorker:function(){return new lc("STORE compression")},uncompressWorker:function(){return new lc("STORE decompression")}};ny.DEFLATE=oc()});var Ds=T(function(oy){oy.LOCAL_FILE_HEADER="PK\x03\x04";oy.CENTRAL_FILE_HEADER="PK\x01\x02";oy.CENTRAL_DIRECTORY_END="PK\x05\x06";oy.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";oy.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";oy.DATA_DESCRIPTOR="PK\x07\b"});var hc=T(function(a1,fc){var Ft=j(),Mt=ae(),Ps=$t(),uc=ai(),Ei=Ds(),M=function(e,t){var r="",i;for(i=0;i<t;i++)r+=String.fromCharCode(e&255),e=e>>>8;return r},py=function(e,t){var r=e;if(!e)r=t?16893:33204;return(r&65535)<<16},gy=function(e){return(e||0)&63},cc=function(e,t,r,i,n,s){var{file:a,compression:o}=e,c=s!==Ps.utf8encode,l=Ft.transformTo("string",s(a.name)),u=Ft.transformTo("string",Ps.utf8encode(a.name)),h=a.comment,f=Ft.transformTo("string",s(h)),d=Ft.transformTo("string",Ps.utf8encode(h)),p=u.length!==a.name.length,m=d.length!==h.length,b,w,v="",S="",g="",{dir:y,date:E}=a,k={crc32:0,compressedSize:0,uncompressedSize:0};if(!t||r)k.crc32=e.crc32,k.compressedSize=e.compressedSize,k.uncompressedSize=e.uncompressedSize;var x=0;if(t)x|=8;if(!c&&(p||m))x|=2048;var I=0,R=0;if(y)I|=16;if(n==="UNIX")R=798,I|=py(a.unixPermissions,y);else R=20,I|=gy(a.dosPermissions,y);if(b=E.getUTCHours(),b=b<<6,b=b|E.getUTCMinutes(),b=b<<5,b=b|E.getUTCSeconds()/2,w=E.getUTCFullYear()-1980,w=w<<4,w=w|E.getUTCMonth()+1,w=w<<5,w=w|E.getUTCDate(),p)S=M(1,1)+M(uc(l),4)+u,v+="up"+M(S.length,2)+S;if(m)g=M(1,1)+M(uc(f),4)+d,v+="uc"+M(g.length,2)+g;var C="";C+=`
|
|
3
|
+
\x00`,C+=M(x,2),C+=o.magic,C+=M(b,2),C+=M(w,2),C+=M(k.crc32,4),C+=M(k.compressedSize,4),C+=M(k.uncompressedSize,4),C+=M(l.length,2),C+=M(v.length,2);var G=Ei.LOCAL_FILE_HEADER+C+l+v,ue=Ei.CENTRAL_FILE_HEADER+M(R,2)+C+M(f.length,2)+"\x00\x00\x00\x00"+M(I,4)+M(i,4)+l+v+f;return{fileRecord:G,dirRecord:ue}},my=function(e,t,r,i,n){var s="",a=Ft.transformTo("string",n(i));return s=Ei.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+M(e,2)+M(e,2)+M(t,4)+M(r,4)+M(a.length,2)+a,s},vy=function(e){var t="";return t=Ei.DATA_DESCRIPTOR+M(e.crc32,4)+M(e.compressedSize,4)+M(e.uncompressedSize,4),t};function ye(e,t,r,i){Mt.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}Ft.inherits(ye,Mt);ye.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;if(this.accumulate)this.contentBuffer.push(e);else this.bytesWritten+=e.data.length,Mt.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}})};ye.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=cc(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0};ye.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=cc(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:vy(e),meta:{percent:100}});else{this.push({data:r.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};ye.prototype.flush=function(){var e=this.bytesWritten;for(var t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,i=my(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})};ye.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};ye.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){if(t.closedSource(t.previous.streamInfo),t._sources.length)t.prepareNextSource();else t.end()}),e.on("error",function(r){t.error(r)}),this};ye.prototype.resume=function(){if(!Mt.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};ye.prototype.error=function(e){var t=this._sources;if(!Mt.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(i){}return!0};ye.prototype.lock=function(){Mt.prototype.lock.call(this);var e=this._sources;for(var t=0;t<e.length;t++)e[t].lock()};fc.exports=ye});var dc=T(function(by){var yy=Bs(),wy=hc(),_y=function(e,t){var r=e||t,i=yy[r];if(!i)throw Error(r+" is not a valid compression method !");return i};by.generateWorker=function(e,t,r){var i=new wy(t.streamFiles,r,t.platform,t.encodeFileName),n=0;try{e.forEach(function(s,a){n++;var o=_y(a.options.compression,t.compression),c=a.options.compressionOptions||t.compressionOptions||{},{dir:l,date:u}=a;a._compressWorker(o,c).withStreamInfo("file",{name:s,dir:l,date:u,comment:a.comment||"",unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions}).pipe(i)}),i.entriesCount=n}catch(s){i.error(s)}return i}});var gc=T(function(l1,pc){var Sy=j(),$i=ae();function $r(e,t){$i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}Sy.inherits($r,$i);$r.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(r){t.push({data:r,meta:{percent:0}})}).on("error",function(r){if(t.isPaused)this.generatedError=r;else t.error(r)}).on("end",function(){if(t.isPaused)t._upstreamEnded=!0;else t.end()})};$r.prototype.pause=function(){if(!$i.prototype.pause.call(this))return!1;return this._stream.pause(),!0};$r.prototype.resume=function(){if(!$i.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};pc.exports=$r});var Ec=T(function(u1,kc){var ky=$t(),Tr=j(),wc=ae(),Ey=Un(),_c=jn(),mc=oi(),$y=vl(),Ty=dc(),vc=sr(),Cy=gc(),bc=function(e,t,r){var i=Tr.getTypeOf(t),n,s=Tr.extend(r||{},_c);if(s.date=s.date||new Date,s.compression!==null)s.compression=s.compression.toUpperCase();if(typeof s.unixPermissions==="string")s.unixPermissions=parseInt(s.unixPermissions,8);if(s.unixPermissions&&s.unixPermissions&16384)s.dir=!0;if(s.dosPermissions&&s.dosPermissions&16)s.dir=!0;if(s.dir)e=xc(e);if(s.createFolders&&(n=Iy(e)))Sc.call(this,n,!0);var a=i==="string"&&s.binary===!1&&s.base64===!1;if(!r||typeof r.binary>"u")s.binary=!a;var o=t instanceof mc&&t.uncompressedSize===0;if(o||s.dir||!t||t.length===0)s.base64=!1,s.binary=!0,t="",s.compression="STORE",i="string";var c=null;if(t instanceof mc||t instanceof wc)c=t;else if(vc.isNode&&vc.isStream(t))c=new Cy(e,t);else c=Tr.prepareContent(e,t,s.binary,s.optimizedBinaryString,s.base64);var l=new $y(e,c,s);this.files[e]=l},Iy=function(e){if(e.slice(-1)==="/")e=e.substring(0,e.length-1);var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},xc=function(e){if(e.slice(-1)!=="/")e+="/";return e},Sc=function(e,t){if(t=typeof t<"u"?t:_c.createFolders,e=xc(e),!this.files[e])bc.call(this,e,null,{dir:!0,createFolders:t});return this.files[e]};function yc(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var Ay={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,i;for(t in this.files)if(i=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root)e(r,i)},filter:function(e){var t=[];return this.forEach(function(r,i){if(e(r,i))t.push(i)}),t},file:function(e,t,r){if(arguments.length===1)if(yc(e)){var i=e;return this.filter(function(s,a){return!a.dir&&i.test(s)})}else{var n=this.files[this.root+e];if(n&&!n.dir)return n;else return null}else e=this.root+e,bc.call(this,e,t,r);return this},folder:function(e){if(!e)return this;if(yc(e))return this.filter(function(n,s){return s.dir&&e.test(n)});var t=this.root+e,r=Sc.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(!t){if(e.slice(-1)!=="/")e+="/";t=this.files[e]}if(t&&!t.dir)delete this.files[e];else{var r=this.filter(function(n,s){return s.name.slice(0,e.length)===e});for(var i=0;i<r.length;i++)delete this.files[r[i].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if(r=Tr.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:ky.utf8encode}),r.type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),r.type==="binarystring")r.type="string";if(!r.type)throw Error("No output type specified.");if(Tr.checkSupport(r.type),r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")r.platform="UNIX";if(r.platform==="win32")r.platform="DOS";var i=r.comment||this.comment||"";t=Ty.generateWorker(this,r,i)}catch(n){t=new wc("error"),t.error(n)}return new Ey(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){if(e=e||{},!e.type)e.type="nodebuffer";return this.generateInternalStream(e).toNodejsStream(t)}};kc.exports=Ay});var Ns=T(function(c1,Tc){var Ry=j();function $c(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}$c.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;this.checkOffset(e);for(r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return Ry.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};Tc.exports=$c});var Fs=T(function(f1,Ic){var Cc=Ns(),Oy=j();function Lt(e){Cc.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}Oy.inherits(Lt,Cc);Lt.prototype.byteAt=function(e){return this.data[this.zero+e]};Lt.prototype.lastIndexOfSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3);for(var s=this.length-4;s>=0;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1};Lt.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&i===s[2]&&n===s[3]};Lt.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Ic.exports=Lt});var Oc=T(function(h1,Rc){var Ac=Ns(),By=j();function Ut(e){Ac.call(this,e)}By.inherits(Ut,Ac);Ut.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Ut.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Ut.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Ut.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Rc.exports=Ut});var Ls=T(function(d1,Dc){var Bc=Fs(),Dy=j();function Ms(e){Bc.call(this,e)}Dy.inherits(Ms,Bc);Ms.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Dc.exports=Ms});var Fc=T(function(p1,Nc){var Pc=Ls(),Py=j();function Us(e){Pc.call(this,e)}Py.inherits(Us,Pc);Us.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};Nc.exports=Us});var js=T(function(g1,Lc){var Ti=j(),Mc=Pe(),Ny=Fs(),Fy=Oc(),My=Fc(),Ly=Ls();Lc.exports=function(e){var t=Ti.getTypeOf(e);if(Ti.checkSupport(t),t==="string"&&!Mc.uint8array)return new Fy(e);if(t==="nodebuffer")return new My(e);if(Mc.uint8array)return new Ly(Ti.transformTo("uint8array",e));return new Ny(Ti.transformTo("array",e))}});var qc=T(function(m1,zc){var zs=js(),Ke=j(),Uy=oi(),Uc=ai(),Ci=$t(),Ii=Bs(),jy=Pe(),zy=0,qy=3,Wy=function(e){for(var t in Ii){if(!Object.prototype.hasOwnProperty.call(Ii,t))continue;if(Ii[t].magic===e)return Ii[t]}return null};function jc(e,t){this.options=e,this.loadOptions=t}jc.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),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(t=Wy(this.compressionMethod),t===null)throw Error("Corrupted zip : compression "+Ke.pretty(this.compressionMethod)+" unknown (inner file : "+Ke.transformTo("string",this.fileName)+")");this.decompressed=new Uy(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,e===zy)this.dosPermissions=this.externalFileAttributes&63;if(e===qy)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var e=zs(this.extraFields[1].value);if(this.uncompressedSize===Ke.MAX_VALUE_32BITS)this.uncompressedSize=e.readInt(8);if(this.compressedSize===Ke.MAX_VALUE_32BITS)this.compressedSize=e.readInt(8);if(this.localHeaderOffset===Ke.MAX_VALUE_32BITS)this.localHeaderOffset=e.readInt(8);if(this.diskNumberStart===Ke.MAX_VALUE_32BITS)this.diskNumberStart=e.readInt(4)},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,r,i,n;if(!this.extraFields)this.extraFields={};while(e.index+4<t)r=e.readInt(2),i=e.readInt(2),n=e.readData(i),this.extraFields[r]={id:r,length:i,value:n};e.setIndex(t)},handleUTF8:function(){var e=jy.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Ci.utf8decode(this.fileName),this.fileCommentStr=Ci.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=Ke.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(i!==null)this.fileCommentStr=i;else{var n=Ke.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=zs(e.value);if(t.readInt(1)!==1)return null;if(Uc(this.fileName)!==t.readInt(4))return null;return Ci.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=zs(e.value);if(t.readInt(1)!==1)return null;if(Uc(this.fileComment)!==t.readInt(4))return null;return Ci.utf8decode(t.readData(e.length-5))}return null}};zc.exports=jc});var Vc=T(function(v1,Hc){var Hy=js(),Le=j(),we=Ds(),Vy=qc(),Zy=Pe();function Wc(e){this.files=[],this.loadOptions=e}Wc.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+Le.pretty(t)+", expected "+Le.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4),n=i===t;return this.reader.setIndex(r),n},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 e=this.reader.readData(this.zipCommentLength),t=Zy.uint8array?"uint8array":"array",r=Le.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},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 e=this.zip64EndOfCentralSize-44,t=0,r,i,n;while(t<e)r=this.reader.readInt(2),i=this.reader.readInt(4),n=this.reader.readData(i),this.zip64ExtensibleData[r]={id:r,length:i,value:n}},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 e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(we.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(we.CENTRAL_FILE_HEADER))e=new Vy({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);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 e=this.reader.lastIndexOfSignature(we.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,we.LOCAL_FILE_HEADER);if(t)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(e);var r=e;if(this.checkSignature(we.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Le.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Le.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Le.MAX_VALUE_16BITS||this.centralDirRecords===Le.MAX_VALUE_16BITS||this.centralDirSize===Le.MAX_VALUE_32BITS||this.centralDirOffset===Le.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(we.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(we.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,we.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(we.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(we.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var i=this.centralDirOffset+this.centralDirSize;if(this.zip64)i+=20,i+=12+this.zip64EndOfCentralSize;var n=r-i;if(n>0)if(this.isSignature(r,we.CENTRAL_FILE_HEADER));else this.reader.zero=n;else if(n<0)throw Error("Corrupted zip: missing "+Math.abs(n)+" bytes.")},prepareReader:function(e){this.reader=Hy(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};Hc.exports=Wc});var Jc=T(function(y1,Gc){var qs=j(),Ai=St(),Gy=$t(),Jy=Vc(),Ky=Wn(),Zc=sr();function Yy(e){return new Ai.Promise(function(t,r){var i=e.decompressed.getContentWorker().pipe(new Ky);i.on("error",function(n){r(n)}).on("end",function(){if(i.streamInfo.crc32!==e.decompressed.crc32)r(Error("Corrupted zip : CRC32 mismatch"));else t()}).resume()})}Gc.exports=function(e,t){var r=this;if(t=qs.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Gy.utf8decode}),Zc.isNode&&Zc.isStream(e))return Ai.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return qs.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(i){var n=new Jy(t);return n.load(i),n}).then(function(n){var s=[Ai.Promise.resolve(n)],a=n.files;if(t.checkCRC32)for(var o=0;o<a.length;o++)s.push(Yy(a[o]));return Ai.Promise.all(s)}).then(function(n){var s=n.shift(),a=s.files;for(var o=0;o<a.length;o++){var c=a[o],l=c.fileNameStr,u=qs.resolve(c.fileNameStr);if(r.file(u,c.decompressed,{binary:!0,optimizedBinaryString:!0,date:c.date,dir:c.dir,comment:c.fileCommentStr.length?c.fileCommentStr:null,unixPermissions:c.unixPermissions,dosPermissions:c.dosPermissions,createFolders:t.createFolders}),!c.dir)r.file(u).unsafeOriginalName=l}if(s.zipComment.length)r.comment=s.zipComment;return r})}});var Ws=T(function(w1,Kc){function ge(){if(!(this instanceof ge))return new ge;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 e=new ge;for(var t in this)if(typeof this[t]!=="function")e[t]=this[t];return e}}ge.prototype=Ec();ge.prototype.loadAsync=Jc();ge.support=Pe();ge.defaults=jn();ge.version="3.10.1";ge.loadAsync=function(e,t){return new ge().loadAsync(e,t)};ge.external=St();Kc.exports=ge});var Qc=T(function(_1,Hs){var Oi=process||{},Yc=Oi.argv||[],Ri=Oi.env||{},Xy=!(!!Ri.NO_COLOR||Yc.includes("--no-color"))&&(!!Ri.FORCE_COLOR||Yc.includes("--color")||Oi.platform==="win32"||(Oi.stdout||{}).isTTY&&Ri.TERM!=="dumb"||!!Ri.CI),Qy=(e,t,r=e)=>(i)=>{let n=""+i,s=n.indexOf(t,e.length);return~s?e+ew(n,t,r,s)+t:e+n+t},ew=(e,t,r,i)=>{let n="",s=0;do n+=e.substring(s,i)+r,s=i+t.length,i=e.indexOf(t,s);while(~i);return n+e.substring(s)},Xc=(e=Xy)=>{let t=e?Qy:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};Hs.exports=Xc();Hs.exports.createColors=Xc});function Jw(e){let t=e.toLowerCase();if(t==="read")return"read";if(t==="edit"||t==="multiedit")return"edit";if(t==="write")return"write";if(t==="bash"||t==="shell")return"bash";if(t==="grep")return"grep";if(t==="glob")return"glob";if(t==="webfetch"||t==="websearch")return"webfetch";if(t==="task"||t==="agent")return"task";return"unknown"}function _e(e,t){if(e==null||typeof e!=="object")return null;let r=e[t];return typeof r==="string"?r:null}function Uf(e){let t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t>=0?e.slice(t+1):e}function le(e,t=40){if(e.length<=t)return e;return`${e.slice(0,t-1)}…`}function jf(e){if(e.kind==="session.start")return"Thinking…";if(e.kind==="session.end")return"Done.";if(e.kind==="session.waiting")return"Waiting for you…";let{toolName:t,phase:r,toolInput:i}=e;if(r==="failed")return t?`${le(t,28)} failed`:"Tool failed";let n=Jw(t),s=r==="done";switch(n){case"read":{let a=_e(i,"file_path")??_e(i,"path"),o=a?le(Uf(a)):null;if(o)return s?`Read ${o}`:`Reading ${o}`;return s?"Read file":"Reading file"}case"edit":case"write":{let a=_e(i,"file_path")??_e(i,"path"),o=a?le(Uf(a)):null;if(o)return s?`Edited ${o}`:`Editing ${o}`;return s?"Edited file":"Editing file"}case"bash":{let a=_e(i,"description");if(a)return le(a,40);let o=_e(i,"command");if(o){let c=le(o.split(/\s+/)[0]??o,24);return s?`Ran ${c}`:`Running ${c}`}return s?"Ran command":"Running command"}case"grep":{let a=_e(i,"pattern");if(a)return s?`Searched “${le(a,28)}”`:`Searching “${le(a,28)}”`;return s?"Searched files":"Searching files"}case"glob":{let a=_e(i,"pattern");if(a)return s?`Listed ${le(a,28)}`:`Listing ${le(a,28)}`;return s?"Listed files":"Listing files"}case"webfetch":{let a=_e(i,"url");if(a)try{let o=new URL(a).hostname;return s?`Fetched ${le(o,28)}`:`Fetching ${le(o,28)}`}catch{}return s?"Fetched web":"Searching web"}case"task":{let a=_e(i,"description")??_e(i,"subject");if(a)return s?"Subagent done":`Spawning ${le(a,28)}`;return s?"Subagent done":"Spawning subagent"}default:{let a=le(t,28);return s?`Called ${a}`:`Calling ${a}`}}}import{closeSync as Kw,existsSync as Yw,fstatSync as Xw,mkdirSync as Qw,openSync as e_,readdirSync as t_,readFileSync as Zf,readSync as r_,statSync as i_,unlinkSync as n_,writeFileSync as s_}from"node:fs";import{homedir as a_}from"node:os";import{join as dt}from"node:path";function p_(e,t,r){try{let i=m_(r);if(!i)return;Qw(e,{recursive:!0}),s_(dt(e,`${t}.json`),JSON.stringify({title:i,at:Date.now()}))}catch{}}function g_(e,t){try{let r=Zf(dt(e,`${t}.json`),"utf8"),i=JSON.parse(r);return typeof i.title==="string"&&i.title.length>0?i.title:null}catch{return null}}function m_(e){let t=e.replace(/\s+/g," ").trim();if(t.length<=zf)return t;return`${t.slice(0,zf-1)}…`}function w_(e){let t=e.replace(/\s+/g," ").trim();if(t.length<=qf)return t;return`${t.slice(0,qf-1)}…`}function __(e){let t=null;try{t=e_(e,"r");let r=Xw(t).size,i=Math.min(r,v_),n=Buffer.alloc(i);r_(t,n,0,i,r-i);let s=n.toString("utf8").split(`
|
|
4
|
+
`);for(let a=s.length-1;a>=0;a--){let o=s[a]?.trim();if(!o)continue;let c;try{c=JSON.parse(o)}catch{continue}if(c==null||typeof c!=="object"||c.type!=="assistant")continue;let l=c.message;if(l==null||typeof l!=="object")continue;let u=l.content;if(!Array.isArray(u))continue;let h=u.filter((f)=>f!=null&&typeof f==="object"&&f.type==="text"&&typeof f.text==="string").map((f)=>f.text).join(" ").trim();if(h)return h}return null}catch{return null}finally{if(t!==null)try{Kw(t)}catch{}}}function b_(e,t=Date.now()){try{for(let r of t_(e)){if(!r.endsWith(".json"))continue;let i=dt(e,r);try{if(t-i_(i).mtimeMs>y_)n_(i)}catch{}}}catch{}}function x_(e){if(typeof e!=="string")return null;return/^[a-zA-Z0-9_-]{1,64}$/.test(e)?e:null}function Wf(e){let t=0;while(t<e.length&&/\s/.test(e[t]??""))t+=1;let r=e[t];if(r!=="{"&&r!=="[")return null;let i=[r==="{"?"}":"]"],n=!1,s=!1;for(let a=t+1;a<e.length;a+=1){let o=e[a];if(n){if(s)s=!1;else if(o==="\\")s=!0;else if(o==='"')n=!1;continue}if(o==='"'){n=!0;continue}if(o==="{"||o==="["){i.push(o==="{"?"}":"]");continue}if(o!=="}"&&o!=="]")continue;if(i.pop()!==o)return null;if(i.length!==0)continue;try{return JSON.parse(e.slice(t,a+1)),a+1}catch{return null}}return null}function S_(e){if(e<=127)return 0;if(e>=194&&e<=223)return 1;if(e>=224&&e<=239)return 2;if(e>=240&&e<=244)return 3;return null}function k_(e){let t=e.length-1;while(t>=0&&(e[t]&192)===128)t-=1;if(t<0)return e.length;let r=S_(e[t]),i=e.length-t-1;if(r!==null&&i<r)return t;return e.length}function Hf(e){return e.toString("utf8",0,k_(e))}function E_(e,t){let r=e[0];if(r==="pre"){if(t){let i=t.toLowerCase();if(i==="read"||i==="grep"||i==="glob")return"review"}return"running"}if(r==="post")return"idle";if(r==="tool-failure")return"failed";if(r==="stop"||r==="session-end")return"waving";if(r==="user-prompt"||r==="session-start")return"jumping";if(r==="waiting"||r==="notification")return"waiting";return null}function T_(e,t,r){let i={state:e};if(t>0)i.duration=t;return i.agent_source=r,i}function C_(e,t,r,i,n){let s={text:e,busy:t,agent_source:r};if(i)s.title=i;if(n)s.session_id=n;return s}async function I_(e=process.stdin){if(e.isTTY)return Promise.resolve("");return await new Promise((t)=>{let r=[],i=0,n=!1,s,a,o=()=>{let f=Buffer.concat(r,i),d=Hf(f),p=Wf(d);return p===null?d:d.slice(0,p)},c=()=>{if(s!==void 0)clearTimeout(s);if(a!==void 0)clearTimeout(a);e.off("data",h),e.off("end",l),e.off("error",l),e.pause()},l=()=>{if(n)return;n=!0,c(),t(o())},u=()=>{if(n)return;if(n=!0,s!==void 0)clearTimeout(s);t(o()),a=setTimeout(c,d_),a.unref?.()},h=(f)=>{let d=Buffer.isBuffer(f)?f:Buffer.from(f);if(!n){let p=f_-i;if(p>0){let m=Buffer.from(d.subarray(0,p));r.push(m),i+=m.length;let b=Hf(Buffer.concat(r,i));if(Wf(b)!==null)u()}}};e.on("data",h),e.on("end",l),e.on("error",l),e.resume(),s=setTimeout(l,h_)})}function na(e){if(!e.trim())return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null};try{let t=JSON.parse(e),r=typeof t.tool_name==="string"?t.tool_name:null,i=t.tool_input,n=typeof t.agent_source==="string"?t.agent_source:null,s=x_(t.session_id),a=typeof t.prompt==="string"?t.prompt:null,o=typeof t.transcript_path==="string"?t.transcript_path:null,c=typeof t.last_assistant_message==="string"?t.last_assistant_message:null;return{toolName:r,toolInput:i,agentSource:n,sessionId:s,prompt:a,transcriptPath:o,lastAssistantMessage:c}}catch{return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null}}}function A_(e,t){let r=e[0];if(!r)return null;if(r==="stop"||r==="session-end")return{kind:"session.end"};if(r==="user-prompt"||r==="session-start")return{kind:"session.start"};if(r==="waiting"||r==="notification")return{kind:"session.waiting"};if(r==="tool-failure"){let{toolName:a}=na(t);return{kind:"tool",phase:"failed",toolName:a??"",toolInput:void 0}}let i=r==="pre"?"running":r==="post"?"done":null;if(!i)return null;let{toolName:n,toolInput:s}=na(t);if(!n)return{kind:"tool",phase:i,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:i,toolName:n,toolInput:s}}function R_(){try{let e=Zf(o_,"utf8").trim();return e.length>0?e:null}catch{return null}}async function Vf(e,t,r){let i=new AbortController,n=setTimeout(()=>i.abort(),300);try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":r},body:JSON.stringify(t),signal:i.signal})}catch{}finally{clearTimeout(n)}}async function Jf(e){let t=I_();if(Yw(l_)){await t;return}let r=e[1]??null,i=await t,n=A_(e,i);if(!n)return;let s=e[0],{toolName:a,agentSource:o,sessionId:c,prompt:l,transcriptPath:u,lastAssistantMessage:h}=na(i),f=O_(o,r);if(c&&l&&(s==="user-prompt"||s==="session-start"))p_(ia,c,l);let d=c?g_(ia,c):null,p=jf(n);if(s==="stop"||s==="session-end"){let v=h??(u?__(u):null);if(v)p=w_(v);b_(ia)}let m=E_(e,a),b=R_();if(!b)return;let w=[];if(p){let v=s==="user-prompt"||s==="session-start"||s==="pre"||s==="post"||s==="tool-failure";w.push(Vf(u_,C_(p,v,f,d,c),b))}if(m){let v=s==="tool-failure"?$_:0;w.push(Vf(c_,T_(m,v,f),b))}await Promise.all(w)}function O_(e,t){return t&&t.length>0?t:e}var sa,o_,l_,Gf="http://127.0.0.1:7777",u_,c_,f_=65536,h_=500,d_=300,ia,zf=60,qf=110,v_=65536,y_=86400000,$_=1220;var Kf=ga(()=>{sa=dt(a_(),".petdex","runtime"),o_=dt(sa,"update-token"),l_=dt(sa,"hooks-disabled"),u_=`${Gf}/bubble`,c_=`${Gf}/state`,ia=dt(sa,"sessions")});import{readFile as Xf}from"node:fs/promises";import{homedir as Qf}from"node:os";import eh from"node:path";async function M_(){try{return(await Xf(P_,"utf8")).trim()}catch{return null}}async function L_(){try{return await Xf(N_),!0}catch{return!1}}async function Yf(e,t){let r=await M_();if(!r)return{ok:!1,status:0};try{let i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":r},body:JSON.stringify(t),signal:AbortSignal.timeout(300)});return{ok:i.ok,status:i.status}}catch{return{ok:!1,status:0}}}function me(e){let t=JSON.stringify(e);if(aa==="jsonl"){process.stdout.write(`${t}
|
|
5
|
+
`);return}let i=`Content-Length: ${new TextEncoder().encode(t).length}\r
|
|
6
6
|
\r
|
|
7
|
-
`;process.stdout.write(
|
|
8
|
-
`),
|
|
9
|
-
`){if(
|
|
10
|
-
`){if(
|
|
11
|
-
`)}var
|
|
12
|
-
`),
|
|
13
|
-
`),
|
|
14
|
-
`)
|
|
15
|
-
`).
|
|
16
|
-
`)
|
|
17
|
-
`)
|
|
18
|
-
`)
|
|
19
|
-
`)
|
|
20
|
-
`).
|
|
21
|
-
`)),this._prevFrame=$;return}}this.output.write(s.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function JY($,Q){if($===void 0||Q.length===0)return 0;let J=Q.findIndex((q)=>q.value===$);return J!==-1?J:0}function qY($,Q){return(Q.label??String(Q.value)).toLowerCase().includes($.toLowerCase())}function YY($,Q){if(Q)return $?Q:Q[0]}var GY=class extends a0{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Q=0;#Y="";#$;#G;#X;get cursor(){return this.#Q}get userInputWithCursor(){if(!this.userInput)return n6(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let Q=this.userInput.slice(0,this._cursor),[J,...q]=this.userInput.slice(this._cursor);return`${Q}${n6("inverse",J)}${q.join("")}`}get options(){return typeof this.#G=="function"?this.#G():this.#G}constructor(Q){super(Q),this.#G=Q.options,this.#X=Q.placeholder;let J=this.options;this.filteredOptions=[...J],this.multiple=Q.multiple===!0,this.#$=typeof Q.options=="function"?Q.filter:Q.filter??qY;let q;if(Q.initialValue&&Array.isArray(Q.initialValue)?this.multiple?q=Q.initialValue:q=Q.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(q=[this.options[0].value]),q)for(let Y of q){let G=J.findIndex((V)=>V.value===Y);G!==-1&&(this.toggleSelected(Y),this.#Q=G)}this.focusedValue=this.options[this.#Q]?.value,this.on("key",(Y,G)=>this.#J(Y,G)),this.on("userInput",(Y)=>this.#q(Y))}_isActionKey(Q,J){return Q==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&Q!==void 0&&Q!==""}#J(Q,J){let q=J.name==="up",Y=J.name==="down",G=J.name==="return",V=this.userInput===""||this.userInput==="\t",X=this.#X,W=this.options,K=X!==void 0&&X!==""&&W.some((U)=>!U.disabled&&(this.#$?this.#$(X,U):!0));if(J.name==="tab"&&V&&K){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(X,!0),this.isNavigating=!1;return}q||Y?(this.#Q=F1(this.#Q,q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Q]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):G?this.value=YY(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(Q){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(Q)?this.selectedValues=this.selectedValues.filter((J)=>J!==Q):this.selectedValues=[...this.selectedValues,Q]:this.selectedValues=[Q])}#q(Q){if(Q!==this.#Y){this.#Y=Q;let J=this.options;Q&&this.#$?this.filteredOptions=J.filter((G)=>this.#$?.(Q,G)):this.filteredOptions=[...J];let q=JY(this.focusedValue,this.filteredOptions);this.#Q=F1(q,0,this.filteredOptions);let Y=this.filteredOptions[this.#Q];Y&&!Y.disabled?this.focusedValue=Y.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class $$ extends a0{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(s.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var VY={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function R4($){return[...$].map((Q)=>VY[Q])}function XY($){let Q=new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2000,0,15)),J=[],q="/";for(let Y of Q)Y.type==="literal"?q=Y.value.trim()||Y.value:(Y.type==="year"||Y.type==="month"||Y.type==="day")&&J.push({type:Y.type,len:Y.type==="year"?4:2});return{segments:J,separator:q}}function i6($){return Number.parseInt(($||"0").replace(/_/g,"0"),10)||0}function S8($){return{year:i6($.year),month:i6($.month),day:i6($.day)}}function a6($,Q){return new Date($||2001,Q||1,0).getDate()}function S4($){let{year:Q,month:J,day:q}=S8($);if(!Q||Q<0||Q>9999||!J||J<1||J>12||!q||q<1)return;let Y=new Date(Date.UTC(Q,J-1,q));if(!(Y.getUTCFullYear()!==Q||Y.getUTCMonth()!==J-1||Y.getUTCDate()!==q))return{year:Q,month:J,day:q}}function k4($){let Q=S4($);return Q?new Date(Date.UTC(Q.year,Q.month-1,Q.day)):void 0}function KY($,Q,J,q){let Y=J?{year:J.getUTCFullYear(),month:J.getUTCMonth()+1,day:J.getUTCDate()}:null,G=q?{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate()}:null;return $==="year"?{min:Y?.year??1,max:G?.year??9999}:$==="month"?{min:Y&&Q.year===Y.year?Y.month:1,max:G&&Q.year===G.year?G.month:12}:{min:Y&&Q.year===Y.year&&Q.month===Y.month?Y.day:1,max:G&&Q.year===G.year&&Q.month===G.month?G.day:a6(Q.year,Q.month)}}class T4 extends a0{#Q;#Y;#$;#G;#X;#J={segmentIndex:0,positionInSegment:0};#q=!0;#V=null;inlineError="";get segmentCursor(){return{...this.#J}}get segmentValues(){return{...this.#$}}get segments(){return this.#Q}get separator(){return this.#Y}get formattedValue(){return this.#j(this.#$)}#j($){return this.#Q.map((Q)=>$[Q.type]).join(this.#Y)}#K(){this._setUserInput(this.#j(this.#$)),this._setValue(k4(this.#$)??void 0)}constructor($){let Q=$.format?{segments:R4($.format),separator:$.separator??"/"}:XY($.locale),J=$.separator??Q.separator,q=$.format?R4($.format):Q.segments,Y=$.initialValue??$.defaultValue,G=Y?{year:String(Y.getUTCFullYear()).padStart(4,"0"),month:String(Y.getUTCMonth()+1).padStart(2,"0"),day:String(Y.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},V=q.map((X)=>G[X.type]).join(J);super({...$,initialUserInput:V},!1),this.#Q=q,this.#Y=J,this.#$=G,this.#G=$.minDate,this.#X=$.maxDate,this.#K(),this.on("cursor",(X)=>this.#P(X)),this.on("key",(X,W)=>this.#Z(X,W)),this.on("finalize",()=>this.#z($))}#U(){let $=Math.max(0,Math.min(this.#J.segmentIndex,this.#Q.length-1)),Q=this.#Q[$];if(Q)return this.#J.positionInSegment=Math.max(0,Math.min(this.#J.positionInSegment,Q.len-1)),{segment:Q,index:$}}#W($){this.inlineError="",this.#V=null;let Q=this.#U();Q&&(this.#J.segmentIndex=Math.max(0,Math.min(this.#Q.length-1,Q.index+$)),this.#J.positionInSegment=0,this.#q=!0)}#F($){let Q=this.#U();if(!Q)return;let{segment:J}=Q,q=this.#$[J.type],Y=!q||q.replace(/_/g,"")==="",G=Number.parseInt((q||"0").replace(/_/g,"0"),10)||0,V=KY(J.type,S8(this.#$),this.#G,this.#X),X;Y?X=$===1?V.min:V.max:X=Math.max(Math.min(V.max,G+$),V.min),this.#$={...this.#$,[J.type]:X.toString().padStart(J.len,"0")},this.#q=!0,this.#V=null,this.#K()}#P($){if($)switch($){case"right":return this.#W(1);case"left":return this.#W(-1);case"up":return this.#F(1);case"down":return this.#F(-1)}}#Z($,Q){if(Q?.name==="backspace"||Q?.sequence===""||Q?.sequence==="\b"||$===""||$==="\b"){this.inlineError="";let J=this.#U();if(!J)return;if(!this.#$[J.segment.type].replace(/_/g,"")){this.#W(-1);return}this.#$[J.segment.type]="_".repeat(J.segment.len),this.#q=!0,this.#J.positionInSegment=0,this.#K();return}if(Q?.name==="tab"){this.inlineError="";let J=this.#U();if(!J)return;let q=Q.shift?-1:1,Y=J.index+q;Y>=0&&Y<this.#Q.length&&(this.#J.segmentIndex=Y,this.#J.positionInSegment=0,this.#q=!0);return}if($&&/^[0-9]$/.test($)){let J=this.#U();if(!J)return;let{segment:q}=J,Y=!this.#$[q.type].replace(/_/g,"");if(this.#q&&this.#V!==null&&!Y){let j=this.#V+$,H={...this.#$,[q.type]:j},Z=this.#H(H,q);if(Z){this.inlineError=Z,this.#V=null,this.#q=!1;return}this.inlineError="",this.#$[q.type]=j,this.#V=null,this.#q=!1,this.#K(),J.index<this.#Q.length-1&&(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0);return}this.#q&&!Y&&(this.#$[q.type]="_".repeat(q.len),this.#J.positionInSegment=0),this.#q=!1,this.#V=null;let G=this.#$[q.type],V=G.indexOf("_"),X=V>=0?V:Math.min(this.#J.positionInSegment,q.len-1);if(X<0||X>=q.len)return;let W=G.slice(0,X)+$+G.slice(X+1),K=!1;if(X===0&&G==="__"&&(q.type==="month"||q.type==="day")){let j=Number.parseInt($,10);W=`0${$}`,K=j<=(q.type==="month"?1:2)}if(q.type==="year"&&(W=(G.replace(/_/g,"")+$).padStart(q.len,"_")),!W.includes("_")){let j={...this.#$,[q.type]:W},H=this.#H(j,q);if(H){this.inlineError=H;return}}this.inlineError="",this.#$[q.type]=W;let U=W.includes("_")?void 0:S4(this.#$);if(U){let{year:j,month:H}=U,Z=a6(j,H);this.#$={year:String(Math.max(0,Math.min(9999,j))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,H))).padStart(2,"0"),day:String(Math.max(1,Math.min(Z,U.day))).padStart(2,"0")}}this.#K();let F=W.indexOf("_");K?(this.#q=!0,this.#V=$):F>=0?this.#J.positionInSegment=F:V>=0&&J.index<this.#Q.length-1?(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0):this.#J.positionInSegment=Math.min(X+1,q.len-1)}}#H($,Q){let{month:J,day:q}=S8($);if(Q.type==="month"&&(J<0||J>12))return n.date.messages.invalidMonth;if(Q.type==="day"&&(q<0||q>31))return n.date.messages.invalidDay(31,"any month")}#z($){let{year:Q,month:J,day:q}=S8(this.#$);if(Q&&J&&q){let Y=a6(Q,J);this.#$={...this.#$,day:String(Math.min(q,Y)).padStart(2,"0")}}this.value=k4(this.#$)??$.defaultValue??void 0}}var UY=class extends a0{options;cursor=0;#Q;getGroupItems(Q){return this.options.filter((J)=>J.group===Q)}isGroupSelected(Q){let J=this.getGroupItems(Q),q=this.value;return q===void 0?!1:J.every((Y)=>q.includes(Y.value))}toggleValue(){let Q=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),Q.group===!0){let J=Q.value,q=this.getGroupItems(J);this.isGroupSelected(J)?this.value=this.value.filter((Y)=>q.findIndex((G)=>G.value===Y)===-1):this.value=[...this.value,...q.map((Y)=>Y.value)],this.value=Array.from(new Set(this.value))}else{let J=this.value.includes(Q.value);this.value=J?this.value.filter((q)=>q!==Q.value):[...this.value,Q.value]}}constructor(Q){super(Q,!1);let{options:J}=Q;this.#Q=Q.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([q,Y])=>[{value:q,group:!0,label:q},...Y.map((G)=>({...G,group:q}))]),this.value=[...Q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),this.#Q?0:1),this.on("cursor",(q)=>{switch(q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(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;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},WY=new Set(["up","down","left","right"]);class y4 extends a0{#Q=!1;#Y;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${$}█`;let Q=$.slice(0,this.cursor),J=$[this.cursor],q=$.slice(this.cursor+1);return J===`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
`:""}${
|
|
29
|
-
`,W=this.value?Q:J;switch(this.state){case"submit":{let K=q?`${k("gray",c)} `:"";return`${X}${K}${k("dim",W)}`}case"cancel":{let K=q?`${k("gray",c)} `:"";return`${X}${K}${k(["strikethrough","dim"],W)}${q?`
|
|
30
|
-
${k("gray",c)}`:""}`}default:{let K=q?`${k("cyan",c)} `:"",U=q?k("cyan",h8):"";return`${X}${K}${this.value?`${k("green",q$)} ${Q}`:`${k("dim",y8)} ${k("dim",Q)}`}${$.vertical?q?`
|
|
31
|
-
${k("cyan",c)} `:`
|
|
32
|
-
`:` ${k("dim","/")} `}${this.value?`${k("dim",y8)} ${k("dim",J)}`:`${k("green",q$)} ${J}`}
|
|
33
|
-
${U}
|
|
34
|
-
`}}}}).prompt()};var u=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${k("gray",h8)} `:"";J.write(`${q}${k("red",$)}
|
|
7
|
+
`;process.stdout.write(i),process.stdout.write(t)}function Ar(e,t,r){return{jsonrpc:"2.0",id:e,error:{code:t,message:r}}}async function j_(e){let{id:t,method:r,params:i}=e;switch(r){case"initialize":{let n=i?.protocolVersion??"2025-03-26";me({jsonrpc:"2.0",id:t,result:{protocolVersion:n,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"petdex-mcp-server",version:F_}}});return}case"tools/list":{me({jsonrpc:"2.0",id:t,result:{tools:U_}});return}case"tools/call":{let n=i?.name,s=i?.arguments??{};if(await L_()){me({jsonrpc:"2.0",id:t,result:{content:[{type:"text",text:"Petdex hooks are disabled. Run /petdex in your agent or `petdex hooks on` to re-enable."}]}});return}switch(n){case"petdex_set_state":{let a=s.state;if(!a){me(Ar(t,-32602,"Missing required argument: state"));return}let o={state:a,agent_source:"antigravity"};if(typeof s.duration==="number")o.duration=s.duration;let c=await Yf(B_,o);me({jsonrpc:"2.0",id:t,result:{content:[{type:"text",text:c.ok?`Pet state set to "${a}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_show_bubble":{let a=s.text;if(!a){me(Ar(t,-32602,"Missing required argument: text"));return}let o=await Yf(D_,{text:a,agent_source:"antigravity"});me({jsonrpc:"2.0",id:t,result:{content:[{type:"text",text:o.ok?`Bubble shown: "${a}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_status":{let a=!1;try{a=(await fetch(`${la}/health`,{signal:AbortSignal.timeout(500)})).ok}catch{a=!1}me({jsonrpc:"2.0",id:t,result:{content:[{type:"text",text:a?"Petdex desktop is reachable.":"Petdex desktop not detected. Start it with `petdex up`."}]}});return}default:{me(Ar(t,-32601,`Unknown tool: ${n}`));return}}}case"notifications/initialized":return;default:me(Ar(t,-32601,`Unknown method: ${r}`))}}async function th(){let e=new Uint8Array(0),t=0,r=!1,i=new TextDecoder;function n(){if(t===0)process.exit(0)}process.stdin.on("data",(a)=>{let o=typeof a==="string"?new TextEncoder().encode(a):a,c=new Uint8Array(e.length+o.length);c.set(e),c.set(o,e.length),e=c;while(!0){let l=q_(e);if(l===123||l===91){let g=oa(e,new Uint8Array([10]));if(g===-1)break;let y=W_(e.slice(0,g));e=e.slice(g+1);let E=i.decode(y).trim();if(!E)continue;aa="jsonl",s(E);continue}let u=z_(e),h=u.index;if(h===-1)break;let f=e.slice(0,h),p=i.decode(f).match(/Content-Length:\s*(\d+)/i);if(!p){e=e.slice(h+u.length);continue}let m=parseInt(p[1],10),b=h+u.length,w=b+m;if(e.length<w)break;let v=e.slice(b,w),S=i.decode(v);e=e.slice(w),aa="framed",s(S)}}),process.stdin.on("end",()=>{r=!0,n(),setTimeout(()=>process.exit(0),3000).unref()});function s(a){try{let o=JSON.parse(a);t++,j_(o).catch((c)=>{me(Ar(o.id,-32603,`Internal error: ${c.message}`))}).finally(()=>{if(t--,r)n()})}catch(o){me({jsonrpc:"2.0",id:null,error:{code:-32700,message:`Parse error: ${o.message}`}})}}}function oa(e,t){e:for(let r=0;r<=e.length-t.length;r++){for(let i=0;i<t.length;i++)if(e[r+i]!==t[i])continue e;return r}return-1}function z_(e){let t=oa(e,new Uint8Array([13,10,13,10]));if(t!==-1)return{index:t,length:4};let r=oa(e,new Uint8Array([10,10]));if(r!==-1)return{index:r,length:2};return{index:-1,length:0}}function q_(e){for(let t of e)if(t!==32&&t!==9&&t!==10&&t!==13)return t;return null}function W_(e){if(e.at(-1)===13)return e.slice(0,-1);return e}var la="http://127.0.0.1:7777",B_,D_,P_,N_,F_="0.1.0",aa="framed",U_;var rh=ga(()=>{B_=`${la}/state`,D_=`${la}/bubble`,P_=eh.join(Qf(),".petdex","runtime","update-token"),N_=eh.join(Qf(),".petdex","runtime","hooks-disabled");U_=[{name:"petdex_set_state",description:"Set the pet's animation state. Call this before/after tool use to reflect agent activity.",inputSchema:{type:"object",properties:{state:{type:"string",description:"Animation state: idle, running, running-left, running-right, waving, jumping, failed, review, waiting",enum:["idle","running","running-left","running-right","waving","jumping","failed","review","waiting"]},duration:{type:"number",description:"Optional duration in ms to hold this state"}},required:["state"]}},{name:"petdex_show_bubble",description:"Show a speech bubble above the pet with the given text. Use to display what the agent is currently doing.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The bubble text to display (e.g. 'Reading server.ts')"}},required:["text"]}},{name:"petdex_status",description:"Check if the petdex desktop mascot is reachable. Returns connection status.",inputSchema:{type:"object",properties:{}}}]});import{mkdir as ih,readdir as H_,readFile as fa,stat as uh,writeFile as Li}from"node:fs/promises";import{homedir as nh}from"node:os";import ie from"node:path";import{stdout as Ki,stdin as Oa}from"node:process";import*as Ue from"node:readline";import Uh from"node:readline";var ma=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(t)=>{let r=0;e.lastIndex=0;while(e.test(t))r+=1;return t.length-r}})(),va=(e)=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ya=(e)=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141;var Eh=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,$h=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,wa=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Th=/\t{1,1000}/y,_a=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,Ch=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ih=/\p{M}+/gu,Ah={limit:1/0,ellipsis:""},ba=(e,t={},r={})=>{let i=t.limit??1/0,n=t.ellipsis??"",s=t?.ellipsisWidth??(n?ba(n,Ah,r).width:0),a=0,o=r.controlWidth??0,c=r.tabWidth??8,l=r.emojiWidth??2,u=2,h=r.regularWidth??1,f=r.wideWidth??2,d=[[Ch,h],[Eh,0],[$h,o],[Th,c],[_a,l],[wa,f]],p=0,m=0,b=e.length,w=0,v=!1,S=b,g=Math.max(0,i-s),y=0,E=0,k=0,x=0;e:while(!0){if(E>y||m>=b&&m>p){let I=e.slice(y,E)||e.slice(p,m);w=0;for(let R of I.replaceAll(Ih,"")){let C=R.codePointAt(0)||0;if(va(C))x=2;else if(ya(C))x=f;else x=h;if(k+x>g)S=Math.min(S,Math.max(y,p)+w);if(k+x>i){v=!0;break e}w+=R.length,k+=x}y=E=0}if(m>=b)break e;for(let I=0,R=d.length;I<R;I++){let[C,G]=d[I];if(C.lastIndex=m,C.test(e)){if(w=C===wa?ma(e.slice(m,C.lastIndex)):C===_a?1:C.lastIndex-m,x=w*G,k+x>g)S=Math.min(S,m+Math.floor((g-k)/G));if(k+x>i){v=!0;break e}k+=x,y=p,E=m,m=p=C.lastIndex;continue e}}m+=1}return{width:v?g:k,index:v?S:b,truncated:v,ellipsed:v&&i>=s}},xa=ba;var Rh={limit:1/0,ellipsis:"",ellipsisWidth:0},Oh=(e,t={})=>xa(e,Rh,t).width,ee=Oh;var Br="\x1B",Ta="",Bh=39,Hi="\x07",Ca="[",Dh="]",Ia="m",Vi=`${Dh}8;;`,Sa=new RegExp(`(?:\\${Ca}(?<code>\\d+)m|\\${Vi}(?<uri>.*)${Hi})`,"y"),ka=(e)=>{if(e>=30&&e<=37)return 39;if(e>=90&&e<=97)return 39;if(e>=40&&e<=47)return 49;if(e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0;return},Ea=(e)=>`${Br}${Ca}${e}${Ia}`,$a=(e)=>`${Br}${Vi}${e}${Hi}`,Wi=(e,t,r)=>{let i=t[Symbol.iterator](),n=!1,s=!1,a=e.at(-1),o=a===void 0?0:ee(a),c=i.next(),l=i.next(),u=0;while(!c.done){let h=c.value,f=ee(h);if(o+f<=r)e[e.length-1]+=h;else e.push(h),o=0;if(h===Br||h===Ta)n=!0,s=t.startsWith(Vi,u+1);if(n){if(s){if(h===Hi)n=!1,s=!1}else if(h===Ia)n=!1}else if(o+=f,o===r&&!l.done)e.push(""),o=0;c=l,l=i.next(),u+=h.length}if(a=e.at(-1),!o&&a!==void 0&&a.length&&e.length>1)e[e.length-2]+=e.pop()},Ph=(e)=>{let t=e.split(" "),r=t.length;while(r){if(ee(t[r-1]))break;r--}if(r===t.length)return e;return t.slice(0,r).join(" ")+t.slice(r).join("")},Nh=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let i="",n,s,a=e.split(" "),o=[""],c=0;for(let h=0;h<a.length;h++){let f=a[h];if(r.trim!==!1){let p=o.at(-1)??"",m=p.trimStart();if(p.length!==m.length)o[o.length-1]=m,c=ee(m)}if(h!==0){if(c>=t&&(r.wordWrap===!1||r.trim===!1))o.push(""),c=0;if(c||r.trim===!1)o[o.length-1]+=" ",c++}let d=ee(f);if(r.hard&&d>t){let p=t-c,m=1+Math.floor((d-p-1)/t);if(Math.floor((d-1)/t)<m)o.push("");Wi(o,f,t),c=ee(o.at(-1)??"");continue}if(c+d>t&&c&&d){if(r.wordWrap===!1&&c<t){Wi(o,f,t),c=ee(o.at(-1)??"");continue}o.push(""),c=0}if(c+d>t&&r.wordWrap===!1){Wi(o,f,t),c=ee(o.at(-1)??"");continue}o[o.length-1]+=f,c+=d}if(r.trim!==!1)o=o.map((h)=>Ph(h));let l=o.join(`
|
|
8
|
+
`),u=!1;for(let h=0;h<l.length;h++){let f=l[h];if(i+=f,!u){if(u=f>="\uD800"&&f<="\uDBFF",u)continue}else u=!1;if(f===Br||f===Ta){Sa.lastIndex=h+1;let p=Sa.exec(l)?.groups;if(p?.code!==void 0){let m=Number.parseFloat(p.code);n=m===Bh?void 0:m}else if(p?.uri!==void 0)s=p.uri.length===0?void 0:p.uri}if(l[h+1]===`
|
|
9
|
+
`){if(s)i+=$a("");let d=n?ka(n):void 0;if(n&&d)i+=Ea(d)}else if(f===`
|
|
10
|
+
`){if(n&&ka(n))i+=Ea(n);if(s)i+=$a(s)}}return i},Fh=/\r?\n/;function xe(e,t,r){return String(e).normalize().split(Fh).map((i)=>Nh(i,t,r)).join(`
|
|
11
|
+
`)}var Y=zt(Gi(),1);import{ReadStream as Ra}from"node:tty";function Pr(e,t,r){if(!r.some((a)=>!a.disabled))return e;let i=e+t,n=Math.max(r.length-1,0),s=i<0?n:i>n?0:i;return r[s].disabled?Pr(s,t<0?-1:1,r):s}var jh=["up","down","left","right","space","enter","cancel"],zh=["January","February","March","April","May","June","July","August","September","October","November","December"],te={actions:new Set(jh),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...zh],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:(e)=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:(e)=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function Yi(e,t){if(typeof e=="string")return te.aliases.get(e)===t;for(let r of e)if(r!==void 0&&Yi(r,t))return!0;return!1}function qh(e,t){if(e===t)return;let r=e.split(`
|
|
12
|
+
`),i=t.split(`
|
|
13
|
+
`),n=Math.max(r.length,i.length),s=[];for(let a=0;a<n;a++)r[a]!==i[a]&&s.push(a);return{lines:s,numLinesBefore:r.length,numLinesAfter:i.length,numLines:n}}var Wh=globalThis.process.platform.startsWith("win"),Ji=Symbol("clack:cancel");function pt(e){return e===Ji}function Dr(e,t){let r=e;r.isTTY&&r.setRawMode(t)}function Ba({input:e=Oa,output:t=Ki,overwrite:r=!0,hideCursor:i=!0}={}){let n=Ue.createInterface({input:e,output:t,prompt:"",tabSize:1});Ue.emitKeypressEvents(e,n),e instanceof Ra&&e.isTTY&&e.setRawMode(!0);let s=(a,{name:o,sequence:c})=>{let l=String(a);if(Yi([l,o,c],"cancel")){i&&t.write(Y.cursor.show),process.exit(0);return}if(!r)return;Ue.moveCursor(t,o==="return"?0:-1,o==="return"?-1:0,()=>{Ue.clearLine(t,1,()=>{e.once("keypress",s)})})};return i&&t.write(Y.cursor.hide),e.once("keypress",s),()=>{e.off("keypress",s),i&&t.write(Y.cursor.show),e instanceof Ra&&e.isTTY&&!Wh&&e.setRawMode(!1),n.terminal=!1,n.close()}}var qt=(e)=>("columns"in e)&&typeof e.columns=="number"?e.columns:80,Xi=(e)=>("rows"in e)&&typeof e.rows=="number"?e.rows:20;function Wt(e,t,r,i=r,n){let s=qt(e??Ki);return xe(t,s-r.length,{hard:!0,trim:!1}).split(`
|
|
14
|
+
`).map((a,o)=>{let c=n?n(a,o):a;return`${o===0?i:r}${c}`}).join(`
|
|
15
|
+
`)}var Da=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:r=Oa,output:i=Ki,render:n,signal:s,...a}=e;this.opts=a,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=n.bind(this),this._track=t,this._abortSignal=s,this.input=r,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let r=this._subscribers.get(e)??[];r.push(t),this._subscribers.set(e,r)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let r=this._subscribers.get(e)??[],i=[];for(let n of r)n.cb(...t),n.once&&i.push(()=>r.splice(r.indexOf(n),1));for(let n of i)n()}prompt(){return new Promise((e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(Ji);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Uh.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),Dr(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Y.cursor.show),this.output.off("resize",this.render),Dr(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(Y.cursor.show),this.output.off("resize",this.render),Dr(this.input,!1),e(Ji)})})}_isActionKey(e,t){return e==="\t"}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress(e,t){if(this._track&&t.name!=="return"&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),t?.name&&(!this._track&&te.aliases.has(t.name)&&this.emit("cursor",te.aliases.get(t.name)),te.actions.has(t.name)&&this.emit("cursor",t.name)),e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n")&&this.emit("confirm",e.toLowerCase()==="y"),this.emit("key",e?.toLowerCase(),t),t?.name==="return"&&this._shouldSubmit(e,t)){if(this.opts.validate){let r=this.opts.validate(this.value);r&&(this.error=r instanceof Error?r.message:r,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}Yi([e,t?.name,t?.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(`
|
|
16
|
+
`),Dr(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=xe(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
17
|
+
`).length-1;this.output.write(Y.cursor.move(-999,e*-1))}render(){let e=xe(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state==="initial")this.output.write(Y.cursor.hide);else{let t=qh(this._prevFrame,e),r=Xi(this.output);if(this.restoreCursor(),t){let i=Math.max(0,t.numLinesAfter-r),n=Math.max(0,t.numLinesBefore-r),s=t.lines.find((a)=>a>=i);if(s===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(Y.cursor.move(0,s-n)),this.output.write(Y.erase.lines(1));let a=e.split(`
|
|
18
|
+
`);this.output.write(a[s]),this._prevFrame=e,this.output.write(Y.cursor.move(0,a.length-s-1));return}else if(t.lines.length>1){if(i<n)s=i;else{let o=s-n;o>0&&this.output.write(Y.cursor.move(0,o))}this.output.write(Y.erase.down());let a=e.split(`
|
|
19
|
+
`).slice(s);this.output.write(a.join(`
|
|
20
|
+
`)),this._prevFrame=e;return}}this.output.write(Y.erase.down())}this.output.write(e),this.state==="initial"&&(this.state="active"),this._prevFrame=e}}};class Qi extends Da{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(Y.cursor.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class en extends Da{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:i})=>i===e.initialValue),r=t===-1?0:t;this.cursor=this.options[r].disabled?Pr(r,1,this.options):r,this.changeValue(),this.on("cursor",(i)=>{switch(i){case"left":case"up":this.cursor=Pr(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Pr(this.cursor,1,this.options);break}this.changeValue()})}}import{styleText as A,stripVTControlCharacters as jb}from"node:util";import fe from"node:process";var Ht=zt(Gi(),1);function Hh(){return fe.platform!=="win32"?fe.env.TERM!=="linux":!!fe.env.CI||!!fe.env.WT_SESSION||!!fe.env.TERMINUS_SUBLIME||fe.env.ConEmuTask==="{cmd::Cmder}"||fe.env.TERM_PROGRAM==="Terminus-Sublime"||fe.env.TERM_PROGRAM==="vscode"||fe.env.TERM==="xterm-256color"||fe.env.TERM==="alacritty"||fe.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var tn=Hh(),Vh=()=>process.env.CI==="true";var P=(e,t)=>tn?e:t,Zh=P("◆","*"),Na=P("■","x"),Fa=P("▲","x"),nn=P("◇","o"),Gh=P("┌","T"),z=P("│","|"),Mr=P("└","—"),Hb=P("┐","T"),Vb=P("┘","—"),rn=P("●",">"),Fr=P("○"," "),Zb=P("◻","[•]"),Gb=P("◼","[+]"),Jb=P("◻","[ ]"),Kb=P("▪","•"),Pa=P("─","-"),Jh=P("╮","+"),Kh=P("├","+"),Yh=P("╯","+"),Xh=P("╰","+"),Yb=P("╭","+"),Xb=P("●","•"),Qb=P("◆","*"),ex=P("▲","!"),tx=P("■","x"),Ma=(e)=>{switch(e){case"initial":case"active":return A("cyan",Zh);case"cancel":return A("red",Na);case"error":return A("yellow",Fa);case"submit":return A("green",nn)}},Qh=(e)=>{switch(e){case"initial":case"active":return A("cyan",z);case"cancel":return A("red",z);case"error":return A("yellow",z);case"submit":return A("green",z)}},ed=(e,t,r,i,n)=>{let s=t,a=0;for(let o=r;o<i;o++){let c=e[o];if(s=s-c.length,a++,s<=n)break}return{lineCount:s,removals:a}},td=({cursor:e,options:t,style:r,output:i=process.stdout,maxItems:n=Number.POSITIVE_INFINITY,columnPadding:s=0,rowPadding:a=4})=>{let o=qt(i)-s,c=Xi(i),l=A("dim","..."),u=Math.max(c-a,0),h=Math.max(Math.min(n,u),5),f=0;e>=h-3&&(f=Math.max(Math.min(e-h+3,t.length-h),0));let d=h<t.length&&f>0,p=h<t.length&&f+h<t.length,m=Math.min(f+h,t.length),b=[],w=0;d&&w++,p&&w++;let v=f+(d?1:0),S=m-(p?1:0);for(let y=v;y<S;y++){let E=xe(r(t[y],y===e),o,{hard:!0,trim:!1}).split(`
|
|
21
|
+
`);b.push(E),w+=E.length}if(w>u){let y=0,E=0,k=w,x=e-v,I=(R,C)=>ed(b,k,R,C,u);d?({lineCount:k,removals:y}=I(0,x),k>u&&({lineCount:k,removals:E}=I(x+1,b.length))):({lineCount:k,removals:E}=I(x+1,b.length),k>u&&({lineCount:k,removals:y}=I(0,x))),y>0&&(d=!0,b.splice(0,y)),E>0&&(p=!0,b.splice(b.length-E,E))}let g=[];d&&g.push(l);for(let y of b)for(let E of y)g.push(E);return p&&g.push(l),g};var La=(e)=>{let t=e.active??"Yes",r=e.inactive??"No";return new Qi({active:t,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??te.withGuide,n=`${Ma(this.state)} `,s=i?`${A("gray",z)} `:"",a=Wt(e.output,e.message,s,n),o=`${i?`${A("gray",z)}
|
|
22
|
+
`:""}${a}
|
|
23
|
+
`,c=this.value?t:r;switch(this.state){case"submit":{let l=i?`${A("gray",z)} `:"";return`${o}${l}${A("dim",c)}`}case"cancel":{let l=i?`${A("gray",z)} `:"";return`${o}${l}${A(["strikethrough","dim"],c)}${i?`
|
|
24
|
+
${A("gray",z)}`:""}`}default:{let l=i?`${A("cyan",z)} `:"",u=i?A("cyan",Mr):"";return`${o}${l}${this.value?`${A("green",rn)} ${t}`:`${A("dim",Fr)} ${A("dim",t)}`}${e.vertical?i?`
|
|
25
|
+
${A("cyan",z)} `:`
|
|
26
|
+
`:` ${A("dim","/")} `}${this.value?`${A("dim",Fr)} ${A("dim",r)}`:`${A("green",rn)} ${r}`}
|
|
27
|
+
${u}
|
|
28
|
+
`}}}}).prompt()};var q=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??te.withGuide?`${A("gray",Mr)} `:"";r.write(`${i}${A("red",e)}
|
|
35
29
|
|
|
36
|
-
`)},
|
|
37
|
-
`)},
|
|
38
|
-
${
|
|
30
|
+
`)},Lr=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??te.withGuide?`${A("gray",Gh)} `:"";r.write(`${i}${e}
|
|
31
|
+
`)},Vt=(e="",t)=>{let r=t?.output??process.stdout,i=t?.withGuide??te.withGuide?`${A("gray",z)}
|
|
32
|
+
${A("gray",Mr)} `:"";r.write(`${i}${e}
|
|
39
33
|
|
|
40
|
-
`)};var
|
|
41
|
-
`),
|
|
42
|
-
`).map(
|
|
43
|
-
`),
|
|
44
|
-
`:"",
|
|
45
|
-
${
|
|
46
|
-
${
|
|
47
|
-
`)};var
|
|
48
|
-
`);let
|
|
49
|
-
`);
|
|
50
|
-
`);let
|
|
51
|
-
`):
|
|
52
|
-
`)),
|
|
53
|
-
`)
|
|
54
|
-
`).map((
|
|
55
|
-
`):
|
|
56
|
-
`:""}${
|
|
57
|
-
`;switch(this.state){case"submit":{let
|
|
58
|
-
${
|
|
59
|
-
`).length,
|
|
60
|
-
${
|
|
61
|
-
${
|
|
62
|
-
`}}}}).prompt()};var
|
|
34
|
+
`)};var rd=(e)=>A("dim",e),id=(e,t,r)=>{let i={hard:!0,trim:!1},n=xe(e,t,i).split(`
|
|
35
|
+
`),s=n.reduce((c,l)=>Math.max(ee(l),c),0),a=n.map(r).reduce((c,l)=>Math.max(ee(l),c),0),o=t-(a-s);return xe(e,o,i)},Zt=(e="",t="",r)=>{let i=r?.output??fe.stdout,n=r?.withGuide??te.withGuide,s=r?.format??rd,a=["",...id(e,qt(i)-6,s).split(`
|
|
36
|
+
`).map(s),""],o=ee(t),c=Math.max(a.reduce((f,d)=>{let p=ee(d);return p>f?p:f},0),o)+2,l=a.map((f)=>`${A("gray",z)} ${f}${" ".repeat(c-ee(f))}${A("gray",z)}`).join(`
|
|
37
|
+
`),u=n?`${A("gray",z)}
|
|
38
|
+
`:"",h=n?Kh:Xh;i.write(`${u}${A("green",nn)} ${A("reset",t)} ${A("gray",Pa.repeat(Math.max(c-o-1,1))+Jh)}
|
|
39
|
+
${l}
|
|
40
|
+
${A("gray",h+Pa.repeat(c+2)+Yh)}
|
|
41
|
+
`)};var nd=(e)=>A("magenta",e),Ye=({indicator:e="dots",onCancel:t,output:r=process.stdout,cancelMessage:i,errorMessage:n,frames:s=tn?["◒","◐","◓","◑"]:["•","o","O","0"],delay:a=tn?80:120,signal:o,...c}={})=>{let l=Vh(),u,h,f=!1,d=!1,p="",m,b=performance.now(),w=qt(r),v=c?.styleFrame??nd,S=(N)=>{let Q=N>1?n??te.messages.error:i??te.messages.cancel;d=N===1,f&&(ue(Q,N),d&&typeof t=="function"&&t())},g=()=>S(2),y=()=>S(1),E=()=>{process.on("uncaughtExceptionMonitor",g),process.on("unhandledRejection",g),process.on("SIGINT",y),process.on("SIGTERM",y),process.on("exit",S),o&&o.addEventListener("abort",y)},k=()=>{process.removeListener("uncaughtExceptionMonitor",g),process.removeListener("unhandledRejection",g),process.removeListener("SIGINT",y),process.removeListener("SIGTERM",y),process.removeListener("exit",S),o&&o.removeEventListener("abort",y)},x=()=>{if(m===void 0)return;l&&r.write(`
|
|
42
|
+
`);let N=xe(m,w,{hard:!0,trim:!1}).split(`
|
|
43
|
+
`);N.length>1&&r.write(Ht.cursor.up(N.length-1)),r.write(Ht.cursor.to(0)),r.write(Ht.erase.down())},I=(N)=>N.replace(/\.+$/,""),R=(N)=>{let Q=(performance.now()-N)/1000,ce=Math.floor(Q/60),ne=Math.floor(Q%60);return ce>0?`[${ce}m ${ne}s]`:`[${ne}s]`},C=c.withGuide??te.withGuide,G=(N="")=>{f=!0,u=Ba({output:r}),p=I(N),b=performance.now(),C&&r.write(`${A("gray",z)}
|
|
44
|
+
`);let Q=0,ce=0;E(),h=setInterval(()=>{if(l&&p===m)return;x(),m=p;let ne=v(s[Q]),Re;if(l)Re=`${ne} ${p}...`;else if(e==="timer")Re=`${ne} ${p} ${R(b)}`;else{let vh=".".repeat(Math.floor(ce)).slice(0,3);Re=`${ne} ${p}${vh}`}let mh=xe(Re,w,{hard:!0,trim:!1});r.write(mh),Q=Q+1<s.length?Q+1:0,ce=ce<4?ce+0.125:0},a)},ue=(N="",Q=0,ce=!1)=>{if(!f)return;f=!1,clearInterval(h),x();let ne=Q===0?A("green",nn):Q===1?A("red",Na):A("red",Fa);p=N??p,ce||(e==="timer"?r.write(`${ne} ${p} ${R(b)}
|
|
45
|
+
`):r.write(`${ne} ${p}
|
|
46
|
+
`)),k(),u()};return{start:G,stop:(N="")=>ue(N,0),message:(N="")=>{p=I(N??p)},cancel:(N="")=>ue(N,1),error:(N="")=>ue(N,2),clear:()=>ue("",0,!0),get isCancelled(){return d}}},rx={light:P("─","-"),heavy:P("━","="),block:P("█","#")};var Nr=(e,t)=>e.includes(`
|
|
47
|
+
`)?e.split(`
|
|
48
|
+
`).map((r)=>t(r)).join(`
|
|
49
|
+
`):t(e),sn=(e)=>{let t=(r,i)=>{let n=r.label??String(r.value);switch(i){case"disabled":return`${A("gray",Fr)} ${Nr(n,(s)=>A("gray",s))}${r.hint?` ${A("dim",`(${r.hint??"disabled"})`)}`:""}`;case"selected":return`${Nr(n,(s)=>A("dim",s))}`;case"active":return`${A("green",rn)} ${n}${r.hint?` ${A("dim",`(${r.hint})`)}`:""}`;case"cancelled":return`${Nr(n,(s)=>A(["strikethrough","dim"],s))}`;default:return`${A("dim",Fr)} ${Nr(n,(s)=>A("dim",s))}`}};return new en({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let r=e.withGuide??te.withGuide,i=`${Ma(this.state)} `,n=`${Qh(this.state)} `,s=Wt(e.output,e.message,n,i),a=`${r?`${A("gray",z)}
|
|
50
|
+
`:""}${s}
|
|
51
|
+
`;switch(this.state){case"submit":{let o=r?`${A("gray",z)} `:"",c=Wt(e.output,t(this.options[this.cursor],"selected"),o);return`${a}${c}`}case"cancel":{let o=r?`${A("gray",z)} `:"",c=Wt(e.output,t(this.options[this.cursor],"cancelled"),o);return`${a}${c}${r?`
|
|
52
|
+
${A("gray",z)}`:""}`}default:{let o=r?`${A("cyan",z)} `:"",c=r?A("cyan",Mr):"",l=a.split(`
|
|
53
|
+
`).length,u=r?2:1;return`${a}${o}${td({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:o.length,rowPadding:l+u,style:(h,f)=>t(h,h.disabled?"disabled":f?"active":"inactive")}).join(`
|
|
54
|
+
${o}`)}
|
|
55
|
+
${c}
|
|
56
|
+
`}}}}).prompt()};var ix=`${A("gray",z)} `;var ha=zt(Ws(),1),_=zt(Qc(),1);var ef={name:"petdex",version:"1.3.1",description:"CLI for Petdex. Install, browse, and submit Codex pets from your terminal.",keywords:["petdex","codex","openai-codex","pets","pet","mascot","cli","terminal","animated","pixel-art","developer-tools","fun"],homepage:"https://petdex.dev",repository:{type:"git",url:"git+https://github.com/crafter-station/petdex.git",directory:"packages/petdex-cli"},license:"MIT",type:"module",engines:{node:">=20"},bin:{petdex:"dist/petdex.js"},files:["dist","README.md","AGENTS.md","CLAUDE.md"],scripts:{build:"bun build ./bin/petdex.ts --target=node --outfile=./dist/petdex.js --minify --external @napi-rs/keyring",postbuild:`node -e 'const f="./dist/petdex.js";const fs=require("fs");const c=fs.readFileSync(f,"utf8");if(!c.startsWith("#!")){fs.writeFileSync(f,"#!/usr/bin/env node\\n"+c)}fs.chmodSync(f,0o755)'`,typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",jszip:"^3.10.1",picocolors:"^1.1.1"},optionalDependencies:{"@napi-rs/keyring":"^1.1.6"},devDependencies:{"@types/node":"^26.0.0","bun-types":"^1.3.13",typescript:"^7.0.2"}};var rw=new Set(["assets.petdex.dev"]);function Cr(e){try{let t=new URL(e);if(t.protocol!=="https:")return!1;return rw.has(t.hostname)}catch{return!1}}var Vs=["profile","email","openid","offline_access"];async function tf({petdexUrl:e,env:t=process.env,fetchImpl:r=fetch,warnOnFallback:i=!0}){let{CLERK_ISSUER:n,CLERK_OAUTH_CLIENT_ID:s}=t;if(n&&s)return{issuer:n,clientId:s,scopes:Vs};try{let a=await r(`${e}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(a.ok){let o=await a.json(),c=typeof o.issuer==="string"?o.issuer:null,l=typeof o.clientId==="string"?o.clientId:null,u=Array.isArray(o.scopes)?o.scopes.filter((h)=>typeof h==="string"):null;if(c&&l)return{issuer:n??c,clientId:s??l,scopes:u&&u.length>0?u:Vs}}}catch{}if(i)console.error("petdex: unable to refresh auth configuration; using fallback authentication values.");return{issuer:n??"https://clerk.petdex.dev",clientId:s??"LcThwEayl6KAA1Qm",scopes:Vs}}import{spawn as mw}from"node:child_process";import{createServer as iw}from"node:http";class F extends Error{code;constructor(e,t){super(t);this.name="ClerkCliAuthError",this.code=e}}var nw=`<!doctype html>
|
|
63
57
|
<html>
|
|
64
58
|
<head><meta charset="utf-8"><title>Authentication complete</title></head>
|
|
65
59
|
<body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
|
|
66
|
-
</html>`,
|
|
60
|
+
</html>`,sw=`<!doctype html>
|
|
67
61
|
<html>
|
|
68
62
|
<head><meta charset="utf-8"><title>Authentication failed</title></head>
|
|
69
63
|
<body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
|
|
70
|
-
</html>`;function
|
|
71
|
-
`,{mode:384}),await
|
|
72
|
-
${$}`);let Q=process.platform,J=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let G=hW(J,q,{detached:!0,stdio:"ignore"});G.once("error",()=>Y()),G.unref(),Y()})}class x6{config;constructor($){if(!$.clientId)throw new h("config","clientId is required");if(!$.issuer)throw new h("config","issuer is required");let Q=$.environment??"default",J=typeof $.storage==="object"&&$.storage!==null?$.storage:j3($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:bW($.issuer),scopes:$.scopes??fW,storage:J,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=H3(),Q=await P3($),J=Z3(),q=await Y3({expectedState:J,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",J),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??_W)(Y.toString())}catch(W){throw new h("config",`Failed to open authorization URL: ${W.message}`)}let{code:G}=await q.waitForCallback(),V=await N3({issuer:this.config.issuer,clientId:this.config.clientId,code:G,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",V);let X=await a2({issuer:this.config.issuer,accessToken:V.accessToken});return await this.setJson("user",X),{tokens:V,user:X}}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 J=await w3({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...J,refreshToken:J.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 J=await a2({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",J),J}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw g6("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(J){throw g6(`read ${$}`,J)}if(!Q)return null;try{return JSON.parse(Q)}catch(J){throw g6(`parse stored ${$}`,J)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(J){throw g6(`write ${$}`,J)}}}var D3=_1(d2(),1);import{readFile as mW,stat as cW}from"node:fs/promises";import{inflateSync as pW}from"node:zlib";var O3=8388608,C8=Buffer.from([137,80,78,71,13,10,26,10]),uW=[[0,0,8,8],[4,0,8,8],[0,4,4,8],[2,0,4,4],[0,2,2,4],[1,0,2,2],[0,1,1,2]],S6=new Uint32Array(256);for(let $=0;$<S6.length;$+=1){let Q=$;for(let J=0;J<8;J+=1)Q=Q&1?3988292384^Q>>>1:Q>>>1;S6[$]=Q>>>0}function dW($){return $.length>=C8.length&&$.subarray(0,C8.length).equals(C8)}function lW($){if($.length<16||$.subarray(0,4).toString("ascii")!=="RIFF"||$.subarray(8,12).toString("ascii")!=="WEBP")return!1;let Q=$.readUInt32LE(4);return Q>=4&&Q+8<=$.length}function oW($,Q){let J=4294967295;for(let q of $)J=S6[(J^q)&255]^J>>>8;for(let q of Q)J=S6[(J^q)&255]^J>>>8;return(J^4294967295)>>>0}function B3($){switch($){case 0:return 1;case 2:return 3;case 3:return 1;case 4:return 2;case 6:return 4;default:return null}}function iW($,Q){return{0:[1,2,4,8,16],2:[8,16],3:[1,2,4,8],4:[8,16],6:[8,16]}[$]?.includes(Q)??!1}function nW($,Q,J,q){if(q===0){let G=Math.ceil($*J/8);return Array.from({length:Q},()=>G)}let Y=[];for(let[G,V,X,W]of uW){let K=$>G?Math.ceil(($-G)/X):0,U=Q>V?Math.ceil((Q-V)/W):0;if(K===0||U===0)continue;let F=Math.ceil(K*J/8);for(let j=0;j<U;j+=1)Y.push(F)}return Y}function rW($){if(!dW($))return null;let Q=C8.length,J=null,q=[],Y=!1;while(Q<$.length){if(Q+12>$.length)return null;let U=$.readUInt32BE(Q),F=Q+12+U;if(F>$.length)return null;let j=$.subarray(Q+4,Q+8),H=$.subarray(Q+8,Q+8+U),Z=$.readUInt32BE(Q+8+U);if(oW(j,H)!==Z)return null;let z=j.toString("ascii");if(z==="IHDR"){if(Q!==C8.length||U!==13)return null;if(J={width:H.readUInt32BE(0),height:H.readUInt32BE(4),bitDepth:H[8],colorType:H[9],interlace:H[12]},H[10]!==0||H[11]!==0)return null}else if(!J)return null;else if(z==="IDAT")q.push(H);else if(z==="IEND"){if(U!==0)return null;Y=!0,Q=F;break}Q=F}if(!Y||Q!==$.length||!J||q.length===0)return null;if(J.width===0||J.height===0||!B3(J.colorType)||!iW(J.colorType,J.bitDepth)||J.interlace!==0&&J.interlace!==1)return null;let G=B3(J.colorType);if(G===null)return null;let V=nW(J.width,J.height,G*J.bitDepth,J.interlace),X=V.reduce((U,F)=>U+F+1,0);if(X>134217728)return null;let W;try{W=pW(Buffer.concat(q))}catch{return null}if(W.length!==X)return null;let K=0;for(let U of V){if(W[K]>4)return null;K+=U+1}return{width:J.width,height:J.height}}function aW($){if(!lW($))return null;let Q=8+$.readUInt32LE(4);if(Q!==$.length)return null;let J=[],q=12;while(q<Q){if(q+8>Q)return null;let Y=$.readUInt32LE(q+4),G=q+8+Y,V=G+(Y&1);if(V>Q)return null;J.push({type:$.subarray(q,q+4).toString("ascii"),data:$.subarray(q+8,G)}),q=V}return q===Q?J:null}function s2($){if($.length<10||$[3]!==157||$[4]!==1||$[5]!==42)return null;let Q=$.readUInt16LE(6)&16383,J=$.readUInt16LE(8)&16383;return Q>0&&J>0?{width:Q,height:J}:null}function t2($){if($.length<5||$[0]!==47)return null;let Q=1+(($[1]|($[2]&63)<<8)>>>0),J=1+(($[2]>>6|$[3]<<2|($[4]&15)<<10)>>>0);return Q>0&&J>0?{width:Q,height:J}:null}function sW($){let Q=16;while(Q<$.length){if(Q+8>$.length)return!1;let J=$.subarray(Q,Q+4).toString("ascii"),q=$.readUInt32LE(Q+4),Y=Q+8+q,G=Y+(q&1);if(G>$.length)return!1;let V=$.subarray(Q+8,Y);if(J==="VP8 "&&s2(V))return!0;if(J==="VP8L"&&t2(V))return!0;Q=G}return!1}function tW($){let Q=aW($);if(!Q)return null;let J=Q.find((X)=>X.type==="VP8X"),q=Q.find((X)=>X.type==="VP8 "),Y=Q.find((X)=>X.type==="VP8L");if(!J)return q?s2(q.data):Y?t2(Y.data):null;if(J.data.length!==10)return null;let G={width:1+((J.data[4]|J.data[5]<<8|J.data[6]<<16)>>>0),height:1+((J.data[7]|J.data[8]<<8|J.data[9]<<16)>>>0)};if(G.width<=0||G.height<=0)return null;if(q&&s2(q.data))return G;if(Y&&t2(Y.data))return G;let V=Q.find((X)=>X.type==="ANMF");return V&&sW(V.data)?G:null}function v3($){let Q=rW($);if(Q)return{...Q,format:"png"};let J=tW($);if(J)return{...J,format:"webp"};return null}function C3($){let Q=v3($);return Q?{width:Q.width,height:Q.height}:{width:0,height:0}}function eW($){let Q=v3($);if(!Q)throw Error("sprite must be a valid PNG or WebP file");return{buffer:$,format:Q.format,contentType:Q.format==="png"?"image/png":"image/webp",width:Q.width,height:Q.height}}function $j($){let Q;try{Q=JSON.parse($.toString("utf8"))}catch{throw Error("metadata is not valid JSON")}if(Q===null||typeof Q!=="object"||Array.isArray(Q))throw Error("metadata must be a JSON object");return Q}async function Qj($){try{await D3.default.loadAsync($,{checkCRC32:!0})}catch{throw Error("zip is not a valid archive")}}async function e2($){let Q=await cW($);if(!Q.isFile())throw Error(`not a file: ${$}`);if(Q.size<=0||Q.size>O3)throw Error(`asset is ${(Q.size/1048576).toFixed(1)} MB; maximum is 8 MB`);let J=await mW($);if(J.length<=0||J.length>O3)throw Error("asset changed while it was being read");return J}async function A3($){return eW(await e2($))}async function R3($){let Q=await e2($);return $j(Q),Q}async function k3($){let Q=await e2($);return await Qj(Q),Q}import{spawn as Jj}from"node:child_process";import{randomUUID as E3}from"node:crypto";import{existsSync as qj,mkdirSync as Yj,readFileSync as Gj,writeFileSync as Vj}from"node:fs";import{homedir as Xj}from"node:os";import g3 from"node:path";function T6(){let $=process.env.HOME??Xj();return g3.join($,".petdex","telemetry.json")}var Kj=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",Uj=2000;function y6(){if(!qj(T6()))return{kind:"missing"};let $;try{$=Gj(T6(),"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 $4($){try{return Yj(g3.dirname(T6()),{recursive:!0}),Vj(T6(),`${JSON.stringify($,null,2)}
|
|
73
|
-
`),!0}catch{return!1}}function
|
|
74
|
-
`))
|
|
64
|
+
</html>`;function Zs(e,t){return new F(e,t)}function rf(e){let{expectedState:t,port:r=0,timeoutMs:i=120000,successHtml:n=nw,errorHtml:s=sw}=e,a,o=!1,c=!1,l,u,h=new Promise((p,m)=>{l=p,u=m}),f=(p)=>{if(c)return;c=!0,p.close()},d=iw((p,m)=>{if(o){m.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),m.end("Authentication callback already handled.");return}if(p.method!=="GET"||!p.url){m.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),m.end("Not found");return}let b=new URL(p.url,"http://127.0.0.1");if(b.pathname!=="/callback"){m.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),m.end("Clerk CLI auth server is waiting for /callback.");return}let w=b.searchParams.get("code"),v=b.searchParams.get("state"),S=b.searchParams.get("error"),g=b.searchParams.get("error_description")??S,y=(E,k,x)=>{if(o=!0,a)clearTimeout(a);m.writeHead(E,{"Content-Type":"text/html; charset=utf-8"}),m.end(k,()=>{if(x)u(x);else if(w&&v)l({code:w,state:v});f(d)})};if(S){y(400,s,Zs("token_exchange",`OAuth authorization failed: ${g??"unknown error"}`));return}if(v!==t){y(400,s,Zs("state_mismatch","OAuth callback state did not match."));return}if(!w){y(400,s,Zs("token_exchange","OAuth callback did not include an authorization code."));return}y(200,n)});return new Promise((p,m)=>{d.once("error",(b)=>{m(new F("config",`Failed to start local auth callback server: ${b.message}`))}),d.listen(r,"127.0.0.1",()=>{let w=d.address().port,v=`http://127.0.0.1:${w}/callback`;a=setTimeout(()=>{if(o)return;o=!0,u(new F("timeout",`OAuth callback timed out after ${i}ms.`)),f(d)},i),p({port:w,redirectUri:v,waitForCallback:()=>h,close:()=>{if(a)clearTimeout(a);if(!o)o=!0,u(new F("timeout","OAuth callback server was closed."));f(d)}})})})}import{chmod as aw,mkdir as ow,readFile as lw,writeFile as uw}from"node:fs/promises";import{homedir as cw}from"node:os";import{dirname as fw,join as hw}from"node:path";function nf(e,t){if(t instanceof F)return t;let r=t instanceof Error?t.message:String(t);return new F("storage",`${e}: ${r}`)}function af(e){return e?.environment??"default"}function dw(e){return hw(cw(),".config","clerk-cli-auth",`${e}.json`)}class of{values=new Map;async get(e){return this.values.get(e)??null}async set(e,t){this.values.set(e,t)}async delete(e){this.values.delete(e)}}class lf{filePath;queue=Promise.resolve();constructor(e){this.filePath=e}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.catch(()=>{return}),t}async readAll(){try{let e=await lw(this.filePath,"utf8");if(!e.trim())return{};let t=JSON.parse(e);if(!t||typeof t!=="object"||Array.isArray(t))return{};let r={};for(let[i,n]of Object.entries(t))if(typeof n==="string")r[i]=n;return r}catch(e){if(e.code==="ENOENT")return{};throw nf(`Failed to read credential file ${this.filePath}`,e)}}async writeAll(e){try{await ow(fw(this.filePath),{recursive:!0}),await uw(this.filePath,`${JSON.stringify(e,null,2)}
|
|
65
|
+
`,{mode:384}),await aw(this.filePath,384)}catch(t){throw nf(`Failed to write credential file ${this.filePath}`,t)}}async get(e){return this.enqueue(async()=>(await this.readAll())[e]??null)}async set(e,t){return this.enqueue(async()=>{let r=await this.readAll();r[e]=t,await this.writeAll(r)})}async delete(e){return this.enqueue(async()=>{let t=await this.readAll();delete t[e],await this.writeAll(t)})}}class uf{service;environment;fallback;keyringPromise=null;constructor(e,t,r){this.service=e;this.environment=t;this.fallback=r}account(e){return`${this.environment}:${e}`}warnFallback(e,t){let r=t instanceof Error?t.message:String(t);if(e==="initialization"&&r.includes("Cannot find package"))return;console.warn(`Keychain ${e} failed; falling back to file store. ${r}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch((e)=>(this.warnFallback("initialization",e),null)),this.keyringPromise}async get(e){try{let t=await this.loadKeyring();if(!t)return this.fallback.get(e);return new t.Entry(this.service,this.account(e)).getPassword()??await this.fallback.get(e)}catch(t){return this.warnFallback("get",t),this.fallback.get(e)}}async set(e,t){try{let r=await this.loadKeyring();if(!r){await this.fallback.set(e,t);return}new r.Entry(this.service,this.account(e)).setPassword(t)}catch(r){this.warnFallback("set",r),await this.fallback.set(e,t)}}async delete(e){try{let t=await this.loadKeyring();if(t)new t.Entry(this.service,this.account(e)).deletePassword()}catch(t){this.warnFallback("delete",t)}await this.fallback.delete(e)}}function sf(e){let t=af(e);return new lf(e?.filePath??dw(t))}function cf(e,t){if(e==="memory")return new of;if(e==="file")return sf(t);let r=sf(t),i=t?.keychainService??"clerk-cli-auth",n=af(t);return new uf(i,n,r)}import{createHash as pw,randomBytes as ff}from"node:crypto";function Gs(e){return e.toString("base64url")}function hf(){return Gs(ff(32))}async function df(e){return Gs(pw("sha256").update(e).digest())}function pf(){return Gs(ff(32))}function gf(e,t){return`${e.replace(/\/+$/,"")}${t}`}async function mf(e){if((e.headers.get("content-type")??"").includes("application/json"))return e.json();return e.text()}function vf(e,t){if(typeof e==="string"&&e.trim())return e.trim();if(e&&typeof e==="object"){let r=e;for(let i of["error_description","message","error"]){let n=r[i];if(typeof n==="string"&&n.trim())return n.trim()}}return t}function gw(e){if(typeof e.access_token!=="string"||e.access_token.length===0)throw new F("token_exchange","Token response did not include access_token.");let t={accessToken:e.access_token};if(typeof e.refresh_token==="string")t.refreshToken=e.refresh_token;if(typeof e.id_token==="string")t.idToken=e.id_token;if(typeof e.scope==="string")t.scope=e.scope;if(typeof e.token_type==="string")t.tokenType=e.token_type;if(typeof e.expires_in==="number")t.expiresAt=Date.now()+e.expires_in*1000;return t}async function yf(e,t){let r;try{r=await fetch(gf(e,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t.toString()})}catch(n){throw new F("token_exchange",`Token request failed: ${n.message}`)}let i;try{i=await mf(r)}catch(n){throw new F("token_exchange",`Token response could not be parsed: ${n.message}`)}if(!r.ok)throw new F("token_exchange",vf(i,`Token request failed with HTTP ${r.status}.`));if(!i||typeof i!=="object")throw new F("token_exchange","Token response was not JSON.");return gw(i)}async function wf(e){let t=new URLSearchParams({grant_type:"authorization_code",client_id:e.clientId,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri});return yf(e.issuer,t)}async function _f(e){let t=new URLSearchParams({grant_type:"refresh_token",client_id:e.clientId,refresh_token:e.refreshToken});if(e.scopes?.length)t.set("scope",e.scopes.join(" "));return yf(e.issuer,t)}async function Js(e){let t;try{t=await fetch(gf(e.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${e.accessToken}`}})}catch(n){throw new F("userinfo",`Userinfo request failed: ${n.message}`)}let r;try{r=await mf(t)}catch(n){throw new F("userinfo",`Userinfo response could not be parsed: ${n.message}`)}if(!t.ok)throw new F("userinfo",vf(r,`Userinfo request failed with HTTP ${t.status}.`));if(!r||typeof r!=="object")throw new F("userinfo","Userinfo response was not JSON.");let i=r;if(typeof i.sub!=="string"||i.sub.length===0)throw new F("userinfo","Userinfo response did not include sub.");return i}var vw=["profile","email","openid","offline_access"];function yw(e){let t=e.trim().replace(/\/+$/,"");try{let r=new URL(t);if(r.protocol!=="http:"&&r.protocol!=="https:")throw Error("issuer must use http or https");return t}catch(r){throw new F("config",`issuer must be a valid URL: ${r.message}`)}}function Bi(e,t){if(t instanceof F)return t;let r=t instanceof Error?t.message:String(t);return new F("storage",`Failed to ${e}: ${r}`)}async function ww(e){console.log(`Open this URL to sign in:
|
|
66
|
+
${e}`);let t=process.platform,r=t==="darwin"?"open":t==="win32"?"cmd":"xdg-open",i=t==="win32"?["/c","start","",e]:[e];await new Promise((n)=>{let s=mw(r,i,{detached:!0,stdio:"ignore"});s.once("error",()=>n()),s.unref(),n()})}class Di{config;constructor(e){if(!e.clientId)throw new F("config","clientId is required");if(!e.issuer)throw new F("config","issuer is required");let t=e.environment??"default",r=typeof e.storage==="object"&&e.storage!==null?e.storage:cf(e.storage??"keychain",{environment:t,keychainService:e.keychainService});this.config={clientId:e.clientId,issuer:yw(e.issuer),scopes:e.scopes??vw,storage:r,keychainService:e.keychainService??"clerk-cli-auth",environment:t,callbackPort:e.callbackPort??0,timeoutMs:e.timeoutMs??120000,openBrowser:e.openBrowser}}async login(){let e=hf(),t=await df(e),r=pf(),i=await rf({expectedState:r,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let n=new URL(`${this.config.issuer}/oauth/authorize`);n.searchParams.set("response_type","code"),n.searchParams.set("client_id",this.config.clientId),n.searchParams.set("redirect_uri",i.redirectUri),n.searchParams.set("scope",this.config.scopes.join(" ")),n.searchParams.set("state",r),n.searchParams.set("code_challenge",t),n.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??ww)(n.toString())}catch(c){throw new F("config",`Failed to open authorization URL: ${c.message}`)}let{code:s}=await i.waitForCallback(),a=await wf({issuer:this.config.issuer,clientId:this.config.clientId,code:s,codeVerifier:e,redirectUri:i.redirectUri});await this.setJson("tokens",a);let o=await Js({issuer:this.config.issuer,accessToken:a.accessToken});return await this.setJson("user",o),{tokens:a,user:o}}finally{i.close()}}async getAccessToken(){let e=await this.getTokenSet();if(!e)return null;if((e.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return e.accessToken;if(!e.refreshToken)return null;let r=await _f({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:e.refreshToken,scopes:this.config.scopes}),i={...e,...r,refreshToken:r.refreshToken??e.refreshToken};return await this.setJson("tokens",i),i.accessToken}async whoami(){let e=await this.getJson("user");if(e)return e;let t=await this.getAccessToken();if(!t)return null;let r=await Js({issuer:this.config.issuer,accessToken:t});return await this.setJson("user",r),r}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch(e){throw Bi("clear stored credentials",e)}}async getTokenSet(){return this.getJson("tokens")}async getJson(e){let t;try{t=await this.config.storage.get(e)}catch(r){throw Bi(`read ${e}`,r)}if(!t)return null;try{return JSON.parse(t)}catch(r){throw Bi(`parse stored ${e}`,r)}}async setJson(e,t){try{await this.config.storage.set(e,JSON.stringify(t))}catch(r){throw Bi(`write ${e}`,r)}}}var Sf=zt(Ws(),1);import{readFile as _w,stat as bw}from"node:fs/promises";import{inflateSync as xw}from"node:zlib";var bf=8388608,Ir=Buffer.from([137,80,78,71,13,10,26,10]),Sw=[[0,0,8,8],[4,0,8,8],[0,4,4,8],[2,0,4,4],[0,2,2,4],[1,0,2,2],[0,1,1,2]],Pi=new Uint32Array(256);for(let e=0;e<Pi.length;e+=1){let t=e;for(let r=0;r<8;r+=1)t=t&1?3988292384^t>>>1:t>>>1;Pi[e]=t>>>0}function kw(e){return e.length>=Ir.length&&e.subarray(0,Ir.length).equals(Ir)}function Ew(e){if(e.length<16||e.subarray(0,4).toString("ascii")!=="RIFF"||e.subarray(8,12).toString("ascii")!=="WEBP")return!1;let t=e.readUInt32LE(4);return t>=4&&t+8<=e.length}function $w(e,t){let r=4294967295;for(let i of e)r=Pi[(r^i)&255]^r>>>8;for(let i of t)r=Pi[(r^i)&255]^r>>>8;return(r^4294967295)>>>0}function xf(e){switch(e){case 0:return 1;case 2:return 3;case 3:return 1;case 4:return 2;case 6:return 4;default:return null}}function Tw(e,t){return{0:[1,2,4,8,16],2:[8,16],3:[1,2,4,8],4:[8,16],6:[8,16]}[e]?.includes(t)??!1}function Cw(e,t,r,i){if(i===0){let s=Math.ceil(e*r/8);return Array.from({length:t},()=>s)}let n=[];for(let[s,a,o,c]of Sw){let l=e>s?Math.ceil((e-s)/o):0,u=t>a?Math.ceil((t-a)/c):0;if(l===0||u===0)continue;let h=Math.ceil(l*r/8);for(let f=0;f<u;f+=1)n.push(h)}return n}function Iw(e){if(!kw(e))return null;let t=Ir.length,r=null,i=[],n=!1;while(t<e.length){if(t+12>e.length)return null;let u=e.readUInt32BE(t),h=t+12+u;if(h>e.length)return null;let f=e.subarray(t+4,t+8),d=e.subarray(t+8,t+8+u),p=e.readUInt32BE(t+8+u);if($w(f,d)!==p)return null;let m=f.toString("ascii");if(m==="IHDR"){if(t!==Ir.length||u!==13)return null;if(r={width:d.readUInt32BE(0),height:d.readUInt32BE(4),bitDepth:d[8],colorType:d[9],interlace:d[12]},d[10]!==0||d[11]!==0)return null}else if(!r)return null;else if(m==="IDAT")i.push(d);else if(m==="IEND"){if(u!==0)return null;n=!0,t=h;break}t=h}if(!n||t!==e.length||!r||i.length===0)return null;if(r.width===0||r.height===0||!xf(r.colorType)||!Tw(r.colorType,r.bitDepth)||r.interlace!==0&&r.interlace!==1)return null;let s=xf(r.colorType);if(s===null)return null;let a=Cw(r.width,r.height,s*r.bitDepth,r.interlace),o=a.reduce((u,h)=>u+h+1,0);if(o>134217728)return null;let c;try{c=xw(Buffer.concat(i))}catch{return null}if(c.length!==o)return null;let l=0;for(let u of a){if(c[l]>4)return null;l+=u+1}return{width:r.width,height:r.height}}function Aw(e){if(!Ew(e))return null;let t=8+e.readUInt32LE(4);if(t!==e.length)return null;let r=[],i=12;while(i<t){if(i+8>t)return null;let n=e.readUInt32LE(i+4),s=i+8+n,a=s+(n&1);if(a>t)return null;r.push({type:e.subarray(i,i+4).toString("ascii"),data:e.subarray(i+8,s)}),i=a}return i===t?r:null}function Ks(e){if(e.length<10||e[3]!==157||e[4]!==1||e[5]!==42)return null;let t=e.readUInt16LE(6)&16383,r=e.readUInt16LE(8)&16383;return t>0&&r>0?{width:t,height:r}:null}function Ys(e){if(e.length<5||e[0]!==47)return null;let t=1+((e[1]|(e[2]&63)<<8)>>>0),r=1+((e[2]>>6|e[3]<<2|(e[4]&15)<<10)>>>0);return t>0&&r>0?{width:t,height:r}:null}function Rw(e){let t=16;while(t<e.length){if(t+8>e.length)return!1;let r=e.subarray(t,t+4).toString("ascii"),i=e.readUInt32LE(t+4),n=t+8+i,s=n+(i&1);if(s>e.length)return!1;let a=e.subarray(t+8,n);if(r==="VP8 "&&Ks(a))return!0;if(r==="VP8L"&&Ys(a))return!0;t=s}return!1}function Ow(e){let t=Aw(e);if(!t)return null;let r=t.find((o)=>o.type==="VP8X"),i=t.find((o)=>o.type==="VP8 "),n=t.find((o)=>o.type==="VP8L");if(!r)return i?Ks(i.data):n?Ys(n.data):null;if(r.data.length!==10)return null;let s={width:1+((r.data[4]|r.data[5]<<8|r.data[6]<<16)>>>0),height:1+((r.data[7]|r.data[8]<<8|r.data[9]<<16)>>>0)};if(s.width<=0||s.height<=0)return null;if(i&&Ks(i.data))return s;if(n&&Ys(n.data))return s;let a=t.find((o)=>o.type==="ANMF");return a&&Rw(a.data)?s:null}function kf(e){let t=Iw(e);if(t)return{...t,format:"png"};let r=Ow(e);if(r)return{...r,format:"webp"};return null}function Ef(e){let t=kf(e);return t?{width:t.width,height:t.height}:{width:0,height:0}}function Bw(e){let t=kf(e);if(!t)throw Error("sprite must be a valid PNG or WebP file");return{buffer:e,format:t.format,contentType:t.format==="png"?"image/png":"image/webp",width:t.width,height:t.height}}function Dw(e){let t;try{t=JSON.parse(e.toString("utf8"))}catch{throw Error("metadata is not valid JSON")}if(t===null||typeof t!=="object"||Array.isArray(t))throw Error("metadata must be a JSON object");return t}async function Pw(e){try{await Sf.default.loadAsync(e,{checkCRC32:!0})}catch{throw Error("zip is not a valid archive")}}async function Xs(e){let t=await bw(e);if(!t.isFile())throw Error(`not a file: ${e}`);if(t.size<=0||t.size>bf)throw Error(`asset is ${(t.size/1048576).toFixed(1)} MB; maximum is 8 MB`);let r=await _w(e);if(r.length<=0||r.length>bf)throw Error("asset changed while it was being read");return r}async function $f(e){return Bw(await Xs(e))}async function Tf(e){let t=await Xs(e);return Dw(t),t}async function Cf(e){let t=await Xs(e);return await Pw(t),t}var Nw=15000,Qs=["slug","displayName","kind","submittedBy","spritesheet","petJson","zip","spriteVersionNumber"];function ea(e){return typeof e==="object"&&e!==null}function Ni(e){return e===null||typeof e==="string"}function Af(e){return e===1||e===2}function ht(e,t){let r;try{r=t?new URL(e,`${t.replace(/\/+$/,"")}/`):new URL(e)}catch{throw Error("manifest contains an invalid asset URL")}let i=r.toString();if(!Cr(i))throw Error("manifest contains an untrusted asset host");return i}function Fw(e){if(typeof e!=="string")throw Error("compact manifest is missing assetBase");return ht(e)}function Rf(e,t){if(e.total!==void 0&&e.total!==t)throw Error("manifest total does not match its entries")}function Mw(e){if(!ea(e)||e.v!==2||!Array.isArray(e.pets))throw Error("invalid compact manifest");let t=Fw(e.assetBase);if(!Array.isArray(e.fields)||e.fields.length!==Qs.length||e.fields.some((r,i)=>r!==Qs[i]))throw Error("invalid compact manifest fields");return Rf(e,e.pets.length),e.pets.map((r,i)=>{if(!Array.isArray(r)||r.length!==Qs.length||typeof r[0]!=="string"||typeof r[1]!=="string"||typeof r[2]!=="string"||!Ni(r[3])||typeof r[4]!=="string"||typeof r[5]!=="string"||!Ni(r[6])||!Af(r[7]))throw Error(`invalid compact manifest pet at index ${i}`);return{slug:r[0],displayName:r[1],kind:r[2],submittedBy:r[3],spritesheetUrl:ht(r[4],t),petJsonUrl:ht(r[5],t),zipUrl:r[6]?ht(r[6],t):null,spriteVersionNumber:r[7]}})}function Lw(e){if(!ea(e)||!Array.isArray(e.pets))throw Error("invalid legacy manifest");return Rf(e,e.pets.length),e.pets.map((t,r)=>{if(!ea(t)||typeof t.slug!=="string"||typeof t.displayName!=="string"||typeof t.kind!=="string"||!Ni(t.submittedBy)||typeof t.spritesheetUrl!=="string"||typeof t.petJsonUrl!=="string"||!Ni(t.zipUrl)||t.spriteVersionNumber!==void 0&&!Af(t.spriteVersionNumber))throw Error(`invalid legacy manifest pet at index ${r}`);return{slug:t.slug,displayName:t.displayName,kind:t.kind,submittedBy:t.submittedBy,spritesheetUrl:ht(t.spritesheetUrl),petJsonUrl:ht(t.petJsonUrl),zipUrl:t.zipUrl?ht(t.zipUrl):null,spriteVersionNumber:t.spriteVersionNumber??1}})}async function If(e,t){let r=await e(t,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(Nw)});if(!r.ok)throw Error(`manifest fetch ${r.status}`);try{return await r.json()}catch{throw Error("manifest response was not valid JSON")}}async function ta(e,t=fetch){let r=e.replace(/\/+$/,""),i;try{return Mw(await If(t,`${r}/api/manifest/v2`))}catch(n){i=n}try{return Lw(await If(t,`${r}/api/manifest`))}catch(n){let s=i instanceof Error?i.message:"unknown error",a=n instanceof Error?n.message:"unknown error";throw Error(`manifest unavailable (v2: ${s}; legacy: ${a})`)}}import{spawn as Uw}from"node:child_process";import{randomUUID as Of}from"node:crypto";import{existsSync as jw,mkdirSync as zw,readFileSync as qw,writeFileSync as Ww}from"node:fs";import{homedir as Hw}from"node:os";import Bf from"node:path";function Fi(){let e=process.env.HOME??Hw();return Bf.join(e,".petdex","telemetry.json")}var Vw=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",Zw=2000;function Mi(){if(!jw(Fi()))return{kind:"missing"};let e;try{e=qw(Fi(),"utf8")}catch(t){return{kind:"error",reason:`read failed: ${t.message}`}}try{return{kind:"ok",config:JSON.parse(e)}}catch(t){return{kind:"error",reason:`parse failed: ${t.message}`}}}function ra(e){try{return zw(Bf.dirname(Fi()),{recursive:!0}),Ww(Fi(),`${JSON.stringify(e,null,2)}
|
|
67
|
+
`),!0}catch{return!1}}function Df(){if(process.env.PETDEX_TELEMETRY==="0")return null;let e=Mi();if(e.kind==="ok")return e.config;if(e.kind==="error")return null;let t={install_id:Of(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return ra(t)?t:null}function Pf(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let e=Mi();if(e.kind==="missing")return!0;if(e.kind==="error")return!1;return e.config.enabled}function Nf(e){let t=Mi(),r;if(t.kind==="ok")r=t.config,r.enabled=e;else r={install_id:Of(),enabled:e,notice_seen:!0,first_seen:new Date().toISOString()};return ra(r)}function Ff(){let e=Mi();return{enabled:Pf(),install_id:e.kind==="ok"?e.config.install_id:null}}function Mf(){if(process.env.PETDEX_TELEMETRY==="0")return;let e=Df();if(!e)return;if(e.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.dev/legal/telemetry",""].join(`
|
|
68
|
+
`)),e.notice_seen=!0,ra(e)}function Lf(e,t={}){if(!Pf())return;let r=Df();if(!r)return;let i=JSON.stringify({install_id:r.install_id,event:e,...t});try{let n=`
|
|
75
69
|
const controller = new AbortController();
|
|
76
|
-
const t = setTimeout(() => controller.abort(), ${
|
|
77
|
-
fetch(${JSON.stringify(
|
|
70
|
+
const t = setTimeout(() => controller.abort(), ${Zw});
|
|
71
|
+
fetch(${JSON.stringify(Vw)}, {
|
|
78
72
|
method: "POST",
|
|
79
73
|
headers: { "content-type": "application/json" },
|
|
80
|
-
body: ${JSON.stringify(
|
|
74
|
+
body: ${JSON.stringify(i)},
|
|
81
75
|
signal: controller.signal,
|
|
82
76
|
}).catch(() => {}).finally(() => clearTimeout(t));
|
|
83
|
-
`;
|
|
84
|
-
`))}function
|
|
85
|
-
`))}async function
|
|
86
|
-
`),"Signed in")}catch{
|
|
87
|
-
`),"Next steps");if(
|
|
77
|
+
`;Uw(process.execPath,["-e",n],{detached:!0,stdio:"ignore"}).unref()}catch{}}var Z=process.env.PETDEX_URL??"https://petdex.dev",V_=`${Z.replace(/\/+$/,"")}/`,ch=`${Z.replace(/\/+$/,"")}/download`,ua="The desktop app runs on its own. Launch Petdex from Applications.",sh="Quit Petdex from its menu bar icon to stop it.",fh=new Map([["init","The desktop app installs its own agent hooks from Settings."],["up",ua],["start",ua],["restart",ua],["down",sh],["stop",sh],["toggle","Toggle the mascot from the Petdex menu bar icon."],["desktop","The desktop app manages its own lifecycle."],["select","Select pets from the Petdex desktop app."],["update","The desktop app updates itself automatically."],["doctor","Petdex Settings shows agent and hook status directly."],["hooks","Install agent hooks from Petdex Settings, one click per agent."]]),Ui=null;async function Or({warnOnFallback:e=!0}={}){if(Ui)return Ui;let t=await tf({petdexUrl:Z,warnOnFallback:e});return Ui=new Di({clientId:t.clientId,issuer:t.issuer,scopes:t.scopes,storage:"keychain",keychainService:"petdex-cli"}),Ui}var qi=ef.version;async function Z_(){let e=process.argv.slice(2),t=e[0];if(t==="bubble"){await Promise.resolve().then(() => Kf());await Jf(e.slice(1));return}if(t==="mcp-server"){await Promise.resolve().then(() => rh());await th();return}if(!t||t==="--help"||t==="-h"||t==="help"){ah();return}if(fh.has(t)){hh(t);return}if(!new Set(["version","--version","-v","telemetry"]).has(t))Mf();switch(t){case"login":await G_();break;case"logout":await J_();break;case"whoami":await K_();break;case"submit":await tb(e.slice(1));break;case"edit":await rb(e.slice(1));break;case"install":await X_(e.slice(1));break;case"list":await Q_();break;case"telemetry":db(e.slice(1));break;case"version":case"--version":case"-v":console.log(qi);break;default:console.error(_.default.red(`Unknown command: ${t}`)),ah(),process.exit(1)}}function hh(e){let t=fh.get(e)??"";console.error(["",` ${_.default.yellow("!")} ${_.default.bold(`petdex ${e}`)} was removed in v${qi.split(".")[0]}.`,"",` ${t}`,` Get the app: ${_.default.underline(ch)}`,"",` This CLI now manages the pet catalog: ${_.default.cyan("petdex list")}, ${_.default.cyan("petdex install <slug>")}.`,""].join(`
|
|
78
|
+
`))}function ah(){let e=_.default.cyan,t=_.default.dim;console.log(["",` ${_.default.bold(_.default.magenta("petdex"))} ${t(qi)} ${t("Codex pet gallery CLI")}`,"",` ${e("Usage")}`," petdex <command> [args]","",` ${e("Commands")}`,` ${_.default.bold("list")} List approved pets`,` ${_.default.bold("install")} <slug...> Install one or more pets into ~/.petdex/pets and ~/.codex/pets`,` ${_.default.bold("login")} Sign in with Clerk OAuth`,` ${_.default.bold("logout")} Clear stored credentials`,` ${_.default.bold("whoami")} Show signed-in user`,` ${_.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${_.default.bold("edit")} <slug> Edit a pet you own (--desc, --displayName, --sprite, --meta, --zip)`,` ${_.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,` ${_.default.bold("version")} Print the CLI version`,"",` ${e("Examples")}`,` ${t("$")} petdex list ${t("# browse the gallery")}`,` ${t("$")} petdex install boba ${t("# install a pet by slug")}`,` ${t("$")} petdex install boba doraemon mochi ${t("# install several at once")}`,` ${t("$")} petdex login`,` ${t("$")} petdex submit ~/.codex/pets/boba ${t("# single folder")}`,"",` ${t("The desktop mascot is now the Petdex app: it installs agent hooks")}`,` ${t("from Settings and updates itself.")} ${_.default.underline(ch)}`,"",` ${t("Gallery & docs:")} ${_.default.underline(Z)}`,""].join(`
|
|
79
|
+
`))}async function G_(){Lr(_.default.bgMagenta(_.default.white(" petdex login ")));let e=Ye();e.start("Opening your browser to sign in with Clerk");try{let t=await Or(),{user:r}=await t.login(),i=ph(r.email,r.username,r.sub)??"unknown";e.stop(`${_.default.green("✓ ")}Signed in as ${_.default.cyan(i)}`),Vt(`Try ${_.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(t){throw e.stop(_.default.red("× login failed")),Error(ub(t.message))}}async function J_(){await(await Or({warnOnFallback:!1})).logout(),console.log(`${_.default.green("✓ ")}Signed out`)}async function K_(){try{let t=await(await Or()).whoami();if(!t)throw Error("not signed in");let r=[zi(t.given_name),zi(t.family_name)].filter(Boolean).join(" ");Zt([`${_.default.dim("user: ")}${t.sub}`,`${_.default.dim("email: ")}${t.email??"—"}`,`${_.default.dim("name: ")}${r||"—"}`,`${_.default.dim("username:")}${zi(t.preferred_username)??"—"}`].join(`
|
|
80
|
+
`),"Signed in")}catch{q(`Not signed in. Run ${_.default.cyan("petdex login")}.`),process.exit(1)}}function dh(e){let t=e.spriteVersionNumber;if(t===void 0||t===1)return 1;if(t===2)return 2;throw Error("spriteVersionNumber must be omitted, 1, or 2")}async function Y_(e){let t=e.slug;if(!Cr(e.spritesheetUrl)||!Cr(e.petJsonUrl))throw Error(`untrusted asset host for ${t} (admin needs to re-upload)`);let r=ie.join(nh(),".petdex","pets",t),i=ie.join(nh(),".codex","pets",t);await Promise.all([ih(r,{recursive:!0}),ih(i,{recursive:!0})]);let n=e.spritesheetUrl.endsWith(".png")?"png":"webp",s=async(c)=>{let l=await fetch(c,{headers:{Referer:V_}});if(!l.ok)throw Error(`download ${c} -> ${l.status} ${l.statusText}`);return l.arrayBuffer()},[a,o]=await Promise.all([s(e.petJsonUrl),s(e.spritesheetUrl)]);await Promise.all([Li(ie.join(r,"pet.json"),Buffer.from(a)),Li(ie.join(r,`spritesheet.${n}`),Buffer.from(o)),Li(ie.join(i,"pet.json"),Buffer.from(a)),Li(ie.join(i,`spritesheet.${n}`),Buffer.from(o))]),fetch(`${Z}/install/${t}`,{method:"GET"}).catch(()=>{})}async function X_(e){let t=e[0];if(!t)q(`Usage: ${_.default.cyan("petdex install <slug> [slug...]")}`),process.exit(1);if(t==="desktop"){hh("desktop");return}let r=Array.from(new Set(e)),i=Ye();i.start(r.length===1?`Resolving ${r[0]}`:`Resolving ${r.length} pets`);let n;try{n=await ta(Z)}catch(u){throw i.stop(_.default.red("manifest failed")),u}let s=[],a=[];for(let u of r){let h=n.find((f)=>f.slug===u);if(h)s.push(h);else a.push(u)}if(s.length===0)i.stop(_.default.red("none found")),q(`No pets matched. Try ${_.default.cyan("petdex list")} to see what's available.`),process.exit(1);let o=[],c=[];for(let u=0;u<s.length;u++){let h=s[u];i.message(s.length===1?`Downloading ${h.slug}`:`Downloading ${h.slug} (${u+1}/${s.length})`);try{await Y_(h),o.push(h.displayName)}catch(f){c.push({slug:h.slug,reason:f instanceof Error?f.message:String(f)})}}if(o.length===s.length)i.stop(o.length===1?`Installed ${_.default.cyan(o[0])}`:`Installed ${_.default.cyan(o.length)} pets`);else if(o.length>0)i.stop(`Installed ${_.default.cyan(o.length)} of ${s.length} (${_.default.red(`${c.length} failed`)})`);else i.stop(_.default.red("all failed"));let l=[];if(o.length>0)l.push("Paths:"),l.push(` ${_.default.dim("~/.petdex/pets/")} (Petdex Desktop)`),l.push(` ${_.default.dim("~/.codex/pets/")} (Codex Desktop)`),l.push(""),l.push("Activate in Petdex Desktop: right-click the mascot."),l.push("Activate in Codex Desktop:"),l.push(` ${_.default.cyan("Settings -> Appearance -> Pets")}`);if(a.length>0){if(l.length>0)l.push("");l.push(_.default.yellow("Skipped (slug not found):"));for(let u of a)l.push(` ${u}`)}if(c.length>0){if(l.length>0)l.push("");l.push(_.default.red("Failed:"));for(let u of c)l.push(` ${u.slug}: ${u.reason}`)}if(l.length>0)Zt(l.join(`
|
|
81
|
+
`),"Next steps");if(c.length>0&&o.length===0)process.exit(1)}async function Q_(){let e=Ye();e.start("Fetching gallery");let t;try{t=await ta(Z)}catch(i){throw e.stop(_.default.red("failed")),i}e.stop(`${t.length} pets`);let r=t.map((i)=>{let n=i.submittedBy?_.default.dim(` by ${i.submittedBy}`):"";return` ${_.default.cyan(i.slug.padEnd(26))} ${i.displayName}${n}`});console.log(r.join(`
|
|
88
82
|
`)),console.log(`
|
|
89
|
-
${
|
|
90
|
-
${
|
|
91
|
-
`),`${
|
|
92
|
-
`),"Failures");let
|
|
93
|
-
`)),
|
|
94
|
-
`);if(
|
|
95
|
-
`);if(
|
|
96
|
-
`);return
|
|
83
|
+
${_.default.dim("Install with")} ${_.default.cyan("petdex install <slug>")}
|
|
84
|
+
${_.default.dim("Browse:")} ${_.default.underline(Z)}`)}var ca=[{value:"cc0",label:"CC0 — public domain, no credit needed"},{value:"cc-by",label:"CC BY — any use, with credit"},{value:"cc-by-sa",label:"CC BY-SA — any use, credit, share alike"},{value:"cc-by-nc",label:"CC BY-NC — non-commercial only, with credit"},{value:"all-rights-reserved",label:"All rights reserved — ask me first"}];function eb(e){let t=e.find((i)=>i.startsWith("--license="));if(t)return t.slice(10);let r=e.indexOf("--license");return r>=0?e[r+1]??"":null}async function tb(e){let r=e.filter((g)=>!g.startsWith("--"))[0];if(!r)q(`Usage: ${_.default.cyan("petdex submit <path> [--license <id>] [--force]")}`),process.exit(1);let i=eb(e),n;if(i!==null){let g=ca.find((y)=>y.value===i);if(!g)q(`Unknown --license ${_.default.red(i||"(empty)")}. Options: ${ca.map((y)=>y.value).join(", ")}`),process.exit(1);n=g.value}else{let g=await sn({message:"License for this pet's artwork (you keep the copyright)",options:ca.map((y)=>({value:y.value,label:y.label}))});if(pt(g))q("Cancelled."),process.exit(1);n=g}let s=await Or(),a;try{let g=await s.getAccessToken();if(!g)q(`Not signed in. Run ${_.default.cyan("petdex login")}.`),process.exit(1);a=g}catch{q(`Not signed in. Run ${_.default.cyan("petdex login")}.`),process.exit(1)}let o=Z;try{o=fb(await s.whoami())}catch{}let c=ie.resolve(r),l=await uh(c).catch(()=>null);if(!l)q(`No such file or directory: ${r}`),process.exit(1);Lr(_.default.bgMagenta(_.default.white(" petdex submit ")));let u=Ye();u.start(`Scanning ${c}`);let h=await ib(c,l.isDirectory());if(u.stop(h.length>0?`${h.length} pet${h.length===1?"":"s"} found`:_.default.red("no pets found")),h.length===0)q("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let d=e.includes("--force")?new Map:await lb(h,a),p=h,m=0;if(d.size>0){let g=h.filter((k)=>d.has(Rr(k.petIdHint))),y=h.filter((k)=>!d.has(Rr(k.petIdHint)));Zt(g.map((k)=>{let I=d.get(Rr(k.petIdHint))?.status??"unknown";return`${_.default.yellow("•")} ${_.default.bold(k.label)} ${_.default.dim(`(${I})`)}`}).join(`
|
|
85
|
+
`),`${g.length} already submitted by you`);let E=await sn({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(pt(E)||E==="cancel")q("Aborted."),process.exit(1);if(E==="skip"){if(p=y,m=g.length,p.length===0){Vt(`Nothing new to submit. Track approval at ${_.default.underline(o)}.`);return}}}if(p.length>1){let g=await La({message:`Submit ${_.default.bold(String(p.length))} pet${p.length===1?"":"s"}?`});if(pt(g)||!g)q("Aborted."),process.exit(1)}let b=0,w=0,v=[];for(let g of p){let y=Ye();y.start(`Submitting ${_.default.cyan(g.label)}`);try{let E=await s.getAccessToken();if(!E)throw Error("session expired");a=E;let k=await sb(g,a,n);o=cb(k.profileUrl)??o,y.stop(`${_.default.green("✓")} ${_.default.cyan(g.label)} → ${ab(k)}`),b++}catch(E){let k=E.message;y.stop(`${_.default.red("×")} ${_.default.cyan(g.label)} ${_.default.red(k.slice(0,60))}`),v.push({label:g.label,error:k}),w++}}if(v.length>0)Zt(v.map((g)=>`${_.default.red("•")} ${_.default.bold(g.label)}: ${g.error}`).join(`
|
|
86
|
+
`),"Failures");let S=m>0?`, ${_.default.yellow(String(m))} skipped`:"";if(Vt([`${_.default.green(String(b))} submitted${S}, ${w>0?_.default.red(String(w)):_.default.dim(String(w))} failed.`,`Held submissions stay visible at ${_.default.underline(o)}.`].join(`
|
|
87
|
+
`)),w>0)process.exit(1)}async function rb(e){let r=e.filter((v)=>!v.startsWith("--"))[0];if(!r)q(`Usage: ${_.default.cyan('petdex edit <slug> [--desc "..."] [--displayName "..."] [--sprite ./new.webp] [--meta ./pet.json] [--zip ./pet.zip]')}`),process.exit(1);let i=await Or(),n;try{let v=await i.getAccessToken();if(!v)q(`Not signed in. Run ${_.default.cyan("petdex login")}.`),process.exit(1);n=v}catch{q(`Not signed in. Run ${_.default.cyan("petdex login")}.`),process.exit(1)}function s(v){let S=e.indexOf(v);if(S===-1)return null;let g=e[S+1];return typeof g==="string"&&!g.startsWith("--")?g:null}let a=s("--desc"),o=s("--displayName"),c=s("--sprite"),l=s("--meta"),u=s("--zip");if(!a&&!o&&!c&&!l&&!u)q("Nothing to edit. Provide at least one flag."),process.exit(1);Lr(_.default.bgMagenta(_.default.white(" petdex edit ")));let h=Ye();h.start(`Resolving ${r}`);let f=await fetch(`${Z}/api/pets/${r}`,{headers:{Authorization:`Bearer ${n}`}});if(!f.ok)h.stop(_.default.red("not found")),q(`Pet "${r}" not found or you don't own it.`),process.exit(1);let p=(await f.json()).id;if(!p)h.stop(_.default.red("could not resolve pet id")),process.exit(1);h.stop(`Found ${_.default.cyan(r)}`);let m={};if(a)m.description=a;if(o)m.displayName=o;if(c||l||u){h.start("Uploading assets");let v=null,S=null,g=null;try{v=c?await $f(c):null,S=l?await Tf(l):null,g=u?await Cf(u):null}catch(x){let I=x instanceof Error?x.message:String(x);h.stop(_.default.red("asset validation failed")),q(I),process.exit(1)}let y=await fetch(`${Z}/api/cli/edit-presign`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify({petId:p,hasSprite:Boolean(v),hasMeta:Boolean(S),hasZip:Boolean(g),spritesheetExt:v?.format})});if(!y.ok){let x=await y.text().catch(()=>"");h.stop(_.default.red(`asset presign failed: ${y.status}`)),q(x.slice(0,120)),process.exit(1)}let E=await y.json();if(!Array.isArray(E.files))h.stop(_.default.red("asset presign returned no files")),process.exit(1);let k=(x)=>{let I=E.files?.find((R)=>R.role===x);if(!I)h.stop(_.default.red(`asset presign missing ${x}`)),process.exit(1);return I};if(v){let x=k("sprite");await jt(x.uploadUrl,v.buffer,v.contentType);let{width:I,height:R}=v;m.spritesheetUrl=x.publicUrl,m.spritesheetWidth=I,m.spritesheetHeight=R}if(l&&S){let x=k("petjson");await jt(x.uploadUrl,S,"application/json"),m.petJsonUrl=x.publicUrl,m.spriteVersionNumber=dh(JSON.parse(S.toString("utf8")))}if(u&&g){let x=k("zip");await jt(x.uploadUrl,g,"application/zip"),m.zipUrl=x.publicUrl}h.stop("Assets uploaded")}h.start("Submitting edit");let b=await fetch(`${Z}/api/cli/edit`,{method:"PATCH",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Origin:Z},body:JSON.stringify({...m,petId:p})});if(!b.ok){let v=await b.text().catch(()=>"");h.stop(_.default.red(`edit failed: ${b.status}`)),q(v.slice(0,120)),process.exit(1)}let w=await b.json();h.stop(w.status==="auto_approved"?`${_.default.green("✓")} Edit auto-approved and live`:`${_.default.yellow("·")} Edit queued for admin review`),Lf("cli_edit_invoked",{cli_version:qi}),Vt(`Gallery: ${_.default.underline(`${Z}/pets/${r}`)}`)}async function ib(e,t){if(!t){if(!e.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${e}`);let s=await nb(e);return s?[s]:[]}if(await ji(ie.join(e,"pet.json"))){let s=await oh(e);return s?[s]:[]}let i=await H_(e,{withFileTypes:!0}),n=[];for(let s of i){if(!s.isDirectory())continue;let a=ie.join(e,s.name),o=await oh(a);if(o)n.push(o)}return n}async function oh(e){let t=ie.join(e,"pet.json");if(!await ji(t))return null;let r=ie.join(e,"spritesheet.webp"),i="webp";if(!await ji(r)){let u=ie.join(e,"spritesheet.png");if(!await ji(u))return null;r=u,i="png"}let n=await fa(t,"utf8"),s={};try{s=JSON.parse(n)}catch{throw Error(`pet.json in ${e} is not valid JSON`)}let a=await fa(r),o=new ha.default;o.file("pet.json",n),o.file(`spritesheet.${i}`,a);let c=Buffer.from(await o.generateAsync({type:"uint8array",compression:"DEFLATE"})),l=ie.basename(e);return{label:l,source:"folder",petJson:n,petJsonObj:s,zipBuffer:c,zipFileName:`${l}.zip`,spritesheetBuffer:a,spritesheetExt:i,petIdHint:typeof s.id==="string"?s.id:l}}async function nb(e){let t=await fa(e),r=await ha.default.loadAsync(t),i=r.file("pet.json"),n=r.file("spritesheet.webp"),s=r.file("spritesheet.png"),a=n??s,o=n?"webp":"png";if(!i||!a)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${e}`);let c=await i.async("string"),l={};try{l=JSON.parse(c)}catch{throw Error("pet.json in zip is not valid JSON")}let u=Buffer.from(await a.async("uint8array")),h=ie.basename(e,".zip");return{label:h,source:"zip",petJson:c,petJsonObj:l,zipBuffer:t,zipFileName:ie.basename(e),spritesheetBuffer:u,spritesheetExt:o,petIdHint:typeof l.id==="string"?l.id:h}}async function sb(e,t,r){let{width:i,height:n}=Ef(e.spritesheetBuffer);if(i===0||n===0)throw Error("spritesheet dimensions could not be parsed");let s=await fetch(`${Z}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:Rr(e.petIdHint),petId:e.petIdHint,spritesheetExt:e.spritesheetExt})});if(!s.ok){let p=await s.text().catch(()=>"");throw Error(`presign ${s.status} ${p.slice(0,100)}`)}let a=await s.json(),o=(p)=>{let m=a.files.find((b)=>b.role===p);if(!m)throw Error(`presign response missing ${p}`);return m},c=o("zip"),l=o("sprite"),u=o("petjson"),h=e.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([jt(c.uploadUrl,e.zipBuffer,"application/zip"),jt(l.uploadUrl,e.spritesheetBuffer,h),jt(u.uploadUrl,Buffer.from(e.petJson,"utf8"),"application/json")]);let f=await fetch(`${Z}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:c.publicUrl,spritesheetUrl:l.publicUrl,petJsonUrl:u.publicUrl,petId:e.petIdHint,displayName:lh(e.petJsonObj.displayName,"Untitled pet"),description:lh(e.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:i,spritesheetHeight:n,spriteVersionNumber:dh(e.petJsonObj),license:r})});if(!f.ok){let p=await f.text().catch(()=>"");throw Error(`register ${f.status} ${p.slice(0,100)}`)}return await f.json()}function ab(e){let t=_.default.dim(e.slug),r=ob(e.review);if(e.review.decision==="approved")return`${t} ${_.default.green("approved")}`;if(e.review.decision==="rejected")return`${t} ${_.default.red("rejected")}${r?_.default.dim(`: ${r}`):""}`;return`${t} ${_.default.yellow("held for review")}${r?_.default.dim(`: ${r}`):""}`}function ob(e){let t=e.reasonCode??"";if(t.startsWith("duplicate_"))return e.summary??"appears to duplicate an existing pet";if(t.startsWith("policy_"))return"possible policy issue";if(t.startsWith("asset_"))return"package file or spritesheet issue";if(t==="review_timeout")return"automated review timed out";if(t==="review_error"||t==="review_failed")return"automated review failed";if(e.decision==="rejected")return"high-confidence automated review issue";if(e.decision==="hold")return"not confident enough to approve automatically";return null}async function jt(e,t,r){let i=await fetch(e,{method:"PUT",headers:{"Content-Type":r},body:t});if(!i.ok)throw Error(`R2 PUT ${i.status}`)}async function lb(e,t){let r=new Map;if(e.length===0)return r;try{let i=await fetch(`${Z}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:e.map((s)=>({petId:s.petIdHint,slugHint:Rr(s.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!i.ok)return r;let n=await i.json();for(let s of n.existing??[])if(s&&typeof s.slug==="string")r.set(s.slug,s)}catch{}return r}function ub(e){let t=e.toLowerCase();if(t.includes("invalid_client")||t.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(`
|
|
88
|
+
`);if(t.includes("invalid_grant")||t.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(`
|
|
89
|
+
`);if(t.includes("redirect_uri")&&t.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(`
|
|
90
|
+
`);return e}async function ji(e){try{return await uh(e),!0}catch{return!1}}function lh(e,t){if(typeof e==="string"&&e.trim())return e.trim();return t}function zi(e){return typeof e==="string"&&e.trim()?e.trim():null}function ph(...e){for(let t of e){let r=zi(t);if(r)return r}return null}function gh(e){let t=Z.replace(/\/+$/,""),r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}function cb(e){if(!e)return null;if(e.startsWith("http://")||e.startsWith("https://"))return e;return gh(e)}function fb(e){let t=ph(e?.preferred_username,e?.username)??(typeof e?.sub==="string"?e.sub.slice(-8).toLowerCase():null);return t?gh(`/u/${encodeURIComponent(t.toLowerCase())}`):Z}function hb(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Rr(e){let t=hb(e);if(t)return t;let r=e.trim();if(!r)return"";let i=2166136261;for(let n of new TextEncoder().encode(r))i^=n,i=Math.imul(i,16777619)>>>0;return`pet-${i.toString(36).padStart(7,"0")}`}function db(e){let t=e[0];if(t==="on"||t==="off"){let r=t==="on";if(Nf(r))console.log(r?"Telemetry enabled":"Telemetry disabled");else console.error(_.default.red(`${_.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${t}\` again.`)),process.exit(1)}else if(t==="status"||!t){let r=Ff();if(console.log(`Status: ${r.enabled?"enabled":"disabled"}`),r.install_id)console.log(`Install ID: ${r.install_id}`)}else console.error(_.default.red(`Unknown telemetry subcommand: ${t}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}Z_().catch((e)=>{q(`petdex: ${e.message}`),process.exit(1)});
|