@eka-care/apollo-assist 0.1.30-dev.0 → 0.1.30
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/widget.js +28 -28
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -347,117 +347,117 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
347
347
|
https://github.com/nodeca/pako/blob/main/LICENSE
|
|
348
348
|
*/var dy;function tI(){return dy||(dy=1,function(n,a){(function(i){n.exports=i()})(function(){return function i(l,u,f){function c(g,A){if(!u[g]){if(!l[g]){var m=typeof Ku=="function"&&Ku;if(!A&&m)return m(g,!0);if(d)return d(g,!0);var y=new Error("Cannot find module '"+g+"'");throw y.code="MODULE_NOT_FOUND",y}var E=u[g]={exports:{}};l[g][0].call(E.exports,function(x){var w=l[g][1][x];return c(w||x)},E,E.exports,i,l,u,f)}return u[g].exports}for(var d=typeof Ku=="function"&&Ku,p=0;p<f.length;p++)c(f[p]);return c}({1:[function(i,l,u){var f=i("./utils"),c=i("./support"),d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";u.encode=function(p){for(var g,A,m,y,E,x,w,k=[],C=0,D=p.length,B=D,H=f.getTypeOf(p)!=="string";C<p.length;)B=D-C,m=H?(g=p[C++],A=C<D?p[C++]:0,C<D?p[C++]:0):(g=p.charCodeAt(C++),A=C<D?p.charCodeAt(C++):0,C<D?p.charCodeAt(C++):0),y=g>>2,E=(3&g)<<4|A>>4,x=1<B?(15&A)<<2|m>>6:64,w=2<B?63&m:64,k.push(d.charAt(y)+d.charAt(E)+d.charAt(x)+d.charAt(w));return k.join("")},u.decode=function(p){var g,A,m,y,E,x,w=0,k=0,C="data:";if(p.substr(0,C.length)===C)throw new Error("Invalid base64 input, it looks like a data url.");var D,B=3*(p=p.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(p.charAt(p.length-1)===d.charAt(64)&&B--,p.charAt(p.length-2)===d.charAt(64)&&B--,B%1!=0)throw new Error("Invalid base64 input, bad content length.");for(D=c.uint8array?new Uint8Array(0|B):new Array(0|B);w<p.length;)g=d.indexOf(p.charAt(w++))<<2|(y=d.indexOf(p.charAt(w++)))>>4,A=(15&y)<<4|(E=d.indexOf(p.charAt(w++)))>>2,m=(3&E)<<6|(x=d.indexOf(p.charAt(w++))),D[k++]=g,E!==64&&(D[k++]=A),x!==64&&(D[k++]=m);return D}},{"./support":30,"./utils":32}],2:[function(i,l,u){var f=i("./external"),c=i("./stream/DataWorker"),d=i("./stream/Crc32Probe"),p=i("./stream/DataLengthProbe");function g(A,m,y,E,x){this.compressedSize=A,this.uncompressedSize=m,this.crc32=y,this.compression=E,this.compressedContent=x}g.prototype={getContentWorker:function(){var A=new c(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new p("data_length")),m=this;return A.on("end",function(){if(this.streamInfo.data_length!==m.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),A},getCompressedWorker:function(){return new c(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},g.createWorkerFrom=function(A,m,y){return A.pipe(new d).pipe(new p("uncompressedSize")).pipe(m.compressWorker(y)).pipe(new p("compressedSize")).withStreamInfo("compression",m)},l.exports=g},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,l,u){var f=i("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},u.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,l,u){var f=i("./utils"),c=function(){for(var d,p=[],g=0;g<256;g++){d=g;for(var A=0;A<8;A++)d=1&d?3988292384^d>>>1:d>>>1;p[g]=d}return p}();l.exports=function(d,p){return d!==void 0&&d.length?f.getTypeOf(d)!=="string"?function(g,A,m,y){var E=c,x=y+m;g^=-1;for(var w=y;w<x;w++)g=g>>>8^E[255&(g^A[w])];return-1^g}(0|p,d,d.length,0):function(g,A,m,y){var E=c,x=y+m;g^=-1;for(var w=y;w<x;w++)g=g>>>8^E[255&(g^A.charCodeAt(w))];return-1^g}(0|p,d,d.length,0):0}},{"./utils":32}],5:[function(i,l,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(i,l,u){var f=null;f=typeof Promise!="undefined"?Promise:i("lie"),l.exports={Promise:f}},{lie:37}],7:[function(i,l,u){var f=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",c=i("pako"),d=i("./utils"),p=i("./stream/GenericWorker"),g=f?"uint8array":"array";function A(m,y){p.call(this,"FlateWorker/"+m),this._pako=null,this._pakoAction=m,this._pakoOptions=y,this.meta={}}u.magic="\b\0",d.inherits(A,p),A.prototype.processChunk=function(m){this.meta=m.meta,this._pako===null&&this._createPako(),this._pako.push(d.transformTo(g,m.data),!1)},A.prototype.flush=function(){p.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},A.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this._pako=null},A.prototype._createPako=function(){this._pako=new c[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var m=this;this._pako.onData=function(y){m.push({data:y,meta:m.meta})}},u.compressWorker=function(m){return new A("Deflate",m)},u.uncompressWorker=function(){return new A("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,l,u){function f(E,x){var w,k="";for(w=0;w<x;w++)k+=String.fromCharCode(255&E),E>>>=8;return k}function c(E,x,w,k,C,D){var B,H,F=E.file,j=E.compression,Z=D!==g.utf8encode,ie=d.transformTo("string",D(F.name)),L=d.transformTo("string",g.utf8encode(F.name)),G=F.comment,re=d.transformTo("string",D(G)),M=d.transformTo("string",g.utf8encode(G)),W=L.length!==F.name.length,I=M.length!==G.length,ae="",fe="",se="",ue=F.dir,te=F.date,T={crc32:0,compressedSize:0,uncompressedSize:0};x&&!w||(T.crc32=E.crc32,T.compressedSize=E.compressedSize,T.uncompressedSize=E.uncompressedSize);var V=0;x&&(V|=8),Z||!W&&!I||(V|=2048);var q=0,Q=0;ue&&(q|=16),C==="UNIX"?(Q=798,q|=function(Se,Oe){var He=Se;return Se||(He=Oe?16893:33204),(65535&He)<<16}(F.unixPermissions,ue)):(Q=20,q|=function(Se){return 63&(Se||0)}(F.dosPermissions)),B=te.getUTCHours(),B<<=6,B|=te.getUTCMinutes(),B<<=5,B|=te.getUTCSeconds()/2,H=te.getUTCFullYear()-1980,H<<=4,H|=te.getUTCMonth()+1,H<<=5,H|=te.getUTCDate(),W&&(fe=f(1,1)+f(A(ie),4)+L,ae+="up"+f(fe.length,2)+fe),I&&(se=f(1,1)+f(A(re),4)+M,ae+="uc"+f(se.length,2)+se);var ye="";return ye+=`
|
|
349
349
|
\0`,ye+=f(V,2),ye+=j.magic,ye+=f(B,2),ye+=f(H,2),ye+=f(T.crc32,4),ye+=f(T.compressedSize,4),ye+=f(T.uncompressedSize,4),ye+=f(ie.length,2),ye+=f(ae.length,2),{fileRecord:m.LOCAL_FILE_HEADER+ye+ie+ae,dirRecord:m.CENTRAL_FILE_HEADER+f(Q,2)+ye+f(re.length,2)+"\0\0\0\0"+f(q,4)+f(k,4)+ie+ae+re}}var d=i("../utils"),p=i("../stream/GenericWorker"),g=i("../utf8"),A=i("../crc32"),m=i("../signature");function y(E,x,w,k){p.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=w,this.encodeFileName=k,this.streamFiles=E,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}d.inherits(y,p),y.prototype.push=function(E){var x=E.meta.percent||0,w=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(E):(this.bytesWritten+=E.data.length,p.prototype.push.call(this,{data:E.data,meta:{currentFile:this.currentFile,percent:w?(x+100*(w-k-1))/w:100}}))},y.prototype.openedSource=function(E){this.currentSourceOffset=this.bytesWritten,this.currentFile=E.file.name;var x=this.streamFiles&&!E.file.dir;if(x){var w=c(E,x,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:w.fileRecord,meta:{percent:0}})}else this.accumulate=!0},y.prototype.closedSource=function(E){this.accumulate=!1;var x=this.streamFiles&&!E.file.dir,w=c(E,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(w.dirRecord),x)this.push({data:function(k){return m.DATA_DESCRIPTOR+f(k.crc32,4)+f(k.compressedSize,4)+f(k.uncompressedSize,4)}(E),meta:{percent:100}});else for(this.push({data:w.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},y.prototype.flush=function(){for(var E=this.bytesWritten,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var w=this.bytesWritten-E,k=function(C,D,B,H,F){var j=d.transformTo("string",F(H));return m.CENTRAL_DIRECTORY_END+"\0\0\0\0"+f(C,2)+f(C,2)+f(D,4)+f(B,4)+f(j.length,2)+j}(this.dirRecords.length,w,E,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},y.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},y.prototype.registerPrevious=function(E){this._sources.push(E);var x=this;return E.on("data",function(w){x.processChunk(w)}),E.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),E.on("error",function(w){x.error(w)}),this},y.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},y.prototype.error=function(E){var x=this._sources;if(!p.prototype.error.call(this,E))return!1;for(var w=0;w<x.length;w++)try{x[w].error(E)}catch(k){}return!0},y.prototype.lock=function(){p.prototype.lock.call(this);for(var E=this._sources,x=0;x<E.length;x++)E[x].lock()},l.exports=y},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(i,l,u){var f=i("../compressions"),c=i("./ZipFileWorker");u.generateWorker=function(d,p,g){var A=new c(p.streamFiles,g,p.platform,p.encodeFileName),m=0;try{d.forEach(function(y,E){m++;var x=function(D,B){var H=D||B,F=f[H];if(!F)throw new Error(H+" is not a valid compression method !");return F}(E.options.compression,p.compression),w=E.options.compressionOptions||p.compressionOptions||{},k=E.dir,C=E.date;E._compressWorker(x,w).withStreamInfo("file",{name:y,dir:k,date:C,comment:E.comment||"",unixPermissions:E.unixPermissions,dosPermissions:E.dosPermissions}).pipe(A)}),A.entriesCount=m}catch(y){A.error(y)}return A}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(i,l,u){function f(){if(!(this instanceof f))return new f;if(arguments.length)throw new 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 c=new f;for(var d in this)typeof this[d]!="function"&&(c[d]=this[d]);return c}}(f.prototype=i("./object")).loadAsync=i("./load"),f.support=i("./support"),f.defaults=i("./defaults"),f.version="3.10.1",f.loadAsync=function(c,d){return new f().loadAsync(c,d)},f.external=i("./external"),l.exports=f},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(i,l,u){var f=i("./utils"),c=i("./external"),d=i("./utf8"),p=i("./zipEntries"),g=i("./stream/Crc32Probe"),A=i("./nodejsUtils");function m(y){return new c.Promise(function(E,x){var w=y.decompressed.getContentWorker().pipe(new g);w.on("error",function(k){x(k)}).on("end",function(){w.streamInfo.crc32!==y.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):E()}).resume()})}l.exports=function(y,E){var x=this;return E=f.extend(E||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:d.utf8decode}),A.isNode&&A.isStream(y)?c.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):f.prepareContent("the loaded zip file",y,!0,E.optimizedBinaryString,E.base64).then(function(w){var k=new p(E);return k.load(w),k}).then(function(w){var k=[c.Promise.resolve(w)],C=w.files;if(E.checkCRC32)for(var D=0;D<C.length;D++)k.push(m(C[D]));return c.Promise.all(k)}).then(function(w){for(var k=w.shift(),C=k.files,D=0;D<C.length;D++){var B=C[D],H=B.fileNameStr,F=f.resolve(B.fileNameStr);x.file(F,B.decompressed,{binary:!0,optimizedBinaryString:!0,date:B.date,dir:B.dir,comment:B.fileCommentStr.length?B.fileCommentStr:null,unixPermissions:B.unixPermissions,dosPermissions:B.dosPermissions,createFolders:E.createFolders}),B.dir||(x.file(F).unsafeOriginalName=H)}return k.zipComment.length&&(x.comment=k.zipComment),x})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(i,l,u){var f=i("../utils"),c=i("../stream/GenericWorker");function d(p,g){c.call(this,"Nodejs stream input adapter for "+p),this._upstreamEnded=!1,this._bindStream(g)}f.inherits(d,c),d.prototype._bindStream=function(p){var g=this;(this._stream=p).pause(),p.on("data",function(A){g.push({data:A,meta:{percent:0}})}).on("error",function(A){g.isPaused?this.generatedError=A:g.error(A)}).on("end",function(){g.isPaused?g._upstreamEnded=!0:g.end()})},d.prototype.pause=function(){return!!c.prototype.pause.call(this)&&(this._stream.pause(),!0)},d.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},l.exports=d},{"../stream/GenericWorker":28,"../utils":32}],13:[function(i,l,u){var f=i("readable-stream").Readable;function c(d,p,g){f.call(this,p),this._helper=d;var A=this;d.on("data",function(m,y){A.push(m)||A._helper.pause(),g&&g(y)}).on("error",function(m){A.emit("error",m)}).on("end",function(){A.push(null)})}i("../utils").inherits(c,f),c.prototype._read=function(){this._helper.resume()},l.exports=c},{"../utils":32,"readable-stream":16}],14:[function(i,l,u){l.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(f,c){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(f,c);if(typeof f=="number")throw new Error('The "data" argument must not be a number');return new Buffer(f,c)},allocBuffer:function(f){if(Buffer.alloc)return Buffer.alloc(f);var c=new Buffer(f);return c.fill(0),c},isBuffer:function(f){return Buffer.isBuffer(f)},isStream:function(f){return f&&typeof f.on=="function"&&typeof f.pause=="function"&&typeof f.resume=="function"}}},{}],15:[function(i,l,u){function f(F,j,Z){var ie,L=d.getTypeOf(j),G=d.extend(Z||{},A);G.date=G.date||new Date,G.compression!==null&&(G.compression=G.compression.toUpperCase()),typeof G.unixPermissions=="string"&&(G.unixPermissions=parseInt(G.unixPermissions,8)),G.unixPermissions&&16384&G.unixPermissions&&(G.dir=!0),G.dosPermissions&&16&G.dosPermissions&&(G.dir=!0),G.dir&&(F=C(F)),G.createFolders&&(ie=k(F))&&D.call(this,ie,!0);var re=L==="string"&&G.binary===!1&&G.base64===!1;Z&&Z.binary!==void 0||(G.binary=!re),(j instanceof m&&j.uncompressedSize===0||G.dir||!j||j.length===0)&&(G.base64=!1,G.binary=!0,j="",G.compression="STORE",L="string");var M=null;M=j instanceof m||j instanceof p?j:x.isNode&&x.isStream(j)?new w(F,j):d.prepareContent(F,j,G.binary,G.optimizedBinaryString,G.base64);var W=new y(F,M,G);this.files[F]=W}var c=i("./utf8"),d=i("./utils"),p=i("./stream/GenericWorker"),g=i("./stream/StreamHelper"),A=i("./defaults"),m=i("./compressedObject"),y=i("./zipObject"),E=i("./generate"),x=i("./nodejsUtils"),w=i("./nodejs/NodejsStreamInputAdapter"),k=function(F){F.slice(-1)==="/"&&(F=F.substring(0,F.length-1));var j=F.lastIndexOf("/");return 0<j?F.substring(0,j):""},C=function(F){return F.slice(-1)!=="/"&&(F+="/"),F},D=function(F,j){return j=j!==void 0?j:A.createFolders,F=C(F),this.files[F]||f.call(this,F,null,{dir:!0,createFolders:j}),this.files[F]};function B(F){return Object.prototype.toString.call(F)==="[object RegExp]"}var H={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(F){var j,Z,ie;for(j in this.files)ie=this.files[j],(Z=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&F(Z,ie)},filter:function(F){var j=[];return this.forEach(function(Z,ie){F(Z,ie)&&j.push(ie)}),j},file:function(F,j,Z){if(arguments.length!==1)return F=this.root+F,f.call(this,F,j,Z),this;if(B(F)){var ie=F;return this.filter(function(G,re){return!re.dir&&ie.test(G)})}var L=this.files[this.root+F];return L&&!L.dir?L:null},folder:function(F){if(!F)return this;if(B(F))return this.filter(function(L,G){return G.dir&&F.test(L)});var j=this.root+F,Z=D.call(this,j),ie=this.clone();return ie.root=Z.name,ie},remove:function(F){F=this.root+F;var j=this.files[F];if(j||(F.slice(-1)!=="/"&&(F+="/"),j=this.files[F]),j&&!j.dir)delete this.files[F];else for(var Z=this.filter(function(L,G){return G.name.slice(0,F.length)===F}),ie=0;ie<Z.length;ie++)delete this.files[Z[ie].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(F){var j,Z={};try{if((Z=d.extend(F||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:c.utf8encode})).type=Z.type.toLowerCase(),Z.compression=Z.compression.toUpperCase(),Z.type==="binarystring"&&(Z.type="string"),!Z.type)throw new Error("No output type specified.");d.checkSupport(Z.type),Z.platform!=="darwin"&&Z.platform!=="freebsd"&&Z.platform!=="linux"&&Z.platform!=="sunos"||(Z.platform="UNIX"),Z.platform==="win32"&&(Z.platform="DOS");var ie=Z.comment||this.comment||"";j=E.generateWorker(this,Z,ie)}catch(L){(j=new p("error")).error(L)}return new g(j,Z.type||"string",Z.mimeType)},generateAsync:function(F,j){return this.generateInternalStream(F).accumulate(j)},generateNodeStream:function(F,j){return(F=F||{}).type||(F.type="nodebuffer"),this.generateInternalStream(F).toNodejsStream(j)}};l.exports=H},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(i,l,u){l.exports=i("stream")},{stream:void 0}],17:[function(i,l,u){var f=i("./DataReader");function c(d){f.call(this,d);for(var p=0;p<this.data.length;p++)d[p]=255&d[p]}i("../utils").inherits(c,f),c.prototype.byteAt=function(d){return this.data[this.zero+d]},c.prototype.lastIndexOfSignature=function(d){for(var p=d.charCodeAt(0),g=d.charCodeAt(1),A=d.charCodeAt(2),m=d.charCodeAt(3),y=this.length-4;0<=y;--y)if(this.data[y]===p&&this.data[y+1]===g&&this.data[y+2]===A&&this.data[y+3]===m)return y-this.zero;return-1},c.prototype.readAndCheckSignature=function(d){var p=d.charCodeAt(0),g=d.charCodeAt(1),A=d.charCodeAt(2),m=d.charCodeAt(3),y=this.readData(4);return p===y[0]&&g===y[1]&&A===y[2]&&m===y[3]},c.prototype.readData=function(d){if(this.checkOffset(d),d===0)return[];var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},l.exports=c},{"../utils":32,"./DataReader":18}],18:[function(i,l,u){var f=i("../utils");function c(d){this.data=d,this.length=d.length,this.index=0,this.zero=0}c.prototype={checkOffset:function(d){this.checkIndex(this.index+d)},checkIndex:function(d){if(this.length<this.zero+d||d<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+d+"). Corrupted zip ?")},setIndex:function(d){this.checkIndex(d),this.index=d},skip:function(d){this.setIndex(this.index+d)},byteAt:function(){},readInt:function(d){var p,g=0;for(this.checkOffset(d),p=this.index+d-1;p>=this.index;p--)g=(g<<8)+this.byteAt(p);return this.index+=d,g},readString:function(d){return f.transformTo("string",this.readData(d))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var d=this.readInt(4);return new Date(Date.UTC(1980+(d>>25&127),(d>>21&15)-1,d>>16&31,d>>11&31,d>>5&63,(31&d)<<1))}},l.exports=c},{"../utils":32}],19:[function(i,l,u){var f=i("./Uint8ArrayReader");function c(d){f.call(this,d)}i("../utils").inherits(c,f),c.prototype.readData=function(d){this.checkOffset(d);var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},l.exports=c},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,l,u){var f=i("./DataReader");function c(d){f.call(this,d)}i("../utils").inherits(c,f),c.prototype.byteAt=function(d){return this.data.charCodeAt(this.zero+d)},c.prototype.lastIndexOfSignature=function(d){return this.data.lastIndexOf(d)-this.zero},c.prototype.readAndCheckSignature=function(d){return d===this.readData(4)},c.prototype.readData=function(d){this.checkOffset(d);var p=this.data.slice(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},l.exports=c},{"../utils":32,"./DataReader":18}],21:[function(i,l,u){var f=i("./ArrayReader");function c(d){f.call(this,d)}i("../utils").inherits(c,f),c.prototype.readData=function(d){if(this.checkOffset(d),d===0)return new Uint8Array(0);var p=this.data.subarray(this.zero+this.index,this.zero+this.index+d);return this.index+=d,p},l.exports=c},{"../utils":32,"./ArrayReader":17}],22:[function(i,l,u){var f=i("../utils"),c=i("../support"),d=i("./ArrayReader"),p=i("./StringReader"),g=i("./NodeBufferReader"),A=i("./Uint8ArrayReader");l.exports=function(m){var y=f.getTypeOf(m);return f.checkSupport(y),y!=="string"||c.uint8array?y==="nodebuffer"?new g(m):c.uint8array?new A(f.transformTo("uint8array",m)):new d(f.transformTo("array",m)):new p(m)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,l,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,l,u){var f=i("./GenericWorker"),c=i("../utils");function d(p){f.call(this,"ConvertWorker to "+p),this.destType=p}c.inherits(d,f),d.prototype.processChunk=function(p){this.push({data:c.transformTo(this.destType,p.data),meta:p.meta})},l.exports=d},{"../utils":32,"./GenericWorker":28}],25:[function(i,l,u){var f=i("./GenericWorker"),c=i("../crc32");function d(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(d,f),d.prototype.processChunk=function(p){this.streamInfo.crc32=c(p.data,this.streamInfo.crc32||0),this.push(p)},l.exports=d},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,l,u){var f=i("../utils"),c=i("./GenericWorker");function d(p){c.call(this,"DataLengthProbe for "+p),this.propName=p,this.withStreamInfo(p,0)}f.inherits(d,c),d.prototype.processChunk=function(p){if(p){var g=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=g+p.data.length}c.prototype.processChunk.call(this,p)},l.exports=d},{"../utils":32,"./GenericWorker":28}],27:[function(i,l,u){var f=i("../utils"),c=i("./GenericWorker");function d(p){c.call(this,"DataWorker");var g=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,p.then(function(A){g.dataIsReady=!0,g.data=A,g.max=A&&A.length||0,g.type=f.getTypeOf(A),g.isPaused||g._tickAndRepeat()},function(A){g.error(A)})}f.inherits(d,c),d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this.data=null},d.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},d.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},d.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var p=null,g=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":p=this.data.substring(this.index,g);break;case"uint8array":p=this.data.subarray(this.index,g);break;case"array":case"nodebuffer":p=this.data.slice(this.index,g)}return this.index=g,this.push({data:p,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=d},{"../utils":32,"./GenericWorker":28}],28:[function(i,l,u){function f(c){this.name=c||"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}f.prototype={push:function(c){this.emit("data",c)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(c){this.emit("error",c)}return!0},error:function(c){return!this.isFinished&&(this.isPaused?this.generatedError=c:(this.isFinished=!0,this.emit("error",c),this.previous&&this.previous.error(c),this.cleanUp()),!0)},on:function(c,d){return this._listeners[c].push(d),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(c,d){if(this._listeners[c])for(var p=0;p<this._listeners[c].length;p++)this._listeners[c][p].call(this,d)},pipe:function(c){return c.registerPrevious(this)},registerPrevious:function(c){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=c.streamInfo,this.mergeStreamInfo(),this.previous=c;var d=this;return c.on("data",function(p){d.processChunk(p)}),c.on("end",function(){d.end()}),c.on("error",function(p){d.error(p)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var c=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),c=!0),this.previous&&this.previous.resume(),!c},flush:function(){},processChunk:function(c){this.push(c)},withStreamInfo:function(c,d){return this.extraStreamInfo[c]=d,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var c in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,c)&&(this.streamInfo[c]=this.extraStreamInfo[c])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var c="Worker "+this.name;return this.previous?this.previous+" -> "+c:c}},l.exports=f},{}],29:[function(i,l,u){var f=i("../utils"),c=i("./ConvertWorker"),d=i("./GenericWorker"),p=i("../base64"),g=i("../support"),A=i("../external"),m=null;if(g.nodestream)try{m=i("../nodejs/NodejsStreamOutputAdapter")}catch(x){}function y(x,w){return new A.Promise(function(k,C){var D=[],B=x._internalType,H=x._outputType,F=x._mimeType;x.on("data",function(j,Z){D.push(j),w&&w(Z)}).on("error",function(j){D=[],C(j)}).on("end",function(){try{var j=function(Z,ie,L){switch(Z){case"blob":return f.newBlob(f.transformTo("arraybuffer",ie),L);case"base64":return p.encode(ie);default:return f.transformTo(Z,ie)}}(H,function(Z,ie){var L,G=0,re=null,M=0;for(L=0;L<ie.length;L++)M+=ie[L].length;switch(Z){case"string":return ie.join("");case"array":return Array.prototype.concat.apply([],ie);case"uint8array":for(re=new Uint8Array(M),L=0;L<ie.length;L++)re.set(ie[L],G),G+=ie[L].length;return re;case"nodebuffer":return Buffer.concat(ie);default:throw new Error("concat : unsupported type '"+Z+"'")}}(B,D),F);k(j)}catch(Z){C(Z)}D=[]}).resume()})}function E(x,w,k){var C=w;switch(w){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=w,this._mimeType=k,f.checkSupport(C),this._worker=x.pipe(new c(C)),x.lock()}catch(D){this._worker=new d("error"),this._worker.error(D)}}E.prototype={accumulate:function(x){return y(this,x)},on:function(x,w){var k=this;return x==="data"?this._worker.on(x,function(C){w.call(k,C.data,C.meta)}):this._worker.on(x,function(){f.delay(w,arguments,k)}),this},resume:function(){return f.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(x){if(f.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new m(this,{objectMode:this._outputType!=="nodebuffer"},x)}},l.exports=E},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(i,l,u){if(u.base64=!0,u.array=!0,u.string=!0,u.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",u.nodebuffer=typeof Buffer!="undefined",u.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")u.blob=!1;else{var f=new ArrayBuffer(0);try{u.blob=new Blob([f],{type:"application/zip"}).size===0}catch(d){try{var c=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);c.append(f),u.blob=c.getBlob("application/zip").size===0}catch(p){u.blob=!1}}}try{u.nodestream=!!i("readable-stream").Readable}catch(d){u.nodestream=!1}},{"readable-stream":16}],31:[function(i,l,u){for(var f=i("./utils"),c=i("./support"),d=i("./nodejsUtils"),p=i("./stream/GenericWorker"),g=new Array(256),A=0;A<256;A++)g[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;g[254]=g[254]=1;function m(){p.call(this,"utf-8 decode"),this.leftOver=null}function y(){p.call(this,"utf-8 encode")}u.utf8encode=function(E){return c.nodebuffer?d.newBufferFrom(E,"utf-8"):function(x){var w,k,C,D,B,H=x.length,F=0;for(D=0;D<H;D++)(64512&(k=x.charCodeAt(D)))==55296&&D+1<H&&(64512&(C=x.charCodeAt(D+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),D++),F+=k<128?1:k<2048?2:k<65536?3:4;for(w=c.uint8array?new Uint8Array(F):new Array(F),D=B=0;B<F;D++)(64512&(k=x.charCodeAt(D)))==55296&&D+1<H&&(64512&(C=x.charCodeAt(D+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),D++),k<128?w[B++]=k:(k<2048?w[B++]=192|k>>>6:(k<65536?w[B++]=224|k>>>12:(w[B++]=240|k>>>18,w[B++]=128|k>>>12&63),w[B++]=128|k>>>6&63),w[B++]=128|63&k);return w}(E)},u.utf8decode=function(E){return c.nodebuffer?f.transformTo("nodebuffer",E).toString("utf-8"):function(x){var w,k,C,D,B=x.length,H=new Array(2*B);for(w=k=0;w<B;)if((C=x[w++])<128)H[k++]=C;else if(4<(D=g[C]))H[k++]=65533,w+=D-1;else{for(C&=D===2?31:D===3?15:7;1<D&&w<B;)C=C<<6|63&x[w++],D--;1<D?H[k++]=65533:C<65536?H[k++]=C:(C-=65536,H[k++]=55296|C>>10&1023,H[k++]=56320|1023&C)}return H.length!==k&&(H.subarray?H=H.subarray(0,k):H.length=k),f.applyFromCharCode(H)}(E=f.transformTo(c.uint8array?"uint8array":"array",E))},f.inherits(m,p),m.prototype.processChunk=function(E){var x=f.transformTo(c.uint8array?"uint8array":"array",E.data);if(this.leftOver&&this.leftOver.length){if(c.uint8array){var w=x;(x=new Uint8Array(w.length+this.leftOver.length)).set(this.leftOver,0),x.set(w,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var k=function(D,B){var H;for((B=B||D.length)>D.length&&(B=D.length),H=B-1;0<=H&&(192&D[H])==128;)H--;return H<0||H===0?B:H+g[D[H]]>B?H:B}(x),C=x;k!==x.length&&(c.uint8array?(C=x.subarray(0,k),this.leftOver=x.subarray(k,x.length)):(C=x.slice(0,k),this.leftOver=x.slice(k,x.length))),this.push({data:u.utf8decode(C),meta:E.meta})},m.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=m,f.inherits(y,p),y.prototype.processChunk=function(E){this.push({data:u.utf8encode(E.data),meta:E.meta})},u.Utf8EncodeWorker=y},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,l,u){var f=i("./support"),c=i("./base64"),d=i("./nodejsUtils"),p=i("./external");function g(w){return w}function A(w,k){for(var C=0;C<w.length;++C)k[C]=255&w.charCodeAt(C);return k}i("setimmediate"),u.newBlob=function(w,k){u.checkSupport("blob");try{return new Blob([w],{type:k})}catch(D){try{var C=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return C.append(w),C.getBlob(k)}catch(B){throw new Error("Bug : can't construct the Blob.")}}};var m={stringifyByChunk:function(w,k,C){var D=[],B=0,H=w.length;if(H<=C)return String.fromCharCode.apply(null,w);for(;B<H;)k==="array"||k==="nodebuffer"?D.push(String.fromCharCode.apply(null,w.slice(B,Math.min(B+C,H)))):D.push(String.fromCharCode.apply(null,w.subarray(B,Math.min(B+C,H)))),B+=C;return D.join("")},stringifyByChar:function(w){for(var k="",C=0;C<w.length;C++)k+=String.fromCharCode(w[C]);return k},applyCanBeUsed:{uint8array:function(){try{return f.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(w){return!1}}(),nodebuffer:function(){try{return f.nodebuffer&&String.fromCharCode.apply(null,d.allocBuffer(1)).length===1}catch(w){return!1}}()}};function y(w){var k=65536,C=u.getTypeOf(w),D=!0;if(C==="uint8array"?D=m.applyCanBeUsed.uint8array:C==="nodebuffer"&&(D=m.applyCanBeUsed.nodebuffer),D)for(;1<k;)try{return m.stringifyByChunk(w,C,k)}catch(B){k=Math.floor(k/2)}return m.stringifyByChar(w)}function E(w,k){for(var C=0;C<w.length;C++)k[C]=w[C];return k}u.applyFromCharCode=y;var x={};x.string={string:g,array:function(w){return A(w,new Array(w.length))},arraybuffer:function(w){return x.string.uint8array(w).buffer},uint8array:function(w){return A(w,new Uint8Array(w.length))},nodebuffer:function(w){return A(w,d.allocBuffer(w.length))}},x.array={string:y,array:g,arraybuffer:function(w){return new Uint8Array(w).buffer},uint8array:function(w){return new Uint8Array(w)},nodebuffer:function(w){return d.newBufferFrom(w)}},x.arraybuffer={string:function(w){return y(new Uint8Array(w))},array:function(w){return E(new Uint8Array(w),new Array(w.byteLength))},arraybuffer:g,uint8array:function(w){return new Uint8Array(w)},nodebuffer:function(w){return d.newBufferFrom(new Uint8Array(w))}},x.uint8array={string:y,array:function(w){return E(w,new Array(w.length))},arraybuffer:function(w){return w.buffer},uint8array:g,nodebuffer:function(w){return d.newBufferFrom(w)}},x.nodebuffer={string:y,array:function(w){return E(w,new Array(w.length))},arraybuffer:function(w){return x.nodebuffer.uint8array(w).buffer},uint8array:function(w){return E(w,new Uint8Array(w.length))},nodebuffer:g},u.transformTo=function(w,k){if(k=k||"",!w)return k;u.checkSupport(w);var C=u.getTypeOf(k);return x[C][w](k)},u.resolve=function(w){for(var k=w.split("/"),C=[],D=0;D<k.length;D++){var B=k[D];B==="."||B===""&&D!==0&&D!==k.length-1||(B===".."?C.pop():C.push(B))}return C.join("/")},u.getTypeOf=function(w){return typeof w=="string"?"string":Object.prototype.toString.call(w)==="[object Array]"?"array":f.nodebuffer&&d.isBuffer(w)?"nodebuffer":f.uint8array&&w instanceof Uint8Array?"uint8array":f.arraybuffer&&w instanceof ArrayBuffer?"arraybuffer":void 0},u.checkSupport=function(w){if(!f[w.toLowerCase()])throw new Error(w+" is not supported by this platform")},u.MAX_VALUE_16BITS=65535,u.MAX_VALUE_32BITS=-1,u.pretty=function(w){var k,C,D="";for(C=0;C<(w||"").length;C++)D+="\\x"+((k=w.charCodeAt(C))<16?"0":"")+k.toString(16).toUpperCase();return D},u.delay=function(w,k,C){setImmediate(function(){w.apply(C||null,k||[])})},u.inherits=function(w,k){function C(){}C.prototype=k.prototype,w.prototype=new C},u.extend=function(){var w,k,C={};for(w=0;w<arguments.length;w++)for(k in arguments[w])Object.prototype.hasOwnProperty.call(arguments[w],k)&&C[k]===void 0&&(C[k]=arguments[w][k]);return C},u.prepareContent=function(w,k,C,D,B){return p.Promise.resolve(k).then(function(H){return f.blob&&(H instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(H))!==-1)&&typeof FileReader!="undefined"?new p.Promise(function(F,j){var Z=new FileReader;Z.onload=function(ie){F(ie.target.result)},Z.onerror=function(ie){j(ie.target.error)},Z.readAsArrayBuffer(H)}):H}).then(function(H){var F=u.getTypeOf(H);return F?(F==="arraybuffer"?H=u.transformTo("uint8array",H):F==="string"&&(B?H=c.decode(H):C&&D!==!0&&(H=function(j){return A(j,f.uint8array?new Uint8Array(j.length):new Array(j.length))}(H))),H):p.Promise.reject(new Error("Can't read the data of '"+w+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(i,l,u){var f=i("./reader/readerFor"),c=i("./utils"),d=i("./signature"),p=i("./zipEntry"),g=i("./support");function A(m){this.files=[],this.loadOptions=m}A.prototype={checkSignature:function(m){if(!this.reader.readAndCheckSignature(m)){this.reader.index-=4;var y=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+c.pretty(y)+", expected "+c.pretty(m)+")")}},isSignature:function(m,y){var E=this.reader.index;this.reader.setIndex(m);var x=this.reader.readString(4)===y;return this.reader.setIndex(E),x},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 m=this.reader.readData(this.zipCommentLength),y=g.uint8array?"uint8array":"array",E=c.transformTo(y,m);this.zipComment=this.loadOptions.decodeFileName(E)},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={};for(var m,y,E,x=this.zip64EndOfCentralSize-44;0<x;)m=this.reader.readInt(2),y=this.reader.readInt(4),E=this.reader.readData(y),this.zip64ExtensibleData[m]={id:m,length:y,value:E}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var m,y;for(m=0;m<this.files.length;m++)y=this.files[m],this.reader.setIndex(y.localHeaderOffset),this.checkSignature(d.LOCAL_FILE_HEADER),y.readLocalPart(this.reader),y.handleUTF8(),y.processAttributes()},readCentralDir:function(){var m;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(d.CENTRAL_FILE_HEADER);)(m=new p({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(m);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var m=this.reader.lastIndexOfSignature(d.CENTRAL_DIRECTORY_END);if(m<0)throw this.isSignature(0,d.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new 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");this.reader.setIndex(m);var y=m;if(this.checkSignature(d.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===c.MAX_VALUE_16BITS||this.diskWithCentralDirStart===c.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===c.MAX_VALUE_16BITS||this.centralDirRecords===c.MAX_VALUE_16BITS||this.centralDirSize===c.MAX_VALUE_32BITS||this.centralDirOffset===c.MAX_VALUE_32BITS){if(this.zip64=!0,(m=this.reader.lastIndexOfSignature(d.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(m),this.checkSignature(d.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,d.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(d.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(d.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var E=this.centralDirOffset+this.centralDirSize;this.zip64&&(E+=20,E+=12+this.zip64EndOfCentralSize);var x=y-E;if(0<x)this.isSignature(y,d.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" bytes.")},prepareReader:function(m){this.reader=f(m)},load:function(m){this.prepareReader(m),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},l.exports=A},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(i,l,u){var f=i("./reader/readerFor"),c=i("./utils"),d=i("./compressedObject"),p=i("./crc32"),g=i("./utf8"),A=i("./compressions"),m=i("./support");function y(E,x){this.options=E,this.loadOptions=x}y.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(E){var x,w;if(E.skip(22),this.fileNameLength=E.readInt(2),w=E.readInt(2),this.fileName=E.readData(this.fileNameLength),E.skip(w),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((x=function(k){for(var C in A)if(Object.prototype.hasOwnProperty.call(A,C)&&A[C].magic===k)return A[C];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+c.pretty(this.compressionMethod)+" unknown (inner file : "+c.transformTo("string",this.fileName)+")");this.decompressed=new d(this.compressedSize,this.uncompressedSize,this.crc32,x,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 x=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 new Error("Encrypted zip are not supported");E.skip(x),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;this.dir=!!(16&this.externalFileAttributes),E==0&&(this.dosPermissions=63&this.externalFileAttributes),E==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var E=f(this.extraFields[1].value);this.uncompressedSize===c.MAX_VALUE_32BITS&&(this.uncompressedSize=E.readInt(8)),this.compressedSize===c.MAX_VALUE_32BITS&&(this.compressedSize=E.readInt(8)),this.localHeaderOffset===c.MAX_VALUE_32BITS&&(this.localHeaderOffset=E.readInt(8)),this.diskNumberStart===c.MAX_VALUE_32BITS&&(this.diskNumberStart=E.readInt(4))}},readExtraFields:function(E){var x,w,k,C=E.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});E.index+4<C;)x=E.readInt(2),w=E.readInt(2),k=E.readData(w),this.extraFields[x]={id:x,length:w,value:k};E.setIndex(C)},handleUTF8:function(){var E=m.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=g.utf8decode(this.fileName),this.fileCommentStr=g.utf8decode(this.fileComment);else{var x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var w=c.transformTo(E,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(w)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var C=c.transformTo(E,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(C)}}},findExtraFieldUnicodePath:function(){var E=this.extraFields[28789];if(E){var x=f(E.value);return x.readInt(1)!==1||p(this.fileName)!==x.readInt(4)?null:g.utf8decode(x.readData(E.length-5))}return null},findExtraFieldUnicodeComment:function(){var E=this.extraFields[25461];if(E){var x=f(E.value);return x.readInt(1)!==1||p(this.fileComment)!==x.readInt(4)?null:g.utf8decode(x.readData(E.length-5))}return null}},l.exports=y},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(i,l,u){function f(x,w,k){this.name=x,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=w,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var c=i("./stream/StreamHelper"),d=i("./stream/DataWorker"),p=i("./utf8"),g=i("./compressedObject"),A=i("./stream/GenericWorker");f.prototype={internalStream:function(x){var w=null,k="string";try{if(!x)throw new Error("No output type specified.");var C=(k=x.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),w=this._decompressWorker();var D=!this._dataBinary;D&&!C&&(w=w.pipe(new p.Utf8EncodeWorker)),!D&&C&&(w=w.pipe(new p.Utf8DecodeWorker))}catch(B){(w=new A("error")).error(B)}return new c(w,k,"")},async:function(x,w){return this.internalStream(x).accumulate(w)},nodeStream:function(x,w){return this.internalStream(x||"nodebuffer").toNodejsStream(w)},_compressWorker:function(x,w){if(this._data instanceof g&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new p.Utf8EncodeWorker)),g.createWorkerFrom(k,x,w)},_decompressWorker:function(){return this._data instanceof g?this._data.getContentWorker():this._data instanceof A?this._data:new d(this._data)}};for(var m=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],y=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},E=0;E<m.length;E++)f.prototype[m[E]]=y;l.exports=f},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(i,l,u){(function(f){var c,d,p=f.MutationObserver||f.WebKitMutationObserver;if(p){var g=0,A=new p(x),m=f.document.createTextNode("");A.observe(m,{characterData:!0}),c=function(){m.data=g=++g%2}}else if(f.setImmediate||f.MessageChannel===void 0)c="document"in f&&"onreadystatechange"in f.document.createElement("script")?function(){var w=f.document.createElement("script");w.onreadystatechange=function(){x(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},f.document.documentElement.appendChild(w)}:function(){setTimeout(x,0)};else{var y=new f.MessageChannel;y.port1.onmessage=x,c=function(){y.port2.postMessage(0)}}var E=[];function x(){var w,k;d=!0;for(var C=E.length;C;){for(k=E,E=[],w=-1;++w<C;)k[w]();C=E.length}d=!1}l.exports=function(w){E.push(w)!==1||d||c()}}).call(this,typeof Wt!="undefined"?Wt:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(i,l,u){var f=i("immediate");function c(){}var d={},p=["REJECTED"],g=["FULFILLED"],A=["PENDING"];function m(C){if(typeof C!="function")throw new TypeError("resolver must be a function");this.state=A,this.queue=[],this.outcome=void 0,C!==c&&w(this,C)}function y(C,D,B){this.promise=C,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof B=="function"&&(this.onRejected=B,this.callRejected=this.otherCallRejected)}function E(C,D,B){f(function(){var H;try{H=D(B)}catch(F){return d.reject(C,F)}H===C?d.reject(C,new TypeError("Cannot resolve promise with itself")):d.resolve(C,H)})}function x(C){var D=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof D=="function")return function(){D.apply(C,arguments)}}function w(C,D){var B=!1;function H(Z){B||(B=!0,d.reject(C,Z))}function F(Z){B||(B=!0,d.resolve(C,Z))}var j=k(function(){D(F,H)});j.status==="error"&&H(j.value)}function k(C,D){var B={};try{B.value=C(D),B.status="success"}catch(H){B.status="error",B.value=H}return B}(l.exports=m).prototype.finally=function(C){if(typeof C!="function")return this;var D=this.constructor;return this.then(function(B){return D.resolve(C()).then(function(){return B})},function(B){return D.resolve(C()).then(function(){throw B})})},m.prototype.catch=function(C){return this.then(null,C)},m.prototype.then=function(C,D){if(typeof C!="function"&&this.state===g||typeof D!="function"&&this.state===p)return this;var B=new this.constructor(c);return this.state!==A?E(B,this.state===g?C:D,this.outcome):this.queue.push(new y(B,C,D)),B},y.prototype.callFulfilled=function(C){d.resolve(this.promise,C)},y.prototype.otherCallFulfilled=function(C){E(this.promise,this.onFulfilled,C)},y.prototype.callRejected=function(C){d.reject(this.promise,C)},y.prototype.otherCallRejected=function(C){E(this.promise,this.onRejected,C)},d.resolve=function(C,D){var B=k(x,D);if(B.status==="error")return d.reject(C,B.value);var H=B.value;if(H)w(C,H);else{C.state=g,C.outcome=D;for(var F=-1,j=C.queue.length;++F<j;)C.queue[F].callFulfilled(D)}return C},d.reject=function(C,D){C.state=p,C.outcome=D;for(var B=-1,H=C.queue.length;++B<H;)C.queue[B].callRejected(D);return C},m.resolve=function(C){return C instanceof this?C:d.resolve(new this(c),C)},m.reject=function(C){var D=new this(c);return d.reject(D,C)},m.all=function(C){var D=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var B=C.length,H=!1;if(!B)return this.resolve([]);for(var F=new Array(B),j=0,Z=-1,ie=new this(c);++Z<B;)L(C[Z],Z);return ie;function L(G,re){D.resolve(G).then(function(M){F[re]=M,++j!==B||H||(H=!0,d.resolve(ie,F))},function(M){H||(H=!0,d.reject(ie,M))})}},m.race=function(C){var D=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var B=C.length,H=!1;if(!B)return this.resolve([]);for(var F=-1,j=new this(c);++F<B;)Z=C[F],D.resolve(Z).then(function(ie){H||(H=!0,d.resolve(j,ie))},function(ie){H||(H=!0,d.reject(j,ie))});var Z;return j}},{immediate:36}],38:[function(i,l,u){var f={};(0,i("./lib/utils/common").assign)(f,i("./lib/deflate"),i("./lib/inflate"),i("./lib/zlib/constants")),l.exports=f},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(i,l,u){var f=i("./zlib/deflate"),c=i("./utils/common"),d=i("./utils/strings"),p=i("./zlib/messages"),g=i("./zlib/zstream"),A=Object.prototype.toString,m=0,y=-1,E=0,x=8;function w(C){if(!(this instanceof w))return new w(C);this.options=c.assign({level:y,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:E,to:""},C||{});var D=this.options;D.raw&&0<D.windowBits?D.windowBits=-D.windowBits:D.gzip&&0<D.windowBits&&D.windowBits<16&&(D.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new g,this.strm.avail_out=0;var B=f.deflateInit2(this.strm,D.level,D.method,D.windowBits,D.memLevel,D.strategy);if(B!==m)throw new Error(p[B]);if(D.header&&f.deflateSetHeader(this.strm,D.header),D.dictionary){var H;if(H=typeof D.dictionary=="string"?d.string2buf(D.dictionary):A.call(D.dictionary)==="[object ArrayBuffer]"?new Uint8Array(D.dictionary):D.dictionary,(B=f.deflateSetDictionary(this.strm,H))!==m)throw new Error(p[B]);this._dict_set=!0}}function k(C,D){var B=new w(D);if(B.push(C,!0),B.err)throw B.msg||p[B.err];return B.result}w.prototype.push=function(C,D){var B,H,F=this.strm,j=this.options.chunkSize;if(this.ended)return!1;H=D===~~D?D:D===!0?4:0,typeof C=="string"?F.input=d.string2buf(C):A.call(C)==="[object ArrayBuffer]"?F.input=new Uint8Array(C):F.input=C,F.next_in=0,F.avail_in=F.input.length;do{if(F.avail_out===0&&(F.output=new c.Buf8(j),F.next_out=0,F.avail_out=j),(B=f.deflate(F,H))!==1&&B!==m)return this.onEnd(B),!(this.ended=!0);F.avail_out!==0&&(F.avail_in!==0||H!==4&&H!==2)||(this.options.to==="string"?this.onData(d.buf2binstring(c.shrinkBuf(F.output,F.next_out))):this.onData(c.shrinkBuf(F.output,F.next_out)))}while((0<F.avail_in||F.avail_out===0)&&B!==1);return H===4?(B=f.deflateEnd(this.strm),this.onEnd(B),this.ended=!0,B===m):H!==2||(this.onEnd(m),!(F.avail_out=0))},w.prototype.onData=function(C){this.chunks.push(C)},w.prototype.onEnd=function(C){C===m&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg},u.Deflate=w,u.deflate=k,u.deflateRaw=function(C,D){return(D=D||{}).raw=!0,k(C,D)},u.gzip=function(C,D){return(D=D||{}).gzip=!0,k(C,D)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(i,l,u){var f=i("./zlib/inflate"),c=i("./utils/common"),d=i("./utils/strings"),p=i("./zlib/constants"),g=i("./zlib/messages"),A=i("./zlib/zstream"),m=i("./zlib/gzheader"),y=Object.prototype.toString;function E(w){if(!(this instanceof E))return new E(w);this.options=c.assign({chunkSize:16384,windowBits:0,to:""},w||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||w&&w.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new A,this.strm.avail_out=0;var C=f.inflateInit2(this.strm,k.windowBits);if(C!==p.Z_OK)throw new Error(g[C]);this.header=new m,f.inflateGetHeader(this.strm,this.header)}function x(w,k){var C=new E(k);if(C.push(w,!0),C.err)throw C.msg||g[C.err];return C.result}E.prototype.push=function(w,k){var C,D,B,H,F,j,Z=this.strm,ie=this.options.chunkSize,L=this.options.dictionary,G=!1;if(this.ended)return!1;D=k===~~k?k:k===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof w=="string"?Z.input=d.binstring2buf(w):y.call(w)==="[object ArrayBuffer]"?Z.input=new Uint8Array(w):Z.input=w,Z.next_in=0,Z.avail_in=Z.input.length;do{if(Z.avail_out===0&&(Z.output=new c.Buf8(ie),Z.next_out=0,Z.avail_out=ie),(C=f.inflate(Z,p.Z_NO_FLUSH))===p.Z_NEED_DICT&&L&&(j=typeof L=="string"?d.string2buf(L):y.call(L)==="[object ArrayBuffer]"?new Uint8Array(L):L,C=f.inflateSetDictionary(this.strm,j)),C===p.Z_BUF_ERROR&&G===!0&&(C=p.Z_OK,G=!1),C!==p.Z_STREAM_END&&C!==p.Z_OK)return this.onEnd(C),!(this.ended=!0);Z.next_out&&(Z.avail_out!==0&&C!==p.Z_STREAM_END&&(Z.avail_in!==0||D!==p.Z_FINISH&&D!==p.Z_SYNC_FLUSH)||(this.options.to==="string"?(B=d.utf8border(Z.output,Z.next_out),H=Z.next_out-B,F=d.buf2string(Z.output,B),Z.next_out=H,Z.avail_out=ie-H,H&&c.arraySet(Z.output,Z.output,B,H,0),this.onData(F)):this.onData(c.shrinkBuf(Z.output,Z.next_out)))),Z.avail_in===0&&Z.avail_out===0&&(G=!0)}while((0<Z.avail_in||Z.avail_out===0)&&C!==p.Z_STREAM_END);return C===p.Z_STREAM_END&&(D=p.Z_FINISH),D===p.Z_FINISH?(C=f.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===p.Z_OK):D!==p.Z_SYNC_FLUSH||(this.onEnd(p.Z_OK),!(Z.avail_out=0))},E.prototype.onData=function(w){this.chunks.push(w)},E.prototype.onEnd=function(w){w===p.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=c.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},u.Inflate=E,u.inflate=x,u.inflateRaw=function(w,k){return(k=k||{}).raw=!0,x(w,k)},u.ungzip=x},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(i,l,u){var f=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";u.assign=function(p){for(var g=Array.prototype.slice.call(arguments,1);g.length;){var A=g.shift();if(A){if(typeof A!="object")throw new TypeError(A+"must be non-object");for(var m in A)A.hasOwnProperty(m)&&(p[m]=A[m])}}return p},u.shrinkBuf=function(p,g){return p.length===g?p:p.subarray?p.subarray(0,g):(p.length=g,p)};var c={arraySet:function(p,g,A,m,y){if(g.subarray&&p.subarray)p.set(g.subarray(A,A+m),y);else for(var E=0;E<m;E++)p[y+E]=g[A+E]},flattenChunks:function(p){var g,A,m,y,E,x;for(g=m=0,A=p.length;g<A;g++)m+=p[g].length;for(x=new Uint8Array(m),g=y=0,A=p.length;g<A;g++)E=p[g],x.set(E,y),y+=E.length;return x}},d={arraySet:function(p,g,A,m,y){for(var E=0;E<m;E++)p[y+E]=g[A+E]},flattenChunks:function(p){return[].concat.apply([],p)}};u.setTyped=function(p){p?(u.Buf8=Uint8Array,u.Buf16=Uint16Array,u.Buf32=Int32Array,u.assign(u,c)):(u.Buf8=Array,u.Buf16=Array,u.Buf32=Array,u.assign(u,d))},u.setTyped(f)},{}],42:[function(i,l,u){var f=i("./common"),c=!0,d=!0;try{String.fromCharCode.apply(null,[0])}catch(m){c=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(m){d=!1}for(var p=new f.Buf8(256),g=0;g<256;g++)p[g]=252<=g?6:248<=g?5:240<=g?4:224<=g?3:192<=g?2:1;function A(m,y){if(y<65537&&(m.subarray&&d||!m.subarray&&c))return String.fromCharCode.apply(null,f.shrinkBuf(m,y));for(var E="",x=0;x<y;x++)E+=String.fromCharCode(m[x]);return E}p[254]=p[254]=1,u.string2buf=function(m){var y,E,x,w,k,C=m.length,D=0;for(w=0;w<C;w++)(64512&(E=m.charCodeAt(w)))==55296&&w+1<C&&(64512&(x=m.charCodeAt(w+1)))==56320&&(E=65536+(E-55296<<10)+(x-56320),w++),D+=E<128?1:E<2048?2:E<65536?3:4;for(y=new f.Buf8(D),w=k=0;k<D;w++)(64512&(E=m.charCodeAt(w)))==55296&&w+1<C&&(64512&(x=m.charCodeAt(w+1)))==56320&&(E=65536+(E-55296<<10)+(x-56320),w++),E<128?y[k++]=E:(E<2048?y[k++]=192|E>>>6:(E<65536?y[k++]=224|E>>>12:(y[k++]=240|E>>>18,y[k++]=128|E>>>12&63),y[k++]=128|E>>>6&63),y[k++]=128|63&E);return y},u.buf2binstring=function(m){return A(m,m.length)},u.binstring2buf=function(m){for(var y=new f.Buf8(m.length),E=0,x=y.length;E<x;E++)y[E]=m.charCodeAt(E);return y},u.buf2string=function(m,y){var E,x,w,k,C=y||m.length,D=new Array(2*C);for(E=x=0;E<C;)if((w=m[E++])<128)D[x++]=w;else if(4<(k=p[w]))D[x++]=65533,E+=k-1;else{for(w&=k===2?31:k===3?15:7;1<k&&E<C;)w=w<<6|63&m[E++],k--;1<k?D[x++]=65533:w<65536?D[x++]=w:(w-=65536,D[x++]=55296|w>>10&1023,D[x++]=56320|1023&w)}return A(D,x)},u.utf8border=function(m,y){var E;for((y=y||m.length)>m.length&&(y=m.length),E=y-1;0<=E&&(192&m[E])==128;)E--;return E<0||E===0?y:E+p[m[E]]>y?E:y}},{"./common":41}],43:[function(i,l,u){l.exports=function(f,c,d,p){for(var g=65535&f|0,A=f>>>16&65535|0,m=0;d!==0;){for(d-=m=2e3<d?2e3:d;A=A+(g=g+c[p++]|0)|0,--m;);g%=65521,A%=65521}return g|A<<16|0}},{}],44:[function(i,l,u){l.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}},{}],45:[function(i,l,u){var f=function(){for(var c,d=[],p=0;p<256;p++){c=p;for(var g=0;g<8;g++)c=1&c?3988292384^c>>>1:c>>>1;d[p]=c}return d}();l.exports=function(c,d,p,g){var A=f,m=g+p;c^=-1;for(var y=g;y<m;y++)c=c>>>8^A[255&(c^d[y])];return-1^c}},{}],46:[function(i,l,u){var f,c=i("../utils/common"),d=i("./trees"),p=i("./adler32"),g=i("./crc32"),A=i("./messages"),m=0,y=4,E=0,x=-2,w=-1,k=4,C=2,D=8,B=9,H=286,F=30,j=19,Z=2*H+1,ie=15,L=3,G=258,re=G+L+1,M=42,W=113,I=1,ae=2,fe=3,se=4;function ue(v,pe){return v.msg=A[pe],pe}function te(v){return(v<<1)-(4<v?9:0)}function T(v){for(var pe=v.length;0<=--pe;)v[pe]=0}function V(v){var pe=v.state,de=pe.pending;de>v.avail_out&&(de=v.avail_out),de!==0&&(c.arraySet(v.output,pe.pending_buf,pe.pending_out,de,v.next_out),v.next_out+=de,pe.pending_out+=de,v.total_out+=de,v.avail_out-=de,pe.pending-=de,pe.pending===0&&(pe.pending_out=0))}function q(v,pe){d._tr_flush_block(v,0<=v.block_start?v.block_start:-1,v.strstart-v.block_start,pe),v.block_start=v.strstart,V(v.strm)}function Q(v,pe){v.pending_buf[v.pending++]=pe}function ye(v,pe){v.pending_buf[v.pending++]=pe>>>8&255,v.pending_buf[v.pending++]=255&pe}function Se(v,pe){var de,Y,z=v.max_chain_length,U=v.strstart,J=v.prev_length,ge=v.nice_match,$=v.strstart>v.w_size-re?v.strstart-(v.w_size-re):0,Ee=v.window,Re=v.w_mask,be=v.prev,ne=v.strstart+G,ee=Ee[U+J-1],xe=Ee[U+J];v.prev_length>=v.good_match&&(z>>=2),ge>v.lookahead&&(ge=v.lookahead);do if(Ee[(de=pe)+J]===xe&&Ee[de+J-1]===ee&&Ee[de]===Ee[U]&&Ee[++de]===Ee[U+1]){U+=2,de++;do;while(Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&Ee[++U]===Ee[++de]&&U<ne);if(Y=G-(ne-U),U=ne-G,J<Y){if(v.match_start=pe,ge<=(J=Y))break;ee=Ee[U+J-1],xe=Ee[U+J]}}while((pe=be[pe&Re])>$&&--z!=0);return J<=v.lookahead?J:v.lookahead}function Oe(v){var pe,de,Y,z,U,J,ge,$,Ee,Re,be=v.w_size;do{if(z=v.window_size-v.lookahead-v.strstart,v.strstart>=be+(be-re)){for(c.arraySet(v.window,v.window,be,be,0),v.match_start-=be,v.strstart-=be,v.block_start-=be,pe=de=v.hash_size;Y=v.head[--pe],v.head[pe]=be<=Y?Y-be:0,--de;);for(pe=de=be;Y=v.prev[--pe],v.prev[pe]=be<=Y?Y-be:0,--de;);z+=be}if(v.strm.avail_in===0)break;if(J=v.strm,ge=v.window,$=v.strstart+v.lookahead,Ee=z,Re=void 0,Re=J.avail_in,Ee<Re&&(Re=Ee),de=Re===0?0:(J.avail_in-=Re,c.arraySet(ge,J.input,J.next_in,Re,$),J.state.wrap===1?J.adler=p(J.adler,ge,Re,$):J.state.wrap===2&&(J.adler=g(J.adler,ge,Re,$)),J.next_in+=Re,J.total_in+=Re,Re),v.lookahead+=de,v.lookahead+v.insert>=L)for(U=v.strstart-v.insert,v.ins_h=v.window[U],v.ins_h=(v.ins_h<<v.hash_shift^v.window[U+1])&v.hash_mask;v.insert&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[U+L-1])&v.hash_mask,v.prev[U&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=U,U++,v.insert--,!(v.lookahead+v.insert<L)););}while(v.lookahead<re&&v.strm.avail_in!==0)}function He(v,pe){for(var de,Y;;){if(v.lookahead<re){if(Oe(v),v.lookahead<re&&pe===m)return I;if(v.lookahead===0)break}if(de=0,v.lookahead>=L&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+L-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),de!==0&&v.strstart-de<=v.w_size-re&&(v.match_length=Se(v,de)),v.match_length>=L)if(Y=d._tr_tally(v,v.strstart-v.match_start,v.match_length-L),v.lookahead-=v.match_length,v.match_length<=v.max_lazy_match&&v.lookahead>=L){for(v.match_length--;v.strstart++,v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+L-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart,--v.match_length!=0;);v.strstart++}else v.strstart+=v.match_length,v.match_length=0,v.ins_h=v.window[v.strstart],v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+1])&v.hash_mask;else Y=d._tr_tally(v,0,v.window[v.strstart]),v.lookahead--,v.strstart++;if(Y&&(q(v,!1),v.strm.avail_out===0))return I}return v.insert=v.strstart<L-1?v.strstart:L-1,pe===y?(q(v,!0),v.strm.avail_out===0?fe:se):v.last_lit&&(q(v,!1),v.strm.avail_out===0)?I:ae}function Ue(v,pe){for(var de,Y,z;;){if(v.lookahead<re){if(Oe(v),v.lookahead<re&&pe===m)return I;if(v.lookahead===0)break}if(de=0,v.lookahead>=L&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+L-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),v.prev_length=v.match_length,v.prev_match=v.match_start,v.match_length=L-1,de!==0&&v.prev_length<v.max_lazy_match&&v.strstart-de<=v.w_size-re&&(v.match_length=Se(v,de),v.match_length<=5&&(v.strategy===1||v.match_length===L&&4096<v.strstart-v.match_start)&&(v.match_length=L-1)),v.prev_length>=L&&v.match_length<=v.prev_length){for(z=v.strstart+v.lookahead-L,Y=d._tr_tally(v,v.strstart-1-v.prev_match,v.prev_length-L),v.lookahead-=v.prev_length-1,v.prev_length-=2;++v.strstart<=z&&(v.ins_h=(v.ins_h<<v.hash_shift^v.window[v.strstart+L-1])&v.hash_mask,de=v.prev[v.strstart&v.w_mask]=v.head[v.ins_h],v.head[v.ins_h]=v.strstart),--v.prev_length!=0;);if(v.match_available=0,v.match_length=L-1,v.strstart++,Y&&(q(v,!1),v.strm.avail_out===0))return I}else if(v.match_available){if((Y=d._tr_tally(v,0,v.window[v.strstart-1]))&&q(v,!1),v.strstart++,v.lookahead--,v.strm.avail_out===0)return I}else v.match_available=1,v.strstart++,v.lookahead--}return v.match_available&&(Y=d._tr_tally(v,0,v.window[v.strstart-1]),v.match_available=0),v.insert=v.strstart<L-1?v.strstart:L-1,pe===y?(q(v,!0),v.strm.avail_out===0?fe:se):v.last_lit&&(q(v,!1),v.strm.avail_out===0)?I:ae}function Le(v,pe,de,Y,z){this.good_length=v,this.max_lazy=pe,this.nice_length=de,this.max_chain=Y,this.func=z}function et(){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=D,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 c.Buf16(2*Z),this.dyn_dtree=new c.Buf16(2*(2*F+1)),this.bl_tree=new c.Buf16(2*(2*j+1)),T(this.dyn_ltree),T(this.dyn_dtree),T(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new c.Buf16(ie+1),this.heap=new c.Buf16(2*H+1),T(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new c.Buf16(2*H+1),T(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 rt(v){var pe;return v&&v.state?(v.total_in=v.total_out=0,v.data_type=C,(pe=v.state).pending=0,pe.pending_out=0,pe.wrap<0&&(pe.wrap=-pe.wrap),pe.status=pe.wrap?M:W,v.adler=pe.wrap===2?0:1,pe.last_flush=m,d._tr_init(pe),E):ue(v,x)}function Et(v){var pe=rt(v);return pe===E&&function(de){de.window_size=2*de.w_size,T(de.head),de.max_lazy_match=f[de.level].max_lazy,de.good_match=f[de.level].good_length,de.nice_match=f[de.level].nice_length,de.max_chain_length=f[de.level].max_chain,de.strstart=0,de.block_start=0,de.lookahead=0,de.insert=0,de.match_length=de.prev_length=L-1,de.match_available=0,de.ins_h=0}(v.state),pe}function Dt(v,pe,de,Y,z,U){if(!v)return x;var J=1;if(pe===w&&(pe=6),Y<0?(J=0,Y=-Y):15<Y&&(J=2,Y-=16),z<1||B<z||de!==D||Y<8||15<Y||pe<0||9<pe||U<0||k<U)return ue(v,x);Y===8&&(Y=9);var ge=new et;return(v.state=ge).strm=v,ge.wrap=J,ge.gzhead=null,ge.w_bits=Y,ge.w_size=1<<ge.w_bits,ge.w_mask=ge.w_size-1,ge.hash_bits=z+7,ge.hash_size=1<<ge.hash_bits,ge.hash_mask=ge.hash_size-1,ge.hash_shift=~~((ge.hash_bits+L-1)/L),ge.window=new c.Buf8(2*ge.w_size),ge.head=new c.Buf16(ge.hash_size),ge.prev=new c.Buf16(ge.w_size),ge.lit_bufsize=1<<z+6,ge.pending_buf_size=4*ge.lit_bufsize,ge.pending_buf=new c.Buf8(ge.pending_buf_size),ge.d_buf=1*ge.lit_bufsize,ge.l_buf=3*ge.lit_bufsize,ge.level=pe,ge.strategy=U,ge.method=de,Et(v)}f=[new Le(0,0,0,0,function(v,pe){var de=65535;for(de>v.pending_buf_size-5&&(de=v.pending_buf_size-5);;){if(v.lookahead<=1){if(Oe(v),v.lookahead===0&&pe===m)return I;if(v.lookahead===0)break}v.strstart+=v.lookahead,v.lookahead=0;var Y=v.block_start+de;if((v.strstart===0||v.strstart>=Y)&&(v.lookahead=v.strstart-Y,v.strstart=Y,q(v,!1),v.strm.avail_out===0)||v.strstart-v.block_start>=v.w_size-re&&(q(v,!1),v.strm.avail_out===0))return I}return v.insert=0,pe===y?(q(v,!0),v.strm.avail_out===0?fe:se):(v.strstart>v.block_start&&(q(v,!1),v.strm.avail_out),I)}),new Le(4,4,8,4,He),new Le(4,5,16,8,He),new Le(4,6,32,32,He),new Le(4,4,16,16,Ue),new Le(8,16,32,32,Ue),new Le(8,16,128,128,Ue),new Le(8,32,128,256,Ue),new Le(32,128,258,1024,Ue),new Le(32,258,258,4096,Ue)],u.deflateInit=function(v,pe){return Dt(v,pe,D,15,8,0)},u.deflateInit2=Dt,u.deflateReset=Et,u.deflateResetKeep=rt,u.deflateSetHeader=function(v,pe){return v&&v.state?v.state.wrap!==2?x:(v.state.gzhead=pe,E):x},u.deflate=function(v,pe){var de,Y,z,U;if(!v||!v.state||5<pe||pe<0)return v?ue(v,x):x;if(Y=v.state,!v.output||!v.input&&v.avail_in!==0||Y.status===666&&pe!==y)return ue(v,v.avail_out===0?-5:x);if(Y.strm=v,de=Y.last_flush,Y.last_flush=pe,Y.status===M)if(Y.wrap===2)v.adler=0,Q(Y,31),Q(Y,139),Q(Y,8),Y.gzhead?(Q(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),Q(Y,255&Y.gzhead.time),Q(Y,Y.gzhead.time>>8&255),Q(Y,Y.gzhead.time>>16&255),Q(Y,Y.gzhead.time>>24&255),Q(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),Q(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(Q(Y,255&Y.gzhead.extra.length),Q(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(v.adler=g(v.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(Q(Y,0),Q(Y,0),Q(Y,0),Q(Y,0),Q(Y,0),Q(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),Q(Y,3),Y.status=W);else{var J=D+(Y.w_bits-8<<4)<<8;J|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(J|=32),J+=31-J%31,Y.status=W,ye(Y,J),Y.strstart!==0&&(ye(Y,v.adler>>>16),ye(Y,65535&v.adler)),v.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(z=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),V(v),z=Y.pending,Y.pending!==Y.pending_buf_size));)Q(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){z=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),V(v),z=Y.pending,Y.pending===Y.pending_buf_size)){U=1;break}U=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,Q(Y,U)}while(U!==0);Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),U===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){z=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),V(v),z=Y.pending,Y.pending===Y.pending_buf_size)){U=1;break}U=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,Q(Y,U)}while(U!==0);Y.gzhead.hcrc&&Y.pending>z&&(v.adler=g(v.adler,Y.pending_buf,Y.pending-z,z)),U===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&V(v),Y.pending+2<=Y.pending_buf_size&&(Q(Y,255&v.adler),Q(Y,v.adler>>8&255),v.adler=0,Y.status=W)):Y.status=W),Y.pending!==0){if(V(v),v.avail_out===0)return Y.last_flush=-1,E}else if(v.avail_in===0&&te(pe)<=te(de)&&pe!==y)return ue(v,-5);if(Y.status===666&&v.avail_in!==0)return ue(v,-5);if(v.avail_in!==0||Y.lookahead!==0||pe!==m&&Y.status!==666){var ge=Y.strategy===2?function($,Ee){for(var Re;;){if($.lookahead===0&&(Oe($),$.lookahead===0)){if(Ee===m)return I;break}if($.match_length=0,Re=d._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Re&&(q($,!1),$.strm.avail_out===0))return I}return $.insert=0,Ee===y?(q($,!0),$.strm.avail_out===0?fe:se):$.last_lit&&(q($,!1),$.strm.avail_out===0)?I:ae}(Y,pe):Y.strategy===3?function($,Ee){for(var Re,be,ne,ee,xe=$.window;;){if($.lookahead<=G){if(Oe($),$.lookahead<=G&&Ee===m)return I;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=L&&0<$.strstart&&(be=xe[ne=$.strstart-1])===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]){ee=$.strstart+G;do;while(be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&be===xe[++ne]&&ne<ee);$.match_length=G-(ee-ne),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=L?(Re=d._tr_tally($,1,$.match_length-L),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(Re=d._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),Re&&(q($,!1),$.strm.avail_out===0))return I}return $.insert=0,Ee===y?(q($,!0),$.strm.avail_out===0?fe:se):$.last_lit&&(q($,!1),$.strm.avail_out===0)?I:ae}(Y,pe):f[Y.level].func(Y,pe);if(ge!==fe&&ge!==se||(Y.status=666),ge===I||ge===fe)return v.avail_out===0&&(Y.last_flush=-1),E;if(ge===ae&&(pe===1?d._tr_align(Y):pe!==5&&(d._tr_stored_block(Y,0,0,!1),pe===3&&(T(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),V(v),v.avail_out===0))return Y.last_flush=-1,E}return pe!==y?E:Y.wrap<=0?1:(Y.wrap===2?(Q(Y,255&v.adler),Q(Y,v.adler>>8&255),Q(Y,v.adler>>16&255),Q(Y,v.adler>>24&255),Q(Y,255&v.total_in),Q(Y,v.total_in>>8&255),Q(Y,v.total_in>>16&255),Q(Y,v.total_in>>24&255)):(ye(Y,v.adler>>>16),ye(Y,65535&v.adler)),V(v),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?E:1)},u.deflateEnd=function(v){var pe;return v&&v.state?(pe=v.state.status)!==M&&pe!==69&&pe!==73&&pe!==91&&pe!==103&&pe!==W&&pe!==666?ue(v,x):(v.state=null,pe===W?ue(v,-3):E):x},u.deflateSetDictionary=function(v,pe){var de,Y,z,U,J,ge,$,Ee,Re=pe.length;if(!v||!v.state||(U=(de=v.state).wrap)===2||U===1&&de.status!==M||de.lookahead)return x;for(U===1&&(v.adler=p(v.adler,pe,Re,0)),de.wrap=0,Re>=de.w_size&&(U===0&&(T(de.head),de.strstart=0,de.block_start=0,de.insert=0),Ee=new c.Buf8(de.w_size),c.arraySet(Ee,pe,Re-de.w_size,de.w_size,0),pe=Ee,Re=de.w_size),J=v.avail_in,ge=v.next_in,$=v.input,v.avail_in=Re,v.next_in=0,v.input=pe,Oe(de);de.lookahead>=L;){for(Y=de.strstart,z=de.lookahead-(L-1);de.ins_h=(de.ins_h<<de.hash_shift^de.window[Y+L-1])&de.hash_mask,de.prev[Y&de.w_mask]=de.head[de.ins_h],de.head[de.ins_h]=Y,Y++,--z;);de.strstart=Y,de.lookahead=L-1,Oe(de)}return de.strstart+=de.lookahead,de.block_start=de.strstart,de.insert=de.lookahead,de.lookahead=0,de.match_length=de.prev_length=L-1,de.match_available=0,v.next_in=ge,v.input=$,v.avail_in=J,de.wrap=U,E},u.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(i,l,u){l.exports=function(){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}},{}],48:[function(i,l,u){l.exports=function(f,c){var d,p,g,A,m,y,E,x,w,k,C,D,B,H,F,j,Z,ie,L,G,re,M,W,I,ae;d=f.state,p=f.next_in,I=f.input,g=p+(f.avail_in-5),A=f.next_out,ae=f.output,m=A-(c-f.avail_out),y=A+(f.avail_out-257),E=d.dmax,x=d.wsize,w=d.whave,k=d.wnext,C=d.window,D=d.hold,B=d.bits,H=d.lencode,F=d.distcode,j=(1<<d.lenbits)-1,Z=(1<<d.distbits)-1;e:do{B<15&&(D+=I[p++]<<B,B+=8,D+=I[p++]<<B,B+=8),ie=H[D&j];t:for(;;){if(D>>>=L=ie>>>24,B-=L,(L=ie>>>16&255)===0)ae[A++]=65535&ie;else{if(!(16&L)){if((64&L)==0){ie=H[(65535&ie)+(D&(1<<L)-1)];continue t}if(32&L){d.mode=12;break e}f.msg="invalid literal/length code",d.mode=30;break e}G=65535&ie,(L&=15)&&(B<L&&(D+=I[p++]<<B,B+=8),G+=D&(1<<L)-1,D>>>=L,B-=L),B<15&&(D+=I[p++]<<B,B+=8,D+=I[p++]<<B,B+=8),ie=F[D&Z];n:for(;;){if(D>>>=L=ie>>>24,B-=L,!(16&(L=ie>>>16&255))){if((64&L)==0){ie=F[(65535&ie)+(D&(1<<L)-1)];continue n}f.msg="invalid distance code",d.mode=30;break e}if(re=65535&ie,B<(L&=15)&&(D+=I[p++]<<B,(B+=8)<L&&(D+=I[p++]<<B,B+=8)),E<(re+=D&(1<<L)-1)){f.msg="invalid distance too far back",d.mode=30;break e}if(D>>>=L,B-=L,(L=A-m)<re){if(w<(L=re-L)&&d.sane){f.msg="invalid distance too far back",d.mode=30;break e}if(W=C,(M=0)===k){if(M+=x-L,L<G){for(G-=L;ae[A++]=C[M++],--L;);M=A-re,W=ae}}else if(k<L){if(M+=x+k-L,(L-=k)<G){for(G-=L;ae[A++]=C[M++],--L;);if(M=0,k<G){for(G-=L=k;ae[A++]=C[M++],--L;);M=A-re,W=ae}}}else if(M+=k-L,L<G){for(G-=L;ae[A++]=C[M++],--L;);M=A-re,W=ae}for(;2<G;)ae[A++]=W[M++],ae[A++]=W[M++],ae[A++]=W[M++],G-=3;G&&(ae[A++]=W[M++],1<G&&(ae[A++]=W[M++]))}else{for(M=A-re;ae[A++]=ae[M++],ae[A++]=ae[M++],ae[A++]=ae[M++],2<(G-=3););G&&(ae[A++]=ae[M++],1<G&&(ae[A++]=ae[M++]))}break}}break}}while(p<g&&A<y);p-=G=B>>3,D&=(1<<(B-=G<<3))-1,f.next_in=p,f.next_out=A,f.avail_in=p<g?g-p+5:5-(p-g),f.avail_out=A<y?y-A+257:257-(A-y),d.hold=D,d.bits=B}},{}],49:[function(i,l,u){var f=i("../utils/common"),c=i("./adler32"),d=i("./crc32"),p=i("./inffast"),g=i("./inftrees"),A=1,m=2,y=0,E=-2,x=1,w=852,k=592;function C(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function D(){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 f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function B(M){var W;return M&&M.state?(W=M.state,M.total_in=M.total_out=W.total=0,M.msg="",W.wrap&&(M.adler=1&W.wrap),W.mode=x,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new f.Buf32(w),W.distcode=W.distdyn=new f.Buf32(k),W.sane=1,W.back=-1,y):E}function H(M){var W;return M&&M.state?((W=M.state).wsize=0,W.whave=0,W.wnext=0,B(M)):E}function F(M,W){var I,ae;return M&&M.state?(ae=M.state,W<0?(I=0,W=-W):(I=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?E:(ae.window!==null&&ae.wbits!==W&&(ae.window=null),ae.wrap=I,ae.wbits=W,H(M))):E}function j(M,W){var I,ae;return M?(ae=new D,(M.state=ae).window=null,(I=F(M,W))!==y&&(M.state=null),I):E}var Z,ie,L=!0;function G(M){if(L){var W;for(Z=new f.Buf32(512),ie=new f.Buf32(32),W=0;W<144;)M.lens[W++]=8;for(;W<256;)M.lens[W++]=9;for(;W<280;)M.lens[W++]=7;for(;W<288;)M.lens[W++]=8;for(g(A,M.lens,0,288,Z,0,M.work,{bits:9}),W=0;W<32;)M.lens[W++]=5;g(m,M.lens,0,32,ie,0,M.work,{bits:5}),L=!1}M.lencode=Z,M.lenbits=9,M.distcode=ie,M.distbits=5}function re(M,W,I,ae){var fe,se=M.state;return se.window===null&&(se.wsize=1<<se.wbits,se.wnext=0,se.whave=0,se.window=new f.Buf8(se.wsize)),ae>=se.wsize?(f.arraySet(se.window,W,I-se.wsize,se.wsize,0),se.wnext=0,se.whave=se.wsize):(ae<(fe=se.wsize-se.wnext)&&(fe=ae),f.arraySet(se.window,W,I-ae,fe,se.wnext),(ae-=fe)?(f.arraySet(se.window,W,I-ae,ae,0),se.wnext=ae,se.whave=se.wsize):(se.wnext+=fe,se.wnext===se.wsize&&(se.wnext=0),se.whave<se.wsize&&(se.whave+=fe))),0}u.inflateReset=H,u.inflateReset2=F,u.inflateResetKeep=B,u.inflateInit=function(M){return j(M,15)},u.inflateInit2=j,u.inflate=function(M,W){var I,ae,fe,se,ue,te,T,V,q,Q,ye,Se,Oe,He,Ue,Le,et,rt,Et,Dt,v,pe,de,Y,z=0,U=new f.Buf8(4),J=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return E;(I=M.state).mode===12&&(I.mode=13),ue=M.next_out,fe=M.output,T=M.avail_out,se=M.next_in,ae=M.input,te=M.avail_in,V=I.hold,q=I.bits,Q=te,ye=T,pe=y;e:for(;;)switch(I.mode){case x:if(I.wrap===0){I.mode=13;break}for(;q<16;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(2&I.wrap&&V===35615){U[I.check=0]=255&V,U[1]=V>>>8&255,I.check=d(I.check,U,2,0),q=V=0,I.mode=2;break}if(I.flags=0,I.head&&(I.head.done=!1),!(1&I.wrap)||(((255&V)<<8)+(V>>8))%31){M.msg="incorrect header check",I.mode=30;break}if((15&V)!=8){M.msg="unknown compression method",I.mode=30;break}if(q-=4,v=8+(15&(V>>>=4)),I.wbits===0)I.wbits=v;else if(v>I.wbits){M.msg="invalid window size",I.mode=30;break}I.dmax=1<<v,M.adler=I.check=1,I.mode=512&V?10:12,q=V=0;break;case 2:for(;q<16;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(I.flags=V,(255&I.flags)!=8){M.msg="unknown compression method",I.mode=30;break}if(57344&I.flags){M.msg="unknown header flags set",I.mode=30;break}I.head&&(I.head.text=V>>8&1),512&I.flags&&(U[0]=255&V,U[1]=V>>>8&255,I.check=d(I.check,U,2,0)),q=V=0,I.mode=3;case 3:for(;q<32;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.head&&(I.head.time=V),512&I.flags&&(U[0]=255&V,U[1]=V>>>8&255,U[2]=V>>>16&255,U[3]=V>>>24&255,I.check=d(I.check,U,4,0)),q=V=0,I.mode=4;case 4:for(;q<16;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.head&&(I.head.xflags=255&V,I.head.os=V>>8),512&I.flags&&(U[0]=255&V,U[1]=V>>>8&255,I.check=d(I.check,U,2,0)),q=V=0,I.mode=5;case 5:if(1024&I.flags){for(;q<16;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.length=V,I.head&&(I.head.extra_len=V),512&I.flags&&(U[0]=255&V,U[1]=V>>>8&255,I.check=d(I.check,U,2,0)),q=V=0}else I.head&&(I.head.extra=null);I.mode=6;case 6:if(1024&I.flags&&(te<(Se=I.length)&&(Se=te),Se&&(I.head&&(v=I.head.extra_len-I.length,I.head.extra||(I.head.extra=new Array(I.head.extra_len)),f.arraySet(I.head.extra,ae,se,Se,v)),512&I.flags&&(I.check=d(I.check,ae,Se,se)),te-=Se,se+=Se,I.length-=Se),I.length))break e;I.length=0,I.mode=7;case 7:if(2048&I.flags){if(te===0)break e;for(Se=0;v=ae[se+Se++],I.head&&v&&I.length<65536&&(I.head.name+=String.fromCharCode(v)),v&&Se<te;);if(512&I.flags&&(I.check=d(I.check,ae,Se,se)),te-=Se,se+=Se,v)break e}else I.head&&(I.head.name=null);I.length=0,I.mode=8;case 8:if(4096&I.flags){if(te===0)break e;for(Se=0;v=ae[se+Se++],I.head&&v&&I.length<65536&&(I.head.comment+=String.fromCharCode(v)),v&&Se<te;);if(512&I.flags&&(I.check=d(I.check,ae,Se,se)),te-=Se,se+=Se,v)break e}else I.head&&(I.head.comment=null);I.mode=9;case 9:if(512&I.flags){for(;q<16;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(V!==(65535&I.check)){M.msg="header crc mismatch",I.mode=30;break}q=V=0}I.head&&(I.head.hcrc=I.flags>>9&1,I.head.done=!0),M.adler=I.check=0,I.mode=12;break;case 10:for(;q<32;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}M.adler=I.check=C(V),q=V=0,I.mode=11;case 11:if(I.havedict===0)return M.next_out=ue,M.avail_out=T,M.next_in=se,M.avail_in=te,I.hold=V,I.bits=q,2;M.adler=I.check=1,I.mode=12;case 12:if(W===5||W===6)break e;case 13:if(I.last){V>>>=7&q,q-=7&q,I.mode=27;break}for(;q<3;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}switch(I.last=1&V,q-=1,3&(V>>>=1)){case 0:I.mode=14;break;case 1:if(G(I),I.mode=20,W!==6)break;V>>>=2,q-=2;break e;case 2:I.mode=17;break;case 3:M.msg="invalid block type",I.mode=30}V>>>=2,q-=2;break;case 14:for(V>>>=7&q,q-=7&q;q<32;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if((65535&V)!=(V>>>16^65535)){M.msg="invalid stored block lengths",I.mode=30;break}if(I.length=65535&V,q=V=0,I.mode=15,W===6)break e;case 15:I.mode=16;case 16:if(Se=I.length){if(te<Se&&(Se=te),T<Se&&(Se=T),Se===0)break e;f.arraySet(fe,ae,se,Se,ue),te-=Se,se+=Se,T-=Se,ue+=Se,I.length-=Se;break}I.mode=12;break;case 17:for(;q<14;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(I.nlen=257+(31&V),V>>>=5,q-=5,I.ndist=1+(31&V),V>>>=5,q-=5,I.ncode=4+(15&V),V>>>=4,q-=4,286<I.nlen||30<I.ndist){M.msg="too many length or distance symbols",I.mode=30;break}I.have=0,I.mode=18;case 18:for(;I.have<I.ncode;){for(;q<3;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.lens[J[I.have++]]=7&V,V>>>=3,q-=3}for(;I.have<19;)I.lens[J[I.have++]]=0;if(I.lencode=I.lendyn,I.lenbits=7,de={bits:I.lenbits},pe=g(0,I.lens,0,19,I.lencode,0,I.work,de),I.lenbits=de.bits,pe){M.msg="invalid code lengths set",I.mode=30;break}I.have=0,I.mode=19;case 19:for(;I.have<I.nlen+I.ndist;){for(;Le=(z=I.lencode[V&(1<<I.lenbits)-1])>>>16&255,et=65535&z,!((Ue=z>>>24)<=q);){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(et<16)V>>>=Ue,q-=Ue,I.lens[I.have++]=et;else{if(et===16){for(Y=Ue+2;q<Y;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(V>>>=Ue,q-=Ue,I.have===0){M.msg="invalid bit length repeat",I.mode=30;break}v=I.lens[I.have-1],Se=3+(3&V),V>>>=2,q-=2}else if(et===17){for(Y=Ue+3;q<Y;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}q-=Ue,v=0,Se=3+(7&(V>>>=Ue)),V>>>=3,q-=3}else{for(Y=Ue+7;q<Y;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}q-=Ue,v=0,Se=11+(127&(V>>>=Ue)),V>>>=7,q-=7}if(I.have+Se>I.nlen+I.ndist){M.msg="invalid bit length repeat",I.mode=30;break}for(;Se--;)I.lens[I.have++]=v}}if(I.mode===30)break;if(I.lens[256]===0){M.msg="invalid code -- missing end-of-block",I.mode=30;break}if(I.lenbits=9,de={bits:I.lenbits},pe=g(A,I.lens,0,I.nlen,I.lencode,0,I.work,de),I.lenbits=de.bits,pe){M.msg="invalid literal/lengths set",I.mode=30;break}if(I.distbits=6,I.distcode=I.distdyn,de={bits:I.distbits},pe=g(m,I.lens,I.nlen,I.ndist,I.distcode,0,I.work,de),I.distbits=de.bits,pe){M.msg="invalid distances set",I.mode=30;break}if(I.mode=20,W===6)break e;case 20:I.mode=21;case 21:if(6<=te&&258<=T){M.next_out=ue,M.avail_out=T,M.next_in=se,M.avail_in=te,I.hold=V,I.bits=q,p(M,ye),ue=M.next_out,fe=M.output,T=M.avail_out,se=M.next_in,ae=M.input,te=M.avail_in,V=I.hold,q=I.bits,I.mode===12&&(I.back=-1);break}for(I.back=0;Le=(z=I.lencode[V&(1<<I.lenbits)-1])>>>16&255,et=65535&z,!((Ue=z>>>24)<=q);){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(Le&&(240&Le)==0){for(rt=Ue,Et=Le,Dt=et;Le=(z=I.lencode[Dt+((V&(1<<rt+Et)-1)>>rt)])>>>16&255,et=65535&z,!(rt+(Ue=z>>>24)<=q);){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}V>>>=rt,q-=rt,I.back+=rt}if(V>>>=Ue,q-=Ue,I.back+=Ue,I.length=et,Le===0){I.mode=26;break}if(32&Le){I.back=-1,I.mode=12;break}if(64&Le){M.msg="invalid literal/length code",I.mode=30;break}I.extra=15&Le,I.mode=22;case 22:if(I.extra){for(Y=I.extra;q<Y;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.length+=V&(1<<I.extra)-1,V>>>=I.extra,q-=I.extra,I.back+=I.extra}I.was=I.length,I.mode=23;case 23:for(;Le=(z=I.distcode[V&(1<<I.distbits)-1])>>>16&255,et=65535&z,!((Ue=z>>>24)<=q);){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if((240&Le)==0){for(rt=Ue,Et=Le,Dt=et;Le=(z=I.distcode[Dt+((V&(1<<rt+Et)-1)>>rt)])>>>16&255,et=65535&z,!(rt+(Ue=z>>>24)<=q);){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}V>>>=rt,q-=rt,I.back+=rt}if(V>>>=Ue,q-=Ue,I.back+=Ue,64&Le){M.msg="invalid distance code",I.mode=30;break}I.offset=et,I.extra=15&Le,I.mode=24;case 24:if(I.extra){for(Y=I.extra;q<Y;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}I.offset+=V&(1<<I.extra)-1,V>>>=I.extra,q-=I.extra,I.back+=I.extra}if(I.offset>I.dmax){M.msg="invalid distance too far back",I.mode=30;break}I.mode=25;case 25:if(T===0)break e;if(Se=ye-T,I.offset>Se){if((Se=I.offset-Se)>I.whave&&I.sane){M.msg="invalid distance too far back",I.mode=30;break}Oe=Se>I.wnext?(Se-=I.wnext,I.wsize-Se):I.wnext-Se,Se>I.length&&(Se=I.length),He=I.window}else He=fe,Oe=ue-I.offset,Se=I.length;for(T<Se&&(Se=T),T-=Se,I.length-=Se;fe[ue++]=He[Oe++],--Se;);I.length===0&&(I.mode=21);break;case 26:if(T===0)break e;fe[ue++]=I.length,T--,I.mode=21;break;case 27:if(I.wrap){for(;q<32;){if(te===0)break e;te--,V|=ae[se++]<<q,q+=8}if(ye-=T,M.total_out+=ye,I.total+=ye,ye&&(M.adler=I.check=I.flags?d(I.check,fe,ye,ue-ye):c(I.check,fe,ye,ue-ye)),ye=T,(I.flags?V:C(V))!==I.check){M.msg="incorrect data check",I.mode=30;break}q=V=0}I.mode=28;case 28:if(I.wrap&&I.flags){for(;q<32;){if(te===0)break e;te--,V+=ae[se++]<<q,q+=8}if(V!==(4294967295&I.total)){M.msg="incorrect length check",I.mode=30;break}q=V=0}I.mode=29;case 29:pe=1;break e;case 30:pe=-3;break e;case 31:return-4;case 32:default:return E}return M.next_out=ue,M.avail_out=T,M.next_in=se,M.avail_in=te,I.hold=V,I.bits=q,(I.wsize||ye!==M.avail_out&&I.mode<30&&(I.mode<27||W!==4))&&re(M,M.output,M.next_out,ye-M.avail_out)?(I.mode=31,-4):(Q-=M.avail_in,ye-=M.avail_out,M.total_in+=Q,M.total_out+=ye,I.total+=ye,I.wrap&&ye&&(M.adler=I.check=I.flags?d(I.check,fe,ye,M.next_out-ye):c(I.check,fe,ye,M.next_out-ye)),M.data_type=I.bits+(I.last?64:0)+(I.mode===12?128:0)+(I.mode===20||I.mode===15?256:0),(Q==0&&ye===0||W===4)&&pe===y&&(pe=-5),pe)},u.inflateEnd=function(M){if(!M||!M.state)return E;var W=M.state;return W.window&&(W.window=null),M.state=null,y},u.inflateGetHeader=function(M,W){var I;return M&&M.state?(2&(I=M.state).wrap)==0?E:((I.head=W).done=!1,y):E},u.inflateSetDictionary=function(M,W){var I,ae=W.length;return M&&M.state?(I=M.state).wrap!==0&&I.mode!==11?E:I.mode===11&&c(1,W,ae,0)!==I.check?-3:re(M,W,ae,ae)?(I.mode=31,-4):(I.havedict=1,y):E},u.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(i,l,u){var f=i("../utils/common"),c=[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],d=[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],p=[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],g=[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];l.exports=function(A,m,y,E,x,w,k,C){var D,B,H,F,j,Z,ie,L,G,re=C.bits,M=0,W=0,I=0,ae=0,fe=0,se=0,ue=0,te=0,T=0,V=0,q=null,Q=0,ye=new f.Buf16(16),Se=new f.Buf16(16),Oe=null,He=0;for(M=0;M<=15;M++)ye[M]=0;for(W=0;W<E;W++)ye[m[y+W]]++;for(fe=re,ae=15;1<=ae&&ye[ae]===0;ae--);if(ae<fe&&(fe=ae),ae===0)return x[w++]=20971520,x[w++]=20971520,C.bits=1,0;for(I=1;I<ae&&ye[I]===0;I++);for(fe<I&&(fe=I),M=te=1;M<=15;M++)if(te<<=1,(te-=ye[M])<0)return-1;if(0<te&&(A===0||ae!==1))return-1;for(Se[1]=0,M=1;M<15;M++)Se[M+1]=Se[M]+ye[M];for(W=0;W<E;W++)m[y+W]!==0&&(k[Se[m[y+W]]++]=W);if(Z=A===0?(q=Oe=k,19):A===1?(q=c,Q-=257,Oe=d,He-=257,256):(q=p,Oe=g,-1),M=I,j=w,ue=W=V=0,H=-1,F=(T=1<<(se=fe))-1,A===1&&852<T||A===2&&592<T)return 1;for(;;){for(ie=M-ue,G=k[W]<Z?(L=0,k[W]):k[W]>Z?(L=Oe[He+k[W]],q[Q+k[W]]):(L=96,0),D=1<<M-ue,I=B=1<<se;x[j+(V>>ue)+(B-=D)]=ie<<24|L<<16|G|0,B!==0;);for(D=1<<M-1;V&D;)D>>=1;if(D!==0?(V&=D-1,V+=D):V=0,W++,--ye[M]==0){if(M===ae)break;M=m[y+k[W]]}if(fe<M&&(V&F)!==H){for(ue===0&&(ue=fe),j+=I,te=1<<(se=M-ue);se+ue<ae&&!((te-=ye[se+ue])<=0);)se++,te<<=1;if(T+=1<<se,A===1&&852<T||A===2&&592<T)return 1;x[H=V&F]=fe<<24|se<<16|j-w|0}}return V!==0&&(x[j+V]=M-ue<<24|4194304|0),C.bits=fe,0}},{"../utils/common":41}],51:[function(i,l,u){l.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"}},{}],52:[function(i,l,u){var f=i("../utils/common"),c=0,d=1;function p(z){for(var U=z.length;0<=--U;)z[U]=0}var g=0,A=29,m=256,y=m+1+A,E=30,x=19,w=2*y+1,k=15,C=16,D=7,B=256,H=16,F=17,j=18,Z=[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],ie=[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],L=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],re=new Array(2*(y+2));p(re);var M=new Array(2*E);p(M);var W=new Array(512);p(W);var I=new Array(256);p(I);var ae=new Array(A);p(ae);var fe,se,ue,te=new Array(E);function T(z,U,J,ge,$){this.static_tree=z,this.extra_bits=U,this.extra_base=J,this.elems=ge,this.max_length=$,this.has_stree=z&&z.length}function V(z,U){this.dyn_tree=z,this.max_code=0,this.stat_desc=U}function q(z){return z<256?W[z]:W[256+(z>>>7)]}function Q(z,U){z.pending_buf[z.pending++]=255&U,z.pending_buf[z.pending++]=U>>>8&255}function ye(z,U,J){z.bi_valid>C-J?(z.bi_buf|=U<<z.bi_valid&65535,Q(z,z.bi_buf),z.bi_buf=U>>C-z.bi_valid,z.bi_valid+=J-C):(z.bi_buf|=U<<z.bi_valid&65535,z.bi_valid+=J)}function Se(z,U,J){ye(z,J[2*U],J[2*U+1])}function Oe(z,U){for(var J=0;J|=1&z,z>>>=1,J<<=1,0<--U;);return J>>>1}function He(z,U,J){var ge,$,Ee=new Array(k+1),Re=0;for(ge=1;ge<=k;ge++)Ee[ge]=Re=Re+J[ge-1]<<1;for($=0;$<=U;$++){var be=z[2*$+1];be!==0&&(z[2*$]=Oe(Ee[be]++,be))}}function Ue(z){var U;for(U=0;U<y;U++)z.dyn_ltree[2*U]=0;for(U=0;U<E;U++)z.dyn_dtree[2*U]=0;for(U=0;U<x;U++)z.bl_tree[2*U]=0;z.dyn_ltree[2*B]=1,z.opt_len=z.static_len=0,z.last_lit=z.matches=0}function Le(z){8<z.bi_valid?Q(z,z.bi_buf):0<z.bi_valid&&(z.pending_buf[z.pending++]=z.bi_buf),z.bi_buf=0,z.bi_valid=0}function et(z,U,J,ge){var $=2*U,Ee=2*J;return z[$]<z[Ee]||z[$]===z[Ee]&&ge[U]<=ge[J]}function rt(z,U,J){for(var ge=z.heap[J],$=J<<1;$<=z.heap_len&&($<z.heap_len&&et(U,z.heap[$+1],z.heap[$],z.depth)&&$++,!et(U,ge,z.heap[$],z.depth));)z.heap[J]=z.heap[$],J=$,$<<=1;z.heap[J]=ge}function Et(z,U,J){var ge,$,Ee,Re,be=0;if(z.last_lit!==0)for(;ge=z.pending_buf[z.d_buf+2*be]<<8|z.pending_buf[z.d_buf+2*be+1],$=z.pending_buf[z.l_buf+be],be++,ge===0?Se(z,$,U):(Se(z,(Ee=I[$])+m+1,U),(Re=Z[Ee])!==0&&ye(z,$-=ae[Ee],Re),Se(z,Ee=q(--ge),J),(Re=ie[Ee])!==0&&ye(z,ge-=te[Ee],Re)),be<z.last_lit;);Se(z,B,U)}function Dt(z,U){var J,ge,$,Ee=U.dyn_tree,Re=U.stat_desc.static_tree,be=U.stat_desc.has_stree,ne=U.stat_desc.elems,ee=-1;for(z.heap_len=0,z.heap_max=w,J=0;J<ne;J++)Ee[2*J]!==0?(z.heap[++z.heap_len]=ee=J,z.depth[J]=0):Ee[2*J+1]=0;for(;z.heap_len<2;)Ee[2*($=z.heap[++z.heap_len]=ee<2?++ee:0)]=1,z.depth[$]=0,z.opt_len--,be&&(z.static_len-=Re[2*$+1]);for(U.max_code=ee,J=z.heap_len>>1;1<=J;J--)rt(z,Ee,J);for($=ne;J=z.heap[1],z.heap[1]=z.heap[z.heap_len--],rt(z,Ee,1),ge=z.heap[1],z.heap[--z.heap_max]=J,z.heap[--z.heap_max]=ge,Ee[2*$]=Ee[2*J]+Ee[2*ge],z.depth[$]=(z.depth[J]>=z.depth[ge]?z.depth[J]:z.depth[ge])+1,Ee[2*J+1]=Ee[2*ge+1]=$,z.heap[1]=$++,rt(z,Ee,1),2<=z.heap_len;);z.heap[--z.heap_max]=z.heap[1],function(xe,Ne){var Ve,Ze,ct,tt,ot,Ht,vt=Ne.dyn_tree,O=Ne.max_code,ce=Ne.stat_desc.static_tree,Me=Ne.stat_desc.has_stree,je=Ne.stat_desc.extra_bits,Ye=Ne.stat_desc.extra_base,it=Ne.stat_desc.max_length,he=0;for(tt=0;tt<=k;tt++)xe.bl_count[tt]=0;for(vt[2*xe.heap[xe.heap_max]+1]=0,Ve=xe.heap_max+1;Ve<w;Ve++)it<(tt=vt[2*vt[2*(Ze=xe.heap[Ve])+1]+1]+1)&&(tt=it,he++),vt[2*Ze+1]=tt,O<Ze||(xe.bl_count[tt]++,ot=0,Ye<=Ze&&(ot=je[Ze-Ye]),Ht=vt[2*Ze],xe.opt_len+=Ht*(tt+ot),Me&&(xe.static_len+=Ht*(ce[2*Ze+1]+ot)));if(he!==0){do{for(tt=it-1;xe.bl_count[tt]===0;)tt--;xe.bl_count[tt]--,xe.bl_count[tt+1]+=2,xe.bl_count[it]--,he-=2}while(0<he);for(tt=it;tt!==0;tt--)for(Ze=xe.bl_count[tt];Ze!==0;)O<(ct=xe.heap[--Ve])||(vt[2*ct+1]!==tt&&(xe.opt_len+=(tt-vt[2*ct+1])*vt[2*ct],vt[2*ct+1]=tt),Ze--)}}(z,U),He(Ee,ee,z.bl_count)}function v(z,U,J){var ge,$,Ee=-1,Re=U[1],be=0,ne=7,ee=4;for(Re===0&&(ne=138,ee=3),U[2*(J+1)+1]=65535,ge=0;ge<=J;ge++)$=Re,Re=U[2*(ge+1)+1],++be<ne&&$===Re||(be<ee?z.bl_tree[2*$]+=be:$!==0?($!==Ee&&z.bl_tree[2*$]++,z.bl_tree[2*H]++):be<=10?z.bl_tree[2*F]++:z.bl_tree[2*j]++,Ee=$,ee=(be=0)===Re?(ne=138,3):$===Re?(ne=6,3):(ne=7,4))}function pe(z,U,J){var ge,$,Ee=-1,Re=U[1],be=0,ne=7,ee=4;for(Re===0&&(ne=138,ee=3),ge=0;ge<=J;ge++)if($=Re,Re=U[2*(ge+1)+1],!(++be<ne&&$===Re)){if(be<ee)for(;Se(z,$,z.bl_tree),--be!=0;);else $!==0?($!==Ee&&(Se(z,$,z.bl_tree),be--),Se(z,H,z.bl_tree),ye(z,be-3,2)):be<=10?(Se(z,F,z.bl_tree),ye(z,be-3,3)):(Se(z,j,z.bl_tree),ye(z,be-11,7));Ee=$,ee=(be=0)===Re?(ne=138,3):$===Re?(ne=6,3):(ne=7,4)}}p(te);var de=!1;function Y(z,U,J,ge){ye(z,(g<<1)+(ge?1:0),3),function($,Ee,Re,be){Le($),Q($,Re),Q($,~Re),f.arraySet($.pending_buf,$.window,Ee,Re,$.pending),$.pending+=Re}(z,U,J)}u._tr_init=function(z){de||(function(){var U,J,ge,$,Ee,Re=new Array(k+1);for($=ge=0;$<A-1;$++)for(ae[$]=ge,U=0;U<1<<Z[$];U++)I[ge++]=$;for(I[ge-1]=$,$=Ee=0;$<16;$++)for(te[$]=Ee,U=0;U<1<<ie[$];U++)W[Ee++]=$;for(Ee>>=7;$<E;$++)for(te[$]=Ee<<7,U=0;U<1<<ie[$]-7;U++)W[256+Ee++]=$;for(J=0;J<=k;J++)Re[J]=0;for(U=0;U<=143;)re[2*U+1]=8,U++,Re[8]++;for(;U<=255;)re[2*U+1]=9,U++,Re[9]++;for(;U<=279;)re[2*U+1]=7,U++,Re[7]++;for(;U<=287;)re[2*U+1]=8,U++,Re[8]++;for(He(re,y+1,Re),U=0;U<E;U++)M[2*U+1]=5,M[2*U]=Oe(U,5);fe=new T(re,Z,m+1,y,k),se=new T(M,ie,0,E,k),ue=new T(new Array(0),L,0,x,D)}(),de=!0),z.l_desc=new V(z.dyn_ltree,fe),z.d_desc=new V(z.dyn_dtree,se),z.bl_desc=new V(z.bl_tree,ue),z.bi_buf=0,z.bi_valid=0,Ue(z)},u._tr_stored_block=Y,u._tr_flush_block=function(z,U,J,ge){var $,Ee,Re=0;0<z.level?(z.strm.data_type===2&&(z.strm.data_type=function(be){var ne,ee=4093624447;for(ne=0;ne<=31;ne++,ee>>>=1)if(1&ee&&be.dyn_ltree[2*ne]!==0)return c;if(be.dyn_ltree[18]!==0||be.dyn_ltree[20]!==0||be.dyn_ltree[26]!==0)return d;for(ne=32;ne<m;ne++)if(be.dyn_ltree[2*ne]!==0)return d;return c}(z)),Dt(z,z.l_desc),Dt(z,z.d_desc),Re=function(be){var ne;for(v(be,be.dyn_ltree,be.l_desc.max_code),v(be,be.dyn_dtree,be.d_desc.max_code),Dt(be,be.bl_desc),ne=x-1;3<=ne&&be.bl_tree[2*G[ne]+1]===0;ne--);return be.opt_len+=3*(ne+1)+5+5+4,ne}(z),$=z.opt_len+3+7>>>3,(Ee=z.static_len+3+7>>>3)<=$&&($=Ee)):$=Ee=J+5,J+4<=$&&U!==-1?Y(z,U,J,ge):z.strategy===4||Ee===$?(ye(z,2+(ge?1:0),3),Et(z,re,M)):(ye(z,4+(ge?1:0),3),function(be,ne,ee,xe){var Ne;for(ye(be,ne-257,5),ye(be,ee-1,5),ye(be,xe-4,4),Ne=0;Ne<xe;Ne++)ye(be,be.bl_tree[2*G[Ne]+1],3);pe(be,be.dyn_ltree,ne-1),pe(be,be.dyn_dtree,ee-1)}(z,z.l_desc.max_code+1,z.d_desc.max_code+1,Re+1),Et(z,z.dyn_ltree,z.dyn_dtree)),Ue(z),ge&&Le(z)},u._tr_tally=function(z,U,J){return z.pending_buf[z.d_buf+2*z.last_lit]=U>>>8&255,z.pending_buf[z.d_buf+2*z.last_lit+1]=255&U,z.pending_buf[z.l_buf+z.last_lit]=255&J,z.last_lit++,U===0?z.dyn_ltree[2*J]++:(z.matches++,U--,z.dyn_ltree[2*(I[J]+m+1)]++,z.dyn_dtree[2*q(U)]++),z.last_lit===z.lit_bufsize-1},u._tr_align=function(z){ye(z,2,3),Se(z,B,re),function(U){U.bi_valid===16?(Q(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(z)}},{"../utils/common":41}],53:[function(i,l,u){l.exports=function(){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}},{}],54:[function(i,l,u){(function(f){(function(c,d){if(!c.setImmediate){var p,g,A,m,y=1,E={},x=!1,w=c.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(c);k=k&&k.setTimeout?k:c,p={}.toString.call(c.process)==="[object process]"?function(H){process.nextTick(function(){D(H)})}:function(){if(c.postMessage&&!c.importScripts){var H=!0,F=c.onmessage;return c.onmessage=function(){H=!1},c.postMessage("","*"),c.onmessage=F,H}}()?(m="setImmediate$"+Math.random()+"$",c.addEventListener?c.addEventListener("message",B,!1):c.attachEvent("onmessage",B),function(H){c.postMessage(m+H,"*")}):c.MessageChannel?((A=new MessageChannel).port1.onmessage=function(H){D(H.data)},function(H){A.port2.postMessage(H)}):w&&"onreadystatechange"in w.createElement("script")?(g=w.documentElement,function(H){var F=w.createElement("script");F.onreadystatechange=function(){D(H),F.onreadystatechange=null,g.removeChild(F),F=null},g.appendChild(F)}):function(H){setTimeout(D,0,H)},k.setImmediate=function(H){typeof H!="function"&&(H=new Function(""+H));for(var F=new Array(arguments.length-1),j=0;j<F.length;j++)F[j]=arguments[j+1];var Z={callback:H,args:F};return E[y]=Z,p(y),y++},k.clearImmediate=C}function C(H){delete E[H]}function D(H){if(x)setTimeout(D,0,H);else{var F=E[H];if(F){x=!0;try{(function(j){var Z=j.callback,ie=j.args;switch(ie.length){case 0:Z();break;case 1:Z(ie[0]);break;case 2:Z(ie[0],ie[1]);break;case 3:Z(ie[0],ie[1],ie[2]);break;default:Z.apply(d,ie)}})(F)}finally{C(H),x=!1}}}}function B(H){H.source===c&&typeof H.data=="string"&&H.data.indexOf(m)===0&&D(+H.data.slice(m.length))}})(typeof self=="undefined"?f===void 0?this:f:self)}).call(this,typeof Wt!="undefined"?Wt:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})}(xd)),xd.exports}var nI=tI();const rI=Hn(nI),iI=n=>$e(null,null,function*(){const a=new rI;return n.forEach(l=>{a.file(l.name,l)}),yield a.generateAsync({type:"blob"})}),aI=(n,a)=>new File([n],a,{type:n.type}),hy=n=>n.length>1,oI=n=>{var a;return hy(n)?`uploaded_files_${Date.now()}.zip`:((a=n[0])==null?void 0:a.name)||"file"},lI=`${Yr.WEBSOCKET_URL}/ws/med-assist/session`;class sI{constructor(a){Pt(this,"ws",null);Pt(this,"config");Pt(this,"connectionState",Xn.DISCONNECTED);Pt(this,"reconnectAttempts",0);Pt(this,"maxConnectionAttempts",5);Pt(this,"maxReconnectAttempts",2);Pt(this,"connectionAttempts",0);Pt(this,"reconnectDelay",1e3);Pt(this,"eventCallbacks",new Map);Pt(this,"isReconnecting",!1);Pt(this,"pingInterval",null);Pt(this,"connectionTimeout",null);Pt(this,"currentStreamMessage",null);Pt(this,"pendingFileData",{files:[],message:"",format:void 0});var i,l,u;this.config={sessionId:a.sessionId,auth:a.auth,options:le({connectAttempts:5,reconnectAttempts:5,reconnectDelay:1e3,pingInterval:3e4,connectionTimeout:5e3},a.options)},this.maxReconnectAttempts=((i=this.config.options)==null?void 0:i.reconnectAttempts)||5,this.maxConnectionAttempts=((l=this.config.options)==null?void 0:l.connectAttempts)||5,this.reconnectDelay=((u=this.config.options)==null?void 0:u.reconnectDelay)||1e3}connect(){return $e(this,null,function*(){var a;try{if(this.isReconnecting||this.connectionState===Xn.CONNECTING){console.log("Connection already in progress, skipping from connect function");return}if(this.isConnected()){console.log("WebSocket is already connected");return}if(this.connectionAttempts>=this.maxConnectionAttempts){console.log("connection attempts exceeded",this.connectionAttempts),this.updateConnectionState(Xn.ERROR),this.triggerEvent(An.MAX_CONNECTION_ATTEMPTS_EXCEEDED,new Error("connection attempts exceeded"));return}this.updateConnectionState(Xn.CONNECTING),this.isReconnecting=!0,this.connectionAttempts==2&&(yield this.checkSessionDetails()),this.connectionAttempts++;const i=`${lI}/${this.config.sessionId}/`;if(console.log("Connecting to WebSocket:",i,"with session ID:",this.config.sessionId),this.ws=new WebSocket(i),this.setupWebSocketHandlers(),this.connectionTimeout=setTimeout(()=>{if(this.connectionState===Xn.CONNECTING){if(console.log("Connection timeout",this.reconnectAttempts,this.maxReconnectAttempts),this.isReconnecting=!1,this.updateConnectionState(Xn.ERROR),this.reconnectAttempts>=this.maxReconnectAttempts){this.triggerEvent(An.MAX_RECONNECTION_ATTEMPTS_EXCEEDED,new Error("Connection timeout after two retries"));return}this.cleanup(),this.triggerEvent(An.CONNECTION_TIMEOUT_ERROR,new Error("Connection timeout"))}},((a=this.config.options)==null?void 0:a.connectionTimeout)||5e3),!this.ws)throw new Error("WebSocket not initialized")}catch(i){throw console.error("Failed to connect:",i),this.isReconnecting=!1,this.updateConnectionState(Xn.ERROR),this.triggerEvent(An.CONNECTION_ERROR,i instanceof Error?i:new Error("Connection failed")),i}})}checkSessionDetails(){return $e(this,null,function*(){try{this.isReconnecting=!1;const a=yield sy(this.config.sessionId);if(console.log("sessionDetails response",a),a)this.isReconnecting=!0;else{this.isReconnecting=!1,this.updateConnectionState(Xn.ERROR),this.triggerEvent(en.CONNECTION_ESTABLISHED,!1),this.triggerEvent(An.SESSION_INACTIVE,new Error(Mt.SESSION_INACTIVE.title)),this.triggerEvent(An.START_NEW_SESSION,new Error("Session is invalid, starting new session")),this.cleanup();return}}catch(a){console.error("Error checking session details:",a),this.isReconnecting=!0}})}setupWebSocketHandlers(){this.ws&&(this.ws.onopen=()=>{console.log("WebSocket opened"),this.sendAuthMessage(),this.isReconnecting=!1,this.connectionAttempts=0,this.updateConnectionState(Xn.CONNECTED),this.startPingInterval()},this.ws.onmessage=a=>$e(this,null,function*(){try{const i=JSON.parse(a.data);yield this.handleServerMessage(i)}catch(i){console.error("Failed to parse WebSocket message:",i)}}),this.ws.onclose=a=>{console.log("WebSocket closed:",a.code,a),this.handleConnectionClose(a)},this.ws.onerror=a=>{console.error("WebSocket error:",a),this.isReconnecting=!1,this.updateConnectionState(Xn.ERROR),this.triggerEvent(en.ERROR,new Error("WebSocket error occurred"))})}handleServerMessage(a){return $e(this,null,function*(){switch(a.ev){case en.CONNECTION_ESTABLISHED:this.handleConnectionEstablished(a);break;case en.CHAT:this.handleChatMessage(a);break;case en.STREAM:this.handleStreamMessage(a);break;case en.END_OF_STREAM:this.handleEndOfStreamMessage(a);break;case en.PONG:this.handlePongMessage(a);break;case en.SYNC:this.handleSyncMessage(a);break;case en.ERROR:yield this.handleErrorMessage(a);break;default:console.warn("Unknown event type:",a.ev)}})}handleConnectionEstablished(a){this.triggerEvent(en.CONNECTION_ESTABLISHED,!0)}handleChatMessage(a){console.log("Chat message received:",a),this.triggerEvent(en.CHAT,a)}handleStreamMessage(a){var i;if(a.ct===$t.TEXT&&a.data){if(a.data.progress_msg){this.triggerEvent("progress_message",a.data.progress_msg);return}a.data.text&&(this.currentStreamMessage||(this.currentStreamMessage={id:a._id,content:"",timestamp:new Date,type:"text",metadata:{isStreaming:!0}}),this.currentStreamMessage.content+=a.data.text,this.triggerEvent("stream_chunk",{content:this.currentStreamMessage.content,messageId:a._id}))}else a.ct===$t.TIPS?(console.log("Tips message received:",a.data),(i=a.data.tips)!=null&&i.length&&this.triggerEvent(An.TIPS,a.data.tips)):this.triggerEvent(en.STREAM,a)}handleEndOfStreamMessage(a){a.ct===$t.TEXT&&this.currentStreamMessage?(this.currentStreamMessage.metadata=Fe(le({},this.currentStreamMessage.metadata),{isStreaming:!1}),this.triggerEvent(en.END_OF_STREAM,this.currentStreamMessage),this.currentStreamMessage=null):this.triggerEvent(en.END_OF_STREAM,a)}handlePongMessage(a){this.triggerEvent(en.PONG,a)}handleSyncMessage(a){this.triggerEvent(en.SYNC,a)}handleErrorMessage(a){return $e(this,null,function*(){this.triggerEvent(en.ERROR,a)})}handleConnectionClose(a){if(this.cleanup(),this.updateConnectionState(Xn.DISCONNECTED),this.triggerEvent(en.CONNECTION_ESTABLISHED,!1),a.code===1008){this.triggerEvent(An.SESSION_EXPIRED,new Error(Mt.SESSION_EXPIRED.title));return}a.code!==1e3&&!this.isReconnecting&&a.code==1008&&this.attemptReconnect()}attemptReconnect(){if(this.isReconnecting){console.log("Reconnection already in progress, skipping from attemptReconnect function");return}console.log(`Attempting to reconnect (${this.connectionAttempts+1}/${this.maxConnectionAttempts})`),setTimeout(()=>{this.connect().catch(a=>{console.error("Reconnection failed from attemptReconnect function:",a)})},this.reconnectDelay)}sendChatMessage({message:a,tool_use_id:i,hidden:l,tool_use_params:u}){if(!this.isConnected())throw new Error("WebSocket not connected");const f={ev:Na.CHAT,ct:$t.TEXT,ts:Date.now(),_id:Date.now().toString(),data:le(le(le({text:a},i&&{tool_use_id:i}),l&&{hidden:l}),u&&{tool_use_params:u})};this.sendMessage(f)}sendFileUploadRequest(){if(!this.isConnected())throw new Error("WebSocket is not connected");const a={ev:Na.CHAT,ct:$t.FILE,ts:Date.now(),_id:Date.now().toString(),data:{extension:this.pendingFileData.format}};this.sendMessage(a)}sendAuthMessage(){if(!this.isConnected())throw new Error("WebSocket is not connected");const a={ev:Na.AUTH,_id:Date.now().toString(),ts:Date.now(),data:{token:this.config.auth.token}};this.sendMessage(a)}sendFileUploadComplete(a){var u;if(!this.isConnected())throw new Error("WebSocket is not connected");const i=(u=this.pendingFileData)==null?void 0:u.message,l={ev:Na.CHAT,ct:$t.FILE,ts:Date.now(),_id:Date.now().toString(),data:le({url:a},i&&i.trim()&&{text:i.trim()})};this.sendMessage(l),this.clearPendingFiles()}setFilesForUpload(a,i){var f,c,d;const l=["application/pdf","image/jpeg","image/png","image/jpg","image/tiff","text/plain","text/markdown","image/heif","image/heic","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],u=a.filter(p=>l.includes(p.type))||[];this.pendingFileData.files=u,this.pendingFileData.format=u.length>1?"zip":((d=(c=(f=u[0].type)==null?void 0:f.split)==null?void 0:c.call(f,"/"))==null?void 0:d[1])||void 0,i!=null&&i.trim()&&(this.pendingFileData.message=i),console.log(`Set ${u.length} files for upload`)}clearPendingFiles(){this.pendingFileData.files=[],this.pendingFileData.message="",this.pendingFileData.format=void 0}clearStreamingState(){this.currentStreamMessage=null,console.log("Cleared streaming state")}reconnect(a,i){return $e(this,null,function*(){if(!a&&this.isReconnecting){console.log("Reconnection already in progress, skipping");return}if(a&&(this.isReconnecting=!1,this.connectionAttempts=0),this.reconnectAttempts===this.maxReconnectAttempts){this.updateConnectionState(Xn.ERROR),this.triggerEvent(An.MAX_RECONNECTION_ATTEMPTS_EXCEEDED,new Error("Maximum reconnection attempts exceeded"));return}this.reconnectAttempts++,console.log(`Initiating reconnection${i?` due to: ${i}`:""}...`),this.updateConnectionState(Xn.RECONNECTING);try{this.disconnect(),yield this.connect()}catch(l){console.error("Reconnection failed:",l),this.handleReconnectionError(l)}finally{this.isReconnecting=!1}})}handleReconnectionError(a){this.reconnectAttempts++,this.isReconnecting=!1,console.error("Reconnection error:",a),this.triggerEvent(An.CONNECTION_ERROR,a),this.reconnectAttempts===this.maxReconnectAttempts?(this.updateConnectionState(Xn.ERROR),this.triggerEvent(An.MAX_RECONNECTION_ATTEMPTS_EXCEEDED,new Error("Maximum reconnection attempts exceeded"))):this.attemptReconnect()}regenerateResponse(a){if(!this.isConnected())throw new Error("WebSocket is not connected");console.log("Regenerating response for:",a),this.clearStreamingState();const i={ev:Na.CHAT,ct:$t.TEXT,ts:Date.now(),_id:Date.now().toString(),data:{text:a}};this.sendMessage(i)}uploadFilesToPresignedUrl(a){return $e(this,null,function*(){var u,f,c,d,p,g;console.log("hi from uploadFilesToPresignedUrl");let i=0;const l=a.filter(A=>A&&A.trim());try{if(l.length===0)throw new Error("No valid presigned URLs provided");console.log(`Uploading ${(f=(u=this.pendingFileData)==null?void 0:u.files)==null?void 0:f.length} files to ${a.length} presigned URL(s)`);let A,m;if(hy(this.pendingFileData.files)){console.log("Multiple files detected, zipping before upload...");const y=yield iI(this.pendingFileData.files),E=oI(this.pendingFileData.files);A=aI(y,E),m="application/zip",console.log(`Zipped ${(d=(c=this.pendingFileData)==null?void 0:c.files)==null?void 0:d.length} files into ${E} (${(A.size/1024/1024).toFixed(2)} MB)`)}else A=(g=(p=this.pendingFileData)==null?void 0:p.files)==null?void 0:g[0],m=A.type,console.log(`Uploading single file: ${A.name} (${(A.size/1024/1024).toFixed(2)} MB)`);for(let y=0;y<l.length;y++){const E=l[y];console.log(`Uploading to URL ${y+1}/${l.length}: ${E}`);const x=yield fetch(E,{method:"PUT",body:A,headers:{"Content-Type":m,"x-ms-blob-type":"BlockBlob"}});if(!x.ok)throw new Error(`Failed to upload ${A.name} to URL ${y+1}: ${x.status} ${x.statusText}`);i++,console.log(`Successfully uploaded to URL ${y+1}/${l.length}`,x)}console.log("All file uploads completed successfully, calling sendFileUploadComplete"),this.sendFileUploadComplete(l[0])}catch(A){if(i>0){this.sendFileUploadComplete(l[0]);return}throw console.error("Error uploading files to presigned URL:",A),A}})}sendAudioData(a){if(!this.isConnected())throw new Error("WebSocket not connected");const i={ev:Na.STREAM,ct:$t.AUDIO,ts:Date.now(),_id:Date.now().toString(),data:{audio:a.audio,format:a.format}};console.log("Sending full audio data to backend:",i),this.sendMessage(i)}sendPing(){if(this.isConnected()){const a={ev:Na.PING,ts:Date.now(),_id:Date.now().toString()};this.sendMessage(a)}}on(a,i){this.eventCallbacks.has(a)||this.eventCallbacks.set(a,new Set),this.eventCallbacks.get(a).add(i)}off(a,i){var l;i?(l=this.eventCallbacks.get(a))==null||l.delete(i):this.eventCallbacks.delete(a)}triggerEvent(a,i){const l=this.eventCallbacks.get(a);l&&l.forEach(u=>{try{u(i)}catch(f){console.error("Error in event callback:",f)}})}startPingInterval(){var a;this.pingInterval&&clearInterval(this.pingInterval),this.pingInterval=setInterval(()=>{this.sendPing()},((a=this.config.options)==null?void 0:a.pingInterval)||3e4)}isConnected(){var a;return((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN}getConnectionState(){return this.connectionState}updateConfig(a){var i;a!=null&&a.sessionId&&(this.config.sessionId=a.sessionId),(i=a==null?void 0:a.auth)!=null&&i.token&&(this.config.auth.token=a.auth.token),console.log("WebSocket config updated:",this.config)}updateConnectionState(a){this.connectionState=a,console.log("Connection state updated:",a)}disconnect(){console.log("WebSocket disconnect called"),this.ws&&(this.ws.close(1e3,"Manual disconnect"),this.cleanup())}sendMessage(a){var i;if(((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN)this.ws.send(JSON.stringify(a));else throw new Error("WebSocket is not open")}getConfig(){return this.config}cleanup(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null),this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=null),this.clearPendingFiles(),this.clearStreamingState(),this.ws&&(this.ws.onopen=null,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null,this.ws=null)}}function uI(n,a,i,l,u,f){var ue;const c=K.useRef(null),d=K.useRef(0),p=K.useRef(null),g=Vt(te=>te.setError),A=Vt(te=>te.setShowRetryButton),m=Vt(te=>te.setStartNewConnection),y=Vt(te=>te.refreshSession),E=Vt(te=>te.setSessionId),x=Vt(te=>te.setSessionToken),w=K.useRef(!1),{setIsStreaming:k,isStreaming:C,connectionStatus:D,setConnectionStatus:B,clearResponseTimeout:H,clearStreamingTimeout:F,setLastStreamingActivity:j}=Vt();K.useEffect(()=>{var T,V,q,Q,ye,Se,Oe,He,Ue,Le,et,rt,Et,Dt,v,pe,de,Y,z;if(!n||!n.sessionId||!((T=n.auth)!=null&&T.token)){console.log("No config provided",n),B(xt.CONNECTING);return}if((V=c.current)!=null&&V.isConnected()){console.log("WebSocket already connected, skipping connection");return}const te=new sI(n);return console.log("WebSocket service created:",te),c.current=te,(q=c.current)==null||q.on(en.CONNECTION_ESTABLISHED,U=>{console.log("WebSocket connection:",U),B(xt.CONNECTED),U?(A(!1),m(!1),g(null),d.current=0):(A(!0),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED))}),(Q=c.current)==null||Q.on(en.PONG,U=>{}),c.current.on(en.SYNC,U=>{}),(ye=c.current)==null||ye.on(en.CHAT,U=>{if(U.ct===$t.FILE&&U.data&&"urls"in U.data){const J=U.data.urls||[];J.length>0&&te.uploadFilesToPresignedUrl(J).then(()=>{}).catch(ge=>{console.error("Failed to upload files:",ge),g(Mt.FILE_UPLOAD_FAILED)})}else if((U.ct===$t.PILL||U.ct===$t.MULTI||U.ct===$t.DOCTOR_CARD||U.ct===$t.MOBILE_VERIFICATION||U.ct===$t.LAB_PACKAGE_CARD)&&U.data&&U.data.tool_use_id){if(u){const J={type:U.ct,tool_use_id:U.data.tool_use_id,data:{choices:U.data.choices,doctor_details:U.data.doctor_details,lab_packages:U.data.lab_packages,callbacks:U.data.callbacks,additional_option:U.data.additional_option,url:U.data.url,mobile_number:U.data.mobile_number}};u(J,U._id)}}else U.ct===$t.TEXT&&U.data&&U.data.text&&U._id?(Vt.getState().isStreaming||(k(!0),H(),g(null)),j(Date.now()),a&&a(U.data.text,U._id),setTimeout(()=>{Vt.getState().isStreaming&&k(!1)},0)):U.ct===$t.INLINE_TEXT&&U.data&&U.data.text&&(Vt.getState().isStreaming||(k(!0),H()),j(Date.now()),f&&f(U.data.text),setTimeout(()=>{Vt.getState().isStreaming&&k(!1)},0))}),(Se=c.current)==null||Se.on(en.STREAM,U=>{Vt.getState().isStreaming||(k(!0),H(),g(null)),j(Date.now()),U.ct===$t.TEXT&&U.data&&U.data.text&&(U!=null&&U._id)&&a&&a(U.data.text,U._id)}),(Oe=c.current)==null||Oe.on("stream_chunk",({content:U,messageId:J})=>{C||(k(!0),H(),g(null)),j(Date.now()),a&&a(U,J)}),(He=c.current)==null||He.on(en.END_OF_STREAM,U=>{k(!1),F(),p.current=null,i&&i("")}),(Ue=c.current)==null||Ue.on(en.ERROR,U=>{switch(console.error("WebSocket error:",U),U.code){case Ci.SESSION_INACTIVE:{A(!1),m(!0),g(Mt.SESSION_INACTIVE);break}case Ci.SESSION_EXPIRED:{console.log("Session expired from useWebSocket"),I(),g(Mt.SESSION_EXPIRED);break}case Ci.INVALID_EVENT:{g(Mt.INVALID_EVENT);break}case Ci.INVALID_CONTENT_TYPE:{g(Mt.INVALID_CONTENT_TYPE);break}case Ci.PARSING_ERROR:{d.current<2?(console.log("Retrying..."),d.current++,A(!0),g(Mt.PARSING_ERROR)):(A(!1),m(!0),d.current=0,g(Mt.ERROR_PROCESSING_MESSAGE));break}case Ci.SERVER_ERROR:{A(!0),g(Mt.SERVER_ERROR);break}case Ci.TIMEOUT:{g(Mt.TIMEOUT),A(!0);break}case Ci.SESSION_TOKEN_MISMATCH:{g(Mt.SESSION_TOKEN_MISMATCH),A(!1),m(!0);break}default:{g({title:U.msg}),A(!0);break}}}),(Le=c.current)==null||Le.on(An.SESSION_INACTIVE,U=>{console.error("Session inactive:",U),A(!1),m(!0),g(Mt.SESSION_INACTIVE)}),(et=c.current)==null||et.on("progress_message",U=>{j(Date.now()),Vt.getState().isStreaming||(H(),g(null)),i&&(i(U),g(null))}),(rt=c.current)==null||rt.on(An.TIPS,U=>{j(Date.now()),l&&l(U)}),(Et=c.current)==null||Et.on("message",U=>{var J;((J=U.metadata)==null?void 0:J.isStreaming)===!1&&(k(!1),F(),g(null))}),(Dt=c.current)==null||Dt.on(An.MAX_CONNECTION_ATTEMPTS_EXCEEDED,U=>{console.log("MAX_CONNECTION_ATTEMPTS_EXCEEDED received:",U),A(!0),g(Mt.CONNECTION_ATTEMPTS_EXCEEDED)}),(v=c.current)==null||v.on(An.MAX_RECONNECTION_ATTEMPTS_EXCEEDED,U=>{console.log("MAX_RECONNECTION_ATTEMPTS_EXCEEDED received:",U),A(!1),m(!0)}),(pe=c.current)==null||pe.on(An.CONNECTION_TIMEOUT_ERROR,U=>{console.log("CONNECTION_TIMEOUT_ERROR received:",U),A(!0),g(Mt.CONNECTION_LOST)}),(de=c.current)==null||de.on(An.SESSION_REFRESHED,U=>{if(console.log("SESSION_REFRESHED received:",U),U){const J=Vt.getState();J.sessionId&&J.sessionToken&&(E(J.sessionId),x(J.sessionToken),c.current&&c.current.updateConfig({sessionId:J.sessionId,auth:{token:J.sessionToken}}),console.log("Session store updated after refresh"))}}),(Y=c.current)==null||Y.on(An.START_NEW_SESSION,U=>{A(!1),m(!0),g(Mt.SESSION_INACTIVE)}),(z=c.current)==null||z.on(An.SESSION_EXPIRED,U=>{A(!1),I(),g(Mt.SESSION_EXPIRED)}),te.connect().catch(U=>{console.error("Failed to connect to WebSocket:",U),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED)}),()=>{c.current&&(c.current.disconnect(),c.current=null),k(!1),F(),H(),g(null),j(null),p.current=null,A(!1),m(!1),B(xt.DISCONNECTED)}},[n==null?void 0:n.sessionId,(ue=n==null?void 0:n.auth)==null?void 0:ue.token,B]);const Z=({message:te,tool_use_id:T,tool_use_params:V})=>{var q;if((q=c.current)!=null&&q.isConnected())try{p.current={content:te,tool_use_id:T,type:"text"},c.current.sendChatMessage({message:te,tool_use_id:T,tool_use_params:V})}catch(Q){console.error("Failed to send text message:",Q),g(Q instanceof Error?{title:Q.message}:{title:"Failed to send message"})}else console.error("WebSocket not connected"),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED),A(!0)},ie=({message:te,tool_use_id:T,tool_use_params:V})=>{var q;if((q=c.current)!=null&&q.isConnected())try{c.current.sendChatMessage({message:te,tool_use_id:T,hidden:!0,tool_use_params:V})}catch(Q){console.error("Failed to send hidden text message:",Q)}else console.error("WebSocket not connected"),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED),A(!0)},L=te=>{var T;if((T=c.current)!=null&&T.isConnected())try{w.current||(w.current=!0),p.current={content:"🎤 Voice message sent",type:"audio",audioData:te},c.current.sendAudioData(te),w.current=!1}catch(V){console.error("Failed to send audio data:",V),g(V instanceof Error?{title:V.message}:{title:"Failed to send audio"})}else console.error("WebSocket not connected"),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED),A(!0)},G=()=>{c.current&&D===xt.CONNECTED&&c.current.sendFileUploadRequest()},re=(te,T)=>{p.current={content:T||`📎 ${te.length>1?`${te.length} files`:"File"} uploaded`,type:"file",files:te,message:T},c.current&&c.current.setFilesForUpload(te,T)},M=te=>{c.current&&D===xt.CONNECTED&&(k(!1),c.current.regenerateResponse(te))},W=()=>{g(null)},I=()=>$e(null,null,function*(){try{c.current&&c.current.disconnect();const te=yield y();return te?console.log("Manual session refresh successful"):(A(!1),m(!0),g(Mt.SESSION_EXPIRED),console.log("Manual session refresh failed")),te}catch(te){return console.error("Error during manual session refresh:",te),!1}}),ae=()=>$e(null,null,function*(){var T;if(!((T=c.current)!=null&&T.isConnected()))return console.error("WebSocket not connected, cannot retry message"),g(Mt.CONNECTION_LOST),B(xt.DISCONNECTED),A(!0),!1;if(!p.current)return console.error("No last message to retry"),!1;const te=p.current;try{switch(te.type){case"text":yield Z({message:te.content,tool_use_id:te.tool_use_id,tool_use_params:te.tool_use_params});break;case"audio":te.audioData&&(yield L(te.audioData));break;case"file":te.files&&(yield re(te.files,te.message),yield G());break;default:return console.error("Unknown message type for retry:",te.type),!1}return!0}catch(V){return console.error("Failed to retry last message:",V),g({title:"Failed to retry message. Please try again."}),!1}}),fe=()=>{var te;return((te=c.current)==null?void 0:te.isConnected())||!1},se=()=>{var te;return((te=c.current)==null?void 0:te.getConnectionState())||null};return{isAudioStreaming:w.current,isConnected:fe(),connectionState:se(),sendChatMessage:Z,sendAudioData:L,sendFileUploadRequest:G,setFilesForUpload:re,clearError:W,regenerateResponse:M,triggerSessionRefresh:I,retryLastMessage:ae,sendHiddenChatMessage:ie,webSocketService:c.current}}/**
|
|
350
|
-
* @license lucide-react v0.
|
|
350
|
+
* @license lucide-react v0.555.0 - ISC
|
|
351
351
|
*
|
|
352
352
|
* This source code is licensed under the ISC license.
|
|
353
353
|
* See the LICENSE file in the root directory of this source tree.
|
|
354
354
|
*/const cI=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fI=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,i,l)=>l?l.toUpperCase():i.toLowerCase()),py=n=>{const a=fI(n);return a.charAt(0).toUpperCase()+a.slice(1)},gy=(...n)=>n.filter((a,i,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===i).join(" ").trim(),dI=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
|
355
|
-
* @license lucide-react v0.
|
|
355
|
+
* @license lucide-react v0.555.0 - ISC
|
|
356
356
|
*
|
|
357
357
|
* This source code is licensed under the ISC license.
|
|
358
358
|
* See the LICENSE file in the root directory of this source tree.
|
|
359
359
|
*/var hI={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
360
|
-
* @license lucide-react v0.
|
|
360
|
+
* @license lucide-react v0.555.0 - ISC
|
|
361
361
|
*
|
|
362
362
|
* This source code is licensed under the ISC license.
|
|
363
363
|
* See the LICENSE file in the root directory of this source tree.
|
|
364
364
|
*/const pI=K.forwardRef((g,p)=>{var A=g,{color:n="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:u="",children:f,iconNode:c}=A,d=Rt(A,["color","size","strokeWidth","absoluteStrokeWidth","className","children","iconNode"]);return K.createElement("svg",le(le(Fe(le({ref:p},hI),{width:a,height:a,stroke:n,strokeWidth:l?Number(i)*24/Number(a):i,className:gy("lucide",u)}),!f&&!dI(d)&&{"aria-hidden":"true"}),d),[...c.map(([m,y])=>K.createElement(m,y)),...Array.isArray(f)?f:[f]])});/**
|
|
365
|
-
* @license lucide-react v0.
|
|
365
|
+
* @license lucide-react v0.555.0 - ISC
|
|
366
366
|
*
|
|
367
367
|
* This source code is licensed under the ISC license.
|
|
368
368
|
* See the LICENSE file in the root directory of this source tree.
|
|
369
369
|
*/const Cn=(n,a)=>{const i=K.forwardRef((c,f)=>{var d=c,{className:l}=d,u=Rt(d,["className"]);return K.createElement(pI,le({ref:f,iconNode:a,className:gy(`lucide-${cI(py(n))}`,`lucide-${n}`,l)},u))});return i.displayName=py(n),i};/**
|
|
370
|
-
* @license lucide-react v0.
|
|
370
|
+
* @license lucide-react v0.555.0 - ISC
|
|
371
371
|
*
|
|
372
372
|
* This source code is licensed under the ISC license.
|
|
373
373
|
* See the LICENSE file in the root directory of this source tree.
|
|
374
374
|
*/const gI=Cn("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
375
|
-
* @license lucide-react v0.
|
|
375
|
+
* @license lucide-react v0.555.0 - ISC
|
|
376
376
|
*
|
|
377
377
|
* This source code is licensed under the ISC license.
|
|
378
378
|
* See the LICENSE file in the root directory of this source tree.
|
|
379
|
-
*/const Cd=Cn("building-2",[["path",{d:"
|
|
380
|
-
* @license lucide-react v0.
|
|
379
|
+
*/const Cd=Cn("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]]);/**
|
|
380
|
+
* @license lucide-react v0.555.0 - ISC
|
|
381
381
|
*
|
|
382
382
|
* This source code is licensed under the ISC license.
|
|
383
383
|
* See the LICENSE file in the root directory of this source tree.
|
|
384
384
|
*/const mI=Cn("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
385
|
-
* @license lucide-react v0.
|
|
385
|
+
* @license lucide-react v0.555.0 - ISC
|
|
386
386
|
*
|
|
387
387
|
* This source code is licensed under the ISC license.
|
|
388
388
|
* See the LICENSE file in the root directory of this source tree.
|
|
389
389
|
*/const AI=Cn("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
390
|
-
* @license lucide-react v0.
|
|
390
|
+
* @license lucide-react v0.555.0 - ISC
|
|
391
391
|
*
|
|
392
392
|
* This source code is licensed under the ISC license.
|
|
393
393
|
* See the LICENSE file in the root directory of this source tree.
|
|
394
394
|
*/const yI=Cn("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
395
|
-
* @license lucide-react v0.
|
|
395
|
+
* @license lucide-react v0.555.0 - ISC
|
|
396
396
|
*
|
|
397
397
|
* This source code is licensed under the ISC license.
|
|
398
398
|
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
-
*/const EI=Cn("chevron-
|
|
400
|
-
* @license lucide-react v0.
|
|
399
|
+
*/const EI=Cn("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
400
|
+
* @license lucide-react v0.555.0 - ISC
|
|
401
401
|
*
|
|
402
402
|
* This source code is licensed under the ISC license.
|
|
403
403
|
* See the LICENSE file in the root directory of this source tree.
|
|
404
|
-
*/const wI=Cn("chevron-
|
|
405
|
-
* @license lucide-react v0.
|
|
404
|
+
*/const wI=Cn("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
405
|
+
* @license lucide-react v0.555.0 - ISC
|
|
406
406
|
*
|
|
407
407
|
* This source code is licensed under the ISC license.
|
|
408
408
|
* See the LICENSE file in the root directory of this source tree.
|
|
409
409
|
*/const bI=Cn("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
410
|
-
* @license lucide-react v0.
|
|
410
|
+
* @license lucide-react v0.555.0 - ISC
|
|
411
411
|
*
|
|
412
412
|
* This source code is licensed under the ISC license.
|
|
413
413
|
* See the LICENSE file in the root directory of this source tree.
|
|
414
|
-
*/const xI=Cn("file-text",[["path",{d:"
|
|
415
|
-
* @license lucide-react v0.
|
|
414
|
+
*/const xI=Cn("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
415
|
+
* @license lucide-react v0.555.0 - ISC
|
|
416
416
|
*
|
|
417
417
|
* This source code is licensed under the ISC license.
|
|
418
418
|
* See the LICENSE file in the root directory of this source tree.
|
|
419
419
|
*/const CI=Cn("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
|
|
420
|
-
* @license lucide-react v0.
|
|
420
|
+
* @license lucide-react v0.555.0 - ISC
|
|
421
421
|
*
|
|
422
422
|
* This source code is licensed under the ISC license.
|
|
423
423
|
* See the LICENSE file in the root directory of this source tree.
|
|
424
424
|
*/const Vl=Cn("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
425
|
-
* @license lucide-react v0.
|
|
425
|
+
* @license lucide-react v0.555.0 - ISC
|
|
426
426
|
*
|
|
427
427
|
* This source code is licensed under the ISC license.
|
|
428
428
|
* See the LICENSE file in the root directory of this source tree.
|
|
429
429
|
*/const vI=Cn("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
|
|
430
|
-
* @license lucide-react v0.
|
|
430
|
+
* @license lucide-react v0.555.0 - ISC
|
|
431
431
|
*
|
|
432
432
|
* This source code is licensed under the ISC license.
|
|
433
433
|
* See the LICENSE file in the root directory of this source tree.
|
|
434
434
|
*/const SI=Cn("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/**
|
|
435
|
-
* @license lucide-react v0.
|
|
435
|
+
* @license lucide-react v0.555.0 - ISC
|
|
436
436
|
*
|
|
437
437
|
* This source code is licensed under the ISC license.
|
|
438
438
|
* See the LICENSE file in the root directory of this source tree.
|
|
439
439
|
*/const kI=Cn("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]);/**
|
|
440
|
-
* @license lucide-react v0.
|
|
440
|
+
* @license lucide-react v0.555.0 - ISC
|
|
441
441
|
*
|
|
442
442
|
* This source code is licensed under the ISC license.
|
|
443
443
|
* See the LICENSE file in the root directory of this source tree.
|
|
444
444
|
*/const II=Cn("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);/**
|
|
445
|
-
* @license lucide-react v0.
|
|
445
|
+
* @license lucide-react v0.555.0 - ISC
|
|
446
446
|
*
|
|
447
447
|
* This source code is licensed under the ISC license.
|
|
448
448
|
* See the LICENSE file in the root directory of this source tree.
|
|
449
449
|
*/const my=Cn("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
450
|
-
* @license lucide-react v0.
|
|
450
|
+
* @license lucide-react v0.555.0 - ISC
|
|
451
451
|
*
|
|
452
452
|
* This source code is licensed under the ISC license.
|
|
453
453
|
* See the LICENSE file in the root directory of this source tree.
|
|
454
454
|
*/const vd=Cn("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
455
|
-
* @license lucide-react v0.
|
|
455
|
+
* @license lucide-react v0.555.0 - ISC
|
|
456
456
|
*
|
|
457
457
|
* This source code is licensed under the ISC license.
|
|
458
458
|
* See the LICENSE file in the root directory of this source tree.
|
|
459
459
|
*/const RI=Cn("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
|
|
460
|
-
* @license lucide-react v0.
|
|
460
|
+
* @license lucide-react v0.555.0 - ISC
|
|
461
461
|
*
|
|
462
462
|
* This source code is licensed under the ISC license.
|
|
463
463
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -474,7 +474,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
474
474
|
`});++l<n.length;)l&&i.push({type:"text",value:`
|
|
475
475
|
`}),i.push(n[l]);return a&&n.length>0&&i.push({type:"text",value:`
|
|
476
476
|
`}),i}function v0(n){let a=0,i=n.charCodeAt(a);for(;i===9||i===32;)a++,i=n.charCodeAt(a);return n.slice(a)}function S0(n,a){const i=rB(n,a),l=i.one(n,void 0),u=JT(i),f=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&f.children.push({type:"text",value:`
|
|
477
|
-
`},u),f}function sB(n,a){return n&&"run"in n?function(i,l){return $e(this,null,function*(){const u=S0(i,le({file:l},a));yield n.run(u,l)})}:function(i,l){return S0(i,le({file:l},n||a))}}function k0(n){if(n)throw n}var Wd,I0;function uB(){if(I0)return Wd;I0=1;var n=Object.prototype.hasOwnProperty,a=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=function(g){return typeof Array.isArray=="function"?Array.isArray(g):a.call(g)==="[object Array]"},f=function(g){if(!g||a.call(g)!=="[object Object]")return!1;var A=n.call(g,"constructor"),m=g.constructor&&g.constructor.prototype&&n.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!A&&!m)return!1;var y;for(y in g);return typeof y=="undefined"||n.call(g,y)},c=function(g,A){i&&A.name==="__proto__"?i(g,A.name,{enumerable:!0,configurable:!0,value:A.newValue,writable:!0}):g[A.name]=A.newValue},d=function(g,A){if(A==="__proto__")if(n.call(g,A)){if(l)return l(g,A).value}else return;return g[A]};return Wd=function p(){var g,A,m,y,E,x,w=arguments[0],k=1,C=arguments.length,D=!1;for(typeof w=="boolean"&&(D=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});k<C;++k)if(g=arguments[k],g!=null)for(A in g)m=d(w,A),y=d(g,A),w!==y&&(D&&y&&(f(y)||(E=u(y)))?(E?(E=!1,x=m&&u(m)?m:[]):x=m&&f(m)?m:{},c(w,{name:A,newValue:p(D,x,y)})):typeof y!="undefined"&&c(w,{name:A,newValue:y}));return w},Wd}var cB=uB();const $d=Hn(cB);function eh(n){if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function fB(){const n=[],a={run:i,use:l};return a;function i(...u){let f=-1;const c=u.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...u);function d(p,...g){const A=n[++f];let m=-1;if(p){c(p);return}for(;++m<u.length;)(g[m]===null||g[m]===void 0)&&(g[m]=u[m]);u=g,A?dB(A,d)(...g):c(null,...g)}}function l(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return n.push(u),a}}function dB(n,a){let i;return l;function l(...c){const d=n.length>c.length;let p;d&&c.push(u);try{p=n.apply(this,c)}catch(g){const A=g;if(d&&i)throw A;return u(A)}d||(p&&p.then&&typeof p.then=="function"?p.then(f,u):p instanceof Error?u(p):f(p))}function u(c,...d){i||(i=!0,a(c,...d))}function f(c){u(null,c)}}const ni={basename:hB,dirname:pB,extname:gB,join:mB,sep:"/"};function hB(n,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');as(n);let i=0,l=-1,u=n.length,f;if(a===void 0||a.length===0||a.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(f){i=u+1;break}}else l<0&&(f=!0,l=u+1);return l<0?"":n.slice(i,l)}if(a===n)return"";let c=-1,d=a.length-1;for(;u--;)if(n.codePointAt(u)===47){if(f){i=u+1;break}}else c<0&&(f=!0,c=u+1),d>-1&&(n.codePointAt(u)===a.codePointAt(d--)?d<0&&(l=u):(d=-1,l=c));return i===l?l=c:l<0&&(l=n.length),n.slice(i,l)}function pB(n){if(as(n),n.length===0)return".";let a=-1,i=n.length,l;for(;--i;)if(n.codePointAt(i)===47){if(l){a=i;break}}else l||(l=!0);return a<0?n.codePointAt(0)===47?"/":".":a===1&&n.codePointAt(0)===47?"//":n.slice(0,a)}function gB(n){as(n);let a=n.length,i=-1,l=0,u=-1,f=0,c;for(;a--;){const d=n.codePointAt(a);if(d===47){if(c){l=a+1;break}continue}i<0&&(c=!0,i=a+1),d===46?u<0?u=a:f!==1&&(f=1):u>-1&&(f=-1)}return u<0||i<0||f===0||f===1&&u===i-1&&u===l+1?"":n.slice(u,i)}function mB(...n){let a=-1,i;for(;++a<n.length;)as(n[a]),n[a]&&(i=i===void 0?n[a]:i+"/"+n[a]);return i===void 0?".":AB(i)}function AB(n){as(n);const a=n.codePointAt(0)===47;let i=yB(n,!a);return i.length===0&&!a&&(i="."),i.length>0&&n.codePointAt(n.length-1)===47&&(i+="/"),a?"/"+i:i}function yB(n,a){let i="",l=0,u=-1,f=0,c=-1,d,p;for(;++c<=n.length;){if(c<n.length)d=n.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(u===c-1||f===1))if(u!==c-1&&f===2){if(i.length<2||l!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(p=i.lastIndexOf("/"),p!==i.length-1){p<0?(i="",l=0):(i=i.slice(0,p),l=i.length-1-i.lastIndexOf("/")),u=c,f=0;continue}}else if(i.length>0){i="",l=0,u=c,f=0;continue}}a&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+n.slice(u+1,c):i=n.slice(u+1,c),l=c-u-1;u=c,f=0}else d===46&&f>-1?f++:f=-1}return i}function as(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const EB={cwd:wB};function wB(){return"/"}function th(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function bB(n){if(typeof n=="string")n=new URL(n);else if(!th(n)){const a=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw a.code="ERR_INVALID_ARG_TYPE",a}if(n.protocol!=="file:"){const a=new TypeError("The URL must be of scheme file");throw a.code="ERR_INVALID_URL_SCHEME",a}return xB(n)}function xB(n){if(n.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const a=n.pathname;let i=-1;for(;++i<a.length;)if(a.codePointAt(i)===37&&a.codePointAt(i+1)===50){const l=a.codePointAt(i+2);if(l===70||l===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(a)}const nh=["history","path","basename","stem","extname","dirname"];class R0{constructor(a){let i;a?th(a)?i={path:a}:typeof a=="string"||CB(a)?i={value:a}:i=a:i={},this.cwd="cwd"in i?"":EB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<nh.length;){const f=nh[l];f in i&&i[f]!==void 0&&i[f]!==null&&(this[f]=f==="history"?[...i[f]]:i[f])}let u;for(u in i)nh.includes(u)||(this[u]=i[u])}get basename(){return typeof this.path=="string"?ni.basename(this.path):void 0}set basename(a){ih(a,"basename"),rh(a,"basename"),this.path=ni.join(this.dirname||"",a)}get dirname(){return typeof this.path=="string"?ni.dirname(this.path):void 0}set dirname(a){D0(this.basename,"dirname"),this.path=ni.join(a||"",this.basename)}get extname(){return typeof this.path=="string"?ni.extname(this.path):void 0}set extname(a){if(rh(a,"extname"),D0(this.dirname,"extname"),a){if(a.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(a.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ni.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){th(a)&&(a=bB(a)),ih(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return typeof this.path=="string"?ni.basename(this.path,this.extname):void 0}set stem(a){ih(a,"stem"),rh(a,"stem"),this.path=ni.join(this.dirname||"",a+(this.extname||""))}fail(a,i,l){const u=this.message(a,i,l);throw u.fatal=!0,u}info(a,i,l){const u=this.message(a,i,l);return u.fatal=void 0,u}message(a,i,l){const u=new Yn(a,i,l);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(a){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(a||void 0).decode(this.value)}}function rh(n,a){if(n&&n.includes(ni.sep))throw new Error("`"+a+"` cannot be a path: did not expect `"+ni.sep+"`")}function ih(n,a){if(!n)throw new Error("`"+a+"` cannot be empty")}function D0(n,a){if(!n)throw new Error("Setting `"+a+"` requires `path` to be set too")}function CB(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const vB=function(n){const l=this.constructor.prototype,u=l[n],f=function(){return u.apply(f,arguments)};return Object.setPrototypeOf(f,l),f},SB={}.hasOwnProperty;class ah extends vB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=fB()}copy(){const a=new ah;let i=-1;for(;++i<this.attachers.length;){const l=this.attachers[i];a.use(...l)}return a.data($d(!0,{},this.namespace)),a}data(a,i){return typeof a=="string"?arguments.length===2?(sh("data",this.frozen),this.namespace[a]=i,this):SB.call(this.namespace,a)&&this.namespace[a]||void 0:a?(sh("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;const a=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const u=i.call(a,...l);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(a){this.freeze();const i=rc(a),l=this.parser||this.Parser;return oh("parse",l),l(String(i),i)}process(a,i){const l=this;return this.freeze(),oh("process",this.parser||this.Parser),lh("process",this.compiler||this.Compiler),i?u(void 0,i):new Promise(u);function u(f,c){const d=rc(a),p=l.parse(d);l.run(p,d,function(A,m,y){if(A||!m||!y)return g(A);const E=m,x=l.stringify(E,y);RB(x)?y.value=x:y.result=x,g(A,y)});function g(A,m){A||!m?c(A):f?f(m):i(void 0,m)}}}processSync(a){let i=!1,l;return this.freeze(),oh("processSync",this.parser||this.Parser),lh("processSync",this.compiler||this.Compiler),this.process(a,u),B0("processSync","process",i),l;function u(f,c){i=!0,k0(f),l=c}}run(a,i,l){T0(a),this.freeze();const u=this.transformers;return!l&&typeof i=="function"&&(l=i,i=void 0),l?f(void 0,l):new Promise(f);function f(c,d){const p=rc(i);u.run(a,p,g);function g(A,m,y){const E=m||a;A?d(A):c?c(E):l(void 0,E,y)}}}runSync(a,i){let l=!1,u;return this.run(a,i,f),B0("runSync","run",l),u;function f(c,d){k0(c),u=d,l=!0}}stringify(a,i){this.freeze();const l=rc(i),u=this.compiler||this.Compiler;return lh("stringify",u),T0(a),u(a,l)}use(a,...i){const l=this.attachers,u=this.namespace;if(sh("use",this.frozen),a!=null)if(typeof a=="function")p(a,i);else if(typeof a=="object")Array.isArray(a)?d(a):c(a);else throw new TypeError("Expected usable value, not `"+a+"`");return this;function f(g){if(typeof g=="function")p(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[A,...m]=g;p(A,m)}else c(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function c(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(g.plugins),g.settings&&(u.settings=$d(!0,u.settings,g.settings))}function d(g){let A=-1;if(g!=null)if(Array.isArray(g))for(;++A<g.length;){const m=g[A];f(m)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function p(g,A){let m=-1,y=-1;for(;++m<l.length;)if(l[m][0]===g){y=m;break}if(y===-1)l.push([g,...A]);else if(A.length>0){let[E,...x]=A;const w=l[y][1];eh(w)&&eh(E)&&(E=$d(!0,w,E)),l[y]=[g,E,...x]}}}}const kB=new ah().freeze();function oh(n,a){if(typeof a!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function lh(n,a){if(typeof a!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function sh(n,a){if(a)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function T0(n){if(!eh(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function B0(n,a,i){if(!i)throw new Error("`"+n+"` finished async. Use `"+a+"` instead")}function rc(n){return IB(n)?n:new R0(n)}function IB(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function RB(n){return typeof n=="string"||DB(n)}function DB(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const TB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",M0=[],Q0={allowDangerousHtml:!0},BB=/^(https?|ircs?|mailto|xmpp)$/i,MB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function O0(n){const a=QB(n),i=OB(n);return UB(a.runSync(a.parse(i),i),n)}function QB(n){const a=n.rehypePlugins||M0,i=n.remarkPlugins||M0,l=n.remarkRehypeOptions?le(le({},n.remarkRehypeOptions),Q0):Q0;return kB().use(pT).use(i).use(sB,l).use(a)}function OB(n){const a=n.children||"",i=new R0;return typeof a=="string"&&(i.value=a),i}function UB(n,a){const i=a.allowedElements,l=a.allowElement,u=a.components,f=a.disallowedElements,c=a.skipHtml,d=a.unwrapDisallowed,p=a.urlTransform||NB;for(const A of MB)Object.hasOwn(a,A.from)&&(""+A.from+(A.to?"use `"+A.to+"` instead":"remove it")+TB+A.id,void 0);return Xd(n,g),oR(n,{Fragment:R.Fragment,components:u,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function g(A,m,y){if(A.type==="raw"&&y&&typeof m=="number")return c?y.children.splice(m,1):y.children[m]={type:"text",value:A.value},m;if(A.type==="element"){let E;for(E in jd)if(Object.hasOwn(jd,E)&&Object.hasOwn(A.properties,E)){const x=A.properties[E],w=jd[E];(w===null||w.includes(A.tagName))&&(A.properties[E]=p(String(x||""),E,A))}}if(A.type==="element"){let E=i?!i.includes(A.tagName):f?f.includes(A.tagName):!1;if(!E&&l&&typeof m=="number"&&(E=!l(A,m,y)),E&&y&&typeof m=="number")return d&&A.children?y.children.splice(m,1,...A.children):y.children.splice(m,1),m}}}function NB(n){const a=n.indexOf(":"),i=n.indexOf("?"),l=n.indexOf("#"),u=n.indexOf("/");return a===-1||u!==-1&&a>u||i!==-1&&a>i||l!==-1&&a>l||BB.test(n.slice(0,a))?n:""}function jB({doctor:n,availability:a,callbacks:i,onBook:l,disabled:u=!1,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c}){var Oe,He,Ue,Le,et,rt,Et,Dt,v,pe,de,Y,z;const[d,p]=K.useState(!1),[g,A]=K.useState(0),[m,y]=K.useState(null),[E,x]=K.useState(0),[w,k]=K.useState(n.hospitals[0]||null),[C,D]=K.useState(!0),[B,H]=K.useState(!1),[F,j]=K.useState(null),[Z,ie]=K.useState(!1),[L,G]=K.useState(null),re=Vt(U=>U.sessionId);K.useEffect(()=>{var $,Ee,Re,be,ne,ee;if(!(w!=null&&w.hospital_id))return;const U=w.hospital_id,J=((Re=(Ee=($=F==null?void 0:F[U])==null?void 0:$.slots_details)==null?void 0:Ee.length)!=null?Re:0)>0,ge=((ee=(ne=(be=a==null?void 0:a[U])==null?void 0:be.slots_details)==null?void 0:ne.length)!=null?ee:0)>0;i!=null&&i.tool_callback_availability_dates&&n.doctor_id&&re&&!J&&!ge?Q():(J||ge)&&D(!1)},[i==null?void 0:i.tool_callback_availability_dates,F,w==null?void 0:w.hospital_id,a]);const M=K.useMemo(()=>{if(!(w!=null&&w.hospital_id))return a||null;const U=w.hospital_id,J=F==null?void 0:F[U],ge=a==null?void 0:a[U];return J?Fe(le({},a||{}),{[U]:J}):ge?a:a||null},[F,a,w==null?void 0:w.hospital_id]);K.useEffect(()=>{var $,Ee,Re,be,ne,ee;if(!(w!=null&&w.hospital_id))return;const U=w.hospital_id,J=((Re=(Ee=($=F==null?void 0:F[U])==null?void 0:$.slots_details)==null?void 0:Ee.length)!=null?Re:0)>0,ge=((ee=(ne=(be=a==null?void 0:a[U])==null?void 0:be.slots_details)==null?void 0:ne.length)!=null?ee:0)>0;ie(!1),A(0),x(0),y(null),G(null),!J&&!ge&&(i!=null&&i.tool_callback_availability_dates)?(console.log("No cached data for hospital, fetching...",w.name),Q()):(console.log("Using cached/initial data for hospital",w.name),D(!1))},[w==null?void 0:w.hospital_id]);const W=K.useMemo(()=>{var J,ge,$,Ee;if(!(w!=null&&w.hospital_id)||!((ge=(J=M==null?void 0:M[(w==null?void 0:w.hospital_id)||""])==null?void 0:J.slots_details)!=null&&ge.length))return new Date;const U=(Ee=($=M==null?void 0:M[w.hospital_id])==null?void 0:$.slots_details)==null?void 0:Ee[0];return U?new Date(U.date):new Date},[M]);K.useEffect(()=>{var $,Ee;const U=w==null?void 0:w.hospital_id,J=U?M==null?void 0:M[U]:null,ge=(J==null?void 0:J.slots_details)||[];if(U&&ge.length>0&&!Z){let Re=0;const be=(J==null?void 0:J.selected_date)||(($=a==null?void 0:a[U])==null?void 0:$.selected_date);if(be){const xe=ge.findIndex(Ne=>Ne.date===be);xe>=0&&(Re=xe)}else{const xe=((Ee=a==null?void 0:a[U])==null?void 0:Ee.slots_details)||[],Ne=ge.findIndex(Ve=>{const Ze=xe.find(ct=>ct.date===Ve.date);return Ze&&Ze.slots&&Ze.slots.length>0});Ne>=0&&(Re=Ne)}A(Re);const ne=Math.floor(Re/3)*3;x(ne);const ee=ge[Re];ee&&(!(ee!=null&&ee.slots)||ee.slots.length===0)&&(i!=null&&i.tool_callback_availability_slots)&&n.doctor_id&&(w!=null&&w.hospital_id)&&(w!=null&&w.region_id)&&re&&!C&&setTimeout(()=>{ye(ee.date)},0)}},[M,w==null?void 0:w.hospital_id,a,Z,C]);const I=K.useMemo(()=>{var $;const U=[],J=w==null?void 0:w.hospital_id,ge=J?($=M==null?void 0:M[J])==null?void 0:$.slots_details:null;if(ge&&ge.length>0){const Ee=Math.max(0,Math.floor(E/3)*3),Re=Math.min(ge.length,Ee+3);for(let be=Ee;be<Re;be++){const ne=ge[be],ee=new Date(ne.date),xe=ee.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),Ne=ee.toLocaleDateString(void 0,{day:"2-digit"});U.push({weekday:xe,dayNum:Ne,date:ne.date,hasAvailability:!0,fullDate:ee,hasSlots:ne.slots&&ne.slots.length>0})}}else{const Ee=new Date(W);Ee.setDate(Ee.getDate()+E);for(let Re=0;Re<3;Re++){const be=new Date(Ee);be.setDate(Ee.getDate()+Re);const ne=be.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),ee=be.toLocaleDateString(void 0,{day:"2-digit"}),xe=be.toISOString().split("T")[0];U.push({weekday:ne,dayNum:ee,date:xe,hasAvailability:!1,fullDate:be,hasSlots:!1})}}return U},[W,E,M,w==null?void 0:w.hospital_id]),ae=K.useMemo(()=>{var ge;const U=w==null?void 0:w.hospital_id,J=U?(ge=M==null?void 0:M[U])==null?void 0:ge.slots_details:null;return(J==null?void 0:J[g])||null},[M,w==null?void 0:w.hospital_id,g]),fe=((Oe=n.name)==null?void 0:Oe.split(" ").map(U=>U[0]).slice(0,2).join("").toUpperCase())||"DR";function se(){ie(!0),x(U=>Math.max(0,U-3)),y(null)}function ue(){var $;ie(!0);const U=w==null?void 0:w.hospital_id,J=U?($=M==null?void 0:M[U])==null?void 0:$.slots_details:null,ge=J!=null&&J.length?Math.max(0,J.length-3):0;x(Ee=>Math.min(ge,Ee+3)),y(null)}function te(U){var Re,be;ie(!0);const J=w==null?void 0:w.hospital_id,ge=J?(Re=M==null?void 0:M[J])==null?void 0:Re.slots_details:null,$=(be=ge==null?void 0:ge.findIndex(ne=>ne.date===U))!=null?be:-1;$>=0&&A($),y(null);const Ee=ge==null?void 0:ge.find(ne=>ne.date===U);i!=null&&i.tool_callback_availability_slots&&(!(Ee!=null&&Ee.slots)||Ee.slots.length===0)&&n.doctor_id&&(w!=null&&w.hospital_id)&&(w!=null&&w.region_id)&&re&&ye(U)}const T=K.useMemo(()=>E>0,[E]),V=K.useMemo(()=>{var $;const U=w==null?void 0:w.hospital_id,J=U?($=M==null?void 0:M[U])==null?void 0:$.slots_details:null;if(!J||J.length===0)return!1;const ge=Math.max(0,J.length-3);return E<ge},[E,M,w==null?void 0:w.hospital_id]);function q(){l&&ae&&m&&l({date:ae.date,time:m,doctorData:{doctor:n,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""}})}const Q=()=>$e(null,null,function*(){var U,J,ge,$,Ee,Re;if(console.log("called loadAvailabilityDates"),!n.doctor_id||!re||!(w!=null&&w.hospital_id)){console.warn("Missing required parameters for loading availability dates");return}D(!0),console.log("loading availability dates",w==null?void 0:w.name);try{let be;const ne=yield f({doctor_id:n.doctor_id,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""});if(!ne.success){(J=(U=ne.data)==null?void 0:U.error)!=null&&J.msg&&G(($=(ge=ne.data)==null?void 0:ge.error)==null?void 0:$.msg),console.error("Failed to load availability dates via handler",ne);return}be=ne.data;const ee=be.available_dates.map(ot=>({date:ot,slots:[]})),xe=(w==null?void 0:w.hospital_id)||"",Ne=((Ee=a==null?void 0:a[xe])==null?void 0:Ee.slots_details)||[],Ve=((Re=F==null?void 0:F[xe])==null?void 0:Re.slots_details)||[],Ze=new Map;Ne.forEach(ot=>{Ze.set(ot.date,ot)}),Ve.forEach(ot=>{Ze.set(ot.date,ot)});const tt=[...Array.from(Ze.values())];ee.forEach(ot=>{Ze.has(ot.date)||tt.push(ot)}),tt.sort((ot,Ht)=>new Date(ot.date).getTime()-new Date(Ht.date).getTime()),console.log("merged slots",tt),j(ot=>Fe(le({},ot||{}),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:tt}}))}catch(be){console.error("Error loading availability dates:",be)}finally{D(!1)}}),ye=U=>$e(null,null,function*(){if(!n.doctor_id||!(w!=null&&w.hospital_id)||!(w!=null&&w.region_id)||!re){console.warn("Missing required parameters for loading slots");return}H(!0);try{let J;const ge=yield c(U,{doctor_id:n.doctor_id,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""});if(!ge.success){console.error("Failed to load slots via handler");return}J=ge.data,j($=>{var ne,ee,xe,Ne,Ve,Ze;if(!$||!((ee=(ne=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:ne.slots_details)!=null&&ee.length))return Fe(le({},$||{}),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:[{date:U,slots:J.slots}]}});const Ee=(Ne=(xe=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:xe.slots_details)==null?void 0:Ne.map(ct=>ct.date===U?Fe(le({},ct),{slots:J.slots}):ct),be=((Ze=(Ve=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:Ve.slots_details)==null?void 0:Ze.some(ct=>ct.date===U))?Ee:[...Ee||[],{date:U,slots:J.slots}];return be&&be.length>0&&be.sort((ct,tt)=>new Date(ct.date).getTime()-new Date(tt.date).getTime()),Fe(le({},$),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:be}})})}catch(J){console.error("Error loading slots for date:",J)}finally{H(!1)}}),Se=U=>{const J=n.hospitals.find(ge=>ge.hospital_id===U);console.log("hospitalId",U,J),J&&(console.log("hospital selected",J),k(J))};return R.jsxs(sd,{className:"max-w-md rounded-xl border-slate-200 shadow-sm p-0","aria-label":"Appointment card",children:[R.jsx(fA,{className:"flex flex-row items-center justify-between gap-3 bg-[var(--color-background-primary-subtle)] rounded-t-xl p-4",children:R.jsxs("div",{className:"flex items-center gap-3",children:[n.profile_pic&&R.jsxs(kA,{className:"h-12 w-12",children:[R.jsx(IA,{src:n.profile_pic,alt:`${n.name} profile photo`,crossOrigin:"anonymous"}),R.jsx(RA,{children:fe})]}),R.jsxs("div",{className:"min-w-0",children:[R.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[R.jsx("h3",{className:" text-base font-bold text-slate-900",children:n.name}),n.profile_link?R.jsx("a",{href:n.profile_link,target:"_blank",rel:"noreferrer",className:"text-xs font-semibold text-[var(--color-primary)] hover:underline",children:"View profile"}):null]}),R.jsxs("p",{className:"mt-0.5 text-sm text-slate-500",children:[n.specialty,n.experience&&R.jsxs(R.Fragment,{children:[" • ",n.experience]})]})]})]})}),R.jsxs(dA,{className:"px-4 pb-2",children:[R.jsxs("div",{className:"grid gap-2 border-b border-slate-200 pb-3",children:[(n==null?void 0:n.timings)&&R.jsxs("div",{className:"flex items-start gap-2 text-sm text-slate-900",children:[R.jsx(bI,{className:"h-4 w-4 text-[var(--color-primary)] mt-0.5 flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-500 text-xs",children:n==null?void 0:n.timings})]}),n.languages?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(CI,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),R.jsx("span",{className:"text-slate-500",children:n.languages})]}):null,n!=null&&n.hospitals&&((He=n.hospitals)==null?void 0:He.length)>1?w&&w.name&&R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),R.jsx(Fk,{options:n.hospitals.map(U=>({value:U.hospital_id,label:U.name})),placeholder:"Select Hospital",disabled:u,onValueChange:Se,value:(w==null?void 0:w.hospital_id)||""})]}):w&&w.name&&R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),w.name]})]}),w!=null&&w.hospital_id&&((Le=(Ue=M==null?void 0:M[w==null?void 0:w.hospital_id])==null?void 0:Ue.slots_details)!=null&&Le.length)||i!=null&&i.tool_callback_availability_dates||C?R.jsx(Bt,{type:"button",variant:"outline","aria-expanded":d,"aria-controls":"ap-slots",onClick:()=>p(U=>!U),disabled:C,className:"mt-3 w-full border-[var(--color-primary)] text-[var(--color-primary)] hover:bg-[var(--color-background-primary-subtle)] disabled:opacity-50",children:C?R.jsxs(R.Fragment,{children:[R.jsx(Vl,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading availability..."]}):R.jsxs(R.Fragment,{children:[R.jsx("span",{className:"mr-1",children:d?"Hide slots":"Show available slots"}),R.jsx(yI,{className:`h-4 w-4 transition-transform ${d?"rotate-180":""}`,"aria-hidden":!0})]})}):R.jsx("div",{className:"mt-3 w-full flex items-center justify-center py-3 px-4 bg-gray-50 border border-gray-200 rounded-lg",children:R.jsx("span",{className:"text-sm text-gray-500 font-medium",children:"No details available"})}),d&&(w==null?void 0:w.hospital_id)&&((rt=(et=M==null?void 0:M[w==null?void 0:w.hospital_id])==null?void 0:et.slots_details)==null?void 0:rt.length)&&R.jsx("div",{id:"ap-slots",role:"region","aria-label":"Available slots",className:"pt-3",children:(v=(Dt=M==null?void 0:M[(Et=w==null?void 0:w.hospital_id)!=null?Et:""])==null?void 0:Dt.slots_details)!=null&&v.length?R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"flex items-center gap-2 px-0.5",children:[R.jsx(Bt,{type:"button",variant:"outline",size:"icon",onClick:se,"aria-label":"Previous 3 days",disabled:u||!T,className:"h-8 w-8 flex-shrink-0 rounded-md border-slate-200 bg-transparent text-slate-900 disabled:opacity-50",children:R.jsx(EI,{className:"h-4 w-4"})}),R.jsx("div",{className:"flex-1 grid grid-cols-3 gap-1 min-w-0",children:I.map((U,J)=>{const ge=(ae==null?void 0:ae.date)===U.date,$=!U.hasAvailability;return R.jsxs(Bt,{type:"button",variant:"outline",onClick:()=>!$&&te(U.date),disabled:$||u,"aria-current":ge?"date":void 0,className:["flex flex-col items-center justify-center h-12 rounded-lg border p-2 gap-0.5 min-w-0",ge?"border-[var(--color-primary)] ring-2 ring-[var(--color-background-primary-subtle)] bg-[var(--color-background-primary-subtle)]":$?"border-slate-100 bg-slate-50 text-slate-300 cursor-not-allowed":"border-slate-200 bg-white hover:bg-slate-50"].join(" "),children:[R.jsx("span",{className:["text-[10px] tracking-wide w-full text-center",ge?"text-[var(--color-primary)]":$?"text-slate-300":"text-slate-500"].join(" "),children:U.weekday}),R.jsx("span",{className:["text-xs font-bold w-full text-center",ge?"text-[var(--color-primary)]":$?"text-slate-300":"text-slate-900"].join(" "),children:U.dayNum})]},`${U.date}-${J}`)})}),R.jsx(Bt,{type:"button",variant:"outline",size:"icon",onClick:ue,"aria-label":"Next 3 days",disabled:u||!V,className:"h-8 w-8 flex-shrink-0 rounded-md border-slate-200 bg-transparent text-slate-900 disabled:opacity-50",children:R.jsx(wI,{className:"h-4 w-4"})})]}),R.jsx("div",{className:"px-0.5 py-3",children:B?R.jsxs("div",{className:"flex items-center justify-center py-4",children:[R.jsx(Vl,{className:"h-4 w-4 animate-spin text-[var(--color-primary)] mr-2"}),R.jsx("span",{className:"text-sm text-slate-500",children:"Loading slots..."})]}):(pe=ae==null?void 0:ae.slots)!=null&&pe.length?R.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-48 overflow-y-auto",children:ae.slots.map((U,J)=>{const ge=m===U;return R.jsxs(Bt,{type:"button",variant:"outline",onClick:()=>y(U),"aria-pressed":ge,disabled:u,className:["inline-flex h-9 items-center justify-center gap-2 rounded-lg px-3 text-xs font-semibold",ge?"border-[var(--color-primary)] bg-[var(--color-primary)] text-white":"border-slate-200 bg-white text-slate-900 hover:bg-slate-50"].join(" "),children:[R.jsx(mI,{className:`h-3.5 w-3.5 flex-shrink-0${ge?"text-white":"text-[var(--color-primary)]"}`}),R.jsx("span",{className:"truncate",children:U})]},U||`slot-${J}`)})}):R.jsx("p",{className:"px-1 text-sm text-slate-500",children:"No slots available for this day."})}),R.jsx("div",{className:"px-0.5 pb-1.5",children:R.jsxs(Bt,{type:"button",onClick:q,disabled:!m||u,"aria-disabled":!m,className:"w-full h-10 gap-2 bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary)]/90 disabled:opacity-60",children:["Book appointment",R.jsx(gI,{className:"h-4 w-4"})]})})]}):R.jsx("div",{className:"px-1 pb-2 pt-1",children:R.jsx("p",{className:"text-sm text-slate-500",children:L||"No availability provided."})})}),d&&!((z=(Y=M==null?void 0:M[(de=w==null?void 0:w.hospital_id)!=null?de:""])==null?void 0:Y.slots_details)!=null&&z.length)&&R.jsx("div",{className:"px-1 pb-2 pt-1",children:R.jsx("p",{className:"text-sm text-slate-500",children:L||"No availability provided."})})]})]})}function zB(n,a=3e4){return new Promise((i,l)=>{const u=setTimeout(()=>{l(new Error(`Request timeout after ${a}ms`))},a);n.then(f=>{clearTimeout(u),i(f)}).catch(f=>{clearTimeout(u),l(f)})})}function FB(n,a={},i=3e4){const l=fetch(n,a);return zB(l,i)}function La(l){return $e(this,arguments,function*({toolParams:n,wrapperOptions:a,retryCount:i=0}){const{timeout:u=3e4,onSessionRefresh:f,session_id:c,tool_name:d}=a;try{const p=`${Yr.BASE_API_URL}/med-assist/api-call-tool?session_id=${c}&tool_name=${d}`,g={method:"POST",headers:{"Content-Type":"application/json","x-agent-id":Yr.X_AGENT_ID},body:JSON.stringify({tool_params:n})},A=yield FB(p,g,u);if(A.ok)return A;if(A.status===401&&i<1&&f){if(console.log("401 Unauthorized error detected, attempting session refresh..."),yield f())return console.log("Session refreshed successfully, retrying request..."),yield La({toolParams:n,wrapperOptions:a,retryCount:i+1});console.error("Session refresh failed")}return A}catch(p){throw console.error("Error in fetchWithSessionRefresh:",p),p}})}const uh=(n,a,i)=>$e(null,null,function*(){try{const l=yield La({toolParams:{doctor_id:n},wrapperOptions:{session_id:a,tool_name:ja.DOCTOR_DETAILS,onSessionRefresh:i}});if(!(l!=null&&l.ok))throw new Error("Failed to load doctor details");return yield l.json()}catch(l){throw console.error("Error loading doctor details:",l),l}});function LB({doctorDetails:n,callbacks:a,onBook:i,refreshSession:l,disabled:u=!1,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c}){const[d,p]=K.useState([]),[g,A]=K.useState(!1),[m,y]=K.useState(0),[E,x]=K.useState(null),w=Vt(j=>j.sessionId),k=n.doctor_ids||[],C=k.length,D=Math.min(3,C),B=C-D;K.useEffect(()=>{if(k.length===0||!w)return;$e(null,null,function*(){A(!0),x(null);try{const Z=k.slice(0,D),ie=Z.map(re=>uh(re,w,l)),L=yield Promise.allSettled(ie),G=[];L.forEach((re,M)=>{re.status==="fulfilled"?G.push(re.value):console.error(`Failed to load doctor ${Z[M]}:`,re.reason)}),p(G),y(G.length)}catch(Z){console.error("Error loading initial doctors:",Z),x("Failed to load doctor details. Please try again.")}finally{A(!1)}})},[k,w,D]);const H=()=>$e(null,null,function*(){if(!(m>=C||!w)){A(!0),x(null);try{const j=k.slice(m),Z=j.map(G=>uh(G,w,l)),ie=yield Promise.allSettled(Z),L=[];ie.forEach((G,re)=>{G.status==="fulfilled"?L.push(G.value):console.error(`Failed to load doctor ${j[re]}:`,G.reason)}),p(G=>[...G,...L]),y(G=>G+L.length)}catch(j){console.error("Error loading remaining doctors:",j),x("Failed to load more doctor details. Please try again.")}finally{A(!1)}}}),F=j=>{i&&i(j)};return g&&d.length===0?R.jsx("div",{className:"flex items-center justify-center py-8",children:R.jsxs("div",{className:"text-center",children:[R.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--color-primary)] mx-auto mb-3"}),R.jsx("p",{className:"text-sm text-gray-500",children:"Loading doctor details..."})]})}):E&&d.length===0?R.jsx("div",{className:"flex items-center justify-center py-8",children:R.jsxs("div",{className:"text-center",children:[R.jsx("p",{className:"text-sm text-red-500 mb-2",children:E}),R.jsx(Bt,{variant:"outline",size:"sm",onClick:()=>{x(null),k.length>0&&w&&$e(null,null,function*(){A(!0);try{const ie=k.slice(0,D).map(re=>uh(re,w,l)),L=yield Promise.allSettled(ie),G=[];L.forEach((re,M)=>{re.status==="fulfilled"&&G.push(re.value)}),p(G),y(G.length)}catch(Z){x("Failed to load doctor details. Please try again.")}finally{A(!1)}})},children:"Retry"})]})}):d.length===0?R.jsx("div",{className:"flex items-center justify-center py-2",children:R.jsx("p",{className:"text-sm text-gray-500",children:"No doctor details available."})}):R.jsxs("div",{className:"space-y-4",children:[R.jsx("div",{className:"space-y-4",children:d.map((j,Z)=>(j==null?void 0:j.doctor_id)&&R.jsx(jB,{doctor:j,availability:n.availability,callbacks:a,onBook:F,disabled:u,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c},`${Z}`))}),m<C&&R.jsx("div",{className:"flex justify-center",children:R.jsx(Bt,{variant:"outline",onClick:H,disabled:g,className:"px-6 py-2",children:g?R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--color-primary)] mr-2"}),"Loading more doctors..."]}):`Show more (${B} more)`})}),E&&d.length>0&&R.jsxs("div",{className:"text-center",children:[R.jsx("p",{className:"text-sm text-red-500 mb-2",children:E}),R.jsx(Bt,{variant:"outline",size:"sm",onClick:H,disabled:g,children:"Retry loading more"})]})]})}function PB({data:n,className:a,disabled:i,onBook:l}){const{package_name:u,hospital_name:f,city:c,description:d,link:p}=n,g=()=>{if(!i){if(l){l(n);return}p&&(window.open(p,"_blank","noopener,noreferrer")||(window.location.href=p))}},A=!!p||!!l;return R.jsxs(sd,{className:pt("w-full max-w-md rounded-xl border border-slate-200 shadow-sm p-0 gap-1",a),"aria-label":"Lab package card",children:[R.jsx(fA,{className:"bg-[var(--color-background-primary-subtle)] p-4",children:u?R.jsx("h3",{className:"text-lg font-bold text-slate-900 leading-snug",children:u}):null}),R.jsxs(dA,{className:"px-4 py-2",children:[d?R.jsx("p",{className:"text-xs leading-relaxed text-slate-500 mb-4",children:d}):null,R.jsxs("div",{className:"space-y-2 mb-4",children:[f?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)] flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-700",children:f})]}):null,c?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(vI,{className:"h-4 w-4 text-[var(--color-primary)] flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-700",children:c})]}):null]}),R.jsx(QA,{className:"bg-slate-200 mb-2"}),A?R.jsx(Bt,{type:"button",variant:"outline",disabled:i,onClick:g,className:"w-full h-11 rounded-lg border-2 border-[var(--color-primary)] bg-white text-[var(--color-primary)] hover:bg-[var(--color-background-primary-subtle)] disabled:opacity-60",children:"View Details"}):null]})]})}function HB({packages:n=[],disabled:a,onBook:i}){const[l,u]=K.useState(2),f=n.slice(0,l),c=K.useMemo(()=>Math.min(n.length-l,2),[n.length,l]);return n.length?R.jsxs("div",{className:"space-y-4",children:[f.map((d,p)=>{var g;return R.jsx(PB,{data:d,disabled:a,onBook:i},`${(g=d.package_name)!=null?g:"pkg"}-${p}`)}),l<n.length&&R.jsx("div",{className:"flex justify-center",children:R.jsxs(Bt,{variant:"outline",onClick:()=>u(d=>d+Math.min(n.length-d,2)),disabled:a,className:"px-6 py-2",children:["Show more (",c," more)"]})})]}):R.jsx("div",{className:"py-4 text-center text-sm text-slate-500",children:"No lab packages available."})}function GB({tips:n,onTipsExpire:a}){const[i,l]=K.useState(!0);return K.useEffect(()=>{if(n.length===0){l(!1);return}l(!0);const u=setTimeout(()=>{l(!1),a==null||a()},7e3);return()=>clearTimeout(u)},[n,a]),!i||n.length===0?null:R.jsx("div",{className:"py-2 space-y-3",children:R.jsxs("div",{className:"flex gap-3",children:[R.jsx("div",{className:"w-px bg-gray-300 flex-shrink-0"}),R.jsx("div",{className:"flex-1 space-y-2",children:n.map((u,f)=>R.jsxs("div",{className:"flex items-start gap-2",children:[R.jsx("div",{className:"flex-shrink-0 mt-0.5",children:R.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-yellow-500",children:R.jsx("path",{d:"M9 21C9 21.55 9.45 22 10 22H14C14.55 22 15 21.55 15 21V20H9V21ZM12 2C8.14 2 5 5.14 5 9C5 11.38 6.19 13.47 8 14.74V17C8 17.55 8.45 18 9 18H15C15.55 18 16 17.55 16 17V14.74C17.81 13.47 19 11.38 19 9C19 5.14 15.86 2 12 2ZM15 13.7L14 14.5V16H10V14.5L9 13.7C7.8 12.8 7 11.4 7 9C7 6.24 9.24 4 12 4S17 6.24 17 9C17 11.4 16.2 12.8 15 13.7Z",fill:"currentColor"})})}),R.jsxs("div",{className:"flex-1",children:[R.jsx("span",{className:"text-sm text-gray-600 font-medium",children:"Tip: "}),R.jsx("span",{className:"text-sm text-gray-500 italic",children:u})]})]},f))})]})})}function U0({file:n,onRemove:a,isPreview:i=!0,className:l=""}){var y,E;const[u,f]=K.useState(!1),[c,d]=K.useState(""),p=(E=(y=n==null?void 0:n.type)==null?void 0:y.startsWith("image/"))!=null?E:!1,g=(n==null?void 0:n.type)==="application/pdf";K.useEffect(()=>{if(p){const x=URL.createObjectURL(n);return d(x),()=>URL.revokeObjectURL(x)}},[n,p]),K.useEffect(()=>{f(!1)},[n]);const A=()=>p?"text-green-600":"text-gray-600",m=x=>{if(x===0)return"0 B";const w=1024,k=["B","KB","MB","GB"],C=Math.floor(Math.log(x)/Math.log(w));return`${(x/Math.pow(w,C)).toFixed(1)} ${k[C]}`.toLowerCase()};return!p||u?R.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${i?"hover:bg-neutral-50":""} ${l}`,children:[R.jsx("div",{className:`flex-shrink-0 ${A()}`,children:R.jsx(xI,{className:"h-5 w-5"})}),R.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[(n==null?void 0:n.name)&&R.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:n.name}),(n==null?void 0:n.size)&&R.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:m(n.size)})]}),i&&a&&R.jsx("button",{onClick:a,"aria-label":`Remove ${n.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:R.jsx(Yu,{className:"h-4 w-4"})})]}):R.jsxs("div",{className:`relative group flex-shrink-0 ${l}`,children:[R.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${i?"hover:bg-neutral-100 cursor-pointer":""}`,children:c&&R.jsx("img",{src:c,alt:n.name,className:"w-full h-full object-cover",onError:()=>f(!0)})}),i&&a&&R.jsx("button",{onClick:a,"aria-label":`Remove ${n.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:R.jsx(Yu,{className:"h-3 w-3 text-black"})})]})}function N0({files:n,onRemoveFile:a,isPreview:i=!0,className:l=""}){if(n.length===0)return null;const u=n.filter(c=>{var d;return(d=c.type)==null?void 0:d.startsWith("image/")}),f=n.filter(c=>{var d;return!((d=c.type)!=null&&d.startsWith("image/"))});return R.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${l}`,children:[f.map(c=>{const d=n.indexOf(c);return R.jsx(U0,{file:c,onRemove:a?()=>a(d):void 0,isPreview:i},`${c.name}-${c.size}-${d}`)}),u.length>0&&R.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:u.map(c=>{const d=n.indexOf(c);return R.jsx(U0,{file:c,onRemove:a?()=>a(d):void 0,isPreview:i},`${c.name}-${c.size}-${d}`)})})]})}function KB({title:n="Tell us more",subtitle:a,options:i,onClose:l,onOptionSelect:u,className:f=""}){const[c,d]=K.useState(!1),p=g=>{d(!0),u==null||u(g)};return R.jsxs("div",{className:pt("mx-4 my-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-muted)]/40 px-4 py-3",f),children:[R.jsxs("div",{className:"flex items-start justify-between gap-3",children:[R.jsxs("div",{children:[R.jsx("p",{className:"text-sm font-medium text-[var(--color-foreground)]",children:c?"Thank you for your feedback":n}),a&&R.jsx("p",{className:"text-xs text-[var(--color-muted-foreground)]",children:a})]}),R.jsx("button",{"aria-label":"Close feedback prompt",className:"text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)]",onClick:l,children:R.jsx(Yu,{className:"h-4 w-4"})})]}),!c&&R.jsx(Ck,{className:"mt-3",pillClassName:"bg-white text-[var(--color-foreground)] hover:bg-white/80",items:i,onItemClick:g=>p(g)})]})}function j0(n,a){const i=String(n);if(typeof a!="string")throw new TypeError("Expected character");let l=0,u=i.indexOf(a);for(;u!==-1;)l++,u=i.indexOf(a,u+a.length);return l}function YB(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qB(n,a,i){const u=tc((i||{}).ignore||[]),f=JB(a);let c=-1;for(;++c<f.length;)C0(n,"text",d);function d(g,A){let m=-1,y;for(;++m<A.length;){const E=A[m],x=y?y.children:void 0;if(u(E,x?x.indexOf(E):void 0,y))return;y=E}if(y)return p(g,A)}function p(g,A){const m=A[A.length-1],y=f[c][0],E=f[c][1];let x=0;const k=m.children.indexOf(g);let C=!1,D=[];y.lastIndex=0;let B=y.exec(g.value);for(;B;){const H=B.index,F={index:B.index,input:B.input,stack:[...A,g]};let j=E(...B,F);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?y.lastIndex=H+1:(x!==H&&D.push({type:"text",value:g.value.slice(x,H)}),Array.isArray(j)?D.push(...j):j&&D.push(j),x=H+B[0].length,C=!0),!y.global)break;B=y.exec(g.value)}return C?(x<g.value.length&&D.push({type:"text",value:g.value.slice(x)}),m.children.splice(k,1,...D)):D=[g],k+D.length}}function JB(n){const a=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!n[0]||Array.isArray(n[0])?n:[n];let l=-1;for(;++l<i.length;){const u=i[l];a.push([VB(u[0]),_B(u[1])])}return a}function VB(n){return typeof n=="string"?new RegExp(YB(n),"g"):n}function _B(n){return typeof n=="function"?n:function(){return n}}const ch="phrasing",fh=["autolink","link","image","label"];function XB(){return{transforms:[rM],enter:{literalAutolink:WB,literalAutolinkEmail:dh,literalAutolinkHttp:dh,literalAutolinkWww:dh},exit:{literalAutolink:nM,literalAutolinkEmail:tM,literalAutolinkHttp:$B,literalAutolinkWww:eM}}}function ZB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ch,notInConstruct:fh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ch,notInConstruct:fh},{character:":",before:"[ps]",after:"\\/",inConstruct:ch,notInConstruct:fh}]}}function WB(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function dh(n){this.config.enter.autolinkProtocol.call(this,n)}function $B(n){this.config.exit.autolinkProtocol.call(this,n)}function eM(n){this.config.exit.data.call(this,n);const a=this.stack[this.stack.length-1];a.type,a.url="http://"+this.sliceSerialize(n)}function tM(n){this.config.exit.autolinkEmail.call(this,n)}function nM(n){this.exit(n)}function rM(n){qB(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),aM]],{ignore:["link","linkReference"]})}function iM(n,a,i,l,u){let f="";if(!z0(u)||(/^w/i.test(a)&&(i=a+i,a="",f="http://"),!oM(i)))return!1;const c=lM(i+l);if(!c[0])return!1;const d={type:"link",title:null,url:f+a+c[0],children:[{type:"text",value:a+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function aM(n,a,i,l){return!z0(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+a+"@"+i,children:[{type:"text",value:a+"@"+i}]}}function oM(n){const a=n.split(".");return!(a.length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))}function lM(n){const a=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!a)return[n,void 0];n=n.slice(0,a.index);let i=a[0],l=i.indexOf(")");const u=j0(n,"(");let f=j0(n,")");for(;l!==-1&&u>f;)n+=i.slice(0,l+1),i=i.slice(l+1),l=i.indexOf(")"),f++;return[n,i]}function z0(n,a){const i=n.input.charCodeAt(n.index-1);return(n.index===0||Fa(i)||Ju(i))&&(!a||i!==47)}F0.peek=mM;function sM(){this.buffer()}function uM(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function cM(){this.buffer()}function fM(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function dM(n){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=qr(this.sliceSerialize(n)).toLowerCase(),i.label=a}function hM(n){this.exit(n)}function pM(n){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=qr(this.sliceSerialize(n)).toLowerCase(),i.label=a}function gM(n){this.exit(n)}function mM(){return"["}function F0(n,a,i,l){const u=i.createTracker(l);let f=u.move("[^");const c=i.enter("footnoteReference"),d=i.enter("reference");return f+=u.move(i.safe(i.associationId(n),{after:"]",before:f})),d(),c(),f+=u.move("]"),f}function AM(){return{enter:{gfmFootnoteCallString:sM,gfmFootnoteCall:uM,gfmFootnoteDefinitionLabelString:cM,gfmFootnoteDefinition:fM},exit:{gfmFootnoteCallString:dM,gfmFootnoteCall:hM,gfmFootnoteDefinitionLabelString:pM,gfmFootnoteDefinition:gM}}}function yM(n){let a=!1;return n&&n.firstLineBlank&&(a=!0),{handlers:{footnoteDefinition:i,footnoteReference:F0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(l,u,f,c){const d=f.createTracker(c);let p=d.move("[^");const g=f.enter("footnoteDefinition"),A=f.enter("label");return p+=d.move(f.safe(f.associationId(l),{before:p,after:"]"})),A(),p+=d.move("]:"),l.children&&l.children.length>0&&(d.shift(4),p+=d.move((a?`
|
|
477
|
+
`},u),f}function sB(n,a){return n&&"run"in n?function(i,l){return $e(this,null,function*(){const u=S0(i,le({file:l},a));yield n.run(u,l)})}:function(i,l){return S0(i,le({file:l},n||a))}}function k0(n){if(n)throw n}var Wd,I0;function uB(){if(I0)return Wd;I0=1;var n=Object.prototype.hasOwnProperty,a=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=function(g){return typeof Array.isArray=="function"?Array.isArray(g):a.call(g)==="[object Array]"},f=function(g){if(!g||a.call(g)!=="[object Object]")return!1;var A=n.call(g,"constructor"),m=g.constructor&&g.constructor.prototype&&n.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!A&&!m)return!1;var y;for(y in g);return typeof y=="undefined"||n.call(g,y)},c=function(g,A){i&&A.name==="__proto__"?i(g,A.name,{enumerable:!0,configurable:!0,value:A.newValue,writable:!0}):g[A.name]=A.newValue},d=function(g,A){if(A==="__proto__")if(n.call(g,A)){if(l)return l(g,A).value}else return;return g[A]};return Wd=function p(){var g,A,m,y,E,x,w=arguments[0],k=1,C=arguments.length,D=!1;for(typeof w=="boolean"&&(D=w,w=arguments[1]||{},k=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});k<C;++k)if(g=arguments[k],g!=null)for(A in g)m=d(w,A),y=d(g,A),w!==y&&(D&&y&&(f(y)||(E=u(y)))?(E?(E=!1,x=m&&u(m)?m:[]):x=m&&f(m)?m:{},c(w,{name:A,newValue:p(D,x,y)})):typeof y!="undefined"&&c(w,{name:A,newValue:y}));return w},Wd}var cB=uB();const $d=Hn(cB);function eh(n){if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)}function fB(){const n=[],a={run:i,use:l};return a;function i(...u){let f=-1;const c=u.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...u);function d(p,...g){const A=n[++f];let m=-1;if(p){c(p);return}for(;++m<u.length;)(g[m]===null||g[m]===void 0)&&(g[m]=u[m]);u=g,A?dB(A,d)(...g):c(null,...g)}}function l(u){if(typeof u!="function")throw new TypeError("Expected `middelware` to be a function, not "+u);return n.push(u),a}}function dB(n,a){let i;return l;function l(...c){const d=n.length>c.length;let p;d&&c.push(u);try{p=n.apply(this,c)}catch(g){const A=g;if(d&&i)throw A;return u(A)}d||(p&&p.then&&typeof p.then=="function"?p.then(f,u):p instanceof Error?u(p):f(p))}function u(c,...d){i||(i=!0,a(c,...d))}function f(c){u(null,c)}}const ni={basename:hB,dirname:pB,extname:gB,join:mB,sep:"/"};function hB(n,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');as(n);let i=0,l=-1,u=n.length,f;if(a===void 0||a.length===0||a.length>n.length){for(;u--;)if(n.codePointAt(u)===47){if(f){i=u+1;break}}else l<0&&(f=!0,l=u+1);return l<0?"":n.slice(i,l)}if(a===n)return"";let c=-1,d=a.length-1;for(;u--;)if(n.codePointAt(u)===47){if(f){i=u+1;break}}else c<0&&(f=!0,c=u+1),d>-1&&(n.codePointAt(u)===a.codePointAt(d--)?d<0&&(l=u):(d=-1,l=c));return i===l?l=c:l<0&&(l=n.length),n.slice(i,l)}function pB(n){if(as(n),n.length===0)return".";let a=-1,i=n.length,l;for(;--i;)if(n.codePointAt(i)===47){if(l){a=i;break}}else l||(l=!0);return a<0?n.codePointAt(0)===47?"/":".":a===1&&n.codePointAt(0)===47?"//":n.slice(0,a)}function gB(n){as(n);let a=n.length,i=-1,l=0,u=-1,f=0,c;for(;a--;){const d=n.codePointAt(a);if(d===47){if(c){l=a+1;break}continue}i<0&&(c=!0,i=a+1),d===46?u<0?u=a:f!==1&&(f=1):u>-1&&(f=-1)}return u<0||i<0||f===0||f===1&&u===i-1&&u===l+1?"":n.slice(u,i)}function mB(...n){let a=-1,i;for(;++a<n.length;)as(n[a]),n[a]&&(i=i===void 0?n[a]:i+"/"+n[a]);return i===void 0?".":AB(i)}function AB(n){as(n);const a=n.codePointAt(0)===47;let i=yB(n,!a);return i.length===0&&!a&&(i="."),i.length>0&&n.codePointAt(n.length-1)===47&&(i+="/"),a?"/"+i:i}function yB(n,a){let i="",l=0,u=-1,f=0,c=-1,d,p;for(;++c<=n.length;){if(c<n.length)d=n.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(u===c-1||f===1))if(u!==c-1&&f===2){if(i.length<2||l!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(p=i.lastIndexOf("/"),p!==i.length-1){p<0?(i="",l=0):(i=i.slice(0,p),l=i.length-1-i.lastIndexOf("/")),u=c,f=0;continue}}else if(i.length>0){i="",l=0,u=c,f=0;continue}}a&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+n.slice(u+1,c):i=n.slice(u+1,c),l=c-u-1;u=c,f=0}else d===46&&f>-1?f++:f=-1}return i}function as(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const EB={cwd:wB};function wB(){return"/"}function th(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function bB(n){if(typeof n=="string")n=new URL(n);else if(!th(n)){const a=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw a.code="ERR_INVALID_ARG_TYPE",a}if(n.protocol!=="file:"){const a=new TypeError("The URL must be of scheme file");throw a.code="ERR_INVALID_URL_SCHEME",a}return xB(n)}function xB(n){if(n.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const a=n.pathname;let i=-1;for(;++i<a.length;)if(a.codePointAt(i)===37&&a.codePointAt(i+1)===50){const l=a.codePointAt(i+2);if(l===70||l===102){const u=new TypeError("File URL path must not include encoded / characters");throw u.code="ERR_INVALID_FILE_URL_PATH",u}}return decodeURIComponent(a)}const nh=["history","path","basename","stem","extname","dirname"];class R0{constructor(a){let i;a?th(a)?i={path:a}:typeof a=="string"||CB(a)?i={value:a}:i=a:i={},this.cwd="cwd"in i?"":EB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<nh.length;){const f=nh[l];f in i&&i[f]!==void 0&&i[f]!==null&&(this[f]=f==="history"?[...i[f]]:i[f])}let u;for(u in i)nh.includes(u)||(this[u]=i[u])}get basename(){return typeof this.path=="string"?ni.basename(this.path):void 0}set basename(a){ih(a,"basename"),rh(a,"basename"),this.path=ni.join(this.dirname||"",a)}get dirname(){return typeof this.path=="string"?ni.dirname(this.path):void 0}set dirname(a){D0(this.basename,"dirname"),this.path=ni.join(a||"",this.basename)}get extname(){return typeof this.path=="string"?ni.extname(this.path):void 0}set extname(a){if(rh(a,"extname"),D0(this.dirname,"extname"),a){if(a.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(a.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ni.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){th(a)&&(a=bB(a)),ih(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return typeof this.path=="string"?ni.basename(this.path,this.extname):void 0}set stem(a){ih(a,"stem"),rh(a,"stem"),this.path=ni.join(this.dirname||"",a+(this.extname||""))}fail(a,i,l){const u=this.message(a,i,l);throw u.fatal=!0,u}info(a,i,l){const u=this.message(a,i,l);return u.fatal=void 0,u}message(a,i,l){const u=new Yn(a,i,l);return this.path&&(u.name=this.path+":"+u.name,u.file=this.path),u.fatal=!1,this.messages.push(u),u}toString(a){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(a||void 0).decode(this.value)}}function rh(n,a){if(n&&n.includes(ni.sep))throw new Error("`"+a+"` cannot be a path: did not expect `"+ni.sep+"`")}function ih(n,a){if(!n)throw new Error("`"+a+"` cannot be empty")}function D0(n,a){if(!n)throw new Error("Setting `"+a+"` requires `path` to be set too")}function CB(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const vB=function(n){const l=this.constructor.prototype,u=l[n],f=function(){return u.apply(f,arguments)};return Object.setPrototypeOf(f,l),f},SB={}.hasOwnProperty;class ah extends vB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=fB()}copy(){const a=new ah;let i=-1;for(;++i<this.attachers.length;){const l=this.attachers[i];a.use(...l)}return a.data($d(!0,{},this.namespace)),a}data(a,i){return typeof a=="string"?arguments.length===2?(sh("data",this.frozen),this.namespace[a]=i,this):SB.call(this.namespace,a)&&this.namespace[a]||void 0:a?(sh("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;const a=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const u=i.call(a,...l);typeof u=="function"&&this.transformers.use(u)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(a){this.freeze();const i=rc(a),l=this.parser||this.Parser;return oh("parse",l),l(String(i),i)}process(a,i){const l=this;return this.freeze(),oh("process",this.parser||this.Parser),lh("process",this.compiler||this.Compiler),i?u(void 0,i):new Promise(u);function u(f,c){const d=rc(a),p=l.parse(d);l.run(p,d,function(A,m,y){if(A||!m||!y)return g(A);const E=m,x=l.stringify(E,y);RB(x)?y.value=x:y.result=x,g(A,y)});function g(A,m){A||!m?c(A):f?f(m):i(void 0,m)}}}processSync(a){let i=!1,l;return this.freeze(),oh("processSync",this.parser||this.Parser),lh("processSync",this.compiler||this.Compiler),this.process(a,u),B0("processSync","process",i),l;function u(f,c){i=!0,k0(f),l=c}}run(a,i,l){T0(a),this.freeze();const u=this.transformers;return!l&&typeof i=="function"&&(l=i,i=void 0),l?f(void 0,l):new Promise(f);function f(c,d){const p=rc(i);u.run(a,p,g);function g(A,m,y){const E=m||a;A?d(A):c?c(E):l(void 0,E,y)}}}runSync(a,i){let l=!1,u;return this.run(a,i,f),B0("runSync","run",l),u;function f(c,d){k0(c),u=d,l=!0}}stringify(a,i){this.freeze();const l=rc(i),u=this.compiler||this.Compiler;return lh("stringify",u),T0(a),u(a,l)}use(a,...i){const l=this.attachers,u=this.namespace;if(sh("use",this.frozen),a!=null)if(typeof a=="function")p(a,i);else if(typeof a=="object")Array.isArray(a)?d(a):c(a);else throw new TypeError("Expected usable value, not `"+a+"`");return this;function f(g){if(typeof g=="function")p(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[A,...m]=g;p(A,m)}else c(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function c(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(g.plugins),g.settings&&(u.settings=$d(!0,u.settings,g.settings))}function d(g){let A=-1;if(g!=null)if(Array.isArray(g))for(;++A<g.length;){const m=g[A];f(m)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function p(g,A){let m=-1,y=-1;for(;++m<l.length;)if(l[m][0]===g){y=m;break}if(y===-1)l.push([g,...A]);else if(A.length>0){let[E,...x]=A;const w=l[y][1];eh(w)&&eh(E)&&(E=$d(!0,w,E)),l[y]=[g,E,...x]}}}}const kB=new ah().freeze();function oh(n,a){if(typeof a!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function lh(n,a){if(typeof a!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function sh(n,a){if(a)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function T0(n){if(!eh(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function B0(n,a,i){if(!i)throw new Error("`"+n+"` finished async. Use `"+a+"` instead")}function rc(n){return IB(n)?n:new R0(n)}function IB(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function RB(n){return typeof n=="string"||DB(n)}function DB(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const TB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",M0=[],Q0={allowDangerousHtml:!0},BB=/^(https?|ircs?|mailto|xmpp)$/i,MB=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function O0(n){const a=QB(n),i=OB(n);return UB(a.runSync(a.parse(i),i),n)}function QB(n){const a=n.rehypePlugins||M0,i=n.remarkPlugins||M0,l=n.remarkRehypeOptions?le(le({},n.remarkRehypeOptions),Q0):Q0;return kB().use(pT).use(i).use(sB,l).use(a)}function OB(n){const a=n.children||"",i=new R0;return typeof a=="string"&&(i.value=a),i}function UB(n,a){const i=a.allowedElements,l=a.allowElement,u=a.components,f=a.disallowedElements,c=a.skipHtml,d=a.unwrapDisallowed,p=a.urlTransform||NB;for(const A of MB)Object.hasOwn(a,A.from)&&(""+A.from+(A.to?"use `"+A.to+"` instead":"remove it")+TB+A.id,void 0);return Xd(n,g),oR(n,{Fragment:R.Fragment,components:u,ignoreInvalidStyle:!0,jsx:R.jsx,jsxs:R.jsxs,passKeys:!0,passNode:!0});function g(A,m,y){if(A.type==="raw"&&y&&typeof m=="number")return c?y.children.splice(m,1):y.children[m]={type:"text",value:A.value},m;if(A.type==="element"){let E;for(E in jd)if(Object.hasOwn(jd,E)&&Object.hasOwn(A.properties,E)){const x=A.properties[E],w=jd[E];(w===null||w.includes(A.tagName))&&(A.properties[E]=p(String(x||""),E,A))}}if(A.type==="element"){let E=i?!i.includes(A.tagName):f?f.includes(A.tagName):!1;if(!E&&l&&typeof m=="number"&&(E=!l(A,m,y)),E&&y&&typeof m=="number")return d&&A.children?y.children.splice(m,1,...A.children):y.children.splice(m,1),m}}}function NB(n){const a=n.indexOf(":"),i=n.indexOf("?"),l=n.indexOf("#"),u=n.indexOf("/");return a===-1||u!==-1&&a>u||i!==-1&&a>i||l!==-1&&a>l||BB.test(n.slice(0,a))?n:""}function jB({doctor:n,availability:a,callbacks:i,onBook:l,disabled:u=!1,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c}){var Oe,He,Ue,Le,et,rt,Et,Dt,v,pe,de,Y,z;const[d,p]=K.useState(!1),[g,A]=K.useState(0),[m,y]=K.useState(null),[E,x]=K.useState(0),[w,k]=K.useState(n.hospitals[0]||null),[C,D]=K.useState(!0),[B,H]=K.useState(!1),[F,j]=K.useState(null),[Z,ie]=K.useState(!1),[L,G]=K.useState(null),re=Vt(U=>U.sessionId);K.useEffect(()=>{var $,Ee,Re,be,ne,ee;if(!(w!=null&&w.hospital_id))return;const U=w.hospital_id,J=((Re=(Ee=($=F==null?void 0:F[U])==null?void 0:$.slots_details)==null?void 0:Ee.length)!=null?Re:0)>0,ge=((ee=(ne=(be=a==null?void 0:a[U])==null?void 0:be.slots_details)==null?void 0:ne.length)!=null?ee:0)>0;i!=null&&i.tool_callback_availability_dates&&n.doctor_id&&re&&!J&&!ge?Q():(J||ge)&&D(!1)},[i==null?void 0:i.tool_callback_availability_dates,F,w==null?void 0:w.hospital_id,a]);const M=K.useMemo(()=>{if(!(w!=null&&w.hospital_id))return a||null;const U=w.hospital_id,J=F==null?void 0:F[U],ge=a==null?void 0:a[U];return J?Fe(le({},a||{}),{[U]:J}):ge?a:a||null},[F,a,w==null?void 0:w.hospital_id]);K.useEffect(()=>{var $,Ee,Re,be,ne,ee;if(!(w!=null&&w.hospital_id))return;const U=w.hospital_id,J=((Re=(Ee=($=F==null?void 0:F[U])==null?void 0:$.slots_details)==null?void 0:Ee.length)!=null?Re:0)>0,ge=((ee=(ne=(be=a==null?void 0:a[U])==null?void 0:be.slots_details)==null?void 0:ne.length)!=null?ee:0)>0;ie(!1),A(0),x(0),y(null),G(null),!J&&!ge&&(i!=null&&i.tool_callback_availability_dates)?(console.log("No cached data for hospital, fetching...",w.name),Q()):(console.log("Using cached/initial data for hospital",w.name),D(!1))},[w==null?void 0:w.hospital_id]);const W=K.useMemo(()=>{var J,ge,$,Ee;if(!(w!=null&&w.hospital_id)||!((ge=(J=M==null?void 0:M[(w==null?void 0:w.hospital_id)||""])==null?void 0:J.slots_details)!=null&&ge.length))return new Date;const U=(Ee=($=M==null?void 0:M[w.hospital_id])==null?void 0:$.slots_details)==null?void 0:Ee[0];return U?new Date(U.date):new Date},[M]);K.useEffect(()=>{var $,Ee;const U=w==null?void 0:w.hospital_id,J=U?M==null?void 0:M[U]:null,ge=(J==null?void 0:J.slots_details)||[];if(U&&ge.length>0&&!Z){let Re=0;const be=(J==null?void 0:J.selected_date)||(($=a==null?void 0:a[U])==null?void 0:$.selected_date);if(be){const xe=ge.findIndex(Ne=>Ne.date===be);xe>=0&&(Re=xe)}else{const xe=((Ee=a==null?void 0:a[U])==null?void 0:Ee.slots_details)||[],Ne=ge.findIndex(Ve=>{const Ze=xe.find(ct=>ct.date===Ve.date);return Ze&&Ze.slots&&Ze.slots.length>0});Ne>=0&&(Re=Ne)}A(Re);const ne=Math.floor(Re/3)*3;x(ne);const ee=ge[Re];ee&&(!(ee!=null&&ee.slots)||ee.slots.length===0)&&(i!=null&&i.tool_callback_availability_slots)&&n.doctor_id&&(w!=null&&w.hospital_id)&&(w!=null&&w.region_id)&&re&&!C&&setTimeout(()=>{ye(ee.date)},0)}},[M,w==null?void 0:w.hospital_id,a,Z,C]);const I=K.useMemo(()=>{var $;const U=[],J=w==null?void 0:w.hospital_id,ge=J?($=M==null?void 0:M[J])==null?void 0:$.slots_details:null;if(ge&&ge.length>0){const Ee=Math.max(0,Math.floor(E/3)*3),Re=Math.min(ge.length,Ee+3);for(let be=Ee;be<Re;be++){const ne=ge[be],ee=new Date(ne.date),xe=ee.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),Ne=ee.toLocaleDateString(void 0,{day:"2-digit"});U.push({weekday:xe,dayNum:Ne,date:ne.date,hasAvailability:!0,fullDate:ee,hasSlots:ne.slots&&ne.slots.length>0})}}else{const Ee=new Date(W);Ee.setDate(Ee.getDate()+E);for(let Re=0;Re<3;Re++){const be=new Date(Ee);be.setDate(Ee.getDate()+Re);const ne=be.toLocaleDateString(void 0,{weekday:"short"}).toUpperCase(),ee=be.toLocaleDateString(void 0,{day:"2-digit"}),xe=be.toISOString().split("T")[0];U.push({weekday:ne,dayNum:ee,date:xe,hasAvailability:!1,fullDate:be,hasSlots:!1})}}return U},[W,E,M,w==null?void 0:w.hospital_id]),ae=K.useMemo(()=>{var ge;const U=w==null?void 0:w.hospital_id,J=U?(ge=M==null?void 0:M[U])==null?void 0:ge.slots_details:null;return(J==null?void 0:J[g])||null},[M,w==null?void 0:w.hospital_id,g]),fe=((Oe=n.name)==null?void 0:Oe.split(" ").map(U=>U[0]).slice(0,2).join("").toUpperCase())||"DR";function se(){ie(!0),x(U=>Math.max(0,U-3)),y(null)}function ue(){var $;ie(!0);const U=w==null?void 0:w.hospital_id,J=U?($=M==null?void 0:M[U])==null?void 0:$.slots_details:null,ge=J!=null&&J.length?Math.max(0,J.length-3):0;x(Ee=>Math.min(ge,Ee+3)),y(null)}function te(U){var Re,be;ie(!0);const J=w==null?void 0:w.hospital_id,ge=J?(Re=M==null?void 0:M[J])==null?void 0:Re.slots_details:null,$=(be=ge==null?void 0:ge.findIndex(ne=>ne.date===U))!=null?be:-1;$>=0&&A($),y(null);const Ee=ge==null?void 0:ge.find(ne=>ne.date===U);i!=null&&i.tool_callback_availability_slots&&(!(Ee!=null&&Ee.slots)||Ee.slots.length===0)&&n.doctor_id&&(w!=null&&w.hospital_id)&&(w!=null&&w.region_id)&&re&&ye(U)}const T=K.useMemo(()=>E>0,[E]),V=K.useMemo(()=>{var $;const U=w==null?void 0:w.hospital_id,J=U?($=M==null?void 0:M[U])==null?void 0:$.slots_details:null;if(!J||J.length===0)return!1;const ge=Math.max(0,J.length-3);return E<ge},[E,M,w==null?void 0:w.hospital_id]);function q(){l&&ae&&m&&l({date:ae.date,time:m,doctorData:{doctor:n,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""}})}const Q=()=>$e(null,null,function*(){var U,J,ge,$,Ee,Re;if(console.log("called loadAvailabilityDates"),!n.doctor_id||!re||!(w!=null&&w.hospital_id)){console.warn("Missing required parameters for loading availability dates");return}D(!0),console.log("loading availability dates",w==null?void 0:w.name);try{let be;const ne=yield f({doctor_id:n.doctor_id,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""});if(!ne.success){(J=(U=ne.data)==null?void 0:U.error)!=null&&J.msg&&G(($=(ge=ne.data)==null?void 0:ge.error)==null?void 0:$.msg),console.error("Failed to load availability dates via handler",ne);return}be=ne.data;const ee=be.available_dates.map(ot=>({date:ot,slots:[]})),xe=(w==null?void 0:w.hospital_id)||"",Ne=((Ee=a==null?void 0:a[xe])==null?void 0:Ee.slots_details)||[],Ve=((Re=F==null?void 0:F[xe])==null?void 0:Re.slots_details)||[],Ze=new Map;Ne.forEach(ot=>{Ze.set(ot.date,ot)}),Ve.forEach(ot=>{Ze.set(ot.date,ot)});const tt=[...Array.from(Ze.values())];ee.forEach(ot=>{Ze.has(ot.date)||tt.push(ot)}),tt.sort((ot,Ht)=>new Date(ot.date).getTime()-new Date(Ht.date).getTime()),console.log("merged slots",tt),j(ot=>Fe(le({},ot||{}),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:tt}}))}catch(be){console.error("Error loading availability dates:",be)}finally{D(!1)}}),ye=U=>$e(null,null,function*(){if(!n.doctor_id||!(w!=null&&w.hospital_id)||!(w!=null&&w.region_id)||!re){console.warn("Missing required parameters for loading slots");return}H(!0);try{let J;const ge=yield c(U,{doctor_id:n.doctor_id,hospital_id:(w==null?void 0:w.hospital_id)||"",region_id:(w==null?void 0:w.region_id)||""});if(!ge.success){console.error("Failed to load slots via handler");return}J=ge.data,j($=>{var ne,ee,xe,Ne,Ve,Ze;if(!$||!((ee=(ne=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:ne.slots_details)!=null&&ee.length))return Fe(le({},$||{}),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:[{date:U,slots:J.slots}]}});const Ee=(Ne=(xe=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:xe.slots_details)==null?void 0:Ne.map(ct=>ct.date===U?Fe(le({},ct),{slots:J.slots}):ct),be=((Ze=(Ve=$==null?void 0:$[w==null?void 0:w.hospital_id])==null?void 0:Ve.slots_details)==null?void 0:Ze.some(ct=>ct.date===U))?Ee:[...Ee||[],{date:U,slots:J.slots}];return be&&be.length>0&&be.sort((ct,tt)=>new Date(ct.date).getTime()-new Date(tt.date).getTime()),Fe(le({},$),{[(w==null?void 0:w.hospital_id)||""]:{slots_details:be}})})}catch(J){console.error("Error loading slots for date:",J)}finally{H(!1)}}),Se=U=>{const J=n.hospitals.find(ge=>ge.hospital_id===U);console.log("hospitalId",U,J),J&&(console.log("hospital selected",J),k(J))};return R.jsxs(sd,{className:"max-w-md rounded-xl border-slate-200 shadow-sm p-0","aria-label":"Appointment card",children:[R.jsx(fA,{className:"flex flex-row items-center justify-between gap-3 bg-[var(--color-background-primary-subtle)] rounded-t-xl p-4",children:R.jsxs("div",{className:"flex items-center gap-3",children:[n.profile_pic&&R.jsxs(kA,{className:"h-12 w-12",children:[R.jsx(IA,{src:n.profile_pic,alt:`${n.name} profile photo`,crossOrigin:"anonymous"}),R.jsx(RA,{children:fe})]}),R.jsxs("div",{className:"min-w-0",children:[R.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[R.jsx("h3",{className:" text-base font-bold text-slate-900",children:n.name}),n.profile_link?R.jsx("a",{href:n.profile_link,target:"_blank",rel:"noreferrer",className:"text-xs font-semibold text-[var(--color-primary)] hover:underline",children:"View profile"}):null]}),R.jsxs("p",{className:"mt-0.5 text-sm text-slate-500",children:[n.specialty,n.experience&&R.jsxs(R.Fragment,{children:[" • ",n.experience]})]})]})]})}),R.jsxs(dA,{className:"px-4 pb-2",children:[R.jsxs("div",{className:"grid gap-2 border-b border-slate-200 pb-3",children:[(n==null?void 0:n.timings)&&R.jsxs("div",{className:"flex items-start gap-2 text-sm text-slate-900",children:[R.jsx(bI,{className:"h-4 w-4 text-[var(--color-primary)] mt-0.5 flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-500 text-xs",children:n==null?void 0:n.timings})]}),n.languages?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(CI,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),R.jsx("span",{className:"text-slate-500",children:n.languages})]}):null,n!=null&&n.hospitals&&((He=n.hospitals)==null?void 0:He.length)>1?w&&w.name&&R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),R.jsx(Fk,{options:n.hospitals.map(U=>({value:U.hospital_id,label:U.name})),placeholder:"Select Hospital",disabled:u,onValueChange:Se,value:(w==null?void 0:w.hospital_id)||""})]}):w&&w.name&&R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)]","aria-hidden":!0}),w.name]})]}),w!=null&&w.hospital_id&&((Le=(Ue=M==null?void 0:M[w==null?void 0:w.hospital_id])==null?void 0:Ue.slots_details)!=null&&Le.length)||i!=null&&i.tool_callback_availability_dates||C?R.jsx(Bt,{type:"button",variant:"outline","aria-expanded":d,"aria-controls":"ap-slots",onClick:()=>p(U=>!U),disabled:C,className:"mt-3 w-full border-[var(--color-primary)] text-[var(--color-primary)] hover:bg-[var(--color-background-primary-subtle)] disabled:opacity-50",children:C?R.jsxs(R.Fragment,{children:[R.jsx(Vl,{className:"h-4 w-4 mr-2 animate-spin"}),"Loading availability..."]}):R.jsxs(R.Fragment,{children:[R.jsx("span",{className:"mr-1",children:d?"Hide slots":"Show available slots"}),R.jsx(yI,{className:`h-4 w-4 transition-transform ${d?"rotate-180":""}`,"aria-hidden":!0})]})}):R.jsx("div",{className:"mt-3 w-full flex items-center justify-center py-3 px-4 bg-gray-50 border border-gray-200 rounded-lg",children:R.jsx("span",{className:"text-sm text-gray-500 font-medium",children:"No details available"})}),d&&(w==null?void 0:w.hospital_id)&&((rt=(et=M==null?void 0:M[w==null?void 0:w.hospital_id])==null?void 0:et.slots_details)==null?void 0:rt.length)&&R.jsx("div",{id:"ap-slots",role:"region","aria-label":"Available slots",className:"pt-3",children:(v=(Dt=M==null?void 0:M[(Et=w==null?void 0:w.hospital_id)!=null?Et:""])==null?void 0:Dt.slots_details)!=null&&v.length?R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"flex items-center gap-2 px-0.5",children:[R.jsx(Bt,{type:"button",variant:"outline",size:"icon",onClick:se,"aria-label":"Previous 3 days",disabled:u||!T,className:"h-8 w-8 flex-shrink-0 rounded-md border-slate-200 bg-transparent text-slate-900 disabled:opacity-50",children:R.jsx(wI,{className:"h-4 w-4"})}),R.jsx("div",{className:"flex-1 grid grid-cols-3 gap-1 min-w-0",children:I.map((U,J)=>{const ge=(ae==null?void 0:ae.date)===U.date,$=!U.hasAvailability;return R.jsxs(Bt,{type:"button",variant:"outline",onClick:()=>!$&&te(U.date),disabled:$||u,"aria-current":ge?"date":void 0,className:["flex flex-col items-center justify-center h-12 rounded-lg border p-2 gap-0.5 min-w-0",ge?"border-[var(--color-primary)] ring-2 ring-[var(--color-background-primary-subtle)] bg-[var(--color-background-primary-subtle)]":$?"border-slate-100 bg-slate-50 text-slate-300 cursor-not-allowed":"border-slate-200 bg-white hover:bg-slate-50"].join(" "),children:[R.jsx("span",{className:["text-[10px] tracking-wide w-full text-center",ge?"text-[var(--color-primary)]":$?"text-slate-300":"text-slate-500"].join(" "),children:U.weekday}),R.jsx("span",{className:["text-xs font-bold w-full text-center",ge?"text-[var(--color-primary)]":$?"text-slate-300":"text-slate-900"].join(" "),children:U.dayNum})]},`${U.date}-${J}`)})}),R.jsx(Bt,{type:"button",variant:"outline",size:"icon",onClick:ue,"aria-label":"Next 3 days",disabled:u||!V,className:"h-8 w-8 flex-shrink-0 rounded-md border-slate-200 bg-transparent text-slate-900 disabled:opacity-50",children:R.jsx(EI,{className:"h-4 w-4"})})]}),R.jsx("div",{className:"px-0.5 py-3",children:B?R.jsxs("div",{className:"flex items-center justify-center py-4",children:[R.jsx(Vl,{className:"h-4 w-4 animate-spin text-[var(--color-primary)] mr-2"}),R.jsx("span",{className:"text-sm text-slate-500",children:"Loading slots..."})]}):(pe=ae==null?void 0:ae.slots)!=null&&pe.length?R.jsx("div",{className:"grid grid-cols-2 gap-2 max-h-48 overflow-y-auto",children:ae.slots.map((U,J)=>{const ge=m===U;return R.jsxs(Bt,{type:"button",variant:"outline",onClick:()=>y(U),"aria-pressed":ge,disabled:u,className:["inline-flex h-9 items-center justify-center gap-2 rounded-lg px-3 text-xs font-semibold",ge?"border-[var(--color-primary)] bg-[var(--color-primary)] text-white":"border-slate-200 bg-white text-slate-900 hover:bg-slate-50"].join(" "),children:[R.jsx(mI,{className:`h-3.5 w-3.5 flex-shrink-0${ge?"text-white":"text-[var(--color-primary)]"}`}),R.jsx("span",{className:"truncate",children:U})]},U||`slot-${J}`)})}):R.jsx("p",{className:"px-1 text-sm text-slate-500",children:"No slots available for this day."})}),R.jsx("div",{className:"px-0.5 pb-1.5",children:R.jsxs(Bt,{type:"button",onClick:q,disabled:!m||u,"aria-disabled":!m,className:"w-full h-10 gap-2 bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary)]/90 disabled:opacity-60",children:["Book appointment",R.jsx(gI,{className:"h-4 w-4"})]})})]}):R.jsx("div",{className:"px-1 pb-2 pt-1",children:R.jsx("p",{className:"text-sm text-slate-500",children:L||"No availability provided."})})}),d&&!((z=(Y=M==null?void 0:M[(de=w==null?void 0:w.hospital_id)!=null?de:""])==null?void 0:Y.slots_details)!=null&&z.length)&&R.jsx("div",{className:"px-1 pb-2 pt-1",children:R.jsx("p",{className:"text-sm text-slate-500",children:L||"No availability provided."})})]})]})}function zB(n,a=3e4){return new Promise((i,l)=>{const u=setTimeout(()=>{l(new Error(`Request timeout after ${a}ms`))},a);n.then(f=>{clearTimeout(u),i(f)}).catch(f=>{clearTimeout(u),l(f)})})}function FB(n,a={},i=3e4){const l=fetch(n,a);return zB(l,i)}function La(l){return $e(this,arguments,function*({toolParams:n,wrapperOptions:a,retryCount:i=0}){const{timeout:u=3e4,onSessionRefresh:f,session_id:c,tool_name:d}=a;try{const p=`${Yr.BASE_API_URL}/med-assist/api-call-tool?session_id=${c}&tool_name=${d}`,g={method:"POST",headers:{"Content-Type":"application/json","x-agent-id":Yr.X_AGENT_ID},body:JSON.stringify({tool_params:n})},A=yield FB(p,g,u);if(A.ok)return A;if(A.status===401&&i<1&&f){if(console.log("401 Unauthorized error detected, attempting session refresh..."),yield f())return console.log("Session refreshed successfully, retrying request..."),yield La({toolParams:n,wrapperOptions:a,retryCount:i+1});console.error("Session refresh failed")}return A}catch(p){throw console.error("Error in fetchWithSessionRefresh:",p),p}})}const uh=(n,a,i)=>$e(null,null,function*(){try{const l=yield La({toolParams:{doctor_id:n},wrapperOptions:{session_id:a,tool_name:ja.DOCTOR_DETAILS,onSessionRefresh:i}});if(!(l!=null&&l.ok))throw new Error("Failed to load doctor details");return yield l.json()}catch(l){throw console.error("Error loading doctor details:",l),l}});function LB({doctorDetails:n,callbacks:a,onBook:i,refreshSession:l,disabled:u=!1,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c}){const[d,p]=K.useState([]),[g,A]=K.useState(!1),[m,y]=K.useState(0),[E,x]=K.useState(null),w=Vt(j=>j.sessionId),k=n.doctor_ids||[],C=k.length,D=Math.min(3,C),B=C-D;K.useEffect(()=>{if(k.length===0||!w)return;$e(null,null,function*(){A(!0),x(null);try{const Z=k.slice(0,D),ie=Z.map(re=>uh(re,w,l)),L=yield Promise.allSettled(ie),G=[];L.forEach((re,M)=>{re.status==="fulfilled"?G.push(re.value):console.error(`Failed to load doctor ${Z[M]}:`,re.reason)}),p(G),y(G.length)}catch(Z){console.error("Error loading initial doctors:",Z),x("Failed to load doctor details. Please try again.")}finally{A(!1)}})},[k,w,D]);const H=()=>$e(null,null,function*(){if(!(m>=C||!w)){A(!0),x(null);try{const j=k.slice(m),Z=j.map(G=>uh(G,w,l)),ie=yield Promise.allSettled(Z),L=[];ie.forEach((G,re)=>{G.status==="fulfilled"?L.push(G.value):console.error(`Failed to load doctor ${j[re]}:`,G.reason)}),p(G=>[...G,...L]),y(G=>G+L.length)}catch(j){console.error("Error loading remaining doctors:",j),x("Failed to load more doctor details. Please try again.")}finally{A(!1)}}}),F=j=>{i&&i(j)};return g&&d.length===0?R.jsx("div",{className:"flex items-center justify-center py-8",children:R.jsxs("div",{className:"text-center",children:[R.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[var(--color-primary)] mx-auto mb-3"}),R.jsx("p",{className:"text-sm text-gray-500",children:"Loading doctor details..."})]})}):E&&d.length===0?R.jsx("div",{className:"flex items-center justify-center py-8",children:R.jsxs("div",{className:"text-center",children:[R.jsx("p",{className:"text-sm text-red-500 mb-2",children:E}),R.jsx(Bt,{variant:"outline",size:"sm",onClick:()=>{x(null),k.length>0&&w&&$e(null,null,function*(){A(!0);try{const ie=k.slice(0,D).map(re=>uh(re,w,l)),L=yield Promise.allSettled(ie),G=[];L.forEach((re,M)=>{re.status==="fulfilled"&&G.push(re.value)}),p(G),y(G.length)}catch(Z){x("Failed to load doctor details. Please try again.")}finally{A(!1)}})},children:"Retry"})]})}):d.length===0?R.jsx("div",{className:"flex items-center justify-center py-2",children:R.jsx("p",{className:"text-sm text-gray-500",children:"No doctor details available."})}):R.jsxs("div",{className:"space-y-4",children:[R.jsx("div",{className:"space-y-4",children:d.map((j,Z)=>(j==null?void 0:j.doctor_id)&&R.jsx(jB,{doctor:j,availability:n.availability,callbacks:a,onBook:F,disabled:u,getAvailabilityDatesForAppointment:f,getAvailableSlotsForAppointment:c},`${Z}`))}),m<C&&R.jsx("div",{className:"flex justify-center",children:R.jsx(Bt,{variant:"outline",onClick:H,disabled:g,className:"px-6 py-2",children:g?R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--color-primary)] mr-2"}),"Loading more doctors..."]}):`Show more (${B} more)`})}),E&&d.length>0&&R.jsxs("div",{className:"text-center",children:[R.jsx("p",{className:"text-sm text-red-500 mb-2",children:E}),R.jsx(Bt,{variant:"outline",size:"sm",onClick:H,disabled:g,children:"Retry loading more"})]})]})}function PB({data:n,className:a,disabled:i,onBook:l}){const{package_name:u,hospital_name:f,city:c,description:d,link:p}=n,g=()=>{if(!i){if(l){l(n);return}p&&(window.open(p,"_blank","noopener,noreferrer")||(window.location.href=p))}},A=!!p||!!l;return R.jsxs(sd,{className:pt("w-full max-w-md rounded-xl border border-slate-200 shadow-sm p-0 gap-1",a),"aria-label":"Lab package card",children:[R.jsx(fA,{className:"bg-[var(--color-background-primary-subtle)] p-4",children:u?R.jsx("h3",{className:"text-lg font-bold text-slate-900 leading-snug",children:u}):null}),R.jsxs(dA,{className:"px-4 py-2",children:[d?R.jsx("p",{className:"text-xs leading-relaxed text-slate-500 mb-4",children:d}):null,R.jsxs("div",{className:"space-y-2 mb-4",children:[f?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(Cd,{className:"h-4 w-4 text-[var(--color-primary)] flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-700",children:f})]}):null,c?R.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-900",children:[R.jsx(vI,{className:"h-4 w-4 text-[var(--color-primary)] flex-shrink-0","aria-hidden":!0}),R.jsx("span",{className:"text-slate-700",children:c})]}):null]}),R.jsx(QA,{className:"bg-slate-200 mb-2"}),A?R.jsx(Bt,{type:"button",variant:"outline",disabled:i,onClick:g,className:"w-full h-11 rounded-lg border-2 border-[var(--color-primary)] bg-white text-[var(--color-primary)] hover:bg-[var(--color-background-primary-subtle)] disabled:opacity-60",children:"View Details"}):null]})]})}function HB({packages:n=[],disabled:a,onBook:i}){const[l,u]=K.useState(2),f=n.slice(0,l),c=K.useMemo(()=>Math.min(n.length-l,2),[n.length,l]);return n.length?R.jsxs("div",{className:"space-y-4",children:[f.map((d,p)=>{var g;return R.jsx(PB,{data:d,disabled:a,onBook:i},`${(g=d.package_name)!=null?g:"pkg"}-${p}`)}),l<n.length&&R.jsx("div",{className:"flex justify-center",children:R.jsxs(Bt,{variant:"outline",onClick:()=>u(d=>d+Math.min(n.length-d,2)),disabled:a,className:"px-6 py-2",children:["Show more (",c," more)"]})})]}):R.jsx("div",{className:"py-4 text-center text-sm text-slate-500",children:"No lab packages available."})}function GB({tips:n,onTipsExpire:a}){const[i,l]=K.useState(!0);return K.useEffect(()=>{if(n.length===0){l(!1);return}l(!0);const u=setTimeout(()=>{l(!1),a==null||a()},7e3);return()=>clearTimeout(u)},[n,a]),!i||n.length===0?null:R.jsx("div",{className:"py-2 space-y-3",children:R.jsxs("div",{className:"flex gap-3",children:[R.jsx("div",{className:"w-px bg-gray-300 flex-shrink-0"}),R.jsx("div",{className:"flex-1 space-y-2",children:n.map((u,f)=>R.jsxs("div",{className:"flex items-start gap-2",children:[R.jsx("div",{className:"flex-shrink-0 mt-0.5",children:R.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-yellow-500",children:R.jsx("path",{d:"M9 21C9 21.55 9.45 22 10 22H14C14.55 22 15 21.55 15 21V20H9V21ZM12 2C8.14 2 5 5.14 5 9C5 11.38 6.19 13.47 8 14.74V17C8 17.55 8.45 18 9 18H15C15.55 18 16 17.55 16 17V14.74C17.81 13.47 19 11.38 19 9C19 5.14 15.86 2 12 2ZM15 13.7L14 14.5V16H10V14.5L9 13.7C7.8 12.8 7 11.4 7 9C7 6.24 9.24 4 12 4S17 6.24 17 9C17 11.4 16.2 12.8 15 13.7Z",fill:"currentColor"})})}),R.jsxs("div",{className:"flex-1",children:[R.jsx("span",{className:"text-sm text-gray-600 font-medium",children:"Tip: "}),R.jsx("span",{className:"text-sm text-gray-500 italic",children:u})]})]},f))})]})})}function U0({file:n,onRemove:a,isPreview:i=!0,className:l=""}){var y,E;const[u,f]=K.useState(!1),[c,d]=K.useState(""),p=(E=(y=n==null?void 0:n.type)==null?void 0:y.startsWith("image/"))!=null?E:!1,g=(n==null?void 0:n.type)==="application/pdf";K.useEffect(()=>{if(p){const x=URL.createObjectURL(n);return d(x),()=>URL.revokeObjectURL(x)}},[n,p]),K.useEffect(()=>{f(!1)},[n]);const A=()=>p?"text-green-600":"text-gray-600",m=x=>{if(x===0)return"0 B";const w=1024,k=["B","KB","MB","GB"],C=Math.floor(Math.log(x)/Math.log(w));return`${(x/Math.pow(w,C)).toFixed(1)} ${k[C]}`.toLowerCase()};return!p||u?R.jsxs("div",{className:`relative group inline-flex flex-shrink-0 bg-white border border-neutral-300 rounded-lg flex items-center gap-3 px-3 py-2.5 max-w-full ${i?"hover:bg-neutral-50":""} ${l}`,children:[R.jsx("div",{className:`flex-shrink-0 ${A()}`,children:R.jsx(xI,{className:"h-5 w-5"})}),R.jsxs("div",{className:"flex-1 min-w-0 max-w-[200px]",children:[(n==null?void 0:n.name)&&R.jsx("div",{className:"text-sm font-medium text-[var(--color-foreground)] truncate",children:n.name}),(n==null?void 0:n.size)&&R.jsx("div",{className:"text-xs text-[var(--color-muted-foreground)]",children:m(n.size)})]}),i&&a&&R.jsx("button",{onClick:a,"aria-label":`Remove ${n.name}`,className:"flex-shrink-0 flex items-center justify-center w-5 h-5 text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)] transition-colors",children:R.jsx(Yu,{className:"h-4 w-4"})})]}):R.jsxs("div",{className:`relative group flex-shrink-0 ${l}`,children:[R.jsx("div",{className:`w-20 h-20 bg-white border border-neutral-300 rounded-lg flex items-center justify-center overflow-hidden ${i?"hover:bg-neutral-100 cursor-pointer":""}`,children:c&&R.jsx("img",{src:c,alt:n.name,className:"w-full h-full object-cover",onError:()=>f(!0)})}),i&&a&&R.jsx("button",{onClick:a,"aria-label":`Remove ${n.name}`,className:"absolute top-0 right-0 bg-[var(--color-muted)] text-black rounded-full w-5 h-5 flex items-center justify-center hover:bg-[var(--color-muted-foreground)] transition-colors z-10 transform translate-x-1 -translate-y-1",children:R.jsx(Yu,{className:"h-3 w-3 text-black"})})]})}function N0({files:n,onRemoveFile:a,isPreview:i=!0,className:l=""}){if(n.length===0)return null;const u=n.filter(c=>{var d;return(d=c.type)==null?void 0:d.startsWith("image/")}),f=n.filter(c=>{var d;return!((d=c.type)!=null&&d.startsWith("image/"))});return R.jsxs("div",{className:`flex flex-wrap justify-end gap-2 max-w-full ${l}`,children:[f.map(c=>{const d=n.indexOf(c);return R.jsx(U0,{file:c,onRemove:a?()=>a(d):void 0,isPreview:i},`${c.name}-${c.size}-${d}`)}),u.length>0&&R.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full p-1 scrollbar-hide",children:u.map(c=>{const d=n.indexOf(c);return R.jsx(U0,{file:c,onRemove:a?()=>a(d):void 0,isPreview:i},`${c.name}-${c.size}-${d}`)})})]})}function KB({title:n="Tell us more",subtitle:a,options:i,onClose:l,onOptionSelect:u,className:f=""}){const[c,d]=K.useState(!1),p=g=>{d(!0),u==null||u(g)};return R.jsxs("div",{className:pt("mx-4 my-2 rounded-lg border border-[var(--color-border)] bg-[var(--color-muted)]/40 px-4 py-3",f),children:[R.jsxs("div",{className:"flex items-start justify-between gap-3",children:[R.jsxs("div",{children:[R.jsx("p",{className:"text-sm font-medium text-[var(--color-foreground)]",children:c?"Thank you for your feedback":n}),a&&R.jsx("p",{className:"text-xs text-[var(--color-muted-foreground)]",children:a})]}),R.jsx("button",{"aria-label":"Close feedback prompt",className:"text-[var(--color-muted-foreground)] hover:text-[var(--color-foreground)]",onClick:l,children:R.jsx(Yu,{className:"h-4 w-4"})})]}),!c&&R.jsx(Ck,{className:"mt-3",pillClassName:"bg-white text-[var(--color-foreground)] hover:bg-white/80",items:i,onItemClick:g=>p(g)})]})}function j0(n,a){const i=String(n);if(typeof a!="string")throw new TypeError("Expected character");let l=0,u=i.indexOf(a);for(;u!==-1;)l++,u=i.indexOf(a,u+a.length);return l}function YB(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function qB(n,a,i){const u=tc((i||{}).ignore||[]),f=JB(a);let c=-1;for(;++c<f.length;)C0(n,"text",d);function d(g,A){let m=-1,y;for(;++m<A.length;){const E=A[m],x=y?y.children:void 0;if(u(E,x?x.indexOf(E):void 0,y))return;y=E}if(y)return p(g,A)}function p(g,A){const m=A[A.length-1],y=f[c][0],E=f[c][1];let x=0;const k=m.children.indexOf(g);let C=!1,D=[];y.lastIndex=0;let B=y.exec(g.value);for(;B;){const H=B.index,F={index:B.index,input:B.input,stack:[...A,g]};let j=E(...B,F);if(typeof j=="string"&&(j=j.length>0?{type:"text",value:j}:void 0),j===!1?y.lastIndex=H+1:(x!==H&&D.push({type:"text",value:g.value.slice(x,H)}),Array.isArray(j)?D.push(...j):j&&D.push(j),x=H+B[0].length,C=!0),!y.global)break;B=y.exec(g.value)}return C?(x<g.value.length&&D.push({type:"text",value:g.value.slice(x)}),m.children.splice(k,1,...D)):D=[g],k+D.length}}function JB(n){const a=[];if(!Array.isArray(n))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!n[0]||Array.isArray(n[0])?n:[n];let l=-1;for(;++l<i.length;){const u=i[l];a.push([VB(u[0]),_B(u[1])])}return a}function VB(n){return typeof n=="string"?new RegExp(YB(n),"g"):n}function _B(n){return typeof n=="function"?n:function(){return n}}const ch="phrasing",fh=["autolink","link","image","label"];function XB(){return{transforms:[rM],enter:{literalAutolink:WB,literalAutolinkEmail:dh,literalAutolinkHttp:dh,literalAutolinkWww:dh},exit:{literalAutolink:nM,literalAutolinkEmail:tM,literalAutolinkHttp:$B,literalAutolinkWww:eM}}}function ZB(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ch,notInConstruct:fh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ch,notInConstruct:fh},{character:":",before:"[ps]",after:"\\/",inConstruct:ch,notInConstruct:fh}]}}function WB(n){this.enter({type:"link",title:null,url:"",children:[]},n)}function dh(n){this.config.enter.autolinkProtocol.call(this,n)}function $B(n){this.config.exit.autolinkProtocol.call(this,n)}function eM(n){this.config.exit.data.call(this,n);const a=this.stack[this.stack.length-1];a.type,a.url="http://"+this.sliceSerialize(n)}function tM(n){this.config.exit.autolinkEmail.call(this,n)}function nM(n){this.exit(n)}function rM(n){qB(n,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),aM]],{ignore:["link","linkReference"]})}function iM(n,a,i,l,u){let f="";if(!z0(u)||(/^w/i.test(a)&&(i=a+i,a="",f="http://"),!oM(i)))return!1;const c=lM(i+l);if(!c[0])return!1;const d={type:"link",title:null,url:f+a+c[0],children:[{type:"text",value:a+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function aM(n,a,i,l){return!z0(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+a+"@"+i,children:[{type:"text",value:a+"@"+i}]}}function oM(n){const a=n.split(".");return!(a.length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))}function lM(n){const a=/[!"&'),.:;<>?\]}]+$/.exec(n);if(!a)return[n,void 0];n=n.slice(0,a.index);let i=a[0],l=i.indexOf(")");const u=j0(n,"(");let f=j0(n,")");for(;l!==-1&&u>f;)n+=i.slice(0,l+1),i=i.slice(l+1),l=i.indexOf(")"),f++;return[n,i]}function z0(n,a){const i=n.input.charCodeAt(n.index-1);return(n.index===0||Fa(i)||Ju(i))&&(!a||i!==47)}F0.peek=mM;function sM(){this.buffer()}function uM(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function cM(){this.buffer()}function fM(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function dM(n){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=qr(this.sliceSerialize(n)).toLowerCase(),i.label=a}function hM(n){this.exit(n)}function pM(n){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=qr(this.sliceSerialize(n)).toLowerCase(),i.label=a}function gM(n){this.exit(n)}function mM(){return"["}function F0(n,a,i,l){const u=i.createTracker(l);let f=u.move("[^");const c=i.enter("footnoteReference"),d=i.enter("reference");return f+=u.move(i.safe(i.associationId(n),{after:"]",before:f})),d(),c(),f+=u.move("]"),f}function AM(){return{enter:{gfmFootnoteCallString:sM,gfmFootnoteCall:uM,gfmFootnoteDefinitionLabelString:cM,gfmFootnoteDefinition:fM},exit:{gfmFootnoteCallString:dM,gfmFootnoteCall:hM,gfmFootnoteDefinitionLabelString:pM,gfmFootnoteDefinition:gM}}}function yM(n){let a=!1;return n&&n.firstLineBlank&&(a=!0),{handlers:{footnoteDefinition:i,footnoteReference:F0},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(l,u,f,c){const d=f.createTracker(c);let p=d.move("[^");const g=f.enter("footnoteDefinition"),A=f.enter("label");return p+=d.move(f.safe(f.associationId(l),{before:p,after:"]"})),A(),p+=d.move("]:"),l.children&&l.children.length>0&&(d.shift(4),p+=d.move((a?`
|
|
478
478
|
`:" ")+f.indentLines(f.containerFlow(l,d.current()),a?L0:EM))),g(),p}}function EM(n,a,i){return a===0?n:L0(n,a,i)}function L0(n,a,i){return(i?"":" ")+n}const wM=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];P0.peek=SM;function bM(){return{canContainEols:["delete"],enter:{strikethrough:CM},exit:{strikethrough:vM}}}function xM(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wM}],handlers:{delete:P0}}}function CM(n){this.enter({type:"delete",children:[]},n)}function vM(n){this.exit(n)}function P0(n,a,i,l){const u=i.createTracker(l),f=i.enter("strikethrough");let c=u.move("~~");return c+=i.containerPhrasing(n,Fe(le({},u.current()),{before:c,after:"~"})),c+=u.move("~~"),f(),c}function SM(){return"~"}function kM(n){return n.length}function IM(n,a){const i=a||{},l=(i.align||[]).concat(),u=i.stringLength||kM,f=[],c=[],d=[],p=[];let g=0,A=-1;for(;++A<n.length;){const w=[],k=[];let C=-1;for(n[A].length>g&&(g=n[A].length);++C<n[A].length;){const D=RM(n[A][C]);if(i.alignDelimiters!==!1){const B=u(D);k[C]=B,(p[C]===void 0||B>p[C])&&(p[C]=B)}w.push(D)}c[A]=w,d[A]=k}let m=-1;if(typeof l=="object"&&"length"in l)for(;++m<g;)f[m]=H0(l[m]);else{const w=H0(l);for(;++m<g;)f[m]=w}m=-1;const y=[],E=[];for(;++m<g;){const w=f[m];let k="",C="";w===99?(k=":",C=":"):w===108?k=":":w===114&&(C=":");let D=i.alignDelimiters===!1?1:Math.max(1,p[m]-k.length-C.length);const B=k+"-".repeat(D)+C;i.alignDelimiters!==!1&&(D=k.length+D+C.length,D>p[m]&&(p[m]=D),E[m]=D),y[m]=B}c.splice(1,0,y),d.splice(1,0,E),A=-1;const x=[];for(;++A<c.length;){const w=c[A],k=d[A];m=-1;const C=[];for(;++m<g;){const D=w[m]||"";let B="",H="";if(i.alignDelimiters!==!1){const F=p[m]-(k[m]||0),j=f[m];j===114?B=" ".repeat(F):j===99?F%2?(B=" ".repeat(F/2+.5),H=" ".repeat(F/2-.5)):(B=" ".repeat(F/2),H=B):H=" ".repeat(F)}i.delimiterStart!==!1&&!m&&C.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&D==="")&&(i.delimiterStart!==!1||m)&&C.push(" "),i.alignDelimiters!==!1&&C.push(B),C.push(D),i.alignDelimiters!==!1&&C.push(H),i.padding!==!1&&C.push(" "),(i.delimiterEnd!==!1||m!==g-1)&&C.push("|")}x.push(i.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return x.join(`
|
|
479
479
|
`)}function RM(n){return n==null?"":String(n)}function H0(n){const a=typeof n=="string"?n.codePointAt(0):0;return a===67||a===99?99:a===76||a===108?108:a===82||a===114?114:0}function DM(n,a,i,l){const u=i.enter("blockquote"),f=i.createTracker(l);f.move("> "),f.shift(2);const c=i.indentLines(i.containerFlow(n,f.current()),TM);return u(),c}function TM(n,a,i){return">"+(i?"":" ")+n}function BM(n,a){return G0(n,a.inConstruct,!0)&&!G0(n,a.notInConstruct,!1)}function G0(n,a,i){if(typeof a=="string"&&(a=[a]),!a||a.length===0)return i;let l=-1;for(;++l<a.length;)if(n.includes(a[l]))return!0;return!1}function K0(n,a,i,l){let u=-1;for(;++u<i.unsafe.length;)if(i.unsafe[u].character===`
|
|
480
480
|
`&&BM(i.stack,i.unsafe[u]))return/[ \t]/.test(l.before)?"":" ";return`\\
|