iflow-engine-base 3.10.7 → 3.10.8
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 +5 -5
- package/dist/bim-engine-sdk.umd.js +721 -721
- package/dist/chunks/{engine-2d-DsaDpJPQ.js → engine-2d-B8rWZz5y.js} +138 -113
- package/dist/chunks/{engine-3d-XJ7zBlLL.js → engine-3d-RuQU2JFm.js} +625 -590
- package/dist/chunks/{engine-720-CZj_sSsS.js → engine-720-QtnZH4Dk.js} +132 -113
- package/dist/chunks/{engine-gaussian-CX0k_s78.js → engine-gaussian-Bavllo9e.js} +617 -579
- package/dist/chunks/{engine-gis-N6XH8qUs.js → engine-gis-D4z6WKlH.js} +10645 -10542
- package/dist/chunks/{sdk-runtime-DTY-QKTD.js → sdk-runtime-CkKNeQgI.js} +1557 -1513
- package/dist/iflow-engine-base.css +1 -1
- package/dist/index.d.ts +38 -2
- package/dist2d/dwg-preview.es.js +1561 -1504
- package/dist2d/dwg-preview.umd.js +42 -42
- package/distGaussian/gaussian.es.js +9345 -6986
- package/distGaussian/gaussian.umd.js +23 -22
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
(function(Ze,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):(Ze=typeof globalThis<"u"?globalThis:Ze||self,St(Ze.Gaussian={},Ze.THREE,Ze.GaussianSplats3D))})(this,(function(Ze,St,vn){"use strict";function ta(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const lt=ta(St),ra=ta(vn);var ft=(t=>(t.LoadStart="gaussian-load-start",t.LoadProgress="gaussian-load-progress",t.Loaded="gaussian-loaded",t.LoadError="gaussian-load-error",t.SceneRemoved="gaussian-scene-removed",t.FpsUpdated="gaussian-fps-updated",t.ViewChanged="gaussian-view-changed",t))(ft||{});class yn{listeners=new Map;on(e,r){const o=String(e);this.listeners.has(o)||this.listeners.set(o,[]),this.listeners.get(o).push(r)}off(e,r){const o=String(e),E=this.listeners.get(o);if(!E)return;const y=E.indexOf(r);y!==-1&&E.splice(y,1),E.length===0&&this.listeners.delete(o)}trigger(e,r){const o=this.listeners.get(String(e));!o||o.length===0||[...o].forEach(E=>{try{E(r)}catch(y){console.error(`[EventModuleGaussian] event handler failed: ${e}`,y)}})}clear(){this.listeners.clear()}dispose(){this.clear()}}class mn{scene;constructor(e){this.scene=new lt.Scene,e&&(this.scene.background=new lt.Color(e))}getScene(){return this.scene}setBackgroundColor(e){this.scene.background=e==null?null:new lt.Color(e)}dispose(){this.scene.clear(),this.scene.background=null,this.scene.environment=null}}class Cn{camera;container;cameraUp;initialLookAt;constructor(e,r,o,E){this.container=e,this.cameraUp=r,this.initialLookAt=E,this.camera=this.createCamera(o)}createCamera(e){const r=Math.max(this.container.clientWidth,1),o=Math.max(this.container.clientHeight,1),E=new lt.PerspectiveCamera(65,r/o,.1,5e3);return E.position.fromArray(e),E.up.fromArray(this.cameraUp).normalize(),E.lookAt(new lt.Vector3().fromArray(this.initialLookAt)),E.updateProjectionMatrix(),E}getCamera(){return this.camera}updateAspectRatio(e,r){this.camera.aspect=Math.max(e,1)/Math.max(r,1),this.camera.updateProjectionMatrix()}reset(e,r){e&&this.camera.position.fromArray(e),this.camera.lookAt(new lt.Vector3().fromArray(r??this.initialLookAt)),this.camera.updateMatrixWorld(!0)}dispose(){this.camera=null}}const En="iflowbim.cn",xn=512,Sn=128,Tn=150,An=38,kt=290,$t=190;class In{THREE;text;scene;camera;material;sprites=[];size;viewportWidth=0;viewportHeight=0;constructor(e,r=En){this.THREE=e,this.text=r,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=xn,e.height=Sn;const r=e.getContext("2d");return r&&(r.clearRect(0,0,e.width,e.height),r.textAlign="center",r.textBaseline="middle",r.font="600 54px Arial, Helvetica, sans-serif",r.lineWidth=3,r.strokeStyle="rgba(0, 0, 0, 0.20)",r.fillStyle="rgba(255, 255, 255, 0.24)",r.strokeText(this.text,e.width/2,e.height/2),r.fillText(this.text,e.width/2,e.height/2)),e}updateLayout(e,r){if(e===this.viewportWidth&&r===this.viewportHeight)return;this.viewportWidth=e,this.viewportHeight=r,this.camera.left=-e/2,this.camera.right=e/2,this.camera.top=r/2,this.camera.bottom=-r/2,this.camera.updateProjectionMatrix();const o=Math.ceil(e/kt)+2,E=Math.ceil(r/$t)+2,y=o*E;this.ensureSpriteCount(y);let f=0;const a=-e/2-kt/2,p=-r/2-$t/2;for(let l=0;l<E;l+=1)for(let S=0;S<o;S+=1){const R=this.sprites[f],x=a+S*kt+l%2*(kt/2),c=p+l*$t;R.position.set(x,c,0),R.visible=!0,f+=1}for(let l=f;l<this.sprites.length;l+=1)this.sprites[l].visible=!1}ensureSpriteCount(e){for(;this.sprites.length<e;){const r=new this.THREE.Sprite(this.material);r.scale.set(Tn,An,1),r.rotation.z=-.32,r.renderOrder=999999,this.scene.add(r),this.sprites.push(r)}}}class Bn{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,r,o,E){this.container=e,this.renderer=this.createRenderer(E.antialias),this.watermark=new In(lt),this.viewer=new ra.Viewer({selfDrivenMode:!1,renderer:this.renderer,camera:o,threeScene:r,rootElement:e,useBuiltInControls:!0,cameraUp:E.cameraUp,initialCameraPosition:E.initialCameraPosition,initialCameraLookAt:E.initialCameraLookAt,sharedMemoryForWorkers:E.sharedMemoryForWorkers,gpuAcceleratedSort:E.gpuAcceleratedSort,sphericalHarmonicsDegree:E.sphericalHarmonicsDegree,...E.viewerOptions??{}})}createRenderer(e){const r=new lt.WebGLRenderer({antialias:e,alpha:!0,preserveDrawingBuffer:!1});return r.setSize(Math.max(this.container.clientWidth,1),Math.max(this.container.clientHeight,1)),r.setPixelRatio(Math.min(window.devicePixelRatio,2)),this.container.appendChild(r.domElement),r}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(),r=e-this.fpsLastTime;if(r<1e3)return;const o=Math.round(this.fpsFrameCount*1e3/r);this.fpsInfo={fps:o,frameTimeMs:o>0?1e3/o:0,minFps:this.fpsInfo.minFps===0?o:Math.min(this.fpsInfo.minFps,o)},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,r){this.renderer.setSize(Math.max(e,1),Math.max(r,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 bn={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 wn{orientationPreset;constructor(e="x180"){this.orientationPreset=e}setOrientationPreset(e){this.orientationPreset=e}getOrientationPreset(){return this.orientationPreset}getOrientationRotation(){return[...bn[this.orientationPreset]]}active(){}disActive(){}update(){}dispose(){}}function _n(t,e){return`${t}#${e}`}class Rn{viewer;getDefaultRotation;scenes=new Map;constructor(e,r){this.viewer=e,this.getDefaultRotation=r}async loadModel(e,r={}){const o=this.viewer.getSceneCount(),E={showLoadingUI:!0,progressiveLoad:!1,position:[0,0,0],rotation:this.getDefaultRotation(),scale:[1,1,1],...r};await this.viewer.addSplatScene(e,E);const y={id:E.id??_n(e,o),name:E.name??e.split(/[\\/]/).pop()??e,url:e,index:o,options:E};return this.scenes.set(y.id,y),y}async loadModels(e){const r=[];for(const o of e)r.push(await this.loadModel(o.url,o.options));return r}async unloadModel(e,r=!0){const o=this.scenes.get(e);o&&(await this.viewer.removeSplatScene(o.index,r),this.scenes.delete(e),this.reindexScenesAfterRemove(o.index))}getModel(e){return this.scenes.get(e)}getAllModels(){return Array.from(this.scenes.values())}getRawSplatScene(e){const r=typeof e=="number"?e:this.scenes.get(e)?.index;return r==null?void 0:this.viewer.getSplatScene(r)}async clear(e=!1){const r=this.getAllModels().map(o=>o.index);r.length>0&&await this.viewer.removeSplatScenes(r,e),this.scenes.clear()}reindexScenesAfterRemove(e){this.scenes.forEach(r=>{r.index>e&&(r.index-=1)})}}const Tt={version:"3.10.7"}.version;function Zt(){const t=globalThis.crypto?.subtle;if(!t)throw new Error("[BimEngine] Web Crypto API is required for secure sdkAuth credentials mode");return t}function At(t){return new TextEncoder().encode(t)}function It(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function aa(t){let e="";return t.forEach(r=>{e+=String.fromCharCode(r)}),btoa(e)}function Nn(t){const e=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),o=String(t.getUTCDate()).padStart(2,"0");return`${e}${r}${o}`}async function Ln(t){const e=await Zt().digest("SHA-256",It(At(t)));return Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join("")}async function kn(t,e){const r=Zt(),o=await r.importKey("raw",It(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return r.sign("HMAC",o,It(At(e)))}function Un(t){return At([t.appId,t.engineType,t.requestDate,String(t.timestamp),t.nonce].join("|"))}async function Dn(t){const e=Zt(),r=new Date,o=r.getTime(),E=Nn(r),y=globalThis.crypto.randomUUID(),f=globalThis.crypto.getRandomValues(new Uint8Array(12)),a=await Ln(t.appSecret),p=await kn(At(a),E),l=await e.importKey("raw",p,"AES-GCM",!1,["encrypt"]),S=JSON.stringify({appKey:t.appKey,appSecret:t.appSecret}),R=await e.encrypt({name:"AES-GCM",iv:f,additionalData:It(Un({appId:t.appId,engineType:t.engineType,requestDate:E,timestamp:o,nonce:y})),tagLength:128},l,It(At(S)));return{appId:t.appId,engineType:t.engineType,requestDate:E,timestamp:o,nonce:y,iv:aa(f),cipherText:aa(new Uint8Array(R)),sdkVersion:t.sdkVersion,origin:t.origin,product:t.product}}const Jt=new Map;function Ut(t){return t.replace(/\/+$/,"")}function Dt(t){if(t)return t;if(typeof window<"u"&&typeof window.location?.origin=="string")return window.location.origin}function Pn(t,e){return JSON.stringify({endpoint:Ut(t.endpoint),token:t.token??"",appId:t.appId??"",appKey:t.appKey??"",appSecret:t.appSecret??"",origin:Dt(t.origin)??"",product:t.product??"",engineType:e,sdkVersion:Tt})}async function er(t,e,r){const o=typeof AbortController<"u"?new AbortController:void 0,E=o?setTimeout(()=>o.abort(),r):void 0;try{const y=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:o?.signal}),f=await y.json().catch(()=>({}));if(!y.ok){const a=f?.error?.message??f?.message??`SDK authentication failed with status ${y.status}`;throw new Error(a)}return f}finally{E!=null&&clearTimeout(E)}}async function Vn(t,e){const r=await er(`${Ut(t.endpoint)}/oauth/sdk-verify`,{sdkToken:t.token,engineType:e,sdkVersion:Tt,origin:Dt(t.origin),product:t.product},t.timeoutMs??8e3);return r.sdkToken=t.token,r}async function On(t,e){const r=await Dn({appId:t.appId,appKey:t.appKey,appSecret:t.appSecret,engineType:e,sdkVersion:Tt,origin:Dt(t.origin),product:t.product}),o=await er(`${Ut(t.endpoint)}/oauth/sdk-token/secure`,r,t.timeoutMs??8e3),E=await er(`${Ut(t.endpoint)}/oauth/sdk-verify`,{sdkToken:o.sdkToken,engineType:e,sdkVersion:Tt,origin:Dt(t.origin),product:t.product},t.timeoutMs??8e3);return E.sdkToken=o.sdkToken,E}async function Mn(t,e){const r=t?.sdkAuth;if(!r)return null;if(!r.endpoint)throw new Error("[BimEngine] sdkAuth.endpoint is required");if(!r.token&&!(r.appId&&r.appKey&&r.appSecret))return null;const o=Pn(r,e),E=Jt.get(o);if(E){const f=await E;return t&&(t.__sdkAuthSession=f),f}const y=(r.token?Vn(r,e):On(r,e)).then(f=>{if(f.authorized!==!0)throw new Error("[BimEngine] SDK authorization rejected");return t&&(t.__sdkAuthSession=f),f}).catch(f=>{throw Jt.delete(o),f});return Jt.set(o,y),y}function Kn(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function na(t){if(typeof t!="number")throw new TypeError("number expected, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError("positive integer expected, got "+t)}function Qe(t,e,r=""){const o=Kn(t),E=t?.length,y=e!==void 0;if(!o||y&&E!==e){const f=r&&`"${r}" `,a=y?` of length ${e}`:"",p=o?`length=${E}`:`type=${typeof t}`,l=f+"expected Uint8Array"+a+", got "+p;throw o?new RangeError(l):new TypeError(l)}return t}function ia(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Fn(t,e,r=!1){Qe(t,void 0,"output");const o=e.outputLen;if(t.length<o)throw new RangeError("digestInto() expects output buffer of length at least "+o);if(r&&!Bt(t))throw new Error("invalid output, must be aligned")}function qn(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}function pt(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ct(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Pt(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const tr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,sa=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,xe=tr?t=>t:t=>sa(t)>>>0,rr=tr?t=>t:t=>{for(let e=0;e<t.length;e++)t[e]=sa(t[e]);return t};function Hn(t,e){if(t.length!==e.length)return!1;let r=0;for(let o=0;o<t.length;o++)r|=t[o]^e[o];return r===0}function Gn(t,e,r){const o=e,E=r||(()=>[]),y=(a,p)=>o(p,...E(a)).update(a).digest(),f=o(new Uint8Array(t),...E(new Uint8Array(0)));return y.outputLen=f.outputLen,y.blockLen=f.blockLen,y.create=(a,...p)=>o(a,...p),y}const zn=(t,e)=>{function r(o,...E){if(Qe(o,void 0,"key"),t.nonceLength!==void 0){const S=E[0];Qe(S,t.varSizeNonce?void 0:t.nonceLength,"nonce")}const y=t.tagLength;y&&E[1]!==void 0&&Qe(E[1],void 0,"AAD");const f=e(o,...E),a=(S,R)=>{if(R!==void 0){if(S!==2)throw new Error("cipher output not supported");Qe(R,void 0,"output")}};let p=!1;return{encrypt(S,R){if(p)throw new Error("cannot encrypt() twice with same key + nonce");return p=!0,Qe(S),a(f.encrypt.length,R),f.encrypt(S,R)},decrypt(S,R){if(Qe(S),y&&S.length<y)throw new Error('"ciphertext" expected length bigger than tagLength='+y);return a(f.decrypt.length,R),f.decrypt(S,R)}}}return Object.assign(r,t),r};function Qn(t,e,r=!0){if(e===void 0)return new Uint8Array(t);if(Qe(e,void 0,"output"),e.length!==t)throw new Error('"output" expected Uint8Array of length '+t+", got: "+e.length);if(r&&!Bt(e))throw new Error("invalid output, must be aligned");return e}function Wn(t,e,r){na(t),na(e);const o=new Uint8Array(16),E=Pt(o);return E.setBigUint64(0,BigInt(e),r),E.setBigUint64(8,BigInt(t),r),o}function Bt(t){return t.byteOffset%4===0}function bt(t){return Uint8Array.from(Qe(t))}const mt=16,oa=new Uint8Array(16),wt=pt(oa),Yn=225,Xn=(t,e,r,o)=>{const E=o&1;return{s3:r<<31|o>>>1,s2:e<<31|r>>>1,s1:t<<31|e>>>1,s0:t>>>1^Yn<<24&-(E&1)}},Vt=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255|0,jn=t=>t>64*1024?8:t>1024?4:2;class $n{blockLen=mt;outputLen=mt;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(e,r){Qe(e,16,"key"),e=bt(e);const o=Pt(e);let E=o.getUint32(0,!1),y=o.getUint32(4,!1),f=o.getUint32(8,!1),a=o.getUint32(12,!1);const p=[];for(let g=0;g<128;g++)p.push({s0:Vt(E),s1:Vt(y),s2:Vt(f),s3:Vt(a)}),{s0:E,s1:y,s2:f,s3:a}=Xn(E,y,f,a);const l=jn(r||1024);if(![1,2,4,8].includes(l))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=l;const R=128/l,x=this.windowSize=2**l,c=[];for(let g=0;g<R;g++)for(let C=0;C<x;C++){let m=0,i=0,h=0,v=0;for(let I=0;I<l;I++){if(!(C>>>l-I-1&1))continue;const{s0:d,s1:s,s2:n,s3:B}=p[l*g+I];m^=d,i^=s,h^=n,v^=B}c.push({s0:m,s1:i,s2:h,s3:v})}this.t=c}_updateBlock(e,r,o,E){e^=this.s0,r^=this.s1,o^=this.s2,E^=this.s3;const{W:y,t:f,windowSize:a}=this;let p=0,l=0,S=0,R=0;const x=(1<<y)-1;let c=0;for(const g of[e,r,o,E])for(let C=0;C<4;C++){const m=g>>>8*C&255;for(let i=8/y-1;i>=0;i--){const h=m>>>y*i&x,{s0:v,s1:I,s2:N,s3:d}=f[c*a+h];p^=v,l^=I,S^=N,R^=d,c+=1}}this.s0=p,this.s1=l,this.s2=S,this.s3=R}update(e){ia(this),Qe(e),e=bt(e);const r=pt(e),o=Math.floor(e.length/mt),E=e.length%mt;for(let y=0;y<o;y++)this._updateBlock(xe(r[y*4+0]),xe(r[y*4+1]),xe(r[y*4+2]),xe(r[y*4+3]));return E&&(oa.set(e.subarray(o*mt)),this._updateBlock(xe(wt[0]),xe(wt[1]),xe(wt[2]),xe(wt[3])),ct(wt)),this}destroy(){this.destroyed=!0;const{t:e}=this;for(const r of e)r.s0=0,r.s1=0,r.s2=0,r.s3=0}digestInto(e){ia(this),Fn(e,this,!0),this.finished=!0;const{s0:r,s1:o,s2:E,s3:y}=this,f=pt(e);f[0]=r,f[1]=o,f[2]=E,f[3]=y,rr(f)}digest(){const e=new Uint8Array(mt);return this.digestInto(e),this.destroy(),e}}const ua=Gn(16,(t,e)=>new $n(t,e),t=>[t.length]),ar=16,Zn=4,Ot=new Uint8Array(ar),Jn=283;function ei(t){if(![16,24,32].includes(t.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+t.length)}function nr(t){return t<<1^Jn&-(t>>7)}function la(t,e){let r=0;for(;e>0;e>>=1)r^=t&-(e&1),t=nr(t);return r}const ti=(()=>{const t=new Uint8Array(256);for(let r=0,o=1;r<256;r++,o^=nr(o))t[r]=o;const e=new Uint8Array(256);e[0]=99;for(let r=0;r<255;r++){let o=t[255-r];o|=o<<8,e[t[r]]=(o^o>>4^o>>5^o>>6^o>>7^99)&255}return ct(t),e})(),ri=t=>t<<24|t>>>8,ir=t=>t<<8|t>>>24;function ai(t,e){if(t.length!==256)throw new Error("Wrong sbox length");const r=new Uint32Array(256).map((l,S)=>e(t[S])),o=r.map(ir),E=o.map(ir),y=E.map(ir),f=new Uint32Array(256*256),a=new Uint32Array(256*256),p=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let S=0;S<256;S++){const R=l*256+S;f[R]=r[l]^o[S],a[R]=E[l]^y[S],p[R]=t[l]<<8|t[S]}return{sbox:t,sbox2:p,T0:r,T1:o,T2:E,T3:y,T01:f,T23:a}}const fa=ai(ti,t=>la(t,3)<<24|t<<16|t<<8|la(t,2)),ni=(()=>{const t=new Uint8Array(16);for(let e=0,r=1;e<16;e++,r=nr(r))t[e]=r;return t})();function ii(t){Qe(t);const e=t.length;ei(t);const{sbox2:r}=fa,o=[];(!tr||!Bt(t))&&o.push(t=bt(t));const E=rr(pt(t)),y=E.length,f=p=>_t(r,p,p,p,p),a=new Uint32Array(e+28);a.set(E);for(let p=y;p<a.length;p++){let l=a[p-1];p%y===0?l=f(ri(l))^ni[p/y-1]:y>6&&p%y===4&&(l=f(l)),a[p]=a[p-y]^l}return ct(...o),a}function Mt(t,e,r,o,E,y){return t[r<<8&65280|o>>>8&255]^e[E>>>8&65280|y>>>24&255]}function _t(t,e,r,o,E){return t[e&255|r&65280]|t[o>>>16&255|E>>>16&65280]<<16}function ca(t,e,r,o,E){const{sbox2:y,T01:f,T23:a}=fa;let p=0;e^=t[p++],r^=t[p++],o^=t[p++],E^=t[p++];const l=t.length/4-2;for(let g=0;g<l;g++){const C=t[p++]^Mt(f,a,e,r,o,E),m=t[p++]^Mt(f,a,r,o,E,e),i=t[p++]^Mt(f,a,o,E,e,r),h=t[p++]^Mt(f,a,E,e,r,o);e=C,r=m,o=i,E=h}const S=t[p++]^_t(y,e,r,o,E),R=t[p++]^_t(y,r,o,E,e),x=t[p++]^_t(y,o,E,e,r),c=t[p++]^_t(y,E,e,r,o);return{s0:S,s1:R,s2:x,s3:c}}function Kt(t,e,r,o,E){Qe(r,ar,"nonce"),Qe(o),E=Qn(o.length,E);const y=r,f=pt(y),a=Pt(y),p=pt(o),l=pt(E),S=e?0:12,R=o.length;let x=a.getUint32(S,e),{s0:c,s1:g,s2:C,s3:m}=ca(t,xe(f[0]),xe(f[1]),xe(f[2]),xe(f[3]));for(let h=0;h+4<=p.length;h+=4)l[h+0]=p[h+0]^xe(c),l[h+1]=p[h+1]^xe(g),l[h+2]=p[h+2]^xe(C),l[h+3]=p[h+3]^xe(m),x=x+1>>>0,a.setUint32(S,x,e),{s0:c,s1:g,s2:C,s3:m}=ca(t,xe(f[0]),xe(f[1]),xe(f[2]),xe(f[3]));const i=ar*Math.floor(p.length/Zn);if(i<R){const h=new Uint32Array([c,g,C,m]);rr(h);const v=qn(h);for(let I=i,N=0;I<R;I++,N++)E[I]=o[I]^v[N];ct(h)}return E}function si(t,e,r,o,E){const y=E?E.length:0,f=t.create(r,o.length+y);E&&f.update(E);const a=Wn(8*o.length,8*y,e);f.update(o),f.update(a);const p=f.digest();return ct(a),p}const oi=zn({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(e,r,o){if(r.length<8)throw new Error("aes/gcm: invalid nonce length");const E=16;function y(a,p,l){const S=si(ua,!1,a,l,o);for(let R=0;R<p.length;R++)S[R]^=p[R];return S}function f(){const a=ii(e),p=Ot.slice(),l=Ot.slice();if(Kt(a,!1,l,l,p),r.length===12)l.set(r);else{const R=Ot.slice();Pt(R).setBigUint64(8,BigInt(r.length*8),!1);const c=ua.create(p).update(r).update(R);c.digestInto(l),c.destroy()}const S=Kt(a,!1,l,Ot);return{xk:a,authKey:p,counter:l,tagMask:S}}return{encrypt(a){const{xk:p,authKey:l,counter:S,tagMask:R}=f(),x=new Uint8Array(a.length+E),c=[p,l,S,R];Bt(a)||c.push(a=bt(a)),Kt(p,!1,S,a,x.subarray(0,a.length));const g=y(l,R,x.subarray(0,x.length-E));return c.push(g),x.set(g,a.length),ct(...c),x},decrypt(a){const{xk:p,authKey:l,counter:S,tagMask:R}=f(),x=[p,l,R,S];Bt(a)||x.push(a=bt(a));const c=a.subarray(0,-E),g=a.subarray(-E),C=y(l,R,c);if(x.push(C),!Hn(C,g))throw ct(...x),new Error("aes/gcm: invalid ghash tag");const m=Kt(p,!1,S,c);return ct(...x),m}}});var ui=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function li(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function o(){var E=!1;try{E=this instanceof o}catch{}return E?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var E=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r,o,E.get?E:{enumerable:!0,get:function(){return t[o]}})}),r}var sr,da;function ue(){return da||(da=1,sr={options:{usePureJavaScript:!1}}),sr}var or={exports:{}},ur,ha;function fi(){if(ha)return ur;ha=1;var t={};ur=t;var e={};t.encode=function(o,E,y){if(typeof E!="string")throw new TypeError('"alphabet" must be a string.');if(y!==void 0&&typeof y!="number")throw new TypeError('"maxline" must be a number.');var f="";if(!(o instanceof Uint8Array))f=r(o,E);else{var a=0,p=E.length,l=E.charAt(0),S=[0];for(a=0;a<o.length;++a){for(var R=0,x=o[a];R<S.length;++R)x+=S[R]<<8,S[R]=x%p,x=x/p|0;for(;x>0;)S.push(x%p),x=x/p|0}for(a=0;o[a]===0&&a<o.length-1;++a)f+=l;for(a=S.length-1;a>=0;--a)f+=E[S[a]]}if(y){var c=new RegExp(".{1,"+y+"}","g");f=f.match(c).join(`\r
|
|
2
|
-
`)}return f},t.decode=function(o,E){if(typeof o!="string")throw new TypeError('"input" must be a string.');if(typeof E!="string")throw new TypeError('"alphabet" must be a string.');var y=e[E];if(!y){y=e[E]=[];for(var f=0;f<E.length;++f)y[E.charCodeAt(f)]=f}o=o.replace(/\s/g,"");for(var a=E.length,p=E.charAt(0),l=[0],f=0;f<o.length;f++){var S=y[o.charCodeAt(f)];if(S===void 0)return;for(var R=0,x=S;R<l.length;++R)x+=l[R]*a,l[R]=x&255,x>>=8;for(;x>0;)l.push(x&255),x>>=8}for(var c=0;o[c]===p&&c<o.length-1;++c)l.push(0);return typeof Buffer<"u"?Buffer.from(l.reverse()):new Uint8Array(l.reverse())};function r(o,E){var y=0,f=E.length,a=E.charAt(0),p=[0];for(y=0;y<o.length();++y){for(var l=0,S=o.at(y);l<p.length;++l)S+=p[l]<<8,p[l]=S%f,S=S/f|0;for(;S>0;)p.push(S%f),S=S/f|0}var R="";for(y=0;o.at(y)===0&&y<o.length()-1;++y)R+=a;for(y=p.length-1;y>=0;--y)R+=E[p[y]];return R}return ur}var pa;function ce(){if(pa)return or.exports;pa=1;var t=ue(),e=fi(),r=or.exports=t.util=t.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){r.nextTick=process.nextTick,typeof setImmediate=="function"?r.setImmediate=setImmediate:r.setImmediate=r.nextTick;return}if(typeof setImmediate=="function"){r.setImmediate=function(){return setImmediate.apply(void 0,arguments)},r.nextTick=function(s){return setImmediate(s)};return}if(r.setImmediate=function(s){setTimeout(s,0)},typeof window<"u"&&typeof window.postMessage=="function"){let s=function(n){if(n.source===window&&n.data===i){n.stopPropagation();var B=h.slice();h.length=0,B.forEach(function(U){U()})}};var i="forge.setImmediate",h=[];r.setImmediate=function(n){h.push(n),h.length===1&&window.postMessage(i,"*")},window.addEventListener("message",s,!0)}if(typeof MutationObserver<"u"){var v=Date.now(),I=!0,N=document.createElement("div"),h=[];new MutationObserver(function(){var n=h.slice();h.length=0,n.forEach(function(B){B()})}).observe(N,{attributes:!0});var d=r.setImmediate;r.setImmediate=function(n){Date.now()-v>15?(v=Date.now(),d(n)):(h.push(n),h.length===1&&N.setAttribute("a",I=!I))}}r.nextTick=r.setImmediate})(),r.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,r.globalScope=(function(){return r.isNodejs?ui:typeof self>"u"?window:self})(),r.isArray=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},r.isArrayBuffer=function(i){return typeof ArrayBuffer<"u"&&i instanceof ArrayBuffer},r.isArrayBufferView=function(i){return i&&r.isArrayBuffer(i.buffer)&&i.byteLength!==void 0};function o(i){if(!(i===8||i===16||i===24||i===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+i)}r.ByteBuffer=E;function E(i){if(this.data="",this.read=0,typeof i=="string")this.data=i;else if(r.isArrayBuffer(i)||r.isArrayBufferView(i))if(typeof Buffer<"u"&&i instanceof Buffer)this.data=i.toString("binary");else{var h=new Uint8Array(i);try{this.data=String.fromCharCode.apply(null,h)}catch{for(var v=0;v<h.length;++v)this.putByte(h[v])}}else(i instanceof E||typeof i=="object"&&typeof i.data=="string"&&typeof i.read=="number")&&(this.data=i.data,this.read=i.read);this._constructedStringLength=0}r.ByteStringBuffer=E;var y=4096;r.ByteStringBuffer.prototype._optimizeConstructedString=function(i){this._constructedStringLength+=i,this._constructedStringLength>y&&(this.data.substr(0,1),this._constructedStringLength=0)},r.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},r.ByteStringBuffer.prototype.putByte=function(i){return this.putBytes(String.fromCharCode(i))},r.ByteStringBuffer.prototype.fillWithByte=function(i,h){i=String.fromCharCode(i);for(var v=this.data;h>0;)h&1&&(v+=i),h>>>=1,h>0&&(i+=i);return this.data=v,this._optimizeConstructedString(h),this},r.ByteStringBuffer.prototype.putBytes=function(i){return this.data+=i,this._optimizeConstructedString(i.length),this},r.ByteStringBuffer.prototype.putString=function(i){return this.putBytes(r.encodeUtf8(i))},r.ByteStringBuffer.prototype.putInt16=function(i){return this.putBytes(String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},r.ByteStringBuffer.prototype.putInt24=function(i){return this.putBytes(String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},r.ByteStringBuffer.prototype.putInt32=function(i){return this.putBytes(String.fromCharCode(i>>24&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255))},r.ByteStringBuffer.prototype.putInt16Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255))},r.ByteStringBuffer.prototype.putInt24Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i>>16&255))},r.ByteStringBuffer.prototype.putInt32Le=function(i){return this.putBytes(String.fromCharCode(i&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>24&255))},r.ByteStringBuffer.prototype.putInt=function(i,h){o(h);var v="";do h-=8,v+=String.fromCharCode(i>>h&255);while(h>0);return this.putBytes(v)},r.ByteStringBuffer.prototype.putSignedInt=function(i,h){return i<0&&(i+=2<<h-1),this.putInt(i,h)},r.ByteStringBuffer.prototype.putBuffer=function(i){return this.putBytes(i.getBytes())},r.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},r.ByteStringBuffer.prototype.getInt16=function(){var i=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,i},r.ByteStringBuffer.prototype.getInt24=function(){var i=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,i},r.ByteStringBuffer.prototype.getInt32=function(){var i=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,i},r.ByteStringBuffer.prototype.getInt16Le=function(){var i=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,i},r.ByteStringBuffer.prototype.getInt24Le=function(){var i=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,i},r.ByteStringBuffer.prototype.getInt32Le=function(){var i=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,i},r.ByteStringBuffer.prototype.getInt=function(i){o(i);var h=0;do h=(h<<8)+this.data.charCodeAt(this.read++),i-=8;while(i>0);return h},r.ByteStringBuffer.prototype.getSignedInt=function(i){var h=this.getInt(i),v=2<<i-2;return h>=v&&(h-=v<<1),h},r.ByteStringBuffer.prototype.getBytes=function(i){var h;return i?(i=Math.min(this.length(),i),h=this.data.slice(this.read,this.read+i),this.read+=i):i===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},r.ByteStringBuffer.prototype.bytes=function(i){return typeof i>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+i)},r.ByteStringBuffer.prototype.at=function(i){return this.data.charCodeAt(this.read+i)},r.ByteStringBuffer.prototype.setAt=function(i,h){return this.data=this.data.substr(0,this.read+i)+String.fromCharCode(h)+this.data.substr(this.read+i+1),this},r.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},r.ByteStringBuffer.prototype.copy=function(){var i=r.createBuffer(this.data);return i.read=this.read,i},r.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},r.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},r.ByteStringBuffer.prototype.truncate=function(i){var h=Math.max(0,this.length()-i);return this.data=this.data.substr(this.read,h),this.read=0,this},r.ByteStringBuffer.prototype.toHex=function(){for(var i="",h=this.read;h<this.data.length;++h){var v=this.data.charCodeAt(h);v<16&&(i+="0"),i+=v.toString(16)}return i},r.ByteStringBuffer.prototype.toString=function(){return r.decodeUtf8(this.bytes())};function f(i,h){h=h||{},this.read=h.readOffset||0,this.growSize=h.growSize||1024;var v=r.isArrayBuffer(i),I=r.isArrayBufferView(i);if(v||I){v?this.data=new DataView(i):this.data=new DataView(i.buffer,i.byteOffset,i.byteLength),this.write="writeOffset"in h?h.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,i!=null&&this.putBytes(i),"writeOffset"in h&&(this.write=h.writeOffset)}r.DataBuffer=f,r.DataBuffer.prototype.length=function(){return this.write-this.read},r.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},r.DataBuffer.prototype.accommodate=function(i,h){if(this.length()>=i)return this;h=Math.max(h||this.growSize,i);var v=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),I=new Uint8Array(this.length()+h);return I.set(v),this.data=new DataView(I.buffer),this},r.DataBuffer.prototype.putByte=function(i){return this.accommodate(1),this.data.setUint8(this.write++,i),this},r.DataBuffer.prototype.fillWithByte=function(i,h){this.accommodate(h);for(var v=0;v<h;++v)this.data.setUint8(i);return this},r.DataBuffer.prototype.putBytes=function(i,h){if(r.isArrayBufferView(i)){var v=new Uint8Array(i.buffer,i.byteOffset,i.byteLength),I=v.byteLength-v.byteOffset;this.accommodate(I);var N=new Uint8Array(this.data.buffer,this.write);return N.set(v),this.write+=I,this}if(r.isArrayBuffer(i)){var v=new Uint8Array(i);this.accommodate(v.byteLength);var N=new Uint8Array(this.data.buffer);return N.set(v,this.write),this.write+=v.byteLength,this}if(i instanceof r.DataBuffer||typeof i=="object"&&typeof i.read=="number"&&typeof i.write=="number"&&r.isArrayBufferView(i.data)){var v=new Uint8Array(i.data.byteLength,i.read,i.length());this.accommodate(v.byteLength);var N=new Uint8Array(i.data.byteLength,this.write);return N.set(v),this.write+=v.byteLength,this}if(i instanceof r.ByteStringBuffer&&(i=i.data,h="binary"),h=h||"binary",typeof i=="string"){var d;if(h==="hex")return this.accommodate(Math.ceil(i.length/2)),d=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.hex.decode(i,d,this.write),this;if(h==="base64")return this.accommodate(Math.ceil(i.length/4)*3),d=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.base64.decode(i,d,this.write),this;if(h==="utf8"&&(i=r.encodeUtf8(i),h="binary"),h==="binary"||h==="raw")return this.accommodate(i.length),d=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.raw.decode(d),this;if(h==="utf16")return this.accommodate(i.length*2),d=new Uint16Array(this.data.buffer,this.write),this.write+=r.text.utf16.encode(d),this;throw new Error("Invalid encoding: "+h)}throw Error("Invalid parameter: "+i)},r.DataBuffer.prototype.putBuffer=function(i){return this.putBytes(i),i.clear(),this},r.DataBuffer.prototype.putString=function(i){return this.putBytes(i,"utf16")},r.DataBuffer.prototype.putInt16=function(i){return this.accommodate(2),this.data.setInt16(this.write,i),this.write+=2,this},r.DataBuffer.prototype.putInt24=function(i){return this.accommodate(3),this.data.setInt16(this.write,i>>8&65535),this.data.setInt8(this.write,i>>16&255),this.write+=3,this},r.DataBuffer.prototype.putInt32=function(i){return this.accommodate(4),this.data.setInt32(this.write,i),this.write+=4,this},r.DataBuffer.prototype.putInt16Le=function(i){return this.accommodate(2),this.data.setInt16(this.write,i,!0),this.write+=2,this},r.DataBuffer.prototype.putInt24Le=function(i){return this.accommodate(3),this.data.setInt8(this.write,i>>16&255),this.data.setInt16(this.write,i>>8&65535,!0),this.write+=3,this},r.DataBuffer.prototype.putInt32Le=function(i){return this.accommodate(4),this.data.setInt32(this.write,i,!0),this.write+=4,this},r.DataBuffer.prototype.putInt=function(i,h){o(h),this.accommodate(h/8);do h-=8,this.data.setInt8(this.write++,i>>h&255);while(h>0);return this},r.DataBuffer.prototype.putSignedInt=function(i,h){return o(h),this.accommodate(h/8),i<0&&(i+=2<<h-1),this.putInt(i,h)},r.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},r.DataBuffer.prototype.getInt16=function(){var i=this.data.getInt16(this.read);return this.read+=2,i},r.DataBuffer.prototype.getInt24=function(){var i=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,i},r.DataBuffer.prototype.getInt32=function(){var i=this.data.getInt32(this.read);return this.read+=4,i},r.DataBuffer.prototype.getInt16Le=function(){var i=this.data.getInt16(this.read,!0);return this.read+=2,i},r.DataBuffer.prototype.getInt24Le=function(){var i=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,i},r.DataBuffer.prototype.getInt32Le=function(){var i=this.data.getInt32(this.read,!0);return this.read+=4,i},r.DataBuffer.prototype.getInt=function(i){o(i);var h=0;do h=(h<<8)+this.data.getInt8(this.read++),i-=8;while(i>0);return h},r.DataBuffer.prototype.getSignedInt=function(i){var h=this.getInt(i),v=2<<i-2;return h>=v&&(h-=v<<1),h},r.DataBuffer.prototype.getBytes=function(i){var h;return i?(i=Math.min(this.length(),i),h=this.data.slice(this.read,this.read+i),this.read+=i):i===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},r.DataBuffer.prototype.bytes=function(i){return typeof i>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+i)},r.DataBuffer.prototype.at=function(i){return this.data.getUint8(this.read+i)},r.DataBuffer.prototype.setAt=function(i,h){return this.data.setUint8(i,h),this},r.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},r.DataBuffer.prototype.copy=function(){return new r.DataBuffer(this)},r.DataBuffer.prototype.compact=function(){if(this.read>0){var i=new Uint8Array(this.data.buffer,this.read),h=new Uint8Array(i.byteLength);h.set(i),this.data=new DataView(h),this.write-=this.read,this.read=0}return this},r.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},r.DataBuffer.prototype.truncate=function(i){return this.write=Math.max(0,this.length()-i),this.read=Math.min(this.read,this.write),this},r.DataBuffer.prototype.toHex=function(){for(var i="",h=this.read;h<this.data.byteLength;++h){var v=this.data.getUint8(h);v<16&&(i+="0"),i+=v.toString(16)}return i},r.DataBuffer.prototype.toString=function(i){var h=new Uint8Array(this.data,this.read,this.length());if(i=i||"utf8",i==="binary"||i==="raw")return r.binary.raw.encode(h);if(i==="hex")return r.binary.hex.encode(h);if(i==="base64")return r.binary.base64.encode(h);if(i==="utf8")return r.text.utf8.decode(h);if(i==="utf16")return r.text.utf16.decode(h);throw new Error("Invalid encoding: "+i)},r.createBuffer=function(i,h){return h=h||"raw",i!==void 0&&h==="utf8"&&(i=r.encodeUtf8(i)),new r.ByteBuffer(i)},r.fillString=function(i,h){for(var v="";h>0;)h&1&&(v+=i),h>>>=1,h>0&&(i+=i);return v},r.xorBytes=function(i,h,v){for(var I="",N="",d="",s=0,n=0;v>0;--v,++s)N=i.charCodeAt(s)^h.charCodeAt(s),n>=10&&(I+=d,d="",n=0),d+=String.fromCharCode(N),++n;return I+=d,I},r.hexToBytes=function(i){var h="",v=0;for(i.length&!0&&(v=1,h+=String.fromCharCode(parseInt(i[0],16)));v<i.length;v+=2)h+=String.fromCharCode(parseInt(i.substr(v,2),16));return h},r.bytesToHex=function(i){return r.createBuffer(i).toHex()},r.int32ToBytes=function(i){return String.fromCharCode(i>>24&255)+String.fromCharCode(i>>16&255)+String.fromCharCode(i>>8&255)+String.fromCharCode(i&255)};var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=[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";r.encode64=function(i,h){for(var v="",I="",N,d,s,n=0;n<i.length;)N=i.charCodeAt(n++),d=i.charCodeAt(n++),s=i.charCodeAt(n++),v+=a.charAt(N>>2),v+=a.charAt((N&3)<<4|d>>4),isNaN(d)?v+="==":(v+=a.charAt((d&15)<<2|s>>6),v+=isNaN(s)?"=":a.charAt(s&63)),h&&v.length>h&&(I+=v.substr(0,h)+`\r
|
|
3
|
-
`,v=v.substr(h));return I+=v,I},r.decode64=function(i){i=i.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var h="",v,I,N,d,s=0;s<i.length;)v=p[i.charCodeAt(s++)-43],I=p[i.charCodeAt(s++)-43],N=p[i.charCodeAt(s++)-43],d=p[i.charCodeAt(s++)-43],h+=String.fromCharCode(v<<2|I>>4),N!==64&&(h+=String.fromCharCode((I&15)<<4|N>>2),d!==64&&(h+=String.fromCharCode((N&3)<<6|d)));return h},r.encodeUtf8=function(i){return unescape(encodeURIComponent(i))},r.decodeUtf8=function(i){return decodeURIComponent(escape(i))},r.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},r.binary.raw.encode=function(i){return String.fromCharCode.apply(null,i)},r.binary.raw.decode=function(i,h,v){var I=h;I||(I=new Uint8Array(i.length)),v=v||0;for(var N=v,d=0;d<i.length;++d)I[N++]=i.charCodeAt(d);return h?N-v:I},r.binary.hex.encode=r.bytesToHex,r.binary.hex.decode=function(i,h,v){var I=h;I||(I=new Uint8Array(Math.ceil(i.length/2))),v=v||0;var N=0,d=v;for(i.length&1&&(N=1,I[d++]=parseInt(i[0],16));N<i.length;N+=2)I[d++]=parseInt(i.substr(N,2),16);return h?d-v:I},r.binary.base64.encode=function(i,h){for(var v="",I="",N,d,s,n=0;n<i.byteLength;)N=i[n++],d=i[n++],s=i[n++],v+=a.charAt(N>>2),v+=a.charAt((N&3)<<4|d>>4),isNaN(d)?v+="==":(v+=a.charAt((d&15)<<2|s>>6),v+=isNaN(s)?"=":a.charAt(s&63)),h&&v.length>h&&(I+=v.substr(0,h)+`\r
|
|
4
|
-
`,v=v.substr(h));return I+=v,I},r.binary.base64.decode=function(i,h,v){var I=h;I||(I=new Uint8Array(Math.ceil(i.length/4)*3)),i=i.replace(/[^A-Za-z0-9\+\/\=]/g,""),v=v||0;for(var N,d,s,n,B=0,U=v;B<i.length;)N=p[i.charCodeAt(B++)-43],d=p[i.charCodeAt(B++)-43],s=p[i.charCodeAt(B++)-43],n=p[i.charCodeAt(B++)-43],I[U++]=N<<2|d>>4,s!==64&&(I[U++]=(d&15)<<4|s>>2,n!==64&&(I[U++]=(s&3)<<6|n));return h?U-v:I.subarray(0,U)},r.binary.base58.encode=function(i,h){return r.binary.baseN.encode(i,l,h)},r.binary.base58.decode=function(i,h){return r.binary.baseN.decode(i,l,h)},r.text={utf8:{},utf16:{}},r.text.utf8.encode=function(i,h,v){i=r.encodeUtf8(i);var I=h;I||(I=new Uint8Array(i.length)),v=v||0;for(var N=v,d=0;d<i.length;++d)I[N++]=i.charCodeAt(d);return h?N-v:I},r.text.utf8.decode=function(i){return r.decodeUtf8(String.fromCharCode.apply(null,i))},r.text.utf16.encode=function(i,h,v){var I=h;I||(I=new Uint8Array(i.length*2));var N=new Uint16Array(I.buffer);v=v||0;for(var d=v,s=v,n=0;n<i.length;++n)N[s++]=i.charCodeAt(n),d+=2;return h?d-v:I},r.text.utf16.decode=function(i){return String.fromCharCode.apply(null,new Uint16Array(i.buffer))},r.deflate=function(i,h,v){if(h=r.decode64(i.deflate(r.encode64(h)).rval),v){var I=2,N=h.charCodeAt(1);N&32&&(I=6),h=h.substring(I,h.length-4)}return h},r.inflate=function(i,h,v){var I=i.inflate(r.encode64(h)).rval;return I===null?null:r.decode64(I)};var S=function(i,h,v){if(!i)throw new Error("WebStorage not available.");var I;if(v===null?I=i.removeItem(h):(v=r.encode64(JSON.stringify(v)),I=i.setItem(h,v)),typeof I<"u"&&I.rval!==!0){var N=new Error(I.error.message);throw N.id=I.error.id,N.name=I.error.name,N}},R=function(i,h){if(!i)throw new Error("WebStorage not available.");var v=i.getItem(h);if(i.init)if(v.rval===null){if(v.error){var I=new Error(v.error.message);throw I.id=v.error.id,I.name=v.error.name,I}v=null}else v=v.rval;return v!==null&&(v=JSON.parse(r.decode64(v))),v},x=function(i,h,v,I){var N=R(i,h);N===null&&(N={}),N[v]=I,S(i,h,N)},c=function(i,h,v){var I=R(i,h);return I!==null&&(I=v in I?I[v]:null),I},g=function(i,h,v){var I=R(i,h);if(I!==null&&v in I){delete I[v];var N=!0;for(var d in I){N=!1;break}N&&(I=null),S(i,h,I)}},C=function(i,h){S(i,h,null)},m=function(i,h,v){var I=null;typeof v>"u"&&(v=["web","flash"]);var N,d=!1,s=null;for(var n in v){N=v[n];try{if(N==="flash"||N==="both"){if(h[0]===null)throw new Error("Flash local storage not available.");I=i.apply(this,h),d=N==="flash"}(N==="web"||N==="both")&&(h[0]=localStorage,I=i.apply(this,h),d=!0)}catch(B){s=B}if(d)break}if(!d)throw s;return I};return r.setItem=function(i,h,v,I,N){m(x,arguments,N)},r.getItem=function(i,h,v,I){return m(c,arguments,I)},r.removeItem=function(i,h,v,I){m(g,arguments,I)},r.clearItems=function(i,h,v){m(C,arguments,v)},r.isEmpty=function(i){for(var h in i)if(i.hasOwnProperty(h))return!1;return!0},r.format=function(i){for(var h=/%./g,v,I,N=0,d=[],s=0;v=h.exec(i);){I=i.substring(s,h.lastIndex-2),I.length>0&&d.push(I),s=h.lastIndex;var n=v[0][1];switch(n){case"s":case"o":N<arguments.length?d.push(arguments[N+++1]):d.push("<?>");break;case"%":d.push("%");break;default:d.push("<%"+n+"?>")}}return d.push(i.substring(s)),d.join("")},r.formatNumber=function(i,h,v,I){var N=i,d=isNaN(h=Math.abs(h))?2:h,s=v===void 0?",":v,n=I===void 0?".":I,B=N<0?"-":"",U=parseInt(N=Math.abs(+N||0).toFixed(d),10)+"",O=U.length>3?U.length%3:0;return B+(O?U.substr(0,O)+n:"")+U.substr(O).replace(/(\d{3})(?=\d)/g,"$1"+n)+(d?s+Math.abs(N-U).toFixed(d).slice(2):"")},r.formatSize=function(i){return i>=1073741824?i=r.formatNumber(i/1073741824,2,".","")+" GiB":i>=1048576?i=r.formatNumber(i/1048576,2,".","")+" MiB":i>=1024?i=r.formatNumber(i/1024,0)+" KiB":i=r.formatNumber(i,0)+" bytes",i},r.bytesFromIP=function(i){return i.indexOf(".")!==-1?r.bytesFromIPv4(i):i.indexOf(":")!==-1?r.bytesFromIPv6(i):null},r.bytesFromIPv4=function(i){if(i=i.split("."),i.length!==4)return null;for(var h=r.createBuffer(),v=0;v<i.length;++v){var I=parseInt(i[v],10);if(isNaN(I))return null;h.putByte(I)}return h.getBytes()},r.bytesFromIPv6=function(i){var h=0;i=i.split(":").filter(function(s){return s.length===0&&++h,!0});for(var v=(8-i.length+h)*2,I=r.createBuffer(),N=0;N<8;++N){if(!i[N]||i[N].length===0){I.fillWithByte(0,v),v=0;continue}var d=r.hexToBytes(i[N]);d.length<2&&I.putByte(0),I.putBytes(d)}return I.getBytes()},r.bytesToIP=function(i){return i.length===4?r.bytesToIPv4(i):i.length===16?r.bytesToIPv6(i):null},r.bytesToIPv4=function(i){if(i.length!==4)return null;for(var h=[],v=0;v<i.length;++v)h.push(i.charCodeAt(v));return h.join(".")},r.bytesToIPv6=function(i){if(i.length!==16)return null;for(var h=[],v=[],I=0,N=0;N<i.length;N+=2){for(var d=r.bytesToHex(i[N]+i[N+1]);d[0]==="0"&&d!=="0";)d=d.substr(1);if(d==="0"){var s=v[v.length-1],n=h.length;!s||n!==s.end+1?v.push({start:n,end:n}):(s.end=n,s.end-s.start>v[I].end-v[I].start&&(I=v.length-1))}h.push(d)}if(v.length>0){var B=v[I];B.end-B.start>0&&(h.splice(B.start,B.end-B.start+1,""),B.start===0&&h.unshift(""),B.end===7&&h.push(""))}return h.join(":")},r.estimateCores=function(i,h){if(typeof i=="function"&&(h=i,i={}),i=i||{},"cores"in r&&!i.update)return h(null,r.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return r.cores=navigator.hardwareConcurrency,h(null,r.cores);if(typeof Worker>"u")return r.cores=1,h(null,r.cores);if(typeof Blob>"u")return r.cores=2,h(null,r.cores);var v=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(s){var n=Date.now(),B=n+4;self.postMessage({st:n,et:B})})}).toString(),")()"],{type:"application/javascript"}));I([],5,16);function I(s,n,B){if(n===0){var U=Math.floor(s.reduce(function(O,P){return O+P},0)/s.length);return r.cores=Math.max(1,U),URL.revokeObjectURL(v),h(null,r.cores)}N(B,function(O,P){s.push(d(B,P)),I(s,n-1,B)})}function N(s,n){for(var B=[],U=[],O=0;O<s;++O){var P=new Worker(v);P.addEventListener("message",function(M){if(U.push(M.data),U.length===s){for(var q=0;q<s;++q)B[q].terminate();n(null,U)}}),B.push(P)}for(var O=0;O<s;++O)B[O].postMessage(O)}function d(s,n){for(var B=[],U=0;U<s;++U)for(var O=n[U],P=B[U]=[],M=0;M<s;++M)if(U!==M){var q=n[M];(O.st>q.st&&O.st<q.et||q.st>O.st&&q.st<O.et)&&P.push(M)}return B.reduce(function(F,G){return Math.max(F,G.length)},0)}},or.exports}var lr,ga;function fr(){if(ga)return lr;ga=1;var t=ue();ce(),lr=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(r,o){var E=r;if(typeof E=="string"&&(E=t.cipher.getAlgorithm(E),E&&(E=E())),!E)throw new Error("Unsupported algorithm: "+r);return new t.cipher.BlockCipher({algorithm:E,key:o,decrypt:!1})},t.cipher.createDecipher=function(r,o){var E=r;if(typeof E=="string"&&(E=t.cipher.getAlgorithm(E),E&&(E=E())),!E)throw new Error("Unsupported algorithm: "+r);return new t.cipher.BlockCipher({algorithm:E,key:o,decrypt:!0})},t.cipher.registerAlgorithm=function(r,o){r=r.toUpperCase(),t.cipher.algorithms[r]=o},t.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in t.cipher.algorithms?t.cipher.algorithms[r]:null};var e=t.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};return e.prototype.start=function(r){r=r||{};var o={};for(var E in r)o[E]=r[E];o.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=r.output||t.util.createBuffer(),this.mode.start(o)},e.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(E){return r(this.blockSize,E,!1)},this.mode.unpad=function(E){return r(this.blockSize,E,!0)});var o={};return o.decrypt=this._decrypt,o.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,o)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,o))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,o))},lr}var cr={exports:{}},va;function ya(){if(va)return cr.exports;va=1;var t=ue();ce(),t.cipher=t.cipher||{};var e=cr.exports=t.cipher.modes=t.cipher.modes||{};e.ecb=function(y){y=y||{},this.name="ECB",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(y){},e.ecb.prototype.encrypt=function(y,f,a){if(y.length()<this.blockSize&&!(a&&y.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=y.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)f.putInt32(this._outBlock[p])},e.ecb.prototype.decrypt=function(y,f,a){if(y.length()<this.blockSize&&!(a&&y.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=y.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)f.putInt32(this._outBlock[p])},e.ecb.prototype.pad=function(y,f){var a=y.length()===this.blockSize?this.blockSize:this.blockSize-y.length();return y.fillWithByte(a,a),!0},e.ecb.prototype.unpad=function(y,f){if(f.overflow>0)return!1;var a=y.length(),p=y.at(a-1);return p>this.blockSize<<2?!1:(y.truncate(p),!0)},e.cbc=function(y){y=y||{},this.name="CBC",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(y){if(y.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in y)this._iv=r(y.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(y,f,a){if(y.length()<this.blockSize&&!(a&&y.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=this._prev[p]^y.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)f.putInt32(this._outBlock[p]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(y,f,a){if(y.length()<this.blockSize&&!(a&&y.length()>0))return!0;for(var p=0;p<this._ints;++p)this._inBlock[p]=y.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var p=0;p<this._ints;++p)f.putInt32(this._prev[p]^this._outBlock[p]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(y,f){var a=y.length()===this.blockSize?this.blockSize:this.blockSize-y.length();return y.fillWithByte(a,a),!0},e.cbc.prototype.unpad=function(y,f){if(f.overflow>0)return!1;var a=y.length(),p=y.at(a-1);return p>this.blockSize<<2?!1:(y.truncate(p),!0)},e.cfb=function(y){y=y||{},this.name="CFB",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(y){if(!("iv"in y))throw new Error("Invalid IV parameter.");this._iv=r(y.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(y,f,a){var p=y.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=y.getInt32()^this._outBlock[l],f.putInt32(this._inBlock[l]);return}var S=(this.blockSize-p)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=y.getInt32()^this._outBlock[l],this._partialOutput.putInt32(this._partialBlock[l]);if(S>0)y.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),S>0&&!a)return f.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;f.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(y,f,a){var p=y.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=y.getInt32(),f.putInt32(this._inBlock[l]^this._outBlock[l]);return}var S=(this.blockSize-p)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=y.getInt32(),this._partialOutput.putInt32(this._partialBlock[l]^this._outBlock[l]);if(S>0)y.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),S>0&&!a)return f.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;f.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.ofb=function(y){y=y||{},this.name="OFB",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(y){if(!("iv"in y))throw new Error("Invalid IV parameter.");this._iv=r(y.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(y,f,a){var p=y.length();if(y.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var l=0;l<this._ints;++l)f.putInt32(y.getInt32()^this._outBlock[l]),this._inBlock[l]=this._outBlock[l];return}var S=(this.blockSize-p)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(y.getInt32()^this._outBlock[l]);if(S>0)y.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),S>0&&!a)return f.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;f.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(y){y=y||{},this.name="CTR",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(y){if(!("iv"in y))throw new Error("Invalid IV parameter.");this._iv=r(y.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(y,f,a){var p=y.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize)for(var l=0;l<this._ints;++l)f.putInt32(y.getInt32()^this._outBlock[l]);else{var S=(this.blockSize-p)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(y.getInt32()^this._outBlock[l]);if(S>0&&(y.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return f.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;f.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}o(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(y){y=y||{},this.name="GCM",this.cipher=y.cipher,this.blockSize=y.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(y){if(!("iv"in y))throw new Error("Invalid IV parameter.");var f=t.util.createBuffer(y.iv);this._cipherLength=0;var a;if("additionalData"in y?a=t.util.createBuffer(y.additionalData):a=t.util.createBuffer(),"tagLength"in y?this._tagLength=y.tagLength:this._tagLength=128,this._tag=null,y.decrypt&&(this._tag=t.util.createBuffer(y.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 p=f.length();if(p===12)this._j0=[f.getInt32(),f.getInt32(),f.getInt32(),1];else{for(this._j0=[0,0,0,0];f.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[f.getInt32(),f.getInt32(),f.getInt32(),f.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(E(p*8)))}this._inBlock=this._j0.slice(0),o(this._inBlock),this._partialBytes=0,a=t.util.createBuffer(a),this._aDataLength=E(a.length()*8);var l=a.length()%this.blockSize;for(l&&a.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])},e.gcm.prototype.encrypt=function(y,f,a){var p=y.length();if(p===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&p>=this.blockSize){for(var l=0;l<this._ints;++l)f.putInt32(this._outBlock[l]^=y.getInt32());this._cipherLength+=this.blockSize}else{var S=(this.blockSize-p)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(y.getInt32()^this._outBlock[l]);if(S<=0||a){if(a){var R=p%this.blockSize;this._cipherLength+=R,this._partialOutput.truncate(this.blockSize-R)}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),S>0&&!a)return y.read-=this.blockSize,f.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;f.putBytes(this._partialOutput.getBytes(p-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},e.gcm.prototype.decrypt=function(y,f,a){var p=y.length();if(p<this.blockSize&&!(a&&p>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(this._inBlock),this._hashBlock[0]=y.getInt32(),this._hashBlock[1]=y.getInt32(),this._hashBlock[2]=y.getInt32(),this._hashBlock[3]=y.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var l=0;l<this._ints;++l)f.putInt32(this._outBlock[l]^this._hashBlock[l]);p<this.blockSize?this._cipherLength+=p%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(y,f){var a=!0;f.decrypt&&f.overflow&&y.truncate(this.blockSize-f.overflow),this.tag=t.util.createBuffer();var p=this._aDataLength.concat(E(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,p);var l=[];this.cipher.encrypt(this._j0,l);for(var S=0;S<this._ints;++S)this.tag.putInt32(this._s[S]^l[S]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),f.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},e.gcm.prototype.multiply=function(y,f){for(var a=[0,0,0,0],p=f.slice(0),l=0;l<128;++l){var S=y[l/32|0]&1<<31-l%32;S&&(a[0]^=p[0],a[1]^=p[1],a[2]^=p[2],a[3]^=p[3]),this.pow(p,p)}return a},e.gcm.prototype.pow=function(y,f){for(var a=y[3]&1,p=3;p>0;--p)f[p]=y[p]>>>1|(y[p-1]&1)<<31;f[0]=y[0]>>>1,a&&(f[0]^=this._R)},e.gcm.prototype.tableMultiply=function(y){for(var f=[0,0,0,0],a=0;a<32;++a){var p=a/8|0,l=y[p]>>>(7-a%8)*4&15,S=this._m[a][l];f[0]^=S[0],f[1]^=S[1],f[2]^=S[2],f[3]^=S[3]}return f},e.gcm.prototype.ghash=function(y,f,a){return f[0]^=a[0],f[1]^=a[1],f[2]^=a[2],f[3]^=a[3],this.tableMultiply(f)},e.gcm.prototype.generateHashTable=function(y,f){for(var a=8/f,p=4*a,l=16*a,S=new Array(l),R=0;R<l;++R){var x=[0,0,0,0],c=R/p|0,g=(p-1-R%p)*f;x[c]=1<<f-1<<g,S[R]=this.generateSubHashTable(this.multiply(x,y),f)}return S},e.gcm.prototype.generateSubHashTable=function(y,f){var a=1<<f,p=a>>>1,l=new Array(a);l[p]=y.slice(0);for(var S=p>>>1;S>0;)this.pow(l[2*S],l[S]=[]),S>>=1;for(S=2;S<p;){for(var R=1;R<S;++R){var x=l[S],c=l[R];l[S+R]=[x[0]^c[0],x[1]^c[1],x[2]^c[2],x[3]^c[3]]}S*=2}for(l[0]=[0,0,0,0],S=p+1;S<a;++S){var g=l[S^p];l[S]=[y[0]^g[0],y[1]^g[1],y[2]^g[2],y[3]^g[3]]}return l};function r(y,f){if(typeof y=="string"&&(y=t.util.createBuffer(y)),t.util.isArray(y)&&y.length>4){var a=y;y=t.util.createBuffer();for(var p=0;p<a.length;++p)y.putByte(a[p])}if(y.length()<f)throw new Error("Invalid IV length; got "+y.length()+" bytes and expected "+f+" bytes.");if(!t.util.isArray(y)){for(var l=[],S=f/4,p=0;p<S;++p)l.push(y.getInt32());y=l}return y}function o(y){y[y.length-1]=y[y.length-1]+1&4294967295}function E(y){return[y/4294967296|0,y&4294967295]}return cr.exports}var dr,ma;function gt(){if(ma)return dr;ma=1;var t=ue();fr(),ya(),ce(),dr=t.aes=t.aes||{},t.aes.startEncrypting=function(c,g,C,m){var i=x({key:c,output:C,decrypt:!1,mode:m});return i.start(g),i},t.aes.createEncryptionCipher=function(c,g){return x({key:c,output:null,decrypt:!1,mode:g})},t.aes.startDecrypting=function(c,g,C,m){var i=x({key:c,output:C,decrypt:!0,mode:m});return i.start(g),i},t.aes.createDecryptionCipher=function(c,g){return x({key:c,output:null,decrypt:!0,mode:g})},t.aes.Algorithm=function(c,g){r||l();var C=this;C.name=c,C.mode=new g({blockSize:16,cipher:{encrypt:function(m,i){return R(C._w,m,i,!1)},decrypt:function(m,i){return R(C._w,m,i,!0)}}}),C._init=!1},t.aes.Algorithm.prototype.initialize=function(c){if(!this._init){var g=c.key,C;if(typeof g=="string"&&(g.length===16||g.length===24||g.length===32))g=t.util.createBuffer(g);else if(t.util.isArray(g)&&(g.length===16||g.length===24||g.length===32)){C=g,g=t.util.createBuffer();for(var m=0;m<C.length;++m)g.putByte(C[m])}if(!t.util.isArray(g)){C=g,g=[];var i=C.length();if(i===16||i===24||i===32){i=i>>>2;for(var m=0;m<i;++m)g.push(C.getInt32())}}if(!t.util.isArray(g)||!(g.length===4||g.length===6||g.length===8))throw new Error("Invalid key parameter.");var h=this.mode.name,v=["CFB","OFB","CTR","GCM"].indexOf(h)!==-1;this._w=S(g,c.decrypt&&!v),this._init=!0}},t.aes._expandKey=function(c,g){return r||l(),S(c,g)},t.aes._updateBlock=R,e("AES-ECB",t.cipher.modes.ecb),e("AES-CBC",t.cipher.modes.cbc),e("AES-CFB",t.cipher.modes.cfb),e("AES-OFB",t.cipher.modes.ofb),e("AES-CTR",t.cipher.modes.ctr),e("AES-GCM",t.cipher.modes.gcm);function e(c,g){var C=function(){return new t.aes.Algorithm(c,g)};t.cipher.registerAlgorithm(c,C)}var r=!1,o=4,E,y,f,a,p;function l(){r=!0,f=[0,1,2,4,8,16,32,64,128,27,54];for(var c=new Array(256),g=0;g<128;++g)c[g]=g<<1,c[g+128]=g+128<<1^283;E=new Array(256),y=new Array(256),a=new Array(4),p=new Array(4);for(var g=0;g<4;++g)a[g]=new Array(256),p[g]=new Array(256);for(var C=0,m=0,i,h,v,I,N,d,s,g=0;g<256;++g){I=m^m<<1^m<<2^m<<3^m<<4,I=I>>8^I&255^99,E[C]=I,y[I]=C,N=c[I],i=c[C],h=c[i],v=c[h],d=N<<24^I<<16^I<<8^(I^N),s=(i^h^v)<<24^(C^v)<<16^(C^h^v)<<8^(C^i^v);for(var n=0;n<4;++n)a[n][C]=d,p[n][I]=s,d=d<<24|d>>>8,s=s<<24|s>>>8;C===0?C=m=1:(C=i^c[c[c[i^v]]],m^=c[c[m]])}}function S(c,g){for(var C=c.slice(0),m,i=1,h=C.length,v=h+6+1,I=o*v,N=h;N<I;++N)m=C[N-1],N%h===0?(m=E[m>>>16&255]<<24^E[m>>>8&255]<<16^E[m&255]<<8^E[m>>>24]^f[i]<<24,i++):h>6&&N%h===4&&(m=E[m>>>24]<<24^E[m>>>16&255]<<16^E[m>>>8&255]<<8^E[m&255]),C[N]=C[N-h]^m;if(g){var d,s=p[0],n=p[1],B=p[2],U=p[3],O=C.slice(0);I=C.length;for(var N=0,P=I-o;N<I;N+=o,P-=o)if(N===0||N===I-o)O[N]=C[P],O[N+1]=C[P+3],O[N+2]=C[P+2],O[N+3]=C[P+1];else for(var M=0;M<o;++M)d=C[P+M],O[N+(3&-M)]=s[E[d>>>24]]^n[E[d>>>16&255]]^B[E[d>>>8&255]]^U[E[d&255]];C=O}return C}function R(c,g,C,m){var i=c.length/4-1,h,v,I,N,d;m?(h=p[0],v=p[1],I=p[2],N=p[3],d=y):(h=a[0],v=a[1],I=a[2],N=a[3],d=E);var s,n,B,U,O,P,M;s=g[0]^c[0],n=g[m?3:1]^c[1],B=g[2]^c[2],U=g[m?1:3]^c[3];for(var q=3,F=1;F<i;++F)O=h[s>>>24]^v[n>>>16&255]^I[B>>>8&255]^N[U&255]^c[++q],P=h[n>>>24]^v[B>>>16&255]^I[U>>>8&255]^N[s&255]^c[++q],M=h[B>>>24]^v[U>>>16&255]^I[s>>>8&255]^N[n&255]^c[++q],U=h[U>>>24]^v[s>>>16&255]^I[n>>>8&255]^N[B&255]^c[++q],s=O,n=P,B=M;C[0]=d[s>>>24]<<24^d[n>>>16&255]<<16^d[B>>>8&255]<<8^d[U&255]^c[++q],C[m?3:1]=d[n>>>24]<<24^d[B>>>16&255]<<16^d[U>>>8&255]<<8^d[s&255]^c[++q],C[2]=d[B>>>24]<<24^d[U>>>16&255]<<16^d[s>>>8&255]<<8^d[n&255]^c[++q],C[m?1:3]=d[U>>>24]<<24^d[s>>>16&255]<<16^d[n>>>8&255]<<8^d[B&255]^c[++q]}function x(c){c=c||{};var g=(c.mode||"CBC").toUpperCase(),C="AES-"+g,m;c.decrypt?m=t.cipher.createDecipher(C,c.key):m=t.cipher.createCipher(C,c.key);var i=m.start;return m.start=function(h,v){var I=null;v instanceof t.util.ByteBuffer&&(I=v,v={}),v=v||{},v.output=I,v.iv=h,i.call(m,v)},m}return dr}var hr={exports:{}},pr={exports:{}},gr={exports:{}},Ca;function vt(){if(Ca)return gr.exports;Ca=1;var t=ue();t.pki=t.pki||{};var e=gr.exports=t.pki.oids=t.oids=t.oids||{};function r(E,y){e[E]=y,e[y]=E}function o(E,y){e[E]=y}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("2.5.4.65","pseudonym"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),gr.exports}var Ea;function nt(){if(Ea)return pr.exports;Ea=1;var t=ue();ce(),vt();var e=pr.exports=t.asn1=t.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(f,a,p,l,S){if(t.util.isArray(l)){for(var R=[],x=0;x<l.length;++x)l[x]!==void 0&&R.push(l[x]);l=R}var c={tagClass:f,type:a,constructed:p,composed:p||t.util.isArray(l),value:l};return S&&"bitStringContents"in S&&(c.bitStringContents=S.bitStringContents,c.original=e.copy(c)),c},e.copy=function(f,a){var p;if(t.util.isArray(f)){p=[];for(var l=0;l<f.length;++l)p.push(e.copy(f[l],a));return p}return typeof f=="string"?f:(p={tagClass:f.tagClass,type:f.type,constructed:f.constructed,composed:f.composed,value:e.copy(f.value,a)},a&&!a.excludeBitStringContents&&(p.bitStringContents=f.bitStringContents),p)},e.equals=function(f,a,p){if(t.util.isArray(f)){if(!t.util.isArray(a)||f.length!==a.length)return!1;for(var l=0;l<f.length;++l)if(!e.equals(f[l],a[l]))return!1;return!0}if(typeof f!=typeof a)return!1;if(typeof f=="string")return f===a;var S=f.tagClass===a.tagClass&&f.type===a.type&&f.constructed===a.constructed&&f.composed===a.composed&&e.equals(f.value,a.value);return p&&p.includeBitStringContents&&(S=S&&f.bitStringContents===a.bitStringContents),S},e.getBerValueLength=function(f){var a=f.getByte();if(a!==128){var p,l=a&128;return l?p=f.getInt((a&127)<<3):p=a,p}};function r(f,a,p){if(p>a){var l=new Error("Too few bytes to parse DER.");throw l.available=f.length(),l.remaining=a,l.requested=p,l}}var o=function(f,a){var p=f.getByte();if(a--,p!==128){var l,S=p&128;if(!S)l=p;else{var R=p&127;r(f,a,R),l=f.getInt(R<<3)}if(l<0)throw new Error("Negative length: "+l);return l}};e.fromDer=function(f,a){a===void 0&&(a={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof a=="boolean"&&(a={strict:a,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in a||(a.strict=!0),"parseAllBytes"in a||(a.parseAllBytes=!0),"decodeBitStrings"in a||(a.decodeBitStrings=!0),"maxDepth"in a||(a.maxDepth=e.maxDepth),typeof f=="string"&&(f=t.util.createBuffer(f));var p=f.length(),l=E(f,f.length(),0,a);if(a.parseAllBytes&&f.length()!==0){var S=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw S.byteCount=p,S.remaining=f.length(),S}return l};function E(f,a,p,l){if(p>=l.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var S;r(f,a,2);var R=f.getByte();a--;var x=R&192,c=R&31;S=f.length();var g=o(f,a);if(a-=S-f.length(),g!==void 0&&g>a){if(l.strict){var C=new Error("Too few bytes to read ASN.1 value.");throw C.available=f.length(),C.remaining=a,C.requested=g,C}g=a}var m,i,h=(R&32)===32;if(h)if(m=[],g===void 0)for(;;){if(r(f,a,2),f.bytes(2)==="\0\0"){f.getBytes(2),a-=2;break}S=f.length(),m.push(E(f,a,p+1,l)),a-=S-f.length()}else for(;g>0;)S=f.length(),m.push(E(f,g,p+1,l)),a-=S-f.length(),g-=S-f.length();if(m===void 0&&x===e.Class.UNIVERSAL&&c===e.Type.BITSTRING&&(i=f.bytes(g)),m===void 0&&l.decodeBitStrings&&x===e.Class.UNIVERSAL&&c===e.Type.BITSTRING&&g>1){var v=f.read,I=a,N=0;if(c===e.Type.BITSTRING&&(r(f,a,1),N=f.getByte(),a--),N===0)try{S=f.length();var d={strict:!0,decodeBitStrings:!0},s=E(f,a,p+1,d),n=S-f.length();a-=n,c==e.Type.BITSTRING&&n++;var B=s.tagClass;n===g&&(B===e.Class.UNIVERSAL||B===e.Class.CONTEXT_SPECIFIC)&&(m=[s])}catch{}m===void 0&&(f.read=v,a=I)}if(m===void 0){if(g===void 0){if(l.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");g=a}if(c===e.Type.BMPSTRING)for(m="";g>0;g-=2)r(f,a,2),m+=String.fromCharCode(f.getInt16()),a-=2;else m=f.getBytes(g),a-=g}var U=i===void 0?null:{bitStringContents:i};return e.create(x,c,h,m,U)}e.toDer=function(f){var a=t.util.createBuffer(),p=f.tagClass|f.type,l=t.util.createBuffer(),S=!1;if("bitStringContents"in f&&(S=!0,f.original&&(S=e.equals(f,f.original))),S)l.putBytes(f.bitStringContents);else if(f.composed){f.constructed?p|=32:l.putByte(0);for(var R=0;R<f.value.length;++R)f.value[R]!==void 0&&l.putBuffer(e.toDer(f.value[R]))}else if(f.type===e.Type.BMPSTRING)for(var R=0;R<f.value.length;++R)l.putInt16(f.value.charCodeAt(R));else f.type===e.Type.INTEGER&&f.value.length>1&&(f.value.charCodeAt(0)===0&&(f.value.charCodeAt(1)&128)===0||f.value.charCodeAt(0)===255&&(f.value.charCodeAt(1)&128)===128)?l.putBytes(f.value.substr(1)):l.putBytes(f.value);if(a.putByte(p),l.length()<=127)a.putByte(l.length()&127);else{var x=l.length(),c="";do c+=String.fromCharCode(x&255),x=x>>>8;while(x>0);a.putByte(c.length|128);for(var R=c.length-1;R>=0;--R)a.putByte(c.charCodeAt(R))}return a.putBuffer(l),a},e.oidToDer=function(f){var a=f.split("."),p=t.util.createBuffer();p.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var l,S,R,x,c=2;c<a.length;++c){if(l=!0,S=[],R=parseInt(a[c],10),R>4294967295)throw new Error("OID value too large; max is 32-bits.");do x=R&127,R=R>>>7,l||(x|=128),S.push(x),l=!1;while(R>0);for(var g=S.length-1;g>=0;--g)p.putByte(S[g])}return p},e.derToOid=function(f){var a;typeof f=="string"&&(f=t.util.createBuffer(f));var p=f.getByte();a=Math.floor(p/40)+"."+p%40;for(var l=0;f.length()>0;){if(l>70368744177663)throw new Error("OID value too large; max is 53-bits.");p=f.getByte(),l=l*128,p&128?l+=p&127:(a+="."+(l+p),l=0)}return a},e.utcTimeToDate=function(f){var a=new Date,p=parseInt(f.substr(0,2),10);p=p>=50?1900+p:2e3+p;var l=parseInt(f.substr(2,2),10)-1,S=parseInt(f.substr(4,2),10),R=parseInt(f.substr(6,2),10),x=parseInt(f.substr(8,2),10),c=0;if(f.length>11){var g=f.charAt(10),C=10;g!=="+"&&g!=="-"&&(c=parseInt(f.substr(10,2),10),C+=2)}if(a.setUTCFullYear(p,l,S),a.setUTCHours(R,x,c,0),C&&(g=f.charAt(C),g==="+"||g==="-")){var m=parseInt(f.substr(C+1,2),10),i=parseInt(f.substr(C+4,2),10),h=m*60+i;h*=6e4,g==="+"?a.setTime(+a-h):a.setTime(+a+h)}return a},e.generalizedTimeToDate=function(f){var a=new Date,p=parseInt(f.substr(0,4),10),l=parseInt(f.substr(4,2),10)-1,S=parseInt(f.substr(6,2),10),R=parseInt(f.substr(8,2),10),x=parseInt(f.substr(10,2),10),c=parseInt(f.substr(12,2),10),g=0,C=0,m=!1;f.charAt(f.length-1)==="Z"&&(m=!0);var i=f.length-5,h=f.charAt(i);if(h==="+"||h==="-"){var v=parseInt(f.substr(i+1,2),10),I=parseInt(f.substr(i+4,2),10);C=v*60+I,C*=6e4,h==="+"&&(C*=-1),m=!0}return f.charAt(14)==="."&&(g=parseFloat(f.substr(14),10)*1e3),m?(a.setUTCFullYear(p,l,S),a.setUTCHours(R,x,c,g),a.setTime(+a+C)):(a.setFullYear(p,l,S),a.setHours(R,x,c,g)),a},e.dateToUtcTime=function(f){if(typeof f=="string")return f;var a="",p=[];p.push((""+f.getUTCFullYear()).substr(2)),p.push(""+(f.getUTCMonth()+1)),p.push(""+f.getUTCDate()),p.push(""+f.getUTCHours()),p.push(""+f.getUTCMinutes()),p.push(""+f.getUTCSeconds());for(var l=0;l<p.length;++l)p[l].length<2&&(a+="0"),a+=p[l];return a+="Z",a},e.dateToGeneralizedTime=function(f){if(typeof f=="string")return f;var a="",p=[];p.push(""+f.getUTCFullYear()),p.push(""+(f.getUTCMonth()+1)),p.push(""+f.getUTCDate()),p.push(""+f.getUTCHours()),p.push(""+f.getUTCMinutes()),p.push(""+f.getUTCSeconds());for(var l=0;l<p.length;++l)p[l].length<2&&(a+="0"),a+=p[l];return a+="Z",a},e.integerToDer=function(f){var a=t.util.createBuffer();if(f>=-128&&f<128)return a.putSignedInt(f,8);if(f>=-32768&&f<32768)return a.putSignedInt(f,16);if(f>=-8388608&&f<8388608)return a.putSignedInt(f,24);if(f>=-2147483648&&f<2147483648)return a.putSignedInt(f,32);var p=new Error("Integer too large; max is 32-bits.");throw p.integer=f,p},e.derToInteger=function(f){typeof f=="string"&&(f=t.util.createBuffer(f));var a=f.length()*8;if(a>32)throw new Error("Integer too large; max is 32-bits.");return f.getSignedInt(a)},e.validate=function(f,a,p,l){var S=!1;if((f.tagClass===a.tagClass||typeof a.tagClass>"u")&&(f.type===a.type||typeof a.type>"u"))if(f.constructed===a.constructed||typeof a.constructed>"u"){if(S=!0,a.value&&t.util.isArray(a.value))for(var R=0,x=0;S&&x<a.value.length;++x){var c=a.value[x];S=!!c.optional;var g=f.value[R];if(!g){c.optional||(S=!1,l&&l.push("["+a.name+'] Missing required element. Expected tag class "'+c.tagClass+'", type "'+c.type+'"'));continue}var C=typeof c.tagClass<"u"&&typeof c.type<"u";if(C&&(g.tagClass!==c.tagClass||g.type!==c.type))if(c.optional){S=!0;continue}else{S=!1,l&&l.push("["+a.name+"] Tag mismatch. Expected ("+c.tagClass+","+c.type+"), got ("+g.tagClass+","+g.type+")");break}var m=e.validate(g,c,p,l);if(m)++R,S=!0;else if(c.optional)S=!0;else{S=!1;break}}if(S&&p&&(a.capture&&(p[a.capture]=f.value),a.captureAsn1&&(p[a.captureAsn1]=f),a.captureBitStringContents&&"bitStringContents"in f&&(p[a.captureBitStringContents]=f.bitStringContents),a.captureBitStringValue&&"bitStringContents"in f))if(f.bitStringContents.length<2)p[a.captureBitStringValue]="";else{var i=f.bitStringContents.charCodeAt(0);if(i!==0)throw new Error("captureBitStringValue only supported for zero unused bits");p[a.captureBitStringValue]=f.bitStringContents.slice(1)}}else l&&l.push("["+a.name+'] Expected constructed "'+a.constructed+'", got "'+f.constructed+'"');else l&&(f.tagClass!==a.tagClass&&l.push("["+a.name+'] Expected tag class "'+a.tagClass+'", got "'+f.tagClass+'"'),f.type!==a.type&&l.push("["+a.name+'] Expected type "'+a.type+'", got "'+f.type+'"'));return S};var y=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(f,a,p){var l="";a=a||0,p=p||2,a>0&&(l+=`
|
|
5
|
-
`);for(var S="",R=0;R<a*p;++R)S+=" ";switch(l+=S+"Tag: ",f.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(f.tagClass===e.Class.UNIVERSAL)switch(l+=f.type,f.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+=f.type;if(l+=`
|
|
6
|
-
|
|
7
|
-
`,
|
|
8
|
-
`,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
`,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`+R+y.substr(S+1),l=p-S-1,S=-1,++p}else(y[p]===" "||y[p]===" "||y[p]===",")&&(S=p);return y}function o(E){return E.replace(/^\s+/,"")}return Er.exports}var xr={exports:{}},Sr,Ia;function Ft(){if(Ia)return Sr;Ia=1;var t=ue();fr(),ya(),ce(),Sr=t.des=t.des||{},t.des.startEncrypting=function(c,g,C,m){var i=x({key:c,output:C,decrypt:!1,mode:m||(g===null?"ECB":"CBC")});return i.start(g),i},t.des.createEncryptionCipher=function(c,g){return x({key:c,output:null,decrypt:!1,mode:g})},t.des.startDecrypting=function(c,g,C,m){var i=x({key:c,output:C,decrypt:!0,mode:m||(g===null?"ECB":"CBC")});return i.start(g),i},t.des.createDecryptionCipher=function(c,g){return x({key:c,output:null,decrypt:!0,mode:g})},t.des.Algorithm=function(c,g){var C=this;C.name=c,C.mode=new g({blockSize:8,cipher:{encrypt:function(m,i){return R(C._keys,m,i,!1)},decrypt:function(m,i){return R(C._keys,m,i,!0)}}}),C._init=!1},t.des.Algorithm.prototype.initialize=function(c){if(!this._init){var g=t.util.createBuffer(c.key);if(this.name.indexOf("3DES")===0&&g.length()!==24)throw new Error("Invalid Triple-DES key size: "+g.length()*8);this._keys=S(g),this._init=!0}},e("DES-ECB",t.cipher.modes.ecb),e("DES-CBC",t.cipher.modes.cbc),e("DES-CFB",t.cipher.modes.cfb),e("DES-OFB",t.cipher.modes.ofb),e("DES-CTR",t.cipher.modes.ctr),e("3DES-ECB",t.cipher.modes.ecb),e("3DES-CBC",t.cipher.modes.cbc),e("3DES-CFB",t.cipher.modes.cfb),e("3DES-OFB",t.cipher.modes.ofb),e("3DES-CTR",t.cipher.modes.ctr);function e(c,g){var C=function(){return new t.des.Algorithm(c,g)};t.cipher.registerAlgorithm(c,C)}var r=[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],o=[-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],E=[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],y=[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],f=[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],a=[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],p=[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 S(c){for(var g=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],C=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],m=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],v=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],I=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],N=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],d=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],s=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],n=[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],U=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],P=c.length()>8?3:1,M=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],F=0,G,W=0;W<P;W++){var X=c.getInt32(),ee=c.getInt32();G=(X>>>4^ee)&252645135,ee^=G,X^=G<<4,G=(ee>>>-16^X)&65535,X^=G,ee^=G<<-16,G=(X>>>2^ee)&858993459,ee^=G,X^=G<<2,G=(ee>>>-16^X)&65535,X^=G,ee^=G<<-16,G=(X>>>1^ee)&1431655765,ee^=G,X^=G<<1,G=(ee>>>8^X)&16711935,X^=G,ee^=G<<8,G=(X>>>1^ee)&1431655765,ee^=G,X^=G<<1,G=X<<8|ee>>>20&240,X=ee<<24|ee<<8&16711680|ee>>>8&65280|ee>>>24&240,ee=G;for(var ne=0;ne<q.length;++ne){q[ne]?(X=X<<2|X>>>26,ee=ee<<2|ee>>>26):(X=X<<1|X>>>27,ee=ee<<1|ee>>>27),X&=-15,ee&=-15;var ie=g[X>>>28]|C[X>>>24&15]|m[X>>>20&15]|i[X>>>16&15]|h[X>>>12&15]|v[X>>>8&15]|I[X>>>4&15],de=N[ee>>>28]|d[ee>>>24&15]|s[ee>>>20&15]|n[ee>>>16&15]|B[ee>>>12&15]|U[ee>>>8&15]|O[ee>>>4&15];G=(de>>>16^ie)&65535,M[F++]=ie^G,M[F++]=de^G<<16}}return M}function R(c,g,C,m){var i=c.length===32?3:9,h;i===3?h=m?[30,-2,-2]:[0,32,2]:h=m?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var v,I=g[0],N=g[1];v=(I>>>4^N)&252645135,N^=v,I^=v<<4,v=(I>>>16^N)&65535,N^=v,I^=v<<16,v=(N>>>2^I)&858993459,I^=v,N^=v<<2,v=(N>>>8^I)&16711935,I^=v,N^=v<<8,v=(I>>>1^N)&1431655765,N^=v,I^=v<<1,I=I<<1|I>>>31,N=N<<1|N>>>31;for(var d=0;d<i;d+=3){for(var s=h[d+1],n=h[d+2],B=h[d];B!=s;B+=n){var U=N^c[B],O=(N>>>4|N<<28)^c[B+1];v=I,I=N,N=v^(o[U>>>24&63]|y[U>>>16&63]|a[U>>>8&63]|l[U&63]|r[O>>>24&63]|E[O>>>16&63]|f[O>>>8&63]|p[O&63])}v=I,I=N,N=v}I=I>>>1|I<<31,N=N>>>1|N<<31,v=(I>>>1^N)&1431655765,N^=v,I^=v<<1,v=(N>>>8^I)&16711935,I^=v,N^=v<<8,v=(N>>>2^I)&858993459,I^=v,N^=v<<2,v=(I>>>16^N)&65535,N^=v,I^=v<<16,v=(I>>>4^N)&252645135,N^=v,I^=v<<4,C[0]=I,C[1]=N}function x(c){c=c||{};var g=(c.mode||"CBC").toUpperCase(),C="DES-"+g,m;c.decrypt?m=t.cipher.createDecipher(C,c.key):m=t.cipher.createCipher(C,c.key);var i=m.start;return m.start=function(h,v){var I=null;v instanceof t.util.ByteBuffer&&(I=v,v={}),v=v||{},v.output=I,v.iv=h,i.call(m,v)},m}return Sr}const Tr=li(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ar,Ba;function Ir(){if(Ba)return Ar;Ba=1;var t=ue();Rt(),st(),ce();var e=t.pkcs5=t.pkcs5||{},r;return t.util.isNodejs&&!t.options.usePureJavaScript&&(r=Tr),Ar=t.pbkdf2=e.pbkdf2=function(o,E,y,f,a,p){if(typeof a=="function"&&(p=a,a=null),t.util.isNodejs&&!t.options.usePureJavaScript&&r.pbkdf2&&(a===null||typeof a!="object")&&(r.pbkdf2Sync.length>4||!a||a==="sha1"))return typeof a!="string"&&(a="sha1"),o=Buffer.from(o,"binary"),E=Buffer.from(E,"binary"),p?r.pbkdf2Sync.length===4?r.pbkdf2(o,E,y,f,function(d,s){if(d)return p(d);p(null,s.toString("binary"))}):r.pbkdf2(o,E,y,f,a,function(d,s){if(d)return p(d);p(null,s.toString("binary"))}):r.pbkdf2Sync.length===4?r.pbkdf2Sync(o,E,y,f).toString("binary"):r.pbkdf2Sync(o,E,y,f,a).toString("binary");if((typeof a>"u"||a===null)&&(a="sha1"),typeof a=="string"){if(!(a in t.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=t.md[a].create()}var l=a.digestLength;if(f>4294967295*l){var S=new Error("Derived key is too long.");if(p)return p(S);throw S}var R=Math.ceil(f/l),x=f-(R-1)*l,c=t.hmac.create();c.start(a,o);var g="",C,m,i;if(!p){for(var h=1;h<=R;++h){c.start(null,null),c.update(E),c.update(t.util.int32ToBytes(h)),C=i=c.digest().getBytes();for(var v=2;v<=y;++v)c.start(null,null),c.update(i),m=c.digest().getBytes(),C=t.util.xorBytes(C,m,l),i=m;g+=h<R?C:C.substr(0,x)}return g}var h=1,v;function I(){if(h>R)return p(null,g);c.start(null,null),c.update(E),c.update(t.util.int32ToBytes(h)),C=i=c.digest().getBytes(),v=2,N()}function N(){if(v<=y)return c.start(null,null),c.update(i),m=c.digest().getBytes(),C=t.util.xorBytes(C,m,l),i=m,++v,t.util.setImmediate(N);g+=h<R?C:C.substr(0,x),++h,I()}I()},Ar}var qt={exports:{}},Br={exports:{}},ba;function wa(){if(ba)return Br.exports;ba=1;var t=ue();st(),ce();var e=Br.exports=t.sha256=t.sha256||{};t.md.sha256=t.md.algorithms.sha256=e,e.create=function(){o||y();var a=null,p=t.util.createBuffer(),l=new Array(64),S={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return S.start=function(){S.messageLength=0,S.fullMessageLength=S.messageLength64=[];for(var R=S.messageLengthSize/4,x=0;x<R;++x)S.fullMessageLength.push(0);return p=t.util.createBuffer(),a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},S},S.start(),S.update=function(R,x){x==="utf8"&&(R=t.util.encodeUtf8(R));var c=R.length;S.messageLength+=c,c=[c/4294967296>>>0,c>>>0];for(var g=S.fullMessageLength.length-1;g>=0;--g)S.fullMessageLength[g]+=c[1],c[1]=c[0]+(S.fullMessageLength[g]/4294967296>>>0),S.fullMessageLength[g]=S.fullMessageLength[g]>>>0,c[0]=c[1]/4294967296>>>0;return p.putBytes(R),f(a,l,p),(p.read>2048||p.length()===0)&&p.compact(),S},S.digest=function(){var R=t.util.createBuffer();R.putBytes(p.bytes());var x=S.fullMessageLength[S.fullMessageLength.length-1]+S.messageLengthSize,c=x&S.blockLength-1;R.putBytes(r.substr(0,S.blockLength-c));for(var g,C,m=S.fullMessageLength[0]*8,i=0;i<S.fullMessageLength.length-1;++i)g=S.fullMessageLength[i+1]*8,C=g/4294967296>>>0,m+=C,R.putInt32(m>>>0),m=g>>>0;R.putInt32(m);var h={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};f(h,l,R);var v=t.util.createBuffer();return v.putInt32(h.h0),v.putInt32(h.h1),v.putInt32(h.h2),v.putInt32(h.h3),v.putInt32(h.h4),v.putInt32(h.h5),v.putInt32(h.h6),v.putInt32(h.h7),v},S};var r=null,o=!1,E=null;function y(){r="",r+=t.util.fillString("\0",64),E=[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],o=!0}function f(a,p,l){for(var S,R,x,c,g,C,m,i,h,v,I,N,d,s,n,B=l.length();B>=64;){for(m=0;m<16;++m)p[m]=l.getInt32();for(;m<64;++m)S=p[m-2],S=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,R=p[m-15],R=(R>>>7|R<<25)^(R>>>18|R<<14)^R>>>3,p[m]=S+p[m-7]+R+p[m-16]|0;for(i=a.h0,h=a.h1,v=a.h2,I=a.h3,N=a.h4,d=a.h5,s=a.h6,n=a.h7,m=0;m<64;++m)c=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7),g=s^N&(d^s),x=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),C=i&h|v&(i^h),S=n+c+g+E[m]+p[m],R=x+C,n=s,s=d,d=N,N=I+S>>>0,I=v,v=h,h=i,i=S+R>>>0;a.h0=a.h0+i|0,a.h1=a.h1+h|0,a.h2=a.h2+v|0,a.h3=a.h3+I|0,a.h4=a.h4+N|0,a.h5=a.h5+d|0,a.h6=a.h6+s|0,a.h7=a.h7+n|0,B-=64}}return Br.exports}var br={exports:{}},_a;function Ra(){if(_a)return br.exports;_a=1;var t=ue();ce();var e=null;t.util.isNodejs&&!t.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Tr);var r=br.exports=t.prng=t.prng||{};return r.create=function(o){for(var E={plugin:o,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},y=o.md,f=new Array(32),a=0;a<32;++a)f[a]=y.create();E.pools=f,E.pool=0,E.generate=function(x,c){if(!c)return E.generateSync(x);var g=E.plugin.cipher,C=E.plugin.increment,m=E.plugin.formatKey,i=E.plugin.formatSeed,h=t.util.createBuffer();E.key=null,v();function v(I){if(I)return c(I);if(h.length()>=x)return c(null,h.getBytes(x));if(E.generated>1048575&&(E.key=null),E.key===null)return t.util.nextTick(function(){p(v)});var N=g(E.key,E.seed);E.generated+=N.length,h.putBytes(N),E.key=m(g(E.key,C(E.seed))),E.seed=i(g(E.key,E.seed)),t.util.setImmediate(v)}},E.generateSync=function(x){var c=E.plugin.cipher,g=E.plugin.increment,C=E.plugin.formatKey,m=E.plugin.formatSeed;E.key=null;for(var i=t.util.createBuffer();i.length()<x;){E.generated>1048575&&(E.key=null),E.key===null&&l();var h=c(E.key,E.seed);E.generated+=h.length,i.putBytes(h),E.key=C(c(E.key,g(E.seed))),E.seed=m(c(E.key,E.seed))}return i.getBytes(x)};function p(x){if(E.pools[0].messageLength>=32)return S(),x();var c=32-E.pools[0].messageLength<<5;E.seedFile(c,function(g,C){if(g)return x(g);E.collect(C),S(),x()})}function l(){if(E.pools[0].messageLength>=32)return S();var x=32-E.pools[0].messageLength<<5;E.collect(E.seedFileSync(x)),S()}function S(){E.reseeds=E.reseeds===4294967295?0:E.reseeds+1;var x=E.plugin.md.create();x.update(E.keyBytes);for(var c=1,g=0;g<32;++g)E.reseeds%c===0&&(x.update(E.pools[g].digest().getBytes()),E.pools[g].start()),c=c<<1;E.keyBytes=x.digest().getBytes(),x.start(),x.update(E.keyBytes);var C=x.digest().getBytes();E.key=E.plugin.formatKey(E.keyBytes),E.seed=E.plugin.formatSeed(C),E.generated=0}function R(x){var c=null,g=t.util.globalScope,C=g.crypto||g.msCrypto;C&&C.getRandomValues&&(c=function(n){return C.getRandomValues(n)});var m=t.util.createBuffer();if(c)for(;m.length()<x;){var i=Math.max(1,Math.min(x-m.length(),65536)/4),h=new Uint32Array(Math.floor(i));try{c(h);for(var v=0;v<h.length;++v)m.putInt32(h[v])}catch(n){if(!(typeof QuotaExceededError<"u"&&n instanceof QuotaExceededError))throw n}}if(m.length()<x)for(var I,N,d,s=Math.floor(Math.random()*65536);m.length()<x;){N=16807*(s&65535),I=16807*(s>>16),N+=(I&32767)<<16,N+=I>>15,N=(N&2147483647)+(N>>31),s=N&4294967295;for(var v=0;v<3;++v)d=s>>>(v<<3),d^=Math.floor(Math.random()*256),m.putByte(d&255)}return m.getBytes(x)}return e?(E.seedFile=function(x,c){e.randomBytes(x,function(g,C){if(g)return c(g);c(null,C.toString())})},E.seedFileSync=function(x){return e.randomBytes(x).toString()}):(E.seedFile=function(x,c){try{c(null,R(x))}catch(g){c(g)}},E.seedFileSync=R),E.collect=function(x){for(var c=x.length,g=0;g<c;++g)E.pools[E.pool].update(x.substr(g,1)),E.pool=E.pool===31?0:E.pool+1},E.collectInt=function(x,c){for(var g="",C=0;C<c;C+=8)g+=String.fromCharCode(x>>C&255);E.collect(g)},E.registerWorker=function(x){if(x===self)E.seedFile=function(g,C){function m(i){var h=i.data;h.forge&&h.forge.prng&&(self.removeEventListener("message",m),C(h.forge.prng.err,h.forge.prng.bytes))}self.addEventListener("message",m),self.postMessage({forge:{prng:{needed:g}}})};else{var c=function(g){var C=g.data;C.forge&&C.forge.prng&&E.seedFile(C.forge.prng.needed,function(m,i){x.postMessage({forge:{prng:{err:m,bytes:i}}})})};x.addEventListener("message",c)}},E},br.exports}var Na;function Je(){if(Na)return qt.exports;Na=1;var t=ue();return gt(),wa(),Ra(),ce(),(function(){if(t.random&&t.random.getBytes){qt.exports=t.random;return}(function(e){var r={},o=new Array(4),E=t.util.createBuffer();r.formatKey=function(x){var c=t.util.createBuffer(x);return x=new Array(4),x[0]=c.getInt32(),x[1]=c.getInt32(),x[2]=c.getInt32(),x[3]=c.getInt32(),t.aes._expandKey(x,!1)},r.formatSeed=function(x){var c=t.util.createBuffer(x);return x=new Array(4),x[0]=c.getInt32(),x[1]=c.getInt32(),x[2]=c.getInt32(),x[3]=c.getInt32(),x},r.cipher=function(x,c){return t.aes._updateBlock(x,c,o,!1),E.putInt32(o[0]),E.putInt32(o[1]),E.putInt32(o[2]),E.putInt32(o[3]),E.getBytes()},r.increment=function(x){return++x[3],x},r.md=t.md.sha256;function y(){var x=t.prng.create(r);return x.getBytes=function(c,g){return x.generate(c,g)},x.getBytesSync=function(c){return x.generate(c)},x}var f=y(),a=null,p=t.util.globalScope,l=p.crypto||p.msCrypto;if(l&&l.getRandomValues&&(a=function(x){return l.getRandomValues(x)}),t.options.usePureJavaScript||!t.util.isNodejs&&!a){if(f.collectInt(+new Date,32),typeof navigator<"u"){var S="";for(var R in navigator)try{typeof navigator[R]=="string"&&(S+=navigator[R])}catch{}f.collect(S),S=null}e&&(e().mousemove(function(x){f.collectInt(x.clientX,16),f.collectInt(x.clientY,16)}),e().keypress(function(x){f.collectInt(x.charCode,8)}))}if(!t.random)t.random=f;else for(var R in f)t.random[R]=f[R];t.random.createInstance=y,qt.exports=t.random})(typeof jQuery<"u"?jQuery:null)})(),qt.exports}var wr,La;function ka(){if(La)return wr;La=1;var t=ue();ce();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],r=[1,2,3,5],o=function(f,a){return f<<a&65535|(f&65535)>>16-a},E=function(f,a){return(f&65535)>>a|f<<16-a&65535};wr=t.rc2=t.rc2||{},t.rc2.expandKey=function(f,a){typeof f=="string"&&(f=t.util.createBuffer(f)),a=a||128;var p=f,l=f.length(),S=a,R=Math.ceil(S/8),x=255>>(S&7),c;for(c=l;c<128;c++)p.putByte(e[p.at(c-1)+p.at(c-l)&255]);for(p.setAt(128-R,e[p.at(128-R)&x]),c=127-R;c>=0;c--)p.setAt(c,e[p.at(c+1)^p.at(c+R)]);return p};var y=function(f,a,p){var l=!1,S=null,R=null,x=null,c,g,C,m,i=[];for(f=t.rc2.expandKey(f,a),C=0;C<64;C++)i.push(f.getInt16Le());p?(c=function(I){for(C=0;C<4;C++)I[C]+=i[m]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),I[C]=o(I[C],r[C]),m++},g=function(I){for(C=0;C<4;C++)I[C]+=i[I[(C+3)%4]&63]}):(c=function(I){for(C=3;C>=0;C--)I[C]=E(I[C],r[C]),I[C]-=i[m]+(I[(C+3)%4]&I[(C+2)%4])+(~I[(C+3)%4]&I[(C+1)%4]),m--},g=function(I){for(C=3;C>=0;C--)I[C]-=i[I[(C+3)%4]&63]});var h=function(I){var N=[];for(C=0;C<4;C++){var d=S.getInt16Le();x!==null&&(p?d^=x.getInt16Le():x.putInt16Le(d)),N.push(d&65535)}m=p?0:63;for(var s=0;s<I.length;s++)for(var n=0;n<I[s][0];n++)I[s][1](N);for(C=0;C<4;C++)x!==null&&(p?x.putInt16Le(N[C]):N[C]^=x.getInt16Le()),R.putInt16Le(N[C])},v=null;return v={start:function(I,N){I&&typeof I=="string"&&(I=t.util.createBuffer(I)),l=!1,S=t.util.createBuffer(),R=N||new t.util.createBuffer,x=I,v.output=R},update:function(I){for(l||S.putBuffer(I);S.length()>=8;)h([[5,c],[1,g],[6,c],[1,g],[5,c]])},finish:function(I){var N=!0;if(p)if(I)N=I(8,S,!p);else{var d=S.length()===8?8:8-S.length();S.fillWithByte(d,d)}if(N&&(l=!0,v.update()),!p&&(N=S.length()===0,N))if(I)N=I(8,R,!p);else{var s=R.length(),n=R.at(s-1);n>s?N=!1:R.truncate(n)}return N}},v};return t.rc2.startEncrypting=function(f,a,p){var l=t.rc2.createEncryptionCipher(f,128);return l.start(a,p),l},t.rc2.createEncryptionCipher=function(f,a){return y(f,a,!0)},t.rc2.startDecrypting=function(f,a,p){var l=t.rc2.createDecryptionCipher(f,128);return l.start(a,p),l},t.rc2.createDecryptionCipher=function(f,a){return y(f,a,!1)},wr}var _r,Ua;function Ht(){if(Ua)return _r;Ua=1;var t=ue();_r=t.jsbn=t.jsbn||{};var e;function r(A,b,D){this.data=[],A!=null&&(typeof A=="number"?this.fromNumber(A,b,D):b==null&&typeof A!="string"?this.fromString(A,256):this.fromString(A,b))}t.jsbn.BigInteger=r;function o(){return new r(null)}function E(A,b,D,K,Q,Y){for(;--Y>=0;){var re=b*this.data[A++]+D.data[K]+Q;Q=Math.floor(re/67108864),D.data[K++]=re&67108863}return Q}function y(A,b,D,K,Q,Y){for(var re=b&32767,J=b>>15;--Y>=0;){var he=this.data[A]&32767,Fe=this.data[A++]>>15,$e=J*he+Fe*re;he=re*he+(($e&32767)<<15)+D.data[K]+(Q&1073741823),Q=(he>>>30)+($e>>>15)+J*Fe+(Q>>>30),D.data[K++]=he&1073741823}return Q}function f(A,b,D,K,Q,Y){for(var re=b&16383,J=b>>14;--Y>=0;){var he=this.data[A]&16383,Fe=this.data[A++]>>14,$e=J*he+Fe*re;he=re*he+(($e&16383)<<14)+D.data[K]+Q,Q=(he>>28)+($e>>14)+J*Fe,D.data[K++]=he&268435455}return Q}typeof navigator>"u"?(r.prototype.am=f,e=28):navigator.appName=="Microsoft Internet Explorer"?(r.prototype.am=y,e=30):navigator.appName!="Netscape"?(r.prototype.am=E,e=26):(r.prototype.am=f,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;var a=52;r.prototype.FV=Math.pow(2,a),r.prototype.F1=a-e,r.prototype.F2=2*e-a;var p="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array,S,R;for(S=48,R=0;R<=9;++R)l[S++]=R;for(S=97,R=10;R<36;++R)l[S++]=R;for(S=65,R=10;R<36;++R)l[S++]=R;function x(A){return p.charAt(A)}function c(A,b){var D=l[A.charCodeAt(b)];return D??-1}function g(A){for(var b=this.t-1;b>=0;--b)A.data[b]=this.data[b];A.t=this.t,A.s=this.s}function C(A){this.t=1,this.s=A<0?-1:0,A>0?this.data[0]=A:A<-1?this.data[0]=A+this.DV:this.t=0}function m(A){var b=o();return b.fromInt(A),b}function i(A,b){var D;if(b==16)D=4;else if(b==8)D=3;else if(b==256)D=8;else if(b==2)D=1;else if(b==32)D=5;else if(b==4)D=2;else{this.fromRadix(A,b);return}this.t=0,this.s=0;for(var K=A.length,Q=!1,Y=0;--K>=0;){var re=D==8?A[K]&255:c(A,K);if(re<0){A.charAt(K)=="-"&&(Q=!0);continue}Q=!1,Y==0?this.data[this.t++]=re:Y+D>this.DB?(this.data[this.t-1]|=(re&(1<<this.DB-Y)-1)<<Y,this.data[this.t++]=re>>this.DB-Y):this.data[this.t-1]|=re<<Y,Y+=D,Y>=this.DB&&(Y-=this.DB)}D==8&&(A[0]&128)!=0&&(this.s=-1,Y>0&&(this.data[this.t-1]|=(1<<this.DB-Y)-1<<Y)),this.clamp(),Q&&r.ZERO.subTo(this,this)}function h(){for(var A=this.s&this.DM;this.t>0&&this.data[this.t-1]==A;)--this.t}function v(A){if(this.s<0)return"-"+this.negate().toString(A);var b;if(A==16)b=4;else if(A==8)b=3;else if(A==2)b=1;else if(A==32)b=5;else if(A==4)b=2;else return this.toRadix(A);var D=(1<<b)-1,K,Q=!1,Y="",re=this.t,J=this.DB-re*this.DB%b;if(re-- >0)for(J<this.DB&&(K=this.data[re]>>J)>0&&(Q=!0,Y=x(K));re>=0;)J<b?(K=(this.data[re]&(1<<J)-1)<<b-J,K|=this.data[--re]>>(J+=this.DB-b)):(K=this.data[re]>>(J-=b)&D,J<=0&&(J+=this.DB,--re)),K>0&&(Q=!0),Q&&(Y+=x(K));return Q?Y:"0"}function I(){var A=o();return r.ZERO.subTo(this,A),A}function N(){return this.s<0?this.negate():this}function d(A){var b=this.s-A.s;if(b!=0)return b;var D=this.t;if(b=D-A.t,b!=0)return this.s<0?-b:b;for(;--D>=0;)if((b=this.data[D]-A.data[D])!=0)return b;return 0}function s(A){var b=1,D;return(D=A>>>16)!=0&&(A=D,b+=16),(D=A>>8)!=0&&(A=D,b+=8),(D=A>>4)!=0&&(A=D,b+=4),(D=A>>2)!=0&&(A=D,b+=2),(D=A>>1)!=0&&(A=D,b+=1),b}function n(){return this.t<=0?0:this.DB*(this.t-1)+s(this.data[this.t-1]^this.s&this.DM)}function B(A,b){var D;for(D=this.t-1;D>=0;--D)b.data[D+A]=this.data[D];for(D=A-1;D>=0;--D)b.data[D]=0;b.t=this.t+A,b.s=this.s}function U(A,b){for(var D=A;D<this.t;++D)b.data[D-A]=this.data[D];b.t=Math.max(this.t-A,0),b.s=this.s}function O(A,b){var D=A%this.DB,K=this.DB-D,Q=(1<<K)-1,Y=Math.floor(A/this.DB),re=this.s<<D&this.DM,J;for(J=this.t-1;J>=0;--J)b.data[J+Y+1]=this.data[J]>>K|re,re=(this.data[J]&Q)<<D;for(J=Y-1;J>=0;--J)b.data[J]=0;b.data[Y]=re,b.t=this.t+Y+1,b.s=this.s,b.clamp()}function P(A,b){b.s=this.s;var D=Math.floor(A/this.DB);if(D>=this.t){b.t=0;return}var K=A%this.DB,Q=this.DB-K,Y=(1<<K)-1;b.data[0]=this.data[D]>>K;for(var re=D+1;re<this.t;++re)b.data[re-D-1]|=(this.data[re]&Y)<<Q,b.data[re-D]=this.data[re]>>K;K>0&&(b.data[this.t-D-1]|=(this.s&Y)<<Q),b.t=this.t-D,b.clamp()}function M(A,b){for(var D=0,K=0,Q=Math.min(A.t,this.t);D<Q;)K+=this.data[D]-A.data[D],b.data[D++]=K&this.DM,K>>=this.DB;if(A.t<this.t){for(K-=A.s;D<this.t;)K+=this.data[D],b.data[D++]=K&this.DM,K>>=this.DB;K+=this.s}else{for(K+=this.s;D<A.t;)K-=A.data[D],b.data[D++]=K&this.DM,K>>=this.DB;K-=A.s}b.s=K<0?-1:0,K<-1?b.data[D++]=this.DV+K:K>0&&(b.data[D++]=K),b.t=D,b.clamp()}function q(A,b){var D=this.abs(),K=A.abs(),Q=D.t;for(b.t=Q+K.t;--Q>=0;)b.data[Q]=0;for(Q=0;Q<K.t;++Q)b.data[Q+D.t]=D.am(0,K.data[Q],b,Q,0,D.t);b.s=0,b.clamp(),this.s!=A.s&&r.ZERO.subTo(b,b)}function F(A){for(var b=this.abs(),D=A.t=2*b.t;--D>=0;)A.data[D]=0;for(D=0;D<b.t-1;++D){var K=b.am(D,b.data[D],A,2*D,0,1);(A.data[D+b.t]+=b.am(D+1,2*b.data[D],A,2*D+1,K,b.t-D-1))>=b.DV&&(A.data[D+b.t]-=b.DV,A.data[D+b.t+1]=1)}A.t>0&&(A.data[A.t-1]+=b.am(D,b.data[D],A,2*D,0,1)),A.s=0,A.clamp()}function G(A,b,D){var K=A.abs();if(!(K.t<=0)){var Q=this.abs();if(Q.t<K.t){b?.fromInt(0),D!=null&&this.copyTo(D);return}D==null&&(D=o());var Y=o(),re=this.s,J=A.s,he=this.DB-s(K.data[K.t-1]);he>0?(K.lShiftTo(he,Y),Q.lShiftTo(he,D)):(K.copyTo(Y),Q.copyTo(D));var Fe=Y.t,$e=Y.data[Fe-1];if($e!=0){var Xe=$e*(1<<this.F1)+(Fe>1?Y.data[Fe-2]>>this.F2:0),ut=this.FV/Xe,Xt=(1<<this.F1)/Xe,rt=1<<this.F2,at=D.t,jt=at-Fe,ht=b??o();for(Y.dlShiftTo(jt,ht),D.compareTo(ht)>=0&&(D.data[D.t++]=1,D.subTo(ht,D)),r.ONE.dlShiftTo(Fe,ht),ht.subTo(Y,Y);Y.t<Fe;)Y.data[Y.t++]=0;for(;--jt>=0;){var ea=D.data[--at]==$e?this.DM:Math.floor(D.data[at]*ut+(D.data[at-1]+rt)*Xt);if((D.data[at]+=Y.am(0,ea,D,jt,0,Fe))<ea)for(Y.dlShiftTo(jt,ht),D.subTo(ht,D);D.data[at]<--ea;)D.subTo(ht,D)}b!=null&&(D.drShiftTo(Fe,b),re!=J&&r.ZERO.subTo(b,b)),D.t=Fe,D.clamp(),he>0&&D.rShiftTo(he,D),re<0&&r.ZERO.subTo(D,D)}}}function W(A){var b=o();return this.abs().divRemTo(A,null,b),this.s<0&&b.compareTo(r.ZERO)>0&&A.subTo(b,b),b}function X(A){this.m=A}function ee(A){return A.s<0||A.compareTo(this.m)>=0?A.mod(this.m):A}function ne(A){return A}function ie(A){A.divRemTo(this.m,null,A)}function de(A,b,D){A.multiplyTo(b,D),this.reduce(D)}function ge(A,b){A.squareTo(b),this.reduce(b)}X.prototype.convert=ee,X.prototype.revert=ne,X.prototype.reduce=ie,X.prototype.mulTo=de,X.prototype.sqrTo=ge;function le(){if(this.t<1)return 0;var A=this.data[0];if((A&1)==0)return 0;var b=A&3;return b=b*(2-(A&15)*b)&15,b=b*(2-(A&255)*b)&255,b=b*(2-((A&65535)*b&65535))&65535,b=b*(2-A*b%this.DV)%this.DV,b>0?this.DV-b:-b}function j(A){this.m=A,this.mp=A.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<A.DB-15)-1,this.mt2=2*A.t}function $(A){var b=o();return A.abs().dlShiftTo(this.m.t,b),b.divRemTo(this.m,null,b),A.s<0&&b.compareTo(r.ZERO)>0&&this.m.subTo(b,b),b}function ze(A){var b=o();return A.copyTo(b),this.reduce(b),b}function qe(A){for(;A.t<=this.mt2;)A.data[A.t++]=0;for(var b=0;b<this.m.t;++b){var D=A.data[b]&32767,K=D*this.mpl+((D*this.mph+(A.data[b]>>15)*this.mpl&this.um)<<15)&A.DM;for(D=b+this.m.t,A.data[D]+=this.m.am(0,K,A,b,0,this.m.t);A.data[D]>=A.DV;)A.data[D]-=A.DV,A.data[++D]++}A.clamp(),A.drShiftTo(this.m.t,A),A.compareTo(this.m)>=0&&A.subTo(this.m,A)}function T(A,b){A.squareTo(b),this.reduce(b)}function k(A,b,D){A.multiplyTo(b,D),this.reduce(D)}j.prototype.convert=$,j.prototype.revert=ze,j.prototype.reduce=qe,j.prototype.mulTo=k,j.prototype.sqrTo=T;function L(){return(this.t>0?this.data[0]&1:this.s)==0}function _(A,b){if(A>4294967295||A<1)return r.ONE;var D=o(),K=o(),Q=b.convert(this),Y=s(A)-1;for(Q.copyTo(D);--Y>=0;)if(b.sqrTo(D,K),(A&1<<Y)>0)b.mulTo(K,Q,D);else{var re=D;D=K,K=re}return b.revert(D)}function u(A,b){var D;return A<256||b.isEven()?D=new X(b):D=new j(b),this.exp(A,D)}r.prototype.copyTo=g,r.prototype.fromInt=C,r.prototype.fromString=i,r.prototype.clamp=h,r.prototype.dlShiftTo=B,r.prototype.drShiftTo=U,r.prototype.lShiftTo=O,r.prototype.rShiftTo=P,r.prototype.subTo=M,r.prototype.multiplyTo=q,r.prototype.squareTo=F,r.prototype.divRemTo=G,r.prototype.invDigit=le,r.prototype.isEven=L,r.prototype.exp=_,r.prototype.toString=v,r.prototype.negate=I,r.prototype.abs=N,r.prototype.compareTo=d,r.prototype.bitLength=n,r.prototype.mod=W,r.prototype.modPowInt=u,r.ZERO=m(0),r.ONE=m(1);function w(){var A=o();return this.copyTo(A),A}function V(){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 H(){return this.t==0?this.s:this.data[0]<<24>>24}function ae(){return this.t==0?this.s:this.data[0]<<16>>16}function te(A){return Math.floor(Math.LN2*this.DB/Math.log(A))}function z(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Z(A){if(A==null&&(A=10),this.signum()==0||A<2||A>36)return"0";var b=this.chunkSize(A),D=Math.pow(A,b),K=m(D),Q=o(),Y=o(),re="";for(this.divRemTo(K,Q,Y);Q.signum()>0;)re=(D+Y.intValue()).toString(A).substr(1)+re,Q.divRemTo(K,Q,Y);return Y.intValue().toString(A)+re}function se(A,b){this.fromInt(0),b==null&&(b=10);for(var D=this.chunkSize(b),K=Math.pow(b,D),Q=!1,Y=0,re=0,J=0;J<A.length;++J){var he=c(A,J);if(he<0){A.charAt(J)=="-"&&this.signum()==0&&(Q=!0);continue}re=b*re+he,++Y>=D&&(this.dMultiply(K),this.dAddOffset(re,0),Y=0,re=0)}Y>0&&(this.dMultiply(Math.pow(b,Y)),this.dAddOffset(re,0)),Q&&r.ZERO.subTo(this,this)}function fe(A,b,D){if(typeof b=="number")if(A<2)this.fromInt(1);else for(this.fromNumber(A,D),this.testBit(A-1)||this.bitwiseTo(r.ONE.shiftLeft(A-1),pe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>A&&this.subTo(r.ONE.shiftLeft(A-1),this);else{var K=new Array,Q=A&7;K.length=(A>>3)+1,b.nextBytes(K),Q>0?K[0]&=(1<<Q)-1:K[0]=0,this.fromString(K,256)}}function oe(){var A=this.t,b=new Array;b[0]=this.s;var D=this.DB-A*this.DB%8,K,Q=0;if(A-- >0)for(D<this.DB&&(K=this.data[A]>>D)!=(this.s&this.DM)>>D&&(b[Q++]=K|this.s<<this.DB-D);A>=0;)D<8?(K=(this.data[A]&(1<<D)-1)<<8-D,K|=this.data[--A]>>(D+=this.DB-8)):(K=this.data[A]>>(D-=8)&255,D<=0&&(D+=this.DB,--A)),(K&128)!=0&&(K|=-256),Q==0&&(this.s&128)!=(K&128)&&++Q,(Q>0||K!=this.s)&&(b[Q++]=K);return b}function Ce(A){return this.compareTo(A)==0}function Te(A){return this.compareTo(A)<0?this:A}function Se(A){return this.compareTo(A)>0?this:A}function Ee(A,b,D){var K,Q,Y=Math.min(A.t,this.t);for(K=0;K<Y;++K)D.data[K]=b(this.data[K],A.data[K]);if(A.t<this.t){for(Q=A.s&this.DM,K=Y;K<this.t;++K)D.data[K]=b(this.data[K],Q);D.t=this.t}else{for(Q=this.s&this.DM,K=Y;K<A.t;++K)D.data[K]=b(Q,A.data[K]);D.t=A.t}D.s=b(this.s,A.s),D.clamp()}function ye(A,b){return A&b}function ve(A){var b=o();return this.bitwiseTo(A,ye,b),b}function pe(A,b){return A|b}function Ie(A){var b=o();return this.bitwiseTo(A,pe,b),b}function Be(A,b){return A^b}function He(A){var b=o();return this.bitwiseTo(A,Be,b),b}function Ge(A,b){return A&~b}function We(A){var b=o();return this.bitwiseTo(A,Ge,b),b}function Ye(){for(var A=o(),b=0;b<this.t;++b)A.data[b]=this.DM&~this.data[b];return A.t=this.t,A.s=~this.s,A}function je(A){var b=o();return A<0?this.rShiftTo(-A,b):this.lShiftTo(A,b),b}function et(A){var b=o();return A<0?this.lShiftTo(-A,b):this.rShiftTo(A,b),b}function it(A){if(A==0)return-1;var b=0;return(A&65535)==0&&(A>>=16,b+=16),(A&255)==0&&(A>>=8,b+=8),(A&15)==0&&(A>>=4,b+=4),(A&3)==0&&(A>>=2,b+=2),(A&1)==0&&++b,b}function ot(){for(var A=0;A<this.t;++A)if(this.data[A]!=0)return A*this.DB+it(this.data[A]);return this.s<0?this.t*this.DB:-1}function dt(A){for(var b=0;A!=0;)A&=A-1,++b;return b}function yt(){for(var A=0,b=this.s&this.DM,D=0;D<this.t;++D)A+=dt(this.data[D]^b);return A}function Et(A){var b=Math.floor(A/this.DB);return b>=this.t?this.s!=0:(this.data[b]&1<<A%this.DB)!=0}function Lt(A,b){var D=r.ONE.shiftLeft(A);return this.bitwiseTo(D,b,D),D}function Yt(A){return this.changeBit(A,pe)}function be(A){return this.changeBit(A,Ge)}function we(A){return this.changeBit(A,Be)}function _e(A,b){for(var D=0,K=0,Q=Math.min(A.t,this.t);D<Q;)K+=this.data[D]+A.data[D],b.data[D++]=K&this.DM,K>>=this.DB;if(A.t<this.t){for(K+=A.s;D<this.t;)K+=this.data[D],b.data[D++]=K&this.DM,K>>=this.DB;K+=this.s}else{for(K+=this.s;D<A.t;)K+=A.data[D],b.data[D++]=K&this.DM,K>>=this.DB;K+=A.s}b.s=K<0?-1:0,K>0?b.data[D++]=K:K<-1&&(b.data[D++]=this.DV+K),b.t=D,b.clamp()}function Re(A){var b=o();return this.addTo(A,b),b}function Ne(A){var b=o();return this.subTo(A,b),b}function Le(A){var b=o();return this.multiplyTo(A,b),b}function ke(){var A=o();return this.squareTo(A),A}function Ue(A){var b=o();return this.divRemTo(A,b,null),b}function De(A){var b=o();return this.divRemTo(A,null,b),b}function Pe(A){var b=o(),D=o();return this.divRemTo(A,b,D),new Array(b,D)}function Ve(A){this.data[this.t]=this.am(0,A-1,this,0,0,this.t),++this.t,this.clamp()}function Oe(A,b){if(A!=0){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=A;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=0),++this.data[b]}}function me(){}function Ae(A){return A}function Me(A,b,D){A.multiplyTo(b,D)}function Ke(A,b){A.squareTo(b)}me.prototype.convert=Ae,me.prototype.revert=Ae,me.prototype.mulTo=Me,me.prototype.sqrTo=Ke;function Pi(A){return this.exp(A,new me)}function Vi(A,b,D){var K=Math.min(this.t+A.t,b);for(D.s=0,D.t=K;K>0;)D.data[--K]=0;var Q;for(Q=D.t-this.t;K<Q;++K)D.data[K+this.t]=this.am(0,A.data[K],D,K,0,this.t);for(Q=Math.min(A.t,b);K<Q;++K)this.am(0,A.data[K],D,K,0,b-K);D.clamp()}function Oi(A,b,D){--b;var K=D.t=this.t+A.t-b;for(D.s=0;--K>=0;)D.data[K]=0;for(K=Math.max(b-this.t,0);K<A.t;++K)D.data[this.t+K-b]=this.am(b-K,A.data[K],D,0,0,this.t+K-b);D.clamp(),D.drShiftTo(1,D)}function xt(A){this.r2=o(),this.q3=o(),r.ONE.dlShiftTo(2*A.t,this.r2),this.mu=this.r2.divide(A),this.m=A}function Mi(A){if(A.s<0||A.t>2*this.m.t)return A.mod(this.m);if(A.compareTo(this.m)<0)return A;var b=o();return A.copyTo(b),this.reduce(b),b}function Ki(A){return A}function Fi(A){for(A.drShiftTo(this.m.t-1,this.r2),A.t>this.m.t+1&&(A.t=this.m.t+1,A.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);A.compareTo(this.r2)<0;)A.dAddOffset(1,this.m.t+1);for(A.subTo(this.r2,A);A.compareTo(this.m)>=0;)A.subTo(this.m,A)}function qi(A,b){A.squareTo(b),this.reduce(b)}function Hi(A,b,D){A.multiplyTo(b,D),this.reduce(D)}xt.prototype.convert=Mi,xt.prototype.revert=Ki,xt.prototype.reduce=Fi,xt.prototype.mulTo=Hi,xt.prototype.sqrTo=qi;function Gi(A,b){var D=A.bitLength(),K,Q=m(1),Y;if(D<=0)return Q;D<18?K=1:D<48?K=3:D<144?K=4:D<768?K=5:K=6,D<8?Y=new X(b):b.isEven()?Y=new xt(b):Y=new j(b);var re=new Array,J=3,he=K-1,Fe=(1<<K)-1;if(re[1]=Y.convert(this),K>1){var $e=o();for(Y.sqrTo(re[1],$e);J<=Fe;)re[J]=o(),Y.mulTo($e,re[J-2],re[J]),J+=2}var Xe=A.t-1,ut,Xt=!0,rt=o(),at;for(D=s(A.data[Xe])-1;Xe>=0;){for(D>=he?ut=A.data[Xe]>>D-he&Fe:(ut=(A.data[Xe]&(1<<D+1)-1)<<he-D,Xe>0&&(ut|=A.data[Xe-1]>>this.DB+D-he)),J=K;(ut&1)==0;)ut>>=1,--J;if((D-=J)<0&&(D+=this.DB,--Xe),Xt)re[ut].copyTo(Q),Xt=!1;else{for(;J>1;)Y.sqrTo(Q,rt),Y.sqrTo(rt,Q),J-=2;J>0?Y.sqrTo(Q,rt):(at=Q,Q=rt,rt=at),Y.mulTo(rt,re[ut],Q)}for(;Xe>=0&&(A.data[Xe]&1<<D)==0;)Y.sqrTo(Q,rt),at=Q,Q=rt,rt=at,--D<0&&(D=this.DB-1,--Xe)}return Y.revert(Q)}function zi(A){var b=this.s<0?this.negate():this.clone(),D=A.s<0?A.negate():A.clone();if(b.compareTo(D)<0){var K=b;b=D,D=K}var Q=b.getLowestSetBit(),Y=D.getLowestSetBit();if(Y<0)return b;for(Q<Y&&(Y=Q),Y>0&&(b.rShiftTo(Y,b),D.rShiftTo(Y,D));b.signum()>0;)(Q=b.getLowestSetBit())>0&&b.rShiftTo(Q,b),(Q=D.getLowestSetBit())>0&&D.rShiftTo(Q,D),b.compareTo(D)>=0?(b.subTo(D,b),b.rShiftTo(1,b)):(D.subTo(b,D),D.rShiftTo(1,D));return Y>0&&D.lShiftTo(Y,D),D}function Qi(A){if(A<=0)return 0;var b=this.DV%A,D=this.s<0?A-1:0;if(this.t>0)if(b==0)D=this.data[0]%A;else for(var K=this.t-1;K>=0;--K)D=(b*D+this.data[K])%A;return D}function Wi(A){if(this.signum()==0)return r.ZERO;var b=A.isEven();if(this.isEven()&&b||A.signum()==0)return r.ZERO;for(var D=A.clone(),K=this.clone(),Q=m(1),Y=m(0),re=m(0),J=m(1);D.signum()!=0;){for(;D.isEven();)D.rShiftTo(1,D),b?((!Q.isEven()||!Y.isEven())&&(Q.addTo(this,Q),Y.subTo(A,Y)),Q.rShiftTo(1,Q)):Y.isEven()||Y.subTo(A,Y),Y.rShiftTo(1,Y);for(;K.isEven();)K.rShiftTo(1,K),b?((!re.isEven()||!J.isEven())&&(re.addTo(this,re),J.subTo(A,J)),re.rShiftTo(1,re)):J.isEven()||J.subTo(A,J),J.rShiftTo(1,J);D.compareTo(K)>=0?(D.subTo(K,D),b&&Q.subTo(re,Q),Y.subTo(J,Y)):(K.subTo(D,K),b&&re.subTo(Q,re),J.subTo(Y,J))}if(K.compareTo(r.ONE)!=0)return r.ZERO;if(J.compareTo(A)>=0)return J.subtract(A);if(J.signum()<0)J.addTo(A,J);else return J;return J.signum()<0?J.add(A):J}var tt=[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],Yi=(1<<26)/tt[tt.length-1];function Xi(A){var b,D=this.abs();if(D.t==1&&D.data[0]<=tt[tt.length-1]){for(b=0;b<tt.length;++b)if(D.data[0]==tt[b])return!0;return!1}if(D.isEven())return!1;for(b=1;b<tt.length;){for(var K=tt[b],Q=b+1;Q<tt.length&&K<Yi;)K*=tt[Q++];for(K=D.modInt(K);b<Q;)if(K%tt[b++]==0)return!1}return D.millerRabin(A)}function ji(A){var b=this.subtract(r.ONE),D=b.getLowestSetBit();if(D<=0)return!1;for(var K=b.shiftRight(D),Q=$i(),Y,re=0;re<A;++re){do Y=new r(this.bitLength(),Q);while(Y.compareTo(r.ONE)<=0||Y.compareTo(b)>=0);var J=Y.modPow(K,this);if(J.compareTo(r.ONE)!=0&&J.compareTo(b)!=0){for(var he=1;he++<D&&J.compareTo(b)!=0;)if(J=J.modPowInt(2,this),J.compareTo(r.ONE)==0)return!1;if(J.compareTo(b)!=0)return!1}}return!0}function $i(){return{nextBytes:function(A){for(var b=0;b<A.length;++b)A[b]=Math.floor(Math.random()*256)}}}return r.prototype.chunkSize=te,r.prototype.toRadix=Z,r.prototype.fromRadix=se,r.prototype.fromNumber=fe,r.prototype.bitwiseTo=Ee,r.prototype.changeBit=Lt,r.prototype.addTo=_e,r.prototype.dMultiply=Ve,r.prototype.dAddOffset=Oe,r.prototype.multiplyLowerTo=Vi,r.prototype.multiplyUpperTo=Oi,r.prototype.modInt=Qi,r.prototype.millerRabin=ji,r.prototype.clone=w,r.prototype.intValue=V,r.prototype.byteValue=H,r.prototype.shortValue=ae,r.prototype.signum=z,r.prototype.toByteArray=oe,r.prototype.equals=Ce,r.prototype.min=Te,r.prototype.max=Se,r.prototype.and=ve,r.prototype.or=Ie,r.prototype.xor=He,r.prototype.andNot=We,r.prototype.not=Ye,r.prototype.shiftLeft=je,r.prototype.shiftRight=et,r.prototype.getLowestSetBit=ot,r.prototype.bitCount=yt,r.prototype.testBit=Et,r.prototype.setBit=Yt,r.prototype.clearBit=be,r.prototype.flipBit=we,r.prototype.add=Re,r.prototype.subtract=Ne,r.prototype.multiply=Le,r.prototype.divide=Ue,r.prototype.remainder=De,r.prototype.divideAndRemainder=Pe,r.prototype.modPow=Gi,r.prototype.modInverse=Wi,r.prototype.pow=Pi,r.prototype.gcd=zi,r.prototype.isProbablePrime=Xi,r.prototype.square=ke,_r}var Rr={exports:{}},Nr={exports:{}},Da;function Nt(){if(Da)return Nr.exports;Da=1;var t=ue();st(),ce();var e=Nr.exports=t.sha1=t.sha1||{};t.md.sha1=t.md.algorithms.sha1=e,e.create=function(){o||E();var f=null,a=t.util.createBuffer(),p=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 S=l.messageLengthSize/4,R=0;R<S;++R)l.fullMessageLength.push(0);return a=t.util.createBuffer(),f={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l},l.start(),l.update=function(S,R){R==="utf8"&&(S=t.util.encodeUtf8(S));var x=S.length;l.messageLength+=x,x=[x/4294967296>>>0,x>>>0];for(var c=l.fullMessageLength.length-1;c>=0;--c)l.fullMessageLength[c]+=x[1],x[1]=x[0]+(l.fullMessageLength[c]/4294967296>>>0),l.fullMessageLength[c]=l.fullMessageLength[c]>>>0,x[0]=x[1]/4294967296>>>0;return a.putBytes(S),y(f,p,a),(a.read>2048||a.length()===0)&&a.compact(),l},l.digest=function(){var S=t.util.createBuffer();S.putBytes(a.bytes());var R=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize,x=R&l.blockLength-1;S.putBytes(r.substr(0,l.blockLength-x));for(var c,g,C=l.fullMessageLength[0]*8,m=0;m<l.fullMessageLength.length-1;++m)c=l.fullMessageLength[m+1]*8,g=c/4294967296>>>0,C+=g,S.putInt32(C>>>0),C=c>>>0;S.putInt32(C);var i={h0:f.h0,h1:f.h1,h2:f.h2,h3:f.h3,h4:f.h4};y(i,p,S);var h=t.util.createBuffer();return h.putInt32(i.h0),h.putInt32(i.h1),h.putInt32(i.h2),h.putInt32(i.h3),h.putInt32(i.h4),h},l};var r=null,o=!1;function E(){r="",r+=t.util.fillString("\0",64),o=!0}function y(f,a,p){for(var l,S,R,x,c,g,C,m,i=p.length();i>=64;){for(S=f.h0,R=f.h1,x=f.h2,c=f.h3,g=f.h4,m=0;m<16;++m)l=p.getInt32(),a[m]=l,C=c^R&(x^c),l=(S<<5|S>>>27)+C+g+1518500249+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;for(;m<20;++m)l=a[m-3]^a[m-8]^a[m-14]^a[m-16],l=l<<1|l>>>31,a[m]=l,C=c^R&(x^c),l=(S<<5|S>>>27)+C+g+1518500249+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;for(;m<32;++m)l=a[m-3]^a[m-8]^a[m-14]^a[m-16],l=l<<1|l>>>31,a[m]=l,C=R^x^c,l=(S<<5|S>>>27)+C+g+1859775393+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;for(;m<40;++m)l=a[m-6]^a[m-16]^a[m-28]^a[m-32],l=l<<2|l>>>30,a[m]=l,C=R^x^c,l=(S<<5|S>>>27)+C+g+1859775393+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;for(;m<60;++m)l=a[m-6]^a[m-16]^a[m-28]^a[m-32],l=l<<2|l>>>30,a[m]=l,C=R&x|c&(R^x),l=(S<<5|S>>>27)+C+g+2400959708+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;for(;m<80;++m)l=a[m-6]^a[m-16]^a[m-28]^a[m-32],l=l<<2|l>>>30,a[m]=l,C=R^x^c,l=(S<<5|S>>>27)+C+g+3395469782+l,g=c,c=x,x=(R<<30|R>>>2)>>>0,R=S,S=l;f.h0=f.h0+S|0,f.h1=f.h1+R|0,f.h2=f.h2+x|0,f.h3=f.h3+c|0,f.h4=f.h4+g|0,i-=64}}return Nr.exports}var Pa;function Va(){if(Pa)return Rr.exports;Pa=1;var t=ue();ce(),Je(),Nt();var e=Rr.exports=t.pkcs1=t.pkcs1||{};e.encode_rsa_oaep=function(o,E,y){var f,a,p,l;typeof y=="string"?(f=y,a=arguments[3]||void 0,p=arguments[4]||void 0):y&&(f=y.label||void 0,a=y.seed||void 0,p=y.md||void 0,y.mgf1&&y.mgf1.md&&(l=y.mgf1.md)),p?p.start():p=t.md.sha1.create(),l||(l=p);var S=Math.ceil(o.n.bitLength()/8),R=S-2*p.digestLength-2;if(E.length>R){var x=new Error("RSAES-OAEP input message length is too long.");throw x.length=E.length,x.maxLength=R,x}f||(f=""),p.update(f,"raw");for(var c=p.digest(),g="",C=R-E.length,m=0;m<C;m++)g+="\0";var i=c.getBytes()+g+""+E;if(!a)a=t.random.getBytes(p.digestLength);else if(a.length!==p.digestLength){var x=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw x.seedLength=a.length,x.digestLength=p.digestLength,x}var h=r(a,S-p.digestLength-1,l),v=t.util.xorBytes(i,h,i.length),I=r(v,p.digestLength,l),N=t.util.xorBytes(a,I,a.length);return"\0"+N+v},e.decode_rsa_oaep=function(o,E,y){var f,a,p;typeof y=="string"?(f=y,a=arguments[3]||void 0):y&&(f=y.label||void 0,a=y.md||void 0,y.mgf1&&y.mgf1.md&&(p=y.mgf1.md));var l=Math.ceil(o.n.bitLength()/8);if(E.length!==l){var v=new Error("RSAES-OAEP encoded message length is invalid.");throw v.length=E.length,v.expectedLength=l,v}if(a===void 0?a=t.md.sha1.create():a.start(),p||(p=a),l<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");f||(f=""),a.update(f,"raw");for(var S=a.digest().getBytes(),R=E.charAt(0),x=E.substring(1,a.digestLength+1),c=E.substring(1+a.digestLength),g=r(c,a.digestLength,p),C=t.util.xorBytes(x,g,x.length),m=r(C,l-a.digestLength-1,p),i=t.util.xorBytes(c,m,c.length),h=i.substring(0,a.digestLength),v=R!=="\0",I=0;I<a.digestLength;++I)v|=S.charAt(I)!==h.charAt(I);for(var N=1,d=a.digestLength,s=a.digestLength;s<i.length;s++){var n=i.charCodeAt(s),B=n&1^1,U=N?65534:0;v|=n&U,N=N&B,d+=N}if(v||i.charCodeAt(d)!==1)throw new Error("Invalid RSAES-OAEP padding.");return i.substring(d+1)};function r(o,E,y){y||(y=t.md.sha1.create());for(var f="",a=Math.ceil(E/y.digestLength),p=0;p<a;++p){var l=String.fromCharCode(p>>24&255,p>>16&255,p>>8&255,p&255);y.start(),y.update(o+l),f+=y.digest().getBytes()}return f.substring(0,E)}return Rr.exports}var Gt={exports:{}},Oa;function Ma(){if(Oa)return Gt.exports;Oa=1;var t=ue();return ce(),Ht(),Je(),(function(){if(t.prime){Gt.exports=t.prime;return}var e=Gt.exports=t.prime=t.prime||{},r=t.jsbn.BigInteger,o=[6,4,2,4,2,4,6,2],E=new r(null);E.fromInt(30);var y=function(x,c){return x|c};e.generateProbablePrime=function(x,c,g){typeof c=="function"&&(g=c,c={}),c=c||{};var C=c.algorithm||"PRIMEINC";typeof C=="string"&&(C={name:C}),C.options=C.options||{};var m=c.prng||t.random,i={nextBytes:function(h){for(var v=m.getBytesSync(h.length),I=0;I<h.length;++I)h[I]=v.charCodeAt(I)}};if(C.name==="PRIMEINC")return f(x,i,C.options,g);throw new Error("Invalid prime generation algorithm: "+C.name)};function f(x,c,g,C){return"workers"in g?l(x,c,g,C):a(x,c,g,C)}function a(x,c,g,C){var m=S(x,c),i=0,h=R(m.bitLength());"millerRabinTests"in g&&(h=g.millerRabinTests);var v=10;"maxBlockTime"in g&&(v=g.maxBlockTime),p(m,x,c,i,h,v,C)}function p(x,c,g,C,m,i,h){var v=+new Date;do{if(x.bitLength()>c&&(x=S(c,g)),x.isProbablePrime(m))return h(null,x);x.dAddOffset(o[C++%8],0)}while(i<0||+new Date-v<i);t.util.setImmediate(function(){p(x,c,g,C,m,i,h)})}function l(x,c,g,C){if(typeof Worker>"u")return a(x,c,g,C);var m=S(x,c),i=g.workers,h=g.workLoad||100,v=h*30/8,I=g.workerScript||"forge/prime.worker.js";if(i===-1)return t.util.estimateCores(function(d,s){d&&(s=2),i=s-1,N()});N();function N(){i=Math.max(1,i);for(var d=[],s=0;s<i;++s)d[s]=new Worker(I);for(var s=0;s<i;++s)d[s].addEventListener("message",B);var n=!1;function B(U){if(!n){var O=U.data;if(O.found){for(var P=0;P<d.length;++P)d[P].terminate();return n=!0,C(null,new r(O.prime,16))}m.bitLength()>x&&(m=S(x,c));var M=m.toString(16);U.target.postMessage({hex:M,workLoad:h}),m.dAddOffset(v,0)}}}}function S(x,c){var g=new r(x,c),C=x-1;return g.testBit(C)||g.bitwiseTo(r.ONE.shiftLeft(C),y,g),g.dAddOffset(31-g.mod(E).byteValue(),0),g}function R(x){return x<=100?27:x<=150?18:x<=200?15:x<=250?12:x<=300?9:x<=350?8:x<=400?7:x<=500?6:x<=600?5:x<=800?4:x<=1250?3:2}})(),Gt.exports}var Lr,Ka;function zt(){if(Ka)return Lr;Ka=1;var t=ue();if(nt(),Ht(),vt(),Va(),Ma(),Je(),ce(),typeof e>"u")var e=t.jsbn.BigInteger;var r=t.util.isNodejs?Tr:null,o=t.asn1,E=t.util;t.pki=t.pki||{},Lr=t.pki.rsa=t.rsa=t.rsa||{};var y=t.pki,f=[6,4,2,4,2,4,6,2],a={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},S=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},R={name:"DigestInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},x=function(s){var n;if(s.algorithm in y.oids)n=y.oids[s.algorithm];else{var B=new Error("Unknown message digest algorithm.");throw B.algorithm=s.algorithm,B}var U=o.oidToDer(n).getBytes(),O=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),P=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);P.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,U)),P.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var M=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,s.digest().getBytes());return O.value.push(P),O.value.push(M),o.toDer(O).getBytes()},c=function(s,n,B){if(B)return s.modPow(n.e,n.n);if(!n.p||!n.q)return s.modPow(n.d,n.n);n.dP||(n.dP=n.d.mod(n.p.subtract(e.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(e.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));var U;do U=new e(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16);while(U.compareTo(n.n)>=0||!U.gcd(n.n).equals(e.ONE));s=s.multiply(U.modPow(n.e,n.n)).mod(n.n);for(var O=s.mod(n.p).modPow(n.dP,n.p),P=s.mod(n.q).modPow(n.dQ,n.q);O.compareTo(P)<0;)O=O.add(n.p);var M=O.subtract(P).multiply(n.qInv).mod(n.p).multiply(n.q).add(P);return M=M.multiply(U.modInverse(n.n)).mod(n.n),M};y.rsa.encrypt=function(s,n,B){var U=B,O,P=Math.ceil(n.n.bitLength()/8);B!==!1&&B!==!0?(U=B===2,O=g(s,n,B)):(O=t.util.createBuffer(),O.putBytes(s));for(var M=new e(O.toHex(),16),q=c(M,n,U),F=q.toString(16),G=t.util.createBuffer(),W=P-Math.ceil(F.length/2);W>0;)G.putByte(0),--W;return G.putBytes(t.util.hexToBytes(F)),G.getBytes()},y.rsa.decrypt=function(s,n,B,U){var O=Math.ceil(n.n.bitLength()/8);if(s.length!==O){var P=new Error("Encrypted message length is invalid.");throw P.length=s.length,P.expected=O,P}var M=new e(t.util.createBuffer(s).toHex(),16);if(M.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var q=c(M,n,B),F=q.toString(16),G=t.util.createBuffer(),W=O-Math.ceil(F.length/2);W>0;)G.putByte(0),--W;return G.putBytes(t.util.hexToBytes(F)),U!==!1?C(G.getBytes(),n,B):G.getBytes()},y.rsa.createKeyPairGenerationState=function(s,n,B){typeof s=="string"&&(s=parseInt(s,10)),s=s||2048,B=B||{};var U=B.prng||t.random,O={nextBytes:function(q){for(var F=U.getBytesSync(q.length),G=0;G<q.length;++G)q[G]=F.charCodeAt(G)}},P=B.algorithm||"PRIMEINC",M;if(P==="PRIMEINC")M={algorithm:P,state:0,bits:s,rng:O,eInt:n||65537,e:new e(null),p:null,q:null,qBits:s>>1,pBits:s-(s>>1),pqState:0,num:null,keys:null},M.e.fromInt(M.eInt);else throw new Error("Invalid key generation algorithm: "+P);return M},y.rsa.stepKeyPairGenerationState=function(s,n){"algorithm"in s||(s.algorithm="PRIMEINC");var B=new e(null);B.fromInt(30);for(var U=0,O=function(X,ee){return X|ee},P=+new Date,M,q=0;s.keys===null&&(n<=0||q<n);){if(s.state===0){var F=s.p===null?s.pBits:s.qBits,G=F-1;s.pqState===0?(s.num=new e(F,s.rng),s.num.testBit(G)||s.num.bitwiseTo(e.ONE.shiftLeft(G),O,s.num),s.num.dAddOffset(31-s.num.mod(B).byteValue(),0),U=0,++s.pqState):s.pqState===1?s.num.bitLength()>F?s.pqState=0:s.num.isProbablePrime(h(s.num.bitLength()))?++s.pqState:s.num.dAddOffset(f[U++%8],0):s.pqState===2?s.pqState=s.num.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)===0?3:0:s.pqState===3&&(s.pqState=0,s.p===null?s.p=s.num:s.q=s.num,s.p!==null&&s.q!==null&&++s.state,s.num=null)}else if(s.state===1)s.p.compareTo(s.q)<0&&(s.num=s.p,s.p=s.q,s.q=s.num),++s.state;else if(s.state===2)s.p1=s.p.subtract(e.ONE),s.q1=s.q.subtract(e.ONE),s.phi=s.p1.multiply(s.q1),++s.state;else if(s.state===3)s.phi.gcd(s.e).compareTo(e.ONE)===0?++s.state:(s.p=null,s.q=null,s.state=0);else if(s.state===4)s.n=s.p.multiply(s.q),s.n.bitLength()===s.bits?++s.state:(s.q=null,s.state=0);else if(s.state===5){var W=s.e.modInverse(s.phi);s.keys={privateKey:y.rsa.setPrivateKey(s.n,s.e,W,s.p,s.q,W.mod(s.p1),W.mod(s.q1),s.q.modInverse(s.p)),publicKey:y.rsa.setPublicKey(s.n,s.e)}}M=+new Date,q+=M-P,P=M}return s.keys!==null},y.rsa.generateKeyPair=function(s,n,B,U){if(arguments.length===1?typeof s=="object"?(B=s,s=void 0):typeof s=="function"&&(U=s,s=void 0):arguments.length===2?typeof s=="number"?typeof n=="function"?(U=n,n=void 0):typeof n!="number"&&(B=n,n=void 0):(B=s,U=n,s=void 0,n=void 0):arguments.length===3&&(typeof n=="number"?typeof B=="function"&&(U=B,B=void 0):(U=B,B=n,n=void 0)),B=B||{},s===void 0&&(s=B.bits||2048),n===void 0&&(n=B.e||65537),!t.options.usePureJavaScript&&!B.prng&&s>=256&&s<=16384&&(n===65537||n===3)){if(U){if(v("generateKeyPair"))return r.generateKeyPair("rsa",{modulusLength:s,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(q,F,G){if(q)return U(q);U(null,{privateKey:y.privateKeyFromPem(G),publicKey:y.publicKeyFromPem(F)})});if(I("generateKey")&&I("exportKey"))return E.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:s,publicExponent:d(n),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(q){return E.globalScope.crypto.subtle.exportKey("pkcs8",q.privateKey)}).then(void 0,function(q){U(q)}).then(function(q){if(q){var F=y.privateKeyFromAsn1(o.fromDer(t.util.createBuffer(q)));U(null,{privateKey:F,publicKey:y.setRsaPublicKey(F.n,F.e)})}});if(N("generateKey")&&N("exportKey")){var O=E.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:s,publicExponent:d(n),hash:{name:"SHA-256"}},!0,["sign","verify"]);O.oncomplete=function(q){var F=q.target.result,G=E.globalScope.msCrypto.subtle.exportKey("pkcs8",F.privateKey);G.oncomplete=function(W){var X=W.target.result,ee=y.privateKeyFromAsn1(o.fromDer(t.util.createBuffer(X)));U(null,{privateKey:ee,publicKey:y.setRsaPublicKey(ee.n,ee.e)})},G.onerror=function(W){U(W)}},O.onerror=function(q){U(q)};return}}else if(v("generateKeyPairSync")){var P=r.generateKeyPairSync("rsa",{modulusLength:s,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:y.privateKeyFromPem(P.privateKey),publicKey:y.publicKeyFromPem(P.publicKey)}}}var M=y.rsa.createKeyPairGenerationState(s,n,B);if(!U)return y.rsa.stepKeyPairGenerationState(M,0),M.keys;m(M,B,U)},y.setRsaPublicKey=y.rsa.setPublicKey=function(s,n){var B={n:s,e:n};return B.encrypt=function(U,O,P){if(typeof O=="string"?O=O.toUpperCase():O===void 0&&(O="RSAES-PKCS1-V1_5"),O==="RSAES-PKCS1-V1_5")O={encode:function(q,F,G){return g(q,F,2).getBytes()}};else if(O==="RSA-OAEP"||O==="RSAES-OAEP")O={encode:function(q,F){return t.pkcs1.encode_rsa_oaep(F,q,P)}};else if(["RAW","NONE","NULL",null].indexOf(O)!==-1)O={encode:function(q){return q}};else if(typeof O=="string")throw new Error('Unsupported encryption scheme: "'+O+'".');var M=O.encode(U,B,!0);return y.rsa.encrypt(M,B,!0)},B.verify=function(U,O,P,M){typeof P=="string"?P=P.toUpperCase():P===void 0&&(P="RSASSA-PKCS1-V1_5"),M===void 0&&(M={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in M||(M._parseAllDigestBytes=!0),"_skipPaddingChecks"in M||(M._skipPaddingChecks=!1),P==="RSASSA-PKCS1-V1_5"?P={verify:function(F,G){G=C(G,B,!0,void 0,M);var W=o.fromDer(G,{parseAllBytes:M._parseAllDigestBytes}),X={},ee=[];if(!o.validate(W,R,X,ee)||W.value.length!==2){var ne=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ne.errors=ee,ne}var ie=o.derToOid(X.algorithmIdentifier);if(!(ie===t.oids.md2||ie===t.oids.md5||ie===t.oids.sha1||ie===t.oids.sha224||ie===t.oids.sha256||ie===t.oids.sha384||ie===t.oids.sha512||ie===t.oids["sha512-224"]||ie===t.oids["sha512-256"])){var ne=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ne.oid=ie,ne}if((ie===t.oids.md2||ie===t.oids.md5)&&!("parameters"in X))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return F===X.digest}}:(P==="NONE"||P==="NULL"||P===null)&&(P={verify:function(F,G){return G=C(G,B,!0,void 0,M),F===G}});var q=y.rsa.decrypt(O,B,!0,!1);return P.verify(U,q,B.n.bitLength())},B},y.setRsaPrivateKey=y.rsa.setPrivateKey=function(s,n,B,U,O,P,M,q){var F={n:s,e:n,d:B,p:U,q:O,dP:P,dQ:M,qInv:q};return F.decrypt=function(G,W,X){typeof W=="string"?W=W.toUpperCase():W===void 0&&(W="RSAES-PKCS1-V1_5");var ee=y.rsa.decrypt(G,F,!1,!1);if(W==="RSAES-PKCS1-V1_5")W={decode:C};else if(W==="RSA-OAEP"||W==="RSAES-OAEP")W={decode:function(ne,ie){return t.pkcs1.decode_rsa_oaep(ie,ne,X)}};else if(["RAW","NONE","NULL",null].indexOf(W)!==-1)W={decode:function(ne){return ne}};else throw new Error('Unsupported encryption scheme: "'+W+'".');return W.decode(ee,F,!1)},F.sign=function(G,W){var X=!1;typeof W=="string"&&(W=W.toUpperCase()),W===void 0||W==="RSASSA-PKCS1-V1_5"?(W={encode:x},X=1):(W==="NONE"||W==="NULL"||W===null)&&(W={encode:function(){return G}},X=1);var ee=W.encode(G,F.n.bitLength());return y.rsa.encrypt(ee,F,X)},F},y.wrapRsaPrivateKey=function(s){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(s).getBytes())])},y.privateKeyFromAsn1=function(s){var n={},B=[];if(o.validate(s,a,n,B)&&(s=o.fromDer(t.util.createBuffer(n.privateKey))),n={},B=[],!o.validate(s,p,n,B)){var U=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw U.errors=B,U}var O,P,M,q,F,G,W,X;return O=t.util.createBuffer(n.privateKeyModulus).toHex(),P=t.util.createBuffer(n.privateKeyPublicExponent).toHex(),M=t.util.createBuffer(n.privateKeyPrivateExponent).toHex(),q=t.util.createBuffer(n.privateKeyPrime1).toHex(),F=t.util.createBuffer(n.privateKeyPrime2).toHex(),G=t.util.createBuffer(n.privateKeyExponent1).toHex(),W=t.util.createBuffer(n.privateKeyExponent2).toHex(),X=t.util.createBuffer(n.privateKeyCoefficient).toHex(),y.setRsaPrivateKey(new e(O,16),new e(P,16),new e(M,16),new e(q,16),new e(F,16),new e(G,16),new e(W,16),new e(X,16))},y.privateKeyToAsn1=y.privateKeyToRSAPrivateKey=function(s){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.qInv))])},y.publicKeyFromAsn1=function(s){var n={},B=[];if(o.validate(s,S,n,B)){var U=o.derToOid(n.publicKeyOid);if(U!==y.oids.rsaEncryption){var O=new Error("Cannot read public key. Unknown OID.");throw O.oid=U,O}s=n.rsaPublicKey}if(B=[],!o.validate(s,l,n,B)){var O=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw O.errors=B,O}var P=t.util.createBuffer(n.publicKeyModulus).toHex(),M=t.util.createBuffer(n.publicKeyExponent).toHex();return y.setRsaPublicKey(new e(P,16),new e(M,16))},y.publicKeyToAsn1=y.publicKeyToSubjectPublicKeyInfo=function(s){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[y.publicKeyToRSAPublicKey(s)])])},y.publicKeyToRSAPublicKey=function(s){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,i(s.e))])};function g(s,n,B){var U=t.util.createBuffer(),O=Math.ceil(n.n.bitLength()/8);if(s.length>O-11){var P=new Error("Message is too long for PKCS#1 v1.5 padding.");throw P.length=s.length,P.max=O-11,P}U.putByte(0),U.putByte(B);var M=O-3-s.length,q;if(B===0||B===1){q=B===0?0:255;for(var F=0;F<M;++F)U.putByte(q)}else for(;M>0;){for(var G=0,W=t.random.getBytes(M),F=0;F<M;++F)q=W.charCodeAt(F),q===0?++G:U.putByte(q);M=G}return U.putByte(0),U.putBytes(s),U}function C(s,n,B,U,O){var P=Math.ceil(n.n.bitLength()/8),M=t.util.createBuffer(s),q=M.getByte(),F=M.getByte();if(q!==0||B&&F!==0&&F!==1||!B&&F!==2||B&&F===0&&typeof U>"u")throw new Error("Encryption block is invalid.");var G=0;if(F===0){G=P-3-U;for(var W=0;W<G;++W)if(M.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(F===1){for(G=0;M.length()>1;){if(M.getByte()!==255){--M.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(F===2){for(G=0;M.length()>1;){if(M.getByte()===0){--M.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var X=M.getByte();if(X!==0||G!==P-3-M.length())throw new Error("Encryption block is invalid.");return M.getBytes()}function m(s,n,B){typeof n=="function"&&(B=n,n={}),n=n||{};var U={algorithm:{name:n.algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};"prng"in n&&(U.prng=n.prng),O();function O(){P(s.pBits,function(q,F){if(q)return B(q);if(s.p=F,s.q!==null)return M(q,s.q);P(s.qBits,M)})}function P(q,F){t.prime.generateProbablePrime(q,U,F)}function M(q,F){if(q)return B(q);if(s.q=F,s.p.compareTo(s.q)<0){var G=s.p;s.p=s.q,s.q=G}if(s.p.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)!==0){s.p=null,O();return}if(s.q.subtract(e.ONE).gcd(s.e).compareTo(e.ONE)!==0){s.q=null,P(s.qBits,M);return}if(s.p1=s.p.subtract(e.ONE),s.q1=s.q.subtract(e.ONE),s.phi=s.p1.multiply(s.q1),s.phi.gcd(s.e).compareTo(e.ONE)!==0){s.p=s.q=null,O();return}if(s.n=s.p.multiply(s.q),s.n.bitLength()!==s.bits){s.q=null,P(s.qBits,M);return}var W=s.e.modInverse(s.phi);s.keys={privateKey:y.rsa.setPrivateKey(s.n,s.e,W,s.p,s.q,W.mod(s.p1),W.mod(s.q1),s.q.modInverse(s.p)),publicKey:y.rsa.setPublicKey(s.n,s.e)},B(null,s.keys)}}function i(s){var n=s.toString(16);n[0]>="8"&&(n="00"+n);var B=t.util.hexToBytes(n);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 h(s){return s<=100?27:s<=150?18:s<=200?15:s<=250?12:s<=300?9:s<=350?8:s<=400?7:s<=500?6:s<=600?5:s<=800?4:s<=1250?3:2}function v(s){return t.util.isNodejs&&typeof r[s]=="function"}function I(s){return typeof E.globalScope<"u"&&typeof E.globalScope.crypto=="object"&&typeof E.globalScope.crypto.subtle=="object"&&typeof E.globalScope.crypto.subtle[s]=="function"}function N(s){return typeof E.globalScope<"u"&&typeof E.globalScope.msCrypto=="object"&&typeof E.globalScope.msCrypto.subtle=="object"&&typeof E.globalScope.msCrypto.subtle[s]=="function"}function d(s){for(var n=t.util.hexToBytes(s.toString(16)),B=new Uint8Array(n.length),U=0;U<n.length;++U)B[U]=n.charCodeAt(U);return B}return Lr}var kr,Fa;function qa(){if(Fa)return kr;Fa=1;var t=ue();if(gt(),nt(),Ft(),st(),vt(),Ir(),Ct(),Je(),ka(),zt(),ce(),typeof e>"u")var e=t.jsbn.BigInteger;var r=t.asn1,o=t.pki=t.pki||{};kr=o.pbe=t.pbe=t.pbe||{};var E=o.oids,y={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},f={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},a={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};o.encryptPrivateKeyInfo=function(x,c,g){g=g||{},g.saltSize=g.saltSize||8,g.count=g.count||2048,g.algorithm=g.algorithm||"aes128",g.prfAlgorithm=g.prfAlgorithm||"sha1";var C=t.random.getBytesSync(g.saltSize),m=g.count,i=r.integerToDer(m),h,v,I;if(g.algorithm.indexOf("aes")===0||g.algorithm==="des"){var N,d,s;switch(g.algorithm){case"aes128":h=16,N=16,d=E["aes128-CBC"],s=t.aes.createEncryptionCipher;break;case"aes192":h=24,N=16,d=E["aes192-CBC"],s=t.aes.createEncryptionCipher;break;case"aes256":h=32,N=16,d=E["aes256-CBC"],s=t.aes.createEncryptionCipher;break;case"des":h=8,N=8,d=E.desCBC,s=t.des.createEncryptionCipher;break;default:var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=g.algorithm,n}var B="hmacWith"+g.prfAlgorithm.toUpperCase(),U=S(B),O=t.pkcs5.pbkdf2(c,C,m,h,U),P=t.random.getBytesSync(N),M=s(O);M.start(P),M.update(r.toDer(x)),M.finish(),I=M.output.getBytes();var q=R(C,i,h,B);v=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(E.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(E.pkcs5PBKDF2).getBytes()),q]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(d).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,P)])])])}else if(g.algorithm==="3des"){h=24;var F=new t.util.ByteBuffer(C),O=o.pbe.generatePkcs12Key(c,F,1,m,h),P=o.pbe.generatePkcs12Key(c,F,2,m,h),M=t.des.createEncryptionCipher(O);M.start(P),M.update(r.toDer(x)),M.finish(),I=M.output.getBytes(),v=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(E["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,C),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,i.getBytes())])])}else{var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=g.algorithm,n}var G=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[v,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,I)]);return G},o.decryptPrivateKeyInfo=function(x,c){var g=null,C={},m=[];if(!r.validate(x,y,C,m)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=m,i}var h=r.derToOid(C.encryptionOid),v=o.pbe.getCipher(h,C.encryptionParams,c),I=t.util.createBuffer(C.encryptedData);return v.update(I),v.finish()&&(g=r.fromDer(v.output)),g},o.encryptedPrivateKeyToPem=function(x,c){var g={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(x).getBytes()};return t.pem.encode(g,{maxline:c})},o.encryptedPrivateKeyFromPem=function(x){var c=t.pem.decode(x)[0];if(c.type!=="ENCRYPTED PRIVATE KEY"){var g=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw g.headerType=c.type,g}if(c.procType&&c.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(c.body)},o.encryptRsaPrivateKey=function(x,c,g){if(g=g||{},!g.legacy){var C=o.wrapRsaPrivateKey(o.privateKeyToAsn1(x));return C=o.encryptPrivateKeyInfo(C,c,g),o.encryptedPrivateKeyToPem(C)}var m,i,h,v;switch(g.algorithm){case"aes128":m="AES-128-CBC",h=16,i=t.random.getBytesSync(16),v=t.aes.createEncryptionCipher;break;case"aes192":m="AES-192-CBC",h=24,i=t.random.getBytesSync(16),v=t.aes.createEncryptionCipher;break;case"aes256":m="AES-256-CBC",h=32,i=t.random.getBytesSync(16),v=t.aes.createEncryptionCipher;break;case"3des":m="DES-EDE3-CBC",h=24,i=t.random.getBytesSync(8),v=t.des.createEncryptionCipher;break;case"des":m="DES-CBC",h=8,i=t.random.getBytesSync(8),v=t.des.createEncryptionCipher;break;default:var I=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+g.algorithm+'".');throw I.algorithm=g.algorithm,I}var N=t.pbe.opensslDeriveBytes(c,i.substr(0,8),h),d=v(N);d.start(i),d.update(r.toDer(o.privateKeyToAsn1(x))),d.finish();var s={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:m,parameters:t.util.bytesToHex(i).toUpperCase()},body:d.output.getBytes()};return t.pem.encode(s)},o.decryptRsaPrivateKey=function(x,c){var g=null,C=t.pem.decode(x)[0];if(C.type!=="ENCRYPTED PRIVATE KEY"&&C.type!=="PRIVATE KEY"&&C.type!=="RSA PRIVATE KEY"){var m=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw m.headerType=m,m}if(C.procType&&C.procType.type==="ENCRYPTED"){var i,h;switch(C.dekInfo.algorithm){case"DES-CBC":i=8,h=t.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,h=t.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,h=t.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,h=t.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,h=t.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,h=function(s){return t.rc2.createDecryptionCipher(s,40)};break;case"RC2-64-CBC":i=8,h=function(s){return t.rc2.createDecryptionCipher(s,64)};break;case"RC2-128-CBC":i=16,h=function(s){return t.rc2.createDecryptionCipher(s,128)};break;default:var m=new Error('Could not decrypt private key; unsupported encryption algorithm "'+C.dekInfo.algorithm+'".');throw m.algorithm=C.dekInfo.algorithm,m}var v=t.util.hexToBytes(C.dekInfo.parameters),I=t.pbe.opensslDeriveBytes(c,v.substr(0,8),i),N=h(I);if(N.start(v),N.update(t.util.createBuffer(C.body)),N.finish())g=N.output.getBytes();else return g}else g=C.body;return C.type==="ENCRYPTED PRIVATE KEY"?g=o.decryptPrivateKeyInfo(r.fromDer(g),c):g=r.fromDer(g),g!==null&&(g=o.privateKeyFromAsn1(g)),g},o.pbe.generatePkcs12Key=function(x,c,g,C,m,i){var h,v;if(typeof i>"u"||i===null){if(!("sha1"in t.md))throw new Error('"sha1" hash algorithm unavailable.');i=t.md.sha1.create()}var I=i.digestLength,N=i.blockLength,d=new t.util.ByteBuffer,s=new t.util.ByteBuffer;if(x!=null){for(v=0;v<x.length;v++)s.putInt16(x.charCodeAt(v));s.putInt16(0)}var n=s.length(),B=c.length(),U=new t.util.ByteBuffer;U.fillWithByte(g,N);var O=N*Math.ceil(B/N),P=new t.util.ByteBuffer;for(v=0;v<O;v++)P.putByte(c.at(v%B));var M=N*Math.ceil(n/N),q=new t.util.ByteBuffer;for(v=0;v<M;v++)q.putByte(s.at(v%n));var F=P;F.putBuffer(q);for(var G=Math.ceil(m/I),W=1;W<=G;W++){var X=new t.util.ByteBuffer;X.putBytes(U.bytes()),X.putBytes(F.bytes());for(var ee=0;ee<C;ee++)i.start(),i.update(X.getBytes()),X=i.digest();var ne=new t.util.ByteBuffer;for(v=0;v<N;v++)ne.putByte(X.at(v%I));var ie=Math.ceil(B/N)+Math.ceil(n/N),de=new t.util.ByteBuffer;for(h=0;h<ie;h++){var ge=new t.util.ByteBuffer(F.getBytes(N)),le=511;for(v=ne.length()-1;v>=0;v--)le=le>>8,le+=ne.at(v)+ge.at(v),ge.setAt(v,le&255);de.putBuffer(ge)}F=de,d.putBuffer(X)}return d.truncate(d.length()-m),d},o.pbe.getCipher=function(x,c,g){switch(x){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(x,c,g);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.pbe.getCipherForPKCS12PBE(x,c,g);default:var C=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw C.oid=x,C.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],C}},o.pbe.getCipherForPBES2=function(x,c,g){var C={},m=[];if(!r.validate(c,f,C,m)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=m,i}if(x=r.derToOid(C.kdfOid),x!==o.oids.pkcs5PBKDF2){var i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw i.oid=x,i.supportedOids=["pkcs5PBKDF2"],i}if(x=r.derToOid(C.encOid),x!==o.oids["aes128-CBC"]&&x!==o.oids["aes192-CBC"]&&x!==o.oids["aes256-CBC"]&&x!==o.oids["des-EDE3-CBC"]&&x!==o.oids.desCBC){var i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw i.oid=x,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i}var h=C.kdfSalt,v=t.util.createBuffer(C.kdfIterationCount);v=v.getInt(v.length()<<3);var I,N;switch(o.oids[x]){case"aes128-CBC":I=16,N=t.aes.createDecryptionCipher;break;case"aes192-CBC":I=24,N=t.aes.createDecryptionCipher;break;case"aes256-CBC":I=32,N=t.aes.createDecryptionCipher;break;case"des-EDE3-CBC":I=24,N=t.des.createDecryptionCipher;break;case"desCBC":I=8,N=t.des.createDecryptionCipher;break}var d=l(C.prfOid),s=t.pkcs5.pbkdf2(g,h,v,I,d),n=C.encIv,B=N(s);return B.start(n),B},o.pbe.getCipherForPKCS12PBE=function(x,c,g){var C={},m=[];if(!r.validate(c,a,C,m)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=m,i}var h=t.util.createBuffer(C.salt),v=t.util.createBuffer(C.iterations);v=v.getInt(v.length()<<3);var I,N,d;switch(x){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:I=24,N=8,d=t.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:I=5,N=8,d=function(O,P){var M=t.rc2.createDecryptionCipher(O,40);return M.start(P,null),M};break;default:var i=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw i.oid=x,i}var s=l(C.prfOid),n=o.pbe.generatePkcs12Key(g,h,1,v,I,s);s.start();var B=o.pbe.generatePkcs12Key(g,h,2,v,N,s);return d(n,B)},o.pbe.opensslDeriveBytes=function(x,c,g,C){if(typeof C>"u"||C===null){if(!("md5"in t.md))throw new Error('"md5" hash algorithm unavailable.');C=t.md.md5.create()}c===null&&(c="");for(var m=[p(C,x+c)],i=16,h=1;i<g;++h,i+=16)m.push(p(C,m[h-1]+x+c));return m.join("").substr(0,g)};function p(x,c){return x.start().update(c).digest().getBytes()}function l(x){var c;if(!x)c="hmacWithSHA1";else if(c=o.oids[r.derToOid(x)],!c){var g=new Error("Unsupported PRF OID.");throw g.oid=x,g.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],g}return S(c)}function S(x){var c=t.md;switch(x){case"hmacWithSHA224":c=t.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":x=x.substr(8).toLowerCase();break;default:var g=new Error("Unsupported PRF algorithm.");throw g.algorithm=x,g.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],g}if(!c||!(x in c))throw new Error("Unknown hash algorithm: "+x);return c[x].create()}function R(x,c,g,C){var m=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,x),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,c.getBytes())]);return C!=="hmacWithSHA1"&&m.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,t.util.hexToBytes(g.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(o.oids[C]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),m}return kr}var Ur={exports:{}},Dr={exports:{}},Ha;function Ga(){if(Ha)return Dr.exports;Ha=1;var t=ue();nt(),ce();var e=t.asn1,r=Dr.exports=t.pkcs7asn1=t.pkcs7asn1||{};t.pkcs7=t.pkcs7||{},t.pkcs7.asn1=r;var o={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"}]};r.contentInfoValidator=o;var E={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"}]};r.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(E)},r.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(E)};var y={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 r.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"},o,{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:[y]}]},r.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"}]},Dr.exports}var Pr={exports:{}},Vr={exports:{}},za;function Qa(){if(za)return Vr.exports;za=1;var t=ue();ce(),t.mgf=t.mgf||{};var e=Vr.exports=t.mgf.mgf1=t.mgf1=t.mgf1||{};return e.create=function(r){var o={generate:function(E,y){for(var f=new t.util.ByteBuffer,a=Math.ceil(y/r.digestLength),p=0;p<a;p++){var l=new t.util.ByteBuffer;l.putInt32(p),r.start(),r.update(E+l.getBytes()),f.putBuffer(r.digest())}return f.truncate(f.length()-y),f.getBytes()}};return o},Vr.exports}var Or,Wa;function ci(){if(Wa)return Or;Wa=1;var t=ue();return Qa(),Or=t.mgf=t.mgf||{},t.mgf.mgf1=t.mgf1,Or}var Mr={exports:{}},Ya;function Kr(){if(Ya)return Mr.exports;Ya=1;var t=ue();Je(),ce();var e=Mr.exports=t.pss=t.pss||{};return e.create=function(r){arguments.length===3&&(r={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var o=r.md,E=r.mgf,y=o.digestLength,f=r.salt||null;typeof f=="string"&&(f=t.util.createBuffer(f));var a;if("saltLength"in r)a=r.saltLength;else if(f!==null)a=f.length();else throw new Error("Salt length not specified or specific salt not given.");if(f!==null&&f.length()!==a)throw new Error("Given salt length does not match length of given salt.");var p=r.prng||t.random,l={};return l.encode=function(S,R){var x,c=R-1,g=Math.ceil(c/8),C=S.digest().getBytes();if(g<y+a+2)throw new Error("Message is too long to encrypt.");var m;f===null?m=p.getBytesSync(a):m=f.bytes();var i=new t.util.ByteBuffer;i.fillWithByte(0,8),i.putBytes(C),i.putBytes(m),o.start(),o.update(i.getBytes());var h=o.digest().getBytes(),v=new t.util.ByteBuffer;v.fillWithByte(0,g-a-y-2),v.putByte(1),v.putBytes(m);var I=v.getBytes(),N=g-y-1,d=E.generate(h,N),s="";for(x=0;x<N;x++)s+=String.fromCharCode(I.charCodeAt(x)^d.charCodeAt(x));var n=65280>>8*g-c&255;return s=String.fromCharCode(s.charCodeAt(0)&~n)+s.substr(1),s+h+"¼"},l.verify=function(S,R,x){var c,g=x-1,C=Math.ceil(g/8);if(R=R.substr(-C),C<y+a+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(R.charCodeAt(C-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var m=C-y-1,i=R.substr(0,m),h=R.substr(m,y),v=65280>>8*C-g&255;if((i.charCodeAt(0)&v)!==0)throw new Error("Bits beyond keysize not zero as expected.");var I=E.generate(h,m),N="";for(c=0;c<m;c++)N+=String.fromCharCode(i.charCodeAt(c)^I.charCodeAt(c));N=String.fromCharCode(N.charCodeAt(0)&~v)+N.substr(1);var d=C-y-a-2;for(c=0;c<d;c++)if(N.charCodeAt(c)!==0)throw new Error("Leftmost octets not zero as expected");if(N.charCodeAt(d)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var s=N.substr(-a),n=new t.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(S),n.putBytes(s),o.start(),o.update(n.getBytes());var B=o.digest().getBytes();return h===B},l},Mr.exports}var Xa;function Fr(){if(Xa)return Pr.exports;Xa=1;var t=ue();gt(),nt(),Ft(),st(),ci(),vt(),Ct(),Kr(),zt(),ce();var e=t.asn1,r=Pr.exports=t.pki=t.pki||{},o=r.oids,E={};E.CN=o.commonName,E.commonName="CN",E.C=o.countryName,E.countryName="C",E.L=o.localityName,E.localityName="L",E.ST=o.stateOrProvinceName,E.stateOrProvinceName="ST",E.O=o.organizationName,E.organizationName="O",E.OU=o.organizationalUnitName,E.organizationalUnitName="OU",E.E=o.emailAddress,E.emailAddress="E";var y=t.pki.rsa.publicKeyValidator,f={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"},y,{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"}]},a={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"}]}]},p={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"},y,{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:[p,{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"}]};r.RDNAttributesAsArray=function(d,s){for(var n=[],B,U,O,P=0;P<d.value.length;++P){B=d.value[P];for(var M=0;M<B.value.length;++M)O={},U=B.value[M],O.type=e.derToOid(U.value[0].value),O.value=U.value[1].value,O.valueTagClass=U.value[1].type,O.type in o&&(O.name=o[O.type],O.name in E&&(O.shortName=E[O.name])),s&&(s.update(O.type),s.update(O.value)),n.push(O)}return n},r.CRIAttributesAsArray=function(d){for(var s=[],n=0;n<d.length;++n)for(var B=d[n],U=e.derToOid(B.value[0].value),O=B.value[1].value,P=0;P<O.length;++P){var M={};if(M.type=U,M.value=O[P].value,M.valueTagClass=O[P].type,M.type in o&&(M.name=o[M.type],M.name in E&&(M.shortName=E[M.name])),M.type===o.extensionRequest){M.extensions=[];for(var q=0;q<M.value.length;++q)M.extensions.push(r.certificateExtensionFromAsn1(M.value[q]))}s.push(M)}return s};function S(d,s){typeof s=="string"&&(s={shortName:s});for(var n=null,B,U=0;n===null&&U<d.attributes.length;++U)B=d.attributes[U],(s.type&&s.type===B.type||s.name&&s.name===B.name||s.shortName&&s.shortName===B.shortName)&&(n=B);return n}var R=function(d,s,n){var B={};if(d!==o["RSASSA-PSS"])return B;n&&(B={hash:{algorithmOid:o.sha1},mgf:{algorithmOid:o.mgf1,hash:{algorithmOid:o.sha1}},saltLength:20});var U={},O=[];if(!e.validate(s,a,U,O)){var P=new Error("Cannot read RSASSA-PSS parameter block.");throw P.errors=O,P}return U.hashOid!==void 0&&(B.hash=B.hash||{},B.hash.algorithmOid=e.derToOid(U.hashOid)),U.maskGenOid!==void 0&&(B.mgf=B.mgf||{},B.mgf.algorithmOid=e.derToOid(U.maskGenOid),B.mgf.hash=B.mgf.hash||{},B.mgf.hash.algorithmOid=e.derToOid(U.maskGenHashOid)),U.saltLength!==void 0&&(B.saltLength=U.saltLength.charCodeAt(0)),B},x=function(d){switch(o[d.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return t.md.sha1.create();case"md5WithRSAEncryption":return t.md.md5.create();case"sha256WithRSAEncryption":return t.md.sha256.create();case"sha384WithRSAEncryption":return t.md.sha384.create();case"sha512WithRSAEncryption":return t.md.sha512.create();case"RSASSA-PSS":return t.md.sha256.create();default:var s=new Error("Could not compute "+d.type+" digest. Unknown signature OID.");throw s.signatureOid=d.signatureOid,s}},c=function(d){var s=d.certificate,n;switch(s.signatureOid){case o.sha1WithRSAEncryption:case o.sha1WithRSASignature:break;case o["RSASSA-PSS"]:var B,U;if(B=o[s.signatureParameters.mgf.hash.algorithmOid],B===void 0||t.md[B]===void 0){var O=new Error("Unsupported MGF hash function.");throw O.oid=s.signatureParameters.mgf.hash.algorithmOid,O.name=B,O}if(U=o[s.signatureParameters.mgf.algorithmOid],U===void 0||t.mgf[U]===void 0){var O=new Error("Unsupported MGF function.");throw O.oid=s.signatureParameters.mgf.algorithmOid,O.name=U,O}if(U=t.mgf[U].create(t.md[B].create()),B=o[s.signatureParameters.hash.algorithmOid],B===void 0||t.md[B]===void 0){var O=new Error("Unsupported RSASSA-PSS hash function.");throw O.oid=s.signatureParameters.hash.algorithmOid,O.name=B,O}n=t.pss.create(t.md[B].create(),U,s.signatureParameters.saltLength);break}return s.publicKey.verify(d.md.digest().getBytes(),d.signature,n)};r.certificateFromPem=function(d,s,n){var B=t.pem.decode(d)[0];if(B.type!=="CERTIFICATE"&&B.type!=="X509 CERTIFICATE"&&B.type!=="TRUSTED CERTIFICATE"){var U=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw U.headerType=B.type,U}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var O=e.fromDer(B.body,n);return r.certificateFromAsn1(O,s)},r.certificateToPem=function(d,s){var n={type:"CERTIFICATE",body:e.toDer(r.certificateToAsn1(d)).getBytes()};return t.pem.encode(n,{maxline:s})},r.publicKeyFromPem=function(d){var s=t.pem.decode(d)[0];if(s.type!=="PUBLIC KEY"&&s.type!=="RSA PUBLIC KEY"){var n=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw n.headerType=s.type,n}if(s.procType&&s.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var B=e.fromDer(s.body);return r.publicKeyFromAsn1(B)},r.publicKeyToPem=function(d,s){var n={type:"PUBLIC KEY",body:e.toDer(r.publicKeyToAsn1(d)).getBytes()};return t.pem.encode(n,{maxline:s})},r.publicKeyToRSAPublicKeyPem=function(d,s){var n={type:"RSA PUBLIC KEY",body:e.toDer(r.publicKeyToRSAPublicKey(d)).getBytes()};return t.pem.encode(n,{maxline:s})},r.getPublicKeyFingerprint=function(d,s){s=s||{};var n=s.md||t.md.sha1.create(),B=s.type||"RSAPublicKey",U;switch(B){case"RSAPublicKey":U=e.toDer(r.publicKeyToRSAPublicKey(d)).getBytes();break;case"SubjectPublicKeyInfo":U=e.toDer(r.publicKeyToAsn1(d)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+s.type+'".')}n.start(),n.update(U);var O=n.digest();if(s.encoding==="hex"){var P=O.toHex();return s.delimiter?P.match(/.{2}/g).join(s.delimiter):P}else{if(s.encoding==="binary")return O.getBytes();if(s.encoding)throw new Error('Unknown encoding "'+s.encoding+'".')}return O},r.certificationRequestFromPem=function(d,s,n){var B=t.pem.decode(d)[0];if(B.type!=="CERTIFICATE REQUEST"){var U=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw U.headerType=B.type,U}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var O=e.fromDer(B.body,n);return r.certificationRequestFromAsn1(O,s)},r.certificationRequestToPem=function(d,s){var n={type:"CERTIFICATE REQUEST",body:e.toDer(r.certificationRequestToAsn1(d)).getBytes()};return t.pem.encode(n,{maxline:s})},r.createCertificate=function(){var d={};return d.version=2,d.serialNumber="00",d.signatureOid=null,d.signature=null,d.siginfo={},d.siginfo.algorithmOid=null,d.validity={},d.validity.notBefore=new Date,d.validity.notAfter=new Date,d.issuer={},d.issuer.getField=function(s){return S(d.issuer,s)},d.issuer.addField=function(s){C([s]),d.issuer.attributes.push(s)},d.issuer.attributes=[],d.issuer.hash=null,d.subject={},d.subject.getField=function(s){return S(d.subject,s)},d.subject.addField=function(s){C([s]),d.subject.attributes.push(s)},d.subject.attributes=[],d.subject.hash=null,d.extensions=[],d.publicKey=null,d.md=null,d.setSubject=function(s,n){C(s),d.subject.attributes=s,delete d.subject.uniqueId,n&&(d.subject.uniqueId=n),d.subject.hash=null},d.setIssuer=function(s,n){C(s),d.issuer.attributes=s,delete d.issuer.uniqueId,n&&(d.issuer.uniqueId=n),d.issuer.hash=null},d.setExtensions=function(s){for(var n=0;n<s.length;++n)m(s[n],{cert:d});d.extensions=s},d.getExtension=function(s){typeof s=="string"&&(s={name:s});for(var n=null,B,U=0;n===null&&U<d.extensions.length;++U)B=d.extensions[U],(s.id&&B.id===s.id||s.name&&B.name===s.name)&&(n=B);return n},d.sign=function(s,n){d.md=n||t.md.sha1.create();var B=o[d.md.algorithm+"WithRSAEncryption"];if(!B){var U=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw U.algorithm=d.md.algorithm,U}d.signatureOid=d.siginfo.algorithmOid=B,d.tbsCertificate=r.getTBSCertificate(d);var O=e.toDer(d.tbsCertificate);d.md.update(O.getBytes()),d.signature=s.sign(d.md)},d.verify=function(s){var n=!1;if(!d.issued(s)){var B=s.issuer,U=d.subject,O=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 O.expectedIssuer=U.attributes,O.actualIssuer=B.attributes,O}var P=s.md;if(P===null){P=x({signatureOid:s.signatureOid,type:"certificate"});var M=s.tbsCertificate||r.getTBSCertificate(s),q=e.toDer(M);P.update(q.getBytes())}return P!==null&&(n=c({certificate:d,md:P,signature:s.signature})),n},d.isIssuer=function(s){var n=!1,B=d.issuer,U=s.subject;if(B.hash&&U.hash)n=B.hash===U.hash;else if(B.attributes.length===U.attributes.length){n=!0;for(var O,P,M=0;n&&M<B.attributes.length;++M)O=B.attributes[M],P=U.attributes[M],(O.type!==P.type||O.value!==P.value)&&(n=!1)}return n},d.issued=function(s){return s.isIssuer(d)},d.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(d.publicKey,{type:"RSAPublicKey"})},d.verifySubjectKeyIdentifier=function(){for(var s=o.subjectKeyIdentifier,n=0;n<d.extensions.length;++n){var B=d.extensions[n];if(B.id===s){var U=d.generateSubjectKeyIdentifier().getBytes();return t.util.hexToBytes(B.subjectKeyIdentifier)===U}}return!1},d},r.certificateFromAsn1=function(d,s){var n={},B=[];if(!e.validate(d,f,n,B)){var U=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw U.errors=B,U}var O=e.derToOid(n.publicKeyOid);if(O!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=r.createCertificate();P.version=n.certVersion?n.certVersion.charCodeAt(0):0;var M=t.util.createBuffer(n.certSerialNumber);P.serialNumber=M.toHex(),P.signatureOid=t.asn1.derToOid(n.certSignatureOid),P.signatureParameters=R(P.signatureOid,n.certSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.certinfoSignatureOid),P.siginfo.parameters=R(P.siginfo.algorithmOid,n.certinfoSignatureParams,!1),P.signature=n.certSignature;var q=[];if(n.certValidity1UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity1UTCTime)),n.certValidity2GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity2GeneralizedTime)),n.certValidity3UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity3UTCTime)),n.certValidity4GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity4GeneralizedTime)),q.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(q.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(P.validity.notBefore=q[0],P.validity.notAfter=q[1],P.tbsCertificate=n.tbsCertificate,s){P.md=x({signatureOid:P.signatureOid,type:"certificate"});var F=e.toDer(P.tbsCertificate);P.md.update(F.getBytes())}var G=t.md.sha1.create(),W=e.toDer(n.certIssuer);G.update(W.getBytes()),P.issuer.getField=function(ne){return S(P.issuer,ne)},P.issuer.addField=function(ne){C([ne]),P.issuer.attributes.push(ne)},P.issuer.attributes=r.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId&&(P.issuer.uniqueId=n.certIssuerUniqueId),P.issuer.hash=G.digest().toHex();var X=t.md.sha1.create(),ee=e.toDer(n.certSubject);return X.update(ee.getBytes()),P.subject.getField=function(ne){return S(P.subject,ne)},P.subject.addField=function(ne){C([ne]),P.subject.attributes.push(ne)},P.subject.attributes=r.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId&&(P.subject.uniqueId=n.certSubjectUniqueId),P.subject.hash=X.digest().toHex(),n.certExtensions?P.extensions=r.certificateExtensionsFromAsn1(n.certExtensions):P.extensions=[],P.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),P},r.certificateExtensionsFromAsn1=function(d){for(var s=[],n=0;n<d.value.length;++n)for(var B=d.value[n],U=0;U<B.value.length;++U)s.push(r.certificateExtensionFromAsn1(B.value[U]));return s},r.certificateExtensionFromAsn1=function(d){var s={};if(s.id=e.derToOid(d.value[0].value),s.critical=!1,d.value[1].type===e.Type.BOOLEAN?(s.critical=d.value[1].value.charCodeAt(0)!==0,s.value=d.value[2].value):s.value=d.value[1].value,s.id in o){if(s.name=o[s.id],s.name==="keyUsage"){var n=e.fromDer(s.value),B=0,U=0;n.value.length>1&&(B=n.value.charCodeAt(1),U=n.value.length>2?n.value.charCodeAt(2):0),s.digitalSignature=(B&128)===128,s.nonRepudiation=(B&64)===64,s.keyEncipherment=(B&32)===32,s.dataEncipherment=(B&16)===16,s.keyAgreement=(B&8)===8,s.keyCertSign=(B&4)===4,s.cRLSign=(B&2)===2,s.encipherOnly=(B&1)===1,s.decipherOnly=(U&128)===128}else if(s.name==="basicConstraints"){var n=e.fromDer(s.value);n.value.length>0&&n.value[0].type===e.Type.BOOLEAN?s.cA=n.value[0].value.charCodeAt(0)!==0:s.cA=!1;var O=null;n.value.length>0&&n.value[0].type===e.Type.INTEGER?O=n.value[0].value:n.value.length>1&&(O=n.value[1].value),O!==null&&(s.pathLenConstraint=e.derToInteger(O))}else if(s.name==="extKeyUsage")for(var n=e.fromDer(s.value),P=0;P<n.value.length;++P){var M=e.derToOid(n.value[P].value);M in o?s[o[M]]=!0:s[M]=!0}else if(s.name==="nsCertType"){var n=e.fromDer(s.value),B=0;n.value.length>1&&(B=n.value.charCodeAt(1)),s.client=(B&128)===128,s.server=(B&64)===64,s.email=(B&32)===32,s.objsign=(B&16)===16,s.reserved=(B&8)===8,s.sslCA=(B&4)===4,s.emailCA=(B&2)===2,s.objCA=(B&1)===1}else if(s.name==="subjectAltName"||s.name==="issuerAltName"){s.altNames=[];for(var q,n=e.fromDer(s.value),F=0;F<n.value.length;++F){q=n.value[F];var G={type:q.type,value:q.value};switch(s.altNames.push(G),q.type){case 1:case 2:case 6:break;case 7:G.ip=t.util.bytesToIP(q.value);break;case 8:G.oid=e.derToOid(q.value);break}}}else if(s.name==="subjectKeyIdentifier"){var n=e.fromDer(s.value);s.subjectKeyIdentifier=t.util.bytesToHex(n.value)}}return s},r.certificationRequestFromAsn1=function(d,s){var n={},B=[];if(!e.validate(d,l,n,B)){var U=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw U.errors=B,U}var O=e.derToOid(n.publicKeyOid);if(O!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=r.createCertificationRequest();if(P.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,P.signatureOid=t.asn1.derToOid(n.csrSignatureOid),P.signatureParameters=R(P.signatureOid,n.csrSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.csrSignatureOid),P.siginfo.parameters=R(P.siginfo.algorithmOid,n.csrSignatureParams,!1),P.signature=n.csrSignature,P.certificationRequestInfo=n.certificationRequestInfo,s){P.md=x({signatureOid:P.signatureOid,type:"certification request"});var M=e.toDer(P.certificationRequestInfo);P.md.update(M.getBytes())}var q=t.md.sha1.create();return P.subject.getField=function(F){return S(P.subject,F)},P.subject.addField=function(F){C([F]),P.subject.attributes.push(F)},P.subject.attributes=r.RDNAttributesAsArray(n.certificationRequestInfoSubject,q),P.subject.hash=q.digest().toHex(),P.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),P.getAttribute=function(F){return S(P,F)},P.addAttribute=function(F){C([F]),P.attributes.push(F)},P.attributes=r.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),P},r.createCertificationRequest=function(){var d={};return d.version=0,d.signatureOid=null,d.signature=null,d.siginfo={},d.siginfo.algorithmOid=null,d.subject={},d.subject.getField=function(s){return S(d.subject,s)},d.subject.addField=function(s){C([s]),d.subject.attributes.push(s)},d.subject.attributes=[],d.subject.hash=null,d.publicKey=null,d.attributes=[],d.getAttribute=function(s){return S(d,s)},d.addAttribute=function(s){C([s]),d.attributes.push(s)},d.md=null,d.setSubject=function(s){C(s),d.subject.attributes=s,d.subject.hash=null},d.setAttributes=function(s){C(s),d.attributes=s},d.sign=function(s,n){d.md=n||t.md.sha1.create();var B=o[d.md.algorithm+"WithRSAEncryption"];if(!B){var U=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw U.algorithm=d.md.algorithm,U}d.signatureOid=d.siginfo.algorithmOid=B,d.certificationRequestInfo=r.getCertificationRequestInfo(d);var O=e.toDer(d.certificationRequestInfo);d.md.update(O.getBytes()),d.signature=s.sign(d.md)},d.verify=function(){var s=!1,n=d.md;if(n===null){n=x({signatureOid:d.signatureOid,type:"certification request"});var B=d.certificationRequestInfo||r.getCertificationRequestInfo(d),U=e.toDer(B);n.update(U.getBytes())}return n!==null&&(s=c({certificate:d,md:n,signature:d.signature})),s},d};function g(d){for(var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),n,B,U=d.attributes,O=0;O<U.length;++O){n=U[O];var P=n.value,M=e.Type.PRINTABLESTRING;"valueTagClass"in n&&(M=n.valueTagClass,M===e.Type.UTF8&&(P=t.util.encodeUtf8(P))),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(n.type).getBytes()),e.create(e.Class.UNIVERSAL,M,!1,P)])]),s.value.push(B)}return s}function C(d){for(var s,n=0;n<d.length;++n){if(s=d[n],typeof s.name>"u"&&(s.type&&s.type in r.oids?s.name=r.oids[s.type]:s.shortName&&s.shortName in E&&(s.name=r.oids[E[s.shortName]])),typeof s.type>"u")if(s.name&&s.name in r.oids)s.type=r.oids[s.name];else{var B=new Error("Attribute type not specified.");throw B.attribute=s,B}if(typeof s.shortName>"u"&&s.name&&s.name in E&&(s.shortName=E[s.name]),s.type===o.extensionRequest&&(s.valueConstructed=!0,s.valueTagClass=e.Type.SEQUENCE,!s.value&&s.extensions)){s.value=[];for(var U=0;U<s.extensions.length;++U)s.value.push(r.certificateExtensionToAsn1(m(s.extensions[U])))}if(typeof s.value>"u"){var B=new Error("Attribute value not specified.");throw B.attribute=s,B}}}function m(d,s){if(s=s||{},typeof d.name>"u"&&d.id&&d.id in r.oids&&(d.name=r.oids[d.id]),typeof d.id>"u")if(d.name&&d.name in r.oids)d.id=r.oids[d.name];else{var n=new Error("Extension ID not specified.");throw n.extension=d,n}if(typeof d.value<"u")return d;if(d.name==="keyUsage"){var B=0,U=0,O=0;d.digitalSignature&&(U|=128,B=7),d.nonRepudiation&&(U|=64,B=6),d.keyEncipherment&&(U|=32,B=5),d.dataEncipherment&&(U|=16,B=4),d.keyAgreement&&(U|=8,B=3),d.keyCertSign&&(U|=4,B=2),d.cRLSign&&(U|=2,B=1),d.encipherOnly&&(U|=1,B=0),d.decipherOnly&&(O|=128,B=7);var P=String.fromCharCode(B);O!==0?P+=String.fromCharCode(U)+String.fromCharCode(O):U!==0&&(P+=String.fromCharCode(U)),d.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(d.name==="basicConstraints")d.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),d.cA&&d.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in d&&d.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(d.pathLenConstraint).getBytes()));else if(d.name==="extKeyUsage"){d.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var M=d.value.value;for(var q in d)d[q]===!0&&(q in o?M.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(o[q]).getBytes())):q.indexOf(".")!==-1&&M.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q).getBytes())))}else if(d.name==="nsCertType"){var B=0,U=0;d.client&&(U|=128,B=7),d.server&&(U|=64,B=6),d.email&&(U|=32,B=5),d.objsign&&(U|=16,B=4),d.reserved&&(U|=8,B=3),d.sslCA&&(U|=4,B=2),d.emailCA&&(U|=2,B=1),d.objCA&&(U|=1,B=0);var P=String.fromCharCode(B);U!==0&&(P+=String.fromCharCode(U)),d.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(d.name==="subjectAltName"||d.name==="issuerAltName"){d.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var F,G=0;G<d.altNames.length;++G){F=d.altNames[G];var P=F.value;if(F.type===7&&F.ip){if(P=t.util.bytesFromIP(F.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=d,n}}else F.type===8&&(F.oid?P=e.oidToDer(e.oidToDer(F.oid)):P=e.oidToDer(P));d.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,F.type,!1,P))}}else if(d.name==="nsComment"&&s.cert){if(!/^[\x00-\x7F]*$/.test(d.comment)||d.comment.length<1||d.comment.length>128)throw new Error('Invalid "nsComment" content.');d.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,d.comment)}else if(d.name==="subjectKeyIdentifier"&&s.cert){var W=s.cert.generateSubjectKeyIdentifier();d.subjectKeyIdentifier=W.toHex(),d.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,W.getBytes())}else if(d.name==="authorityKeyIdentifier"&&s.cert){d.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var M=d.value.value;if(d.keyIdentifier){var X=d.keyIdentifier===!0?s.cert.generateSubjectKeyIdentifier().getBytes():d.keyIdentifier;M.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,X))}if(d.authorityCertIssuer){var ee=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[g(d.authorityCertIssuer===!0?s.cert.issuer:d.authorityCertIssuer)])];M.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,ee))}if(d.serialNumber){var ne=t.util.hexToBytes(d.serialNumber===!0?s.cert.serialNumber:d.serialNumber);M.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ne))}}else if(d.name==="cRLDistributionPoints"){d.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var M=d.value.value,ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),de=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),F,G=0;G<d.altNames.length;++G){F=d.altNames[G];var P=F.value;if(F.type===7&&F.ip){if(P=t.util.bytesFromIP(F.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=d,n}}else F.type===8&&(F.oid?P=e.oidToDer(e.oidToDer(F.oid)):P=e.oidToDer(P));de.value.push(e.create(e.Class.CONTEXT_SPECIFIC,F.type,!1,P))}ie.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[de])),M.push(ie)}if(typeof d.value>"u"){var n=new Error("Extension value not specified.");throw n.extension=d,n}return d}function i(d,s){switch(d){case o["RSASSA-PSS"]:var n=[];return s.hash.algorithmOid!==void 0&&n.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(s.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),s.mgf.algorithmOid!==void 0&&n.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(s.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(s.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),s.saltLength!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(s.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function h(d){var s=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(d.attributes.length===0)return s;for(var n=d.attributes,B=0;B<n.length;++B){var U=n[B],O=U.value,P=e.Type.UTF8;"valueTagClass"in U&&(P=U.valueTagClass),P===e.Type.UTF8&&(O=t.util.encodeUtf8(O));var M=!1;"valueConstructed"in U&&(M=U.valueConstructed);var q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(U.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,P,M,O)])]);s.value.push(q)}return s}var v=new Date("1950-01-01T00:00:00Z"),I=new Date("2050-01-01T00:00:00Z");function N(d){return d>=v&&d<I?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(d)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(d))}return r.getTBSCertificate=function(d){var s=N(d.validity.notBefore),n=N(d.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(d.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(d.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.siginfo.algorithmOid).getBytes()),i(d.siginfo.algorithmOid,d.siginfo.parameters)]),g(d.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,n]),g(d.subject),r.publicKeyToAsn1(d.publicKey)]);return d.issuer.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+d.issuer.uniqueId)])),d.subject.uniqueId&&B.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+d.subject.uniqueId)])),d.extensions.length>0&&B.value.push(r.certificateExtensionsToAsn1(d.extensions)),B},r.getCertificationRequestInfo=function(d){var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(d.version).getBytes()),g(d.subject),r.publicKeyToAsn1(d.publicKey),h(d)]);return s},r.distinguishedNameToAsn1=function(d){return g(d)},r.certificateToAsn1=function(d){var s=d.tbsCertificate||r.getTBSCertificate(d);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.signatureOid).getBytes()),i(d.signatureOid,d.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+d.signature)])},r.certificateExtensionsToAsn1=function(d){var s=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);s.value.push(n);for(var B=0;B<d.length;++B)n.value.push(r.certificateExtensionToAsn1(d[B]));return s},r.certificateExtensionToAsn1=function(d){var s=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);s.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.id).getBytes())),d.critical&&s.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var n=d.value;return typeof d.value!="string"&&(n=e.toDer(n).getBytes()),s.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)),s},r.certificationRequestToAsn1=function(d){var s=d.certificationRequestInfo||r.getCertificationRequestInfo(d);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[s,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d.signatureOid).getBytes()),i(d.signatureOid,d.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+d.signature)])},r.createCaStore=function(d){var s={certs:{}};s.getIssuer=function(P){var M=n(P.issuer);return M},s.addCertificate=function(P){if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),B(P.subject),!s.hasCertificate(P))if(P.subject.hash in s.certs){var M=s.certs[P.subject.hash];t.util.isArray(M)||(M=[M]),M.push(P),s.certs[P.subject.hash]=M}else s.certs[P.subject.hash]=P},s.hasCertificate=function(P){typeof P=="string"&&(P=t.pki.certificateFromPem(P));var M=n(P.subject);if(!M)return!1;t.util.isArray(M)||(M=[M]);for(var q=e.toDer(r.certificateToAsn1(P)).getBytes(),F=0;F<M.length;++F){var G=e.toDer(r.certificateToAsn1(M[F])).getBytes();if(q===G)return!0}return!1},s.listAllCertificates=function(){var P=[];for(var M in s.certs)if(s.certs.hasOwnProperty(M)){var q=s.certs[M];if(!t.util.isArray(q))P.push(q);else for(var F=0;F<q.length;++F)P.push(q[F])}return P},s.removeCertificate=function(P){var M;if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),B(P.subject),!s.hasCertificate(P))return null;var q=n(P.subject);if(!t.util.isArray(q))return M=s.certs[P.subject.hash],delete s.certs[P.subject.hash],M;for(var F=e.toDer(r.certificateToAsn1(P)).getBytes(),G=0;G<q.length;++G){var W=e.toDer(r.certificateToAsn1(q[G])).getBytes();F===W&&(M=q[G],q.splice(G,1))}return q.length===0&&delete s.certs[P.subject.hash],M};function n(P){return B(P),s.certs[P.hash]||null}function B(P){if(!P.hash){var M=t.md.sha1.create();P.attributes=r.RDNAttributesAsArray(g(P),M),P.hash=M.digest().toHex()}}if(d)for(var U=0;U<d.length;++U){var O=d[U];s.addCertificate(O)}return s},r.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"},r.verifyCertificateChain=function(d,s,n){typeof n=="function"&&(n={verify:n}),n=n||{},s=s.slice(0);var B=s.slice(0),U=n.validityCheckDate;typeof U>"u"&&(U=new Date);var O=!0,P=null,M=0;do{var q=s.shift(),F=null,G=!1;if(U&&(U<q.validity.notBefore||U>q.validity.notAfter)&&(P={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:U}),P===null){if(F=s[0]||d.getIssuer(q),F===null&&q.isIssuer(q)&&(G=!0,F=q),F){var W=F;t.util.isArray(W)||(W=[W]);for(var X=!1;!X&&W.length>0;){F=W.shift();try{X=F.verify(q)}catch{}}X||(P={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}P===null&&(!F||G)&&!d.hasCertificate(q)&&(P={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(P===null&&F&&!q.isIssuer(F)&&(P={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),P===null)for(var ee={keyUsage:!0,basicConstraints:!0},ne=0;P===null&&ne<q.extensions.length;++ne){var ie=q.extensions[ne];ie.critical&&!(ie.name in ee)&&(P={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(P===null&&(!O||s.length===0&&(!F||G))){var de=q.getExtension("basicConstraints"),ge=q.getExtension("keyUsage");if(ge!==null&&(!ge.keyCertSign||de===null)&&(P={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:r.certificateError.bad_certificate}),P===null&&de===null&&(P={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:r.certificateError.bad_certificate}),P===null&&de!==null&&!de.cA&&(P={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),P===null&&ge!==null&&"pathLenConstraint"in de){var le=M-1;le>de.pathLenConstraint&&(P={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}}var j=P===null?!0:P.error,$=n.verify?n.verify(j,M,B):j;if($===!0)P=null;else throw j===!0&&(P={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),($||$===0)&&(typeof $=="object"&&!t.util.isArray($)?($.message&&(P.message=$.message),$.error&&(P.error=$.error)):typeof $=="string"&&(P.error=$)),P;O=!1,++M}while(s.length>0);return!0},Pr.exports}var ja;function $a(){if(ja)return Ur.exports;ja=1;var t=ue();nt(),Rt(),vt(),Ga(),qa(),Je(),zt(),Nt(),ce(),Fr();var e=t.asn1,r=t.pki,o=Ur.exports=t.pkcs12=t.pkcs12||{},E={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"}]},y={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"},E,{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"}]}]},f={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"}]},a={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"}]},p={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(C,m,i,h){for(var v=[],I=0;I<C.length;I++)for(var N=0;N<C[I].safeBags.length;N++){var d=C[I].safeBags[N];if(!(h!==void 0&&d.type!==h)){if(m===null){v.push(d);continue}d.attributes[m]!==void 0&&d.attributes[m].indexOf(i)>=0&&v.push(d)}}return v}o.pkcs12FromAsn1=function(C,m,i){typeof m=="string"?(i=m,m=!0):m===void 0&&(m=!0);var h={},v=[];if(!e.validate(C,y,h,v)){var I=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw I.errors=I,I}var N={version:h.version.charCodeAt(0),safeContents:[],getBags:function(F){var G={},W;return"localKeyId"in F?W=F.localKeyId:"localKeyIdHex"in F&&(W=t.util.hexToBytes(F.localKeyIdHex)),W===void 0&&!("friendlyName"in F)&&"bagType"in F&&(G[F.bagType]=l(N.safeContents,null,null,F.bagType)),W!==void 0&&(G.localKeyId=l(N.safeContents,"localKeyId",W,F.bagType)),"friendlyName"in F&&(G.friendlyName=l(N.safeContents,"friendlyName",F.friendlyName,F.bagType)),G},getBagsByFriendlyName:function(F,G){return l(N.safeContents,"friendlyName",F,G)},getBagsByLocalKeyId:function(F,G){return l(N.safeContents,"localKeyId",F,G)}};if(h.version.charCodeAt(0)!==3){var I=new Error("PKCS#12 PFX of version other than 3 not supported.");throw I.version=h.version.charCodeAt(0),I}if(e.derToOid(h.contentType)!==r.oids.data){var I=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw I.oid=e.derToOid(h.contentType),I}var d=h.content.value[0];if(d.tagClass!==e.Class.UNIVERSAL||d.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(d=S(d),h.mac){var s=null,n=0,B=e.derToOid(h.macAlgorithm);switch(B){case r.oids.sha1:s=t.md.sha1.create(),n=20;break;case r.oids.sha256:s=t.md.sha256.create(),n=32;break;case r.oids.sha384:s=t.md.sha384.create(),n=48;break;case r.oids.sha512:s=t.md.sha512.create(),n=64;break;case r.oids.md5:s=t.md.md5.create(),n=16;break}if(s===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+B);var U=new t.util.ByteBuffer(h.macSalt),O="macIterations"in h?parseInt(t.util.bytesToHex(h.macIterations),16):1,P=o.generateKey(i,U,3,O,n,s),M=t.hmac.create();M.start(s,P),M.update(d.value);var q=M.getMac();if(q.getBytes()!==h.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(C.value)&&C.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return R(N,d.value,m,i),N};function S(C){if(C.composed||C.constructed){for(var m=t.util.createBuffer(),i=0;i<C.value.length;++i)m.putBytes(C.value[i].value);C.composed=C.constructed=!1,C.value=m.getBytes()}return C}function R(C,m,i,h){if(m=e.fromDer(m,i),m.tagClass!==e.Class.UNIVERSAL||m.type!==e.Type.SEQUENCE||m.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var v=0;v<m.value.length;v++){var I=m.value[v],N={},d=[];if(!e.validate(I,E,N,d)){var s=new Error("Cannot read ContentInfo.");throw s.errors=d,s}var n={encrypted:!1},B=null,U=N.content.value[0];switch(e.derToOid(N.contentType)){case r.oids.data:if(U.tagClass!==e.Class.UNIVERSAL||U.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");B=S(U).value;break;case r.oids.encryptedData:B=x(U,h),n.encrypted=!0;break;default:var s=new Error("Unsupported PKCS#12 contentType.");throw s.contentType=e.derToOid(N.contentType),s}n.safeBags=c(B,i,h),C.safeContents.push(n)}}function x(C,m){var i={},h=[];if(!e.validate(C,t.pkcs7.asn1.encryptedDataValidator,i,h)){var v=new Error("Cannot read EncryptedContentInfo.");throw v.errors=h,v}var I=e.derToOid(i.contentType);if(I!==r.oids.data){var v=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw v.oid=I,v}I=e.derToOid(i.encAlgorithm);var N=r.pbe.getCipher(I,i.encParameter,m),d=S(i.encryptedContentAsn1),s=t.util.createBuffer(d.value);if(N.update(s),!N.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return N.output.getBytes()}function c(C,m,i){if(!m&&C.length===0)return[];if(C=e.fromDer(C,m),C.tagClass!==e.Class.UNIVERSAL||C.type!==e.Type.SEQUENCE||C.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var h=[],v=0;v<C.value.length;v++){var I=C.value[v],N={},d=[];if(!e.validate(I,f,N,d)){var s=new Error("Cannot read SafeBag.");throw s.errors=d,s}var n={type:e.derToOid(N.bagId),attributes:g(N.bagAttributes)};h.push(n);var B,U,O=N.bagValue.value[0];switch(n.type){case r.oids.pkcs8ShroudedKeyBag:if(O=r.decryptPrivateKeyInfo(O,i),O===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{n.key=r.privateKeyFromAsn1(O)}catch{n.key=null,n.asn1=O}continue;case r.oids.certBag:B=p,U=function(){if(e.derToOid(N.certId)!==r.oids.x509Certificate){var M=new Error("Unsupported certificate type, only X.509 supported.");throw M.oid=e.derToOid(N.certId),M}var q=e.fromDer(N.cert,m);try{n.cert=r.certificateFromAsn1(q,!0)}catch{n.cert=null,n.asn1=q}};break;default:var s=new Error("Unsupported PKCS#12 SafeBag type.");throw s.oid=n.type,s}if(B!==void 0&&!e.validate(O,B,N,d)){var s=new Error("Cannot read PKCS#12 "+B.name);throw s.errors=d,s}U()}return h}function g(C){var m={};if(C!==void 0)for(var i=0;i<C.length;++i){var h={},v=[];if(!e.validate(C[i],a,h,v)){var I=new Error("Cannot read PKCS#12 BagAttribute.");throw I.errors=v,I}var N=e.derToOid(h.oid);if(r.oids[N]!==void 0){m[r.oids[N]]=[];for(var d=0;d<h.values.length;++d)m[r.oids[N]].push(h.values[d].value)}}return m}return o.toPkcs12Asn1=function(C,m,i,h){h=h||{},h.saltSize=h.saltSize||8,h.count=h.count||2048,h.algorithm=h.algorithm||h.encAlgorithm||"aes128","useMac"in h||(h.useMac=!0),"localKeyId"in h||(h.localKeyId=null),"generateLocalKeyId"in h||(h.generateLocalKeyId=!0);var v=h.localKeyId,I;if(v!==null)v=t.util.hexToBytes(v);else if(h.generateLocalKeyId)if(m){var N=t.util.isArray(m)?m[0]:m;typeof N=="string"&&(N=r.certificateFromPem(N));var d=t.md.sha1.create();d.update(e.toDer(r.certificateToAsn1(N)).getBytes()),v=d.digest().getBytes()}else v=t.random.getBytes(20);var s=[];v!==null&&s.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,v)])])),"friendlyName"in h&&s.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,h.friendlyName)])])),s.length>0&&(I=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,s));var n=[],B=[];m!==null&&(t.util.isArray(m)?B=m:B=[m]);for(var U=[],O=0;O<B.length;++O){m=B[O],typeof m=="string"&&(m=r.certificateFromPem(m));var P=O===0?I:void 0,M=r.certificateToAsn1(m),q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.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(r.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(M).getBytes())])])]),P]);U.push(q)}if(U.length>0){var F=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,U),G=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(F).getBytes())])]);n.push(G)}var W=null;if(C!==null){var X=r.wrapRsaPrivateKey(r.privateKeyToAsn1(C));i===null?W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[X]),I]):W=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(X,i,h)]),I]);var ee=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[W]),ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ee).getBytes())])]);n.push(ne)}var ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n),de;if(h.useMac){var d=t.md.sha1.create(),ge=new t.util.ByteBuffer(t.random.getBytes(h.saltSize)),le=h.count,C=o.generateKey(i,ge,3,le,20),j=t.hmac.create();j.start(d,C),j.update(e.toDer(ie).getBytes());var $=j.getMac();de=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(r.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,$.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ge.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(le).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(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ie).getBytes())])]),de])},o.generateKey=t.pbe.generatePkcs12Key,Ur.exports}var Za;function Ja(){if(Za)return xr.exports;Za=1;var t=ue();nt(),vt(),qa(),Ct(),Ir(),$a(),Kr(),zt(),ce(),Fr();var e=t.asn1,r=xr.exports=t.pki=t.pki||{};return r.pemToDer=function(o){var E=t.pem.decode(o)[0];if(E.procType&&E.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return t.util.createBuffer(E.body)},r.privateKeyFromPem=function(o){var E=t.pem.decode(o)[0];if(E.type!=="PRIVATE KEY"&&E.type!=="RSA PRIVATE KEY"){var y=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw y.headerType=E.type,y}if(E.procType&&E.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var f=e.fromDer(E.body);return r.privateKeyFromAsn1(f)},r.privateKeyToPem=function(o,E){var y={type:"RSA PRIVATE KEY",body:e.toDer(r.privateKeyToAsn1(o)).getBytes()};return t.pem.encode(y,{maxline:E})},r.privateKeyInfoToPem=function(o,E){var y={type:"PRIVATE KEY",body:e.toDer(o).getBytes()};return t.pem.encode(y,{maxline:E})},xr.exports}var qr,en;function tn(){if(en)return qr;en=1;var t=ue();nt(),Rt(),Cr(),Ct(),Ja(),Je(),Nt(),ce();var e=function(T,k,L,_){var u=t.util.createBuffer(),w=T.length>>1,V=w+(T.length&1),H=T.substr(0,V),ae=T.substr(w,V),te=t.util.createBuffer(),z=t.hmac.create();L=k+L;var Z=Math.ceil(_/16),se=Math.ceil(_/20);z.start("MD5",H);var fe=t.util.createBuffer();te.putBytes(L);for(var oe=0;oe<Z;++oe)z.start(null,null),z.update(te.getBytes()),te.putBuffer(z.digest()),z.start(null,null),z.update(te.bytes()+L),fe.putBuffer(z.digest());z.start("SHA1",ae);var Ce=t.util.createBuffer();te.clear(),te.putBytes(L);for(var oe=0;oe<se;++oe)z.start(null,null),z.update(te.getBytes()),te.putBuffer(z.digest()),z.start(null,null),z.update(te.bytes()+L),Ce.putBuffer(z.digest());return u.putBytes(t.util.xorBytes(fe.getBytes(),Ce.getBytes(),_)),u},r=function(T,k,L){var _=t.hmac.create();_.start("SHA1",T);var u=t.util.createBuffer();return u.putInt32(k[0]),u.putInt32(k[1]),u.putByte(L.type),u.putByte(L.version.major),u.putByte(L.version.minor),u.putInt16(L.length),u.putBytes(L.fragment.bytes()),_.update(u.getBytes()),_.digest().getBytes()},o=function(T,k,L){var _=!1;try{var u=T.deflate(k.fragment.getBytes());k.fragment=t.util.createBuffer(u),k.length=u.length,_=!0}catch{}return _},E=function(T,k,L){var _=!1;try{var u=T.inflate(k.fragment.getBytes());k.fragment=t.util.createBuffer(u),k.length=u.length,_=!0}catch{}return _},y=function(T,k){var L=0;switch(k){case 1:L=T.getByte();break;case 2:L=T.getInt16();break;case 3:L=T.getInt24();break;case 4:L=T.getInt32();break}return t.util.createBuffer(T.getBytes(L))},f=function(T,k,L){T.putInt(L.length(),k<<3),T.putBuffer(L)},a={};a.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},a.SupportedVersions=[a.Versions.TLS_1_1,a.Versions.TLS_1_0],a.Version=a.SupportedVersions[0],a.MaxFragment=15360,a.ConnectionEnd={server:0,client:1},a.PRFAlgorithm={tls_prf_sha256:0},a.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},a.CipherType={stream:0,block:1,aead:2},a.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},a.CompressionMethod={none:0,deflate:1},a.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},a.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},a.Alert={},a.Alert.Level={warning:1,fatal:2},a.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},a.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},a.CipherSuites={},a.getCipherSuite=function(T){var k=null;for(var L in a.CipherSuites){var _=a.CipherSuites[L];if(_.id[0]===T.charCodeAt(0)&&_.id[1]===T.charCodeAt(1)){k=_;break}}return k},a.handleUnexpected=function(T,k){var L=!T.open&&T.entity===a.ConnectionEnd.client;L||T.error(T,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unexpected_message}})},a.handleHelloRequest=function(T,k,L){!T.handshaking&&T.handshakes>0&&(a.queue(T,a.createAlert(T,{level:a.Alert.Level.warning,description:a.Alert.Description.no_renegotiation})),a.flush(T)),T.process()},a.parseHelloMessage=function(T,k,L){var _=null,u=T.entity===a.ConnectionEnd.client;if(L<38)T.error(T,{message:u?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});else{var w=k.fragment,V=w.length();if(_={version:{major:w.getByte(),minor:w.getByte()},random:t.util.createBuffer(w.getBytes(32)),session_id:y(w,1),extensions:[]},u?(_.cipher_suite=w.getBytes(2),_.compression_method=w.getByte()):(_.cipher_suites=y(w,2),_.compression_methods=y(w,1)),V=L-(V-w.length()),V>0){for(var H=y(w,2);H.length()>0;)_.extensions.push({type:[H.getByte(),H.getByte()],data:y(H,2)});if(!u)for(var ae=0;ae<_.extensions.length;++ae){var te=_.extensions[ae];if(te.type[0]===0&&te.type[1]===0)for(var z=y(te.data,2);z.length()>0;){var Z=z.getByte();if(Z!==0)break;T.session.extensions.server_name.serverNameList.push(y(z,2).getBytes())}}}if(T.session.version&&(_.version.major!==T.session.version.major||_.version.minor!==T.session.version.minor))return T.error(T,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}});if(u)T.session.cipherSuite=a.getCipherSuite(_.cipher_suite);else for(var se=t.util.createBuffer(_.cipher_suites.bytes());se.length()>0&&(T.session.cipherSuite=a.getCipherSuite(se.getBytes(2)),T.session.cipherSuite===null););if(T.session.cipherSuite===null)return T.error(T,{message:"No cipher suites in common.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.handshake_failure},cipherSuite:t.util.bytesToHex(_.cipher_suite)});u?T.session.compressionMethod=_.compression_method:T.session.compressionMethod=a.CompressionMethod.none}return _},a.createSecurityParameters=function(T,k){var L=T.entity===a.ConnectionEnd.client,_=k.random.bytes(),u=L?T.session.sp.client_random:_,w=L?_:a.createRandom().getBytes();T.session.sp={entity:T.entity,prf_algorithm:a.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:T.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:u,server_random:w}},a.handleServerHello=function(T,k,L){var _=a.parseHelloMessage(T,k,L);if(!T.fail){if(_.version.minor<=T.version.minor)T.version.minor=_.version.minor;else return T.error(T,{message:"Incompatible TLS version.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}});T.session.version=T.version;var u=_.session_id.bytes();u.length>0&&u===T.session.id?(T.expect=c,T.session.resuming=!0,T.session.sp.server_random=_.random.bytes()):(T.expect=l,T.session.resuming=!1,a.createSecurityParameters(T,_)),T.session.id=u,T.process()}},a.handleClientHello=function(T,k,L){var _=a.parseHelloMessage(T,k,L);if(!T.fail){var u=_.session_id.bytes(),w=null;if(T.sessionCache&&(w=T.sessionCache.getSession(u),w===null?u="":(w.version.major!==_.version.major||w.version.minor>_.version.minor)&&(w=null,u="")),u.length===0&&(u=t.random.getBytes(32)),T.session.id=u,T.session.clientHelloVersion=_.version,T.session.sp={},w)T.version=T.session.version=w.version,T.session.sp=w.sp;else{for(var V,H=1;H<a.SupportedVersions.length&&(V=a.SupportedVersions[H],!(V.minor<=_.version.minor));++H);T.version={major:V.major,minor:V.minor},T.session.version=T.version}w!==null?(T.expect=N,T.session.resuming=!0,T.session.sp.client_random=_.random.bytes()):(T.expect=T.verifyClient!==!1?h:v,T.session.resuming=!1,a.createSecurityParameters(T,_)),T.open=!0,a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createServerHello(T)})),T.session.resuming?(a.queue(T,a.createRecord(T,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),T.state.pending=a.createConnectionState(T),T.state.current.write=T.state.pending.write,a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createFinished(T)}))):(a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createCertificate(T)})),T.fail||(a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createServerKeyExchange(T)})),T.verifyClient!==!1&&a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createCertificateRequest(T)})),a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createServerHelloDone(T)})))),a.flush(T),T.process()}},a.handleCertificate=function(T,k,L){if(L<3)return T.error(T,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var _=k.fragment,u={certificate_list:y(_,3)},w,V,H=[];try{for(;u.certificate_list.length()>0;)w=y(u.certificate_list,3),V=t.asn1.fromDer(w),w=t.pki.certificateFromAsn1(V,!0),H.push(w)}catch(te){return T.error(T,{message:"Could not parse certificate list.",cause:te,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate}})}var ae=T.entity===a.ConnectionEnd.client;(ae||T.verifyClient===!0)&&H.length===0?T.error(T,{message:ae?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}}):H.length===0?T.expect=ae?S:v:(ae?T.session.serverCertificate=H[0]:T.session.clientCertificate=H[0],a.verifyCertificateChain(T,H)&&(T.expect=ae?S:v)),T.process()},a.handleServerKeyExchange=function(T,k,L){if(L>0)return T.error(T,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unsupported_certificate}});T.expect=R,T.process()},a.handleClientKeyExchange=function(T,k,L){if(L<48)return T.error(T,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unsupported_certificate}});var _=k.fragment,u={enc_pre_master_secret:y(_,2).getBytes()},w=null;if(T.getPrivateKey)try{w=T.getPrivateKey(T,T.session.serverCertificate),w=t.pki.privateKeyFromPem(w)}catch(ae){T.error(T,{message:"Could not get private key.",cause:ae,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}})}if(w===null)return T.error(T,{message:"No private key set.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}});try{var V=T.session.sp;V.pre_master_secret=w.decrypt(u.enc_pre_master_secret);var H=T.session.clientHelloVersion;if(H.major!==V.pre_master_secret.charCodeAt(0)||H.minor!==V.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{V.pre_master_secret=t.random.getBytes(48)}T.expect=N,T.session.clientCertificate!==null&&(T.expect=I),T.process()},a.handleCertificateRequest=function(T,k,L){if(L<3)return T.error(T,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var _=k.fragment,u={certificate_types:y(_,1),certificate_authorities:y(_,2)};T.session.certificateRequest=u,T.expect=x,T.process()},a.handleCertificateVerify=function(T,k,L){if(L<2)return T.error(T,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var _=k.fragment;_.read-=4;var u=_.bytes();_.read+=4;var w={signature:y(_,2).getBytes()},V=t.util.createBuffer();V.putBuffer(T.session.md5.digest()),V.putBuffer(T.session.sha1.digest()),V=V.getBytes();try{var H=T.session.clientCertificate;if(!H.publicKey.verify(V,w.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");T.session.md5.update(u),T.session.sha1.update(u)}catch{return T.error(T,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.handshake_failure}})}T.expect=N,T.process()},a.handleServerHelloDone=function(T,k,L){if(L>0)return T.error(T,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.record_overflow}});if(T.serverCertificate===null){var _={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.insufficient_security}},u=0,w=T.verify(T,_.alert.description,u,[]);if(w!==!0)return(w||w===0)&&(typeof w=="object"&&!t.util.isArray(w)?(w.message&&(_.message=w.message),w.alert&&(_.alert.description=w.alert)):typeof w=="number"&&(_.alert.description=w)),T.error(T,_)}T.session.certificateRequest!==null&&(k=a.createRecord(T,{type:a.ContentType.handshake,data:a.createCertificate(T)}),a.queue(T,k)),k=a.createRecord(T,{type:a.ContentType.handshake,data:a.createClientKeyExchange(T)}),a.queue(T,k),T.expect=m;var V=function(H,ae){H.session.certificateRequest!==null&&H.session.clientCertificate!==null&&a.queue(H,a.createRecord(H,{type:a.ContentType.handshake,data:a.createCertificateVerify(H,ae)})),a.queue(H,a.createRecord(H,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),H.state.pending=a.createConnectionState(H),H.state.current.write=H.state.pending.write,a.queue(H,a.createRecord(H,{type:a.ContentType.handshake,data:a.createFinished(H)})),H.expect=c,a.flush(H),H.process()};if(T.session.certificateRequest===null||T.session.clientCertificate===null)return V(T,null);a.getClientSignature(T,V)},a.handleChangeCipherSpec=function(T,k){if(k.fragment.getByte()!==1)return T.error(T,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var L=T.entity===a.ConnectionEnd.client;(T.session.resuming&&L||!T.session.resuming&&!L)&&(T.state.pending=a.createConnectionState(T)),T.state.current.read=T.state.pending.read,(!T.session.resuming&&L||T.session.resuming&&!L)&&(T.state.pending=null),T.expect=L?g:d,T.process()},a.handleFinished=function(T,k,L){var _=k.fragment;_.read-=4;var u=_.bytes();_.read+=4;var w=k.fragment.getBytes();_=t.util.createBuffer(),_.putBuffer(T.session.md5.digest()),_.putBuffer(T.session.sha1.digest());var V=T.entity===a.ConnectionEnd.client,H=V?"server finished":"client finished",ae=T.session.sp,te=12,z=e;if(_=z(ae.master_secret,H,_.getBytes(),te),_.getBytes()!==w)return T.error(T,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.decrypt_error}});T.session.md5.update(u),T.session.sha1.update(u),(T.session.resuming&&V||!T.session.resuming&&!V)&&(a.queue(T,a.createRecord(T,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),T.state.current.write=T.state.pending.write,T.state.pending=null,a.queue(T,a.createRecord(T,{type:a.ContentType.handshake,data:a.createFinished(T)}))),T.expect=V?C:s,T.handshaking=!1,++T.handshakes,T.peerCertificate=V?T.session.serverCertificate:T.session.clientCertificate,a.flush(T),T.isConnected=!0,T.connected(T),T.process()},a.handleAlert=function(T,k){var L=k.fragment,_={level:L.getByte(),description:L.getByte()},u;switch(_.description){case a.Alert.Description.close_notify:u="Connection closed.";break;case a.Alert.Description.unexpected_message:u="Unexpected message.";break;case a.Alert.Description.bad_record_mac:u="Bad record MAC.";break;case a.Alert.Description.decryption_failed:u="Decryption failed.";break;case a.Alert.Description.record_overflow:u="Record overflow.";break;case a.Alert.Description.decompression_failure:u="Decompression failed.";break;case a.Alert.Description.handshake_failure:u="Handshake failure.";break;case a.Alert.Description.bad_certificate:u="Bad certificate.";break;case a.Alert.Description.unsupported_certificate:u="Unsupported certificate.";break;case a.Alert.Description.certificate_revoked:u="Certificate revoked.";break;case a.Alert.Description.certificate_expired:u="Certificate expired.";break;case a.Alert.Description.certificate_unknown:u="Certificate unknown.";break;case a.Alert.Description.illegal_parameter:u="Illegal parameter.";break;case a.Alert.Description.unknown_ca:u="Unknown certificate authority.";break;case a.Alert.Description.access_denied:u="Access denied.";break;case a.Alert.Description.decode_error:u="Decode error.";break;case a.Alert.Description.decrypt_error:u="Decrypt error.";break;case a.Alert.Description.export_restriction:u="Export restriction.";break;case a.Alert.Description.protocol_version:u="Unsupported protocol version.";break;case a.Alert.Description.insufficient_security:u="Insufficient security.";break;case a.Alert.Description.internal_error:u="Internal error.";break;case a.Alert.Description.user_canceled:u="User canceled.";break;case a.Alert.Description.no_renegotiation:u="Renegotiation not supported.";break;default:u="Unknown error.";break}if(_.description===a.Alert.Description.close_notify)return T.close();T.error(T,{message:u,send:!1,origin:T.entity===a.ConnectionEnd.client?"server":"client",alert:_}),T.process()},a.handleHandshake=function(T,k){var L=k.fragment,_=L.getByte(),u=L.getInt24();if(u>L.length())return T.fragmented=k,k.fragment=t.util.createBuffer(),L.read-=4,T.process();T.fragmented=null,L.read-=4;var w=L.bytes(u+4);L.read+=4,_ in de[T.entity][T.expect]?(T.entity===a.ConnectionEnd.server&&!T.open&&!T.fail&&(T.handshaking=!0,T.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:t.md.md5.create(),sha1:t.md.sha1.create()}),_!==a.HandshakeType.hello_request&&_!==a.HandshakeType.certificate_verify&&_!==a.HandshakeType.finished&&(T.session.md5.update(w),T.session.sha1.update(w)),de[T.entity][T.expect][_](T,k,u)):a.handleUnexpected(T,k)},a.handleApplicationData=function(T,k){T.data.putBuffer(k.fragment),T.dataReady(T),T.process()},a.handleHeartbeat=function(T,k){var L=k.fragment,_=L.getByte(),u=L.getInt16(),w=L.getBytes(u);if(_===a.HeartbeatMessageType.heartbeat_request){if(T.handshaking||u>w.length)return T.process();a.queue(T,a.createRecord(T,{type:a.ContentType.heartbeat,data:a.createHeartbeat(a.HeartbeatMessageType.heartbeat_response,w)})),a.flush(T)}else if(_===a.HeartbeatMessageType.heartbeat_response){if(w!==T.expectedHeartbeatPayload)return T.process();T.heartbeatReceived&&T.heartbeatReceived(T,t.util.createBuffer(w))}T.process()};var p=0,l=1,S=2,R=3,x=4,c=5,g=6,C=7,m=8,i=0,h=1,v=2,I=3,N=4,d=5,s=6,n=a.handleUnexpected,B=a.handleChangeCipherSpec,U=a.handleAlert,O=a.handleHandshake,P=a.handleApplicationData,M=a.handleHeartbeat,q=[];q[a.ConnectionEnd.client]=[[n,U,O,n,M],[n,U,O,n,M],[n,U,O,n,M],[n,U,O,n,M],[n,U,O,n,M],[B,U,n,n,M],[n,U,O,n,M],[n,U,O,P,M],[n,U,O,n,M]],q[a.ConnectionEnd.server]=[[n,U,O,n,M],[n,U,O,n,M],[n,U,O,n,M],[n,U,O,n,M],[B,U,n,n,M],[n,U,O,n,M],[n,U,O,P,M],[n,U,O,n,M]];var F=a.handleHelloRequest,G=a.handleServerHello,W=a.handleCertificate,X=a.handleServerKeyExchange,ee=a.handleCertificateRequest,ne=a.handleServerHelloDone,ie=a.handleFinished,de=[];de[a.ConnectionEnd.client]=[[n,n,G,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,W,X,ee,ne,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,X,ee,ne,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,n,ee,ne,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,n,n,ne,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[F,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[F,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]];var ge=a.handleClientHello,le=a.handleClientKeyExchange,j=a.handleCertificateVerify;de[a.ConnectionEnd.server]=[[n,ge,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,W,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,le,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,j,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]],a.generateKeys=function(T,k){var L=e,_=k.client_random+k.server_random;T.session.resuming||(k.master_secret=L(k.pre_master_secret,"master secret",_,48).bytes(),k.pre_master_secret=null),_=k.server_random+k.client_random;var u=2*k.mac_key_length+2*k.enc_key_length,w=T.version.major===a.Versions.TLS_1_0.major&&T.version.minor===a.Versions.TLS_1_0.minor;w&&(u+=2*k.fixed_iv_length);var V=L(k.master_secret,"key expansion",_,u),H={client_write_MAC_key:V.getBytes(k.mac_key_length),server_write_MAC_key:V.getBytes(k.mac_key_length),client_write_key:V.getBytes(k.enc_key_length),server_write_key:V.getBytes(k.enc_key_length)};return w&&(H.client_write_IV=V.getBytes(k.fixed_iv_length),H.server_write_IV=V.getBytes(k.fixed_iv_length)),H},a.createConnectionState=function(T){var k=T.entity===a.ConnectionEnd.client,L=function(){var w={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(V){return!0},compressionState:null,compressFunction:function(V){return!0},updateSequenceNumber:function(){w.sequenceNumber[1]===4294967295?(w.sequenceNumber[1]=0,++w.sequenceNumber[0]):++w.sequenceNumber[1]}};return w},_={read:L(),write:L()};if(_.read.update=function(w,V){return _.read.cipherFunction(V,_.read)?_.read.compressFunction(w,V,_.read)||w.error(w,{message:"Could not decompress record.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.decompression_failure}}):w.error(w,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_record_mac}}),!w.fail},_.write.update=function(w,V){return _.write.compressFunction(w,V,_.write)?_.write.cipherFunction(V,_.write)||w.error(w,{message:"Could not encrypt record.",send:!1,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}):w.error(w,{message:"Could not compress record.",send:!1,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}),!w.fail},T.session){var u=T.session.sp;switch(T.session.cipherSuite.initSecurityParameters(u),u.keys=a.generateKeys(T,u),_.read.macKey=k?u.keys.server_write_MAC_key:u.keys.client_write_MAC_key,_.write.macKey=k?u.keys.client_write_MAC_key:u.keys.server_write_MAC_key,T.session.cipherSuite.initConnectionState(_,T,u),u.compression_algorithm){case a.CompressionMethod.none:break;case a.CompressionMethod.deflate:_.read.compressFunction=E,_.write.compressFunction=o;break;default:throw new Error("Unsupported compression algorithm.")}}return _},a.createRandom=function(){var T=new Date,k=+T+T.getTimezoneOffset()*6e4,L=t.util.createBuffer();return L.putInt32(k),L.putBytes(t.random.getBytes(28)),L},a.createRecord=function(T,k){if(!k.data)return null;var L={type:k.type,version:{major:T.version.major,minor:T.version.minor},length:k.data.length(),fragment:k.data};return L},a.createAlert=function(T,k){var L=t.util.createBuffer();return L.putByte(k.level),L.putByte(k.description),a.createRecord(T,{type:a.ContentType.alert,data:L})},a.createClientHello=function(T){T.session.clientHelloVersion={major:T.version.major,minor:T.version.minor};for(var k=t.util.createBuffer(),L=0;L<T.cipherSuites.length;++L){var _=T.cipherSuites[L];k.putByte(_.id[0]),k.putByte(_.id[1])}var u=k.length(),w=t.util.createBuffer();w.putByte(a.CompressionMethod.none);var V=w.length(),H=t.util.createBuffer();if(T.virtualHost){var ae=t.util.createBuffer();ae.putByte(0),ae.putByte(0);var te=t.util.createBuffer();te.putByte(0),f(te,2,t.util.createBuffer(T.virtualHost));var z=t.util.createBuffer();f(z,2,te),f(ae,2,z),H.putBuffer(ae)}var Z=H.length();Z>0&&(Z+=2);var se=T.session.id,fe=se.length+1+2+4+28+2+u+1+V+Z,oe=t.util.createBuffer();return oe.putByte(a.HandshakeType.client_hello),oe.putInt24(fe),oe.putByte(T.version.major),oe.putByte(T.version.minor),oe.putBytes(T.session.sp.client_random),f(oe,1,t.util.createBuffer(se)),f(oe,2,k),f(oe,1,w),Z>0&&f(oe,2,H),oe},a.createServerHello=function(T){var k=T.session.id,L=k.length+1+2+4+28+2+1,_=t.util.createBuffer();return _.putByte(a.HandshakeType.server_hello),_.putInt24(L),_.putByte(T.version.major),_.putByte(T.version.minor),_.putBytes(T.session.sp.server_random),f(_,1,t.util.createBuffer(k)),_.putByte(T.session.cipherSuite.id[0]),_.putByte(T.session.cipherSuite.id[1]),_.putByte(T.session.compressionMethod),_},a.createCertificate=function(T){var k=T.entity===a.ConnectionEnd.client,L=null;if(T.getCertificate){var _;k?_=T.session.certificateRequest:_=T.session.extensions.server_name.serverNameList,L=T.getCertificate(T,_)}var u=t.util.createBuffer();if(L!==null)try{t.util.isArray(L)||(L=[L]);for(var w=null,V=0;V<L.length;++V){var H=t.pem.decode(L[V])[0];if(H.type!=="CERTIFICATE"&&H.type!=="X509 CERTIFICATE"&&H.type!=="TRUSTED CERTIFICATE"){var ae=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ae.headerType=H.type,ae}if(H.procType&&H.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var te=t.util.createBuffer(H.body);w===null&&(w=t.asn1.fromDer(te.bytes(),!1));var z=t.util.createBuffer();f(z,3,te),u.putBuffer(z)}L=t.pki.certificateFromAsn1(w),k?T.session.clientCertificate=L:T.session.serverCertificate=L}catch(fe){return T.error(T,{message:"Could not send certificate list.",cause:fe,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate}})}var Z=3+u.length(),se=t.util.createBuffer();return se.putByte(a.HandshakeType.certificate),se.putInt24(Z),f(se,3,u),se},a.createClientKeyExchange=function(T){var k=t.util.createBuffer();k.putByte(T.session.clientHelloVersion.major),k.putByte(T.session.clientHelloVersion.minor),k.putBytes(t.random.getBytes(46));var L=T.session.sp;L.pre_master_secret=k.getBytes();var _=T.session.serverCertificate.publicKey;k=_.encrypt(L.pre_master_secret);var u=k.length+2,w=t.util.createBuffer();return w.putByte(a.HandshakeType.client_key_exchange),w.putInt24(u),w.putInt16(k.length),w.putBytes(k),w},a.createServerKeyExchange=function(T){var k=t.util.createBuffer();return k},a.getClientSignature=function(T,k){var L=t.util.createBuffer();L.putBuffer(T.session.md5.digest()),L.putBuffer(T.session.sha1.digest()),L=L.getBytes(),T.getSignature=T.getSignature||function(_,u,w){var V=null;if(_.getPrivateKey)try{V=_.getPrivateKey(_,_.session.clientCertificate),V=t.pki.privateKeyFromPem(V)}catch(H){_.error(_,{message:"Could not get private key.",cause:H,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}})}V===null?_.error(_,{message:"No private key set.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}):u=V.sign(u,null),w(_,u)},T.getSignature(T,L,k)},a.createCertificateVerify=function(T,k){var L=k.length+2,_=t.util.createBuffer();return _.putByte(a.HandshakeType.certificate_verify),_.putInt24(L),_.putInt16(k.length),_.putBytes(k),_},a.createCertificateRequest=function(T){var k=t.util.createBuffer();k.putByte(1);var L=t.util.createBuffer();for(var _ in T.caStore.certs){var u=T.caStore.certs[_],w=t.pki.distinguishedNameToAsn1(u.subject),V=t.asn1.toDer(w);L.putInt16(V.length()),L.putBuffer(V)}var H=1+k.length()+2+L.length(),ae=t.util.createBuffer();return ae.putByte(a.HandshakeType.certificate_request),ae.putInt24(H),f(ae,1,k),f(ae,2,L),ae},a.createServerHelloDone=function(T){var k=t.util.createBuffer();return k.putByte(a.HandshakeType.server_hello_done),k.putInt24(0),k},a.createChangeCipherSpec=function(){var T=t.util.createBuffer();return T.putByte(1),T},a.createFinished=function(T){var k=t.util.createBuffer();k.putBuffer(T.session.md5.digest()),k.putBuffer(T.session.sha1.digest());var L=T.entity===a.ConnectionEnd.client,_=T.session.sp,u=12,w=e,V=L?"client finished":"server finished";k=w(_.master_secret,V,k.getBytes(),u);var H=t.util.createBuffer();return H.putByte(a.HandshakeType.finished),H.putInt24(k.length()),H.putBuffer(k),H},a.createHeartbeat=function(T,k,L){typeof L>"u"&&(L=k.length);var _=t.util.createBuffer();_.putByte(T),_.putInt16(L),_.putBytes(k);var u=_.length(),w=Math.max(16,u-L-3);return _.putBytes(t.random.getBytes(w)),_},a.queue=function(T,k){if(k&&!(k.fragment.length()===0&&(k.type===a.ContentType.handshake||k.type===a.ContentType.alert||k.type===a.ContentType.change_cipher_spec))){if(k.type===a.ContentType.handshake){var L=k.fragment.bytes();T.session.md5.update(L),T.session.sha1.update(L),L=null}var _;if(k.fragment.length()<=a.MaxFragment)_=[k];else{_=[];for(var u=k.fragment.bytes();u.length>a.MaxFragment;)_.push(a.createRecord(T,{type:k.type,data:t.util.createBuffer(u.slice(0,a.MaxFragment))})),u=u.slice(a.MaxFragment);u.length>0&&_.push(a.createRecord(T,{type:k.type,data:t.util.createBuffer(u)}))}for(var w=0;w<_.length&&!T.fail;++w){var V=_[w],H=T.state.current.write;H.update(T,V)&&T.records.push(V)}}},a.flush=function(T){for(var k=0;k<T.records.length;++k){var L=T.records[k];T.tlsData.putByte(L.type),T.tlsData.putByte(L.version.major),T.tlsData.putByte(L.version.minor),T.tlsData.putInt16(L.fragment.length()),T.tlsData.putBuffer(T.records[k].fragment)}return T.records=[],T.tlsDataReady(T)};var $=function(T){switch(T){case!0:return!0;case t.pki.certificateError.bad_certificate:return a.Alert.Description.bad_certificate;case t.pki.certificateError.unsupported_certificate:return a.Alert.Description.unsupported_certificate;case t.pki.certificateError.certificate_revoked:return a.Alert.Description.certificate_revoked;case t.pki.certificateError.certificate_expired:return a.Alert.Description.certificate_expired;case t.pki.certificateError.certificate_unknown:return a.Alert.Description.certificate_unknown;case t.pki.certificateError.unknown_ca:return a.Alert.Description.unknown_ca;default:return a.Alert.Description.bad_certificate}},ze=function(T){switch(T){case!0:return!0;case a.Alert.Description.bad_certificate:return t.pki.certificateError.bad_certificate;case a.Alert.Description.unsupported_certificate:return t.pki.certificateError.unsupported_certificate;case a.Alert.Description.certificate_revoked:return t.pki.certificateError.certificate_revoked;case a.Alert.Description.certificate_expired:return t.pki.certificateError.certificate_expired;case a.Alert.Description.certificate_unknown:return t.pki.certificateError.certificate_unknown;case a.Alert.Description.unknown_ca:return t.pki.certificateError.unknown_ca;default:return t.pki.certificateError.bad_certificate}};a.verifyCertificateChain=function(T,k){try{var L={};for(var _ in T.verifyOptions)L[_]=T.verifyOptions[_];L.verify=function(w,V,H){var ae=$(w),te=T.verify(T,w,V,H);if(te!==!0){if(typeof te=="object"&&!t.util.isArray(te)){var z=new Error("The application rejected the certificate.");throw z.send=!0,z.alert={level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate},te.message&&(z.message=te.message),te.alert&&(z.alert.description=te.alert),z}te!==w&&(te=ze(te))}return te},t.pki.verifyCertificateChain(T.caStore,k,L)}catch(w){var u=w;(typeof u!="object"||t.util.isArray(u))&&(u={send:!0,alert:{level:a.Alert.Level.fatal,description:$(w)}}),"send"in u||(u.send=!0),"alert"in u||(u.alert={level:a.Alert.Level.fatal,description:$(u.error)}),T.error(T,u)}return!T.fail},a.createSessionCache=function(T,k){var L=null;if(T&&T.getSession&&T.setSession&&T.order)L=T;else{L={},L.cache=T||{},L.capacity=Math.max(k||100,1),L.order=[];for(var _ in T)L.order.length<=k?L.order.push(_):delete T[_];L.getSession=function(u){var w=null,V=null;if(u?V=t.util.bytesToHex(u):L.order.length>0&&(V=L.order[0]),V!==null&&V in L.cache){w=L.cache[V],delete L.cache[V];for(var H in L.order)if(L.order[H]===V){L.order.splice(H,1);break}}return w},L.setSession=function(u,w){if(L.order.length===L.capacity){var V=L.order.shift();delete L.cache[V]}var V=t.util.bytesToHex(u);L.order.push(V),L.cache[V]=w}}return L},a.createConnection=function(T){var k=null;T.caStore?t.util.isArray(T.caStore)?k=t.pki.createCaStore(T.caStore):k=T.caStore:k=t.pki.createCaStore();var L=T.cipherSuites||null;if(L===null){L=[];for(var _ in a.CipherSuites)L.push(a.CipherSuites[_])}var u=T.server?a.ConnectionEnd.server:a.ConnectionEnd.client,w=T.sessionCache?a.createSessionCache(T.sessionCache):null,V={version:{major:a.Version.major,minor:a.Version.minor},entity:u,sessionId:T.sessionId,caStore:k,sessionCache:w,cipherSuites:L,connected:T.connected,virtualHost:T.virtualHost||null,verifyClient:T.verifyClient||!1,verify:T.verify||function(z,Z,se,fe){return Z},verifyOptions:T.verifyOptions||{},getCertificate:T.getCertificate||null,getPrivateKey:T.getPrivateKey||null,getSignature:T.getSignature||null,input:t.util.createBuffer(),tlsData:t.util.createBuffer(),data:t.util.createBuffer(),tlsDataReady:T.tlsDataReady,dataReady:T.dataReady,heartbeatReceived:T.heartbeatReceived,closed:T.closed,error:function(z,Z){Z.origin=Z.origin||(z.entity===a.ConnectionEnd.client?"client":"server"),Z.send&&(a.queue(z,a.createAlert(z,Z.alert)),a.flush(z));var se=Z.fatal!==!1;se&&(z.fail=!0),T.error(z,Z),se&&z.close(!1)},deflate:T.deflate||null,inflate:T.inflate||null};V.reset=function(z){V.version={major:a.Version.major,minor:a.Version.minor},V.record=null,V.session=null,V.peerCertificate=null,V.state={pending:null,current:null},V.expect=V.entity===a.ConnectionEnd.client?p:i,V.fragmented=null,V.records=[],V.open=!1,V.handshakes=0,V.handshaking=!1,V.isConnected=!1,V.fail=!(z||typeof z>"u"),V.input.clear(),V.tlsData.clear(),V.data.clear(),V.state.current=a.createConnectionState(V)},V.reset();var H=function(z,Z){var se=Z.type-a.ContentType.change_cipher_spec,fe=q[z.entity][z.expect];se in fe?fe[se](z,Z):a.handleUnexpected(z,Z)},ae=function(z){var Z=0,se=z.input,fe=se.length();if(fe<5)Z=5-fe;else{z.record={type:se.getByte(),version:{major:se.getByte(),minor:se.getByte()},length:se.getInt16(),fragment:t.util.createBuffer(),ready:!1};var oe=z.record.version.major===z.version.major;oe&&z.session&&z.session.version&&(oe=z.record.version.minor===z.version.minor),oe||z.error(z,{message:"Incompatible TLS version.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}})}return Z},te=function(z){var Z=0,se=z.input,fe=se.length();if(fe<z.record.length)Z=z.record.length-fe;else{z.record.fragment.putBytes(se.getBytes(z.record.length)),se.compact();var oe=z.state.current.read;oe.update(z,z.record)&&(z.fragmented!==null&&(z.fragmented.type===z.record.type?(z.fragmented.fragment.putBuffer(z.record.fragment),z.record=z.fragmented):z.error(z,{message:"Invalid fragmented record.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unexpected_message}})),z.record.ready=!0)}return Z};return V.handshake=function(z){if(V.entity!==a.ConnectionEnd.client)V.error(V,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(V.handshaking)V.error(V,{message:"Handshake already in progress.",fatal:!1});else{V.fail&&!V.open&&V.handshakes===0&&(V.fail=!1),V.handshaking=!0,z=z||"";var Z=null;z.length>0&&(V.sessionCache&&(Z=V.sessionCache.getSession(z)),Z===null&&(z="")),z.length===0&&V.sessionCache&&(Z=V.sessionCache.getSession(),Z!==null&&(z=Z.id)),V.session={id:z,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:t.md.md5.create(),sha1:t.md.sha1.create()},Z&&(V.version=Z.version,V.session.sp=Z.sp),V.session.sp.client_random=a.createRandom().getBytes(),V.open=!0,a.queue(V,a.createRecord(V,{type:a.ContentType.handshake,data:a.createClientHello(V)})),a.flush(V)}},V.process=function(z){var Z=0;return z&&V.input.putBytes(z),V.fail||(V.record!==null&&V.record.ready&&V.record.fragment.isEmpty()&&(V.record=null),V.record===null&&(Z=ae(V)),!V.fail&&V.record!==null&&!V.record.ready&&(Z=te(V)),!V.fail&&V.record!==null&&V.record.ready&&H(V,V.record)),Z},V.prepare=function(z){return a.queue(V,a.createRecord(V,{type:a.ContentType.application_data,data:t.util.createBuffer(z)})),a.flush(V)},V.prepareHeartbeatRequest=function(z,Z){return z instanceof t.util.ByteBuffer&&(z=z.bytes()),typeof Z>"u"&&(Z=z.length),V.expectedHeartbeatPayload=z,a.queue(V,a.createRecord(V,{type:a.ContentType.heartbeat,data:a.createHeartbeat(a.HeartbeatMessageType.heartbeat_request,z,Z)})),a.flush(V)},V.close=function(z){if(!V.fail&&V.sessionCache&&V.session){var Z={id:V.session.id,version:V.session.version,sp:V.session.sp};Z.sp.keys=null,V.sessionCache.setSession(Z.id,Z)}V.open&&(V.open=!1,V.input.clear(),(V.isConnected||V.handshaking)&&(V.isConnected=V.handshaking=!1,a.queue(V,a.createAlert(V,{level:a.Alert.Level.warning,description:a.Alert.Description.close_notify})),a.flush(V)),V.closed(V)),V.reset(z)},V},qr=t.tls=t.tls||{};for(var qe in a)typeof a[qe]!="function"&&(t.tls[qe]=a[qe]);return t.tls.prf_tls1=e,t.tls.hmac_sha1=r,t.tls.createSessionCache=a.createSessionCache,t.tls.createConnection=a.createConnection,qr}var rn;function di(){if(rn)return hr.exports;rn=1;var t=ue();gt(),tn();var e=hr.exports=t.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(p){p.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,p.cipher_type=e.CipherType.block,p.enc_key_length=16,p.block_length=16,p.fixed_iv_length=16,p.record_iv_length=16,p.mac_algorithm=e.MACAlgorithm.hmac_sha1,p.mac_length=20,p.mac_key_length=20},initConnectionState:r},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(p){p.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,p.cipher_type=e.CipherType.block,p.enc_key_length=32,p.block_length=16,p.fixed_iv_length=16,p.record_iv_length=16,p.mac_algorithm=e.MACAlgorithm.hmac_sha1,p.mac_length=20,p.mac_key_length=20},initConnectionState:r};function r(p,l,S){var R=l.entity===t.tls.ConnectionEnd.client;p.read.cipherState={init:!1,cipher:t.cipher.createDecipher("AES-CBC",R?S.keys.server_write_key:S.keys.client_write_key),iv:R?S.keys.server_write_IV:S.keys.client_write_IV},p.write.cipherState={init:!1,cipher:t.cipher.createCipher("AES-CBC",R?S.keys.client_write_key:S.keys.server_write_key),iv:R?S.keys.client_write_IV:S.keys.server_write_IV},p.read.cipherFunction=f,p.write.cipherFunction=o,p.read.macLength=p.write.macLength=S.mac_length,p.read.macFunction=p.write.macFunction=e.hmac_sha1}function o(p,l){var S=!1,R=l.macFunction(l.macKey,l.sequenceNumber,p);p.fragment.putBytes(R),l.updateSequenceNumber();var x;p.version.minor===e.Versions.TLS_1_0.minor?x=l.cipherState.init?null:l.cipherState.iv:x=t.random.getBytesSync(16),l.cipherState.init=!0;var c=l.cipherState.cipher;return c.start({iv:x}),p.version.minor>=e.Versions.TLS_1_1.minor&&c.output.putBytes(x),c.update(p.fragment),c.finish(E)&&(p.fragment=c.output,p.length=p.fragment.length(),S=!0),S}function E(p,l,S){if(!S){var R=p-l.length()%p;l.fillWithByte(R-1,R)}return!0}function y(p,l,S){var R=!0;if(S){for(var x=l.length(),c=l.last(),g=x-1-c;g<x-1;++g)R=R&&l.at(g)==c;R&&l.truncate(c+1)}return R}function f(p,l){var S=!1,R;p.version.minor===e.Versions.TLS_1_0.minor?R=l.cipherState.init?null:l.cipherState.iv:R=p.fragment.getBytes(16),l.cipherState.init=!0;var x=l.cipherState.cipher;x.start({iv:R}),x.update(p.fragment),S=x.finish(y);var c=l.macLength,g=t.random.getBytesSync(c),C=x.output.length();C>=c?(p.fragment=x.output.getBytes(C-c),g=x.output.getBytes(c)):p.fragment=x.output.getBytes(),p.fragment=t.util.createBuffer(p.fragment),p.length=p.fragment.length();var m=l.macFunction(l.macKey,l.sequenceNumber,p);return l.updateSequenceNumber(),S=a(l.macKey,g,m)&&S,S}function a(p,l,S){var R=t.hmac.create();return R.start("SHA1",p),R.update(l),l=R.digest().getBytes(),R.start(null,null),R.update(S),S=R.digest().getBytes(),l===S}return hr.exports}var Hr={exports:{}},an;function nn(){if(an)return Hr.exports;an=1;var t=ue();st(),ce();var e=Hr.exports=t.sha512=t.sha512||{};t.md.sha512=t.md.algorithms.sha512=e;var r=t.sha384=t.sha512.sha384=t.sha512.sha384||{};r.create=function(){return e.create("SHA-384")},t.md.sha384=t.md.algorithms.sha384=r,t.sha512.sha256=t.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},t.md["sha512/256"]=t.md.algorithms["sha512/256"]=t.sha512.sha256,t.sha512.sha224=t.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},t.md["sha512/224"]=t.md.algorithms["sha512/224"]=t.sha512.sha224,e.create=function(l){if(E||a(),typeof l>"u"&&(l="SHA-512"),!(l in f))throw new Error("Invalid SHA-512 algorithm: "+l);for(var S=f[l],R=null,x=t.util.createBuffer(),c=new Array(80),g=0;g<80;++g)c[g]=new Array(2);var C=64;switch(l){case"SHA-384":C=48;break;case"SHA-512/256":C=32;break;case"SHA-512/224":C=28;break}var m={algorithm:l.replace("-","").toLowerCase(),blockLength:128,digestLength:C,messageLength:0,fullMessageLength:null,messageLengthSize:16};return m.start=function(){m.messageLength=0,m.fullMessageLength=m.messageLength128=[];for(var i=m.messageLengthSize/4,h=0;h<i;++h)m.fullMessageLength.push(0);x=t.util.createBuffer(),R=new Array(S.length);for(var h=0;h<S.length;++h)R[h]=S[h].slice(0);return m},m.start(),m.update=function(i,h){h==="utf8"&&(i=t.util.encodeUtf8(i));var v=i.length;m.messageLength+=v,v=[v/4294967296>>>0,v>>>0];for(var I=m.fullMessageLength.length-1;I>=0;--I)m.fullMessageLength[I]+=v[1],v[1]=v[0]+(m.fullMessageLength[I]/4294967296>>>0),m.fullMessageLength[I]=m.fullMessageLength[I]>>>0,v[0]=v[1]/4294967296>>>0;return x.putBytes(i),p(R,c,x),(x.read>2048||x.length()===0)&&x.compact(),m},m.digest=function(){var i=t.util.createBuffer();i.putBytes(x.bytes());var h=m.fullMessageLength[m.fullMessageLength.length-1]+m.messageLengthSize,v=h&m.blockLength-1;i.putBytes(o.substr(0,m.blockLength-v));for(var I,N,d=m.fullMessageLength[0]*8,s=0;s<m.fullMessageLength.length-1;++s)I=m.fullMessageLength[s+1]*8,N=I/4294967296>>>0,d+=N,i.putInt32(d>>>0),d=I>>>0;i.putInt32(d);for(var n=new Array(R.length),s=0;s<R.length;++s)n[s]=R[s].slice(0);p(n,c,i);var B=t.util.createBuffer(),U;l==="SHA-512"?U=n.length:l==="SHA-384"?U=n.length-2:U=n.length-4;for(var s=0;s<U;++s)B.putInt32(n[s][0]),(s!==U-1||l!=="SHA-512/224")&&B.putInt32(n[s][1]);return B},m};var o=null,E=!1,y=null,f=null;function a(){o="",o+=t.util.fillString("\0",128),y=[[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]],f={},f["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],f["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],f["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],f["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],E=!0}function p(l,S,R){for(var x,c,g,C,m,i,h,v,I,N,d,s,n,B,U,O,P,M,q,F,G,W,X,ee,ne,ie,de,ge,le,j,$,ze,qe,T,k,L=R.length();L>=128;){for(le=0;le<16;++le)S[le][0]=R.getInt32()>>>0,S[le][1]=R.getInt32()>>>0;for(;le<80;++le)ze=S[le-2],j=ze[0],$=ze[1],x=((j>>>19|$<<13)^($>>>29|j<<3)^j>>>6)>>>0,c=((j<<13|$>>>19)^($<<3|j>>>29)^(j<<26|$>>>6))>>>0,T=S[le-15],j=T[0],$=T[1],g=((j>>>1|$<<31)^(j>>>8|$<<24)^j>>>7)>>>0,C=((j<<31|$>>>1)^(j<<24|$>>>8)^(j<<25|$>>>7))>>>0,qe=S[le-7],k=S[le-16],$=c+qe[1]+C+k[1],S[le][0]=x+qe[0]+g+k[0]+($/4294967296>>>0)>>>0,S[le][1]=$>>>0;for(n=l[0][0],B=l[0][1],U=l[1][0],O=l[1][1],P=l[2][0],M=l[2][1],q=l[3][0],F=l[3][1],G=l[4][0],W=l[4][1],X=l[5][0],ee=l[5][1],ne=l[6][0],ie=l[6][1],de=l[7][0],ge=l[7][1],le=0;le<80;++le)h=((G>>>14|W<<18)^(G>>>18|W<<14)^(W>>>9|G<<23))>>>0,v=((G<<18|W>>>14)^(G<<14|W>>>18)^(W<<23|G>>>9))>>>0,I=(ne^G&(X^ne))>>>0,N=(ie^W&(ee^ie))>>>0,m=((n>>>28|B<<4)^(B>>>2|n<<30)^(B>>>7|n<<25))>>>0,i=((n<<4|B>>>28)^(B<<30|n>>>2)^(B<<25|n>>>7))>>>0,d=(n&U|P&(n^U))>>>0,s=(B&O|M&(B^O))>>>0,$=ge+v+N+y[le][1]+S[le][1],x=de+h+I+y[le][0]+S[le][0]+($/4294967296>>>0)>>>0,c=$>>>0,$=i+s,g=m+d+($/4294967296>>>0)>>>0,C=$>>>0,de=ne,ge=ie,ne=X,ie=ee,X=G,ee=W,$=F+c,G=q+x+($/4294967296>>>0)>>>0,W=$>>>0,q=P,F=M,P=U,M=O,U=n,O=B,$=c+C,n=x+g+($/4294967296>>>0)>>>0,B=$>>>0;$=l[0][1]+B,l[0][0]=l[0][0]+n+($/4294967296>>>0)>>>0,l[0][1]=$>>>0,$=l[1][1]+O,l[1][0]=l[1][0]+U+($/4294967296>>>0)>>>0,l[1][1]=$>>>0,$=l[2][1]+M,l[2][0]=l[2][0]+P+($/4294967296>>>0)>>>0,l[2][1]=$>>>0,$=l[3][1]+F,l[3][0]=l[3][0]+q+($/4294967296>>>0)>>>0,l[3][1]=$>>>0,$=l[4][1]+W,l[4][0]=l[4][0]+G+($/4294967296>>>0)>>>0,l[4][1]=$>>>0,$=l[5][1]+ee,l[5][0]=l[5][0]+X+($/4294967296>>>0)>>>0,l[5][1]=$>>>0,$=l[6][1]+ie,l[6][0]=l[6][0]+ne+($/4294967296>>>0)>>>0,l[6][1]=$>>>0,$=l[7][1]+ge,l[7][0]=l[7][0]+de+($/4294967296>>>0)>>>0,l[7][1]=$>>>0,L-=128}}return Hr.exports}var Qt={},sn;function hi(){if(sn)return Qt;sn=1;var t=ue();nt();var e=t.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 Gr,on;function pi(){if(on)return Gr;on=1;var t=ue();Ht(),Je(),nn(),ce();var e=hi(),r=e.publicKeyValidator,o=e.privateKeyValidator;if(typeof E>"u")var E=t.jsbn.BigInteger;var y=t.util.ByteBuffer,f=typeof Buffer>"u"?Uint8Array:Buffer;t.pki=t.pki||{},Gr=t.pki.ed25519=t.ed25519=t.ed25519||{};var a=t.ed25519;a.constants={},a.constants.PUBLIC_KEY_BYTE_LENGTH=32,a.constants.PRIVATE_KEY_BYTE_LENGTH=64,a.constants.SEED_BYTE_LENGTH=32,a.constants.SIGN_BYTE_LENGTH=64,a.constants.HASH_BYTE_LENGTH=64,a.generateKeyPair=function(k){k=k||{};var L=k.seed;if(L===void 0)L=t.random.getBytesSync(a.constants.SEED_BYTE_LENGTH);else if(typeof L=="string"){if(L.length!==a.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+a.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(L instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');L=p({message:L,encoding:"binary"});for(var _=new f(a.constants.PUBLIC_KEY_BYTE_LENGTH),u=new f(a.constants.PRIVATE_KEY_BYTE_LENGTH),w=0;w<32;++w)u[w]=L[w];return h(_,u),{publicKey:_,privateKey:u}},a.privateKeyFromAsn1=function(k){var L={},_=[],u=t.asn1.validate(k,o,L,_);if(!u){var w=new Error("Invalid Key.");throw w.errors=_,w}var V=t.asn1.derToOid(L.privateKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=L.privateKey,te=p({message:t.asn1.fromDer(ae).value,encoding:"binary"});return{privateKeyBytes:te}},a.publicKeyFromAsn1=function(k){var L={},_=[],u=t.asn1.validate(k,r,L,_);if(!u){var w=new Error("Invalid Key.");throw w.errors=_,w}var V=t.asn1.derToOid(L.publicKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=L.ed25519PublicKey;if(ae.length!==a.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return p({message:ae,encoding:"binary"})},a.publicKeyFromPrivateKey=function(k){k=k||{};var L=p({message:k.privateKey,encoding:"binary"});if(L.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.PRIVATE_KEY_BYTE_LENGTH);for(var _=new f(a.constants.PUBLIC_KEY_BYTE_LENGTH),u=0;u<_.length;++u)_[u]=L[32+u];return _},a.sign=function(k){k=k||{};var L=p(k),_=p({message:k.privateKey,encoding:"binary"});if(_.length===a.constants.SEED_BYTE_LENGTH){var u=a.generateKeyPair({seed:_});_=u.privateKey}else if(_.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.SEED_BYTE_LENGTH+" or "+a.constants.PRIVATE_KEY_BYTE_LENGTH);var w=new f(a.constants.SIGN_BYTE_LENGTH+L.length);v(w,L,L.length,_);for(var V=new f(a.constants.SIGN_BYTE_LENGTH),H=0;H<V.length;++H)V[H]=w[H];return V},a.verify=function(k){k=k||{};var L=p(k);if(k.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var _=p({message:k.signature,encoding:"binary"});if(_.length!==a.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+a.constants.SIGN_BYTE_LENGTH);var u=p({message:k.publicKey,encoding:"binary"});if(u.length!==a.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+a.constants.PUBLIC_KEY_BYTE_LENGTH);var w=new f(a.constants.SIGN_BYTE_LENGTH+L.length),V=new f(a.constants.SIGN_BYTE_LENGTH+L.length),H;for(H=0;H<a.constants.SIGN_BYTE_LENGTH;++H)w[H]=_[H];for(H=0;H<L.length;++H)w[H+a.constants.SIGN_BYTE_LENGTH]=L[H];return I(V,w,w.length,u)>=0};function p(k){var L=k.message;if(L instanceof Uint8Array||L instanceof f)return L;var _=k.encoding;if(L===void 0)if(k.md)L=k.md.digest().getBytes(),_="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof L=="string"&&!_)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof L=="string"){if(typeof Buffer<"u")return Buffer.from(L,_);L=new y(L,_)}else if(!(L instanceof y))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 u=new f(L.length()),w=0;w<u.length;++w)u[w]=L.at(w);return u}var l=j(),S=j([1]),R=j([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),x=j([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),c=j([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),g=j([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),C=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]),m=j([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function i(k,L){var _=t.md.sha512.create(),u=new y(k);_.update(u.getBytes(L),"binary");var w=_.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(w,"binary");for(var V=new f(a.constants.HASH_BYTE_LENGTH),H=0;H<64;++H)V[H]=w.charCodeAt(H);return V}function h(k,L){var _=[j(),j(),j(),j()],u,w=i(L,32);for(w[0]&=248,w[31]&=127,w[31]|=64,ne(_,w),U(k,_),u=0;u<32;++u)L[u+32]=k[u];return 0}function v(k,L,_,u){var w,V,H=new Float64Array(64),ae=[j(),j(),j(),j()],te=i(u,32);te[0]&=248,te[31]&=127,te[31]|=64;var z=_+64;for(w=0;w<_;++w)k[64+w]=L[w];for(w=0;w<32;++w)k[32+w]=te[32+w];var Z=i(k.subarray(32),_+32);for(s(Z),ne(ae,Z),U(k,ae),w=32;w<64;++w)k[w]=u[w];var se=i(k,_+64);for(s(se),w=32;w<64;++w)H[w]=0;for(w=0;w<32;++w)H[w]=Z[w];for(w=0;w<32;++w)for(V=0;V<32;V++)H[w+V]+=se[w]*te[V];return d(k.subarray(32),H),z}function I(k,L,_,u){var w,V,H=new f(32),ae=[j(),j(),j(),j()],te=[j(),j(),j(),j()];if(V=-1,_<64||P(te,u)||!N(L,32))return-1;for(w=0;w<_;++w)k[w]=L[w];for(w=0;w<32;++w)k[w+32]=u[w];var z=i(k,_);if(s(z),ee(ae,te,z),ne(te,L.subarray(32)),n(ae,te),U(H,ae),_-=64,G(L,0,H,0)){for(w=0;w<_;++w)k[w]=0;return-1}for(w=0;w<_;++w)k[w]=L[w+64];return V=_,V}function N(k,L){var _;for(_=31;_>=0;--_){if(k[L+_]<C[_])return!0;if(k[L+_]>C[_])return!1}return!1}function d(k,L){var _,u,w,V;for(u=63;u>=32;--u){for(_=0,w=u-32,V=u-12;w<V;++w)L[w]+=_-16*L[u]*C[w-(u-32)],_=L[w]+128>>8,L[w]-=_*256;L[w]+=_,L[u]=0}for(_=0,w=0;w<32;++w)L[w]+=_-(L[31]>>4)*C[w],_=L[w]>>8,L[w]&=255;for(w=0;w<32;++w)L[w]-=_*C[w];for(u=0;u<32;++u)L[u+1]+=L[u]>>8,k[u]=L[u]&255}function s(k){for(var L=new Float64Array(64),_=0;_<64;++_)L[_]=k[_],k[_]=0;d(k,L)}function n(k,L){var _=j(),u=j(),w=j(),V=j(),H=j(),ae=j(),te=j(),z=j(),Z=j();ze(_,k[1],k[0]),ze(Z,L[1],L[0]),T(_,_,Z),$(u,k[0],k[1]),$(Z,L[0],L[1]),T(u,u,Z),T(w,k[3],L[3]),T(w,w,x),T(V,k[2],L[2]),$(V,V,V),ze(H,u,_),ze(ae,V,w),$(te,V,w),$(z,u,_),T(k[0],H,ae),T(k[1],z,te),T(k[2],te,ae),T(k[3],H,z)}function B(k,L,_){for(var u=0;u<4;++u)le(k[u],L[u],_)}function U(k,L){var _=j(),u=j(),w=j();de(w,L[2]),T(_,L[0],w),T(u,L[1],w),O(k,u),k[31]^=X(_)<<7}function O(k,L){var _,u,w,V=j(),H=j();for(_=0;_<16;++_)H[_]=L[_];for(ge(H),ge(H),ge(H),u=0;u<2;++u){for(V[0]=H[0]-65517,_=1;_<15;++_)V[_]=H[_]-65535-(V[_-1]>>16&1),V[_-1]&=65535;V[15]=H[15]-32767-(V[14]>>16&1),w=V[15]>>16&1,V[14]&=65535,le(H,V,1-w)}for(_=0;_<16;_++)k[2*_]=H[_]&255,k[2*_+1]=H[_]>>8}function P(k,L){var _=j(),u=j(),w=j(),V=j(),H=j(),ae=j(),te=j();return ie(k[2],S),M(k[1],L),qe(w,k[1]),T(V,w,R),ze(w,w,k[2]),$(V,k[2],V),qe(H,V),qe(ae,H),T(te,ae,H),T(_,te,w),T(_,_,V),q(_,_),T(_,_,w),T(_,_,V),T(_,_,V),T(k[0],_,V),qe(u,k[0]),T(u,u,V),F(u,w)&&T(k[0],k[0],m),qe(u,k[0]),T(u,u,V),F(u,w)?-1:(X(k[0])===L[31]>>7&&ze(k[0],l,k[0]),T(k[3],k[0],k[1]),0)}function M(k,L){var _;for(_=0;_<16;++_)k[_]=L[2*_]+(L[2*_+1]<<8);k[15]&=32767}function q(k,L){var _=j(),u;for(u=0;u<16;++u)_[u]=L[u];for(u=250;u>=0;--u)qe(_,_),u!==1&&T(_,_,L);for(u=0;u<16;++u)k[u]=_[u]}function F(k,L){var _=new f(32),u=new f(32);return O(_,k),O(u,L),G(_,0,u,0)}function G(k,L,_,u){return W(k,L,_,u,32)}function W(k,L,_,u,w){var V,H=0;for(V=0;V<w;++V)H|=k[L+V]^_[u+V];return(1&H-1>>>8)-1}function X(k){var L=new f(32);return O(L,k),L[0]&1}function ee(k,L,_){var u,w;for(ie(k[0],l),ie(k[1],S),ie(k[2],S),ie(k[3],l),w=255;w>=0;--w)u=_[w/8|0]>>(w&7)&1,B(k,L,u),n(L,k),n(k,k),B(k,L,u)}function ne(k,L){var _=[j(),j(),j(),j()];ie(_[0],c),ie(_[1],g),ie(_[2],S),T(_[3],c,g),ee(k,_,L)}function ie(k,L){var _;for(_=0;_<16;_++)k[_]=L[_]|0}function de(k,L){var _=j(),u;for(u=0;u<16;++u)_[u]=L[u];for(u=253;u>=0;--u)qe(_,_),u!==2&&u!==4&&T(_,_,L);for(u=0;u<16;++u)k[u]=_[u]}function ge(k){var L,_,u=1;for(L=0;L<16;++L)_=k[L]+u+65535,u=Math.floor(_/65536),k[L]=_-u*65536;k[0]+=u-1+37*(u-1)}function le(k,L,_){for(var u,w=~(_-1),V=0;V<16;++V)u=w&(k[V]^L[V]),k[V]^=u,L[V]^=u}function j(k){var L,_=new Float64Array(16);if(k)for(L=0;L<k.length;++L)_[L]=k[L];return _}function $(k,L,_){for(var u=0;u<16;++u)k[u]=L[u]+_[u]}function ze(k,L,_){for(var u=0;u<16;++u)k[u]=L[u]-_[u]}function qe(k,L){T(k,L,L)}function T(k,L,_){var u,w,V=0,H=0,ae=0,te=0,z=0,Z=0,se=0,fe=0,oe=0,Ce=0,Te=0,Se=0,Ee=0,ye=0,ve=0,pe=0,Ie=0,Be=0,He=0,Ge=0,We=0,Ye=0,je=0,et=0,it=0,ot=0,dt=0,yt=0,Et=0,Lt=0,Yt=0,be=_[0],we=_[1],_e=_[2],Re=_[3],Ne=_[4],Le=_[5],ke=_[6],Ue=_[7],De=_[8],Pe=_[9],Ve=_[10],Oe=_[11],me=_[12],Ae=_[13],Me=_[14],Ke=_[15];u=L[0],V+=u*be,H+=u*we,ae+=u*_e,te+=u*Re,z+=u*Ne,Z+=u*Le,se+=u*ke,fe+=u*Ue,oe+=u*De,Ce+=u*Pe,Te+=u*Ve,Se+=u*Oe,Ee+=u*me,ye+=u*Ae,ve+=u*Me,pe+=u*Ke,u=L[1],H+=u*be,ae+=u*we,te+=u*_e,z+=u*Re,Z+=u*Ne,se+=u*Le,fe+=u*ke,oe+=u*Ue,Ce+=u*De,Te+=u*Pe,Se+=u*Ve,Ee+=u*Oe,ye+=u*me,ve+=u*Ae,pe+=u*Me,Ie+=u*Ke,u=L[2],ae+=u*be,te+=u*we,z+=u*_e,Z+=u*Re,se+=u*Ne,fe+=u*Le,oe+=u*ke,Ce+=u*Ue,Te+=u*De,Se+=u*Pe,Ee+=u*Ve,ye+=u*Oe,ve+=u*me,pe+=u*Ae,Ie+=u*Me,Be+=u*Ke,u=L[3],te+=u*be,z+=u*we,Z+=u*_e,se+=u*Re,fe+=u*Ne,oe+=u*Le,Ce+=u*ke,Te+=u*Ue,Se+=u*De,Ee+=u*Pe,ye+=u*Ve,ve+=u*Oe,pe+=u*me,Ie+=u*Ae,Be+=u*Me,He+=u*Ke,u=L[4],z+=u*be,Z+=u*we,se+=u*_e,fe+=u*Re,oe+=u*Ne,Ce+=u*Le,Te+=u*ke,Se+=u*Ue,Ee+=u*De,ye+=u*Pe,ve+=u*Ve,pe+=u*Oe,Ie+=u*me,Be+=u*Ae,He+=u*Me,Ge+=u*Ke,u=L[5],Z+=u*be,se+=u*we,fe+=u*_e,oe+=u*Re,Ce+=u*Ne,Te+=u*Le,Se+=u*ke,Ee+=u*Ue,ye+=u*De,ve+=u*Pe,pe+=u*Ve,Ie+=u*Oe,Be+=u*me,He+=u*Ae,Ge+=u*Me,We+=u*Ke,u=L[6],se+=u*be,fe+=u*we,oe+=u*_e,Ce+=u*Re,Te+=u*Ne,Se+=u*Le,Ee+=u*ke,ye+=u*Ue,ve+=u*De,pe+=u*Pe,Ie+=u*Ve,Be+=u*Oe,He+=u*me,Ge+=u*Ae,We+=u*Me,Ye+=u*Ke,u=L[7],fe+=u*be,oe+=u*we,Ce+=u*_e,Te+=u*Re,Se+=u*Ne,Ee+=u*Le,ye+=u*ke,ve+=u*Ue,pe+=u*De,Ie+=u*Pe,Be+=u*Ve,He+=u*Oe,Ge+=u*me,We+=u*Ae,Ye+=u*Me,je+=u*Ke,u=L[8],oe+=u*be,Ce+=u*we,Te+=u*_e,Se+=u*Re,Ee+=u*Ne,ye+=u*Le,ve+=u*ke,pe+=u*Ue,Ie+=u*De,Be+=u*Pe,He+=u*Ve,Ge+=u*Oe,We+=u*me,Ye+=u*Ae,je+=u*Me,et+=u*Ke,u=L[9],Ce+=u*be,Te+=u*we,Se+=u*_e,Ee+=u*Re,ye+=u*Ne,ve+=u*Le,pe+=u*ke,Ie+=u*Ue,Be+=u*De,He+=u*Pe,Ge+=u*Ve,We+=u*Oe,Ye+=u*me,je+=u*Ae,et+=u*Me,it+=u*Ke,u=L[10],Te+=u*be,Se+=u*we,Ee+=u*_e,ye+=u*Re,ve+=u*Ne,pe+=u*Le,Ie+=u*ke,Be+=u*Ue,He+=u*De,Ge+=u*Pe,We+=u*Ve,Ye+=u*Oe,je+=u*me,et+=u*Ae,it+=u*Me,ot+=u*Ke,u=L[11],Se+=u*be,Ee+=u*we,ye+=u*_e,ve+=u*Re,pe+=u*Ne,Ie+=u*Le,Be+=u*ke,He+=u*Ue,Ge+=u*De,We+=u*Pe,Ye+=u*Ve,je+=u*Oe,et+=u*me,it+=u*Ae,ot+=u*Me,dt+=u*Ke,u=L[12],Ee+=u*be,ye+=u*we,ve+=u*_e,pe+=u*Re,Ie+=u*Ne,Be+=u*Le,He+=u*ke,Ge+=u*Ue,We+=u*De,Ye+=u*Pe,je+=u*Ve,et+=u*Oe,it+=u*me,ot+=u*Ae,dt+=u*Me,yt+=u*Ke,u=L[13],ye+=u*be,ve+=u*we,pe+=u*_e,Ie+=u*Re,Be+=u*Ne,He+=u*Le,Ge+=u*ke,We+=u*Ue,Ye+=u*De,je+=u*Pe,et+=u*Ve,it+=u*Oe,ot+=u*me,dt+=u*Ae,yt+=u*Me,Et+=u*Ke,u=L[14],ve+=u*be,pe+=u*we,Ie+=u*_e,Be+=u*Re,He+=u*Ne,Ge+=u*Le,We+=u*ke,Ye+=u*Ue,je+=u*De,et+=u*Pe,it+=u*Ve,ot+=u*Oe,dt+=u*me,yt+=u*Ae,Et+=u*Me,Lt+=u*Ke,u=L[15],pe+=u*be,Ie+=u*we,Be+=u*_e,He+=u*Re,Ge+=u*Ne,We+=u*Le,Ye+=u*ke,je+=u*Ue,et+=u*De,it+=u*Pe,ot+=u*Ve,dt+=u*Oe,yt+=u*me,Et+=u*Ae,Lt+=u*Me,Yt+=u*Ke,V+=38*Ie,H+=38*Be,ae+=38*He,te+=38*Ge,z+=38*We,Z+=38*Ye,se+=38*je,fe+=38*et,oe+=38*it,Ce+=38*ot,Te+=38*dt,Se+=38*yt,Ee+=38*Et,ye+=38*Lt,ve+=38*Yt,w=1,u=V+w+65535,w=Math.floor(u/65536),V=u-w*65536,u=H+w+65535,w=Math.floor(u/65536),H=u-w*65536,u=ae+w+65535,w=Math.floor(u/65536),ae=u-w*65536,u=te+w+65535,w=Math.floor(u/65536),te=u-w*65536,u=z+w+65535,w=Math.floor(u/65536),z=u-w*65536,u=Z+w+65535,w=Math.floor(u/65536),Z=u-w*65536,u=se+w+65535,w=Math.floor(u/65536),se=u-w*65536,u=fe+w+65535,w=Math.floor(u/65536),fe=u-w*65536,u=oe+w+65535,w=Math.floor(u/65536),oe=u-w*65536,u=Ce+w+65535,w=Math.floor(u/65536),Ce=u-w*65536,u=Te+w+65535,w=Math.floor(u/65536),Te=u-w*65536,u=Se+w+65535,w=Math.floor(u/65536),Se=u-w*65536,u=Ee+w+65535,w=Math.floor(u/65536),Ee=u-w*65536,u=ye+w+65535,w=Math.floor(u/65536),ye=u-w*65536,u=ve+w+65535,w=Math.floor(u/65536),ve=u-w*65536,u=pe+w+65535,w=Math.floor(u/65536),pe=u-w*65536,V+=w-1+37*(w-1),w=1,u=V+w+65535,w=Math.floor(u/65536),V=u-w*65536,u=H+w+65535,w=Math.floor(u/65536),H=u-w*65536,u=ae+w+65535,w=Math.floor(u/65536),ae=u-w*65536,u=te+w+65535,w=Math.floor(u/65536),te=u-w*65536,u=z+w+65535,w=Math.floor(u/65536),z=u-w*65536,u=Z+w+65535,w=Math.floor(u/65536),Z=u-w*65536,u=se+w+65535,w=Math.floor(u/65536),se=u-w*65536,u=fe+w+65535,w=Math.floor(u/65536),fe=u-w*65536,u=oe+w+65535,w=Math.floor(u/65536),oe=u-w*65536,u=Ce+w+65535,w=Math.floor(u/65536),Ce=u-w*65536,u=Te+w+65535,w=Math.floor(u/65536),Te=u-w*65536,u=Se+w+65535,w=Math.floor(u/65536),Se=u-w*65536,u=Ee+w+65535,w=Math.floor(u/65536),Ee=u-w*65536,u=ye+w+65535,w=Math.floor(u/65536),ye=u-w*65536,u=ve+w+65535,w=Math.floor(u/65536),ve=u-w*65536,u=pe+w+65535,w=Math.floor(u/65536),pe=u-w*65536,V+=w-1+37*(w-1),k[0]=V,k[1]=H,k[2]=ae,k[3]=te,k[4]=z,k[5]=Z,k[6]=se,k[7]=fe,k[8]=oe,k[9]=Ce,k[10]=Te,k[11]=Se,k[12]=Ee,k[13]=ye,k[14]=ve,k[15]=pe}return Gr}var zr,un;function gi(){if(un)return zr;un=1;var t=ue();ce(),Je(),Ht(),zr=t.kem=t.kem||{};var e=t.jsbn.BigInteger;t.kem.rsa={},t.kem.rsa.create=function(o,E){E=E||{};var y=E.prng||t.random,f={};return f.encrypt=function(a,p){var l=Math.ceil(a.n.bitLength()/8),S;do S=new e(t.util.bytesToHex(y.getBytesSync(l)),16).mod(a.n);while(S.compareTo(e.ONE)<=0);S=t.util.hexToBytes(S.toString(16));var R=l-S.length;R>0&&(S=t.util.fillString("\0",R)+S);var x=a.encrypt(S,"NONE"),c=o.generate(S,p);return{encapsulation:x,key:c}},f.decrypt=function(a,p,l){var S=a.decrypt(p,"NONE");return o.generate(S,l)},f},t.kem.kdf1=function(o,E){r(this,o,0,E||o.digestLength)},t.kem.kdf2=function(o,E){r(this,o,1,E||o.digestLength)};function r(o,E,y,f){o.generate=function(a,p){for(var l=new t.util.ByteBuffer,S=Math.ceil(p/f)+y,R=new t.util.ByteBuffer,x=y;x<S;++x){R.putInt32(x),E.start(),E.update(a+R.getBytes());var c=E.digest();l.putBytes(c.getBytes(f))}return l.truncate(l.length()-p),l.getBytes()}}return zr}var Qr,ln;function vi(){if(ln)return Qr;ln=1;var t=ue();ce(),Qr=t.log=t.log||{},t.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},r=[],o=null;t.log.LEVEL_LOCKED=2,t.log.NO_LEVEL_CHECK=4,t.log.INTERPOLATE=8;for(var E=0;E<t.log.levels.length;++E){var y=t.log.levels[E];e[y]={index:E,name:y.toUpperCase()}}t.log.logMessage=function(x){for(var c=e[x.level].index,g=0;g<r.length;++g){var C=r[g];if(C.flags&t.log.NO_LEVEL_CHECK)C.f(x);else{var m=e[C.level].index;c<=m&&C.f(C,x)}}},t.log.prepareStandard=function(x){"standard"in x||(x.standard=e[x.level].name+" ["+x.category+"] "+x.message)},t.log.prepareFull=function(x){if(!("full"in x)){var c=[x.message];c=c.concat([]),x.full=t.util.format.apply(this,c)}},t.log.prepareStandardFull=function(x){"standardFull"in x||(t.log.prepareStandard(x),x.standardFull=x.standard)};for(var f=["error","warning","info","debug","verbose"],E=0;E<f.length;++E)(function(c){t.log[c]=function(g,C){var m=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:c,category:g,message:C,arguments:m};t.log.logMessage(i)}})(f[E]);if(t.log.makeLogger=function(x){var c={flags:0,f:x};return t.log.setLevel(c,"none"),c},t.log.setLevel=function(x,c){var g=!1;if(x&&!(x.flags&t.log.LEVEL_LOCKED))for(var C=0;C<t.log.levels.length;++C){var m=t.log.levels[C];if(c==m){x.level=c,g=!0;break}}return g},t.log.lock=function(x,c){typeof c>"u"||c?x.flags|=t.log.LEVEL_LOCKED:x.flags&=~t.log.LEVEL_LOCKED},t.log.addLogger=function(x){r.push(x)},typeof console<"u"&&"log"in console){var a;if(console.error&&console.warn&&console.info&&console.debug){var p={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},l=function(x,c){t.log.prepareStandard(c);var g=p[c.level],C=[c.standard];C=C.concat(c.arguments.slice()),g.apply(console,C)};a=t.log.makeLogger(l)}else{var l=function(c,g){t.log.prepareStandardFull(g),console.log(g.standardFull)};a=t.log.makeLogger(l)}t.log.setLevel(a,"debug"),t.log.addLogger(a),o=a}else console={log:function(){}};if(o!==null&&typeof window<"u"&&window.location){var S=new URL(window.location.href).searchParams;if(S.has("console.level")&&t.log.setLevel(o,S.get("console.level").slice(-1)[0]),S.has("console.lock")){var R=S.get("console.lock").slice(-1)[0];R=="true"&&t.log.lock(o)}}return t.log.consoleLogger=o,Qr}var Wr,fn;function yi(){return fn||(fn=1,Wr=st(),Cr(),Nt(),wa(),nn()),Wr}var Yr={exports:{}},cn;function mi(){if(cn)return Yr.exports;cn=1;var t=ue();gt(),nt(),Ft(),vt(),Ct(),Ga(),Je(),ce(),Fr();var e=t.asn1,r=Yr.exports=t.pkcs7=t.pkcs7||{};r.messageFromPem=function(c){var g=t.pem.decode(c)[0];if(g.type!=="PKCS7"){var C=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw C.headerType=g.type,C}if(g.procType&&g.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var m=e.fromDer(g.body);return r.messageFromAsn1(m)},r.messageToPem=function(c,g){var C={type:"PKCS7",body:e.toDer(c.toAsn1()).getBytes()};return t.pem.encode(C,{maxline:g})},r.messageFromAsn1=function(c){var g={},C=[];if(!e.validate(c,r.asn1.contentInfoValidator,g,C)){var m=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw m.errors=C,m}var i=e.derToOid(g.contentType),h;switch(i){case t.pki.oids.envelopedData:h=r.createEnvelopedData();break;case t.pki.oids.encryptedData:h=r.createEncryptedData();break;case t.pki.oids.signedData:h=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return h.fromAsn1(g.content.value[0]),h},r.createSignedData=function(){var c=null;return c={type:t.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(m){if(R(c,m,r.asn1.signedDataValidator),c.certificates=[],c.crls=[],c.digestAlgorithmIdentifiers=[],c.contentInfo=null,c.signerInfos=[],c.rawCapture.certificates)for(var i=c.rawCapture.certificates.value,h=0;h<i.length;++h)c.certificates.push(t.pki.certificateFromAsn1(i[h]))},toAsn1:function(){c.contentInfo||c.sign();for(var m=[],i=0;i<c.certificates.length;++i)m.push(t.pki.certificateToAsn1(c.certificates[i]));var h=[],v=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(c.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,c.digestAlgorithmIdentifiers),c.contentInfo])]);return m.length>0&&v.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,m)),h.length>0&&v.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,h)),v.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,c.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.type).getBytes()),v])},addSigner:function(m){var i=m.issuer,h=m.serialNumber;if(m.certificate){var v=m.certificate;typeof v=="string"&&(v=t.pki.certificateFromPem(v)),i=v.issuer.attributes,h=v.serialNumber}var I=m.key;if(!I)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof I=="string"&&(I=t.pki.privateKeyFromPem(I));var N=m.digestAlgorithm||t.pki.oids.sha1;switch(N){case t.pki.oids.sha1:case t.pki.oids.sha256:case t.pki.oids.sha384:case t.pki.oids.sha512:case t.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+N)}var d=m.authenticatedAttributes||[];if(d.length>0){for(var s=!1,n=!1,B=0;B<d.length;++B){var U=d[B];if(!s&&U.type===t.pki.oids.contentType){if(s=!0,n)break;continue}if(!n&&U.type===t.pki.oids.messageDigest){if(n=!0,s)break;continue}}if(!s||!n)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.")}c.signers.push({key:I,version:1,issuer:i,serialNumber:h,digestAlgorithm:N,signatureAlgorithm:t.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:d,unauthenticatedAttributes:[]})},sign:function(m){if(m=m||{},(typeof c.content!="object"||c.contentInfo===null)&&(c.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes())]),"content"in c)){var i;c.content instanceof t.util.ByteBuffer?i=c.content.bytes():typeof c.content=="string"&&(i=t.util.encodeUtf8(c.content)),m.detached?c.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i):c.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,i)]))}if(c.signers.length!==0){var h=g();C(h)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(m){typeof m=="string"&&(m=t.pki.certificateFromPem(m)),c.certificates.push(m)},addCertificateRevokationList:function(m){throw new Error("PKCS#7 CRL support not yet implemented.")}},c;function g(){for(var m={},i=0;i<c.signers.length;++i){var h=c.signers[i],v=h.digestAlgorithm;v in m||(m[v]=t.md[t.pki.oids[v]].create()),h.authenticatedAttributes.length===0?h.md=m[v]:h.md=t.md[t.pki.oids[v]].create()}c.digestAlgorithmIdentifiers=[];for(var v in m)c.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(v).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return m}function C(m){var i;if(c.detachedContent?i=c.detachedContent:(i=c.contentInfo.value[1],i=i.value[0]),!i)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var h=e.derToOid(c.contentInfo.value[0].value),v=e.toDer(i);v.getByte(),e.getBerValueLength(v),v=v.getBytes();for(var I in m)m[I].start().update(v);for(var N=new Date,d=0;d<c.signers.length;++d){var s=c.signers[d];if(s.authenticatedAttributes.length===0){if(h!==t.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{s.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var n=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),B=0;B<s.authenticatedAttributes.length;++B){var U=s.authenticatedAttributes[B];U.type===t.pki.oids.messageDigest?U.value=m[s.digestAlgorithm].digest():U.type===t.pki.oids.signingTime&&(U.value||(U.value=N)),n.value.push(l(U)),s.authenticatedAttributesAsn1.value.push(l(U))}v=e.toDer(n).getBytes(),s.md.start().update(v)}s.signature=s.key.sign(s.md,"RSASSA-PKCS1-V1_5")}c.signerInfos=p(c.signers)}},r.createEncryptedData=function(){var c=null;return c={type:t.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(g){R(c,g,r.asn1.encryptedDataValidator)},decrypt:function(g){g!==void 0&&(c.encryptedContent.key=g),x(c)}},c},r.createEnvelopedData=function(){var c=null;return c={type:t.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(g){var C=R(c,g,r.asn1.envelopedDataValidator);c.recipients=y(C.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(c.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(c.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,f(c.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,S(c.encryptedContent))])])])},findRecipient:function(g){for(var C=g.issuer.attributes,m=0;m<c.recipients.length;++m){var i=c.recipients[m],h=i.issuer;if(i.serialNumber===g.serialNumber&&h.length===C.length){for(var v=!0,I=0;I<C.length;++I)if(h[I].type!==C[I].type||h[I].value!==C[I].value){v=!1;break}if(v)return i}}return null},decrypt:function(g,C){if(c.encryptedContent.key===void 0&&g!==void 0&&C!==void 0)switch(g.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:case t.pki.oids.desCBC:var m=C.decrypt(g.encryptedContent.content);c.encryptedContent.key=t.util.createBuffer(m);break;default:throw new Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm)}x(c)},addRecipient:function(g){c.recipients.push({version:0,issuer:g.issuer.attributes,serialNumber:g.serialNumber,encryptedContent:{algorithm:t.pki.oids.rsaEncryption,key:g.publicKey}})},encrypt:function(g,C){if(c.encryptedContent.content===void 0){C=C||c.encryptedContent.algorithm,g=g||c.encryptedContent.key;var m,i,h;switch(C){case t.pki.oids["aes128-CBC"]:m=16,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes192-CBC"]:m=24,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes256-CBC"]:m=32,i=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["des-EDE3-CBC"]:m=24,i=8,h=t.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+C)}if(g===void 0)g=t.util.createBuffer(t.random.getBytes(m));else if(g.length()!=m)throw new Error("Symmetric key has wrong length; got "+g.length()+" bytes, expected "+m+".");c.encryptedContent.algorithm=C,c.encryptedContent.key=g,c.encryptedContent.parameter=t.util.createBuffer(t.random.getBytes(i));var v=h(g);if(v.start(c.encryptedContent.parameter.copy()),v.update(c.content),!v.finish())throw new Error("Symmetric encryption failed.");c.encryptedContent.content=v.output}for(var I=0;I<c.recipients.length;++I){var N=c.recipients[I];if(N.encryptedContent.content===void 0)switch(N.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:N.encryptedContent.content=N.encryptedContent.key.encrypt(c.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+N.encryptedContent.algorithm)}}}},c};function o(c){var g={},C=[];if(!e.validate(c,r.asn1.recipientInfoValidator,g,C)){var m=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw m.errors=C,m}return{version:g.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(g.issuer),serialNumber:t.util.createBuffer(g.serial).toHex(),encryptedContent:{algorithm:e.derToOid(g.encAlgorithm),parameter:g.encParameter?g.encParameter.value:void 0,content:g.encKey}}}function E(c){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:c.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.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.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c.encryptedContent.content)])}function y(c){for(var g=[],C=0;C<c.length;++C)g.push(o(c[C]));return g}function f(c){for(var g=[],C=0;C<c.length;++C)g.push(E(c[C]));return g}function a(c){var g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:c.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.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.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(c.authenticatedAttributesAsn1&&g.value.push(c.authenticatedAttributesAsn1),g.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),g.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c.signature)),c.unauthenticatedAttributes.length>0){for(var C=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),m=0;m<c.unauthenticatedAttributes.length;++m){var i=c.unauthenticatedAttributes[m];C.values.push(l(i))}g.value.push(C)}return g}function p(c){for(var g=[],C=0;C<c.length;++C)g.push(a(c[C]));return g}function l(c){var g;if(c.type===t.pki.oids.contentType)g=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.value).getBytes());else if(c.type===t.pki.oids.messageDigest)g=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c.value.bytes());else if(c.type===t.pki.oids.signingTime){var C=new Date("1950-01-01T00:00:00Z"),m=new Date("2050-01-01T00:00:00Z"),i=c.value;if(typeof i=="string"){var h=Date.parse(i);isNaN(h)?i.length===13?i=e.utcTimeToDate(i):i=e.generalizedTimeToDate(i):i=new Date(h)}i>=C&&i<m?g=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(i)):g=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(i))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[g])])}function S(c){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.algorithm).getBytes()),c.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,c.content.getBytes())])]}function R(c,g,C){var m={},i=[];if(!e.validate(g,C,m,i)){var h=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw h.errors=h,h}var v=e.derToOid(m.contentType);if(v!==t.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(m.encryptedContent){var I="";if(t.util.isArray(m.encryptedContent))for(var N=0;N<m.encryptedContent.length;++N){if(m.encryptedContent[N].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");I+=m.encryptedContent[N].value}else I=m.encryptedContent;c.encryptedContent={algorithm:e.derToOid(m.encAlgorithm),parameter:t.util.createBuffer(m.encParameter.value),content:t.util.createBuffer(I)}}if(m.content){var I="";if(t.util.isArray(m.content))for(var N=0;N<m.content.length;++N){if(m.content[N].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");I+=m.content[N].value}else I=m.content;c.content=t.util.createBuffer(I)}return c.version=m.version.charCodeAt(0),c.rawCapture=m,m}function x(c){if(c.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(c.content===void 0){var g;switch(c.encryptedContent.algorithm){case t.pki.oids["aes128-CBC"]:case t.pki.oids["aes192-CBC"]:case t.pki.oids["aes256-CBC"]:g=t.aes.createDecryptionCipher(c.encryptedContent.key);break;case t.pki.oids.desCBC:case t.pki.oids["des-EDE3-CBC"]:g=t.des.createDecryptionCipher(c.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+c.encryptedContent.algorithm)}if(g.start(c.encryptedContent.parameter),g.update(c.encryptedContent.content),!g.finish())throw new Error("Symmetric decryption failed.");c.content=g.output}}return Yr.exports}var Xr={exports:{}},dn;function Ci(){if(dn)return Xr.exports;dn=1;var t=ue();gt(),Rt(),Cr(),Nt(),ce();var e=Xr.exports=t.ssh=t.ssh||{};e.privateKeyToPutty=function(y,f,a){a=a||"",f=f||"";var p="ssh-rsa",l=f===""?"none":"aes256-cbc",S="PuTTY-User-Key-File-2: "+p+`\r
|
|
15
|
-
`;S+="Encryption: "+l+`\r
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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={showLoadingUI:!0,progressiveLoad:!1,position:[0,0,0],rotation:this.getDefaultRotation(),scale:[1,1,1],...t};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=!0){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.10.8"}.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:e.showLoadingUI??!0,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,{showLoadingUI:!0,...t,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,{showLoadingUI:!0,...t,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"})}));
|