iflow-engine-base-3d 3.12.22 → 3.12.25
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/bim-engine-sdk.es.js +11 -7035
- package/dist/bim-engine-sdk.umd.js +559 -999
- package/dist/chunks/{engine-3d-NODP2UZP.js → engine-3d-DEKfHjXs.js} +400 -401
- package/dist/chunks/{sdk-assets-rr-2tUgO.js → sdk-assets-Dl8936wx.js} +1 -1
- package/dist/chunks/{sdk-runtime-Dh6NDrxA.js → sdk-runtime-CY1F9tN3.js} +2 -2
- package/dist/chunks/{three-vendor-Bm0q8_z9.js → three-vendor-Cy618JLY.js} +16650 -50149
- package/dist/iflow-engine-base.css +1 -1
- package/dist/index.d.ts +0 -36
- package/distGaussian/gaussian.es.js +14769 -14769
- package/distGaussian/gaussian.umd.js +23 -23
- package/distGaussian/index.d.ts +80 -80
- package/package.json +7 -3
- package/dist2d/dwg-preview.css +0 -1
- package/dist2d/dwg-preview.d.ts +0 -2
- package/dist2d/dwg-preview.es.js +0 -21462
- package/dist2d/dwg-preview.umd.js +0 -242
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
(function(rt,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("three"),require("@mkkellogg/gaussian-splats-3d")):typeof define=="function"&&define.amd?define(["exports","three","@mkkellogg/gaussian-splats-3d"],St):(rt=typeof globalThis<"u"?globalThis:rt||self,St(rt.Gaussian={},rt.THREE,rt.GaussianSplats3D))})(this,(function(rt,St,xn){"use strict";function na(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const d=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,d.get?d:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const dt=na(St),ia=na(xn);var Je=(a=>(a.LoadStart="gaussian-load-start",a.LoadProgress="gaussian-load-progress",a.Loaded="gaussian-loaded",a.LoadError="gaussian-load-error",a.SceneRemoved="gaussian-scene-removed",a.FpsUpdated="gaussian-fps-updated",a.ViewChanged="gaussian-view-changed",a))(Je||{});class En{listeners=new Map;on(e,t){const d=String(e);this.listeners.has(d)||this.listeners.set(d,[]),this.listeners.get(d).push(t)}off(e,t){const d=String(e),x=this.listeners.get(d);if(!x)return;const g=x.indexOf(t);g!==-1&&x.splice(g,1),x.length===0&&this.listeners.delete(d)}trigger(e,t){const d=this.listeners.get(String(e));!d||d.length===0||[...d].forEach(x=>{try{x(t)}catch(g){console.error(`[EventModuleGaussian] event handler failed: ${e}`,g)}})}clear(){this.listeners.clear()}dispose(){this.clear()}}class Sn{scene;constructor(e){this.scene=new dt.Scene,e&&(this.scene.background=new dt.Color(e))}getScene(){return this.scene}setBackgroundColor(e){this.scene.background=e==null?null:new dt.Color(e)}dispose(){this.scene.clear(),this.scene.background=null,this.scene.environment=null}}class bn{camera;container;cameraUp;initialLookAt;constructor(e,t,d,x){this.container=e,this.cameraUp=t,this.initialLookAt=x,this.camera=this.createCamera(d)}createCamera(e){const t=Math.max(this.container.clientWidth,1),d=Math.max(this.container.clientHeight,1),x=new dt.PerspectiveCamera(65,t/d,.1,5e3);return x.position.fromArray(e),x.up.fromArray(this.cameraUp).normalize(),x.lookAt(new dt.Vector3().fromArray(this.initialLookAt)),x.updateProjectionMatrix(),x}getCamera(){return this.camera}updateAspectRatio(e,t){this.camera.aspect=Math.max(e,1)/Math.max(t,1),this.camera.updateProjectionMatrix()}reset(e,t){e&&this.camera.position.fromArray(e),this.camera.lookAt(new dt.Vector3().fromArray(t??this.initialLookAt)),this.camera.updateMatrixWorld(!0)}dispose(){this.camera=null}}const _n="iflowbim.cn",Tn=512,An=128,In=150,wn=38,Dt=290,Jt=190;class Bn{THREE;text;scene;camera;material;sprites=[];size;viewportWidth=0;viewportHeight=0;constructor(e,t=_n){this.THREE=e,this.text=t,this.scene=new e.Scene,this.camera=new e.OrthographicCamera(0,1,1,0,-10,10),this.material=new e.SpriteMaterial({map:new e.CanvasTexture(this.createTextTexture()),transparent:!0,opacity:.46,depthTest:!1,depthWrite:!1,toneMapped:!1}),this.size=new e.Vector2}render(e){}dispose(){this.material.map?.dispose?.(),this.material.dispose?.(),this.sprites.length=0}createTextTexture(){const e=document.createElement("canvas");e.width=Tn,e.height=An;const t=e.getContext("2d");return t&&(t.clearRect(0,0,e.width,e.height),t.textAlign="center",t.textBaseline="middle",t.font="600 54px Arial, Helvetica, sans-serif",t.lineWidth=3,t.strokeStyle="rgba(0, 0, 0, 0.20)",t.fillStyle="rgba(255, 255, 255, 0.24)",t.strokeText(this.text,e.width/2,e.height/2),t.fillText(this.text,e.width/2,e.height/2)),e}updateLayout(e,t){if(e===this.viewportWidth&&t===this.viewportHeight)return;this.viewportWidth=e,this.viewportHeight=t,this.camera.left=-e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-t/2,this.camera.updateProjectionMatrix();const d=Math.ceil(e/Dt)+2,x=Math.ceil(t/Jt)+2,g=d*x;this.ensureSpriteCount(g);let u=0;const r=-e/2-Dt/2,c=-t/2-Jt/2;for(let l=0;l<x;l+=1)for(let b=0;b<d;b+=1){const T=this.sprites[u],E=r+b*Dt+l%2*(Dt/2),s=c+l*Jt;T.position.set(E,s,0),T.visible=!0,u+=1}for(let l=u;l<this.sprites.length;l+=1)this.sprites[l].visible=!1}ensureSpriteCount(e){for(;this.sprites.length<e;){const t=new this.THREE.Sprite(this.material);t.scale.set(In,wn,1),t.rotation.z=-.32,t.renderOrder=999999,this.scene.add(t),this.sprites.push(t)}}}class kn{renderer;viewer;container;animationId=null;isRenderingPaused=!0;fpsFrameCount=0;fpsLastTime=performance.now();fpsInfo={fps:0,frameTimeMs:0,minFps:0};watermark;onBeforeRenderCallback;onAfterRenderCallback;onFpsUpdatedCallback;constructor(e,t,d,x){this.container=e,this.renderer=this.createRenderer(x.antialias),this.watermark=new Bn(dt),this.viewer=new ia.Viewer({selfDrivenMode:!1,renderer:this.renderer,camera:d,threeScene:t,rootElement:e,useBuiltInControls:!0,cameraUp:x.cameraUp,initialCameraPosition:x.initialCameraPosition,initialCameraLookAt:x.initialCameraLookAt,sharedMemoryForWorkers:x.sharedMemoryForWorkers,gpuAcceleratedSort:x.gpuAcceleratedSort,sphericalHarmonicsDegree:x.sphericalHarmonicsDegree,...x.viewerOptions??{}})}createRenderer(e){const t=new dt.WebGLRenderer({antialias:e,alpha:!0,preserveDrawingBuffer:!1});return t.setSize(Math.max(this.container.clientWidth,1),Math.max(this.container.clientHeight,1)),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.container.appendChild(t.domElement),t}setOnBeforeRender(e){this.onBeforeRenderCallback=e}setOnAfterRender(e){this.onAfterRenderCallback=e}setOnFpsUpdated(e){this.onFpsUpdatedCallback=e}startRenderLoop(){this.animationId===null&&(this.isRenderingPaused=!1,this.animate())}animate(){if(this.isRenderingPaused){this.animationId=null;return}this.animationId=requestAnimationFrame(()=>this.animate()),this.render()}render(){this.onBeforeRenderCallback?.(),this.viewer.update(this.renderer),this.viewer.render(),this.watermark.render(this.renderer),this.onAfterRenderCallback?.(),this.updateFps()}updateFps(){this.fpsFrameCount++;const e=performance.now(),t=e-this.fpsLastTime;if(t<1e3)return;const d=Math.round(this.fpsFrameCount*1e3/t);this.fpsInfo={fps:d,frameTimeMs:d>0?1e3/d:0,minFps:this.fpsInfo.minFps===0?d:Math.min(this.fpsInfo.minFps,d)},this.fpsFrameCount=0,this.fpsLastTime=e,this.onFpsUpdatedCallback?.({...this.fpsInfo})}resetFpsStats(){this.fpsInfo={fps:0,frameTimeMs:0,minFps:0},this.fpsFrameCount=0,this.fpsLastTime=performance.now()}pauseRendering(){this.isRenderingPaused=!0,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}resumeRendering(){this.isRenderingPaused&&this.startRenderLoop()}isRenderingPausedState(){return this.isRenderingPaused}resize(e,t){this.renderer.setSize(Math.max(e,1),Math.max(t,1)),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2))}getViewer(){return this.viewer}getRenderer(){return this.renderer}getDomElement(){return this.renderer.domElement}getFpsInfo(){return{...this.fpsInfo}}async dispose(){this.pauseRendering(),await this.viewer.dispose(),this.container.contains(this.renderer.domElement)&&this.container.removeChild(this.renderer.domElement),this.watermark.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss()}}const Rn={identity:[0,0,0,1],"x-90":[-.7071068,0,0,.7071068],x90:[.7071068,0,0,.7071068],x180:[1,0,0,0],"y-90":[0,-.7071068,0,.7071068],y90:[0,.7071068,0,.7071068],"z-90":[0,0,-.7071068,.7071068],z90:[0,0,.7071068,.7071068],z180:[0,0,1,0]};class Nn{orientationPreset;constructor(e="x180"){this.orientationPreset=e}setOrientationPreset(e){this.orientationPreset=e}getOrientationPreset(){return this.orientationPreset}getOrientationRotation(){return[...Rn[this.orientationPreset]]}active(){}disActive(){}update(){}dispose(){}}var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ln(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var e=a.default;if(typeof e=="function"){var t=function d(){var x=!1;try{x=this instanceof d}catch{}return x?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(a).forEach(function(d){var x=Object.getOwnPropertyDescriptor(a,d);Object.defineProperty(t,d,x.get?x:{enumerable:!0,get:function(){return a[d]}})}),t}function Ut(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var er={exports:{}};var sa;function Dn(){return sa||(sa=1,(function(a,e){(function(t){a.exports=t()})(function(){return(function t(d,x,g){function u(l,b){if(!x[l]){if(!d[l]){var T=typeof Ut=="function"&&Ut;if(!b&&T)return T(l,!0);if(r)return r(l,!0);var E=new Error("Cannot find module '"+l+"'");throw E.code="MODULE_NOT_FOUND",E}var s=x[l]={exports:{}};d[l][0].call(s.exports,function(v){var h=d[l][1][v];return u(h||v)},s,s.exports,t,d,x,g)}return x[l].exports}for(var r=typeof Ut=="function"&&Ut,c=0;c<g.length;c++)u(g[c]);return u})({1:[function(t,d,x){var g=t("./utils"),u=t("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";x.encode=function(c){for(var l,b,T,E,s,v,h,y=[],n=0,p=c.length,m=p,_=g.getTypeOf(c)!=="string";n<c.length;)m=p-n,T=_?(l=c[n++],b=n<p?c[n++]:0,n<p?c[n++]:0):(l=c.charCodeAt(n++),b=n<p?c.charCodeAt(n++):0,n<p?c.charCodeAt(n++):0),E=l>>2,s=(3&l)<<4|b>>4,v=1<m?(15&b)<<2|T>>6:64,h=2<m?63&T:64,y.push(r.charAt(E)+r.charAt(s)+r.charAt(v)+r.charAt(h));return y.join("")},x.decode=function(c){var l,b,T,E,s,v,h=0,y=0,n="data:";if(c.substr(0,n.length)===n)throw new Error("Invalid base64 input, it looks like a data url.");var p,m=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===r.charAt(64)&&m--,c.charAt(c.length-2)===r.charAt(64)&&m--,m%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=u.uint8array?new Uint8Array(0|m):new Array(0|m);h<c.length;)l=r.indexOf(c.charAt(h++))<<2|(E=r.indexOf(c.charAt(h++)))>>4,b=(15&E)<<4|(s=r.indexOf(c.charAt(h++)))>>2,T=(3&s)<<6|(v=r.indexOf(c.charAt(h++))),p[y++]=l,s!==64&&(p[y++]=b),v!==64&&(p[y++]=T);return p}},{"./support":30,"./utils":32}],2:[function(t,d,x){var g=t("./external"),u=t("./stream/DataWorker"),r=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(b,T,E,s,v){this.compressedSize=b,this.uncompressedSize=T,this.crc32=E,this.compression=s,this.compressedContent=v}l.prototype={getContentWorker:function(){var b=new u(g.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),T=this;return b.on("end",function(){if(this.streamInfo.data_length!==T.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new u(g.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(b,T,E){return b.pipe(new r).pipe(new c("uncompressedSize")).pipe(T.compressWorker(E)).pipe(new c("compressedSize")).withStreamInfo("compression",T)},d.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,d,x){var g=t("./stream/GenericWorker");x.STORE={magic:"\0\0",compressWorker:function(){return new g("STORE compression")},uncompressWorker:function(){return new g("STORE decompression")}},x.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,d,x){var g=t("./utils"),u=(function(){for(var r,c=[],l=0;l<256;l++){r=l;for(var b=0;b<8;b++)r=1&r?3988292384^r>>>1:r>>>1;c[l]=r}return c})();d.exports=function(r,c){return r!==void 0&&r.length?g.getTypeOf(r)!=="string"?(function(l,b,T,E){var s=u,v=E+T;l^=-1;for(var h=E;h<v;h++)l=l>>>8^s[255&(l^b[h])];return-1^l})(0|c,r,r.length,0):(function(l,b,T,E){var s=u,v=E+T;l^=-1;for(var h=E;h<v;h++)l=l>>>8^s[255&(l^b.charCodeAt(h))];return-1^l})(0|c,r,r.length,0):0}},{"./utils":32}],5:[function(t,d,x){x.base64=!1,x.binary=!1,x.dir=!1,x.createFolders=!0,x.date=null,x.compression=null,x.compressionOptions=null,x.comment=null,x.unixPermissions=null,x.dosPermissions=null},{}],6:[function(t,d,x){var g=null;g=typeof Promise<"u"?Promise:t("lie"),d.exports={Promise:g}},{lie:37}],7:[function(t,d,x){var g=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",u=t("pako"),r=t("./utils"),c=t("./stream/GenericWorker"),l=g?"uint8array":"array";function b(T,E){c.call(this,"FlateWorker/"+T),this._pako=null,this._pakoAction=T,this._pakoOptions=E,this.meta={}}x.magic="\b\0",r.inherits(b,c),b.prototype.processChunk=function(T){this.meta=T.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(l,T.data),!1)},b.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new u[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var T=this;this._pako.onData=function(E){T.push({data:E,meta:T.meta})}},x.compressWorker=function(T){return new b("Deflate",T)},x.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,d,x){function g(s,v){var h,y="";for(h=0;h<v;h++)y+=String.fromCharCode(255&s),s>>>=8;return y}function u(s,v,h,y,n,p){var m,_,w=s.file,C=s.compression,o=p!==l.utf8encode,i=r.transformTo("string",p(w.name)),B=r.transformTo("string",l.utf8encode(w.name)),N=w.comment,q=r.transformTo("string",p(N)),I=r.transformTo("string",l.utf8encode(N)),F=B.length!==w.name.length,A=I.length!==N.length,H="",j="",W="",re=w.dir,J=w.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};v&&!h||(oe.crc32=s.crc32,oe.compressedSize=s.compressedSize,oe.uncompressedSize=s.uncompressedSize);var Q=0;v&&(Q|=8),o||!F&&!A||(Q|=2048);var $=0,ce=0;re&&($|=16),n==="UNIX"?(ce=798,$|=(function(ee,ue){var Se=ee;return ee||(Se=ue?16893:33204),(65535&Se)<<16})(w.unixPermissions,re)):(ce=20,$|=(function(ee){return 63&(ee||0)})(w.dosPermissions)),m=J.getUTCHours(),m<<=6,m|=J.getUTCMinutes(),m<<=5,m|=J.getUTCSeconds()/2,_=J.getUTCFullYear()-1980,_<<=4,_|=J.getUTCMonth()+1,_<<=5,_|=J.getUTCDate(),F&&(j=g(1,1)+g(b(i),4)+B,H+="up"+g(j.length,2)+j),A&&(W=g(1,1)+g(b(q),4)+I,H+="uc"+g(W.length,2)+W);var ie="";return ie+=`
|
|
2
|
-
\0`,ie+=g(Q,2),ie+=C.magic,ie+=g(m,2),ie+=g(_,2),ie+=g(oe.crc32,4),ie+=g(oe.compressedSize,4),ie+=g(oe.uncompressedSize,4),ie+=g(i.length,2),ie+=g(H.length,2),{fileRecord:T.LOCAL_FILE_HEADER+ie+i+H,dirRecord:T.CENTRAL_FILE_HEADER+g(ce,2)+ie+g(q.length,2)+"\0\0\0\0"+g($,4)+g(y,4)+i+H+q}}var r=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),b=t("../crc32"),T=t("../signature");function E(s,v,h,y){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=h,this.encodeFileName=y,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(E,c),E.prototype.push=function(s){var v=s.meta.percent||0,h=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,c.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:h?(v+100*(h-y-1))/h:100}}))},E.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var v=this.streamFiles&&!s.file.dir;if(v){var h=u(s,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},E.prototype.closedSource=function(s){this.accumulate=!1;var v=this.streamFiles&&!s.file.dir,h=u(s,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),v)this.push({data:(function(y){return T.DATA_DESCRIPTOR+g(y.crc32,4)+g(y.compressedSize,4)+g(y.uncompressedSize,4)})(s),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},E.prototype.flush=function(){for(var s=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var h=this.bytesWritten-s,y=(function(n,p,m,_,w){var C=r.transformTo("string",w(_));return T.CENTRAL_DIRECTORY_END+"\0\0\0\0"+g(n,2)+g(n,2)+g(p,4)+g(m,4)+g(C.length,2)+C})(this.dirRecords.length,h,s,this.zipComment,this.encodeFileName);this.push({data:y,meta:{percent:100}})},E.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},E.prototype.registerPrevious=function(s){this._sources.push(s);var v=this;return s.on("data",function(h){v.processChunk(h)}),s.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),s.on("error",function(h){v.error(h)}),this},E.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},E.prototype.error=function(s){var v=this._sources;if(!c.prototype.error.call(this,s))return!1;for(var h=0;h<v.length;h++)try{v[h].error(s)}catch{}return!0},E.prototype.lock=function(){c.prototype.lock.call(this);for(var s=this._sources,v=0;v<s.length;v++)s[v].lock()},d.exports=E},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,d,x){var g=t("../compressions"),u=t("./ZipFileWorker");x.generateWorker=function(r,c,l){var b=new u(c.streamFiles,l,c.platform,c.encodeFileName),T=0;try{r.forEach(function(E,s){T++;var v=(function(p,m){var _=p||m,w=g[_];if(!w)throw new Error(_+" is not a valid compression method !");return w})(s.options.compression,c.compression),h=s.options.compressionOptions||c.compressionOptions||{},y=s.dir,n=s.date;s._compressWorker(v,h).withStreamInfo("file",{name:E,dir:y,date:n,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(b)}),b.entriesCount=T}catch(E){b.error(E)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,d,x){function g(){if(!(this instanceof g))return new g;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 u=new g;for(var r in this)typeof this[r]!="function"&&(u[r]=this[r]);return u}}(g.prototype=t("./object")).loadAsync=t("./load"),g.support=t("./support"),g.defaults=t("./defaults"),g.version="3.10.1",g.loadAsync=function(u,r){return new g().loadAsync(u,r)},g.external=t("./external"),d.exports=g},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,d,x){var g=t("./utils"),u=t("./external"),r=t("./utf8"),c=t("./zipEntries"),l=t("./stream/Crc32Probe"),b=t("./nodejsUtils");function T(E){return new u.Promise(function(s,v){var h=E.decompressed.getContentWorker().pipe(new l);h.on("error",function(y){v(y)}).on("end",function(){h.streamInfo.crc32!==E.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):s()}).resume()})}d.exports=function(E,s){var v=this;return s=g.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),b.isNode&&b.isStream(E)?u.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):g.prepareContent("the loaded zip file",E,!0,s.optimizedBinaryString,s.base64).then(function(h){var y=new c(s);return y.load(h),y}).then(function(h){var y=[u.Promise.resolve(h)],n=h.files;if(s.checkCRC32)for(var p=0;p<n.length;p++)y.push(T(n[p]));return u.Promise.all(y)}).then(function(h){for(var y=h.shift(),n=y.files,p=0;p<n.length;p++){var m=n[p],_=m.fileNameStr,w=g.resolve(m.fileNameStr);v.file(w,m.decompressed,{binary:!0,optimizedBinaryString:!0,date:m.date,dir:m.dir,comment:m.fileCommentStr.length?m.fileCommentStr:null,unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions,createFolders:s.createFolders}),m.dir||(v.file(w).unsafeOriginalName=_)}return y.zipComment.length&&(v.comment=y.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,d,x){var g=t("../utils"),u=t("../stream/GenericWorker");function r(c,l){u.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}g.inherits(r,u),r.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(b){l.push({data:b,meta:{percent:0}})}).on("error",function(b){l.isPaused?this.generatedError=b:l.error(b)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},r.prototype.pause=function(){return!!u.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},d.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,d,x){var g=t("readable-stream").Readable;function u(r,c,l){g.call(this,c),this._helper=r;var b=this;r.on("data",function(T,E){b.push(T)||b._helper.pause(),l&&l(E)}).on("error",function(T){b.emit("error",T)}).on("end",function(){b.push(null)})}t("../utils").inherits(u,g),u.prototype._read=function(){this._helper.resume()},d.exports=u},{"../utils":32,"readable-stream":16}],14:[function(t,d,x){d.exports={isNode:typeof Buffer<"u",newBufferFrom:function(g,u){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(g,u);if(typeof g=="number")throw new Error('The "data" argument must not be a number');return new Buffer(g,u)},allocBuffer:function(g){if(Buffer.alloc)return Buffer.alloc(g);var u=new Buffer(g);return u.fill(0),u},isBuffer:function(g){return Buffer.isBuffer(g)},isStream:function(g){return g&&typeof g.on=="function"&&typeof g.pause=="function"&&typeof g.resume=="function"}}},{}],15:[function(t,d,x){function g(w,C,o){var i,B=r.getTypeOf(C),N=r.extend(o||{},b);N.date=N.date||new Date,N.compression!==null&&(N.compression=N.compression.toUpperCase()),typeof N.unixPermissions=="string"&&(N.unixPermissions=parseInt(N.unixPermissions,8)),N.unixPermissions&&16384&N.unixPermissions&&(N.dir=!0),N.dosPermissions&&16&N.dosPermissions&&(N.dir=!0),N.dir&&(w=n(w)),N.createFolders&&(i=y(w))&&p.call(this,i,!0);var q=B==="string"&&N.binary===!1&&N.base64===!1;o&&o.binary!==void 0||(N.binary=!q),(C instanceof T&&C.uncompressedSize===0||N.dir||!C||C.length===0)&&(N.base64=!1,N.binary=!0,C="",N.compression="STORE",B="string");var I=null;I=C instanceof T||C instanceof c?C:v.isNode&&v.isStream(C)?new h(w,C):r.prepareContent(w,C,N.binary,N.optimizedBinaryString,N.base64);var F=new E(w,I,N);this.files[w]=F}var u=t("./utf8"),r=t("./utils"),c=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),b=t("./defaults"),T=t("./compressedObject"),E=t("./zipObject"),s=t("./generate"),v=t("./nodejsUtils"),h=t("./nodejs/NodejsStreamInputAdapter"),y=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var C=w.lastIndexOf("/");return 0<C?w.substring(0,C):""},n=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},p=function(w,C){return C=C!==void 0?C:b.createFolders,w=n(w),this.files[w]||g.call(this,w,null,{dir:!0,createFolders:C}),this.files[w]};function m(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var C,o,i;for(C in this.files)i=this.files[C],(o=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&w(o,i)},filter:function(w){var C=[];return this.forEach(function(o,i){w(o,i)&&C.push(i)}),C},file:function(w,C,o){if(arguments.length!==1)return w=this.root+w,g.call(this,w,C,o),this;if(m(w)){var i=w;return this.filter(function(N,q){return!q.dir&&i.test(N)})}var B=this.files[this.root+w];return B&&!B.dir?B:null},folder:function(w){if(!w)return this;if(m(w))return this.filter(function(B,N){return N.dir&&w.test(B)});var C=this.root+w,o=p.call(this,C),i=this.clone();return i.root=o.name,i},remove:function(w){w=this.root+w;var C=this.files[w];if(C||(w.slice(-1)!=="/"&&(w+="/"),C=this.files[w]),C&&!C.dir)delete this.files[w];else for(var o=this.filter(function(B,N){return N.name.slice(0,w.length)===w}),i=0;i<o.length;i++)delete this.files[o[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var C,o={};try{if((o=r.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:u.utf8encode})).type=o.type.toLowerCase(),o.compression=o.compression.toUpperCase(),o.type==="binarystring"&&(o.type="string"),!o.type)throw new Error("No output type specified.");r.checkSupport(o.type),o.platform!=="darwin"&&o.platform!=="freebsd"&&o.platform!=="linux"&&o.platform!=="sunos"||(o.platform="UNIX"),o.platform==="win32"&&(o.platform="DOS");var i=o.comment||this.comment||"";C=s.generateWorker(this,o,i)}catch(B){(C=new c("error")).error(B)}return new l(C,o.type||"string",o.mimeType)},generateAsync:function(w,C){return this.generateInternalStream(w).accumulate(C)},generateNodeStream:function(w,C){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(C)}};d.exports=_},{"./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(t,d,x){d.exports=t("stream")},{stream:void 0}],17:[function(t,d,x){var g=t("./DataReader");function u(r){g.call(this,r);for(var c=0;c<this.data.length;c++)r[c]=255&r[c]}t("../utils").inherits(u,g),u.prototype.byteAt=function(r){return this.data[this.zero+r]},u.prototype.lastIndexOfSignature=function(r){for(var c=r.charCodeAt(0),l=r.charCodeAt(1),b=r.charCodeAt(2),T=r.charCodeAt(3),E=this.length-4;0<=E;--E)if(this.data[E]===c&&this.data[E+1]===l&&this.data[E+2]===b&&this.data[E+3]===T)return E-this.zero;return-1},u.prototype.readAndCheckSignature=function(r){var c=r.charCodeAt(0),l=r.charCodeAt(1),b=r.charCodeAt(2),T=r.charCodeAt(3),E=this.readData(4);return c===E[0]&&l===E[1]&&b===E[2]&&T===E[3]},u.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./DataReader":18}],18:[function(t,d,x){var g=t("../utils");function u(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}u.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var c,l=0;for(this.checkOffset(r),c=this.index+r-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=r,l},readString:function(r){return g.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},d.exports=u},{"../utils":32}],19:[function(t,d,x){var g=t("./Uint8ArrayReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,d,x){var g=t("./DataReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},u.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},u.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},u.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./DataReader":18}],21:[function(t,d,x){var g=t("./ArrayReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./ArrayReader":17}],22:[function(t,d,x){var g=t("../utils"),u=t("../support"),r=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),b=t("./Uint8ArrayReader");d.exports=function(T){var E=g.getTypeOf(T);return g.checkSupport(E),E!=="string"||u.uint8array?E==="nodebuffer"?new l(T):u.uint8array?new b(g.transformTo("uint8array",T)):new r(g.transformTo("array",T)):new c(T)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,d,x){x.LOCAL_FILE_HEADER="PK",x.CENTRAL_FILE_HEADER="PK",x.CENTRAL_DIRECTORY_END="PK",x.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",x.ZIP64_CENTRAL_DIRECTORY_END="PK",x.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,d,x){var g=t("./GenericWorker"),u=t("../utils");function r(c){g.call(this,"ConvertWorker to "+c),this.destType=c}u.inherits(r,g),r.prototype.processChunk=function(c){this.push({data:u.transformTo(this.destType,c.data),meta:c.meta})},d.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(t,d,x){var g=t("./GenericWorker"),u=t("../crc32");function r(){g.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(r,g),r.prototype.processChunk=function(c){this.streamInfo.crc32=u(c.data,this.streamInfo.crc32||0),this.push(c)},d.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,d,x){var g=t("../utils"),u=t("./GenericWorker");function r(c){u.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}g.inherits(r,u),r.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}u.prototype.processChunk.call(this,c)},d.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(t,d,x){var g=t("../utils"),u=t("./GenericWorker");function r(c){u.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(b){l.dataIsReady=!0,l.data=b,l.max=b&&b.length||0,l.type=g.getTypeOf(b),l.isPaused||l._tickAndRepeat()},function(b){l.error(b)})}g.inherits(r,u),r.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,g.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(g.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},d.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(t,d,x){function g(u){this.name=u||"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}g.prototype={push:function(u){this.emit("data",u)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(u){this.emit("error",u)}return!0},error:function(u){return!this.isFinished&&(this.isPaused?this.generatedError=u:(this.isFinished=!0,this.emit("error",u),this.previous&&this.previous.error(u),this.cleanUp()),!0)},on:function(u,r){return this._listeners[u].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(u,r){if(this._listeners[u])for(var c=0;c<this._listeners[u].length;c++)this._listeners[u][c].call(this,r)},pipe:function(u){return u.registerPrevious(this)},registerPrevious:function(u){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=u.streamInfo,this.mergeStreamInfo(),this.previous=u;var r=this;return u.on("data",function(c){r.processChunk(c)}),u.on("end",function(){r.end()}),u.on("error",function(c){r.error(c)}),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 u=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),u=!0),this.previous&&this.previous.resume(),!u},flush:function(){},processChunk:function(u){this.push(u)},withStreamInfo:function(u,r){return this.extraStreamInfo[u]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var u in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,u)&&(this.streamInfo[u]=this.extraStreamInfo[u])},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 u="Worker "+this.name;return this.previous?this.previous+" -> "+u:u}},d.exports=g},{}],29:[function(t,d,x){var g=t("../utils"),u=t("./ConvertWorker"),r=t("./GenericWorker"),c=t("../base64"),l=t("../support"),b=t("../external"),T=null;if(l.nodestream)try{T=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function E(v,h){return new b.Promise(function(y,n){var p=[],m=v._internalType,_=v._outputType,w=v._mimeType;v.on("data",function(C,o){p.push(C),h&&h(o)}).on("error",function(C){p=[],n(C)}).on("end",function(){try{var C=(function(o,i,B){switch(o){case"blob":return g.newBlob(g.transformTo("arraybuffer",i),B);case"base64":return c.encode(i);default:return g.transformTo(o,i)}})(_,(function(o,i){var B,N=0,q=null,I=0;for(B=0;B<i.length;B++)I+=i[B].length;switch(o){case"string":return i.join("");case"array":return Array.prototype.concat.apply([],i);case"uint8array":for(q=new Uint8Array(I),B=0;B<i.length;B++)q.set(i[B],N),N+=i[B].length;return q;case"nodebuffer":return Buffer.concat(i);default:throw new Error("concat : unsupported type '"+o+"'")}})(m,p),w);y(C)}catch(o){n(o)}p=[]}).resume()})}function s(v,h,y){var n=h;switch(h){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=h,this._mimeType=y,g.checkSupport(n),this._worker=v.pipe(new u(n)),v.lock()}catch(p){this._worker=new r("error"),this._worker.error(p)}}s.prototype={accumulate:function(v){return E(this,v)},on:function(v,h){var y=this;return v==="data"?this._worker.on(v,function(n){h.call(y,n.data,n.meta)}):this._worker.on(v,function(){g.delay(h,arguments,y)}),this},resume:function(){return g.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(v){if(g.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new T(this,{objectMode:this._outputType!=="nodebuffer"},v)}},d.exports=s},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,d,x){if(x.base64=!0,x.array=!0,x.string=!0,x.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",x.nodebuffer=typeof Buffer<"u",x.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")x.blob=!1;else{var g=new ArrayBuffer(0);try{x.blob=new Blob([g],{type:"application/zip"}).size===0}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);u.append(g),x.blob=u.getBlob("application/zip").size===0}catch{x.blob=!1}}}try{x.nodestream=!!t("readable-stream").Readable}catch{x.nodestream=!1}},{"readable-stream":16}],31:[function(t,d,x){for(var g=t("./utils"),u=t("./support"),r=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),b=0;b<256;b++)l[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;l[254]=l[254]=1;function T(){c.call(this,"utf-8 decode"),this.leftOver=null}function E(){c.call(this,"utf-8 encode")}x.utf8encode=function(s){return u.nodebuffer?r.newBufferFrom(s,"utf-8"):(function(v){var h,y,n,p,m,_=v.length,w=0;for(p=0;p<_;p++)(64512&(y=v.charCodeAt(p)))==55296&&p+1<_&&(64512&(n=v.charCodeAt(p+1)))==56320&&(y=65536+(y-55296<<10)+(n-56320),p++),w+=y<128?1:y<2048?2:y<65536?3:4;for(h=u.uint8array?new Uint8Array(w):new Array(w),p=m=0;m<w;p++)(64512&(y=v.charCodeAt(p)))==55296&&p+1<_&&(64512&(n=v.charCodeAt(p+1)))==56320&&(y=65536+(y-55296<<10)+(n-56320),p++),y<128?h[m++]=y:(y<2048?h[m++]=192|y>>>6:(y<65536?h[m++]=224|y>>>12:(h[m++]=240|y>>>18,h[m++]=128|y>>>12&63),h[m++]=128|y>>>6&63),h[m++]=128|63&y);return h})(s)},x.utf8decode=function(s){return u.nodebuffer?g.transformTo("nodebuffer",s).toString("utf-8"):(function(v){var h,y,n,p,m=v.length,_=new Array(2*m);for(h=y=0;h<m;)if((n=v[h++])<128)_[y++]=n;else if(4<(p=l[n]))_[y++]=65533,h+=p-1;else{for(n&=p===2?31:p===3?15:7;1<p&&h<m;)n=n<<6|63&v[h++],p--;1<p?_[y++]=65533:n<65536?_[y++]=n:(n-=65536,_[y++]=55296|n>>10&1023,_[y++]=56320|1023&n)}return _.length!==y&&(_.subarray?_=_.subarray(0,y):_.length=y),g.applyFromCharCode(_)})(s=g.transformTo(u.uint8array?"uint8array":"array",s))},g.inherits(T,c),T.prototype.processChunk=function(s){var v=g.transformTo(u.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(u.uint8array){var h=v;(v=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),v.set(h,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var y=(function(p,m){var _;for((m=m||p.length)>p.length&&(m=p.length),_=m-1;0<=_&&(192&p[_])==128;)_--;return _<0||_===0?m:_+l[p[_]]>m?_:m})(v),n=v;y!==v.length&&(u.uint8array?(n=v.subarray(0,y),this.leftOver=v.subarray(y,v.length)):(n=v.slice(0,y),this.leftOver=v.slice(y,v.length))),this.push({data:x.utf8decode(n),meta:s.meta})},T.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:x.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},x.Utf8DecodeWorker=T,g.inherits(E,c),E.prototype.processChunk=function(s){this.push({data:x.utf8encode(s.data),meta:s.meta})},x.Utf8EncodeWorker=E},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,d,x){var g=t("./support"),u=t("./base64"),r=t("./nodejsUtils"),c=t("./external");function l(h){return h}function b(h,y){for(var n=0;n<h.length;++n)y[n]=255&h.charCodeAt(n);return y}t("setimmediate"),x.newBlob=function(h,y){x.checkSupport("blob");try{return new Blob([h],{type:y})}catch{try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(h),n.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var T={stringifyByChunk:function(h,y,n){var p=[],m=0,_=h.length;if(_<=n)return String.fromCharCode.apply(null,h);for(;m<_;)y==="array"||y==="nodebuffer"?p.push(String.fromCharCode.apply(null,h.slice(m,Math.min(m+n,_)))):p.push(String.fromCharCode.apply(null,h.subarray(m,Math.min(m+n,_)))),m+=n;return p.join("")},stringifyByChar:function(h){for(var y="",n=0;n<h.length;n++)y+=String.fromCharCode(h[n]);return y},applyCanBeUsed:{uint8array:(function(){try{return g.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return g.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function E(h){var y=65536,n=x.getTypeOf(h),p=!0;if(n==="uint8array"?p=T.applyCanBeUsed.uint8array:n==="nodebuffer"&&(p=T.applyCanBeUsed.nodebuffer),p)for(;1<y;)try{return T.stringifyByChunk(h,n,y)}catch{y=Math.floor(y/2)}return T.stringifyByChar(h)}function s(h,y){for(var n=0;n<h.length;n++)y[n]=h[n];return y}x.applyFromCharCode=E;var v={};v.string={string:l,array:function(h){return b(h,new Array(h.length))},arraybuffer:function(h){return v.string.uint8array(h).buffer},uint8array:function(h){return b(h,new Uint8Array(h.length))},nodebuffer:function(h){return b(h,r.allocBuffer(h.length))}},v.array={string:E,array:l,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return r.newBufferFrom(h)}},v.arraybuffer={string:function(h){return E(new Uint8Array(h))},array:function(h){return s(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:l,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return r.newBufferFrom(new Uint8Array(h))}},v.uint8array={string:E,array:function(h){return s(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:l,nodebuffer:function(h){return r.newBufferFrom(h)}},v.nodebuffer={string:E,array:function(h){return s(h,new Array(h.length))},arraybuffer:function(h){return v.nodebuffer.uint8array(h).buffer},uint8array:function(h){return s(h,new Uint8Array(h.length))},nodebuffer:l},x.transformTo=function(h,y){if(y=y||"",!h)return y;x.checkSupport(h);var n=x.getTypeOf(y);return v[n][h](y)},x.resolve=function(h){for(var y=h.split("/"),n=[],p=0;p<y.length;p++){var m=y[p];m==="."||m===""&&p!==0&&p!==y.length-1||(m===".."?n.pop():n.push(m))}return n.join("/")},x.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":g.nodebuffer&&r.isBuffer(h)?"nodebuffer":g.uint8array&&h instanceof Uint8Array?"uint8array":g.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},x.checkSupport=function(h){if(!g[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},x.MAX_VALUE_16BITS=65535,x.MAX_VALUE_32BITS=-1,x.pretty=function(h){var y,n,p="";for(n=0;n<(h||"").length;n++)p+="\\x"+((y=h.charCodeAt(n))<16?"0":"")+y.toString(16).toUpperCase();return p},x.delay=function(h,y,n){setImmediate(function(){h.apply(n||null,y||[])})},x.inherits=function(h,y){function n(){}n.prototype=y.prototype,h.prototype=new n},x.extend=function(){var h,y,n={};for(h=0;h<arguments.length;h++)for(y in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],y)&&n[y]===void 0&&(n[y]=arguments[h][y]);return n},x.prepareContent=function(h,y,n,p,m){return c.Promise.resolve(y).then(function(_){return g.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)&&typeof FileReader<"u"?new c.Promise(function(w,C){var o=new FileReader;o.onload=function(i){w(i.target.result)},o.onerror=function(i){C(i.target.error)},o.readAsArrayBuffer(_)}):_}).then(function(_){var w=x.getTypeOf(_);return w?(w==="arraybuffer"?_=x.transformTo("uint8array",_):w==="string"&&(m?_=u.decode(_):n&&p!==!0&&(_=(function(C){return b(C,g.uint8array?new Uint8Array(C.length):new Array(C.length))})(_))),_):c.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,d,x){var g=t("./reader/readerFor"),u=t("./utils"),r=t("./signature"),c=t("./zipEntry"),l=t("./support");function b(T){this.files=[],this.loadOptions=T}b.prototype={checkSignature:function(T){if(!this.reader.readAndCheckSignature(T)){this.reader.index-=4;var E=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+u.pretty(E)+", expected "+u.pretty(T)+")")}},isSignature:function(T,E){var s=this.reader.index;this.reader.setIndex(T);var v=this.reader.readString(4)===E;return this.reader.setIndex(s),v},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 T=this.reader.readData(this.zipCommentLength),E=l.uint8array?"uint8array":"array",s=u.transformTo(E,T);this.zipComment=this.loadOptions.decodeFileName(s)},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 T,E,s,v=this.zip64EndOfCentralSize-44;0<v;)T=this.reader.readInt(2),E=this.reader.readInt(4),s=this.reader.readData(E),this.zip64ExtensibleData[T]={id:T,length:E,value:s}},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 T,E;for(T=0;T<this.files.length;T++)E=this.files[T],this.reader.setIndex(E.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),E.readLocalPart(this.reader),E.handleUTF8(),E.processAttributes()},readCentralDir:function(){var T;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(T=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(T);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 T=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(T<0)throw this.isSignature(0,r.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(T);var E=T;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===u.MAX_VALUE_16BITS||this.diskWithCentralDirStart===u.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===u.MAX_VALUE_16BITS||this.centralDirRecords===u.MAX_VALUE_16BITS||this.centralDirSize===u.MAX_VALUE_32BITS||this.centralDirOffset===u.MAX_VALUE_32BITS){if(this.zip64=!0,(T=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(T),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var v=E-s;if(0<v)this.isSignature(E,r.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(T){this.reader=g(T)},load:function(T){this.prepareReader(T),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},d.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,d,x){var g=t("./reader/readerFor"),u=t("./utils"),r=t("./compressedObject"),c=t("./crc32"),l=t("./utf8"),b=t("./compressions"),T=t("./support");function E(s,v){this.options=s,this.loadOptions=v}E.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var v,h;if(s.skip(22),this.fileNameLength=s.readInt(2),h=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.skip(h),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((v=(function(y){for(var n in b)if(Object.prototype.hasOwnProperty.call(b,n)&&b[n].magic===y)return b[n];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+u.pretty(this.compressionMethod)+" unknown (inner file : "+u.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,v,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var v=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(v),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=g(this.extraFields[1].value);this.uncompressedSize===u.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===u.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===u.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===u.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var v,h,y,n=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<n;)v=s.readInt(2),h=s.readInt(2),y=s.readData(h),this.extraFields[v]={id:v,length:h,value:y};s.setIndex(n)},handleUTF8:function(){var s=T.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var h=u.transformTo(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var n=u.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var v=g(s.value);return v.readInt(1)!==1||c(this.fileName)!==v.readInt(4)?null:l.utf8decode(v.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var v=g(s.value);return v.readInt(1)!==1||c(this.fileComment)!==v.readInt(4)?null:l.utf8decode(v.readData(s.length-5))}return null}},d.exports=E},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,d,x){function g(v,h,y){this.name=v,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=h,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var u=t("./stream/StreamHelper"),r=t("./stream/DataWorker"),c=t("./utf8"),l=t("./compressedObject"),b=t("./stream/GenericWorker");g.prototype={internalStream:function(v){var h=null,y="string";try{if(!v)throw new Error("No output type specified.");var n=(y=v.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),h=this._decompressWorker();var p=!this._dataBinary;p&&!n&&(h=h.pipe(new c.Utf8EncodeWorker)),!p&&n&&(h=h.pipe(new c.Utf8DecodeWorker))}catch(m){(h=new b("error")).error(m)}return new u(h,y,"")},async:function(v,h){return this.internalStream(v).accumulate(h)},nodeStream:function(v,h){return this.internalStream(v||"nodebuffer").toNodejsStream(h)},_compressWorker:function(v,h){if(this._data instanceof l&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(y,v,h)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof b?this._data:new r(this._data)}};for(var T=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],E=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},s=0;s<T.length;s++)g.prototype[T[s]]=E;d.exports=g},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,d,x){(function(g){var u,r,c=g.MutationObserver||g.WebKitMutationObserver;if(c){var l=0,b=new c(v),T=g.document.createTextNode("");b.observe(T,{characterData:!0}),u=function(){T.data=l=++l%2}}else if(g.setImmediate||g.MessageChannel===void 0)u="document"in g&&"onreadystatechange"in g.document.createElement("script")?function(){var h=g.document.createElement("script");h.onreadystatechange=function(){v(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},g.document.documentElement.appendChild(h)}:function(){setTimeout(v,0)};else{var E=new g.MessageChannel;E.port1.onmessage=v,u=function(){E.port2.postMessage(0)}}var s=[];function v(){var h,y;r=!0;for(var n=s.length;n;){for(y=s,s=[],h=-1;++h<n;)y[h]();n=s.length}r=!1}d.exports=function(h){s.push(h)!==1||r||u()}}).call(this,typeof bt<"u"?bt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,d,x){var g=t("immediate");function u(){}var r={},c=["REJECTED"],l=["FULFILLED"],b=["PENDING"];function T(n){if(typeof n!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,n!==u&&h(this,n)}function E(n,p,m){this.promise=n,typeof p=="function"&&(this.onFulfilled=p,this.callFulfilled=this.otherCallFulfilled),typeof m=="function"&&(this.onRejected=m,this.callRejected=this.otherCallRejected)}function s(n,p,m){g(function(){var _;try{_=p(m)}catch(w){return r.reject(n,w)}_===n?r.reject(n,new TypeError("Cannot resolve promise with itself")):r.resolve(n,_)})}function v(n){var p=n&&n.then;if(n&&(typeof n=="object"||typeof n=="function")&&typeof p=="function")return function(){p.apply(n,arguments)}}function h(n,p){var m=!1;function _(o){m||(m=!0,r.reject(n,o))}function w(o){m||(m=!0,r.resolve(n,o))}var C=y(function(){p(w,_)});C.status==="error"&&_(C.value)}function y(n,p){var m={};try{m.value=n(p),m.status="success"}catch(_){m.status="error",m.value=_}return m}(d.exports=T).prototype.finally=function(n){if(typeof n!="function")return this;var p=this.constructor;return this.then(function(m){return p.resolve(n()).then(function(){return m})},function(m){return p.resolve(n()).then(function(){throw m})})},T.prototype.catch=function(n){return this.then(null,n)},T.prototype.then=function(n,p){if(typeof n!="function"&&this.state===l||typeof p!="function"&&this.state===c)return this;var m=new this.constructor(u);return this.state!==b?s(m,this.state===l?n:p,this.outcome):this.queue.push(new E(m,n,p)),m},E.prototype.callFulfilled=function(n){r.resolve(this.promise,n)},E.prototype.otherCallFulfilled=function(n){s(this.promise,this.onFulfilled,n)},E.prototype.callRejected=function(n){r.reject(this.promise,n)},E.prototype.otherCallRejected=function(n){s(this.promise,this.onRejected,n)},r.resolve=function(n,p){var m=y(v,p);if(m.status==="error")return r.reject(n,m.value);var _=m.value;if(_)h(n,_);else{n.state=l,n.outcome=p;for(var w=-1,C=n.queue.length;++w<C;)n.queue[w].callFulfilled(p)}return n},r.reject=function(n,p){n.state=c,n.outcome=p;for(var m=-1,_=n.queue.length;++m<_;)n.queue[m].callRejected(p);return n},T.resolve=function(n){return n instanceof this?n:r.resolve(new this(u),n)},T.reject=function(n){var p=new this(u);return r.reject(p,n)},T.all=function(n){var p=this;if(Object.prototype.toString.call(n)!=="[object Array]")return this.reject(new TypeError("must be an array"));var m=n.length,_=!1;if(!m)return this.resolve([]);for(var w=new Array(m),C=0,o=-1,i=new this(u);++o<m;)B(n[o],o);return i;function B(N,q){p.resolve(N).then(function(I){w[q]=I,++C!==m||_||(_=!0,r.resolve(i,w))},function(I){_||(_=!0,r.reject(i,I))})}},T.race=function(n){var p=this;if(Object.prototype.toString.call(n)!=="[object Array]")return this.reject(new TypeError("must be an array"));var m=n.length,_=!1;if(!m)return this.resolve([]);for(var w=-1,C=new this(u);++w<m;)o=n[w],p.resolve(o).then(function(i){_||(_=!0,r.resolve(C,i))},function(i){_||(_=!0,r.reject(C,i))});var o;return C}},{immediate:36}],38:[function(t,d,x){var g={};(0,t("./lib/utils/common").assign)(g,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),d.exports=g},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,d,x){var g=t("./zlib/deflate"),u=t("./utils/common"),r=t("./utils/strings"),c=t("./zlib/messages"),l=t("./zlib/zstream"),b=Object.prototype.toString,T=0,E=-1,s=0,v=8;function h(n){if(!(this instanceof h))return new h(n);this.options=u.assign({level:E,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:s,to:""},n||{});var p=this.options;p.raw&&0<p.windowBits?p.windowBits=-p.windowBits:p.gzip&&0<p.windowBits&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var m=g.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(m!==T)throw new Error(c[m]);if(p.header&&g.deflateSetHeader(this.strm,p.header),p.dictionary){var _;if(_=typeof p.dictionary=="string"?r.string2buf(p.dictionary):b.call(p.dictionary)==="[object ArrayBuffer]"?new Uint8Array(p.dictionary):p.dictionary,(m=g.deflateSetDictionary(this.strm,_))!==T)throw new Error(c[m]);this._dict_set=!0}}function y(n,p){var m=new h(p);if(m.push(n,!0),m.err)throw m.msg||c[m.err];return m.result}h.prototype.push=function(n,p){var m,_,w=this.strm,C=this.options.chunkSize;if(this.ended)return!1;_=p===~~p?p:p===!0?4:0,typeof n=="string"?w.input=r.string2buf(n):b.call(n)==="[object ArrayBuffer]"?w.input=new Uint8Array(n):w.input=n,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new u.Buf8(C),w.next_out=0,w.avail_out=C),(m=g.deflate(w,_))!==1&&m!==T)return this.onEnd(m),!(this.ended=!0);w.avail_out!==0&&(w.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(u.shrinkBuf(w.output,w.next_out))):this.onData(u.shrinkBuf(w.output,w.next_out)))}while((0<w.avail_in||w.avail_out===0)&&m!==1);return _===4?(m=g.deflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===T):_!==2||(this.onEnd(T),!(w.avail_out=0))},h.prototype.onData=function(n){this.chunks.push(n)},h.prototype.onEnd=function(n){n===T&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=u.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},x.Deflate=h,x.deflate=y,x.deflateRaw=function(n,p){return(p=p||{}).raw=!0,y(n,p)},x.gzip=function(n,p){return(p=p||{}).gzip=!0,y(n,p)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,d,x){var g=t("./zlib/inflate"),u=t("./utils/common"),r=t("./utils/strings"),c=t("./zlib/constants"),l=t("./zlib/messages"),b=t("./zlib/zstream"),T=t("./zlib/gzheader"),E=Object.prototype.toString;function s(h){if(!(this instanceof s))return new s(h);this.options=u.assign({chunkSize:16384,windowBits:0,to:""},h||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||h&&h.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&(15&y.windowBits)==0&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var n=g.inflateInit2(this.strm,y.windowBits);if(n!==c.Z_OK)throw new Error(l[n]);this.header=new T,g.inflateGetHeader(this.strm,this.header)}function v(h,y){var n=new s(y);if(n.push(h,!0),n.err)throw n.msg||l[n.err];return n.result}s.prototype.push=function(h,y){var n,p,m,_,w,C,o=this.strm,i=this.options.chunkSize,B=this.options.dictionary,N=!1;if(this.ended)return!1;p=y===~~y?y:y===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof h=="string"?o.input=r.binstring2buf(h):E.call(h)==="[object ArrayBuffer]"?o.input=new Uint8Array(h):o.input=h,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new u.Buf8(i),o.next_out=0,o.avail_out=i),(n=g.inflate(o,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&B&&(C=typeof B=="string"?r.string2buf(B):E.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,n=g.inflateSetDictionary(this.strm,C)),n===c.Z_BUF_ERROR&&N===!0&&(n=c.Z_OK,N=!1),n!==c.Z_STREAM_END&&n!==c.Z_OK)return this.onEnd(n),!(this.ended=!0);o.next_out&&(o.avail_out!==0&&n!==c.Z_STREAM_END&&(o.avail_in!==0||p!==c.Z_FINISH&&p!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(m=r.utf8border(o.output,o.next_out),_=o.next_out-m,w=r.buf2string(o.output,m),o.next_out=_,o.avail_out=i-_,_&&u.arraySet(o.output,o.output,m,_,0),this.onData(w)):this.onData(u.shrinkBuf(o.output,o.next_out)))),o.avail_in===0&&o.avail_out===0&&(N=!0)}while((0<o.avail_in||o.avail_out===0)&&n!==c.Z_STREAM_END);return n===c.Z_STREAM_END&&(p=c.Z_FINISH),p===c.Z_FINISH?(n=g.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===c.Z_OK):p!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(o.avail_out=0))},s.prototype.onData=function(h){this.chunks.push(h)},s.prototype.onEnd=function(h){h===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=u.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},x.Inflate=s,x.inflate=v,x.inflateRaw=function(h,y){return(y=y||{}).raw=!0,v(h,y)},x.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,d,x){var g=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";x.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var b=l.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var T in b)b.hasOwnProperty(T)&&(c[T]=b[T])}}return c},x.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var u={arraySet:function(c,l,b,T,E){if(l.subarray&&c.subarray)c.set(l.subarray(b,b+T),E);else for(var s=0;s<T;s++)c[E+s]=l[b+s]},flattenChunks:function(c){var l,b,T,E,s,v;for(l=T=0,b=c.length;l<b;l++)T+=c[l].length;for(v=new Uint8Array(T),l=E=0,b=c.length;l<b;l++)s=c[l],v.set(s,E),E+=s.length;return v}},r={arraySet:function(c,l,b,T,E){for(var s=0;s<T;s++)c[E+s]=l[b+s]},flattenChunks:function(c){return[].concat.apply([],c)}};x.setTyped=function(c){c?(x.Buf8=Uint8Array,x.Buf16=Uint16Array,x.Buf32=Int32Array,x.assign(x,u)):(x.Buf8=Array,x.Buf16=Array,x.Buf32=Array,x.assign(x,r))},x.setTyped(g)},{}],42:[function(t,d,x){var g=t("./common"),u=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{u=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var c=new g.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function b(T,E){if(E<65537&&(T.subarray&&r||!T.subarray&&u))return String.fromCharCode.apply(null,g.shrinkBuf(T,E));for(var s="",v=0;v<E;v++)s+=String.fromCharCode(T[v]);return s}c[254]=c[254]=1,x.string2buf=function(T){var E,s,v,h,y,n=T.length,p=0;for(h=0;h<n;h++)(64512&(s=T.charCodeAt(h)))==55296&&h+1<n&&(64512&(v=T.charCodeAt(h+1)))==56320&&(s=65536+(s-55296<<10)+(v-56320),h++),p+=s<128?1:s<2048?2:s<65536?3:4;for(E=new g.Buf8(p),h=y=0;y<p;h++)(64512&(s=T.charCodeAt(h)))==55296&&h+1<n&&(64512&(v=T.charCodeAt(h+1)))==56320&&(s=65536+(s-55296<<10)+(v-56320),h++),s<128?E[y++]=s:(s<2048?E[y++]=192|s>>>6:(s<65536?E[y++]=224|s>>>12:(E[y++]=240|s>>>18,E[y++]=128|s>>>12&63),E[y++]=128|s>>>6&63),E[y++]=128|63&s);return E},x.buf2binstring=function(T){return b(T,T.length)},x.binstring2buf=function(T){for(var E=new g.Buf8(T.length),s=0,v=E.length;s<v;s++)E[s]=T.charCodeAt(s);return E},x.buf2string=function(T,E){var s,v,h,y,n=E||T.length,p=new Array(2*n);for(s=v=0;s<n;)if((h=T[s++])<128)p[v++]=h;else if(4<(y=c[h]))p[v++]=65533,s+=y-1;else{for(h&=y===2?31:y===3?15:7;1<y&&s<n;)h=h<<6|63&T[s++],y--;1<y?p[v++]=65533:h<65536?p[v++]=h:(h-=65536,p[v++]=55296|h>>10&1023,p[v++]=56320|1023&h)}return b(p,v)},x.utf8border=function(T,E){var s;for((E=E||T.length)>T.length&&(E=T.length),s=E-1;0<=s&&(192&T[s])==128;)s--;return s<0||s===0?E:s+c[T[s]]>E?s:E}},{"./common":41}],43:[function(t,d,x){d.exports=function(g,u,r,c){for(var l=65535&g|0,b=g>>>16&65535|0,T=0;r!==0;){for(r-=T=2e3<r?2e3:r;b=b+(l=l+u[c++]|0)|0,--T;);l%=65521,b%=65521}return l|b<<16|0}},{}],44:[function(t,d,x){d.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(t,d,x){var g=(function(){for(var u,r=[],c=0;c<256;c++){u=c;for(var l=0;l<8;l++)u=1&u?3988292384^u>>>1:u>>>1;r[c]=u}return r})();d.exports=function(u,r,c,l){var b=g,T=l+c;u^=-1;for(var E=l;E<T;E++)u=u>>>8^b[255&(u^r[E])];return-1^u}},{}],46:[function(t,d,x){var g,u=t("../utils/common"),r=t("./trees"),c=t("./adler32"),l=t("./crc32"),b=t("./messages"),T=0,E=4,s=0,v=-2,h=-1,y=4,n=2,p=8,m=9,_=286,w=30,C=19,o=2*_+1,i=15,B=3,N=258,q=N+B+1,I=42,F=113,A=1,H=2,j=3,W=4;function re(f,L){return f.msg=b[L],L}function J(f){return(f<<1)-(4<f?9:0)}function oe(f){for(var L=f.length;0<=--L;)f[L]=0}function Q(f){var L=f.state,G=L.pending;G>f.avail_out&&(G=f.avail_out),G!==0&&(u.arraySet(f.output,L.pending_buf,L.pending_out,G,f.next_out),f.next_out+=G,L.pending_out+=G,f.total_out+=G,f.avail_out-=G,L.pending-=G,L.pending===0&&(L.pending_out=0))}function $(f,L){r._tr_flush_block(f,0<=f.block_start?f.block_start:-1,f.strstart-f.block_start,L),f.block_start=f.strstart,Q(f.strm)}function ce(f,L){f.pending_buf[f.pending++]=L}function ie(f,L){f.pending_buf[f.pending++]=L>>>8&255,f.pending_buf[f.pending++]=255&L}function ee(f,L){var G,M,V=f.max_chain_length,K=f.strstart,X=f.prev_length,te=f.nice_match,Y=f.strstart>f.w_size-q?f.strstart-(f.w_size-q):0,ae=f.window,fe=f.w_mask,se=f.prev,de=f.strstart+N,ye=ae[K+X-1],ge=ae[K+X];f.prev_length>=f.good_match&&(V>>=2),te>f.lookahead&&(te=f.lookahead);do if(ae[(G=L)+X]===ge&&ae[G+X-1]===ye&&ae[G]===ae[K]&&ae[++G]===ae[K+1]){K+=2,G++;do;while(ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&K<de);if(M=N-(de-K),K=de-N,X<M){if(f.match_start=L,te<=(X=M))break;ye=ae[K+X-1],ge=ae[K+X]}}while((L=se[L&fe])>Y&&--V!=0);return X<=f.lookahead?X:f.lookahead}function ue(f){var L,G,M,V,K,X,te,Y,ae,fe,se=f.w_size;do{if(V=f.window_size-f.lookahead-f.strstart,f.strstart>=se+(se-q)){for(u.arraySet(f.window,f.window,se,se,0),f.match_start-=se,f.strstart-=se,f.block_start-=se,L=G=f.hash_size;M=f.head[--L],f.head[L]=se<=M?M-se:0,--G;);for(L=G=se;M=f.prev[--L],f.prev[L]=se<=M?M-se:0,--G;);V+=se}if(f.strm.avail_in===0)break;if(X=f.strm,te=f.window,Y=f.strstart+f.lookahead,ae=V,fe=void 0,fe=X.avail_in,ae<fe&&(fe=ae),G=fe===0?0:(X.avail_in-=fe,u.arraySet(te,X.input,X.next_in,fe,Y),X.state.wrap===1?X.adler=c(X.adler,te,fe,Y):X.state.wrap===2&&(X.adler=l(X.adler,te,fe,Y)),X.next_in+=fe,X.total_in+=fe,fe),f.lookahead+=G,f.lookahead+f.insert>=B)for(K=f.strstart-f.insert,f.ins_h=f.window[K],f.ins_h=(f.ins_h<<f.hash_shift^f.window[K+1])&f.hash_mask;f.insert&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[K+B-1])&f.hash_mask,f.prev[K&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=K,K++,f.insert--,!(f.lookahead+f.insert<B)););}while(f.lookahead<q&&f.strm.avail_in!==0)}function Se(f,L){for(var G,M;;){if(f.lookahead<q){if(ue(f),f.lookahead<q&&L===T)return A;if(f.lookahead===0)break}if(G=0,f.lookahead>=B&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),G!==0&&f.strstart-G<=f.w_size-q&&(f.match_length=ee(f,G)),f.match_length>=B)if(M=r._tr_tally(f,f.strstart-f.match_start,f.match_length-B),f.lookahead-=f.match_length,f.match_length<=f.max_lazy_match&&f.lookahead>=B){for(f.match_length--;f.strstart++,f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart,--f.match_length!=0;);f.strstart++}else f.strstart+=f.match_length,f.match_length=0,f.ins_h=f.window[f.strstart],f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+1])&f.hash_mask;else M=r._tr_tally(f,0,f.window[f.strstart]),f.lookahead--,f.strstart++;if(M&&($(f,!1),f.strm.avail_out===0))return A}return f.insert=f.strstart<B-1?f.strstart:B-1,L===E?($(f,!0),f.strm.avail_out===0?j:W):f.last_lit&&($(f,!1),f.strm.avail_out===0)?A:H}function ve(f,L){for(var G,M,V;;){if(f.lookahead<q){if(ue(f),f.lookahead<q&&L===T)return A;if(f.lookahead===0)break}if(G=0,f.lookahead>=B&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),f.prev_length=f.match_length,f.prev_match=f.match_start,f.match_length=B-1,G!==0&&f.prev_length<f.max_lazy_match&&f.strstart-G<=f.w_size-q&&(f.match_length=ee(f,G),f.match_length<=5&&(f.strategy===1||f.match_length===B&&4096<f.strstart-f.match_start)&&(f.match_length=B-1)),f.prev_length>=B&&f.match_length<=f.prev_length){for(V=f.strstart+f.lookahead-B,M=r._tr_tally(f,f.strstart-1-f.prev_match,f.prev_length-B),f.lookahead-=f.prev_length-1,f.prev_length-=2;++f.strstart<=V&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),--f.prev_length!=0;);if(f.match_available=0,f.match_length=B-1,f.strstart++,M&&($(f,!1),f.strm.avail_out===0))return A}else if(f.match_available){if((M=r._tr_tally(f,0,f.window[f.strstart-1]))&&$(f,!1),f.strstart++,f.lookahead--,f.strm.avail_out===0)return A}else f.match_available=1,f.strstart++,f.lookahead--}return f.match_available&&(M=r._tr_tally(f,0,f.window[f.strstart-1]),f.match_available=0),f.insert=f.strstart<B-1?f.strstart:B-1,L===E?($(f,!0),f.strm.avail_out===0?j:W):f.last_lit&&($(f,!1),f.strm.avail_out===0)?A:H}function k(f,L,G,M,V){this.good_length=f,this.max_lazy=L,this.nice_length=G,this.max_chain=M,this.func=V}function O(){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=p,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 u.Buf16(2*o),this.dyn_dtree=new u.Buf16(2*(2*w+1)),this.bl_tree=new u.Buf16(2*(2*C+1)),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new u.Buf16(i+1),this.heap=new u.Buf16(2*_+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new u.Buf16(2*_+1),oe(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 P(f){var L;return f&&f.state?(f.total_in=f.total_out=0,f.data_type=n,(L=f.state).pending=0,L.pending_out=0,L.wrap<0&&(L.wrap=-L.wrap),L.status=L.wrap?I:F,f.adler=L.wrap===2?0:1,L.last_flush=T,r._tr_init(L),s):re(f,v)}function D(f){var L=P(f);return L===s&&(function(G){G.window_size=2*G.w_size,oe(G.head),G.max_lazy_match=g[G.level].max_lazy,G.good_match=g[G.level].good_length,G.nice_match=g[G.level].nice_length,G.max_chain_length=g[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=B-1,G.match_available=0,G.ins_h=0})(f.state),L}function S(f,L,G,M,V,K){if(!f)return v;var X=1;if(L===h&&(L=6),M<0?(X=0,M=-M):15<M&&(X=2,M-=16),V<1||m<V||G!==p||M<8||15<M||L<0||9<L||K<0||y<K)return re(f,v);M===8&&(M=9);var te=new O;return(f.state=te).strm=f,te.wrap=X,te.gzhead=null,te.w_bits=M,te.w_size=1<<te.w_bits,te.w_mask=te.w_size-1,te.hash_bits=V+7,te.hash_size=1<<te.hash_bits,te.hash_mask=te.hash_size-1,te.hash_shift=~~((te.hash_bits+B-1)/B),te.window=new u.Buf8(2*te.w_size),te.head=new u.Buf16(te.hash_size),te.prev=new u.Buf16(te.w_size),te.lit_bufsize=1<<V+6,te.pending_buf_size=4*te.lit_bufsize,te.pending_buf=new u.Buf8(te.pending_buf_size),te.d_buf=1*te.lit_bufsize,te.l_buf=3*te.lit_bufsize,te.level=L,te.strategy=K,te.method=G,D(f)}g=[new k(0,0,0,0,function(f,L){var G=65535;for(G>f.pending_buf_size-5&&(G=f.pending_buf_size-5);;){if(f.lookahead<=1){if(ue(f),f.lookahead===0&&L===T)return A;if(f.lookahead===0)break}f.strstart+=f.lookahead,f.lookahead=0;var M=f.block_start+G;if((f.strstart===0||f.strstart>=M)&&(f.lookahead=f.strstart-M,f.strstart=M,$(f,!1),f.strm.avail_out===0)||f.strstart-f.block_start>=f.w_size-q&&($(f,!1),f.strm.avail_out===0))return A}return f.insert=0,L===E?($(f,!0),f.strm.avail_out===0?j:W):(f.strstart>f.block_start&&($(f,!1),f.strm.avail_out),A)}),new k(4,4,8,4,Se),new k(4,5,16,8,Se),new k(4,6,32,32,Se),new k(4,4,16,16,ve),new k(8,16,32,32,ve),new k(8,16,128,128,ve),new k(8,32,128,256,ve),new k(32,128,258,1024,ve),new k(32,258,258,4096,ve)],x.deflateInit=function(f,L){return S(f,L,p,15,8,0)},x.deflateInit2=S,x.deflateReset=D,x.deflateResetKeep=P,x.deflateSetHeader=function(f,L){return f&&f.state?f.state.wrap!==2?v:(f.state.gzhead=L,s):v},x.deflate=function(f,L){var G,M,V,K;if(!f||!f.state||5<L||L<0)return f?re(f,v):v;if(M=f.state,!f.output||!f.input&&f.avail_in!==0||M.status===666&&L!==E)return re(f,f.avail_out===0?-5:v);if(M.strm=f,G=M.last_flush,M.last_flush=L,M.status===I)if(M.wrap===2)f.adler=0,ce(M,31),ce(M,139),ce(M,8),M.gzhead?(ce(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),ce(M,255&M.gzhead.time),ce(M,M.gzhead.time>>8&255),ce(M,M.gzhead.time>>16&255),ce(M,M.gzhead.time>>24&255),ce(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),ce(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(ce(M,255&M.gzhead.extra.length),ce(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(f.adler=l(f.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(ce(M,0),ce(M,0),ce(M,0),ce(M,0),ce(M,0),ce(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),ce(M,3),M.status=F);else{var X=p+(M.w_bits-8<<4)<<8;X|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(X|=32),X+=31-X%31,M.status=F,ie(M,X),M.strstart!==0&&(ie(M,f.adler>>>16),ie(M,65535&f.adler)),f.adler=1}if(M.status===69)if(M.gzhead.extra){for(V=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending!==M.pending_buf_size));)ce(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){V=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending===M.pending_buf_size)){K=1;break}K=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,ce(M,K)}while(K!==0);M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),K===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){V=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending===M.pending_buf_size)){K=1;break}K=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,ce(M,K)}while(K!==0);M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),K===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&Q(f),M.pending+2<=M.pending_buf_size&&(ce(M,255&f.adler),ce(M,f.adler>>8&255),f.adler=0,M.status=F)):M.status=F),M.pending!==0){if(Q(f),f.avail_out===0)return M.last_flush=-1,s}else if(f.avail_in===0&&J(L)<=J(G)&&L!==E)return re(f,-5);if(M.status===666&&f.avail_in!==0)return re(f,-5);if(f.avail_in!==0||M.lookahead!==0||L!==T&&M.status!==666){var te=M.strategy===2?(function(Y,ae){for(var fe;;){if(Y.lookahead===0&&(ue(Y),Y.lookahead===0)){if(ae===T)return A;break}if(Y.match_length=0,fe=r._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++,fe&&($(Y,!1),Y.strm.avail_out===0))return A}return Y.insert=0,ae===E?($(Y,!0),Y.strm.avail_out===0?j:W):Y.last_lit&&($(Y,!1),Y.strm.avail_out===0)?A:H})(M,L):M.strategy===3?(function(Y,ae){for(var fe,se,de,ye,ge=Y.window;;){if(Y.lookahead<=N){if(ue(Y),Y.lookahead<=N&&ae===T)return A;if(Y.lookahead===0)break}if(Y.match_length=0,Y.lookahead>=B&&0<Y.strstart&&(se=ge[de=Y.strstart-1])===ge[++de]&&se===ge[++de]&&se===ge[++de]){ye=Y.strstart+N;do;while(se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&de<ye);Y.match_length=N-(ye-de),Y.match_length>Y.lookahead&&(Y.match_length=Y.lookahead)}if(Y.match_length>=B?(fe=r._tr_tally(Y,1,Y.match_length-B),Y.lookahead-=Y.match_length,Y.strstart+=Y.match_length,Y.match_length=0):(fe=r._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++),fe&&($(Y,!1),Y.strm.avail_out===0))return A}return Y.insert=0,ae===E?($(Y,!0),Y.strm.avail_out===0?j:W):Y.last_lit&&($(Y,!1),Y.strm.avail_out===0)?A:H})(M,L):g[M.level].func(M,L);if(te!==j&&te!==W||(M.status=666),te===A||te===j)return f.avail_out===0&&(M.last_flush=-1),s;if(te===H&&(L===1?r._tr_align(M):L!==5&&(r._tr_stored_block(M,0,0,!1),L===3&&(oe(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),Q(f),f.avail_out===0))return M.last_flush=-1,s}return L!==E?s:M.wrap<=0?1:(M.wrap===2?(ce(M,255&f.adler),ce(M,f.adler>>8&255),ce(M,f.adler>>16&255),ce(M,f.adler>>24&255),ce(M,255&f.total_in),ce(M,f.total_in>>8&255),ce(M,f.total_in>>16&255),ce(M,f.total_in>>24&255)):(ie(M,f.adler>>>16),ie(M,65535&f.adler)),Q(f),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?s:1)},x.deflateEnd=function(f){var L;return f&&f.state?(L=f.state.status)!==I&&L!==69&&L!==73&&L!==91&&L!==103&&L!==F&&L!==666?re(f,v):(f.state=null,L===F?re(f,-3):s):v},x.deflateSetDictionary=function(f,L){var G,M,V,K,X,te,Y,ae,fe=L.length;if(!f||!f.state||(K=(G=f.state).wrap)===2||K===1&&G.status!==I||G.lookahead)return v;for(K===1&&(f.adler=c(f.adler,L,fe,0)),G.wrap=0,fe>=G.w_size&&(K===0&&(oe(G.head),G.strstart=0,G.block_start=0,G.insert=0),ae=new u.Buf8(G.w_size),u.arraySet(ae,L,fe-G.w_size,G.w_size,0),L=ae,fe=G.w_size),X=f.avail_in,te=f.next_in,Y=f.input,f.avail_in=fe,f.next_in=0,f.input=L,ue(G);G.lookahead>=B;){for(M=G.strstart,V=G.lookahead-(B-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[M+B-1])&G.hash_mask,G.prev[M&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=M,M++,--V;);G.strstart=M,G.lookahead=B-1,ue(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=B-1,G.match_available=0,f.next_in=te,f.input=Y,f.avail_in=X,G.wrap=K,s},x.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,d,x){d.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(t,d,x){d.exports=function(g,u){var r,c,l,b,T,E,s,v,h,y,n,p,m,_,w,C,o,i,B,N,q,I,F,A,H;r=g.state,c=g.next_in,A=g.input,l=c+(g.avail_in-5),b=g.next_out,H=g.output,T=b-(u-g.avail_out),E=b+(g.avail_out-257),s=r.dmax,v=r.wsize,h=r.whave,y=r.wnext,n=r.window,p=r.hold,m=r.bits,_=r.lencode,w=r.distcode,C=(1<<r.lenbits)-1,o=(1<<r.distbits)-1;e:do{m<15&&(p+=A[c++]<<m,m+=8,p+=A[c++]<<m,m+=8),i=_[p&C];t:for(;;){if(p>>>=B=i>>>24,m-=B,(B=i>>>16&255)===0)H[b++]=65535&i;else{if(!(16&B)){if((64&B)==0){i=_[(65535&i)+(p&(1<<B)-1)];continue t}if(32&B){r.mode=12;break e}g.msg="invalid literal/length code",r.mode=30;break e}N=65535&i,(B&=15)&&(m<B&&(p+=A[c++]<<m,m+=8),N+=p&(1<<B)-1,p>>>=B,m-=B),m<15&&(p+=A[c++]<<m,m+=8,p+=A[c++]<<m,m+=8),i=w[p&o];r:for(;;){if(p>>>=B=i>>>24,m-=B,!(16&(B=i>>>16&255))){if((64&B)==0){i=w[(65535&i)+(p&(1<<B)-1)];continue r}g.msg="invalid distance code",r.mode=30;break e}if(q=65535&i,m<(B&=15)&&(p+=A[c++]<<m,(m+=8)<B&&(p+=A[c++]<<m,m+=8)),s<(q+=p&(1<<B)-1)){g.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=B,m-=B,(B=b-T)<q){if(h<(B=q-B)&&r.sane){g.msg="invalid distance too far back",r.mode=30;break e}if(F=n,(I=0)===y){if(I+=v-B,B<N){for(N-=B;H[b++]=n[I++],--B;);I=b-q,F=H}}else if(y<B){if(I+=v+y-B,(B-=y)<N){for(N-=B;H[b++]=n[I++],--B;);if(I=0,y<N){for(N-=B=y;H[b++]=n[I++],--B;);I=b-q,F=H}}}else if(I+=y-B,B<N){for(N-=B;H[b++]=n[I++],--B;);I=b-q,F=H}for(;2<N;)H[b++]=F[I++],H[b++]=F[I++],H[b++]=F[I++],N-=3;N&&(H[b++]=F[I++],1<N&&(H[b++]=F[I++]))}else{for(I=b-q;H[b++]=H[I++],H[b++]=H[I++],H[b++]=H[I++],2<(N-=3););N&&(H[b++]=H[I++],1<N&&(H[b++]=H[I++]))}break}}break}}while(c<l&&b<E);c-=N=m>>3,p&=(1<<(m-=N<<3))-1,g.next_in=c,g.next_out=b,g.avail_in=c<l?l-c+5:5-(c-l),g.avail_out=b<E?E-b+257:257-(b-E),r.hold=p,r.bits=m}},{}],49:[function(t,d,x){var g=t("../utils/common"),u=t("./adler32"),r=t("./crc32"),c=t("./inffast"),l=t("./inftrees"),b=1,T=2,E=0,s=-2,v=1,h=852,y=592;function n(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function p(){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 g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(I){var F;return I&&I.state?(F=I.state,I.total_in=I.total_out=F.total=0,I.msg="",F.wrap&&(I.adler=1&F.wrap),F.mode=v,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new g.Buf32(h),F.distcode=F.distdyn=new g.Buf32(y),F.sane=1,F.back=-1,E):s}function _(I){var F;return I&&I.state?((F=I.state).wsize=0,F.whave=0,F.wnext=0,m(I)):s}function w(I,F){var A,H;return I&&I.state?(H=I.state,F<0?(A=0,F=-F):(A=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?s:(H.window!==null&&H.wbits!==F&&(H.window=null),H.wrap=A,H.wbits=F,_(I))):s}function C(I,F){var A,H;return I?(H=new p,(I.state=H).window=null,(A=w(I,F))!==E&&(I.state=null),A):s}var o,i,B=!0;function N(I){if(B){var F;for(o=new g.Buf32(512),i=new g.Buf32(32),F=0;F<144;)I.lens[F++]=8;for(;F<256;)I.lens[F++]=9;for(;F<280;)I.lens[F++]=7;for(;F<288;)I.lens[F++]=8;for(l(b,I.lens,0,288,o,0,I.work,{bits:9}),F=0;F<32;)I.lens[F++]=5;l(T,I.lens,0,32,i,0,I.work,{bits:5}),B=!1}I.lencode=o,I.lenbits=9,I.distcode=i,I.distbits=5}function q(I,F,A,H){var j,W=I.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new g.Buf8(W.wsize)),H>=W.wsize?(g.arraySet(W.window,F,A-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(H<(j=W.wsize-W.wnext)&&(j=H),g.arraySet(W.window,F,A-H,j,W.wnext),(H-=j)?(g.arraySet(W.window,F,A-H,H,0),W.wnext=H,W.whave=W.wsize):(W.wnext+=j,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=j))),0}x.inflateReset=_,x.inflateReset2=w,x.inflateResetKeep=m,x.inflateInit=function(I){return C(I,15)},x.inflateInit2=C,x.inflate=function(I,F){var A,H,j,W,re,J,oe,Q,$,ce,ie,ee,ue,Se,ve,k,O,P,D,S,f,L,G,M,V=0,K=new g.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return s;(A=I.state).mode===12&&(A.mode=13),re=I.next_out,j=I.output,oe=I.avail_out,W=I.next_in,H=I.input,J=I.avail_in,Q=A.hold,$=A.bits,ce=J,ie=oe,L=E;e:for(;;)switch(A.mode){case v:if(A.wrap===0){A.mode=13;break}for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(2&A.wrap&&Q===35615){K[A.check=0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0),$=Q=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&Q)<<8)+(Q>>8))%31){I.msg="incorrect header check",A.mode=30;break}if((15&Q)!=8){I.msg="unknown compression method",A.mode=30;break}if($-=4,f=8+(15&(Q>>>=4)),A.wbits===0)A.wbits=f;else if(f>A.wbits){I.msg="invalid window size",A.mode=30;break}A.dmax=1<<f,I.adler=A.check=1,A.mode=512&Q?10:12,$=Q=0;break;case 2:for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(A.flags=Q,(255&A.flags)!=8){I.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){I.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=Q>>8&1),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0,A.mode=3;case 3:for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.head&&(A.head.time=Q),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,K[2]=Q>>>16&255,K[3]=Q>>>24&255,A.check=r(A.check,K,4,0)),$=Q=0,A.mode=4;case 4:for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.head&&(A.head.xflags=255&Q,A.head.os=Q>>8),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0,A.mode=5;case 5:if(1024&A.flags){for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.length=Q,A.head&&(A.head.extra_len=Q),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(J<(ee=A.length)&&(ee=J),ee&&(A.head&&(f=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),g.arraySet(A.head.extra,H,W,ee,f)),512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,A.length-=ee),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(J===0)break e;for(ee=0;f=H[W+ee++],A.head&&f&&A.length<65536&&(A.head.name+=String.fromCharCode(f)),f&&ee<J;);if(512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,f)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(J===0)break e;for(ee=0;f=H[W+ee++],A.head&&f&&A.length<65536&&(A.head.comment+=String.fromCharCode(f)),f&&ee<J;);if(512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,f)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q!==(65535&A.check)){I.msg="header crc mismatch",A.mode=30;break}$=Q=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),I.adler=A.check=0,A.mode=12;break;case 10:for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}I.adler=A.check=n(Q),$=Q=0,A.mode=11;case 11:if(A.havedict===0)return I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,2;I.adler=A.check=1,A.mode=12;case 12:if(F===5||F===6)break e;case 13:if(A.last){Q>>>=7&$,$-=7&$,A.mode=27;break}for(;$<3;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}switch(A.last=1&Q,$-=1,3&(Q>>>=1)){case 0:A.mode=14;break;case 1:if(N(A),A.mode=20,F!==6)break;Q>>>=2,$-=2;break e;case 2:A.mode=17;break;case 3:I.msg="invalid block type",A.mode=30}Q>>>=2,$-=2;break;case 14:for(Q>>>=7&$,$-=7&$;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if((65535&Q)!=(Q>>>16^65535)){I.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&Q,$=Q=0,A.mode=15,F===6)break e;case 15:A.mode=16;case 16:if(ee=A.length){if(J<ee&&(ee=J),oe<ee&&(ee=oe),ee===0)break e;g.arraySet(j,H,W,ee,re),J-=ee,W+=ee,oe-=ee,re+=ee,A.length-=ee;break}A.mode=12;break;case 17:for(;$<14;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(A.nlen=257+(31&Q),Q>>>=5,$-=5,A.ndist=1+(31&Q),Q>>>=5,$-=5,A.ncode=4+(15&Q),Q>>>=4,$-=4,286<A.nlen||30<A.ndist){I.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;$<3;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.lens[X[A.have++]]=7&Q,Q>>>=3,$-=3}for(;A.have<19;)A.lens[X[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,G={bits:A.lenbits},L=l(0,A.lens,0,19,A.lencode,0,A.work,G),A.lenbits=G.bits,L){I.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;k=(V=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(O<16)Q>>>=ve,$-=ve,A.lens[A.have++]=O;else{if(O===16){for(M=ve+2;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q>>>=ve,$-=ve,A.have===0){I.msg="invalid bit length repeat",A.mode=30;break}f=A.lens[A.have-1],ee=3+(3&Q),Q>>>=2,$-=2}else if(O===17){for(M=ve+3;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}$-=ve,f=0,ee=3+(7&(Q>>>=ve)),Q>>>=3,$-=3}else{for(M=ve+7;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}$-=ve,f=0,ee=11+(127&(Q>>>=ve)),Q>>>=7,$-=7}if(A.have+ee>A.nlen+A.ndist){I.msg="invalid bit length repeat",A.mode=30;break}for(;ee--;)A.lens[A.have++]=f}}if(A.mode===30)break;if(A.lens[256]===0){I.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,G={bits:A.lenbits},L=l(b,A.lens,0,A.nlen,A.lencode,0,A.work,G),A.lenbits=G.bits,L){I.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,G={bits:A.distbits},L=l(T,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,G),A.distbits=G.bits,L){I.msg="invalid distances set",A.mode=30;break}if(A.mode=20,F===6)break e;case 20:A.mode=21;case 21:if(6<=J&&258<=oe){I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,c(I,ie),re=I.next_out,j=I.output,oe=I.avail_out,W=I.next_in,H=I.input,J=I.avail_in,Q=A.hold,$=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;k=(V=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(k&&(240&k)==0){for(P=ve,D=k,S=O;k=(V=A.lencode[S+((Q&(1<<P+D)-1)>>P)])>>>16&255,O=65535&V,!(P+(ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}Q>>>=P,$-=P,A.back+=P}if(Q>>>=ve,$-=ve,A.back+=ve,A.length=O,k===0){A.mode=26;break}if(32&k){A.back=-1,A.mode=12;break}if(64&k){I.msg="invalid literal/length code",A.mode=30;break}A.extra=15&k,A.mode=22;case 22:if(A.extra){for(M=A.extra;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.length+=Q&(1<<A.extra)-1,Q>>>=A.extra,$-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;k=(V=A.distcode[Q&(1<<A.distbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if((240&k)==0){for(P=ve,D=k,S=O;k=(V=A.distcode[S+((Q&(1<<P+D)-1)>>P)])>>>16&255,O=65535&V,!(P+(ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}Q>>>=P,$-=P,A.back+=P}if(Q>>>=ve,$-=ve,A.back+=ve,64&k){I.msg="invalid distance code",A.mode=30;break}A.offset=O,A.extra=15&k,A.mode=24;case 24:if(A.extra){for(M=A.extra;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.offset+=Q&(1<<A.extra)-1,Q>>>=A.extra,$-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){I.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(oe===0)break e;if(ee=ie-oe,A.offset>ee){if((ee=A.offset-ee)>A.whave&&A.sane){I.msg="invalid distance too far back",A.mode=30;break}ue=ee>A.wnext?(ee-=A.wnext,A.wsize-ee):A.wnext-ee,ee>A.length&&(ee=A.length),Se=A.window}else Se=j,ue=re-A.offset,ee=A.length;for(oe<ee&&(ee=oe),oe-=ee,A.length-=ee;j[re++]=Se[ue++],--ee;);A.length===0&&(A.mode=21);break;case 26:if(oe===0)break e;j[re++]=A.length,oe--,A.mode=21;break;case 27:if(A.wrap){for(;$<32;){if(J===0)break e;J--,Q|=H[W++]<<$,$+=8}if(ie-=oe,I.total_out+=ie,A.total+=ie,ie&&(I.adler=A.check=A.flags?r(A.check,j,ie,re-ie):u(A.check,j,ie,re-ie)),ie=oe,(A.flags?Q:n(Q))!==A.check){I.msg="incorrect data check",A.mode=30;break}$=Q=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q!==(4294967295&A.total)){I.msg="incorrect length check",A.mode=30;break}$=Q=0}A.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;case 32:default:return s}return I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,(A.wsize||ie!==I.avail_out&&A.mode<30&&(A.mode<27||F!==4))&&q(I,I.output,I.next_out,ie-I.avail_out)?(A.mode=31,-4):(ce-=I.avail_in,ie-=I.avail_out,I.total_in+=ce,I.total_out+=ie,A.total+=ie,A.wrap&&ie&&(I.adler=A.check=A.flags?r(A.check,j,ie,I.next_out-ie):u(A.check,j,ie,I.next_out-ie)),I.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(ce==0&&ie===0||F===4)&&L===E&&(L=-5),L)},x.inflateEnd=function(I){if(!I||!I.state)return s;var F=I.state;return F.window&&(F.window=null),I.state=null,E},x.inflateGetHeader=function(I,F){var A;return I&&I.state?(2&(A=I.state).wrap)==0?s:((A.head=F).done=!1,E):s},x.inflateSetDictionary=function(I,F){var A,H=F.length;return I&&I.state?(A=I.state).wrap!==0&&A.mode!==11?s:A.mode===11&&u(1,F,H,0)!==A.check?-3:q(I,F,H,H)?(A.mode=31,-4):(A.havedict=1,E):s},x.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,d,x){var g=t("../utils/common"),u=[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],r=[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],c=[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],l=[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];d.exports=function(b,T,E,s,v,h,y,n){var p,m,_,w,C,o,i,B,N,q=n.bits,I=0,F=0,A=0,H=0,j=0,W=0,re=0,J=0,oe=0,Q=0,$=null,ce=0,ie=new g.Buf16(16),ee=new g.Buf16(16),ue=null,Se=0;for(I=0;I<=15;I++)ie[I]=0;for(F=0;F<s;F++)ie[T[E+F]]++;for(j=q,H=15;1<=H&&ie[H]===0;H--);if(H<j&&(j=H),H===0)return v[h++]=20971520,v[h++]=20971520,n.bits=1,0;for(A=1;A<H&&ie[A]===0;A++);for(j<A&&(j=A),I=J=1;I<=15;I++)if(J<<=1,(J-=ie[I])<0)return-1;if(0<J&&(b===0||H!==1))return-1;for(ee[1]=0,I=1;I<15;I++)ee[I+1]=ee[I]+ie[I];for(F=0;F<s;F++)T[E+F]!==0&&(y[ee[T[E+F]]++]=F);if(o=b===0?($=ue=y,19):b===1?($=u,ce-=257,ue=r,Se-=257,256):($=c,ue=l,-1),I=A,C=h,re=F=Q=0,_=-1,w=(oe=1<<(W=j))-1,b===1&&852<oe||b===2&&592<oe)return 1;for(;;){for(i=I-re,N=y[F]<o?(B=0,y[F]):y[F]>o?(B=ue[Se+y[F]],$[ce+y[F]]):(B=96,0),p=1<<I-re,A=m=1<<W;v[C+(Q>>re)+(m-=p)]=i<<24|B<<16|N|0,m!==0;);for(p=1<<I-1;Q&p;)p>>=1;if(p!==0?(Q&=p-1,Q+=p):Q=0,F++,--ie[I]==0){if(I===H)break;I=T[E+y[F]]}if(j<I&&(Q&w)!==_){for(re===0&&(re=j),C+=A,J=1<<(W=I-re);W+re<H&&!((J-=ie[W+re])<=0);)W++,J<<=1;if(oe+=1<<W,b===1&&852<oe||b===2&&592<oe)return 1;v[_=Q&w]=j<<24|W<<16|C-h|0}}return Q!==0&&(v[C+Q]=I-re<<24|64<<16|0),n.bits=j,0}},{"../utils/common":41}],51:[function(t,d,x){d.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(t,d,x){var g=t("../utils/common"),u=0,r=1;function c(V){for(var K=V.length;0<=--K;)V[K]=0}var l=0,b=29,T=256,E=T+1+b,s=30,v=19,h=2*E+1,y=15,n=16,p=7,m=256,_=16,w=17,C=18,o=[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],i=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(E+2));c(q);var I=new Array(2*s);c(I);var F=new Array(512);c(F);var A=new Array(256);c(A);var H=new Array(b);c(H);var j,W,re,J=new Array(s);function oe(V,K,X,te,Y){this.static_tree=V,this.extra_bits=K,this.extra_base=X,this.elems=te,this.max_length=Y,this.has_stree=V&&V.length}function Q(V,K){this.dyn_tree=V,this.max_code=0,this.stat_desc=K}function $(V){return V<256?F[V]:F[256+(V>>>7)]}function ce(V,K){V.pending_buf[V.pending++]=255&K,V.pending_buf[V.pending++]=K>>>8&255}function ie(V,K,X){V.bi_valid>n-X?(V.bi_buf|=K<<V.bi_valid&65535,ce(V,V.bi_buf),V.bi_buf=K>>n-V.bi_valid,V.bi_valid+=X-n):(V.bi_buf|=K<<V.bi_valid&65535,V.bi_valid+=X)}function ee(V,K,X){ie(V,X[2*K],X[2*K+1])}function ue(V,K){for(var X=0;X|=1&V,V>>>=1,X<<=1,0<--K;);return X>>>1}function Se(V,K,X){var te,Y,ae=new Array(y+1),fe=0;for(te=1;te<=y;te++)ae[te]=fe=fe+X[te-1]<<1;for(Y=0;Y<=K;Y++){var se=V[2*Y+1];se!==0&&(V[2*Y]=ue(ae[se]++,se))}}function ve(V){var K;for(K=0;K<E;K++)V.dyn_ltree[2*K]=0;for(K=0;K<s;K++)V.dyn_dtree[2*K]=0;for(K=0;K<v;K++)V.bl_tree[2*K]=0;V.dyn_ltree[2*m]=1,V.opt_len=V.static_len=0,V.last_lit=V.matches=0}function k(V){8<V.bi_valid?ce(V,V.bi_buf):0<V.bi_valid&&(V.pending_buf[V.pending++]=V.bi_buf),V.bi_buf=0,V.bi_valid=0}function O(V,K,X,te){var Y=2*K,ae=2*X;return V[Y]<V[ae]||V[Y]===V[ae]&&te[K]<=te[X]}function P(V,K,X){for(var te=V.heap[X],Y=X<<1;Y<=V.heap_len&&(Y<V.heap_len&&O(K,V.heap[Y+1],V.heap[Y],V.depth)&&Y++,!O(K,te,V.heap[Y],V.depth));)V.heap[X]=V.heap[Y],X=Y,Y<<=1;V.heap[X]=te}function D(V,K,X){var te,Y,ae,fe,se=0;if(V.last_lit!==0)for(;te=V.pending_buf[V.d_buf+2*se]<<8|V.pending_buf[V.d_buf+2*se+1],Y=V.pending_buf[V.l_buf+se],se++,te===0?ee(V,Y,K):(ee(V,(ae=A[Y])+T+1,K),(fe=o[ae])!==0&&ie(V,Y-=H[ae],fe),ee(V,ae=$(--te),X),(fe=i[ae])!==0&&ie(V,te-=J[ae],fe)),se<V.last_lit;);ee(V,m,K)}function S(V,K){var X,te,Y,ae=K.dyn_tree,fe=K.stat_desc.static_tree,se=K.stat_desc.has_stree,de=K.stat_desc.elems,ye=-1;for(V.heap_len=0,V.heap_max=h,X=0;X<de;X++)ae[2*X]!==0?(V.heap[++V.heap_len]=ye=X,V.depth[X]=0):ae[2*X+1]=0;for(;V.heap_len<2;)ae[2*(Y=V.heap[++V.heap_len]=ye<2?++ye:0)]=1,V.depth[Y]=0,V.opt_len--,se&&(V.static_len-=fe[2*Y+1]);for(K.max_code=ye,X=V.heap_len>>1;1<=X;X--)P(V,ae,X);for(Y=de;X=V.heap[1],V.heap[1]=V.heap[V.heap_len--],P(V,ae,1),te=V.heap[1],V.heap[--V.heap_max]=X,V.heap[--V.heap_max]=te,ae[2*Y]=ae[2*X]+ae[2*te],V.depth[Y]=(V.depth[X]>=V.depth[te]?V.depth[X]:V.depth[te])+1,ae[2*X+1]=ae[2*te+1]=Y,V.heap[1]=Y++,P(V,ae,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],(function(ge,xe){var be,_e,Ae,Ce,Be,Ne,Ie=xe.dyn_tree,Qe=xe.max_code,Ze=xe.stat_desc.static_tree,et=xe.stat_desc.has_stree,nt=xe.stat_desc.extra_bits,it=xe.stat_desc.extra_base,Xe=xe.stat_desc.max_length,st=0;for(Ce=0;Ce<=y;Ce++)ge.bl_count[Ce]=0;for(Ie[2*ge.heap[ge.heap_max]+1]=0,be=ge.heap_max+1;be<h;be++)Xe<(Ce=Ie[2*Ie[2*(_e=ge.heap[be])+1]+1]+1)&&(Ce=Xe,st++),Ie[2*_e+1]=Ce,Qe<_e||(ge.bl_count[Ce]++,Be=0,it<=_e&&(Be=nt[_e-it]),Ne=Ie[2*_e],ge.opt_len+=Ne*(Ce+Be),et&&(ge.static_len+=Ne*(Ze[2*_e+1]+Be)));if(st!==0){do{for(Ce=Xe-1;ge.bl_count[Ce]===0;)Ce--;ge.bl_count[Ce]--,ge.bl_count[Ce+1]+=2,ge.bl_count[Xe]--,st-=2}while(0<st);for(Ce=Xe;Ce!==0;Ce--)for(_e=ge.bl_count[Ce];_e!==0;)Qe<(Ae=ge.heap[--be])||(Ie[2*Ae+1]!==Ce&&(ge.opt_len+=(Ce-Ie[2*Ae+1])*Ie[2*Ae],Ie[2*Ae+1]=Ce),_e--)}})(V,K),Se(ae,ye,V.bl_count)}function f(V,K,X){var te,Y,ae=-1,fe=K[1],se=0,de=7,ye=4;for(fe===0&&(de=138,ye=3),K[2*(X+1)+1]=65535,te=0;te<=X;te++)Y=fe,fe=K[2*(te+1)+1],++se<de&&Y===fe||(se<ye?V.bl_tree[2*Y]+=se:Y!==0?(Y!==ae&&V.bl_tree[2*Y]++,V.bl_tree[2*_]++):se<=10?V.bl_tree[2*w]++:V.bl_tree[2*C]++,ae=Y,ye=(se=0)===fe?(de=138,3):Y===fe?(de=6,3):(de=7,4))}function L(V,K,X){var te,Y,ae=-1,fe=K[1],se=0,de=7,ye=4;for(fe===0&&(de=138,ye=3),te=0;te<=X;te++)if(Y=fe,fe=K[2*(te+1)+1],!(++se<de&&Y===fe)){if(se<ye)for(;ee(V,Y,V.bl_tree),--se!=0;);else Y!==0?(Y!==ae&&(ee(V,Y,V.bl_tree),se--),ee(V,_,V.bl_tree),ie(V,se-3,2)):se<=10?(ee(V,w,V.bl_tree),ie(V,se-3,3)):(ee(V,C,V.bl_tree),ie(V,se-11,7));ae=Y,ye=(se=0)===fe?(de=138,3):Y===fe?(de=6,3):(de=7,4)}}c(J);var G=!1;function M(V,K,X,te){ie(V,(l<<1)+(te?1:0),3),(function(Y,ae,fe,se){k(Y),ce(Y,fe),ce(Y,~fe),g.arraySet(Y.pending_buf,Y.window,ae,fe,Y.pending),Y.pending+=fe})(V,K,X)}x._tr_init=function(V){G||((function(){var K,X,te,Y,ae,fe=new Array(y+1);for(Y=te=0;Y<b-1;Y++)for(H[Y]=te,K=0;K<1<<o[Y];K++)A[te++]=Y;for(A[te-1]=Y,Y=ae=0;Y<16;Y++)for(J[Y]=ae,K=0;K<1<<i[Y];K++)F[ae++]=Y;for(ae>>=7;Y<s;Y++)for(J[Y]=ae<<7,K=0;K<1<<i[Y]-7;K++)F[256+ae++]=Y;for(X=0;X<=y;X++)fe[X]=0;for(K=0;K<=143;)q[2*K+1]=8,K++,fe[8]++;for(;K<=255;)q[2*K+1]=9,K++,fe[9]++;for(;K<=279;)q[2*K+1]=7,K++,fe[7]++;for(;K<=287;)q[2*K+1]=8,K++,fe[8]++;for(Se(q,E+1,fe),K=0;K<s;K++)I[2*K+1]=5,I[2*K]=ue(K,5);j=new oe(q,o,T+1,E,y),W=new oe(I,i,0,s,y),re=new oe(new Array(0),B,0,v,p)})(),G=!0),V.l_desc=new Q(V.dyn_ltree,j),V.d_desc=new Q(V.dyn_dtree,W),V.bl_desc=new Q(V.bl_tree,re),V.bi_buf=0,V.bi_valid=0,ve(V)},x._tr_stored_block=M,x._tr_flush_block=function(V,K,X,te){var Y,ae,fe=0;0<V.level?(V.strm.data_type===2&&(V.strm.data_type=(function(se){var de,ye=4093624447;for(de=0;de<=31;de++,ye>>>=1)if(1&ye&&se.dyn_ltree[2*de]!==0)return u;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return r;for(de=32;de<T;de++)if(se.dyn_ltree[2*de]!==0)return r;return u})(V)),S(V,V.l_desc),S(V,V.d_desc),fe=(function(se){var de;for(f(se,se.dyn_ltree,se.l_desc.max_code),f(se,se.dyn_dtree,se.d_desc.max_code),S(se,se.bl_desc),de=v-1;3<=de&&se.bl_tree[2*N[de]+1]===0;de--);return se.opt_len+=3*(de+1)+5+5+4,de})(V),Y=V.opt_len+3+7>>>3,(ae=V.static_len+3+7>>>3)<=Y&&(Y=ae)):Y=ae=X+5,X+4<=Y&&K!==-1?M(V,K,X,te):V.strategy===4||ae===Y?(ie(V,2+(te?1:0),3),D(V,q,I)):(ie(V,4+(te?1:0),3),(function(se,de,ye,ge){var xe;for(ie(se,de-257,5),ie(se,ye-1,5),ie(se,ge-4,4),xe=0;xe<ge;xe++)ie(se,se.bl_tree[2*N[xe]+1],3);L(se,se.dyn_ltree,de-1),L(se,se.dyn_dtree,ye-1)})(V,V.l_desc.max_code+1,V.d_desc.max_code+1,fe+1),D(V,V.dyn_ltree,V.dyn_dtree)),ve(V),te&&k(V)},x._tr_tally=function(V,K,X){return V.pending_buf[V.d_buf+2*V.last_lit]=K>>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&K,V.pending_buf[V.l_buf+V.last_lit]=255&X,V.last_lit++,K===0?V.dyn_ltree[2*X]++:(V.matches++,K--,V.dyn_ltree[2*(A[X]+T+1)]++,V.dyn_dtree[2*$(K)]++),V.last_lit===V.lit_bufsize-1},x._tr_align=function(V){ie(V,2,3),ee(V,m,q),(function(K){K.bi_valid===16?(ce(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)})(V)}},{"../utils/common":41}],53:[function(t,d,x){d.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(t,d,x){(function(g){(function(u,r){if(!u.setImmediate){var c,l,b,T,E=1,s={},v=!1,h=u.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(u);y=y&&y.setTimeout?y:u,c={}.toString.call(u.process)==="[object process]"?function(_){process.nextTick(function(){p(_)})}:(function(){if(u.postMessage&&!u.importScripts){var _=!0,w=u.onmessage;return u.onmessage=function(){_=!1},u.postMessage("","*"),u.onmessage=w,_}})()?(T="setImmediate$"+Math.random()+"$",u.addEventListener?u.addEventListener("message",m,!1):u.attachEvent("onmessage",m),function(_){u.postMessage(T+_,"*")}):u.MessageChannel?((b=new MessageChannel).port1.onmessage=function(_){p(_.data)},function(_){b.port2.postMessage(_)}):h&&"onreadystatechange"in h.createElement("script")?(l=h.documentElement,function(_){var w=h.createElement("script");w.onreadystatechange=function(){p(_),w.onreadystatechange=null,l.removeChild(w),w=null},l.appendChild(w)}):function(_){setTimeout(p,0,_)},y.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var w=new Array(arguments.length-1),C=0;C<w.length;C++)w[C]=arguments[C+1];var o={callback:_,args:w};return s[E]=o,c(E),E++},y.clearImmediate=n}function n(_){delete s[_]}function p(_){if(v)setTimeout(p,0,_);else{var w=s[_];if(w){v=!0;try{(function(C){var o=C.callback,i=C.args;switch(i.length){case 0:o();break;case 1:o(i[0]);break;case 2:o(i[0],i[1]);break;case 3:o(i[0],i[1],i[2]);break;default:o.apply(r,i)}})(w)}finally{n(_),v=!1}}}}function m(_){_.source===u&&typeof _.data=="string"&&_.data.indexOf(T)===0&&p(+_.data.slice(T.length))}})(typeof self>"u"?g===void 0?this:g:self)}).call(this,typeof bt<"u"?bt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(er)),er.exports}Dn();function Un(a){const e=String(a??"").trim().toLowerCase(),t=e.lastIndexOf(".");return t>=0?e.slice(t):""}function Pn(a){const e=URL.createObjectURL(a);return{url:e,name:a.name,extension:Un(a.name),revoke:()=>URL.revokeObjectURL(e)}}function On(a,e){return`${a}#${e}`}class Fn{viewer;getDefaultRotation;scenes=new Map;localSceneResources=new Map;constructor(e,t){this.viewer=e,this.getDefaultRotation=t}async loadModel(e,t={}){const d=this.viewer.getSceneCount(),x={progressiveLoad:!1,position:[0,0,0],rotation:this.getDefaultRotation(),scale:[1,1,1],...t,showLoadingUI:!1};await this.viewer.addSplatScene(e,x);const g={id:x.id??On(e,d),name:x.name??e.split(/[\\/]/).pop()??e,url:e,index:d,options:x};return this.scenes.set(g.id,g),g}async loadModelFile(e,t={}){if(e.length===0)throw new Error("LoaderModuleGaussian: no file selected");if(e.length>1)throw new Error("LoaderModuleGaussian: only a single local point cloud file is supported");const d=Pn(e[0]);try{const x=await this.loadModel(d.url,{...t,name:t.name??e[0].name});return this.localSceneResources.set(x.id,d),x}catch(x){throw d.revoke(),x}}async loadModels(e){const t=[];for(const d of e)t.push(await this.loadModel(d.url,d.options));return t}async unloadModel(e,t=!1){const d=this.scenes.get(e);d&&(await this.viewer.removeSplatScene(d.index,t),this.scenes.delete(e),this.localSceneResources.get(e)?.revoke(),this.localSceneResources.delete(e),this.reindexScenesAfterRemove(d.index))}getModel(e){return this.scenes.get(e)}getAllModels(){return Array.from(this.scenes.values())}getRawSplatScene(e){const t=typeof e=="number"?e:this.scenes.get(e)?.index;return t==null?void 0:this.viewer.getSplatScene(t)}async clear(e=!1){const t=this.getAllModels().map(d=>d.index);t.length>0&&await this.viewer.removeSplatScenes(t,e),this.scenes.clear(),this.localSceneResources.forEach(d=>d.revoke()),this.localSceneResources.clear()}reindexScenesAfterRemove(e){this.scenes.forEach(t=>{t.index>e&&(t.index-=1)})}}const _t={version:"3.11.7"}.version;function tr(){const a=globalThis.crypto?.subtle;if(!a)throw new Error("[BimEngine] Web Crypto API is required for secure sdkAuth credentials mode");return a}function Tt(a){return new TextEncoder().encode(a)}function At(a){return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}function oa(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e)}function Vn(a){const e=a.getUTCFullYear(),t=String(a.getUTCMonth()+1).padStart(2,"0"),d=String(a.getUTCDate()).padStart(2,"0");return`${e}${t}${d}`}async function Mn(a){const e=await tr().digest("SHA-256",At(Tt(a)));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Kn(a,e){const t=tr(),d=await t.importKey("raw",At(a),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return t.sign("HMAC",d,At(Tt(e)))}function zn(a){return Tt([a.appId,a.engineType,a.requestDate,String(a.timestamp),a.nonce].join("|"))}async function qn(a){const e=tr(),t=new Date,d=t.getTime(),x=Vn(t),g=globalThis.crypto.randomUUID(),u=globalThis.crypto.getRandomValues(new Uint8Array(12)),r=await Mn(a.appSecret),c=await Kn(Tt(r),x),l=await e.importKey("raw",c,"AES-GCM",!1,["encrypt"]),b=JSON.stringify({appKey:a.appKey,appSecret:a.appSecret}),T=await e.encrypt({name:"AES-GCM",iv:u,additionalData:At(zn({appId:a.appId,engineType:a.engineType,requestDate:x,timestamp:d,nonce:g})),tagLength:128},l,At(Tt(b)));return{appId:a.appId,engineType:a.engineType,requestDate:x,timestamp:d,nonce:g,iv:oa(u),cipherText:oa(new Uint8Array(T)),sdkVersion:a.sdkVersion,origin:a.origin,product:a.product}}const rr=new Map;function Pt(a){return a.replace(/\/+$/,"")}function Ot(a){if(a)return a;if(typeof window<"u"&&typeof window.location?.origin=="string")return window.location.origin}function Hn(a,e){return JSON.stringify({endpoint:Pt(a.endpoint),token:a.token??"",appId:a.appId??"",appKey:a.appKey??"",appSecret:a.appSecret??"",origin:Ot(a.origin)??"",product:a.product??"",engineType:e,sdkVersion:_t})}async function ar(a,e,t){const d=typeof AbortController<"u"?new AbortController:void 0,x=d?setTimeout(()=>d.abort(),t):void 0;try{const g=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:d?.signal}),u=await g.json().catch(()=>({}));if(!g.ok){const r=u?.error?.message??u?.message??`SDK authentication failed with status ${g.status}`;throw new Error(r)}return u}finally{x!=null&&clearTimeout(x)}}async function Gn(a,e){const t=await ar(`${Pt(a.endpoint)}/oauth/sdk-verify`,{sdkToken:a.token,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product},a.timeoutMs??8e3);return t.sdkToken=a.token,t}async function Wn(a,e){const t=await qn({appId:a.appId,appKey:a.appKey,appSecret:a.appSecret,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product}),d=await ar(`${Pt(a.endpoint)}/oauth/sdk-token/secure`,t,a.timeoutMs??8e3),x=await ar(`${Pt(a.endpoint)}/oauth/sdk-verify`,{sdkToken:d.sdkToken,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product},a.timeoutMs??8e3);return x.sdkToken=d.sdkToken,x}async function jn(a,e){const t=a?.sdkAuth;if(!t)return null;if(!t.endpoint)throw new Error("[BimEngine] sdkAuth.endpoint is required");if(!t.token&&!(t.appId&&t.appKey&&t.appSecret))return null;const d=Hn(t,e),x=rr.get(d);if(x){const u=await x;return a&&(a.__sdkAuthSession=u),u}const g=(t.token?Gn(t,e):Wn(t,e)).then(u=>{if(u.authorized!==!0)throw new Error("[BimEngine] SDK authorization rejected");return a&&(a.__sdkAuthSession=u),u}).catch(u=>{throw rr.delete(d),u});return rr.set(d,g),g}function Qn(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in a&&a.BYTES_PER_ELEMENT===1}function ua(a){if(typeof a!="number")throw new TypeError("number expected, got "+typeof a);if(!Number.isSafeInteger(a)||a<0)throw new RangeError("positive integer expected, got "+a)}function Ye(a,e,t=""){const d=Qn(a),x=a?.length,g=e!==void 0;if(!d||g&&x!==e){const u=t&&`"${t}" `,r=g?` of length ${e}`:"",c=d?`length=${x}`:`type=${typeof a}`,l=u+"expected Uint8Array"+r+", got "+c;throw d?new RangeError(l):new TypeError(l)}return a}function la(a,e=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(e&&a.finished)throw new Error("Hash#digest() has already been called")}function Yn(a,e,t=!1){Ye(a,void 0,"output");const d=e.outputLen;if(a.length<d)throw new RangeError("digestInto() expects output buffer of length at least "+d);if(t&&!It(a))throw new Error("invalid output, must be aligned")}function Zn(a){return new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}function vt(a){return new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))}function pt(...a){for(let e=0;e<a.length;e++)a[e].fill(0)}function Ft(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}const nr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,fa=a=>a<<24&4278190080|a<<8&16711680|a>>>8&65280|a>>>24&255,ke=nr?a=>a:a=>fa(a)>>>0,ir=nr?a=>a:a=>{for(let e=0;e<a.length;e++)a[e]=fa(a[e]);return a};function Xn(a,e){if(a.length!==e.length)return!1;let t=0;for(let d=0;d<a.length;d++)t|=a[d]^e[d];return t===0}function $n(a,e,t){const d=e,x=t||(()=>[]),g=(r,c)=>d(c,...x(r)).update(r).digest(),u=d(new Uint8Array(a),...x(new Uint8Array(0)));return g.outputLen=u.outputLen,g.blockLen=u.blockLen,g.create=(r,...c)=>d(r,...c),g}const Jn=(a,e)=>{function t(d,...x){if(Ye(d,void 0,"key"),a.nonceLength!==void 0){const b=x[0];Ye(b,a.varSizeNonce?void 0:a.nonceLength,"nonce")}const g=a.tagLength;g&&x[1]!==void 0&&Ye(x[1],void 0,"AAD");const u=e(d,...x),r=(b,T)=>{if(T!==void 0){if(b!==2)throw new Error("cipher output not supported");Ye(T,void 0,"output")}};let c=!1;return{encrypt(b,T){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Ye(b),r(u.encrypt.length,T),u.encrypt(b,T)},decrypt(b,T){if(Ye(b),g&&b.length<g)throw new Error('"ciphertext" expected length bigger than tagLength='+g);return r(u.decrypt.length,T),u.decrypt(b,T)}}}return Object.assign(t,a),t};function ei(a,e,t=!0){if(e===void 0)return new Uint8Array(a);if(Ye(e,void 0,"output"),e.length!==a)throw new Error('"output" expected Uint8Array of length '+a+", got: "+e.length);if(t&&!It(e))throw new Error("invalid output, must be aligned");return e}function ti(a,e,t){ua(a),ua(e);const d=new Uint8Array(16),x=Ft(d);return x.setBigUint64(0,BigInt(e),t),x.setBigUint64(8,BigInt(a),t),d}function It(a){return a.byteOffset%4===0}function wt(a){return Uint8Array.from(Ye(a))}const Ct=16,ca=new Uint8Array(16),Bt=vt(ca),ri=225,ai=(a,e,t,d)=>{const x=d&1;return{s3:t<<31|d>>>1,s2:e<<31|t>>>1,s1:a<<31|e>>>1,s0:a>>>1^ri<<24&-(x&1)}},Vt=a=>(a>>>0&255)<<24|(a>>>8&255)<<16|(a>>>16&255)<<8|a>>>24&255|0,ni=a=>a>64*1024?8:a>1024?4:2;class ii{blockLen=Ct;outputLen=Ct;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(e,t){Ye(e,16,"key"),e=wt(e);const d=Ft(e);let x=d.getUint32(0,!1),g=d.getUint32(4,!1),u=d.getUint32(8,!1),r=d.getUint32(12,!1);const c=[];for(let v=0;v<128;v++)c.push({s0:Vt(x),s1:Vt(g),s2:Vt(u),s3:Vt(r)}),{s0:x,s1:g,s2:u,s3:r}=ai(x,g,u,r);const l=ni(t||1024);if(![1,2,4,8].includes(l))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=l;const T=128/l,E=this.windowSize=2**l,s=[];for(let v=0;v<T;v++)for(let h=0;h<E;h++){let y=0,n=0,p=0,m=0;for(let _=0;_<l;_++){if(!(h>>>l-_-1&1))continue;const{s0:C,s1:o,s2:i,s3:B}=c[l*v+_];y^=C,n^=o,p^=i,m^=B}s.push({s0:y,s1:n,s2:p,s3:m})}this.t=s}_updateBlock(e,t,d,x){e^=this.s0,t^=this.s1,d^=this.s2,x^=this.s3;const{W:g,t:u,windowSize:r}=this;let c=0,l=0,b=0,T=0;const E=(1<<g)-1;let s=0;for(const v of[e,t,d,x])for(let h=0;h<4;h++){const y=v>>>8*h&255;for(let n=8/g-1;n>=0;n--){const p=y>>>g*n&E,{s0:m,s1:_,s2:w,s3:C}=u[s*r+p];c^=m,l^=_,b^=w,T^=C,s+=1}}this.s0=c,this.s1=l,this.s2=b,this.s3=T}update(e){la(this),Ye(e),e=wt(e);const t=vt(e),d=Math.floor(e.length/Ct),x=e.length%Ct;for(let g=0;g<d;g++)this._updateBlock(ke(t[g*4+0]),ke(t[g*4+1]),ke(t[g*4+2]),ke(t[g*4+3]));return x&&(ca.set(e.subarray(d*Ct)),this._updateBlock(ke(Bt[0]),ke(Bt[1]),ke(Bt[2]),ke(Bt[3])),pt(Bt)),this}destroy(){this.destroyed=!0;const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){la(this),Yn(e,this,!0),this.finished=!0;const{s0:t,s1:d,s2:x,s3:g}=this,u=vt(e);u[0]=t,u[1]=d,u[2]=x,u[3]=g,ir(u)}digest(){const e=new Uint8Array(Ct);return this.digestInto(e),this.destroy(),e}}const ha=$n(16,(a,e)=>new ii(a,e),a=>[a.length]),sr=16,si=4,Mt=new Uint8Array(sr),oi=283;function ui(a){if(![16,24,32].includes(a.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+a.length)}function or(a){return a<<1^oi&-(a>>7)}function da(a,e){let t=0;for(;e>0;e>>=1)t^=a&-(e&1),a=or(a);return t}const li=(()=>{const a=new Uint8Array(256);for(let t=0,d=1;t<256;t++,d^=or(d))a[t]=d;const e=new Uint8Array(256);e[0]=99;for(let t=0;t<255;t++){let d=a[255-t];d|=d<<8,e[a[t]]=(d^d>>4^d>>5^d>>6^d>>7^99)&255}return pt(a),e})(),fi=a=>a<<24|a>>>8,ur=a=>a<<8|a>>>24;function ci(a,e){if(a.length!==256)throw new Error("Wrong sbox length");const t=new Uint32Array(256).map((l,b)=>e(a[b])),d=t.map(ur),x=d.map(ur),g=x.map(ur),u=new Uint32Array(256*256),r=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let b=0;b<256;b++){const T=l*256+b;u[T]=t[l]^d[b],r[T]=x[l]^g[b],c[T]=a[l]<<8|a[b]}return{sbox:a,sbox2:c,T0:t,T1:d,T2:x,T3:g,T01:u,T23:r}}const pa=ci(li,a=>da(a,3)<<24|a<<16|a<<8|da(a,2)),hi=(()=>{const a=new Uint8Array(16);for(let e=0,t=1;e<16;e++,t=or(t))a[e]=t;return a})();function di(a){Ye(a);const e=a.length;ui(a);const{sbox2:t}=pa,d=[];(!nr||!It(a))&&d.push(a=wt(a));const x=ir(vt(a)),g=x.length,u=c=>kt(t,c,c,c,c),r=new Uint32Array(e+28);r.set(x);for(let c=g;c<r.length;c++){let l=r[c-1];c%g===0?l=u(fi(l))^hi[c/g-1]:g>6&&c%g===4&&(l=u(l)),r[c]=r[c-g]^l}return pt(...d),r}function Kt(a,e,t,d,x,g){return a[t<<8&65280|d>>>8&255]^e[x>>>8&65280|g>>>24&255]}function kt(a,e,t,d,x){return a[e&255|t&65280]|a[d>>>16&255|x>>>16&65280]<<16}function ga(a,e,t,d,x){const{sbox2:g,T01:u,T23:r}=pa;let c=0;e^=a[c++],t^=a[c++],d^=a[c++],x^=a[c++];const l=a.length/4-2;for(let v=0;v<l;v++){const h=a[c++]^Kt(u,r,e,t,d,x),y=a[c++]^Kt(u,r,t,d,x,e),n=a[c++]^Kt(u,r,d,x,e,t),p=a[c++]^Kt(u,r,x,e,t,d);e=h,t=y,d=n,x=p}const b=a[c++]^kt(g,e,t,d,x),T=a[c++]^kt(g,t,d,x,e),E=a[c++]^kt(g,d,x,e,t),s=a[c++]^kt(g,x,e,t,d);return{s0:b,s1:T,s2:E,s3:s}}function zt(a,e,t,d,x){Ye(t,sr,"nonce"),Ye(d),x=ei(d.length,x);const g=t,u=vt(g),r=Ft(g),c=vt(d),l=vt(x),b=e?0:12,T=d.length;let E=r.getUint32(b,e),{s0:s,s1:v,s2:h,s3:y}=ga(a,ke(u[0]),ke(u[1]),ke(u[2]),ke(u[3]));for(let p=0;p+4<=c.length;p+=4)l[p+0]=c[p+0]^ke(s),l[p+1]=c[p+1]^ke(v),l[p+2]=c[p+2]^ke(h),l[p+3]=c[p+3]^ke(y),E=E+1>>>0,r.setUint32(b,E,e),{s0:s,s1:v,s2:h,s3:y}=ga(a,ke(u[0]),ke(u[1]),ke(u[2]),ke(u[3]));const n=sr*Math.floor(c.length/si);if(n<T){const p=new Uint32Array([s,v,h,y]);ir(p);const m=Zn(p);for(let _=n,w=0;_<T;_++,w++)x[_]=d[_]^m[w];pt(p)}return x}function pi(a,e,t,d,x){const g=x?x.length:0,u=a.create(t,d.length+g);x&&u.update(x);const r=ti(8*d.length,8*g,e);u.update(d),u.update(r);const c=u.digest();return pt(r),c}const gi=Jn({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(e,t,d){if(t.length<8)throw new Error("aes/gcm: invalid nonce length");const x=16;function g(r,c,l){const b=pi(ha,!1,r,l,d);for(let T=0;T<c.length;T++)b[T]^=c[T];return b}function u(){const r=di(e),c=Mt.slice(),l=Mt.slice();if(zt(r,!1,l,l,c),t.length===12)l.set(t);else{const T=Mt.slice();Ft(T).setBigUint64(8,BigInt(t.length*8),!1);const s=ha.create(c).update(t).update(T);s.digestInto(l),s.destroy()}const b=zt(r,!1,l,Mt);return{xk:r,authKey:c,counter:l,tagMask:b}}return{encrypt(r){const{xk:c,authKey:l,counter:b,tagMask:T}=u(),E=new Uint8Array(r.length+x),s=[c,l,b,T];It(r)||s.push(r=wt(r)),zt(c,!1,b,r,E.subarray(0,r.length));const v=g(l,T,E.subarray(0,E.length-x));return s.push(v),E.set(v,r.length),pt(...s),E},decrypt(r){const{xk:c,authKey:l,counter:b,tagMask:T}=u(),E=[c,l,T,b];It(r)||E.push(r=wt(r));const s=r.subarray(0,-x),v=r.subarray(-x),h=g(l,T,s);if(E.push(h),!Xn(h,v))throw pt(...E),new Error("aes/gcm: invalid ghash tag");const y=zt(c,!1,b,s);return pt(...E),y}}});var lr,va;function me(){return va||(va=1,lr={options:{usePureJavaScript:!1}}),lr}var fr={exports:{}},cr,ya;function vi(){if(ya)return cr;ya=1;var a={};cr=a;var e={};a.encode=function(d,x,g){if(typeof x!="string")throw new TypeError('"alphabet" must be a string.');if(g!==void 0&&typeof g!="number")throw new TypeError('"maxline" must be a number.');var u="";if(!(d instanceof Uint8Array))u=t(d,x);else{var r=0,c=x.length,l=x.charAt(0),b=[0];for(r=0;r<d.length;++r){for(var T=0,E=d[r];T<b.length;++T)E+=b[T]<<8,b[T]=E%c,E=E/c|0;for(;E>0;)b.push(E%c),E=E/c|0}for(r=0;d[r]===0&&r<d.length-1;++r)u+=l;for(r=b.length-1;r>=0;--r)u+=x[b[r]]}if(g){var s=new RegExp(".{1,"+g+"}","g");u=u.match(s).join(`\r
|
|
3
|
-
`)}return u},a.decode=function(d,x){if(typeof d!="string")throw new TypeError('"input" must be a string.');if(typeof x!="string")throw new TypeError('"alphabet" must be a string.');var g=e[x];if(!g){g=e[x]=[];for(var u=0;u<x.length;++u)g[x.charCodeAt(u)]=u}d=d.replace(/\s/g,"");for(var r=x.length,c=x.charAt(0),l=[0],u=0;u<d.length;u++){var b=g[d.charCodeAt(u)];if(b===void 0)return;for(var T=0,E=b;T<l.length;++T)E+=l[T]*r,l[T]=E&255,E>>=8;for(;E>0;)l.push(E&255),E>>=8}for(var s=0;d[s]===c&&s<d.length-1;++s)l.push(0);return typeof Buffer<"u"?Buffer.from(l.reverse()):new Uint8Array(l.reverse())};function t(d,x){var g=0,u=x.length,r=x.charAt(0),c=[0];for(g=0;g<d.length();++g){for(var l=0,b=d.at(g);l<c.length;++l)b+=c[l]<<8,c[l]=b%u,b=b/u|0;for(;b>0;)c.push(b%u),b=b/u|0}var T="";for(g=0;d.at(g)===0&&g<d.length()-1;++g)T+=r;for(g=c.length-1;g>=0;--g)T+=x[c[g]];return T}return cr}var ma;function Ee(){if(ma)return fr.exports;ma=1;var a=me(),e=vi(),t=fr.exports=a.util=a.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){t.nextTick=process.nextTick,typeof setImmediate=="function"?t.setImmediate=setImmediate:t.setImmediate=t.nextTick;return}if(typeof setImmediate=="function"){t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},t.nextTick=function(o){return setImmediate(o)};return}if(t.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(i){if(i.source===window&&i.data===n){i.stopPropagation();var B=p.slice();p.length=0,B.forEach(function(N){N()})}};var n="forge.setImmediate",p=[];t.setImmediate=function(i){p.push(i),p.length===1&&window.postMessage(n,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var m=Date.now(),_=!0,w=document.createElement("div"),p=[];new MutationObserver(function(){var i=p.slice();p.length=0,i.forEach(function(B){B()})}).observe(w,{attributes:!0});var C=t.setImmediate;t.setImmediate=function(i){Date.now()-m>15?(m=Date.now(),C(i)):(p.push(i),p.length===1&&w.setAttribute("a",_=!_))}}t.nextTick=t.setImmediate})(),t.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,t.globalScope=(function(){return t.isNodejs?bt:typeof self>"u"?window:self})(),t.isArray=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},t.isArrayBuffer=function(n){return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer},t.isArrayBufferView=function(n){return n&&t.isArrayBuffer(n.buffer)&&n.byteLength!==void 0};function d(n){if(!(n===8||n===16||n===24||n===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+n)}t.ByteBuffer=x;function x(n){if(this.data="",this.read=0,typeof n=="string")this.data=n;else if(t.isArrayBuffer(n)||t.isArrayBufferView(n))if(typeof Buffer<"u"&&n instanceof Buffer)this.data=n.toString("binary");else{var p=new Uint8Array(n);try{this.data=String.fromCharCode.apply(null,p)}catch{for(var m=0;m<p.length;++m)this.putByte(p[m])}}else(n instanceof x||typeof n=="object"&&typeof n.data=="string"&&typeof n.read=="number")&&(this.data=n.data,this.read=n.read);this._constructedStringLength=0}t.ByteStringBuffer=x;var g=4096;t.ByteStringBuffer.prototype._optimizeConstructedString=function(n){this._constructedStringLength+=n,this._constructedStringLength>g&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(n){return this.putBytes(String.fromCharCode(n))},t.ByteStringBuffer.prototype.fillWithByte=function(n,p){n=String.fromCharCode(n);for(var m=this.data;p>0;)p&1&&(m+=n),p>>>=1,p>0&&(n+=n);return this.data=m,this._optimizeConstructedString(p),this},t.ByteStringBuffer.prototype.putBytes=function(n){return this.data+=n,this._optimizeConstructedString(n.length),this},t.ByteStringBuffer.prototype.putString=function(n){return this.putBytes(t.encodeUtf8(n))},t.ByteStringBuffer.prototype.putInt16=function(n){return this.putBytes(String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt24=function(n){return this.putBytes(String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt32=function(n){return this.putBytes(String.fromCharCode(n>>24&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt16Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>24&255))},t.ByteStringBuffer.prototype.putInt=function(n,p){d(p);var m="";do p-=8,m+=String.fromCharCode(n>>p&255);while(p>0);return this.putBytes(m)},t.ByteStringBuffer.prototype.putSignedInt=function(n,p){return n<0&&(n+=2<<p-1),this.putInt(n,p)},t.ByteStringBuffer.prototype.putBuffer=function(n){return this.putBytes(n.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var n=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,n},t.ByteStringBuffer.prototype.getInt24=function(){var n=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,n},t.ByteStringBuffer.prototype.getInt32=function(){var n=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,n},t.ByteStringBuffer.prototype.getInt16Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,n},t.ByteStringBuffer.prototype.getInt24Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,n},t.ByteStringBuffer.prototype.getInt32Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,n},t.ByteStringBuffer.prototype.getInt=function(n){d(n);var p=0;do p=(p<<8)+this.data.charCodeAt(this.read++),n-=8;while(n>0);return p},t.ByteStringBuffer.prototype.getSignedInt=function(n){var p=this.getInt(n),m=2<<n-2;return p>=m&&(p-=m<<1),p},t.ByteStringBuffer.prototype.getBytes=function(n){var p;return n?(n=Math.min(this.length(),n),p=this.data.slice(this.read,this.read+n),this.read+=n):n===0?p="":(p=this.read===0?this.data:this.data.slice(this.read),this.clear()),p},t.ByteStringBuffer.prototype.bytes=function(n){return typeof n>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+n)},t.ByteStringBuffer.prototype.at=function(n){return this.data.charCodeAt(this.read+n)},t.ByteStringBuffer.prototype.setAt=function(n,p){return this.data=this.data.substr(0,this.read+n)+String.fromCharCode(p)+this.data.substr(this.read+n+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var n=t.createBuffer(this.data);return n.read=this.read,n},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(n){var p=Math.max(0,this.length()-n);return this.data=this.data.substr(this.read,p),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var n="",p=this.read;p<this.data.length;++p){var m=this.data.charCodeAt(p);m<16&&(n+="0"),n+=m.toString(16)}return n},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())};function u(n,p){p=p||{},this.read=p.readOffset||0,this.growSize=p.growSize||1024;var m=t.isArrayBuffer(n),_=t.isArrayBufferView(n);if(m||_){m?this.data=new DataView(n):this.data=new DataView(n.buffer,n.byteOffset,n.byteLength),this.write="writeOffset"in p?p.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,n!=null&&this.putBytes(n),"writeOffset"in p&&(this.write=p.writeOffset)}t.DataBuffer=u,t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(n,p){if(this.length()>=n)return this;p=Math.max(p||this.growSize,n);var m=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),_=new Uint8Array(this.length()+p);return _.set(m),this.data=new DataView(_.buffer),this},t.DataBuffer.prototype.putByte=function(n){return this.accommodate(1),this.data.setUint8(this.write++,n),this},t.DataBuffer.prototype.fillWithByte=function(n,p){this.accommodate(p);for(var m=0;m<p;++m)this.data.setUint8(n);return this},t.DataBuffer.prototype.putBytes=function(n,p){if(t.isArrayBufferView(n)){var m=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),_=m.byteLength-m.byteOffset;this.accommodate(_);var w=new Uint8Array(this.data.buffer,this.write);return w.set(m),this.write+=_,this}if(t.isArrayBuffer(n)){var m=new Uint8Array(n);this.accommodate(m.byteLength);var w=new Uint8Array(this.data.buffer);return w.set(m,this.write),this.write+=m.byteLength,this}if(n instanceof t.DataBuffer||typeof n=="object"&&typeof n.read=="number"&&typeof n.write=="number"&&t.isArrayBufferView(n.data)){var m=new Uint8Array(n.data.byteLength,n.read,n.length());this.accommodate(m.byteLength);var w=new Uint8Array(n.data.byteLength,this.write);return w.set(m),this.write+=m.byteLength,this}if(n instanceof t.ByteStringBuffer&&(n=n.data,p="binary"),p=p||"binary",typeof n=="string"){var C;if(p==="hex")return this.accommodate(Math.ceil(n.length/2)),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(n,C,this.write),this;if(p==="base64")return this.accommodate(Math.ceil(n.length/4)*3),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(n,C,this.write),this;if(p==="utf8"&&(n=t.encodeUtf8(n),p="binary"),p==="binary"||p==="raw")return this.accommodate(n.length),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(C),this;if(p==="utf16")return this.accommodate(n.length*2),C=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(C),this;throw new Error("Invalid encoding: "+p)}throw Error("Invalid parameter: "+n)},t.DataBuffer.prototype.putBuffer=function(n){return this.putBytes(n),n.clear(),this},t.DataBuffer.prototype.putString=function(n){return this.putBytes(n,"utf16")},t.DataBuffer.prototype.putInt16=function(n){return this.accommodate(2),this.data.setInt16(this.write,n),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(n){return this.accommodate(3),this.data.setInt16(this.write,n>>8&65535),this.data.setInt8(this.write,n>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(n){return this.accommodate(4),this.data.setInt32(this.write,n),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(n){return this.accommodate(2),this.data.setInt16(this.write,n,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(n){return this.accommodate(3),this.data.setInt8(this.write,n>>16&255),this.data.setInt16(this.write,n>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(n){return this.accommodate(4),this.data.setInt32(this.write,n,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(n,p){d(p),this.accommodate(p/8);do p-=8,this.data.setInt8(this.write++,n>>p&255);while(p>0);return this},t.DataBuffer.prototype.putSignedInt=function(n,p){return d(p),this.accommodate(p/8),n<0&&(n+=2<<p-1),this.putInt(n,p)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var n=this.data.getInt16(this.read);return this.read+=2,n},t.DataBuffer.prototype.getInt24=function(){var n=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,n},t.DataBuffer.prototype.getInt32=function(){var n=this.data.getInt32(this.read);return this.read+=4,n},t.DataBuffer.prototype.getInt16Le=function(){var n=this.data.getInt16(this.read,!0);return this.read+=2,n},t.DataBuffer.prototype.getInt24Le=function(){var n=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,n},t.DataBuffer.prototype.getInt32Le=function(){var n=this.data.getInt32(this.read,!0);return this.read+=4,n},t.DataBuffer.prototype.getInt=function(n){d(n);var p=0;do p=(p<<8)+this.data.getInt8(this.read++),n-=8;while(n>0);return p},t.DataBuffer.prototype.getSignedInt=function(n){var p=this.getInt(n),m=2<<n-2;return p>=m&&(p-=m<<1),p},t.DataBuffer.prototype.getBytes=function(n){var p;return n?(n=Math.min(this.length(),n),p=this.data.slice(this.read,this.read+n),this.read+=n):n===0?p="":(p=this.read===0?this.data:this.data.slice(this.read),this.clear()),p},t.DataBuffer.prototype.bytes=function(n){return typeof n>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+n)},t.DataBuffer.prototype.at=function(n){return this.data.getUint8(this.read+n)},t.DataBuffer.prototype.setAt=function(n,p){return this.data.setUint8(n,p),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var n=new Uint8Array(this.data.buffer,this.read),p=new Uint8Array(n.byteLength);p.set(n),this.data=new DataView(p),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(n){return this.write=Math.max(0,this.length()-n),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var n="",p=this.read;p<this.data.byteLength;++p){var m=this.data.getUint8(p);m<16&&(n+="0"),n+=m.toString(16)}return n},t.DataBuffer.prototype.toString=function(n){var p=new Uint8Array(this.data,this.read,this.length());if(n=n||"utf8",n==="binary"||n==="raw")return t.binary.raw.encode(p);if(n==="hex")return t.binary.hex.encode(p);if(n==="base64")return t.binary.base64.encode(p);if(n==="utf8")return t.text.utf8.decode(p);if(n==="utf16")return t.text.utf16.decode(p);throw new Error("Invalid encoding: "+n)},t.createBuffer=function(n,p){return p=p||"raw",n!==void 0&&p==="utf8"&&(n=t.encodeUtf8(n)),new t.ByteBuffer(n)},t.fillString=function(n,p){for(var m="";p>0;)p&1&&(m+=n),p>>>=1,p>0&&(n+=n);return m},t.xorBytes=function(n,p,m){for(var _="",w="",C="",o=0,i=0;m>0;--m,++o)w=n.charCodeAt(o)^p.charCodeAt(o),i>=10&&(_+=C,C="",i=0),C+=String.fromCharCode(w),++i;return _+=C,_},t.hexToBytes=function(n){var p="",m=0;for(n.length&!0&&(m=1,p+=String.fromCharCode(parseInt(n[0],16)));m<n.length;m+=2)p+=String.fromCharCode(parseInt(n.substr(m,2),16));return p},t.bytesToHex=function(n){return t.createBuffer(n).toHex()},t.int32ToBytes=function(n){return String.fromCharCode(n>>24&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255)};var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(n,p){for(var m="",_="",w,C,o,i=0;i<n.length;)w=n.charCodeAt(i++),C=n.charCodeAt(i++),o=n.charCodeAt(i++),m+=r.charAt(w>>2),m+=r.charAt((w&3)<<4|C>>4),isNaN(C)?m+="==":(m+=r.charAt((C&15)<<2|o>>6),m+=isNaN(o)?"=":r.charAt(o&63)),p&&m.length>p&&(_+=m.substr(0,p)+`\r
|
|
4
|
-
`,m=m.substr(p));return _+=m,_},t.decode64=function(n){n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var p="",m,_,w,C,o=0;o<n.length;)m=c[n.charCodeAt(o++)-43],_=c[n.charCodeAt(o++)-43],w=c[n.charCodeAt(o++)-43],C=c[n.charCodeAt(o++)-43],p+=String.fromCharCode(m<<2|_>>4),w!==64&&(p+=String.fromCharCode((_&15)<<4|w>>2),C!==64&&(p+=String.fromCharCode((w&3)<<6|C)));return p},t.encodeUtf8=function(n){return unescape(encodeURIComponent(n))},t.decodeUtf8=function(n){return decodeURIComponent(escape(n))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},t.binary.raw.encode=function(n){return String.fromCharCode.apply(null,n)},t.binary.raw.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(n.length)),m=m||0;for(var w=m,C=0;C<n.length;++C)_[w++]=n.charCodeAt(C);return p?w-m:_},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(Math.ceil(n.length/2))),m=m||0;var w=0,C=m;for(n.length&1&&(w=1,_[C++]=parseInt(n[0],16));w<n.length;w+=2)_[C++]=parseInt(n.substr(w,2),16);return p?C-m:_},t.binary.base64.encode=function(n,p){for(var m="",_="",w,C,o,i=0;i<n.byteLength;)w=n[i++],C=n[i++],o=n[i++],m+=r.charAt(w>>2),m+=r.charAt((w&3)<<4|C>>4),isNaN(C)?m+="==":(m+=r.charAt((C&15)<<2|o>>6),m+=isNaN(o)?"=":r.charAt(o&63)),p&&m.length>p&&(_+=m.substr(0,p)+`\r
|
|
5
|
-
`,m=m.substr(p));return _+=m,_},t.binary.base64.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(Math.ceil(n.length/4)*3)),n=n.replace(/[^A-Za-z0-9\+\/\=]/g,""),m=m||0;for(var w,C,o,i,B=0,N=m;B<n.length;)w=c[n.charCodeAt(B++)-43],C=c[n.charCodeAt(B++)-43],o=c[n.charCodeAt(B++)-43],i=c[n.charCodeAt(B++)-43],_[N++]=w<<2|C>>4,o!==64&&(_[N++]=(C&15)<<4|o>>2,i!==64&&(_[N++]=(o&3)<<6|i));return p?N-m:_.subarray(0,N)},t.binary.base58.encode=function(n,p){return t.binary.baseN.encode(n,l,p)},t.binary.base58.decode=function(n,p){return t.binary.baseN.decode(n,l,p)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(n,p,m){n=t.encodeUtf8(n);var _=p;_||(_=new Uint8Array(n.length)),m=m||0;for(var w=m,C=0;C<n.length;++C)_[w++]=n.charCodeAt(C);return p?w-m:_},t.text.utf8.decode=function(n){return t.decodeUtf8(String.fromCharCode.apply(null,n))},t.text.utf16.encode=function(n,p,m){var _=p;_||(_=new Uint8Array(n.length*2));var w=new Uint16Array(_.buffer);m=m||0;for(var C=m,o=m,i=0;i<n.length;++i)w[o++]=n.charCodeAt(i),C+=2;return p?C-m:_},t.text.utf16.decode=function(n){return String.fromCharCode.apply(null,new Uint16Array(n.buffer))},t.deflate=function(n,p,m){if(p=t.decode64(n.deflate(t.encode64(p)).rval),m){var _=2,w=p.charCodeAt(1);w&32&&(_=6),p=p.substring(_,p.length-4)}return p},t.inflate=function(n,p,m){var _=n.inflate(t.encode64(p)).rval;return _===null?null:t.decode64(_)};var b=function(n,p,m){if(!n)throw new Error("WebStorage not available.");var _;if(m===null?_=n.removeItem(p):(m=t.encode64(JSON.stringify(m)),_=n.setItem(p,m)),typeof _<"u"&&_.rval!==!0){var w=new Error(_.error.message);throw w.id=_.error.id,w.name=_.error.name,w}},T=function(n,p){if(!n)throw new Error("WebStorage not available.");var m=n.getItem(p);if(n.init)if(m.rval===null){if(m.error){var _=new Error(m.error.message);throw _.id=m.error.id,_.name=m.error.name,_}m=null}else m=m.rval;return m!==null&&(m=JSON.parse(t.decode64(m))),m},E=function(n,p,m,_){var w=T(n,p);w===null&&(w={}),w[m]=_,b(n,p,w)},s=function(n,p,m){var _=T(n,p);return _!==null&&(_=m in _?_[m]:null),_},v=function(n,p,m){var _=T(n,p);if(_!==null&&m in _){delete _[m];var w=!0;for(var C in _){w=!1;break}w&&(_=null),b(n,p,_)}},h=function(n,p){b(n,p,null)},y=function(n,p,m){var _=null;typeof m>"u"&&(m=["web","flash"]);var w,C=!1,o=null;for(var i in m){w=m[i];try{if(w==="flash"||w==="both"){if(p[0]===null)throw new Error("Flash local storage not available.");_=n.apply(this,p),C=w==="flash"}(w==="web"||w==="both")&&(p[0]=localStorage,_=n.apply(this,p),C=!0)}catch(B){o=B}if(C)break}if(!C)throw o;return _};return t.setItem=function(n,p,m,_,w){y(E,arguments,w)},t.getItem=function(n,p,m,_){return y(s,arguments,_)},t.removeItem=function(n,p,m,_){y(v,arguments,_)},t.clearItems=function(n,p,m){y(h,arguments,m)},t.isEmpty=function(n){for(var p in n)if(n.hasOwnProperty(p))return!1;return!0},t.format=function(n){for(var p=/%./g,m,_,w=0,C=[],o=0;m=p.exec(n);){_=n.substring(o,p.lastIndex-2),_.length>0&&C.push(_),o=p.lastIndex;var i=m[0][1];switch(i){case"s":case"o":w<arguments.length?C.push(arguments[w+++1]):C.push("<?>");break;case"%":C.push("%");break;default:C.push("<%"+i+"?>")}}return C.push(n.substring(o)),C.join("")},t.formatNumber=function(n,p,m,_){var w=n,C=isNaN(p=Math.abs(p))?2:p,o=m===void 0?",":m,i=_===void 0?".":_,B=w<0?"-":"",N=parseInt(w=Math.abs(+w||0).toFixed(C),10)+"",q=N.length>3?N.length%3:0;return B+(q?N.substr(0,q)+i:"")+N.substr(q).replace(/(\d{3})(?=\d)/g,"$1"+i)+(C?o+Math.abs(w-N).toFixed(C).slice(2):"")},t.formatSize=function(n){return n>=1073741824?n=t.formatNumber(n/1073741824,2,".","")+" GiB":n>=1048576?n=t.formatNumber(n/1048576,2,".","")+" MiB":n>=1024?n=t.formatNumber(n/1024,0)+" KiB":n=t.formatNumber(n,0)+" bytes",n},t.bytesFromIP=function(n){return n.indexOf(".")!==-1?t.bytesFromIPv4(n):n.indexOf(":")!==-1?t.bytesFromIPv6(n):null},t.bytesFromIPv4=function(n){if(n=n.split("."),n.length!==4)return null;for(var p=t.createBuffer(),m=0;m<n.length;++m){var _=parseInt(n[m],10);if(isNaN(_))return null;p.putByte(_)}return p.getBytes()},t.bytesFromIPv6=function(n){var p=0;n=n.split(":").filter(function(o){return o.length===0&&++p,!0});for(var m=(8-n.length+p)*2,_=t.createBuffer(),w=0;w<8;++w){if(!n[w]||n[w].length===0){_.fillWithByte(0,m),m=0;continue}var C=t.hexToBytes(n[w]);C.length<2&&_.putByte(0),_.putBytes(C)}return _.getBytes()},t.bytesToIP=function(n){return n.length===4?t.bytesToIPv4(n):n.length===16?t.bytesToIPv6(n):null},t.bytesToIPv4=function(n){if(n.length!==4)return null;for(var p=[],m=0;m<n.length;++m)p.push(n.charCodeAt(m));return p.join(".")},t.bytesToIPv6=function(n){if(n.length!==16)return null;for(var p=[],m=[],_=0,w=0;w<n.length;w+=2){for(var C=t.bytesToHex(n[w]+n[w+1]);C[0]==="0"&&C!=="0";)C=C.substr(1);if(C==="0"){var o=m[m.length-1],i=p.length;!o||i!==o.end+1?m.push({start:i,end:i}):(o.end=i,o.end-o.start>m[_].end-m[_].start&&(_=m.length-1))}p.push(C)}if(m.length>0){var B=m[_];B.end-B.start>0&&(p.splice(B.start,B.end-B.start+1,""),B.start===0&&p.unshift(""),B.end===7&&p.push(""))}return p.join(":")},t.estimateCores=function(n,p){if(typeof n=="function"&&(p=n,n={}),n=n||{},"cores"in t&&!n.update)return p(null,t.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,p(null,t.cores);if(typeof Worker>"u")return t.cores=1,p(null,t.cores);if(typeof Blob>"u")return t.cores=2,p(null,t.cores);var m=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(o){var i=Date.now(),B=i+4;self.postMessage({st:i,et:B})})}).toString(),")()"],{type:"application/javascript"}));_([],5,16);function _(o,i,B){if(i===0){var N=Math.floor(o.reduce(function(q,I){return q+I},0)/o.length);return t.cores=Math.max(1,N),URL.revokeObjectURL(m),p(null,t.cores)}w(B,function(q,I){o.push(C(B,I)),_(o,i-1,B)})}function w(o,i){for(var B=[],N=[],q=0;q<o;++q){var I=new Worker(m);I.addEventListener("message",function(F){if(N.push(F.data),N.length===o){for(var A=0;A<o;++A)B[A].terminate();i(null,N)}}),B.push(I)}for(var q=0;q<o;++q)B[q].postMessage(q)}function C(o,i){for(var B=[],N=0;N<o;++N)for(var q=i[N],I=B[N]=[],F=0;F<o;++F)if(N!==F){var A=i[F];(q.st>A.st&&q.st<A.et||A.st>q.st&&A.st<q.et)&&I.push(F)}return B.reduce(function(H,j){return Math.max(H,j.length)},0)}},fr.exports}var hr,Ca;function dr(){if(Ca)return hr;Ca=1;var a=me();Ee(),hr=a.cipher=a.cipher||{},a.cipher.algorithms=a.cipher.algorithms||{},a.cipher.createCipher=function(t,d){var x=t;if(typeof x=="string"&&(x=a.cipher.getAlgorithm(x),x&&(x=x())),!x)throw new Error("Unsupported algorithm: "+t);return new a.cipher.BlockCipher({algorithm:x,key:d,decrypt:!1})},a.cipher.createDecipher=function(t,d){var x=t;if(typeof x=="string"&&(x=a.cipher.getAlgorithm(x),x&&(x=x())),!x)throw new Error("Unsupported algorithm: "+t);return new a.cipher.BlockCipher({algorithm:x,key:d,decrypt:!0})},a.cipher.registerAlgorithm=function(t,d){t=t.toUpperCase(),a.cipher.algorithms[t]=d},a.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in a.cipher.algorithms?a.cipher.algorithms[t]:null};var e=a.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};return e.prototype.start=function(t){t=t||{};var d={};for(var x in t)d[x]=t[x];d.decrypt=this._decrypt,this._finish=!1,this._input=a.util.createBuffer(),this.output=t.output||a.util.createBuffer(),this.mode.start(d)},e.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(x){return t(this.blockSize,x,!1)},this.mode.unpad=function(x){return t(this.blockSize,x,!0)});var d={};return d.decrypt=this._decrypt,d.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,d)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,d))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,d))},hr}var pr={exports:{}},xa;function Ea(){if(xa)return pr.exports;xa=1;var a=me();Ee(),a.cipher=a.cipher||{};var e=pr.exports=a.cipher.modes=a.cipher.modes||{};e.ecb=function(g){g=g||{},this.name="ECB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(g){},e.ecb.prototype.encrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c])},e.ecb.prototype.decrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c])},e.ecb.prototype.pad=function(g,u){var r=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(r,r),!0},e.ecb.prototype.unpad=function(g,u){if(u.overflow>0)return!1;var r=g.length(),c=g.at(r-1);return c>this.blockSize<<2?!1:(g.truncate(c),!0)},e.cbc=function(g){g=g||{},this.name="CBC",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(g){if(g.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in g)this._iv=t(g.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(g,u){var r=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(r,r),!0},e.cbc.prototype.unpad=function(g,u){if(u.overflow>0)return!1;var r=g.length(),c=g.at(r-1);return c>this.blockSize<<2?!1:(g.truncate(c),!0)},e.cfb=function(g){g=g||{},this.name="CFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=g.getInt32()^this._outBlock[l],u.putInt32(this._inBlock[l]);return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=g.getInt32()^this._outBlock[l],this._partialOutput.putInt32(this._partialBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=g.getInt32(),u.putInt32(this._inBlock[l]^this._outBlock[l]);return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=g.getInt32(),this._partialOutput.putInt32(this._partialBlock[l]^this._outBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.ofb=function(g){g=g||{},this.name="OFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(g,u,r){var c=g.length();if(g.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)u.putInt32(g.getInt32()^this._outBlock[l]),this._inBlock[l]=this._outBlock[l];return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._outBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(g){g=g||{},this.name="CTR",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize)for(var l=0;l<this._ints;++l)u.putInt32(g.getInt32()^this._outBlock[l]);else{var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b>0&&(g.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}d(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(g){g=g||{},this.name="GCM",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");var u=a.util.createBuffer(g.iv);this._cipherLength=0;var r;if("additionalData"in g?r=a.util.createBuffer(g.additionalData):r=a.util.createBuffer(),"tagLength"in g?this._tagLength=g.tagLength:this._tagLength=128,this._tag=null,g.decrypt&&(this._tag=a.util.createBuffer(g.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var c=u.length();if(c===12)this._j0=[u.getInt32(),u.getInt32(),u.getInt32(),1];else{for(this._j0=[0,0,0,0];u.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[u.getInt32(),u.getInt32(),u.getInt32(),u.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(x(c*8)))}this._inBlock=this._j0.slice(0),d(this._inBlock),this._partialBytes=0,r=a.util.createBuffer(r),this._aDataLength=x(r.length()*8);var l=r.length()%this.blockSize;for(l&&r.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},e.gcm.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)u.putInt32(this._outBlock[l]^=g.getInt32());this._cipherLength+=this.blockSize}else{var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b<=0||r){if(r){var T=c%this.blockSize;this._cipherLength+=T,this._partialOutput.truncate(this.blockSize-T)}else this._cipherLength+=this.blockSize;for(var l=0;l<this._ints;++l)this._outBlock[l]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return g.read-=this.blockSize,u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),d(this._inBlock)},e.gcm.prototype.decrypt=function(g,u,r){var c=g.length();if(c<this.blockSize&&!(r&&c>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),d(this._inBlock),this._hashBlock[0]=g.getInt32(),this._hashBlock[1]=g.getInt32(),this._hashBlock[2]=g.getInt32(),this._hashBlock[3]=g.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var l=0;l<this._ints;++l)u.putInt32(this._outBlock[l]^this._hashBlock[l]);c<this.blockSize?this._cipherLength+=c%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(g,u){var r=!0;u.decrypt&&u.overflow&&g.truncate(this.blockSize-u.overflow),this.tag=a.util.createBuffer();var c=this._aDataLength.concat(x(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,c);var l=[];this.cipher.encrypt(this._j0,l);for(var b=0;b<this._ints;++b)this.tag.putInt32(this._s[b]^l[b]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),u.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},e.gcm.prototype.multiply=function(g,u){for(var r=[0,0,0,0],c=u.slice(0),l=0;l<128;++l){var b=g[l/32|0]&1<<31-l%32;b&&(r[0]^=c[0],r[1]^=c[1],r[2]^=c[2],r[3]^=c[3]),this.pow(c,c)}return r},e.gcm.prototype.pow=function(g,u){for(var r=g[3]&1,c=3;c>0;--c)u[c]=g[c]>>>1|(g[c-1]&1)<<31;u[0]=g[0]>>>1,r&&(u[0]^=this._R)},e.gcm.prototype.tableMultiply=function(g){for(var u=[0,0,0,0],r=0;r<32;++r){var c=r/8|0,l=g[c]>>>(7-r%8)*4&15,b=this._m[r][l];u[0]^=b[0],u[1]^=b[1],u[2]^=b[2],u[3]^=b[3]}return u},e.gcm.prototype.ghash=function(g,u,r){return u[0]^=r[0],u[1]^=r[1],u[2]^=r[2],u[3]^=r[3],this.tableMultiply(u)},e.gcm.prototype.generateHashTable=function(g,u){for(var r=8/u,c=4*r,l=16*r,b=new Array(l),T=0;T<l;++T){var E=[0,0,0,0],s=T/c|0,v=(c-1-T%c)*u;E[s]=1<<u-1<<v,b[T]=this.generateSubHashTable(this.multiply(E,g),u)}return b},e.gcm.prototype.generateSubHashTable=function(g,u){var r=1<<u,c=r>>>1,l=new Array(r);l[c]=g.slice(0);for(var b=c>>>1;b>0;)this.pow(l[2*b],l[b]=[]),b>>=1;for(b=2;b<c;){for(var T=1;T<b;++T){var E=l[b],s=l[T];l[b+T]=[E[0]^s[0],E[1]^s[1],E[2]^s[2],E[3]^s[3]]}b*=2}for(l[0]=[0,0,0,0],b=c+1;b<r;++b){var v=l[b^c];l[b]=[g[0]^v[0],g[1]^v[1],g[2]^v[2],g[3]^v[3]]}return l};function t(g,u){if(typeof g=="string"&&(g=a.util.createBuffer(g)),a.util.isArray(g)&&g.length>4){var r=g;g=a.util.createBuffer();for(var c=0;c<r.length;++c)g.putByte(r[c])}if(g.length()<u)throw new Error("Invalid IV length; got "+g.length()+" bytes and expected "+u+" bytes.");if(!a.util.isArray(g)){for(var l=[],b=u/4,c=0;c<b;++c)l.push(g.getInt32());g=l}return g}function d(g){g[g.length-1]=g[g.length-1]+1&4294967295}function x(g){return[g/4294967296|0,g&4294967295]}return pr.exports}var gr,Sa;function yt(){if(Sa)return gr;Sa=1;var a=me();dr(),Ea(),Ee(),gr=a.aes=a.aes||{},a.aes.startEncrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!1,mode:y});return n.start(v),n},a.aes.createEncryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!1,mode:v})},a.aes.startDecrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!0,mode:y});return n.start(v),n},a.aes.createDecryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!0,mode:v})},a.aes.Algorithm=function(s,v){t||l();var h=this;h.name=s,h.mode=new v({blockSize:16,cipher:{encrypt:function(y,n){return T(h._w,y,n,!1)},decrypt:function(y,n){return T(h._w,y,n,!0)}}}),h._init=!1},a.aes.Algorithm.prototype.initialize=function(s){if(!this._init){var v=s.key,h;if(typeof v=="string"&&(v.length===16||v.length===24||v.length===32))v=a.util.createBuffer(v);else if(a.util.isArray(v)&&(v.length===16||v.length===24||v.length===32)){h=v,v=a.util.createBuffer();for(var y=0;y<h.length;++y)v.putByte(h[y])}if(!a.util.isArray(v)){h=v,v=[];var n=h.length();if(n===16||n===24||n===32){n=n>>>2;for(var y=0;y<n;++y)v.push(h.getInt32())}}if(!a.util.isArray(v)||!(v.length===4||v.length===6||v.length===8))throw new Error("Invalid key parameter.");var p=this.mode.name,m=["CFB","OFB","CTR","GCM"].indexOf(p)!==-1;this._w=b(v,s.decrypt&&!m),this._init=!0}},a.aes._expandKey=function(s,v){return t||l(),b(s,v)},a.aes._updateBlock=T,e("AES-ECB",a.cipher.modes.ecb),e("AES-CBC",a.cipher.modes.cbc),e("AES-CFB",a.cipher.modes.cfb),e("AES-OFB",a.cipher.modes.ofb),e("AES-CTR",a.cipher.modes.ctr),e("AES-GCM",a.cipher.modes.gcm);function e(s,v){var h=function(){return new a.aes.Algorithm(s,v)};a.cipher.registerAlgorithm(s,h)}var t=!1,d=4,x,g,u,r,c;function l(){t=!0,u=[0,1,2,4,8,16,32,64,128,27,54];for(var s=new Array(256),v=0;v<128;++v)s[v]=v<<1,s[v+128]=v+128<<1^283;x=new Array(256),g=new Array(256),r=new Array(4),c=new Array(4);for(var v=0;v<4;++v)r[v]=new Array(256),c[v]=new Array(256);for(var h=0,y=0,n,p,m,_,w,C,o,v=0;v<256;++v){_=y^y<<1^y<<2^y<<3^y<<4,_=_>>8^_&255^99,x[h]=_,g[_]=h,w=s[_],n=s[h],p=s[n],m=s[p],C=w<<24^_<<16^_<<8^(_^w),o=(n^p^m)<<24^(h^m)<<16^(h^p^m)<<8^(h^n^m);for(var i=0;i<4;++i)r[i][h]=C,c[i][_]=o,C=C<<24|C>>>8,o=o<<24|o>>>8;h===0?h=y=1:(h=n^s[s[s[n^m]]],y^=s[s[y]])}}function b(s,v){for(var h=s.slice(0),y,n=1,p=h.length,m=p+6+1,_=d*m,w=p;w<_;++w)y=h[w-1],w%p===0?(y=x[y>>>16&255]<<24^x[y>>>8&255]<<16^x[y&255]<<8^x[y>>>24]^u[n]<<24,n++):p>6&&w%p===4&&(y=x[y>>>24]<<24^x[y>>>16&255]<<16^x[y>>>8&255]<<8^x[y&255]),h[w]=h[w-p]^y;if(v){var C,o=c[0],i=c[1],B=c[2],N=c[3],q=h.slice(0);_=h.length;for(var w=0,I=_-d;w<_;w+=d,I-=d)if(w===0||w===_-d)q[w]=h[I],q[w+1]=h[I+3],q[w+2]=h[I+2],q[w+3]=h[I+1];else for(var F=0;F<d;++F)C=h[I+F],q[w+(3&-F)]=o[x[C>>>24]]^i[x[C>>>16&255]]^B[x[C>>>8&255]]^N[x[C&255]];h=q}return h}function T(s,v,h,y){var n=s.length/4-1,p,m,_,w,C;y?(p=c[0],m=c[1],_=c[2],w=c[3],C=g):(p=r[0],m=r[1],_=r[2],w=r[3],C=x);var o,i,B,N,q,I,F;o=v[0]^s[0],i=v[y?3:1]^s[1],B=v[2]^s[2],N=v[y?1:3]^s[3];for(var A=3,H=1;H<n;++H)q=p[o>>>24]^m[i>>>16&255]^_[B>>>8&255]^w[N&255]^s[++A],I=p[i>>>24]^m[B>>>16&255]^_[N>>>8&255]^w[o&255]^s[++A],F=p[B>>>24]^m[N>>>16&255]^_[o>>>8&255]^w[i&255]^s[++A],N=p[N>>>24]^m[o>>>16&255]^_[i>>>8&255]^w[B&255]^s[++A],o=q,i=I,B=F;h[0]=C[o>>>24]<<24^C[i>>>16&255]<<16^C[B>>>8&255]<<8^C[N&255]^s[++A],h[y?3:1]=C[i>>>24]<<24^C[B>>>16&255]<<16^C[N>>>8&255]<<8^C[o&255]^s[++A],h[2]=C[B>>>24]<<24^C[N>>>16&255]<<16^C[o>>>8&255]<<8^C[i&255]^s[++A],h[y?1:3]=C[N>>>24]<<24^C[o>>>16&255]<<16^C[i>>>8&255]<<8^C[B&255]^s[++A]}function E(s){s=s||{};var v=(s.mode||"CBC").toUpperCase(),h="AES-"+v,y;s.decrypt?y=a.cipher.createDecipher(h,s.key):y=a.cipher.createCipher(h,s.key);var n=y.start;return y.start=function(p,m){var _=null;m instanceof a.util.ByteBuffer&&(_=m,m={}),m=m||{},m.output=_,m.iv=p,n.call(y,m)},y}return gr}var vr={exports:{}},yr={exports:{}},mr={exports:{}},ba;function mt(){if(ba)return mr.exports;ba=1;var a=me();a.pki=a.pki||{};var e=mr.exports=a.pki.oids=a.oids=a.oids||{};function t(x,g){e[x]=g,e[g]=x}function d(x,g){e[x]=g}return t("1.2.840.113549.1.1.1","rsaEncryption"),t("1.2.840.113549.1.1.4","md5WithRSAEncryption"),t("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),t("1.2.840.113549.1.1.7","RSAES-OAEP"),t("1.2.840.113549.1.1.8","mgf1"),t("1.2.840.113549.1.1.9","pSpecified"),t("1.2.840.113549.1.1.10","RSASSA-PSS"),t("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),t("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),t("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),t("1.3.101.112","EdDSA25519"),t("1.2.840.10040.4.3","dsa-with-sha1"),t("1.3.14.3.2.7","desCBC"),t("1.3.14.3.2.26","sha1"),t("1.3.14.3.2.29","sha1WithRSASignature"),t("2.16.840.1.101.3.4.2.1","sha256"),t("2.16.840.1.101.3.4.2.2","sha384"),t("2.16.840.1.101.3.4.2.3","sha512"),t("2.16.840.1.101.3.4.2.4","sha224"),t("2.16.840.1.101.3.4.2.5","sha512-224"),t("2.16.840.1.101.3.4.2.6","sha512-256"),t("1.2.840.113549.2.2","md2"),t("1.2.840.113549.2.5","md5"),t("1.2.840.113549.1.7.1","data"),t("1.2.840.113549.1.7.2","signedData"),t("1.2.840.113549.1.7.3","envelopedData"),t("1.2.840.113549.1.7.4","signedAndEnvelopedData"),t("1.2.840.113549.1.7.5","digestedData"),t("1.2.840.113549.1.7.6","encryptedData"),t("1.2.840.113549.1.9.1","emailAddress"),t("1.2.840.113549.1.9.2","unstructuredName"),t("1.2.840.113549.1.9.3","contentType"),t("1.2.840.113549.1.9.4","messageDigest"),t("1.2.840.113549.1.9.5","signingTime"),t("1.2.840.113549.1.9.6","counterSignature"),t("1.2.840.113549.1.9.7","challengePassword"),t("1.2.840.113549.1.9.8","unstructuredAddress"),t("1.2.840.113549.1.9.14","extensionRequest"),t("1.2.840.113549.1.9.20","friendlyName"),t("1.2.840.113549.1.9.21","localKeyId"),t("1.2.840.113549.1.9.22.1","x509Certificate"),t("1.2.840.113549.1.12.10.1.1","keyBag"),t("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),t("1.2.840.113549.1.12.10.1.3","certBag"),t("1.2.840.113549.1.12.10.1.4","crlBag"),t("1.2.840.113549.1.12.10.1.5","secretBag"),t("1.2.840.113549.1.12.10.1.6","safeContentsBag"),t("1.2.840.113549.1.5.13","pkcs5PBES2"),t("1.2.840.113549.1.5.12","pkcs5PBKDF2"),t("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),t("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),t("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),t("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),t("1.2.840.113549.2.7","hmacWithSHA1"),t("1.2.840.113549.2.8","hmacWithSHA224"),t("1.2.840.113549.2.9","hmacWithSHA256"),t("1.2.840.113549.2.10","hmacWithSHA384"),t("1.2.840.113549.2.11","hmacWithSHA512"),t("1.2.840.113549.3.7","des-EDE3-CBC"),t("2.16.840.1.101.3.4.1.2","aes128-CBC"),t("2.16.840.1.101.3.4.1.22","aes192-CBC"),t("2.16.840.1.101.3.4.1.42","aes256-CBC"),t("2.5.4.3","commonName"),t("2.5.4.4","surname"),t("2.5.4.5","serialNumber"),t("2.5.4.6","countryName"),t("2.5.4.7","localityName"),t("2.5.4.8","stateOrProvinceName"),t("2.5.4.9","streetAddress"),t("2.5.4.10","organizationName"),t("2.5.4.11","organizationalUnitName"),t("2.5.4.12","title"),t("2.5.4.13","description"),t("2.5.4.15","businessCategory"),t("2.5.4.17","postalCode"),t("2.5.4.42","givenName"),t("2.5.4.65","pseudonym"),t("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),t("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),t("2.16.840.1.113730.1.1","nsCertType"),t("2.16.840.1.113730.1.13","nsComment"),d("2.5.29.1","authorityKeyIdentifier"),d("2.5.29.2","keyAttributes"),d("2.5.29.3","certificatePolicies"),d("2.5.29.4","keyUsageRestriction"),d("2.5.29.5","policyMapping"),d("2.5.29.6","subtreesConstraint"),d("2.5.29.7","subjectAltName"),d("2.5.29.8","issuerAltName"),d("2.5.29.9","subjectDirectoryAttributes"),d("2.5.29.10","basicConstraints"),d("2.5.29.11","nameConstraints"),d("2.5.29.12","policyConstraints"),d("2.5.29.13","basicConstraints"),t("2.5.29.14","subjectKeyIdentifier"),t("2.5.29.15","keyUsage"),d("2.5.29.16","privateKeyUsagePeriod"),t("2.5.29.17","subjectAltName"),t("2.5.29.18","issuerAltName"),t("2.5.29.19","basicConstraints"),d("2.5.29.20","cRLNumber"),d("2.5.29.21","cRLReason"),d("2.5.29.22","expirationDate"),d("2.5.29.23","instructionCode"),d("2.5.29.24","invalidityDate"),d("2.5.29.25","cRLDistributionPoints"),d("2.5.29.26","issuingDistributionPoint"),d("2.5.29.27","deltaCRLIndicator"),d("2.5.29.28","issuingDistributionPoint"),d("2.5.29.29","certificateIssuer"),d("2.5.29.30","nameConstraints"),t("2.5.29.31","cRLDistributionPoints"),t("2.5.29.32","certificatePolicies"),d("2.5.29.33","policyMappings"),d("2.5.29.34","policyConstraints"),t("2.5.29.35","authorityKeyIdentifier"),d("2.5.29.36","policyConstraints"),t("2.5.29.37","extKeyUsage"),d("2.5.29.46","freshestCRL"),d("2.5.29.54","inhibitAnyPolicy"),t("1.3.6.1.4.1.11129.2.4.2","timestampList"),t("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),t("1.3.6.1.5.5.7.3.1","serverAuth"),t("1.3.6.1.5.5.7.3.2","clientAuth"),t("1.3.6.1.5.5.7.3.3","codeSigning"),t("1.3.6.1.5.5.7.3.4","emailProtection"),t("1.3.6.1.5.5.7.3.8","timeStamping"),mr.exports}var _a;function ft(){if(_a)return yr.exports;_a=1;var a=me();Ee(),mt();var e=yr.exports=a.asn1=a.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(u,r,c,l,b){if(a.util.isArray(l)){for(var T=[],E=0;E<l.length;++E)l[E]!==void 0&&T.push(l[E]);l=T}var s={tagClass:u,type:r,constructed:c,composed:c||a.util.isArray(l),value:l};return b&&"bitStringContents"in b&&(s.bitStringContents=b.bitStringContents,s.original=e.copy(s)),s},e.copy=function(u,r){var c;if(a.util.isArray(u)){c=[];for(var l=0;l<u.length;++l)c.push(e.copy(u[l],r));return c}return typeof u=="string"?u:(c={tagClass:u.tagClass,type:u.type,constructed:u.constructed,composed:u.composed,value:e.copy(u.value,r)},r&&!r.excludeBitStringContents&&(c.bitStringContents=u.bitStringContents),c)},e.equals=function(u,r,c){if(a.util.isArray(u)){if(!a.util.isArray(r)||u.length!==r.length)return!1;for(var l=0;l<u.length;++l)if(!e.equals(u[l],r[l]))return!1;return!0}if(typeof u!=typeof r)return!1;if(typeof u=="string")return u===r;var b=u.tagClass===r.tagClass&&u.type===r.type&&u.constructed===r.constructed&&u.composed===r.composed&&e.equals(u.value,r.value);return c&&c.includeBitStringContents&&(b=b&&u.bitStringContents===r.bitStringContents),b},e.getBerValueLength=function(u){var r=u.getByte();if(r!==128){var c,l=r&128;return l?c=u.getInt((r&127)<<3):c=r,c}};function t(u,r,c){if(c>r){var l=new Error("Too few bytes to parse DER.");throw l.available=u.length(),l.remaining=r,l.requested=c,l}}var d=function(u,r){var c=u.getByte();if(r--,c!==128){var l,b=c&128;if(!b)l=c;else{var T=c&127;t(u,r,T),l=u.getInt(T<<3)}if(l<0)throw new Error("Negative length: "+l);return l}};e.fromDer=function(u,r){r===void 0&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof r=="boolean"&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"maxDepth"in r||(r.maxDepth=e.maxDepth),typeof u=="string"&&(u=a.util.createBuffer(u));var c=u.length(),l=x(u,u.length(),0,r);if(r.parseAllBytes&&u.length()!==0){var b=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw b.byteCount=c,b.remaining=u.length(),b}return l};function x(u,r,c,l){if(c>=l.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var b;t(u,r,2);var T=u.getByte();r--;var E=T&192,s=T&31;b=u.length();var v=d(u,r);if(r-=b-u.length(),v!==void 0&&v>r){if(l.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=u.length(),h.remaining=r,h.requested=v,h}v=r}var y,n,p=(T&32)===32;if(p)if(y=[],v===void 0)for(;;){if(t(u,r,2),u.bytes(2)==="\0\0"){u.getBytes(2),r-=2;break}b=u.length(),y.push(x(u,r,c+1,l)),r-=b-u.length()}else for(;v>0;)b=u.length(),y.push(x(u,v,c+1,l)),r-=b-u.length(),v-=b-u.length();if(y===void 0&&E===e.Class.UNIVERSAL&&s===e.Type.BITSTRING&&(n=u.bytes(v)),y===void 0&&l.decodeBitStrings&&E===e.Class.UNIVERSAL&&s===e.Type.BITSTRING&&v>1){var m=u.read,_=r,w=0;if(s===e.Type.BITSTRING&&(t(u,r,1),w=u.getByte(),r--),w===0)try{b=u.length();var C={strict:!0,decodeBitStrings:!0},o=x(u,r,c+1,C),i=b-u.length();r-=i,s==e.Type.BITSTRING&&i++;var B=o.tagClass;i===v&&(B===e.Class.UNIVERSAL||B===e.Class.CONTEXT_SPECIFIC)&&(y=[o])}catch{}y===void 0&&(u.read=m,r=_)}if(y===void 0){if(v===void 0){if(l.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");v=r}if(s===e.Type.BMPSTRING)for(y="";v>0;v-=2)t(u,r,2),y+=String.fromCharCode(u.getInt16()),r-=2;else y=u.getBytes(v),r-=v}var N=n===void 0?null:{bitStringContents:n};return e.create(E,s,p,y,N)}e.toDer=function(u){var r=a.util.createBuffer(),c=u.tagClass|u.type,l=a.util.createBuffer(),b=!1;if("bitStringContents"in u&&(b=!0,u.original&&(b=e.equals(u,u.original))),b)l.putBytes(u.bitStringContents);else if(u.composed){u.constructed?c|=32:l.putByte(0);for(var T=0;T<u.value.length;++T)u.value[T]!==void 0&&l.putBuffer(e.toDer(u.value[T]))}else if(u.type===e.Type.BMPSTRING)for(var T=0;T<u.value.length;++T)l.putInt16(u.value.charCodeAt(T));else u.type===e.Type.INTEGER&&u.value.length>1&&(u.value.charCodeAt(0)===0&&(u.value.charCodeAt(1)&128)===0||u.value.charCodeAt(0)===255&&(u.value.charCodeAt(1)&128)===128)?l.putBytes(u.value.substr(1)):l.putBytes(u.value);if(r.putByte(c),l.length()<=127)r.putByte(l.length()&127);else{var E=l.length(),s="";do s+=String.fromCharCode(E&255),E=E>>>8;while(E>0);r.putByte(s.length|128);for(var T=s.length-1;T>=0;--T)r.putByte(s.charCodeAt(T))}return r.putBuffer(l),r},e.oidToDer=function(u){var r=u.split("."),c=a.util.createBuffer();c.putByte(40*parseInt(r[0],10)+parseInt(r[1],10));for(var l,b,T,E,s=2;s<r.length;++s){if(l=!0,b=[],T=parseInt(r[s],10),T>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=T&127,T=T>>>7,l||(E|=128),b.push(E),l=!1;while(T>0);for(var v=b.length-1;v>=0;--v)c.putByte(b[v])}return c},e.derToOid=function(u){var r;typeof u=="string"&&(u=a.util.createBuffer(u));var c=u.getByte();r=Math.floor(c/40)+"."+c%40;for(var l=0;u.length()>0;){if(l>70368744177663)throw new Error("OID value too large; max is 53-bits.");c=u.getByte(),l=l*128,c&128?l+=c&127:(r+="."+(l+c),l=0)}return r},e.utcTimeToDate=function(u){var r=new Date,c=parseInt(u.substr(0,2),10);c=c>=50?1900+c:2e3+c;var l=parseInt(u.substr(2,2),10)-1,b=parseInt(u.substr(4,2),10),T=parseInt(u.substr(6,2),10),E=parseInt(u.substr(8,2),10),s=0;if(u.length>11){var v=u.charAt(10),h=10;v!=="+"&&v!=="-"&&(s=parseInt(u.substr(10,2),10),h+=2)}if(r.setUTCFullYear(c,l,b),r.setUTCHours(T,E,s,0),h&&(v=u.charAt(h),v==="+"||v==="-")){var y=parseInt(u.substr(h+1,2),10),n=parseInt(u.substr(h+4,2),10),p=y*60+n;p*=6e4,v==="+"?r.setTime(+r-p):r.setTime(+r+p)}return r},e.generalizedTimeToDate=function(u){var r=new Date,c=parseInt(u.substr(0,4),10),l=parseInt(u.substr(4,2),10)-1,b=parseInt(u.substr(6,2),10),T=parseInt(u.substr(8,2),10),E=parseInt(u.substr(10,2),10),s=parseInt(u.substr(12,2),10),v=0,h=0,y=!1;u.charAt(u.length-1)==="Z"&&(y=!0);var n=u.length-5,p=u.charAt(n);if(p==="+"||p==="-"){var m=parseInt(u.substr(n+1,2),10),_=parseInt(u.substr(n+4,2),10);h=m*60+_,h*=6e4,p==="+"&&(h*=-1),y=!0}return u.charAt(14)==="."&&(v=parseFloat(u.substr(14),10)*1e3),y?(r.setUTCFullYear(c,l,b),r.setUTCHours(T,E,s,v),r.setTime(+r+h)):(r.setFullYear(c,l,b),r.setHours(T,E,s,v)),r},e.dateToUtcTime=function(u){if(typeof u=="string")return u;var r="",c=[];c.push((""+u.getUTCFullYear()).substr(2)),c.push(""+(u.getUTCMonth()+1)),c.push(""+u.getUTCDate()),c.push(""+u.getUTCHours()),c.push(""+u.getUTCMinutes()),c.push(""+u.getUTCSeconds());for(var l=0;l<c.length;++l)c[l].length<2&&(r+="0"),r+=c[l];return r+="Z",r},e.dateToGeneralizedTime=function(u){if(typeof u=="string")return u;var r="",c=[];c.push(""+u.getUTCFullYear()),c.push(""+(u.getUTCMonth()+1)),c.push(""+u.getUTCDate()),c.push(""+u.getUTCHours()),c.push(""+u.getUTCMinutes()),c.push(""+u.getUTCSeconds());for(var l=0;l<c.length;++l)c[l].length<2&&(r+="0"),r+=c[l];return r+="Z",r},e.integerToDer=function(u){var r=a.util.createBuffer();if(u>=-128&&u<128)return r.putSignedInt(u,8);if(u>=-32768&&u<32768)return r.putSignedInt(u,16);if(u>=-8388608&&u<8388608)return r.putSignedInt(u,24);if(u>=-2147483648&&u<2147483648)return r.putSignedInt(u,32);var c=new Error("Integer too large; max is 32-bits.");throw c.integer=u,c},e.derToInteger=function(u){typeof u=="string"&&(u=a.util.createBuffer(u));var r=u.length()*8;if(r>32)throw new Error("Integer too large; max is 32-bits.");return u.getSignedInt(r)},e.validate=function(u,r,c,l){var b=!1;if((u.tagClass===r.tagClass||typeof r.tagClass>"u")&&(u.type===r.type||typeof r.type>"u"))if(u.constructed===r.constructed||typeof r.constructed>"u"){if(b=!0,r.value&&a.util.isArray(r.value))for(var T=0,E=0;b&&E<r.value.length;++E){var s=r.value[E];b=!!s.optional;var v=u.value[T];if(!v){s.optional||(b=!1,l&&l.push("["+r.name+'] Missing required element. Expected tag class "'+s.tagClass+'", type "'+s.type+'"'));continue}var h=typeof s.tagClass<"u"&&typeof s.type<"u";if(h&&(v.tagClass!==s.tagClass||v.type!==s.type))if(s.optional){b=!0;continue}else{b=!1,l&&l.push("["+r.name+"] Tag mismatch. Expected ("+s.tagClass+","+s.type+"), got ("+v.tagClass+","+v.type+")");break}var y=e.validate(v,s,c,l);if(y)++T,b=!0;else if(s.optional)b=!0;else{b=!1;break}}if(b&&c&&(r.capture&&(c[r.capture]=u.value),r.captureAsn1&&(c[r.captureAsn1]=u),r.captureBitStringContents&&"bitStringContents"in u&&(c[r.captureBitStringContents]=u.bitStringContents),r.captureBitStringValue&&"bitStringContents"in u))if(u.bitStringContents.length<2)c[r.captureBitStringValue]="";else{var n=u.bitStringContents.charCodeAt(0);if(n!==0)throw new Error("captureBitStringValue only supported for zero unused bits");c[r.captureBitStringValue]=u.bitStringContents.slice(1)}}else l&&l.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+u.constructed+'"');else l&&(u.tagClass!==r.tagClass&&l.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+u.tagClass+'"'),u.type!==r.type&&l.push("["+r.name+'] Expected type "'+r.type+'", got "'+u.type+'"'));return b};var g=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(u,r,c){var l="";r=r||0,c=c||2,r>0&&(l+=`
|
|
6
|
-
`);for(var b="",T=0;T<r*c;++T)b+=" ";switch(l+=b+"Tag: ",u.tagClass){case e.Class.UNIVERSAL:l+="Universal:";break;case e.Class.APPLICATION:l+="Application:";break;case e.Class.CONTEXT_SPECIFIC:l+="Context-Specific:";break;case e.Class.PRIVATE:l+="Private:";break}if(u.tagClass===e.Class.UNIVERSAL)switch(l+=u.type,u.type){case e.Type.NONE:l+=" (None)";break;case e.Type.BOOLEAN:l+=" (Boolean)";break;case e.Type.INTEGER:l+=" (Integer)";break;case e.Type.BITSTRING:l+=" (Bit string)";break;case e.Type.OCTETSTRING:l+=" (Octet string)";break;case e.Type.NULL:l+=" (Null)";break;case e.Type.OID:l+=" (Object Identifier)";break;case e.Type.ODESC:l+=" (Object Descriptor)";break;case e.Type.EXTERNAL:l+=" (External or Instance of)";break;case e.Type.REAL:l+=" (Real)";break;case e.Type.ENUMERATED:l+=" (Enumerated)";break;case e.Type.EMBEDDED:l+=" (Embedded PDV)";break;case e.Type.UTF8:l+=" (UTF8)";break;case e.Type.ROID:l+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:l+=" (Sequence)";break;case e.Type.SET:l+=" (Set)";break;case e.Type.PRINTABLESTRING:l+=" (Printable String)";break;case e.Type.IA5String:l+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:l+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:l+=" (Generalized time)";break;case e.Type.BMPSTRING:l+=" (BMP String)";break}else l+=u.type;if(l+=`
|
|
7
|
-
`,l+=b+"Constructed: "+u.constructed+`
|
|
8
|
-
`,u.composed){for(var E=0,s="",T=0;T<u.value.length;++T)u.value[T]!==void 0&&(E+=1,s+=e.prettyPrint(u.value[T],r+1,c),T+1<u.value.length&&(s+=","));l+=b+"Sub values: "+E+s}else{if(l+=b+"Value: ",u.type===e.Type.OID){var v=e.derToOid(u.value);l+=v,a.pki&&a.pki.oids&&v in a.pki.oids&&(l+=" ("+a.pki.oids[v]+") ")}if(u.type===e.Type.INTEGER)try{l+=e.derToInteger(u.value)}catch{l+="0x"+a.util.bytesToHex(u.value)}else if(u.type===e.Type.BITSTRING){if(u.value.length>1?l+="0x"+a.util.bytesToHex(u.value.slice(1)):l+="(none)",u.value.length>0){var h=u.value.charCodeAt(0);h==1?l+=" (1 unused bit shown)":h>1&&(l+=" ("+h+" unused bits shown)")}}else if(u.type===e.Type.OCTETSTRING)g.test(u.value)||(l+="("+u.value+") "),l+="0x"+a.util.bytesToHex(u.value);else if(u.type===e.Type.UTF8)try{l+=a.util.decodeUtf8(u.value)}catch(y){if(y.message==="URI malformed")l+="0x"+a.util.bytesToHex(u.value)+" (malformed UTF8)";else throw y}else u.type===e.Type.PRINTABLESTRING||u.type===e.Type.IA5String?l+=u.value:g.test(u.value)?l+="0x"+a.util.bytesToHex(u.value):u.value.length===0?l+="[null]":l+=u.value}return l},yr.exports}var Cr={exports:{}},xr,Ta;function ct(){if(Ta)return xr;Ta=1;var a=me();return xr=a.md=a.md||{},a.md.algorithms=a.md.algorithms||{},xr}var Aa;function Rt(){if(Aa)return Cr.exports;Aa=1;var a=me();ct(),Ee();var e=Cr.exports=a.hmac=a.hmac||{};return e.create=function(){var t=null,d=null,x=null,g=null,u={};return u.start=function(r,c){if(r!==null)if(typeof r=="string")if(r=r.toLowerCase(),r in a.md.algorithms)d=a.md.algorithms[r].create();else throw new Error('Unknown hash algorithm "'+r+'"');else d=r;if(c===null)c=t;else{if(typeof c=="string")c=a.util.createBuffer(c);else if(a.util.isArray(c)){var l=c;c=a.util.createBuffer();for(var b=0;b<l.length;++b)c.putByte(l[b])}var T=c.length();T>d.blockLength&&(d.start(),d.update(c.bytes()),c=d.digest()),x=a.util.createBuffer(),g=a.util.createBuffer(),T=c.length();for(var b=0;b<T;++b){var l=c.at(b);x.putByte(54^l),g.putByte(92^l)}if(T<d.blockLength)for(var l=d.blockLength-T,b=0;b<l;++b)x.putByte(54),g.putByte(92);t=c,x=x.bytes(),g=g.bytes()}d.start(),d.update(x)},u.update=function(r){d.update(r)},u.getMac=function(){var r=d.digest().bytes();return d.start(),d.update(g),d.update(r),d.digest()},u.digest=u.getMac,u},Cr.exports}var Er={exports:{}},Ia;function Sr(){if(Ia)return Er.exports;Ia=1;var a=me();ct(),Ee();var e=Er.exports=a.md5=a.md5||{};a.md.md5=a.md.algorithms.md5=e,e.create=function(){u||r();var l=null,b=a.util.createBuffer(),T=new Array(16),E={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var s=E.messageLengthSize/4,v=0;v<s;++v)E.fullMessageLength.push(0);return b=a.util.createBuffer(),l={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(s,v){v==="utf8"&&(s=a.util.encodeUtf8(s));var h=s.length;E.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var y=E.fullMessageLength.length-1;y>=0;--y)E.fullMessageLength[y]+=h[1],h[1]=h[0]+(E.fullMessageLength[y]/4294967296>>>0),E.fullMessageLength[y]=E.fullMessageLength[y]>>>0,h[0]=h[1]/4294967296>>>0;return b.putBytes(s),c(l,T,b),(b.read>2048||b.length()===0)&&b.compact(),E},E.digest=function(){var s=a.util.createBuffer();s.putBytes(b.bytes());var v=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,h=v&E.blockLength-1;s.putBytes(t.substr(0,E.blockLength-h));for(var y,n=0,p=E.fullMessageLength.length-1;p>=0;--p)y=E.fullMessageLength[p]*8+n,n=y/4294967296>>>0,s.putInt32Le(y>>>0);var m={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3};c(m,T,s);var _=a.util.createBuffer();return _.putInt32Le(m.h0),_.putInt32Le(m.h1),_.putInt32Le(m.h2),_.putInt32Le(m.h3),_},E};var t=null,d=null,x=null,g=null,u=!1;function r(){t="",t+=a.util.fillString("\0",64),d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],x=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],g=new Array(64);for(var l=0;l<64;++l)g[l]=Math.floor(Math.abs(Math.sin(l+1))*4294967296);u=!0}function c(l,b,T){for(var E,s,v,h,y,n,p,m,_=T.length();_>=64;){for(s=l.h0,v=l.h1,h=l.h2,y=l.h3,m=0;m<16;++m)b[m]=T.getInt32Le(),n=y^v&(h^y),E=s+n+g[m]+b[m],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<32;++m)n=h^y&(v^h),E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<48;++m)n=v^h^y,E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<64;++m)n=h^(v|~y),E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;l.h0=l.h0+s|0,l.h1=l.h1+v|0,l.h2=l.h2+h|0,l.h3=l.h3+y|0,_-=64}}return Er.exports}var br={exports:{}},wa;function xt(){if(wa)return br.exports;wa=1;var a=me();Ee();var e=br.exports=a.pem=a.pem||{};e.encode=function(x,g){g=g||{};var u="-----BEGIN "+x.type+`-----\r
|
|
9
|
-
`,r;if(x.procType&&(r={name:"Proc-Type",values:[String(x.procType.version),x.procType.type]},u+=t(r)),x.contentDomain&&(r={name:"Content-Domain",values:[x.contentDomain]},u+=t(r)),x.dekInfo&&(r={name:"DEK-Info",values:[x.dekInfo.algorithm]},x.dekInfo.parameters&&r.values.push(x.dekInfo.parameters),u+=t(r)),x.headers)for(var c=0;c<x.headers.length;++c)u+=t(x.headers[c]);return x.procType&&(u+=`\r
|
|
10
|
-
`),u+=a.util.encode64(x.body,g.maxline||64)+`\r
|
|
11
|
-
`,u+="-----END "+x.type+`-----\r
|
|
12
|
-
`,u},e.decode=function(x){for(var g=[],u=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,c=/\r?\n/,l;l=u.exec(x),!!l;){var b=l[1];b==="NEW CERTIFICATE REQUEST"&&(b="CERTIFICATE REQUEST");var T={type:b,procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(l[3])};if(g.push(T),!!l[2]){for(var E=l[2].split(c),s=0;l&&s<E.length;){for(var v=E[s].replace(/\s+$/,""),h=s+1;h<E.length;++h){var y=E[h];if(!/\s/.test(y[0]))break;v+=y,s=h}if(l=v.match(r),l){for(var n={name:l[1],values:[]},p=l[2].split(","),m=0;m<p.length;++m)n.values.push(d(p[m]));if(T.procType)if(!T.contentDomain&&n.name==="Content-Domain")T.contentDomain=p[0]||"";else if(!T.dekInfo&&n.name==="DEK-Info"){if(n.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');T.dekInfo={algorithm:p[0],parameters:p[1]||null}}else T.headers.push(n);else{if(n.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(n.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');T.procType={version:p[0],type:p[1]}}}++s}if(T.procType==="ENCRYPTED"&&!T.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(g.length===0)throw new Error("Invalid PEM formatted message.");return g};function t(x){for(var g=x.name+": ",u=[],r=function(E,s){return" "+s},c=0;c<x.values.length;++c)u.push(x.values[c].replace(/^(\S+\r\n)/,r));g+=u.join(",")+`\r
|
|
13
|
-
`;for(var l=0,b=-1,c=0;c<g.length;++c,++l)if(l>65&&b!==-1){var T=g[b];T===","?(++b,g=g.substr(0,b)+`\r
|
|
14
|
-
`+g.substr(b)):g=g.substr(0,b)+`\r
|
|
15
|
-
`+T+g.substr(b+1),l=c-b-1,b=-1,++c}else(g[c]===" "||g[c]===" "||g[c]===",")&&(b=c);return g}function d(x){return x.replace(/^\s+/,"")}return br.exports}var _r={exports:{}},Tr,Ba;function qt(){if(Ba)return Tr;Ba=1;var a=me();dr(),Ea(),Ee(),Tr=a.des=a.des||{},a.des.startEncrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!1,mode:y||(v===null?"ECB":"CBC")});return n.start(v),n},a.des.createEncryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!1,mode:v})},a.des.startDecrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!0,mode:y||(v===null?"ECB":"CBC")});return n.start(v),n},a.des.createDecryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!0,mode:v})},a.des.Algorithm=function(s,v){var h=this;h.name=s,h.mode=new v({blockSize:8,cipher:{encrypt:function(y,n){return T(h._keys,y,n,!1)},decrypt:function(y,n){return T(h._keys,y,n,!0)}}}),h._init=!1},a.des.Algorithm.prototype.initialize=function(s){if(!this._init){var v=a.util.createBuffer(s.key);if(this.name.indexOf("3DES")===0&&v.length()!==24)throw new Error("Invalid Triple-DES key size: "+v.length()*8);this._keys=b(v),this._init=!0}},e("DES-ECB",a.cipher.modes.ecb),e("DES-CBC",a.cipher.modes.cbc),e("DES-CFB",a.cipher.modes.cfb),e("DES-OFB",a.cipher.modes.ofb),e("DES-CTR",a.cipher.modes.ctr),e("3DES-ECB",a.cipher.modes.ecb),e("3DES-CBC",a.cipher.modes.cbc),e("3DES-CFB",a.cipher.modes.cfb),e("3DES-OFB",a.cipher.modes.ofb),e("3DES-CTR",a.cipher.modes.ctr);function e(s,v){var h=function(){return new a.des.Algorithm(s,v)};a.cipher.registerAlgorithm(s,h)}var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],d=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],x=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],r=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],c=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],l=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function b(s){for(var v=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],h=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],y=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],p=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],m=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],_=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],w=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],C=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],o=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],i=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],B=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],N=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],q=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],I=s.length()>8?3:1,F=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],H=0,j,W=0;W<I;W++){var re=s.getInt32(),J=s.getInt32();j=(re>>>4^J)&252645135,J^=j,re^=j<<4,j=(J>>>-16^re)&65535,re^=j,J^=j<<-16,j=(re>>>2^J)&858993459,J^=j,re^=j<<2,j=(J>>>-16^re)&65535,re^=j,J^=j<<-16,j=(re>>>1^J)&1431655765,J^=j,re^=j<<1,j=(J>>>8^re)&16711935,re^=j,J^=j<<8,j=(re>>>1^J)&1431655765,J^=j,re^=j<<1,j=re<<8|J>>>20&240,re=J<<24|J<<8&16711680|J>>>8&65280|J>>>24&240,J=j;for(var oe=0;oe<A.length;++oe){A[oe]?(re=re<<2|re>>>26,J=J<<2|J>>>26):(re=re<<1|re>>>27,J=J<<1|J>>>27),re&=-15,J&=-15;var Q=v[re>>>28]|h[re>>>24&15]|y[re>>>20&15]|n[re>>>16&15]|p[re>>>12&15]|m[re>>>8&15]|_[re>>>4&15],$=w[J>>>28]|C[J>>>24&15]|o[J>>>20&15]|i[J>>>16&15]|B[J>>>12&15]|N[J>>>8&15]|q[J>>>4&15];j=($>>>16^Q)&65535,F[H++]=Q^j,F[H++]=$^j<<16}}return F}function T(s,v,h,y){var n=s.length===32?3:9,p;n===3?p=y?[30,-2,-2]:[0,32,2]:p=y?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m,_=v[0],w=v[1];m=(_>>>4^w)&252645135,w^=m,_^=m<<4,m=(_>>>16^w)&65535,w^=m,_^=m<<16,m=(w>>>2^_)&858993459,_^=m,w^=m<<2,m=(w>>>8^_)&16711935,_^=m,w^=m<<8,m=(_>>>1^w)&1431655765,w^=m,_^=m<<1,_=_<<1|_>>>31,w=w<<1|w>>>31;for(var C=0;C<n;C+=3){for(var o=p[C+1],i=p[C+2],B=p[C];B!=o;B+=i){var N=w^s[B],q=(w>>>4|w<<28)^s[B+1];m=_,_=w,w=m^(d[N>>>24&63]|g[N>>>16&63]|r[N>>>8&63]|l[N&63]|t[q>>>24&63]|x[q>>>16&63]|u[q>>>8&63]|c[q&63])}m=_,_=w,w=m}_=_>>>1|_<<31,w=w>>>1|w<<31,m=(_>>>1^w)&1431655765,w^=m,_^=m<<1,m=(w>>>8^_)&16711935,_^=m,w^=m<<8,m=(w>>>2^_)&858993459,_^=m,w^=m<<2,m=(_>>>16^w)&65535,w^=m,_^=m<<16,m=(_>>>4^w)&252645135,w^=m,_^=m<<4,h[0]=_,h[1]=w}function E(s){s=s||{};var v=(s.mode||"CBC").toUpperCase(),h="DES-"+v,y;s.decrypt?y=a.cipher.createDecipher(h,s.key):y=a.cipher.createCipher(h,s.key);var n=y.start;return y.start=function(p,m){var _=null;m instanceof a.util.ByteBuffer&&(_=m,m={}),m=m||{},m.output=_,m.iv=p,n.call(y,m)},y}return Tr}const Ar=Ln(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ir,ka;function wr(){if(ka)return Ir;ka=1;var a=me();Rt(),ct(),Ee();var e=a.pkcs5=a.pkcs5||{},t;return a.util.isNodejs&&!a.options.usePureJavaScript&&(t=Ar),Ir=a.pbkdf2=e.pbkdf2=function(d,x,g,u,r,c){if(typeof r=="function"&&(c=r,r=null),a.util.isNodejs&&!a.options.usePureJavaScript&&t.pbkdf2&&(r===null||typeof r!="object")&&(t.pbkdf2Sync.length>4||!r||r==="sha1"))return typeof r!="string"&&(r="sha1"),d=Buffer.from(d,"binary"),x=Buffer.from(x,"binary"),c?t.pbkdf2Sync.length===4?t.pbkdf2(d,x,g,u,function(C,o){if(C)return c(C);c(null,o.toString("binary"))}):t.pbkdf2(d,x,g,u,r,function(C,o){if(C)return c(C);c(null,o.toString("binary"))}):t.pbkdf2Sync.length===4?t.pbkdf2Sync(d,x,g,u).toString("binary"):t.pbkdf2Sync(d,x,g,u,r).toString("binary");if((typeof r>"u"||r===null)&&(r="sha1"),typeof r=="string"){if(!(r in a.md.algorithms))throw new Error("Unknown hash algorithm: "+r);r=a.md[r].create()}var l=r.digestLength;if(u>4294967295*l){var b=new Error("Derived key is too long.");if(c)return c(b);throw b}var T=Math.ceil(u/l),E=u-(T-1)*l,s=a.hmac.create();s.start(r,d);var v="",h,y,n;if(!c){for(var p=1;p<=T;++p){s.start(null,null),s.update(x),s.update(a.util.int32ToBytes(p)),h=n=s.digest().getBytes();for(var m=2;m<=g;++m)s.start(null,null),s.update(n),y=s.digest().getBytes(),h=a.util.xorBytes(h,y,l),n=y;v+=p<T?h:h.substr(0,E)}return v}var p=1,m;function _(){if(p>T)return c(null,v);s.start(null,null),s.update(x),s.update(a.util.int32ToBytes(p)),h=n=s.digest().getBytes(),m=2,w()}function w(){if(m<=g)return s.start(null,null),s.update(n),y=s.digest().getBytes(),h=a.util.xorBytes(h,y,l),n=y,++m,a.util.setImmediate(w);v+=p<T?h:h.substr(0,E),++p,_()}_()},Ir}var Ht={exports:{}},Br={exports:{}},Ra;function Na(){if(Ra)return Br.exports;Ra=1;var a=me();ct(),Ee();var e=Br.exports=a.sha256=a.sha256||{};a.md.sha256=a.md.algorithms.sha256=e,e.create=function(){d||g();var r=null,c=a.util.createBuffer(),l=new Array(64),b={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return b.start=function(){b.messageLength=0,b.fullMessageLength=b.messageLength64=[];for(var T=b.messageLengthSize/4,E=0;E<T;++E)b.fullMessageLength.push(0);return c=a.util.createBuffer(),r={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},b},b.start(),b.update=function(T,E){E==="utf8"&&(T=a.util.encodeUtf8(T));var s=T.length;b.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var v=b.fullMessageLength.length-1;v>=0;--v)b.fullMessageLength[v]+=s[1],s[1]=s[0]+(b.fullMessageLength[v]/4294967296>>>0),b.fullMessageLength[v]=b.fullMessageLength[v]>>>0,s[0]=s[1]/4294967296>>>0;return c.putBytes(T),u(r,l,c),(c.read>2048||c.length()===0)&&c.compact(),b},b.digest=function(){var T=a.util.createBuffer();T.putBytes(c.bytes());var E=b.fullMessageLength[b.fullMessageLength.length-1]+b.messageLengthSize,s=E&b.blockLength-1;T.putBytes(t.substr(0,b.blockLength-s));for(var v,h,y=b.fullMessageLength[0]*8,n=0;n<b.fullMessageLength.length-1;++n)v=b.fullMessageLength[n+1]*8,h=v/4294967296>>>0,y+=h,T.putInt32(y>>>0),y=v>>>0;T.putInt32(y);var p={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4,h5:r.h5,h6:r.h6,h7:r.h7};u(p,l,T);var m=a.util.createBuffer();return m.putInt32(p.h0),m.putInt32(p.h1),m.putInt32(p.h2),m.putInt32(p.h3),m.putInt32(p.h4),m.putInt32(p.h5),m.putInt32(p.h6),m.putInt32(p.h7),m},b};var t=null,d=!1,x=null;function g(){t="",t+=a.util.fillString("\0",64),x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=!0}function u(r,c,l){for(var b,T,E,s,v,h,y,n,p,m,_,w,C,o,i,B=l.length();B>=64;){for(y=0;y<16;++y)c[y]=l.getInt32();for(;y<64;++y)b=c[y-2],b=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,T=c[y-15],T=(T>>>7|T<<25)^(T>>>18|T<<14)^T>>>3,c[y]=b+c[y-7]+T+c[y-16]|0;for(n=r.h0,p=r.h1,m=r.h2,_=r.h3,w=r.h4,C=r.h5,o=r.h6,i=r.h7,y=0;y<64;++y)s=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),v=o^w&(C^o),E=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=n&p|m&(n^p),b=i+s+v+x[y]+c[y],T=E+h,i=o,o=C,C=w,w=_+b>>>0,_=m,m=p,p=n,n=b+T>>>0;r.h0=r.h0+n|0,r.h1=r.h1+p|0,r.h2=r.h2+m|0,r.h3=r.h3+_|0,r.h4=r.h4+w|0,r.h5=r.h5+C|0,r.h6=r.h6+o|0,r.h7=r.h7+i|0,B-=64}}return Br.exports}var kr={exports:{}},La;function Da(){if(La)return kr.exports;La=1;var a=me();Ee();var e=null;a.util.isNodejs&&!a.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Ar);var t=kr.exports=a.prng=a.prng||{};return t.create=function(d){for(var x={plugin:d,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},g=d.md,u=new Array(32),r=0;r<32;++r)u[r]=g.create();x.pools=u,x.pool=0,x.generate=function(E,s){if(!s)return x.generateSync(E);var v=x.plugin.cipher,h=x.plugin.increment,y=x.plugin.formatKey,n=x.plugin.formatSeed,p=a.util.createBuffer();x.key=null,m();function m(_){if(_)return s(_);if(p.length()>=E)return s(null,p.getBytes(E));if(x.generated>1048575&&(x.key=null),x.key===null)return a.util.nextTick(function(){c(m)});var w=v(x.key,x.seed);x.generated+=w.length,p.putBytes(w),x.key=y(v(x.key,h(x.seed))),x.seed=n(v(x.key,x.seed)),a.util.setImmediate(m)}},x.generateSync=function(E){var s=x.plugin.cipher,v=x.plugin.increment,h=x.plugin.formatKey,y=x.plugin.formatSeed;x.key=null;for(var n=a.util.createBuffer();n.length()<E;){x.generated>1048575&&(x.key=null),x.key===null&&l();var p=s(x.key,x.seed);x.generated+=p.length,n.putBytes(p),x.key=h(s(x.key,v(x.seed))),x.seed=y(s(x.key,x.seed))}return n.getBytes(E)};function c(E){if(x.pools[0].messageLength>=32)return b(),E();var s=32-x.pools[0].messageLength<<5;x.seedFile(s,function(v,h){if(v)return E(v);x.collect(h),b(),E()})}function l(){if(x.pools[0].messageLength>=32)return b();var E=32-x.pools[0].messageLength<<5;x.collect(x.seedFileSync(E)),b()}function b(){x.reseeds=x.reseeds===4294967295?0:x.reseeds+1;var E=x.plugin.md.create();E.update(x.keyBytes);for(var s=1,v=0;v<32;++v)x.reseeds%s===0&&(E.update(x.pools[v].digest().getBytes()),x.pools[v].start()),s=s<<1;x.keyBytes=E.digest().getBytes(),E.start(),E.update(x.keyBytes);var h=E.digest().getBytes();x.key=x.plugin.formatKey(x.keyBytes),x.seed=x.plugin.formatSeed(h),x.generated=0}function T(E){var s=null,v=a.util.globalScope,h=v.crypto||v.msCrypto;h&&h.getRandomValues&&(s=function(i){return h.getRandomValues(i)});var y=a.util.createBuffer();if(s)for(;y.length()<E;){var n=Math.max(1,Math.min(E-y.length(),65536)/4),p=new Uint32Array(Math.floor(n));try{s(p);for(var m=0;m<p.length;++m)y.putInt32(p[m])}catch(i){if(!(typeof QuotaExceededError<"u"&&i instanceof QuotaExceededError))throw i}}if(y.length()<E)for(var _,w,C,o=Math.floor(Math.random()*65536);y.length()<E;){w=16807*(o&65535),_=16807*(o>>16),w+=(_&32767)<<16,w+=_>>15,w=(w&2147483647)+(w>>31),o=w&4294967295;for(var m=0;m<3;++m)C=o>>>(m<<3),C^=Math.floor(Math.random()*256),y.putByte(C&255)}return y.getBytes(E)}return e?(x.seedFile=function(E,s){e.randomBytes(E,function(v,h){if(v)return s(v);s(null,h.toString())})},x.seedFileSync=function(E){return e.randomBytes(E).toString()}):(x.seedFile=function(E,s){try{s(null,T(E))}catch(v){s(v)}},x.seedFileSync=T),x.collect=function(E){for(var s=E.length,v=0;v<s;++v)x.pools[x.pool].update(E.substr(v,1)),x.pool=x.pool===31?0:x.pool+1},x.collectInt=function(E,s){for(var v="",h=0;h<s;h+=8)v+=String.fromCharCode(E>>h&255);x.collect(v)},x.registerWorker=function(E){if(E===self)x.seedFile=function(v,h){function y(n){var p=n.data;p.forge&&p.forge.prng&&(self.removeEventListener("message",y),h(p.forge.prng.err,p.forge.prng.bytes))}self.addEventListener("message",y),self.postMessage({forge:{prng:{needed:v}}})};else{var s=function(v){var h=v.data;h.forge&&h.forge.prng&&x.seedFile(h.forge.prng.needed,function(y,n){E.postMessage({forge:{prng:{err:y,bytes:n}}})})};E.addEventListener("message",s)}},x},kr.exports}var Ua;function at(){if(Ua)return Ht.exports;Ua=1;var a=me();return yt(),Na(),Da(),Ee(),(function(){if(a.random&&a.random.getBytes){Ht.exports=a.random;return}(function(e){var t={},d=new Array(4),x=a.util.createBuffer();t.formatKey=function(E){var s=a.util.createBuffer(E);return E=new Array(4),E[0]=s.getInt32(),E[1]=s.getInt32(),E[2]=s.getInt32(),E[3]=s.getInt32(),a.aes._expandKey(E,!1)},t.formatSeed=function(E){var s=a.util.createBuffer(E);return E=new Array(4),E[0]=s.getInt32(),E[1]=s.getInt32(),E[2]=s.getInt32(),E[3]=s.getInt32(),E},t.cipher=function(E,s){return a.aes._updateBlock(E,s,d,!1),x.putInt32(d[0]),x.putInt32(d[1]),x.putInt32(d[2]),x.putInt32(d[3]),x.getBytes()},t.increment=function(E){return++E[3],E},t.md=a.md.sha256;function g(){var E=a.prng.create(t);return E.getBytes=function(s,v){return E.generate(s,v)},E.getBytesSync=function(s){return E.generate(s)},E}var u=g(),r=null,c=a.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(r=function(E){return l.getRandomValues(E)}),a.options.usePureJavaScript||!a.util.isNodejs&&!r){if(u.collectInt(+new Date,32),typeof navigator<"u"){var b="";for(var T in navigator)try{typeof navigator[T]=="string"&&(b+=navigator[T])}catch{}u.collect(b),b=null}e&&(e().mousemove(function(E){u.collectInt(E.clientX,16),u.collectInt(E.clientY,16)}),e().keypress(function(E){u.collectInt(E.charCode,8)}))}if(!a.random)a.random=u;else for(var T in u)a.random[T]=u[T];a.random.createInstance=g,Ht.exports=a.random})(typeof jQuery<"u"?jQuery:null)})(),Ht.exports}var Rr,Pa;function Oa(){if(Pa)return Rr;Pa=1;var a=me();Ee();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],t=[1,2,3,5],d=function(u,r){return u<<r&65535|(u&65535)>>16-r},x=function(u,r){return(u&65535)>>r|u<<16-r&65535};Rr=a.rc2=a.rc2||{},a.rc2.expandKey=function(u,r){typeof u=="string"&&(u=a.util.createBuffer(u)),r=r||128;var c=u,l=u.length(),b=r,T=Math.ceil(b/8),E=255>>(b&7),s;for(s=l;s<128;s++)c.putByte(e[c.at(s-1)+c.at(s-l)&255]);for(c.setAt(128-T,e[c.at(128-T)&E]),s=127-T;s>=0;s--)c.setAt(s,e[c.at(s+1)^c.at(s+T)]);return c};var g=function(u,r,c){var l=!1,b=null,T=null,E=null,s,v,h,y,n=[];for(u=a.rc2.expandKey(u,r),h=0;h<64;h++)n.push(u.getInt16Le());c?(s=function(_){for(h=0;h<4;h++)_[h]+=n[y]+(_[(h+3)%4]&_[(h+2)%4])+(~_[(h+3)%4]&_[(h+1)%4]),_[h]=d(_[h],t[h]),y++},v=function(_){for(h=0;h<4;h++)_[h]+=n[_[(h+3)%4]&63]}):(s=function(_){for(h=3;h>=0;h--)_[h]=x(_[h],t[h]),_[h]-=n[y]+(_[(h+3)%4]&_[(h+2)%4])+(~_[(h+3)%4]&_[(h+1)%4]),y--},v=function(_){for(h=3;h>=0;h--)_[h]-=n[_[(h+3)%4]&63]});var p=function(_){var w=[];for(h=0;h<4;h++){var C=b.getInt16Le();E!==null&&(c?C^=E.getInt16Le():E.putInt16Le(C)),w.push(C&65535)}y=c?0:63;for(var o=0;o<_.length;o++)for(var i=0;i<_[o][0];i++)_[o][1](w);for(h=0;h<4;h++)E!==null&&(c?E.putInt16Le(w[h]):w[h]^=E.getInt16Le()),T.putInt16Le(w[h])},m=null;return m={start:function(_,w){_&&typeof _=="string"&&(_=a.util.createBuffer(_)),l=!1,b=a.util.createBuffer(),T=w||new a.util.createBuffer,E=_,m.output=T},update:function(_){for(l||b.putBuffer(_);b.length()>=8;)p([[5,s],[1,v],[6,s],[1,v],[5,s]])},finish:function(_){var w=!0;if(c)if(_)w=_(8,b,!c);else{var C=b.length()===8?8:8-b.length();b.fillWithByte(C,C)}if(w&&(l=!0,m.update()),!c&&(w=b.length()===0,w))if(_)w=_(8,T,!c);else{var o=T.length(),i=T.at(o-1);i>o?w=!1:T.truncate(i)}return w}},m};return a.rc2.startEncrypting=function(u,r,c){var l=a.rc2.createEncryptionCipher(u,128);return l.start(r,c),l},a.rc2.createEncryptionCipher=function(u,r){return g(u,r,!0)},a.rc2.startDecrypting=function(u,r,c){var l=a.rc2.createDecryptionCipher(u,128);return l.start(r,c),l},a.rc2.createDecryptionCipher=function(u,r){return g(u,r,!1)},Rr}var Nr,Fa;function Gt(){if(Fa)return Nr;Fa=1;var a=me();Nr=a.jsbn=a.jsbn||{};var e;function t(R,U,z){this.data=[],R!=null&&(typeof R=="number"?this.fromNumber(R,U,z):U==null&&typeof R!="string"?this.fromString(R,256):this.fromString(R,U))}a.jsbn.BigInteger=t;function d(){return new t(null)}function x(R,U,z,Z,ne,le){for(;--le>=0;){var pe=U*this.data[R++]+z.data[Z]+ne;ne=Math.floor(pe/67108864),z.data[Z++]=pe&67108863}return ne}function g(R,U,z,Z,ne,le){for(var pe=U&32767,he=U>>15;--le>=0;){var Te=this.data[R]&32767,je=this.data[R++]>>15,tt=he*Te+je*pe;Te=pe*Te+((tt&32767)<<15)+z.data[Z]+(ne&1073741823),ne=(Te>>>30)+(tt>>>15)+he*je+(ne>>>30),z.data[Z++]=Te&1073741823}return ne}function u(R,U,z,Z,ne,le){for(var pe=U&16383,he=U>>14;--le>=0;){var Te=this.data[R]&16383,je=this.data[R++]>>14,tt=he*Te+je*pe;Te=pe*Te+((tt&16383)<<14)+z.data[Z]+ne,ne=(Te>>28)+(tt>>14)+he*je,z.data[Z++]=Te&268435455}return ne}typeof navigator>"u"?(t.prototype.am=u,e=28):navigator.appName=="Microsoft Internet Explorer"?(t.prototype.am=g,e=30):navigator.appName!="Netscape"?(t.prototype.am=x,e=26):(t.prototype.am=u,e=28),t.prototype.DB=e,t.prototype.DM=(1<<e)-1,t.prototype.DV=1<<e;var r=52;t.prototype.FV=Math.pow(2,r),t.prototype.F1=r-e,t.prototype.F2=2*e-r;var c="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array,b,T;for(b=48,T=0;T<=9;++T)l[b++]=T;for(b=97,T=10;T<36;++T)l[b++]=T;for(b=65,T=10;T<36;++T)l[b++]=T;function E(R){return c.charAt(R)}function s(R,U){var z=l[R.charCodeAt(U)];return z??-1}function v(R){for(var U=this.t-1;U>=0;--U)R.data[U]=this.data[U];R.t=this.t,R.s=this.s}function h(R){this.t=1,this.s=R<0?-1:0,R>0?this.data[0]=R:R<-1?this.data[0]=R+this.DV:this.t=0}function y(R){var U=d();return U.fromInt(R),U}function n(R,U){var z;if(U==16)z=4;else if(U==8)z=3;else if(U==256)z=8;else if(U==2)z=1;else if(U==32)z=5;else if(U==4)z=2;else{this.fromRadix(R,U);return}this.t=0,this.s=0;for(var Z=R.length,ne=!1,le=0;--Z>=0;){var pe=z==8?R[Z]&255:s(R,Z);if(pe<0){R.charAt(Z)=="-"&&(ne=!0);continue}ne=!1,le==0?this.data[this.t++]=pe:le+z>this.DB?(this.data[this.t-1]|=(pe&(1<<this.DB-le)-1)<<le,this.data[this.t++]=pe>>this.DB-le):this.data[this.t-1]|=pe<<le,le+=z,le>=this.DB&&(le-=this.DB)}z==8&&(R[0]&128)!=0&&(this.s=-1,le>0&&(this.data[this.t-1]|=(1<<this.DB-le)-1<<le)),this.clamp(),ne&&t.ZERO.subTo(this,this)}function p(){for(var R=this.s&this.DM;this.t>0&&this.data[this.t-1]==R;)--this.t}function m(R){if(this.s<0)return"-"+this.negate().toString(R);var U;if(R==16)U=4;else if(R==8)U=3;else if(R==2)U=1;else if(R==32)U=5;else if(R==4)U=2;else return this.toRadix(R);var z=(1<<U)-1,Z,ne=!1,le="",pe=this.t,he=this.DB-pe*this.DB%U;if(pe-- >0)for(he<this.DB&&(Z=this.data[pe]>>he)>0&&(ne=!0,le=E(Z));pe>=0;)he<U?(Z=(this.data[pe]&(1<<he)-1)<<U-he,Z|=this.data[--pe]>>(he+=this.DB-U)):(Z=this.data[pe]>>(he-=U)&z,he<=0&&(he+=this.DB,--pe)),Z>0&&(ne=!0),ne&&(le+=E(Z));return ne?le:"0"}function _(){var R=d();return t.ZERO.subTo(this,R),R}function w(){return this.s<0?this.negate():this}function C(R){var U=this.s-R.s;if(U!=0)return U;var z=this.t;if(U=z-R.t,U!=0)return this.s<0?-U:U;for(;--z>=0;)if((U=this.data[z]-R.data[z])!=0)return U;return 0}function o(R){var U=1,z;return(z=R>>>16)!=0&&(R=z,U+=16),(z=R>>8)!=0&&(R=z,U+=8),(z=R>>4)!=0&&(R=z,U+=4),(z=R>>2)!=0&&(R=z,U+=2),(z=R>>1)!=0&&(R=z,U+=1),U}function i(){return this.t<=0?0:this.DB*(this.t-1)+o(this.data[this.t-1]^this.s&this.DM)}function B(R,U){var z;for(z=this.t-1;z>=0;--z)U.data[z+R]=this.data[z];for(z=R-1;z>=0;--z)U.data[z]=0;U.t=this.t+R,U.s=this.s}function N(R,U){for(var z=R;z<this.t;++z)U.data[z-R]=this.data[z];U.t=Math.max(this.t-R,0),U.s=this.s}function q(R,U){var z=R%this.DB,Z=this.DB-z,ne=(1<<Z)-1,le=Math.floor(R/this.DB),pe=this.s<<z&this.DM,he;for(he=this.t-1;he>=0;--he)U.data[he+le+1]=this.data[he]>>Z|pe,pe=(this.data[he]&ne)<<z;for(he=le-1;he>=0;--he)U.data[he]=0;U.data[le]=pe,U.t=this.t+le+1,U.s=this.s,U.clamp()}function I(R,U){U.s=this.s;var z=Math.floor(R/this.DB);if(z>=this.t){U.t=0;return}var Z=R%this.DB,ne=this.DB-Z,le=(1<<Z)-1;U.data[0]=this.data[z]>>Z;for(var pe=z+1;pe<this.t;++pe)U.data[pe-z-1]|=(this.data[pe]&le)<<ne,U.data[pe-z]=this.data[pe]>>Z;Z>0&&(U.data[this.t-z-1]|=(this.s&le)<<ne),U.t=this.t-z,U.clamp()}function F(R,U){for(var z=0,Z=0,ne=Math.min(R.t,this.t);z<ne;)Z+=this.data[z]-R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;if(R.t<this.t){for(Z-=R.s;z<this.t;)Z+=this.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=this.s}else{for(Z+=this.s;z<R.t;)Z-=R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z-=R.s}U.s=Z<0?-1:0,Z<-1?U.data[z++]=this.DV+Z:Z>0&&(U.data[z++]=Z),U.t=z,U.clamp()}function A(R,U){var z=this.abs(),Z=R.abs(),ne=z.t;for(U.t=ne+Z.t;--ne>=0;)U.data[ne]=0;for(ne=0;ne<Z.t;++ne)U.data[ne+z.t]=z.am(0,Z.data[ne],U,ne,0,z.t);U.s=0,U.clamp(),this.s!=R.s&&t.ZERO.subTo(U,U)}function H(R){for(var U=this.abs(),z=R.t=2*U.t;--z>=0;)R.data[z]=0;for(z=0;z<U.t-1;++z){var Z=U.am(z,U.data[z],R,2*z,0,1);(R.data[z+U.t]+=U.am(z+1,2*U.data[z],R,2*z+1,Z,U.t-z-1))>=U.DV&&(R.data[z+U.t]-=U.DV,R.data[z+U.t+1]=1)}R.t>0&&(R.data[R.t-1]+=U.am(z,U.data[z],R,2*z,0,1)),R.s=0,R.clamp()}function j(R,U,z){var Z=R.abs();if(!(Z.t<=0)){var ne=this.abs();if(ne.t<Z.t){U?.fromInt(0),z!=null&&this.copyTo(z);return}z==null&&(z=d());var le=d(),pe=this.s,he=R.s,Te=this.DB-o(Z.data[Z.t-1]);Te>0?(Z.lShiftTo(Te,le),ne.lShiftTo(Te,z)):(Z.copyTo(le),ne.copyTo(z));var je=le.t,tt=le.data[je-1];if(tt!=0){var $e=tt*(1<<this.F1)+(je>1?le.data[je-2]>>this.F2:0),ht=this.FV/$e,Xt=(1<<this.F1)/$e,ut=1<<this.F2,lt=z.t,$t=lt-je,gt=U??d();for(le.dlShiftTo($t,gt),z.compareTo(gt)>=0&&(z.data[z.t++]=1,z.subTo(gt,z)),t.ONE.dlShiftTo(je,gt),gt.subTo(le,le);le.t<je;)le.data[le.t++]=0;for(;--$t>=0;){var aa=z.data[--lt]==tt?this.DM:Math.floor(z.data[lt]*ht+(z.data[lt-1]+ut)*Xt);if((z.data[lt]+=le.am(0,aa,z,$t,0,je))<aa)for(le.dlShiftTo($t,gt),z.subTo(gt,z);z.data[lt]<--aa;)z.subTo(gt,z)}U!=null&&(z.drShiftTo(je,U),pe!=he&&t.ZERO.subTo(U,U)),z.t=je,z.clamp(),Te>0&&z.rShiftTo(Te,z),pe<0&&t.ZERO.subTo(z,z)}}}function W(R){var U=d();return this.abs().divRemTo(R,null,U),this.s<0&&U.compareTo(t.ZERO)>0&&R.subTo(U,U),U}function re(R){this.m=R}function J(R){return R.s<0||R.compareTo(this.m)>=0?R.mod(this.m):R}function oe(R){return R}function Q(R){R.divRemTo(this.m,null,R)}function $(R,U,z){R.multiplyTo(U,z),this.reduce(z)}function ce(R,U){R.squareTo(U),this.reduce(U)}re.prototype.convert=J,re.prototype.revert=oe,re.prototype.reduce=Q,re.prototype.mulTo=$,re.prototype.sqrTo=ce;function ie(){if(this.t<1)return 0;var R=this.data[0];if((R&1)==0)return 0;var U=R&3;return U=U*(2-(R&15)*U)&15,U=U*(2-(R&255)*U)&255,U=U*(2-((R&65535)*U&65535))&65535,U=U*(2-R*U%this.DV)%this.DV,U>0?this.DV-U:-U}function ee(R){this.m=R,this.mp=R.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<R.DB-15)-1,this.mt2=2*R.t}function ue(R){var U=d();return R.abs().dlShiftTo(this.m.t,U),U.divRemTo(this.m,null,U),R.s<0&&U.compareTo(t.ZERO)>0&&this.m.subTo(U,U),U}function Se(R){var U=d();return R.copyTo(U),this.reduce(U),U}function ve(R){for(;R.t<=this.mt2;)R.data[R.t++]=0;for(var U=0;U<this.m.t;++U){var z=R.data[U]&32767,Z=z*this.mpl+((z*this.mph+(R.data[U]>>15)*this.mpl&this.um)<<15)&R.DM;for(z=U+this.m.t,R.data[z]+=this.m.am(0,Z,R,U,0,this.m.t);R.data[z]>=R.DV;)R.data[z]-=R.DV,R.data[++z]++}R.clamp(),R.drShiftTo(this.m.t,R),R.compareTo(this.m)>=0&&R.subTo(this.m,R)}function k(R,U){R.squareTo(U),this.reduce(U)}function O(R,U,z){R.multiplyTo(U,z),this.reduce(z)}ee.prototype.convert=ue,ee.prototype.revert=Se,ee.prototype.reduce=ve,ee.prototype.mulTo=O,ee.prototype.sqrTo=k;function P(){return(this.t>0?this.data[0]&1:this.s)==0}function D(R,U){if(R>4294967295||R<1)return t.ONE;var z=d(),Z=d(),ne=U.convert(this),le=o(R)-1;for(ne.copyTo(z);--le>=0;)if(U.sqrTo(z,Z),(R&1<<le)>0)U.mulTo(Z,ne,z);else{var pe=z;z=Z,Z=pe}return U.revert(z)}function S(R,U){var z;return R<256||U.isEven()?z=new re(U):z=new ee(U),this.exp(R,z)}t.prototype.copyTo=v,t.prototype.fromInt=h,t.prototype.fromString=n,t.prototype.clamp=p,t.prototype.dlShiftTo=B,t.prototype.drShiftTo=N,t.prototype.lShiftTo=q,t.prototype.rShiftTo=I,t.prototype.subTo=F,t.prototype.multiplyTo=A,t.prototype.squareTo=H,t.prototype.divRemTo=j,t.prototype.invDigit=ie,t.prototype.isEven=P,t.prototype.exp=D,t.prototype.toString=m,t.prototype.negate=_,t.prototype.abs=w,t.prototype.compareTo=C,t.prototype.bitLength=i,t.prototype.mod=W,t.prototype.modPowInt=S,t.ZERO=y(0),t.ONE=y(1);function f(){var R=d();return this.copyTo(R),R}function L(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function G(){return this.t==0?this.s:this.data[0]<<24>>24}function M(){return this.t==0?this.s:this.data[0]<<16>>16}function V(R){return Math.floor(Math.LN2*this.DB/Math.log(R))}function K(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function X(R){if(R==null&&(R=10),this.signum()==0||R<2||R>36)return"0";var U=this.chunkSize(R),z=Math.pow(R,U),Z=y(z),ne=d(),le=d(),pe="";for(this.divRemTo(Z,ne,le);ne.signum()>0;)pe=(z+le.intValue()).toString(R).substr(1)+pe,ne.divRemTo(Z,ne,le);return le.intValue().toString(R)+pe}function te(R,U){this.fromInt(0),U==null&&(U=10);for(var z=this.chunkSize(U),Z=Math.pow(U,z),ne=!1,le=0,pe=0,he=0;he<R.length;++he){var Te=s(R,he);if(Te<0){R.charAt(he)=="-"&&this.signum()==0&&(ne=!0);continue}pe=U*pe+Te,++le>=z&&(this.dMultiply(Z),this.dAddOffset(pe,0),le=0,pe=0)}le>0&&(this.dMultiply(Math.pow(U,le)),this.dAddOffset(pe,0)),ne&&t.ZERO.subTo(this,this)}function Y(R,U,z){if(typeof U=="number")if(R<2)this.fromInt(1);else for(this.fromNumber(R,z),this.testBit(R-1)||this.bitwiseTo(t.ONE.shiftLeft(R-1),be,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(U);)this.dAddOffset(2,0),this.bitLength()>R&&this.subTo(t.ONE.shiftLeft(R-1),this);else{var Z=new Array,ne=R&7;Z.length=(R>>3)+1,U.nextBytes(Z),ne>0?Z[0]&=(1<<ne)-1:Z[0]=0,this.fromString(Z,256)}}function ae(){var R=this.t,U=new Array;U[0]=this.s;var z=this.DB-R*this.DB%8,Z,ne=0;if(R-- >0)for(z<this.DB&&(Z=this.data[R]>>z)!=(this.s&this.DM)>>z&&(U[ne++]=Z|this.s<<this.DB-z);R>=0;)z<8?(Z=(this.data[R]&(1<<z)-1)<<8-z,Z|=this.data[--R]>>(z+=this.DB-8)):(Z=this.data[R]>>(z-=8)&255,z<=0&&(z+=this.DB,--R)),(Z&128)!=0&&(Z|=-256),ne==0&&(this.s&128)!=(Z&128)&&++ne,(ne>0||Z!=this.s)&&(U[ne++]=Z);return U}function fe(R){return this.compareTo(R)==0}function se(R){return this.compareTo(R)<0?this:R}function de(R){return this.compareTo(R)>0?this:R}function ye(R,U,z){var Z,ne,le=Math.min(R.t,this.t);for(Z=0;Z<le;++Z)z.data[Z]=U(this.data[Z],R.data[Z]);if(R.t<this.t){for(ne=R.s&this.DM,Z=le;Z<this.t;++Z)z.data[Z]=U(this.data[Z],ne);z.t=this.t}else{for(ne=this.s&this.DM,Z=le;Z<R.t;++Z)z.data[Z]=U(ne,R.data[Z]);z.t=R.t}z.s=U(this.s,R.s),z.clamp()}function ge(R,U){return R&U}function xe(R){var U=d();return this.bitwiseTo(R,ge,U),U}function be(R,U){return R|U}function _e(R){var U=d();return this.bitwiseTo(R,be,U),U}function Ae(R,U){return R^U}function Ce(R){var U=d();return this.bitwiseTo(R,Ae,U),U}function Be(R,U){return R&~U}function Ne(R){var U=d();return this.bitwiseTo(R,Be,U),U}function Ie(){for(var R=d(),U=0;U<this.t;++U)R.data[U]=this.DM&~this.data[U];return R.t=this.t,R.s=~this.s,R}function Qe(R){var U=d();return R<0?this.rShiftTo(-R,U):this.lShiftTo(R,U),U}function Ze(R){var U=d();return R<0?this.lShiftTo(-R,U):this.rShiftTo(R,U),U}function et(R){if(R==0)return-1;var U=0;return(R&65535)==0&&(R>>=16,U+=16),(R&255)==0&&(R>>=8,U+=8),(R&15)==0&&(R>>=4,U+=4),(R&3)==0&&(R>>=2,U+=2),(R&1)==0&&++U,U}function nt(){for(var R=0;R<this.t;++R)if(this.data[R]!=0)return R*this.DB+et(this.data[R]);return this.s<0?this.t*this.DB:-1}function it(R){for(var U=0;R!=0;)R&=R-1,++U;return U}function Xe(){for(var R=0,U=this.s&this.DM,z=0;z<this.t;++z)R+=it(this.data[z]^U);return R}function st(R){var U=Math.floor(R/this.DB);return U>=this.t?this.s!=0:(this.data[U]&1<<R%this.DB)!=0}function Lt(R,U){var z=t.ONE.shiftLeft(R);return this.bitwiseTo(z,U,z),z}function Zt(R){return this.changeBit(R,be)}function Le(R){return this.changeBit(R,Be)}function De(R){return this.changeBit(R,Ae)}function Ue(R,U){for(var z=0,Z=0,ne=Math.min(R.t,this.t);z<ne;)Z+=this.data[z]+R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;if(R.t<this.t){for(Z+=R.s;z<this.t;)Z+=this.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=this.s}else{for(Z+=this.s;z<R.t;)Z+=R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=R.s}U.s=Z<0?-1:0,Z>0?U.data[z++]=Z:Z<-1&&(U.data[z++]=this.DV+Z),U.t=z,U.clamp()}function Pe(R){var U=d();return this.addTo(R,U),U}function Oe(R){var U=d();return this.subTo(R,U),U}function Fe(R){var U=d();return this.multiplyTo(R,U),U}function Ve(){var R=d();return this.squareTo(R),R}function Me(R){var U=d();return this.divRemTo(R,U,null),U}function Ke(R){var U=d();return this.divRemTo(R,null,U),U}function ze(R){var U=d(),z=d();return this.divRemTo(R,U,z),new Array(U,z)}function qe(R){this.data[this.t]=this.am(0,R-1,this,0,0,this.t),++this.t,this.clamp()}function He(R,U){if(R!=0){for(;this.t<=U;)this.data[this.t++]=0;for(this.data[U]+=R;this.data[U]>=this.DV;)this.data[U]-=this.DV,++U>=this.t&&(this.data[this.t++]=0),++this.data[U]}}function we(){}function Re(R){return R}function Ge(R,U,z){R.multiplyTo(U,z)}function We(R,U){R.squareTo(U)}we.prototype.convert=Re,we.prototype.revert=Re,we.prototype.mulTo=Ge,we.prototype.sqrTo=We;function zi(R){return this.exp(R,new we)}function qi(R,U,z){var Z=Math.min(this.t+R.t,U);for(z.s=0,z.t=Z;Z>0;)z.data[--Z]=0;var ne;for(ne=z.t-this.t;Z<ne;++Z)z.data[Z+this.t]=this.am(0,R.data[Z],z,Z,0,this.t);for(ne=Math.min(R.t,U);Z<ne;++Z)this.am(0,R.data[Z],z,Z,0,U-Z);z.clamp()}function Hi(R,U,z){--U;var Z=z.t=this.t+R.t-U;for(z.s=0;--Z>=0;)z.data[Z]=0;for(Z=Math.max(U-this.t,0);Z<R.t;++Z)z.data[this.t+Z-U]=this.am(U-Z,R.data[Z],z,0,0,this.t+Z-U);z.clamp(),z.drShiftTo(1,z)}function Et(R){this.r2=d(),this.q3=d(),t.ONE.dlShiftTo(2*R.t,this.r2),this.mu=this.r2.divide(R),this.m=R}function Gi(R){if(R.s<0||R.t>2*this.m.t)return R.mod(this.m);if(R.compareTo(this.m)<0)return R;var U=d();return R.copyTo(U),this.reduce(U),U}function Wi(R){return R}function ji(R){for(R.drShiftTo(this.m.t-1,this.r2),R.t>this.m.t+1&&(R.t=this.m.t+1,R.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);R.compareTo(this.r2)<0;)R.dAddOffset(1,this.m.t+1);for(R.subTo(this.r2,R);R.compareTo(this.m)>=0;)R.subTo(this.m,R)}function Qi(R,U){R.squareTo(U),this.reduce(U)}function Yi(R,U,z){R.multiplyTo(U,z),this.reduce(z)}Et.prototype.convert=Gi,Et.prototype.revert=Wi,Et.prototype.reduce=ji,Et.prototype.mulTo=Yi,Et.prototype.sqrTo=Qi;function Zi(R,U){var z=R.bitLength(),Z,ne=y(1),le;if(z<=0)return ne;z<18?Z=1:z<48?Z=3:z<144?Z=4:z<768?Z=5:Z=6,z<8?le=new re(U):U.isEven()?le=new Et(U):le=new ee(U);var pe=new Array,he=3,Te=Z-1,je=(1<<Z)-1;if(pe[1]=le.convert(this),Z>1){var tt=d();for(le.sqrTo(pe[1],tt);he<=je;)pe[he]=d(),le.mulTo(tt,pe[he-2],pe[he]),he+=2}var $e=R.t-1,ht,Xt=!0,ut=d(),lt;for(z=o(R.data[$e])-1;$e>=0;){for(z>=Te?ht=R.data[$e]>>z-Te&je:(ht=(R.data[$e]&(1<<z+1)-1)<<Te-z,$e>0&&(ht|=R.data[$e-1]>>this.DB+z-Te)),he=Z;(ht&1)==0;)ht>>=1,--he;if((z-=he)<0&&(z+=this.DB,--$e),Xt)pe[ht].copyTo(ne),Xt=!1;else{for(;he>1;)le.sqrTo(ne,ut),le.sqrTo(ut,ne),he-=2;he>0?le.sqrTo(ne,ut):(lt=ne,ne=ut,ut=lt),le.mulTo(ut,pe[ht],ne)}for(;$e>=0&&(R.data[$e]&1<<z)==0;)le.sqrTo(ne,ut),lt=ne,ne=ut,ut=lt,--z<0&&(z=this.DB-1,--$e)}return le.revert(ne)}function Xi(R){var U=this.s<0?this.negate():this.clone(),z=R.s<0?R.negate():R.clone();if(U.compareTo(z)<0){var Z=U;U=z,z=Z}var ne=U.getLowestSetBit(),le=z.getLowestSetBit();if(le<0)return U;for(ne<le&&(le=ne),le>0&&(U.rShiftTo(le,U),z.rShiftTo(le,z));U.signum()>0;)(ne=U.getLowestSetBit())>0&&U.rShiftTo(ne,U),(ne=z.getLowestSetBit())>0&&z.rShiftTo(ne,z),U.compareTo(z)>=0?(U.subTo(z,U),U.rShiftTo(1,U)):(z.subTo(U,z),z.rShiftTo(1,z));return le>0&&z.lShiftTo(le,z),z}function $i(R){if(R<=0)return 0;var U=this.DV%R,z=this.s<0?R-1:0;if(this.t>0)if(U==0)z=this.data[0]%R;else for(var Z=this.t-1;Z>=0;--Z)z=(U*z+this.data[Z])%R;return z}function Ji(R){if(this.signum()==0)return t.ZERO;var U=R.isEven();if(this.isEven()&&U||R.signum()==0)return t.ZERO;for(var z=R.clone(),Z=this.clone(),ne=y(1),le=y(0),pe=y(0),he=y(1);z.signum()!=0;){for(;z.isEven();)z.rShiftTo(1,z),U?((!ne.isEven()||!le.isEven())&&(ne.addTo(this,ne),le.subTo(R,le)),ne.rShiftTo(1,ne)):le.isEven()||le.subTo(R,le),le.rShiftTo(1,le);for(;Z.isEven();)Z.rShiftTo(1,Z),U?((!pe.isEven()||!he.isEven())&&(pe.addTo(this,pe),he.subTo(R,he)),pe.rShiftTo(1,pe)):he.isEven()||he.subTo(R,he),he.rShiftTo(1,he);z.compareTo(Z)>=0?(z.subTo(Z,z),U&&ne.subTo(pe,ne),le.subTo(he,le)):(Z.subTo(z,Z),U&&pe.subTo(ne,pe),he.subTo(le,he))}if(Z.compareTo(t.ONE)!=0)return t.ZERO;if(he.compareTo(R)>=0)return he.subtract(R);if(he.signum()<0)he.addTo(R,he);else return he;return he.signum()<0?he.add(R):he}var ot=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],es=(1<<26)/ot[ot.length-1];function ts(R){var U,z=this.abs();if(z.t==1&&z.data[0]<=ot[ot.length-1]){for(U=0;U<ot.length;++U)if(z.data[0]==ot[U])return!0;return!1}if(z.isEven())return!1;for(U=1;U<ot.length;){for(var Z=ot[U],ne=U+1;ne<ot.length&&Z<es;)Z*=ot[ne++];for(Z=z.modInt(Z);U<ne;)if(Z%ot[U++]==0)return!1}return z.millerRabin(R)}function rs(R){var U=this.subtract(t.ONE),z=U.getLowestSetBit();if(z<=0)return!1;for(var Z=U.shiftRight(z),ne=as(),le,pe=0;pe<R;++pe){do le=new t(this.bitLength(),ne);while(le.compareTo(t.ONE)<=0||le.compareTo(U)>=0);var he=le.modPow(Z,this);if(he.compareTo(t.ONE)!=0&&he.compareTo(U)!=0){for(var Te=1;Te++<z&&he.compareTo(U)!=0;)if(he=he.modPowInt(2,this),he.compareTo(t.ONE)==0)return!1;if(he.compareTo(U)!=0)return!1}}return!0}function as(){return{nextBytes:function(R){for(var U=0;U<R.length;++U)R[U]=Math.floor(Math.random()*256)}}}return t.prototype.chunkSize=V,t.prototype.toRadix=X,t.prototype.fromRadix=te,t.prototype.fromNumber=Y,t.prototype.bitwiseTo=ye,t.prototype.changeBit=Lt,t.prototype.addTo=Ue,t.prototype.dMultiply=qe,t.prototype.dAddOffset=He,t.prototype.multiplyLowerTo=qi,t.prototype.multiplyUpperTo=Hi,t.prototype.modInt=$i,t.prototype.millerRabin=rs,t.prototype.clone=f,t.prototype.intValue=L,t.prototype.byteValue=G,t.prototype.shortValue=M,t.prototype.signum=K,t.prototype.toByteArray=ae,t.prototype.equals=fe,t.prototype.min=se,t.prototype.max=de,t.prototype.and=xe,t.prototype.or=_e,t.prototype.xor=Ce,t.prototype.andNot=Ne,t.prototype.not=Ie,t.prototype.shiftLeft=Qe,t.prototype.shiftRight=Ze,t.prototype.getLowestSetBit=nt,t.prototype.bitCount=Xe,t.prototype.testBit=st,t.prototype.setBit=Zt,t.prototype.clearBit=Le,t.prototype.flipBit=De,t.prototype.add=Pe,t.prototype.subtract=Oe,t.prototype.multiply=Fe,t.prototype.divide=Me,t.prototype.remainder=Ke,t.prototype.divideAndRemainder=ze,t.prototype.modPow=Zi,t.prototype.modInverse=Ji,t.prototype.pow=zi,t.prototype.gcd=Xi,t.prototype.isProbablePrime=ts,t.prototype.square=Ve,Nr}var Lr={exports:{}},Dr={exports:{}},Va;function Nt(){if(Va)return Dr.exports;Va=1;var a=me();ct(),Ee();var e=Dr.exports=a.sha1=a.sha1||{};a.md.sha1=a.md.algorithms.sha1=e,e.create=function(){d||x();var u=null,r=a.util.createBuffer(),c=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return l.start=function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var b=l.messageLengthSize/4,T=0;T<b;++T)l.fullMessageLength.push(0);return r=a.util.createBuffer(),u={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l},l.start(),l.update=function(b,T){T==="utf8"&&(b=a.util.encodeUtf8(b));var E=b.length;l.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var s=l.fullMessageLength.length-1;s>=0;--s)l.fullMessageLength[s]+=E[1],E[1]=E[0]+(l.fullMessageLength[s]/4294967296>>>0),l.fullMessageLength[s]=l.fullMessageLength[s]>>>0,E[0]=E[1]/4294967296>>>0;return r.putBytes(b),g(u,c,r),(r.read>2048||r.length()===0)&&r.compact(),l},l.digest=function(){var b=a.util.createBuffer();b.putBytes(r.bytes());var T=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize,E=T&l.blockLength-1;b.putBytes(t.substr(0,l.blockLength-E));for(var s,v,h=l.fullMessageLength[0]*8,y=0;y<l.fullMessageLength.length-1;++y)s=l.fullMessageLength[y+1]*8,v=s/4294967296>>>0,h+=v,b.putInt32(h>>>0),h=s>>>0;b.putInt32(h);var n={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3,h4:u.h4};g(n,c,b);var p=a.util.createBuffer();return p.putInt32(n.h0),p.putInt32(n.h1),p.putInt32(n.h2),p.putInt32(n.h3),p.putInt32(n.h4),p},l};var t=null,d=!1;function x(){t="",t+=a.util.fillString("\0",64),d=!0}function g(u,r,c){for(var l,b,T,E,s,v,h,y,n=c.length();n>=64;){for(b=u.h0,T=u.h1,E=u.h2,s=u.h3,v=u.h4,y=0;y<16;++y)l=c.getInt32(),r[y]=l,h=s^T&(E^s),l=(b<<5|b>>>27)+h+v+1518500249+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<20;++y)l=r[y-3]^r[y-8]^r[y-14]^r[y-16],l=l<<1|l>>>31,r[y]=l,h=s^T&(E^s),l=(b<<5|b>>>27)+h+v+1518500249+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<32;++y)l=r[y-3]^r[y-8]^r[y-14]^r[y-16],l=l<<1|l>>>31,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+1859775393+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<40;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+1859775393+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<60;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T&E|s&(T^E),l=(b<<5|b>>>27)+h+v+2400959708+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<80;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+3395469782+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;u.h0=u.h0+b|0,u.h1=u.h1+T|0,u.h2=u.h2+E|0,u.h3=u.h3+s|0,u.h4=u.h4+v|0,n-=64}}return Dr.exports}var Ma;function Ka(){if(Ma)return Lr.exports;Ma=1;var a=me();Ee(),at(),Nt();var e=Lr.exports=a.pkcs1=a.pkcs1||{};e.encode_rsa_oaep=function(d,x,g){var u,r,c,l;typeof g=="string"?(u=g,r=arguments[3]||void 0,c=arguments[4]||void 0):g&&(u=g.label||void 0,r=g.seed||void 0,c=g.md||void 0,g.mgf1&&g.mgf1.md&&(l=g.mgf1.md)),c?c.start():c=a.md.sha1.create(),l||(l=c);var b=Math.ceil(d.n.bitLength()/8),T=b-2*c.digestLength-2;if(x.length>T){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=x.length,E.maxLength=T,E}u||(u=""),c.update(u,"raw");for(var s=c.digest(),v="",h=T-x.length,y=0;y<h;y++)v+="\0";var n=s.getBytes()+v+""+x;if(!r)r=a.random.getBytes(c.digestLength);else if(r.length!==c.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=r.length,E.digestLength=c.digestLength,E}var p=t(r,b-c.digestLength-1,l),m=a.util.xorBytes(n,p,n.length),_=t(m,c.digestLength,l),w=a.util.xorBytes(r,_,r.length);return"\0"+w+m},e.decode_rsa_oaep=function(d,x,g){var u,r,c;typeof g=="string"?(u=g,r=arguments[3]||void 0):g&&(u=g.label||void 0,r=g.md||void 0,g.mgf1&&g.mgf1.md&&(c=g.mgf1.md));var l=Math.ceil(d.n.bitLength()/8);if(x.length!==l){var m=new Error("RSAES-OAEP encoded message length is invalid.");throw m.length=x.length,m.expectedLength=l,m}if(r===void 0?r=a.md.sha1.create():r.start(),c||(c=r),l<2*r.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");u||(u=""),r.update(u,"raw");for(var b=r.digest().getBytes(),T=x.charAt(0),E=x.substring(1,r.digestLength+1),s=x.substring(1+r.digestLength),v=t(s,r.digestLength,c),h=a.util.xorBytes(E,v,E.length),y=t(h,l-r.digestLength-1,c),n=a.util.xorBytes(s,y,s.length),p=n.substring(0,r.digestLength),m=T!=="\0",_=0;_<r.digestLength;++_)m|=b.charAt(_)!==p.charAt(_);for(var w=1,C=r.digestLength,o=r.digestLength;o<n.length;o++){var i=n.charCodeAt(o),B=i&1^1,N=w?65534:0;m|=i&N,w=w&B,C+=w}if(m||n.charCodeAt(C)!==1)throw new Error("Invalid RSAES-OAEP padding.");return n.substring(C+1)};function t(d,x,g){g||(g=a.md.sha1.create());for(var u="",r=Math.ceil(x/g.digestLength),c=0;c<r;++c){var l=String.fromCharCode(c>>24&255,c>>16&255,c>>8&255,c&255);g.start(),g.update(d+l),u+=g.digest().getBytes()}return u.substring(0,x)}return Lr.exports}var Wt={exports:{}},za;function qa(){if(za)return Wt.exports;za=1;var a=me();return Ee(),Gt(),at(),(function(){if(a.prime){Wt.exports=a.prime;return}var e=Wt.exports=a.prime=a.prime||{},t=a.jsbn.BigInteger,d=[6,4,2,4,2,4,6,2],x=new t(null);x.fromInt(30);var g=function(E,s){return E|s};e.generateProbablePrime=function(E,s,v){typeof s=="function"&&(v=s,s={}),s=s||{};var h=s.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var y=s.prng||a.random,n={nextBytes:function(p){for(var m=y.getBytesSync(p.length),_=0;_<p.length;++_)p[_]=m.charCodeAt(_)}};if(h.name==="PRIMEINC")return u(E,n,h.options,v);throw new Error("Invalid prime generation algorithm: "+h.name)};function u(E,s,v,h){return"workers"in v?l(E,s,v,h):r(E,s,v,h)}function r(E,s,v,h){var y=b(E,s),n=0,p=T(y.bitLength());"millerRabinTests"in v&&(p=v.millerRabinTests);var m=10;"maxBlockTime"in v&&(m=v.maxBlockTime),c(y,E,s,n,p,m,h)}function c(E,s,v,h,y,n,p){var m=+new Date;do{if(E.bitLength()>s&&(E=b(s,v)),E.isProbablePrime(y))return p(null,E);E.dAddOffset(d[h++%8],0)}while(n<0||+new Date-m<n);a.util.setImmediate(function(){c(E,s,v,h,y,n,p)})}function l(E,s,v,h){if(typeof Worker>"u")return r(E,s,v,h);var y=b(E,s),n=v.workers,p=v.workLoad||100,m=p*30/8,_=v.workerScript||"forge/prime.worker.js";if(n===-1)return a.util.estimateCores(function(C,o){C&&(o=2),n=o-1,w()});w();function w(){n=Math.max(1,n);for(var C=[],o=0;o<n;++o)C[o]=new Worker(_);for(var o=0;o<n;++o)C[o].addEventListener("message",B);var i=!1;function B(N){if(!i){var q=N.data;if(q.found){for(var I=0;I<C.length;++I)C[I].terminate();return i=!0,h(null,new t(q.prime,16))}y.bitLength()>E&&(y=b(E,s));var F=y.toString(16);N.target.postMessage({hex:F,workLoad:p}),y.dAddOffset(m,0)}}}}function b(E,s){var v=new t(E,s),h=E-1;return v.testBit(h)||v.bitwiseTo(t.ONE.shiftLeft(h),g,v),v.dAddOffset(31-v.mod(x).byteValue(),0),v}function T(E){return E<=100?27:E<=150?18:E<=200?15:E<=250?12:E<=300?9:E<=350?8:E<=400?7:E<=500?6:E<=600?5:E<=800?4:E<=1250?3:2}})(),Wt.exports}var Ur,Ha;function jt(){if(Ha)return Ur;Ha=1;var a=me();if(ft(),Gt(),mt(),Ka(),qa(),at(),Ee(),typeof e>"u")var e=a.jsbn.BigInteger;var t=a.util.isNodejs?Ar:null,d=a.asn1,x=a.util;a.pki=a.pki||{},Ur=a.pki.rsa=a.rsa=a.rsa||{};var g=a.pki,u=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},b=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},T={name:"DigestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,type:d.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(o){var i;if(o.algorithm in g.oids)i=g.oids[o.algorithm];else{var B=new Error("Unknown message digest algorithm.");throw B.algorithm=o.algorithm,B}var N=d.oidToDer(i).getBytes(),q=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),I=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);I.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,N)),I.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var F=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,o.digest().getBytes());return q.value.push(I),q.value.push(F),d.toDer(q).getBytes()},s=function(o,i,B){if(B)return o.modPow(i.e,i.n);if(!i.p||!i.q)return o.modPow(i.d,i.n);i.dP||(i.dP=i.d.mod(i.p.subtract(e.ONE))),i.dQ||(i.dQ=i.d.mod(i.q.subtract(e.ONE))),i.qInv||(i.qInv=i.q.modInverse(i.p));var N;do N=new e(a.util.bytesToHex(a.random.getBytes(i.n.bitLength()/8)),16);while(N.compareTo(i.n)>=0||!N.gcd(i.n).equals(e.ONE));o=o.multiply(N.modPow(i.e,i.n)).mod(i.n);for(var q=o.mod(i.p).modPow(i.dP,i.p),I=o.mod(i.q).modPow(i.dQ,i.q);q.compareTo(I)<0;)q=q.add(i.p);var F=q.subtract(I).multiply(i.qInv).mod(i.p).multiply(i.q).add(I);return F=F.multiply(N.modInverse(i.n)).mod(i.n),F};g.rsa.encrypt=function(o,i,B){var N=B,q,I=Math.ceil(i.n.bitLength()/8);B!==!1&&B!==!0?(N=B===2,q=v(o,i,B)):(q=a.util.createBuffer(),q.putBytes(o));for(var F=new e(q.toHex(),16),A=s(F,i,N),H=A.toString(16),j=a.util.createBuffer(),W=I-Math.ceil(H.length/2);W>0;)j.putByte(0),--W;return j.putBytes(a.util.hexToBytes(H)),j.getBytes()},g.rsa.decrypt=function(o,i,B,N){var q=Math.ceil(i.n.bitLength()/8);if(o.length!==q){var I=new Error("Encrypted message length is invalid.");throw I.length=o.length,I.expected=q,I}var F=new e(a.util.createBuffer(o).toHex(),16);if(F.compareTo(i.n)>=0)throw new Error("Encrypted message is invalid.");for(var A=s(F,i,B),H=A.toString(16),j=a.util.createBuffer(),W=q-Math.ceil(H.length/2);W>0;)j.putByte(0),--W;return j.putBytes(a.util.hexToBytes(H)),N!==!1?h(j.getBytes(),i,B):j.getBytes()},g.rsa.createKeyPairGenerationState=function(o,i,B){typeof o=="string"&&(o=parseInt(o,10)),o=o||2048,B=B||{};var N=B.prng||a.random,q={nextBytes:function(A){for(var H=N.getBytesSync(A.length),j=0;j<A.length;++j)A[j]=H.charCodeAt(j)}},I=B.algorithm||"PRIMEINC",F;if(I==="PRIMEINC")F={algorithm:I,state:0,bits:o,rng:q,eInt:i||65537,e:new e(null),p:null,q:null,qBits:o>>1,pBits:o-(o>>1),pqState:0,num:null,keys:null},F.e.fromInt(F.eInt);else throw new Error("Invalid key generation algorithm: "+I);return F},g.rsa.stepKeyPairGenerationState=function(o,i){"algorithm"in o||(o.algorithm="PRIMEINC");var B=new e(null);B.fromInt(30);for(var N=0,q=function(re,J){return re|J},I=+new Date,F,A=0;o.keys===null&&(i<=0||A<i);){if(o.state===0){var H=o.p===null?o.pBits:o.qBits,j=H-1;o.pqState===0?(o.num=new e(H,o.rng),o.num.testBit(j)||o.num.bitwiseTo(e.ONE.shiftLeft(j),q,o.num),o.num.dAddOffset(31-o.num.mod(B).byteValue(),0),N=0,++o.pqState):o.pqState===1?o.num.bitLength()>H?o.pqState=0:o.num.isProbablePrime(p(o.num.bitLength()))?++o.pqState:o.num.dAddOffset(u[N++%8],0):o.pqState===2?o.pqState=o.num.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)===0?3:0:o.pqState===3&&(o.pqState=0,o.p===null?o.p=o.num:o.q=o.num,o.p!==null&&o.q!==null&&++o.state,o.num=null)}else if(o.state===1)o.p.compareTo(o.q)<0&&(o.num=o.p,o.p=o.q,o.q=o.num),++o.state;else if(o.state===2)o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),++o.state;else if(o.state===3)o.phi.gcd(o.e).compareTo(e.ONE)===0?++o.state:(o.p=null,o.q=null,o.state=0);else if(o.state===4)o.n=o.p.multiply(o.q),o.n.bitLength()===o.bits?++o.state:(o.q=null,o.state=0);else if(o.state===5){var W=o.e.modInverse(o.phi);o.keys={privateKey:g.rsa.setPrivateKey(o.n,o.e,W,o.p,o.q,W.mod(o.p1),W.mod(o.q1),o.q.modInverse(o.p)),publicKey:g.rsa.setPublicKey(o.n,o.e)}}F=+new Date,A+=F-I,I=F}return o.keys!==null},g.rsa.generateKeyPair=function(o,i,B,N){if(arguments.length===1?typeof o=="object"?(B=o,o=void 0):typeof o=="function"&&(N=o,o=void 0):arguments.length===2?typeof o=="number"?typeof i=="function"?(N=i,i=void 0):typeof i!="number"&&(B=i,i=void 0):(B=o,N=i,o=void 0,i=void 0):arguments.length===3&&(typeof i=="number"?typeof B=="function"&&(N=B,B=void 0):(N=B,B=i,i=void 0)),B=B||{},o===void 0&&(o=B.bits||2048),i===void 0&&(i=B.e||65537),!a.options.usePureJavaScript&&!B.prng&&o>=256&&o<=16384&&(i===65537||i===3)){if(N){if(m("generateKeyPair"))return t.generateKeyPair("rsa",{modulusLength:o,publicExponent:i,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(A,H,j){if(A)return N(A);N(null,{privateKey:g.privateKeyFromPem(j),publicKey:g.publicKeyFromPem(H)})});if(_("generateKey")&&_("exportKey"))return x.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:C(i),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(A){return x.globalScope.crypto.subtle.exportKey("pkcs8",A.privateKey)}).then(void 0,function(A){N(A)}).then(function(A){if(A){var H=g.privateKeyFromAsn1(d.fromDer(a.util.createBuffer(A)));N(null,{privateKey:H,publicKey:g.setRsaPublicKey(H.n,H.e)})}});if(w("generateKey")&&w("exportKey")){var q=x.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:C(i),hash:{name:"SHA-256"}},!0,["sign","verify"]);q.oncomplete=function(A){var H=A.target.result,j=x.globalScope.msCrypto.subtle.exportKey("pkcs8",H.privateKey);j.oncomplete=function(W){var re=W.target.result,J=g.privateKeyFromAsn1(d.fromDer(a.util.createBuffer(re)));N(null,{privateKey:J,publicKey:g.setRsaPublicKey(J.n,J.e)})},j.onerror=function(W){N(W)}},q.onerror=function(A){N(A)};return}}else if(m("generateKeyPairSync")){var I=t.generateKeyPairSync("rsa",{modulusLength:o,publicExponent:i,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:g.privateKeyFromPem(I.privateKey),publicKey:g.publicKeyFromPem(I.publicKey)}}}var F=g.rsa.createKeyPairGenerationState(o,i,B);if(!N)return g.rsa.stepKeyPairGenerationState(F,0),F.keys;y(F,B,N)},g.setRsaPublicKey=g.rsa.setPublicKey=function(o,i){var B={n:o,e:i};return B.encrypt=function(N,q,I){if(typeof q=="string"?q=q.toUpperCase():q===void 0&&(q="RSAES-PKCS1-V1_5"),q==="RSAES-PKCS1-V1_5")q={encode:function(A,H,j){return v(A,H,2).getBytes()}};else if(q==="RSA-OAEP"||q==="RSAES-OAEP")q={encode:function(A,H){return a.pkcs1.encode_rsa_oaep(H,A,I)}};else if(["RAW","NONE","NULL",null].indexOf(q)!==-1)q={encode:function(A){return A}};else if(typeof q=="string")throw new Error('Unsupported encryption scheme: "'+q+'".');var F=q.encode(N,B,!0);return g.rsa.encrypt(F,B,!0)},B.verify=function(N,q,I,F){typeof I=="string"?I=I.toUpperCase():I===void 0&&(I="RSASSA-PKCS1-V1_5"),F===void 0&&(F={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in F||(F._parseAllDigestBytes=!0),"_skipPaddingChecks"in F||(F._skipPaddingChecks=!1),I==="RSASSA-PKCS1-V1_5"?I={verify:function(H,j){j=h(j,B,!0,void 0,F);var W=d.fromDer(j,{parseAllBytes:F._parseAllDigestBytes}),re={},J=[];if(!d.validate(W,T,re,J)||W.value.length!==2){var oe=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw oe.errors=J,oe}var Q=d.derToOid(re.algorithmIdentifier);if(!(Q===a.oids.md2||Q===a.oids.md5||Q===a.oids.sha1||Q===a.oids.sha224||Q===a.oids.sha256||Q===a.oids.sha384||Q===a.oids.sha512||Q===a.oids["sha512-224"]||Q===a.oids["sha512-256"])){var oe=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw oe.oid=Q,oe}if((Q===a.oids.md2||Q===a.oids.md5)&&!("parameters"in re))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return H===re.digest}}:(I==="NONE"||I==="NULL"||I===null)&&(I={verify:function(H,j){return j=h(j,B,!0,void 0,F),H===j}});var A=g.rsa.decrypt(q,B,!0,!1);return I.verify(N,A,B.n.bitLength())},B},g.setRsaPrivateKey=g.rsa.setPrivateKey=function(o,i,B,N,q,I,F,A){var H={n:o,e:i,d:B,p:N,q,dP:I,dQ:F,qInv:A};return H.decrypt=function(j,W,re){typeof W=="string"?W=W.toUpperCase():W===void 0&&(W="RSAES-PKCS1-V1_5");var J=g.rsa.decrypt(j,H,!1,!1);if(W==="RSAES-PKCS1-V1_5")W={decode:h};else if(W==="RSA-OAEP"||W==="RSAES-OAEP")W={decode:function(oe,Q){return a.pkcs1.decode_rsa_oaep(Q,oe,re)}};else if(["RAW","NONE","NULL",null].indexOf(W)!==-1)W={decode:function(oe){return oe}};else throw new Error('Unsupported encryption scheme: "'+W+'".');return W.decode(J,H,!1)},H.sign=function(j,W){var re=!1;typeof W=="string"&&(W=W.toUpperCase()),W===void 0||W==="RSASSA-PKCS1-V1_5"?(W={encode:E},re=1):(W==="NONE"||W==="NULL"||W===null)&&(W={encode:function(){return j}},re=1);var J=W.encode(j,H.n.bitLength());return g.rsa.encrypt(J,H,re)},H},g.wrapRsaPrivateKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(g.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(o).getBytes())])},g.privateKeyFromAsn1=function(o){var i={},B=[];if(d.validate(o,r,i,B)&&(o=d.fromDer(a.util.createBuffer(i.privateKey))),i={},B=[],!d.validate(o,c,i,B)){var N=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw N.errors=B,N}var q,I,F,A,H,j,W,re;return q=a.util.createBuffer(i.privateKeyModulus).toHex(),I=a.util.createBuffer(i.privateKeyPublicExponent).toHex(),F=a.util.createBuffer(i.privateKeyPrivateExponent).toHex(),A=a.util.createBuffer(i.privateKeyPrime1).toHex(),H=a.util.createBuffer(i.privateKeyPrime2).toHex(),j=a.util.createBuffer(i.privateKeyExponent1).toHex(),W=a.util.createBuffer(i.privateKeyExponent2).toHex(),re=a.util.createBuffer(i.privateKeyCoefficient).toHex(),g.setRsaPrivateKey(new e(q,16),new e(I,16),new e(F,16),new e(A,16),new e(H,16),new e(j,16),new e(W,16),new e(re,16))},g.privateKeyToAsn1=g.privateKeyToRSAPrivateKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.qInv))])},g.publicKeyFromAsn1=function(o){var i={},B=[];if(d.validate(o,b,i,B)){var N=d.derToOid(i.publicKeyOid);if(N!==g.oids.rsaEncryption){var q=new Error("Cannot read public key. Unknown OID.");throw q.oid=N,q}o=i.rsaPublicKey}if(B=[],!d.validate(o,l,i,B)){var q=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw q.errors=B,q}var I=a.util.createBuffer(i.publicKeyModulus).toHex(),F=a.util.createBuffer(i.publicKeyExponent).toHex();return g.setRsaPublicKey(new e(I,16),new e(F,16))},g.publicKeyToAsn1=g.publicKeyToSubjectPublicKeyInfo=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(g.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[g.publicKeyToRSAPublicKey(o)])])},g.publicKeyToRSAPublicKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.e))])};function v(o,i,B){var N=a.util.createBuffer(),q=Math.ceil(i.n.bitLength()/8);if(o.length>q-11){var I=new Error("Message is too long for PKCS#1 v1.5 padding.");throw I.length=o.length,I.max=q-11,I}N.putByte(0),N.putByte(B);var F=q-3-o.length,A;if(B===0||B===1){A=B===0?0:255;for(var H=0;H<F;++H)N.putByte(A)}else for(;F>0;){for(var j=0,W=a.random.getBytes(F),H=0;H<F;++H)A=W.charCodeAt(H),A===0?++j:N.putByte(A);F=j}return N.putByte(0),N.putBytes(o),N}function h(o,i,B,N,q){var I=Math.ceil(i.n.bitLength()/8),F=a.util.createBuffer(o),A=F.getByte(),H=F.getByte();if(A!==0||B&&H!==0&&H!==1||!B&&H!==2||B&&H===0&&typeof N>"u")throw new Error("Encryption block is invalid.");var j=0;if(H===0){j=I-3-N;for(var W=0;W<j;++W)if(F.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(H===1){for(j=0;F.length()>1;){if(F.getByte()!==255){--F.read;break}++j}if(j<8&&!(q&&q._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(H===2){for(j=0;F.length()>1;){if(F.getByte()===0){--F.read;break}++j}if(j<8&&!(q&&q._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var re=F.getByte();if(re!==0||j!==I-3-F.length())throw new Error("Encryption block is invalid.");return F.getBytes()}function y(o,i,B){typeof i=="function"&&(B=i,i={}),i=i||{};var N={algorithm:{name:i.algorithm||"PRIMEINC",options:{workers:i.workers||2,workLoad:i.workLoad||100,workerScript:i.workerScript}}};"prng"in i&&(N.prng=i.prng),q();function q(){I(o.pBits,function(A,H){if(A)return B(A);if(o.p=H,o.q!==null)return F(A,o.q);I(o.qBits,F)})}function I(A,H){a.prime.generateProbablePrime(A,N,H)}function F(A,H){if(A)return B(A);if(o.q=H,o.p.compareTo(o.q)<0){var j=o.p;o.p=o.q,o.q=j}if(o.p.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.p=null,q();return}if(o.q.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.q=null,I(o.qBits,F);return}if(o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),o.phi.gcd(o.e).compareTo(e.ONE)!==0){o.p=o.q=null,q();return}if(o.n=o.p.multiply(o.q),o.n.bitLength()!==o.bits){o.q=null,I(o.qBits,F);return}var W=o.e.modInverse(o.phi);o.keys={privateKey:g.rsa.setPrivateKey(o.n,o.e,W,o.p,o.q,W.mod(o.p1),W.mod(o.q1),o.q.modInverse(o.p)),publicKey:g.rsa.setPublicKey(o.n,o.e)},B(null,o.keys)}}function n(o){var i=o.toString(16);i[0]>="8"&&(i="00"+i);var B=a.util.hexToBytes(i);return B.length>1&&(B.charCodeAt(0)===0&&(B.charCodeAt(1)&128)===0||B.charCodeAt(0)===255&&(B.charCodeAt(1)&128)===128)?B.substr(1):B}function p(o){return o<=100?27:o<=150?18:o<=200?15:o<=250?12:o<=300?9:o<=350?8:o<=400?7:o<=500?6:o<=600?5:o<=800?4:o<=1250?3:2}function m(o){return a.util.isNodejs&&typeof t[o]=="function"}function _(o){return typeof x.globalScope<"u"&&typeof x.globalScope.crypto=="object"&&typeof x.globalScope.crypto.subtle=="object"&&typeof x.globalScope.crypto.subtle[o]=="function"}function w(o){return typeof x.globalScope<"u"&&typeof x.globalScope.msCrypto=="object"&&typeof x.globalScope.msCrypto.subtle=="object"&&typeof x.globalScope.msCrypto.subtle[o]=="function"}function C(o){for(var i=a.util.hexToBytes(o.toString(16)),B=new Uint8Array(i.length),N=0;N<i.length;++N)B[N]=i.charCodeAt(N);return B}return Ur}var Pr,Ga;function Wa(){if(Ga)return Pr;Ga=1;var a=me();if(yt(),ft(),qt(),ct(),mt(),wr(),xt(),at(),Oa(),jt(),Ee(),typeof e>"u")var e=a.jsbn.BigInteger;var t=a.asn1,d=a.pki=a.pki||{};Pr=d.pbe=a.pbe=a.pbe||{};var x=d.oids,g={name:"EncryptedPrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},r={name:"pkcs-12PbeParams",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"iterations"}]};d.encryptPrivateKeyInfo=function(E,s,v){v=v||{},v.saltSize=v.saltSize||8,v.count=v.count||2048,v.algorithm=v.algorithm||"aes128",v.prfAlgorithm=v.prfAlgorithm||"sha1";var h=a.random.getBytesSync(v.saltSize),y=v.count,n=t.integerToDer(y),p,m,_;if(v.algorithm.indexOf("aes")===0||v.algorithm==="des"){var w,C,o;switch(v.algorithm){case"aes128":p=16,w=16,C=x["aes128-CBC"],o=a.aes.createEncryptionCipher;break;case"aes192":p=24,w=16,C=x["aes192-CBC"],o=a.aes.createEncryptionCipher;break;case"aes256":p=32,w=16,C=x["aes256-CBC"],o=a.aes.createEncryptionCipher;break;case"des":p=8,w=8,C=x.desCBC,o=a.des.createEncryptionCipher;break;default:var i=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw i.algorithm=v.algorithm,i}var B="hmacWith"+v.prfAlgorithm.toUpperCase(),N=b(B),q=a.pkcs5.pbkdf2(s,h,y,p,N),I=a.random.getBytesSync(w),F=o(q);F.start(I),F.update(t.toDer(E)),F.finish(),_=F.output.getBytes();var A=T(h,n,p,B);m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x.pkcs5PBES2).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x.pkcs5PBKDF2).getBytes()),A]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(C).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,I)])])])}else if(v.algorithm==="3des"){p=24;var H=new a.util.ByteBuffer(h),q=d.pbe.generatePkcs12Key(s,H,1,y,p),I=d.pbe.generatePkcs12Key(s,H,2,y,p),F=a.des.createEncryptionCipher(q);F.start(I),F.update(t.toDer(E)),F.finish(),_=F.output.getBytes(),m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,h),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,n.getBytes())])])}else{var i=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw i.algorithm=v.algorithm,i}var j=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[m,t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,_)]);return j},d.decryptPrivateKeyInfo=function(E,s){var v=null,h={},y=[];if(!t.validate(E,g,h,y)){var n=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}var p=t.derToOid(h.encryptionOid),m=d.pbe.getCipher(p,h.encryptionParams,s),_=a.util.createBuffer(h.encryptedData);return m.update(_),m.finish()&&(v=t.fromDer(m.output)),v},d.encryptedPrivateKeyToPem=function(E,s){var v={type:"ENCRYPTED PRIVATE KEY",body:t.toDer(E).getBytes()};return a.pem.encode(v,{maxline:s})},d.encryptedPrivateKeyFromPem=function(E){var s=a.pem.decode(E)[0];if(s.type!=="ENCRYPTED PRIVATE KEY"){var v=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw v.headerType=s.type,v}if(s.procType&&s.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return t.fromDer(s.body)},d.encryptRsaPrivateKey=function(E,s,v){if(v=v||{},!v.legacy){var h=d.wrapRsaPrivateKey(d.privateKeyToAsn1(E));return h=d.encryptPrivateKeyInfo(h,s,v),d.encryptedPrivateKeyToPem(h)}var y,n,p,m;switch(v.algorithm){case"aes128":y="AES-128-CBC",p=16,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"aes192":y="AES-192-CBC",p=24,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"aes256":y="AES-256-CBC",p=32,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"3des":y="DES-EDE3-CBC",p=24,n=a.random.getBytesSync(8),m=a.des.createEncryptionCipher;break;case"des":y="DES-CBC",p=8,n=a.random.getBytesSync(8),m=a.des.createEncryptionCipher;break;default:var _=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+v.algorithm+'".');throw _.algorithm=v.algorithm,_}var w=a.pbe.opensslDeriveBytes(s,n.substr(0,8),p),C=m(w);C.start(n),C.update(t.toDer(d.privateKeyToAsn1(E))),C.finish();var o={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:y,parameters:a.util.bytesToHex(n).toUpperCase()},body:C.output.getBytes()};return a.pem.encode(o)},d.decryptRsaPrivateKey=function(E,s){var v=null,h=a.pem.decode(E)[0];if(h.type!=="ENCRYPTED PRIVATE KEY"&&h.type!=="PRIVATE KEY"&&h.type!=="RSA PRIVATE KEY"){var y=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw y.headerType=y,y}if(h.procType&&h.procType.type==="ENCRYPTED"){var n,p;switch(h.dekInfo.algorithm){case"DES-CBC":n=8,p=a.des.createDecryptionCipher;break;case"DES-EDE3-CBC":n=24,p=a.des.createDecryptionCipher;break;case"AES-128-CBC":n=16,p=a.aes.createDecryptionCipher;break;case"AES-192-CBC":n=24,p=a.aes.createDecryptionCipher;break;case"AES-256-CBC":n=32,p=a.aes.createDecryptionCipher;break;case"RC2-40-CBC":n=5,p=function(o){return a.rc2.createDecryptionCipher(o,40)};break;case"RC2-64-CBC":n=8,p=function(o){return a.rc2.createDecryptionCipher(o,64)};break;case"RC2-128-CBC":n=16,p=function(o){return a.rc2.createDecryptionCipher(o,128)};break;default:var y=new Error('Could not decrypt private key; unsupported encryption algorithm "'+h.dekInfo.algorithm+'".');throw y.algorithm=h.dekInfo.algorithm,y}var m=a.util.hexToBytes(h.dekInfo.parameters),_=a.pbe.opensslDeriveBytes(s,m.substr(0,8),n),w=p(_);if(w.start(m),w.update(a.util.createBuffer(h.body)),w.finish())v=w.output.getBytes();else return v}else v=h.body;return h.type==="ENCRYPTED PRIVATE KEY"?v=d.decryptPrivateKeyInfo(t.fromDer(v),s):v=t.fromDer(v),v!==null&&(v=d.privateKeyFromAsn1(v)),v},d.pbe.generatePkcs12Key=function(E,s,v,h,y,n){var p,m;if(typeof n>"u"||n===null){if(!("sha1"in a.md))throw new Error('"sha1" hash algorithm unavailable.');n=a.md.sha1.create()}var _=n.digestLength,w=n.blockLength,C=new a.util.ByteBuffer,o=new a.util.ByteBuffer;if(E!=null){for(m=0;m<E.length;m++)o.putInt16(E.charCodeAt(m));o.putInt16(0)}var i=o.length(),B=s.length(),N=new a.util.ByteBuffer;N.fillWithByte(v,w);var q=w*Math.ceil(B/w),I=new a.util.ByteBuffer;for(m=0;m<q;m++)I.putByte(s.at(m%B));var F=w*Math.ceil(i/w),A=new a.util.ByteBuffer;for(m=0;m<F;m++)A.putByte(o.at(m%i));var H=I;H.putBuffer(A);for(var j=Math.ceil(y/_),W=1;W<=j;W++){var re=new a.util.ByteBuffer;re.putBytes(N.bytes()),re.putBytes(H.bytes());for(var J=0;J<h;J++)n.start(),n.update(re.getBytes()),re=n.digest();var oe=new a.util.ByteBuffer;for(m=0;m<w;m++)oe.putByte(re.at(m%_));var Q=Math.ceil(B/w)+Math.ceil(i/w),$=new a.util.ByteBuffer;for(p=0;p<Q;p++){var ce=new a.util.ByteBuffer(H.getBytes(w)),ie=511;for(m=oe.length()-1;m>=0;m--)ie=ie>>8,ie+=oe.at(m)+ce.at(m),ce.setAt(m,ie&255);$.putBuffer(ce)}H=$,C.putBuffer(re)}return C.truncate(C.length()-y),C},d.pbe.getCipher=function(E,s,v){switch(E){case d.oids.pkcs5PBES2:return d.pbe.getCipherForPBES2(E,s,v);case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case d.oids["pbewithSHAAnd40BitRC2-CBC"]:return d.pbe.getCipherForPKCS12PBE(E,s,v);default:var h=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw h.oid=E,h.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],h}},d.pbe.getCipherForPBES2=function(E,s,v){var h={},y=[];if(!t.validate(s,u,h,y)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}if(E=t.derToOid(h.kdfOid),E!==d.oids.pkcs5PBKDF2){var n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw n.oid=E,n.supportedOids=["pkcs5PBKDF2"],n}if(E=t.derToOid(h.encOid),E!==d.oids["aes128-CBC"]&&E!==d.oids["aes192-CBC"]&&E!==d.oids["aes256-CBC"]&&E!==d.oids["des-EDE3-CBC"]&&E!==d.oids.desCBC){var n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw n.oid=E,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n}var p=h.kdfSalt,m=a.util.createBuffer(h.kdfIterationCount);m=m.getInt(m.length()<<3);var _,w;switch(d.oids[E]){case"aes128-CBC":_=16,w=a.aes.createDecryptionCipher;break;case"aes192-CBC":_=24,w=a.aes.createDecryptionCipher;break;case"aes256-CBC":_=32,w=a.aes.createDecryptionCipher;break;case"des-EDE3-CBC":_=24,w=a.des.createDecryptionCipher;break;case"desCBC":_=8,w=a.des.createDecryptionCipher;break}var C=l(h.prfOid),o=a.pkcs5.pbkdf2(v,p,m,_,C),i=h.encIv,B=w(o);return B.start(i),B},d.pbe.getCipherForPKCS12PBE=function(E,s,v){var h={},y=[];if(!t.validate(s,r,h,y)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}var p=a.util.createBuffer(h.salt),m=a.util.createBuffer(h.iterations);m=m.getInt(m.length()<<3);var _,w,C;switch(E){case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:_=24,w=8,C=a.des.startDecrypting;break;case d.oids["pbewithSHAAnd40BitRC2-CBC"]:_=5,w=8,C=function(q,I){var F=a.rc2.createDecryptionCipher(q,40);return F.start(I,null),F};break;default:var n=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw n.oid=E,n}var o=l(h.prfOid),i=d.pbe.generatePkcs12Key(v,p,1,m,_,o);o.start();var B=d.pbe.generatePkcs12Key(v,p,2,m,w,o);return C(i,B)},d.pbe.opensslDeriveBytes=function(E,s,v,h){if(typeof h>"u"||h===null){if(!("md5"in a.md))throw new Error('"md5" hash algorithm unavailable.');h=a.md.md5.create()}s===null&&(s="");for(var y=[c(h,E+s)],n=16,p=1;n<v;++p,n+=16)y.push(c(h,y[p-1]+E+s));return y.join("").substr(0,v)};function c(E,s){return E.start().update(s).digest().getBytes()}function l(E){var s;if(!E)s="hmacWithSHA1";else if(s=d.oids[t.derToOid(E)],!s){var v=new Error("Unsupported PRF OID.");throw v.oid=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}return b(s)}function b(E){var s=a.md;switch(E){case"hmacWithSHA224":s=a.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var v=new Error("Unsupported PRF algorithm.");throw v.algorithm=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}if(!s||!(E in s))throw new Error("Unknown hash algorithm: "+E);return s[E].create()}function T(E,s,v,h){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,E),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,s.getBytes())]);return h!=="hmacWithSHA1"&&y.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,a.util.hexToBytes(v.toString(16))),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(d.oids[h]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),y}return Pr}var Or={exports:{}},Fr={exports:{}},ja;function Qa(){if(ja)return Fr.exports;ja=1;var a=me();ft(),Ee();var e=a.asn1,t=Fr.exports=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=a.pkcs7||{},a.pkcs7.asn1=t;var d={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};t.contentInfoValidator=d;var x={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};t.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(x)},t.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(x)};var g={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return t.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},d,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[g]}]},t.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},Fr.exports}var Vr={exports:{}},Mr={exports:{}},Ya;function Za(){if(Ya)return Mr.exports;Ya=1;var a=me();Ee(),a.mgf=a.mgf||{};var e=Mr.exports=a.mgf.mgf1=a.mgf1=a.mgf1||{};return e.create=function(t){var d={generate:function(x,g){for(var u=new a.util.ByteBuffer,r=Math.ceil(g/t.digestLength),c=0;c<r;c++){var l=new a.util.ByteBuffer;l.putInt32(c),t.start(),t.update(x+l.getBytes()),u.putBuffer(t.digest())}return u.truncate(u.length()-g),u.getBytes()}};return d},Mr.exports}var Kr,Xa;function yi(){if(Xa)return Kr;Xa=1;var a=me();return Za(),Kr=a.mgf=a.mgf||{},a.mgf.mgf1=a.mgf1,Kr}var zr={exports:{}},$a;function qr(){if($a)return zr.exports;$a=1;var a=me();at(),Ee();var e=zr.exports=a.pss=a.pss||{};return e.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var d=t.md,x=t.mgf,g=d.digestLength,u=t.salt||null;typeof u=="string"&&(u=a.util.createBuffer(u));var r;if("saltLength"in t)r=t.saltLength;else if(u!==null)r=u.length();else throw new Error("Salt length not specified or specific salt not given.");if(u!==null&&u.length()!==r)throw new Error("Given salt length does not match length of given salt.");var c=t.prng||a.random,l={};return l.encode=function(b,T){var E,s=T-1,v=Math.ceil(s/8),h=b.digest().getBytes();if(v<g+r+2)throw new Error("Message is too long to encrypt.");var y;u===null?y=c.getBytesSync(r):y=u.bytes();var n=new a.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(h),n.putBytes(y),d.start(),d.update(n.getBytes());var p=d.digest().getBytes(),m=new a.util.ByteBuffer;m.fillWithByte(0,v-r-g-2),m.putByte(1),m.putBytes(y);var _=m.getBytes(),w=v-g-1,C=x.generate(p,w),o="";for(E=0;E<w;E++)o+=String.fromCharCode(_.charCodeAt(E)^C.charCodeAt(E));var i=65280>>8*v-s&255;return o=String.fromCharCode(o.charCodeAt(0)&~i)+o.substr(1),o+p+"¼"},l.verify=function(b,T,E){var s,v=E-1,h=Math.ceil(v/8);if(T=T.substr(-h),h<g+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(T.charCodeAt(h-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=h-g-1,n=T.substr(0,y),p=T.substr(y,g),m=65280>>8*h-v&255;if((n.charCodeAt(0)&m)!==0)throw new Error("Bits beyond keysize not zero as expected.");var _=x.generate(p,y),w="";for(s=0;s<y;s++)w+=String.fromCharCode(n.charCodeAt(s)^_.charCodeAt(s));w=String.fromCharCode(w.charCodeAt(0)&~m)+w.substr(1);var C=h-g-r-2;for(s=0;s<C;s++)if(w.charCodeAt(s)!==0)throw new Error("Leftmost octets not zero as expected");if(w.charCodeAt(C)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var o=w.substr(-r),i=new a.util.ByteBuffer;i.fillWithByte(0,8),i.putBytes(b),i.putBytes(o),d.start(),d.update(i.getBytes());var B=d.digest().getBytes();return p===B},l},zr.exports}var Ja;function Hr(){if(Ja)return Vr.exports;Ja=1;var a=me();yt(),ft(),qt(),ct(),yi(),mt(),xt(),qr(),jt(),Ee();var e=a.asn1,t=Vr.exports=a.pki=a.pki||{},d=t.oids,x={};x.CN=d.commonName,x.commonName="CN",x.C=d.countryName,x.countryName="C",x.L=d.localityName,x.localityName="L",x.ST=d.stateOrProvinceName,x.stateOrProvinceName="ST",x.O=d.organizationName,x.organizationName="O",x.OU=d.organizationalUnitName,x.organizationalUnitName="OU",x.E=d.emailAddress,x.emailAddress="E";var g=a.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},g,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},r={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},g,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};t.RDNAttributesAsArray=function(C,o){for(var i=[],B,N,q,I=0;I<C.value.length;++I){B=C.value[I];for(var F=0;F<B.value.length;++F)q={},N=B.value[F],q.type=e.derToOid(N.value[0].value),q.value=N.value[1].value,q.valueTagClass=N.value[1].type,q.type in d&&(q.name=d[q.type],q.name in x&&(q.shortName=x[q.name])),o&&(o.update(q.type),o.update(q.value)),i.push(q)}return i},t.CRIAttributesAsArray=function(C){for(var o=[],i=0;i<C.length;++i)for(var B=C[i],N=e.derToOid(B.value[0].value),q=B.value[1].value,I=0;I<q.length;++I){var F={};if(F.type=N,F.value=q[I].value,F.valueTagClass=q[I].type,F.type in d&&(F.name=d[F.type],F.name in x&&(F.shortName=x[F.name])),F.type===d.extensionRequest){F.extensions=[];for(var A=0;A<F.value.length;++A)F.extensions.push(t.certificateExtensionFromAsn1(F.value[A]))}o.push(F)}return o};function b(C,o){typeof o=="string"&&(o={shortName:o});for(var i=null,B,N=0;i===null&&N<C.attributes.length;++N)B=C.attributes[N],(o.type&&o.type===B.type||o.name&&o.name===B.name||o.shortName&&o.shortName===B.shortName)&&(i=B);return i}var T=function(C,o,i){var B={};if(C!==d["RSASSA-PSS"])return B;i&&(B={hash:{algorithmOid:d.sha1},mgf:{algorithmOid:d.mgf1,hash:{algorithmOid:d.sha1}},saltLength:20});var N={},q=[];if(!e.validate(o,r,N,q)){var I=new Error("Cannot read RSASSA-PSS parameter block.");throw I.errors=q,I}return N.hashOid!==void 0&&(B.hash=B.hash||{},B.hash.algorithmOid=e.derToOid(N.hashOid)),N.maskGenOid!==void 0&&(B.mgf=B.mgf||{},B.mgf.algorithmOid=e.derToOid(N.maskGenOid),B.mgf.hash=B.mgf.hash||{},B.mgf.hash.algorithmOid=e.derToOid(N.maskGenHashOid)),N.saltLength!==void 0&&(B.saltLength=N.saltLength.charCodeAt(0)),B},E=function(C){switch(d[C.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return a.md.sha1.create();case"md5WithRSAEncryption":return a.md.md5.create();case"sha256WithRSAEncryption":return a.md.sha256.create();case"sha384WithRSAEncryption":return a.md.sha384.create();case"sha512WithRSAEncryption":return a.md.sha512.create();case"RSASSA-PSS":return a.md.sha256.create();default:var o=new Error("Could not compute "+C.type+" digest. Unknown signature OID.");throw o.signatureOid=C.signatureOid,o}},s=function(C){var o=C.certificate,i;switch(o.signatureOid){case d.sha1WithRSAEncryption:case d.sha1WithRSASignature:break;case d["RSASSA-PSS"]:var B,N;if(B=d[o.signatureParameters.mgf.hash.algorithmOid],B===void 0||a.md[B]===void 0){var q=new Error("Unsupported MGF hash function.");throw q.oid=o.signatureParameters.mgf.hash.algorithmOid,q.name=B,q}if(N=d[o.signatureParameters.mgf.algorithmOid],N===void 0||a.mgf[N]===void 0){var q=new Error("Unsupported MGF function.");throw q.oid=o.signatureParameters.mgf.algorithmOid,q.name=N,q}if(N=a.mgf[N].create(a.md[B].create()),B=d[o.signatureParameters.hash.algorithmOid],B===void 0||a.md[B]===void 0){var q=new Error("Unsupported RSASSA-PSS hash function.");throw q.oid=o.signatureParameters.hash.algorithmOid,q.name=B,q}i=a.pss.create(a.md[B].create(),N,o.signatureParameters.saltLength);break}return o.publicKey.verify(C.md.digest().getBytes(),C.signature,i)};t.certificateFromPem=function(C,o,i){var B=a.pem.decode(C)[0];if(B.type!=="CERTIFICATE"&&B.type!=="X509 CERTIFICATE"&&B.type!=="TRUSTED CERTIFICATE"){var N=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw N.headerType=B.type,N}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var q=e.fromDer(B.body,i);return t.certificateFromAsn1(q,o)},t.certificateToPem=function(C,o){var i={type:"CERTIFICATE",body:e.toDer(t.certificateToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.publicKeyFromPem=function(C){var o=a.pem.decode(C)[0];if(o.type!=="PUBLIC KEY"&&o.type!=="RSA PUBLIC KEY"){var i=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw i.headerType=o.type,i}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var B=e.fromDer(o.body);return t.publicKeyFromAsn1(B)},t.publicKeyToPem=function(C,o){var i={type:"PUBLIC KEY",body:e.toDer(t.publicKeyToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.publicKeyToRSAPublicKeyPem=function(C,o){var i={type:"RSA PUBLIC KEY",body:e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.getPublicKeyFingerprint=function(C,o){o=o||{};var i=o.md||a.md.sha1.create(),B=o.type||"RSAPublicKey",N;switch(B){case"RSAPublicKey":N=e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes();break;case"SubjectPublicKeyInfo":N=e.toDer(t.publicKeyToAsn1(C)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+o.type+'".')}i.start(),i.update(N);var q=i.digest();if(o.encoding==="hex"){var I=q.toHex();return o.delimiter?I.match(/.{2}/g).join(o.delimiter):I}else{if(o.encoding==="binary")return q.getBytes();if(o.encoding)throw new Error('Unknown encoding "'+o.encoding+'".')}return q},t.certificationRequestFromPem=function(C,o,i){var B=a.pem.decode(C)[0];if(B.type!=="CERTIFICATE REQUEST"){var N=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw N.headerType=B.type,N}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var q=e.fromDer(B.body,i);return t.certificationRequestFromAsn1(q,o)},t.certificationRequestToPem=function(C,o){var i={type:"CERTIFICATE REQUEST",body:e.toDer(t.certificationRequestToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.createCertificate=function(){var C={};return C.version=2,C.serialNumber="00",C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.validity={},C.validity.notBefore=new Date,C.validity.notAfter=new Date,C.issuer={},C.issuer.getField=function(o){return b(C.issuer,o)},C.issuer.addField=function(o){h([o]),C.issuer.attributes.push(o)},C.issuer.attributes=[],C.issuer.hash=null,C.subject={},C.subject.getField=function(o){return b(C.subject,o)},C.subject.addField=function(o){h([o]),C.subject.attributes.push(o)},C.subject.attributes=[],C.subject.hash=null,C.extensions=[],C.publicKey=null,C.md=null,C.setSubject=function(o,i){h(o),C.subject.attributes=o,delete C.subject.uniqueId,i&&(C.subject.uniqueId=i),C.subject.hash=null},C.setIssuer=function(o,i){h(o),C.issuer.attributes=o,delete C.issuer.uniqueId,i&&(C.issuer.uniqueId=i),C.issuer.hash=null},C.setExtensions=function(o){for(var i=0;i<o.length;++i)y(o[i],{cert:C});C.extensions=o},C.getExtension=function(o){typeof o=="string"&&(o={name:o});for(var i=null,B,N=0;i===null&&N<C.extensions.length;++N)B=C.extensions[N],(o.id&&B.id===o.id||o.name&&B.name===o.name)&&(i=B);return i},C.sign=function(o,i){C.md=i||a.md.sha1.create();var B=d[C.md.algorithm+"WithRSAEncryption"];if(!B){var N=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw N.algorithm=C.md.algorithm,N}C.signatureOid=C.siginfo.algorithmOid=B,C.tbsCertificate=t.getTBSCertificate(C);var q=e.toDer(C.tbsCertificate);C.md.update(q.getBytes()),C.signature=o.sign(C.md)},C.verify=function(o){var i=!1;if(!C.issued(o)){var B=o.issuer,N=C.subject,q=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw q.expectedIssuer=N.attributes,q.actualIssuer=B.attributes,q}var I=o.md;if(I===null){I=E({signatureOid:o.signatureOid,type:"certificate"});var F=o.tbsCertificate||t.getTBSCertificate(o),A=e.toDer(F);I.update(A.getBytes())}return I!==null&&(i=s({certificate:C,md:I,signature:o.signature})),i},C.isIssuer=function(o){var i=!1,B=C.issuer,N=o.subject;if(B.hash&&N.hash)i=B.hash===N.hash;else if(B.attributes.length===N.attributes.length){i=!0;for(var q,I,F=0;i&&F<B.attributes.length;++F)q=B.attributes[F],I=N.attributes[F],(q.type!==I.type||q.value!==I.value)&&(i=!1)}return i},C.issued=function(o){return o.isIssuer(C)},C.generateSubjectKeyIdentifier=function(){return t.getPublicKeyFingerprint(C.publicKey,{type:"RSAPublicKey"})},C.verifySubjectKeyIdentifier=function(){for(var o=d.subjectKeyIdentifier,i=0;i<C.extensions.length;++i){var B=C.extensions[i];if(B.id===o){var N=C.generateSubjectKeyIdentifier().getBytes();return a.util.hexToBytes(B.subjectKeyIdentifier)===N}}return!1},C},t.certificateFromAsn1=function(C,o){var i={},B=[];if(!e.validate(C,u,i,B)){var N=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw N.errors=B,N}var q=e.derToOid(i.publicKeyOid);if(q!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var I=t.createCertificate();I.version=i.certVersion?i.certVersion.charCodeAt(0):0;var F=a.util.createBuffer(i.certSerialNumber);I.serialNumber=F.toHex(),I.signatureOid=a.asn1.derToOid(i.certSignatureOid),I.signatureParameters=T(I.signatureOid,i.certSignatureParams,!0),I.siginfo.algorithmOid=a.asn1.derToOid(i.certinfoSignatureOid),I.siginfo.parameters=T(I.siginfo.algorithmOid,i.certinfoSignatureParams,!1),I.signature=i.certSignature;var A=[];if(i.certValidity1UTCTime!==void 0&&A.push(e.utcTimeToDate(i.certValidity1UTCTime)),i.certValidity2GeneralizedTime!==void 0&&A.push(e.generalizedTimeToDate(i.certValidity2GeneralizedTime)),i.certValidity3UTCTime!==void 0&&A.push(e.utcTimeToDate(i.certValidity3UTCTime)),i.certValidity4GeneralizedTime!==void 0&&A.push(e.generalizedTimeToDate(i.certValidity4GeneralizedTime)),A.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(A.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(I.validity.notBefore=A[0],I.validity.notAfter=A[1],I.tbsCertificate=i.tbsCertificate,o){I.md=E({signatureOid:I.signatureOid,type:"certificate"});var H=e.toDer(I.tbsCertificate);I.md.update(H.getBytes())}var j=a.md.sha1.create(),W=e.toDer(i.certIssuer);j.update(W.getBytes()),I.issuer.getField=function(oe){return b(I.issuer,oe)},I.issuer.addField=function(oe){h([oe]),I.issuer.attributes.push(oe)},I.issuer.attributes=t.RDNAttributesAsArray(i.certIssuer),i.certIssuerUniqueId&&(I.issuer.uniqueId=i.certIssuerUniqueId),I.issuer.hash=j.digest().toHex();var re=a.md.sha1.create(),J=e.toDer(i.certSubject);return re.update(J.getBytes()),I.subject.getField=function(oe){return b(I.subject,oe)},I.subject.addField=function(oe){h([oe]),I.subject.attributes.push(oe)},I.subject.attributes=t.RDNAttributesAsArray(i.certSubject),i.certSubjectUniqueId&&(I.subject.uniqueId=i.certSubjectUniqueId),I.subject.hash=re.digest().toHex(),i.certExtensions?I.extensions=t.certificateExtensionsFromAsn1(i.certExtensions):I.extensions=[],I.publicKey=t.publicKeyFromAsn1(i.subjectPublicKeyInfo),I},t.certificateExtensionsFromAsn1=function(C){for(var o=[],i=0;i<C.value.length;++i)for(var B=C.value[i],N=0;N<B.value.length;++N)o.push(t.certificateExtensionFromAsn1(B.value[N]));return o},t.certificateExtensionFromAsn1=function(C){var o={};if(o.id=e.derToOid(C.value[0].value),o.critical=!1,C.value[1].type===e.Type.BOOLEAN?(o.critical=C.value[1].value.charCodeAt(0)!==0,o.value=C.value[2].value):o.value=C.value[1].value,o.id in d){if(o.name=d[o.id],o.name==="keyUsage"){var i=e.fromDer(o.value),B=0,N=0;i.value.length>1&&(B=i.value.charCodeAt(1),N=i.value.length>2?i.value.charCodeAt(2):0),o.digitalSignature=(B&128)===128,o.nonRepudiation=(B&64)===64,o.keyEncipherment=(B&32)===32,o.dataEncipherment=(B&16)===16,o.keyAgreement=(B&8)===8,o.keyCertSign=(B&4)===4,o.cRLSign=(B&2)===2,o.encipherOnly=(B&1)===1,o.decipherOnly=(N&128)===128}else if(o.name==="basicConstraints"){var i=e.fromDer(o.value);i.value.length>0&&i.value[0].type===e.Type.BOOLEAN?o.cA=i.value[0].value.charCodeAt(0)!==0:o.cA=!1;var q=null;i.value.length>0&&i.value[0].type===e.Type.INTEGER?q=i.value[0].value:i.value.length>1&&(q=i.value[1].value),q!==null&&(o.pathLenConstraint=e.derToInteger(q))}else if(o.name==="extKeyUsage")for(var i=e.fromDer(o.value),I=0;I<i.value.length;++I){var F=e.derToOid(i.value[I].value);F in d?o[d[F]]=!0:o[F]=!0}else if(o.name==="nsCertType"){var i=e.fromDer(o.value),B=0;i.value.length>1&&(B=i.value.charCodeAt(1)),o.client=(B&128)===128,o.server=(B&64)===64,o.email=(B&32)===32,o.objsign=(B&16)===16,o.reserved=(B&8)===8,o.sslCA=(B&4)===4,o.emailCA=(B&2)===2,o.objCA=(B&1)===1}else if(o.name==="subjectAltName"||o.name==="issuerAltName"){o.altNames=[];for(var A,i=e.fromDer(o.value),H=0;H<i.value.length;++H){A=i.value[H];var j={type:A.type,value:A.value};switch(o.altNames.push(j),A.type){case 1:case 2:case 6:break;case 7:j.ip=a.util.bytesToIP(A.value);break;case 8:j.oid=e.derToOid(A.value);break}}}else if(o.name==="subjectKeyIdentifier"){var i=e.fromDer(o.value);o.subjectKeyIdentifier=a.util.bytesToHex(i.value)}}return o},t.certificationRequestFromAsn1=function(C,o){var i={},B=[];if(!e.validate(C,l,i,B)){var N=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw N.errors=B,N}var q=e.derToOid(i.publicKeyOid);if(q!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var I=t.createCertificationRequest();if(I.version=i.csrVersion?i.csrVersion.charCodeAt(0):0,I.signatureOid=a.asn1.derToOid(i.csrSignatureOid),I.signatureParameters=T(I.signatureOid,i.csrSignatureParams,!0),I.siginfo.algorithmOid=a.asn1.derToOid(i.csrSignatureOid),I.siginfo.parameters=T(I.siginfo.algorithmOid,i.csrSignatureParams,!1),I.signature=i.csrSignature,I.certificationRequestInfo=i.certificationRequestInfo,o){I.md=E({signatureOid:I.signatureOid,type:"certification request"});var F=e.toDer(I.certificationRequestInfo);I.md.update(F.getBytes())}var A=a.md.sha1.create();return I.subject.getField=function(H){return b(I.subject,H)},I.subject.addField=function(H){h([H]),I.subject.attributes.push(H)},I.subject.attributes=t.RDNAttributesAsArray(i.certificationRequestInfoSubject,A),I.subject.hash=A.digest().toHex(),I.publicKey=t.publicKeyFromAsn1(i.subjectPublicKeyInfo),I.getAttribute=function(H){return b(I,H)},I.addAttribute=function(H){h([H]),I.attributes.push(H)},I.attributes=t.CRIAttributesAsArray(i.certificationRequestInfoAttributes||[]),I},t.createCertificationRequest=function(){var C={};return C.version=0,C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.subject={},C.subject.getField=function(o){return b(C.subject,o)},C.subject.addField=function(o){h([o]),C.subject.attributes.push(o)},C.subject.attributes=[],C.subject.hash=null,C.publicKey=null,C.attributes=[],C.getAttribute=function(o){return b(C,o)},C.addAttribute=function(o){h([o]),C.attributes.push(o)},C.md=null,C.setSubject=function(o){h(o),C.subject.attributes=o,C.subject.hash=null},C.setAttributes=function(o){h(o),C.attributes=o},C.sign=function(o,i){C.md=i||a.md.sha1.create();var B=d[C.md.algorithm+"WithRSAEncryption"];if(!B){var N=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw N.algorithm=C.md.algorithm,N}C.signatureOid=C.siginfo.algorithmOid=B,C.certificationRequestInfo=t.getCertificationRequestInfo(C);var q=e.toDer(C.certificationRequestInfo);C.md.update(q.getBytes()),C.signature=o.sign(C.md)},C.verify=function(){var o=!1,i=C.md;if(i===null){i=E({signatureOid:C.signatureOid,type:"certification request"});var B=C.certificationRequestInfo||t.getCertificationRequestInfo(C),N=e.toDer(B);i.update(N.getBytes())}return i!==null&&(o=s({certificate:C,md:i,signature:C.signature})),o},C};function v(C){for(var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),i,B,N=C.attributes,q=0;q<N.length;++q){i=N[q];var I=i.value,F=e.Type.PRINTABLESTRING;"valueTagClass"in i&&(F=i.valueTagClass,F===e.Type.UTF8&&(I=a.util.encodeUtf8(I))),B=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.type).getBytes()),e.create(e.Class.UNIVERSAL,F,!1,I)])]),o.value.push(B)}return o}function h(C){for(var o,i=0;i<C.length;++i){if(o=C[i],typeof o.name>"u"&&(o.type&&o.type in t.oids?o.name=t.oids[o.type]:o.shortName&&o.shortName in x&&(o.name=t.oids[x[o.shortName]])),typeof o.type>"u")if(o.name&&o.name in t.oids)o.type=t.oids[o.name];else{var B=new Error("Attribute type not specified.");throw B.attribute=o,B}if(typeof o.shortName>"u"&&o.name&&o.name in x&&(o.shortName=x[o.name]),o.type===d.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=e.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var N=0;N<o.extensions.length;++N)o.value.push(t.certificateExtensionToAsn1(y(o.extensions[N])))}if(typeof o.value>"u"){var B=new Error("Attribute value not specified.");throw B.attribute=o,B}}}function y(C,o){if(o=o||{},typeof C.name>"u"&&C.id&&C.id in t.oids&&(C.name=t.oids[C.id]),typeof C.id>"u")if(C.name&&C.name in t.oids)C.id=t.oids[C.name];else{var i=new Error("Extension ID not specified.");throw i.extension=C,i}if(typeof C.value<"u")return C;if(C.name==="keyUsage"){var B=0,N=0,q=0;C.digitalSignature&&(N|=128,B=7),C.nonRepudiation&&(N|=64,B=6),C.keyEncipherment&&(N|=32,B=5),C.dataEncipherment&&(N|=16,B=4),C.keyAgreement&&(N|=8,B=3),C.keyCertSign&&(N|=4,B=2),C.cRLSign&&(N|=2,B=1),C.encipherOnly&&(N|=1,B=0),C.decipherOnly&&(q|=128,B=7);var I=String.fromCharCode(B);q!==0?I+=String.fromCharCode(N)+String.fromCharCode(q):N!==0&&(I+=String.fromCharCode(N)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,I)}else if(C.name==="basicConstraints")C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),C.cA&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in C&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.pathLenConstraint).getBytes()));else if(C.name==="extKeyUsage"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=C.value.value;for(var A in C)C[A]===!0&&(A in d?F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d[A]).getBytes())):A.indexOf(".")!==-1&&F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(A).getBytes())))}else if(C.name==="nsCertType"){var B=0,N=0;C.client&&(N|=128,B=7),C.server&&(N|=64,B=6),C.email&&(N|=32,B=5),C.objsign&&(N|=16,B=4),C.reserved&&(N|=8,B=3),C.sslCA&&(N|=4,B=2),C.emailCA&&(N|=2,B=1),C.objCA&&(N|=1,B=0);var I=String.fromCharCode(B);N!==0&&(I+=String.fromCharCode(N)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,I)}else if(C.name==="subjectAltName"||C.name==="issuerAltName"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var H,j=0;j<C.altNames.length;++j){H=C.altNames[j];var I=H.value;if(H.type===7&&H.ip){if(I=a.util.bytesFromIP(H.ip),I===null){var i=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw i.extension=C,i}}else H.type===8&&(H.oid?I=e.oidToDer(e.oidToDer(H.oid)):I=e.oidToDer(I));C.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,H.type,!1,I))}}else if(C.name==="nsComment"&&o.cert){if(!/^[\x00-\x7F]*$/.test(C.comment)||C.comment.length<1||C.comment.length>128)throw new Error('Invalid "nsComment" content.');C.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,C.comment)}else if(C.name==="subjectKeyIdentifier"&&o.cert){var W=o.cert.generateSubjectKeyIdentifier();C.subjectKeyIdentifier=W.toHex(),C.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,W.getBytes())}else if(C.name==="authorityKeyIdentifier"&&o.cert){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=C.value.value;if(C.keyIdentifier){var re=C.keyIdentifier===!0?o.cert.generateSubjectKeyIdentifier().getBytes():C.keyIdentifier;F.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,re))}if(C.authorityCertIssuer){var J=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[v(C.authorityCertIssuer===!0?o.cert.issuer:C.authorityCertIssuer)])];F.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,J))}if(C.serialNumber){var oe=a.util.hexToBytes(C.serialNumber===!0?o.cert.serialNumber:C.serialNumber);F.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,oe))}}else if(C.name==="cRLDistributionPoints"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var F=C.value.value,Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),$=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),H,j=0;j<C.altNames.length;++j){H=C.altNames[j];var I=H.value;if(H.type===7&&H.ip){if(I=a.util.bytesFromIP(H.ip),I===null){var i=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw i.extension=C,i}}else H.type===8&&(H.oid?I=e.oidToDer(e.oidToDer(H.oid)):I=e.oidToDer(I));$.value.push(e.create(e.Class.CONTEXT_SPECIFIC,H.type,!1,I))}Q.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[$])),F.push(Q)}if(typeof C.value>"u"){var i=new Error("Extension value not specified.");throw i.extension=C,i}return C}function n(C,o){switch(C){case d["RSASSA-PSS"]:var i=[];return o.hash.algorithmOid!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),o.mgf.algorithmOid!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),o.saltLength!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(o.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,i);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function p(C){var o=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(C.attributes.length===0)return o;for(var i=C.attributes,B=0;B<i.length;++B){var N=i[B],q=N.value,I=e.Type.UTF8;"valueTagClass"in N&&(I=N.valueTagClass),I===e.Type.UTF8&&(q=a.util.encodeUtf8(q));var F=!1;"valueConstructed"in N&&(F=N.valueConstructed);var A=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(N.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,I,F,q)])]);o.value.push(A)}return o}var m=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function w(C){return C>=m&&C<_?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(C)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(C))}return t.getTBSCertificate=function(C){var o=w(C.validity.notBefore),i=w(C.validity.notAfter),B=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(C.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.siginfo.algorithmOid).getBytes()),n(C.siginfo.algorithmOid,C.siginfo.parameters)]),v(C.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,i]),v(C.subject),t.publicKeyToAsn1(C.publicKey)]);return C.issuer.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.issuer.uniqueId)])),C.subject.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.subject.uniqueId)])),C.extensions.length>0&&B.value.push(t.certificateExtensionsToAsn1(C.extensions)),B},t.getCertificationRequestInfo=function(C){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes()),v(C.subject),t.publicKeyToAsn1(C.publicKey),p(C)]);return o},t.distinguishedNameToAsn1=function(C){return v(C)},t.certificateToAsn1=function(C){var o=C.tbsCertificate||t.getTBSCertificate(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),n(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.certificateExtensionsToAsn1=function(C){var o=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),i=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);o.value.push(i);for(var B=0;B<C.length;++B)i.value.push(t.certificateExtensionToAsn1(C[B]));return o},t.certificateExtensionToAsn1=function(C){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.id).getBytes())),C.critical&&o.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var i=C.value;return typeof C.value!="string"&&(i=e.toDer(i).getBytes()),o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i)),o},t.certificationRequestToAsn1=function(C){var o=C.certificationRequestInfo||t.getCertificationRequestInfo(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),n(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.createCaStore=function(C){var o={certs:{}};o.getIssuer=function(I){var F=i(I.issuer);return F},o.addCertificate=function(I){if(typeof I=="string"&&(I=a.pki.certificateFromPem(I)),B(I.subject),!o.hasCertificate(I))if(I.subject.hash in o.certs){var F=o.certs[I.subject.hash];a.util.isArray(F)||(F=[F]),F.push(I),o.certs[I.subject.hash]=F}else o.certs[I.subject.hash]=I},o.hasCertificate=function(I){typeof I=="string"&&(I=a.pki.certificateFromPem(I));var F=i(I.subject);if(!F)return!1;a.util.isArray(F)||(F=[F]);for(var A=e.toDer(t.certificateToAsn1(I)).getBytes(),H=0;H<F.length;++H){var j=e.toDer(t.certificateToAsn1(F[H])).getBytes();if(A===j)return!0}return!1},o.listAllCertificates=function(){var I=[];for(var F in o.certs)if(o.certs.hasOwnProperty(F)){var A=o.certs[F];if(!a.util.isArray(A))I.push(A);else for(var H=0;H<A.length;++H)I.push(A[H])}return I},o.removeCertificate=function(I){var F;if(typeof I=="string"&&(I=a.pki.certificateFromPem(I)),B(I.subject),!o.hasCertificate(I))return null;var A=i(I.subject);if(!a.util.isArray(A))return F=o.certs[I.subject.hash],delete o.certs[I.subject.hash],F;for(var H=e.toDer(t.certificateToAsn1(I)).getBytes(),j=0;j<A.length;++j){var W=e.toDer(t.certificateToAsn1(A[j])).getBytes();H===W&&(F=A[j],A.splice(j,1))}return A.length===0&&delete o.certs[I.subject.hash],F};function i(I){return B(I),o.certs[I.hash]||null}function B(I){if(!I.hash){var F=a.md.sha1.create();I.attributes=t.RDNAttributesAsArray(v(I),F),I.hash=F.digest().toHex()}}if(C)for(var N=0;N<C.length;++N){var q=C[N];o.addCertificate(q)}return o},t.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},t.verifyCertificateChain=function(C,o,i){typeof i=="function"&&(i={verify:i}),i=i||{},o=o.slice(0);var B=o.slice(0),N=i.validityCheckDate;typeof N>"u"&&(N=new Date);var q=!0,I=null,F=0;do{var A=o.shift(),H=null,j=!1;if(N&&(N<A.validity.notBefore||N>A.validity.notAfter)&&(I={message:"Certificate is not valid yet or has expired.",error:t.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:N}),I===null){if(H=o[0]||C.getIssuer(A),H===null&&A.isIssuer(A)&&(j=!0,H=A),H){var W=H;a.util.isArray(W)||(W=[W]);for(var re=!1;!re&&W.length>0;){H=W.shift();try{re=H.verify(A)}catch{}}re||(I={message:"Certificate signature is invalid.",error:t.certificateError.bad_certificate})}I===null&&(!H||j)&&!C.hasCertificate(A)&&(I={message:"Certificate is not trusted.",error:t.certificateError.unknown_ca})}if(I===null&&H&&!A.isIssuer(H)&&(I={message:"Certificate issuer is invalid.",error:t.certificateError.bad_certificate}),I===null)for(var J={keyUsage:!0,basicConstraints:!0},oe=0;I===null&&oe<A.extensions.length;++oe){var Q=A.extensions[oe];Q.critical&&!(Q.name in J)&&(I={message:"Certificate has an unsupported critical extension.",error:t.certificateError.unsupported_certificate})}if(I===null&&(!q||o.length===0&&(!H||j))){var $=A.getExtension("basicConstraints"),ce=A.getExtension("keyUsage");if(ce!==null&&(!ce.keyCertSign||$===null)&&(I={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:t.certificateError.bad_certificate}),I===null&&$===null&&(I={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:t.certificateError.bad_certificate}),I===null&&$!==null&&!$.cA&&(I={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:t.certificateError.bad_certificate}),I===null&&ce!==null&&"pathLenConstraint"in $){var ie=F-1;ie>$.pathLenConstraint&&(I={message:"Certificate basicConstraints pathLenConstraint violated.",error:t.certificateError.bad_certificate})}}var ee=I===null?!0:I.error,ue=i.verify?i.verify(ee,F,B):ee;if(ue===!0)I=null;else throw ee===!0&&(I={message:"The application rejected the certificate.",error:t.certificateError.bad_certificate}),(ue||ue===0)&&(typeof ue=="object"&&!a.util.isArray(ue)?(ue.message&&(I.message=ue.message),ue.error&&(I.error=ue.error)):typeof ue=="string"&&(I.error=ue)),I;q=!1,++F}while(o.length>0);return!0},Vr.exports}var en;function tn(){if(en)return Or.exports;en=1;var a=me();ft(),Rt(),mt(),Qa(),Wa(),at(),jt(),Nt(),Ee(),Hr();var e=a.asn1,t=a.pki,d=Or.exports=a.pkcs12=a.pkcs12||{},x={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},g={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},x,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},u={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},r={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(h,y,n,p){for(var m=[],_=0;_<h.length;_++)for(var w=0;w<h[_].safeBags.length;w++){var C=h[_].safeBags[w];if(!(p!==void 0&&C.type!==p)){if(y===null){m.push(C);continue}C.attributes[y]!==void 0&&C.attributes[y].indexOf(n)>=0&&m.push(C)}}return m}d.pkcs12FromAsn1=function(h,y,n){typeof y=="string"?(n=y,y=!0):y===void 0&&(y=!0);var p={},m=[];if(!e.validate(h,g,p,m)){var _=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw _.errors=_,_}var w={version:p.version.charCodeAt(0),safeContents:[],getBags:function(H){var j={},W;return"localKeyId"in H?W=H.localKeyId:"localKeyIdHex"in H&&(W=a.util.hexToBytes(H.localKeyIdHex)),W===void 0&&!("friendlyName"in H)&&"bagType"in H&&(j[H.bagType]=l(w.safeContents,null,null,H.bagType)),W!==void 0&&(j.localKeyId=l(w.safeContents,"localKeyId",W,H.bagType)),"friendlyName"in H&&(j.friendlyName=l(w.safeContents,"friendlyName",H.friendlyName,H.bagType)),j},getBagsByFriendlyName:function(H,j){return l(w.safeContents,"friendlyName",H,j)},getBagsByLocalKeyId:function(H,j){return l(w.safeContents,"localKeyId",H,j)}};if(p.version.charCodeAt(0)!==3){var _=new Error("PKCS#12 PFX of version other than 3 not supported.");throw _.version=p.version.charCodeAt(0),_}if(e.derToOid(p.contentType)!==t.oids.data){var _=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw _.oid=e.derToOid(p.contentType),_}var C=p.content.value[0];if(C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(C=b(C),p.mac){var o=null,i=0,B=e.derToOid(p.macAlgorithm);switch(B){case t.oids.sha1:o=a.md.sha1.create(),i=20;break;case t.oids.sha256:o=a.md.sha256.create(),i=32;break;case t.oids.sha384:o=a.md.sha384.create(),i=48;break;case t.oids.sha512:o=a.md.sha512.create(),i=64;break;case t.oids.md5:o=a.md.md5.create(),i=16;break}if(o===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+B);var N=new a.util.ByteBuffer(p.macSalt),q="macIterations"in p?parseInt(a.util.bytesToHex(p.macIterations),16):1,I=d.generateKey(n,N,3,q,i,o),F=a.hmac.create();F.start(o,I),F.update(C.value);var A=F.getMac();if(A.getBytes()!==p.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(h.value)&&h.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return T(w,C.value,y,n),w};function b(h){if(h.composed||h.constructed){for(var y=a.util.createBuffer(),n=0;n<h.value.length;++n)y.putBytes(h.value[n].value);h.composed=h.constructed=!1,h.value=y.getBytes()}return h}function T(h,y,n,p){if(y=e.fromDer(y,n),y.tagClass!==e.Class.UNIVERSAL||y.type!==e.Type.SEQUENCE||y.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var m=0;m<y.value.length;m++){var _=y.value[m],w={},C=[];if(!e.validate(_,x,w,C)){var o=new Error("Cannot read ContentInfo.");throw o.errors=C,o}var i={encrypted:!1},B=null,N=w.content.value[0];switch(e.derToOid(w.contentType)){case t.oids.data:if(N.tagClass!==e.Class.UNIVERSAL||N.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");B=b(N).value;break;case t.oids.encryptedData:B=E(N,p),i.encrypted=!0;break;default:var o=new Error("Unsupported PKCS#12 contentType.");throw o.contentType=e.derToOid(w.contentType),o}i.safeBags=s(B,n,p),h.safeContents.push(i)}}function E(h,y){var n={},p=[];if(!e.validate(h,a.pkcs7.asn1.encryptedDataValidator,n,p)){var m=new Error("Cannot read EncryptedContentInfo.");throw m.errors=p,m}var _=e.derToOid(n.contentType);if(_!==t.oids.data){var m=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw m.oid=_,m}_=e.derToOid(n.encAlgorithm);var w=t.pbe.getCipher(_,n.encParameter,y),C=b(n.encryptedContentAsn1),o=a.util.createBuffer(C.value);if(w.update(o),!w.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return w.output.getBytes()}function s(h,y,n){if(!y&&h.length===0)return[];if(h=e.fromDer(h,y),h.tagClass!==e.Class.UNIVERSAL||h.type!==e.Type.SEQUENCE||h.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var p=[],m=0;m<h.value.length;m++){var _=h.value[m],w={},C=[];if(!e.validate(_,u,w,C)){var o=new Error("Cannot read SafeBag.");throw o.errors=C,o}var i={type:e.derToOid(w.bagId),attributes:v(w.bagAttributes)};p.push(i);var B,N,q=w.bagValue.value[0];switch(i.type){case t.oids.pkcs8ShroudedKeyBag:if(q=t.decryptPrivateKeyInfo(q,n),q===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case t.oids.keyBag:try{i.key=t.privateKeyFromAsn1(q)}catch{i.key=null,i.asn1=q}continue;case t.oids.certBag:B=c,N=function(){if(e.derToOid(w.certId)!==t.oids.x509Certificate){var F=new Error("Unsupported certificate type, only X.509 supported.");throw F.oid=e.derToOid(w.certId),F}var A=e.fromDer(w.cert,y);try{i.cert=t.certificateFromAsn1(A,!0)}catch{i.cert=null,i.asn1=A}};break;default:var o=new Error("Unsupported PKCS#12 SafeBag type.");throw o.oid=i.type,o}if(B!==void 0&&!e.validate(q,B,w,C)){var o=new Error("Cannot read PKCS#12 "+B.name);throw o.errors=C,o}N()}return p}function v(h){var y={};if(h!==void 0)for(var n=0;n<h.length;++n){var p={},m=[];if(!e.validate(h[n],r,p,m)){var _=new Error("Cannot read PKCS#12 BagAttribute.");throw _.errors=m,_}var w=e.derToOid(p.oid);if(t.oids[w]!==void 0){y[t.oids[w]]=[];for(var C=0;C<p.values.length;++C)y[t.oids[w]].push(p.values[C].value)}}return y}return d.toPkcs12Asn1=function(h,y,n,p){p=p||{},p.saltSize=p.saltSize||8,p.count=p.count||2048,p.algorithm=p.algorithm||p.encAlgorithm||"aes128","useMac"in p||(p.useMac=!0),"localKeyId"in p||(p.localKeyId=null),"generateLocalKeyId"in p||(p.generateLocalKeyId=!0);var m=p.localKeyId,_;if(m!==null)m=a.util.hexToBytes(m);else if(p.generateLocalKeyId)if(y){var w=a.util.isArray(y)?y[0]:y;typeof w=="string"&&(w=t.certificateFromPem(w));var C=a.md.sha1.create();C.update(e.toDer(t.certificateToAsn1(w)).getBytes()),m=C.digest().getBytes()}else m=a.random.getBytes(20);var o=[];m!==null&&o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,m)])])),"friendlyName"in p&&o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,p.friendlyName)])])),o.length>0&&(_=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,o));var i=[],B=[];y!==null&&(a.util.isArray(y)?B=y:B=[y]);for(var N=[],q=0;q<B.length;++q){y=B[q],typeof y=="string"&&(y=t.certificateFromPem(y));var I=q===0?_:void 0,F=t.certificateToAsn1(y),A=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(F).getBytes())])])]),I]);N.push(A)}if(N.length>0){var H=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,N),j=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(H).getBytes())])]);i.push(j)}var W=null;if(h!==null){var re=t.wrapRsaPrivateKey(t.privateKeyToAsn1(h));n===null?W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[re]),_]):W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[t.encryptPrivateKeyInfo(re,n,p)]),_]);var J=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[W]),oe=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(J).getBytes())])]);i.push(oe)}var Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,i),$;if(p.useMac){var C=a.md.sha1.create(),ce=new a.util.ByteBuffer(a.random.getBytes(p.saltSize)),ie=p.count,h=d.generateKey(n,ce,3,ie,20),ee=a.hmac.create();ee.start(C,h),ee.update(e.toDer(Q).getBytes());var ue=ee.getMac();$=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ue.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ce.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(ie).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(Q).getBytes())])]),$])},d.generateKey=a.pbe.generatePkcs12Key,Or.exports}var rn;function an(){if(rn)return _r.exports;rn=1;var a=me();ft(),mt(),Wa(),xt(),wr(),tn(),qr(),jt(),Ee(),Hr();var e=a.asn1,t=_r.exports=a.pki=a.pki||{};return t.pemToDer=function(d){var x=a.pem.decode(d)[0];if(x.procType&&x.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(x.body)},t.privateKeyFromPem=function(d){var x=a.pem.decode(d)[0];if(x.type!=="PRIVATE KEY"&&x.type!=="RSA PRIVATE KEY"){var g=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw g.headerType=x.type,g}if(x.procType&&x.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var u=e.fromDer(x.body);return t.privateKeyFromAsn1(u)},t.privateKeyToPem=function(d,x){var g={type:"RSA PRIVATE KEY",body:e.toDer(t.privateKeyToAsn1(d)).getBytes()};return a.pem.encode(g,{maxline:x})},t.privateKeyInfoToPem=function(d,x){var g={type:"PRIVATE KEY",body:e.toDer(d).getBytes()};return a.pem.encode(g,{maxline:x})},_r.exports}var Gr,nn;function sn(){if(nn)return Gr;nn=1;var a=me();ft(),Rt(),Sr(),xt(),an(),at(),Nt(),Ee();var e=function(k,O,P,D){var S=a.util.createBuffer(),f=k.length>>1,L=f+(k.length&1),G=k.substr(0,L),M=k.substr(f,L),V=a.util.createBuffer(),K=a.hmac.create();P=O+P;var X=Math.ceil(D/16),te=Math.ceil(D/20);K.start("MD5",G);var Y=a.util.createBuffer();V.putBytes(P);for(var ae=0;ae<X;++ae)K.start(null,null),K.update(V.getBytes()),V.putBuffer(K.digest()),K.start(null,null),K.update(V.bytes()+P),Y.putBuffer(K.digest());K.start("SHA1",M);var fe=a.util.createBuffer();V.clear(),V.putBytes(P);for(var ae=0;ae<te;++ae)K.start(null,null),K.update(V.getBytes()),V.putBuffer(K.digest()),K.start(null,null),K.update(V.bytes()+P),fe.putBuffer(K.digest());return S.putBytes(a.util.xorBytes(Y.getBytes(),fe.getBytes(),D)),S},t=function(k,O,P){var D=a.hmac.create();D.start("SHA1",k);var S=a.util.createBuffer();return S.putInt32(O[0]),S.putInt32(O[1]),S.putByte(P.type),S.putByte(P.version.major),S.putByte(P.version.minor),S.putInt16(P.length),S.putBytes(P.fragment.bytes()),D.update(S.getBytes()),D.digest().getBytes()},d=function(k,O,P){var D=!1;try{var S=k.deflate(O.fragment.getBytes());O.fragment=a.util.createBuffer(S),O.length=S.length,D=!0}catch{}return D},x=function(k,O,P){var D=!1;try{var S=k.inflate(O.fragment.getBytes());O.fragment=a.util.createBuffer(S),O.length=S.length,D=!0}catch{}return D},g=function(k,O){var P=0;switch(O){case 1:P=k.getByte();break;case 2:P=k.getInt16();break;case 3:P=k.getInt24();break;case 4:P=k.getInt32();break}return a.util.createBuffer(k.getBytes(P))},u=function(k,O,P){k.putInt(P.length(),O<<3),k.putBuffer(P)},r={};r.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},r.SupportedVersions=[r.Versions.TLS_1_1,r.Versions.TLS_1_0],r.Version=r.SupportedVersions[0],r.MaxFragment=15360,r.ConnectionEnd={server:0,client:1},r.PRFAlgorithm={tls_prf_sha256:0},r.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},r.CipherType={stream:0,block:1,aead:2},r.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},r.CompressionMethod={none:0,deflate:1},r.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},r.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},r.Alert={},r.Alert.Level={warning:1,fatal:2},r.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},r.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},r.CipherSuites={},r.getCipherSuite=function(k){var O=null;for(var P in r.CipherSuites){var D=r.CipherSuites[P];if(D.id[0]===k.charCodeAt(0)&&D.id[1]===k.charCodeAt(1)){O=D;break}}return O},r.handleUnexpected=function(k,O){var P=!k.open&&k.entity===r.ConnectionEnd.client;P||k.error(k,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})},r.handleHelloRequest=function(k,O,P){!k.handshaking&&k.handshakes>0&&(r.queue(k,r.createAlert(k,{level:r.Alert.Level.warning,description:r.Alert.Description.no_renegotiation})),r.flush(k)),k.process()},r.parseHelloMessage=function(k,O,P){var D=null,S=k.entity===r.ConnectionEnd.client;if(P<38)k.error(k,{message:S?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});else{var f=O.fragment,L=f.length();if(D={version:{major:f.getByte(),minor:f.getByte()},random:a.util.createBuffer(f.getBytes(32)),session_id:g(f,1),extensions:[]},S?(D.cipher_suite=f.getBytes(2),D.compression_method=f.getByte()):(D.cipher_suites=g(f,2),D.compression_methods=g(f,1)),L=P-(L-f.length()),L>0){for(var G=g(f,2);G.length()>0;)D.extensions.push({type:[G.getByte(),G.getByte()],data:g(G,2)});if(!S)for(var M=0;M<D.extensions.length;++M){var V=D.extensions[M];if(V.type[0]===0&&V.type[1]===0)for(var K=g(V.data,2);K.length()>0;){var X=K.getByte();if(X!==0)break;k.session.extensions.server_name.serverNameList.push(g(K,2).getBytes())}}}if(k.session.version&&(D.version.major!==k.session.version.major||D.version.minor!==k.session.version.minor))return k.error(k,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});if(S)k.session.cipherSuite=r.getCipherSuite(D.cipher_suite);else for(var te=a.util.createBuffer(D.cipher_suites.bytes());te.length()>0&&(k.session.cipherSuite=r.getCipherSuite(te.getBytes(2)),k.session.cipherSuite===null););if(k.session.cipherSuite===null)return k.error(k,{message:"No cipher suites in common.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(D.cipher_suite)});S?k.session.compressionMethod=D.compression_method:k.session.compressionMethod=r.CompressionMethod.none}return D},r.createSecurityParameters=function(k,O){var P=k.entity===r.ConnectionEnd.client,D=O.random.bytes(),S=P?k.session.sp.client_random:D,f=P?D:r.createRandom().getBytes();k.session.sp={entity:k.entity,prf_algorithm:r.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:k.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:S,server_random:f}},r.handleServerHello=function(k,O,P){var D=r.parseHelloMessage(k,O,P);if(!k.fail){if(D.version.minor<=k.version.minor)k.version.minor=D.version.minor;else return k.error(k,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});k.session.version=k.version;var S=D.session_id.bytes();S.length>0&&S===k.session.id?(k.expect=s,k.session.resuming=!0,k.session.sp.server_random=D.random.bytes()):(k.expect=l,k.session.resuming=!1,r.createSecurityParameters(k,D)),k.session.id=S,k.process()}},r.handleClientHello=function(k,O,P){var D=r.parseHelloMessage(k,O,P);if(!k.fail){var S=D.session_id.bytes(),f=null;if(k.sessionCache&&(f=k.sessionCache.getSession(S),f===null?S="":(f.version.major!==D.version.major||f.version.minor>D.version.minor)&&(f=null,S="")),S.length===0&&(S=a.random.getBytes(32)),k.session.id=S,k.session.clientHelloVersion=D.version,k.session.sp={},f)k.version=k.session.version=f.version,k.session.sp=f.sp;else{for(var L,G=1;G<r.SupportedVersions.length&&(L=r.SupportedVersions[G],!(L.minor<=D.version.minor));++G);k.version={major:L.major,minor:L.minor},k.session.version=k.version}f!==null?(k.expect=w,k.session.resuming=!0,k.session.sp.client_random=D.random.bytes()):(k.expect=k.verifyClient!==!1?p:m,k.session.resuming=!1,r.createSecurityParameters(k,D)),k.open=!0,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerHello(k)})),k.session.resuming?(r.queue(k,r.createRecord(k,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),k.state.pending=r.createConnectionState(k),k.state.current.write=k.state.pending.write,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createFinished(k)}))):(r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificate(k)})),k.fail||(r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerKeyExchange(k)})),k.verifyClient!==!1&&r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificateRequest(k)})),r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerHelloDone(k)})))),r.flush(k),k.process()}},r.handleCertificate=function(k,O,P){if(P<3)return k.error(k,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment,S={certificate_list:g(D,3)},f,L,G=[];try{for(;S.certificate_list.length()>0;)f=g(S.certificate_list,3),L=a.asn1.fromDer(f),f=a.pki.certificateFromAsn1(L,!0),G.push(f)}catch(V){return k.error(k,{message:"Could not parse certificate list.",cause:V,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var M=k.entity===r.ConnectionEnd.client;(M||k.verifyClient===!0)&&G.length===0?k.error(k,{message:M?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}}):G.length===0?k.expect=M?b:m:(M?k.session.serverCertificate=G[0]:k.session.clientCertificate=G[0],r.verifyCertificateChain(k,G)&&(k.expect=M?b:m)),k.process()},r.handleServerKeyExchange=function(k,O,P){if(P>0)return k.error(k,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});k.expect=T,k.process()},r.handleClientKeyExchange=function(k,O,P){if(P<48)return k.error(k,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});var D=O.fragment,S={enc_pre_master_secret:g(D,2).getBytes()},f=null;if(k.getPrivateKey)try{f=k.getPrivateKey(k,k.session.serverCertificate),f=a.pki.privateKeyFromPem(f)}catch(M){k.error(k,{message:"Could not get private key.",cause:M,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}if(f===null)return k.error(k,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}});try{var L=k.session.sp;L.pre_master_secret=f.decrypt(S.enc_pre_master_secret);var G=k.session.clientHelloVersion;if(G.major!==L.pre_master_secret.charCodeAt(0)||G.minor!==L.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{L.pre_master_secret=a.random.getBytes(48)}k.expect=w,k.session.clientCertificate!==null&&(k.expect=_),k.process()},r.handleCertificateRequest=function(k,O,P){if(P<3)return k.error(k,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment,S={certificate_types:g(D,1),certificate_authorities:g(D,2)};k.session.certificateRequest=S,k.expect=E,k.process()},r.handleCertificateVerify=function(k,O,P){if(P<2)return k.error(k,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment;D.read-=4;var S=D.bytes();D.read+=4;var f={signature:g(D,2).getBytes()},L=a.util.createBuffer();L.putBuffer(k.session.md5.digest()),L.putBuffer(k.session.sha1.digest()),L=L.getBytes();try{var G=k.session.clientCertificate;if(!G.publicKey.verify(L,f.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");k.session.md5.update(S),k.session.sha1.update(S)}catch{return k.error(k,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure}})}k.expect=w,k.process()},r.handleServerHelloDone=function(k,O,P){if(P>0)return k.error(k,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.record_overflow}});if(k.serverCertificate===null){var D={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.insufficient_security}},S=0,f=k.verify(k,D.alert.description,S,[]);if(f!==!0)return(f||f===0)&&(typeof f=="object"&&!a.util.isArray(f)?(f.message&&(D.message=f.message),f.alert&&(D.alert.description=f.alert)):typeof f=="number"&&(D.alert.description=f)),k.error(k,D)}k.session.certificateRequest!==null&&(O=r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificate(k)}),r.queue(k,O)),O=r.createRecord(k,{type:r.ContentType.handshake,data:r.createClientKeyExchange(k)}),r.queue(k,O),k.expect=y;var L=function(G,M){G.session.certificateRequest!==null&&G.session.clientCertificate!==null&&r.queue(G,r.createRecord(G,{type:r.ContentType.handshake,data:r.createCertificateVerify(G,M)})),r.queue(G,r.createRecord(G,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),G.state.pending=r.createConnectionState(G),G.state.current.write=G.state.pending.write,r.queue(G,r.createRecord(G,{type:r.ContentType.handshake,data:r.createFinished(G)})),G.expect=s,r.flush(G),G.process()};if(k.session.certificateRequest===null||k.session.clientCertificate===null)return L(k,null);r.getClientSignature(k,L)},r.handleChangeCipherSpec=function(k,O){if(O.fragment.getByte()!==1)return k.error(k,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var P=k.entity===r.ConnectionEnd.client;(k.session.resuming&&P||!k.session.resuming&&!P)&&(k.state.pending=r.createConnectionState(k)),k.state.current.read=k.state.pending.read,(!k.session.resuming&&P||k.session.resuming&&!P)&&(k.state.pending=null),k.expect=P?v:C,k.process()},r.handleFinished=function(k,O,P){var D=O.fragment;D.read-=4;var S=D.bytes();D.read+=4;var f=O.fragment.getBytes();D=a.util.createBuffer(),D.putBuffer(k.session.md5.digest()),D.putBuffer(k.session.sha1.digest());var L=k.entity===r.ConnectionEnd.client,G=L?"server finished":"client finished",M=k.session.sp,V=12,K=e;if(D=K(M.master_secret,G,D.getBytes(),V),D.getBytes()!==f)return k.error(k,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decrypt_error}});k.session.md5.update(S),k.session.sha1.update(S),(k.session.resuming&&L||!k.session.resuming&&!L)&&(r.queue(k,r.createRecord(k,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),k.state.current.write=k.state.pending.write,k.state.pending=null,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createFinished(k)}))),k.expect=L?h:o,k.handshaking=!1,++k.handshakes,k.peerCertificate=L?k.session.serverCertificate:k.session.clientCertificate,r.flush(k),k.isConnected=!0,k.connected(k),k.process()},r.handleAlert=function(k,O){var P=O.fragment,D={level:P.getByte(),description:P.getByte()},S;switch(D.description){case r.Alert.Description.close_notify:S="Connection closed.";break;case r.Alert.Description.unexpected_message:S="Unexpected message.";break;case r.Alert.Description.bad_record_mac:S="Bad record MAC.";break;case r.Alert.Description.decryption_failed:S="Decryption failed.";break;case r.Alert.Description.record_overflow:S="Record overflow.";break;case r.Alert.Description.decompression_failure:S="Decompression failed.";break;case r.Alert.Description.handshake_failure:S="Handshake failure.";break;case r.Alert.Description.bad_certificate:S="Bad certificate.";break;case r.Alert.Description.unsupported_certificate:S="Unsupported certificate.";break;case r.Alert.Description.certificate_revoked:S="Certificate revoked.";break;case r.Alert.Description.certificate_expired:S="Certificate expired.";break;case r.Alert.Description.certificate_unknown:S="Certificate unknown.";break;case r.Alert.Description.illegal_parameter:S="Illegal parameter.";break;case r.Alert.Description.unknown_ca:S="Unknown certificate authority.";break;case r.Alert.Description.access_denied:S="Access denied.";break;case r.Alert.Description.decode_error:S="Decode error.";break;case r.Alert.Description.decrypt_error:S="Decrypt error.";break;case r.Alert.Description.export_restriction:S="Export restriction.";break;case r.Alert.Description.protocol_version:S="Unsupported protocol version.";break;case r.Alert.Description.insufficient_security:S="Insufficient security.";break;case r.Alert.Description.internal_error:S="Internal error.";break;case r.Alert.Description.user_canceled:S="User canceled.";break;case r.Alert.Description.no_renegotiation:S="Renegotiation not supported.";break;default:S="Unknown error.";break}if(D.description===r.Alert.Description.close_notify)return k.close();k.error(k,{message:S,send:!1,origin:k.entity===r.ConnectionEnd.client?"server":"client",alert:D}),k.process()},r.handleHandshake=function(k,O){var P=O.fragment,D=P.getByte(),S=P.getInt24();if(S>P.length())return k.fragmented=O,O.fragment=a.util.createBuffer(),P.read-=4,k.process();k.fragmented=null,P.read-=4;var f=P.bytes(S+4);P.read+=4,D in $[k.entity][k.expect]?(k.entity===r.ConnectionEnd.server&&!k.open&&!k.fail&&(k.handshaking=!0,k.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),D!==r.HandshakeType.hello_request&&D!==r.HandshakeType.certificate_verify&&D!==r.HandshakeType.finished&&(k.session.md5.update(f),k.session.sha1.update(f)),$[k.entity][k.expect][D](k,O,S)):r.handleUnexpected(k,O)},r.handleApplicationData=function(k,O){k.data.putBuffer(O.fragment),k.dataReady(k),k.process()},r.handleHeartbeat=function(k,O){var P=O.fragment,D=P.getByte(),S=P.getInt16(),f=P.getBytes(S);if(D===r.HeartbeatMessageType.heartbeat_request){if(k.handshaking||S>f.length)return k.process();r.queue(k,r.createRecord(k,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_response,f)})),r.flush(k)}else if(D===r.HeartbeatMessageType.heartbeat_response){if(f!==k.expectedHeartbeatPayload)return k.process();k.heartbeatReceived&&k.heartbeatReceived(k,a.util.createBuffer(f))}k.process()};var c=0,l=1,b=2,T=3,E=4,s=5,v=6,h=7,y=8,n=0,p=1,m=2,_=3,w=4,C=5,o=6,i=r.handleUnexpected,B=r.handleChangeCipherSpec,N=r.handleAlert,q=r.handleHandshake,I=r.handleApplicationData,F=r.handleHeartbeat,A=[];A[r.ConnectionEnd.client]=[[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[B,N,i,i,F],[i,N,q,i,F],[i,N,q,I,F],[i,N,q,i,F]],A[r.ConnectionEnd.server]=[[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[B,N,i,i,F],[i,N,q,i,F],[i,N,q,I,F],[i,N,q,i,F]];var H=r.handleHelloRequest,j=r.handleServerHello,W=r.handleCertificate,re=r.handleServerKeyExchange,J=r.handleCertificateRequest,oe=r.handleServerHelloDone,Q=r.handleFinished,$=[];$[r.ConnectionEnd.client]=[[i,i,j,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,W,re,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,re,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,Q],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i]];var ce=r.handleClientHello,ie=r.handleClientKeyExchange,ee=r.handleCertificateVerify;$[r.ConnectionEnd.server]=[[i,ce,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,W,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,ie,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,ee,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,Q],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i]],r.generateKeys=function(k,O){var P=e,D=O.client_random+O.server_random;k.session.resuming||(O.master_secret=P(O.pre_master_secret,"master secret",D,48).bytes(),O.pre_master_secret=null),D=O.server_random+O.client_random;var S=2*O.mac_key_length+2*O.enc_key_length,f=k.version.major===r.Versions.TLS_1_0.major&&k.version.minor===r.Versions.TLS_1_0.minor;f&&(S+=2*O.fixed_iv_length);var L=P(O.master_secret,"key expansion",D,S),G={client_write_MAC_key:L.getBytes(O.mac_key_length),server_write_MAC_key:L.getBytes(O.mac_key_length),client_write_key:L.getBytes(O.enc_key_length),server_write_key:L.getBytes(O.enc_key_length)};return f&&(G.client_write_IV=L.getBytes(O.fixed_iv_length),G.server_write_IV=L.getBytes(O.fixed_iv_length)),G},r.createConnectionState=function(k){var O=k.entity===r.ConnectionEnd.client,P=function(){var f={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(L){return!0},compressionState:null,compressFunction:function(L){return!0},updateSequenceNumber:function(){f.sequenceNumber[1]===4294967295?(f.sequenceNumber[1]=0,++f.sequenceNumber[0]):++f.sequenceNumber[1]}};return f},D={read:P(),write:P()};if(D.read.update=function(f,L){return D.read.cipherFunction(L,D.read)?D.read.compressFunction(f,L,D.read)||f.error(f,{message:"Could not decompress record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decompression_failure}}):f.error(f,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_record_mac}}),!f.fail},D.write.update=function(f,L){return D.write.compressFunction(f,L,D.write)?D.write.cipherFunction(L,D.write)||f.error(f,{message:"Could not encrypt record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):f.error(f,{message:"Could not compress record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}),!f.fail},k.session){var S=k.session.sp;switch(k.session.cipherSuite.initSecurityParameters(S),S.keys=r.generateKeys(k,S),D.read.macKey=O?S.keys.server_write_MAC_key:S.keys.client_write_MAC_key,D.write.macKey=O?S.keys.client_write_MAC_key:S.keys.server_write_MAC_key,k.session.cipherSuite.initConnectionState(D,k,S),S.compression_algorithm){case r.CompressionMethod.none:break;case r.CompressionMethod.deflate:D.read.compressFunction=x,D.write.compressFunction=d;break;default:throw new Error("Unsupported compression algorithm.")}}return D},r.createRandom=function(){var k=new Date,O=+k+k.getTimezoneOffset()*6e4,P=a.util.createBuffer();return P.putInt32(O),P.putBytes(a.random.getBytes(28)),P},r.createRecord=function(k,O){if(!O.data)return null;var P={type:O.type,version:{major:k.version.major,minor:k.version.minor},length:O.data.length(),fragment:O.data};return P},r.createAlert=function(k,O){var P=a.util.createBuffer();return P.putByte(O.level),P.putByte(O.description),r.createRecord(k,{type:r.ContentType.alert,data:P})},r.createClientHello=function(k){k.session.clientHelloVersion={major:k.version.major,minor:k.version.minor};for(var O=a.util.createBuffer(),P=0;P<k.cipherSuites.length;++P){var D=k.cipherSuites[P];O.putByte(D.id[0]),O.putByte(D.id[1])}var S=O.length(),f=a.util.createBuffer();f.putByte(r.CompressionMethod.none);var L=f.length(),G=a.util.createBuffer();if(k.virtualHost){var M=a.util.createBuffer();M.putByte(0),M.putByte(0);var V=a.util.createBuffer();V.putByte(0),u(V,2,a.util.createBuffer(k.virtualHost));var K=a.util.createBuffer();u(K,2,V),u(M,2,K),G.putBuffer(M)}var X=G.length();X>0&&(X+=2);var te=k.session.id,Y=te.length+1+2+4+28+2+S+1+L+X,ae=a.util.createBuffer();return ae.putByte(r.HandshakeType.client_hello),ae.putInt24(Y),ae.putByte(k.version.major),ae.putByte(k.version.minor),ae.putBytes(k.session.sp.client_random),u(ae,1,a.util.createBuffer(te)),u(ae,2,O),u(ae,1,f),X>0&&u(ae,2,G),ae},r.createServerHello=function(k){var O=k.session.id,P=O.length+1+2+4+28+2+1,D=a.util.createBuffer();return D.putByte(r.HandshakeType.server_hello),D.putInt24(P),D.putByte(k.version.major),D.putByte(k.version.minor),D.putBytes(k.session.sp.server_random),u(D,1,a.util.createBuffer(O)),D.putByte(k.session.cipherSuite.id[0]),D.putByte(k.session.cipherSuite.id[1]),D.putByte(k.session.compressionMethod),D},r.createCertificate=function(k){var O=k.entity===r.ConnectionEnd.client,P=null;if(k.getCertificate){var D;O?D=k.session.certificateRequest:D=k.session.extensions.server_name.serverNameList,P=k.getCertificate(k,D)}var S=a.util.createBuffer();if(P!==null)try{a.util.isArray(P)||(P=[P]);for(var f=null,L=0;L<P.length;++L){var G=a.pem.decode(P[L])[0];if(G.type!=="CERTIFICATE"&&G.type!=="X509 CERTIFICATE"&&G.type!=="TRUSTED CERTIFICATE"){var M=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw M.headerType=G.type,M}if(G.procType&&G.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var V=a.util.createBuffer(G.body);f===null&&(f=a.asn1.fromDer(V.bytes(),!1));var K=a.util.createBuffer();u(K,3,V),S.putBuffer(K)}P=a.pki.certificateFromAsn1(f),O?k.session.clientCertificate=P:k.session.serverCertificate=P}catch(Y){return k.error(k,{message:"Could not send certificate list.",cause:Y,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var X=3+S.length(),te=a.util.createBuffer();return te.putByte(r.HandshakeType.certificate),te.putInt24(X),u(te,3,S),te},r.createClientKeyExchange=function(k){var O=a.util.createBuffer();O.putByte(k.session.clientHelloVersion.major),O.putByte(k.session.clientHelloVersion.minor),O.putBytes(a.random.getBytes(46));var P=k.session.sp;P.pre_master_secret=O.getBytes();var D=k.session.serverCertificate.publicKey;O=D.encrypt(P.pre_master_secret);var S=O.length+2,f=a.util.createBuffer();return f.putByte(r.HandshakeType.client_key_exchange),f.putInt24(S),f.putInt16(O.length),f.putBytes(O),f},r.createServerKeyExchange=function(k){var O=a.util.createBuffer();return O},r.getClientSignature=function(k,O){var P=a.util.createBuffer();P.putBuffer(k.session.md5.digest()),P.putBuffer(k.session.sha1.digest()),P=P.getBytes(),k.getSignature=k.getSignature||function(D,S,f){var L=null;if(D.getPrivateKey)try{L=D.getPrivateKey(D,D.session.clientCertificate),L=a.pki.privateKeyFromPem(L)}catch(G){D.error(D,{message:"Could not get private key.",cause:G,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}L===null?D.error(D,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):S=L.sign(S,null),f(D,S)},k.getSignature(k,P,O)},r.createCertificateVerify=function(k,O){var P=O.length+2,D=a.util.createBuffer();return D.putByte(r.HandshakeType.certificate_verify),D.putInt24(P),D.putInt16(O.length),D.putBytes(O),D},r.createCertificateRequest=function(k){var O=a.util.createBuffer();O.putByte(1);var P=a.util.createBuffer();for(var D in k.caStore.certs){var S=k.caStore.certs[D],f=a.pki.distinguishedNameToAsn1(S.subject),L=a.asn1.toDer(f);P.putInt16(L.length()),P.putBuffer(L)}var G=1+O.length()+2+P.length(),M=a.util.createBuffer();return M.putByte(r.HandshakeType.certificate_request),M.putInt24(G),u(M,1,O),u(M,2,P),M},r.createServerHelloDone=function(k){var O=a.util.createBuffer();return O.putByte(r.HandshakeType.server_hello_done),O.putInt24(0),O},r.createChangeCipherSpec=function(){var k=a.util.createBuffer();return k.putByte(1),k},r.createFinished=function(k){var O=a.util.createBuffer();O.putBuffer(k.session.md5.digest()),O.putBuffer(k.session.sha1.digest());var P=k.entity===r.ConnectionEnd.client,D=k.session.sp,S=12,f=e,L=P?"client finished":"server finished";O=f(D.master_secret,L,O.getBytes(),S);var G=a.util.createBuffer();return G.putByte(r.HandshakeType.finished),G.putInt24(O.length()),G.putBuffer(O),G},r.createHeartbeat=function(k,O,P){typeof P>"u"&&(P=O.length);var D=a.util.createBuffer();D.putByte(k),D.putInt16(P),D.putBytes(O);var S=D.length(),f=Math.max(16,S-P-3);return D.putBytes(a.random.getBytes(f)),D},r.queue=function(k,O){if(O&&!(O.fragment.length()===0&&(O.type===r.ContentType.handshake||O.type===r.ContentType.alert||O.type===r.ContentType.change_cipher_spec))){if(O.type===r.ContentType.handshake){var P=O.fragment.bytes();k.session.md5.update(P),k.session.sha1.update(P),P=null}var D;if(O.fragment.length()<=r.MaxFragment)D=[O];else{D=[];for(var S=O.fragment.bytes();S.length>r.MaxFragment;)D.push(r.createRecord(k,{type:O.type,data:a.util.createBuffer(S.slice(0,r.MaxFragment))})),S=S.slice(r.MaxFragment);S.length>0&&D.push(r.createRecord(k,{type:O.type,data:a.util.createBuffer(S)}))}for(var f=0;f<D.length&&!k.fail;++f){var L=D[f],G=k.state.current.write;G.update(k,L)&&k.records.push(L)}}},r.flush=function(k){for(var O=0;O<k.records.length;++O){var P=k.records[O];k.tlsData.putByte(P.type),k.tlsData.putByte(P.version.major),k.tlsData.putByte(P.version.minor),k.tlsData.putInt16(P.fragment.length()),k.tlsData.putBuffer(k.records[O].fragment)}return k.records=[],k.tlsDataReady(k)};var ue=function(k){switch(k){case!0:return!0;case a.pki.certificateError.bad_certificate:return r.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return r.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return r.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return r.Alert.Description.certificate_expired;case a.pki.certificateError.certificate_unknown:return r.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return r.Alert.Description.unknown_ca;default:return r.Alert.Description.bad_certificate}},Se=function(k){switch(k){case!0:return!0;case r.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case r.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case r.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;case r.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case r.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case r.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};r.verifyCertificateChain=function(k,O){try{var P={};for(var D in k.verifyOptions)P[D]=k.verifyOptions[D];P.verify=function(f,L,G){var M=ue(f),V=k.verify(k,f,L,G);if(V!==!0){if(typeof V=="object"&&!a.util.isArray(V)){var K=new Error("The application rejected the certificate.");throw K.send=!0,K.alert={level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate},V.message&&(K.message=V.message),V.alert&&(K.alert.description=V.alert),K}V!==f&&(V=Se(V))}return V},a.pki.verifyCertificateChain(k.caStore,O,P)}catch(f){var S=f;(typeof S!="object"||a.util.isArray(S))&&(S={send:!0,alert:{level:r.Alert.Level.fatal,description:ue(f)}}),"send"in S||(S.send=!0),"alert"in S||(S.alert={level:r.Alert.Level.fatal,description:ue(S.error)}),k.error(k,S)}return!k.fail},r.createSessionCache=function(k,O){var P=null;if(k&&k.getSession&&k.setSession&&k.order)P=k;else{P={},P.cache=k||{},P.capacity=Math.max(O||100,1),P.order=[];for(var D in k)P.order.length<=O?P.order.push(D):delete k[D];P.getSession=function(S){var f=null,L=null;if(S?L=a.util.bytesToHex(S):P.order.length>0&&(L=P.order[0]),L!==null&&L in P.cache){f=P.cache[L],delete P.cache[L];for(var G in P.order)if(P.order[G]===L){P.order.splice(G,1);break}}return f},P.setSession=function(S,f){if(P.order.length===P.capacity){var L=P.order.shift();delete P.cache[L]}var L=a.util.bytesToHex(S);P.order.push(L),P.cache[L]=f}}return P},r.createConnection=function(k){var O=null;k.caStore?a.util.isArray(k.caStore)?O=a.pki.createCaStore(k.caStore):O=k.caStore:O=a.pki.createCaStore();var P=k.cipherSuites||null;if(P===null){P=[];for(var D in r.CipherSuites)P.push(r.CipherSuites[D])}var S=k.server?r.ConnectionEnd.server:r.ConnectionEnd.client,f=k.sessionCache?r.createSessionCache(k.sessionCache):null,L={version:{major:r.Version.major,minor:r.Version.minor},entity:S,sessionId:k.sessionId,caStore:O,sessionCache:f,cipherSuites:P,connected:k.connected,virtualHost:k.virtualHost||null,verifyClient:k.verifyClient||!1,verify:k.verify||function(K,X,te,Y){return X},verifyOptions:k.verifyOptions||{},getCertificate:k.getCertificate||null,getPrivateKey:k.getPrivateKey||null,getSignature:k.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:k.tlsDataReady,dataReady:k.dataReady,heartbeatReceived:k.heartbeatReceived,closed:k.closed,error:function(K,X){X.origin=X.origin||(K.entity===r.ConnectionEnd.client?"client":"server"),X.send&&(r.queue(K,r.createAlert(K,X.alert)),r.flush(K));var te=X.fatal!==!1;te&&(K.fail=!0),k.error(K,X),te&&K.close(!1)},deflate:k.deflate||null,inflate:k.inflate||null};L.reset=function(K){L.version={major:r.Version.major,minor:r.Version.minor},L.record=null,L.session=null,L.peerCertificate=null,L.state={pending:null,current:null},L.expect=L.entity===r.ConnectionEnd.client?c:n,L.fragmented=null,L.records=[],L.open=!1,L.handshakes=0,L.handshaking=!1,L.isConnected=!1,L.fail=!(K||typeof K>"u"),L.input.clear(),L.tlsData.clear(),L.data.clear(),L.state.current=r.createConnectionState(L)},L.reset();var G=function(K,X){var te=X.type-r.ContentType.change_cipher_spec,Y=A[K.entity][K.expect];te in Y?Y[te](K,X):r.handleUnexpected(K,X)},M=function(K){var X=0,te=K.input,Y=te.length();if(Y<5)X=5-Y;else{K.record={type:te.getByte(),version:{major:te.getByte(),minor:te.getByte()},length:te.getInt16(),fragment:a.util.createBuffer(),ready:!1};var ae=K.record.version.major===K.version.major;ae&&K.session&&K.session.version&&(ae=K.record.version.minor===K.version.minor),ae||K.error(K,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}})}return X},V=function(K){var X=0,te=K.input,Y=te.length();if(Y<K.record.length)X=K.record.length-Y;else{K.record.fragment.putBytes(te.getBytes(K.record.length)),te.compact();var ae=K.state.current.read;ae.update(K,K.record)&&(K.fragmented!==null&&(K.fragmented.type===K.record.type?(K.fragmented.fragment.putBuffer(K.record.fragment),K.record=K.fragmented):K.error(K,{message:"Invalid fragmented record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})),K.record.ready=!0)}return X};return L.handshake=function(K){if(L.entity!==r.ConnectionEnd.client)L.error(L,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(L.handshaking)L.error(L,{message:"Handshake already in progress.",fatal:!1});else{L.fail&&!L.open&&L.handshakes===0&&(L.fail=!1),L.handshaking=!0,K=K||"";var X=null;K.length>0&&(L.sessionCache&&(X=L.sessionCache.getSession(K)),X===null&&(K="")),K.length===0&&L.sessionCache&&(X=L.sessionCache.getSession(),X!==null&&(K=X.id)),L.session={id:K,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()},X&&(L.version=X.version,L.session.sp=X.sp),L.session.sp.client_random=r.createRandom().getBytes(),L.open=!0,r.queue(L,r.createRecord(L,{type:r.ContentType.handshake,data:r.createClientHello(L)})),r.flush(L)}},L.process=function(K){var X=0;return K&&L.input.putBytes(K),L.fail||(L.record!==null&&L.record.ready&&L.record.fragment.isEmpty()&&(L.record=null),L.record===null&&(X=M(L)),!L.fail&&L.record!==null&&!L.record.ready&&(X=V(L)),!L.fail&&L.record!==null&&L.record.ready&&G(L,L.record)),X},L.prepare=function(K){return r.queue(L,r.createRecord(L,{type:r.ContentType.application_data,data:a.util.createBuffer(K)})),r.flush(L)},L.prepareHeartbeatRequest=function(K,X){return K instanceof a.util.ByteBuffer&&(K=K.bytes()),typeof X>"u"&&(X=K.length),L.expectedHeartbeatPayload=K,r.queue(L,r.createRecord(L,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_request,K,X)})),r.flush(L)},L.close=function(K){if(!L.fail&&L.sessionCache&&L.session){var X={id:L.session.id,version:L.session.version,sp:L.session.sp};X.sp.keys=null,L.sessionCache.setSession(X.id,X)}L.open&&(L.open=!1,L.input.clear(),(L.isConnected||L.handshaking)&&(L.isConnected=L.handshaking=!1,r.queue(L,r.createAlert(L,{level:r.Alert.Level.warning,description:r.Alert.Description.close_notify})),r.flush(L)),L.closed(L)),L.reset(K)},L},Gr=a.tls=a.tls||{};for(var ve in r)typeof r[ve]!="function"&&(a.tls[ve]=r[ve]);return a.tls.prf_tls1=e,a.tls.hmac_sha1=t,a.tls.createSessionCache=r.createSessionCache,a.tls.createConnection=r.createConnection,Gr}var on;function mi(){if(on)return vr.exports;on=1;var a=me();yt(),sn();var e=vr.exports=a.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(c){c.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,c.cipher_type=e.CipherType.block,c.enc_key_length=16,c.block_length=16,c.fixed_iv_length=16,c.record_iv_length=16,c.mac_algorithm=e.MACAlgorithm.hmac_sha1,c.mac_length=20,c.mac_key_length=20},initConnectionState:t},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(c){c.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,c.cipher_type=e.CipherType.block,c.enc_key_length=32,c.block_length=16,c.fixed_iv_length=16,c.record_iv_length=16,c.mac_algorithm=e.MACAlgorithm.hmac_sha1,c.mac_length=20,c.mac_key_length=20},initConnectionState:t};function t(c,l,b){var T=l.entity===a.tls.ConnectionEnd.client;c.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",T?b.keys.server_write_key:b.keys.client_write_key),iv:T?b.keys.server_write_IV:b.keys.client_write_IV},c.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",T?b.keys.client_write_key:b.keys.server_write_key),iv:T?b.keys.client_write_IV:b.keys.server_write_IV},c.read.cipherFunction=u,c.write.cipherFunction=d,c.read.macLength=c.write.macLength=b.mac_length,c.read.macFunction=c.write.macFunction=e.hmac_sha1}function d(c,l){var b=!1,T=l.macFunction(l.macKey,l.sequenceNumber,c);c.fragment.putBytes(T),l.updateSequenceNumber();var E;c.version.minor===e.Versions.TLS_1_0.minor?E=l.cipherState.init?null:l.cipherState.iv:E=a.random.getBytesSync(16),l.cipherState.init=!0;var s=l.cipherState.cipher;return s.start({iv:E}),c.version.minor>=e.Versions.TLS_1_1.minor&&s.output.putBytes(E),s.update(c.fragment),s.finish(x)&&(c.fragment=s.output,c.length=c.fragment.length(),b=!0),b}function x(c,l,b){if(!b){var T=c-l.length()%c;l.fillWithByte(T-1,T)}return!0}function g(c,l,b){var T=!0;if(b){for(var E=l.length(),s=l.last(),v=E-1-s;v<E-1;++v)T=T&&l.at(v)==s;T&&l.truncate(s+1)}return T}function u(c,l){var b=!1,T;c.version.minor===e.Versions.TLS_1_0.minor?T=l.cipherState.init?null:l.cipherState.iv:T=c.fragment.getBytes(16),l.cipherState.init=!0;var E=l.cipherState.cipher;E.start({iv:T}),E.update(c.fragment),b=E.finish(g);var s=l.macLength,v=a.random.getBytesSync(s),h=E.output.length();h>=s?(c.fragment=E.output.getBytes(h-s),v=E.output.getBytes(s)):c.fragment=E.output.getBytes(),c.fragment=a.util.createBuffer(c.fragment),c.length=c.fragment.length();var y=l.macFunction(l.macKey,l.sequenceNumber,c);return l.updateSequenceNumber(),b=r(l.macKey,v,y)&&b,b}function r(c,l,b){var T=a.hmac.create();return T.start("SHA1",c),T.update(l),l=T.digest().getBytes(),T.start(null,null),T.update(b),b=T.digest().getBytes(),l===b}return vr.exports}var Wr={exports:{}},un;function ln(){if(un)return Wr.exports;un=1;var a=me();ct(),Ee();var e=Wr.exports=a.sha512=a.sha512||{};a.md.sha512=a.md.algorithms.sha512=e;var t=a.sha384=a.sha512.sha384=a.sha512.sha384||{};t.create=function(){return e.create("SHA-384")},a.md.sha384=a.md.algorithms.sha384=t,a.sha512.sha256=a.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256,a.sha512.sha224=a.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224,e.create=function(l){if(x||r(),typeof l>"u"&&(l="SHA-512"),!(l in u))throw new Error("Invalid SHA-512 algorithm: "+l);for(var b=u[l],T=null,E=a.util.createBuffer(),s=new Array(80),v=0;v<80;++v)s[v]=new Array(2);var h=64;switch(l){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28;break}var y={algorithm:l.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16};return y.start=function(){y.messageLength=0,y.fullMessageLength=y.messageLength128=[];for(var n=y.messageLengthSize/4,p=0;p<n;++p)y.fullMessageLength.push(0);E=a.util.createBuffer(),T=new Array(b.length);for(var p=0;p<b.length;++p)T[p]=b[p].slice(0);return y},y.start(),y.update=function(n,p){p==="utf8"&&(n=a.util.encodeUtf8(n));var m=n.length;y.messageLength+=m,m=[m/4294967296>>>0,m>>>0];for(var _=y.fullMessageLength.length-1;_>=0;--_)y.fullMessageLength[_]+=m[1],m[1]=m[0]+(y.fullMessageLength[_]/4294967296>>>0),y.fullMessageLength[_]=y.fullMessageLength[_]>>>0,m[0]=m[1]/4294967296>>>0;return E.putBytes(n),c(T,s,E),(E.read>2048||E.length()===0)&&E.compact(),y},y.digest=function(){var n=a.util.createBuffer();n.putBytes(E.bytes());var p=y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize,m=p&y.blockLength-1;n.putBytes(d.substr(0,y.blockLength-m));for(var _,w,C=y.fullMessageLength[0]*8,o=0;o<y.fullMessageLength.length-1;++o)_=y.fullMessageLength[o+1]*8,w=_/4294967296>>>0,C+=w,n.putInt32(C>>>0),C=_>>>0;n.putInt32(C);for(var i=new Array(T.length),o=0;o<T.length;++o)i[o]=T[o].slice(0);c(i,s,n);var B=a.util.createBuffer(),N;l==="SHA-512"?N=i.length:l==="SHA-384"?N=i.length-2:N=i.length-4;for(var o=0;o<N;++o)B.putInt32(i[o][0]),(o!==N-1||l!=="SHA-512/224")&&B.putInt32(i[o][1]);return B},y};var d=null,x=!1,g=null,u=null;function r(){d="",d+=a.util.fillString("\0",128),g=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],u={},u["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],x=!0}function c(l,b,T){for(var E,s,v,h,y,n,p,m,_,w,C,o,i,B,N,q,I,F,A,H,j,W,re,J,oe,Q,$,ce,ie,ee,ue,Se,ve,k,O,P=T.length();P>=128;){for(ie=0;ie<16;++ie)b[ie][0]=T.getInt32()>>>0,b[ie][1]=T.getInt32()>>>0;for(;ie<80;++ie)Se=b[ie-2],ee=Se[0],ue=Se[1],E=((ee>>>19|ue<<13)^(ue>>>29|ee<<3)^ee>>>6)>>>0,s=((ee<<13|ue>>>19)^(ue<<3|ee>>>29)^(ee<<26|ue>>>6))>>>0,k=b[ie-15],ee=k[0],ue=k[1],v=((ee>>>1|ue<<31)^(ee>>>8|ue<<24)^ee>>>7)>>>0,h=((ee<<31|ue>>>1)^(ee<<24|ue>>>8)^(ee<<25|ue>>>7))>>>0,ve=b[ie-7],O=b[ie-16],ue=s+ve[1]+h+O[1],b[ie][0]=E+ve[0]+v+O[0]+(ue/4294967296>>>0)>>>0,b[ie][1]=ue>>>0;for(i=l[0][0],B=l[0][1],N=l[1][0],q=l[1][1],I=l[2][0],F=l[2][1],A=l[3][0],H=l[3][1],j=l[4][0],W=l[4][1],re=l[5][0],J=l[5][1],oe=l[6][0],Q=l[6][1],$=l[7][0],ce=l[7][1],ie=0;ie<80;++ie)p=((j>>>14|W<<18)^(j>>>18|W<<14)^(W>>>9|j<<23))>>>0,m=((j<<18|W>>>14)^(j<<14|W>>>18)^(W<<23|j>>>9))>>>0,_=(oe^j&(re^oe))>>>0,w=(Q^W&(J^Q))>>>0,y=((i>>>28|B<<4)^(B>>>2|i<<30)^(B>>>7|i<<25))>>>0,n=((i<<4|B>>>28)^(B<<30|i>>>2)^(B<<25|i>>>7))>>>0,C=(i&N|I&(i^N))>>>0,o=(B&q|F&(B^q))>>>0,ue=ce+m+w+g[ie][1]+b[ie][1],E=$+p+_+g[ie][0]+b[ie][0]+(ue/4294967296>>>0)>>>0,s=ue>>>0,ue=n+o,v=y+C+(ue/4294967296>>>0)>>>0,h=ue>>>0,$=oe,ce=Q,oe=re,Q=J,re=j,J=W,ue=H+s,j=A+E+(ue/4294967296>>>0)>>>0,W=ue>>>0,A=I,H=F,I=N,F=q,N=i,q=B,ue=s+h,i=E+v+(ue/4294967296>>>0)>>>0,B=ue>>>0;ue=l[0][1]+B,l[0][0]=l[0][0]+i+(ue/4294967296>>>0)>>>0,l[0][1]=ue>>>0,ue=l[1][1]+q,l[1][0]=l[1][0]+N+(ue/4294967296>>>0)>>>0,l[1][1]=ue>>>0,ue=l[2][1]+F,l[2][0]=l[2][0]+I+(ue/4294967296>>>0)>>>0,l[2][1]=ue>>>0,ue=l[3][1]+H,l[3][0]=l[3][0]+A+(ue/4294967296>>>0)>>>0,l[3][1]=ue>>>0,ue=l[4][1]+W,l[4][0]=l[4][0]+j+(ue/4294967296>>>0)>>>0,l[4][1]=ue>>>0,ue=l[5][1]+J,l[5][0]=l[5][0]+re+(ue/4294967296>>>0)>>>0,l[5][1]=ue>>>0,ue=l[6][1]+Q,l[6][0]=l[6][0]+oe+(ue/4294967296>>>0)>>>0,l[6][1]=ue>>>0,ue=l[7][1]+ce,l[7][0]=l[7][0]+$+(ue/4294967296>>>0)>>>0,l[7][1]=ue>>>0,P-=128}}return Wr.exports}var Qt={},fn;function Ci(){if(fn)return Qt;fn=1;var a=me();ft();var e=a.asn1;return Qt.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Qt.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},Qt}var jr,cn;function xi(){if(cn)return jr;cn=1;var a=me();Gt(),at(),ln(),Ee();var e=Ci(),t=e.publicKeyValidator,d=e.privateKeyValidator;if(typeof x>"u")var x=a.jsbn.BigInteger;var g=a.util.ByteBuffer,u=typeof Buffer>"u"?Uint8Array:Buffer;a.pki=a.pki||{},jr=a.pki.ed25519=a.ed25519=a.ed25519||{};var r=a.ed25519;r.constants={},r.constants.PUBLIC_KEY_BYTE_LENGTH=32,r.constants.PRIVATE_KEY_BYTE_LENGTH=64,r.constants.SEED_BYTE_LENGTH=32,r.constants.SIGN_BYTE_LENGTH=64,r.constants.HASH_BYTE_LENGTH=64,r.generateKeyPair=function(O){O=O||{};var P=O.seed;if(P===void 0)P=a.random.getBytesSync(r.constants.SEED_BYTE_LENGTH);else if(typeof P=="string"){if(P.length!==r.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+r.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(P instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');P=c({message:P,encoding:"binary"});for(var D=new u(r.constants.PUBLIC_KEY_BYTE_LENGTH),S=new u(r.constants.PRIVATE_KEY_BYTE_LENGTH),f=0;f<32;++f)S[f]=P[f];return p(D,S),{publicKey:D,privateKey:S}},r.privateKeyFromAsn1=function(O){var P={},D=[],S=a.asn1.validate(O,d,P,D);if(!S){var f=new Error("Invalid Key.");throw f.errors=D,f}var L=a.asn1.derToOid(P.privateKeyOid),G=a.oids.EdDSA25519;if(L!==G)throw new Error('Invalid OID "'+L+'"; OID must be "'+G+'".');var M=P.privateKey,V=c({message:a.asn1.fromDer(M).value,encoding:"binary"});return{privateKeyBytes:V}},r.publicKeyFromAsn1=function(O){var P={},D=[],S=a.asn1.validate(O,t,P,D);if(!S){var f=new Error("Invalid Key.");throw f.errors=D,f}var L=a.asn1.derToOid(P.publicKeyOid),G=a.oids.EdDSA25519;if(L!==G)throw new Error('Invalid OID "'+L+'"; OID must be "'+G+'".');var M=P.ed25519PublicKey;if(M.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return c({message:M,encoding:"binary"})},r.publicKeyFromPrivateKey=function(O){O=O||{};var P=c({message:O.privateKey,encoding:"binary"});if(P.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.PRIVATE_KEY_BYTE_LENGTH);for(var D=new u(r.constants.PUBLIC_KEY_BYTE_LENGTH),S=0;S<D.length;++S)D[S]=P[32+S];return D},r.sign=function(O){O=O||{};var P=c(O),D=c({message:O.privateKey,encoding:"binary"});if(D.length===r.constants.SEED_BYTE_LENGTH){var S=r.generateKeyPair({seed:D});D=S.privateKey}else if(D.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.SEED_BYTE_LENGTH+" or "+r.constants.PRIVATE_KEY_BYTE_LENGTH);var f=new u(r.constants.SIGN_BYTE_LENGTH+P.length);m(f,P,P.length,D);for(var L=new u(r.constants.SIGN_BYTE_LENGTH),G=0;G<L.length;++G)L[G]=f[G];return L},r.verify=function(O){O=O||{};var P=c(O);if(O.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var D=c({message:O.signature,encoding:"binary"});if(D.length!==r.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+r.constants.SIGN_BYTE_LENGTH);var S=c({message:O.publicKey,encoding:"binary"});if(S.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+r.constants.PUBLIC_KEY_BYTE_LENGTH);var f=new u(r.constants.SIGN_BYTE_LENGTH+P.length),L=new u(r.constants.SIGN_BYTE_LENGTH+P.length),G;for(G=0;G<r.constants.SIGN_BYTE_LENGTH;++G)f[G]=D[G];for(G=0;G<P.length;++G)f[G+r.constants.SIGN_BYTE_LENGTH]=P[G];return _(L,f,f.length,S)>=0};function c(O){var P=O.message;if(P instanceof Uint8Array||P instanceof u)return P;var D=O.encoding;if(P===void 0)if(O.md)P=O.md.digest().getBytes(),D="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof P=="string"&&!D)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof P=="string"){if(typeof Buffer<"u")return Buffer.from(P,D);P=new g(P,D)}else if(!(P instanceof g))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var S=new u(P.length()),f=0;f<S.length;++f)S[f]=P.at(f);return S}var l=ee(),b=ee([1]),T=ee([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=ee([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),s=ee([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=ee([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),y=ee([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function n(O,P){var D=a.md.sha512.create(),S=new g(O);D.update(S.getBytes(P),"binary");var f=D.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(f,"binary");for(var L=new u(r.constants.HASH_BYTE_LENGTH),G=0;G<64;++G)L[G]=f.charCodeAt(G);return L}function p(O,P){var D=[ee(),ee(),ee(),ee()],S,f=n(P,32);for(f[0]&=248,f[31]&=127,f[31]|=64,oe(D,f),N(O,D),S=0;S<32;++S)P[S+32]=O[S];return 0}function m(O,P,D,S){var f,L,G=new Float64Array(64),M=[ee(),ee(),ee(),ee()],V=n(S,32);V[0]&=248,V[31]&=127,V[31]|=64;var K=D+64;for(f=0;f<D;++f)O[64+f]=P[f];for(f=0;f<32;++f)O[32+f]=V[32+f];var X=n(O.subarray(32),D+32);for(o(X),oe(M,X),N(O,M),f=32;f<64;++f)O[f]=S[f];var te=n(O,D+64);for(o(te),f=32;f<64;++f)G[f]=0;for(f=0;f<32;++f)G[f]=X[f];for(f=0;f<32;++f)for(L=0;L<32;L++)G[f+L]+=te[f]*V[L];return C(O.subarray(32),G),K}function _(O,P,D,S){var f,L,G=new u(32),M=[ee(),ee(),ee(),ee()],V=[ee(),ee(),ee(),ee()];if(L=-1,D<64||I(V,S)||!w(P,32))return-1;for(f=0;f<D;++f)O[f]=P[f];for(f=0;f<32;++f)O[f+32]=S[f];var K=n(O,D);if(o(K),J(M,V,K),oe(V,P.subarray(32)),i(M,V),N(G,M),D-=64,j(P,0,G,0)){for(f=0;f<D;++f)O[f]=0;return-1}for(f=0;f<D;++f)O[f]=P[f+64];return L=D,L}function w(O,P){var D;for(D=31;D>=0;--D){if(O[P+D]<h[D])return!0;if(O[P+D]>h[D])return!1}return!1}function C(O,P){var D,S,f,L;for(S=63;S>=32;--S){for(D=0,f=S-32,L=S-12;f<L;++f)P[f]+=D-16*P[S]*h[f-(S-32)],D=P[f]+128>>8,P[f]-=D*256;P[f]+=D,P[S]=0}for(D=0,f=0;f<32;++f)P[f]+=D-(P[31]>>4)*h[f],D=P[f]>>8,P[f]&=255;for(f=0;f<32;++f)P[f]-=D*h[f];for(S=0;S<32;++S)P[S+1]+=P[S]>>8,O[S]=P[S]&255}function o(O){for(var P=new Float64Array(64),D=0;D<64;++D)P[D]=O[D],O[D]=0;C(O,P)}function i(O,P){var D=ee(),S=ee(),f=ee(),L=ee(),G=ee(),M=ee(),V=ee(),K=ee(),X=ee();Se(D,O[1],O[0]),Se(X,P[1],P[0]),k(D,D,X),ue(S,O[0],O[1]),ue(X,P[0],P[1]),k(S,S,X),k(f,O[3],P[3]),k(f,f,E),k(L,O[2],P[2]),ue(L,L,L),Se(G,S,D),Se(M,L,f),ue(V,L,f),ue(K,S,D),k(O[0],G,M),k(O[1],K,V),k(O[2],V,M),k(O[3],G,K)}function B(O,P,D){for(var S=0;S<4;++S)ie(O[S],P[S],D)}function N(O,P){var D=ee(),S=ee(),f=ee();$(f,P[2]),k(D,P[0],f),k(S,P[1],f),q(O,S),O[31]^=re(D)<<7}function q(O,P){var D,S,f,L=ee(),G=ee();for(D=0;D<16;++D)G[D]=P[D];for(ce(G),ce(G),ce(G),S=0;S<2;++S){for(L[0]=G[0]-65517,D=1;D<15;++D)L[D]=G[D]-65535-(L[D-1]>>16&1),L[D-1]&=65535;L[15]=G[15]-32767-(L[14]>>16&1),f=L[15]>>16&1,L[14]&=65535,ie(G,L,1-f)}for(D=0;D<16;D++)O[2*D]=G[D]&255,O[2*D+1]=G[D]>>8}function I(O,P){var D=ee(),S=ee(),f=ee(),L=ee(),G=ee(),M=ee(),V=ee();return Q(O[2],b),F(O[1],P),ve(f,O[1]),k(L,f,T),Se(f,f,O[2]),ue(L,O[2],L),ve(G,L),ve(M,G),k(V,M,G),k(D,V,f),k(D,D,L),A(D,D),k(D,D,f),k(D,D,L),k(D,D,L),k(O[0],D,L),ve(S,O[0]),k(S,S,L),H(S,f)&&k(O[0],O[0],y),ve(S,O[0]),k(S,S,L),H(S,f)?-1:(re(O[0])===P[31]>>7&&Se(O[0],l,O[0]),k(O[3],O[0],O[1]),0)}function F(O,P){var D;for(D=0;D<16;++D)O[D]=P[2*D]+(P[2*D+1]<<8);O[15]&=32767}function A(O,P){var D=ee(),S;for(S=0;S<16;++S)D[S]=P[S];for(S=250;S>=0;--S)ve(D,D),S!==1&&k(D,D,P);for(S=0;S<16;++S)O[S]=D[S]}function H(O,P){var D=new u(32),S=new u(32);return q(D,O),q(S,P),j(D,0,S,0)}function j(O,P,D,S){return W(O,P,D,S,32)}function W(O,P,D,S,f){var L,G=0;for(L=0;L<f;++L)G|=O[P+L]^D[S+L];return(1&G-1>>>8)-1}function re(O){var P=new u(32);return q(P,O),P[0]&1}function J(O,P,D){var S,f;for(Q(O[0],l),Q(O[1],b),Q(O[2],b),Q(O[3],l),f=255;f>=0;--f)S=D[f/8|0]>>(f&7)&1,B(O,P,S),i(P,O),i(O,O),B(O,P,S)}function oe(O,P){var D=[ee(),ee(),ee(),ee()];Q(D[0],s),Q(D[1],v),Q(D[2],b),k(D[3],s,v),J(O,D,P)}function Q(O,P){var D;for(D=0;D<16;D++)O[D]=P[D]|0}function $(O,P){var D=ee(),S;for(S=0;S<16;++S)D[S]=P[S];for(S=253;S>=0;--S)ve(D,D),S!==2&&S!==4&&k(D,D,P);for(S=0;S<16;++S)O[S]=D[S]}function ce(O){var P,D,S=1;for(P=0;P<16;++P)D=O[P]+S+65535,S=Math.floor(D/65536),O[P]=D-S*65536;O[0]+=S-1+37*(S-1)}function ie(O,P,D){for(var S,f=~(D-1),L=0;L<16;++L)S=f&(O[L]^P[L]),O[L]^=S,P[L]^=S}function ee(O){var P,D=new Float64Array(16);if(O)for(P=0;P<O.length;++P)D[P]=O[P];return D}function ue(O,P,D){for(var S=0;S<16;++S)O[S]=P[S]+D[S]}function Se(O,P,D){for(var S=0;S<16;++S)O[S]=P[S]-D[S]}function ve(O,P){k(O,P,P)}function k(O,P,D){var S,f,L=0,G=0,M=0,V=0,K=0,X=0,te=0,Y=0,ae=0,fe=0,se=0,de=0,ye=0,ge=0,xe=0,be=0,_e=0,Ae=0,Ce=0,Be=0,Ne=0,Ie=0,Qe=0,Ze=0,et=0,nt=0,it=0,Xe=0,st=0,Lt=0,Zt=0,Le=D[0],De=D[1],Ue=D[2],Pe=D[3],Oe=D[4],Fe=D[5],Ve=D[6],Me=D[7],Ke=D[8],ze=D[9],qe=D[10],He=D[11],we=D[12],Re=D[13],Ge=D[14],We=D[15];S=P[0],L+=S*Le,G+=S*De,M+=S*Ue,V+=S*Pe,K+=S*Oe,X+=S*Fe,te+=S*Ve,Y+=S*Me,ae+=S*Ke,fe+=S*ze,se+=S*qe,de+=S*He,ye+=S*we,ge+=S*Re,xe+=S*Ge,be+=S*We,S=P[1],G+=S*Le,M+=S*De,V+=S*Ue,K+=S*Pe,X+=S*Oe,te+=S*Fe,Y+=S*Ve,ae+=S*Me,fe+=S*Ke,se+=S*ze,de+=S*qe,ye+=S*He,ge+=S*we,xe+=S*Re,be+=S*Ge,_e+=S*We,S=P[2],M+=S*Le,V+=S*De,K+=S*Ue,X+=S*Pe,te+=S*Oe,Y+=S*Fe,ae+=S*Ve,fe+=S*Me,se+=S*Ke,de+=S*ze,ye+=S*qe,ge+=S*He,xe+=S*we,be+=S*Re,_e+=S*Ge,Ae+=S*We,S=P[3],V+=S*Le,K+=S*De,X+=S*Ue,te+=S*Pe,Y+=S*Oe,ae+=S*Fe,fe+=S*Ve,se+=S*Me,de+=S*Ke,ye+=S*ze,ge+=S*qe,xe+=S*He,be+=S*we,_e+=S*Re,Ae+=S*Ge,Ce+=S*We,S=P[4],K+=S*Le,X+=S*De,te+=S*Ue,Y+=S*Pe,ae+=S*Oe,fe+=S*Fe,se+=S*Ve,de+=S*Me,ye+=S*Ke,ge+=S*ze,xe+=S*qe,be+=S*He,_e+=S*we,Ae+=S*Re,Ce+=S*Ge,Be+=S*We,S=P[5],X+=S*Le,te+=S*De,Y+=S*Ue,ae+=S*Pe,fe+=S*Oe,se+=S*Fe,de+=S*Ve,ye+=S*Me,ge+=S*Ke,xe+=S*ze,be+=S*qe,_e+=S*He,Ae+=S*we,Ce+=S*Re,Be+=S*Ge,Ne+=S*We,S=P[6],te+=S*Le,Y+=S*De,ae+=S*Ue,fe+=S*Pe,se+=S*Oe,de+=S*Fe,ye+=S*Ve,ge+=S*Me,xe+=S*Ke,be+=S*ze,_e+=S*qe,Ae+=S*He,Ce+=S*we,Be+=S*Re,Ne+=S*Ge,Ie+=S*We,S=P[7],Y+=S*Le,ae+=S*De,fe+=S*Ue,se+=S*Pe,de+=S*Oe,ye+=S*Fe,ge+=S*Ve,xe+=S*Me,be+=S*Ke,_e+=S*ze,Ae+=S*qe,Ce+=S*He,Be+=S*we,Ne+=S*Re,Ie+=S*Ge,Qe+=S*We,S=P[8],ae+=S*Le,fe+=S*De,se+=S*Ue,de+=S*Pe,ye+=S*Oe,ge+=S*Fe,xe+=S*Ve,be+=S*Me,_e+=S*Ke,Ae+=S*ze,Ce+=S*qe,Be+=S*He,Ne+=S*we,Ie+=S*Re,Qe+=S*Ge,Ze+=S*We,S=P[9],fe+=S*Le,se+=S*De,de+=S*Ue,ye+=S*Pe,ge+=S*Oe,xe+=S*Fe,be+=S*Ve,_e+=S*Me,Ae+=S*Ke,Ce+=S*ze,Be+=S*qe,Ne+=S*He,Ie+=S*we,Qe+=S*Re,Ze+=S*Ge,et+=S*We,S=P[10],se+=S*Le,de+=S*De,ye+=S*Ue,ge+=S*Pe,xe+=S*Oe,be+=S*Fe,_e+=S*Ve,Ae+=S*Me,Ce+=S*Ke,Be+=S*ze,Ne+=S*qe,Ie+=S*He,Qe+=S*we,Ze+=S*Re,et+=S*Ge,nt+=S*We,S=P[11],de+=S*Le,ye+=S*De,ge+=S*Ue,xe+=S*Pe,be+=S*Oe,_e+=S*Fe,Ae+=S*Ve,Ce+=S*Me,Be+=S*Ke,Ne+=S*ze,Ie+=S*qe,Qe+=S*He,Ze+=S*we,et+=S*Re,nt+=S*Ge,it+=S*We,S=P[12],ye+=S*Le,ge+=S*De,xe+=S*Ue,be+=S*Pe,_e+=S*Oe,Ae+=S*Fe,Ce+=S*Ve,Be+=S*Me,Ne+=S*Ke,Ie+=S*ze,Qe+=S*qe,Ze+=S*He,et+=S*we,nt+=S*Re,it+=S*Ge,Xe+=S*We,S=P[13],ge+=S*Le,xe+=S*De,be+=S*Ue,_e+=S*Pe,Ae+=S*Oe,Ce+=S*Fe,Be+=S*Ve,Ne+=S*Me,Ie+=S*Ke,Qe+=S*ze,Ze+=S*qe,et+=S*He,nt+=S*we,it+=S*Re,Xe+=S*Ge,st+=S*We,S=P[14],xe+=S*Le,be+=S*De,_e+=S*Ue,Ae+=S*Pe,Ce+=S*Oe,Be+=S*Fe,Ne+=S*Ve,Ie+=S*Me,Qe+=S*Ke,Ze+=S*ze,et+=S*qe,nt+=S*He,it+=S*we,Xe+=S*Re,st+=S*Ge,Lt+=S*We,S=P[15],be+=S*Le,_e+=S*De,Ae+=S*Ue,Ce+=S*Pe,Be+=S*Oe,Ne+=S*Fe,Ie+=S*Ve,Qe+=S*Me,Ze+=S*Ke,et+=S*ze,nt+=S*qe,it+=S*He,Xe+=S*we,st+=S*Re,Lt+=S*Ge,Zt+=S*We,L+=38*_e,G+=38*Ae,M+=38*Ce,V+=38*Be,K+=38*Ne,X+=38*Ie,te+=38*Qe,Y+=38*Ze,ae+=38*et,fe+=38*nt,se+=38*it,de+=38*Xe,ye+=38*st,ge+=38*Lt,xe+=38*Zt,f=1,S=L+f+65535,f=Math.floor(S/65536),L=S-f*65536,S=G+f+65535,f=Math.floor(S/65536),G=S-f*65536,S=M+f+65535,f=Math.floor(S/65536),M=S-f*65536,S=V+f+65535,f=Math.floor(S/65536),V=S-f*65536,S=K+f+65535,f=Math.floor(S/65536),K=S-f*65536,S=X+f+65535,f=Math.floor(S/65536),X=S-f*65536,S=te+f+65535,f=Math.floor(S/65536),te=S-f*65536,S=Y+f+65535,f=Math.floor(S/65536),Y=S-f*65536,S=ae+f+65535,f=Math.floor(S/65536),ae=S-f*65536,S=fe+f+65535,f=Math.floor(S/65536),fe=S-f*65536,S=se+f+65535,f=Math.floor(S/65536),se=S-f*65536,S=de+f+65535,f=Math.floor(S/65536),de=S-f*65536,S=ye+f+65535,f=Math.floor(S/65536),ye=S-f*65536,S=ge+f+65535,f=Math.floor(S/65536),ge=S-f*65536,S=xe+f+65535,f=Math.floor(S/65536),xe=S-f*65536,S=be+f+65535,f=Math.floor(S/65536),be=S-f*65536,L+=f-1+37*(f-1),f=1,S=L+f+65535,f=Math.floor(S/65536),L=S-f*65536,S=G+f+65535,f=Math.floor(S/65536),G=S-f*65536,S=M+f+65535,f=Math.floor(S/65536),M=S-f*65536,S=V+f+65535,f=Math.floor(S/65536),V=S-f*65536,S=K+f+65535,f=Math.floor(S/65536),K=S-f*65536,S=X+f+65535,f=Math.floor(S/65536),X=S-f*65536,S=te+f+65535,f=Math.floor(S/65536),te=S-f*65536,S=Y+f+65535,f=Math.floor(S/65536),Y=S-f*65536,S=ae+f+65535,f=Math.floor(S/65536),ae=S-f*65536,S=fe+f+65535,f=Math.floor(S/65536),fe=S-f*65536,S=se+f+65535,f=Math.floor(S/65536),se=S-f*65536,S=de+f+65535,f=Math.floor(S/65536),de=S-f*65536,S=ye+f+65535,f=Math.floor(S/65536),ye=S-f*65536,S=ge+f+65535,f=Math.floor(S/65536),ge=S-f*65536,S=xe+f+65535,f=Math.floor(S/65536),xe=S-f*65536,S=be+f+65535,f=Math.floor(S/65536),be=S-f*65536,L+=f-1+37*(f-1),O[0]=L,O[1]=G,O[2]=M,O[3]=V,O[4]=K,O[5]=X,O[6]=te,O[7]=Y,O[8]=ae,O[9]=fe,O[10]=se,O[11]=de,O[12]=ye,O[13]=ge,O[14]=xe,O[15]=be}return jr}var Qr,hn;function Ei(){if(hn)return Qr;hn=1;var a=me();Ee(),at(),Gt(),Qr=a.kem=a.kem||{};var e=a.jsbn.BigInteger;a.kem.rsa={},a.kem.rsa.create=function(d,x){x=x||{};var g=x.prng||a.random,u={};return u.encrypt=function(r,c){var l=Math.ceil(r.n.bitLength()/8),b;do b=new e(a.util.bytesToHex(g.getBytesSync(l)),16).mod(r.n);while(b.compareTo(e.ONE)<=0);b=a.util.hexToBytes(b.toString(16));var T=l-b.length;T>0&&(b=a.util.fillString("\0",T)+b);var E=r.encrypt(b,"NONE"),s=d.generate(b,c);return{encapsulation:E,key:s}},u.decrypt=function(r,c,l){var b=r.decrypt(c,"NONE");return d.generate(b,l)},u},a.kem.kdf1=function(d,x){t(this,d,0,x||d.digestLength)},a.kem.kdf2=function(d,x){t(this,d,1,x||d.digestLength)};function t(d,x,g,u){d.generate=function(r,c){for(var l=new a.util.ByteBuffer,b=Math.ceil(c/u)+g,T=new a.util.ByteBuffer,E=g;E<b;++E){T.putInt32(E),x.start(),x.update(r+T.getBytes());var s=x.digest();l.putBytes(s.getBytes(u))}return l.truncate(l.length()-c),l.getBytes()}}return Qr}var Yr,dn;function Si(){if(dn)return Yr;dn=1;var a=me();Ee(),Yr=a.log=a.log||{},a.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},t=[],d=null;a.log.LEVEL_LOCKED=2,a.log.NO_LEVEL_CHECK=4,a.log.INTERPOLATE=8;for(var x=0;x<a.log.levels.length;++x){var g=a.log.levels[x];e[g]={index:x,name:g.toUpperCase()}}a.log.logMessage=function(E){for(var s=e[E.level].index,v=0;v<t.length;++v){var h=t[v];if(h.flags&a.log.NO_LEVEL_CHECK)h.f(E);else{var y=e[h.level].index;s<=y&&h.f(h,E)}}},a.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},a.log.prepareFull=function(E){if(!("full"in E)){var s=[E.message];s=s.concat([]),E.full=a.util.format.apply(this,s)}},a.log.prepareStandardFull=function(E){"standardFull"in E||(a.log.prepareStandard(E),E.standardFull=E.standard)};for(var u=["error","warning","info","debug","verbose"],x=0;x<u.length;++x)(function(s){a.log[s]=function(v,h){var y=Array.prototype.slice.call(arguments).slice(2),n={timestamp:new Date,level:s,category:v,message:h,arguments:y};a.log.logMessage(n)}})(u[x]);if(a.log.makeLogger=function(E){var s={flags:0,f:E};return a.log.setLevel(s,"none"),s},a.log.setLevel=function(E,s){var v=!1;if(E&&!(E.flags&a.log.LEVEL_LOCKED))for(var h=0;h<a.log.levels.length;++h){var y=a.log.levels[h];if(s==y){E.level=s,v=!0;break}}return v},a.log.lock=function(E,s){typeof s>"u"||s?E.flags|=a.log.LEVEL_LOCKED:E.flags&=~a.log.LEVEL_LOCKED},a.log.addLogger=function(E){t.push(E)},typeof console<"u"&&"log"in console){var r;if(console.error&&console.warn&&console.info&&console.debug){var c={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},l=function(E,s){a.log.prepareStandard(s);var v=c[s.level],h=[s.standard];h=h.concat(s.arguments.slice()),v.apply(console,h)};r=a.log.makeLogger(l)}else{var l=function(s,v){a.log.prepareStandardFull(v),console.log(v.standardFull)};r=a.log.makeLogger(l)}a.log.setLevel(r,"debug"),a.log.addLogger(r),d=r}else console={log:function(){}};if(d!==null&&typeof window<"u"&&window.location){var b=new URL(window.location.href).searchParams;if(b.has("console.level")&&a.log.setLevel(d,b.get("console.level").slice(-1)[0]),b.has("console.lock")){var T=b.get("console.lock").slice(-1)[0];T=="true"&&a.log.lock(d)}}return a.log.consoleLogger=d,Yr}var Zr,pn;function bi(){return pn||(pn=1,Zr=ct(),Sr(),Nt(),Na(),ln()),Zr}var Xr={exports:{}},gn;function _i(){if(gn)return Xr.exports;gn=1;var a=me();yt(),ft(),qt(),mt(),xt(),Qa(),at(),Ee(),Hr();var e=a.asn1,t=Xr.exports=a.pkcs7=a.pkcs7||{};t.messageFromPem=function(s){var v=a.pem.decode(s)[0];if(v.type!=="PKCS7"){var h=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw h.headerType=v.type,h}if(v.procType&&v.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var y=e.fromDer(v.body);return t.messageFromAsn1(y)},t.messageToPem=function(s,v){var h={type:"PKCS7",body:e.toDer(s.toAsn1()).getBytes()};return a.pem.encode(h,{maxline:v})},t.messageFromAsn1=function(s){var v={},h=[];if(!e.validate(s,t.asn1.contentInfoValidator,v,h)){var y=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw y.errors=h,y}var n=e.derToOid(v.contentType),p;switch(n){case a.pki.oids.envelopedData:p=t.createEnvelopedData();break;case a.pki.oids.encryptedData:p=t.createEncryptedData();break;case a.pki.oids.signedData:p=t.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return p.fromAsn1(v.content.value[0]),p},t.createSignedData=function(){var s=null;return s={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(y){if(T(s,y,t.asn1.signedDataValidator),s.certificates=[],s.crls=[],s.digestAlgorithmIdentifiers=[],s.contentInfo=null,s.signerInfos=[],s.rawCapture.certificates)for(var n=s.rawCapture.certificates.value,p=0;p<n.length;++p)s.certificates.push(a.pki.certificateFromAsn1(n[p]))},toAsn1:function(){s.contentInfo||s.sign();for(var y=[],n=0;n<s.certificates.length;++n)y.push(a.pki.certificateToAsn1(s.certificates[n]));var p=[],m=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s.digestAlgorithmIdentifiers),s.contentInfo])]);return y.length>0&&m.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,y)),p.length>0&&m.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,p)),m.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),m])},addSigner:function(y){var n=y.issuer,p=y.serialNumber;if(y.certificate){var m=y.certificate;typeof m=="string"&&(m=a.pki.certificateFromPem(m)),n=m.issuer.attributes,p=m.serialNumber}var _=y.key;if(!_)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof _=="string"&&(_=a.pki.privateKeyFromPem(_));var w=y.digestAlgorithm||a.pki.oids.sha1;switch(w){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+w)}var C=y.authenticatedAttributes||[];if(C.length>0){for(var o=!1,i=!1,B=0;B<C.length;++B){var N=C[B];if(!o&&N.type===a.pki.oids.contentType){if(o=!0,i)break;continue}if(!i&&N.type===a.pki.oids.messageDigest){if(i=!0,o)break;continue}}if(!o||!i)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}s.signers.push({key:_,version:1,issuer:n,serialNumber:p,digestAlgorithm:w,signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:C,unauthenticatedAttributes:[]})},sign:function(y){if(y=y||{},(typeof s.content!="object"||s.contentInfo===null)&&(s.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes())]),"content"in s)){var n;s.content instanceof a.util.ByteBuffer?n=s.content.bytes():typeof s.content=="string"&&(n=a.util.encodeUtf8(s.content)),y.detached?s.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n):s.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)]))}if(s.signers.length!==0){var p=v();h(p)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(y){typeof y=="string"&&(y=a.pki.certificateFromPem(y)),s.certificates.push(y)},addCertificateRevokationList:function(y){throw new Error("PKCS#7 CRL support not yet implemented.")}},s;function v(){for(var y={},n=0;n<s.signers.length;++n){var p=s.signers[n],m=p.digestAlgorithm;m in y||(y[m]=a.md[a.pki.oids[m]].create()),p.authenticatedAttributes.length===0?p.md=y[m]:p.md=a.md[a.pki.oids[m]].create()}s.digestAlgorithmIdentifiers=[];for(var m in y)s.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(m).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return y}function h(y){var n;if(s.detachedContent?n=s.detachedContent:(n=s.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var p=e.derToOid(s.contentInfo.value[0].value),m=e.toDer(n);m.getByte(),e.getBerValueLength(m),m=m.getBytes();for(var _ in y)y[_].start().update(m);for(var w=new Date,C=0;C<s.signers.length;++C){var o=s.signers[C];if(o.authenticatedAttributes.length===0){if(p!==a.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{o.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var i=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),B=0;B<o.authenticatedAttributes.length;++B){var N=o.authenticatedAttributes[B];N.type===a.pki.oids.messageDigest?N.value=y[o.digestAlgorithm].digest():N.type===a.pki.oids.signingTime&&(N.value||(N.value=w)),i.value.push(l(N)),o.authenticatedAttributesAsn1.value.push(l(N))}m=e.toDer(i).getBytes(),o.md.start().update(m)}o.signature=o.key.sign(o.md,"RSASSA-PKCS1-V1_5")}s.signerInfos=c(s.signers)}},t.createEncryptedData=function(){var s=null;return s={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(v){T(s,v,t.asn1.encryptedDataValidator)},decrypt:function(v){v!==void 0&&(s.encryptedContent.key=v),E(s)}},s},t.createEnvelopedData=function(){var s=null;return s={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(v){var h=T(s,v,t.asn1.envelopedDataValidator);s.recipients=g(h.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u(s.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,b(s.encryptedContent))])])])},findRecipient:function(v){for(var h=v.issuer.attributes,y=0;y<s.recipients.length;++y){var n=s.recipients[y],p=n.issuer;if(n.serialNumber===v.serialNumber&&p.length===h.length){for(var m=!0,_=0;_<h.length;++_)if(p[_].type!==h[_].type||p[_].value!==h[_].value){m=!1;break}if(m)return n}}return null},decrypt:function(v,h){if(s.encryptedContent.key===void 0&&v!==void 0&&h!==void 0)switch(v.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var y=h.decrypt(v.encryptedContent.content);s.encryptedContent.key=a.util.createBuffer(y);break;default:throw new Error("Unsupported asymmetric cipher, OID "+v.encryptedContent.algorithm)}E(s)},addRecipient:function(v){s.recipients.push({version:0,issuer:v.issuer.attributes,serialNumber:v.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:v.publicKey}})},encrypt:function(v,h){if(s.encryptedContent.content===void 0){h=h||s.encryptedContent.algorithm,v=v||s.encryptedContent.key;var y,n,p;switch(h){case a.pki.oids["aes128-CBC"]:y=16,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:y=24,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:y=32,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:y=24,n=8,p=a.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+h)}if(v===void 0)v=a.util.createBuffer(a.random.getBytes(y));else if(v.length()!=y)throw new Error("Symmetric key has wrong length; got "+v.length()+" bytes, expected "+y+".");s.encryptedContent.algorithm=h,s.encryptedContent.key=v,s.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(n));var m=p(v);if(m.start(s.encryptedContent.parameter.copy()),m.update(s.content),!m.finish())throw new Error("Symmetric encryption failed.");s.encryptedContent.content=m.output}for(var _=0;_<s.recipients.length;++_){var w=s.recipients[_];if(w.encryptedContent.content===void 0)switch(w.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:w.encryptedContent.content=w.encryptedContent.key.encrypt(s.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+w.encryptedContent.algorithm)}}}},s};function d(s){var v={},h=[];if(!e.validate(s,t.asn1.recipientInfoValidator,v,h)){var y=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw y.errors=h,y}return{version:v.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(v.issuer),serialNumber:a.util.createBuffer(v.serial).toHex(),encryptedContent:{algorithm:e.derToOid(v.encAlgorithm),parameter:v.encParameter?v.encParameter.value:void 0,content:v.encKey}}}function x(s){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:s.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(s.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.encryptedContent.content)])}function g(s){for(var v=[],h=0;h<s.length;++h)v.push(d(s[h]));return v}function u(s){for(var v=[],h=0;h<s.length;++h)v.push(x(s[h]));return v}function r(s){var v=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:s.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(s.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(s.authenticatedAttributesAsn1&&v.value.push(s.authenticatedAttributesAsn1),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.signature)),s.unauthenticatedAttributes.length>0){for(var h=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),y=0;y<s.unauthenticatedAttributes.length;++y){var n=s.unauthenticatedAttributes[y];h.values.push(l(n))}v.value.push(h)}return v}function c(s){for(var v=[],h=0;h<s.length;++h)v.push(r(s[h]));return v}function l(s){var v;if(s.type===a.pki.oids.contentType)v=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.value).getBytes());else if(s.type===a.pki.oids.messageDigest)v=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.value.bytes());else if(s.type===a.pki.oids.signingTime){var h=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z"),n=s.value;if(typeof n=="string"){var p=Date.parse(n);isNaN(p)?n.length===13?n=e.utcTimeToDate(n):n=e.generalizedTimeToDate(n):n=new Date(p)}n>=h&&n<y?v=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(n)):v=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(n))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[v])])}function b(s){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.algorithm).getBytes()),s.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.content.getBytes())])]}function T(s,v,h){var y={},n=[];if(!e.validate(v,h,y,n)){var p=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw p.errors=p,p}var m=e.derToOid(y.contentType);if(m!==a.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(y.encryptedContent){var _="";if(a.util.isArray(y.encryptedContent))for(var w=0;w<y.encryptedContent.length;++w){if(y.encryptedContent[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");_+=y.encryptedContent[w].value}else _=y.encryptedContent;s.encryptedContent={algorithm:e.derToOid(y.encAlgorithm),parameter:a.util.createBuffer(y.encParameter.value),content:a.util.createBuffer(_)}}if(y.content){var _="";if(a.util.isArray(y.content))for(var w=0;w<y.content.length;++w){if(y.content[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");_+=y.content[w].value}else _=y.content;s.content=a.util.createBuffer(_)}return s.version=y.version.charCodeAt(0),s.rawCapture=y,y}function E(s){if(s.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(s.content===void 0){var v;switch(s.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:v=a.aes.createDecryptionCipher(s.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:v=a.des.createDecryptionCipher(s.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+s.encryptedContent.algorithm)}if(v.start(s.encryptedContent.parameter),v.update(s.encryptedContent.content),!v.finish())throw new Error("Symmetric decryption failed.");s.content=v.output}}return Xr.exports}var $r={exports:{}},vn;function Ti(){if(vn)return $r.exports;vn=1;var a=me();yt(),Rt(),Sr(),Nt(),Ee();var e=$r.exports=a.ssh=a.ssh||{};e.privateKeyToPutty=function(g,u,r){r=r||"",u=u||"";var c="ssh-rsa",l=u===""?"none":"aes256-cbc",b="PuTTY-User-Key-File-2: "+c+`\r
|
|
16
|
-
`;b+="Encryption: "+l+`\r
|
|
17
|
-
`,b+="Comment: "+r+`\r
|
|
18
|
-
`;var T=a.util.createBuffer();d(T,c),t(T,g.e),t(T,g.n);var E=a.util.encode64(T.bytes(),64),s=Math.floor(E.length/66)+1;b+="Public-Lines: "+s+`\r
|
|
19
|
-
`,b+=E;var v=a.util.createBuffer();t(v,g.d),t(v,g.p),t(v,g.q),t(v,g.qInv);var h;if(!u)h=a.util.encode64(v.bytes(),64);else{var y=v.length()+16-1;y-=y%16;var n=x(v.bytes());n.truncate(n.length()-y+v.length()),v.putBuffer(n);var p=a.util.createBuffer();p.putBuffer(x("\0\0\0\0",u)),p.putBuffer(x("\0\0\0",u));var m=a.aes.createEncryptionCipher(p.truncate(8),"CBC");m.start(a.util.createBuffer().fillWithByte(0,16)),m.update(v.copy()),m.finish();var _=m.output;_.truncate(16),h=a.util.encode64(_.bytes(),64)}s=Math.floor(h.length/66)+1,b+=`\r
|
|
20
|
-
Private-Lines: `+s+`\r
|
|
21
|
-
`,b+=h;var w=x("putty-private-key-file-mac-key",u),C=a.util.createBuffer();d(C,c),d(C,l),d(C,r),C.putInt32(T.length()),C.putBuffer(T),C.putInt32(v.length()),C.putBuffer(v);var o=a.hmac.create();return o.start("sha1",w),o.update(C.bytes()),b+=`\r
|
|
22
|
-
Private-MAC: `+o.digest().toHex()+`\r
|
|
23
|
-
`,b},e.publicKeyToOpenSSH=function(g,u){var r="ssh-rsa";u=u||"";var c=a.util.createBuffer();return d(c,r),t(c,g.e),t(c,g.n),r+" "+a.util.encode64(c.bytes())+" "+u},e.privateKeyToOpenSSH=function(g,u){return u?a.pki.encryptRsaPrivateKey(g,u,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(g)},e.getPublicKeyFingerprint=function(g,u){u=u||{};var r=u.md||a.md.md5.create(),c="ssh-rsa",l=a.util.createBuffer();d(l,c),t(l,g.e),t(l,g.n),r.start(),r.update(l.getBytes());var b=r.digest();if(u.encoding==="hex"){var T=b.toHex();return u.delimiter?T.match(/.{2}/g).join(u.delimiter):T}else{if(u.encoding==="binary")return b.getBytes();if(u.encoding)throw new Error('Unknown encoding "'+u.encoding+'".')}return b};function t(g,u){var r=u.toString(16);r[0]>="8"&&(r="00"+r);var c=a.util.hexToBytes(r);g.putInt32(c.length),g.putBytes(c)}function d(g,u){g.putInt32(u.length),g.putString(u)}function x(){for(var g=a.md.sha1.create(),u=arguments.length,r=0;r<u;++r)g.update(arguments[r]);return g.digest()}return $r.exports}var Jr,yn;function Ai(){return yn||(yn=1,Jr=me(),yt(),mi(),ft(),dr(),qt(),xi(),Rt(),Ei(),Si(),bi(),Za(),wr(),xt(),Ka(),tn(),_i(),an(),qa(),Da(),qr(),at(),Oa(),Ti(),sn(),Ee()),Jr}var ea=Ai();const Ii="evtrsa1",ta=new Map;function mn(a){return a.replace(/\/+$/,"")}function wi(a){return new TextEncoder().encode(a)}function Yt(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}async function Bi(a,e){const t=typeof AbortController<"u"?new AbortController:void 0,d=t?setTimeout(()=>t.abort(),e):void 0;try{const x=await fetch(a,{method:"GET",headers:{Accept:"application/json"},signal:t?.signal}),g=await x.json().catch(()=>({}));if(!x.ok){const u=g?.error?.message??g?.message??`ViewToken public key request failed with status ${x.status}`;throw new Error(u)}return g}finally{d!=null&&clearTimeout(d)}}function ra(a){const e=globalThis.crypto;if(!e?.getRandomValues)throw new Error("[BimEngine] crypto.getRandomValues is required to encrypt viewToken");return e.getRandomValues(new Uint8Array(a))}function ki(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),e}function Ri(a){const e=new Uint8Array(a.length);for(let t=0;t<a.length;t+=1)e[t]=a.charCodeAt(t)&255;return e}async function Ni(a,e){const t=`${mn(a)}/models/view-token/public-key`,d=await Bi(t,e);if(d.algorithm!=="RSA-OAEP-256"||!d.publicKey)throw new Error("[BimEngine] OpenAPI returned an invalid viewToken public key");return ea.pki.publicKeyFromPem(d.publicKey)}function Li(a,e){const t=mn(a),d=ta.get(t);if(d)return d;const x=Ni(a,e).catch(g=>{throw ta.delete(t),g});return ta.set(t,x),x}async function Di(a,e,t){const d=await Li(a,t),x=ra(32),g=ra(12),u=ra(16),r=JSON.stringify({viewToken:e,timestamp:Date.now(),nonce:Yt(u)}),c=d.encrypt(ki(x),"RSA-OAEP",{md:ea.md.sha256.create(),mgf1:{md:ea.md.sha256.create()}}),l=gi(x,g).encrypt(wi(r));return[Ii,Yt(Ri(c)),Yt(g),Yt(l)].join(".")}function Ui(a){return a.replace(/\/+$/,"")}async function Pi(a,e,t){const d=typeof AbortController<"u"?new AbortController:void 0,x=d?setTimeout(()=>d.abort(),t):void 0;try{const g=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:d?.signal}),u=await g.json().catch(()=>({}));if(!g.ok){const r=u?.error?.message??u?.message??`ViewToken resolve failed with status ${g.status}`;throw new Error(r)}return u}finally{x!=null&&clearTimeout(x)}}function Oi(a){switch(a){case"2d":return"cad_model";case"720":return"panorama";case"gis":return"gis_scene";case"gaussian":return"gaussian_model";case"3d":default:return"model"}}function Fi(a){return{models:[{modelType:a.toLowerCase().endsWith(".json")?"3dtiles":"glb",url:a}]}}function Vi(a,e){return{applicationId:0,engineType:e,assetCategory:Oi(e),url:a,urls:[a],info:e==="gis"?Fi(a):void 0}}async function Mi(a,e,t){const d=a?.sdkAuth;if(!d?.endpoint)return Vi(e,t);let x;(d.token||d.appId&&d.appKey&&d.appSecret)&&(x=(await jn(a,t))?.sdkToken);const u={viewToken:await Di(d.endpoint,e,d.timeoutMs??8e3),engineType:t};return x&&(u.sdkToken=x),Pi(`${Ui(d.endpoint)}/models/view-token/resolve`,u,d.timeoutMs??8e3)}class Cn{eventModule;sceneModule;cameraModule;renderModule;controlModule;loaderModule;isInitialized=!1;options;version=_t;constructor(e){this.options=e,this.initialize(e)}initialize(e){const t={containerId:e.containerId,cameraUp:e.cameraUp??[0,1,0],initialCameraPosition:e.initialCameraPosition??[0,0,6],initialCameraLookAt:e.initialCameraLookAt??[0,0,0],backgroundColor:e.backgroundColor,antialias:e.antialias??!1,showLoadingUI:!1,sharedMemoryForWorkers:e.sharedMemoryForWorkers??!1,gpuAcceleratedSort:e.gpuAcceleratedSort??!1,sphericalHarmonicsDegree:e.sphericalHarmonicsDegree??0,orientationPreset:e.orientationPreset??"x180",viewerOptions:e.viewerOptions},d=document.getElementById(t.containerId);if(!d)throw new Error(`Container with id "${t.containerId}" not found`);this.eventModule=new En,this.sceneModule=new Sn(t.backgroundColor),this.cameraModule=new bn(d,t.cameraUp,t.initialCameraPosition,t.initialCameraLookAt),this.controlModule=new Nn(t.orientationPreset),this.renderModule=new kn(d,this.sceneModule.getScene(),this.cameraModule.getCamera(),t),this.loaderModule=new Fn(this.renderModule.getViewer(),()=>this.controlModule.getOrientationRotation()),this.renderModule.setOnBeforeRender(()=>{this.controlModule.update()}),this.renderModule.setOnFpsUpdated(x=>{this.eventModule.trigger(Je.FpsUpdated,x)}),this.renderModule.startRenderLoop(),this.isInitialized=!0}async loadModel(e,t={}){this.checkInitialized(),this.eventModule.trigger(Je.LoadStart,{url:e,name:t.name});try{const d=await this.loaderModule.loadModel(e,{...t,showLoadingUI:!1,onProgress:(x,g,u)=>{this.eventModule.trigger(Je.LoadProgress,{url:e,name:t.name,progress:x}),t.onProgress?.(x,g,u)}});return this.eventModule.trigger(Je.Loaded,{url:e,name:d.name,progress:100}),d}catch(d){throw this.eventModule.trigger(Je.LoadError,{url:e,name:t.name,error:d instanceof Error?d:new Error(String(d))}),d}}async loadModelFile(e,t={}){this.checkInitialized();const d=e[0]?.name??"local-file";this.eventModule.trigger(Je.LoadStart,{url:d,name:t.name??d});try{const x=await this.loaderModule.loadModelFile(e,{...t,showLoadingUI:!1,onProgress:(g,u,r)=>{this.eventModule.trigger(Je.LoadProgress,{url:d,name:t.name??d,progress:g}),t.onProgress?.(g,u,r)}});return this.eventModule.trigger(Je.Loaded,{url:d,name:x.name,progress:100}),x}catch(x){throw this.eventModule.trigger(Je.LoadError,{url:d,name:t.name??d,error:x instanceof Error?x:new Error(String(x))}),x}}async loadModelByViewToken(e,t={}){const d=await Mi(this.options,e,"gaussian");if(d.assetCategory==="composite_model"&&d.urls.length>1)throw new Error("EngineKernelGaussian: composite_model viewToken is not supported");return this.loadModel(d.url,t)}async unloadModel(e){this.checkInitialized(),await this.loaderModule.unloadModel(e,!1),this.eventModule.trigger(Je.SceneRemoved,{id:e})}setOrientationPreset(e){this.checkInitialized(),this.controlModule.setOrientationPreset(e)}getOrientationPreset(){return this.checkInitialized(),this.controlModule.getOrientationPreset()}resize(e,t){this.checkInitialized();const d=this.renderModule.getDomElement(),x=e??d.parentElement?.clientWidth??d.clientWidth,g=t??d.parentElement?.clientHeight??d.clientHeight;this.renderModule.resize(x,g),this.cameraModule.updateAspectRatio(x,g)}pauseRendering(){this.checkInitialized(),this.renderModule.pauseRendering()}resumeRendering(){this.checkInitialized(),this.renderModule.resumeRendering()}resetFpsStats(){this.checkInitialized(),this.renderModule.resetFpsStats()}getFpsInfo(){return this.checkInitialized(),this.renderModule.getFpsInfo()}on(e,t){this.checkInitialized(),this.eventModule.on(e,t)}off(e,t){this.checkInitialized(),this.eventModule.off(e,t)}getVersion(){return this.version}async dispose(){this.isInitialized&&(await this.loaderModule.clear(!1),await this.renderModule.dispose(),this.controlModule.dispose(),this.cameraModule.dispose(),this.sceneModule.dispose(),this.eventModule.dispose(),this.isInitialized=!1)}checkInitialized(){if(!this.isInitialized)throw new Error("EngineKernelGaussian: Not initialized")}}function Ki(a){return new Cn(a)}rt.GaussianSplats3D=ia,rt.EngineKernelGaussian=Cn,rt.EventTypeGaussian=Je,rt.createEngineGaussian=Ki,Object.defineProperty(rt,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(rt,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("three"),require("@mkkellogg/gaussian-splats-3d")):typeof define=="function"&&define.amd?define(["exports","three","@mkkellogg/gaussian-splats-3d"],St):(rt=typeof globalThis<"u"?globalThis:rt||self,St(rt.Gaussian={},rt.THREE,rt.GaussianSplats3D))})(this,(function(rt,St,xn){"use strict";function na(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const d=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,d.get?d:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const dt=na(St),ia=na(xn);var Je=(a=>(a.LoadStart="gaussian-load-start",a.LoadProgress="gaussian-load-progress",a.Loaded="gaussian-loaded",a.LoadError="gaussian-load-error",a.SceneRemoved="gaussian-scene-removed",a.FpsUpdated="gaussian-fps-updated",a.ViewChanged="gaussian-view-changed",a))(Je||{});class En{listeners=new Map;on(e,t){const d=String(e);this.listeners.has(d)||this.listeners.set(d,[]),this.listeners.get(d).push(t)}off(e,t){const d=String(e),x=this.listeners.get(d);if(!x)return;const g=x.indexOf(t);g!==-1&&x.splice(g,1),x.length===0&&this.listeners.delete(d)}trigger(e,t){const d=this.listeners.get(String(e));!d||d.length===0||[...d].forEach(x=>{try{x(t)}catch(g){console.error(`[EventModuleGaussian] event handler failed: ${e}`,g)}})}clear(){this.listeners.clear()}dispose(){this.clear()}}class Sn{scene;constructor(e){this.scene=new dt.Scene,e&&(this.scene.background=new dt.Color(e))}getScene(){return this.scene}setBackgroundColor(e){this.scene.background=e==null?null:new dt.Color(e)}dispose(){this.scene.clear(),this.scene.background=null,this.scene.environment=null}}class bn{camera;container;cameraUp;initialLookAt;constructor(e,t,d,x){this.container=e,this.cameraUp=t,this.initialLookAt=x,this.camera=this.createCamera(d)}createCamera(e){const t=Math.max(this.container.clientWidth,1),d=Math.max(this.container.clientHeight,1),x=new dt.PerspectiveCamera(65,t/d,.1,5e3);return x.position.fromArray(e),x.up.fromArray(this.cameraUp).normalize(),x.lookAt(new dt.Vector3().fromArray(this.initialLookAt)),x.updateProjectionMatrix(),x}getCamera(){return this.camera}updateAspectRatio(e,t){this.camera.aspect=Math.max(e,1)/Math.max(t,1),this.camera.updateProjectionMatrix()}reset(e,t){e&&this.camera.position.fromArray(e),this.camera.lookAt(new dt.Vector3().fromArray(t??this.initialLookAt)),this.camera.updateMatrixWorld(!0)}dispose(){this.camera=null}}const _n="iflowbim.cn",Tn=512,An=128,In=150,wn=38,Dt=290,Jt=190;class Bn{THREE;text;scene;camera;material;sprites=[];size;viewportWidth=0;viewportHeight=0;constructor(e,t=_n){this.THREE=e,this.text=t,this.scene=new e.Scene,this.camera=new e.OrthographicCamera(0,1,1,0,-10,10),this.material=new e.SpriteMaterial({map:new e.CanvasTexture(this.createTextTexture()),transparent:!0,opacity:.46,depthTest:!1,depthWrite:!1,toneMapped:!1}),this.size=new e.Vector2}render(e){}dispose(){this.material.map?.dispose?.(),this.material.dispose?.(),this.sprites.length=0}createTextTexture(){const e=document.createElement("canvas");e.width=Tn,e.height=An;const t=e.getContext("2d");return t&&(t.clearRect(0,0,e.width,e.height),t.textAlign="center",t.textBaseline="middle",t.font="600 54px Arial, Helvetica, sans-serif",t.lineWidth=3,t.strokeStyle="rgba(0, 0, 0, 0.20)",t.fillStyle="rgba(255, 255, 255, 0.24)",t.strokeText(this.text,e.width/2,e.height/2),t.fillText(this.text,e.width/2,e.height/2)),e}updateLayout(e,t){if(e===this.viewportWidth&&t===this.viewportHeight)return;this.viewportWidth=e,this.viewportHeight=t,this.camera.left=-e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-t/2,this.camera.updateProjectionMatrix();const d=Math.ceil(e/Dt)+2,x=Math.ceil(t/Jt)+2,g=d*x;this.ensureSpriteCount(g);let u=0;const r=-e/2-Dt/2,c=-t/2-Jt/2;for(let l=0;l<x;l+=1)for(let b=0;b<d;b+=1){const T=this.sprites[u],E=r+b*Dt+l%2*(Dt/2),s=c+l*Jt;T.position.set(E,s,0),T.visible=!0,u+=1}for(let l=u;l<this.sprites.length;l+=1)this.sprites[l].visible=!1}ensureSpriteCount(e){for(;this.sprites.length<e;){const t=new this.THREE.Sprite(this.material);t.scale.set(In,wn,1),t.rotation.z=-.32,t.renderOrder=999999,this.scene.add(t),this.sprites.push(t)}}}class kn{renderer;viewer;container;animationId=null;isRenderingPaused=!0;fpsFrameCount=0;fpsLastTime=performance.now();fpsInfo={fps:0,frameTimeMs:0,minFps:0};watermark;onBeforeRenderCallback;onAfterRenderCallback;onFpsUpdatedCallback;constructor(e,t,d,x){this.container=e,this.renderer=this.createRenderer(x.antialias),this.watermark=new Bn(dt),this.viewer=new ia.Viewer({selfDrivenMode:!1,renderer:this.renderer,camera:d,threeScene:t,rootElement:e,useBuiltInControls:!0,cameraUp:x.cameraUp,initialCameraPosition:x.initialCameraPosition,initialCameraLookAt:x.initialCameraLookAt,sharedMemoryForWorkers:x.sharedMemoryForWorkers,gpuAcceleratedSort:x.gpuAcceleratedSort,sphericalHarmonicsDegree:x.sphericalHarmonicsDegree,...x.viewerOptions??{}})}createRenderer(e){const t=new dt.WebGLRenderer({antialias:e,alpha:!0,preserveDrawingBuffer:!1});return t.setSize(Math.max(this.container.clientWidth,1),Math.max(this.container.clientHeight,1)),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.container.appendChild(t.domElement),t}setOnBeforeRender(e){this.onBeforeRenderCallback=e}setOnAfterRender(e){this.onAfterRenderCallback=e}setOnFpsUpdated(e){this.onFpsUpdatedCallback=e}startRenderLoop(){this.animationId===null&&(this.isRenderingPaused=!1,this.animate())}animate(){if(this.isRenderingPaused){this.animationId=null;return}this.animationId=requestAnimationFrame(()=>this.animate()),this.render()}render(){this.onBeforeRenderCallback?.(),this.viewer.update(this.renderer),this.viewer.render(),this.watermark.render(this.renderer),this.onAfterRenderCallback?.(),this.updateFps()}updateFps(){this.fpsFrameCount++;const e=performance.now(),t=e-this.fpsLastTime;if(t<1e3)return;const d=Math.round(this.fpsFrameCount*1e3/t);this.fpsInfo={fps:d,frameTimeMs:d>0?1e3/d:0,minFps:this.fpsInfo.minFps===0?d:Math.min(this.fpsInfo.minFps,d)},this.fpsFrameCount=0,this.fpsLastTime=e,this.onFpsUpdatedCallback?.({...this.fpsInfo})}resetFpsStats(){this.fpsInfo={fps:0,frameTimeMs:0,minFps:0},this.fpsFrameCount=0,this.fpsLastTime=performance.now()}pauseRendering(){this.isRenderingPaused=!0,this.animationId!==null&&(cancelAnimationFrame(this.animationId),this.animationId=null)}resumeRendering(){this.isRenderingPaused&&this.startRenderLoop()}isRenderingPausedState(){return this.isRenderingPaused}resize(e,t){this.renderer.setSize(Math.max(e,1),Math.max(t,1)),this.renderer.setPixelRatio(Math.min(window.devicePixelRatio,2))}getViewer(){return this.viewer}getRenderer(){return this.renderer}getDomElement(){return this.renderer.domElement}getFpsInfo(){return{...this.fpsInfo}}async dispose(){this.pauseRendering(),await this.viewer.dispose(),this.container.contains(this.renderer.domElement)&&this.container.removeChild(this.renderer.domElement),this.watermark.dispose(),this.renderer.dispose(),this.renderer.forceContextLoss()}}const Rn={identity:[0,0,0,1],"x-90":[-.7071068,0,0,.7071068],x90:[.7071068,0,0,.7071068],x180:[1,0,0,0],"y-90":[0,-.7071068,0,.7071068],y90:[0,.7071068,0,.7071068],"z-90":[0,0,-.7071068,.7071068],z90:[0,0,.7071068,.7071068],z180:[0,0,1,0]};class Nn{orientationPreset;constructor(e="x180"){this.orientationPreset=e}setOrientationPreset(e){this.orientationPreset=e}getOrientationPreset(){return this.orientationPreset}getOrientationRotation(){return[...Rn[this.orientationPreset]]}active(){}disActive(){}update(){}dispose(){}}var bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ln(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var e=a.default;if(typeof e=="function"){var t=function d(){var x=!1;try{x=this instanceof d}catch{}return x?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(a).forEach(function(d){var x=Object.getOwnPropertyDescriptor(a,d);Object.defineProperty(t,d,x.get?x:{enumerable:!0,get:function(){return a[d]}})}),t}function Ut(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var er={exports:{}};var sa;function Dn(){return sa||(sa=1,(function(a,e){(function(t){a.exports=t()})(function(){return(function t(d,x,g){function u(l,b){if(!x[l]){if(!d[l]){var T=typeof Ut=="function"&&Ut;if(!b&&T)return T(l,!0);if(r)return r(l,!0);var E=new Error("Cannot find module '"+l+"'");throw E.code="MODULE_NOT_FOUND",E}var s=x[l]={exports:{}};d[l][0].call(s.exports,function(v){var h=d[l][1][v];return u(h||v)},s,s.exports,t,d,x,g)}return x[l].exports}for(var r=typeof Ut=="function"&&Ut,c=0;c<g.length;c++)u(g[c]);return u})({1:[function(t,d,x){var g=t("./utils"),u=t("./support"),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";x.encode=function(c){for(var l,b,T,E,s,v,h,y=[],n=0,p=c.length,m=p,_=g.getTypeOf(c)!=="string";n<c.length;)m=p-n,T=_?(l=c[n++],b=n<p?c[n++]:0,n<p?c[n++]:0):(l=c.charCodeAt(n++),b=n<p?c.charCodeAt(n++):0,n<p?c.charCodeAt(n++):0),E=l>>2,s=(3&l)<<4|b>>4,v=1<m?(15&b)<<2|T>>6:64,h=2<m?63&T:64,y.push(r.charAt(E)+r.charAt(s)+r.charAt(v)+r.charAt(h));return y.join("")},x.decode=function(c){var l,b,T,E,s,v,h=0,y=0,n="data:";if(c.substr(0,n.length)===n)throw new Error("Invalid base64 input, it looks like a data url.");var p,m=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===r.charAt(64)&&m--,c.charAt(c.length-2)===r.charAt(64)&&m--,m%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=u.uint8array?new Uint8Array(0|m):new Array(0|m);h<c.length;)l=r.indexOf(c.charAt(h++))<<2|(E=r.indexOf(c.charAt(h++)))>>4,b=(15&E)<<4|(s=r.indexOf(c.charAt(h++)))>>2,T=(3&s)<<6|(v=r.indexOf(c.charAt(h++))),p[y++]=l,s!==64&&(p[y++]=b),v!==64&&(p[y++]=T);return p}},{"./support":30,"./utils":32}],2:[function(t,d,x){var g=t("./external"),u=t("./stream/DataWorker"),r=t("./stream/Crc32Probe"),c=t("./stream/DataLengthProbe");function l(b,T,E,s,v){this.compressedSize=b,this.uncompressedSize=T,this.crc32=E,this.compression=s,this.compressedContent=v}l.prototype={getContentWorker:function(){var b=new u(g.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),T=this;return b.on("end",function(){if(this.streamInfo.data_length!==T.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),b},getCompressedWorker:function(){return new u(g.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},l.createWorkerFrom=function(b,T,E){return b.pipe(new r).pipe(new c("uncompressedSize")).pipe(T.compressWorker(E)).pipe(new c("compressedSize")).withStreamInfo("compression",T)},d.exports=l},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,d,x){var g=t("./stream/GenericWorker");x.STORE={magic:"\0\0",compressWorker:function(){return new g("STORE compression")},uncompressWorker:function(){return new g("STORE decompression")}},x.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,d,x){var g=t("./utils"),u=(function(){for(var r,c=[],l=0;l<256;l++){r=l;for(var b=0;b<8;b++)r=1&r?3988292384^r>>>1:r>>>1;c[l]=r}return c})();d.exports=function(r,c){return r!==void 0&&r.length?g.getTypeOf(r)!=="string"?(function(l,b,T,E){var s=u,v=E+T;l^=-1;for(var h=E;h<v;h++)l=l>>>8^s[255&(l^b[h])];return-1^l})(0|c,r,r.length,0):(function(l,b,T,E){var s=u,v=E+T;l^=-1;for(var h=E;h<v;h++)l=l>>>8^s[255&(l^b.charCodeAt(h))];return-1^l})(0|c,r,r.length,0):0}},{"./utils":32}],5:[function(t,d,x){x.base64=!1,x.binary=!1,x.dir=!1,x.createFolders=!0,x.date=null,x.compression=null,x.compressionOptions=null,x.comment=null,x.unixPermissions=null,x.dosPermissions=null},{}],6:[function(t,d,x){var g=null;g=typeof Promise<"u"?Promise:t("lie"),d.exports={Promise:g}},{lie:37}],7:[function(t,d,x){var g=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",u=t("pako"),r=t("./utils"),c=t("./stream/GenericWorker"),l=g?"uint8array":"array";function b(T,E){c.call(this,"FlateWorker/"+T),this._pako=null,this._pakoAction=T,this._pakoOptions=E,this.meta={}}x.magic="\b\0",r.inherits(b,c),b.prototype.processChunk=function(T){this.meta=T.meta,this._pako===null&&this._createPako(),this._pako.push(r.transformTo(l,T.data),!1)},b.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},b.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},b.prototype._createPako=function(){this._pako=new u[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var T=this;this._pako.onData=function(E){T.push({data:E,meta:T.meta})}},x.compressWorker=function(T){return new b("Deflate",T)},x.uncompressWorker=function(){return new b("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,d,x){function g(s,v){var h,y="";for(h=0;h<v;h++)y+=String.fromCharCode(255&s),s>>>=8;return y}function u(s,v,h,y,n,p){var m,_,w=s.file,C=s.compression,o=p!==l.utf8encode,i=r.transformTo("string",p(w.name)),B=r.transformTo("string",l.utf8encode(w.name)),N=w.comment,q=r.transformTo("string",p(N)),I=r.transformTo("string",l.utf8encode(N)),F=B.length!==w.name.length,A=I.length!==N.length,H="",j="",W="",re=w.dir,J=w.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};v&&!h||(oe.crc32=s.crc32,oe.compressedSize=s.compressedSize,oe.uncompressedSize=s.uncompressedSize);var Q=0;v&&(Q|=8),o||!F&&!A||(Q|=2048);var $=0,ce=0;re&&($|=16),n==="UNIX"?(ce=798,$|=(function(ee,ue){var Se=ee;return ee||(Se=ue?16893:33204),(65535&Se)<<16})(w.unixPermissions,re)):(ce=20,$|=(function(ee){return 63&(ee||0)})(w.dosPermissions)),m=J.getUTCHours(),m<<=6,m|=J.getUTCMinutes(),m<<=5,m|=J.getUTCSeconds()/2,_=J.getUTCFullYear()-1980,_<<=4,_|=J.getUTCMonth()+1,_<<=5,_|=J.getUTCDate(),F&&(j=g(1,1)+g(b(i),4)+B,H+="up"+g(j.length,2)+j),A&&(W=g(1,1)+g(b(q),4)+I,H+="uc"+g(W.length,2)+W);var ie="";return ie+=`
|
|
2
|
+
\0`,ie+=g(Q,2),ie+=C.magic,ie+=g(m,2),ie+=g(_,2),ie+=g(oe.crc32,4),ie+=g(oe.compressedSize,4),ie+=g(oe.uncompressedSize,4),ie+=g(i.length,2),ie+=g(H.length,2),{fileRecord:T.LOCAL_FILE_HEADER+ie+i+H,dirRecord:T.CENTRAL_FILE_HEADER+g(ce,2)+ie+g(q.length,2)+"\0\0\0\0"+g($,4)+g(y,4)+i+H+q}}var r=t("../utils"),c=t("../stream/GenericWorker"),l=t("../utf8"),b=t("../crc32"),T=t("../signature");function E(s,v,h,y){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=h,this.encodeFileName=y,this.streamFiles=s,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(E,c),E.prototype.push=function(s){var v=s.meta.percent||0,h=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(s):(this.bytesWritten+=s.data.length,c.prototype.push.call(this,{data:s.data,meta:{currentFile:this.currentFile,percent:h?(v+100*(h-y-1))/h:100}}))},E.prototype.openedSource=function(s){this.currentSourceOffset=this.bytesWritten,this.currentFile=s.file.name;var v=this.streamFiles&&!s.file.dir;if(v){var h=u(s,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},E.prototype.closedSource=function(s){this.accumulate=!1;var v=this.streamFiles&&!s.file.dir,h=u(s,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),v)this.push({data:(function(y){return T.DATA_DESCRIPTOR+g(y.crc32,4)+g(y.compressedSize,4)+g(y.uncompressedSize,4)})(s),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},E.prototype.flush=function(){for(var s=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var h=this.bytesWritten-s,y=(function(n,p,m,_,w){var C=r.transformTo("string",w(_));return T.CENTRAL_DIRECTORY_END+"\0\0\0\0"+g(n,2)+g(n,2)+g(p,4)+g(m,4)+g(C.length,2)+C})(this.dirRecords.length,h,s,this.zipComment,this.encodeFileName);this.push({data:y,meta:{percent:100}})},E.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},E.prototype.registerPrevious=function(s){this._sources.push(s);var v=this;return s.on("data",function(h){v.processChunk(h)}),s.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),s.on("error",function(h){v.error(h)}),this},E.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},E.prototype.error=function(s){var v=this._sources;if(!c.prototype.error.call(this,s))return!1;for(var h=0;h<v.length;h++)try{v[h].error(s)}catch{}return!0},E.prototype.lock=function(){c.prototype.lock.call(this);for(var s=this._sources,v=0;v<s.length;v++)s[v].lock()},d.exports=E},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(t,d,x){var g=t("../compressions"),u=t("./ZipFileWorker");x.generateWorker=function(r,c,l){var b=new u(c.streamFiles,l,c.platform,c.encodeFileName),T=0;try{r.forEach(function(E,s){T++;var v=(function(p,m){var _=p||m,w=g[_];if(!w)throw new Error(_+" is not a valid compression method !");return w})(s.options.compression,c.compression),h=s.options.compressionOptions||c.compressionOptions||{},y=s.dir,n=s.date;s._compressWorker(v,h).withStreamInfo("file",{name:E,dir:y,date:n,comment:s.comment||"",unixPermissions:s.unixPermissions,dosPermissions:s.dosPermissions}).pipe(b)}),b.entriesCount=T}catch(E){b.error(E)}return b}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(t,d,x){function g(){if(!(this instanceof g))return new g;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 u=new g;for(var r in this)typeof this[r]!="function"&&(u[r]=this[r]);return u}}(g.prototype=t("./object")).loadAsync=t("./load"),g.support=t("./support"),g.defaults=t("./defaults"),g.version="3.10.1",g.loadAsync=function(u,r){return new g().loadAsync(u,r)},g.external=t("./external"),d.exports=g},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(t,d,x){var g=t("./utils"),u=t("./external"),r=t("./utf8"),c=t("./zipEntries"),l=t("./stream/Crc32Probe"),b=t("./nodejsUtils");function T(E){return new u.Promise(function(s,v){var h=E.decompressed.getContentWorker().pipe(new l);h.on("error",function(y){v(y)}).on("end",function(){h.streamInfo.crc32!==E.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):s()}).resume()})}d.exports=function(E,s){var v=this;return s=g.extend(s||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:r.utf8decode}),b.isNode&&b.isStream(E)?u.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):g.prepareContent("the loaded zip file",E,!0,s.optimizedBinaryString,s.base64).then(function(h){var y=new c(s);return y.load(h),y}).then(function(h){var y=[u.Promise.resolve(h)],n=h.files;if(s.checkCRC32)for(var p=0;p<n.length;p++)y.push(T(n[p]));return u.Promise.all(y)}).then(function(h){for(var y=h.shift(),n=y.files,p=0;p<n.length;p++){var m=n[p],_=m.fileNameStr,w=g.resolve(m.fileNameStr);v.file(w,m.decompressed,{binary:!0,optimizedBinaryString:!0,date:m.date,dir:m.dir,comment:m.fileCommentStr.length?m.fileCommentStr:null,unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions,createFolders:s.createFolders}),m.dir||(v.file(w).unsafeOriginalName=_)}return y.zipComment.length&&(v.comment=y.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(t,d,x){var g=t("../utils"),u=t("../stream/GenericWorker");function r(c,l){u.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(l)}g.inherits(r,u),r.prototype._bindStream=function(c){var l=this;(this._stream=c).pause(),c.on("data",function(b){l.push({data:b,meta:{percent:0}})}).on("error",function(b){l.isPaused?this.generatedError=b:l.error(b)}).on("end",function(){l.isPaused?l._upstreamEnded=!0:l.end()})},r.prototype.pause=function(){return!!u.prototype.pause.call(this)&&(this._stream.pause(),!0)},r.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},d.exports=r},{"../stream/GenericWorker":28,"../utils":32}],13:[function(t,d,x){var g=t("readable-stream").Readable;function u(r,c,l){g.call(this,c),this._helper=r;var b=this;r.on("data",function(T,E){b.push(T)||b._helper.pause(),l&&l(E)}).on("error",function(T){b.emit("error",T)}).on("end",function(){b.push(null)})}t("../utils").inherits(u,g),u.prototype._read=function(){this._helper.resume()},d.exports=u},{"../utils":32,"readable-stream":16}],14:[function(t,d,x){d.exports={isNode:typeof Buffer<"u",newBufferFrom:function(g,u){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(g,u);if(typeof g=="number")throw new Error('The "data" argument must not be a number');return new Buffer(g,u)},allocBuffer:function(g){if(Buffer.alloc)return Buffer.alloc(g);var u=new Buffer(g);return u.fill(0),u},isBuffer:function(g){return Buffer.isBuffer(g)},isStream:function(g){return g&&typeof g.on=="function"&&typeof g.pause=="function"&&typeof g.resume=="function"}}},{}],15:[function(t,d,x){function g(w,C,o){var i,B=r.getTypeOf(C),N=r.extend(o||{},b);N.date=N.date||new Date,N.compression!==null&&(N.compression=N.compression.toUpperCase()),typeof N.unixPermissions=="string"&&(N.unixPermissions=parseInt(N.unixPermissions,8)),N.unixPermissions&&16384&N.unixPermissions&&(N.dir=!0),N.dosPermissions&&16&N.dosPermissions&&(N.dir=!0),N.dir&&(w=n(w)),N.createFolders&&(i=y(w))&&p.call(this,i,!0);var q=B==="string"&&N.binary===!1&&N.base64===!1;o&&o.binary!==void 0||(N.binary=!q),(C instanceof T&&C.uncompressedSize===0||N.dir||!C||C.length===0)&&(N.base64=!1,N.binary=!0,C="",N.compression="STORE",B="string");var I=null;I=C instanceof T||C instanceof c?C:v.isNode&&v.isStream(C)?new h(w,C):r.prepareContent(w,C,N.binary,N.optimizedBinaryString,N.base64);var F=new E(w,I,N);this.files[w]=F}var u=t("./utf8"),r=t("./utils"),c=t("./stream/GenericWorker"),l=t("./stream/StreamHelper"),b=t("./defaults"),T=t("./compressedObject"),E=t("./zipObject"),s=t("./generate"),v=t("./nodejsUtils"),h=t("./nodejs/NodejsStreamInputAdapter"),y=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var C=w.lastIndexOf("/");return 0<C?w.substring(0,C):""},n=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},p=function(w,C){return C=C!==void 0?C:b.createFolders,w=n(w),this.files[w]||g.call(this,w,null,{dir:!0,createFolders:C}),this.files[w]};function m(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var _={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var C,o,i;for(C in this.files)i=this.files[C],(o=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&w(o,i)},filter:function(w){var C=[];return this.forEach(function(o,i){w(o,i)&&C.push(i)}),C},file:function(w,C,o){if(arguments.length!==1)return w=this.root+w,g.call(this,w,C,o),this;if(m(w)){var i=w;return this.filter(function(N,q){return!q.dir&&i.test(N)})}var B=this.files[this.root+w];return B&&!B.dir?B:null},folder:function(w){if(!w)return this;if(m(w))return this.filter(function(B,N){return N.dir&&w.test(B)});var C=this.root+w,o=p.call(this,C),i=this.clone();return i.root=o.name,i},remove:function(w){w=this.root+w;var C=this.files[w];if(C||(w.slice(-1)!=="/"&&(w+="/"),C=this.files[w]),C&&!C.dir)delete this.files[w];else for(var o=this.filter(function(B,N){return N.name.slice(0,w.length)===w}),i=0;i<o.length;i++)delete this.files[o[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var C,o={};try{if((o=r.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:u.utf8encode})).type=o.type.toLowerCase(),o.compression=o.compression.toUpperCase(),o.type==="binarystring"&&(o.type="string"),!o.type)throw new Error("No output type specified.");r.checkSupport(o.type),o.platform!=="darwin"&&o.platform!=="freebsd"&&o.platform!=="linux"&&o.platform!=="sunos"||(o.platform="UNIX"),o.platform==="win32"&&(o.platform="DOS");var i=o.comment||this.comment||"";C=s.generateWorker(this,o,i)}catch(B){(C=new c("error")).error(B)}return new l(C,o.type||"string",o.mimeType)},generateAsync:function(w,C){return this.generateInternalStream(w).accumulate(C)},generateNodeStream:function(w,C){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(C)}};d.exports=_},{"./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(t,d,x){d.exports=t("stream")},{stream:void 0}],17:[function(t,d,x){var g=t("./DataReader");function u(r){g.call(this,r);for(var c=0;c<this.data.length;c++)r[c]=255&r[c]}t("../utils").inherits(u,g),u.prototype.byteAt=function(r){return this.data[this.zero+r]},u.prototype.lastIndexOfSignature=function(r){for(var c=r.charCodeAt(0),l=r.charCodeAt(1),b=r.charCodeAt(2),T=r.charCodeAt(3),E=this.length-4;0<=E;--E)if(this.data[E]===c&&this.data[E+1]===l&&this.data[E+2]===b&&this.data[E+3]===T)return E-this.zero;return-1},u.prototype.readAndCheckSignature=function(r){var c=r.charCodeAt(0),l=r.charCodeAt(1),b=r.charCodeAt(2),T=r.charCodeAt(3),E=this.readData(4);return c===E[0]&&l===E[1]&&b===E[2]&&T===E[3]},u.prototype.readData=function(r){if(this.checkOffset(r),r===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./DataReader":18}],18:[function(t,d,x){var g=t("../utils");function u(r){this.data=r,this.length=r.length,this.index=0,this.zero=0}u.prototype={checkOffset:function(r){this.checkIndex(this.index+r)},checkIndex:function(r){if(this.length<this.zero+r||r<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+r+"). Corrupted zip ?")},setIndex:function(r){this.checkIndex(r),this.index=r},skip:function(r){this.setIndex(this.index+r)},byteAt:function(){},readInt:function(r){var c,l=0;for(this.checkOffset(r),c=this.index+r-1;c>=this.index;c--)l=(l<<8)+this.byteAt(c);return this.index+=r,l},readString:function(r){return g.transformTo("string",this.readData(r))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var r=this.readInt(4);return new Date(Date.UTC(1980+(r>>25&127),(r>>21&15)-1,r>>16&31,r>>11&31,r>>5&63,(31&r)<<1))}},d.exports=u},{"../utils":32}],19:[function(t,d,x){var g=t("./Uint8ArrayReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,d,x){var g=t("./DataReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.byteAt=function(r){return this.data.charCodeAt(this.zero+r)},u.prototype.lastIndexOfSignature=function(r){return this.data.lastIndexOf(r)-this.zero},u.prototype.readAndCheckSignature=function(r){return r===this.readData(4)},u.prototype.readData=function(r){this.checkOffset(r);var c=this.data.slice(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./DataReader":18}],21:[function(t,d,x){var g=t("./ArrayReader");function u(r){g.call(this,r)}t("../utils").inherits(u,g),u.prototype.readData=function(r){if(this.checkOffset(r),r===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+r);return this.index+=r,c},d.exports=u},{"../utils":32,"./ArrayReader":17}],22:[function(t,d,x){var g=t("../utils"),u=t("../support"),r=t("./ArrayReader"),c=t("./StringReader"),l=t("./NodeBufferReader"),b=t("./Uint8ArrayReader");d.exports=function(T){var E=g.getTypeOf(T);return g.checkSupport(E),E!=="string"||u.uint8array?E==="nodebuffer"?new l(T):u.uint8array?new b(g.transformTo("uint8array",T)):new r(g.transformTo("array",T)):new c(T)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,d,x){x.LOCAL_FILE_HEADER="PK",x.CENTRAL_FILE_HEADER="PK",x.CENTRAL_DIRECTORY_END="PK",x.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",x.ZIP64_CENTRAL_DIRECTORY_END="PK",x.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,d,x){var g=t("./GenericWorker"),u=t("../utils");function r(c){g.call(this,"ConvertWorker to "+c),this.destType=c}u.inherits(r,g),r.prototype.processChunk=function(c){this.push({data:u.transformTo(this.destType,c.data),meta:c.meta})},d.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(t,d,x){var g=t("./GenericWorker"),u=t("../crc32");function r(){g.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(r,g),r.prototype.processChunk=function(c){this.streamInfo.crc32=u(c.data,this.streamInfo.crc32||0),this.push(c)},d.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,d,x){var g=t("../utils"),u=t("./GenericWorker");function r(c){u.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}g.inherits(r,u),r.prototype.processChunk=function(c){if(c){var l=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=l+c.data.length}u.prototype.processChunk.call(this,c)},d.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(t,d,x){var g=t("../utils"),u=t("./GenericWorker");function r(c){u.call(this,"DataWorker");var l=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(b){l.dataIsReady=!0,l.data=b,l.max=b&&b.length||0,l.type=g.getTypeOf(b),l.isPaused||l._tickAndRepeat()},function(b){l.error(b)})}g.inherits(r,u),r.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!u.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,g.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(g.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,l=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,l);break;case"uint8array":c=this.data.subarray(this.index,l);break;case"array":case"nodebuffer":c=this.data.slice(this.index,l)}return this.index=l,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},d.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(t,d,x){function g(u){this.name=u||"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}g.prototype={push:function(u){this.emit("data",u)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(u){this.emit("error",u)}return!0},error:function(u){return!this.isFinished&&(this.isPaused?this.generatedError=u:(this.isFinished=!0,this.emit("error",u),this.previous&&this.previous.error(u),this.cleanUp()),!0)},on:function(u,r){return this._listeners[u].push(r),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(u,r){if(this._listeners[u])for(var c=0;c<this._listeners[u].length;c++)this._listeners[u][c].call(this,r)},pipe:function(u){return u.registerPrevious(this)},registerPrevious:function(u){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=u.streamInfo,this.mergeStreamInfo(),this.previous=u;var r=this;return u.on("data",function(c){r.processChunk(c)}),u.on("end",function(){r.end()}),u.on("error",function(c){r.error(c)}),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 u=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),u=!0),this.previous&&this.previous.resume(),!u},flush:function(){},processChunk:function(u){this.push(u)},withStreamInfo:function(u,r){return this.extraStreamInfo[u]=r,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var u in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,u)&&(this.streamInfo[u]=this.extraStreamInfo[u])},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 u="Worker "+this.name;return this.previous?this.previous+" -> "+u:u}},d.exports=g},{}],29:[function(t,d,x){var g=t("../utils"),u=t("./ConvertWorker"),r=t("./GenericWorker"),c=t("../base64"),l=t("../support"),b=t("../external"),T=null;if(l.nodestream)try{T=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function E(v,h){return new b.Promise(function(y,n){var p=[],m=v._internalType,_=v._outputType,w=v._mimeType;v.on("data",function(C,o){p.push(C),h&&h(o)}).on("error",function(C){p=[],n(C)}).on("end",function(){try{var C=(function(o,i,B){switch(o){case"blob":return g.newBlob(g.transformTo("arraybuffer",i),B);case"base64":return c.encode(i);default:return g.transformTo(o,i)}})(_,(function(o,i){var B,N=0,q=null,I=0;for(B=0;B<i.length;B++)I+=i[B].length;switch(o){case"string":return i.join("");case"array":return Array.prototype.concat.apply([],i);case"uint8array":for(q=new Uint8Array(I),B=0;B<i.length;B++)q.set(i[B],N),N+=i[B].length;return q;case"nodebuffer":return Buffer.concat(i);default:throw new Error("concat : unsupported type '"+o+"'")}})(m,p),w);y(C)}catch(o){n(o)}p=[]}).resume()})}function s(v,h,y){var n=h;switch(h){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=h,this._mimeType=y,g.checkSupport(n),this._worker=v.pipe(new u(n)),v.lock()}catch(p){this._worker=new r("error"),this._worker.error(p)}}s.prototype={accumulate:function(v){return E(this,v)},on:function(v,h){var y=this;return v==="data"?this._worker.on(v,function(n){h.call(y,n.data,n.meta)}):this._worker.on(v,function(){g.delay(h,arguments,y)}),this},resume:function(){return g.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(v){if(g.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new T(this,{objectMode:this._outputType!=="nodebuffer"},v)}},d.exports=s},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(t,d,x){if(x.base64=!0,x.array=!0,x.string=!0,x.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",x.nodebuffer=typeof Buffer<"u",x.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")x.blob=!1;else{var g=new ArrayBuffer(0);try{x.blob=new Blob([g],{type:"application/zip"}).size===0}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);u.append(g),x.blob=u.getBlob("application/zip").size===0}catch{x.blob=!1}}}try{x.nodestream=!!t("readable-stream").Readable}catch{x.nodestream=!1}},{"readable-stream":16}],31:[function(t,d,x){for(var g=t("./utils"),u=t("./support"),r=t("./nodejsUtils"),c=t("./stream/GenericWorker"),l=new Array(256),b=0;b<256;b++)l[b]=252<=b?6:248<=b?5:240<=b?4:224<=b?3:192<=b?2:1;l[254]=l[254]=1;function T(){c.call(this,"utf-8 decode"),this.leftOver=null}function E(){c.call(this,"utf-8 encode")}x.utf8encode=function(s){return u.nodebuffer?r.newBufferFrom(s,"utf-8"):(function(v){var h,y,n,p,m,_=v.length,w=0;for(p=0;p<_;p++)(64512&(y=v.charCodeAt(p)))==55296&&p+1<_&&(64512&(n=v.charCodeAt(p+1)))==56320&&(y=65536+(y-55296<<10)+(n-56320),p++),w+=y<128?1:y<2048?2:y<65536?3:4;for(h=u.uint8array?new Uint8Array(w):new Array(w),p=m=0;m<w;p++)(64512&(y=v.charCodeAt(p)))==55296&&p+1<_&&(64512&(n=v.charCodeAt(p+1)))==56320&&(y=65536+(y-55296<<10)+(n-56320),p++),y<128?h[m++]=y:(y<2048?h[m++]=192|y>>>6:(y<65536?h[m++]=224|y>>>12:(h[m++]=240|y>>>18,h[m++]=128|y>>>12&63),h[m++]=128|y>>>6&63),h[m++]=128|63&y);return h})(s)},x.utf8decode=function(s){return u.nodebuffer?g.transformTo("nodebuffer",s).toString("utf-8"):(function(v){var h,y,n,p,m=v.length,_=new Array(2*m);for(h=y=0;h<m;)if((n=v[h++])<128)_[y++]=n;else if(4<(p=l[n]))_[y++]=65533,h+=p-1;else{for(n&=p===2?31:p===3?15:7;1<p&&h<m;)n=n<<6|63&v[h++],p--;1<p?_[y++]=65533:n<65536?_[y++]=n:(n-=65536,_[y++]=55296|n>>10&1023,_[y++]=56320|1023&n)}return _.length!==y&&(_.subarray?_=_.subarray(0,y):_.length=y),g.applyFromCharCode(_)})(s=g.transformTo(u.uint8array?"uint8array":"array",s))},g.inherits(T,c),T.prototype.processChunk=function(s){var v=g.transformTo(u.uint8array?"uint8array":"array",s.data);if(this.leftOver&&this.leftOver.length){if(u.uint8array){var h=v;(v=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),v.set(h,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var y=(function(p,m){var _;for((m=m||p.length)>p.length&&(m=p.length),_=m-1;0<=_&&(192&p[_])==128;)_--;return _<0||_===0?m:_+l[p[_]]>m?_:m})(v),n=v;y!==v.length&&(u.uint8array?(n=v.subarray(0,y),this.leftOver=v.subarray(y,v.length)):(n=v.slice(0,y),this.leftOver=v.slice(y,v.length))),this.push({data:x.utf8decode(n),meta:s.meta})},T.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:x.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},x.Utf8DecodeWorker=T,g.inherits(E,c),E.prototype.processChunk=function(s){this.push({data:x.utf8encode(s.data),meta:s.meta})},x.Utf8EncodeWorker=E},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,d,x){var g=t("./support"),u=t("./base64"),r=t("./nodejsUtils"),c=t("./external");function l(h){return h}function b(h,y){for(var n=0;n<h.length;++n)y[n]=255&h.charCodeAt(n);return y}t("setimmediate"),x.newBlob=function(h,y){x.checkSupport("blob");try{return new Blob([h],{type:y})}catch{try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(h),n.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var T={stringifyByChunk:function(h,y,n){var p=[],m=0,_=h.length;if(_<=n)return String.fromCharCode.apply(null,h);for(;m<_;)y==="array"||y==="nodebuffer"?p.push(String.fromCharCode.apply(null,h.slice(m,Math.min(m+n,_)))):p.push(String.fromCharCode.apply(null,h.subarray(m,Math.min(m+n,_)))),m+=n;return p.join("")},stringifyByChar:function(h){for(var y="",n=0;n<h.length;n++)y+=String.fromCharCode(h[n]);return y},applyCanBeUsed:{uint8array:(function(){try{return g.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return g.nodebuffer&&String.fromCharCode.apply(null,r.allocBuffer(1)).length===1}catch{return!1}})()}};function E(h){var y=65536,n=x.getTypeOf(h),p=!0;if(n==="uint8array"?p=T.applyCanBeUsed.uint8array:n==="nodebuffer"&&(p=T.applyCanBeUsed.nodebuffer),p)for(;1<y;)try{return T.stringifyByChunk(h,n,y)}catch{y=Math.floor(y/2)}return T.stringifyByChar(h)}function s(h,y){for(var n=0;n<h.length;n++)y[n]=h[n];return y}x.applyFromCharCode=E;var v={};v.string={string:l,array:function(h){return b(h,new Array(h.length))},arraybuffer:function(h){return v.string.uint8array(h).buffer},uint8array:function(h){return b(h,new Uint8Array(h.length))},nodebuffer:function(h){return b(h,r.allocBuffer(h.length))}},v.array={string:E,array:l,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return r.newBufferFrom(h)}},v.arraybuffer={string:function(h){return E(new Uint8Array(h))},array:function(h){return s(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:l,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return r.newBufferFrom(new Uint8Array(h))}},v.uint8array={string:E,array:function(h){return s(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:l,nodebuffer:function(h){return r.newBufferFrom(h)}},v.nodebuffer={string:E,array:function(h){return s(h,new Array(h.length))},arraybuffer:function(h){return v.nodebuffer.uint8array(h).buffer},uint8array:function(h){return s(h,new Uint8Array(h.length))},nodebuffer:l},x.transformTo=function(h,y){if(y=y||"",!h)return y;x.checkSupport(h);var n=x.getTypeOf(y);return v[n][h](y)},x.resolve=function(h){for(var y=h.split("/"),n=[],p=0;p<y.length;p++){var m=y[p];m==="."||m===""&&p!==0&&p!==y.length-1||(m===".."?n.pop():n.push(m))}return n.join("/")},x.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":g.nodebuffer&&r.isBuffer(h)?"nodebuffer":g.uint8array&&h instanceof Uint8Array?"uint8array":g.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},x.checkSupport=function(h){if(!g[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},x.MAX_VALUE_16BITS=65535,x.MAX_VALUE_32BITS=-1,x.pretty=function(h){var y,n,p="";for(n=0;n<(h||"").length;n++)p+="\\x"+((y=h.charCodeAt(n))<16?"0":"")+y.toString(16).toUpperCase();return p},x.delay=function(h,y,n){setImmediate(function(){h.apply(n||null,y||[])})},x.inherits=function(h,y){function n(){}n.prototype=y.prototype,h.prototype=new n},x.extend=function(){var h,y,n={};for(h=0;h<arguments.length;h++)for(y in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],y)&&n[y]===void 0&&(n[y]=arguments[h][y]);return n},x.prepareContent=function(h,y,n,p,m){return c.Promise.resolve(y).then(function(_){return g.blob&&(_ instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(_))!==-1)&&typeof FileReader<"u"?new c.Promise(function(w,C){var o=new FileReader;o.onload=function(i){w(i.target.result)},o.onerror=function(i){C(i.target.error)},o.readAsArrayBuffer(_)}):_}).then(function(_){var w=x.getTypeOf(_);return w?(w==="arraybuffer"?_=x.transformTo("uint8array",_):w==="string"&&(m?_=u.decode(_):n&&p!==!0&&(_=(function(C){return b(C,g.uint8array?new Uint8Array(C.length):new Array(C.length))})(_))),_):c.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(t,d,x){var g=t("./reader/readerFor"),u=t("./utils"),r=t("./signature"),c=t("./zipEntry"),l=t("./support");function b(T){this.files=[],this.loadOptions=T}b.prototype={checkSignature:function(T){if(!this.reader.readAndCheckSignature(T)){this.reader.index-=4;var E=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+u.pretty(E)+", expected "+u.pretty(T)+")")}},isSignature:function(T,E){var s=this.reader.index;this.reader.setIndex(T);var v=this.reader.readString(4)===E;return this.reader.setIndex(s),v},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 T=this.reader.readData(this.zipCommentLength),E=l.uint8array?"uint8array":"array",s=u.transformTo(E,T);this.zipComment=this.loadOptions.decodeFileName(s)},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 T,E,s,v=this.zip64EndOfCentralSize-44;0<v;)T=this.reader.readInt(2),E=this.reader.readInt(4),s=this.reader.readData(E),this.zip64ExtensibleData[T]={id:T,length:E,value:s}},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 T,E;for(T=0;T<this.files.length;T++)E=this.files[T],this.reader.setIndex(E.localHeaderOffset),this.checkSignature(r.LOCAL_FILE_HEADER),E.readLocalPart(this.reader),E.handleUTF8(),E.processAttributes()},readCentralDir:function(){var T;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(r.CENTRAL_FILE_HEADER);)(T=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(T);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 T=this.reader.lastIndexOfSignature(r.CENTRAL_DIRECTORY_END);if(T<0)throw this.isSignature(0,r.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(T);var E=T;if(this.checkSignature(r.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===u.MAX_VALUE_16BITS||this.diskWithCentralDirStart===u.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===u.MAX_VALUE_16BITS||this.centralDirRecords===u.MAX_VALUE_16BITS||this.centralDirSize===u.MAX_VALUE_32BITS||this.centralDirOffset===u.MAX_VALUE_32BITS){if(this.zip64=!0,(T=this.reader.lastIndexOfSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(T),this.checkSignature(r.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,r.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(r.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(r.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var s=this.centralDirOffset+this.centralDirSize;this.zip64&&(s+=20,s+=12+this.zip64EndOfCentralSize);var v=E-s;if(0<v)this.isSignature(E,r.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(T){this.reader=g(T)},load:function(T){this.prepareReader(T),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},d.exports=b},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(t,d,x){var g=t("./reader/readerFor"),u=t("./utils"),r=t("./compressedObject"),c=t("./crc32"),l=t("./utf8"),b=t("./compressions"),T=t("./support");function E(s,v){this.options=s,this.loadOptions=v}E.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(s){var v,h;if(s.skip(22),this.fileNameLength=s.readInt(2),h=s.readInt(2),this.fileName=s.readData(this.fileNameLength),s.skip(h),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((v=(function(y){for(var n in b)if(Object.prototype.hasOwnProperty.call(b,n)&&b[n].magic===y)return b[n];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+u.pretty(this.compressionMethod)+" unknown (inner file : "+u.transformTo("string",this.fileName)+")");this.decompressed=new r(this.compressedSize,this.uncompressedSize,this.crc32,v,s.readData(this.compressedSize))},readCentralPart:function(s){this.versionMadeBy=s.readInt(2),s.skip(2),this.bitFlag=s.readInt(2),this.compressionMethod=s.readString(2),this.date=s.readDate(),this.crc32=s.readInt(4),this.compressedSize=s.readInt(4),this.uncompressedSize=s.readInt(4);var v=s.readInt(2);if(this.extraFieldsLength=s.readInt(2),this.fileCommentLength=s.readInt(2),this.diskNumberStart=s.readInt(2),this.internalFileAttributes=s.readInt(2),this.externalFileAttributes=s.readInt(4),this.localHeaderOffset=s.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");s.skip(v),this.readExtraFields(s),this.parseZIP64ExtraField(s),this.fileComment=s.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var s=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),s==0&&(this.dosPermissions=63&this.externalFileAttributes),s==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var s=g(this.extraFields[1].value);this.uncompressedSize===u.MAX_VALUE_32BITS&&(this.uncompressedSize=s.readInt(8)),this.compressedSize===u.MAX_VALUE_32BITS&&(this.compressedSize=s.readInt(8)),this.localHeaderOffset===u.MAX_VALUE_32BITS&&(this.localHeaderOffset=s.readInt(8)),this.diskNumberStart===u.MAX_VALUE_32BITS&&(this.diskNumberStart=s.readInt(4))}},readExtraFields:function(s){var v,h,y,n=s.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});s.index+4<n;)v=s.readInt(2),h=s.readInt(2),y=s.readData(h),this.extraFields[v]={id:v,length:h,value:y};s.setIndex(n)},handleUTF8:function(){var s=T.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=l.utf8decode(this.fileName),this.fileCommentStr=l.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var h=u.transformTo(s,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var n=u.transformTo(s,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(n)}}},findExtraFieldUnicodePath:function(){var s=this.extraFields[28789];if(s){var v=g(s.value);return v.readInt(1)!==1||c(this.fileName)!==v.readInt(4)?null:l.utf8decode(v.readData(s.length-5))}return null},findExtraFieldUnicodeComment:function(){var s=this.extraFields[25461];if(s){var v=g(s.value);return v.readInt(1)!==1||c(this.fileComment)!==v.readInt(4)?null:l.utf8decode(v.readData(s.length-5))}return null}},d.exports=E},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(t,d,x){function g(v,h,y){this.name=v,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=h,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var u=t("./stream/StreamHelper"),r=t("./stream/DataWorker"),c=t("./utf8"),l=t("./compressedObject"),b=t("./stream/GenericWorker");g.prototype={internalStream:function(v){var h=null,y="string";try{if(!v)throw new Error("No output type specified.");var n=(y=v.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),h=this._decompressWorker();var p=!this._dataBinary;p&&!n&&(h=h.pipe(new c.Utf8EncodeWorker)),!p&&n&&(h=h.pipe(new c.Utf8DecodeWorker))}catch(m){(h=new b("error")).error(m)}return new u(h,y,"")},async:function(v,h){return this.internalStream(v).accumulate(h)},nodeStream:function(v,h){return this.internalStream(v||"nodebuffer").toNodejsStream(h)},_compressWorker:function(v,h){if(this._data instanceof l&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new c.Utf8EncodeWorker)),l.createWorkerFrom(y,v,h)},_decompressWorker:function(){return this._data instanceof l?this._data.getContentWorker():this._data instanceof b?this._data:new r(this._data)}};for(var T=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],E=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},s=0;s<T.length;s++)g.prototype[T[s]]=E;d.exports=g},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(t,d,x){(function(g){var u,r,c=g.MutationObserver||g.WebKitMutationObserver;if(c){var l=0,b=new c(v),T=g.document.createTextNode("");b.observe(T,{characterData:!0}),u=function(){T.data=l=++l%2}}else if(g.setImmediate||g.MessageChannel===void 0)u="document"in g&&"onreadystatechange"in g.document.createElement("script")?function(){var h=g.document.createElement("script");h.onreadystatechange=function(){v(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},g.document.documentElement.appendChild(h)}:function(){setTimeout(v,0)};else{var E=new g.MessageChannel;E.port1.onmessage=v,u=function(){E.port2.postMessage(0)}}var s=[];function v(){var h,y;r=!0;for(var n=s.length;n;){for(y=s,s=[],h=-1;++h<n;)y[h]();n=s.length}r=!1}d.exports=function(h){s.push(h)!==1||r||u()}}).call(this,typeof bt<"u"?bt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(t,d,x){var g=t("immediate");function u(){}var r={},c=["REJECTED"],l=["FULFILLED"],b=["PENDING"];function T(n){if(typeof n!="function")throw new TypeError("resolver must be a function");this.state=b,this.queue=[],this.outcome=void 0,n!==u&&h(this,n)}function E(n,p,m){this.promise=n,typeof p=="function"&&(this.onFulfilled=p,this.callFulfilled=this.otherCallFulfilled),typeof m=="function"&&(this.onRejected=m,this.callRejected=this.otherCallRejected)}function s(n,p,m){g(function(){var _;try{_=p(m)}catch(w){return r.reject(n,w)}_===n?r.reject(n,new TypeError("Cannot resolve promise with itself")):r.resolve(n,_)})}function v(n){var p=n&&n.then;if(n&&(typeof n=="object"||typeof n=="function")&&typeof p=="function")return function(){p.apply(n,arguments)}}function h(n,p){var m=!1;function _(o){m||(m=!0,r.reject(n,o))}function w(o){m||(m=!0,r.resolve(n,o))}var C=y(function(){p(w,_)});C.status==="error"&&_(C.value)}function y(n,p){var m={};try{m.value=n(p),m.status="success"}catch(_){m.status="error",m.value=_}return m}(d.exports=T).prototype.finally=function(n){if(typeof n!="function")return this;var p=this.constructor;return this.then(function(m){return p.resolve(n()).then(function(){return m})},function(m){return p.resolve(n()).then(function(){throw m})})},T.prototype.catch=function(n){return this.then(null,n)},T.prototype.then=function(n,p){if(typeof n!="function"&&this.state===l||typeof p!="function"&&this.state===c)return this;var m=new this.constructor(u);return this.state!==b?s(m,this.state===l?n:p,this.outcome):this.queue.push(new E(m,n,p)),m},E.prototype.callFulfilled=function(n){r.resolve(this.promise,n)},E.prototype.otherCallFulfilled=function(n){s(this.promise,this.onFulfilled,n)},E.prototype.callRejected=function(n){r.reject(this.promise,n)},E.prototype.otherCallRejected=function(n){s(this.promise,this.onRejected,n)},r.resolve=function(n,p){var m=y(v,p);if(m.status==="error")return r.reject(n,m.value);var _=m.value;if(_)h(n,_);else{n.state=l,n.outcome=p;for(var w=-1,C=n.queue.length;++w<C;)n.queue[w].callFulfilled(p)}return n},r.reject=function(n,p){n.state=c,n.outcome=p;for(var m=-1,_=n.queue.length;++m<_;)n.queue[m].callRejected(p);return n},T.resolve=function(n){return n instanceof this?n:r.resolve(new this(u),n)},T.reject=function(n){var p=new this(u);return r.reject(p,n)},T.all=function(n){var p=this;if(Object.prototype.toString.call(n)!=="[object Array]")return this.reject(new TypeError("must be an array"));var m=n.length,_=!1;if(!m)return this.resolve([]);for(var w=new Array(m),C=0,o=-1,i=new this(u);++o<m;)B(n[o],o);return i;function B(N,q){p.resolve(N).then(function(I){w[q]=I,++C!==m||_||(_=!0,r.resolve(i,w))},function(I){_||(_=!0,r.reject(i,I))})}},T.race=function(n){var p=this;if(Object.prototype.toString.call(n)!=="[object Array]")return this.reject(new TypeError("must be an array"));var m=n.length,_=!1;if(!m)return this.resolve([]);for(var w=-1,C=new this(u);++w<m;)o=n[w],p.resolve(o).then(function(i){_||(_=!0,r.resolve(C,i))},function(i){_||(_=!0,r.reject(C,i))});var o;return C}},{immediate:36}],38:[function(t,d,x){var g={};(0,t("./lib/utils/common").assign)(g,t("./lib/deflate"),t("./lib/inflate"),t("./lib/zlib/constants")),d.exports=g},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(t,d,x){var g=t("./zlib/deflate"),u=t("./utils/common"),r=t("./utils/strings"),c=t("./zlib/messages"),l=t("./zlib/zstream"),b=Object.prototype.toString,T=0,E=-1,s=0,v=8;function h(n){if(!(this instanceof h))return new h(n);this.options=u.assign({level:E,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:s,to:""},n||{});var p=this.options;p.raw&&0<p.windowBits?p.windowBits=-p.windowBits:p.gzip&&0<p.windowBits&&p.windowBits<16&&(p.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var m=g.deflateInit2(this.strm,p.level,p.method,p.windowBits,p.memLevel,p.strategy);if(m!==T)throw new Error(c[m]);if(p.header&&g.deflateSetHeader(this.strm,p.header),p.dictionary){var _;if(_=typeof p.dictionary=="string"?r.string2buf(p.dictionary):b.call(p.dictionary)==="[object ArrayBuffer]"?new Uint8Array(p.dictionary):p.dictionary,(m=g.deflateSetDictionary(this.strm,_))!==T)throw new Error(c[m]);this._dict_set=!0}}function y(n,p){var m=new h(p);if(m.push(n,!0),m.err)throw m.msg||c[m.err];return m.result}h.prototype.push=function(n,p){var m,_,w=this.strm,C=this.options.chunkSize;if(this.ended)return!1;_=p===~~p?p:p===!0?4:0,typeof n=="string"?w.input=r.string2buf(n):b.call(n)==="[object ArrayBuffer]"?w.input=new Uint8Array(n):w.input=n,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new u.Buf8(C),w.next_out=0,w.avail_out=C),(m=g.deflate(w,_))!==1&&m!==T)return this.onEnd(m),!(this.ended=!0);w.avail_out!==0&&(w.avail_in!==0||_!==4&&_!==2)||(this.options.to==="string"?this.onData(r.buf2binstring(u.shrinkBuf(w.output,w.next_out))):this.onData(u.shrinkBuf(w.output,w.next_out)))}while((0<w.avail_in||w.avail_out===0)&&m!==1);return _===4?(m=g.deflateEnd(this.strm),this.onEnd(m),this.ended=!0,m===T):_!==2||(this.onEnd(T),!(w.avail_out=0))},h.prototype.onData=function(n){this.chunks.push(n)},h.prototype.onEnd=function(n){n===T&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=u.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg},x.Deflate=h,x.deflate=y,x.deflateRaw=function(n,p){return(p=p||{}).raw=!0,y(n,p)},x.gzip=function(n,p){return(p=p||{}).gzip=!0,y(n,p)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(t,d,x){var g=t("./zlib/inflate"),u=t("./utils/common"),r=t("./utils/strings"),c=t("./zlib/constants"),l=t("./zlib/messages"),b=t("./zlib/zstream"),T=t("./zlib/gzheader"),E=Object.prototype.toString;function s(h){if(!(this instanceof s))return new s(h);this.options=u.assign({chunkSize:16384,windowBits:0,to:""},h||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||h&&h.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&(15&y.windowBits)==0&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b,this.strm.avail_out=0;var n=g.inflateInit2(this.strm,y.windowBits);if(n!==c.Z_OK)throw new Error(l[n]);this.header=new T,g.inflateGetHeader(this.strm,this.header)}function v(h,y){var n=new s(y);if(n.push(h,!0),n.err)throw n.msg||l[n.err];return n.result}s.prototype.push=function(h,y){var n,p,m,_,w,C,o=this.strm,i=this.options.chunkSize,B=this.options.dictionary,N=!1;if(this.ended)return!1;p=y===~~y?y:y===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof h=="string"?o.input=r.binstring2buf(h):E.call(h)==="[object ArrayBuffer]"?o.input=new Uint8Array(h):o.input=h,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new u.Buf8(i),o.next_out=0,o.avail_out=i),(n=g.inflate(o,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&B&&(C=typeof B=="string"?r.string2buf(B):E.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,n=g.inflateSetDictionary(this.strm,C)),n===c.Z_BUF_ERROR&&N===!0&&(n=c.Z_OK,N=!1),n!==c.Z_STREAM_END&&n!==c.Z_OK)return this.onEnd(n),!(this.ended=!0);o.next_out&&(o.avail_out!==0&&n!==c.Z_STREAM_END&&(o.avail_in!==0||p!==c.Z_FINISH&&p!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(m=r.utf8border(o.output,o.next_out),_=o.next_out-m,w=r.buf2string(o.output,m),o.next_out=_,o.avail_out=i-_,_&&u.arraySet(o.output,o.output,m,_,0),this.onData(w)):this.onData(u.shrinkBuf(o.output,o.next_out)))),o.avail_in===0&&o.avail_out===0&&(N=!0)}while((0<o.avail_in||o.avail_out===0)&&n!==c.Z_STREAM_END);return n===c.Z_STREAM_END&&(p=c.Z_FINISH),p===c.Z_FINISH?(n=g.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===c.Z_OK):p!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(o.avail_out=0))},s.prototype.onData=function(h){this.chunks.push(h)},s.prototype.onEnd=function(h){h===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=u.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},x.Inflate=s,x.inflate=v,x.inflateRaw=function(h,y){return(y=y||{}).raw=!0,v(h,y)},x.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(t,d,x){var g=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";x.assign=function(c){for(var l=Array.prototype.slice.call(arguments,1);l.length;){var b=l.shift();if(b){if(typeof b!="object")throw new TypeError(b+"must be non-object");for(var T in b)b.hasOwnProperty(T)&&(c[T]=b[T])}}return c},x.shrinkBuf=function(c,l){return c.length===l?c:c.subarray?c.subarray(0,l):(c.length=l,c)};var u={arraySet:function(c,l,b,T,E){if(l.subarray&&c.subarray)c.set(l.subarray(b,b+T),E);else for(var s=0;s<T;s++)c[E+s]=l[b+s]},flattenChunks:function(c){var l,b,T,E,s,v;for(l=T=0,b=c.length;l<b;l++)T+=c[l].length;for(v=new Uint8Array(T),l=E=0,b=c.length;l<b;l++)s=c[l],v.set(s,E),E+=s.length;return v}},r={arraySet:function(c,l,b,T,E){for(var s=0;s<T;s++)c[E+s]=l[b+s]},flattenChunks:function(c){return[].concat.apply([],c)}};x.setTyped=function(c){c?(x.Buf8=Uint8Array,x.Buf16=Uint16Array,x.Buf32=Int32Array,x.assign(x,u)):(x.Buf8=Array,x.Buf16=Array,x.Buf32=Array,x.assign(x,r))},x.setTyped(g)},{}],42:[function(t,d,x){var g=t("./common"),u=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{u=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var c=new g.Buf8(256),l=0;l<256;l++)c[l]=252<=l?6:248<=l?5:240<=l?4:224<=l?3:192<=l?2:1;function b(T,E){if(E<65537&&(T.subarray&&r||!T.subarray&&u))return String.fromCharCode.apply(null,g.shrinkBuf(T,E));for(var s="",v=0;v<E;v++)s+=String.fromCharCode(T[v]);return s}c[254]=c[254]=1,x.string2buf=function(T){var E,s,v,h,y,n=T.length,p=0;for(h=0;h<n;h++)(64512&(s=T.charCodeAt(h)))==55296&&h+1<n&&(64512&(v=T.charCodeAt(h+1)))==56320&&(s=65536+(s-55296<<10)+(v-56320),h++),p+=s<128?1:s<2048?2:s<65536?3:4;for(E=new g.Buf8(p),h=y=0;y<p;h++)(64512&(s=T.charCodeAt(h)))==55296&&h+1<n&&(64512&(v=T.charCodeAt(h+1)))==56320&&(s=65536+(s-55296<<10)+(v-56320),h++),s<128?E[y++]=s:(s<2048?E[y++]=192|s>>>6:(s<65536?E[y++]=224|s>>>12:(E[y++]=240|s>>>18,E[y++]=128|s>>>12&63),E[y++]=128|s>>>6&63),E[y++]=128|63&s);return E},x.buf2binstring=function(T){return b(T,T.length)},x.binstring2buf=function(T){for(var E=new g.Buf8(T.length),s=0,v=E.length;s<v;s++)E[s]=T.charCodeAt(s);return E},x.buf2string=function(T,E){var s,v,h,y,n=E||T.length,p=new Array(2*n);for(s=v=0;s<n;)if((h=T[s++])<128)p[v++]=h;else if(4<(y=c[h]))p[v++]=65533,s+=y-1;else{for(h&=y===2?31:y===3?15:7;1<y&&s<n;)h=h<<6|63&T[s++],y--;1<y?p[v++]=65533:h<65536?p[v++]=h:(h-=65536,p[v++]=55296|h>>10&1023,p[v++]=56320|1023&h)}return b(p,v)},x.utf8border=function(T,E){var s;for((E=E||T.length)>T.length&&(E=T.length),s=E-1;0<=s&&(192&T[s])==128;)s--;return s<0||s===0?E:s+c[T[s]]>E?s:E}},{"./common":41}],43:[function(t,d,x){d.exports=function(g,u,r,c){for(var l=65535&g|0,b=g>>>16&65535|0,T=0;r!==0;){for(r-=T=2e3<r?2e3:r;b=b+(l=l+u[c++]|0)|0,--T;);l%=65521,b%=65521}return l|b<<16|0}},{}],44:[function(t,d,x){d.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(t,d,x){var g=(function(){for(var u,r=[],c=0;c<256;c++){u=c;for(var l=0;l<8;l++)u=1&u?3988292384^u>>>1:u>>>1;r[c]=u}return r})();d.exports=function(u,r,c,l){var b=g,T=l+c;u^=-1;for(var E=l;E<T;E++)u=u>>>8^b[255&(u^r[E])];return-1^u}},{}],46:[function(t,d,x){var g,u=t("../utils/common"),r=t("./trees"),c=t("./adler32"),l=t("./crc32"),b=t("./messages"),T=0,E=4,s=0,v=-2,h=-1,y=4,n=2,p=8,m=9,_=286,w=30,C=19,o=2*_+1,i=15,B=3,N=258,q=N+B+1,I=42,F=113,A=1,H=2,j=3,W=4;function re(f,L){return f.msg=b[L],L}function J(f){return(f<<1)-(4<f?9:0)}function oe(f){for(var L=f.length;0<=--L;)f[L]=0}function Q(f){var L=f.state,G=L.pending;G>f.avail_out&&(G=f.avail_out),G!==0&&(u.arraySet(f.output,L.pending_buf,L.pending_out,G,f.next_out),f.next_out+=G,L.pending_out+=G,f.total_out+=G,f.avail_out-=G,L.pending-=G,L.pending===0&&(L.pending_out=0))}function $(f,L){r._tr_flush_block(f,0<=f.block_start?f.block_start:-1,f.strstart-f.block_start,L),f.block_start=f.strstart,Q(f.strm)}function ce(f,L){f.pending_buf[f.pending++]=L}function ie(f,L){f.pending_buf[f.pending++]=L>>>8&255,f.pending_buf[f.pending++]=255&L}function ee(f,L){var G,M,V=f.max_chain_length,K=f.strstart,X=f.prev_length,te=f.nice_match,Y=f.strstart>f.w_size-q?f.strstart-(f.w_size-q):0,ae=f.window,fe=f.w_mask,se=f.prev,de=f.strstart+N,ye=ae[K+X-1],ge=ae[K+X];f.prev_length>=f.good_match&&(V>>=2),te>f.lookahead&&(te=f.lookahead);do if(ae[(G=L)+X]===ge&&ae[G+X-1]===ye&&ae[G]===ae[K]&&ae[++G]===ae[K+1]){K+=2,G++;do;while(ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&ae[++K]===ae[++G]&&K<de);if(M=N-(de-K),K=de-N,X<M){if(f.match_start=L,te<=(X=M))break;ye=ae[K+X-1],ge=ae[K+X]}}while((L=se[L&fe])>Y&&--V!=0);return X<=f.lookahead?X:f.lookahead}function ue(f){var L,G,M,V,K,X,te,Y,ae,fe,se=f.w_size;do{if(V=f.window_size-f.lookahead-f.strstart,f.strstart>=se+(se-q)){for(u.arraySet(f.window,f.window,se,se,0),f.match_start-=se,f.strstart-=se,f.block_start-=se,L=G=f.hash_size;M=f.head[--L],f.head[L]=se<=M?M-se:0,--G;);for(L=G=se;M=f.prev[--L],f.prev[L]=se<=M?M-se:0,--G;);V+=se}if(f.strm.avail_in===0)break;if(X=f.strm,te=f.window,Y=f.strstart+f.lookahead,ae=V,fe=void 0,fe=X.avail_in,ae<fe&&(fe=ae),G=fe===0?0:(X.avail_in-=fe,u.arraySet(te,X.input,X.next_in,fe,Y),X.state.wrap===1?X.adler=c(X.adler,te,fe,Y):X.state.wrap===2&&(X.adler=l(X.adler,te,fe,Y)),X.next_in+=fe,X.total_in+=fe,fe),f.lookahead+=G,f.lookahead+f.insert>=B)for(K=f.strstart-f.insert,f.ins_h=f.window[K],f.ins_h=(f.ins_h<<f.hash_shift^f.window[K+1])&f.hash_mask;f.insert&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[K+B-1])&f.hash_mask,f.prev[K&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=K,K++,f.insert--,!(f.lookahead+f.insert<B)););}while(f.lookahead<q&&f.strm.avail_in!==0)}function Se(f,L){for(var G,M;;){if(f.lookahead<q){if(ue(f),f.lookahead<q&&L===T)return A;if(f.lookahead===0)break}if(G=0,f.lookahead>=B&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),G!==0&&f.strstart-G<=f.w_size-q&&(f.match_length=ee(f,G)),f.match_length>=B)if(M=r._tr_tally(f,f.strstart-f.match_start,f.match_length-B),f.lookahead-=f.match_length,f.match_length<=f.max_lazy_match&&f.lookahead>=B){for(f.match_length--;f.strstart++,f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart,--f.match_length!=0;);f.strstart++}else f.strstart+=f.match_length,f.match_length=0,f.ins_h=f.window[f.strstart],f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+1])&f.hash_mask;else M=r._tr_tally(f,0,f.window[f.strstart]),f.lookahead--,f.strstart++;if(M&&($(f,!1),f.strm.avail_out===0))return A}return f.insert=f.strstart<B-1?f.strstart:B-1,L===E?($(f,!0),f.strm.avail_out===0?j:W):f.last_lit&&($(f,!1),f.strm.avail_out===0)?A:H}function ve(f,L){for(var G,M,V;;){if(f.lookahead<q){if(ue(f),f.lookahead<q&&L===T)return A;if(f.lookahead===0)break}if(G=0,f.lookahead>=B&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),f.prev_length=f.match_length,f.prev_match=f.match_start,f.match_length=B-1,G!==0&&f.prev_length<f.max_lazy_match&&f.strstart-G<=f.w_size-q&&(f.match_length=ee(f,G),f.match_length<=5&&(f.strategy===1||f.match_length===B&&4096<f.strstart-f.match_start)&&(f.match_length=B-1)),f.prev_length>=B&&f.match_length<=f.prev_length){for(V=f.strstart+f.lookahead-B,M=r._tr_tally(f,f.strstart-1-f.prev_match,f.prev_length-B),f.lookahead-=f.prev_length-1,f.prev_length-=2;++f.strstart<=V&&(f.ins_h=(f.ins_h<<f.hash_shift^f.window[f.strstart+B-1])&f.hash_mask,G=f.prev[f.strstart&f.w_mask]=f.head[f.ins_h],f.head[f.ins_h]=f.strstart),--f.prev_length!=0;);if(f.match_available=0,f.match_length=B-1,f.strstart++,M&&($(f,!1),f.strm.avail_out===0))return A}else if(f.match_available){if((M=r._tr_tally(f,0,f.window[f.strstart-1]))&&$(f,!1),f.strstart++,f.lookahead--,f.strm.avail_out===0)return A}else f.match_available=1,f.strstart++,f.lookahead--}return f.match_available&&(M=r._tr_tally(f,0,f.window[f.strstart-1]),f.match_available=0),f.insert=f.strstart<B-1?f.strstart:B-1,L===E?($(f,!0),f.strm.avail_out===0?j:W):f.last_lit&&($(f,!1),f.strm.avail_out===0)?A:H}function k(f,L,G,M,V){this.good_length=f,this.max_lazy=L,this.nice_length=G,this.max_chain=M,this.func=V}function O(){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=p,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 u.Buf16(2*o),this.dyn_dtree=new u.Buf16(2*(2*w+1)),this.bl_tree=new u.Buf16(2*(2*C+1)),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new u.Buf16(i+1),this.heap=new u.Buf16(2*_+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new u.Buf16(2*_+1),oe(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 P(f){var L;return f&&f.state?(f.total_in=f.total_out=0,f.data_type=n,(L=f.state).pending=0,L.pending_out=0,L.wrap<0&&(L.wrap=-L.wrap),L.status=L.wrap?I:F,f.adler=L.wrap===2?0:1,L.last_flush=T,r._tr_init(L),s):re(f,v)}function D(f){var L=P(f);return L===s&&(function(G){G.window_size=2*G.w_size,oe(G.head),G.max_lazy_match=g[G.level].max_lazy,G.good_match=g[G.level].good_length,G.nice_match=g[G.level].nice_length,G.max_chain_length=g[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=B-1,G.match_available=0,G.ins_h=0})(f.state),L}function S(f,L,G,M,V,K){if(!f)return v;var X=1;if(L===h&&(L=6),M<0?(X=0,M=-M):15<M&&(X=2,M-=16),V<1||m<V||G!==p||M<8||15<M||L<0||9<L||K<0||y<K)return re(f,v);M===8&&(M=9);var te=new O;return(f.state=te).strm=f,te.wrap=X,te.gzhead=null,te.w_bits=M,te.w_size=1<<te.w_bits,te.w_mask=te.w_size-1,te.hash_bits=V+7,te.hash_size=1<<te.hash_bits,te.hash_mask=te.hash_size-1,te.hash_shift=~~((te.hash_bits+B-1)/B),te.window=new u.Buf8(2*te.w_size),te.head=new u.Buf16(te.hash_size),te.prev=new u.Buf16(te.w_size),te.lit_bufsize=1<<V+6,te.pending_buf_size=4*te.lit_bufsize,te.pending_buf=new u.Buf8(te.pending_buf_size),te.d_buf=1*te.lit_bufsize,te.l_buf=3*te.lit_bufsize,te.level=L,te.strategy=K,te.method=G,D(f)}g=[new k(0,0,0,0,function(f,L){var G=65535;for(G>f.pending_buf_size-5&&(G=f.pending_buf_size-5);;){if(f.lookahead<=1){if(ue(f),f.lookahead===0&&L===T)return A;if(f.lookahead===0)break}f.strstart+=f.lookahead,f.lookahead=0;var M=f.block_start+G;if((f.strstart===0||f.strstart>=M)&&(f.lookahead=f.strstart-M,f.strstart=M,$(f,!1),f.strm.avail_out===0)||f.strstart-f.block_start>=f.w_size-q&&($(f,!1),f.strm.avail_out===0))return A}return f.insert=0,L===E?($(f,!0),f.strm.avail_out===0?j:W):(f.strstart>f.block_start&&($(f,!1),f.strm.avail_out),A)}),new k(4,4,8,4,Se),new k(4,5,16,8,Se),new k(4,6,32,32,Se),new k(4,4,16,16,ve),new k(8,16,32,32,ve),new k(8,16,128,128,ve),new k(8,32,128,256,ve),new k(32,128,258,1024,ve),new k(32,258,258,4096,ve)],x.deflateInit=function(f,L){return S(f,L,p,15,8,0)},x.deflateInit2=S,x.deflateReset=D,x.deflateResetKeep=P,x.deflateSetHeader=function(f,L){return f&&f.state?f.state.wrap!==2?v:(f.state.gzhead=L,s):v},x.deflate=function(f,L){var G,M,V,K;if(!f||!f.state||5<L||L<0)return f?re(f,v):v;if(M=f.state,!f.output||!f.input&&f.avail_in!==0||M.status===666&&L!==E)return re(f,f.avail_out===0?-5:v);if(M.strm=f,G=M.last_flush,M.last_flush=L,M.status===I)if(M.wrap===2)f.adler=0,ce(M,31),ce(M,139),ce(M,8),M.gzhead?(ce(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),ce(M,255&M.gzhead.time),ce(M,M.gzhead.time>>8&255),ce(M,M.gzhead.time>>16&255),ce(M,M.gzhead.time>>24&255),ce(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),ce(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(ce(M,255&M.gzhead.extra.length),ce(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(f.adler=l(f.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(ce(M,0),ce(M,0),ce(M,0),ce(M,0),ce(M,0),ce(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),ce(M,3),M.status=F);else{var X=p+(M.w_bits-8<<4)<<8;X|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(X|=32),X+=31-X%31,M.status=F,ie(M,X),M.strstart!==0&&(ie(M,f.adler>>>16),ie(M,65535&f.adler)),f.adler=1}if(M.status===69)if(M.gzhead.extra){for(V=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending!==M.pending_buf_size));)ce(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){V=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending===M.pending_buf_size)){K=1;break}K=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,ce(M,K)}while(K!==0);M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),K===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){V=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),Q(f),V=M.pending,M.pending===M.pending_buf_size)){K=1;break}K=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,ce(M,K)}while(K!==0);M.gzhead.hcrc&&M.pending>V&&(f.adler=l(f.adler,M.pending_buf,M.pending-V,V)),K===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&Q(f),M.pending+2<=M.pending_buf_size&&(ce(M,255&f.adler),ce(M,f.adler>>8&255),f.adler=0,M.status=F)):M.status=F),M.pending!==0){if(Q(f),f.avail_out===0)return M.last_flush=-1,s}else if(f.avail_in===0&&J(L)<=J(G)&&L!==E)return re(f,-5);if(M.status===666&&f.avail_in!==0)return re(f,-5);if(f.avail_in!==0||M.lookahead!==0||L!==T&&M.status!==666){var te=M.strategy===2?(function(Y,ae){for(var fe;;){if(Y.lookahead===0&&(ue(Y),Y.lookahead===0)){if(ae===T)return A;break}if(Y.match_length=0,fe=r._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++,fe&&($(Y,!1),Y.strm.avail_out===0))return A}return Y.insert=0,ae===E?($(Y,!0),Y.strm.avail_out===0?j:W):Y.last_lit&&($(Y,!1),Y.strm.avail_out===0)?A:H})(M,L):M.strategy===3?(function(Y,ae){for(var fe,se,de,ye,ge=Y.window;;){if(Y.lookahead<=N){if(ue(Y),Y.lookahead<=N&&ae===T)return A;if(Y.lookahead===0)break}if(Y.match_length=0,Y.lookahead>=B&&0<Y.strstart&&(se=ge[de=Y.strstart-1])===ge[++de]&&se===ge[++de]&&se===ge[++de]){ye=Y.strstart+N;do;while(se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&se===ge[++de]&&de<ye);Y.match_length=N-(ye-de),Y.match_length>Y.lookahead&&(Y.match_length=Y.lookahead)}if(Y.match_length>=B?(fe=r._tr_tally(Y,1,Y.match_length-B),Y.lookahead-=Y.match_length,Y.strstart+=Y.match_length,Y.match_length=0):(fe=r._tr_tally(Y,0,Y.window[Y.strstart]),Y.lookahead--,Y.strstart++),fe&&($(Y,!1),Y.strm.avail_out===0))return A}return Y.insert=0,ae===E?($(Y,!0),Y.strm.avail_out===0?j:W):Y.last_lit&&($(Y,!1),Y.strm.avail_out===0)?A:H})(M,L):g[M.level].func(M,L);if(te!==j&&te!==W||(M.status=666),te===A||te===j)return f.avail_out===0&&(M.last_flush=-1),s;if(te===H&&(L===1?r._tr_align(M):L!==5&&(r._tr_stored_block(M,0,0,!1),L===3&&(oe(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),Q(f),f.avail_out===0))return M.last_flush=-1,s}return L!==E?s:M.wrap<=0?1:(M.wrap===2?(ce(M,255&f.adler),ce(M,f.adler>>8&255),ce(M,f.adler>>16&255),ce(M,f.adler>>24&255),ce(M,255&f.total_in),ce(M,f.total_in>>8&255),ce(M,f.total_in>>16&255),ce(M,f.total_in>>24&255)):(ie(M,f.adler>>>16),ie(M,65535&f.adler)),Q(f),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?s:1)},x.deflateEnd=function(f){var L;return f&&f.state?(L=f.state.status)!==I&&L!==69&&L!==73&&L!==91&&L!==103&&L!==F&&L!==666?re(f,v):(f.state=null,L===F?re(f,-3):s):v},x.deflateSetDictionary=function(f,L){var G,M,V,K,X,te,Y,ae,fe=L.length;if(!f||!f.state||(K=(G=f.state).wrap)===2||K===1&&G.status!==I||G.lookahead)return v;for(K===1&&(f.adler=c(f.adler,L,fe,0)),G.wrap=0,fe>=G.w_size&&(K===0&&(oe(G.head),G.strstart=0,G.block_start=0,G.insert=0),ae=new u.Buf8(G.w_size),u.arraySet(ae,L,fe-G.w_size,G.w_size,0),L=ae,fe=G.w_size),X=f.avail_in,te=f.next_in,Y=f.input,f.avail_in=fe,f.next_in=0,f.input=L,ue(G);G.lookahead>=B;){for(M=G.strstart,V=G.lookahead-(B-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[M+B-1])&G.hash_mask,G.prev[M&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=M,M++,--V;);G.strstart=M,G.lookahead=B-1,ue(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=B-1,G.match_available=0,f.next_in=te,f.input=Y,f.avail_in=X,G.wrap=K,s},x.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(t,d,x){d.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(t,d,x){d.exports=function(g,u){var r,c,l,b,T,E,s,v,h,y,n,p,m,_,w,C,o,i,B,N,q,I,F,A,H;r=g.state,c=g.next_in,A=g.input,l=c+(g.avail_in-5),b=g.next_out,H=g.output,T=b-(u-g.avail_out),E=b+(g.avail_out-257),s=r.dmax,v=r.wsize,h=r.whave,y=r.wnext,n=r.window,p=r.hold,m=r.bits,_=r.lencode,w=r.distcode,C=(1<<r.lenbits)-1,o=(1<<r.distbits)-1;e:do{m<15&&(p+=A[c++]<<m,m+=8,p+=A[c++]<<m,m+=8),i=_[p&C];t:for(;;){if(p>>>=B=i>>>24,m-=B,(B=i>>>16&255)===0)H[b++]=65535&i;else{if(!(16&B)){if((64&B)==0){i=_[(65535&i)+(p&(1<<B)-1)];continue t}if(32&B){r.mode=12;break e}g.msg="invalid literal/length code",r.mode=30;break e}N=65535&i,(B&=15)&&(m<B&&(p+=A[c++]<<m,m+=8),N+=p&(1<<B)-1,p>>>=B,m-=B),m<15&&(p+=A[c++]<<m,m+=8,p+=A[c++]<<m,m+=8),i=w[p&o];r:for(;;){if(p>>>=B=i>>>24,m-=B,!(16&(B=i>>>16&255))){if((64&B)==0){i=w[(65535&i)+(p&(1<<B)-1)];continue r}g.msg="invalid distance code",r.mode=30;break e}if(q=65535&i,m<(B&=15)&&(p+=A[c++]<<m,(m+=8)<B&&(p+=A[c++]<<m,m+=8)),s<(q+=p&(1<<B)-1)){g.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=B,m-=B,(B=b-T)<q){if(h<(B=q-B)&&r.sane){g.msg="invalid distance too far back",r.mode=30;break e}if(F=n,(I=0)===y){if(I+=v-B,B<N){for(N-=B;H[b++]=n[I++],--B;);I=b-q,F=H}}else if(y<B){if(I+=v+y-B,(B-=y)<N){for(N-=B;H[b++]=n[I++],--B;);if(I=0,y<N){for(N-=B=y;H[b++]=n[I++],--B;);I=b-q,F=H}}}else if(I+=y-B,B<N){for(N-=B;H[b++]=n[I++],--B;);I=b-q,F=H}for(;2<N;)H[b++]=F[I++],H[b++]=F[I++],H[b++]=F[I++],N-=3;N&&(H[b++]=F[I++],1<N&&(H[b++]=F[I++]))}else{for(I=b-q;H[b++]=H[I++],H[b++]=H[I++],H[b++]=H[I++],2<(N-=3););N&&(H[b++]=H[I++],1<N&&(H[b++]=H[I++]))}break}}break}}while(c<l&&b<E);c-=N=m>>3,p&=(1<<(m-=N<<3))-1,g.next_in=c,g.next_out=b,g.avail_in=c<l?l-c+5:5-(c-l),g.avail_out=b<E?E-b+257:257-(b-E),r.hold=p,r.bits=m}},{}],49:[function(t,d,x){var g=t("../utils/common"),u=t("./adler32"),r=t("./crc32"),c=t("./inffast"),l=t("./inftrees"),b=1,T=2,E=0,s=-2,v=1,h=852,y=592;function n(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function p(){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 g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(I){var F;return I&&I.state?(F=I.state,I.total_in=I.total_out=F.total=0,I.msg="",F.wrap&&(I.adler=1&F.wrap),F.mode=v,F.last=0,F.havedict=0,F.dmax=32768,F.head=null,F.hold=0,F.bits=0,F.lencode=F.lendyn=new g.Buf32(h),F.distcode=F.distdyn=new g.Buf32(y),F.sane=1,F.back=-1,E):s}function _(I){var F;return I&&I.state?((F=I.state).wsize=0,F.whave=0,F.wnext=0,m(I)):s}function w(I,F){var A,H;return I&&I.state?(H=I.state,F<0?(A=0,F=-F):(A=1+(F>>4),F<48&&(F&=15)),F&&(F<8||15<F)?s:(H.window!==null&&H.wbits!==F&&(H.window=null),H.wrap=A,H.wbits=F,_(I))):s}function C(I,F){var A,H;return I?(H=new p,(I.state=H).window=null,(A=w(I,F))!==E&&(I.state=null),A):s}var o,i,B=!0;function N(I){if(B){var F;for(o=new g.Buf32(512),i=new g.Buf32(32),F=0;F<144;)I.lens[F++]=8;for(;F<256;)I.lens[F++]=9;for(;F<280;)I.lens[F++]=7;for(;F<288;)I.lens[F++]=8;for(l(b,I.lens,0,288,o,0,I.work,{bits:9}),F=0;F<32;)I.lens[F++]=5;l(T,I.lens,0,32,i,0,I.work,{bits:5}),B=!1}I.lencode=o,I.lenbits=9,I.distcode=i,I.distbits=5}function q(I,F,A,H){var j,W=I.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new g.Buf8(W.wsize)),H>=W.wsize?(g.arraySet(W.window,F,A-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(H<(j=W.wsize-W.wnext)&&(j=H),g.arraySet(W.window,F,A-H,j,W.wnext),(H-=j)?(g.arraySet(W.window,F,A-H,H,0),W.wnext=H,W.whave=W.wsize):(W.wnext+=j,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=j))),0}x.inflateReset=_,x.inflateReset2=w,x.inflateResetKeep=m,x.inflateInit=function(I){return C(I,15)},x.inflateInit2=C,x.inflate=function(I,F){var A,H,j,W,re,J,oe,Q,$,ce,ie,ee,ue,Se,ve,k,O,P,D,S,f,L,G,M,V=0,K=new g.Buf8(4),X=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return s;(A=I.state).mode===12&&(A.mode=13),re=I.next_out,j=I.output,oe=I.avail_out,W=I.next_in,H=I.input,J=I.avail_in,Q=A.hold,$=A.bits,ce=J,ie=oe,L=E;e:for(;;)switch(A.mode){case v:if(A.wrap===0){A.mode=13;break}for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(2&A.wrap&&Q===35615){K[A.check=0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0),$=Q=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&Q)<<8)+(Q>>8))%31){I.msg="incorrect header check",A.mode=30;break}if((15&Q)!=8){I.msg="unknown compression method",A.mode=30;break}if($-=4,f=8+(15&(Q>>>=4)),A.wbits===0)A.wbits=f;else if(f>A.wbits){I.msg="invalid window size",A.mode=30;break}A.dmax=1<<f,I.adler=A.check=1,A.mode=512&Q?10:12,$=Q=0;break;case 2:for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(A.flags=Q,(255&A.flags)!=8){I.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){I.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=Q>>8&1),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0,A.mode=3;case 3:for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.head&&(A.head.time=Q),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,K[2]=Q>>>16&255,K[3]=Q>>>24&255,A.check=r(A.check,K,4,0)),$=Q=0,A.mode=4;case 4:for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.head&&(A.head.xflags=255&Q,A.head.os=Q>>8),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0,A.mode=5;case 5:if(1024&A.flags){for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.length=Q,A.head&&(A.head.extra_len=Q),512&A.flags&&(K[0]=255&Q,K[1]=Q>>>8&255,A.check=r(A.check,K,2,0)),$=Q=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(J<(ee=A.length)&&(ee=J),ee&&(A.head&&(f=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),g.arraySet(A.head.extra,H,W,ee,f)),512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,A.length-=ee),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(J===0)break e;for(ee=0;f=H[W+ee++],A.head&&f&&A.length<65536&&(A.head.name+=String.fromCharCode(f)),f&&ee<J;);if(512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,f)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(J===0)break e;for(ee=0;f=H[W+ee++],A.head&&f&&A.length<65536&&(A.head.comment+=String.fromCharCode(f)),f&&ee<J;);if(512&A.flags&&(A.check=r(A.check,H,ee,W)),J-=ee,W+=ee,f)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;$<16;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q!==(65535&A.check)){I.msg="header crc mismatch",A.mode=30;break}$=Q=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),I.adler=A.check=0,A.mode=12;break;case 10:for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}I.adler=A.check=n(Q),$=Q=0,A.mode=11;case 11:if(A.havedict===0)return I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,2;I.adler=A.check=1,A.mode=12;case 12:if(F===5||F===6)break e;case 13:if(A.last){Q>>>=7&$,$-=7&$,A.mode=27;break}for(;$<3;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}switch(A.last=1&Q,$-=1,3&(Q>>>=1)){case 0:A.mode=14;break;case 1:if(N(A),A.mode=20,F!==6)break;Q>>>=2,$-=2;break e;case 2:A.mode=17;break;case 3:I.msg="invalid block type",A.mode=30}Q>>>=2,$-=2;break;case 14:for(Q>>>=7&$,$-=7&$;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if((65535&Q)!=(Q>>>16^65535)){I.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&Q,$=Q=0,A.mode=15,F===6)break e;case 15:A.mode=16;case 16:if(ee=A.length){if(J<ee&&(ee=J),oe<ee&&(ee=oe),ee===0)break e;g.arraySet(j,H,W,ee,re),J-=ee,W+=ee,oe-=ee,re+=ee,A.length-=ee;break}A.mode=12;break;case 17:for(;$<14;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(A.nlen=257+(31&Q),Q>>>=5,$-=5,A.ndist=1+(31&Q),Q>>>=5,$-=5,A.ncode=4+(15&Q),Q>>>=4,$-=4,286<A.nlen||30<A.ndist){I.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;$<3;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.lens[X[A.have++]]=7&Q,Q>>>=3,$-=3}for(;A.have<19;)A.lens[X[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,G={bits:A.lenbits},L=l(0,A.lens,0,19,A.lencode,0,A.work,G),A.lenbits=G.bits,L){I.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;k=(V=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(O<16)Q>>>=ve,$-=ve,A.lens[A.have++]=O;else{if(O===16){for(M=ve+2;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q>>>=ve,$-=ve,A.have===0){I.msg="invalid bit length repeat",A.mode=30;break}f=A.lens[A.have-1],ee=3+(3&Q),Q>>>=2,$-=2}else if(O===17){for(M=ve+3;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}$-=ve,f=0,ee=3+(7&(Q>>>=ve)),Q>>>=3,$-=3}else{for(M=ve+7;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}$-=ve,f=0,ee=11+(127&(Q>>>=ve)),Q>>>=7,$-=7}if(A.have+ee>A.nlen+A.ndist){I.msg="invalid bit length repeat",A.mode=30;break}for(;ee--;)A.lens[A.have++]=f}}if(A.mode===30)break;if(A.lens[256]===0){I.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,G={bits:A.lenbits},L=l(b,A.lens,0,A.nlen,A.lencode,0,A.work,G),A.lenbits=G.bits,L){I.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,G={bits:A.distbits},L=l(T,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,G),A.distbits=G.bits,L){I.msg="invalid distances set",A.mode=30;break}if(A.mode=20,F===6)break e;case 20:A.mode=21;case 21:if(6<=J&&258<=oe){I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,c(I,ie),re=I.next_out,j=I.output,oe=I.avail_out,W=I.next_in,H=I.input,J=I.avail_in,Q=A.hold,$=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;k=(V=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(k&&(240&k)==0){for(P=ve,D=k,S=O;k=(V=A.lencode[S+((Q&(1<<P+D)-1)>>P)])>>>16&255,O=65535&V,!(P+(ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}Q>>>=P,$-=P,A.back+=P}if(Q>>>=ve,$-=ve,A.back+=ve,A.length=O,k===0){A.mode=26;break}if(32&k){A.back=-1,A.mode=12;break}if(64&k){I.msg="invalid literal/length code",A.mode=30;break}A.extra=15&k,A.mode=22;case 22:if(A.extra){for(M=A.extra;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.length+=Q&(1<<A.extra)-1,Q>>>=A.extra,$-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;k=(V=A.distcode[Q&(1<<A.distbits)-1])>>>16&255,O=65535&V,!((ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if((240&k)==0){for(P=ve,D=k,S=O;k=(V=A.distcode[S+((Q&(1<<P+D)-1)>>P)])>>>16&255,O=65535&V,!(P+(ve=V>>>24)<=$);){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}Q>>>=P,$-=P,A.back+=P}if(Q>>>=ve,$-=ve,A.back+=ve,64&k){I.msg="invalid distance code",A.mode=30;break}A.offset=O,A.extra=15&k,A.mode=24;case 24:if(A.extra){for(M=A.extra;$<M;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}A.offset+=Q&(1<<A.extra)-1,Q>>>=A.extra,$-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){I.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(oe===0)break e;if(ee=ie-oe,A.offset>ee){if((ee=A.offset-ee)>A.whave&&A.sane){I.msg="invalid distance too far back",A.mode=30;break}ue=ee>A.wnext?(ee-=A.wnext,A.wsize-ee):A.wnext-ee,ee>A.length&&(ee=A.length),Se=A.window}else Se=j,ue=re-A.offset,ee=A.length;for(oe<ee&&(ee=oe),oe-=ee,A.length-=ee;j[re++]=Se[ue++],--ee;);A.length===0&&(A.mode=21);break;case 26:if(oe===0)break e;j[re++]=A.length,oe--,A.mode=21;break;case 27:if(A.wrap){for(;$<32;){if(J===0)break e;J--,Q|=H[W++]<<$,$+=8}if(ie-=oe,I.total_out+=ie,A.total+=ie,ie&&(I.adler=A.check=A.flags?r(A.check,j,ie,re-ie):u(A.check,j,ie,re-ie)),ie=oe,(A.flags?Q:n(Q))!==A.check){I.msg="incorrect data check",A.mode=30;break}$=Q=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;$<32;){if(J===0)break e;J--,Q+=H[W++]<<$,$+=8}if(Q!==(4294967295&A.total)){I.msg="incorrect length check",A.mode=30;break}$=Q=0}A.mode=29;case 29:L=1;break e;case 30:L=-3;break e;case 31:return-4;case 32:default:return s}return I.next_out=re,I.avail_out=oe,I.next_in=W,I.avail_in=J,A.hold=Q,A.bits=$,(A.wsize||ie!==I.avail_out&&A.mode<30&&(A.mode<27||F!==4))&&q(I,I.output,I.next_out,ie-I.avail_out)?(A.mode=31,-4):(ce-=I.avail_in,ie-=I.avail_out,I.total_in+=ce,I.total_out+=ie,A.total+=ie,A.wrap&&ie&&(I.adler=A.check=A.flags?r(A.check,j,ie,I.next_out-ie):u(A.check,j,ie,I.next_out-ie)),I.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(ce==0&&ie===0||F===4)&&L===E&&(L=-5),L)},x.inflateEnd=function(I){if(!I||!I.state)return s;var F=I.state;return F.window&&(F.window=null),I.state=null,E},x.inflateGetHeader=function(I,F){var A;return I&&I.state?(2&(A=I.state).wrap)==0?s:((A.head=F).done=!1,E):s},x.inflateSetDictionary=function(I,F){var A,H=F.length;return I&&I.state?(A=I.state).wrap!==0&&A.mode!==11?s:A.mode===11&&u(1,F,H,0)!==A.check?-3:q(I,F,H,H)?(A.mode=31,-4):(A.havedict=1,E):s},x.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(t,d,x){var g=t("../utils/common"),u=[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],r=[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],c=[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],l=[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];d.exports=function(b,T,E,s,v,h,y,n){var p,m,_,w,C,o,i,B,N,q=n.bits,I=0,F=0,A=0,H=0,j=0,W=0,re=0,J=0,oe=0,Q=0,$=null,ce=0,ie=new g.Buf16(16),ee=new g.Buf16(16),ue=null,Se=0;for(I=0;I<=15;I++)ie[I]=0;for(F=0;F<s;F++)ie[T[E+F]]++;for(j=q,H=15;1<=H&&ie[H]===0;H--);if(H<j&&(j=H),H===0)return v[h++]=20971520,v[h++]=20971520,n.bits=1,0;for(A=1;A<H&&ie[A]===0;A++);for(j<A&&(j=A),I=J=1;I<=15;I++)if(J<<=1,(J-=ie[I])<0)return-1;if(0<J&&(b===0||H!==1))return-1;for(ee[1]=0,I=1;I<15;I++)ee[I+1]=ee[I]+ie[I];for(F=0;F<s;F++)T[E+F]!==0&&(y[ee[T[E+F]]++]=F);if(o=b===0?($=ue=y,19):b===1?($=u,ce-=257,ue=r,Se-=257,256):($=c,ue=l,-1),I=A,C=h,re=F=Q=0,_=-1,w=(oe=1<<(W=j))-1,b===1&&852<oe||b===2&&592<oe)return 1;for(;;){for(i=I-re,N=y[F]<o?(B=0,y[F]):y[F]>o?(B=ue[Se+y[F]],$[ce+y[F]]):(B=96,0),p=1<<I-re,A=m=1<<W;v[C+(Q>>re)+(m-=p)]=i<<24|B<<16|N|0,m!==0;);for(p=1<<I-1;Q&p;)p>>=1;if(p!==0?(Q&=p-1,Q+=p):Q=0,F++,--ie[I]==0){if(I===H)break;I=T[E+y[F]]}if(j<I&&(Q&w)!==_){for(re===0&&(re=j),C+=A,J=1<<(W=I-re);W+re<H&&!((J-=ie[W+re])<=0);)W++,J<<=1;if(oe+=1<<W,b===1&&852<oe||b===2&&592<oe)return 1;v[_=Q&w]=j<<24|W<<16|C-h|0}}return Q!==0&&(v[C+Q]=I-re<<24|64<<16|0),n.bits=j,0}},{"../utils/common":41}],51:[function(t,d,x){d.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(t,d,x){var g=t("../utils/common"),u=0,r=1;function c(V){for(var K=V.length;0<=--K;)V[K]=0}var l=0,b=29,T=256,E=T+1+b,s=30,v=19,h=2*E+1,y=15,n=16,p=7,m=256,_=16,w=17,C=18,o=[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],i=[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],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(E+2));c(q);var I=new Array(2*s);c(I);var F=new Array(512);c(F);var A=new Array(256);c(A);var H=new Array(b);c(H);var j,W,re,J=new Array(s);function oe(V,K,X,te,Y){this.static_tree=V,this.extra_bits=K,this.extra_base=X,this.elems=te,this.max_length=Y,this.has_stree=V&&V.length}function Q(V,K){this.dyn_tree=V,this.max_code=0,this.stat_desc=K}function $(V){return V<256?F[V]:F[256+(V>>>7)]}function ce(V,K){V.pending_buf[V.pending++]=255&K,V.pending_buf[V.pending++]=K>>>8&255}function ie(V,K,X){V.bi_valid>n-X?(V.bi_buf|=K<<V.bi_valid&65535,ce(V,V.bi_buf),V.bi_buf=K>>n-V.bi_valid,V.bi_valid+=X-n):(V.bi_buf|=K<<V.bi_valid&65535,V.bi_valid+=X)}function ee(V,K,X){ie(V,X[2*K],X[2*K+1])}function ue(V,K){for(var X=0;X|=1&V,V>>>=1,X<<=1,0<--K;);return X>>>1}function Se(V,K,X){var te,Y,ae=new Array(y+1),fe=0;for(te=1;te<=y;te++)ae[te]=fe=fe+X[te-1]<<1;for(Y=0;Y<=K;Y++){var se=V[2*Y+1];se!==0&&(V[2*Y]=ue(ae[se]++,se))}}function ve(V){var K;for(K=0;K<E;K++)V.dyn_ltree[2*K]=0;for(K=0;K<s;K++)V.dyn_dtree[2*K]=0;for(K=0;K<v;K++)V.bl_tree[2*K]=0;V.dyn_ltree[2*m]=1,V.opt_len=V.static_len=0,V.last_lit=V.matches=0}function k(V){8<V.bi_valid?ce(V,V.bi_buf):0<V.bi_valid&&(V.pending_buf[V.pending++]=V.bi_buf),V.bi_buf=0,V.bi_valid=0}function O(V,K,X,te){var Y=2*K,ae=2*X;return V[Y]<V[ae]||V[Y]===V[ae]&&te[K]<=te[X]}function P(V,K,X){for(var te=V.heap[X],Y=X<<1;Y<=V.heap_len&&(Y<V.heap_len&&O(K,V.heap[Y+1],V.heap[Y],V.depth)&&Y++,!O(K,te,V.heap[Y],V.depth));)V.heap[X]=V.heap[Y],X=Y,Y<<=1;V.heap[X]=te}function D(V,K,X){var te,Y,ae,fe,se=0;if(V.last_lit!==0)for(;te=V.pending_buf[V.d_buf+2*se]<<8|V.pending_buf[V.d_buf+2*se+1],Y=V.pending_buf[V.l_buf+se],se++,te===0?ee(V,Y,K):(ee(V,(ae=A[Y])+T+1,K),(fe=o[ae])!==0&&ie(V,Y-=H[ae],fe),ee(V,ae=$(--te),X),(fe=i[ae])!==0&&ie(V,te-=J[ae],fe)),se<V.last_lit;);ee(V,m,K)}function S(V,K){var X,te,Y,ae=K.dyn_tree,fe=K.stat_desc.static_tree,se=K.stat_desc.has_stree,de=K.stat_desc.elems,ye=-1;for(V.heap_len=0,V.heap_max=h,X=0;X<de;X++)ae[2*X]!==0?(V.heap[++V.heap_len]=ye=X,V.depth[X]=0):ae[2*X+1]=0;for(;V.heap_len<2;)ae[2*(Y=V.heap[++V.heap_len]=ye<2?++ye:0)]=1,V.depth[Y]=0,V.opt_len--,se&&(V.static_len-=fe[2*Y+1]);for(K.max_code=ye,X=V.heap_len>>1;1<=X;X--)P(V,ae,X);for(Y=de;X=V.heap[1],V.heap[1]=V.heap[V.heap_len--],P(V,ae,1),te=V.heap[1],V.heap[--V.heap_max]=X,V.heap[--V.heap_max]=te,ae[2*Y]=ae[2*X]+ae[2*te],V.depth[Y]=(V.depth[X]>=V.depth[te]?V.depth[X]:V.depth[te])+1,ae[2*X+1]=ae[2*te+1]=Y,V.heap[1]=Y++,P(V,ae,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],(function(ge,xe){var be,_e,Ae,Ce,Be,Ne,Ie=xe.dyn_tree,Qe=xe.max_code,Ze=xe.stat_desc.static_tree,et=xe.stat_desc.has_stree,nt=xe.stat_desc.extra_bits,it=xe.stat_desc.extra_base,Xe=xe.stat_desc.max_length,st=0;for(Ce=0;Ce<=y;Ce++)ge.bl_count[Ce]=0;for(Ie[2*ge.heap[ge.heap_max]+1]=0,be=ge.heap_max+1;be<h;be++)Xe<(Ce=Ie[2*Ie[2*(_e=ge.heap[be])+1]+1]+1)&&(Ce=Xe,st++),Ie[2*_e+1]=Ce,Qe<_e||(ge.bl_count[Ce]++,Be=0,it<=_e&&(Be=nt[_e-it]),Ne=Ie[2*_e],ge.opt_len+=Ne*(Ce+Be),et&&(ge.static_len+=Ne*(Ze[2*_e+1]+Be)));if(st!==0){do{for(Ce=Xe-1;ge.bl_count[Ce]===0;)Ce--;ge.bl_count[Ce]--,ge.bl_count[Ce+1]+=2,ge.bl_count[Xe]--,st-=2}while(0<st);for(Ce=Xe;Ce!==0;Ce--)for(_e=ge.bl_count[Ce];_e!==0;)Qe<(Ae=ge.heap[--be])||(Ie[2*Ae+1]!==Ce&&(ge.opt_len+=(Ce-Ie[2*Ae+1])*Ie[2*Ae],Ie[2*Ae+1]=Ce),_e--)}})(V,K),Se(ae,ye,V.bl_count)}function f(V,K,X){var te,Y,ae=-1,fe=K[1],se=0,de=7,ye=4;for(fe===0&&(de=138,ye=3),K[2*(X+1)+1]=65535,te=0;te<=X;te++)Y=fe,fe=K[2*(te+1)+1],++se<de&&Y===fe||(se<ye?V.bl_tree[2*Y]+=se:Y!==0?(Y!==ae&&V.bl_tree[2*Y]++,V.bl_tree[2*_]++):se<=10?V.bl_tree[2*w]++:V.bl_tree[2*C]++,ae=Y,ye=(se=0)===fe?(de=138,3):Y===fe?(de=6,3):(de=7,4))}function L(V,K,X){var te,Y,ae=-1,fe=K[1],se=0,de=7,ye=4;for(fe===0&&(de=138,ye=3),te=0;te<=X;te++)if(Y=fe,fe=K[2*(te+1)+1],!(++se<de&&Y===fe)){if(se<ye)for(;ee(V,Y,V.bl_tree),--se!=0;);else Y!==0?(Y!==ae&&(ee(V,Y,V.bl_tree),se--),ee(V,_,V.bl_tree),ie(V,se-3,2)):se<=10?(ee(V,w,V.bl_tree),ie(V,se-3,3)):(ee(V,C,V.bl_tree),ie(V,se-11,7));ae=Y,ye=(se=0)===fe?(de=138,3):Y===fe?(de=6,3):(de=7,4)}}c(J);var G=!1;function M(V,K,X,te){ie(V,(l<<1)+(te?1:0),3),(function(Y,ae,fe,se){k(Y),ce(Y,fe),ce(Y,~fe),g.arraySet(Y.pending_buf,Y.window,ae,fe,Y.pending),Y.pending+=fe})(V,K,X)}x._tr_init=function(V){G||((function(){var K,X,te,Y,ae,fe=new Array(y+1);for(Y=te=0;Y<b-1;Y++)for(H[Y]=te,K=0;K<1<<o[Y];K++)A[te++]=Y;for(A[te-1]=Y,Y=ae=0;Y<16;Y++)for(J[Y]=ae,K=0;K<1<<i[Y];K++)F[ae++]=Y;for(ae>>=7;Y<s;Y++)for(J[Y]=ae<<7,K=0;K<1<<i[Y]-7;K++)F[256+ae++]=Y;for(X=0;X<=y;X++)fe[X]=0;for(K=0;K<=143;)q[2*K+1]=8,K++,fe[8]++;for(;K<=255;)q[2*K+1]=9,K++,fe[9]++;for(;K<=279;)q[2*K+1]=7,K++,fe[7]++;for(;K<=287;)q[2*K+1]=8,K++,fe[8]++;for(Se(q,E+1,fe),K=0;K<s;K++)I[2*K+1]=5,I[2*K]=ue(K,5);j=new oe(q,o,T+1,E,y),W=new oe(I,i,0,s,y),re=new oe(new Array(0),B,0,v,p)})(),G=!0),V.l_desc=new Q(V.dyn_ltree,j),V.d_desc=new Q(V.dyn_dtree,W),V.bl_desc=new Q(V.bl_tree,re),V.bi_buf=0,V.bi_valid=0,ve(V)},x._tr_stored_block=M,x._tr_flush_block=function(V,K,X,te){var Y,ae,fe=0;0<V.level?(V.strm.data_type===2&&(V.strm.data_type=(function(se){var de,ye=4093624447;for(de=0;de<=31;de++,ye>>>=1)if(1&ye&&se.dyn_ltree[2*de]!==0)return u;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return r;for(de=32;de<T;de++)if(se.dyn_ltree[2*de]!==0)return r;return u})(V)),S(V,V.l_desc),S(V,V.d_desc),fe=(function(se){var de;for(f(se,se.dyn_ltree,se.l_desc.max_code),f(se,se.dyn_dtree,se.d_desc.max_code),S(se,se.bl_desc),de=v-1;3<=de&&se.bl_tree[2*N[de]+1]===0;de--);return se.opt_len+=3*(de+1)+5+5+4,de})(V),Y=V.opt_len+3+7>>>3,(ae=V.static_len+3+7>>>3)<=Y&&(Y=ae)):Y=ae=X+5,X+4<=Y&&K!==-1?M(V,K,X,te):V.strategy===4||ae===Y?(ie(V,2+(te?1:0),3),D(V,q,I)):(ie(V,4+(te?1:0),3),(function(se,de,ye,ge){var xe;for(ie(se,de-257,5),ie(se,ye-1,5),ie(se,ge-4,4),xe=0;xe<ge;xe++)ie(se,se.bl_tree[2*N[xe]+1],3);L(se,se.dyn_ltree,de-1),L(se,se.dyn_dtree,ye-1)})(V,V.l_desc.max_code+1,V.d_desc.max_code+1,fe+1),D(V,V.dyn_ltree,V.dyn_dtree)),ve(V),te&&k(V)},x._tr_tally=function(V,K,X){return V.pending_buf[V.d_buf+2*V.last_lit]=K>>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&K,V.pending_buf[V.l_buf+V.last_lit]=255&X,V.last_lit++,K===0?V.dyn_ltree[2*X]++:(V.matches++,K--,V.dyn_ltree[2*(A[X]+T+1)]++,V.dyn_dtree[2*$(K)]++),V.last_lit===V.lit_bufsize-1},x._tr_align=function(V){ie(V,2,3),ee(V,m,q),(function(K){K.bi_valid===16?(ce(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)})(V)}},{"../utils/common":41}],53:[function(t,d,x){d.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(t,d,x){(function(g){(function(u,r){if(!u.setImmediate){var c,l,b,T,E=1,s={},v=!1,h=u.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(u);y=y&&y.setTimeout?y:u,c={}.toString.call(u.process)==="[object process]"?function(_){process.nextTick(function(){p(_)})}:(function(){if(u.postMessage&&!u.importScripts){var _=!0,w=u.onmessage;return u.onmessage=function(){_=!1},u.postMessage("","*"),u.onmessage=w,_}})()?(T="setImmediate$"+Math.random()+"$",u.addEventListener?u.addEventListener("message",m,!1):u.attachEvent("onmessage",m),function(_){u.postMessage(T+_,"*")}):u.MessageChannel?((b=new MessageChannel).port1.onmessage=function(_){p(_.data)},function(_){b.port2.postMessage(_)}):h&&"onreadystatechange"in h.createElement("script")?(l=h.documentElement,function(_){var w=h.createElement("script");w.onreadystatechange=function(){p(_),w.onreadystatechange=null,l.removeChild(w),w=null},l.appendChild(w)}):function(_){setTimeout(p,0,_)},y.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var w=new Array(arguments.length-1),C=0;C<w.length;C++)w[C]=arguments[C+1];var o={callback:_,args:w};return s[E]=o,c(E),E++},y.clearImmediate=n}function n(_){delete s[_]}function p(_){if(v)setTimeout(p,0,_);else{var w=s[_];if(w){v=!0;try{(function(C){var o=C.callback,i=C.args;switch(i.length){case 0:o();break;case 1:o(i[0]);break;case 2:o(i[0],i[1]);break;case 3:o(i[0],i[1],i[2]);break;default:o.apply(r,i)}})(w)}finally{n(_),v=!1}}}}function m(_){_.source===u&&typeof _.data=="string"&&_.data.indexOf(T)===0&&p(+_.data.slice(T.length))}})(typeof self>"u"?g===void 0?this:g:self)}).call(this,typeof bt<"u"?bt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(er)),er.exports}Dn();function Un(a){const e=String(a??"").trim().toLowerCase(),t=e.lastIndexOf(".");return t>=0?e.slice(t):""}function Pn(a){const e=URL.createObjectURL(a);return{url:e,name:a.name,extension:Un(a.name),revoke:()=>URL.revokeObjectURL(e)}}function On(a,e){return`${a}#${e}`}class Fn{viewer;getDefaultRotation;scenes=new Map;localSceneResources=new Map;constructor(e,t){this.viewer=e,this.getDefaultRotation=t}async loadModel(e,t={}){const d=this.viewer.getSceneCount(),x={progressiveLoad:!1,position:[0,0,0],rotation:this.getDefaultRotation(),scale:[1,1,1],...t,showLoadingUI:!1};await this.viewer.addSplatScene(e,x);const g={id:x.id??On(e,d),name:x.name??e.split(/[\\/]/).pop()??e,url:e,index:d,options:x};return this.scenes.set(g.id,g),g}async loadModelFile(e,t={}){if(e.length===0)throw new Error("LoaderModuleGaussian: no file selected");if(e.length>1)throw new Error("LoaderModuleGaussian: only a single local point cloud file is supported");const d=Pn(e[0]);try{const x=await this.loadModel(d.url,{...t,name:t.name??e[0].name});return this.localSceneResources.set(x.id,d),x}catch(x){throw d.revoke(),x}}async loadModels(e){const t=[];for(const d of e)t.push(await this.loadModel(d.url,d.options));return t}async unloadModel(e,t=!1){const d=this.scenes.get(e);d&&(await this.viewer.removeSplatScene(d.index,t),this.scenes.delete(e),this.localSceneResources.get(e)?.revoke(),this.localSceneResources.delete(e),this.reindexScenesAfterRemove(d.index))}getModel(e){return this.scenes.get(e)}getAllModels(){return Array.from(this.scenes.values())}getRawSplatScene(e){const t=typeof e=="number"?e:this.scenes.get(e)?.index;return t==null?void 0:this.viewer.getSplatScene(t)}async clear(e=!1){const t=this.getAllModels().map(d=>d.index);t.length>0&&await this.viewer.removeSplatScenes(t,e),this.scenes.clear(),this.localSceneResources.forEach(d=>d.revoke()),this.localSceneResources.clear()}reindexScenesAfterRemove(e){this.scenes.forEach(t=>{t.index>e&&(t.index-=1)})}}const _t={version:"3.11.7"}.version;function tr(){const a=globalThis.crypto?.subtle;if(!a)throw new Error("[BimEngine] Web Crypto API is required for secure sdkAuth credentials mode");return a}function Tt(a){return new TextEncoder().encode(a)}function At(a){return a.buffer.slice(a.byteOffset,a.byteOffset+a.byteLength)}function oa(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e)}function Vn(a){const e=a.getUTCFullYear(),t=String(a.getUTCMonth()+1).padStart(2,"0"),d=String(a.getUTCDate()).padStart(2,"0");return`${e}${t}${d}`}async function Mn(a){const e=await tr().digest("SHA-256",At(Tt(a)));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}async function Kn(a,e){const t=tr(),d=await t.importKey("raw",At(a),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return t.sign("HMAC",d,At(Tt(e)))}function zn(a){return Tt([a.appId,a.engineType,a.requestDate,String(a.timestamp),a.nonce].join("|"))}async function qn(a){const e=tr(),t=new Date,d=t.getTime(),x=Vn(t),g=globalThis.crypto.randomUUID(),u=globalThis.crypto.getRandomValues(new Uint8Array(12)),r=await Mn(a.appSecret),c=await Kn(Tt(r),x),l=await e.importKey("raw",c,"AES-GCM",!1,["encrypt"]),b=JSON.stringify({appKey:a.appKey,appSecret:a.appSecret}),T=await e.encrypt({name:"AES-GCM",iv:u,additionalData:At(zn({appId:a.appId,engineType:a.engineType,requestDate:x,timestamp:d,nonce:g})),tagLength:128},l,At(Tt(b)));return{appId:a.appId,engineType:a.engineType,requestDate:x,timestamp:d,nonce:g,iv:oa(u),cipherText:oa(new Uint8Array(T)),sdkVersion:a.sdkVersion,origin:a.origin,product:a.product}}const rr=new Map;function Pt(a){return a.replace(/\/+$/,"")}function Ot(a){if(a)return a;if(typeof window<"u"&&typeof window.location?.origin=="string")return window.location.origin}function Hn(a,e){return JSON.stringify({endpoint:Pt(a.endpoint),token:a.token??"",appId:a.appId??"",appKey:a.appKey??"",appSecret:a.appSecret??"",origin:Ot(a.origin)??"",product:a.product??"",engineType:e,sdkVersion:_t})}async function ar(a,e,t){const d=typeof AbortController<"u"?new AbortController:void 0,x=d?setTimeout(()=>d.abort(),t):void 0;try{const g=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:d?.signal}),u=await g.json().catch(()=>({}));if(!g.ok){const r=u?.error?.message??u?.message??`SDK authentication failed with status ${g.status}`;throw new Error(r)}return u}finally{x!=null&&clearTimeout(x)}}async function Gn(a,e){const t=await ar(`${Pt(a.endpoint)}/oauth/sdk-verify`,{sdkToken:a.token,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product},a.timeoutMs??8e3);return t.sdkToken=a.token,t}async function Wn(a,e){const t=await qn({appId:a.appId,appKey:a.appKey,appSecret:a.appSecret,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product}),d=await ar(`${Pt(a.endpoint)}/oauth/sdk-token/secure`,t,a.timeoutMs??8e3),x=await ar(`${Pt(a.endpoint)}/oauth/sdk-verify`,{sdkToken:d.sdkToken,engineType:e,sdkVersion:_t,origin:Ot(a.origin),product:a.product},a.timeoutMs??8e3);return x.sdkToken=d.sdkToken,x}async function jn(a,e){const t=a?.sdkAuth;if(!t)return null;if(!t.endpoint)throw new Error("[BimEngine] sdkAuth.endpoint is required");if(!t.token&&!(t.appId&&t.appKey&&t.appSecret))return null;const d=Hn(t,e),x=rr.get(d);if(x){const u=await x;return a&&(a.__sdkAuthSession=u),u}const g=(t.token?Gn(t,e):Wn(t,e)).then(u=>{if(u.authorized!==!0)throw new Error("[BimEngine] SDK authorization rejected");return a&&(a.__sdkAuthSession=u),u}).catch(u=>{throw rr.delete(d),u});return rr.set(d,g),g}function Qn(a){return a instanceof Uint8Array||ArrayBuffer.isView(a)&&a.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in a&&a.BYTES_PER_ELEMENT===1}function ua(a){if(typeof a!="number")throw new TypeError("number expected, got "+typeof a);if(!Number.isSafeInteger(a)||a<0)throw new RangeError("positive integer expected, got "+a)}function Ye(a,e,t=""){const d=Qn(a),x=a?.length,g=e!==void 0;if(!d||g&&x!==e){const u=t&&`"${t}" `,r=g?` of length ${e}`:"",c=d?`length=${x}`:`type=${typeof a}`,l=u+"expected Uint8Array"+r+", got "+c;throw d?new RangeError(l):new TypeError(l)}return a}function la(a,e=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(e&&a.finished)throw new Error("Hash#digest() has already been called")}function Yn(a,e,t=!1){Ye(a,void 0,"output");const d=e.outputLen;if(a.length<d)throw new RangeError("digestInto() expects output buffer of length at least "+d);if(t&&!It(a))throw new Error("invalid output, must be aligned")}function Zn(a){return new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}function vt(a){return new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))}function pt(...a){for(let e=0;e<a.length;e++)a[e].fill(0)}function Ft(a){return new DataView(a.buffer,a.byteOffset,a.byteLength)}const nr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,fa=a=>a<<24&4278190080|a<<8&16711680|a>>>8&65280|a>>>24&255,ke=nr?a=>a:a=>fa(a)>>>0,ir=nr?a=>a:a=>{for(let e=0;e<a.length;e++)a[e]=fa(a[e]);return a};function Xn(a,e){if(a.length!==e.length)return!1;let t=0;for(let d=0;d<a.length;d++)t|=a[d]^e[d];return t===0}function $n(a,e,t){const d=e,x=t||(()=>[]),g=(r,c)=>d(c,...x(r)).update(r).digest(),u=d(new Uint8Array(a),...x(new Uint8Array(0)));return g.outputLen=u.outputLen,g.blockLen=u.blockLen,g.create=(r,...c)=>d(r,...c),g}const Jn=(a,e)=>{function t(d,...x){if(Ye(d,void 0,"key"),a.nonceLength!==void 0){const b=x[0];Ye(b,a.varSizeNonce?void 0:a.nonceLength,"nonce")}const g=a.tagLength;g&&x[1]!==void 0&&Ye(x[1],void 0,"AAD");const u=e(d,...x),r=(b,T)=>{if(T!==void 0){if(b!==2)throw new Error("cipher output not supported");Ye(T,void 0,"output")}};let c=!1;return{encrypt(b,T){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,Ye(b),r(u.encrypt.length,T),u.encrypt(b,T)},decrypt(b,T){if(Ye(b),g&&b.length<g)throw new Error('"ciphertext" expected length bigger than tagLength='+g);return r(u.decrypt.length,T),u.decrypt(b,T)}}}return Object.assign(t,a),t};function ei(a,e,t=!0){if(e===void 0)return new Uint8Array(a);if(Ye(e,void 0,"output"),e.length!==a)throw new Error('"output" expected Uint8Array of length '+a+", got: "+e.length);if(t&&!It(e))throw new Error("invalid output, must be aligned");return e}function ti(a,e,t){ua(a),ua(e);const d=new Uint8Array(16),x=Ft(d);return x.setBigUint64(0,BigInt(e),t),x.setBigUint64(8,BigInt(a),t),d}function It(a){return a.byteOffset%4===0}function wt(a){return Uint8Array.from(Ye(a))}const Ct=16,ca=new Uint8Array(16),Bt=vt(ca),ri=225,ai=(a,e,t,d)=>{const x=d&1;return{s3:t<<31|d>>>1,s2:e<<31|t>>>1,s1:a<<31|e>>>1,s0:a>>>1^ri<<24&-(x&1)}},Vt=a=>(a>>>0&255)<<24|(a>>>8&255)<<16|(a>>>16&255)<<8|a>>>24&255|0,ni=a=>a>64*1024?8:a>1024?4:2;class ii{blockLen=Ct;outputLen=Ct;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(e,t){Ye(e,16,"key"),e=wt(e);const d=Ft(e);let x=d.getUint32(0,!1),g=d.getUint32(4,!1),u=d.getUint32(8,!1),r=d.getUint32(12,!1);const c=[];for(let v=0;v<128;v++)c.push({s0:Vt(x),s1:Vt(g),s2:Vt(u),s3:Vt(r)}),{s0:x,s1:g,s2:u,s3:r}=ai(x,g,u,r);const l=ni(t||1024);if(![1,2,4,8].includes(l))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=l;const T=128/l,E=this.windowSize=2**l,s=[];for(let v=0;v<T;v++)for(let h=0;h<E;h++){let y=0,n=0,p=0,m=0;for(let _=0;_<l;_++){if(!(h>>>l-_-1&1))continue;const{s0:C,s1:o,s2:i,s3:B}=c[l*v+_];y^=C,n^=o,p^=i,m^=B}s.push({s0:y,s1:n,s2:p,s3:m})}this.t=s}_updateBlock(e,t,d,x){e^=this.s0,t^=this.s1,d^=this.s2,x^=this.s3;const{W:g,t:u,windowSize:r}=this;let c=0,l=0,b=0,T=0;const E=(1<<g)-1;let s=0;for(const v of[e,t,d,x])for(let h=0;h<4;h++){const y=v>>>8*h&255;for(let n=8/g-1;n>=0;n--){const p=y>>>g*n&E,{s0:m,s1:_,s2:w,s3:C}=u[s*r+p];c^=m,l^=_,b^=w,T^=C,s+=1}}this.s0=c,this.s1=l,this.s2=b,this.s3=T}update(e){la(this),Ye(e),e=wt(e);const t=vt(e),d=Math.floor(e.length/Ct),x=e.length%Ct;for(let g=0;g<d;g++)this._updateBlock(ke(t[g*4+0]),ke(t[g*4+1]),ke(t[g*4+2]),ke(t[g*4+3]));return x&&(ca.set(e.subarray(d*Ct)),this._updateBlock(ke(Bt[0]),ke(Bt[1]),ke(Bt[2]),ke(Bt[3])),pt(Bt)),this}destroy(){this.destroyed=!0;const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){la(this),Yn(e,this,!0),this.finished=!0;const{s0:t,s1:d,s2:x,s3:g}=this,u=vt(e);u[0]=t,u[1]=d,u[2]=x,u[3]=g,ir(u)}digest(){const e=new Uint8Array(Ct);return this.digestInto(e),this.destroy(),e}}const ha=$n(16,(a,e)=>new ii(a,e),a=>[a.length]),sr=16,si=4,Mt=new Uint8Array(sr),oi=283;function ui(a){if(![16,24,32].includes(a.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+a.length)}function or(a){return a<<1^oi&-(a>>7)}function da(a,e){let t=0;for(;e>0;e>>=1)t^=a&-(e&1),a=or(a);return t}const li=(()=>{const a=new Uint8Array(256);for(let t=0,d=1;t<256;t++,d^=or(d))a[t]=d;const e=new Uint8Array(256);e[0]=99;for(let t=0;t<255;t++){let d=a[255-t];d|=d<<8,e[a[t]]=(d^d>>4^d>>5^d>>6^d>>7^99)&255}return pt(a),e})(),fi=a=>a<<24|a>>>8,ur=a=>a<<8|a>>>24;function ci(a,e){if(a.length!==256)throw new Error("Wrong sbox length");const t=new Uint32Array(256).map((l,b)=>e(a[b])),d=t.map(ur),x=d.map(ur),g=x.map(ur),u=new Uint32Array(256*256),r=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let b=0;b<256;b++){const T=l*256+b;u[T]=t[l]^d[b],r[T]=x[l]^g[b],c[T]=a[l]<<8|a[b]}return{sbox:a,sbox2:c,T0:t,T1:d,T2:x,T3:g,T01:u,T23:r}}const pa=ci(li,a=>da(a,3)<<24|a<<16|a<<8|da(a,2)),hi=(()=>{const a=new Uint8Array(16);for(let e=0,t=1;e<16;e++,t=or(t))a[e]=t;return a})();function di(a){Ye(a);const e=a.length;ui(a);const{sbox2:t}=pa,d=[];(!nr||!It(a))&&d.push(a=wt(a));const x=ir(vt(a)),g=x.length,u=c=>kt(t,c,c,c,c),r=new Uint32Array(e+28);r.set(x);for(let c=g;c<r.length;c++){let l=r[c-1];c%g===0?l=u(fi(l))^hi[c/g-1]:g>6&&c%g===4&&(l=u(l)),r[c]=r[c-g]^l}return pt(...d),r}function Kt(a,e,t,d,x,g){return a[t<<8&65280|d>>>8&255]^e[x>>>8&65280|g>>>24&255]}function kt(a,e,t,d,x){return a[e&255|t&65280]|a[d>>>16&255|x>>>16&65280]<<16}function ga(a,e,t,d,x){const{sbox2:g,T01:u,T23:r}=pa;let c=0;e^=a[c++],t^=a[c++],d^=a[c++],x^=a[c++];const l=a.length/4-2;for(let v=0;v<l;v++){const h=a[c++]^Kt(u,r,e,t,d,x),y=a[c++]^Kt(u,r,t,d,x,e),n=a[c++]^Kt(u,r,d,x,e,t),p=a[c++]^Kt(u,r,x,e,t,d);e=h,t=y,d=n,x=p}const b=a[c++]^kt(g,e,t,d,x),T=a[c++]^kt(g,t,d,x,e),E=a[c++]^kt(g,d,x,e,t),s=a[c++]^kt(g,x,e,t,d);return{s0:b,s1:T,s2:E,s3:s}}function zt(a,e,t,d,x){Ye(t,sr,"nonce"),Ye(d),x=ei(d.length,x);const g=t,u=vt(g),r=Ft(g),c=vt(d),l=vt(x),b=e?0:12,T=d.length;let E=r.getUint32(b,e),{s0:s,s1:v,s2:h,s3:y}=ga(a,ke(u[0]),ke(u[1]),ke(u[2]),ke(u[3]));for(let p=0;p+4<=c.length;p+=4)l[p+0]=c[p+0]^ke(s),l[p+1]=c[p+1]^ke(v),l[p+2]=c[p+2]^ke(h),l[p+3]=c[p+3]^ke(y),E=E+1>>>0,r.setUint32(b,E,e),{s0:s,s1:v,s2:h,s3:y}=ga(a,ke(u[0]),ke(u[1]),ke(u[2]),ke(u[3]));const n=sr*Math.floor(c.length/si);if(n<T){const p=new Uint32Array([s,v,h,y]);ir(p);const m=Zn(p);for(let _=n,w=0;_<T;_++,w++)x[_]=d[_]^m[w];pt(p)}return x}function pi(a,e,t,d,x){const g=x?x.length:0,u=a.create(t,d.length+g);x&&u.update(x);const r=ti(8*d.length,8*g,e);u.update(d),u.update(r);const c=u.digest();return pt(r),c}const gi=Jn({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(e,t,d){if(t.length<8)throw new Error("aes/gcm: invalid nonce length");const x=16;function g(r,c,l){const b=pi(ha,!1,r,l,d);for(let T=0;T<c.length;T++)b[T]^=c[T];return b}function u(){const r=di(e),c=Mt.slice(),l=Mt.slice();if(zt(r,!1,l,l,c),t.length===12)l.set(t);else{const T=Mt.slice();Ft(T).setBigUint64(8,BigInt(t.length*8),!1);const s=ha.create(c).update(t).update(T);s.digestInto(l),s.destroy()}const b=zt(r,!1,l,Mt);return{xk:r,authKey:c,counter:l,tagMask:b}}return{encrypt(r){const{xk:c,authKey:l,counter:b,tagMask:T}=u(),E=new Uint8Array(r.length+x),s=[c,l,b,T];It(r)||s.push(r=wt(r)),zt(c,!1,b,r,E.subarray(0,r.length));const v=g(l,T,E.subarray(0,E.length-x));return s.push(v),E.set(v,r.length),pt(...s),E},decrypt(r){const{xk:c,authKey:l,counter:b,tagMask:T}=u(),E=[c,l,T,b];It(r)||E.push(r=wt(r));const s=r.subarray(0,-x),v=r.subarray(-x),h=g(l,T,s);if(E.push(h),!Xn(h,v))throw pt(...E),new Error("aes/gcm: invalid ghash tag");const y=zt(c,!1,b,s);return pt(...E),y}}});var lr,va;function me(){return va||(va=1,lr={options:{usePureJavaScript:!1}}),lr}var fr={exports:{}},cr,ya;function vi(){if(ya)return cr;ya=1;var a={};cr=a;var e={};a.encode=function(d,x,g){if(typeof x!="string")throw new TypeError('"alphabet" must be a string.');if(g!==void 0&&typeof g!="number")throw new TypeError('"maxline" must be a number.');var u="";if(!(d instanceof Uint8Array))u=t(d,x);else{var r=0,c=x.length,l=x.charAt(0),b=[0];for(r=0;r<d.length;++r){for(var T=0,E=d[r];T<b.length;++T)E+=b[T]<<8,b[T]=E%c,E=E/c|0;for(;E>0;)b.push(E%c),E=E/c|0}for(r=0;d[r]===0&&r<d.length-1;++r)u+=l;for(r=b.length-1;r>=0;--r)u+=x[b[r]]}if(g){var s=new RegExp(".{1,"+g+"}","g");u=u.match(s).join(`\r
|
|
3
|
+
`)}return u},a.decode=function(d,x){if(typeof d!="string")throw new TypeError('"input" must be a string.');if(typeof x!="string")throw new TypeError('"alphabet" must be a string.');var g=e[x];if(!g){g=e[x]=[];for(var u=0;u<x.length;++u)g[x.charCodeAt(u)]=u}d=d.replace(/\s/g,"");for(var r=x.length,c=x.charAt(0),l=[0],u=0;u<d.length;u++){var b=g[d.charCodeAt(u)];if(b===void 0)return;for(var T=0,E=b;T<l.length;++T)E+=l[T]*r,l[T]=E&255,E>>=8;for(;E>0;)l.push(E&255),E>>=8}for(var s=0;d[s]===c&&s<d.length-1;++s)l.push(0);return typeof Buffer<"u"?Buffer.from(l.reverse()):new Uint8Array(l.reverse())};function t(d,x){var g=0,u=x.length,r=x.charAt(0),c=[0];for(g=0;g<d.length();++g){for(var l=0,b=d.at(g);l<c.length;++l)b+=c[l]<<8,c[l]=b%u,b=b/u|0;for(;b>0;)c.push(b%u),b=b/u|0}var T="";for(g=0;d.at(g)===0&&g<d.length()-1;++g)T+=r;for(g=c.length-1;g>=0;--g)T+=x[c[g]];return T}return cr}var ma;function Ee(){if(ma)return fr.exports;ma=1;var a=me(),e=vi(),t=fr.exports=a.util=a.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){t.nextTick=process.nextTick,typeof setImmediate=="function"?t.setImmediate=setImmediate:t.setImmediate=t.nextTick;return}if(typeof setImmediate=="function"){t.setImmediate=function(){return setImmediate.apply(void 0,arguments)},t.nextTick=function(o){return setImmediate(o)};return}if(t.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(i){if(i.source===window&&i.data===n){i.stopPropagation();var B=p.slice();p.length=0,B.forEach(function(N){N()})}};var n="forge.setImmediate",p=[];t.setImmediate=function(i){p.push(i),p.length===1&&window.postMessage(n,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var m=Date.now(),_=!0,w=document.createElement("div"),p=[];new MutationObserver(function(){var i=p.slice();p.length=0,i.forEach(function(B){B()})}).observe(w,{attributes:!0});var C=t.setImmediate;t.setImmediate=function(i){Date.now()-m>15?(m=Date.now(),C(i)):(p.push(i),p.length===1&&w.setAttribute("a",_=!_))}}t.nextTick=t.setImmediate})(),t.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,t.globalScope=(function(){return t.isNodejs?bt:typeof self>"u"?window:self})(),t.isArray=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},t.isArrayBuffer=function(n){return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer},t.isArrayBufferView=function(n){return n&&t.isArrayBuffer(n.buffer)&&n.byteLength!==void 0};function d(n){if(!(n===8||n===16||n===24||n===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+n)}t.ByteBuffer=x;function x(n){if(this.data="",this.read=0,typeof n=="string")this.data=n;else if(t.isArrayBuffer(n)||t.isArrayBufferView(n))if(typeof Buffer<"u"&&n instanceof Buffer)this.data=n.toString("binary");else{var p=new Uint8Array(n);try{this.data=String.fromCharCode.apply(null,p)}catch{for(var m=0;m<p.length;++m)this.putByte(p[m])}}else(n instanceof x||typeof n=="object"&&typeof n.data=="string"&&typeof n.read=="number")&&(this.data=n.data,this.read=n.read);this._constructedStringLength=0}t.ByteStringBuffer=x;var g=4096;t.ByteStringBuffer.prototype._optimizeConstructedString=function(n){this._constructedStringLength+=n,this._constructedStringLength>g&&(this.data.substr(0,1),this._constructedStringLength=0)},t.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},t.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},t.ByteStringBuffer.prototype.putByte=function(n){return this.putBytes(String.fromCharCode(n))},t.ByteStringBuffer.prototype.fillWithByte=function(n,p){n=String.fromCharCode(n);for(var m=this.data;p>0;)p&1&&(m+=n),p>>>=1,p>0&&(n+=n);return this.data=m,this._optimizeConstructedString(p),this},t.ByteStringBuffer.prototype.putBytes=function(n){return this.data+=n,this._optimizeConstructedString(n.length),this},t.ByteStringBuffer.prototype.putString=function(n){return this.putBytes(t.encodeUtf8(n))},t.ByteStringBuffer.prototype.putInt16=function(n){return this.putBytes(String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt24=function(n){return this.putBytes(String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt32=function(n){return this.putBytes(String.fromCharCode(n>>24&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255))},t.ByteStringBuffer.prototype.putInt16Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255))},t.ByteStringBuffer.prototype.putInt24Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n>>16&255))},t.ByteStringBuffer.prototype.putInt32Le=function(n){return this.putBytes(String.fromCharCode(n&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>24&255))},t.ByteStringBuffer.prototype.putInt=function(n,p){d(p);var m="";do p-=8,m+=String.fromCharCode(n>>p&255);while(p>0);return this.putBytes(m)},t.ByteStringBuffer.prototype.putSignedInt=function(n,p){return n<0&&(n+=2<<p-1),this.putInt(n,p)},t.ByteStringBuffer.prototype.putBuffer=function(n){return this.putBytes(n.getBytes())},t.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},t.ByteStringBuffer.prototype.getInt16=function(){var n=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,n},t.ByteStringBuffer.prototype.getInt24=function(){var n=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,n},t.ByteStringBuffer.prototype.getInt32=function(){var n=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,n},t.ByteStringBuffer.prototype.getInt16Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,n},t.ByteStringBuffer.prototype.getInt24Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,n},t.ByteStringBuffer.prototype.getInt32Le=function(){var n=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,n},t.ByteStringBuffer.prototype.getInt=function(n){d(n);var p=0;do p=(p<<8)+this.data.charCodeAt(this.read++),n-=8;while(n>0);return p},t.ByteStringBuffer.prototype.getSignedInt=function(n){var p=this.getInt(n),m=2<<n-2;return p>=m&&(p-=m<<1),p},t.ByteStringBuffer.prototype.getBytes=function(n){var p;return n?(n=Math.min(this.length(),n),p=this.data.slice(this.read,this.read+n),this.read+=n):n===0?p="":(p=this.read===0?this.data:this.data.slice(this.read),this.clear()),p},t.ByteStringBuffer.prototype.bytes=function(n){return typeof n>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+n)},t.ByteStringBuffer.prototype.at=function(n){return this.data.charCodeAt(this.read+n)},t.ByteStringBuffer.prototype.setAt=function(n,p){return this.data=this.data.substr(0,this.read+n)+String.fromCharCode(p)+this.data.substr(this.read+n+1),this},t.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},t.ByteStringBuffer.prototype.copy=function(){var n=t.createBuffer(this.data);return n.read=this.read,n},t.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},t.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},t.ByteStringBuffer.prototype.truncate=function(n){var p=Math.max(0,this.length()-n);return this.data=this.data.substr(this.read,p),this.read=0,this},t.ByteStringBuffer.prototype.toHex=function(){for(var n="",p=this.read;p<this.data.length;++p){var m=this.data.charCodeAt(p);m<16&&(n+="0"),n+=m.toString(16)}return n},t.ByteStringBuffer.prototype.toString=function(){return t.decodeUtf8(this.bytes())};function u(n,p){p=p||{},this.read=p.readOffset||0,this.growSize=p.growSize||1024;var m=t.isArrayBuffer(n),_=t.isArrayBufferView(n);if(m||_){m?this.data=new DataView(n):this.data=new DataView(n.buffer,n.byteOffset,n.byteLength),this.write="writeOffset"in p?p.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,n!=null&&this.putBytes(n),"writeOffset"in p&&(this.write=p.writeOffset)}t.DataBuffer=u,t.DataBuffer.prototype.length=function(){return this.write-this.read},t.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},t.DataBuffer.prototype.accommodate=function(n,p){if(this.length()>=n)return this;p=Math.max(p||this.growSize,n);var m=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),_=new Uint8Array(this.length()+p);return _.set(m),this.data=new DataView(_.buffer),this},t.DataBuffer.prototype.putByte=function(n){return this.accommodate(1),this.data.setUint8(this.write++,n),this},t.DataBuffer.prototype.fillWithByte=function(n,p){this.accommodate(p);for(var m=0;m<p;++m)this.data.setUint8(n);return this},t.DataBuffer.prototype.putBytes=function(n,p){if(t.isArrayBufferView(n)){var m=new Uint8Array(n.buffer,n.byteOffset,n.byteLength),_=m.byteLength-m.byteOffset;this.accommodate(_);var w=new Uint8Array(this.data.buffer,this.write);return w.set(m),this.write+=_,this}if(t.isArrayBuffer(n)){var m=new Uint8Array(n);this.accommodate(m.byteLength);var w=new Uint8Array(this.data.buffer);return w.set(m,this.write),this.write+=m.byteLength,this}if(n instanceof t.DataBuffer||typeof n=="object"&&typeof n.read=="number"&&typeof n.write=="number"&&t.isArrayBufferView(n.data)){var m=new Uint8Array(n.data.byteLength,n.read,n.length());this.accommodate(m.byteLength);var w=new Uint8Array(n.data.byteLength,this.write);return w.set(m),this.write+=m.byteLength,this}if(n instanceof t.ByteStringBuffer&&(n=n.data,p="binary"),p=p||"binary",typeof n=="string"){var C;if(p==="hex")return this.accommodate(Math.ceil(n.length/2)),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.hex.decode(n,C,this.write),this;if(p==="base64")return this.accommodate(Math.ceil(n.length/4)*3),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.base64.decode(n,C,this.write),this;if(p==="utf8"&&(n=t.encodeUtf8(n),p="binary"),p==="binary"||p==="raw")return this.accommodate(n.length),C=new Uint8Array(this.data.buffer,this.write),this.write+=t.binary.raw.decode(C),this;if(p==="utf16")return this.accommodate(n.length*2),C=new Uint16Array(this.data.buffer,this.write),this.write+=t.text.utf16.encode(C),this;throw new Error("Invalid encoding: "+p)}throw Error("Invalid parameter: "+n)},t.DataBuffer.prototype.putBuffer=function(n){return this.putBytes(n),n.clear(),this},t.DataBuffer.prototype.putString=function(n){return this.putBytes(n,"utf16")},t.DataBuffer.prototype.putInt16=function(n){return this.accommodate(2),this.data.setInt16(this.write,n),this.write+=2,this},t.DataBuffer.prototype.putInt24=function(n){return this.accommodate(3),this.data.setInt16(this.write,n>>8&65535),this.data.setInt8(this.write,n>>16&255),this.write+=3,this},t.DataBuffer.prototype.putInt32=function(n){return this.accommodate(4),this.data.setInt32(this.write,n),this.write+=4,this},t.DataBuffer.prototype.putInt16Le=function(n){return this.accommodate(2),this.data.setInt16(this.write,n,!0),this.write+=2,this},t.DataBuffer.prototype.putInt24Le=function(n){return this.accommodate(3),this.data.setInt8(this.write,n>>16&255),this.data.setInt16(this.write,n>>8&65535,!0),this.write+=3,this},t.DataBuffer.prototype.putInt32Le=function(n){return this.accommodate(4),this.data.setInt32(this.write,n,!0),this.write+=4,this},t.DataBuffer.prototype.putInt=function(n,p){d(p),this.accommodate(p/8);do p-=8,this.data.setInt8(this.write++,n>>p&255);while(p>0);return this},t.DataBuffer.prototype.putSignedInt=function(n,p){return d(p),this.accommodate(p/8),n<0&&(n+=2<<p-1),this.putInt(n,p)},t.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},t.DataBuffer.prototype.getInt16=function(){var n=this.data.getInt16(this.read);return this.read+=2,n},t.DataBuffer.prototype.getInt24=function(){var n=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,n},t.DataBuffer.prototype.getInt32=function(){var n=this.data.getInt32(this.read);return this.read+=4,n},t.DataBuffer.prototype.getInt16Le=function(){var n=this.data.getInt16(this.read,!0);return this.read+=2,n},t.DataBuffer.prototype.getInt24Le=function(){var n=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,n},t.DataBuffer.prototype.getInt32Le=function(){var n=this.data.getInt32(this.read,!0);return this.read+=4,n},t.DataBuffer.prototype.getInt=function(n){d(n);var p=0;do p=(p<<8)+this.data.getInt8(this.read++),n-=8;while(n>0);return p},t.DataBuffer.prototype.getSignedInt=function(n){var p=this.getInt(n),m=2<<n-2;return p>=m&&(p-=m<<1),p},t.DataBuffer.prototype.getBytes=function(n){var p;return n?(n=Math.min(this.length(),n),p=this.data.slice(this.read,this.read+n),this.read+=n):n===0?p="":(p=this.read===0?this.data:this.data.slice(this.read),this.clear()),p},t.DataBuffer.prototype.bytes=function(n){return typeof n>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+n)},t.DataBuffer.prototype.at=function(n){return this.data.getUint8(this.read+n)},t.DataBuffer.prototype.setAt=function(n,p){return this.data.setUint8(n,p),this},t.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},t.DataBuffer.prototype.copy=function(){return new t.DataBuffer(this)},t.DataBuffer.prototype.compact=function(){if(this.read>0){var n=new Uint8Array(this.data.buffer,this.read),p=new Uint8Array(n.byteLength);p.set(n),this.data=new DataView(p),this.write-=this.read,this.read=0}return this},t.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},t.DataBuffer.prototype.truncate=function(n){return this.write=Math.max(0,this.length()-n),this.read=Math.min(this.read,this.write),this},t.DataBuffer.prototype.toHex=function(){for(var n="",p=this.read;p<this.data.byteLength;++p){var m=this.data.getUint8(p);m<16&&(n+="0"),n+=m.toString(16)}return n},t.DataBuffer.prototype.toString=function(n){var p=new Uint8Array(this.data,this.read,this.length());if(n=n||"utf8",n==="binary"||n==="raw")return t.binary.raw.encode(p);if(n==="hex")return t.binary.hex.encode(p);if(n==="base64")return t.binary.base64.encode(p);if(n==="utf8")return t.text.utf8.decode(p);if(n==="utf16")return t.text.utf16.decode(p);throw new Error("Invalid encoding: "+n)},t.createBuffer=function(n,p){return p=p||"raw",n!==void 0&&p==="utf8"&&(n=t.encodeUtf8(n)),new t.ByteBuffer(n)},t.fillString=function(n,p){for(var m="";p>0;)p&1&&(m+=n),p>>>=1,p>0&&(n+=n);return m},t.xorBytes=function(n,p,m){for(var _="",w="",C="",o=0,i=0;m>0;--m,++o)w=n.charCodeAt(o)^p.charCodeAt(o),i>=10&&(_+=C,C="",i=0),C+=String.fromCharCode(w),++i;return _+=C,_},t.hexToBytes=function(n){var p="",m=0;for(n.length&!0&&(m=1,p+=String.fromCharCode(parseInt(n[0],16)));m<n.length;m+=2)p+=String.fromCharCode(parseInt(n.substr(m,2),16));return p},t.bytesToHex=function(n){return t.createBuffer(n).toHex()},t.int32ToBytes=function(n){return String.fromCharCode(n>>24&255)+String.fromCharCode(n>>16&255)+String.fromCharCode(n>>8&255)+String.fromCharCode(n&255)};var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";t.encode64=function(n,p){for(var m="",_="",w,C,o,i=0;i<n.length;)w=n.charCodeAt(i++),C=n.charCodeAt(i++),o=n.charCodeAt(i++),m+=r.charAt(w>>2),m+=r.charAt((w&3)<<4|C>>4),isNaN(C)?m+="==":(m+=r.charAt((C&15)<<2|o>>6),m+=isNaN(o)?"=":r.charAt(o&63)),p&&m.length>p&&(_+=m.substr(0,p)+`\r
|
|
4
|
+
`,m=m.substr(p));return _+=m,_},t.decode64=function(n){n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var p="",m,_,w,C,o=0;o<n.length;)m=c[n.charCodeAt(o++)-43],_=c[n.charCodeAt(o++)-43],w=c[n.charCodeAt(o++)-43],C=c[n.charCodeAt(o++)-43],p+=String.fromCharCode(m<<2|_>>4),w!==64&&(p+=String.fromCharCode((_&15)<<4|w>>2),C!==64&&(p+=String.fromCharCode((w&3)<<6|C)));return p},t.encodeUtf8=function(n){return unescape(encodeURIComponent(n))},t.decodeUtf8=function(n){return decodeURIComponent(escape(n))},t.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},t.binary.raw.encode=function(n){return String.fromCharCode.apply(null,n)},t.binary.raw.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(n.length)),m=m||0;for(var w=m,C=0;C<n.length;++C)_[w++]=n.charCodeAt(C);return p?w-m:_},t.binary.hex.encode=t.bytesToHex,t.binary.hex.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(Math.ceil(n.length/2))),m=m||0;var w=0,C=m;for(n.length&1&&(w=1,_[C++]=parseInt(n[0],16));w<n.length;w+=2)_[C++]=parseInt(n.substr(w,2),16);return p?C-m:_},t.binary.base64.encode=function(n,p){for(var m="",_="",w,C,o,i=0;i<n.byteLength;)w=n[i++],C=n[i++],o=n[i++],m+=r.charAt(w>>2),m+=r.charAt((w&3)<<4|C>>4),isNaN(C)?m+="==":(m+=r.charAt((C&15)<<2|o>>6),m+=isNaN(o)?"=":r.charAt(o&63)),p&&m.length>p&&(_+=m.substr(0,p)+`\r
|
|
5
|
+
`,m=m.substr(p));return _+=m,_},t.binary.base64.decode=function(n,p,m){var _=p;_||(_=new Uint8Array(Math.ceil(n.length/4)*3)),n=n.replace(/[^A-Za-z0-9\+\/\=]/g,""),m=m||0;for(var w,C,o,i,B=0,N=m;B<n.length;)w=c[n.charCodeAt(B++)-43],C=c[n.charCodeAt(B++)-43],o=c[n.charCodeAt(B++)-43],i=c[n.charCodeAt(B++)-43],_[N++]=w<<2|C>>4,o!==64&&(_[N++]=(C&15)<<4|o>>2,i!==64&&(_[N++]=(o&3)<<6|i));return p?N-m:_.subarray(0,N)},t.binary.base58.encode=function(n,p){return t.binary.baseN.encode(n,l,p)},t.binary.base58.decode=function(n,p){return t.binary.baseN.decode(n,l,p)},t.text={utf8:{},utf16:{}},t.text.utf8.encode=function(n,p,m){n=t.encodeUtf8(n);var _=p;_||(_=new Uint8Array(n.length)),m=m||0;for(var w=m,C=0;C<n.length;++C)_[w++]=n.charCodeAt(C);return p?w-m:_},t.text.utf8.decode=function(n){return t.decodeUtf8(String.fromCharCode.apply(null,n))},t.text.utf16.encode=function(n,p,m){var _=p;_||(_=new Uint8Array(n.length*2));var w=new Uint16Array(_.buffer);m=m||0;for(var C=m,o=m,i=0;i<n.length;++i)w[o++]=n.charCodeAt(i),C+=2;return p?C-m:_},t.text.utf16.decode=function(n){return String.fromCharCode.apply(null,new Uint16Array(n.buffer))},t.deflate=function(n,p,m){if(p=t.decode64(n.deflate(t.encode64(p)).rval),m){var _=2,w=p.charCodeAt(1);w&32&&(_=6),p=p.substring(_,p.length-4)}return p},t.inflate=function(n,p,m){var _=n.inflate(t.encode64(p)).rval;return _===null?null:t.decode64(_)};var b=function(n,p,m){if(!n)throw new Error("WebStorage not available.");var _;if(m===null?_=n.removeItem(p):(m=t.encode64(JSON.stringify(m)),_=n.setItem(p,m)),typeof _<"u"&&_.rval!==!0){var w=new Error(_.error.message);throw w.id=_.error.id,w.name=_.error.name,w}},T=function(n,p){if(!n)throw new Error("WebStorage not available.");var m=n.getItem(p);if(n.init)if(m.rval===null){if(m.error){var _=new Error(m.error.message);throw _.id=m.error.id,_.name=m.error.name,_}m=null}else m=m.rval;return m!==null&&(m=JSON.parse(t.decode64(m))),m},E=function(n,p,m,_){var w=T(n,p);w===null&&(w={}),w[m]=_,b(n,p,w)},s=function(n,p,m){var _=T(n,p);return _!==null&&(_=m in _?_[m]:null),_},v=function(n,p,m){var _=T(n,p);if(_!==null&&m in _){delete _[m];var w=!0;for(var C in _){w=!1;break}w&&(_=null),b(n,p,_)}},h=function(n,p){b(n,p,null)},y=function(n,p,m){var _=null;typeof m>"u"&&(m=["web","flash"]);var w,C=!1,o=null;for(var i in m){w=m[i];try{if(w==="flash"||w==="both"){if(p[0]===null)throw new Error("Flash local storage not available.");_=n.apply(this,p),C=w==="flash"}(w==="web"||w==="both")&&(p[0]=localStorage,_=n.apply(this,p),C=!0)}catch(B){o=B}if(C)break}if(!C)throw o;return _};return t.setItem=function(n,p,m,_,w){y(E,arguments,w)},t.getItem=function(n,p,m,_){return y(s,arguments,_)},t.removeItem=function(n,p,m,_){y(v,arguments,_)},t.clearItems=function(n,p,m){y(h,arguments,m)},t.isEmpty=function(n){for(var p in n)if(n.hasOwnProperty(p))return!1;return!0},t.format=function(n){for(var p=/%./g,m,_,w=0,C=[],o=0;m=p.exec(n);){_=n.substring(o,p.lastIndex-2),_.length>0&&C.push(_),o=p.lastIndex;var i=m[0][1];switch(i){case"s":case"o":w<arguments.length?C.push(arguments[w+++1]):C.push("<?>");break;case"%":C.push("%");break;default:C.push("<%"+i+"?>")}}return C.push(n.substring(o)),C.join("")},t.formatNumber=function(n,p,m,_){var w=n,C=isNaN(p=Math.abs(p))?2:p,o=m===void 0?",":m,i=_===void 0?".":_,B=w<0?"-":"",N=parseInt(w=Math.abs(+w||0).toFixed(C),10)+"",q=N.length>3?N.length%3:0;return B+(q?N.substr(0,q)+i:"")+N.substr(q).replace(/(\d{3})(?=\d)/g,"$1"+i)+(C?o+Math.abs(w-N).toFixed(C).slice(2):"")},t.formatSize=function(n){return n>=1073741824?n=t.formatNumber(n/1073741824,2,".","")+" GiB":n>=1048576?n=t.formatNumber(n/1048576,2,".","")+" MiB":n>=1024?n=t.formatNumber(n/1024,0)+" KiB":n=t.formatNumber(n,0)+" bytes",n},t.bytesFromIP=function(n){return n.indexOf(".")!==-1?t.bytesFromIPv4(n):n.indexOf(":")!==-1?t.bytesFromIPv6(n):null},t.bytesFromIPv4=function(n){if(n=n.split("."),n.length!==4)return null;for(var p=t.createBuffer(),m=0;m<n.length;++m){var _=parseInt(n[m],10);if(isNaN(_))return null;p.putByte(_)}return p.getBytes()},t.bytesFromIPv6=function(n){var p=0;n=n.split(":").filter(function(o){return o.length===0&&++p,!0});for(var m=(8-n.length+p)*2,_=t.createBuffer(),w=0;w<8;++w){if(!n[w]||n[w].length===0){_.fillWithByte(0,m),m=0;continue}var C=t.hexToBytes(n[w]);C.length<2&&_.putByte(0),_.putBytes(C)}return _.getBytes()},t.bytesToIP=function(n){return n.length===4?t.bytesToIPv4(n):n.length===16?t.bytesToIPv6(n):null},t.bytesToIPv4=function(n){if(n.length!==4)return null;for(var p=[],m=0;m<n.length;++m)p.push(n.charCodeAt(m));return p.join(".")},t.bytesToIPv6=function(n){if(n.length!==16)return null;for(var p=[],m=[],_=0,w=0;w<n.length;w+=2){for(var C=t.bytesToHex(n[w]+n[w+1]);C[0]==="0"&&C!=="0";)C=C.substr(1);if(C==="0"){var o=m[m.length-1],i=p.length;!o||i!==o.end+1?m.push({start:i,end:i}):(o.end=i,o.end-o.start>m[_].end-m[_].start&&(_=m.length-1))}p.push(C)}if(m.length>0){var B=m[_];B.end-B.start>0&&(p.splice(B.start,B.end-B.start+1,""),B.start===0&&p.unshift(""),B.end===7&&p.push(""))}return p.join(":")},t.estimateCores=function(n,p){if(typeof n=="function"&&(p=n,n={}),n=n||{},"cores"in t&&!n.update)return p(null,t.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return t.cores=navigator.hardwareConcurrency,p(null,t.cores);if(typeof Worker>"u")return t.cores=1,p(null,t.cores);if(typeof Blob>"u")return t.cores=2,p(null,t.cores);var m=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(o){var i=Date.now(),B=i+4;self.postMessage({st:i,et:B})})}).toString(),")()"],{type:"application/javascript"}));_([],5,16);function _(o,i,B){if(i===0){var N=Math.floor(o.reduce(function(q,I){return q+I},0)/o.length);return t.cores=Math.max(1,N),URL.revokeObjectURL(m),p(null,t.cores)}w(B,function(q,I){o.push(C(B,I)),_(o,i-1,B)})}function w(o,i){for(var B=[],N=[],q=0;q<o;++q){var I=new Worker(m);I.addEventListener("message",function(F){if(N.push(F.data),N.length===o){for(var A=0;A<o;++A)B[A].terminate();i(null,N)}}),B.push(I)}for(var q=0;q<o;++q)B[q].postMessage(q)}function C(o,i){for(var B=[],N=0;N<o;++N)for(var q=i[N],I=B[N]=[],F=0;F<o;++F)if(N!==F){var A=i[F];(q.st>A.st&&q.st<A.et||A.st>q.st&&A.st<q.et)&&I.push(F)}return B.reduce(function(H,j){return Math.max(H,j.length)},0)}},fr.exports}var hr,Ca;function dr(){if(Ca)return hr;Ca=1;var a=me();Ee(),hr=a.cipher=a.cipher||{},a.cipher.algorithms=a.cipher.algorithms||{},a.cipher.createCipher=function(t,d){var x=t;if(typeof x=="string"&&(x=a.cipher.getAlgorithm(x),x&&(x=x())),!x)throw new Error("Unsupported algorithm: "+t);return new a.cipher.BlockCipher({algorithm:x,key:d,decrypt:!1})},a.cipher.createDecipher=function(t,d){var x=t;if(typeof x=="string"&&(x=a.cipher.getAlgorithm(x),x&&(x=x())),!x)throw new Error("Unsupported algorithm: "+t);return new a.cipher.BlockCipher({algorithm:x,key:d,decrypt:!0})},a.cipher.registerAlgorithm=function(t,d){t=t.toUpperCase(),a.cipher.algorithms[t]=d},a.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in a.cipher.algorithms?a.cipher.algorithms[t]:null};var e=a.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};return e.prototype.start=function(t){t=t||{};var d={};for(var x in t)d[x]=t[x];d.decrypt=this._decrypt,this._finish=!1,this._input=a.util.createBuffer(),this.output=t.output||a.util.createBuffer(),this.mode.start(d)},e.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(x){return t(this.blockSize,x,!1)},this.mode.unpad=function(x){return t(this.blockSize,x,!0)});var d={};return d.decrypt=this._decrypt,d.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,d)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,d))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,d))},hr}var pr={exports:{}},xa;function Ea(){if(xa)return pr.exports;xa=1;var a=me();Ee(),a.cipher=a.cipher||{};var e=pr.exports=a.cipher.modes=a.cipher.modes||{};e.ecb=function(g){g=g||{},this.name="ECB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(g){},e.ecb.prototype.encrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c])},e.ecb.prototype.decrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c])},e.ecb.prototype.pad=function(g,u){var r=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(r,r),!0},e.ecb.prototype.unpad=function(g,u){if(u.overflow>0)return!1;var r=g.length(),c=g.at(r-1);return c>this.blockSize<<2?!1:(g.truncate(c),!0)},e.cbc=function(g){g=g||{},this.name="CBC",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(g){if(g.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in g)this._iv=t(g.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^g.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._outBlock[c]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(g,u,r){if(g.length()<this.blockSize&&!(r&&g.length()>0))return!0;for(var c=0;c<this._ints;++c)this._inBlock[c]=g.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var c=0;c<this._ints;++c)u.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(g,u){var r=g.length()===this.blockSize?this.blockSize:this.blockSize-g.length();return g.fillWithByte(r,r),!0},e.cbc.prototype.unpad=function(g,u){if(u.overflow>0)return!1;var r=g.length(),c=g.at(r-1);return c>this.blockSize<<2?!1:(g.truncate(c),!0)},e.cfb=function(g){g=g||{},this.name="CFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=g.getInt32()^this._outBlock[l],u.putInt32(this._inBlock[l]);return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=g.getInt32()^this._outBlock[l],this._partialOutput.putInt32(this._partialBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=g.getInt32(),u.putInt32(this._inBlock[l]^this._outBlock[l]);return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=g.getInt32(),this._partialOutput.putInt32(this._partialBlock[l]^this._outBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.ofb=function(g){g=g||{},this.name="OFB",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(g,u,r){var c=g.length();if(g.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)u.putInt32(g.getInt32()^this._outBlock[l]),this._inBlock[l]=this._outBlock[l];return}var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b>0)g.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._outBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(g){g=g||{},this.name="CTR",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");this._iv=t(g.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize)for(var l=0;l<this._ints;++l)u.putInt32(g.getInt32()^this._outBlock[l]);else{var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b>0&&(g.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}d(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(g){g=g||{},this.name="GCM",this.cipher=g.cipher,this.blockSize=g.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(g){if(!("iv"in g))throw new Error("Invalid IV parameter.");var u=a.util.createBuffer(g.iv);this._cipherLength=0;var r;if("additionalData"in g?r=a.util.createBuffer(g.additionalData):r=a.util.createBuffer(),"tagLength"in g?this._tagLength=g.tagLength:this._tagLength=128,this._tag=null,g.decrypt&&(this._tag=a.util.createBuffer(g.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var c=u.length();if(c===12)this._j0=[u.getInt32(),u.getInt32(),u.getInt32(),1];else{for(this._j0=[0,0,0,0];u.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[u.getInt32(),u.getInt32(),u.getInt32(),u.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(x(c*8)))}this._inBlock=this._j0.slice(0),d(this._inBlock),this._partialBytes=0,r=a.util.createBuffer(r),this._aDataLength=x(r.length()*8);var l=r.length()%this.blockSize;for(l&&r.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])},e.gcm.prototype.encrypt=function(g,u,r){var c=g.length();if(c===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&c>=this.blockSize){for(var l=0;l<this._ints;++l)u.putInt32(this._outBlock[l]^=g.getInt32());this._cipherLength+=this.blockSize}else{var b=(this.blockSize-c)%this.blockSize;b>0&&(b=this.blockSize-b),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(g.getInt32()^this._outBlock[l]);if(b<=0||r){if(r){var T=c%this.blockSize;this._cipherLength+=T,this._partialOutput.truncate(this.blockSize-T)}else this._cipherLength+=this.blockSize;for(var l=0;l<this._ints;++l)this._outBlock[l]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),b>0&&!r)return g.read-=this.blockSize,u.putBytes(this._partialOutput.getBytes(b-this._partialBytes)),this._partialBytes=b,!0;u.putBytes(this._partialOutput.getBytes(c-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),d(this._inBlock)},e.gcm.prototype.decrypt=function(g,u,r){var c=g.length();if(c<this.blockSize&&!(r&&c>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),d(this._inBlock),this._hashBlock[0]=g.getInt32(),this._hashBlock[1]=g.getInt32(),this._hashBlock[2]=g.getInt32(),this._hashBlock[3]=g.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var l=0;l<this._ints;++l)u.putInt32(this._outBlock[l]^this._hashBlock[l]);c<this.blockSize?this._cipherLength+=c%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(g,u){var r=!0;u.decrypt&&u.overflow&&g.truncate(this.blockSize-u.overflow),this.tag=a.util.createBuffer();var c=this._aDataLength.concat(x(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,c);var l=[];this.cipher.encrypt(this._j0,l);for(var b=0;b<this._ints;++b)this.tag.putInt32(this._s[b]^l[b]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),u.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},e.gcm.prototype.multiply=function(g,u){for(var r=[0,0,0,0],c=u.slice(0),l=0;l<128;++l){var b=g[l/32|0]&1<<31-l%32;b&&(r[0]^=c[0],r[1]^=c[1],r[2]^=c[2],r[3]^=c[3]),this.pow(c,c)}return r},e.gcm.prototype.pow=function(g,u){for(var r=g[3]&1,c=3;c>0;--c)u[c]=g[c]>>>1|(g[c-1]&1)<<31;u[0]=g[0]>>>1,r&&(u[0]^=this._R)},e.gcm.prototype.tableMultiply=function(g){for(var u=[0,0,0,0],r=0;r<32;++r){var c=r/8|0,l=g[c]>>>(7-r%8)*4&15,b=this._m[r][l];u[0]^=b[0],u[1]^=b[1],u[2]^=b[2],u[3]^=b[3]}return u},e.gcm.prototype.ghash=function(g,u,r){return u[0]^=r[0],u[1]^=r[1],u[2]^=r[2],u[3]^=r[3],this.tableMultiply(u)},e.gcm.prototype.generateHashTable=function(g,u){for(var r=8/u,c=4*r,l=16*r,b=new Array(l),T=0;T<l;++T){var E=[0,0,0,0],s=T/c|0,v=(c-1-T%c)*u;E[s]=1<<u-1<<v,b[T]=this.generateSubHashTable(this.multiply(E,g),u)}return b},e.gcm.prototype.generateSubHashTable=function(g,u){var r=1<<u,c=r>>>1,l=new Array(r);l[c]=g.slice(0);for(var b=c>>>1;b>0;)this.pow(l[2*b],l[b]=[]),b>>=1;for(b=2;b<c;){for(var T=1;T<b;++T){var E=l[b],s=l[T];l[b+T]=[E[0]^s[0],E[1]^s[1],E[2]^s[2],E[3]^s[3]]}b*=2}for(l[0]=[0,0,0,0],b=c+1;b<r;++b){var v=l[b^c];l[b]=[g[0]^v[0],g[1]^v[1],g[2]^v[2],g[3]^v[3]]}return l};function t(g,u){if(typeof g=="string"&&(g=a.util.createBuffer(g)),a.util.isArray(g)&&g.length>4){var r=g;g=a.util.createBuffer();for(var c=0;c<r.length;++c)g.putByte(r[c])}if(g.length()<u)throw new Error("Invalid IV length; got "+g.length()+" bytes and expected "+u+" bytes.");if(!a.util.isArray(g)){for(var l=[],b=u/4,c=0;c<b;++c)l.push(g.getInt32());g=l}return g}function d(g){g[g.length-1]=g[g.length-1]+1&4294967295}function x(g){return[g/4294967296|0,g&4294967295]}return pr.exports}var gr,Sa;function yt(){if(Sa)return gr;Sa=1;var a=me();dr(),Ea(),Ee(),gr=a.aes=a.aes||{},a.aes.startEncrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!1,mode:y});return n.start(v),n},a.aes.createEncryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!1,mode:v})},a.aes.startDecrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!0,mode:y});return n.start(v),n},a.aes.createDecryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!0,mode:v})},a.aes.Algorithm=function(s,v){t||l();var h=this;h.name=s,h.mode=new v({blockSize:16,cipher:{encrypt:function(y,n){return T(h._w,y,n,!1)},decrypt:function(y,n){return T(h._w,y,n,!0)}}}),h._init=!1},a.aes.Algorithm.prototype.initialize=function(s){if(!this._init){var v=s.key,h;if(typeof v=="string"&&(v.length===16||v.length===24||v.length===32))v=a.util.createBuffer(v);else if(a.util.isArray(v)&&(v.length===16||v.length===24||v.length===32)){h=v,v=a.util.createBuffer();for(var y=0;y<h.length;++y)v.putByte(h[y])}if(!a.util.isArray(v)){h=v,v=[];var n=h.length();if(n===16||n===24||n===32){n=n>>>2;for(var y=0;y<n;++y)v.push(h.getInt32())}}if(!a.util.isArray(v)||!(v.length===4||v.length===6||v.length===8))throw new Error("Invalid key parameter.");var p=this.mode.name,m=["CFB","OFB","CTR","GCM"].indexOf(p)!==-1;this._w=b(v,s.decrypt&&!m),this._init=!0}},a.aes._expandKey=function(s,v){return t||l(),b(s,v)},a.aes._updateBlock=T,e("AES-ECB",a.cipher.modes.ecb),e("AES-CBC",a.cipher.modes.cbc),e("AES-CFB",a.cipher.modes.cfb),e("AES-OFB",a.cipher.modes.ofb),e("AES-CTR",a.cipher.modes.ctr),e("AES-GCM",a.cipher.modes.gcm);function e(s,v){var h=function(){return new a.aes.Algorithm(s,v)};a.cipher.registerAlgorithm(s,h)}var t=!1,d=4,x,g,u,r,c;function l(){t=!0,u=[0,1,2,4,8,16,32,64,128,27,54];for(var s=new Array(256),v=0;v<128;++v)s[v]=v<<1,s[v+128]=v+128<<1^283;x=new Array(256),g=new Array(256),r=new Array(4),c=new Array(4);for(var v=0;v<4;++v)r[v]=new Array(256),c[v]=new Array(256);for(var h=0,y=0,n,p,m,_,w,C,o,v=0;v<256;++v){_=y^y<<1^y<<2^y<<3^y<<4,_=_>>8^_&255^99,x[h]=_,g[_]=h,w=s[_],n=s[h],p=s[n],m=s[p],C=w<<24^_<<16^_<<8^(_^w),o=(n^p^m)<<24^(h^m)<<16^(h^p^m)<<8^(h^n^m);for(var i=0;i<4;++i)r[i][h]=C,c[i][_]=o,C=C<<24|C>>>8,o=o<<24|o>>>8;h===0?h=y=1:(h=n^s[s[s[n^m]]],y^=s[s[y]])}}function b(s,v){for(var h=s.slice(0),y,n=1,p=h.length,m=p+6+1,_=d*m,w=p;w<_;++w)y=h[w-1],w%p===0?(y=x[y>>>16&255]<<24^x[y>>>8&255]<<16^x[y&255]<<8^x[y>>>24]^u[n]<<24,n++):p>6&&w%p===4&&(y=x[y>>>24]<<24^x[y>>>16&255]<<16^x[y>>>8&255]<<8^x[y&255]),h[w]=h[w-p]^y;if(v){var C,o=c[0],i=c[1],B=c[2],N=c[3],q=h.slice(0);_=h.length;for(var w=0,I=_-d;w<_;w+=d,I-=d)if(w===0||w===_-d)q[w]=h[I],q[w+1]=h[I+3],q[w+2]=h[I+2],q[w+3]=h[I+1];else for(var F=0;F<d;++F)C=h[I+F],q[w+(3&-F)]=o[x[C>>>24]]^i[x[C>>>16&255]]^B[x[C>>>8&255]]^N[x[C&255]];h=q}return h}function T(s,v,h,y){var n=s.length/4-1,p,m,_,w,C;y?(p=c[0],m=c[1],_=c[2],w=c[3],C=g):(p=r[0],m=r[1],_=r[2],w=r[3],C=x);var o,i,B,N,q,I,F;o=v[0]^s[0],i=v[y?3:1]^s[1],B=v[2]^s[2],N=v[y?1:3]^s[3];for(var A=3,H=1;H<n;++H)q=p[o>>>24]^m[i>>>16&255]^_[B>>>8&255]^w[N&255]^s[++A],I=p[i>>>24]^m[B>>>16&255]^_[N>>>8&255]^w[o&255]^s[++A],F=p[B>>>24]^m[N>>>16&255]^_[o>>>8&255]^w[i&255]^s[++A],N=p[N>>>24]^m[o>>>16&255]^_[i>>>8&255]^w[B&255]^s[++A],o=q,i=I,B=F;h[0]=C[o>>>24]<<24^C[i>>>16&255]<<16^C[B>>>8&255]<<8^C[N&255]^s[++A],h[y?3:1]=C[i>>>24]<<24^C[B>>>16&255]<<16^C[N>>>8&255]<<8^C[o&255]^s[++A],h[2]=C[B>>>24]<<24^C[N>>>16&255]<<16^C[o>>>8&255]<<8^C[i&255]^s[++A],h[y?1:3]=C[N>>>24]<<24^C[o>>>16&255]<<16^C[i>>>8&255]<<8^C[B&255]^s[++A]}function E(s){s=s||{};var v=(s.mode||"CBC").toUpperCase(),h="AES-"+v,y;s.decrypt?y=a.cipher.createDecipher(h,s.key):y=a.cipher.createCipher(h,s.key);var n=y.start;return y.start=function(p,m){var _=null;m instanceof a.util.ByteBuffer&&(_=m,m={}),m=m||{},m.output=_,m.iv=p,n.call(y,m)},y}return gr}var vr={exports:{}},yr={exports:{}},mr={exports:{}},ba;function mt(){if(ba)return mr.exports;ba=1;var a=me();a.pki=a.pki||{};var e=mr.exports=a.pki.oids=a.oids=a.oids||{};function t(x,g){e[x]=g,e[g]=x}function d(x,g){e[x]=g}return t("1.2.840.113549.1.1.1","rsaEncryption"),t("1.2.840.113549.1.1.4","md5WithRSAEncryption"),t("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),t("1.2.840.113549.1.1.7","RSAES-OAEP"),t("1.2.840.113549.1.1.8","mgf1"),t("1.2.840.113549.1.1.9","pSpecified"),t("1.2.840.113549.1.1.10","RSASSA-PSS"),t("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),t("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),t("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),t("1.3.101.112","EdDSA25519"),t("1.2.840.10040.4.3","dsa-with-sha1"),t("1.3.14.3.2.7","desCBC"),t("1.3.14.3.2.26","sha1"),t("1.3.14.3.2.29","sha1WithRSASignature"),t("2.16.840.1.101.3.4.2.1","sha256"),t("2.16.840.1.101.3.4.2.2","sha384"),t("2.16.840.1.101.3.4.2.3","sha512"),t("2.16.840.1.101.3.4.2.4","sha224"),t("2.16.840.1.101.3.4.2.5","sha512-224"),t("2.16.840.1.101.3.4.2.6","sha512-256"),t("1.2.840.113549.2.2","md2"),t("1.2.840.113549.2.5","md5"),t("1.2.840.113549.1.7.1","data"),t("1.2.840.113549.1.7.2","signedData"),t("1.2.840.113549.1.7.3","envelopedData"),t("1.2.840.113549.1.7.4","signedAndEnvelopedData"),t("1.2.840.113549.1.7.5","digestedData"),t("1.2.840.113549.1.7.6","encryptedData"),t("1.2.840.113549.1.9.1","emailAddress"),t("1.2.840.113549.1.9.2","unstructuredName"),t("1.2.840.113549.1.9.3","contentType"),t("1.2.840.113549.1.9.4","messageDigest"),t("1.2.840.113549.1.9.5","signingTime"),t("1.2.840.113549.1.9.6","counterSignature"),t("1.2.840.113549.1.9.7","challengePassword"),t("1.2.840.113549.1.9.8","unstructuredAddress"),t("1.2.840.113549.1.9.14","extensionRequest"),t("1.2.840.113549.1.9.20","friendlyName"),t("1.2.840.113549.1.9.21","localKeyId"),t("1.2.840.113549.1.9.22.1","x509Certificate"),t("1.2.840.113549.1.12.10.1.1","keyBag"),t("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),t("1.2.840.113549.1.12.10.1.3","certBag"),t("1.2.840.113549.1.12.10.1.4","crlBag"),t("1.2.840.113549.1.12.10.1.5","secretBag"),t("1.2.840.113549.1.12.10.1.6","safeContentsBag"),t("1.2.840.113549.1.5.13","pkcs5PBES2"),t("1.2.840.113549.1.5.12","pkcs5PBKDF2"),t("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),t("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),t("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),t("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),t("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),t("1.2.840.113549.2.7","hmacWithSHA1"),t("1.2.840.113549.2.8","hmacWithSHA224"),t("1.2.840.113549.2.9","hmacWithSHA256"),t("1.2.840.113549.2.10","hmacWithSHA384"),t("1.2.840.113549.2.11","hmacWithSHA512"),t("1.2.840.113549.3.7","des-EDE3-CBC"),t("2.16.840.1.101.3.4.1.2","aes128-CBC"),t("2.16.840.1.101.3.4.1.22","aes192-CBC"),t("2.16.840.1.101.3.4.1.42","aes256-CBC"),t("2.5.4.3","commonName"),t("2.5.4.4","surname"),t("2.5.4.5","serialNumber"),t("2.5.4.6","countryName"),t("2.5.4.7","localityName"),t("2.5.4.8","stateOrProvinceName"),t("2.5.4.9","streetAddress"),t("2.5.4.10","organizationName"),t("2.5.4.11","organizationalUnitName"),t("2.5.4.12","title"),t("2.5.4.13","description"),t("2.5.4.15","businessCategory"),t("2.5.4.17","postalCode"),t("2.5.4.42","givenName"),t("2.5.4.65","pseudonym"),t("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),t("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),t("2.16.840.1.113730.1.1","nsCertType"),t("2.16.840.1.113730.1.13","nsComment"),d("2.5.29.1","authorityKeyIdentifier"),d("2.5.29.2","keyAttributes"),d("2.5.29.3","certificatePolicies"),d("2.5.29.4","keyUsageRestriction"),d("2.5.29.5","policyMapping"),d("2.5.29.6","subtreesConstraint"),d("2.5.29.7","subjectAltName"),d("2.5.29.8","issuerAltName"),d("2.5.29.9","subjectDirectoryAttributes"),d("2.5.29.10","basicConstraints"),d("2.5.29.11","nameConstraints"),d("2.5.29.12","policyConstraints"),d("2.5.29.13","basicConstraints"),t("2.5.29.14","subjectKeyIdentifier"),t("2.5.29.15","keyUsage"),d("2.5.29.16","privateKeyUsagePeriod"),t("2.5.29.17","subjectAltName"),t("2.5.29.18","issuerAltName"),t("2.5.29.19","basicConstraints"),d("2.5.29.20","cRLNumber"),d("2.5.29.21","cRLReason"),d("2.5.29.22","expirationDate"),d("2.5.29.23","instructionCode"),d("2.5.29.24","invalidityDate"),d("2.5.29.25","cRLDistributionPoints"),d("2.5.29.26","issuingDistributionPoint"),d("2.5.29.27","deltaCRLIndicator"),d("2.5.29.28","issuingDistributionPoint"),d("2.5.29.29","certificateIssuer"),d("2.5.29.30","nameConstraints"),t("2.5.29.31","cRLDistributionPoints"),t("2.5.29.32","certificatePolicies"),d("2.5.29.33","policyMappings"),d("2.5.29.34","policyConstraints"),t("2.5.29.35","authorityKeyIdentifier"),d("2.5.29.36","policyConstraints"),t("2.5.29.37","extKeyUsage"),d("2.5.29.46","freshestCRL"),d("2.5.29.54","inhibitAnyPolicy"),t("1.3.6.1.4.1.11129.2.4.2","timestampList"),t("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),t("1.3.6.1.5.5.7.3.1","serverAuth"),t("1.3.6.1.5.5.7.3.2","clientAuth"),t("1.3.6.1.5.5.7.3.3","codeSigning"),t("1.3.6.1.5.5.7.3.4","emailProtection"),t("1.3.6.1.5.5.7.3.8","timeStamping"),mr.exports}var _a;function ft(){if(_a)return yr.exports;_a=1;var a=me();Ee(),mt();var e=yr.exports=a.asn1=a.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(u,r,c,l,b){if(a.util.isArray(l)){for(var T=[],E=0;E<l.length;++E)l[E]!==void 0&&T.push(l[E]);l=T}var s={tagClass:u,type:r,constructed:c,composed:c||a.util.isArray(l),value:l};return b&&"bitStringContents"in b&&(s.bitStringContents=b.bitStringContents,s.original=e.copy(s)),s},e.copy=function(u,r){var c;if(a.util.isArray(u)){c=[];for(var l=0;l<u.length;++l)c.push(e.copy(u[l],r));return c}return typeof u=="string"?u:(c={tagClass:u.tagClass,type:u.type,constructed:u.constructed,composed:u.composed,value:e.copy(u.value,r)},r&&!r.excludeBitStringContents&&(c.bitStringContents=u.bitStringContents),c)},e.equals=function(u,r,c){if(a.util.isArray(u)){if(!a.util.isArray(r)||u.length!==r.length)return!1;for(var l=0;l<u.length;++l)if(!e.equals(u[l],r[l]))return!1;return!0}if(typeof u!=typeof r)return!1;if(typeof u=="string")return u===r;var b=u.tagClass===r.tagClass&&u.type===r.type&&u.constructed===r.constructed&&u.composed===r.composed&&e.equals(u.value,r.value);return c&&c.includeBitStringContents&&(b=b&&u.bitStringContents===r.bitStringContents),b},e.getBerValueLength=function(u){var r=u.getByte();if(r!==128){var c,l=r&128;return l?c=u.getInt((r&127)<<3):c=r,c}};function t(u,r,c){if(c>r){var l=new Error("Too few bytes to parse DER.");throw l.available=u.length(),l.remaining=r,l.requested=c,l}}var d=function(u,r){var c=u.getByte();if(r--,c!==128){var l,b=c&128;if(!b)l=c;else{var T=c&127;t(u,r,T),l=u.getInt(T<<3)}if(l<0)throw new Error("Negative length: "+l);return l}};e.fromDer=function(u,r){r===void 0&&(r={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof r=="boolean"&&(r={strict:r,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"parseAllBytes"in r||(r.parseAllBytes=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"maxDepth"in r||(r.maxDepth=e.maxDepth),typeof u=="string"&&(u=a.util.createBuffer(u));var c=u.length(),l=x(u,u.length(),0,r);if(r.parseAllBytes&&u.length()!==0){var b=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw b.byteCount=c,b.remaining=u.length(),b}return l};function x(u,r,c,l){if(c>=l.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var b;t(u,r,2);var T=u.getByte();r--;var E=T&192,s=T&31;b=u.length();var v=d(u,r);if(r-=b-u.length(),v!==void 0&&v>r){if(l.strict){var h=new Error("Too few bytes to read ASN.1 value.");throw h.available=u.length(),h.remaining=r,h.requested=v,h}v=r}var y,n,p=(T&32)===32;if(p)if(y=[],v===void 0)for(;;){if(t(u,r,2),u.bytes(2)==="\0\0"){u.getBytes(2),r-=2;break}b=u.length(),y.push(x(u,r,c+1,l)),r-=b-u.length()}else for(;v>0;)b=u.length(),y.push(x(u,v,c+1,l)),r-=b-u.length(),v-=b-u.length();if(y===void 0&&E===e.Class.UNIVERSAL&&s===e.Type.BITSTRING&&(n=u.bytes(v)),y===void 0&&l.decodeBitStrings&&E===e.Class.UNIVERSAL&&s===e.Type.BITSTRING&&v>1){var m=u.read,_=r,w=0;if(s===e.Type.BITSTRING&&(t(u,r,1),w=u.getByte(),r--),w===0)try{b=u.length();var C={strict:!0,decodeBitStrings:!0},o=x(u,r,c+1,C),i=b-u.length();r-=i,s==e.Type.BITSTRING&&i++;var B=o.tagClass;i===v&&(B===e.Class.UNIVERSAL||B===e.Class.CONTEXT_SPECIFIC)&&(y=[o])}catch{}y===void 0&&(u.read=m,r=_)}if(y===void 0){if(v===void 0){if(l.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");v=r}if(s===e.Type.BMPSTRING)for(y="";v>0;v-=2)t(u,r,2),y+=String.fromCharCode(u.getInt16()),r-=2;else y=u.getBytes(v),r-=v}var N=n===void 0?null:{bitStringContents:n};return e.create(E,s,p,y,N)}e.toDer=function(u){var r=a.util.createBuffer(),c=u.tagClass|u.type,l=a.util.createBuffer(),b=!1;if("bitStringContents"in u&&(b=!0,u.original&&(b=e.equals(u,u.original))),b)l.putBytes(u.bitStringContents);else if(u.composed){u.constructed?c|=32:l.putByte(0);for(var T=0;T<u.value.length;++T)u.value[T]!==void 0&&l.putBuffer(e.toDer(u.value[T]))}else if(u.type===e.Type.BMPSTRING)for(var T=0;T<u.value.length;++T)l.putInt16(u.value.charCodeAt(T));else u.type===e.Type.INTEGER&&u.value.length>1&&(u.value.charCodeAt(0)===0&&(u.value.charCodeAt(1)&128)===0||u.value.charCodeAt(0)===255&&(u.value.charCodeAt(1)&128)===128)?l.putBytes(u.value.substr(1)):l.putBytes(u.value);if(r.putByte(c),l.length()<=127)r.putByte(l.length()&127);else{var E=l.length(),s="";do s+=String.fromCharCode(E&255),E=E>>>8;while(E>0);r.putByte(s.length|128);for(var T=s.length-1;T>=0;--T)r.putByte(s.charCodeAt(T))}return r.putBuffer(l),r},e.oidToDer=function(u){var r=u.split("."),c=a.util.createBuffer();c.putByte(40*parseInt(r[0],10)+parseInt(r[1],10));for(var l,b,T,E,s=2;s<r.length;++s){if(l=!0,b=[],T=parseInt(r[s],10),T>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=T&127,T=T>>>7,l||(E|=128),b.push(E),l=!1;while(T>0);for(var v=b.length-1;v>=0;--v)c.putByte(b[v])}return c},e.derToOid=function(u){var r;typeof u=="string"&&(u=a.util.createBuffer(u));var c=u.getByte();r=Math.floor(c/40)+"."+c%40;for(var l=0;u.length()>0;){if(l>70368744177663)throw new Error("OID value too large; max is 53-bits.");c=u.getByte(),l=l*128,c&128?l+=c&127:(r+="."+(l+c),l=0)}return r},e.utcTimeToDate=function(u){var r=new Date,c=parseInt(u.substr(0,2),10);c=c>=50?1900+c:2e3+c;var l=parseInt(u.substr(2,2),10)-1,b=parseInt(u.substr(4,2),10),T=parseInt(u.substr(6,2),10),E=parseInt(u.substr(8,2),10),s=0;if(u.length>11){var v=u.charAt(10),h=10;v!=="+"&&v!=="-"&&(s=parseInt(u.substr(10,2),10),h+=2)}if(r.setUTCFullYear(c,l,b),r.setUTCHours(T,E,s,0),h&&(v=u.charAt(h),v==="+"||v==="-")){var y=parseInt(u.substr(h+1,2),10),n=parseInt(u.substr(h+4,2),10),p=y*60+n;p*=6e4,v==="+"?r.setTime(+r-p):r.setTime(+r+p)}return r},e.generalizedTimeToDate=function(u){var r=new Date,c=parseInt(u.substr(0,4),10),l=parseInt(u.substr(4,2),10)-1,b=parseInt(u.substr(6,2),10),T=parseInt(u.substr(8,2),10),E=parseInt(u.substr(10,2),10),s=parseInt(u.substr(12,2),10),v=0,h=0,y=!1;u.charAt(u.length-1)==="Z"&&(y=!0);var n=u.length-5,p=u.charAt(n);if(p==="+"||p==="-"){var m=parseInt(u.substr(n+1,2),10),_=parseInt(u.substr(n+4,2),10);h=m*60+_,h*=6e4,p==="+"&&(h*=-1),y=!0}return u.charAt(14)==="."&&(v=parseFloat(u.substr(14),10)*1e3),y?(r.setUTCFullYear(c,l,b),r.setUTCHours(T,E,s,v),r.setTime(+r+h)):(r.setFullYear(c,l,b),r.setHours(T,E,s,v)),r},e.dateToUtcTime=function(u){if(typeof u=="string")return u;var r="",c=[];c.push((""+u.getUTCFullYear()).substr(2)),c.push(""+(u.getUTCMonth()+1)),c.push(""+u.getUTCDate()),c.push(""+u.getUTCHours()),c.push(""+u.getUTCMinutes()),c.push(""+u.getUTCSeconds());for(var l=0;l<c.length;++l)c[l].length<2&&(r+="0"),r+=c[l];return r+="Z",r},e.dateToGeneralizedTime=function(u){if(typeof u=="string")return u;var r="",c=[];c.push(""+u.getUTCFullYear()),c.push(""+(u.getUTCMonth()+1)),c.push(""+u.getUTCDate()),c.push(""+u.getUTCHours()),c.push(""+u.getUTCMinutes()),c.push(""+u.getUTCSeconds());for(var l=0;l<c.length;++l)c[l].length<2&&(r+="0"),r+=c[l];return r+="Z",r},e.integerToDer=function(u){var r=a.util.createBuffer();if(u>=-128&&u<128)return r.putSignedInt(u,8);if(u>=-32768&&u<32768)return r.putSignedInt(u,16);if(u>=-8388608&&u<8388608)return r.putSignedInt(u,24);if(u>=-2147483648&&u<2147483648)return r.putSignedInt(u,32);var c=new Error("Integer too large; max is 32-bits.");throw c.integer=u,c},e.derToInteger=function(u){typeof u=="string"&&(u=a.util.createBuffer(u));var r=u.length()*8;if(r>32)throw new Error("Integer too large; max is 32-bits.");return u.getSignedInt(r)},e.validate=function(u,r,c,l){var b=!1;if((u.tagClass===r.tagClass||typeof r.tagClass>"u")&&(u.type===r.type||typeof r.type>"u"))if(u.constructed===r.constructed||typeof r.constructed>"u"){if(b=!0,r.value&&a.util.isArray(r.value))for(var T=0,E=0;b&&E<r.value.length;++E){var s=r.value[E];b=!!s.optional;var v=u.value[T];if(!v){s.optional||(b=!1,l&&l.push("["+r.name+'] Missing required element. Expected tag class "'+s.tagClass+'", type "'+s.type+'"'));continue}var h=typeof s.tagClass<"u"&&typeof s.type<"u";if(h&&(v.tagClass!==s.tagClass||v.type!==s.type))if(s.optional){b=!0;continue}else{b=!1,l&&l.push("["+r.name+"] Tag mismatch. Expected ("+s.tagClass+","+s.type+"), got ("+v.tagClass+","+v.type+")");break}var y=e.validate(v,s,c,l);if(y)++T,b=!0;else if(s.optional)b=!0;else{b=!1;break}}if(b&&c&&(r.capture&&(c[r.capture]=u.value),r.captureAsn1&&(c[r.captureAsn1]=u),r.captureBitStringContents&&"bitStringContents"in u&&(c[r.captureBitStringContents]=u.bitStringContents),r.captureBitStringValue&&"bitStringContents"in u))if(u.bitStringContents.length<2)c[r.captureBitStringValue]="";else{var n=u.bitStringContents.charCodeAt(0);if(n!==0)throw new Error("captureBitStringValue only supported for zero unused bits");c[r.captureBitStringValue]=u.bitStringContents.slice(1)}}else l&&l.push("["+r.name+'] Expected constructed "'+r.constructed+'", got "'+u.constructed+'"');else l&&(u.tagClass!==r.tagClass&&l.push("["+r.name+'] Expected tag class "'+r.tagClass+'", got "'+u.tagClass+'"'),u.type!==r.type&&l.push("["+r.name+'] Expected type "'+r.type+'", got "'+u.type+'"'));return b};var g=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(u,r,c){var l="";r=r||0,c=c||2,r>0&&(l+=`
|
|
6
|
+
`);for(var b="",T=0;T<r*c;++T)b+=" ";switch(l+=b+"Tag: ",u.tagClass){case e.Class.UNIVERSAL:l+="Universal:";break;case e.Class.APPLICATION:l+="Application:";break;case e.Class.CONTEXT_SPECIFIC:l+="Context-Specific:";break;case e.Class.PRIVATE:l+="Private:";break}if(u.tagClass===e.Class.UNIVERSAL)switch(l+=u.type,u.type){case e.Type.NONE:l+=" (None)";break;case e.Type.BOOLEAN:l+=" (Boolean)";break;case e.Type.INTEGER:l+=" (Integer)";break;case e.Type.BITSTRING:l+=" (Bit string)";break;case e.Type.OCTETSTRING:l+=" (Octet string)";break;case e.Type.NULL:l+=" (Null)";break;case e.Type.OID:l+=" (Object Identifier)";break;case e.Type.ODESC:l+=" (Object Descriptor)";break;case e.Type.EXTERNAL:l+=" (External or Instance of)";break;case e.Type.REAL:l+=" (Real)";break;case e.Type.ENUMERATED:l+=" (Enumerated)";break;case e.Type.EMBEDDED:l+=" (Embedded PDV)";break;case e.Type.UTF8:l+=" (UTF8)";break;case e.Type.ROID:l+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:l+=" (Sequence)";break;case e.Type.SET:l+=" (Set)";break;case e.Type.PRINTABLESTRING:l+=" (Printable String)";break;case e.Type.IA5String:l+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:l+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:l+=" (Generalized time)";break;case e.Type.BMPSTRING:l+=" (BMP String)";break}else l+=u.type;if(l+=`
|
|
7
|
+
`,l+=b+"Constructed: "+u.constructed+`
|
|
8
|
+
`,u.composed){for(var E=0,s="",T=0;T<u.value.length;++T)u.value[T]!==void 0&&(E+=1,s+=e.prettyPrint(u.value[T],r+1,c),T+1<u.value.length&&(s+=","));l+=b+"Sub values: "+E+s}else{if(l+=b+"Value: ",u.type===e.Type.OID){var v=e.derToOid(u.value);l+=v,a.pki&&a.pki.oids&&v in a.pki.oids&&(l+=" ("+a.pki.oids[v]+") ")}if(u.type===e.Type.INTEGER)try{l+=e.derToInteger(u.value)}catch{l+="0x"+a.util.bytesToHex(u.value)}else if(u.type===e.Type.BITSTRING){if(u.value.length>1?l+="0x"+a.util.bytesToHex(u.value.slice(1)):l+="(none)",u.value.length>0){var h=u.value.charCodeAt(0);h==1?l+=" (1 unused bit shown)":h>1&&(l+=" ("+h+" unused bits shown)")}}else if(u.type===e.Type.OCTETSTRING)g.test(u.value)||(l+="("+u.value+") "),l+="0x"+a.util.bytesToHex(u.value);else if(u.type===e.Type.UTF8)try{l+=a.util.decodeUtf8(u.value)}catch(y){if(y.message==="URI malformed")l+="0x"+a.util.bytesToHex(u.value)+" (malformed UTF8)";else throw y}else u.type===e.Type.PRINTABLESTRING||u.type===e.Type.IA5String?l+=u.value:g.test(u.value)?l+="0x"+a.util.bytesToHex(u.value):u.value.length===0?l+="[null]":l+=u.value}return l},yr.exports}var Cr={exports:{}},xr,Ta;function ct(){if(Ta)return xr;Ta=1;var a=me();return xr=a.md=a.md||{},a.md.algorithms=a.md.algorithms||{},xr}var Aa;function Rt(){if(Aa)return Cr.exports;Aa=1;var a=me();ct(),Ee();var e=Cr.exports=a.hmac=a.hmac||{};return e.create=function(){var t=null,d=null,x=null,g=null,u={};return u.start=function(r,c){if(r!==null)if(typeof r=="string")if(r=r.toLowerCase(),r in a.md.algorithms)d=a.md.algorithms[r].create();else throw new Error('Unknown hash algorithm "'+r+'"');else d=r;if(c===null)c=t;else{if(typeof c=="string")c=a.util.createBuffer(c);else if(a.util.isArray(c)){var l=c;c=a.util.createBuffer();for(var b=0;b<l.length;++b)c.putByte(l[b])}var T=c.length();T>d.blockLength&&(d.start(),d.update(c.bytes()),c=d.digest()),x=a.util.createBuffer(),g=a.util.createBuffer(),T=c.length();for(var b=0;b<T;++b){var l=c.at(b);x.putByte(54^l),g.putByte(92^l)}if(T<d.blockLength)for(var l=d.blockLength-T,b=0;b<l;++b)x.putByte(54),g.putByte(92);t=c,x=x.bytes(),g=g.bytes()}d.start(),d.update(x)},u.update=function(r){d.update(r)},u.getMac=function(){var r=d.digest().bytes();return d.start(),d.update(g),d.update(r),d.digest()},u.digest=u.getMac,u},Cr.exports}var Er={exports:{}},Ia;function Sr(){if(Ia)return Er.exports;Ia=1;var a=me();ct(),Ee();var e=Er.exports=a.md5=a.md5||{};a.md.md5=a.md.algorithms.md5=e,e.create=function(){u||r();var l=null,b=a.util.createBuffer(),T=new Array(16),E={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var s=E.messageLengthSize/4,v=0;v<s;++v)E.fullMessageLength.push(0);return b=a.util.createBuffer(),l={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(s,v){v==="utf8"&&(s=a.util.encodeUtf8(s));var h=s.length;E.messageLength+=h,h=[h/4294967296>>>0,h>>>0];for(var y=E.fullMessageLength.length-1;y>=0;--y)E.fullMessageLength[y]+=h[1],h[1]=h[0]+(E.fullMessageLength[y]/4294967296>>>0),E.fullMessageLength[y]=E.fullMessageLength[y]>>>0,h[0]=h[1]/4294967296>>>0;return b.putBytes(s),c(l,T,b),(b.read>2048||b.length()===0)&&b.compact(),E},E.digest=function(){var s=a.util.createBuffer();s.putBytes(b.bytes());var v=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,h=v&E.blockLength-1;s.putBytes(t.substr(0,E.blockLength-h));for(var y,n=0,p=E.fullMessageLength.length-1;p>=0;--p)y=E.fullMessageLength[p]*8+n,n=y/4294967296>>>0,s.putInt32Le(y>>>0);var m={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3};c(m,T,s);var _=a.util.createBuffer();return _.putInt32Le(m.h0),_.putInt32Le(m.h1),_.putInt32Le(m.h2),_.putInt32Le(m.h3),_},E};var t=null,d=null,x=null,g=null,u=!1;function r(){t="",t+=a.util.fillString("\0",64),d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],x=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],g=new Array(64);for(var l=0;l<64;++l)g[l]=Math.floor(Math.abs(Math.sin(l+1))*4294967296);u=!0}function c(l,b,T){for(var E,s,v,h,y,n,p,m,_=T.length();_>=64;){for(s=l.h0,v=l.h1,h=l.h2,y=l.h3,m=0;m<16;++m)b[m]=T.getInt32Le(),n=y^v&(h^y),E=s+n+g[m]+b[m],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<32;++m)n=h^y&(v^h),E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<48;++m)n=v^h^y,E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;for(;m<64;++m)n=h^(v|~y),E=s+n+g[m]+b[d[m]],p=x[m],s=y,y=h,h=v,v+=E<<p|E>>>32-p;l.h0=l.h0+s|0,l.h1=l.h1+v|0,l.h2=l.h2+h|0,l.h3=l.h3+y|0,_-=64}}return Er.exports}var br={exports:{}},wa;function xt(){if(wa)return br.exports;wa=1;var a=me();Ee();var e=br.exports=a.pem=a.pem||{};e.encode=function(x,g){g=g||{};var u="-----BEGIN "+x.type+`-----\r
|
|
9
|
+
`,r;if(x.procType&&(r={name:"Proc-Type",values:[String(x.procType.version),x.procType.type]},u+=t(r)),x.contentDomain&&(r={name:"Content-Domain",values:[x.contentDomain]},u+=t(r)),x.dekInfo&&(r={name:"DEK-Info",values:[x.dekInfo.algorithm]},x.dekInfo.parameters&&r.values.push(x.dekInfo.parameters),u+=t(r)),x.headers)for(var c=0;c<x.headers.length;++c)u+=t(x.headers[c]);return x.procType&&(u+=`\r
|
|
10
|
+
`),u+=a.util.encode64(x.body,g.maxline||64)+`\r
|
|
11
|
+
`,u+="-----END "+x.type+`-----\r
|
|
12
|
+
`,u},e.decode=function(x){for(var g=[],u=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,c=/\r?\n/,l;l=u.exec(x),!!l;){var b=l[1];b==="NEW CERTIFICATE REQUEST"&&(b="CERTIFICATE REQUEST");var T={type:b,procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(l[3])};if(g.push(T),!!l[2]){for(var E=l[2].split(c),s=0;l&&s<E.length;){for(var v=E[s].replace(/\s+$/,""),h=s+1;h<E.length;++h){var y=E[h];if(!/\s/.test(y[0]))break;v+=y,s=h}if(l=v.match(r),l){for(var n={name:l[1],values:[]},p=l[2].split(","),m=0;m<p.length;++m)n.values.push(d(p[m]));if(T.procType)if(!T.contentDomain&&n.name==="Content-Domain")T.contentDomain=p[0]||"";else if(!T.dekInfo&&n.name==="DEK-Info"){if(n.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');T.dekInfo={algorithm:p[0],parameters:p[1]||null}}else T.headers.push(n);else{if(n.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(n.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');T.procType={version:p[0],type:p[1]}}}++s}if(T.procType==="ENCRYPTED"&&!T.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(g.length===0)throw new Error("Invalid PEM formatted message.");return g};function t(x){for(var g=x.name+": ",u=[],r=function(E,s){return" "+s},c=0;c<x.values.length;++c)u.push(x.values[c].replace(/^(\S+\r\n)/,r));g+=u.join(",")+`\r
|
|
13
|
+
`;for(var l=0,b=-1,c=0;c<g.length;++c,++l)if(l>65&&b!==-1){var T=g[b];T===","?(++b,g=g.substr(0,b)+`\r
|
|
14
|
+
`+g.substr(b)):g=g.substr(0,b)+`\r
|
|
15
|
+
`+T+g.substr(b+1),l=c-b-1,b=-1,++c}else(g[c]===" "||g[c]===" "||g[c]===",")&&(b=c);return g}function d(x){return x.replace(/^\s+/,"")}return br.exports}var _r={exports:{}},Tr,Ba;function qt(){if(Ba)return Tr;Ba=1;var a=me();dr(),Ea(),Ee(),Tr=a.des=a.des||{},a.des.startEncrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!1,mode:y||(v===null?"ECB":"CBC")});return n.start(v),n},a.des.createEncryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!1,mode:v})},a.des.startDecrypting=function(s,v,h,y){var n=E({key:s,output:h,decrypt:!0,mode:y||(v===null?"ECB":"CBC")});return n.start(v),n},a.des.createDecryptionCipher=function(s,v){return E({key:s,output:null,decrypt:!0,mode:v})},a.des.Algorithm=function(s,v){var h=this;h.name=s,h.mode=new v({blockSize:8,cipher:{encrypt:function(y,n){return T(h._keys,y,n,!1)},decrypt:function(y,n){return T(h._keys,y,n,!0)}}}),h._init=!1},a.des.Algorithm.prototype.initialize=function(s){if(!this._init){var v=a.util.createBuffer(s.key);if(this.name.indexOf("3DES")===0&&v.length()!==24)throw new Error("Invalid Triple-DES key size: "+v.length()*8);this._keys=b(v),this._init=!0}},e("DES-ECB",a.cipher.modes.ecb),e("DES-CBC",a.cipher.modes.cbc),e("DES-CFB",a.cipher.modes.cfb),e("DES-OFB",a.cipher.modes.ofb),e("DES-CTR",a.cipher.modes.ctr),e("3DES-ECB",a.cipher.modes.ecb),e("3DES-CBC",a.cipher.modes.cbc),e("3DES-CFB",a.cipher.modes.cfb),e("3DES-OFB",a.cipher.modes.ofb),e("3DES-CTR",a.cipher.modes.ctr);function e(s,v){var h=function(){return new a.des.Algorithm(s,v)};a.cipher.registerAlgorithm(s,h)}var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],d=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],x=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],r=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],c=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],l=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function b(s){for(var v=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],h=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],y=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],p=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],m=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],_=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],w=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],C=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],o=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],i=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],B=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],N=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],q=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],I=s.length()>8?3:1,F=[],A=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],H=0,j,W=0;W<I;W++){var re=s.getInt32(),J=s.getInt32();j=(re>>>4^J)&252645135,J^=j,re^=j<<4,j=(J>>>-16^re)&65535,re^=j,J^=j<<-16,j=(re>>>2^J)&858993459,J^=j,re^=j<<2,j=(J>>>-16^re)&65535,re^=j,J^=j<<-16,j=(re>>>1^J)&1431655765,J^=j,re^=j<<1,j=(J>>>8^re)&16711935,re^=j,J^=j<<8,j=(re>>>1^J)&1431655765,J^=j,re^=j<<1,j=re<<8|J>>>20&240,re=J<<24|J<<8&16711680|J>>>8&65280|J>>>24&240,J=j;for(var oe=0;oe<A.length;++oe){A[oe]?(re=re<<2|re>>>26,J=J<<2|J>>>26):(re=re<<1|re>>>27,J=J<<1|J>>>27),re&=-15,J&=-15;var Q=v[re>>>28]|h[re>>>24&15]|y[re>>>20&15]|n[re>>>16&15]|p[re>>>12&15]|m[re>>>8&15]|_[re>>>4&15],$=w[J>>>28]|C[J>>>24&15]|o[J>>>20&15]|i[J>>>16&15]|B[J>>>12&15]|N[J>>>8&15]|q[J>>>4&15];j=($>>>16^Q)&65535,F[H++]=Q^j,F[H++]=$^j<<16}}return F}function T(s,v,h,y){var n=s.length===32?3:9,p;n===3?p=y?[30,-2,-2]:[0,32,2]:p=y?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var m,_=v[0],w=v[1];m=(_>>>4^w)&252645135,w^=m,_^=m<<4,m=(_>>>16^w)&65535,w^=m,_^=m<<16,m=(w>>>2^_)&858993459,_^=m,w^=m<<2,m=(w>>>8^_)&16711935,_^=m,w^=m<<8,m=(_>>>1^w)&1431655765,w^=m,_^=m<<1,_=_<<1|_>>>31,w=w<<1|w>>>31;for(var C=0;C<n;C+=3){for(var o=p[C+1],i=p[C+2],B=p[C];B!=o;B+=i){var N=w^s[B],q=(w>>>4|w<<28)^s[B+1];m=_,_=w,w=m^(d[N>>>24&63]|g[N>>>16&63]|r[N>>>8&63]|l[N&63]|t[q>>>24&63]|x[q>>>16&63]|u[q>>>8&63]|c[q&63])}m=_,_=w,w=m}_=_>>>1|_<<31,w=w>>>1|w<<31,m=(_>>>1^w)&1431655765,w^=m,_^=m<<1,m=(w>>>8^_)&16711935,_^=m,w^=m<<8,m=(w>>>2^_)&858993459,_^=m,w^=m<<2,m=(_>>>16^w)&65535,w^=m,_^=m<<16,m=(_>>>4^w)&252645135,w^=m,_^=m<<4,h[0]=_,h[1]=w}function E(s){s=s||{};var v=(s.mode||"CBC").toUpperCase(),h="DES-"+v,y;s.decrypt?y=a.cipher.createDecipher(h,s.key):y=a.cipher.createCipher(h,s.key);var n=y.start;return y.start=function(p,m){var _=null;m instanceof a.util.ByteBuffer&&(_=m,m={}),m=m||{},m.output=_,m.iv=p,n.call(y,m)},y}return Tr}const Ar=Ln(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ir,ka;function wr(){if(ka)return Ir;ka=1;var a=me();Rt(),ct(),Ee();var e=a.pkcs5=a.pkcs5||{},t;return a.util.isNodejs&&!a.options.usePureJavaScript&&(t=Ar),Ir=a.pbkdf2=e.pbkdf2=function(d,x,g,u,r,c){if(typeof r=="function"&&(c=r,r=null),a.util.isNodejs&&!a.options.usePureJavaScript&&t.pbkdf2&&(r===null||typeof r!="object")&&(t.pbkdf2Sync.length>4||!r||r==="sha1"))return typeof r!="string"&&(r="sha1"),d=Buffer.from(d,"binary"),x=Buffer.from(x,"binary"),c?t.pbkdf2Sync.length===4?t.pbkdf2(d,x,g,u,function(C,o){if(C)return c(C);c(null,o.toString("binary"))}):t.pbkdf2(d,x,g,u,r,function(C,o){if(C)return c(C);c(null,o.toString("binary"))}):t.pbkdf2Sync.length===4?t.pbkdf2Sync(d,x,g,u).toString("binary"):t.pbkdf2Sync(d,x,g,u,r).toString("binary");if((typeof r>"u"||r===null)&&(r="sha1"),typeof r=="string"){if(!(r in a.md.algorithms))throw new Error("Unknown hash algorithm: "+r);r=a.md[r].create()}var l=r.digestLength;if(u>4294967295*l){var b=new Error("Derived key is too long.");if(c)return c(b);throw b}var T=Math.ceil(u/l),E=u-(T-1)*l,s=a.hmac.create();s.start(r,d);var v="",h,y,n;if(!c){for(var p=1;p<=T;++p){s.start(null,null),s.update(x),s.update(a.util.int32ToBytes(p)),h=n=s.digest().getBytes();for(var m=2;m<=g;++m)s.start(null,null),s.update(n),y=s.digest().getBytes(),h=a.util.xorBytes(h,y,l),n=y;v+=p<T?h:h.substr(0,E)}return v}var p=1,m;function _(){if(p>T)return c(null,v);s.start(null,null),s.update(x),s.update(a.util.int32ToBytes(p)),h=n=s.digest().getBytes(),m=2,w()}function w(){if(m<=g)return s.start(null,null),s.update(n),y=s.digest().getBytes(),h=a.util.xorBytes(h,y,l),n=y,++m,a.util.setImmediate(w);v+=p<T?h:h.substr(0,E),++p,_()}_()},Ir}var Ht={exports:{}},Br={exports:{}},Ra;function Na(){if(Ra)return Br.exports;Ra=1;var a=me();ct(),Ee();var e=Br.exports=a.sha256=a.sha256||{};a.md.sha256=a.md.algorithms.sha256=e,e.create=function(){d||g();var r=null,c=a.util.createBuffer(),l=new Array(64),b={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return b.start=function(){b.messageLength=0,b.fullMessageLength=b.messageLength64=[];for(var T=b.messageLengthSize/4,E=0;E<T;++E)b.fullMessageLength.push(0);return c=a.util.createBuffer(),r={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},b},b.start(),b.update=function(T,E){E==="utf8"&&(T=a.util.encodeUtf8(T));var s=T.length;b.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var v=b.fullMessageLength.length-1;v>=0;--v)b.fullMessageLength[v]+=s[1],s[1]=s[0]+(b.fullMessageLength[v]/4294967296>>>0),b.fullMessageLength[v]=b.fullMessageLength[v]>>>0,s[0]=s[1]/4294967296>>>0;return c.putBytes(T),u(r,l,c),(c.read>2048||c.length()===0)&&c.compact(),b},b.digest=function(){var T=a.util.createBuffer();T.putBytes(c.bytes());var E=b.fullMessageLength[b.fullMessageLength.length-1]+b.messageLengthSize,s=E&b.blockLength-1;T.putBytes(t.substr(0,b.blockLength-s));for(var v,h,y=b.fullMessageLength[0]*8,n=0;n<b.fullMessageLength.length-1;++n)v=b.fullMessageLength[n+1]*8,h=v/4294967296>>>0,y+=h,T.putInt32(y>>>0),y=v>>>0;T.putInt32(y);var p={h0:r.h0,h1:r.h1,h2:r.h2,h3:r.h3,h4:r.h4,h5:r.h5,h6:r.h6,h7:r.h7};u(p,l,T);var m=a.util.createBuffer();return m.putInt32(p.h0),m.putInt32(p.h1),m.putInt32(p.h2),m.putInt32(p.h3),m.putInt32(p.h4),m.putInt32(p.h5),m.putInt32(p.h6),m.putInt32(p.h7),m},b};var t=null,d=!1,x=null;function g(){t="",t+=a.util.fillString("\0",64),x=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=!0}function u(r,c,l){for(var b,T,E,s,v,h,y,n,p,m,_,w,C,o,i,B=l.length();B>=64;){for(y=0;y<16;++y)c[y]=l.getInt32();for(;y<64;++y)b=c[y-2],b=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,T=c[y-15],T=(T>>>7|T<<25)^(T>>>18|T<<14)^T>>>3,c[y]=b+c[y-7]+T+c[y-16]|0;for(n=r.h0,p=r.h1,m=r.h2,_=r.h3,w=r.h4,C=r.h5,o=r.h6,i=r.h7,y=0;y<64;++y)s=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),v=o^w&(C^o),E=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=n&p|m&(n^p),b=i+s+v+x[y]+c[y],T=E+h,i=o,o=C,C=w,w=_+b>>>0,_=m,m=p,p=n,n=b+T>>>0;r.h0=r.h0+n|0,r.h1=r.h1+p|0,r.h2=r.h2+m|0,r.h3=r.h3+_|0,r.h4=r.h4+w|0,r.h5=r.h5+C|0,r.h6=r.h6+o|0,r.h7=r.h7+i|0,B-=64}}return Br.exports}var kr={exports:{}},La;function Da(){if(La)return kr.exports;La=1;var a=me();Ee();var e=null;a.util.isNodejs&&!a.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Ar);var t=kr.exports=a.prng=a.prng||{};return t.create=function(d){for(var x={plugin:d,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},g=d.md,u=new Array(32),r=0;r<32;++r)u[r]=g.create();x.pools=u,x.pool=0,x.generate=function(E,s){if(!s)return x.generateSync(E);var v=x.plugin.cipher,h=x.plugin.increment,y=x.plugin.formatKey,n=x.plugin.formatSeed,p=a.util.createBuffer();x.key=null,m();function m(_){if(_)return s(_);if(p.length()>=E)return s(null,p.getBytes(E));if(x.generated>1048575&&(x.key=null),x.key===null)return a.util.nextTick(function(){c(m)});var w=v(x.key,x.seed);x.generated+=w.length,p.putBytes(w),x.key=y(v(x.key,h(x.seed))),x.seed=n(v(x.key,x.seed)),a.util.setImmediate(m)}},x.generateSync=function(E){var s=x.plugin.cipher,v=x.plugin.increment,h=x.plugin.formatKey,y=x.plugin.formatSeed;x.key=null;for(var n=a.util.createBuffer();n.length()<E;){x.generated>1048575&&(x.key=null),x.key===null&&l();var p=s(x.key,x.seed);x.generated+=p.length,n.putBytes(p),x.key=h(s(x.key,v(x.seed))),x.seed=y(s(x.key,x.seed))}return n.getBytes(E)};function c(E){if(x.pools[0].messageLength>=32)return b(),E();var s=32-x.pools[0].messageLength<<5;x.seedFile(s,function(v,h){if(v)return E(v);x.collect(h),b(),E()})}function l(){if(x.pools[0].messageLength>=32)return b();var E=32-x.pools[0].messageLength<<5;x.collect(x.seedFileSync(E)),b()}function b(){x.reseeds=x.reseeds===4294967295?0:x.reseeds+1;var E=x.plugin.md.create();E.update(x.keyBytes);for(var s=1,v=0;v<32;++v)x.reseeds%s===0&&(E.update(x.pools[v].digest().getBytes()),x.pools[v].start()),s=s<<1;x.keyBytes=E.digest().getBytes(),E.start(),E.update(x.keyBytes);var h=E.digest().getBytes();x.key=x.plugin.formatKey(x.keyBytes),x.seed=x.plugin.formatSeed(h),x.generated=0}function T(E){var s=null,v=a.util.globalScope,h=v.crypto||v.msCrypto;h&&h.getRandomValues&&(s=function(i){return h.getRandomValues(i)});var y=a.util.createBuffer();if(s)for(;y.length()<E;){var n=Math.max(1,Math.min(E-y.length(),65536)/4),p=new Uint32Array(Math.floor(n));try{s(p);for(var m=0;m<p.length;++m)y.putInt32(p[m])}catch(i){if(!(typeof QuotaExceededError<"u"&&i instanceof QuotaExceededError))throw i}}if(y.length()<E)for(var _,w,C,o=Math.floor(Math.random()*65536);y.length()<E;){w=16807*(o&65535),_=16807*(o>>16),w+=(_&32767)<<16,w+=_>>15,w=(w&2147483647)+(w>>31),o=w&4294967295;for(var m=0;m<3;++m)C=o>>>(m<<3),C^=Math.floor(Math.random()*256),y.putByte(C&255)}return y.getBytes(E)}return e?(x.seedFile=function(E,s){e.randomBytes(E,function(v,h){if(v)return s(v);s(null,h.toString())})},x.seedFileSync=function(E){return e.randomBytes(E).toString()}):(x.seedFile=function(E,s){try{s(null,T(E))}catch(v){s(v)}},x.seedFileSync=T),x.collect=function(E){for(var s=E.length,v=0;v<s;++v)x.pools[x.pool].update(E.substr(v,1)),x.pool=x.pool===31?0:x.pool+1},x.collectInt=function(E,s){for(var v="",h=0;h<s;h+=8)v+=String.fromCharCode(E>>h&255);x.collect(v)},x.registerWorker=function(E){if(E===self)x.seedFile=function(v,h){function y(n){var p=n.data;p.forge&&p.forge.prng&&(self.removeEventListener("message",y),h(p.forge.prng.err,p.forge.prng.bytes))}self.addEventListener("message",y),self.postMessage({forge:{prng:{needed:v}}})};else{var s=function(v){var h=v.data;h.forge&&h.forge.prng&&x.seedFile(h.forge.prng.needed,function(y,n){E.postMessage({forge:{prng:{err:y,bytes:n}}})})};E.addEventListener("message",s)}},x},kr.exports}var Ua;function at(){if(Ua)return Ht.exports;Ua=1;var a=me();return yt(),Na(),Da(),Ee(),(function(){if(a.random&&a.random.getBytes){Ht.exports=a.random;return}(function(e){var t={},d=new Array(4),x=a.util.createBuffer();t.formatKey=function(E){var s=a.util.createBuffer(E);return E=new Array(4),E[0]=s.getInt32(),E[1]=s.getInt32(),E[2]=s.getInt32(),E[3]=s.getInt32(),a.aes._expandKey(E,!1)},t.formatSeed=function(E){var s=a.util.createBuffer(E);return E=new Array(4),E[0]=s.getInt32(),E[1]=s.getInt32(),E[2]=s.getInt32(),E[3]=s.getInt32(),E},t.cipher=function(E,s){return a.aes._updateBlock(E,s,d,!1),x.putInt32(d[0]),x.putInt32(d[1]),x.putInt32(d[2]),x.putInt32(d[3]),x.getBytes()},t.increment=function(E){return++E[3],E},t.md=a.md.sha256;function g(){var E=a.prng.create(t);return E.getBytes=function(s,v){return E.generate(s,v)},E.getBytesSync=function(s){return E.generate(s)},E}var u=g(),r=null,c=a.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(r=function(E){return l.getRandomValues(E)}),a.options.usePureJavaScript||!a.util.isNodejs&&!r){if(u.collectInt(+new Date,32),typeof navigator<"u"){var b="";for(var T in navigator)try{typeof navigator[T]=="string"&&(b+=navigator[T])}catch{}u.collect(b),b=null}e&&(e().mousemove(function(E){u.collectInt(E.clientX,16),u.collectInt(E.clientY,16)}),e().keypress(function(E){u.collectInt(E.charCode,8)}))}if(!a.random)a.random=u;else for(var T in u)a.random[T]=u[T];a.random.createInstance=g,Ht.exports=a.random})(typeof jQuery<"u"?jQuery:null)})(),Ht.exports}var Rr,Pa;function Oa(){if(Pa)return Rr;Pa=1;var a=me();Ee();var e=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],t=[1,2,3,5],d=function(u,r){return u<<r&65535|(u&65535)>>16-r},x=function(u,r){return(u&65535)>>r|u<<16-r&65535};Rr=a.rc2=a.rc2||{},a.rc2.expandKey=function(u,r){typeof u=="string"&&(u=a.util.createBuffer(u)),r=r||128;var c=u,l=u.length(),b=r,T=Math.ceil(b/8),E=255>>(b&7),s;for(s=l;s<128;s++)c.putByte(e[c.at(s-1)+c.at(s-l)&255]);for(c.setAt(128-T,e[c.at(128-T)&E]),s=127-T;s>=0;s--)c.setAt(s,e[c.at(s+1)^c.at(s+T)]);return c};var g=function(u,r,c){var l=!1,b=null,T=null,E=null,s,v,h,y,n=[];for(u=a.rc2.expandKey(u,r),h=0;h<64;h++)n.push(u.getInt16Le());c?(s=function(_){for(h=0;h<4;h++)_[h]+=n[y]+(_[(h+3)%4]&_[(h+2)%4])+(~_[(h+3)%4]&_[(h+1)%4]),_[h]=d(_[h],t[h]),y++},v=function(_){for(h=0;h<4;h++)_[h]+=n[_[(h+3)%4]&63]}):(s=function(_){for(h=3;h>=0;h--)_[h]=x(_[h],t[h]),_[h]-=n[y]+(_[(h+3)%4]&_[(h+2)%4])+(~_[(h+3)%4]&_[(h+1)%4]),y--},v=function(_){for(h=3;h>=0;h--)_[h]-=n[_[(h+3)%4]&63]});var p=function(_){var w=[];for(h=0;h<4;h++){var C=b.getInt16Le();E!==null&&(c?C^=E.getInt16Le():E.putInt16Le(C)),w.push(C&65535)}y=c?0:63;for(var o=0;o<_.length;o++)for(var i=0;i<_[o][0];i++)_[o][1](w);for(h=0;h<4;h++)E!==null&&(c?E.putInt16Le(w[h]):w[h]^=E.getInt16Le()),T.putInt16Le(w[h])},m=null;return m={start:function(_,w){_&&typeof _=="string"&&(_=a.util.createBuffer(_)),l=!1,b=a.util.createBuffer(),T=w||new a.util.createBuffer,E=_,m.output=T},update:function(_){for(l||b.putBuffer(_);b.length()>=8;)p([[5,s],[1,v],[6,s],[1,v],[5,s]])},finish:function(_){var w=!0;if(c)if(_)w=_(8,b,!c);else{var C=b.length()===8?8:8-b.length();b.fillWithByte(C,C)}if(w&&(l=!0,m.update()),!c&&(w=b.length()===0,w))if(_)w=_(8,T,!c);else{var o=T.length(),i=T.at(o-1);i>o?w=!1:T.truncate(i)}return w}},m};return a.rc2.startEncrypting=function(u,r,c){var l=a.rc2.createEncryptionCipher(u,128);return l.start(r,c),l},a.rc2.createEncryptionCipher=function(u,r){return g(u,r,!0)},a.rc2.startDecrypting=function(u,r,c){var l=a.rc2.createDecryptionCipher(u,128);return l.start(r,c),l},a.rc2.createDecryptionCipher=function(u,r){return g(u,r,!1)},Rr}var Nr,Fa;function Gt(){if(Fa)return Nr;Fa=1;var a=me();Nr=a.jsbn=a.jsbn||{};var e;function t(R,U,z){this.data=[],R!=null&&(typeof R=="number"?this.fromNumber(R,U,z):U==null&&typeof R!="string"?this.fromString(R,256):this.fromString(R,U))}a.jsbn.BigInteger=t;function d(){return new t(null)}function x(R,U,z,Z,ne,le){for(;--le>=0;){var pe=U*this.data[R++]+z.data[Z]+ne;ne=Math.floor(pe/67108864),z.data[Z++]=pe&67108863}return ne}function g(R,U,z,Z,ne,le){for(var pe=U&32767,he=U>>15;--le>=0;){var Te=this.data[R]&32767,je=this.data[R++]>>15,tt=he*Te+je*pe;Te=pe*Te+((tt&32767)<<15)+z.data[Z]+(ne&1073741823),ne=(Te>>>30)+(tt>>>15)+he*je+(ne>>>30),z.data[Z++]=Te&1073741823}return ne}function u(R,U,z,Z,ne,le){for(var pe=U&16383,he=U>>14;--le>=0;){var Te=this.data[R]&16383,je=this.data[R++]>>14,tt=he*Te+je*pe;Te=pe*Te+((tt&16383)<<14)+z.data[Z]+ne,ne=(Te>>28)+(tt>>14)+he*je,z.data[Z++]=Te&268435455}return ne}typeof navigator>"u"?(t.prototype.am=u,e=28):navigator.appName=="Microsoft Internet Explorer"?(t.prototype.am=g,e=30):navigator.appName!="Netscape"?(t.prototype.am=x,e=26):(t.prototype.am=u,e=28),t.prototype.DB=e,t.prototype.DM=(1<<e)-1,t.prototype.DV=1<<e;var r=52;t.prototype.FV=Math.pow(2,r),t.prototype.F1=r-e,t.prototype.F2=2*e-r;var c="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array,b,T;for(b=48,T=0;T<=9;++T)l[b++]=T;for(b=97,T=10;T<36;++T)l[b++]=T;for(b=65,T=10;T<36;++T)l[b++]=T;function E(R){return c.charAt(R)}function s(R,U){var z=l[R.charCodeAt(U)];return z??-1}function v(R){for(var U=this.t-1;U>=0;--U)R.data[U]=this.data[U];R.t=this.t,R.s=this.s}function h(R){this.t=1,this.s=R<0?-1:0,R>0?this.data[0]=R:R<-1?this.data[0]=R+this.DV:this.t=0}function y(R){var U=d();return U.fromInt(R),U}function n(R,U){var z;if(U==16)z=4;else if(U==8)z=3;else if(U==256)z=8;else if(U==2)z=1;else if(U==32)z=5;else if(U==4)z=2;else{this.fromRadix(R,U);return}this.t=0,this.s=0;for(var Z=R.length,ne=!1,le=0;--Z>=0;){var pe=z==8?R[Z]&255:s(R,Z);if(pe<0){R.charAt(Z)=="-"&&(ne=!0);continue}ne=!1,le==0?this.data[this.t++]=pe:le+z>this.DB?(this.data[this.t-1]|=(pe&(1<<this.DB-le)-1)<<le,this.data[this.t++]=pe>>this.DB-le):this.data[this.t-1]|=pe<<le,le+=z,le>=this.DB&&(le-=this.DB)}z==8&&(R[0]&128)!=0&&(this.s=-1,le>0&&(this.data[this.t-1]|=(1<<this.DB-le)-1<<le)),this.clamp(),ne&&t.ZERO.subTo(this,this)}function p(){for(var R=this.s&this.DM;this.t>0&&this.data[this.t-1]==R;)--this.t}function m(R){if(this.s<0)return"-"+this.negate().toString(R);var U;if(R==16)U=4;else if(R==8)U=3;else if(R==2)U=1;else if(R==32)U=5;else if(R==4)U=2;else return this.toRadix(R);var z=(1<<U)-1,Z,ne=!1,le="",pe=this.t,he=this.DB-pe*this.DB%U;if(pe-- >0)for(he<this.DB&&(Z=this.data[pe]>>he)>0&&(ne=!0,le=E(Z));pe>=0;)he<U?(Z=(this.data[pe]&(1<<he)-1)<<U-he,Z|=this.data[--pe]>>(he+=this.DB-U)):(Z=this.data[pe]>>(he-=U)&z,he<=0&&(he+=this.DB,--pe)),Z>0&&(ne=!0),ne&&(le+=E(Z));return ne?le:"0"}function _(){var R=d();return t.ZERO.subTo(this,R),R}function w(){return this.s<0?this.negate():this}function C(R){var U=this.s-R.s;if(U!=0)return U;var z=this.t;if(U=z-R.t,U!=0)return this.s<0?-U:U;for(;--z>=0;)if((U=this.data[z]-R.data[z])!=0)return U;return 0}function o(R){var U=1,z;return(z=R>>>16)!=0&&(R=z,U+=16),(z=R>>8)!=0&&(R=z,U+=8),(z=R>>4)!=0&&(R=z,U+=4),(z=R>>2)!=0&&(R=z,U+=2),(z=R>>1)!=0&&(R=z,U+=1),U}function i(){return this.t<=0?0:this.DB*(this.t-1)+o(this.data[this.t-1]^this.s&this.DM)}function B(R,U){var z;for(z=this.t-1;z>=0;--z)U.data[z+R]=this.data[z];for(z=R-1;z>=0;--z)U.data[z]=0;U.t=this.t+R,U.s=this.s}function N(R,U){for(var z=R;z<this.t;++z)U.data[z-R]=this.data[z];U.t=Math.max(this.t-R,0),U.s=this.s}function q(R,U){var z=R%this.DB,Z=this.DB-z,ne=(1<<Z)-1,le=Math.floor(R/this.DB),pe=this.s<<z&this.DM,he;for(he=this.t-1;he>=0;--he)U.data[he+le+1]=this.data[he]>>Z|pe,pe=(this.data[he]&ne)<<z;for(he=le-1;he>=0;--he)U.data[he]=0;U.data[le]=pe,U.t=this.t+le+1,U.s=this.s,U.clamp()}function I(R,U){U.s=this.s;var z=Math.floor(R/this.DB);if(z>=this.t){U.t=0;return}var Z=R%this.DB,ne=this.DB-Z,le=(1<<Z)-1;U.data[0]=this.data[z]>>Z;for(var pe=z+1;pe<this.t;++pe)U.data[pe-z-1]|=(this.data[pe]&le)<<ne,U.data[pe-z]=this.data[pe]>>Z;Z>0&&(U.data[this.t-z-1]|=(this.s&le)<<ne),U.t=this.t-z,U.clamp()}function F(R,U){for(var z=0,Z=0,ne=Math.min(R.t,this.t);z<ne;)Z+=this.data[z]-R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;if(R.t<this.t){for(Z-=R.s;z<this.t;)Z+=this.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=this.s}else{for(Z+=this.s;z<R.t;)Z-=R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z-=R.s}U.s=Z<0?-1:0,Z<-1?U.data[z++]=this.DV+Z:Z>0&&(U.data[z++]=Z),U.t=z,U.clamp()}function A(R,U){var z=this.abs(),Z=R.abs(),ne=z.t;for(U.t=ne+Z.t;--ne>=0;)U.data[ne]=0;for(ne=0;ne<Z.t;++ne)U.data[ne+z.t]=z.am(0,Z.data[ne],U,ne,0,z.t);U.s=0,U.clamp(),this.s!=R.s&&t.ZERO.subTo(U,U)}function H(R){for(var U=this.abs(),z=R.t=2*U.t;--z>=0;)R.data[z]=0;for(z=0;z<U.t-1;++z){var Z=U.am(z,U.data[z],R,2*z,0,1);(R.data[z+U.t]+=U.am(z+1,2*U.data[z],R,2*z+1,Z,U.t-z-1))>=U.DV&&(R.data[z+U.t]-=U.DV,R.data[z+U.t+1]=1)}R.t>0&&(R.data[R.t-1]+=U.am(z,U.data[z],R,2*z,0,1)),R.s=0,R.clamp()}function j(R,U,z){var Z=R.abs();if(!(Z.t<=0)){var ne=this.abs();if(ne.t<Z.t){U?.fromInt(0),z!=null&&this.copyTo(z);return}z==null&&(z=d());var le=d(),pe=this.s,he=R.s,Te=this.DB-o(Z.data[Z.t-1]);Te>0?(Z.lShiftTo(Te,le),ne.lShiftTo(Te,z)):(Z.copyTo(le),ne.copyTo(z));var je=le.t,tt=le.data[je-1];if(tt!=0){var $e=tt*(1<<this.F1)+(je>1?le.data[je-2]>>this.F2:0),ht=this.FV/$e,Xt=(1<<this.F1)/$e,ut=1<<this.F2,lt=z.t,$t=lt-je,gt=U??d();for(le.dlShiftTo($t,gt),z.compareTo(gt)>=0&&(z.data[z.t++]=1,z.subTo(gt,z)),t.ONE.dlShiftTo(je,gt),gt.subTo(le,le);le.t<je;)le.data[le.t++]=0;for(;--$t>=0;){var aa=z.data[--lt]==tt?this.DM:Math.floor(z.data[lt]*ht+(z.data[lt-1]+ut)*Xt);if((z.data[lt]+=le.am(0,aa,z,$t,0,je))<aa)for(le.dlShiftTo($t,gt),z.subTo(gt,z);z.data[lt]<--aa;)z.subTo(gt,z)}U!=null&&(z.drShiftTo(je,U),pe!=he&&t.ZERO.subTo(U,U)),z.t=je,z.clamp(),Te>0&&z.rShiftTo(Te,z),pe<0&&t.ZERO.subTo(z,z)}}}function W(R){var U=d();return this.abs().divRemTo(R,null,U),this.s<0&&U.compareTo(t.ZERO)>0&&R.subTo(U,U),U}function re(R){this.m=R}function J(R){return R.s<0||R.compareTo(this.m)>=0?R.mod(this.m):R}function oe(R){return R}function Q(R){R.divRemTo(this.m,null,R)}function $(R,U,z){R.multiplyTo(U,z),this.reduce(z)}function ce(R,U){R.squareTo(U),this.reduce(U)}re.prototype.convert=J,re.prototype.revert=oe,re.prototype.reduce=Q,re.prototype.mulTo=$,re.prototype.sqrTo=ce;function ie(){if(this.t<1)return 0;var R=this.data[0];if((R&1)==0)return 0;var U=R&3;return U=U*(2-(R&15)*U)&15,U=U*(2-(R&255)*U)&255,U=U*(2-((R&65535)*U&65535))&65535,U=U*(2-R*U%this.DV)%this.DV,U>0?this.DV-U:-U}function ee(R){this.m=R,this.mp=R.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<R.DB-15)-1,this.mt2=2*R.t}function ue(R){var U=d();return R.abs().dlShiftTo(this.m.t,U),U.divRemTo(this.m,null,U),R.s<0&&U.compareTo(t.ZERO)>0&&this.m.subTo(U,U),U}function Se(R){var U=d();return R.copyTo(U),this.reduce(U),U}function ve(R){for(;R.t<=this.mt2;)R.data[R.t++]=0;for(var U=0;U<this.m.t;++U){var z=R.data[U]&32767,Z=z*this.mpl+((z*this.mph+(R.data[U]>>15)*this.mpl&this.um)<<15)&R.DM;for(z=U+this.m.t,R.data[z]+=this.m.am(0,Z,R,U,0,this.m.t);R.data[z]>=R.DV;)R.data[z]-=R.DV,R.data[++z]++}R.clamp(),R.drShiftTo(this.m.t,R),R.compareTo(this.m)>=0&&R.subTo(this.m,R)}function k(R,U){R.squareTo(U),this.reduce(U)}function O(R,U,z){R.multiplyTo(U,z),this.reduce(z)}ee.prototype.convert=ue,ee.prototype.revert=Se,ee.prototype.reduce=ve,ee.prototype.mulTo=O,ee.prototype.sqrTo=k;function P(){return(this.t>0?this.data[0]&1:this.s)==0}function D(R,U){if(R>4294967295||R<1)return t.ONE;var z=d(),Z=d(),ne=U.convert(this),le=o(R)-1;for(ne.copyTo(z);--le>=0;)if(U.sqrTo(z,Z),(R&1<<le)>0)U.mulTo(Z,ne,z);else{var pe=z;z=Z,Z=pe}return U.revert(z)}function S(R,U){var z;return R<256||U.isEven()?z=new re(U):z=new ee(U),this.exp(R,z)}t.prototype.copyTo=v,t.prototype.fromInt=h,t.prototype.fromString=n,t.prototype.clamp=p,t.prototype.dlShiftTo=B,t.prototype.drShiftTo=N,t.prototype.lShiftTo=q,t.prototype.rShiftTo=I,t.prototype.subTo=F,t.prototype.multiplyTo=A,t.prototype.squareTo=H,t.prototype.divRemTo=j,t.prototype.invDigit=ie,t.prototype.isEven=P,t.prototype.exp=D,t.prototype.toString=m,t.prototype.negate=_,t.prototype.abs=w,t.prototype.compareTo=C,t.prototype.bitLength=i,t.prototype.mod=W,t.prototype.modPowInt=S,t.ZERO=y(0),t.ONE=y(1);function f(){var R=d();return this.copyTo(R),R}function L(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function G(){return this.t==0?this.s:this.data[0]<<24>>24}function M(){return this.t==0?this.s:this.data[0]<<16>>16}function V(R){return Math.floor(Math.LN2*this.DB/Math.log(R))}function K(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function X(R){if(R==null&&(R=10),this.signum()==0||R<2||R>36)return"0";var U=this.chunkSize(R),z=Math.pow(R,U),Z=y(z),ne=d(),le=d(),pe="";for(this.divRemTo(Z,ne,le);ne.signum()>0;)pe=(z+le.intValue()).toString(R).substr(1)+pe,ne.divRemTo(Z,ne,le);return le.intValue().toString(R)+pe}function te(R,U){this.fromInt(0),U==null&&(U=10);for(var z=this.chunkSize(U),Z=Math.pow(U,z),ne=!1,le=0,pe=0,he=0;he<R.length;++he){var Te=s(R,he);if(Te<0){R.charAt(he)=="-"&&this.signum()==0&&(ne=!0);continue}pe=U*pe+Te,++le>=z&&(this.dMultiply(Z),this.dAddOffset(pe,0),le=0,pe=0)}le>0&&(this.dMultiply(Math.pow(U,le)),this.dAddOffset(pe,0)),ne&&t.ZERO.subTo(this,this)}function Y(R,U,z){if(typeof U=="number")if(R<2)this.fromInt(1);else for(this.fromNumber(R,z),this.testBit(R-1)||this.bitwiseTo(t.ONE.shiftLeft(R-1),be,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(U);)this.dAddOffset(2,0),this.bitLength()>R&&this.subTo(t.ONE.shiftLeft(R-1),this);else{var Z=new Array,ne=R&7;Z.length=(R>>3)+1,U.nextBytes(Z),ne>0?Z[0]&=(1<<ne)-1:Z[0]=0,this.fromString(Z,256)}}function ae(){var R=this.t,U=new Array;U[0]=this.s;var z=this.DB-R*this.DB%8,Z,ne=0;if(R-- >0)for(z<this.DB&&(Z=this.data[R]>>z)!=(this.s&this.DM)>>z&&(U[ne++]=Z|this.s<<this.DB-z);R>=0;)z<8?(Z=(this.data[R]&(1<<z)-1)<<8-z,Z|=this.data[--R]>>(z+=this.DB-8)):(Z=this.data[R]>>(z-=8)&255,z<=0&&(z+=this.DB,--R)),(Z&128)!=0&&(Z|=-256),ne==0&&(this.s&128)!=(Z&128)&&++ne,(ne>0||Z!=this.s)&&(U[ne++]=Z);return U}function fe(R){return this.compareTo(R)==0}function se(R){return this.compareTo(R)<0?this:R}function de(R){return this.compareTo(R)>0?this:R}function ye(R,U,z){var Z,ne,le=Math.min(R.t,this.t);for(Z=0;Z<le;++Z)z.data[Z]=U(this.data[Z],R.data[Z]);if(R.t<this.t){for(ne=R.s&this.DM,Z=le;Z<this.t;++Z)z.data[Z]=U(this.data[Z],ne);z.t=this.t}else{for(ne=this.s&this.DM,Z=le;Z<R.t;++Z)z.data[Z]=U(ne,R.data[Z]);z.t=R.t}z.s=U(this.s,R.s),z.clamp()}function ge(R,U){return R&U}function xe(R){var U=d();return this.bitwiseTo(R,ge,U),U}function be(R,U){return R|U}function _e(R){var U=d();return this.bitwiseTo(R,be,U),U}function Ae(R,U){return R^U}function Ce(R){var U=d();return this.bitwiseTo(R,Ae,U),U}function Be(R,U){return R&~U}function Ne(R){var U=d();return this.bitwiseTo(R,Be,U),U}function Ie(){for(var R=d(),U=0;U<this.t;++U)R.data[U]=this.DM&~this.data[U];return R.t=this.t,R.s=~this.s,R}function Qe(R){var U=d();return R<0?this.rShiftTo(-R,U):this.lShiftTo(R,U),U}function Ze(R){var U=d();return R<0?this.lShiftTo(-R,U):this.rShiftTo(R,U),U}function et(R){if(R==0)return-1;var U=0;return(R&65535)==0&&(R>>=16,U+=16),(R&255)==0&&(R>>=8,U+=8),(R&15)==0&&(R>>=4,U+=4),(R&3)==0&&(R>>=2,U+=2),(R&1)==0&&++U,U}function nt(){for(var R=0;R<this.t;++R)if(this.data[R]!=0)return R*this.DB+et(this.data[R]);return this.s<0?this.t*this.DB:-1}function it(R){for(var U=0;R!=0;)R&=R-1,++U;return U}function Xe(){for(var R=0,U=this.s&this.DM,z=0;z<this.t;++z)R+=it(this.data[z]^U);return R}function st(R){var U=Math.floor(R/this.DB);return U>=this.t?this.s!=0:(this.data[U]&1<<R%this.DB)!=0}function Lt(R,U){var z=t.ONE.shiftLeft(R);return this.bitwiseTo(z,U,z),z}function Zt(R){return this.changeBit(R,be)}function Le(R){return this.changeBit(R,Be)}function De(R){return this.changeBit(R,Ae)}function Ue(R,U){for(var z=0,Z=0,ne=Math.min(R.t,this.t);z<ne;)Z+=this.data[z]+R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;if(R.t<this.t){for(Z+=R.s;z<this.t;)Z+=this.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=this.s}else{for(Z+=this.s;z<R.t;)Z+=R.data[z],U.data[z++]=Z&this.DM,Z>>=this.DB;Z+=R.s}U.s=Z<0?-1:0,Z>0?U.data[z++]=Z:Z<-1&&(U.data[z++]=this.DV+Z),U.t=z,U.clamp()}function Pe(R){var U=d();return this.addTo(R,U),U}function Oe(R){var U=d();return this.subTo(R,U),U}function Fe(R){var U=d();return this.multiplyTo(R,U),U}function Ve(){var R=d();return this.squareTo(R),R}function Me(R){var U=d();return this.divRemTo(R,U,null),U}function Ke(R){var U=d();return this.divRemTo(R,null,U),U}function ze(R){var U=d(),z=d();return this.divRemTo(R,U,z),new Array(U,z)}function qe(R){this.data[this.t]=this.am(0,R-1,this,0,0,this.t),++this.t,this.clamp()}function He(R,U){if(R!=0){for(;this.t<=U;)this.data[this.t++]=0;for(this.data[U]+=R;this.data[U]>=this.DV;)this.data[U]-=this.DV,++U>=this.t&&(this.data[this.t++]=0),++this.data[U]}}function we(){}function Re(R){return R}function Ge(R,U,z){R.multiplyTo(U,z)}function We(R,U){R.squareTo(U)}we.prototype.convert=Re,we.prototype.revert=Re,we.prototype.mulTo=Ge,we.prototype.sqrTo=We;function zi(R){return this.exp(R,new we)}function qi(R,U,z){var Z=Math.min(this.t+R.t,U);for(z.s=0,z.t=Z;Z>0;)z.data[--Z]=0;var ne;for(ne=z.t-this.t;Z<ne;++Z)z.data[Z+this.t]=this.am(0,R.data[Z],z,Z,0,this.t);for(ne=Math.min(R.t,U);Z<ne;++Z)this.am(0,R.data[Z],z,Z,0,U-Z);z.clamp()}function Hi(R,U,z){--U;var Z=z.t=this.t+R.t-U;for(z.s=0;--Z>=0;)z.data[Z]=0;for(Z=Math.max(U-this.t,0);Z<R.t;++Z)z.data[this.t+Z-U]=this.am(U-Z,R.data[Z],z,0,0,this.t+Z-U);z.clamp(),z.drShiftTo(1,z)}function Et(R){this.r2=d(),this.q3=d(),t.ONE.dlShiftTo(2*R.t,this.r2),this.mu=this.r2.divide(R),this.m=R}function Gi(R){if(R.s<0||R.t>2*this.m.t)return R.mod(this.m);if(R.compareTo(this.m)<0)return R;var U=d();return R.copyTo(U),this.reduce(U),U}function Wi(R){return R}function ji(R){for(R.drShiftTo(this.m.t-1,this.r2),R.t>this.m.t+1&&(R.t=this.m.t+1,R.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);R.compareTo(this.r2)<0;)R.dAddOffset(1,this.m.t+1);for(R.subTo(this.r2,R);R.compareTo(this.m)>=0;)R.subTo(this.m,R)}function Qi(R,U){R.squareTo(U),this.reduce(U)}function Yi(R,U,z){R.multiplyTo(U,z),this.reduce(z)}Et.prototype.convert=Gi,Et.prototype.revert=Wi,Et.prototype.reduce=ji,Et.prototype.mulTo=Yi,Et.prototype.sqrTo=Qi;function Zi(R,U){var z=R.bitLength(),Z,ne=y(1),le;if(z<=0)return ne;z<18?Z=1:z<48?Z=3:z<144?Z=4:z<768?Z=5:Z=6,z<8?le=new re(U):U.isEven()?le=new Et(U):le=new ee(U);var pe=new Array,he=3,Te=Z-1,je=(1<<Z)-1;if(pe[1]=le.convert(this),Z>1){var tt=d();for(le.sqrTo(pe[1],tt);he<=je;)pe[he]=d(),le.mulTo(tt,pe[he-2],pe[he]),he+=2}var $e=R.t-1,ht,Xt=!0,ut=d(),lt;for(z=o(R.data[$e])-1;$e>=0;){for(z>=Te?ht=R.data[$e]>>z-Te&je:(ht=(R.data[$e]&(1<<z+1)-1)<<Te-z,$e>0&&(ht|=R.data[$e-1]>>this.DB+z-Te)),he=Z;(ht&1)==0;)ht>>=1,--he;if((z-=he)<0&&(z+=this.DB,--$e),Xt)pe[ht].copyTo(ne),Xt=!1;else{for(;he>1;)le.sqrTo(ne,ut),le.sqrTo(ut,ne),he-=2;he>0?le.sqrTo(ne,ut):(lt=ne,ne=ut,ut=lt),le.mulTo(ut,pe[ht],ne)}for(;$e>=0&&(R.data[$e]&1<<z)==0;)le.sqrTo(ne,ut),lt=ne,ne=ut,ut=lt,--z<0&&(z=this.DB-1,--$e)}return le.revert(ne)}function Xi(R){var U=this.s<0?this.negate():this.clone(),z=R.s<0?R.negate():R.clone();if(U.compareTo(z)<0){var Z=U;U=z,z=Z}var ne=U.getLowestSetBit(),le=z.getLowestSetBit();if(le<0)return U;for(ne<le&&(le=ne),le>0&&(U.rShiftTo(le,U),z.rShiftTo(le,z));U.signum()>0;)(ne=U.getLowestSetBit())>0&&U.rShiftTo(ne,U),(ne=z.getLowestSetBit())>0&&z.rShiftTo(ne,z),U.compareTo(z)>=0?(U.subTo(z,U),U.rShiftTo(1,U)):(z.subTo(U,z),z.rShiftTo(1,z));return le>0&&z.lShiftTo(le,z),z}function $i(R){if(R<=0)return 0;var U=this.DV%R,z=this.s<0?R-1:0;if(this.t>0)if(U==0)z=this.data[0]%R;else for(var Z=this.t-1;Z>=0;--Z)z=(U*z+this.data[Z])%R;return z}function Ji(R){if(this.signum()==0)return t.ZERO;var U=R.isEven();if(this.isEven()&&U||R.signum()==0)return t.ZERO;for(var z=R.clone(),Z=this.clone(),ne=y(1),le=y(0),pe=y(0),he=y(1);z.signum()!=0;){for(;z.isEven();)z.rShiftTo(1,z),U?((!ne.isEven()||!le.isEven())&&(ne.addTo(this,ne),le.subTo(R,le)),ne.rShiftTo(1,ne)):le.isEven()||le.subTo(R,le),le.rShiftTo(1,le);for(;Z.isEven();)Z.rShiftTo(1,Z),U?((!pe.isEven()||!he.isEven())&&(pe.addTo(this,pe),he.subTo(R,he)),pe.rShiftTo(1,pe)):he.isEven()||he.subTo(R,he),he.rShiftTo(1,he);z.compareTo(Z)>=0?(z.subTo(Z,z),U&&ne.subTo(pe,ne),le.subTo(he,le)):(Z.subTo(z,Z),U&&pe.subTo(ne,pe),he.subTo(le,he))}if(Z.compareTo(t.ONE)!=0)return t.ZERO;if(he.compareTo(R)>=0)return he.subtract(R);if(he.signum()<0)he.addTo(R,he);else return he;return he.signum()<0?he.add(R):he}var ot=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],es=(1<<26)/ot[ot.length-1];function ts(R){var U,z=this.abs();if(z.t==1&&z.data[0]<=ot[ot.length-1]){for(U=0;U<ot.length;++U)if(z.data[0]==ot[U])return!0;return!1}if(z.isEven())return!1;for(U=1;U<ot.length;){for(var Z=ot[U],ne=U+1;ne<ot.length&&Z<es;)Z*=ot[ne++];for(Z=z.modInt(Z);U<ne;)if(Z%ot[U++]==0)return!1}return z.millerRabin(R)}function rs(R){var U=this.subtract(t.ONE),z=U.getLowestSetBit();if(z<=0)return!1;for(var Z=U.shiftRight(z),ne=as(),le,pe=0;pe<R;++pe){do le=new t(this.bitLength(),ne);while(le.compareTo(t.ONE)<=0||le.compareTo(U)>=0);var he=le.modPow(Z,this);if(he.compareTo(t.ONE)!=0&&he.compareTo(U)!=0){for(var Te=1;Te++<z&&he.compareTo(U)!=0;)if(he=he.modPowInt(2,this),he.compareTo(t.ONE)==0)return!1;if(he.compareTo(U)!=0)return!1}}return!0}function as(){return{nextBytes:function(R){for(var U=0;U<R.length;++U)R[U]=Math.floor(Math.random()*256)}}}return t.prototype.chunkSize=V,t.prototype.toRadix=X,t.prototype.fromRadix=te,t.prototype.fromNumber=Y,t.prototype.bitwiseTo=ye,t.prototype.changeBit=Lt,t.prototype.addTo=Ue,t.prototype.dMultiply=qe,t.prototype.dAddOffset=He,t.prototype.multiplyLowerTo=qi,t.prototype.multiplyUpperTo=Hi,t.prototype.modInt=$i,t.prototype.millerRabin=rs,t.prototype.clone=f,t.prototype.intValue=L,t.prototype.byteValue=G,t.prototype.shortValue=M,t.prototype.signum=K,t.prototype.toByteArray=ae,t.prototype.equals=fe,t.prototype.min=se,t.prototype.max=de,t.prototype.and=xe,t.prototype.or=_e,t.prototype.xor=Ce,t.prototype.andNot=Ne,t.prototype.not=Ie,t.prototype.shiftLeft=Qe,t.prototype.shiftRight=Ze,t.prototype.getLowestSetBit=nt,t.prototype.bitCount=Xe,t.prototype.testBit=st,t.prototype.setBit=Zt,t.prototype.clearBit=Le,t.prototype.flipBit=De,t.prototype.add=Pe,t.prototype.subtract=Oe,t.prototype.multiply=Fe,t.prototype.divide=Me,t.prototype.remainder=Ke,t.prototype.divideAndRemainder=ze,t.prototype.modPow=Zi,t.prototype.modInverse=Ji,t.prototype.pow=zi,t.prototype.gcd=Xi,t.prototype.isProbablePrime=ts,t.prototype.square=Ve,Nr}var Lr={exports:{}},Dr={exports:{}},Va;function Nt(){if(Va)return Dr.exports;Va=1;var a=me();ct(),Ee();var e=Dr.exports=a.sha1=a.sha1||{};a.md.sha1=a.md.algorithms.sha1=e,e.create=function(){d||x();var u=null,r=a.util.createBuffer(),c=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return l.start=function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var b=l.messageLengthSize/4,T=0;T<b;++T)l.fullMessageLength.push(0);return r=a.util.createBuffer(),u={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l},l.start(),l.update=function(b,T){T==="utf8"&&(b=a.util.encodeUtf8(b));var E=b.length;l.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var s=l.fullMessageLength.length-1;s>=0;--s)l.fullMessageLength[s]+=E[1],E[1]=E[0]+(l.fullMessageLength[s]/4294967296>>>0),l.fullMessageLength[s]=l.fullMessageLength[s]>>>0,E[0]=E[1]/4294967296>>>0;return r.putBytes(b),g(u,c,r),(r.read>2048||r.length()===0)&&r.compact(),l},l.digest=function(){var b=a.util.createBuffer();b.putBytes(r.bytes());var T=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize,E=T&l.blockLength-1;b.putBytes(t.substr(0,l.blockLength-E));for(var s,v,h=l.fullMessageLength[0]*8,y=0;y<l.fullMessageLength.length-1;++y)s=l.fullMessageLength[y+1]*8,v=s/4294967296>>>0,h+=v,b.putInt32(h>>>0),h=s>>>0;b.putInt32(h);var n={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3,h4:u.h4};g(n,c,b);var p=a.util.createBuffer();return p.putInt32(n.h0),p.putInt32(n.h1),p.putInt32(n.h2),p.putInt32(n.h3),p.putInt32(n.h4),p},l};var t=null,d=!1;function x(){t="",t+=a.util.fillString("\0",64),d=!0}function g(u,r,c){for(var l,b,T,E,s,v,h,y,n=c.length();n>=64;){for(b=u.h0,T=u.h1,E=u.h2,s=u.h3,v=u.h4,y=0;y<16;++y)l=c.getInt32(),r[y]=l,h=s^T&(E^s),l=(b<<5|b>>>27)+h+v+1518500249+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<20;++y)l=r[y-3]^r[y-8]^r[y-14]^r[y-16],l=l<<1|l>>>31,r[y]=l,h=s^T&(E^s),l=(b<<5|b>>>27)+h+v+1518500249+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<32;++y)l=r[y-3]^r[y-8]^r[y-14]^r[y-16],l=l<<1|l>>>31,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+1859775393+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<40;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+1859775393+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<60;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T&E|s&(T^E),l=(b<<5|b>>>27)+h+v+2400959708+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;for(;y<80;++y)l=r[y-6]^r[y-16]^r[y-28]^r[y-32],l=l<<2|l>>>30,r[y]=l,h=T^E^s,l=(b<<5|b>>>27)+h+v+3395469782+l,v=s,s=E,E=(T<<30|T>>>2)>>>0,T=b,b=l;u.h0=u.h0+b|0,u.h1=u.h1+T|0,u.h2=u.h2+E|0,u.h3=u.h3+s|0,u.h4=u.h4+v|0,n-=64}}return Dr.exports}var Ma;function Ka(){if(Ma)return Lr.exports;Ma=1;var a=me();Ee(),at(),Nt();var e=Lr.exports=a.pkcs1=a.pkcs1||{};e.encode_rsa_oaep=function(d,x,g){var u,r,c,l;typeof g=="string"?(u=g,r=arguments[3]||void 0,c=arguments[4]||void 0):g&&(u=g.label||void 0,r=g.seed||void 0,c=g.md||void 0,g.mgf1&&g.mgf1.md&&(l=g.mgf1.md)),c?c.start():c=a.md.sha1.create(),l||(l=c);var b=Math.ceil(d.n.bitLength()/8),T=b-2*c.digestLength-2;if(x.length>T){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=x.length,E.maxLength=T,E}u||(u=""),c.update(u,"raw");for(var s=c.digest(),v="",h=T-x.length,y=0;y<h;y++)v+="\0";var n=s.getBytes()+v+""+x;if(!r)r=a.random.getBytes(c.digestLength);else if(r.length!==c.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=r.length,E.digestLength=c.digestLength,E}var p=t(r,b-c.digestLength-1,l),m=a.util.xorBytes(n,p,n.length),_=t(m,c.digestLength,l),w=a.util.xorBytes(r,_,r.length);return"\0"+w+m},e.decode_rsa_oaep=function(d,x,g){var u,r,c;typeof g=="string"?(u=g,r=arguments[3]||void 0):g&&(u=g.label||void 0,r=g.md||void 0,g.mgf1&&g.mgf1.md&&(c=g.mgf1.md));var l=Math.ceil(d.n.bitLength()/8);if(x.length!==l){var m=new Error("RSAES-OAEP encoded message length is invalid.");throw m.length=x.length,m.expectedLength=l,m}if(r===void 0?r=a.md.sha1.create():r.start(),c||(c=r),l<2*r.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");u||(u=""),r.update(u,"raw");for(var b=r.digest().getBytes(),T=x.charAt(0),E=x.substring(1,r.digestLength+1),s=x.substring(1+r.digestLength),v=t(s,r.digestLength,c),h=a.util.xorBytes(E,v,E.length),y=t(h,l-r.digestLength-1,c),n=a.util.xorBytes(s,y,s.length),p=n.substring(0,r.digestLength),m=T!=="\0",_=0;_<r.digestLength;++_)m|=b.charAt(_)!==p.charAt(_);for(var w=1,C=r.digestLength,o=r.digestLength;o<n.length;o++){var i=n.charCodeAt(o),B=i&1^1,N=w?65534:0;m|=i&N,w=w&B,C+=w}if(m||n.charCodeAt(C)!==1)throw new Error("Invalid RSAES-OAEP padding.");return n.substring(C+1)};function t(d,x,g){g||(g=a.md.sha1.create());for(var u="",r=Math.ceil(x/g.digestLength),c=0;c<r;++c){var l=String.fromCharCode(c>>24&255,c>>16&255,c>>8&255,c&255);g.start(),g.update(d+l),u+=g.digest().getBytes()}return u.substring(0,x)}return Lr.exports}var Wt={exports:{}},za;function qa(){if(za)return Wt.exports;za=1;var a=me();return Ee(),Gt(),at(),(function(){if(a.prime){Wt.exports=a.prime;return}var e=Wt.exports=a.prime=a.prime||{},t=a.jsbn.BigInteger,d=[6,4,2,4,2,4,6,2],x=new t(null);x.fromInt(30);var g=function(E,s){return E|s};e.generateProbablePrime=function(E,s,v){typeof s=="function"&&(v=s,s={}),s=s||{};var h=s.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var y=s.prng||a.random,n={nextBytes:function(p){for(var m=y.getBytesSync(p.length),_=0;_<p.length;++_)p[_]=m.charCodeAt(_)}};if(h.name==="PRIMEINC")return u(E,n,h.options,v);throw new Error("Invalid prime generation algorithm: "+h.name)};function u(E,s,v,h){return"workers"in v?l(E,s,v,h):r(E,s,v,h)}function r(E,s,v,h){var y=b(E,s),n=0,p=T(y.bitLength());"millerRabinTests"in v&&(p=v.millerRabinTests);var m=10;"maxBlockTime"in v&&(m=v.maxBlockTime),c(y,E,s,n,p,m,h)}function c(E,s,v,h,y,n,p){var m=+new Date;do{if(E.bitLength()>s&&(E=b(s,v)),E.isProbablePrime(y))return p(null,E);E.dAddOffset(d[h++%8],0)}while(n<0||+new Date-m<n);a.util.setImmediate(function(){c(E,s,v,h,y,n,p)})}function l(E,s,v,h){if(typeof Worker>"u")return r(E,s,v,h);var y=b(E,s),n=v.workers,p=v.workLoad||100,m=p*30/8,_=v.workerScript||"forge/prime.worker.js";if(n===-1)return a.util.estimateCores(function(C,o){C&&(o=2),n=o-1,w()});w();function w(){n=Math.max(1,n);for(var C=[],o=0;o<n;++o)C[o]=new Worker(_);for(var o=0;o<n;++o)C[o].addEventListener("message",B);var i=!1;function B(N){if(!i){var q=N.data;if(q.found){for(var I=0;I<C.length;++I)C[I].terminate();return i=!0,h(null,new t(q.prime,16))}y.bitLength()>E&&(y=b(E,s));var F=y.toString(16);N.target.postMessage({hex:F,workLoad:p}),y.dAddOffset(m,0)}}}}function b(E,s){var v=new t(E,s),h=E-1;return v.testBit(h)||v.bitwiseTo(t.ONE.shiftLeft(h),g,v),v.dAddOffset(31-v.mod(x).byteValue(),0),v}function T(E){return E<=100?27:E<=150?18:E<=200?15:E<=250?12:E<=300?9:E<=350?8:E<=400?7:E<=500?6:E<=600?5:E<=800?4:E<=1250?3:2}})(),Wt.exports}var Ur,Ha;function jt(){if(Ha)return Ur;Ha=1;var a=me();if(ft(),Gt(),mt(),Ka(),qa(),at(),Ee(),typeof e>"u")var e=a.jsbn.BigInteger;var t=a.util.isNodejs?Ar:null,d=a.asn1,x=a.util;a.pki=a.pki||{},Ur=a.pki.rsa=a.rsa=a.rsa||{};var g=a.pki,u=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},c={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},b=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},T={name:"DigestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,type:d.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(o){var i;if(o.algorithm in g.oids)i=g.oids[o.algorithm];else{var B=new Error("Unknown message digest algorithm.");throw B.algorithm=o.algorithm,B}var N=d.oidToDer(i).getBytes(),q=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),I=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);I.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,N)),I.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var F=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,o.digest().getBytes());return q.value.push(I),q.value.push(F),d.toDer(q).getBytes()},s=function(o,i,B){if(B)return o.modPow(i.e,i.n);if(!i.p||!i.q)return o.modPow(i.d,i.n);i.dP||(i.dP=i.d.mod(i.p.subtract(e.ONE))),i.dQ||(i.dQ=i.d.mod(i.q.subtract(e.ONE))),i.qInv||(i.qInv=i.q.modInverse(i.p));var N;do N=new e(a.util.bytesToHex(a.random.getBytes(i.n.bitLength()/8)),16);while(N.compareTo(i.n)>=0||!N.gcd(i.n).equals(e.ONE));o=o.multiply(N.modPow(i.e,i.n)).mod(i.n);for(var q=o.mod(i.p).modPow(i.dP,i.p),I=o.mod(i.q).modPow(i.dQ,i.q);q.compareTo(I)<0;)q=q.add(i.p);var F=q.subtract(I).multiply(i.qInv).mod(i.p).multiply(i.q).add(I);return F=F.multiply(N.modInverse(i.n)).mod(i.n),F};g.rsa.encrypt=function(o,i,B){var N=B,q,I=Math.ceil(i.n.bitLength()/8);B!==!1&&B!==!0?(N=B===2,q=v(o,i,B)):(q=a.util.createBuffer(),q.putBytes(o));for(var F=new e(q.toHex(),16),A=s(F,i,N),H=A.toString(16),j=a.util.createBuffer(),W=I-Math.ceil(H.length/2);W>0;)j.putByte(0),--W;return j.putBytes(a.util.hexToBytes(H)),j.getBytes()},g.rsa.decrypt=function(o,i,B,N){var q=Math.ceil(i.n.bitLength()/8);if(o.length!==q){var I=new Error("Encrypted message length is invalid.");throw I.length=o.length,I.expected=q,I}var F=new e(a.util.createBuffer(o).toHex(),16);if(F.compareTo(i.n)>=0)throw new Error("Encrypted message is invalid.");for(var A=s(F,i,B),H=A.toString(16),j=a.util.createBuffer(),W=q-Math.ceil(H.length/2);W>0;)j.putByte(0),--W;return j.putBytes(a.util.hexToBytes(H)),N!==!1?h(j.getBytes(),i,B):j.getBytes()},g.rsa.createKeyPairGenerationState=function(o,i,B){typeof o=="string"&&(o=parseInt(o,10)),o=o||2048,B=B||{};var N=B.prng||a.random,q={nextBytes:function(A){for(var H=N.getBytesSync(A.length),j=0;j<A.length;++j)A[j]=H.charCodeAt(j)}},I=B.algorithm||"PRIMEINC",F;if(I==="PRIMEINC")F={algorithm:I,state:0,bits:o,rng:q,eInt:i||65537,e:new e(null),p:null,q:null,qBits:o>>1,pBits:o-(o>>1),pqState:0,num:null,keys:null},F.e.fromInt(F.eInt);else throw new Error("Invalid key generation algorithm: "+I);return F},g.rsa.stepKeyPairGenerationState=function(o,i){"algorithm"in o||(o.algorithm="PRIMEINC");var B=new e(null);B.fromInt(30);for(var N=0,q=function(re,J){return re|J},I=+new Date,F,A=0;o.keys===null&&(i<=0||A<i);){if(o.state===0){var H=o.p===null?o.pBits:o.qBits,j=H-1;o.pqState===0?(o.num=new e(H,o.rng),o.num.testBit(j)||o.num.bitwiseTo(e.ONE.shiftLeft(j),q,o.num),o.num.dAddOffset(31-o.num.mod(B).byteValue(),0),N=0,++o.pqState):o.pqState===1?o.num.bitLength()>H?o.pqState=0:o.num.isProbablePrime(p(o.num.bitLength()))?++o.pqState:o.num.dAddOffset(u[N++%8],0):o.pqState===2?o.pqState=o.num.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)===0?3:0:o.pqState===3&&(o.pqState=0,o.p===null?o.p=o.num:o.q=o.num,o.p!==null&&o.q!==null&&++o.state,o.num=null)}else if(o.state===1)o.p.compareTo(o.q)<0&&(o.num=o.p,o.p=o.q,o.q=o.num),++o.state;else if(o.state===2)o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),++o.state;else if(o.state===3)o.phi.gcd(o.e).compareTo(e.ONE)===0?++o.state:(o.p=null,o.q=null,o.state=0);else if(o.state===4)o.n=o.p.multiply(o.q),o.n.bitLength()===o.bits?++o.state:(o.q=null,o.state=0);else if(o.state===5){var W=o.e.modInverse(o.phi);o.keys={privateKey:g.rsa.setPrivateKey(o.n,o.e,W,o.p,o.q,W.mod(o.p1),W.mod(o.q1),o.q.modInverse(o.p)),publicKey:g.rsa.setPublicKey(o.n,o.e)}}F=+new Date,A+=F-I,I=F}return o.keys!==null},g.rsa.generateKeyPair=function(o,i,B,N){if(arguments.length===1?typeof o=="object"?(B=o,o=void 0):typeof o=="function"&&(N=o,o=void 0):arguments.length===2?typeof o=="number"?typeof i=="function"?(N=i,i=void 0):typeof i!="number"&&(B=i,i=void 0):(B=o,N=i,o=void 0,i=void 0):arguments.length===3&&(typeof i=="number"?typeof B=="function"&&(N=B,B=void 0):(N=B,B=i,i=void 0)),B=B||{},o===void 0&&(o=B.bits||2048),i===void 0&&(i=B.e||65537),!a.options.usePureJavaScript&&!B.prng&&o>=256&&o<=16384&&(i===65537||i===3)){if(N){if(m("generateKeyPair"))return t.generateKeyPair("rsa",{modulusLength:o,publicExponent:i,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(A,H,j){if(A)return N(A);N(null,{privateKey:g.privateKeyFromPem(j),publicKey:g.publicKeyFromPem(H)})});if(_("generateKey")&&_("exportKey"))return x.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:C(i),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(A){return x.globalScope.crypto.subtle.exportKey("pkcs8",A.privateKey)}).then(void 0,function(A){N(A)}).then(function(A){if(A){var H=g.privateKeyFromAsn1(d.fromDer(a.util.createBuffer(A)));N(null,{privateKey:H,publicKey:g.setRsaPublicKey(H.n,H.e)})}});if(w("generateKey")&&w("exportKey")){var q=x.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:o,publicExponent:C(i),hash:{name:"SHA-256"}},!0,["sign","verify"]);q.oncomplete=function(A){var H=A.target.result,j=x.globalScope.msCrypto.subtle.exportKey("pkcs8",H.privateKey);j.oncomplete=function(W){var re=W.target.result,J=g.privateKeyFromAsn1(d.fromDer(a.util.createBuffer(re)));N(null,{privateKey:J,publicKey:g.setRsaPublicKey(J.n,J.e)})},j.onerror=function(W){N(W)}},q.onerror=function(A){N(A)};return}}else if(m("generateKeyPairSync")){var I=t.generateKeyPairSync("rsa",{modulusLength:o,publicExponent:i,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:g.privateKeyFromPem(I.privateKey),publicKey:g.publicKeyFromPem(I.publicKey)}}}var F=g.rsa.createKeyPairGenerationState(o,i,B);if(!N)return g.rsa.stepKeyPairGenerationState(F,0),F.keys;y(F,B,N)},g.setRsaPublicKey=g.rsa.setPublicKey=function(o,i){var B={n:o,e:i};return B.encrypt=function(N,q,I){if(typeof q=="string"?q=q.toUpperCase():q===void 0&&(q="RSAES-PKCS1-V1_5"),q==="RSAES-PKCS1-V1_5")q={encode:function(A,H,j){return v(A,H,2).getBytes()}};else if(q==="RSA-OAEP"||q==="RSAES-OAEP")q={encode:function(A,H){return a.pkcs1.encode_rsa_oaep(H,A,I)}};else if(["RAW","NONE","NULL",null].indexOf(q)!==-1)q={encode:function(A){return A}};else if(typeof q=="string")throw new Error('Unsupported encryption scheme: "'+q+'".');var F=q.encode(N,B,!0);return g.rsa.encrypt(F,B,!0)},B.verify=function(N,q,I,F){typeof I=="string"?I=I.toUpperCase():I===void 0&&(I="RSASSA-PKCS1-V1_5"),F===void 0&&(F={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in F||(F._parseAllDigestBytes=!0),"_skipPaddingChecks"in F||(F._skipPaddingChecks=!1),I==="RSASSA-PKCS1-V1_5"?I={verify:function(H,j){j=h(j,B,!0,void 0,F);var W=d.fromDer(j,{parseAllBytes:F._parseAllDigestBytes}),re={},J=[];if(!d.validate(W,T,re,J)||W.value.length!==2){var oe=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw oe.errors=J,oe}var Q=d.derToOid(re.algorithmIdentifier);if(!(Q===a.oids.md2||Q===a.oids.md5||Q===a.oids.sha1||Q===a.oids.sha224||Q===a.oids.sha256||Q===a.oids.sha384||Q===a.oids.sha512||Q===a.oids["sha512-224"]||Q===a.oids["sha512-256"])){var oe=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw oe.oid=Q,oe}if((Q===a.oids.md2||Q===a.oids.md5)&&!("parameters"in re))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return H===re.digest}}:(I==="NONE"||I==="NULL"||I===null)&&(I={verify:function(H,j){return j=h(j,B,!0,void 0,F),H===j}});var A=g.rsa.decrypt(q,B,!0,!1);return I.verify(N,A,B.n.bitLength())},B},g.setRsaPrivateKey=g.rsa.setPrivateKey=function(o,i,B,N,q,I,F,A){var H={n:o,e:i,d:B,p:N,q,dP:I,dQ:F,qInv:A};return H.decrypt=function(j,W,re){typeof W=="string"?W=W.toUpperCase():W===void 0&&(W="RSAES-PKCS1-V1_5");var J=g.rsa.decrypt(j,H,!1,!1);if(W==="RSAES-PKCS1-V1_5")W={decode:h};else if(W==="RSA-OAEP"||W==="RSAES-OAEP")W={decode:function(oe,Q){return a.pkcs1.decode_rsa_oaep(Q,oe,re)}};else if(["RAW","NONE","NULL",null].indexOf(W)!==-1)W={decode:function(oe){return oe}};else throw new Error('Unsupported encryption scheme: "'+W+'".');return W.decode(J,H,!1)},H.sign=function(j,W){var re=!1;typeof W=="string"&&(W=W.toUpperCase()),W===void 0||W==="RSASSA-PKCS1-V1_5"?(W={encode:E},re=1):(W==="NONE"||W==="NULL"||W===null)&&(W={encode:function(){return j}},re=1);var J=W.encode(j,H.n.bitLength());return g.rsa.encrypt(J,H,re)},H},g.wrapRsaPrivateKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(g.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(o).getBytes())])},g.privateKeyFromAsn1=function(o){var i={},B=[];if(d.validate(o,r,i,B)&&(o=d.fromDer(a.util.createBuffer(i.privateKey))),i={},B=[],!d.validate(o,c,i,B)){var N=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw N.errors=B,N}var q,I,F,A,H,j,W,re;return q=a.util.createBuffer(i.privateKeyModulus).toHex(),I=a.util.createBuffer(i.privateKeyPublicExponent).toHex(),F=a.util.createBuffer(i.privateKeyPrivateExponent).toHex(),A=a.util.createBuffer(i.privateKeyPrime1).toHex(),H=a.util.createBuffer(i.privateKeyPrime2).toHex(),j=a.util.createBuffer(i.privateKeyExponent1).toHex(),W=a.util.createBuffer(i.privateKeyExponent2).toHex(),re=a.util.createBuffer(i.privateKeyCoefficient).toHex(),g.setRsaPrivateKey(new e(q,16),new e(I,16),new e(F,16),new e(A,16),new e(H,16),new e(j,16),new e(W,16),new e(re,16))},g.privateKeyToAsn1=g.privateKeyToRSAPrivateKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.qInv))])},g.publicKeyFromAsn1=function(o){var i={},B=[];if(d.validate(o,b,i,B)){var N=d.derToOid(i.publicKeyOid);if(N!==g.oids.rsaEncryption){var q=new Error("Cannot read public key. Unknown OID.");throw q.oid=N,q}o=i.rsaPublicKey}if(B=[],!d.validate(o,l,i,B)){var q=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw q.errors=B,q}var I=a.util.createBuffer(i.publicKeyModulus).toHex(),F=a.util.createBuffer(i.publicKeyExponent).toHex();return g.setRsaPublicKey(new e(I,16),new e(F,16))},g.publicKeyToAsn1=g.publicKeyToSubjectPublicKeyInfo=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(g.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[g.publicKeyToRSAPublicKey(o)])])},g.publicKeyToRSAPublicKey=function(o){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,n(o.e))])};function v(o,i,B){var N=a.util.createBuffer(),q=Math.ceil(i.n.bitLength()/8);if(o.length>q-11){var I=new Error("Message is too long for PKCS#1 v1.5 padding.");throw I.length=o.length,I.max=q-11,I}N.putByte(0),N.putByte(B);var F=q-3-o.length,A;if(B===0||B===1){A=B===0?0:255;for(var H=0;H<F;++H)N.putByte(A)}else for(;F>0;){for(var j=0,W=a.random.getBytes(F),H=0;H<F;++H)A=W.charCodeAt(H),A===0?++j:N.putByte(A);F=j}return N.putByte(0),N.putBytes(o),N}function h(o,i,B,N,q){var I=Math.ceil(i.n.bitLength()/8),F=a.util.createBuffer(o),A=F.getByte(),H=F.getByte();if(A!==0||B&&H!==0&&H!==1||!B&&H!==2||B&&H===0&&typeof N>"u")throw new Error("Encryption block is invalid.");var j=0;if(H===0){j=I-3-N;for(var W=0;W<j;++W)if(F.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(H===1){for(j=0;F.length()>1;){if(F.getByte()!==255){--F.read;break}++j}if(j<8&&!(q&&q._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(H===2){for(j=0;F.length()>1;){if(F.getByte()===0){--F.read;break}++j}if(j<8&&!(q&&q._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var re=F.getByte();if(re!==0||j!==I-3-F.length())throw new Error("Encryption block is invalid.");return F.getBytes()}function y(o,i,B){typeof i=="function"&&(B=i,i={}),i=i||{};var N={algorithm:{name:i.algorithm||"PRIMEINC",options:{workers:i.workers||2,workLoad:i.workLoad||100,workerScript:i.workerScript}}};"prng"in i&&(N.prng=i.prng),q();function q(){I(o.pBits,function(A,H){if(A)return B(A);if(o.p=H,o.q!==null)return F(A,o.q);I(o.qBits,F)})}function I(A,H){a.prime.generateProbablePrime(A,N,H)}function F(A,H){if(A)return B(A);if(o.q=H,o.p.compareTo(o.q)<0){var j=o.p;o.p=o.q,o.q=j}if(o.p.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.p=null,q();return}if(o.q.subtract(e.ONE).gcd(o.e).compareTo(e.ONE)!==0){o.q=null,I(o.qBits,F);return}if(o.p1=o.p.subtract(e.ONE),o.q1=o.q.subtract(e.ONE),o.phi=o.p1.multiply(o.q1),o.phi.gcd(o.e).compareTo(e.ONE)!==0){o.p=o.q=null,q();return}if(o.n=o.p.multiply(o.q),o.n.bitLength()!==o.bits){o.q=null,I(o.qBits,F);return}var W=o.e.modInverse(o.phi);o.keys={privateKey:g.rsa.setPrivateKey(o.n,o.e,W,o.p,o.q,W.mod(o.p1),W.mod(o.q1),o.q.modInverse(o.p)),publicKey:g.rsa.setPublicKey(o.n,o.e)},B(null,o.keys)}}function n(o){var i=o.toString(16);i[0]>="8"&&(i="00"+i);var B=a.util.hexToBytes(i);return B.length>1&&(B.charCodeAt(0)===0&&(B.charCodeAt(1)&128)===0||B.charCodeAt(0)===255&&(B.charCodeAt(1)&128)===128)?B.substr(1):B}function p(o){return o<=100?27:o<=150?18:o<=200?15:o<=250?12:o<=300?9:o<=350?8:o<=400?7:o<=500?6:o<=600?5:o<=800?4:o<=1250?3:2}function m(o){return a.util.isNodejs&&typeof t[o]=="function"}function _(o){return typeof x.globalScope<"u"&&typeof x.globalScope.crypto=="object"&&typeof x.globalScope.crypto.subtle=="object"&&typeof x.globalScope.crypto.subtle[o]=="function"}function w(o){return typeof x.globalScope<"u"&&typeof x.globalScope.msCrypto=="object"&&typeof x.globalScope.msCrypto.subtle=="object"&&typeof x.globalScope.msCrypto.subtle[o]=="function"}function C(o){for(var i=a.util.hexToBytes(o.toString(16)),B=new Uint8Array(i.length),N=0;N<i.length;++N)B[N]=i.charCodeAt(N);return B}return Ur}var Pr,Ga;function Wa(){if(Ga)return Pr;Ga=1;var a=me();if(yt(),ft(),qt(),ct(),mt(),wr(),xt(),at(),Oa(),jt(),Ee(),typeof e>"u")var e=a.jsbn.BigInteger;var t=a.asn1,d=a.pki=a.pki||{};Pr=d.pbe=a.pbe=a.pbe||{};var x=d.oids,g={name:"EncryptedPrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},r={name:"pkcs-12PbeParams",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"iterations"}]};d.encryptPrivateKeyInfo=function(E,s,v){v=v||{},v.saltSize=v.saltSize||8,v.count=v.count||2048,v.algorithm=v.algorithm||"aes128",v.prfAlgorithm=v.prfAlgorithm||"sha1";var h=a.random.getBytesSync(v.saltSize),y=v.count,n=t.integerToDer(y),p,m,_;if(v.algorithm.indexOf("aes")===0||v.algorithm==="des"){var w,C,o;switch(v.algorithm){case"aes128":p=16,w=16,C=x["aes128-CBC"],o=a.aes.createEncryptionCipher;break;case"aes192":p=24,w=16,C=x["aes192-CBC"],o=a.aes.createEncryptionCipher;break;case"aes256":p=32,w=16,C=x["aes256-CBC"],o=a.aes.createEncryptionCipher;break;case"des":p=8,w=8,C=x.desCBC,o=a.des.createEncryptionCipher;break;default:var i=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw i.algorithm=v.algorithm,i}var B="hmacWith"+v.prfAlgorithm.toUpperCase(),N=b(B),q=a.pkcs5.pbkdf2(s,h,y,p,N),I=a.random.getBytesSync(w),F=o(q);F.start(I),F.update(t.toDer(E)),F.finish(),_=F.output.getBytes();var A=T(h,n,p,B);m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x.pkcs5PBES2).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x.pkcs5PBKDF2).getBytes()),A]),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(C).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,I)])])])}else if(v.algorithm==="3des"){p=24;var H=new a.util.ByteBuffer(h),q=d.pbe.generatePkcs12Key(s,H,1,y,p),I=d.pbe.generatePkcs12Key(s,H,2,y,p),F=a.des.createEncryptionCipher(q);F.start(I),F.update(t.toDer(E)),F.finish(),_=F.output.getBytes(),m=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(x["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,h),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,n.getBytes())])])}else{var i=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw i.algorithm=v.algorithm,i}var j=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[m,t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,_)]);return j},d.decryptPrivateKeyInfo=function(E,s){var v=null,h={},y=[];if(!t.validate(E,g,h,y)){var n=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}var p=t.derToOid(h.encryptionOid),m=d.pbe.getCipher(p,h.encryptionParams,s),_=a.util.createBuffer(h.encryptedData);return m.update(_),m.finish()&&(v=t.fromDer(m.output)),v},d.encryptedPrivateKeyToPem=function(E,s){var v={type:"ENCRYPTED PRIVATE KEY",body:t.toDer(E).getBytes()};return a.pem.encode(v,{maxline:s})},d.encryptedPrivateKeyFromPem=function(E){var s=a.pem.decode(E)[0];if(s.type!=="ENCRYPTED PRIVATE KEY"){var v=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw v.headerType=s.type,v}if(s.procType&&s.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return t.fromDer(s.body)},d.encryptRsaPrivateKey=function(E,s,v){if(v=v||{},!v.legacy){var h=d.wrapRsaPrivateKey(d.privateKeyToAsn1(E));return h=d.encryptPrivateKeyInfo(h,s,v),d.encryptedPrivateKeyToPem(h)}var y,n,p,m;switch(v.algorithm){case"aes128":y="AES-128-CBC",p=16,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"aes192":y="AES-192-CBC",p=24,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"aes256":y="AES-256-CBC",p=32,n=a.random.getBytesSync(16),m=a.aes.createEncryptionCipher;break;case"3des":y="DES-EDE3-CBC",p=24,n=a.random.getBytesSync(8),m=a.des.createEncryptionCipher;break;case"des":y="DES-CBC",p=8,n=a.random.getBytesSync(8),m=a.des.createEncryptionCipher;break;default:var _=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+v.algorithm+'".');throw _.algorithm=v.algorithm,_}var w=a.pbe.opensslDeriveBytes(s,n.substr(0,8),p),C=m(w);C.start(n),C.update(t.toDer(d.privateKeyToAsn1(E))),C.finish();var o={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:y,parameters:a.util.bytesToHex(n).toUpperCase()},body:C.output.getBytes()};return a.pem.encode(o)},d.decryptRsaPrivateKey=function(E,s){var v=null,h=a.pem.decode(E)[0];if(h.type!=="ENCRYPTED PRIVATE KEY"&&h.type!=="PRIVATE KEY"&&h.type!=="RSA PRIVATE KEY"){var y=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw y.headerType=y,y}if(h.procType&&h.procType.type==="ENCRYPTED"){var n,p;switch(h.dekInfo.algorithm){case"DES-CBC":n=8,p=a.des.createDecryptionCipher;break;case"DES-EDE3-CBC":n=24,p=a.des.createDecryptionCipher;break;case"AES-128-CBC":n=16,p=a.aes.createDecryptionCipher;break;case"AES-192-CBC":n=24,p=a.aes.createDecryptionCipher;break;case"AES-256-CBC":n=32,p=a.aes.createDecryptionCipher;break;case"RC2-40-CBC":n=5,p=function(o){return a.rc2.createDecryptionCipher(o,40)};break;case"RC2-64-CBC":n=8,p=function(o){return a.rc2.createDecryptionCipher(o,64)};break;case"RC2-128-CBC":n=16,p=function(o){return a.rc2.createDecryptionCipher(o,128)};break;default:var y=new Error('Could not decrypt private key; unsupported encryption algorithm "'+h.dekInfo.algorithm+'".');throw y.algorithm=h.dekInfo.algorithm,y}var m=a.util.hexToBytes(h.dekInfo.parameters),_=a.pbe.opensslDeriveBytes(s,m.substr(0,8),n),w=p(_);if(w.start(m),w.update(a.util.createBuffer(h.body)),w.finish())v=w.output.getBytes();else return v}else v=h.body;return h.type==="ENCRYPTED PRIVATE KEY"?v=d.decryptPrivateKeyInfo(t.fromDer(v),s):v=t.fromDer(v),v!==null&&(v=d.privateKeyFromAsn1(v)),v},d.pbe.generatePkcs12Key=function(E,s,v,h,y,n){var p,m;if(typeof n>"u"||n===null){if(!("sha1"in a.md))throw new Error('"sha1" hash algorithm unavailable.');n=a.md.sha1.create()}var _=n.digestLength,w=n.blockLength,C=new a.util.ByteBuffer,o=new a.util.ByteBuffer;if(E!=null){for(m=0;m<E.length;m++)o.putInt16(E.charCodeAt(m));o.putInt16(0)}var i=o.length(),B=s.length(),N=new a.util.ByteBuffer;N.fillWithByte(v,w);var q=w*Math.ceil(B/w),I=new a.util.ByteBuffer;for(m=0;m<q;m++)I.putByte(s.at(m%B));var F=w*Math.ceil(i/w),A=new a.util.ByteBuffer;for(m=0;m<F;m++)A.putByte(o.at(m%i));var H=I;H.putBuffer(A);for(var j=Math.ceil(y/_),W=1;W<=j;W++){var re=new a.util.ByteBuffer;re.putBytes(N.bytes()),re.putBytes(H.bytes());for(var J=0;J<h;J++)n.start(),n.update(re.getBytes()),re=n.digest();var oe=new a.util.ByteBuffer;for(m=0;m<w;m++)oe.putByte(re.at(m%_));var Q=Math.ceil(B/w)+Math.ceil(i/w),$=new a.util.ByteBuffer;for(p=0;p<Q;p++){var ce=new a.util.ByteBuffer(H.getBytes(w)),ie=511;for(m=oe.length()-1;m>=0;m--)ie=ie>>8,ie+=oe.at(m)+ce.at(m),ce.setAt(m,ie&255);$.putBuffer(ce)}H=$,C.putBuffer(re)}return C.truncate(C.length()-y),C},d.pbe.getCipher=function(E,s,v){switch(E){case d.oids.pkcs5PBES2:return d.pbe.getCipherForPBES2(E,s,v);case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case d.oids["pbewithSHAAnd40BitRC2-CBC"]:return d.pbe.getCipherForPKCS12PBE(E,s,v);default:var h=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw h.oid=E,h.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],h}},d.pbe.getCipherForPBES2=function(E,s,v){var h={},y=[];if(!t.validate(s,u,h,y)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}if(E=t.derToOid(h.kdfOid),E!==d.oids.pkcs5PBKDF2){var n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw n.oid=E,n.supportedOids=["pkcs5PBKDF2"],n}if(E=t.derToOid(h.encOid),E!==d.oids["aes128-CBC"]&&E!==d.oids["aes192-CBC"]&&E!==d.oids["aes256-CBC"]&&E!==d.oids["des-EDE3-CBC"]&&E!==d.oids.desCBC){var n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw n.oid=E,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n}var p=h.kdfSalt,m=a.util.createBuffer(h.kdfIterationCount);m=m.getInt(m.length()<<3);var _,w;switch(d.oids[E]){case"aes128-CBC":_=16,w=a.aes.createDecryptionCipher;break;case"aes192-CBC":_=24,w=a.aes.createDecryptionCipher;break;case"aes256-CBC":_=32,w=a.aes.createDecryptionCipher;break;case"des-EDE3-CBC":_=24,w=a.des.createDecryptionCipher;break;case"desCBC":_=8,w=a.des.createDecryptionCipher;break}var C=l(h.prfOid),o=a.pkcs5.pbkdf2(v,p,m,_,C),i=h.encIv,B=w(o);return B.start(i),B},d.pbe.getCipherForPKCS12PBE=function(E,s,v){var h={},y=[];if(!t.validate(s,r,h,y)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=y,n}var p=a.util.createBuffer(h.salt),m=a.util.createBuffer(h.iterations);m=m.getInt(m.length()<<3);var _,w,C;switch(E){case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:_=24,w=8,C=a.des.startDecrypting;break;case d.oids["pbewithSHAAnd40BitRC2-CBC"]:_=5,w=8,C=function(q,I){var F=a.rc2.createDecryptionCipher(q,40);return F.start(I,null),F};break;default:var n=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw n.oid=E,n}var o=l(h.prfOid),i=d.pbe.generatePkcs12Key(v,p,1,m,_,o);o.start();var B=d.pbe.generatePkcs12Key(v,p,2,m,w,o);return C(i,B)},d.pbe.opensslDeriveBytes=function(E,s,v,h){if(typeof h>"u"||h===null){if(!("md5"in a.md))throw new Error('"md5" hash algorithm unavailable.');h=a.md.md5.create()}s===null&&(s="");for(var y=[c(h,E+s)],n=16,p=1;n<v;++p,n+=16)y.push(c(h,y[p-1]+E+s));return y.join("").substr(0,v)};function c(E,s){return E.start().update(s).digest().getBytes()}function l(E){var s;if(!E)s="hmacWithSHA1";else if(s=d.oids[t.derToOid(E)],!s){var v=new Error("Unsupported PRF OID.");throw v.oid=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}return b(s)}function b(E){var s=a.md;switch(E){case"hmacWithSHA224":s=a.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var v=new Error("Unsupported PRF algorithm.");throw v.algorithm=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}if(!s||!(E in s))throw new Error("Unknown hash algorithm: "+E);return s[E].create()}function T(E,s,v,h){var y=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,E),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,s.getBytes())]);return h!=="hmacWithSHA1"&&y.value.push(t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,a.util.hexToBytes(v.toString(16))),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(d.oids[h]).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")])),y}return Pr}var Or={exports:{}},Fr={exports:{}},ja;function Qa(){if(ja)return Fr.exports;ja=1;var a=me();ft(),Ee();var e=a.asn1,t=Fr.exports=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=a.pkcs7||{},a.pkcs7.asn1=t;var d={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};t.contentInfoValidator=d;var x={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};t.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(x)},t.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(x)};var g={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return t.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},d,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[g]}]},t.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},Fr.exports}var Vr={exports:{}},Mr={exports:{}},Ya;function Za(){if(Ya)return Mr.exports;Ya=1;var a=me();Ee(),a.mgf=a.mgf||{};var e=Mr.exports=a.mgf.mgf1=a.mgf1=a.mgf1||{};return e.create=function(t){var d={generate:function(x,g){for(var u=new a.util.ByteBuffer,r=Math.ceil(g/t.digestLength),c=0;c<r;c++){var l=new a.util.ByteBuffer;l.putInt32(c),t.start(),t.update(x+l.getBytes()),u.putBuffer(t.digest())}return u.truncate(u.length()-g),u.getBytes()}};return d},Mr.exports}var Kr,Xa;function yi(){if(Xa)return Kr;Xa=1;var a=me();return Za(),Kr=a.mgf=a.mgf||{},a.mgf.mgf1=a.mgf1,Kr}var zr={exports:{}},$a;function qr(){if($a)return zr.exports;$a=1;var a=me();at(),Ee();var e=zr.exports=a.pss=a.pss||{};return e.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var d=t.md,x=t.mgf,g=d.digestLength,u=t.salt||null;typeof u=="string"&&(u=a.util.createBuffer(u));var r;if("saltLength"in t)r=t.saltLength;else if(u!==null)r=u.length();else throw new Error("Salt length not specified or specific salt not given.");if(u!==null&&u.length()!==r)throw new Error("Given salt length does not match length of given salt.");var c=t.prng||a.random,l={};return l.encode=function(b,T){var E,s=T-1,v=Math.ceil(s/8),h=b.digest().getBytes();if(v<g+r+2)throw new Error("Message is too long to encrypt.");var y;u===null?y=c.getBytesSync(r):y=u.bytes();var n=new a.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(h),n.putBytes(y),d.start(),d.update(n.getBytes());var p=d.digest().getBytes(),m=new a.util.ByteBuffer;m.fillWithByte(0,v-r-g-2),m.putByte(1),m.putBytes(y);var _=m.getBytes(),w=v-g-1,C=x.generate(p,w),o="";for(E=0;E<w;E++)o+=String.fromCharCode(_.charCodeAt(E)^C.charCodeAt(E));var i=65280>>8*v-s&255;return o=String.fromCharCode(o.charCodeAt(0)&~i)+o.substr(1),o+p+"¼"},l.verify=function(b,T,E){var s,v=E-1,h=Math.ceil(v/8);if(T=T.substr(-h),h<g+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(T.charCodeAt(h-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=h-g-1,n=T.substr(0,y),p=T.substr(y,g),m=65280>>8*h-v&255;if((n.charCodeAt(0)&m)!==0)throw new Error("Bits beyond keysize not zero as expected.");var _=x.generate(p,y),w="";for(s=0;s<y;s++)w+=String.fromCharCode(n.charCodeAt(s)^_.charCodeAt(s));w=String.fromCharCode(w.charCodeAt(0)&~m)+w.substr(1);var C=h-g-r-2;for(s=0;s<C;s++)if(w.charCodeAt(s)!==0)throw new Error("Leftmost octets not zero as expected");if(w.charCodeAt(C)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var o=w.substr(-r),i=new a.util.ByteBuffer;i.fillWithByte(0,8),i.putBytes(b),i.putBytes(o),d.start(),d.update(i.getBytes());var B=d.digest().getBytes();return p===B},l},zr.exports}var Ja;function Hr(){if(Ja)return Vr.exports;Ja=1;var a=me();yt(),ft(),qt(),ct(),yi(),mt(),xt(),qr(),jt(),Ee();var e=a.asn1,t=Vr.exports=a.pki=a.pki||{},d=t.oids,x={};x.CN=d.commonName,x.commonName="CN",x.C=d.countryName,x.countryName="C",x.L=d.localityName,x.localityName="L",x.ST=d.stateOrProvinceName,x.stateOrProvinceName="ST",x.O=d.organizationName,x.organizationName="O",x.OU=d.organizationalUnitName,x.organizationalUnitName="OU",x.E=d.emailAddress,x.emailAddress="E";var g=a.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},g,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},r={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},g,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};t.RDNAttributesAsArray=function(C,o){for(var i=[],B,N,q,I=0;I<C.value.length;++I){B=C.value[I];for(var F=0;F<B.value.length;++F)q={},N=B.value[F],q.type=e.derToOid(N.value[0].value),q.value=N.value[1].value,q.valueTagClass=N.value[1].type,q.type in d&&(q.name=d[q.type],q.name in x&&(q.shortName=x[q.name])),o&&(o.update(q.type),o.update(q.value)),i.push(q)}return i},t.CRIAttributesAsArray=function(C){for(var o=[],i=0;i<C.length;++i)for(var B=C[i],N=e.derToOid(B.value[0].value),q=B.value[1].value,I=0;I<q.length;++I){var F={};if(F.type=N,F.value=q[I].value,F.valueTagClass=q[I].type,F.type in d&&(F.name=d[F.type],F.name in x&&(F.shortName=x[F.name])),F.type===d.extensionRequest){F.extensions=[];for(var A=0;A<F.value.length;++A)F.extensions.push(t.certificateExtensionFromAsn1(F.value[A]))}o.push(F)}return o};function b(C,o){typeof o=="string"&&(o={shortName:o});for(var i=null,B,N=0;i===null&&N<C.attributes.length;++N)B=C.attributes[N],(o.type&&o.type===B.type||o.name&&o.name===B.name||o.shortName&&o.shortName===B.shortName)&&(i=B);return i}var T=function(C,o,i){var B={};if(C!==d["RSASSA-PSS"])return B;i&&(B={hash:{algorithmOid:d.sha1},mgf:{algorithmOid:d.mgf1,hash:{algorithmOid:d.sha1}},saltLength:20});var N={},q=[];if(!e.validate(o,r,N,q)){var I=new Error("Cannot read RSASSA-PSS parameter block.");throw I.errors=q,I}return N.hashOid!==void 0&&(B.hash=B.hash||{},B.hash.algorithmOid=e.derToOid(N.hashOid)),N.maskGenOid!==void 0&&(B.mgf=B.mgf||{},B.mgf.algorithmOid=e.derToOid(N.maskGenOid),B.mgf.hash=B.mgf.hash||{},B.mgf.hash.algorithmOid=e.derToOid(N.maskGenHashOid)),N.saltLength!==void 0&&(B.saltLength=N.saltLength.charCodeAt(0)),B},E=function(C){switch(d[C.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return a.md.sha1.create();case"md5WithRSAEncryption":return a.md.md5.create();case"sha256WithRSAEncryption":return a.md.sha256.create();case"sha384WithRSAEncryption":return a.md.sha384.create();case"sha512WithRSAEncryption":return a.md.sha512.create();case"RSASSA-PSS":return a.md.sha256.create();default:var o=new Error("Could not compute "+C.type+" digest. Unknown signature OID.");throw o.signatureOid=C.signatureOid,o}},s=function(C){var o=C.certificate,i;switch(o.signatureOid){case d.sha1WithRSAEncryption:case d.sha1WithRSASignature:break;case d["RSASSA-PSS"]:var B,N;if(B=d[o.signatureParameters.mgf.hash.algorithmOid],B===void 0||a.md[B]===void 0){var q=new Error("Unsupported MGF hash function.");throw q.oid=o.signatureParameters.mgf.hash.algorithmOid,q.name=B,q}if(N=d[o.signatureParameters.mgf.algorithmOid],N===void 0||a.mgf[N]===void 0){var q=new Error("Unsupported MGF function.");throw q.oid=o.signatureParameters.mgf.algorithmOid,q.name=N,q}if(N=a.mgf[N].create(a.md[B].create()),B=d[o.signatureParameters.hash.algorithmOid],B===void 0||a.md[B]===void 0){var q=new Error("Unsupported RSASSA-PSS hash function.");throw q.oid=o.signatureParameters.hash.algorithmOid,q.name=B,q}i=a.pss.create(a.md[B].create(),N,o.signatureParameters.saltLength);break}return o.publicKey.verify(C.md.digest().getBytes(),C.signature,i)};t.certificateFromPem=function(C,o,i){var B=a.pem.decode(C)[0];if(B.type!=="CERTIFICATE"&&B.type!=="X509 CERTIFICATE"&&B.type!=="TRUSTED CERTIFICATE"){var N=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw N.headerType=B.type,N}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var q=e.fromDer(B.body,i);return t.certificateFromAsn1(q,o)},t.certificateToPem=function(C,o){var i={type:"CERTIFICATE",body:e.toDer(t.certificateToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.publicKeyFromPem=function(C){var o=a.pem.decode(C)[0];if(o.type!=="PUBLIC KEY"&&o.type!=="RSA PUBLIC KEY"){var i=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw i.headerType=o.type,i}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var B=e.fromDer(o.body);return t.publicKeyFromAsn1(B)},t.publicKeyToPem=function(C,o){var i={type:"PUBLIC KEY",body:e.toDer(t.publicKeyToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.publicKeyToRSAPublicKeyPem=function(C,o){var i={type:"RSA PUBLIC KEY",body:e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.getPublicKeyFingerprint=function(C,o){o=o||{};var i=o.md||a.md.sha1.create(),B=o.type||"RSAPublicKey",N;switch(B){case"RSAPublicKey":N=e.toDer(t.publicKeyToRSAPublicKey(C)).getBytes();break;case"SubjectPublicKeyInfo":N=e.toDer(t.publicKeyToAsn1(C)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+o.type+'".')}i.start(),i.update(N);var q=i.digest();if(o.encoding==="hex"){var I=q.toHex();return o.delimiter?I.match(/.{2}/g).join(o.delimiter):I}else{if(o.encoding==="binary")return q.getBytes();if(o.encoding)throw new Error('Unknown encoding "'+o.encoding+'".')}return q},t.certificationRequestFromPem=function(C,o,i){var B=a.pem.decode(C)[0];if(B.type!=="CERTIFICATE REQUEST"){var N=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw N.headerType=B.type,N}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var q=e.fromDer(B.body,i);return t.certificationRequestFromAsn1(q,o)},t.certificationRequestToPem=function(C,o){var i={type:"CERTIFICATE REQUEST",body:e.toDer(t.certificationRequestToAsn1(C)).getBytes()};return a.pem.encode(i,{maxline:o})},t.createCertificate=function(){var C={};return C.version=2,C.serialNumber="00",C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.validity={},C.validity.notBefore=new Date,C.validity.notAfter=new Date,C.issuer={},C.issuer.getField=function(o){return b(C.issuer,o)},C.issuer.addField=function(o){h([o]),C.issuer.attributes.push(o)},C.issuer.attributes=[],C.issuer.hash=null,C.subject={},C.subject.getField=function(o){return b(C.subject,o)},C.subject.addField=function(o){h([o]),C.subject.attributes.push(o)},C.subject.attributes=[],C.subject.hash=null,C.extensions=[],C.publicKey=null,C.md=null,C.setSubject=function(o,i){h(o),C.subject.attributes=o,delete C.subject.uniqueId,i&&(C.subject.uniqueId=i),C.subject.hash=null},C.setIssuer=function(o,i){h(o),C.issuer.attributes=o,delete C.issuer.uniqueId,i&&(C.issuer.uniqueId=i),C.issuer.hash=null},C.setExtensions=function(o){for(var i=0;i<o.length;++i)y(o[i],{cert:C});C.extensions=o},C.getExtension=function(o){typeof o=="string"&&(o={name:o});for(var i=null,B,N=0;i===null&&N<C.extensions.length;++N)B=C.extensions[N],(o.id&&B.id===o.id||o.name&&B.name===o.name)&&(i=B);return i},C.sign=function(o,i){C.md=i||a.md.sha1.create();var B=d[C.md.algorithm+"WithRSAEncryption"];if(!B){var N=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw N.algorithm=C.md.algorithm,N}C.signatureOid=C.siginfo.algorithmOid=B,C.tbsCertificate=t.getTBSCertificate(C);var q=e.toDer(C.tbsCertificate);C.md.update(q.getBytes()),C.signature=o.sign(C.md)},C.verify=function(o){var i=!1;if(!C.issued(o)){var B=o.issuer,N=C.subject,q=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw q.expectedIssuer=N.attributes,q.actualIssuer=B.attributes,q}var I=o.md;if(I===null){I=E({signatureOid:o.signatureOid,type:"certificate"});var F=o.tbsCertificate||t.getTBSCertificate(o),A=e.toDer(F);I.update(A.getBytes())}return I!==null&&(i=s({certificate:C,md:I,signature:o.signature})),i},C.isIssuer=function(o){var i=!1,B=C.issuer,N=o.subject;if(B.hash&&N.hash)i=B.hash===N.hash;else if(B.attributes.length===N.attributes.length){i=!0;for(var q,I,F=0;i&&F<B.attributes.length;++F)q=B.attributes[F],I=N.attributes[F],(q.type!==I.type||q.value!==I.value)&&(i=!1)}return i},C.issued=function(o){return o.isIssuer(C)},C.generateSubjectKeyIdentifier=function(){return t.getPublicKeyFingerprint(C.publicKey,{type:"RSAPublicKey"})},C.verifySubjectKeyIdentifier=function(){for(var o=d.subjectKeyIdentifier,i=0;i<C.extensions.length;++i){var B=C.extensions[i];if(B.id===o){var N=C.generateSubjectKeyIdentifier().getBytes();return a.util.hexToBytes(B.subjectKeyIdentifier)===N}}return!1},C},t.certificateFromAsn1=function(C,o){var i={},B=[];if(!e.validate(C,u,i,B)){var N=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw N.errors=B,N}var q=e.derToOid(i.publicKeyOid);if(q!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var I=t.createCertificate();I.version=i.certVersion?i.certVersion.charCodeAt(0):0;var F=a.util.createBuffer(i.certSerialNumber);I.serialNumber=F.toHex(),I.signatureOid=a.asn1.derToOid(i.certSignatureOid),I.signatureParameters=T(I.signatureOid,i.certSignatureParams,!0),I.siginfo.algorithmOid=a.asn1.derToOid(i.certinfoSignatureOid),I.siginfo.parameters=T(I.siginfo.algorithmOid,i.certinfoSignatureParams,!1),I.signature=i.certSignature;var A=[];if(i.certValidity1UTCTime!==void 0&&A.push(e.utcTimeToDate(i.certValidity1UTCTime)),i.certValidity2GeneralizedTime!==void 0&&A.push(e.generalizedTimeToDate(i.certValidity2GeneralizedTime)),i.certValidity3UTCTime!==void 0&&A.push(e.utcTimeToDate(i.certValidity3UTCTime)),i.certValidity4GeneralizedTime!==void 0&&A.push(e.generalizedTimeToDate(i.certValidity4GeneralizedTime)),A.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(A.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(I.validity.notBefore=A[0],I.validity.notAfter=A[1],I.tbsCertificate=i.tbsCertificate,o){I.md=E({signatureOid:I.signatureOid,type:"certificate"});var H=e.toDer(I.tbsCertificate);I.md.update(H.getBytes())}var j=a.md.sha1.create(),W=e.toDer(i.certIssuer);j.update(W.getBytes()),I.issuer.getField=function(oe){return b(I.issuer,oe)},I.issuer.addField=function(oe){h([oe]),I.issuer.attributes.push(oe)},I.issuer.attributes=t.RDNAttributesAsArray(i.certIssuer),i.certIssuerUniqueId&&(I.issuer.uniqueId=i.certIssuerUniqueId),I.issuer.hash=j.digest().toHex();var re=a.md.sha1.create(),J=e.toDer(i.certSubject);return re.update(J.getBytes()),I.subject.getField=function(oe){return b(I.subject,oe)},I.subject.addField=function(oe){h([oe]),I.subject.attributes.push(oe)},I.subject.attributes=t.RDNAttributesAsArray(i.certSubject),i.certSubjectUniqueId&&(I.subject.uniqueId=i.certSubjectUniqueId),I.subject.hash=re.digest().toHex(),i.certExtensions?I.extensions=t.certificateExtensionsFromAsn1(i.certExtensions):I.extensions=[],I.publicKey=t.publicKeyFromAsn1(i.subjectPublicKeyInfo),I},t.certificateExtensionsFromAsn1=function(C){for(var o=[],i=0;i<C.value.length;++i)for(var B=C.value[i],N=0;N<B.value.length;++N)o.push(t.certificateExtensionFromAsn1(B.value[N]));return o},t.certificateExtensionFromAsn1=function(C){var o={};if(o.id=e.derToOid(C.value[0].value),o.critical=!1,C.value[1].type===e.Type.BOOLEAN?(o.critical=C.value[1].value.charCodeAt(0)!==0,o.value=C.value[2].value):o.value=C.value[1].value,o.id in d){if(o.name=d[o.id],o.name==="keyUsage"){var i=e.fromDer(o.value),B=0,N=0;i.value.length>1&&(B=i.value.charCodeAt(1),N=i.value.length>2?i.value.charCodeAt(2):0),o.digitalSignature=(B&128)===128,o.nonRepudiation=(B&64)===64,o.keyEncipherment=(B&32)===32,o.dataEncipherment=(B&16)===16,o.keyAgreement=(B&8)===8,o.keyCertSign=(B&4)===4,o.cRLSign=(B&2)===2,o.encipherOnly=(B&1)===1,o.decipherOnly=(N&128)===128}else if(o.name==="basicConstraints"){var i=e.fromDer(o.value);i.value.length>0&&i.value[0].type===e.Type.BOOLEAN?o.cA=i.value[0].value.charCodeAt(0)!==0:o.cA=!1;var q=null;i.value.length>0&&i.value[0].type===e.Type.INTEGER?q=i.value[0].value:i.value.length>1&&(q=i.value[1].value),q!==null&&(o.pathLenConstraint=e.derToInteger(q))}else if(o.name==="extKeyUsage")for(var i=e.fromDer(o.value),I=0;I<i.value.length;++I){var F=e.derToOid(i.value[I].value);F in d?o[d[F]]=!0:o[F]=!0}else if(o.name==="nsCertType"){var i=e.fromDer(o.value),B=0;i.value.length>1&&(B=i.value.charCodeAt(1)),o.client=(B&128)===128,o.server=(B&64)===64,o.email=(B&32)===32,o.objsign=(B&16)===16,o.reserved=(B&8)===8,o.sslCA=(B&4)===4,o.emailCA=(B&2)===2,o.objCA=(B&1)===1}else if(o.name==="subjectAltName"||o.name==="issuerAltName"){o.altNames=[];for(var A,i=e.fromDer(o.value),H=0;H<i.value.length;++H){A=i.value[H];var j={type:A.type,value:A.value};switch(o.altNames.push(j),A.type){case 1:case 2:case 6:break;case 7:j.ip=a.util.bytesToIP(A.value);break;case 8:j.oid=e.derToOid(A.value);break}}}else if(o.name==="subjectKeyIdentifier"){var i=e.fromDer(o.value);o.subjectKeyIdentifier=a.util.bytesToHex(i.value)}}return o},t.certificationRequestFromAsn1=function(C,o){var i={},B=[];if(!e.validate(C,l,i,B)){var N=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw N.errors=B,N}var q=e.derToOid(i.publicKeyOid);if(q!==t.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var I=t.createCertificationRequest();if(I.version=i.csrVersion?i.csrVersion.charCodeAt(0):0,I.signatureOid=a.asn1.derToOid(i.csrSignatureOid),I.signatureParameters=T(I.signatureOid,i.csrSignatureParams,!0),I.siginfo.algorithmOid=a.asn1.derToOid(i.csrSignatureOid),I.siginfo.parameters=T(I.siginfo.algorithmOid,i.csrSignatureParams,!1),I.signature=i.csrSignature,I.certificationRequestInfo=i.certificationRequestInfo,o){I.md=E({signatureOid:I.signatureOid,type:"certification request"});var F=e.toDer(I.certificationRequestInfo);I.md.update(F.getBytes())}var A=a.md.sha1.create();return I.subject.getField=function(H){return b(I.subject,H)},I.subject.addField=function(H){h([H]),I.subject.attributes.push(H)},I.subject.attributes=t.RDNAttributesAsArray(i.certificationRequestInfoSubject,A),I.subject.hash=A.digest().toHex(),I.publicKey=t.publicKeyFromAsn1(i.subjectPublicKeyInfo),I.getAttribute=function(H){return b(I,H)},I.addAttribute=function(H){h([H]),I.attributes.push(H)},I.attributes=t.CRIAttributesAsArray(i.certificationRequestInfoAttributes||[]),I},t.createCertificationRequest=function(){var C={};return C.version=0,C.signatureOid=null,C.signature=null,C.siginfo={},C.siginfo.algorithmOid=null,C.subject={},C.subject.getField=function(o){return b(C.subject,o)},C.subject.addField=function(o){h([o]),C.subject.attributes.push(o)},C.subject.attributes=[],C.subject.hash=null,C.publicKey=null,C.attributes=[],C.getAttribute=function(o){return b(C,o)},C.addAttribute=function(o){h([o]),C.attributes.push(o)},C.md=null,C.setSubject=function(o){h(o),C.subject.attributes=o,C.subject.hash=null},C.setAttributes=function(o){h(o),C.attributes=o},C.sign=function(o,i){C.md=i||a.md.sha1.create();var B=d[C.md.algorithm+"WithRSAEncryption"];if(!B){var N=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw N.algorithm=C.md.algorithm,N}C.signatureOid=C.siginfo.algorithmOid=B,C.certificationRequestInfo=t.getCertificationRequestInfo(C);var q=e.toDer(C.certificationRequestInfo);C.md.update(q.getBytes()),C.signature=o.sign(C.md)},C.verify=function(){var o=!1,i=C.md;if(i===null){i=E({signatureOid:C.signatureOid,type:"certification request"});var B=C.certificationRequestInfo||t.getCertificationRequestInfo(C),N=e.toDer(B);i.update(N.getBytes())}return i!==null&&(o=s({certificate:C,md:i,signature:C.signature})),o},C};function v(C){for(var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),i,B,N=C.attributes,q=0;q<N.length;++q){i=N[q];var I=i.value,F=e.Type.PRINTABLESTRING;"valueTagClass"in i&&(F=i.valueTagClass,F===e.Type.UTF8&&(I=a.util.encodeUtf8(I))),B=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.type).getBytes()),e.create(e.Class.UNIVERSAL,F,!1,I)])]),o.value.push(B)}return o}function h(C){for(var o,i=0;i<C.length;++i){if(o=C[i],typeof o.name>"u"&&(o.type&&o.type in t.oids?o.name=t.oids[o.type]:o.shortName&&o.shortName in x&&(o.name=t.oids[x[o.shortName]])),typeof o.type>"u")if(o.name&&o.name in t.oids)o.type=t.oids[o.name];else{var B=new Error("Attribute type not specified.");throw B.attribute=o,B}if(typeof o.shortName>"u"&&o.name&&o.name in x&&(o.shortName=x[o.name]),o.type===d.extensionRequest&&(o.valueConstructed=!0,o.valueTagClass=e.Type.SEQUENCE,!o.value&&o.extensions)){o.value=[];for(var N=0;N<o.extensions.length;++N)o.value.push(t.certificateExtensionToAsn1(y(o.extensions[N])))}if(typeof o.value>"u"){var B=new Error("Attribute value not specified.");throw B.attribute=o,B}}}function y(C,o){if(o=o||{},typeof C.name>"u"&&C.id&&C.id in t.oids&&(C.name=t.oids[C.id]),typeof C.id>"u")if(C.name&&C.name in t.oids)C.id=t.oids[C.name];else{var i=new Error("Extension ID not specified.");throw i.extension=C,i}if(typeof C.value<"u")return C;if(C.name==="keyUsage"){var B=0,N=0,q=0;C.digitalSignature&&(N|=128,B=7),C.nonRepudiation&&(N|=64,B=6),C.keyEncipherment&&(N|=32,B=5),C.dataEncipherment&&(N|=16,B=4),C.keyAgreement&&(N|=8,B=3),C.keyCertSign&&(N|=4,B=2),C.cRLSign&&(N|=2,B=1),C.encipherOnly&&(N|=1,B=0),C.decipherOnly&&(q|=128,B=7);var I=String.fromCharCode(B);q!==0?I+=String.fromCharCode(N)+String.fromCharCode(q):N!==0&&(I+=String.fromCharCode(N)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,I)}else if(C.name==="basicConstraints")C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),C.cA&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in C&&C.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.pathLenConstraint).getBytes()));else if(C.name==="extKeyUsage"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=C.value.value;for(var A in C)C[A]===!0&&(A in d?F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d[A]).getBytes())):A.indexOf(".")!==-1&&F.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(A).getBytes())))}else if(C.name==="nsCertType"){var B=0,N=0;C.client&&(N|=128,B=7),C.server&&(N|=64,B=6),C.email&&(N|=32,B=5),C.objsign&&(N|=16,B=4),C.reserved&&(N|=8,B=3),C.sslCA&&(N|=4,B=2),C.emailCA&&(N|=2,B=1),C.objCA&&(N|=1,B=0);var I=String.fromCharCode(B);N!==0&&(I+=String.fromCharCode(N)),C.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,I)}else if(C.name==="subjectAltName"||C.name==="issuerAltName"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var H,j=0;j<C.altNames.length;++j){H=C.altNames[j];var I=H.value;if(H.type===7&&H.ip){if(I=a.util.bytesFromIP(H.ip),I===null){var i=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw i.extension=C,i}}else H.type===8&&(H.oid?I=e.oidToDer(e.oidToDer(H.oid)):I=e.oidToDer(I));C.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,H.type,!1,I))}}else if(C.name==="nsComment"&&o.cert){if(!/^[\x00-\x7F]*$/.test(C.comment)||C.comment.length<1||C.comment.length>128)throw new Error('Invalid "nsComment" content.');C.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,C.comment)}else if(C.name==="subjectKeyIdentifier"&&o.cert){var W=o.cert.generateSubjectKeyIdentifier();C.subjectKeyIdentifier=W.toHex(),C.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,W.getBytes())}else if(C.name==="authorityKeyIdentifier"&&o.cert){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var F=C.value.value;if(C.keyIdentifier){var re=C.keyIdentifier===!0?o.cert.generateSubjectKeyIdentifier().getBytes():C.keyIdentifier;F.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,re))}if(C.authorityCertIssuer){var J=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[v(C.authorityCertIssuer===!0?o.cert.issuer:C.authorityCertIssuer)])];F.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,J))}if(C.serialNumber){var oe=a.util.hexToBytes(C.serialNumber===!0?o.cert.serialNumber:C.serialNumber);F.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,oe))}}else if(C.name==="cRLDistributionPoints"){C.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var F=C.value.value,Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),$=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),H,j=0;j<C.altNames.length;++j){H=C.altNames[j];var I=H.value;if(H.type===7&&H.ip){if(I=a.util.bytesFromIP(H.ip),I===null){var i=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw i.extension=C,i}}else H.type===8&&(H.oid?I=e.oidToDer(e.oidToDer(H.oid)):I=e.oidToDer(I));$.value.push(e.create(e.Class.CONTEXT_SPECIFIC,H.type,!1,I))}Q.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[$])),F.push(Q)}if(typeof C.value>"u"){var i=new Error("Extension value not specified.");throw i.extension=C,i}return C}function n(C,o){switch(C){case d["RSASSA-PSS"]:var i=[];return o.hash.algorithmOid!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),o.mgf.algorithmOid!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),o.saltLength!==void 0&&i.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(o.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,i);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function p(C){var o=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(C.attributes.length===0)return o;for(var i=C.attributes,B=0;B<i.length;++B){var N=i[B],q=N.value,I=e.Type.UTF8;"valueTagClass"in N&&(I=N.valueTagClass),I===e.Type.UTF8&&(q=a.util.encodeUtf8(q));var F=!1;"valueConstructed"in N&&(F=N.valueConstructed);var A=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(N.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,I,F,q)])]);o.value.push(A)}return o}var m=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function w(C){return C>=m&&C<_?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(C)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(C))}return t.getTBSCertificate=function(C){var o=w(C.validity.notBefore),i=w(C.validity.notAfter),B=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(C.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.siginfo.algorithmOid).getBytes()),n(C.siginfo.algorithmOid,C.siginfo.parameters)]),v(C.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,i]),v(C.subject),t.publicKeyToAsn1(C.publicKey)]);return C.issuer.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.issuer.uniqueId)])),C.subject.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.subject.uniqueId)])),C.extensions.length>0&&B.value.push(t.certificateExtensionsToAsn1(C.extensions)),B},t.getCertificationRequestInfo=function(C){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(C.version).getBytes()),v(C.subject),t.publicKeyToAsn1(C.publicKey),p(C)]);return o},t.distinguishedNameToAsn1=function(C){return v(C)},t.certificateToAsn1=function(C){var o=C.tbsCertificate||t.getTBSCertificate(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),n(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.certificateExtensionsToAsn1=function(C){var o=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),i=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);o.value.push(i);for(var B=0;B<C.length;++B)i.value.push(t.certificateExtensionToAsn1(C[B]));return o},t.certificateExtensionToAsn1=function(C){var o=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.id).getBytes())),C.critical&&o.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var i=C.value;return typeof C.value!="string"&&(i=e.toDer(i).getBytes()),o.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i)),o},t.certificationRequestToAsn1=function(C){var o=C.certificationRequestInfo||t.getCertificationRequestInfo(C);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[o,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(C.signatureOid).getBytes()),n(C.signatureOid,C.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+C.signature)])},t.createCaStore=function(C){var o={certs:{}};o.getIssuer=function(I){var F=i(I.issuer);return F},o.addCertificate=function(I){if(typeof I=="string"&&(I=a.pki.certificateFromPem(I)),B(I.subject),!o.hasCertificate(I))if(I.subject.hash in o.certs){var F=o.certs[I.subject.hash];a.util.isArray(F)||(F=[F]),F.push(I),o.certs[I.subject.hash]=F}else o.certs[I.subject.hash]=I},o.hasCertificate=function(I){typeof I=="string"&&(I=a.pki.certificateFromPem(I));var F=i(I.subject);if(!F)return!1;a.util.isArray(F)||(F=[F]);for(var A=e.toDer(t.certificateToAsn1(I)).getBytes(),H=0;H<F.length;++H){var j=e.toDer(t.certificateToAsn1(F[H])).getBytes();if(A===j)return!0}return!1},o.listAllCertificates=function(){var I=[];for(var F in o.certs)if(o.certs.hasOwnProperty(F)){var A=o.certs[F];if(!a.util.isArray(A))I.push(A);else for(var H=0;H<A.length;++H)I.push(A[H])}return I},o.removeCertificate=function(I){var F;if(typeof I=="string"&&(I=a.pki.certificateFromPem(I)),B(I.subject),!o.hasCertificate(I))return null;var A=i(I.subject);if(!a.util.isArray(A))return F=o.certs[I.subject.hash],delete o.certs[I.subject.hash],F;for(var H=e.toDer(t.certificateToAsn1(I)).getBytes(),j=0;j<A.length;++j){var W=e.toDer(t.certificateToAsn1(A[j])).getBytes();H===W&&(F=A[j],A.splice(j,1))}return A.length===0&&delete o.certs[I.subject.hash],F};function i(I){return B(I),o.certs[I.hash]||null}function B(I){if(!I.hash){var F=a.md.sha1.create();I.attributes=t.RDNAttributesAsArray(v(I),F),I.hash=F.digest().toHex()}}if(C)for(var N=0;N<C.length;++N){var q=C[N];o.addCertificate(q)}return o},t.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},t.verifyCertificateChain=function(C,o,i){typeof i=="function"&&(i={verify:i}),i=i||{},o=o.slice(0);var B=o.slice(0),N=i.validityCheckDate;typeof N>"u"&&(N=new Date);var q=!0,I=null,F=0;do{var A=o.shift(),H=null,j=!1;if(N&&(N<A.validity.notBefore||N>A.validity.notAfter)&&(I={message:"Certificate is not valid yet or has expired.",error:t.certificateError.certificate_expired,notBefore:A.validity.notBefore,notAfter:A.validity.notAfter,now:N}),I===null){if(H=o[0]||C.getIssuer(A),H===null&&A.isIssuer(A)&&(j=!0,H=A),H){var W=H;a.util.isArray(W)||(W=[W]);for(var re=!1;!re&&W.length>0;){H=W.shift();try{re=H.verify(A)}catch{}}re||(I={message:"Certificate signature is invalid.",error:t.certificateError.bad_certificate})}I===null&&(!H||j)&&!C.hasCertificate(A)&&(I={message:"Certificate is not trusted.",error:t.certificateError.unknown_ca})}if(I===null&&H&&!A.isIssuer(H)&&(I={message:"Certificate issuer is invalid.",error:t.certificateError.bad_certificate}),I===null)for(var J={keyUsage:!0,basicConstraints:!0},oe=0;I===null&&oe<A.extensions.length;++oe){var Q=A.extensions[oe];Q.critical&&!(Q.name in J)&&(I={message:"Certificate has an unsupported critical extension.",error:t.certificateError.unsupported_certificate})}if(I===null&&(!q||o.length===0&&(!H||j))){var $=A.getExtension("basicConstraints"),ce=A.getExtension("keyUsage");if(ce!==null&&(!ce.keyCertSign||$===null)&&(I={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:t.certificateError.bad_certificate}),I===null&&$===null&&(I={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:t.certificateError.bad_certificate}),I===null&&$!==null&&!$.cA&&(I={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:t.certificateError.bad_certificate}),I===null&&ce!==null&&"pathLenConstraint"in $){var ie=F-1;ie>$.pathLenConstraint&&(I={message:"Certificate basicConstraints pathLenConstraint violated.",error:t.certificateError.bad_certificate})}}var ee=I===null?!0:I.error,ue=i.verify?i.verify(ee,F,B):ee;if(ue===!0)I=null;else throw ee===!0&&(I={message:"The application rejected the certificate.",error:t.certificateError.bad_certificate}),(ue||ue===0)&&(typeof ue=="object"&&!a.util.isArray(ue)?(ue.message&&(I.message=ue.message),ue.error&&(I.error=ue.error)):typeof ue=="string"&&(I.error=ue)),I;q=!1,++F}while(o.length>0);return!0},Vr.exports}var en;function tn(){if(en)return Or.exports;en=1;var a=me();ft(),Rt(),mt(),Qa(),Wa(),at(),jt(),Nt(),Ee(),Hr();var e=a.asn1,t=a.pki,d=Or.exports=a.pkcs12=a.pkcs12||{},x={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},g={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},x,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},u={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},r={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},c={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function l(h,y,n,p){for(var m=[],_=0;_<h.length;_++)for(var w=0;w<h[_].safeBags.length;w++){var C=h[_].safeBags[w];if(!(p!==void 0&&C.type!==p)){if(y===null){m.push(C);continue}C.attributes[y]!==void 0&&C.attributes[y].indexOf(n)>=0&&m.push(C)}}return m}d.pkcs12FromAsn1=function(h,y,n){typeof y=="string"?(n=y,y=!0):y===void 0&&(y=!0);var p={},m=[];if(!e.validate(h,g,p,m)){var _=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw _.errors=_,_}var w={version:p.version.charCodeAt(0),safeContents:[],getBags:function(H){var j={},W;return"localKeyId"in H?W=H.localKeyId:"localKeyIdHex"in H&&(W=a.util.hexToBytes(H.localKeyIdHex)),W===void 0&&!("friendlyName"in H)&&"bagType"in H&&(j[H.bagType]=l(w.safeContents,null,null,H.bagType)),W!==void 0&&(j.localKeyId=l(w.safeContents,"localKeyId",W,H.bagType)),"friendlyName"in H&&(j.friendlyName=l(w.safeContents,"friendlyName",H.friendlyName,H.bagType)),j},getBagsByFriendlyName:function(H,j){return l(w.safeContents,"friendlyName",H,j)},getBagsByLocalKeyId:function(H,j){return l(w.safeContents,"localKeyId",H,j)}};if(p.version.charCodeAt(0)!==3){var _=new Error("PKCS#12 PFX of version other than 3 not supported.");throw _.version=p.version.charCodeAt(0),_}if(e.derToOid(p.contentType)!==t.oids.data){var _=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw _.oid=e.derToOid(p.contentType),_}var C=p.content.value[0];if(C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(C=b(C),p.mac){var o=null,i=0,B=e.derToOid(p.macAlgorithm);switch(B){case t.oids.sha1:o=a.md.sha1.create(),i=20;break;case t.oids.sha256:o=a.md.sha256.create(),i=32;break;case t.oids.sha384:o=a.md.sha384.create(),i=48;break;case t.oids.sha512:o=a.md.sha512.create(),i=64;break;case t.oids.md5:o=a.md.md5.create(),i=16;break}if(o===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+B);var N=new a.util.ByteBuffer(p.macSalt),q="macIterations"in p?parseInt(a.util.bytesToHex(p.macIterations),16):1,I=d.generateKey(n,N,3,q,i,o),F=a.hmac.create();F.start(o,I),F.update(C.value);var A=F.getMac();if(A.getBytes()!==p.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(h.value)&&h.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return T(w,C.value,y,n),w};function b(h){if(h.composed||h.constructed){for(var y=a.util.createBuffer(),n=0;n<h.value.length;++n)y.putBytes(h.value[n].value);h.composed=h.constructed=!1,h.value=y.getBytes()}return h}function T(h,y,n,p){if(y=e.fromDer(y,n),y.tagClass!==e.Class.UNIVERSAL||y.type!==e.Type.SEQUENCE||y.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var m=0;m<y.value.length;m++){var _=y.value[m],w={},C=[];if(!e.validate(_,x,w,C)){var o=new Error("Cannot read ContentInfo.");throw o.errors=C,o}var i={encrypted:!1},B=null,N=w.content.value[0];switch(e.derToOid(w.contentType)){case t.oids.data:if(N.tagClass!==e.Class.UNIVERSAL||N.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");B=b(N).value;break;case t.oids.encryptedData:B=E(N,p),i.encrypted=!0;break;default:var o=new Error("Unsupported PKCS#12 contentType.");throw o.contentType=e.derToOid(w.contentType),o}i.safeBags=s(B,n,p),h.safeContents.push(i)}}function E(h,y){var n={},p=[];if(!e.validate(h,a.pkcs7.asn1.encryptedDataValidator,n,p)){var m=new Error("Cannot read EncryptedContentInfo.");throw m.errors=p,m}var _=e.derToOid(n.contentType);if(_!==t.oids.data){var m=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw m.oid=_,m}_=e.derToOid(n.encAlgorithm);var w=t.pbe.getCipher(_,n.encParameter,y),C=b(n.encryptedContentAsn1),o=a.util.createBuffer(C.value);if(w.update(o),!w.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return w.output.getBytes()}function s(h,y,n){if(!y&&h.length===0)return[];if(h=e.fromDer(h,y),h.tagClass!==e.Class.UNIVERSAL||h.type!==e.Type.SEQUENCE||h.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var p=[],m=0;m<h.value.length;m++){var _=h.value[m],w={},C=[];if(!e.validate(_,u,w,C)){var o=new Error("Cannot read SafeBag.");throw o.errors=C,o}var i={type:e.derToOid(w.bagId),attributes:v(w.bagAttributes)};p.push(i);var B,N,q=w.bagValue.value[0];switch(i.type){case t.oids.pkcs8ShroudedKeyBag:if(q=t.decryptPrivateKeyInfo(q,n),q===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case t.oids.keyBag:try{i.key=t.privateKeyFromAsn1(q)}catch{i.key=null,i.asn1=q}continue;case t.oids.certBag:B=c,N=function(){if(e.derToOid(w.certId)!==t.oids.x509Certificate){var F=new Error("Unsupported certificate type, only X.509 supported.");throw F.oid=e.derToOid(w.certId),F}var A=e.fromDer(w.cert,y);try{i.cert=t.certificateFromAsn1(A,!0)}catch{i.cert=null,i.asn1=A}};break;default:var o=new Error("Unsupported PKCS#12 SafeBag type.");throw o.oid=i.type,o}if(B!==void 0&&!e.validate(q,B,w,C)){var o=new Error("Cannot read PKCS#12 "+B.name);throw o.errors=C,o}N()}return p}function v(h){var y={};if(h!==void 0)for(var n=0;n<h.length;++n){var p={},m=[];if(!e.validate(h[n],r,p,m)){var _=new Error("Cannot read PKCS#12 BagAttribute.");throw _.errors=m,_}var w=e.derToOid(p.oid);if(t.oids[w]!==void 0){y[t.oids[w]]=[];for(var C=0;C<p.values.length;++C)y[t.oids[w]].push(p.values[C].value)}}return y}return d.toPkcs12Asn1=function(h,y,n,p){p=p||{},p.saltSize=p.saltSize||8,p.count=p.count||2048,p.algorithm=p.algorithm||p.encAlgorithm||"aes128","useMac"in p||(p.useMac=!0),"localKeyId"in p||(p.localKeyId=null),"generateLocalKeyId"in p||(p.generateLocalKeyId=!0);var m=p.localKeyId,_;if(m!==null)m=a.util.hexToBytes(m);else if(p.generateLocalKeyId)if(y){var w=a.util.isArray(y)?y[0]:y;typeof w=="string"&&(w=t.certificateFromPem(w));var C=a.md.sha1.create();C.update(e.toDer(t.certificateToAsn1(w)).getBytes()),m=C.digest().getBytes()}else m=a.random.getBytes(20);var o=[];m!==null&&o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,m)])])),"friendlyName"in p&&o.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,p.friendlyName)])])),o.length>0&&(_=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,o));var i=[],B=[];y!==null&&(a.util.isArray(y)?B=y:B=[y]);for(var N=[],q=0;q<B.length;++q){y=B[q],typeof y=="string"&&(y=t.certificateFromPem(y));var I=q===0?_:void 0,F=t.certificateToAsn1(y),A=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(F).getBytes())])])]),I]);N.push(A)}if(N.length>0){var H=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,N),j=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(H).getBytes())])]);i.push(j)}var W=null;if(h!==null){var re=t.wrapRsaPrivateKey(t.privateKeyToAsn1(h));n===null?W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[re]),_]):W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[t.encryptPrivateKeyInfo(re,n,p)]),_]);var J=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[W]),oe=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(J).getBytes())])]);i.push(oe)}var Q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,i),$;if(p.useMac){var C=a.md.sha1.create(),ce=new a.util.ByteBuffer(a.random.getBytes(p.saltSize)),ie=p.count,h=d.generateKey(n,ce,3,ie,20),ee=a.hmac.create();ee.start(C,h),ee.update(e.toDer(Q).getBytes());var ue=ee.getMac();$=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ue.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ce.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(ie).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(Q).getBytes())])]),$])},d.generateKey=a.pbe.generatePkcs12Key,Or.exports}var rn;function an(){if(rn)return _r.exports;rn=1;var a=me();ft(),mt(),Wa(),xt(),wr(),tn(),qr(),jt(),Ee(),Hr();var e=a.asn1,t=_r.exports=a.pki=a.pki||{};return t.pemToDer=function(d){var x=a.pem.decode(d)[0];if(x.procType&&x.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(x.body)},t.privateKeyFromPem=function(d){var x=a.pem.decode(d)[0];if(x.type!=="PRIVATE KEY"&&x.type!=="RSA PRIVATE KEY"){var g=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw g.headerType=x.type,g}if(x.procType&&x.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var u=e.fromDer(x.body);return t.privateKeyFromAsn1(u)},t.privateKeyToPem=function(d,x){var g={type:"RSA PRIVATE KEY",body:e.toDer(t.privateKeyToAsn1(d)).getBytes()};return a.pem.encode(g,{maxline:x})},t.privateKeyInfoToPem=function(d,x){var g={type:"PRIVATE KEY",body:e.toDer(d).getBytes()};return a.pem.encode(g,{maxline:x})},_r.exports}var Gr,nn;function sn(){if(nn)return Gr;nn=1;var a=me();ft(),Rt(),Sr(),xt(),an(),at(),Nt(),Ee();var e=function(k,O,P,D){var S=a.util.createBuffer(),f=k.length>>1,L=f+(k.length&1),G=k.substr(0,L),M=k.substr(f,L),V=a.util.createBuffer(),K=a.hmac.create();P=O+P;var X=Math.ceil(D/16),te=Math.ceil(D/20);K.start("MD5",G);var Y=a.util.createBuffer();V.putBytes(P);for(var ae=0;ae<X;++ae)K.start(null,null),K.update(V.getBytes()),V.putBuffer(K.digest()),K.start(null,null),K.update(V.bytes()+P),Y.putBuffer(K.digest());K.start("SHA1",M);var fe=a.util.createBuffer();V.clear(),V.putBytes(P);for(var ae=0;ae<te;++ae)K.start(null,null),K.update(V.getBytes()),V.putBuffer(K.digest()),K.start(null,null),K.update(V.bytes()+P),fe.putBuffer(K.digest());return S.putBytes(a.util.xorBytes(Y.getBytes(),fe.getBytes(),D)),S},t=function(k,O,P){var D=a.hmac.create();D.start("SHA1",k);var S=a.util.createBuffer();return S.putInt32(O[0]),S.putInt32(O[1]),S.putByte(P.type),S.putByte(P.version.major),S.putByte(P.version.minor),S.putInt16(P.length),S.putBytes(P.fragment.bytes()),D.update(S.getBytes()),D.digest().getBytes()},d=function(k,O,P){var D=!1;try{var S=k.deflate(O.fragment.getBytes());O.fragment=a.util.createBuffer(S),O.length=S.length,D=!0}catch{}return D},x=function(k,O,P){var D=!1;try{var S=k.inflate(O.fragment.getBytes());O.fragment=a.util.createBuffer(S),O.length=S.length,D=!0}catch{}return D},g=function(k,O){var P=0;switch(O){case 1:P=k.getByte();break;case 2:P=k.getInt16();break;case 3:P=k.getInt24();break;case 4:P=k.getInt32();break}return a.util.createBuffer(k.getBytes(P))},u=function(k,O,P){k.putInt(P.length(),O<<3),k.putBuffer(P)},r={};r.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},r.SupportedVersions=[r.Versions.TLS_1_1,r.Versions.TLS_1_0],r.Version=r.SupportedVersions[0],r.MaxFragment=15360,r.ConnectionEnd={server:0,client:1},r.PRFAlgorithm={tls_prf_sha256:0},r.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},r.CipherType={stream:0,block:1,aead:2},r.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},r.CompressionMethod={none:0,deflate:1},r.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},r.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20},r.Alert={},r.Alert.Level={warning:1,fatal:2},r.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100},r.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},r.CipherSuites={},r.getCipherSuite=function(k){var O=null;for(var P in r.CipherSuites){var D=r.CipherSuites[P];if(D.id[0]===k.charCodeAt(0)&&D.id[1]===k.charCodeAt(1)){O=D;break}}return O},r.handleUnexpected=function(k,O){var P=!k.open&&k.entity===r.ConnectionEnd.client;P||k.error(k,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})},r.handleHelloRequest=function(k,O,P){!k.handshaking&&k.handshakes>0&&(r.queue(k,r.createAlert(k,{level:r.Alert.Level.warning,description:r.Alert.Description.no_renegotiation})),r.flush(k)),k.process()},r.parseHelloMessage=function(k,O,P){var D=null,S=k.entity===r.ConnectionEnd.client;if(P<38)k.error(k,{message:S?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});else{var f=O.fragment,L=f.length();if(D={version:{major:f.getByte(),minor:f.getByte()},random:a.util.createBuffer(f.getBytes(32)),session_id:g(f,1),extensions:[]},S?(D.cipher_suite=f.getBytes(2),D.compression_method=f.getByte()):(D.cipher_suites=g(f,2),D.compression_methods=g(f,1)),L=P-(L-f.length()),L>0){for(var G=g(f,2);G.length()>0;)D.extensions.push({type:[G.getByte(),G.getByte()],data:g(G,2)});if(!S)for(var M=0;M<D.extensions.length;++M){var V=D.extensions[M];if(V.type[0]===0&&V.type[1]===0)for(var K=g(V.data,2);K.length()>0;){var X=K.getByte();if(X!==0)break;k.session.extensions.server_name.serverNameList.push(g(K,2).getBytes())}}}if(k.session.version&&(D.version.major!==k.session.version.major||D.version.minor!==k.session.version.minor))return k.error(k,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});if(S)k.session.cipherSuite=r.getCipherSuite(D.cipher_suite);else for(var te=a.util.createBuffer(D.cipher_suites.bytes());te.length()>0&&(k.session.cipherSuite=r.getCipherSuite(te.getBytes(2)),k.session.cipherSuite===null););if(k.session.cipherSuite===null)return k.error(k,{message:"No cipher suites in common.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(D.cipher_suite)});S?k.session.compressionMethod=D.compression_method:k.session.compressionMethod=r.CompressionMethod.none}return D},r.createSecurityParameters=function(k,O){var P=k.entity===r.ConnectionEnd.client,D=O.random.bytes(),S=P?k.session.sp.client_random:D,f=P?D:r.createRandom().getBytes();k.session.sp={entity:k.entity,prf_algorithm:r.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:k.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:S,server_random:f}},r.handleServerHello=function(k,O,P){var D=r.parseHelloMessage(k,O,P);if(!k.fail){if(D.version.minor<=k.version.minor)k.version.minor=D.version.minor;else return k.error(k,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}});k.session.version=k.version;var S=D.session_id.bytes();S.length>0&&S===k.session.id?(k.expect=s,k.session.resuming=!0,k.session.sp.server_random=D.random.bytes()):(k.expect=l,k.session.resuming=!1,r.createSecurityParameters(k,D)),k.session.id=S,k.process()}},r.handleClientHello=function(k,O,P){var D=r.parseHelloMessage(k,O,P);if(!k.fail){var S=D.session_id.bytes(),f=null;if(k.sessionCache&&(f=k.sessionCache.getSession(S),f===null?S="":(f.version.major!==D.version.major||f.version.minor>D.version.minor)&&(f=null,S="")),S.length===0&&(S=a.random.getBytes(32)),k.session.id=S,k.session.clientHelloVersion=D.version,k.session.sp={},f)k.version=k.session.version=f.version,k.session.sp=f.sp;else{for(var L,G=1;G<r.SupportedVersions.length&&(L=r.SupportedVersions[G],!(L.minor<=D.version.minor));++G);k.version={major:L.major,minor:L.minor},k.session.version=k.version}f!==null?(k.expect=w,k.session.resuming=!0,k.session.sp.client_random=D.random.bytes()):(k.expect=k.verifyClient!==!1?p:m,k.session.resuming=!1,r.createSecurityParameters(k,D)),k.open=!0,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerHello(k)})),k.session.resuming?(r.queue(k,r.createRecord(k,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),k.state.pending=r.createConnectionState(k),k.state.current.write=k.state.pending.write,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createFinished(k)}))):(r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificate(k)})),k.fail||(r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerKeyExchange(k)})),k.verifyClient!==!1&&r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificateRequest(k)})),r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createServerHelloDone(k)})))),r.flush(k),k.process()}},r.handleCertificate=function(k,O,P){if(P<3)return k.error(k,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment,S={certificate_list:g(D,3)},f,L,G=[];try{for(;S.certificate_list.length()>0;)f=g(S.certificate_list,3),L=a.asn1.fromDer(f),f=a.pki.certificateFromAsn1(L,!0),G.push(f)}catch(V){return k.error(k,{message:"Could not parse certificate list.",cause:V,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var M=k.entity===r.ConnectionEnd.client;(M||k.verifyClient===!0)&&G.length===0?k.error(k,{message:M?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}}):G.length===0?k.expect=M?b:m:(M?k.session.serverCertificate=G[0]:k.session.clientCertificate=G[0],r.verifyCertificateChain(k,G)&&(k.expect=M?b:m)),k.process()},r.handleServerKeyExchange=function(k,O,P){if(P>0)return k.error(k,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});k.expect=T,k.process()},r.handleClientKeyExchange=function(k,O,P){if(P<48)return k.error(k,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unsupported_certificate}});var D=O.fragment,S={enc_pre_master_secret:g(D,2).getBytes()},f=null;if(k.getPrivateKey)try{f=k.getPrivateKey(k,k.session.serverCertificate),f=a.pki.privateKeyFromPem(f)}catch(M){k.error(k,{message:"Could not get private key.",cause:M,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}if(f===null)return k.error(k,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}});try{var L=k.session.sp;L.pre_master_secret=f.decrypt(S.enc_pre_master_secret);var G=k.session.clientHelloVersion;if(G.major!==L.pre_master_secret.charCodeAt(0)||G.minor!==L.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{L.pre_master_secret=a.random.getBytes(48)}k.expect=w,k.session.clientCertificate!==null&&(k.expect=_),k.process()},r.handleCertificateRequest=function(k,O,P){if(P<3)return k.error(k,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment,S={certificate_types:g(D,1),certificate_authorities:g(D,2)};k.session.certificateRequest=S,k.expect=E,k.process()},r.handleCertificateVerify=function(k,O,P){if(P<2)return k.error(k,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var D=O.fragment;D.read-=4;var S=D.bytes();D.read+=4;var f={signature:g(D,2).getBytes()},L=a.util.createBuffer();L.putBuffer(k.session.md5.digest()),L.putBuffer(k.session.sha1.digest()),L=L.getBytes();try{var G=k.session.clientCertificate;if(!G.publicKey.verify(L,f.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");k.session.md5.update(S),k.session.sha1.update(S)}catch{return k.error(k,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.handshake_failure}})}k.expect=w,k.process()},r.handleServerHelloDone=function(k,O,P){if(P>0)return k.error(k,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.record_overflow}});if(k.serverCertificate===null){var D={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.insufficient_security}},S=0,f=k.verify(k,D.alert.description,S,[]);if(f!==!0)return(f||f===0)&&(typeof f=="object"&&!a.util.isArray(f)?(f.message&&(D.message=f.message),f.alert&&(D.alert.description=f.alert)):typeof f=="number"&&(D.alert.description=f)),k.error(k,D)}k.session.certificateRequest!==null&&(O=r.createRecord(k,{type:r.ContentType.handshake,data:r.createCertificate(k)}),r.queue(k,O)),O=r.createRecord(k,{type:r.ContentType.handshake,data:r.createClientKeyExchange(k)}),r.queue(k,O),k.expect=y;var L=function(G,M){G.session.certificateRequest!==null&&G.session.clientCertificate!==null&&r.queue(G,r.createRecord(G,{type:r.ContentType.handshake,data:r.createCertificateVerify(G,M)})),r.queue(G,r.createRecord(G,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),G.state.pending=r.createConnectionState(G),G.state.current.write=G.state.pending.write,r.queue(G,r.createRecord(G,{type:r.ContentType.handshake,data:r.createFinished(G)})),G.expect=s,r.flush(G),G.process()};if(k.session.certificateRequest===null||k.session.clientCertificate===null)return L(k,null);r.getClientSignature(k,L)},r.handleChangeCipherSpec=function(k,O){if(O.fragment.getByte()!==1)return k.error(k,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.illegal_parameter}});var P=k.entity===r.ConnectionEnd.client;(k.session.resuming&&P||!k.session.resuming&&!P)&&(k.state.pending=r.createConnectionState(k)),k.state.current.read=k.state.pending.read,(!k.session.resuming&&P||k.session.resuming&&!P)&&(k.state.pending=null),k.expect=P?v:C,k.process()},r.handleFinished=function(k,O,P){var D=O.fragment;D.read-=4;var S=D.bytes();D.read+=4;var f=O.fragment.getBytes();D=a.util.createBuffer(),D.putBuffer(k.session.md5.digest()),D.putBuffer(k.session.sha1.digest());var L=k.entity===r.ConnectionEnd.client,G=L?"server finished":"client finished",M=k.session.sp,V=12,K=e;if(D=K(M.master_secret,G,D.getBytes(),V),D.getBytes()!==f)return k.error(k,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decrypt_error}});k.session.md5.update(S),k.session.sha1.update(S),(k.session.resuming&&L||!k.session.resuming&&!L)&&(r.queue(k,r.createRecord(k,{type:r.ContentType.change_cipher_spec,data:r.createChangeCipherSpec()})),k.state.current.write=k.state.pending.write,k.state.pending=null,r.queue(k,r.createRecord(k,{type:r.ContentType.handshake,data:r.createFinished(k)}))),k.expect=L?h:o,k.handshaking=!1,++k.handshakes,k.peerCertificate=L?k.session.serverCertificate:k.session.clientCertificate,r.flush(k),k.isConnected=!0,k.connected(k),k.process()},r.handleAlert=function(k,O){var P=O.fragment,D={level:P.getByte(),description:P.getByte()},S;switch(D.description){case r.Alert.Description.close_notify:S="Connection closed.";break;case r.Alert.Description.unexpected_message:S="Unexpected message.";break;case r.Alert.Description.bad_record_mac:S="Bad record MAC.";break;case r.Alert.Description.decryption_failed:S="Decryption failed.";break;case r.Alert.Description.record_overflow:S="Record overflow.";break;case r.Alert.Description.decompression_failure:S="Decompression failed.";break;case r.Alert.Description.handshake_failure:S="Handshake failure.";break;case r.Alert.Description.bad_certificate:S="Bad certificate.";break;case r.Alert.Description.unsupported_certificate:S="Unsupported certificate.";break;case r.Alert.Description.certificate_revoked:S="Certificate revoked.";break;case r.Alert.Description.certificate_expired:S="Certificate expired.";break;case r.Alert.Description.certificate_unknown:S="Certificate unknown.";break;case r.Alert.Description.illegal_parameter:S="Illegal parameter.";break;case r.Alert.Description.unknown_ca:S="Unknown certificate authority.";break;case r.Alert.Description.access_denied:S="Access denied.";break;case r.Alert.Description.decode_error:S="Decode error.";break;case r.Alert.Description.decrypt_error:S="Decrypt error.";break;case r.Alert.Description.export_restriction:S="Export restriction.";break;case r.Alert.Description.protocol_version:S="Unsupported protocol version.";break;case r.Alert.Description.insufficient_security:S="Insufficient security.";break;case r.Alert.Description.internal_error:S="Internal error.";break;case r.Alert.Description.user_canceled:S="User canceled.";break;case r.Alert.Description.no_renegotiation:S="Renegotiation not supported.";break;default:S="Unknown error.";break}if(D.description===r.Alert.Description.close_notify)return k.close();k.error(k,{message:S,send:!1,origin:k.entity===r.ConnectionEnd.client?"server":"client",alert:D}),k.process()},r.handleHandshake=function(k,O){var P=O.fragment,D=P.getByte(),S=P.getInt24();if(S>P.length())return k.fragmented=O,O.fragment=a.util.createBuffer(),P.read-=4,k.process();k.fragmented=null,P.read-=4;var f=P.bytes(S+4);P.read+=4,D in $[k.entity][k.expect]?(k.entity===r.ConnectionEnd.server&&!k.open&&!k.fail&&(k.handshaking=!0,k.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),D!==r.HandshakeType.hello_request&&D!==r.HandshakeType.certificate_verify&&D!==r.HandshakeType.finished&&(k.session.md5.update(f),k.session.sha1.update(f)),$[k.entity][k.expect][D](k,O,S)):r.handleUnexpected(k,O)},r.handleApplicationData=function(k,O){k.data.putBuffer(O.fragment),k.dataReady(k),k.process()},r.handleHeartbeat=function(k,O){var P=O.fragment,D=P.getByte(),S=P.getInt16(),f=P.getBytes(S);if(D===r.HeartbeatMessageType.heartbeat_request){if(k.handshaking||S>f.length)return k.process();r.queue(k,r.createRecord(k,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_response,f)})),r.flush(k)}else if(D===r.HeartbeatMessageType.heartbeat_response){if(f!==k.expectedHeartbeatPayload)return k.process();k.heartbeatReceived&&k.heartbeatReceived(k,a.util.createBuffer(f))}k.process()};var c=0,l=1,b=2,T=3,E=4,s=5,v=6,h=7,y=8,n=0,p=1,m=2,_=3,w=4,C=5,o=6,i=r.handleUnexpected,B=r.handleChangeCipherSpec,N=r.handleAlert,q=r.handleHandshake,I=r.handleApplicationData,F=r.handleHeartbeat,A=[];A[r.ConnectionEnd.client]=[[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[B,N,i,i,F],[i,N,q,i,F],[i,N,q,I,F],[i,N,q,i,F]],A[r.ConnectionEnd.server]=[[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[i,N,q,i,F],[B,N,i,i,F],[i,N,q,i,F],[i,N,q,I,F],[i,N,q,i,F]];var H=r.handleHelloRequest,j=r.handleServerHello,W=r.handleCertificate,re=r.handleServerKeyExchange,J=r.handleCertificateRequest,oe=r.handleServerHelloDone,Q=r.handleFinished,$=[];$[r.ConnectionEnd.client]=[[i,i,j,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,W,re,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,re,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,J,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,oe,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,Q],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[H,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i]];var ce=r.handleClientHello,ie=r.handleClientKeyExchange,ee=r.handleCertificateVerify;$[r.ConnectionEnd.server]=[[i,ce,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,W,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,ie,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,ee,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,Q],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i],[i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i]],r.generateKeys=function(k,O){var P=e,D=O.client_random+O.server_random;k.session.resuming||(O.master_secret=P(O.pre_master_secret,"master secret",D,48).bytes(),O.pre_master_secret=null),D=O.server_random+O.client_random;var S=2*O.mac_key_length+2*O.enc_key_length,f=k.version.major===r.Versions.TLS_1_0.major&&k.version.minor===r.Versions.TLS_1_0.minor;f&&(S+=2*O.fixed_iv_length);var L=P(O.master_secret,"key expansion",D,S),G={client_write_MAC_key:L.getBytes(O.mac_key_length),server_write_MAC_key:L.getBytes(O.mac_key_length),client_write_key:L.getBytes(O.enc_key_length),server_write_key:L.getBytes(O.enc_key_length)};return f&&(G.client_write_IV=L.getBytes(O.fixed_iv_length),G.server_write_IV=L.getBytes(O.fixed_iv_length)),G},r.createConnectionState=function(k){var O=k.entity===r.ConnectionEnd.client,P=function(){var f={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(L){return!0},compressionState:null,compressFunction:function(L){return!0},updateSequenceNumber:function(){f.sequenceNumber[1]===4294967295?(f.sequenceNumber[1]=0,++f.sequenceNumber[0]):++f.sequenceNumber[1]}};return f},D={read:P(),write:P()};if(D.read.update=function(f,L){return D.read.cipherFunction(L,D.read)?D.read.compressFunction(f,L,D.read)||f.error(f,{message:"Could not decompress record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.decompression_failure}}):f.error(f,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_record_mac}}),!f.fail},D.write.update=function(f,L){return D.write.compressFunction(f,L,D.write)?D.write.cipherFunction(L,D.write)||f.error(f,{message:"Could not encrypt record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):f.error(f,{message:"Could not compress record.",send:!1,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}),!f.fail},k.session){var S=k.session.sp;switch(k.session.cipherSuite.initSecurityParameters(S),S.keys=r.generateKeys(k,S),D.read.macKey=O?S.keys.server_write_MAC_key:S.keys.client_write_MAC_key,D.write.macKey=O?S.keys.client_write_MAC_key:S.keys.server_write_MAC_key,k.session.cipherSuite.initConnectionState(D,k,S),S.compression_algorithm){case r.CompressionMethod.none:break;case r.CompressionMethod.deflate:D.read.compressFunction=x,D.write.compressFunction=d;break;default:throw new Error("Unsupported compression algorithm.")}}return D},r.createRandom=function(){var k=new Date,O=+k+k.getTimezoneOffset()*6e4,P=a.util.createBuffer();return P.putInt32(O),P.putBytes(a.random.getBytes(28)),P},r.createRecord=function(k,O){if(!O.data)return null;var P={type:O.type,version:{major:k.version.major,minor:k.version.minor},length:O.data.length(),fragment:O.data};return P},r.createAlert=function(k,O){var P=a.util.createBuffer();return P.putByte(O.level),P.putByte(O.description),r.createRecord(k,{type:r.ContentType.alert,data:P})},r.createClientHello=function(k){k.session.clientHelloVersion={major:k.version.major,minor:k.version.minor};for(var O=a.util.createBuffer(),P=0;P<k.cipherSuites.length;++P){var D=k.cipherSuites[P];O.putByte(D.id[0]),O.putByte(D.id[1])}var S=O.length(),f=a.util.createBuffer();f.putByte(r.CompressionMethod.none);var L=f.length(),G=a.util.createBuffer();if(k.virtualHost){var M=a.util.createBuffer();M.putByte(0),M.putByte(0);var V=a.util.createBuffer();V.putByte(0),u(V,2,a.util.createBuffer(k.virtualHost));var K=a.util.createBuffer();u(K,2,V),u(M,2,K),G.putBuffer(M)}var X=G.length();X>0&&(X+=2);var te=k.session.id,Y=te.length+1+2+4+28+2+S+1+L+X,ae=a.util.createBuffer();return ae.putByte(r.HandshakeType.client_hello),ae.putInt24(Y),ae.putByte(k.version.major),ae.putByte(k.version.minor),ae.putBytes(k.session.sp.client_random),u(ae,1,a.util.createBuffer(te)),u(ae,2,O),u(ae,1,f),X>0&&u(ae,2,G),ae},r.createServerHello=function(k){var O=k.session.id,P=O.length+1+2+4+28+2+1,D=a.util.createBuffer();return D.putByte(r.HandshakeType.server_hello),D.putInt24(P),D.putByte(k.version.major),D.putByte(k.version.minor),D.putBytes(k.session.sp.server_random),u(D,1,a.util.createBuffer(O)),D.putByte(k.session.cipherSuite.id[0]),D.putByte(k.session.cipherSuite.id[1]),D.putByte(k.session.compressionMethod),D},r.createCertificate=function(k){var O=k.entity===r.ConnectionEnd.client,P=null;if(k.getCertificate){var D;O?D=k.session.certificateRequest:D=k.session.extensions.server_name.serverNameList,P=k.getCertificate(k,D)}var S=a.util.createBuffer();if(P!==null)try{a.util.isArray(P)||(P=[P]);for(var f=null,L=0;L<P.length;++L){var G=a.pem.decode(P[L])[0];if(G.type!=="CERTIFICATE"&&G.type!=="X509 CERTIFICATE"&&G.type!=="TRUSTED CERTIFICATE"){var M=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw M.headerType=G.type,M}if(G.procType&&G.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var V=a.util.createBuffer(G.body);f===null&&(f=a.asn1.fromDer(V.bytes(),!1));var K=a.util.createBuffer();u(K,3,V),S.putBuffer(K)}P=a.pki.certificateFromAsn1(f),O?k.session.clientCertificate=P:k.session.serverCertificate=P}catch(Y){return k.error(k,{message:"Could not send certificate list.",cause:Y,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate}})}var X=3+S.length(),te=a.util.createBuffer();return te.putByte(r.HandshakeType.certificate),te.putInt24(X),u(te,3,S),te},r.createClientKeyExchange=function(k){var O=a.util.createBuffer();O.putByte(k.session.clientHelloVersion.major),O.putByte(k.session.clientHelloVersion.minor),O.putBytes(a.random.getBytes(46));var P=k.session.sp;P.pre_master_secret=O.getBytes();var D=k.session.serverCertificate.publicKey;O=D.encrypt(P.pre_master_secret);var S=O.length+2,f=a.util.createBuffer();return f.putByte(r.HandshakeType.client_key_exchange),f.putInt24(S),f.putInt16(O.length),f.putBytes(O),f},r.createServerKeyExchange=function(k){var O=a.util.createBuffer();return O},r.getClientSignature=function(k,O){var P=a.util.createBuffer();P.putBuffer(k.session.md5.digest()),P.putBuffer(k.session.sha1.digest()),P=P.getBytes(),k.getSignature=k.getSignature||function(D,S,f){var L=null;if(D.getPrivateKey)try{L=D.getPrivateKey(D,D.session.clientCertificate),L=a.pki.privateKeyFromPem(L)}catch(G){D.error(D,{message:"Could not get private key.",cause:G,send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}})}L===null?D.error(D,{message:"No private key set.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.internal_error}}):S=L.sign(S,null),f(D,S)},k.getSignature(k,P,O)},r.createCertificateVerify=function(k,O){var P=O.length+2,D=a.util.createBuffer();return D.putByte(r.HandshakeType.certificate_verify),D.putInt24(P),D.putInt16(O.length),D.putBytes(O),D},r.createCertificateRequest=function(k){var O=a.util.createBuffer();O.putByte(1);var P=a.util.createBuffer();for(var D in k.caStore.certs){var S=k.caStore.certs[D],f=a.pki.distinguishedNameToAsn1(S.subject),L=a.asn1.toDer(f);P.putInt16(L.length()),P.putBuffer(L)}var G=1+O.length()+2+P.length(),M=a.util.createBuffer();return M.putByte(r.HandshakeType.certificate_request),M.putInt24(G),u(M,1,O),u(M,2,P),M},r.createServerHelloDone=function(k){var O=a.util.createBuffer();return O.putByte(r.HandshakeType.server_hello_done),O.putInt24(0),O},r.createChangeCipherSpec=function(){var k=a.util.createBuffer();return k.putByte(1),k},r.createFinished=function(k){var O=a.util.createBuffer();O.putBuffer(k.session.md5.digest()),O.putBuffer(k.session.sha1.digest());var P=k.entity===r.ConnectionEnd.client,D=k.session.sp,S=12,f=e,L=P?"client finished":"server finished";O=f(D.master_secret,L,O.getBytes(),S);var G=a.util.createBuffer();return G.putByte(r.HandshakeType.finished),G.putInt24(O.length()),G.putBuffer(O),G},r.createHeartbeat=function(k,O,P){typeof P>"u"&&(P=O.length);var D=a.util.createBuffer();D.putByte(k),D.putInt16(P),D.putBytes(O);var S=D.length(),f=Math.max(16,S-P-3);return D.putBytes(a.random.getBytes(f)),D},r.queue=function(k,O){if(O&&!(O.fragment.length()===0&&(O.type===r.ContentType.handshake||O.type===r.ContentType.alert||O.type===r.ContentType.change_cipher_spec))){if(O.type===r.ContentType.handshake){var P=O.fragment.bytes();k.session.md5.update(P),k.session.sha1.update(P),P=null}var D;if(O.fragment.length()<=r.MaxFragment)D=[O];else{D=[];for(var S=O.fragment.bytes();S.length>r.MaxFragment;)D.push(r.createRecord(k,{type:O.type,data:a.util.createBuffer(S.slice(0,r.MaxFragment))})),S=S.slice(r.MaxFragment);S.length>0&&D.push(r.createRecord(k,{type:O.type,data:a.util.createBuffer(S)}))}for(var f=0;f<D.length&&!k.fail;++f){var L=D[f],G=k.state.current.write;G.update(k,L)&&k.records.push(L)}}},r.flush=function(k){for(var O=0;O<k.records.length;++O){var P=k.records[O];k.tlsData.putByte(P.type),k.tlsData.putByte(P.version.major),k.tlsData.putByte(P.version.minor),k.tlsData.putInt16(P.fragment.length()),k.tlsData.putBuffer(k.records[O].fragment)}return k.records=[],k.tlsDataReady(k)};var ue=function(k){switch(k){case!0:return!0;case a.pki.certificateError.bad_certificate:return r.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return r.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return r.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return r.Alert.Description.certificate_expired;case a.pki.certificateError.certificate_unknown:return r.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return r.Alert.Description.unknown_ca;default:return r.Alert.Description.bad_certificate}},Se=function(k){switch(k){case!0:return!0;case r.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case r.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case r.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;case r.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case r.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case r.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};r.verifyCertificateChain=function(k,O){try{var P={};for(var D in k.verifyOptions)P[D]=k.verifyOptions[D];P.verify=function(f,L,G){var M=ue(f),V=k.verify(k,f,L,G);if(V!==!0){if(typeof V=="object"&&!a.util.isArray(V)){var K=new Error("The application rejected the certificate.");throw K.send=!0,K.alert={level:r.Alert.Level.fatal,description:r.Alert.Description.bad_certificate},V.message&&(K.message=V.message),V.alert&&(K.alert.description=V.alert),K}V!==f&&(V=Se(V))}return V},a.pki.verifyCertificateChain(k.caStore,O,P)}catch(f){var S=f;(typeof S!="object"||a.util.isArray(S))&&(S={send:!0,alert:{level:r.Alert.Level.fatal,description:ue(f)}}),"send"in S||(S.send=!0),"alert"in S||(S.alert={level:r.Alert.Level.fatal,description:ue(S.error)}),k.error(k,S)}return!k.fail},r.createSessionCache=function(k,O){var P=null;if(k&&k.getSession&&k.setSession&&k.order)P=k;else{P={},P.cache=k||{},P.capacity=Math.max(O||100,1),P.order=[];for(var D in k)P.order.length<=O?P.order.push(D):delete k[D];P.getSession=function(S){var f=null,L=null;if(S?L=a.util.bytesToHex(S):P.order.length>0&&(L=P.order[0]),L!==null&&L in P.cache){f=P.cache[L],delete P.cache[L];for(var G in P.order)if(P.order[G]===L){P.order.splice(G,1);break}}return f},P.setSession=function(S,f){if(P.order.length===P.capacity){var L=P.order.shift();delete P.cache[L]}var L=a.util.bytesToHex(S);P.order.push(L),P.cache[L]=f}}return P},r.createConnection=function(k){var O=null;k.caStore?a.util.isArray(k.caStore)?O=a.pki.createCaStore(k.caStore):O=k.caStore:O=a.pki.createCaStore();var P=k.cipherSuites||null;if(P===null){P=[];for(var D in r.CipherSuites)P.push(r.CipherSuites[D])}var S=k.server?r.ConnectionEnd.server:r.ConnectionEnd.client,f=k.sessionCache?r.createSessionCache(k.sessionCache):null,L={version:{major:r.Version.major,minor:r.Version.minor},entity:S,sessionId:k.sessionId,caStore:O,sessionCache:f,cipherSuites:P,connected:k.connected,virtualHost:k.virtualHost||null,verifyClient:k.verifyClient||!1,verify:k.verify||function(K,X,te,Y){return X},verifyOptions:k.verifyOptions||{},getCertificate:k.getCertificate||null,getPrivateKey:k.getPrivateKey||null,getSignature:k.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:k.tlsDataReady,dataReady:k.dataReady,heartbeatReceived:k.heartbeatReceived,closed:k.closed,error:function(K,X){X.origin=X.origin||(K.entity===r.ConnectionEnd.client?"client":"server"),X.send&&(r.queue(K,r.createAlert(K,X.alert)),r.flush(K));var te=X.fatal!==!1;te&&(K.fail=!0),k.error(K,X),te&&K.close(!1)},deflate:k.deflate||null,inflate:k.inflate||null};L.reset=function(K){L.version={major:r.Version.major,minor:r.Version.minor},L.record=null,L.session=null,L.peerCertificate=null,L.state={pending:null,current:null},L.expect=L.entity===r.ConnectionEnd.client?c:n,L.fragmented=null,L.records=[],L.open=!1,L.handshakes=0,L.handshaking=!1,L.isConnected=!1,L.fail=!(K||typeof K>"u"),L.input.clear(),L.tlsData.clear(),L.data.clear(),L.state.current=r.createConnectionState(L)},L.reset();var G=function(K,X){var te=X.type-r.ContentType.change_cipher_spec,Y=A[K.entity][K.expect];te in Y?Y[te](K,X):r.handleUnexpected(K,X)},M=function(K){var X=0,te=K.input,Y=te.length();if(Y<5)X=5-Y;else{K.record={type:te.getByte(),version:{major:te.getByte(),minor:te.getByte()},length:te.getInt16(),fragment:a.util.createBuffer(),ready:!1};var ae=K.record.version.major===K.version.major;ae&&K.session&&K.session.version&&(ae=K.record.version.minor===K.version.minor),ae||K.error(K,{message:"Incompatible TLS version.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.protocol_version}})}return X},V=function(K){var X=0,te=K.input,Y=te.length();if(Y<K.record.length)X=K.record.length-Y;else{K.record.fragment.putBytes(te.getBytes(K.record.length)),te.compact();var ae=K.state.current.read;ae.update(K,K.record)&&(K.fragmented!==null&&(K.fragmented.type===K.record.type?(K.fragmented.fragment.putBuffer(K.record.fragment),K.record=K.fragmented):K.error(K,{message:"Invalid fragmented record.",send:!0,alert:{level:r.Alert.Level.fatal,description:r.Alert.Description.unexpected_message}})),K.record.ready=!0)}return X};return L.handshake=function(K){if(L.entity!==r.ConnectionEnd.client)L.error(L,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(L.handshaking)L.error(L,{message:"Handshake already in progress.",fatal:!1});else{L.fail&&!L.open&&L.handshakes===0&&(L.fail=!1),L.handshaking=!0,K=K||"";var X=null;K.length>0&&(L.sessionCache&&(X=L.sessionCache.getSession(K)),X===null&&(K="")),K.length===0&&L.sessionCache&&(X=L.sessionCache.getSession(),X!==null&&(K=X.id)),L.session={id:K,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()},X&&(L.version=X.version,L.session.sp=X.sp),L.session.sp.client_random=r.createRandom().getBytes(),L.open=!0,r.queue(L,r.createRecord(L,{type:r.ContentType.handshake,data:r.createClientHello(L)})),r.flush(L)}},L.process=function(K){var X=0;return K&&L.input.putBytes(K),L.fail||(L.record!==null&&L.record.ready&&L.record.fragment.isEmpty()&&(L.record=null),L.record===null&&(X=M(L)),!L.fail&&L.record!==null&&!L.record.ready&&(X=V(L)),!L.fail&&L.record!==null&&L.record.ready&&G(L,L.record)),X},L.prepare=function(K){return r.queue(L,r.createRecord(L,{type:r.ContentType.application_data,data:a.util.createBuffer(K)})),r.flush(L)},L.prepareHeartbeatRequest=function(K,X){return K instanceof a.util.ByteBuffer&&(K=K.bytes()),typeof X>"u"&&(X=K.length),L.expectedHeartbeatPayload=K,r.queue(L,r.createRecord(L,{type:r.ContentType.heartbeat,data:r.createHeartbeat(r.HeartbeatMessageType.heartbeat_request,K,X)})),r.flush(L)},L.close=function(K){if(!L.fail&&L.sessionCache&&L.session){var X={id:L.session.id,version:L.session.version,sp:L.session.sp};X.sp.keys=null,L.sessionCache.setSession(X.id,X)}L.open&&(L.open=!1,L.input.clear(),(L.isConnected||L.handshaking)&&(L.isConnected=L.handshaking=!1,r.queue(L,r.createAlert(L,{level:r.Alert.Level.warning,description:r.Alert.Description.close_notify})),r.flush(L)),L.closed(L)),L.reset(K)},L},Gr=a.tls=a.tls||{};for(var ve in r)typeof r[ve]!="function"&&(a.tls[ve]=r[ve]);return a.tls.prf_tls1=e,a.tls.hmac_sha1=t,a.tls.createSessionCache=r.createSessionCache,a.tls.createConnection=r.createConnection,Gr}var on;function mi(){if(on)return vr.exports;on=1;var a=me();yt(),sn();var e=vr.exports=a.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(c){c.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,c.cipher_type=e.CipherType.block,c.enc_key_length=16,c.block_length=16,c.fixed_iv_length=16,c.record_iv_length=16,c.mac_algorithm=e.MACAlgorithm.hmac_sha1,c.mac_length=20,c.mac_key_length=20},initConnectionState:t},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(c){c.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,c.cipher_type=e.CipherType.block,c.enc_key_length=32,c.block_length=16,c.fixed_iv_length=16,c.record_iv_length=16,c.mac_algorithm=e.MACAlgorithm.hmac_sha1,c.mac_length=20,c.mac_key_length=20},initConnectionState:t};function t(c,l,b){var T=l.entity===a.tls.ConnectionEnd.client;c.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",T?b.keys.server_write_key:b.keys.client_write_key),iv:T?b.keys.server_write_IV:b.keys.client_write_IV},c.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",T?b.keys.client_write_key:b.keys.server_write_key),iv:T?b.keys.client_write_IV:b.keys.server_write_IV},c.read.cipherFunction=u,c.write.cipherFunction=d,c.read.macLength=c.write.macLength=b.mac_length,c.read.macFunction=c.write.macFunction=e.hmac_sha1}function d(c,l){var b=!1,T=l.macFunction(l.macKey,l.sequenceNumber,c);c.fragment.putBytes(T),l.updateSequenceNumber();var E;c.version.minor===e.Versions.TLS_1_0.minor?E=l.cipherState.init?null:l.cipherState.iv:E=a.random.getBytesSync(16),l.cipherState.init=!0;var s=l.cipherState.cipher;return s.start({iv:E}),c.version.minor>=e.Versions.TLS_1_1.minor&&s.output.putBytes(E),s.update(c.fragment),s.finish(x)&&(c.fragment=s.output,c.length=c.fragment.length(),b=!0),b}function x(c,l,b){if(!b){var T=c-l.length()%c;l.fillWithByte(T-1,T)}return!0}function g(c,l,b){var T=!0;if(b){for(var E=l.length(),s=l.last(),v=E-1-s;v<E-1;++v)T=T&&l.at(v)==s;T&&l.truncate(s+1)}return T}function u(c,l){var b=!1,T;c.version.minor===e.Versions.TLS_1_0.minor?T=l.cipherState.init?null:l.cipherState.iv:T=c.fragment.getBytes(16),l.cipherState.init=!0;var E=l.cipherState.cipher;E.start({iv:T}),E.update(c.fragment),b=E.finish(g);var s=l.macLength,v=a.random.getBytesSync(s),h=E.output.length();h>=s?(c.fragment=E.output.getBytes(h-s),v=E.output.getBytes(s)):c.fragment=E.output.getBytes(),c.fragment=a.util.createBuffer(c.fragment),c.length=c.fragment.length();var y=l.macFunction(l.macKey,l.sequenceNumber,c);return l.updateSequenceNumber(),b=r(l.macKey,v,y)&&b,b}function r(c,l,b){var T=a.hmac.create();return T.start("SHA1",c),T.update(l),l=T.digest().getBytes(),T.start(null,null),T.update(b),b=T.digest().getBytes(),l===b}return vr.exports}var Wr={exports:{}},un;function ln(){if(un)return Wr.exports;un=1;var a=me();ct(),Ee();var e=Wr.exports=a.sha512=a.sha512||{};a.md.sha512=a.md.algorithms.sha512=e;var t=a.sha384=a.sha512.sha384=a.sha512.sha384||{};t.create=function(){return e.create("SHA-384")},a.md.sha384=a.md.algorithms.sha384=t,a.sha512.sha256=a.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256,a.sha512.sha224=a.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224,e.create=function(l){if(x||r(),typeof l>"u"&&(l="SHA-512"),!(l in u))throw new Error("Invalid SHA-512 algorithm: "+l);for(var b=u[l],T=null,E=a.util.createBuffer(),s=new Array(80),v=0;v<80;++v)s[v]=new Array(2);var h=64;switch(l){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28;break}var y={algorithm:l.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16};return y.start=function(){y.messageLength=0,y.fullMessageLength=y.messageLength128=[];for(var n=y.messageLengthSize/4,p=0;p<n;++p)y.fullMessageLength.push(0);E=a.util.createBuffer(),T=new Array(b.length);for(var p=0;p<b.length;++p)T[p]=b[p].slice(0);return y},y.start(),y.update=function(n,p){p==="utf8"&&(n=a.util.encodeUtf8(n));var m=n.length;y.messageLength+=m,m=[m/4294967296>>>0,m>>>0];for(var _=y.fullMessageLength.length-1;_>=0;--_)y.fullMessageLength[_]+=m[1],m[1]=m[0]+(y.fullMessageLength[_]/4294967296>>>0),y.fullMessageLength[_]=y.fullMessageLength[_]>>>0,m[0]=m[1]/4294967296>>>0;return E.putBytes(n),c(T,s,E),(E.read>2048||E.length()===0)&&E.compact(),y},y.digest=function(){var n=a.util.createBuffer();n.putBytes(E.bytes());var p=y.fullMessageLength[y.fullMessageLength.length-1]+y.messageLengthSize,m=p&y.blockLength-1;n.putBytes(d.substr(0,y.blockLength-m));for(var _,w,C=y.fullMessageLength[0]*8,o=0;o<y.fullMessageLength.length-1;++o)_=y.fullMessageLength[o+1]*8,w=_/4294967296>>>0,C+=w,n.putInt32(C>>>0),C=_>>>0;n.putInt32(C);for(var i=new Array(T.length),o=0;o<T.length;++o)i[o]=T[o].slice(0);c(i,s,n);var B=a.util.createBuffer(),N;l==="SHA-512"?N=i.length:l==="SHA-384"?N=i.length-2:N=i.length-4;for(var o=0;o<N;++o)B.putInt32(i[o][0]),(o!==N-1||l!=="SHA-512/224")&&B.putInt32(i[o][1]);return B},y};var d=null,x=!1,g=null,u=null;function r(){d="",d+=a.util.fillString("\0",128),g=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],u={},u["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],x=!0}function c(l,b,T){for(var E,s,v,h,y,n,p,m,_,w,C,o,i,B,N,q,I,F,A,H,j,W,re,J,oe,Q,$,ce,ie,ee,ue,Se,ve,k,O,P=T.length();P>=128;){for(ie=0;ie<16;++ie)b[ie][0]=T.getInt32()>>>0,b[ie][1]=T.getInt32()>>>0;for(;ie<80;++ie)Se=b[ie-2],ee=Se[0],ue=Se[1],E=((ee>>>19|ue<<13)^(ue>>>29|ee<<3)^ee>>>6)>>>0,s=((ee<<13|ue>>>19)^(ue<<3|ee>>>29)^(ee<<26|ue>>>6))>>>0,k=b[ie-15],ee=k[0],ue=k[1],v=((ee>>>1|ue<<31)^(ee>>>8|ue<<24)^ee>>>7)>>>0,h=((ee<<31|ue>>>1)^(ee<<24|ue>>>8)^(ee<<25|ue>>>7))>>>0,ve=b[ie-7],O=b[ie-16],ue=s+ve[1]+h+O[1],b[ie][0]=E+ve[0]+v+O[0]+(ue/4294967296>>>0)>>>0,b[ie][1]=ue>>>0;for(i=l[0][0],B=l[0][1],N=l[1][0],q=l[1][1],I=l[2][0],F=l[2][1],A=l[3][0],H=l[3][1],j=l[4][0],W=l[4][1],re=l[5][0],J=l[5][1],oe=l[6][0],Q=l[6][1],$=l[7][0],ce=l[7][1],ie=0;ie<80;++ie)p=((j>>>14|W<<18)^(j>>>18|W<<14)^(W>>>9|j<<23))>>>0,m=((j<<18|W>>>14)^(j<<14|W>>>18)^(W<<23|j>>>9))>>>0,_=(oe^j&(re^oe))>>>0,w=(Q^W&(J^Q))>>>0,y=((i>>>28|B<<4)^(B>>>2|i<<30)^(B>>>7|i<<25))>>>0,n=((i<<4|B>>>28)^(B<<30|i>>>2)^(B<<25|i>>>7))>>>0,C=(i&N|I&(i^N))>>>0,o=(B&q|F&(B^q))>>>0,ue=ce+m+w+g[ie][1]+b[ie][1],E=$+p+_+g[ie][0]+b[ie][0]+(ue/4294967296>>>0)>>>0,s=ue>>>0,ue=n+o,v=y+C+(ue/4294967296>>>0)>>>0,h=ue>>>0,$=oe,ce=Q,oe=re,Q=J,re=j,J=W,ue=H+s,j=A+E+(ue/4294967296>>>0)>>>0,W=ue>>>0,A=I,H=F,I=N,F=q,N=i,q=B,ue=s+h,i=E+v+(ue/4294967296>>>0)>>>0,B=ue>>>0;ue=l[0][1]+B,l[0][0]=l[0][0]+i+(ue/4294967296>>>0)>>>0,l[0][1]=ue>>>0,ue=l[1][1]+q,l[1][0]=l[1][0]+N+(ue/4294967296>>>0)>>>0,l[1][1]=ue>>>0,ue=l[2][1]+F,l[2][0]=l[2][0]+I+(ue/4294967296>>>0)>>>0,l[2][1]=ue>>>0,ue=l[3][1]+H,l[3][0]=l[3][0]+A+(ue/4294967296>>>0)>>>0,l[3][1]=ue>>>0,ue=l[4][1]+W,l[4][0]=l[4][0]+j+(ue/4294967296>>>0)>>>0,l[4][1]=ue>>>0,ue=l[5][1]+J,l[5][0]=l[5][0]+re+(ue/4294967296>>>0)>>>0,l[5][1]=ue>>>0,ue=l[6][1]+Q,l[6][0]=l[6][0]+oe+(ue/4294967296>>>0)>>>0,l[6][1]=ue>>>0,ue=l[7][1]+ce,l[7][0]=l[7][0]+$+(ue/4294967296>>>0)>>>0,l[7][1]=ue>>>0,P-=128}}return Wr.exports}var Qt={},fn;function Ci(){if(fn)return Qt;fn=1;var a=me();ft();var e=a.asn1;return Qt.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Qt.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},Qt}var jr,cn;function xi(){if(cn)return jr;cn=1;var a=me();Gt(),at(),ln(),Ee();var e=Ci(),t=e.publicKeyValidator,d=e.privateKeyValidator;if(typeof x>"u")var x=a.jsbn.BigInteger;var g=a.util.ByteBuffer,u=typeof Buffer>"u"?Uint8Array:Buffer;a.pki=a.pki||{},jr=a.pki.ed25519=a.ed25519=a.ed25519||{};var r=a.ed25519;r.constants={},r.constants.PUBLIC_KEY_BYTE_LENGTH=32,r.constants.PRIVATE_KEY_BYTE_LENGTH=64,r.constants.SEED_BYTE_LENGTH=32,r.constants.SIGN_BYTE_LENGTH=64,r.constants.HASH_BYTE_LENGTH=64,r.generateKeyPair=function(O){O=O||{};var P=O.seed;if(P===void 0)P=a.random.getBytesSync(r.constants.SEED_BYTE_LENGTH);else if(typeof P=="string"){if(P.length!==r.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+r.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(P instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');P=c({message:P,encoding:"binary"});for(var D=new u(r.constants.PUBLIC_KEY_BYTE_LENGTH),S=new u(r.constants.PRIVATE_KEY_BYTE_LENGTH),f=0;f<32;++f)S[f]=P[f];return p(D,S),{publicKey:D,privateKey:S}},r.privateKeyFromAsn1=function(O){var P={},D=[],S=a.asn1.validate(O,d,P,D);if(!S){var f=new Error("Invalid Key.");throw f.errors=D,f}var L=a.asn1.derToOid(P.privateKeyOid),G=a.oids.EdDSA25519;if(L!==G)throw new Error('Invalid OID "'+L+'"; OID must be "'+G+'".');var M=P.privateKey,V=c({message:a.asn1.fromDer(M).value,encoding:"binary"});return{privateKeyBytes:V}},r.publicKeyFromAsn1=function(O){var P={},D=[],S=a.asn1.validate(O,t,P,D);if(!S){var f=new Error("Invalid Key.");throw f.errors=D,f}var L=a.asn1.derToOid(P.publicKeyOid),G=a.oids.EdDSA25519;if(L!==G)throw new Error('Invalid OID "'+L+'"; OID must be "'+G+'".');var M=P.ed25519PublicKey;if(M.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return c({message:M,encoding:"binary"})},r.publicKeyFromPrivateKey=function(O){O=O||{};var P=c({message:O.privateKey,encoding:"binary"});if(P.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.PRIVATE_KEY_BYTE_LENGTH);for(var D=new u(r.constants.PUBLIC_KEY_BYTE_LENGTH),S=0;S<D.length;++S)D[S]=P[32+S];return D},r.sign=function(O){O=O||{};var P=c(O),D=c({message:O.privateKey,encoding:"binary"});if(D.length===r.constants.SEED_BYTE_LENGTH){var S=r.generateKeyPair({seed:D});D=S.privateKey}else if(D.length!==r.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+r.constants.SEED_BYTE_LENGTH+" or "+r.constants.PRIVATE_KEY_BYTE_LENGTH);var f=new u(r.constants.SIGN_BYTE_LENGTH+P.length);m(f,P,P.length,D);for(var L=new u(r.constants.SIGN_BYTE_LENGTH),G=0;G<L.length;++G)L[G]=f[G];return L},r.verify=function(O){O=O||{};var P=c(O);if(O.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var D=c({message:O.signature,encoding:"binary"});if(D.length!==r.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+r.constants.SIGN_BYTE_LENGTH);var S=c({message:O.publicKey,encoding:"binary"});if(S.length!==r.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+r.constants.PUBLIC_KEY_BYTE_LENGTH);var f=new u(r.constants.SIGN_BYTE_LENGTH+P.length),L=new u(r.constants.SIGN_BYTE_LENGTH+P.length),G;for(G=0;G<r.constants.SIGN_BYTE_LENGTH;++G)f[G]=D[G];for(G=0;G<P.length;++G)f[G+r.constants.SIGN_BYTE_LENGTH]=P[G];return _(L,f,f.length,S)>=0};function c(O){var P=O.message;if(P instanceof Uint8Array||P instanceof u)return P;var D=O.encoding;if(P===void 0)if(O.md)P=O.md.digest().getBytes(),D="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof P=="string"&&!D)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof P=="string"){if(typeof Buffer<"u")return Buffer.from(P,D);P=new g(P,D)}else if(!(P instanceof g))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var S=new u(P.length()),f=0;f<S.length;++f)S[f]=P.at(f);return S}var l=ee(),b=ee([1]),T=ee([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=ee([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),s=ee([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=ee([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),h=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),y=ee([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function n(O,P){var D=a.md.sha512.create(),S=new g(O);D.update(S.getBytes(P),"binary");var f=D.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(f,"binary");for(var L=new u(r.constants.HASH_BYTE_LENGTH),G=0;G<64;++G)L[G]=f.charCodeAt(G);return L}function p(O,P){var D=[ee(),ee(),ee(),ee()],S,f=n(P,32);for(f[0]&=248,f[31]&=127,f[31]|=64,oe(D,f),N(O,D),S=0;S<32;++S)P[S+32]=O[S];return 0}function m(O,P,D,S){var f,L,G=new Float64Array(64),M=[ee(),ee(),ee(),ee()],V=n(S,32);V[0]&=248,V[31]&=127,V[31]|=64;var K=D+64;for(f=0;f<D;++f)O[64+f]=P[f];for(f=0;f<32;++f)O[32+f]=V[32+f];var X=n(O.subarray(32),D+32);for(o(X),oe(M,X),N(O,M),f=32;f<64;++f)O[f]=S[f];var te=n(O,D+64);for(o(te),f=32;f<64;++f)G[f]=0;for(f=0;f<32;++f)G[f]=X[f];for(f=0;f<32;++f)for(L=0;L<32;L++)G[f+L]+=te[f]*V[L];return C(O.subarray(32),G),K}function _(O,P,D,S){var f,L,G=new u(32),M=[ee(),ee(),ee(),ee()],V=[ee(),ee(),ee(),ee()];if(L=-1,D<64||I(V,S)||!w(P,32))return-1;for(f=0;f<D;++f)O[f]=P[f];for(f=0;f<32;++f)O[f+32]=S[f];var K=n(O,D);if(o(K),J(M,V,K),oe(V,P.subarray(32)),i(M,V),N(G,M),D-=64,j(P,0,G,0)){for(f=0;f<D;++f)O[f]=0;return-1}for(f=0;f<D;++f)O[f]=P[f+64];return L=D,L}function w(O,P){var D;for(D=31;D>=0;--D){if(O[P+D]<h[D])return!0;if(O[P+D]>h[D])return!1}return!1}function C(O,P){var D,S,f,L;for(S=63;S>=32;--S){for(D=0,f=S-32,L=S-12;f<L;++f)P[f]+=D-16*P[S]*h[f-(S-32)],D=P[f]+128>>8,P[f]-=D*256;P[f]+=D,P[S]=0}for(D=0,f=0;f<32;++f)P[f]+=D-(P[31]>>4)*h[f],D=P[f]>>8,P[f]&=255;for(f=0;f<32;++f)P[f]-=D*h[f];for(S=0;S<32;++S)P[S+1]+=P[S]>>8,O[S]=P[S]&255}function o(O){for(var P=new Float64Array(64),D=0;D<64;++D)P[D]=O[D],O[D]=0;C(O,P)}function i(O,P){var D=ee(),S=ee(),f=ee(),L=ee(),G=ee(),M=ee(),V=ee(),K=ee(),X=ee();Se(D,O[1],O[0]),Se(X,P[1],P[0]),k(D,D,X),ue(S,O[0],O[1]),ue(X,P[0],P[1]),k(S,S,X),k(f,O[3],P[3]),k(f,f,E),k(L,O[2],P[2]),ue(L,L,L),Se(G,S,D),Se(M,L,f),ue(V,L,f),ue(K,S,D),k(O[0],G,M),k(O[1],K,V),k(O[2],V,M),k(O[3],G,K)}function B(O,P,D){for(var S=0;S<4;++S)ie(O[S],P[S],D)}function N(O,P){var D=ee(),S=ee(),f=ee();$(f,P[2]),k(D,P[0],f),k(S,P[1],f),q(O,S),O[31]^=re(D)<<7}function q(O,P){var D,S,f,L=ee(),G=ee();for(D=0;D<16;++D)G[D]=P[D];for(ce(G),ce(G),ce(G),S=0;S<2;++S){for(L[0]=G[0]-65517,D=1;D<15;++D)L[D]=G[D]-65535-(L[D-1]>>16&1),L[D-1]&=65535;L[15]=G[15]-32767-(L[14]>>16&1),f=L[15]>>16&1,L[14]&=65535,ie(G,L,1-f)}for(D=0;D<16;D++)O[2*D]=G[D]&255,O[2*D+1]=G[D]>>8}function I(O,P){var D=ee(),S=ee(),f=ee(),L=ee(),G=ee(),M=ee(),V=ee();return Q(O[2],b),F(O[1],P),ve(f,O[1]),k(L,f,T),Se(f,f,O[2]),ue(L,O[2],L),ve(G,L),ve(M,G),k(V,M,G),k(D,V,f),k(D,D,L),A(D,D),k(D,D,f),k(D,D,L),k(D,D,L),k(O[0],D,L),ve(S,O[0]),k(S,S,L),H(S,f)&&k(O[0],O[0],y),ve(S,O[0]),k(S,S,L),H(S,f)?-1:(re(O[0])===P[31]>>7&&Se(O[0],l,O[0]),k(O[3],O[0],O[1]),0)}function F(O,P){var D;for(D=0;D<16;++D)O[D]=P[2*D]+(P[2*D+1]<<8);O[15]&=32767}function A(O,P){var D=ee(),S;for(S=0;S<16;++S)D[S]=P[S];for(S=250;S>=0;--S)ve(D,D),S!==1&&k(D,D,P);for(S=0;S<16;++S)O[S]=D[S]}function H(O,P){var D=new u(32),S=new u(32);return q(D,O),q(S,P),j(D,0,S,0)}function j(O,P,D,S){return W(O,P,D,S,32)}function W(O,P,D,S,f){var L,G=0;for(L=0;L<f;++L)G|=O[P+L]^D[S+L];return(1&G-1>>>8)-1}function re(O){var P=new u(32);return q(P,O),P[0]&1}function J(O,P,D){var S,f;for(Q(O[0],l),Q(O[1],b),Q(O[2],b),Q(O[3],l),f=255;f>=0;--f)S=D[f/8|0]>>(f&7)&1,B(O,P,S),i(P,O),i(O,O),B(O,P,S)}function oe(O,P){var D=[ee(),ee(),ee(),ee()];Q(D[0],s),Q(D[1],v),Q(D[2],b),k(D[3],s,v),J(O,D,P)}function Q(O,P){var D;for(D=0;D<16;D++)O[D]=P[D]|0}function $(O,P){var D=ee(),S;for(S=0;S<16;++S)D[S]=P[S];for(S=253;S>=0;--S)ve(D,D),S!==2&&S!==4&&k(D,D,P);for(S=0;S<16;++S)O[S]=D[S]}function ce(O){var P,D,S=1;for(P=0;P<16;++P)D=O[P]+S+65535,S=Math.floor(D/65536),O[P]=D-S*65536;O[0]+=S-1+37*(S-1)}function ie(O,P,D){for(var S,f=~(D-1),L=0;L<16;++L)S=f&(O[L]^P[L]),O[L]^=S,P[L]^=S}function ee(O){var P,D=new Float64Array(16);if(O)for(P=0;P<O.length;++P)D[P]=O[P];return D}function ue(O,P,D){for(var S=0;S<16;++S)O[S]=P[S]+D[S]}function Se(O,P,D){for(var S=0;S<16;++S)O[S]=P[S]-D[S]}function ve(O,P){k(O,P,P)}function k(O,P,D){var S,f,L=0,G=0,M=0,V=0,K=0,X=0,te=0,Y=0,ae=0,fe=0,se=0,de=0,ye=0,ge=0,xe=0,be=0,_e=0,Ae=0,Ce=0,Be=0,Ne=0,Ie=0,Qe=0,Ze=0,et=0,nt=0,it=0,Xe=0,st=0,Lt=0,Zt=0,Le=D[0],De=D[1],Ue=D[2],Pe=D[3],Oe=D[4],Fe=D[5],Ve=D[6],Me=D[7],Ke=D[8],ze=D[9],qe=D[10],He=D[11],we=D[12],Re=D[13],Ge=D[14],We=D[15];S=P[0],L+=S*Le,G+=S*De,M+=S*Ue,V+=S*Pe,K+=S*Oe,X+=S*Fe,te+=S*Ve,Y+=S*Me,ae+=S*Ke,fe+=S*ze,se+=S*qe,de+=S*He,ye+=S*we,ge+=S*Re,xe+=S*Ge,be+=S*We,S=P[1],G+=S*Le,M+=S*De,V+=S*Ue,K+=S*Pe,X+=S*Oe,te+=S*Fe,Y+=S*Ve,ae+=S*Me,fe+=S*Ke,se+=S*ze,de+=S*qe,ye+=S*He,ge+=S*we,xe+=S*Re,be+=S*Ge,_e+=S*We,S=P[2],M+=S*Le,V+=S*De,K+=S*Ue,X+=S*Pe,te+=S*Oe,Y+=S*Fe,ae+=S*Ve,fe+=S*Me,se+=S*Ke,de+=S*ze,ye+=S*qe,ge+=S*He,xe+=S*we,be+=S*Re,_e+=S*Ge,Ae+=S*We,S=P[3],V+=S*Le,K+=S*De,X+=S*Ue,te+=S*Pe,Y+=S*Oe,ae+=S*Fe,fe+=S*Ve,se+=S*Me,de+=S*Ke,ye+=S*ze,ge+=S*qe,xe+=S*He,be+=S*we,_e+=S*Re,Ae+=S*Ge,Ce+=S*We,S=P[4],K+=S*Le,X+=S*De,te+=S*Ue,Y+=S*Pe,ae+=S*Oe,fe+=S*Fe,se+=S*Ve,de+=S*Me,ye+=S*Ke,ge+=S*ze,xe+=S*qe,be+=S*He,_e+=S*we,Ae+=S*Re,Ce+=S*Ge,Be+=S*We,S=P[5],X+=S*Le,te+=S*De,Y+=S*Ue,ae+=S*Pe,fe+=S*Oe,se+=S*Fe,de+=S*Ve,ye+=S*Me,ge+=S*Ke,xe+=S*ze,be+=S*qe,_e+=S*He,Ae+=S*we,Ce+=S*Re,Be+=S*Ge,Ne+=S*We,S=P[6],te+=S*Le,Y+=S*De,ae+=S*Ue,fe+=S*Pe,se+=S*Oe,de+=S*Fe,ye+=S*Ve,ge+=S*Me,xe+=S*Ke,be+=S*ze,_e+=S*qe,Ae+=S*He,Ce+=S*we,Be+=S*Re,Ne+=S*Ge,Ie+=S*We,S=P[7],Y+=S*Le,ae+=S*De,fe+=S*Ue,se+=S*Pe,de+=S*Oe,ye+=S*Fe,ge+=S*Ve,xe+=S*Me,be+=S*Ke,_e+=S*ze,Ae+=S*qe,Ce+=S*He,Be+=S*we,Ne+=S*Re,Ie+=S*Ge,Qe+=S*We,S=P[8],ae+=S*Le,fe+=S*De,se+=S*Ue,de+=S*Pe,ye+=S*Oe,ge+=S*Fe,xe+=S*Ve,be+=S*Me,_e+=S*Ke,Ae+=S*ze,Ce+=S*qe,Be+=S*He,Ne+=S*we,Ie+=S*Re,Qe+=S*Ge,Ze+=S*We,S=P[9],fe+=S*Le,se+=S*De,de+=S*Ue,ye+=S*Pe,ge+=S*Oe,xe+=S*Fe,be+=S*Ve,_e+=S*Me,Ae+=S*Ke,Ce+=S*ze,Be+=S*qe,Ne+=S*He,Ie+=S*we,Qe+=S*Re,Ze+=S*Ge,et+=S*We,S=P[10],se+=S*Le,de+=S*De,ye+=S*Ue,ge+=S*Pe,xe+=S*Oe,be+=S*Fe,_e+=S*Ve,Ae+=S*Me,Ce+=S*Ke,Be+=S*ze,Ne+=S*qe,Ie+=S*He,Qe+=S*we,Ze+=S*Re,et+=S*Ge,nt+=S*We,S=P[11],de+=S*Le,ye+=S*De,ge+=S*Ue,xe+=S*Pe,be+=S*Oe,_e+=S*Fe,Ae+=S*Ve,Ce+=S*Me,Be+=S*Ke,Ne+=S*ze,Ie+=S*qe,Qe+=S*He,Ze+=S*we,et+=S*Re,nt+=S*Ge,it+=S*We,S=P[12],ye+=S*Le,ge+=S*De,xe+=S*Ue,be+=S*Pe,_e+=S*Oe,Ae+=S*Fe,Ce+=S*Ve,Be+=S*Me,Ne+=S*Ke,Ie+=S*ze,Qe+=S*qe,Ze+=S*He,et+=S*we,nt+=S*Re,it+=S*Ge,Xe+=S*We,S=P[13],ge+=S*Le,xe+=S*De,be+=S*Ue,_e+=S*Pe,Ae+=S*Oe,Ce+=S*Fe,Be+=S*Ve,Ne+=S*Me,Ie+=S*Ke,Qe+=S*ze,Ze+=S*qe,et+=S*He,nt+=S*we,it+=S*Re,Xe+=S*Ge,st+=S*We,S=P[14],xe+=S*Le,be+=S*De,_e+=S*Ue,Ae+=S*Pe,Ce+=S*Oe,Be+=S*Fe,Ne+=S*Ve,Ie+=S*Me,Qe+=S*Ke,Ze+=S*ze,et+=S*qe,nt+=S*He,it+=S*we,Xe+=S*Re,st+=S*Ge,Lt+=S*We,S=P[15],be+=S*Le,_e+=S*De,Ae+=S*Ue,Ce+=S*Pe,Be+=S*Oe,Ne+=S*Fe,Ie+=S*Ve,Qe+=S*Me,Ze+=S*Ke,et+=S*ze,nt+=S*qe,it+=S*He,Xe+=S*we,st+=S*Re,Lt+=S*Ge,Zt+=S*We,L+=38*_e,G+=38*Ae,M+=38*Ce,V+=38*Be,K+=38*Ne,X+=38*Ie,te+=38*Qe,Y+=38*Ze,ae+=38*et,fe+=38*nt,se+=38*it,de+=38*Xe,ye+=38*st,ge+=38*Lt,xe+=38*Zt,f=1,S=L+f+65535,f=Math.floor(S/65536),L=S-f*65536,S=G+f+65535,f=Math.floor(S/65536),G=S-f*65536,S=M+f+65535,f=Math.floor(S/65536),M=S-f*65536,S=V+f+65535,f=Math.floor(S/65536),V=S-f*65536,S=K+f+65535,f=Math.floor(S/65536),K=S-f*65536,S=X+f+65535,f=Math.floor(S/65536),X=S-f*65536,S=te+f+65535,f=Math.floor(S/65536),te=S-f*65536,S=Y+f+65535,f=Math.floor(S/65536),Y=S-f*65536,S=ae+f+65535,f=Math.floor(S/65536),ae=S-f*65536,S=fe+f+65535,f=Math.floor(S/65536),fe=S-f*65536,S=se+f+65535,f=Math.floor(S/65536),se=S-f*65536,S=de+f+65535,f=Math.floor(S/65536),de=S-f*65536,S=ye+f+65535,f=Math.floor(S/65536),ye=S-f*65536,S=ge+f+65535,f=Math.floor(S/65536),ge=S-f*65536,S=xe+f+65535,f=Math.floor(S/65536),xe=S-f*65536,S=be+f+65535,f=Math.floor(S/65536),be=S-f*65536,L+=f-1+37*(f-1),f=1,S=L+f+65535,f=Math.floor(S/65536),L=S-f*65536,S=G+f+65535,f=Math.floor(S/65536),G=S-f*65536,S=M+f+65535,f=Math.floor(S/65536),M=S-f*65536,S=V+f+65535,f=Math.floor(S/65536),V=S-f*65536,S=K+f+65535,f=Math.floor(S/65536),K=S-f*65536,S=X+f+65535,f=Math.floor(S/65536),X=S-f*65536,S=te+f+65535,f=Math.floor(S/65536),te=S-f*65536,S=Y+f+65535,f=Math.floor(S/65536),Y=S-f*65536,S=ae+f+65535,f=Math.floor(S/65536),ae=S-f*65536,S=fe+f+65535,f=Math.floor(S/65536),fe=S-f*65536,S=se+f+65535,f=Math.floor(S/65536),se=S-f*65536,S=de+f+65535,f=Math.floor(S/65536),de=S-f*65536,S=ye+f+65535,f=Math.floor(S/65536),ye=S-f*65536,S=ge+f+65535,f=Math.floor(S/65536),ge=S-f*65536,S=xe+f+65535,f=Math.floor(S/65536),xe=S-f*65536,S=be+f+65535,f=Math.floor(S/65536),be=S-f*65536,L+=f-1+37*(f-1),O[0]=L,O[1]=G,O[2]=M,O[3]=V,O[4]=K,O[5]=X,O[6]=te,O[7]=Y,O[8]=ae,O[9]=fe,O[10]=se,O[11]=de,O[12]=ye,O[13]=ge,O[14]=xe,O[15]=be}return jr}var Qr,hn;function Ei(){if(hn)return Qr;hn=1;var a=me();Ee(),at(),Gt(),Qr=a.kem=a.kem||{};var e=a.jsbn.BigInteger;a.kem.rsa={},a.kem.rsa.create=function(d,x){x=x||{};var g=x.prng||a.random,u={};return u.encrypt=function(r,c){var l=Math.ceil(r.n.bitLength()/8),b;do b=new e(a.util.bytesToHex(g.getBytesSync(l)),16).mod(r.n);while(b.compareTo(e.ONE)<=0);b=a.util.hexToBytes(b.toString(16));var T=l-b.length;T>0&&(b=a.util.fillString("\0",T)+b);var E=r.encrypt(b,"NONE"),s=d.generate(b,c);return{encapsulation:E,key:s}},u.decrypt=function(r,c,l){var b=r.decrypt(c,"NONE");return d.generate(b,l)},u},a.kem.kdf1=function(d,x){t(this,d,0,x||d.digestLength)},a.kem.kdf2=function(d,x){t(this,d,1,x||d.digestLength)};function t(d,x,g,u){d.generate=function(r,c){for(var l=new a.util.ByteBuffer,b=Math.ceil(c/u)+g,T=new a.util.ByteBuffer,E=g;E<b;++E){T.putInt32(E),x.start(),x.update(r+T.getBytes());var s=x.digest();l.putBytes(s.getBytes(u))}return l.truncate(l.length()-c),l.getBytes()}}return Qr}var Yr,dn;function Si(){if(dn)return Yr;dn=1;var a=me();Ee(),Yr=a.log=a.log||{},a.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},t=[],d=null;a.log.LEVEL_LOCKED=2,a.log.NO_LEVEL_CHECK=4,a.log.INTERPOLATE=8;for(var x=0;x<a.log.levels.length;++x){var g=a.log.levels[x];e[g]={index:x,name:g.toUpperCase()}}a.log.logMessage=function(E){for(var s=e[E.level].index,v=0;v<t.length;++v){var h=t[v];if(h.flags&a.log.NO_LEVEL_CHECK)h.f(E);else{var y=e[h.level].index;s<=y&&h.f(h,E)}}},a.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},a.log.prepareFull=function(E){if(!("full"in E)){var s=[E.message];s=s.concat([]),E.full=a.util.format.apply(this,s)}},a.log.prepareStandardFull=function(E){"standardFull"in E||(a.log.prepareStandard(E),E.standardFull=E.standard)};for(var u=["error","warning","info","debug","verbose"],x=0;x<u.length;++x)(function(s){a.log[s]=function(v,h){var y=Array.prototype.slice.call(arguments).slice(2),n={timestamp:new Date,level:s,category:v,message:h,arguments:y};a.log.logMessage(n)}})(u[x]);if(a.log.makeLogger=function(E){var s={flags:0,f:E};return a.log.setLevel(s,"none"),s},a.log.setLevel=function(E,s){var v=!1;if(E&&!(E.flags&a.log.LEVEL_LOCKED))for(var h=0;h<a.log.levels.length;++h){var y=a.log.levels[h];if(s==y){E.level=s,v=!0;break}}return v},a.log.lock=function(E,s){typeof s>"u"||s?E.flags|=a.log.LEVEL_LOCKED:E.flags&=~a.log.LEVEL_LOCKED},a.log.addLogger=function(E){t.push(E)},typeof console<"u"&&"log"in console){var r;if(console.error&&console.warn&&console.info&&console.debug){var c={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},l=function(E,s){a.log.prepareStandard(s);var v=c[s.level],h=[s.standard];h=h.concat(s.arguments.slice()),v.apply(console,h)};r=a.log.makeLogger(l)}else{var l=function(s,v){a.log.prepareStandardFull(v),console.log(v.standardFull)};r=a.log.makeLogger(l)}a.log.setLevel(r,"debug"),a.log.addLogger(r),d=r}else console={log:function(){}};if(d!==null&&typeof window<"u"&&window.location){var b=new URL(window.location.href).searchParams;if(b.has("console.level")&&a.log.setLevel(d,b.get("console.level").slice(-1)[0]),b.has("console.lock")){var T=b.get("console.lock").slice(-1)[0];T=="true"&&a.log.lock(d)}}return a.log.consoleLogger=d,Yr}var Zr,pn;function bi(){return pn||(pn=1,Zr=ct(),Sr(),Nt(),Na(),ln()),Zr}var Xr={exports:{}},gn;function _i(){if(gn)return Xr.exports;gn=1;var a=me();yt(),ft(),qt(),mt(),xt(),Qa(),at(),Ee(),Hr();var e=a.asn1,t=Xr.exports=a.pkcs7=a.pkcs7||{};t.messageFromPem=function(s){var v=a.pem.decode(s)[0];if(v.type!=="PKCS7"){var h=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw h.headerType=v.type,h}if(v.procType&&v.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var y=e.fromDer(v.body);return t.messageFromAsn1(y)},t.messageToPem=function(s,v){var h={type:"PKCS7",body:e.toDer(s.toAsn1()).getBytes()};return a.pem.encode(h,{maxline:v})},t.messageFromAsn1=function(s){var v={},h=[];if(!e.validate(s,t.asn1.contentInfoValidator,v,h)){var y=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw y.errors=h,y}var n=e.derToOid(v.contentType),p;switch(n){case a.pki.oids.envelopedData:p=t.createEnvelopedData();break;case a.pki.oids.encryptedData:p=t.createEncryptedData();break;case a.pki.oids.signedData:p=t.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return p.fromAsn1(v.content.value[0]),p},t.createSignedData=function(){var s=null;return s={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(y){if(T(s,y,t.asn1.signedDataValidator),s.certificates=[],s.crls=[],s.digestAlgorithmIdentifiers=[],s.contentInfo=null,s.signerInfos=[],s.rawCapture.certificates)for(var n=s.rawCapture.certificates.value,p=0;p<n.length;++p)s.certificates.push(a.pki.certificateFromAsn1(n[p]))},toAsn1:function(){s.contentInfo||s.sign();for(var y=[],n=0;n<s.certificates.length;++n)y.push(a.pki.certificateToAsn1(s.certificates[n]));var p=[],m=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s.digestAlgorithmIdentifiers),s.contentInfo])]);return y.length>0&&m.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,y)),p.length>0&&m.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,p)),m.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),m])},addSigner:function(y){var n=y.issuer,p=y.serialNumber;if(y.certificate){var m=y.certificate;typeof m=="string"&&(m=a.pki.certificateFromPem(m)),n=m.issuer.attributes,p=m.serialNumber}var _=y.key;if(!_)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof _=="string"&&(_=a.pki.privateKeyFromPem(_));var w=y.digestAlgorithm||a.pki.oids.sha1;switch(w){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+w)}var C=y.authenticatedAttributes||[];if(C.length>0){for(var o=!1,i=!1,B=0;B<C.length;++B){var N=C[B];if(!o&&N.type===a.pki.oids.contentType){if(o=!0,i)break;continue}if(!i&&N.type===a.pki.oids.messageDigest){if(i=!0,o)break;continue}}if(!o||!i)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}s.signers.push({key:_,version:1,issuer:n,serialNumber:p,digestAlgorithm:w,signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:C,unauthenticatedAttributes:[]})},sign:function(y){if(y=y||{},(typeof s.content!="object"||s.contentInfo===null)&&(s.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes())]),"content"in s)){var n;s.content instanceof a.util.ByteBuffer?n=s.content.bytes():typeof s.content=="string"&&(n=a.util.encodeUtf8(s.content)),y.detached?s.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n):s.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)]))}if(s.signers.length!==0){var p=v();h(p)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(y){typeof y=="string"&&(y=a.pki.certificateFromPem(y)),s.certificates.push(y)},addCertificateRevokationList:function(y){throw new Error("PKCS#7 CRL support not yet implemented.")}},s;function v(){for(var y={},n=0;n<s.signers.length;++n){var p=s.signers[n],m=p.digestAlgorithm;m in y||(y[m]=a.md[a.pki.oids[m]].create()),p.authenticatedAttributes.length===0?p.md=y[m]:p.md=a.md[a.pki.oids[m]].create()}s.digestAlgorithmIdentifiers=[];for(var m in y)s.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(m).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return y}function h(y){var n;if(s.detachedContent?n=s.detachedContent:(n=s.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var p=e.derToOid(s.contentInfo.value[0].value),m=e.toDer(n);m.getByte(),e.getBerValueLength(m),m=m.getBytes();for(var _ in y)y[_].start().update(m);for(var w=new Date,C=0;C<s.signers.length;++C){var o=s.signers[C];if(o.authenticatedAttributes.length===0){if(p!==a.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{o.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var i=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),B=0;B<o.authenticatedAttributes.length;++B){var N=o.authenticatedAttributes[B];N.type===a.pki.oids.messageDigest?N.value=y[o.digestAlgorithm].digest():N.type===a.pki.oids.signingTime&&(N.value||(N.value=w)),i.value.push(l(N)),o.authenticatedAttributesAsn1.value.push(l(N))}m=e.toDer(i).getBytes(),o.md.start().update(m)}o.signature=o.key.sign(o.md,"RSASSA-PKCS1-V1_5")}s.signerInfos=c(s.signers)}},t.createEncryptedData=function(){var s=null;return s={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(v){T(s,v,t.asn1.encryptedDataValidator)},decrypt:function(v){v!==void 0&&(s.encryptedContent.key=v),E(s)}},s},t.createEnvelopedData=function(){var s=null;return s={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(v){var h=T(s,v,t.asn1.envelopedDataValidator);s.recipients=g(h.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u(s.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,b(s.encryptedContent))])])])},findRecipient:function(v){for(var h=v.issuer.attributes,y=0;y<s.recipients.length;++y){var n=s.recipients[y],p=n.issuer;if(n.serialNumber===v.serialNumber&&p.length===h.length){for(var m=!0,_=0;_<h.length;++_)if(p[_].type!==h[_].type||p[_].value!==h[_].value){m=!1;break}if(m)return n}}return null},decrypt:function(v,h){if(s.encryptedContent.key===void 0&&v!==void 0&&h!==void 0)switch(v.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var y=h.decrypt(v.encryptedContent.content);s.encryptedContent.key=a.util.createBuffer(y);break;default:throw new Error("Unsupported asymmetric cipher, OID "+v.encryptedContent.algorithm)}E(s)},addRecipient:function(v){s.recipients.push({version:0,issuer:v.issuer.attributes,serialNumber:v.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:v.publicKey}})},encrypt:function(v,h){if(s.encryptedContent.content===void 0){h=h||s.encryptedContent.algorithm,v=v||s.encryptedContent.key;var y,n,p;switch(h){case a.pki.oids["aes128-CBC"]:y=16,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:y=24,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:y=32,n=16,p=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:y=24,n=8,p=a.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+h)}if(v===void 0)v=a.util.createBuffer(a.random.getBytes(y));else if(v.length()!=y)throw new Error("Symmetric key has wrong length; got "+v.length()+" bytes, expected "+y+".");s.encryptedContent.algorithm=h,s.encryptedContent.key=v,s.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(n));var m=p(v);if(m.start(s.encryptedContent.parameter.copy()),m.update(s.content),!m.finish())throw new Error("Symmetric encryption failed.");s.encryptedContent.content=m.output}for(var _=0;_<s.recipients.length;++_){var w=s.recipients[_];if(w.encryptedContent.content===void 0)switch(w.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:w.encryptedContent.content=w.encryptedContent.key.encrypt(s.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+w.encryptedContent.algorithm)}}}},s};function d(s){var v={},h=[];if(!e.validate(s,t.asn1.recipientInfoValidator,v,h)){var y=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw y.errors=h,y}return{version:v.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(v.issuer),serialNumber:a.util.createBuffer(v.serial).toHex(),encryptedContent:{algorithm:e.derToOid(v.encAlgorithm),parameter:v.encParameter?v.encParameter.value:void 0,content:v.encKey}}}function x(s){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:s.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(s.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.encryptedContent.content)])}function g(s){for(var v=[],h=0;h<s.length;++h)v.push(d(s[h]));return v}function u(s){for(var v=[],h=0;h<s.length;++h)v.push(x(s[h]));return v}function r(s){var v=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:s.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(s.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(s.authenticatedAttributesAsn1&&v.value.push(s.authenticatedAttributesAsn1),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.signature)),s.unauthenticatedAttributes.length>0){for(var h=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),y=0;y<s.unauthenticatedAttributes.length;++y){var n=s.unauthenticatedAttributes[y];h.values.push(l(n))}v.value.push(h)}return v}function c(s){for(var v=[],h=0;h<s.length;++h)v.push(r(s[h]));return v}function l(s){var v;if(s.type===a.pki.oids.contentType)v=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.value).getBytes());else if(s.type===a.pki.oids.messageDigest)v=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.value.bytes());else if(s.type===a.pki.oids.signingTime){var h=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z"),n=s.value;if(typeof n=="string"){var p=Date.parse(n);isNaN(p)?n.length===13?n=e.utcTimeToDate(n):n=e.generalizedTimeToDate(n):n=new Date(p)}n>=h&&n<y?v=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(n)):v=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(n))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[v])])}function b(s){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.algorithm).getBytes()),s.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s.content.getBytes())])]}function T(s,v,h){var y={},n=[];if(!e.validate(v,h,y,n)){var p=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw p.errors=p,p}var m=e.derToOid(y.contentType);if(m!==a.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(y.encryptedContent){var _="";if(a.util.isArray(y.encryptedContent))for(var w=0;w<y.encryptedContent.length;++w){if(y.encryptedContent[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");_+=y.encryptedContent[w].value}else _=y.encryptedContent;s.encryptedContent={algorithm:e.derToOid(y.encAlgorithm),parameter:a.util.createBuffer(y.encParameter.value),content:a.util.createBuffer(_)}}if(y.content){var _="";if(a.util.isArray(y.content))for(var w=0;w<y.content.length;++w){if(y.content[w].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");_+=y.content[w].value}else _=y.content;s.content=a.util.createBuffer(_)}return s.version=y.version.charCodeAt(0),s.rawCapture=y,y}function E(s){if(s.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(s.content===void 0){var v;switch(s.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:v=a.aes.createDecryptionCipher(s.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:v=a.des.createDecryptionCipher(s.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+s.encryptedContent.algorithm)}if(v.start(s.encryptedContent.parameter),v.update(s.encryptedContent.content),!v.finish())throw new Error("Symmetric decryption failed.");s.content=v.output}}return Xr.exports}var $r={exports:{}},vn;function Ti(){if(vn)return $r.exports;vn=1;var a=me();yt(),Rt(),Sr(),Nt(),Ee();var e=$r.exports=a.ssh=a.ssh||{};e.privateKeyToPutty=function(g,u,r){r=r||"",u=u||"";var c="ssh-rsa",l=u===""?"none":"aes256-cbc",b="PuTTY-User-Key-File-2: "+c+`\r
|
|
16
|
+
`;b+="Encryption: "+l+`\r
|
|
17
|
+
`,b+="Comment: "+r+`\r
|
|
18
|
+
`;var T=a.util.createBuffer();d(T,c),t(T,g.e),t(T,g.n);var E=a.util.encode64(T.bytes(),64),s=Math.floor(E.length/66)+1;b+="Public-Lines: "+s+`\r
|
|
19
|
+
`,b+=E;var v=a.util.createBuffer();t(v,g.d),t(v,g.p),t(v,g.q),t(v,g.qInv);var h;if(!u)h=a.util.encode64(v.bytes(),64);else{var y=v.length()+16-1;y-=y%16;var n=x(v.bytes());n.truncate(n.length()-y+v.length()),v.putBuffer(n);var p=a.util.createBuffer();p.putBuffer(x("\0\0\0\0",u)),p.putBuffer(x("\0\0\0",u));var m=a.aes.createEncryptionCipher(p.truncate(8),"CBC");m.start(a.util.createBuffer().fillWithByte(0,16)),m.update(v.copy()),m.finish();var _=m.output;_.truncate(16),h=a.util.encode64(_.bytes(),64)}s=Math.floor(h.length/66)+1,b+=`\r
|
|
20
|
+
Private-Lines: `+s+`\r
|
|
21
|
+
`,b+=h;var w=x("putty-private-key-file-mac-key",u),C=a.util.createBuffer();d(C,c),d(C,l),d(C,r),C.putInt32(T.length()),C.putBuffer(T),C.putInt32(v.length()),C.putBuffer(v);var o=a.hmac.create();return o.start("sha1",w),o.update(C.bytes()),b+=`\r
|
|
22
|
+
Private-MAC: `+o.digest().toHex()+`\r
|
|
23
|
+
`,b},e.publicKeyToOpenSSH=function(g,u){var r="ssh-rsa";u=u||"";var c=a.util.createBuffer();return d(c,r),t(c,g.e),t(c,g.n),r+" "+a.util.encode64(c.bytes())+" "+u},e.privateKeyToOpenSSH=function(g,u){return u?a.pki.encryptRsaPrivateKey(g,u,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(g)},e.getPublicKeyFingerprint=function(g,u){u=u||{};var r=u.md||a.md.md5.create(),c="ssh-rsa",l=a.util.createBuffer();d(l,c),t(l,g.e),t(l,g.n),r.start(),r.update(l.getBytes());var b=r.digest();if(u.encoding==="hex"){var T=b.toHex();return u.delimiter?T.match(/.{2}/g).join(u.delimiter):T}else{if(u.encoding==="binary")return b.getBytes();if(u.encoding)throw new Error('Unknown encoding "'+u.encoding+'".')}return b};function t(g,u){var r=u.toString(16);r[0]>="8"&&(r="00"+r);var c=a.util.hexToBytes(r);g.putInt32(c.length),g.putBytes(c)}function d(g,u){g.putInt32(u.length),g.putString(u)}function x(){for(var g=a.md.sha1.create(),u=arguments.length,r=0;r<u;++r)g.update(arguments[r]);return g.digest()}return $r.exports}var Jr,yn;function Ai(){return yn||(yn=1,Jr=me(),yt(),mi(),ft(),dr(),qt(),xi(),Rt(),Ei(),Si(),bi(),Za(),wr(),xt(),Ka(),tn(),_i(),an(),qa(),Da(),qr(),at(),Oa(),Ti(),sn(),Ee()),Jr}var ea=Ai();const Ii="evtrsa1",ta=new Map;function mn(a){return a.replace(/\/+$/,"")}function wi(a){return new TextEncoder().encode(a)}function Yt(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}async function Bi(a,e){const t=typeof AbortController<"u"?new AbortController:void 0,d=t?setTimeout(()=>t.abort(),e):void 0;try{const x=await fetch(a,{method:"GET",headers:{Accept:"application/json"},signal:t?.signal}),g=await x.json().catch(()=>({}));if(!x.ok){const u=g?.error?.message??g?.message??`ViewToken public key request failed with status ${x.status}`;throw new Error(u)}return g}finally{d!=null&&clearTimeout(d)}}function ra(a){const e=globalThis.crypto;if(!e?.getRandomValues)throw new Error("[BimEngine] crypto.getRandomValues is required to encrypt viewToken");return e.getRandomValues(new Uint8Array(a))}function ki(a){let e="";return a.forEach(t=>{e+=String.fromCharCode(t)}),e}function Ri(a){const e=new Uint8Array(a.length);for(let t=0;t<a.length;t+=1)e[t]=a.charCodeAt(t)&255;return e}async function Ni(a,e){const t=`${mn(a)}/models/view-token/public-key`,d=await Bi(t,e);if(d.algorithm!=="RSA-OAEP-256"||!d.publicKey)throw new Error("[BimEngine] OpenAPI returned an invalid viewToken public key");return ea.pki.publicKeyFromPem(d.publicKey)}function Li(a,e){const t=mn(a),d=ta.get(t);if(d)return d;const x=Ni(a,e).catch(g=>{throw ta.delete(t),g});return ta.set(t,x),x}async function Di(a,e,t){const d=await Li(a,t),x=ra(32),g=ra(12),u=ra(16),r=JSON.stringify({viewToken:e,timestamp:Date.now(),nonce:Yt(u)}),c=d.encrypt(ki(x),"RSA-OAEP",{md:ea.md.sha256.create(),mgf1:{md:ea.md.sha256.create()}}),l=gi(x,g).encrypt(wi(r));return[Ii,Yt(Ri(c)),Yt(g),Yt(l)].join(".")}function Ui(a){return a.replace(/\/+$/,"")}async function Pi(a,e,t){const d=typeof AbortController<"u"?new AbortController:void 0,x=d?setTimeout(()=>d.abort(),t):void 0;try{const g=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:d?.signal}),u=await g.json().catch(()=>({}));if(!g.ok){const r=u?.error?.message??u?.message??`ViewToken resolve failed with status ${g.status}`;throw new Error(r)}return u}finally{x!=null&&clearTimeout(x)}}function Oi(a){switch(a){case"2d":return"cad_model";case"720":return"panorama";case"gis":return"gis_scene";case"gaussian":return"gaussian_model";case"3d":default:return"model"}}function Fi(a){return{models:[{modelType:a.toLowerCase().endsWith(".json")?"3dtiles":"glb",url:a}]}}function Vi(a,e){return{applicationId:0,engineType:e,assetCategory:Oi(e),url:a,urls:[a],info:e==="gis"?Fi(a):void 0}}async function Mi(a,e,t){const d=a?.sdkAuth;if(!d?.endpoint)return Vi(e,t);let x;(d.token||d.appId&&d.appKey&&d.appSecret)&&(x=(await jn(a,t))?.sdkToken);const u={viewToken:await Di(d.endpoint,e,d.timeoutMs??8e3),engineType:t};return x&&(u.sdkToken=x),Pi(`${Ui(d.endpoint)}/models/view-token/resolve`,u,d.timeoutMs??8e3)}class Cn{eventModule;sceneModule;cameraModule;renderModule;controlModule;loaderModule;isInitialized=!1;options;version=_t;constructor(e){this.options=e,this.initialize(e)}initialize(e){const t={containerId:e.containerId,cameraUp:e.cameraUp??[0,1,0],initialCameraPosition:e.initialCameraPosition??[0,0,6],initialCameraLookAt:e.initialCameraLookAt??[0,0,0],backgroundColor:e.backgroundColor,antialias:e.antialias??!1,showLoadingUI:!1,sharedMemoryForWorkers:e.sharedMemoryForWorkers??!1,gpuAcceleratedSort:e.gpuAcceleratedSort??!1,sphericalHarmonicsDegree:e.sphericalHarmonicsDegree??0,orientationPreset:e.orientationPreset??"x180",viewerOptions:e.viewerOptions},d=document.getElementById(t.containerId);if(!d)throw new Error(`Container with id "${t.containerId}" not found`);this.eventModule=new En,this.sceneModule=new Sn(t.backgroundColor),this.cameraModule=new bn(d,t.cameraUp,t.initialCameraPosition,t.initialCameraLookAt),this.controlModule=new Nn(t.orientationPreset),this.renderModule=new kn(d,this.sceneModule.getScene(),this.cameraModule.getCamera(),t),this.loaderModule=new Fn(this.renderModule.getViewer(),()=>this.controlModule.getOrientationRotation()),this.renderModule.setOnBeforeRender(()=>{this.controlModule.update()}),this.renderModule.setOnFpsUpdated(x=>{this.eventModule.trigger(Je.FpsUpdated,x)}),this.renderModule.startRenderLoop(),this.isInitialized=!0}async loadModel(e,t={}){this.checkInitialized(),this.eventModule.trigger(Je.LoadStart,{url:e,name:t.name});try{const d=await this.loaderModule.loadModel(e,{...t,showLoadingUI:!1,onProgress:(x,g,u)=>{this.eventModule.trigger(Je.LoadProgress,{url:e,name:t.name,progress:x}),t.onProgress?.(x,g,u)}});return this.eventModule.trigger(Je.Loaded,{url:e,name:d.name,progress:100}),d}catch(d){throw this.eventModule.trigger(Je.LoadError,{url:e,name:t.name,error:d instanceof Error?d:new Error(String(d))}),d}}async loadModelFile(e,t={}){this.checkInitialized();const d=e[0]?.name??"local-file";this.eventModule.trigger(Je.LoadStart,{url:d,name:t.name??d});try{const x=await this.loaderModule.loadModelFile(e,{...t,showLoadingUI:!1,onProgress:(g,u,r)=>{this.eventModule.trigger(Je.LoadProgress,{url:d,name:t.name??d,progress:g}),t.onProgress?.(g,u,r)}});return this.eventModule.trigger(Je.Loaded,{url:d,name:x.name,progress:100}),x}catch(x){throw this.eventModule.trigger(Je.LoadError,{url:d,name:t.name??d,error:x instanceof Error?x:new Error(String(x))}),x}}async loadModelByViewToken(e,t={}){const d=await Mi(this.options,e,"gaussian");if(d.assetCategory==="composite_model"&&d.urls.length>1)throw new Error("EngineKernelGaussian: composite_model viewToken is not supported");return this.loadModel(d.url,t)}async unloadModel(e){this.checkInitialized(),await this.loaderModule.unloadModel(e,!1),this.eventModule.trigger(Je.SceneRemoved,{id:e})}setOrientationPreset(e){this.checkInitialized(),this.controlModule.setOrientationPreset(e)}getOrientationPreset(){return this.checkInitialized(),this.controlModule.getOrientationPreset()}resize(e,t){this.checkInitialized();const d=this.renderModule.getDomElement(),x=e??d.parentElement?.clientWidth??d.clientWidth,g=t??d.parentElement?.clientHeight??d.clientHeight;this.renderModule.resize(x,g),this.cameraModule.updateAspectRatio(x,g)}pauseRendering(){this.checkInitialized(),this.renderModule.pauseRendering()}resumeRendering(){this.checkInitialized(),this.renderModule.resumeRendering()}resetFpsStats(){this.checkInitialized(),this.renderModule.resetFpsStats()}getFpsInfo(){return this.checkInitialized(),this.renderModule.getFpsInfo()}on(e,t){this.checkInitialized(),this.eventModule.on(e,t)}off(e,t){this.checkInitialized(),this.eventModule.off(e,t)}getVersion(){return this.version}async dispose(){this.isInitialized&&(await this.loaderModule.clear(!1),await this.renderModule.dispose(),this.controlModule.dispose(),this.cameraModule.dispose(),this.sceneModule.dispose(),this.eventModule.dispose(),this.isInitialized=!1)}checkInitialized(){if(!this.isInitialized)throw new Error("EngineKernelGaussian: Not initialized")}}function Ki(a){return new Cn(a)}rt.GaussianSplats3D=ia,rt.EngineKernelGaussian=Cn,rt.EventTypeGaussian=Je,rt.createEngineGaussian=Ki,Object.defineProperty(rt,Symbol.toStringTag,{value:"Module"})}));
|