iflow-engine-base 3.10.6 → 3.10.7
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 +672 -2837
- package/dist/chunks/{engine-2d-D1Kycjix.js → engine-2d-DsaDpJPQ.js} +2 -2
- package/dist/chunks/{engine-3d-C_tGnniz.js → engine-3d-XJ7zBlLL.js} +5137 -7716
- package/dist/chunks/{engine-720-zpIs5x51.js → engine-720-CZj_sSsS.js} +2 -2
- package/dist/chunks/{engine-gaussian-DMNp2sgc.js → engine-gaussian-CX0k_s78.js} +2 -2
- package/dist/chunks/{engine-gis-DBokizAn.js → engine-gis-N6XH8qUs.js} +2 -2
- package/dist/chunks/{sdk-runtime-DWNcrQfl.js → sdk-runtime-DTY-QKTD.js} +2 -2
- package/dist/index.d.ts +5 -142
- package/dist/prompt/prompt.ts +201 -0
- package/dist2d/dwg-preview.es.js +1 -1
- package/dist2d/dwg-preview.umd.js +1 -1
- package/distGaussian/gaussian.es.js +1 -1
- package/distGaussian/gaussian.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
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.6"}.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
|
|
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
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
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
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+=`
|